PSI update
r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
634f2023b1
commit
3168325921
69
SCinter.c
69
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"
|
||||
@@ -134,6 +137,7 @@ static void freeList(int listID);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
return 0;
|
||||
}
|
||||
memset(pNew,0,sizeof(CommandList));
|
||||
|
||||
/* if no data given, initialise with Dummy struct */
|
||||
if(!pData)
|
||||
@@ -431,7 +435,7 @@ extern char *SkipSpace(char *pPtr);
|
||||
}
|
||||
if(fVal > -990.)
|
||||
{
|
||||
fprintf(fd,"run %s %f\n",pCurrent->pName, fVal);
|
||||
fprintf(fd,"drive %s %f\n",pCurrent->pName, fVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1041,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