- Fixed a few problems with hklscan
- Added transfer of zipped data to conman.c, histogram memory software in order to support the TRICS status display. - Upgraded TRICS data file writing. - First installment of triple axis spectrometer support: initialization of data structures and an implementation of the MAD dr(ive) command.
This commit is contained in:
82
histmem.c
82
histmem.c
@ -8,6 +8,8 @@
|
||||
|
||||
revised: Mark Koennecke, June 1997
|
||||
|
||||
added getzip: Mark Koennecke, October 2000
|
||||
|
||||
Copyright:
|
||||
|
||||
Labor fuer Neutronenstreuung
|
||||
@ -1555,6 +1557,86 @@
|
||||
/* Write it */
|
||||
SCWriteUUencoded(pCon,"SicsHistogram",lData,(iEnd+1)*sizeof(HistInt));
|
||||
|
||||
/* clean up and go */
|
||||
free(lData);
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(argv[1],"zipget") == 0) /* get a histogram */
|
||||
{
|
||||
/* check parameters, first required: no of Hist */
|
||||
if(argc < 3)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
iNum = atoi(argv[2]);
|
||||
|
||||
/* check iNum */
|
||||
if( (iNum < 0) || (iNum > self->pDriv->iRank))
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: requested histogram no %d out of range",
|
||||
iNum);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* optional iStart, default 0 */
|
||||
iStart = 0;
|
||||
if(argc > 3 )
|
||||
{
|
||||
iStart = atoi(argv[3]);
|
||||
}
|
||||
|
||||
/* check iStart */
|
||||
if(iStart < 0)
|
||||
{
|
||||
SCWrite(pCon,"WARNING: Invalid start position defaulted to 0",eWarning);
|
||||
iStart = 0;
|
||||
}
|
||||
|
||||
/* optional iEnd, default to maximum */
|
||||
iEnd = self->pDriv->iLength;
|
||||
if(argc > 4)
|
||||
{
|
||||
iEnd = atoi(argv[4]);
|
||||
}
|
||||
|
||||
/* check iEnd */
|
||||
if(iEnd > self->pDriv->iLength)
|
||||
{
|
||||
iEnd = self->pDriv->iLength;
|
||||
SCWrite(pCon,
|
||||
"WARNING: invalid end parameter reset to max ",eWarning);
|
||||
}
|
||||
|
||||
/* allocate data storage and get it */
|
||||
lData = (HistInt *)malloc((iEnd+1)*sizeof(HistInt));
|
||||
if(!lData)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: no memory in HistAction/get",eError);
|
||||
return 0;
|
||||
}
|
||||
memset(lData,0,(iEnd+1)*sizeof(HistInt));
|
||||
iRet = GetHistogram(self,pCon,iNum,iStart,iEnd,
|
||||
&lData[0],iEnd*sizeof(HistInt));
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: cannot retrieve histogram %d",iNum);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
free(lData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* convert to network byte order */
|
||||
for(i = 0; i < iEnd; i++)
|
||||
{
|
||||
lData[i] = htonl(lData[i]);
|
||||
}
|
||||
/* Write it */
|
||||
SCWriteZipped(pCon,argv[0],lData,iEnd*sizeof(HistInt));
|
||||
|
||||
/* clean up and go */
|
||||
free(lData);
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user