- 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:
@ -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);*/
|
||||
|
30
sicsget.c
30
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;
|
||||
|
@ -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;
|
||||
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;
|
||||
}
|
||||
|
5
trace.c
5
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,10 +469,12 @@ static int TraceLog(pSICSOBJ ccmd, SConnection * con,
|
||||
TraceObjects();
|
||||
hdbInit = 1;
|
||||
}
|
||||
TaskRegisterN(pServ->pTasker,"tracestamper",
|
||||
if(traceStamperID < 0){
|
||||
traceStamperID = TaskRegisterN(pServ->pTasker,"tracestamper",
|
||||
TraceLogTask, NULL, NULL, NULL, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------*/
|
||||
|
Reference in New Issue
Block a user