- 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

@ -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;