- SCStore store now also context and macro state

This commit is contained in:
zolliker
2008-01-18 07:20:54 +00:00
parent 6b27a73491
commit 3de3efd407

View File

@ -100,7 +100,7 @@
self->start = time(NULL); self->start = time(NULL);
self->lastt = 0; self->lastt = 0;
self->iWarned = 0; self->iWarned = 0;
SCSave(&self->conn, pCon); self->conn = SCSave(pCon, self->conn);
/* try at least three times to do it */ /* try at least three times to do it */
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
@ -376,7 +376,7 @@
} }
/*---------------------------- Error Handlers --------------------------------*/ /*---------------------------- Error Handlers --------------------------------*/
static void ErrWrite(char *txt, SCStore *conn) static void ErrWrite(char *txt, SCStore conn)
{ {
pExeList pExe; pExeList pExe;
SConnection *pCon = NULL; SConnection *pCon = NULL;
@ -384,17 +384,15 @@ static void ErrWrite(char *txt, SCStore *conn)
pExe = GetExecutor(); pExe = GetExecutor();
pCon = GetExeOwner(pExe); pCon = GetExeOwner(pExe);
if (!pCon) if (pCon)
{ {
pCon = SCLoad(conn); SCWrite(pCon,txt,eWarning);
} }
if(pCon)
{
SCWrite(pCon,txt,eWarning);
}
else else
{ {
ServerWriteGlobal(txt,eWarning); pCon = SCStorePush(conn);
SCWrite(pCon, txt, eWarning);
SCStorePop(conn);
} }
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
@ -408,7 +406,7 @@ static void ErrReport(pEVControl self)
{ {
sprintf(pBueffel,"WARNING: %s is out of range by %g", sprintf(pBueffel,"WARNING: %s is out of range by %g",
self->pName,fDelta); self->pName,fDelta);
ErrWrite(pBueffel, &self->conn); ErrWrite(pBueffel, self->conn);
self->iWarned = 1; self->iWarned = 1;
} }
} }
@ -481,7 +479,7 @@ static void ErrReport(pEVControl self)
snprintf(pBueffel,255, snprintf(pBueffel,255,
"ERROR: %s while processing errorscript for %s", "ERROR: %s while processing errorscript for %s",
pTcl->result,self->pName); pTcl->result,self->pName);
ErrWrite(pBueffel, &self->conn); ErrWrite(pBueffel, self->conn);
} }
/* /*
assume that everything is fine again after the script assume that everything is fine again after the script
@ -495,7 +493,7 @@ static void ErrReport(pEVControl self)
snprintf(pBueffel,255, snprintf(pBueffel,255,
"ERROR: script error handling requested for %s, but no script given", "ERROR: script error handling requested for %s, but no script given",
self->pName); self->pName);
ErrWrite(pBueffel, &self->conn); ErrWrite(pBueffel, self->conn);
} }
return 1; return 1;
@ -525,7 +523,7 @@ static void ErrReport(pEVControl self)
ErrReport(self); ErrReport(self);
ErrWrite("Running to safe value", &self->conn); ErrWrite("Running to safe value", self->conn);
self->pDriv->SetValue(self->pDriv, ObVal(self->pParam,SAFEVALUE)); self->pDriv->SetValue(self->pDriv, ObVal(self->pParam,SAFEVALUE));
self->eMode = EVIdle; self->eMode = EVIdle;
self->iWarned = 0; self->iWarned = 0;
@ -617,7 +615,7 @@ static void ErrReport(pEVControl self)
{ {
sprintf(pBueffel,"Environment device %s back in tolerances again", sprintf(pBueffel,"Environment device %s back in tolerances again",
self->pName); self->pName);
ErrWrite(pBueffel, &self->conn); ErrWrite(pBueffel, self->conn);
self->iWarned = 0; self->iWarned = 0;
} }
return 1; return 1;
@ -798,6 +796,7 @@ static void ErrReport(pEVControl self)
pRes->pName = strdup(pName); pRes->pName = strdup(pName);
pRes->eMode = EVIdle; pRes->eMode = EVIdle;
pRes->iWarned = 0; pRes->iWarned = 0;
pRes->conn = NULL;
/* a terminal error gives a -1 in iRet */ /* a terminal error gives a -1 in iRet */
if(iRet < 0) if(iRet < 0)
@ -870,6 +869,10 @@ static void ErrReport(pEVControl self)
{ {
free(self->runScript); free(self->runScript);
} }
if (self->conn != NULL)
{
SCStoreFree(self->conn);
}
free(self); free(self);
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/