- Changes to SLS magnet controller
- Added nxscript putsicsdata to nxscript
This commit is contained in:
34
nxscript.c
34
nxscript.c
@@ -29,6 +29,7 @@
|
||||
#include "udpquieck.h"
|
||||
#include "nxdict.h"
|
||||
#include "nxscript.h"
|
||||
#include "sicsdata.h"
|
||||
|
||||
extern char *trim(char *str);
|
||||
|
||||
@@ -342,6 +343,36 @@ static void putCounter(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
return;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void putSicsData(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self, int argc, char *argv[]){
|
||||
|
||||
pSICSData data = NULL;
|
||||
int status;
|
||||
char buffer[256];
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to putSicsData",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
find data
|
||||
*/
|
||||
data = (pSICSData)FindCommandData(pSics,argv[3],"SICSData");
|
||||
if(data == NULL){
|
||||
snprintf(buffer,255,"ERROR: sicsdata %s not found!", argv[3]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = NXDputalias(self->fileHandle,self->dictHandle,argv[2],data->data);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write sicsdata to %s", argv[2]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void updateHMDim(NXScript *self, pHistMem mem){
|
||||
int iDim[MAXDIM];
|
||||
int i, rank, timeLength, status;
|
||||
@@ -944,6 +975,9 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
}else if(strcmp(argv[1],"putglobal") == 0){
|
||||
/*===============*/
|
||||
putGlobal(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putsicsdata") == 0){
|
||||
/*===============*/
|
||||
putSicsData(pCon,pSics,self,argc,argv);
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: put command not recognised",eError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user