nxscript.c SICS-295
Restored a modification made in revision 1.7 which was reverted during the PSI update (2/10/08) probably when investigating SICS-291 hmm_configuration_common_1.tcl Added hmm ratemap_xy_max_bin and ratemap_xy_total site_ansto/hardsup/sct_galilprot.c site_ansto/hardsup/makefile Started adding galil protocol for script-context controllers. sans/config/parameters/parameters.tcl SICS-180 BeamCenterY should have been BeamCenterZ r2742 | ffr | 2008-11-07 10:13:51 +1100 (Fri, 07 Nov 2008) | 13 lines
This commit is contained in:
committed by
Douglas Clowes
parent
a00b32dbe4
commit
283c7d56dc
38
nxscript.c
38
nxscript.c
@@ -668,6 +668,7 @@ static int listToArray(SicsInterp *pSics, char *list,
|
||||
return TCL_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
#define HANUM 3
|
||||
static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
int start[NX_MAXRANK], size[NX_MAXRANK];
|
||||
@@ -675,6 +676,9 @@ static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
pHistMem mem = NULL;
|
||||
HistInt *histData = NULL;
|
||||
pSICSData data = NULL;
|
||||
char buffer[256];
|
||||
enum histargs {haStart, haLength, haBank};
|
||||
int i, haIndex, hpars[HANUM], haFirst=6;
|
||||
|
||||
if(argc < 6){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to putslab",
|
||||
@@ -705,13 +709,37 @@ static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
*/
|
||||
mem = (pHistMem)FindCommandData(pSics,argv[5],"HistMem");
|
||||
if(mem != NULL){
|
||||
if (argc == 6) {
|
||||
histData = GetHistogramPointer(mem,pCon);
|
||||
if(histData){
|
||||
status = NXputslab(self->fileHandle, histData, start, size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
} else if (argc > 6) {
|
||||
for (i=0, haIndex=haFirst; i < HANUM; i++, haIndex++) {
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[haIndex],&hpars[i]);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to integer",
|
||||
argv[haIndex]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
histData = (HistInt *)malloc(hpars[haLength]*sizeof(HistInt));
|
||||
if(!histData){
|
||||
SCWrite(pCon,"ERROR: out of memory for reading histogram memory",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
memset(histData,0,hpars[haLength]*sizeof(HistInt));
|
||||
status = GetHistogramDirect(mem,pCon,hpars[haBank],
|
||||
hpars[haStart],hpars[haStart]+hpars[haLength],histData,
|
||||
hpars[haLength]*sizeof(HistInt));
|
||||
}
|
||||
if(histData){
|
||||
status = NXputslab(self->fileHandle, histData, start, size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
if (argc > 6)
|
||||
free(histData);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user