- Fixed state monitor eclipse commit problems. Siiiiiiiggggghhhhhh!
This commit is contained in:
66
SCinter.c
66
SCinter.c
@ -41,7 +41,7 @@
|
||||
Mark Koennecke, August 2001, modified SicsWriteStatus to write motor
|
||||
positions on demand.
|
||||
|
||||
Made ListObjects moe intelligent: list objects according to interface etc.
|
||||
Made ListObjects more intelligent: list objects according to interface etc.
|
||||
Mark Koennecke, December 2003
|
||||
|
||||
Extended 'dir' command (function ListObjects) to list via typename from
|
||||
@ -50,6 +50,8 @@
|
||||
|
||||
Modified printXXX functions to fix duplicate write of last buffer line.
|
||||
Paul Hathaway, May 2004
|
||||
|
||||
Added FindAlias function, Mark Koennecke, January 2007
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -67,6 +69,7 @@
|
||||
#include "motor.h"
|
||||
#include "obdes.h"
|
||||
#include "lld.h"
|
||||
#include "dynstring.h"
|
||||
|
||||
/* M.Z. */
|
||||
#include "definealias.h"
|
||||
@ -1042,3 +1045,64 @@ static void freeList(int listID)
|
||||
pCurrent = pNext;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
char *FindAliases(SicsInterp *pSics, char *name)
|
||||
{
|
||||
pDynString result = NULL;
|
||||
CommandList *pOri = NULL, *pCom = NULL;
|
||||
char *pTrans = NULL, *charResult = NULL;
|
||||
int first;
|
||||
|
||||
pOri = FindCommand(pSics, name);
|
||||
if(pOri == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if(pOri->pData == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = CreateDynString(64,64);
|
||||
if(result == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* try first to locate Markus style aliases */
|
||||
pTrans = TranslateAlias(&pSics->AList,name);
|
||||
if(strcmp(pTrans,name) != 0)
|
||||
{
|
||||
DynStringCopy(result,pTrans);
|
||||
charResult = strdup(GetCharArray(result));
|
||||
DeleteDynString(result);
|
||||
return charResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* locate SicsAlias style aliases by comparing the original
|
||||
* data pointer with the data pointers of other commands
|
||||
*/
|
||||
first = 1;
|
||||
pCom = pSics->pCList;
|
||||
while(pCom != NULL)
|
||||
{
|
||||
if(pCom != pOri && pCom->pData == pOri->pData)
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
DynStringCopy(result,pCom->pName);
|
||||
first = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DynStringConcat(result,",");
|
||||
DynStringConcat(result,pCom->pName);
|
||||
}
|
||||
}
|
||||
pCom = pCom->pNext;
|
||||
}
|
||||
charResult = strdup(GetCharArray(result));
|
||||
DeleteDynString(result);
|
||||
return charResult;
|
||||
}
|
||||
|
Reference in New Issue
Block a user