diff --git a/nxscript.c b/nxscript.c index a97178d2..d036f8fd 100644 --- a/nxscript.c +++ b/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); + } } /* diff --git a/site_ansto/hardsup/makefile b/site_ansto/hardsup/makefile index d543a109..e045f571 100644 --- a/site_ansto/hardsup/makefile +++ b/site_ansto/hardsup/makefile @@ -10,7 +10,7 @@ SRC = . CC = gcc CFLAGS = -g -DLINUX $(DFORTIFY) -I$(SRC) -I../.. -Wall -Wno-unused -HOBJ= nhq200util.o itc4util.o lh45util.o lakeshore340util.o west4100util.o asynsrv_utility.o geterrno.o strjoin.o chopper.o modbustcp.o +HOBJ= nhq200util.o itc4util.o lh45util.o lakeshore340util.o west4100util.o asynsrv_utility.o geterrno.o strjoin.o chopper.o modbustcp.o sct_galilprot.o libhlib.a: $(HOBJ) rm -f libhlib.a diff --git a/site_ansto/hardsup/sct_galilprot.c b/site_ansto/hardsup/sct_galilprot.c new file mode 100644 index 00000000..676ba5b6 --- /dev/null +++ b/site_ansto/hardsup/sct_galilprot.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +int GalilProtHandler(Ascon *a) { + int ret; + char chr; + + switch(a->state){ + case AsconReadStart: + DynStringClear(a->rdBuffer); + a->start = DoubleTime(); + ret = AsconReadChar(a->fd, &chr); + switch (chr) { + case ' ': + a->state = AsconReading; + break; + case '?': + AsconError(a, "Galil Error", errno); + a->state == AsconReadDone; + break; + case ':': + a->state == AsconReadDone; + break; + } + break; + default: + return AsconStdHandler(a); + } + return 1; +} + +void AddGalilProtocoll(){ + AsconProtocol *prot = NULL; + + prot = calloc(sizeof(AsconProtocol), 1); + prot->name = strdup("galil"); + prot->init = AsconStdInit; + prot->handler = GalilProtHandler; + AsconInsertProtocol(prot); +} diff --git a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl index 84643f57..440fdb87 100644 --- a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl +++ b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.42 $ -# $Date: 2008-10-27 04:55:41 $ +# $Revision: 1.43 $ +# $Date: 2008-11-06 23:13:50 $ # Author: Ferdi Franceschini # Based on the examples in the hs_test.tcl sample configuration by Mark Lesha. # http://gumtree.ansto.gov.au:9080/nbicms/bragg-systems/histogram-server/hs_test.tcl/view @@ -1576,6 +1576,20 @@ sicslist setatt ::histogram_memory::time long_name time sicslist setatt ::histogram_memory::time mutable true sicslist setatt ::histogram_memory::time units seconds +::utility::macro::getset int ::histogram_memory::ratemap_xy_max_bin {} { + return "ratemap_xy_max_bin = [lindex [hmm configure ratemap_xy_max_bin] 2]" +} +sicslist setatt ::histogram_memory::ratemap_xy_max_bin klass detector +sicslist setatt ::histogram_memory::ratemap_xy_max_bin long_name max_binrate +sicslist setatt ::histogram_memory::ratemap_xy_max_bin mutable true + +::utility::macro::getset int ::histogram_memory::ratemap_xy_total {} { + return "ratemap_xy_total = [lindex [hmm configure ratemap_xy_total] 2]" +} +sicslist setatt ::histogram_memory::ratemap_xy_total klass detector +sicslist setatt ::histogram_memory::ratemap_xy_total long_name total_maprate +sicslist setatt ::histogram_memory::ratemap_xy_total mutable true + ## # @brief Update the beam monitors when the histmem has finished counting. proc ::histogram_memory::countend_event {} { diff --git a/site_ansto/instrument/sans/config/parameters/parameters.tcl b/site_ansto/instrument/sans/config/parameters/parameters.tcl index 018fe4cf..9a93dc90 100644 --- a/site_ansto/instrument/sans/config/parameters/parameters.tcl +++ b/site_ansto/instrument/sans/config/parameters/parameters.tcl @@ -65,7 +65,7 @@ foreach {var lname nxname units priv } { BSZmm BSZmm z mm user Transmission Transmission Transmission 1 user BeamCenterX BeamCenterX BeamCenterX mm user - BeamCenterY BeamCenterY BeamCenterY mm user + BeamCenterZ BeamCenterZ BeamCenterZ mm user } { ::utility::mkVar $var float $priv $lname true parameter true true if {$units != 1} {