- Removed automatic loading of status file on startup
- make soft motor values the default all over - Introduced nxscript putSlab - Fixed a bug in polldriv
This commit is contained in:
102
nxscript.c
102
nxscript.c
@@ -391,11 +391,12 @@ static void putAttribute(SConnection *pCon, SicsInterp *pSics,
|
||||
return;
|
||||
}
|
||||
status = NXputattr(self->fileHandle,argv[3],(void *)argv[4],
|
||||
strlen(argv[4])+1, type);
|
||||
strlen(argv[4])+1, type);
|
||||
if(status != NX_OK){
|
||||
sprintf(buffer,"ERROR: failed to write attribute %s", argv[3]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
}
|
||||
NXopenpath(self->fileHandle,"/");
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void updateHMDim(NXScript *self, pHistMem mem){
|
||||
@@ -594,10 +595,7 @@ static void putHistogramMemoryChunked(SConnection *pCon, SicsInterp *pSics,
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
read HM
|
||||
*/
|
||||
@@ -647,6 +645,95 @@ static void putHistogramMemoryChunked(SConnection *pCon, SicsInterp *pSics,
|
||||
|
||||
return;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int listToArray(SicsInterp *pSics, char *list,
|
||||
int intar[NX_MAXRANK]){
|
||||
int argc, status, i, val;
|
||||
CONST char **argv;
|
||||
Tcl_Interp *pTcl = InterpGetTcl(pSics);
|
||||
|
||||
status = Tcl_SplitList(pTcl, list, &argc, &argv);
|
||||
if(status != TCL_OK){
|
||||
return status;
|
||||
}
|
||||
|
||||
for(i = 0; i < argc; i++){
|
||||
status = Tcl_GetInt(pTcl,argv[i],&val);
|
||||
if(status != TCL_OK){
|
||||
return status;
|
||||
}
|
||||
intar[i] = val;
|
||||
}
|
||||
Tcl_Free((char *)argv);
|
||||
return TCL_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
int start[NX_MAXRANK], size[NX_MAXRANK];
|
||||
int status, written = 0;
|
||||
pHistMem mem = NULL;
|
||||
HistInt *histData = NULL;
|
||||
pSICSData data = NULL;
|
||||
|
||||
if(argc < 6){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to putslab",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = NXDopenalias(self->fileHandle, self->dictHandle,argv[2]);
|
||||
if(status != NX_OK){
|
||||
SCPrintf(pCon,eError,"ERROR: failed to open alias %s", argv[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
status = listToArray(pSics,argv[3],start);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,"ERROR: failed to convert start value list", eError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = listToArray(pSics,argv[4],size);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,"ERROR: failed to convert size value list", eError);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* try to write HM data
|
||||
*/
|
||||
mem = (pHistMem)FindCommandData(pSics,argv[5],"HistMem");
|
||||
if(mem != NULL){
|
||||
histData = GetHistogramPointer(mem,pCon);
|
||||
if(histData){
|
||||
status = NXputslab(self->fileHandle, histData, start, size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* try to look for sicsdata
|
||||
*/
|
||||
data = (pSICSData)FindCommandData(pSics,argv[5],"SICSData");
|
||||
if(data != NULL){
|
||||
status = NXputslab(self->fileHandle,data->data,start,size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* drop out of hierarchy
|
||||
*/
|
||||
NXopenpath(self->fileHandle,"/");
|
||||
|
||||
if(written == 0){
|
||||
SCWrite(pCon,"ERROR: failed to write data, data not recognised",
|
||||
eError);
|
||||
}
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
static void putTimeBinning(SConnection *pCon, SicsInterp *pSics,
|
||||
pNXScript self,
|
||||
@@ -659,7 +746,7 @@ static void putTimeBinning(SConnection *pCon, SicsInterp *pSics,
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to puttimebinning",
|
||||
eError);
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1024,6 +1111,9 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
}else if(strcmp(argv[1],"putattribute") == 0){
|
||||
/*===============*/
|
||||
putAttribute(pCon,pSics,self,argc,argv);
|
||||
}else if(strcmp(argv[1],"putslab") == 0){
|
||||
/*===============*/
|
||||
putSlab(pCon,pSics,self,argc,argv);
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: put command not recognised",eError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user