- Scriptcontext debugged to be working
- Added a drivable adapter to scriptcontext nodes - Added subsampling to simulated histograms (and as a general option) in order to support Gumtree testing.
This commit is contained in:
@ -20,6 +20,8 @@
|
||||
#include "stptok.h"
|
||||
#include "motor.h"
|
||||
#include "HistMem.h"
|
||||
#include "HistMem.i"
|
||||
#include "HistDriv.i"
|
||||
#include "sicsvar.h"
|
||||
#include "counter.h"
|
||||
#include "lld.h"
|
||||
@ -770,3 +772,52 @@ int SICSHdbAdapter(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return 0;
|
||||
}
|
||||
/*====================== SubSample =========================================*/
|
||||
int HdbSubSample(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]){
|
||||
pHistMem pHM = NULL;
|
||||
pHdb node = NULL;
|
||||
int bank = 0, length = -1, status;
|
||||
HistInt *data = NULL;
|
||||
char *pPtr = NULL;
|
||||
hdbValue v;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to HdbSubSample",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pPtr = strchr(argv[1],':');
|
||||
if(pPtr != NULL){
|
||||
*pPtr = '\0';
|
||||
pPtr++;
|
||||
sscanf(pPtr,"%d",&bank);
|
||||
}
|
||||
pHM = (pHistMem)FindCommandData(pSics,argv[1],"HistMem");
|
||||
node = FindHdbNode(NULL,argv[2], pCon);
|
||||
if(pHM == NULL || node == NULL){
|
||||
SCWrite(pCon,"ERROR: either histogram memory or node not found!",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pHM->pDriv->SubSample == NULL){
|
||||
SCWrite(pCon,"ERROR: hm does not support subsampling", eError);
|
||||
return 0;
|
||||
}
|
||||
data = pHM->pDriv->SubSample(pHM->pDriv, pCon, bank, argv[3]);
|
||||
if(data == NULL){
|
||||
SCWrite(pCon,"ERROR: sub sampling failed", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
v.dataType = HIPINTVARAR;
|
||||
v.arrayLength = data[0];
|
||||
v.v.intArray = data+1;
|
||||
|
||||
UpdateHipadabaPar(node,v,pCon);
|
||||
free(data);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user