Define Alias M.Z.

This commit is contained in:
cvs
2001-04-27 08:38:20 +00:00
parent 63d84a85ad
commit 092e9f21d2
6 changed files with 349 additions and 2 deletions

View File

@ -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;
}