diff --git a/script.c b/script.c index 5b2cc9c6..3dfa8e46 100644 --- a/script.c +++ b/script.c @@ -522,3 +522,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; + } + diff --git a/script.h b/script.h index e88e086f..29cbafad 100644 --- a/script.h +++ b/script.h @@ -45,6 +45,9 @@ /*----------------------------------------------------------------------*/ int SicsPrompt(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]); +/*----------------------------------------------------------------------*/ + int SICSDescriptor(SConnection *pCon, SicsInterp *pSics, void *pData, + int argc, char *argv[]); #endif