Define Alias M.Z.
This commit is contained in:
16
SCinter.c
16
SCinter.c
@ -35,6 +35,8 @@
|
||||
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
||||
|
||||
M. Zolliker, Sept 2000, introduced formal aliases, modifications marked M.Z
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -51,6 +53,8 @@
|
||||
#include "devexec.h"
|
||||
#include "servlog.h"
|
||||
#include "macro.h"
|
||||
/* M.Z. */
|
||||
#include "definealias.h"
|
||||
|
||||
#define MAXLEN 256
|
||||
#define MAXPAR 100
|
||||
@ -68,6 +72,7 @@
|
||||
return NULL;
|
||||
}
|
||||
pInter->pCList = NULL;
|
||||
pInter->AList.pFirst = NULL; /* M.Z. */
|
||||
pInter->pTcl = (void *)MacroInit(pInter);
|
||||
if(!pInter->pTcl)
|
||||
{
|
||||
@ -91,6 +96,7 @@
|
||||
|
||||
strcpy(pBueffel,pName);
|
||||
strtolower(pBueffel);
|
||||
RemoveAlias(&pInterp->AList,pBueffel); /* M.Z. */
|
||||
if(FindCommand(pInterp,pBueffel) != NULL)
|
||||
{
|
||||
return 0;
|
||||
@ -276,7 +282,7 @@ extern char *SkipSpace(char *pPtr);
|
||||
CommandList *FindCommand(SicsInterp *self, char *pName)
|
||||
{
|
||||
CommandList *pCurrent = NULL;
|
||||
char pBueffel[256];
|
||||
char pBueffel[256], *pCmd;
|
||||
|
||||
assert(self);
|
||||
|
||||
@ -287,12 +293,15 @@ extern char *SkipSpace(char *pPtr);
|
||||
|
||||
strcpy(pBueffel,pName);
|
||||
strtolower(pBueffel);
|
||||
|
||||
pCmd=TranslateAlias(&self->AList, pBueffel); /* M.Z. */
|
||||
|
||||
pCurrent = self->pCList;
|
||||
while(pCurrent)
|
||||
{
|
||||
if(pCurrent->pName != NULL)
|
||||
{
|
||||
if(strcmp(pCurrent->pName, pBueffel) == 0 )
|
||||
if(strcmp(pCurrent->pName, pCmd) == 0 ) /* M.Z. */
|
||||
{
|
||||
return pCurrent;
|
||||
}
|
||||
@ -371,6 +380,8 @@ extern char *SkipSpace(char *pPtr);
|
||||
pCurrent = pTemp;
|
||||
}
|
||||
|
||||
FreeAliasList(&self->AList); /* M.Z. */
|
||||
|
||||
/* clear Tcl_Interpreter. Must be AFTER deleting command list because
|
||||
some devices may have Tcl drivers which need to be accessed for
|
||||
proper closing of devices.
|
||||
@ -512,3 +523,4 @@ extern char *SkipSpace(char *pPtr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user