- A syntax checker for SICS was implemented
This commit is contained in:
74
mumo.c
74
mumo.c
@ -13,6 +13,10 @@
|
||||
|
||||
heavily reworked and simplified, Mark Koennecke, June 1997
|
||||
|
||||
added: defpos, recovernampos and made mumo save named positions
|
||||
to the backup file. Mark Koennecke, March 2003
|
||||
|
||||
|
||||
Copyright:
|
||||
|
||||
Labor fuer Neutronenstreuung
|
||||
@ -59,6 +63,28 @@
|
||||
#include "stringdict.h"
|
||||
#include "mumo.h"
|
||||
#include "mumo.i"
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int SaveMumo(void *pData, char *name, FILE *fd)
|
||||
{
|
||||
pMulMot self = NULL;
|
||||
char pCommand[512];
|
||||
const char *pName = NULL;
|
||||
|
||||
self = (pMulMot)pData;
|
||||
if(self == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fprintf(fd,"#----- MultiMotor %s\n", name);
|
||||
while((pName = StringDictGetNext(self->pNamPos,pCommand, 511)) != NULL)
|
||||
{
|
||||
if(strcmp(pName,"back") != 0)
|
||||
{
|
||||
fprintf(fd,"%s recovernampos %s %s\n",name,pName,pCommand);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
pMulMot MakeMultiMotor(void)
|
||||
{
|
||||
@ -88,11 +114,12 @@
|
||||
free(pNew);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pNew->pDes->SaveStatus = SaveMumo;
|
||||
|
||||
/* the parameter array */
|
||||
pNew->pParam = ObParCreate(1);
|
||||
ObParInit(pNew->pParam,ACCESS,"accesscode",usUser,usMugger);
|
||||
|
||||
|
||||
pNew->name = NULL;
|
||||
return pNew;
|
||||
@ -162,6 +189,7 @@
|
||||
#define NAMALL 12
|
||||
#define LIST 13
|
||||
#define DEFPOS 14
|
||||
#define RECOVERNAMPOS 15
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int GetNextToken(psParser self, pMulMot pDings)
|
||||
{
|
||||
@ -289,6 +317,11 @@
|
||||
self->iCurrentToken = DEFPOS;
|
||||
return DEFPOS;
|
||||
}
|
||||
else if(strcmp(self->Token,"recovernampos") ==0)
|
||||
{
|
||||
self->iCurrentToken = RECOVERNAMPOS;
|
||||
return RECOVERNAMPOS;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->iCurrentToken = SYMBOL;
|
||||
@ -675,12 +708,24 @@
|
||||
iToken = GetNextToken(pPP,self);
|
||||
}
|
||||
|
||||
/* The rest of the stuff should be the motors to drive until
|
||||
we are there
|
||||
*/
|
||||
StringDictAddPair(self->pNamPos,namPos,command);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static void RecoverNamPos(pMulMot self, int argc, char *argv[])
|
||||
{
|
||||
char pCommand[512];
|
||||
|
||||
Arg2Text(argc-1,&argv[1],pCommand, 511);
|
||||
if(StringDictExists(self->pNamPos,argv[0]))
|
||||
{
|
||||
StringDictUpdate(self->pNamPos,argv[0],pCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringDictAddPair(self->pNamPos,argv[0],pCommand);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------
|
||||
MultiWrapper is the user interface to a multi motor unit. It supports the
|
||||
following syntax, where DingsBums is the name of the unit:
|
||||
@ -694,7 +739,10 @@
|
||||
DingsBums drop name - deletes the current named position
|
||||
name.
|
||||
DingsBums drop all - drops all named positions (except back)
|
||||
DingsBums list - lists all named positions.
|
||||
DingsBums list - lists all named positions.
|
||||
DingsBums recovernampos nam bla.... - internal command to recover
|
||||
saved named positions
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@ -757,6 +805,7 @@
|
||||
if(iRet)
|
||||
{
|
||||
SCSendOK(pCon);
|
||||
SCparChange(pCon);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -782,6 +831,7 @@
|
||||
}
|
||||
break;
|
||||
case DEFPOS:
|
||||
SCparChange(pCon);
|
||||
return ParseDefPos(pSics,&MyParser,self,pCon);
|
||||
break;
|
||||
case LIST:
|
||||
@ -816,7 +866,8 @@
|
||||
if((iToken == SYMBOL) || (iToken == NAMPOS))
|
||||
{
|
||||
MakeCurrentNamPos(MyParser.Token,pCon,self);
|
||||
return 1;
|
||||
SCparChange(pCon);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -836,6 +887,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
SCparChange(pCon);
|
||||
return ParseDropPos(&MyParser, pCon, self);
|
||||
}
|
||||
}
|
||||
@ -857,6 +909,14 @@
|
||||
sprintf(pError,"ERROR: Unknown Token %s",MyParser.Token);
|
||||
SCWrite(pCon,pError,eError);
|
||||
return 0;
|
||||
case RECOVERNAMPOS:
|
||||
/*
|
||||
This is not meant to be user command but a facility to read
|
||||
back data from sattus file. This is why the error checking
|
||||
is not happening
|
||||
*/
|
||||
RecoverNamPos(self,argc-2,&argv[2]);
|
||||
return 1;
|
||||
default:
|
||||
SCWrite(pCon,"ERROR: Parse Error",eError);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user