- made fixes to hkl

- Introduced a help system
- introduced a module for handling automatic updates of files during
  long measurements
- Added a circular buffer and handling facilities to varlog
- Upgraded documentation


SKIPPED:
	psi/faverage.h
	psi/nxamor.tex
	psi/pimotor.h
	psi/pimotor.tex
This commit is contained in:
cvs
2003-12-10 13:50:44 +00:00
parent 7a5f0193ab
commit bc02cb79e7
80 changed files with 2680 additions and 664 deletions

234
SCinter.c
View File

@ -6,6 +6,9 @@
Mark Koennecke, November 1996
Made ListObjects moe intelligent: list objects according to interface etc.
Mark Koennecke, December 2003
Copyright:
Labor fuer Neutronenstreuung
@ -422,11 +425,9 @@ extern char *SkipSpace(char *pPtr);
free(self);
}
/*--------------------------------------------------------------------------*/
int ListObjects(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
{
/*------------------------------------------------------------------------*/
static void printAll(SicsInterp *pSics, SConnection *pCon)
{
CommandList *pCurrent;
char pBueffel[256];
int iNum = 0;
@ -465,6 +466,228 @@ extern char *SkipSpace(char *pPtr);
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
}
}
/*-----------------------------------------------------------------------
printInterface prints only those objects which implement an interface
as specified bi the id given
-------------------------------------------------------------------------*/
static void printInterface(SicsInterp *pSics, SConnection *pCon, int id)
{
CommandList *pCurrent;
char pBueffel[256];
int iNum = 0;
pObjectDescriptor pObj = NULL;
assert(pSics);
assert(pCon);
pBueffel[0] = '\0';
pCurrent = pSics->pCList;
while(pCurrent)
{
pObj = FindDescriptor(pCurrent->pData);
if(pObj != NULL)
{
if(pObj->GetInterface(pObj,id) != NULL)
{
if(iNum == 0)
{
strcpy(pBueffel,pCurrent->pName);
iNum++;
}
else if(iNum < 4)
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
iNum++;
}
else
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
iNum = 0;
}
}
}
pCurrent = pCurrent->pNext;
}
/* write final entries */
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
}
/*-----------------------------------------------------------------------
printMatch prints only those objects which match the wildcard string given
-------------------------------------------------------------------------*/
extern int match(const char *mask, const char *name); /* from wwildcard.c */
static void printMatch(SicsInterp *pSics, SConnection *pCon, char *mask)
{
CommandList *pCurrent;
char pBueffel[256];
int iNum = 0;
pObjectDescriptor pObj = NULL;
assert(pSics);
assert(pCon);
pBueffel[0] = '\0';
pCurrent = pSics->pCList;
while(pCurrent)
{
pObj = FindDescriptor(pCurrent->pData);
if(pObj != NULL)
{
if(!match(mask,pObj->name))
{
if(iNum == 0)
{
strcpy(pBueffel,pCurrent->pName);
iNum++;
}
else if(iNum < 4)
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
iNum++;
}
else
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
iNum = 0;
}
}
}
pCurrent = pCurrent->pNext;
}
/* write final entries */
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
}
/*-----------------------------------------------------------------------
printType prints only those objects which match the type given
-------------------------------------------------------------------------*/
static void printType(SicsInterp *pSics, SConnection *pCon, char *type)
{
CommandList *pCurrent;
char pBueffel[256];
int iNum = 0;
assert(pSics);
assert(pCon);
pBueffel[0] = '\0';
pCurrent = pSics->pCList;
while(pCurrent)
{
if(pCurrent->pData != NULL)
{
if(iHasType(pCurrent->pData,type))
{
if(iNum == 0)
{
strcpy(pBueffel,pCurrent->pName);
iNum++;
}
else if(iNum < 4)
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
iNum++;
}
else
{
strcat(pBueffel," ");
strcat(pBueffel,pCurrent->pName);
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
iNum = 0;
}
}
}
pCurrent = pCurrent->pNext;
}
/* write final entries */
strcat(pBueffel,"\r\n");
SCWrite(pCon,pBueffel,eStatus);
}
/*--------------------------------------------------------------------------*/
int ListObjects(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
{
if(argc < 2)
{
printAll(pSics,pCon);
return 1;
}
strtolower(argv[1]);
/*
stand alone subcommands
*/
if(strstr(argv[1],"var") != NULL)
{
printType(pSics,pCon,"SicsVariable");
return 1;
}
if(strstr(argv[1],"mot") != NULL)
{
printType(pSics,pCon,"Motor");
return 1;
}
/*
subcommand with three args
*/
if(argc < 3)
{
SCWrite(pCon,"ERROR: missing parameter to command or bad subcommand",
eError);
return 0;
}
/*
interface
*/
if(strcmp(argv[1],"inter") == 0)
{
strtolower(argv[2]);
if(strstr(argv[2],"driv") != NULL)
{
printInterface(pSics,pCon,DRIVEID);
return 1;
}
if(strstr(argv[2],"coun") != NULL)
{
printInterface(pSics,pCon,COUNTID);
return 1;
}
if(strstr(argv[2],"env") != NULL)
{
printInterface(pSics,pCon,ENVIRINTERFACE);
return 1;
}
SCWrite(pCon,"ERROR: interface description nor recognized",eError);
return 0;
}
/*
match
*/
if(strcmp(argv[1],"match") == 0)
{
printMatch(pSics,pCon,argv[2]);
return 1;
}
return 1;
}
/*---------------------------------------------------------------------------*/
@ -567,3 +790,4 @@ void *FindDrivable(SicsInterp *pSics, char *name){
return NULL;
}