From f274f3bcdb9e30d986b1910598e86b59687c53ec Mon Sep 17 00:00:00 2001 From: Koennecke Mark Date: Tue, 18 Nov 2014 09:24:27 +0100 Subject: [PATCH] - Fixed a sget bug which caused text wrongly to be identified as numbers - Fixed a sput bug: SetHipadabaPar versus UpdateHipadabaPar - Modified hdelcb to be able to remove callbacks from SICS objects --- histmemsec.c | 2 +- make_gen | 2 +- sicsget.c | 30 +++++++++++++++++++++++++----- sicshipadaba.c | 13 ++++++++++--- trace.c | 7 +++++-- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/histmemsec.c b/histmemsec.c index ed06e956..248b57c2 100644 --- a/histmemsec.c +++ b/histmemsec.c @@ -44,7 +44,7 @@ static int initArray(pCounter self, int value) assert(datalength != NULL); length = dim->value.v.intArray[0]; - for(i = 1; i < rank->value.v.intValue; i++){ + for(i = 1; i < dim->value.arrayLength; i++){ length *= dim->value.v.intArray[i]; } /* printf("initArray called with length %d\n", length);*/ diff --git a/make_gen b/make_gen index 64962730..09527280 100644 --- a/make_gen +++ b/make_gen @@ -46,7 +46,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ rwpuffer.o asynnet.o background.o countersec.o hdbtable.o velosec.o \ histmemsec.o sansbc.o sicsutil.o strlutil.o genbinprot.o trace.o\ singlebinb.o taskobj.o sctcomtask.o tasmono.o multicountersec.o \ - messagepipe.o sicsget.o + messagepipe.o sicsget.o MOTOROBJ = motor.o simdriv.o COUNTEROBJ = countdriv.o simcter.o counter.o diff --git a/sicsget.c b/sicsget.c index c764d107..6e96c93e 100644 --- a/sicsget.c +++ b/sicsget.c @@ -137,16 +137,22 @@ static int SICSPutCommand(SConnection * pCon, SicsInterp * pSics, void *pData, static int InvokeSICSFunc(void *ms, void *userData) { pParseMessage self = (pParseMessage)ms; + SConnection *pCon = NULL; int status; - SCsetMacro(pServ->dummyCon,1); - status = InterpExecute(pServ->pSics, pServ->dummyCon, self->command); - SCsetMacro(pServ->dummyCon,0); + pCon = SCCreateDummyConnection(pServ->pSics); + if(pCon == NULL){ + return MPSTOP; + } + SCsetMacro(pCon,1); + status = InterpExecute(pServ->pSics, pCon, self->command); + SCsetMacro(pCon,0); if(!status){ self->success = 0; return MPSTOP; } self->response = strdup(Tcl_GetStringResult(InterpGetTcl(pServ->pSics))); + SCDeleteConnection(pCon); return MPCONTINUE; } /*----------------------------------------------------------------------------*/ @@ -174,12 +180,26 @@ static int SplitOffEqual(void *ms, void *userData) return MPCONTINUE; } /*---------------------------------------------------------------------------*/ +static int isExtra(char c) +{ + char extra[] = {"{}"}; + int i; + + for(i = 0; i < strlen(extra); i++){ + if(extra[i] == c ){ + return 1; + } + } + + return 0; +} +/*---------------------------------------------------------------------------*/ static int isNumber(char *txt) { if(*txt == '\0' || *txt == ' '){ return 1; } - if(isalpha(*txt)){ + if(isalpha(*txt) || isExtra(*txt)){ return 0; } else { return isNumber(txt+1); @@ -423,7 +443,7 @@ static int PutHdbFunc(void *ms, void *userData) node = FindHdbNode(NULL,self->name,NULL); if(node != NULL){ - status = UpdateHipadabaPar(node,*(self->v),NULL); + status = SetHipadabaPar(node,*(self->v),NULL); self->success = status; if(status == 1){ return MPSTOP; diff --git a/sicshipadaba.c b/sicshipadaba.c index aed792d1..17880da1 100644 --- a/sicshipadaba.c +++ b/sicshipadaba.c @@ -289,9 +289,8 @@ hdbCallbackReturn SICSValueCheckCallback(pHdb node, void *userData, } return hdbAbort; + } - - /*-------------------------------------------------------------------------------------*/ static hdbCallbackReturn SICSDriveCallback(pHdb node, void *userData, pHdbMessage message) @@ -3131,6 +3130,7 @@ static int RemoveHdbCallback(SConnection * pCon, SicsInterp * pSics, { int id; hdbIDMessage m; + pObjectDescriptor pObj = NULL; if (argc < 2) { SCWrite(pCon, "ERROR: need callback id to remove", eError); @@ -3139,7 +3139,14 @@ static int RemoveHdbCallback(SConnection * pCon, SicsInterp * pSics, id = atoi(argv[1]); m.type = killID; m.ID = id; - RecurseCallbackChains(root, (pHdbMessage) & m); + if(argc < 3){ + RecurseCallbackChains(root, (pHdbMessage) & m); + } else { + pObj = FindCommandDescriptor(pSics,argv[2]); + if(pObj != NULL && pObj->parNode != NULL){ + RecurseCallbackChains(pObj->parNode,(pHdbMessage)&m); + } + } SCSendOK(pCon); return 1; } diff --git a/trace.c b/trace.c index 7ae47edd..db2dade1 100644 --- a/trace.c +++ b/trace.c @@ -37,6 +37,7 @@ static int hdbInit = 0; static int filterProv = 0; static int debug = 0; static int lastTen = -10; +static long traceStamperID = -1; /*----------------------------------------------------------------------------------------*/ int traceActive() { @@ -468,8 +469,10 @@ static int TraceLog(pSICSOBJ ccmd, SConnection * con, TraceObjects(); hdbInit = 1; } - TaskRegisterN(pServ->pTasker,"tracestamper", - TraceLogTask, NULL, NULL, NULL, 1); + if(traceStamperID < 0){ + traceStamperID = TaskRegisterN(pServ->pTasker,"tracestamper", + TraceLogTask, NULL, NULL, NULL, 1); + } } } return 1;