- Added SicsList
- Removed group and description attributes from ObjectDescriptor SKIPPED: psi/dornier2.c psi/libpsi.a psi/make_gen psi/makefile_linux psi/pimotor.c psi/pipiezo.c psi/psi.c psi/serial.c psi/sinqhttp.c psi/sinqhttp.h psi/tcpdornier.c psi/velodornier.c
This commit is contained in:
93
SCinter.c
93
SCinter.c
@ -65,6 +65,7 @@
|
||||
#include "interface.h"
|
||||
#include "motor.h"
|
||||
#include "obdes.h"
|
||||
#include "lld.h"
|
||||
|
||||
/* M.Z. */
|
||||
#include "definealias.h"
|
||||
@ -1019,95 +1020,3 @@ int compareStringNode(void *pStr1, void **ppStr2)
|
||||
pCurrent = pNext;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int handleGet(SConnection *pCon,SicsInterp *pSics, int argc,
|
||||
char *argv[]){
|
||||
CommandList *obj = NULL;
|
||||
pDummy pDum = NULL;
|
||||
char pBueffel[512];
|
||||
char *pPtr = NULL;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: Insufficient number of arguments to SicsAtt get",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
obj = FindCommand(pSics,argv[2]);
|
||||
if(obj == NULL){
|
||||
snprintf(pBueffel,511,"ERROR: object %s not found",argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
pDum = obj->pData;
|
||||
if(pDum == NULL){
|
||||
snprintf(pBueffel,511,"%s has no data, is command", argv[2]);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
strtolower(argv[3]);
|
||||
if(strcmp(argv[3],"type") == 0){
|
||||
snprintf(pBueffel,511, "%s.type = %s", argv[2], pDum->pDescriptor->name);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
} else {
|
||||
pPtr = GetDescriptorKey(pDum->pDescriptor, argv[3]);
|
||||
if(pPtr == NULL){
|
||||
snprintf(pBueffel,511,"%s.%s = Undefined", argv[0], argv[3]);
|
||||
} else {
|
||||
snprintf(pBueffel,511,"%s.%s = %s", argv[0], argv[3], pPtr);
|
||||
}
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int handleSet(SConnection *pCon,SicsInterp *pSics, int argc,
|
||||
char *argv[]){
|
||||
CommandList *obj = NULL;
|
||||
pDummy pDum = NULL;
|
||||
char pBueffel[512];
|
||||
char *pPtr = NULL;
|
||||
|
||||
if(argc < 5){
|
||||
SCWrite(pCon,"ERROR: Insufficient number of arguments to SicsAtt set",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
obj = FindCommand(pSics,argv[2]);
|
||||
if(obj == NULL){
|
||||
snprintf(pBueffel,511,"ERROR: object %s not found",argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
pDum = obj->pData;
|
||||
if(pDum == NULL){
|
||||
snprintf(pBueffel,511,"%s has no data, is command", argv[2]);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
strtolower(argv[3]);
|
||||
pDum->pDescriptor->pKeys = IFSetOption(pDum->pDescriptor->pKeys, argv[3], argv[4]);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int SicsAtt(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]){
|
||||
CommandList *current = NULL;
|
||||
pDummy pDum = NULL;
|
||||
|
||||
if(argc < 2){
|
||||
SCWrite(pCon,"ERROR: insufficient number of argumens to SicsAtt",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
strtolower(argv[1]);
|
||||
if(strcmp(argv[1],"get") == 0) {
|
||||
return handleGet(pCon, pSics, argc, argv);
|
||||
} else if(strcmp(argv[1],"set") == 0){
|
||||
return handleSet(pCon,pSics,argc, argv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user