First version of remoteobject. In the implementation of this, the following
sub problems were solved: - sicsget was not reporting geterrors on nodes properly - rwpuffer contained dirt after wrap - property change events were added to hipadaba - Some tuning of SICS output - The number of codes was wrong in outcode.c
This commit is contained in:
36
sicsget.c
36
sicsget.c
@ -89,7 +89,11 @@ static int SICSGetCommand(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
SCPrintf(pCon,eError,"ERROR: value for %s not found", argv[1]);
|
||||
if(v.dataType == HIPTEXT && strstr(v.v.text,"ERROR") != NULL){
|
||||
SCPrintf(pCon,eError,v.v.text);
|
||||
} else {
|
||||
SCPrintf(pCon,eError,"ERROR: value for %s not found", argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ReleaseHdbValue(&v);
|
||||
@ -326,10 +330,20 @@ static int GetHdbFunc(void *ms, void *userData)
|
||||
{
|
||||
pSSGMessage self = (pSSGMessage)ms;
|
||||
pHdb node = NULL;
|
||||
char *geterror = NULL, error[512];
|
||||
hdbValue ve;
|
||||
|
||||
node = FindHdbNode(NULL,self->name,NULL);
|
||||
if(node != NULL){
|
||||
cloneHdbValue(&node->value, self->v);
|
||||
geterror = GetHdbProp(node,"geterror");
|
||||
if(geterror != NULL){
|
||||
snprintf(error,sizeof(error),"ERROR: %s",geterror);
|
||||
ve = MakeHdbText(strdup(error));
|
||||
cloneHdbValue(&ve, self->v);
|
||||
ReleaseHdbValue(&ve);
|
||||
} else {
|
||||
cloneHdbValue(&node->value, self->v);
|
||||
}
|
||||
self->success = 1;
|
||||
return MPSTOP;
|
||||
} else {
|
||||
@ -381,14 +395,28 @@ static int GetDrivableFunc(void *ms, void *userData)
|
||||
pIDrivable pDriv = NULL;
|
||||
float fVal;
|
||||
hdbValue v;
|
||||
int oldMacro;
|
||||
|
||||
data = FindCommandData(pServ->pSics, self->name,NULL);
|
||||
if(data != NULL){
|
||||
pDriv = GetDrivableInterface(data);
|
||||
if(pDriv != NULL){
|
||||
/*
|
||||
All this macro flag handling is there to get hold of a
|
||||
error message stored in the Tcl interpreter if there is
|
||||
one.
|
||||
*/
|
||||
oldMacro = SCinMacro(pServ->dummyCon);
|
||||
SCsetMacro(pServ->dummyCon,1);
|
||||
fVal = pDriv->GetValue(data,pServ->dummyCon);
|
||||
v = MakeHdbFloat(fVal);
|
||||
self->success = 1;
|
||||
SCsetMacro(pServ->dummyCon,oldMacro);
|
||||
if(fVal < -900000) {
|
||||
v = MakeHdbText(Tcl_GetStringResult(InterpGetTcl(pServ->pSics)));
|
||||
self->success = 0;
|
||||
} else {
|
||||
v = MakeHdbFloat(fVal);
|
||||
self->success = 1;
|
||||
}
|
||||
cloneHdbValue(&v,self->v);
|
||||
return MPSTOP;
|
||||
}
|
||||
|
Reference in New Issue
Block a user