putslab can now get histogram memory data directly if you specify start, length and bank parameters for the histogram memory object. This is useful if you need to make an unbuffered get call to the hmm
r1747 | ffr | 2007-03-30 17:57:07 +1000 (Fri, 30 Mar 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
7391c7122d
commit
9fa649954b
26
nxscript.c
26
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,7 +709,29 @@ 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);
|
||||
} 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){
|
||||
|
||||
Reference in New Issue
Block a user