- Fixed a couple of bugs
This commit is contained in:
@ -779,7 +779,8 @@
|
||||
{"preset",1,{FUPAOPT}},
|
||||
{"send",0,{0,0}},
|
||||
{"setpar",3,{FUPATEXT,FUPAINT,FUPAFLOAT}},
|
||||
{"getpar",2,{FUPATEXT,FUPAOPT}}
|
||||
{"getpar",2,{FUPATEXT,FUPAOPT}},
|
||||
{"getnmon",0,{0,0}}
|
||||
};
|
||||
char *pMode[] = {
|
||||
"timer",
|
||||
@ -795,7 +796,7 @@
|
||||
/* parse function args */
|
||||
argtolower(argc,argv);
|
||||
argx = &argv[1];
|
||||
iRet = EvaluateFuPa((pFuncTemplate)&ActionTemplate,22,argc-1,argx,&PaRes);
|
||||
iRet = EvaluateFuPa((pFuncTemplate)&ActionTemplate,23,argc-1,argx,&PaRes);
|
||||
if(iRet < 0)
|
||||
{
|
||||
sprintf(pBueffel,"%s",PaRes.pError);
|
||||
@ -1134,6 +1135,10 @@
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 22: /* getnmon */
|
||||
snprintf(pBueffel,131,"%s.getnmon = %d", argv[0], GetNMonitor(self));
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
break;
|
||||
default:
|
||||
assert(0); /* internal error */
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ int MakeDiffScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
pNew->pDes->SaveStatus = SaveDiffScan;
|
||||
|
||||
if(argc > 1) {
|
||||
status = AddCommand(pSics,argv[2],
|
||||
status = AddCommand(pSics,argv[1],
|
||||
DiffScanWrapper,
|
||||
KillDiffScan,
|
||||
pNew);
|
||||
|
10
histmem.c
10
histmem.c
@ -72,6 +72,10 @@
|
||||
* from histregress.c
|
||||
*/
|
||||
extern pHistDriver CreateRegressHM(pStringDict pOpt);
|
||||
/*
|
||||
* from slavehm.c
|
||||
*/
|
||||
extern pHistDriver MakeHMSlaveHM(pStringDict pOpt);
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int HistHalt(void *pData)
|
||||
{
|
||||
@ -462,6 +466,12 @@ extern pHistDriver CreateRegressHM(pStringDict pOpt);
|
||||
{
|
||||
pNew->pDriv = CreateRegressHM(pOption);
|
||||
}
|
||||
/*
|
||||
else if(strcmp(driver,"slave") == 0)
|
||||
{
|
||||
pNew->pDriv = MakeHMSlaveHM(pOption);
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
site = getSite();
|
||||
|
2
make_gen
2
make_gen
@ -32,7 +32,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
||||
mcstashm.o initializer.o remob.o tclmotdriv.o protocol.o \
|
||||
sinfox.o sicslist.o cone.o hipadaba.o sicshipadaba.o statistics.o \
|
||||
moregress.o hdbcommand.o multicounter.o regresscter.o histregress.o \
|
||||
sicshdbadapter.o polldriv.o sicspoll.o statemon.o
|
||||
sicshdbadapter.o polldriv.o sicspoll.o statemon.o hmslave.o
|
||||
|
||||
MOTOROBJ = motor.o simdriv.o
|
||||
COUNTEROBJ = countdriv.o simcter.o counter.o
|
||||
|
@ -217,10 +217,6 @@
|
||||
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
|
||||
|
||||
/* the device executor */
|
||||
pCom = FindCommand(self->pSics,"stopexe");
|
||||
assert(pCom);
|
||||
assert(pCom->pData);
|
||||
self->pExecutor = (pExeList)pCom->pData;
|
||||
openDevexecLog();
|
||||
DevexecLog("START","SICS");
|
||||
|
||||
|
4
ofac.c
4
ofac.c
@ -203,6 +203,7 @@
|
||||
assert(pInter);
|
||||
|
||||
pExe = CreateExeList(pTask);
|
||||
pServ->pExecutor = pExe;
|
||||
pEnv = CreateEnvMon();
|
||||
|
||||
assert(pExe);
|
||||
@ -213,9 +214,6 @@
|
||||
AddCommand(pInter,"FileEval",MacroFileEval,NULL,NULL);
|
||||
|
||||
AddCommand(pInter,"InternEval",InternalFileEval,NULL,NULL);
|
||||
/*
|
||||
AddCommand(pInter,"FileWhere",MacroWhere,WhereKill,NULL);
|
||||
*/
|
||||
AddCommand(pInter,"ClientPut",ClientPut,NULL,NULL);
|
||||
AddCommand(pInter,"GumPut",GumPut,NULL,NULL);
|
||||
AddCommand(pInter,"broadcast",Broadcast,NULL,NULL);
|
||||
|
@ -23,5 +23,5 @@
|
||||
"hdbvalue",
|
||||
"hdbevent",
|
||||
NULL };
|
||||
static int iNoCodes = 10;
|
||||
static int iNoCodes = 13;
|
||||
#endif
|
||||
|
5
scan.c
5
scan.c
@ -2218,6 +2218,11 @@ static int DumpScan(pScanData self, SConnection *pCon)
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
/*----------- getnumchan */
|
||||
else if(strcmp(argv[1],"getnumchan") == 0) {
|
||||
snprintf(pBueffel,511,"%s.getnumchan = %d", argv[0], GetNMonitor((pCounter)self->pCounterData));
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
}
|
||||
/*----------- setchannel */
|
||||
else if(strcmp(argv[1],"setchannel") == 0)
|
||||
{
|
||||
|
92
sicsdata.c
92
sicsdata.c
@ -185,7 +185,7 @@ void clearSICSData(pSICSData self){
|
||||
memset(self->dataType,0,self->currentDataSize*sizeof(char));
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
static int dumpSICSDataXY(pSICSData self, char *filename, SConnection *pCon){
|
||||
FILE *fd = NULL;
|
||||
char pBueffel[132];
|
||||
int i;
|
||||
@ -210,6 +210,32 @@ static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int dumpSICSData(pSICSData self, char *filename, SConnection *pCon){
|
||||
FILE *fd = NULL;
|
||||
char pBueffel[132];
|
||||
int i;
|
||||
float fVal;
|
||||
|
||||
fd = fopen(filename,"w");
|
||||
if(fd == NULL){
|
||||
snprintf(pBueffel,131,"ERROR: cannot open %s", filename);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
for(i = 0; i < self->dataUsed; i++){
|
||||
if(self->dataType[i] == INTTYPE){
|
||||
fprintf(fd," %d", self->data[i]);
|
||||
}
|
||||
if(self->dataType[i] == FLOATTYPE){
|
||||
memcpy(&fVal,self->data + i,sizeof(float));
|
||||
fprintf(fd," %.5f",fVal);
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
static int putInt(pSICSData self, int argc, char *argv[],
|
||||
SConnection *pCon, SicsInterp *pSics){
|
||||
@ -588,6 +614,58 @@ static int copyHM(pSICSData self, int argc, char *argv[],
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int copyHMBank(pSICSData self, int argc, char *argv[],
|
||||
SConnection *pCon, SicsInterp *pSics){
|
||||
int status, pos, i, bank, dataLength;
|
||||
pHistMem pHist = NULL;
|
||||
const float *fTimeBin = NULL;
|
||||
int *iData = NULL;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: not enough arguments to SICSData copyhm",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[0],&pos);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank position to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
pHist = (pHistMem)FindCommandData(pSics,argv[1],"HistMem");
|
||||
if(!pHist){
|
||||
SCWrite(pCon,"ERROR: histogram memory not found in copyhmbank",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[2],&bank);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank bank to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[3],&dataLength);
|
||||
if(status != TCL_OK){
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to convert copyhmbank dataLength to integer",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
iData = getSICSDataPointer(self,pos,pos+dataLength);
|
||||
if(!iData){
|
||||
SCWrite(pCon,"ERROR: out of memory in SICSData copyhmbank",eError);
|
||||
return 0;
|
||||
}
|
||||
GetHistogramDirect(pHist,pCon,bank,0,dataLength,iData,
|
||||
dataLength*sizeof(int));
|
||||
assignType(self,pos,pos+dataLength,INTTYPE);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int copyData(pSICSData self,SicsInterp *pSics,
|
||||
SConnection *pCon,int argc, char *argv[]){
|
||||
@ -645,6 +723,13 @@ int SICSDataAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
snprintf(pBueffel,131,"%s = %d", argv[0], self->dataUsed);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
} else if(strcmp(argv[1],"dumpxy") == 0){
|
||||
/* --------- dump */
|
||||
if(argc < 3){
|
||||
SCWrite(pCon,"ERROR: need a file name to dump to",eError);
|
||||
return 0;
|
||||
}
|
||||
return dumpSICSDataXY(self,argv[2],pCon);
|
||||
} else if(strcmp(argv[1],"dump") == 0){
|
||||
/* --------- dump */
|
||||
if(argc < 3){
|
||||
@ -686,8 +771,11 @@ int SICSDataAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
/*--------- copytimebin */
|
||||
return copyTimeBin(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"copyhm") == 0){
|
||||
/*--------- copytimebin */
|
||||
/*--------- copyhm */
|
||||
return copyHM(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"copyhmbank") == 0){
|
||||
/*--------- copyhmbank */
|
||||
return copyHMBank(self,argc-2,&argv[2],pCon,pSics);
|
||||
} else if(strcmp(argv[1],"writezipped") == 0){
|
||||
/*--------- writezipped */
|
||||
if(argc < 3){
|
||||
|
@ -1119,7 +1119,10 @@ int StandardScanWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
strtolower(argv[1]);
|
||||
self = (pScanData)FindCommandData(pSics,argv[2],"ScanObject");
|
||||
assert(self);
|
||||
if(self == NULL){
|
||||
SCWrite(pCon,"ERROR: scan object not found",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strcmp(argv[1],"writeheader") == 0){
|
||||
return WriteHeader(self);
|
||||
|
Reference in New Issue
Block a user