Cleaned up ANSTO code to merge with sinqdev.sics
This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c Conflicts: .gitignore SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c event.h exebuf.c exeman.c histmem.c interface.h motor.c motorlist.c motorsec.c multicounter.c napi.c napi.h napi4.c network.c nwatch.c nxscript.c nxxml.c nxxml.h ofac.c reflist.c scan.c sicshipadaba.c sicsobj.c site_ansto/docs/Copyright.txt site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl statusfile.c tasdrive.c tasub.c tasub.h tasublib.c tasublib.h
This commit is contained in:
32
exebuf.c
32
exebuf.c
@ -91,13 +91,39 @@ static char *locateName(char *filename)
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
If this is MOUNTAINBATCH file, replace ocurrences of @nl@ with \n
|
||||
------------------------------------------------------------------------*/
|
||||
static void fixMountainBatch(pExeBuf self)
|
||||
{
|
||||
char *pPtr, *pData, *pNL;
|
||||
|
||||
pPtr = GetCharArray(self->bufferContent);
|
||||
if(strstr(pPtr, "#MOUNTAINBATCH") != pPtr){
|
||||
/*
|
||||
nothing to do
|
||||
*/
|
||||
return;
|
||||
}
|
||||
pData = strdup(pPtr);
|
||||
DynStringClear(self->bufferContent);
|
||||
pPtr = pData;
|
||||
while((pNL = strstr(pPtr,"@nl@")) != NULL){
|
||||
*pNL = '\n';
|
||||
*(pNL+1) = '\0';
|
||||
DynStringConcat(self->bufferContent, pPtr);
|
||||
pPtr = pNL +4;
|
||||
}
|
||||
DynStringConcat(self->bufferContent,pPtr);
|
||||
free(pData);
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int exeBufLoad(pExeBuf self, char *filename)
|
||||
{
|
||||
char line[256], *pPtr;
|
||||
FILE *fd = NULL;
|
||||
int status, idx;
|
||||
int status, idx, gtsebatch = 0;
|
||||
|
||||
assert(self);
|
||||
fd = fopen(filename, "r");
|
||||
@ -128,6 +154,7 @@ int exeBufLoad(pExeBuf self, char *filename)
|
||||
free(self->name);
|
||||
}
|
||||
self->name = strdup(locateName(filename));
|
||||
fixMountainBatch(self);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -297,8 +324,6 @@ int exeBufProcess(pExeBuf self, SicsInterp * pSics,
|
||||
DeleteDynString(command);
|
||||
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
||||
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
||||
InvokeCallBack(pCall, BATCHEND, self->name);
|
||||
SetStatus(eEager);
|
||||
if (pCall != NULL) {
|
||||
InvokeCallBack(pCall, BATCHEND, self->name);
|
||||
}
|
||||
@ -350,7 +375,6 @@ int exeBufProcessErrList(pExeBuf self, SicsInterp * pSics,
|
||||
DeleteDynString(command);
|
||||
if (SCGetInterrupt(pCon) >= eAbortBatch) {
|
||||
SCWrite(pCon, "ERROR: batch processing interrupted", eError);
|
||||
SetStatus(eEager);
|
||||
return 0;
|
||||
} else {
|
||||
SCSetInterrupt(pCon, eContinue);
|
||||
|
Reference in New Issue
Block a user