- Initial commit of a UB calculation setup for four circle
diffractometers
This commit is contained in:
65
stdscan.c
65
stdscan.c
@ -30,6 +30,37 @@
|
||||
#include "site.h"
|
||||
#include "lld.h"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static char *fixExtension(char *filename)
|
||||
{
|
||||
if(strstr(filename,".hdf") != NULL)
|
||||
{
|
||||
changeExtension(filename,"dat");
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon)
|
||||
{
|
||||
pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL;
|
||||
char *pRes = NULL;
|
||||
int iLen, iNum, iYear;
|
||||
char pNumText[10];
|
||||
CommandList *pCom = NULL;
|
||||
|
||||
/*
|
||||
make a simulated filename if in simulation mode
|
||||
*/
|
||||
if(pServ->simMode)
|
||||
return strdup("sim001001901.sim");
|
||||
|
||||
pRes = makeFilename(pSics,pCon);
|
||||
if(pRes == NULL)
|
||||
{
|
||||
pRes = strdup("emergency.scn");
|
||||
}
|
||||
return fixExtension(pRes);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int WriteHeader(pScanData self)
|
||||
{
|
||||
@ -343,6 +374,7 @@
|
||||
float fVal;
|
||||
char pBueffel[512];
|
||||
char pMessage[1024];
|
||||
char *pPtr = NULL;
|
||||
|
||||
assert(self);
|
||||
assert(self->iNP > 0);
|
||||
@ -390,6 +422,22 @@
|
||||
SetCounterMode((pCounter)self->pCounterData,self->iMode);
|
||||
SetCounterPreset((pCounter)self->pCounterData, self->fPreset);
|
||||
self->iCounts = 0;
|
||||
|
||||
/* allocate a new data file */
|
||||
pPtr = ScanMakeFileName(self->pSics,self->pCon);
|
||||
if(!pPtr)
|
||||
{
|
||||
SCWrite(self->pCon,
|
||||
"ERROR: cannot allocate new data filename, Scan aborted",
|
||||
eError);
|
||||
self->pCon = NULL;
|
||||
self->pSics = NULL;
|
||||
return 0;
|
||||
}
|
||||
snprintf(pBueffel,511,"Writing data file: %s ...",pPtr);
|
||||
SCWrite(self->pCon,pBueffel,eWarning);
|
||||
strcpy(self->pFile,pPtr);
|
||||
free(pPtr);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -402,6 +450,7 @@
|
||||
float fVal;
|
||||
char pBueffel[512];
|
||||
char pMessage[1024];
|
||||
char *pPtr = NULL;
|
||||
|
||||
assert(self);
|
||||
assert(self->iNP > 0);
|
||||
@ -431,6 +480,22 @@
|
||||
SetCounterMode((pCounter)self->pCounterData,self->iMode);
|
||||
SetCounterPreset((pCounter)self->pCounterData, self->fPreset);
|
||||
self->iCounts = 0;
|
||||
|
||||
/* allocate a new data file */
|
||||
pPtr = ScanMakeFileName(self->pSics,self->pCon);
|
||||
if(!pPtr)
|
||||
{
|
||||
SCWrite(self->pCon,
|
||||
"ERROR: cannot allocate new data filename, Scan aborted",
|
||||
eError);
|
||||
self->pCon = NULL;
|
||||
self->pSics = NULL;
|
||||
return 0;
|
||||
}
|
||||
snprintf(pBueffel,511,"Writing data file: %s ...",pPtr);
|
||||
SCWrite(self->pCon,pBueffel,eWarning);
|
||||
strcpy(self->pFile,pPtr);
|
||||
free(pPtr);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user