PSI sics-cvs-psi-2006
This commit is contained in:
49
script.c
49
script.c
@@ -411,6 +411,7 @@
|
||||
char pBueffel[256];
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
int iRet;
|
||||
char *cmd;
|
||||
|
||||
assert(pCon);
|
||||
assert(pSics);
|
||||
@@ -425,8 +426,13 @@
|
||||
pTcl = InterpGetTcl(pSics);
|
||||
assert(pTcl);
|
||||
|
||||
Arg2Text(argc-1,&argv[1],pBueffel,255);
|
||||
iRet = Tcl_Eval(pTcl,pBueffel);
|
||||
cmd = Arg2Tcl(argc-1,&argv[1],pBueffel,sizeof pBueffel);
|
||||
if (!cmd) {
|
||||
SCWrite(pCon,"ERROR: no more memory",eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = Tcl_Eval(pTcl,cmd);
|
||||
if (cmd != pBueffel) free(cmd);
|
||||
if(strlen(pTcl->result) > 1)
|
||||
{
|
||||
SCWrite(pCon,pTcl->result,eValue);
|
||||
@@ -522,3 +528,42 @@
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*----------------------- get object descriptor name -------------------------------
|
||||
get the name of the object descriptor
|
||||
*/
|
||||
|
||||
int SICSDescriptor(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
CommandList *pCom = NULL;
|
||||
Dummy *pDum = NULL;
|
||||
char pBueffel[132];
|
||||
|
||||
|
||||
assert(pCon);
|
||||
assert(pSics);
|
||||
|
||||
/* is there a parameter anyway */
|
||||
if(argc < 2)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: no object specified!",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pCom = FindCommand(pSics,argv[1]);
|
||||
if(pCom)
|
||||
{
|
||||
pDum = (Dummy *)pCom->pData;
|
||||
if(pDum)
|
||||
{
|
||||
SCWrite(pCon,pDum->pDescriptor->name,eValue);
|
||||
return 1;
|
||||
}
|
||||
SCWrite(pCon,"empty",eValue);
|
||||
return 1;
|
||||
}
|
||||
|
||||
SCWrite(pCon,"notfound",eValue);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user