- 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
This commit is contained in:
2014-11-18 09:24:27 +01:00
parent fd986402ff
commit f274f3bcdb
5 changed files with 42 additions and 12 deletions

View File

@ -44,7 +44,7 @@ static int initArray(pCounter self, int value)
assert(datalength != NULL); assert(datalength != NULL);
length = dim->value.v.intArray[0]; 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]; length *= dim->value.v.intArray[i];
} }
/* printf("initArray called with length %d\n", length);*/ /* printf("initArray called with length %d\n", length);*/

View File

@ -137,16 +137,22 @@ static int SICSPutCommand(SConnection * pCon, SicsInterp * pSics, void *pData,
static int InvokeSICSFunc(void *ms, void *userData) static int InvokeSICSFunc(void *ms, void *userData)
{ {
pParseMessage self = (pParseMessage)ms; pParseMessage self = (pParseMessage)ms;
SConnection *pCon = NULL;
int status; int status;
SCsetMacro(pServ->dummyCon,1); pCon = SCCreateDummyConnection(pServ->pSics);
status = InterpExecute(pServ->pSics, pServ->dummyCon, self->command); if(pCon == NULL){
SCsetMacro(pServ->dummyCon,0); return MPSTOP;
}
SCsetMacro(pCon,1);
status = InterpExecute(pServ->pSics, pCon, self->command);
SCsetMacro(pCon,0);
if(!status){ if(!status){
self->success = 0; self->success = 0;
return MPSTOP; return MPSTOP;
} }
self->response = strdup(Tcl_GetStringResult(InterpGetTcl(pServ->pSics))); self->response = strdup(Tcl_GetStringResult(InterpGetTcl(pServ->pSics)));
SCDeleteConnection(pCon);
return MPCONTINUE; return MPCONTINUE;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -174,12 +180,26 @@ static int SplitOffEqual(void *ms, void *userData)
return MPCONTINUE; 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) static int isNumber(char *txt)
{ {
if(*txt == '\0' || *txt == ' '){ if(*txt == '\0' || *txt == ' '){
return 1; return 1;
} }
if(isalpha(*txt)){ if(isalpha(*txt) || isExtra(*txt)){
return 0; return 0;
} else { } else {
return isNumber(txt+1); return isNumber(txt+1);
@ -423,7 +443,7 @@ static int PutHdbFunc(void *ms, void *userData)
node = FindHdbNode(NULL,self->name,NULL); node = FindHdbNode(NULL,self->name,NULL);
if(node != NULL){ if(node != NULL){
status = UpdateHipadabaPar(node,*(self->v),NULL); status = SetHipadabaPar(node,*(self->v),NULL);
self->success = status; self->success = status;
if(status == 1){ if(status == 1){
return MPSTOP; return MPSTOP;

View File

@ -289,9 +289,8 @@ hdbCallbackReturn SICSValueCheckCallback(pHdb node, void *userData,
} }
return hdbAbort; return hdbAbort;
} }
/*-------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------*/
static hdbCallbackReturn SICSDriveCallback(pHdb node, void *userData, static hdbCallbackReturn SICSDriveCallback(pHdb node, void *userData,
pHdbMessage message) pHdbMessage message)
@ -3131,6 +3130,7 @@ static int RemoveHdbCallback(SConnection * pCon, SicsInterp * pSics,
{ {
int id; int id;
hdbIDMessage m; hdbIDMessage m;
pObjectDescriptor pObj = NULL;
if (argc < 2) { if (argc < 2) {
SCWrite(pCon, "ERROR: need callback id to remove", eError); SCWrite(pCon, "ERROR: need callback id to remove", eError);
@ -3139,7 +3139,14 @@ static int RemoveHdbCallback(SConnection * pCon, SicsInterp * pSics,
id = atoi(argv[1]); id = atoi(argv[1]);
m.type = killID; m.type = killID;
m.ID = id; 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); SCSendOK(pCon);
return 1; return 1;
} }

View File

@ -37,6 +37,7 @@ static int hdbInit = 0;
static int filterProv = 0; static int filterProv = 0;
static int debug = 0; static int debug = 0;
static int lastTen = -10; static int lastTen = -10;
static long traceStamperID = -1;
/*----------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------*/
int traceActive() int traceActive()
{ {
@ -468,8 +469,10 @@ static int TraceLog(pSICSOBJ ccmd, SConnection * con,
TraceObjects(); TraceObjects();
hdbInit = 1; hdbInit = 1;
} }
TaskRegisterN(pServ->pTasker,"tracestamper", if(traceStamperID < 0){
TraceLogTask, NULL, NULL, NULL, 1); traceStamperID = TaskRegisterN(pServ->pTasker,"tracestamper",
TraceLogTask, NULL, NULL, NULL, 1);
}
} }
} }
return 1; return 1;