PSI update
r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
634f2023b1
commit
3168325921
87
histmem.c
87
histmem.c
@@ -68,6 +68,10 @@
|
||||
/*
|
||||
#define LOADDEBUG 1
|
||||
*/
|
||||
/*
|
||||
* from histregress.c
|
||||
*/
|
||||
extern pHistDriver CreateRegressHM(pStringDict pOpt);
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int HistHalt(void *pData)
|
||||
{
|
||||
@@ -171,7 +175,9 @@
|
||||
iRet = self->pDriv->Start(self->pDriv, pCon);
|
||||
if(iRet == OKOK)
|
||||
{
|
||||
updateHMData(self->pDriv->data);
|
||||
/* send a COUNTSTART event */
|
||||
InvokeCallBack(self->pCall,COUNTSTART,pCon);
|
||||
updateHMData(self->pDriv->data);
|
||||
return iRet;
|
||||
}
|
||||
else
|
||||
@@ -450,8 +456,12 @@
|
||||
}
|
||||
else if(strcmp(driver,"mcstas") == 0)
|
||||
{
|
||||
pNew->pDriv = NewMcStasHM(pOption);
|
||||
}
|
||||
pNew->pDriv = NewMcStasHM(pOption);
|
||||
}
|
||||
else if(strcmp(driver,"regress") == 0)
|
||||
{
|
||||
pNew->pDriv = CreateRegressHM(pOption);
|
||||
}
|
||||
else
|
||||
{
|
||||
site = getSite();
|
||||
@@ -721,8 +731,6 @@ void HistDirty(pHistMem self)
|
||||
{
|
||||
assert(self);
|
||||
|
||||
/* send a COUNTSTART event */
|
||||
InvokeCallBack(self->pCall,COUNTSTART,pCon);
|
||||
|
||||
/* start */
|
||||
return StartDevice(GetExecutor(),"HistogramMemory", self->pDes, self,
|
||||
@@ -744,9 +752,6 @@ void HistDirty(pHistMem self)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* send a COUNTSTART event */
|
||||
InvokeCallBack(self->pCall,COUNTSTART,pCon);
|
||||
|
||||
/* wait till end */
|
||||
iRet = Wait4Success(GetExecutor());
|
||||
if(iRet == DEVINT)
|
||||
@@ -1233,13 +1238,19 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
}
|
||||
else if(strcmp(argv[1],"init") == 0)
|
||||
{
|
||||
if(GetStatus() != eEager)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: cannot initialize HM while running",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
if(SCMatchRights(pCon,usMugger))
|
||||
{
|
||||
iRet = HistConfigure(self,pCon,pSics);
|
||||
if(iRet)
|
||||
{
|
||||
self->iInit = 1;
|
||||
SCSendOK(pCon);
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1357,6 +1368,31 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
else if(strcmp(argv[1],"initfile") == 0) /* initialize from a file */
|
||||
{
|
||||
/* check user rights */
|
||||
if(!SCMatchRights(pCon,self->iAccess))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* enough arguments */
|
||||
if(argc < 3)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = loadHMData(self->pDriv->data,pCon,argv[2]);
|
||||
self->pDriv->SetHistogram(self->pDriv,pCon,0,0,GetHistLength(self),
|
||||
self->pDriv->data->localBuffer);
|
||||
if(iRet)
|
||||
{
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
else if(strcmp(argv[1],"get") == 0) /* get a histogram */
|
||||
{
|
||||
/* check parameters, first required: no of Hist */
|
||||
@@ -1383,11 +1419,16 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
iStart = 0;
|
||||
}
|
||||
|
||||
if(argc > 4){
|
||||
iEnd = checkHMEnd(self,argv[4]);
|
||||
} else {
|
||||
iEnd = checkHMEnd(self,NULL);
|
||||
}
|
||||
if(argc > 4){
|
||||
iEnd = checkHMEnd(self,argv[4]);
|
||||
} else {
|
||||
iEnd = checkHMEnd(self,NULL);
|
||||
}
|
||||
|
||||
if(iNum != 0 && argc > 4)
|
||||
{
|
||||
iEnd = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/* allocate data storage and get it */
|
||||
lData = (HistInt *)malloc(iEnd*sizeof(HistInt));
|
||||
@@ -1397,8 +1438,14 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
return 0;
|
||||
}
|
||||
memset(lData,0,iEnd*sizeof(HistInt));
|
||||
iRet = GetHistogram(self,pCon,iNum,iStart,iEnd,
|
||||
lData,iEnd*sizeof(long));
|
||||
if(iNum == 0)
|
||||
{
|
||||
iRet = GetHistogram(self,pCon,iNum,iStart,iEnd,
|
||||
lData,iEnd*sizeof(long));
|
||||
} else {
|
||||
iRet = GetHistogramDirect(self,pCon,iNum,iStart, iEnd,
|
||||
lData, iEnd*sizeof(long));
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: cannot retrieve histogram %d",iNum);
|
||||
@@ -1565,10 +1612,10 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
else if(strcmp(argv[1],"timebin") == 0)
|
||||
{
|
||||
Tcl_DStringInit(&tResult);
|
||||
Tcl_DStringAppend(&tResult,"histogram.timebins = ",-1);
|
||||
Tcl_DStringAppend(&tResult,"histogram.timebins =",-1);
|
||||
for(i = 0; i < self->pDriv->data->nTimeChan; i++)
|
||||
{
|
||||
sprintf(pBueffel," %8.2f", self->pDriv->data->timeBinning[i]);
|
||||
sprintf(pBueffel,"%.2f ", self->pDriv->data->timeBinning[i]);
|
||||
Tcl_DStringAppend(&tResult,pBueffel,-1);
|
||||
}
|
||||
/* Write it */
|
||||
@@ -1586,8 +1633,8 @@ static int checkHMEnd(pHistMem self, char *text){
|
||||
return 0;
|
||||
}
|
||||
if(GetStatus() == eCounting)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: cannot modify timebinning while counting",
|
||||
{
|
||||
SCWrite(pCon,"ERROR: cannot modify timebinning while counting",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user