- More debugging of scriptcontext, mostly working now
- Created driveable SICSobj for standalone and as an adapter
This commit is contained in:
35
sicsobj.c
35
sicsobj.c
@ -18,7 +18,7 @@
|
||||
|
||||
extern int decodeSICSPriv(char *txt); /* from access.c */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void DefaultKill(void *data){
|
||||
void DefaultKill(void *data){
|
||||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -209,22 +209,47 @@ static int MakeScriptFunc(pSICSOBJ self, SConnection *pCon,
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int isNodePrintable(pHdb node){
|
||||
switch(node->value.dataType){
|
||||
case HIPNONE:
|
||||
case HIPFUNC:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int InvokeSICSOBJ(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]){
|
||||
pSICSOBJ self = NULL;
|
||||
int status;
|
||||
pHdb parNode;
|
||||
char buffer[132];
|
||||
hdbValue data;
|
||||
pDynString parData;
|
||||
|
||||
self = (pSICSOBJ)pData;
|
||||
assert(self != NULL);
|
||||
|
||||
if(argc < 2){
|
||||
SCWrite(pCon,"ERROR: Nothing to process",eError);
|
||||
return -1;
|
||||
}
|
||||
if (argc == 1) {
|
||||
parNode = self->objectNode;
|
||||
if(parNode != NULL && isNodePrintable(parNode) ){
|
||||
status = GetHipadabaPar(parNode,&data,pCon);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
}
|
||||
parData = formatValue(data, parNode);
|
||||
if(parData == NULL){
|
||||
SCWrite(pCon,"ERROR: failed to format data", eError);
|
||||
return 0;
|
||||
}
|
||||
SCPrintf(pCon,eValue,"%s = %s", argv[0], GetCharArray(parData));
|
||||
DeleteDynString(parData);
|
||||
return 1;
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: nothing to print", eError);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
parNode = GetHipadabaNode(self->objectNode,argv[1]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user