- Cleaned all old dtatus setting code
This commit is contained in:
8
conman.c
8
conman.c
@ -1521,8 +1521,6 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
|
|||||||
|
|
||||||
SCWrite(pCon, pPrompt, eWarning);
|
SCWrite(pCon, pPrompt, eWarning);
|
||||||
master = SCfindMaster(pCon);
|
master = SCfindMaster(pCon);
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eInput);
|
|
||||||
CostaUnlock(master->pStack);
|
CostaUnlock(master->pStack);
|
||||||
while (1) {
|
while (1) {
|
||||||
/*
|
/*
|
||||||
@ -1542,14 +1540,12 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
|
|||||||
/* do we have data ? */
|
/* do we have data ? */
|
||||||
iRet = CostaPop(master->pStack, &pPtr);
|
iRet = CostaPop(master->pStack, &pPtr);
|
||||||
if (iRet == 1) {
|
if (iRet == 1) {
|
||||||
SetStatus(eOld);
|
|
||||||
CostaLock(master->pStack);
|
CostaLock(master->pStack);
|
||||||
strlcpy(pResult, pPtr, iLen);
|
strlcpy(pResult, pPtr, iLen);
|
||||||
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
|
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetStatus(eOld);
|
|
||||||
CostaLock(master->pStack);
|
CostaLock(master->pStack);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1570,8 +1566,6 @@ int SCPromptTMO(SConnection * pCon, char *pPrompt, char *pResult, int iLen, int
|
|||||||
|
|
||||||
SCWrite(pCon, pPrompt, eWarning);
|
SCWrite(pCon, pPrompt, eWarning);
|
||||||
master = SCfindMaster(pCon);
|
master = SCfindMaster(pCon);
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eInput);
|
|
||||||
CostaUnlock(master->pStack);
|
CostaUnlock(master->pStack);
|
||||||
for(i = 0; i < timeout; i++) {
|
for(i = 0; i < timeout; i++) {
|
||||||
/*
|
/*
|
||||||
@ -1591,14 +1585,12 @@ int SCPromptTMO(SConnection * pCon, char *pPrompt, char *pResult, int iLen, int
|
|||||||
/* do we have data ? */
|
/* do we have data ? */
|
||||||
iRet = CostaPop(master->pStack, &pPtr);
|
iRet = CostaPop(master->pStack, &pPtr);
|
||||||
if (iRet == 1) {
|
if (iRet == 1) {
|
||||||
SetStatus(eOld);
|
|
||||||
CostaLock(master->pStack);
|
CostaLock(master->pStack);
|
||||||
strlcpy(pResult, pPtr, iLen);
|
strlcpy(pResult, pPtr, iLen);
|
||||||
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
|
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetStatus(eOld);
|
|
||||||
CostaLock(master->pStack);
|
CostaLock(master->pStack);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -409,8 +409,6 @@ int DoCount(pCounter self, float fPreset, SConnection * pCon, int iBlock)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eCounting);
|
|
||||||
|
|
||||||
/* set Preset */
|
/* set Preset */
|
||||||
SetCounterPreset(self, fPreset);
|
SetCounterPreset(self, fPreset);
|
||||||
@ -423,7 +421,6 @@ int DoCount(pCounter self, float fPreset, SConnection * pCon, int iBlock)
|
|||||||
iRet = StartDevice(GetExecutor(), self->name, self->pDes, self, pCon,
|
iRet = StartDevice(GetExecutor(), self->name, self->pDes, self, pCon,
|
||||||
level, fPreset);
|
level, fPreset);
|
||||||
if (!iRet) {
|
if (!iRet) {
|
||||||
SetStatus(eOld);
|
|
||||||
SCWrite(pCon, "Counting aborted", eError);
|
SCWrite(pCon, "Counting aborted", eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -444,7 +441,6 @@ int DoCount(pCounter self, float fPreset, SConnection * pCon, int iBlock)
|
|||||||
SCWrite(pCon, "Counting finished", eValue);
|
SCWrite(pCon, "Counting finished", eValue);
|
||||||
iRet = 1;
|
iRet = 1;
|
||||||
}
|
}
|
||||||
SetStatus(eOld);
|
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
@ -295,7 +295,6 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
|||||||
taskID = StartDriveTask(pData, pCon, name, fNew);
|
taskID = StartDriveTask(pData, pCon, name, fNew);
|
||||||
if(taskID > 0 && self->instStatus != eCounting){
|
if(taskID > 0 && self->instStatus != eCounting){
|
||||||
self->instStatus = eDriving;
|
self->instStatus = eDriving;
|
||||||
SetStatus(eDriving);
|
|
||||||
}
|
}
|
||||||
if(taskID > 0 && self->drivePrint == 1){
|
if(taskID > 0 && self->drivePrint == 1){
|
||||||
oldVal = pDrivInt->GetValue(pData, pCon);
|
oldVal = pDrivInt->GetValue(pData, pCon);
|
||||||
@ -307,7 +306,6 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
|||||||
taskID = StartCountTask(pData,pCon,name);
|
taskID = StartCountTask(pData,pCon,name);
|
||||||
if(taskID > 0){
|
if(taskID > 0){
|
||||||
self->instStatus = eCounting;
|
self->instStatus = eCounting;
|
||||||
SetStatus(eCounting);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SCPrintf(pCon,eLogError, "ERROR: type unkonw, cannot start %s", name);
|
SCPrintf(pCon,eLogError, "ERROR: type unkonw, cannot start %s", name);
|
||||||
@ -530,7 +528,6 @@ int PauseExecution(pExeList self)
|
|||||||
if(IsCounting(self)){
|
if(IsCounting(self)){
|
||||||
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->waitID);
|
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->waitID);
|
||||||
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->runID);
|
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->runID);
|
||||||
SetStatus(ePaused);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -559,7 +556,6 @@ int ContinueExecution(pExeList self)
|
|||||||
if(GetStatus() == ePaused){
|
if(GetStatus() == ePaused){
|
||||||
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->waitID);
|
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->waitID);
|
||||||
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->runID);
|
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->runID);
|
||||||
SetStatus(eCounting);
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -716,7 +712,6 @@ int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
pExeList self = (pExeList)pData;
|
pExeList self = (pExeList)pData;
|
||||||
|
|
||||||
eOld = GetStatus();
|
eOld = GetStatus();
|
||||||
SetStatus(eRunning);
|
|
||||||
|
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
if(strcmp(argv[1],"RUNDRIVE") == 0){
|
if(strcmp(argv[1],"RUNDRIVE") == 0){
|
||||||
@ -758,7 +753,6 @@ int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
SCWrite(pCon, "Level done", eValue);
|
SCWrite(pCon, "Level done", eValue);
|
||||||
iRet = 1;
|
iRet = 1;
|
||||||
}
|
}
|
||||||
SetStatus(eEager);
|
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
@ -894,7 +888,6 @@ int DevExecTask(void *pData)
|
|||||||
self->lTask = -1;
|
self->lTask = -1;
|
||||||
self->iRun = 0;
|
self->iRun = 0;
|
||||||
self->instStatus = eEager;
|
self->instStatus = eEager;
|
||||||
SetStatus(eEager);
|
|
||||||
/*
|
/*
|
||||||
This is sort of unclean. Setting DEVERROR has to be done in the
|
This is sort of unclean. Setting DEVERROR has to be done in the
|
||||||
device task function as it is the only one that knows about this.
|
device task function as it is the only one that knows about this.
|
||||||
|
13
drive.c
13
drive.c
@ -302,19 +302,16 @@ int DriveWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* interprete arguments as pairs name value and try to start */
|
/* interprete arguments as pairs name value and try to start */
|
||||||
SetStatus(eDriving);
|
|
||||||
for (i = 1; i < argc; i += 2) {
|
for (i = 1; i < argc; i += 2) {
|
||||||
if (argv[i + 1] == NULL) {
|
if (argv[i + 1] == NULL) {
|
||||||
snprintf(pBueffel, 511, "ERROR: no value found for driving %s", argv[i]);
|
snprintf(pBueffel, 511, "ERROR: no value found for driving %s", argv[i]);
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
||||||
if (iRet == TCL_ERROR) {
|
if (iRet == TCL_ERROR) {
|
||||||
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
||||||
StopExe(GetExecutor(), "ALL");
|
StopExe(GetExecutor(), "ALL");
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = Start2Run(pCon, pSics, argv[i], RUNDRIVE, dTarget);
|
iRet = Start2Run(pCon, pSics, argv[i], RUNDRIVE, dTarget);
|
||||||
@ -328,7 +325,6 @@ int DriveWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
}
|
}
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
StopExe(GetExecutor(), "ALL");
|
StopExe(GetExecutor(), "ALL");
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,17 +347,14 @@ int DriveWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
sprintf(pBueffel, "Driving finished with problem");
|
sprintf(pBueffel, "Driving finished with problem");
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
ClearExecutor(GetExecutor());
|
ClearExecutor(GetExecutor());
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (iRet == DEVINT) {
|
} else if (iRet == DEVINT) {
|
||||||
sprintf(pBueffel, "ERROR: Driving Interrupted!");
|
sprintf(pBueffel, "ERROR: Driving Interrupted!");
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
ClearExecutor(GetExecutor());
|
ClearExecutor(GetExecutor());
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SCWrite(pCon, "Driving finished sucessfully", eValue);
|
SCWrite(pCon, "Driving finished sucessfully", eValue);
|
||||||
SetStatus(eOld);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,19 +392,16 @@ int RunWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* interprete arguments as pairs name value and try to start */
|
/* interprete arguments as pairs name value and try to start */
|
||||||
SetStatus(eDriving);
|
|
||||||
for (i = 1; i < argc; i += 2) {
|
for (i = 1; i < argc; i += 2) {
|
||||||
if (argv[i + 1] == NULL) {
|
if (argv[i + 1] == NULL) {
|
||||||
snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]);
|
snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]);
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
||||||
if (iRet == TCL_ERROR) {
|
if (iRet == TCL_ERROR) {
|
||||||
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
||||||
StopExe(GetExecutor(), "ALL");
|
StopExe(GetExecutor(), "ALL");
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = Start2Run(pCon, pSics, argv[i], RUNRUN, dTarget);
|
iRet = Start2Run(pCon, pSics, argv[i], RUNRUN, dTarget);
|
||||||
@ -420,7 +410,6 @@ int RunWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
argv[i + 1]);
|
argv[i + 1]);
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
StopExe(GetExecutor(), "ALL");
|
StopExe(GetExecutor(), "ALL");
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,14 +455,12 @@ int MoveWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
if (argv[i + 1] == NULL) {
|
if (argv[i + 1] == NULL) {
|
||||||
snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]);
|
snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]);
|
||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
iRet = Tcl_GetDouble(tcl_interp, argv[i + 1], &dTarget);
|
||||||
if (iRet == TCL_ERROR) {
|
if (iRet == TCL_ERROR) {
|
||||||
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
SCWrite(pCon, Tcl_GetStringResult(tcl_interp), eError);
|
||||||
StopExe(GetExecutor(), "ALL");
|
StopExe(GetExecutor(), "ALL");
|
||||||
SetStatus(eOld);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
obj = FindCommandData(pSics,argv[i],NULL);
|
obj = FindCommandData(pSics,argv[i],NULL);
|
||||||
|
@ -80,12 +80,9 @@ static long EVIDrive(void *pData, SConnection * pCon, float fVal)
|
|||||||
assert(pCon);
|
assert(pCon);
|
||||||
|
|
||||||
if (self->runScript != NULL) {
|
if (self->runScript != NULL) {
|
||||||
savedStatus = GetStatus();
|
|
||||||
SetStatus(eBatch);
|
|
||||||
pTcl = InterpGetTcl(pServ->pSics);
|
pTcl = InterpGetTcl(pServ->pSics);
|
||||||
snprintf(pBueffel, sizeof(pBueffel), "%s %f", self->runScript, fVal);
|
snprintf(pBueffel, sizeof(pBueffel), "%s %f", self->runScript, fVal);
|
||||||
iRet = Tcl_Eval(pTcl, pBueffel);
|
iRet = Tcl_Eval(pTcl, pBueffel);
|
||||||
SetStatus(savedStatus);
|
|
||||||
if (iRet != TCL_OK) {
|
if (iRet != TCL_OK) {
|
||||||
SCPrintf(pCon, eError,
|
SCPrintf(pCon, eError,
|
||||||
"ERROR: %s while processing runscript for %s",
|
"ERROR: %s while processing runscript for %s",
|
||||||
@ -423,7 +420,6 @@ static int ErrPause(void *pData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* OK now, continue */
|
/* OK now, continue */
|
||||||
SetStatus(eEager);
|
|
||||||
self->iWarned = 0;
|
self->iWarned = 0;
|
||||||
ContinueExecution(pExe);
|
ContinueExecution(pExe);
|
||||||
return 1;
|
return 1;
|
||||||
|
2
exebuf.c
2
exebuf.c
@ -323,7 +323,6 @@ int exeBufProcess(pExeBuf self, SicsInterp * pSics,
|
|||||||
DeleteDynString(command);
|
DeleteDynString(command);
|
||||||
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
||||||
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
||||||
SetStatus(eEager);
|
|
||||||
if (pCall != NULL) {
|
if (pCall != NULL) {
|
||||||
InvokeCallBack(pCall, BATCHEND, self->name);
|
InvokeCallBack(pCall, BATCHEND, self->name);
|
||||||
}
|
}
|
||||||
@ -375,7 +374,6 @@ int exeBufProcessErrList(pExeBuf self, SicsInterp * pSics,
|
|||||||
DeleteDynString(command);
|
DeleteDynString(command);
|
||||||
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
||||||
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
||||||
SetStatus(eEager);
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
SCSetInterrupt(pCon, eContinue);
|
SCSetInterrupt(pCon, eContinue);
|
||||||
|
11
interface.c
11
interface.c
@ -240,7 +240,6 @@ static int DriveTaskFunc(void *data)
|
|||||||
} else {
|
} else {
|
||||||
ExeInterest(pServ->pExecutor,taskData->name, "finished with problem");
|
ExeInterest(pServ->pExecutor,taskData->name, "finished with problem");
|
||||||
}
|
}
|
||||||
SetStatus(eEager);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -370,16 +369,6 @@ static int CountTaskFunc(void *data)
|
|||||||
assert(taskData != NULL);
|
assert(taskData != NULL);
|
||||||
|
|
||||||
status = taskData->pCount->CheckCountStatus(taskData->obj,taskData->pCon);
|
status = taskData->pCount->CheckCountStatus(taskData->obj,taskData->pCon);
|
||||||
if(status == HWBusy) {
|
|
||||||
SetStatus(eCounting);
|
|
||||||
return 1;
|
|
||||||
} else if(status == HWNoBeam){
|
|
||||||
SetStatus(eOutOfBeam);
|
|
||||||
return 1;
|
|
||||||
} else if(status == HWPause){
|
|
||||||
SetStatus(ePaused);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
taskData->pCount->TransferData(taskData->obj, taskData->pCon);
|
taskData->pCount->TransferData(taskData->obj, taskData->pCon);
|
||||||
|
|
||||||
|
6
macro.c
6
macro.c
@ -474,8 +474,6 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* handle status first */
|
/* handle status first */
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eBatch);
|
|
||||||
|
|
||||||
SICSLogWrite("Evaluating in MacroFileEval", eValue);
|
SICSLogWrite("Evaluating in MacroFileEval", eValue);
|
||||||
SICSLogWrite(argv[1], eValue);
|
SICSLogWrite(argv[1], eValue);
|
||||||
@ -500,7 +498,6 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
|||||||
Tcl_DStringAppend(&command, pBueffel, -1);
|
Tcl_DStringAppend(&command, pBueffel, -1);
|
||||||
pCom = Tcl_DStringValue(&command);
|
pCom = Tcl_DStringValue(&command);
|
||||||
if (Tcl_CommandComplete(pCom)) {
|
if (Tcl_CommandComplete(pCom)) {
|
||||||
SetStatus(eEager);
|
|
||||||
FirstWord(pCom, pBueffel);
|
FirstWord(pCom, pBueffel);
|
||||||
if (FindCommand(pInter, pBueffel) != NULL) {
|
if (FindCommand(pInter, pBueffel) != NULL) {
|
||||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s:%d>> %s", pFile, iLine, pCom);
|
snprintf(pBueffel,sizeof(pBueffel)-1, "%s:%d>> %s", pFile, iLine, pCom);
|
||||||
@ -512,7 +509,6 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
|||||||
iLine++;
|
iLine++;
|
||||||
}
|
}
|
||||||
iRet = Tcl_Eval(pTcl, pCom);
|
iRet = Tcl_Eval(pTcl, pCom);
|
||||||
SetStatus(eBatch);
|
|
||||||
if (iRet != TCL_OK) {
|
if (iRet != TCL_OK) {
|
||||||
/* write TCL error and check for total interrupt */
|
/* write TCL error and check for total interrupt */
|
||||||
if (Tcl_GetVar(pTcl, SICSERROR, TCL_GLOBAL_ONLY) == NULL) { /* Tcl error */
|
if (Tcl_GetVar(pTcl, SICSERROR, TCL_GLOBAL_ONLY) == NULL) { /* Tcl error */
|
||||||
@ -537,7 +533,6 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
Tcl_DStringFree(&command);
|
Tcl_DStringFree(&command);
|
||||||
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
||||||
SetStatus(eEager);
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
SCSetInterrupt(pCon, eContinue);
|
SCSetInterrupt(pCon, eContinue);
|
||||||
@ -555,7 +550,6 @@ int MacroFileEval(SConnection * pCon, SicsInterp * pInter, void *pData,
|
|||||||
/* clean up */
|
/* clean up */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
Tcl_DStringFree(&command);
|
Tcl_DStringFree(&command);
|
||||||
SetStatus(eOld);
|
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -318,20 +318,16 @@ static int isMultiMasterRunning(pCounter self, SConnection *pCon, int *status)
|
|||||||
UpdateHipadabaPar(stopTime,MakeHdbInt(time(NULL)),pCon);
|
UpdateHipadabaPar(stopTime,MakeHdbInt(time(NULL)),pCon);
|
||||||
SecCounterSetError(self,"Master counter errror");
|
SecCounterSetError(self,"Master counter errror");
|
||||||
*status = HWBusy;
|
*status = HWBusy;
|
||||||
ClearFixedStatus(eCounting);
|
|
||||||
break;
|
break;
|
||||||
case HWPause:
|
case HWPause:
|
||||||
UpdateHipadabaPar(myStatus,MakeHdbText("paused"),pCon);
|
UpdateHipadabaPar(myStatus,MakeHdbText("paused"),pCon);
|
||||||
*status = HWPause;
|
*status = HWPause;
|
||||||
SetStatusFixed(ePaused);
|
|
||||||
break;
|
break;
|
||||||
case HWNoBeam:
|
case HWNoBeam:
|
||||||
UpdateHipadabaPar(myStatus,MakeHdbText("nobeam"),pCon);
|
UpdateHipadabaPar(myStatus,MakeHdbText("nobeam"),pCon);
|
||||||
*status = HWNoBeam;
|
*status = HWNoBeam;
|
||||||
SetStatusFixed(eOutOfBeam);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SetStatusFixed(eCounting);
|
|
||||||
*status = HWBusy;
|
*status = HWBusy;
|
||||||
UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon);
|
UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon);
|
||||||
if (self->iCallbackCounter > 20) {
|
if (self->iCallbackCounter > 20) {
|
||||||
@ -414,7 +410,6 @@ static void multiEndCounting(pCounter self, SConnection *pCon)
|
|||||||
InvokeCallBack(self->pCall, COUNTEND, NULL);
|
InvokeCallBack(self->pCall, COUNTEND, NULL);
|
||||||
ReleaseCountLock(self->pCountInt);
|
ReleaseCountLock(self->pCountInt);
|
||||||
MultiSecTransfer(self,pCon);
|
MultiSecTransfer(self,pCon);
|
||||||
ClearFixedStatus(eEager);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
@ -432,7 +427,6 @@ static int MultiSecStatus(void *pData, SConnection * pCon)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(areSlavesRunning(self,pCon, &status)){
|
if(areSlavesRunning(self,pCon, &status)){
|
||||||
SetStatusFixed(eCounting);
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,14 +458,10 @@ int UserWait(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eUserWait);
|
|
||||||
sWait.dFinish = DoubleTime() + (double)fVal;
|
sWait.dFinish = DoubleTime() + (double)fVal;
|
||||||
sWait.iEnd = 0;
|
sWait.iEnd = 0;
|
||||||
lID = TaskRegisterN(pTask,"wait", WaitTask, WaitSignal, NULL, &sWait, 1);
|
lID = TaskRegisterN(pTask,"wait", WaitTask, WaitSignal, NULL, &sWait, 1);
|
||||||
TaskWait(pTask, lID);
|
TaskWait(pTask, lID); if (SCGetInterrupt(pCon) != eContinue) {
|
||||||
SetStatus(eOld);
|
|
||||||
if (SCGetInterrupt(pCon) != eContinue) {
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
12
script.c
12
script.c
@ -143,11 +143,17 @@ int SetSICSInterrupt(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------
|
||||||
|
This method does nothing anymore. Status is now calculated from the state
|
||||||
|
of SICS and no longer explicitly set. I left the code in because I am to
|
||||||
|
lazy to find all use cases and eliminate them
|
||||||
|
|
||||||
|
M.K. 07/2014
|
||||||
|
--------------------------------------------------------------------------*/
|
||||||
int SetSICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
int SetSICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int iInt;
|
int iInt = 0;
|
||||||
char pBueffel[132];
|
char pBueffel[132];
|
||||||
|
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
@ -174,7 +180,7 @@ int SetSICSStatus(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
|
|
||||||
/* actually do a job */
|
/* actually do a job */
|
||||||
strtolower(argv[1]);
|
strtolower(argv[1]);
|
||||||
iInt = SetStatusFromText(argv[1]);
|
/* iInt = SetStatusFromText(argv[1]); */
|
||||||
if (iInt) {
|
if (iInt) {
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
|
4
status.c
4
status.c
@ -13,6 +13,10 @@
|
|||||||
Reworked restore to keep parameters from uninitialized devices
|
Reworked restore to keep parameters from uninitialized devices
|
||||||
Mark Koennecke, November 2007
|
Mark Koennecke, November 2007
|
||||||
|
|
||||||
|
Reworked to determine the status from the state of the machine rather then
|
||||||
|
from explicit sets on a global variable. Which caused trouble, trouble and more
|
||||||
|
trouble. Mark Koennecke, July 2015
|
||||||
|
|
||||||
Copyright:
|
Copyright:
|
||||||
|
|
||||||
Labor fuer Neutronenstreuung
|
Labor fuer Neutronenstreuung
|
||||||
|
12
status.h
12
status.h
@ -27,19 +27,7 @@ typedef enum {
|
|||||||
} Status;
|
} Status;
|
||||||
|
|
||||||
/* for status display */
|
/* for status display */
|
||||||
void SetStatus(Status eNew);
|
|
||||||
int SetStatusFromText(char *text);
|
|
||||||
void KillStatus(void *pData);
|
void KillStatus(void *pData);
|
||||||
/**
|
|
||||||
* set a status and disallow any further changes to the status. This serves
|
|
||||||
* in order to prevent massive message flows to the client from status
|
|
||||||
* changes while processing synchronisation files
|
|
||||||
*/
|
|
||||||
void SetStatusFixed(Status eNew);
|
|
||||||
/**
|
|
||||||
* clear a fixed status again, status will be updated again.
|
|
||||||
*/
|
|
||||||
void ClearFixedStatus(Status eNew);
|
|
||||||
|
|
||||||
Status GetStatus(void);
|
Status GetStatus(void);
|
||||||
void GetStatusText(char *buf, int iBufLen);
|
void GetStatusText(char *buf, int iBufLen);
|
||||||
|
@ -903,7 +903,6 @@ int ScanCount(pScanData self, int iPoint)
|
|||||||
SCWrite(self->pCon, "ERROR: Cannot Count, Scan aborted", eLogError);
|
SCWrite(self->pCon, "ERROR: Cannot Count, Scan aborted", eLogError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SetStatus(eCounting);
|
|
||||||
/* wait for finish */
|
/* wait for finish */
|
||||||
while(DevExecLevelRunning(pServ->pExecutor, RUNDRIVE)){
|
while(DevExecLevelRunning(pServ->pExecutor, RUNDRIVE)){
|
||||||
TaskYield(pServ->pTasker);
|
TaskYield(pServ->pTasker);
|
||||||
|
@ -175,7 +175,6 @@ tryagain:
|
|||||||
/*
|
/*
|
||||||
first tell the remote server to backup
|
first tell the remote server to backup
|
||||||
*/
|
*/
|
||||||
SetStatusFixed(eBatch);
|
|
||||||
strcpy(pBueffel, "transact syncbackup");
|
strcpy(pBueffel, "transact syncbackup");
|
||||||
if (syncFile != NULL) {
|
if (syncFile != NULL) {
|
||||||
strcat(pBueffel, " ");
|
strcat(pBueffel, " ");
|
||||||
@ -187,7 +186,6 @@ tryagain:
|
|||||||
NETClosePort(connection);
|
NETClosePort(connection);
|
||||||
free(connection);
|
free(connection);
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
ClearFixedStatus(eEager);
|
|
||||||
if (try > 0)
|
if (try > 0)
|
||||||
goto tryagain;
|
goto tryagain;
|
||||||
SCWrite(pCon, "ERROR: Failed to contact main SICS server", eError);
|
SCWrite(pCon, "ERROR: Failed to contact main SICS server", eError);
|
||||||
@ -207,7 +205,6 @@ tryagain:
|
|||||||
NETClosePort(connection);
|
NETClosePort(connection);
|
||||||
free(connection);
|
free(connection);
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
ClearFixedStatus(eEager);
|
|
||||||
pServ->simMode = 1;
|
pServ->simMode = 1;
|
||||||
if (try > 0)
|
if (try > 0)
|
||||||
goto tryagain;
|
goto tryagain;
|
||||||
@ -247,7 +244,6 @@ tryagain:
|
|||||||
internalCon = SCCreateDummyConnection(pSics);
|
internalCon = SCCreateDummyConnection(pSics);
|
||||||
if (internalCon == NULL) {
|
if (internalCon == NULL) {
|
||||||
SCWrite(pCon, "ERROR: out of memory in sync", eError);
|
SCWrite(pCon, "ERROR: out of memory in sync", eError);
|
||||||
ClearFixedStatus(eEager);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -258,7 +254,6 @@ tryagain:
|
|||||||
}
|
}
|
||||||
test = InterpExecute(pSics, internalCon, pBueffel);
|
test = InterpExecute(pSics, internalCon, pBueffel);
|
||||||
SCDeleteConnection(internalCon);
|
SCDeleteConnection(internalCon);
|
||||||
ClearFixedStatus(eEager);
|
|
||||||
if (test != 1) {
|
if (test != 1) {
|
||||||
SCWrite(pCon, "ERROR: Failed to read sync information", eError);
|
SCWrite(pCon, "ERROR: Failed to read sync information", eError);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -771,7 +771,6 @@ static int TASUBScanCount(pScanData self, int iPoint)
|
|||||||
} else {
|
} else {
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
SetStatus(eOld);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
5
velo.c
5
velo.c
@ -588,10 +588,7 @@ int VSGetLossCurrent(pVelSel self, SConnection * pCon, float *fLoss)
|
|||||||
assert(self);
|
assert(self);
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
|
|
||||||
eOld = GetStatus();
|
|
||||||
SetStatus(eRunning);
|
|
||||||
iRet = self->pDriv->GetLossCurrent(self->pDriv, fLoss);
|
iRet = self->pDriv->GetLossCurrent(self->pDriv, fLoss);
|
||||||
SetStatus(eOld);
|
|
||||||
if (!iRet) {
|
if (!iRet) {
|
||||||
self->pDriv->GetError(self->pDriv, &iCode, pError, 131);
|
self->pDriv->GetError(self->pDriv, &iCode, pError, 131);
|
||||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s while trying to measure loss current",
|
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s while trying to measure loss current",
|
||||||
@ -1161,9 +1158,7 @@ int VelSelAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
eError);
|
eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SetStatus(eDriving);
|
|
||||||
iRet = VSSetTiltRot(self, pCon, fRot, fTilt);
|
iRet = VSSetTiltRot(self, pCon, fRot, fTilt);
|
||||||
SetStatus(eEager);
|
|
||||||
if (iRet) {
|
if (iRet) {
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user