- Fixed a normalisation problem in diffscan when the first value
did not have enough counts - Reduced polling frequency in emon - Fixed a scriptcontext bug which would cause it to dump core in SctTransact on interrupts - Fixed an issue with missing <nl> at the end of batch files - Added a feature which does not call halt when counting stops in hmcontrol.c This is necessary for the BOA CCD - Initalized doNotFree properly in hipadaba.c - Added the travelling salesman reflection measurement algorithm - Added another component to amorset - Removed old SicsWait from nserver.c - Added a means to nxscript to write 16 bit data for BOA - Modified tasub to accept a drivabel as a motor and not only a motor. This became necessary to make EIGER work as A2 on EIGER is a virtual motor SKIPPED: psi/amorcomp.h psi/amordrive.h psi/amorset.c psi/amorset.h psi/amorset.tex psi/amorset.w psi/el734hp.c psi/el737hpdriv.c psi/make_gen psi/pardef.c psi/polterwrite.c psi/psi.c psi/sinqhttpopt.c
This commit is contained in:
115
nxscript.c
115
nxscript.c
@@ -971,7 +971,7 @@ static void putSlab(SConnection * pCon, SicsInterp * pSics, pNXScript self,
|
||||
memsec = (pCounter) FindCommandData(pSics, argv[5], "HistMemSec");
|
||||
if(memsec != NULL){
|
||||
node = GetHipadabaNode(memsec->pDes->parNode,"data");
|
||||
if(data != NULL){
|
||||
if(node == NULL){
|
||||
SCWrite(pCon,"ERROR: ?? data node to second gen HM not found", eError);
|
||||
return;
|
||||
}
|
||||
@@ -1001,6 +1001,116 @@ static void putSlab(SConnection * pCon, SicsInterp * pSics, pNXScript self,
|
||||
eLogError);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static short *HistInt2Short(HistInt *data, int length)
|
||||
{
|
||||
int i;
|
||||
|
||||
int16_t *shdata = NULL;
|
||||
shdata = malloc(length*sizeof(int16_t));
|
||||
if(shdata == NULL){
|
||||
return NULL;
|
||||
}
|
||||
memset(shdata,0,length*sizeof(int16_t));
|
||||
for(i = 0; i < length; i++){
|
||||
shdata[i] = (short)data[i];
|
||||
}
|
||||
return shdata;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void putSlab16(SConnection * pCon, SicsInterp * pSics, pNXScript self,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int start[NX_MAXRANK], size[NX_MAXRANK], dim[MAXDIM];
|
||||
int status, written = 0, rank, i;
|
||||
pHistMem mem = NULL;
|
||||
HistInt *histData = NULL;
|
||||
int16_t *shortData = NULL;
|
||||
pHdb node = NULL;
|
||||
unsigned int length;
|
||||
pCounter memsec = NULL;
|
||||
|
||||
if (argc < 6) {
|
||||
SCWrite(pCon, "ERROR: insufficient number of arguments to putslab",
|
||||
eLogError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = NXDopenalias(self->fileHandle, self->dictHandle, argv[2]);
|
||||
if (status != NX_OK) {
|
||||
SCPrintf(pCon, eLogError, "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", eLogError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = listToArray(pSics, argv[4], size);
|
||||
if (status != TCL_OK) {
|
||||
SCWrite(pCon, "ERROR: failed to convert size value list", eLogError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* try to write HM data
|
||||
*/
|
||||
mem = (pHistMem) FindCommandData(pSics, argv[5], "HistMem");
|
||||
if (mem != NULL) {
|
||||
histData = GetHistogramPointer(mem, pCon);
|
||||
if (histData) {
|
||||
GetHistDim(mem, dim,&rank);
|
||||
for(i = 0, length = 1; i < rank; i++){
|
||||
length *= dim[i];
|
||||
}
|
||||
shortData = HistInt2Short(histData,length);
|
||||
if(shortData != NULL){
|
||||
status = NXputslab(self->fileHandle, shortData, start, size);
|
||||
free(shortData);
|
||||
}
|
||||
if (status == NX_OK) {
|
||||
written = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* try to write second gen histogram data
|
||||
*/
|
||||
memsec = (pCounter) FindCommandData(pSics, argv[5], "HistMemSec");
|
||||
if(memsec != NULL){
|
||||
node = GetHipadabaNode(memsec->pDes->parNode,"data");
|
||||
if(node == NULL){
|
||||
SCWrite(pCon,"ERROR: ?? data node to second gen HM not found", eError);
|
||||
return;
|
||||
}
|
||||
GetHistDim((pHistMem)memsec, dim,&rank);
|
||||
for(i = 0, length = 1; i < rank; i++){
|
||||
length *= dim[i];
|
||||
}
|
||||
shortData = HistInt2Short(node->value.v.intArray,length);
|
||||
if(shortData != NULL){
|
||||
status = NXputslab(self->fileHandle, shortData, start, size);
|
||||
free(shortData);
|
||||
}
|
||||
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",
|
||||
eLogError);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
static void putTimeBinning(SConnection * pCon, SicsInterp * pSics,
|
||||
@@ -1397,6 +1507,9 @@ static int handlePut(SConnection * pCon, SicsInterp * pSics,
|
||||
} else if (strcmp(argv[1], "putslab") == 0) {
|
||||
/*===============*/
|
||||
putSlab(pCon, pSics, self, argc, argv);
|
||||
} else if (strcmp(argv[1], "putslab16") == 0) {
|
||||
/*===============*/
|
||||
putSlab16(pCon, pSics, self, argc, argv);
|
||||
} else {
|
||||
SCPrintf(pCon, eLogError, "ERROR: put command %s not recognised", argv[1] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user