Fixed a minor memory leak in count and drive task handling
Reformatted multicountser to become clearer Minor fixes Added more tracing output to sort the SANSLI problem
This commit is contained in:
@ -543,6 +543,7 @@ void DeleteInterp(SicsInterp * self)
|
||||
|
||||
call KillSicsUnknown instead to clean up all memory properly. M.Z., Apr 05
|
||||
*/
|
||||
Tcl_DeleteInterp(pTcl);
|
||||
KillSicsUnknown();
|
||||
}
|
||||
|
||||
|
3
cone.c
3
cone.c
@ -171,7 +171,6 @@ static long ConeSetValue(void *pData, SConnection * pCon, float fVal)
|
||||
*/
|
||||
SICSHdbGetPar(obj, pCon, "target", &v);
|
||||
target.h = v.v.floatArray[0];
|
||||
target.k = v.v.floatArray[1];
|
||||
target.l = v.v.floatArray[2];
|
||||
SICSHdbGetPar(obj, pCon, "qscale", &v);
|
||||
/*
|
||||
@ -198,7 +197,7 @@ static long ConeSetValue(void *pData, SConnection * pCon, float fVal)
|
||||
mat_free(csToPsi);
|
||||
if (status != 1) {
|
||||
SCWrite(pCon, "ERROR: cannot get cone vector into scattering position",
|
||||
eError);
|
||||
eLogError);
|
||||
SCSetInterrupt(pCon, eAbortOperation);
|
||||
return 0;
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ pExeList CreateExeList(pTaskMan pTask)
|
||||
pRes->pCall = CreateCallBackInterface();
|
||||
pRes->lastRun = time(NULL);
|
||||
pRes->pDes->GetInterface = DevexecInterface;
|
||||
pRes->instStatus = eEager;
|
||||
return pRes;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,9 @@ static int HMCStatus(void *pData, SConnection * pCon)
|
||||
assert(self);
|
||||
|
||||
if(self->checkSlaves == 0) {
|
||||
/*
|
||||
check master
|
||||
*/
|
||||
status = self->slaves[0]->CheckCountStatus(self->slaveData[0], pCon);
|
||||
/*
|
||||
Warning: this assumes that slaves 1 - MAXSLAVE are histogram memories.
|
||||
@ -194,7 +197,7 @@ static int HMCBoaStatus(void *pData, SConnection * pCon)
|
||||
HMCHalt(self);
|
||||
ReleaseCountLock(self->pCount);
|
||||
self->checkSlaves = 0;
|
||||
for(j = 0; j < 100; j++){
|
||||
for(j = 0; j < 200; j++){
|
||||
SicsWait(1);
|
||||
status = self->slaves[i]->CheckCountStatus(self->slaveData[i], pCon);
|
||||
if(status == HWIdle || status == HWFault) {
|
||||
|
@ -196,6 +196,7 @@ static void KillDriveTaskData(void *data)
|
||||
if(taskData->pCon != NULL){
|
||||
SCDeleteConnection(taskData->pCon);
|
||||
}
|
||||
free(taskData);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void DriveTaskSignal(void *data, int iSignal, void *pSigData)
|
||||
@ -240,6 +241,7 @@ static int DriveTaskFunc(void *data)
|
||||
} else {
|
||||
ExeInterest(pServ->pExecutor,taskData->name, "finished with problem");
|
||||
}
|
||||
traceSys("drive","DriveTask %s finished with state %d", taskData->name,status);
|
||||
return 0;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@ -338,6 +340,7 @@ static void KillCountTaskData(void *data)
|
||||
if(taskData->pCon != NULL){
|
||||
SCDeleteConnection(taskData->pCon);
|
||||
}
|
||||
free(taskData);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void CountTaskSignal(void *data, int iSignal, void *pSigData)
|
||||
@ -389,6 +392,7 @@ static int CountTaskFunc(void *data)
|
||||
} else {
|
||||
ExeInterest(pServ->pExecutor,taskData->name, "finished with problem");
|
||||
}
|
||||
traceSys("count","CountTask %s finished with state %d", taskData->name,status);
|
||||
return 0;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
@ -239,7 +239,7 @@ static hdbCallbackReturn MultiSecControllCallback(pHdb node,
|
||||
|
||||
return hdbContinue;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------------2-*/
|
||||
static int MultiSecTransfer(void *pData, SConnection * pCon)
|
||||
{
|
||||
int i, retVal = OKOK, tclStatus;
|
||||
@ -253,6 +253,7 @@ static int MultiSecTransfer(void *pData, SConnection * pCon)
|
||||
transfer = GetHipadabaNode(pCount->objectNode,"transfer");
|
||||
if(transfer != NULL){
|
||||
myCon = SCCopyConnection(pCon);
|
||||
SCsetMacro(myCon,1);
|
||||
MacroPush(myCon);
|
||||
tclStatus = Tcl_Eval(InterpGetTcl(pServ->pSics), transfer->value.v.text);
|
||||
if (tclStatus != TCL_OK) {
|
||||
@ -390,7 +391,6 @@ static int areSlavesRunning(pCounter self, SConnection *pCon, int *status)
|
||||
}
|
||||
SCWrite(pCon,"ERROR: failed to stop overrun CCD",eLogError);
|
||||
*status = HWFault;
|
||||
return 0;
|
||||
} else {
|
||||
*status = HWBusy;
|
||||
UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon);
|
||||
|
11
nxscript.c
11
nxscript.c
@ -235,6 +235,7 @@ static int handleFileOperations(SConnection * pCon, pNXScript self,
|
||||
SCWrite(pCon, buffer, eError);
|
||||
return -1;
|
||||
}
|
||||
traceIO("datafile", "Opening %s", argv[2]);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
@ -1499,7 +1500,7 @@ static int SPutPadding(void *message, void *userData)
|
||||
{
|
||||
pPutMessage self = (pPutMessage)message;
|
||||
char *pPtr = NULL, *pEnd = NULL;
|
||||
unsigned int len, i;
|
||||
unsigned int len = 0, i;
|
||||
|
||||
if(self->v.dataType == HIPTEXT && strstr(self->v.v.text,"@len") != NULL){
|
||||
pPtr = strchr(self->v.v.text,'=');
|
||||
@ -1509,11 +1510,11 @@ static int SPutPadding(void *message, void *userData)
|
||||
*pEnd = '\0';
|
||||
len = atoi(pPtr);
|
||||
}
|
||||
pPtr = malloc((len+5)*sizeof(char));
|
||||
pPtr = malloc((len+7)*sizeof(char));
|
||||
if(pPtr != NULL){
|
||||
memset(pPtr,0,len*sizeof(char));
|
||||
strncpy(pPtr,pEnd+1,len);
|
||||
for(i = strlen(pPtr); i < len-1; i++){
|
||||
for(i = strlen(pPtr); i < len-2; i++){
|
||||
pPtr[i] = ' ';
|
||||
}
|
||||
pPtr[len-1] = '!';
|
||||
@ -1550,7 +1551,11 @@ static int SPutDim(void *message, void *userData)
|
||||
self->dim[0] = self->v.arrayLength;
|
||||
break;
|
||||
case HIPTEXT:
|
||||
if(self->v.v.text != NULL){
|
||||
self->dim[0] = strlen(self->v.v.text)+1;
|
||||
} else {
|
||||
self->dim[0] = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
snprintf(self->error, sizeof(self->error),"invalid data type %d",
|
||||
|
@ -8,6 +8,13 @@
|
||||
* copyright: see file COPYRIGHT
|
||||
*
|
||||
* Mark Koennecke, February 2013
|
||||
*
|
||||
* TODO: this may need a refactoring towards a monochromator object with its
|
||||
* own parameters and such. Eiger would have benefitted from this. This here
|
||||
* just implements a drivable interface on top of the tasub parameters. As EIGER
|
||||
* is now working; this has gone low priority.
|
||||
*
|
||||
* Mark Koennecke, September 2014
|
||||
*/
|
||||
#include <sics.h>
|
||||
#include "tasmono.h"
|
||||
|
Reference in New Issue
Block a user