- extended evcontroller
- remote objects - new ev drivers for oxford IPS,ITC,ILM and LC M.Z. SKIPPED: psi/eve.c psi/eve.h psi/fsm.c psi/fsm.h psi/ilmdriv.c psi/ipsdriv.c psi/itcdriv.c psi/lcdriv.c psi/logger.c psi/logger.h psi/make_gen psi/oicom.c psi/oicom.h psi/psi.c psi/remob.c psi/remob.h psi/tecs/didi psi/tecs/make_crv.tcsh psi/tecs/make_gen psi/tecs/myc_buf.c psi/tecs/six.c psi/tecs/tecs.c psi/tecs/tecs_client.f psi/tecs/tecs_plot.f psi/tecs/term.c psi/tecs/pg_plus/xwdriv.c
This commit is contained in:
93
devexec.c
93
devexec.c
@ -105,6 +105,7 @@
|
||||
long lTask;
|
||||
pTaskMan pTask;
|
||||
int iLock;
|
||||
pICallBack pCall;
|
||||
} ExeList;
|
||||
|
||||
static pExeList pExecutor = NULL;
|
||||
@ -139,6 +140,7 @@
|
||||
pRes->pTask = pTask;
|
||||
pRes->lTask = -1;
|
||||
pRes->iLock = 0;
|
||||
pRes->pCall = CreateCallBackInterface();
|
||||
return pRes;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@ -153,9 +155,21 @@
|
||||
DeleteDescriptor(self->pDes);
|
||||
ClearExecutor(self);
|
||||
LLDdelete(self->iList);
|
||||
if(self->pCall)
|
||||
DeleteCallBackInterface(self->pCall);
|
||||
|
||||
free(self);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void ExeInterest(pExeList self, pDevEntry pDev, char *text) {
|
||||
char buf[128];
|
||||
|
||||
if(pDev)
|
||||
{
|
||||
snprintf(buf, sizeof(buf),"%s %s",pDev->name,text);
|
||||
InvokeCallBack(self->pCall, DRIVSTAT, buf);
|
||||
}
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
void *pData, SConnection *pCon, float fNew)
|
||||
@ -220,6 +234,7 @@
|
||||
if(iRet == OKOK)
|
||||
{
|
||||
LLDnodeAppendFrom(self->iList,&pNew);
|
||||
ExeInterest(self, pNew, "started");
|
||||
self->iRun = 1;
|
||||
self->iStatus = DEVDONE;
|
||||
/* if no task: start it */
|
||||
@ -388,6 +403,7 @@
|
||||
{
|
||||
pDrivInt->iErrorCount = 0;
|
||||
}
|
||||
ExeInterest(self, pDev, "finished");
|
||||
DeleteDevEntry(pDev);
|
||||
LLDnodeDelete(self->iList);
|
||||
iRet = LLDnodePtr2Prev(self->iList);
|
||||
@ -399,6 +415,7 @@
|
||||
self->iStatus = DEVDONE;
|
||||
break;
|
||||
case HWFault: /* real HW error: burning, no net etc.. */
|
||||
ExeInterest(self, pDev, "finished with problem");
|
||||
DeleteDevEntry(pDev);
|
||||
LLDnodeDelete(self->iList);
|
||||
self->iStatus = DEVERROR;
|
||||
@ -446,6 +463,7 @@
|
||||
self->iStatus = DEVBUSY;
|
||||
break;
|
||||
case HWPosFault: /* cannot get somewhere... */
|
||||
ExeInterest(self, pDev, "finished with problem");
|
||||
DeleteDevEntry(pDev);
|
||||
LLDnodeDelete(self->iList);
|
||||
self->iStatus = DEVERROR;
|
||||
@ -561,23 +579,23 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
check for stop flag. This is to stop unnecessary calls to StopExe.
|
||||
There may be way to many, but each call is reasonable under certain
|
||||
circumstances.
|
||||
*/
|
||||
if(self->iStop == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->iStop = 1;
|
||||
}
|
||||
|
||||
/* first the ALL case */
|
||||
if(strcmp(name,"all") == 0)
|
||||
{
|
||||
/*
|
||||
check for stop flag. This is to stop unnecessary calls to StopExe.
|
||||
There may be way to many, but each call is reasonable under certain
|
||||
circumstances.
|
||||
*/
|
||||
if(self->iStop == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->iStop = 1;
|
||||
}
|
||||
|
||||
iRet = LLDnodePtr2First(self->iList);
|
||||
while(iRet != 0)
|
||||
{
|
||||
@ -796,12 +814,48 @@
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
}
|
||||
/*------------------- The CallBack function for interest ------------------*/
|
||||
static int DrivStatCallback(int iEvent, void *text, void *pCon)
|
||||
{
|
||||
assert(pCon);
|
||||
assert(text);
|
||||
|
||||
SCWrite(pCon, text, eValue);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ListExe(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
return ListPending((pExeList)pData,pCon);
|
||||
pExeList self = NULL;
|
||||
int list;
|
||||
|
||||
if (argc == 1) {
|
||||
return ListPending((pExeList)pData,pCon);
|
||||
}
|
||||
argtolower(argc,argv);
|
||||
self = (pExeList)pData;
|
||||
assert(self);
|
||||
if (argc == 2) {
|
||||
if (strcmp(argv[1], "interest") == 0)
|
||||
{
|
||||
list = RegisterCallback(self->pCall, DRIVSTAT, DrivStatCallback,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon, pSics, self->pCall,list);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(argv[1], "uninterest") == 0)
|
||||
{
|
||||
RemoveCallback2(self->pCall, pCon);
|
||||
SCUnregister(pCon, self->pCall);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
SCWrite(pCon, "ERROR: illegal arguments for ListExe", eError);
|
||||
return 0;
|
||||
}
|
||||
/*--------------------------------------------------------------------------
|
||||
Usage:
|
||||
@ -927,12 +981,17 @@
|
||||
iInterrupt = SCGetInterrupt(self->pOwner);
|
||||
if(iInterrupt != eContinue)
|
||||
{
|
||||
SCWrite(self->pOwner,pBueffel, eError);
|
||||
if(iInterrupt > 1)
|
||||
{
|
||||
/* M.Z: it seems that this warning is redundant
|
||||
a) because it was erroenous
|
||||
b) it would be emitted for every driveable obj to be stopped
|
||||
|
||||
Interrupt2Text(iInterrupt,pInterrupt,79);
|
||||
snprintf(pBueffel,131,"ERROR: interrupt %s triggered",
|
||||
pInterrupt);
|
||||
SCWrite(self->pOwner,pBueffel, eError);
|
||||
*/
|
||||
StopExe(self,"all");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
Reference in New Issue
Block a user