- New napi5.c with fix for deep group linking problem
- New file name scheme implemented SKIPPED: psi/amorscan.c
This commit is contained in:
2
napi5.c
2
napi5.c
@ -1096,7 +1096,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
|||||||
strcpy(sLink->iTag5,pFile->name_ref);
|
strcpy(sLink->iTag5,pFile->name_ref);
|
||||||
} else {
|
} else {
|
||||||
/* group link */
|
/* group link */
|
||||||
strcpy(buffer,pFile->iCurrentLGG);
|
strcpy(buffer, pFile->name_ref);
|
||||||
strcat(buffer, sLink->iTag5);
|
strcat(buffer, sLink->iTag5);
|
||||||
strcpy(sLink->iTag5,"/");
|
strcpy(sLink->iTag5,"/");
|
||||||
strcat(sLink->iTag5,buffer);
|
strcat(sLink->iTag5,buffer);
|
||||||
|
15
nxdata.c
15
nxdata.c
@ -59,6 +59,7 @@
|
|||||||
#include "HistMem.h"
|
#include "HistMem.h"
|
||||||
#include "udpquieck.h"
|
#include "udpquieck.h"
|
||||||
#include "evcontroller.h"
|
#include "evcontroller.h"
|
||||||
|
#include "nxscript.h"
|
||||||
|
|
||||||
|
|
||||||
#define DMCDETNAM "DMC-BF3-Detector"
|
#define DMCDETNAM "DMC-BF3-Detector"
|
||||||
@ -74,9 +75,19 @@
|
|||||||
pCon = (SConnection *)pData;
|
pCon = (SConnection *)pData;
|
||||||
SCWrite(pCon,text,eError);
|
SCWrite(pCon,text,eError);
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
char *SNXMakeFileName(SicsInterp *pSics, SConnection *pCon)
|
char *SNXMakeFileName(SicsInterp *pSics, SConnection *pCon)
|
||||||
|
{
|
||||||
|
char *pPtr = NULL;
|
||||||
|
pPtr = makeFilename(pSics,pCon);
|
||||||
|
if(pPtr == NULL)
|
||||||
|
{
|
||||||
|
pPtr = strdup("emergency.hdf");
|
||||||
|
}
|
||||||
|
return pPtr;
|
||||||
|
}
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
char *SNXMakeFileNameOld(SicsInterp *pSics, SConnection *pCon)
|
||||||
{
|
{
|
||||||
pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL;
|
pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL;
|
||||||
char *pRes = NULL;
|
char *pRes = NULL;
|
||||||
|
@ -64,7 +64,7 @@ char *makeFilename(SicsInterp *pSics, SConnection *pCon) {
|
|||||||
/* find length */
|
/* find length */
|
||||||
iLen = strlen(pPath->text) + 4; /* extra 4 for dir number */
|
iLen = strlen(pPath->text) + 4; /* extra 4 for dir number */
|
||||||
iLen += strlen(pPref->text);
|
iLen += strlen(pPref->text);
|
||||||
iLen += 8; /* for number + year */
|
iLen += 9; /* for number + year */
|
||||||
iLen += strlen(pEnd->text);
|
iLen += strlen(pEnd->text);
|
||||||
iLen += 10; /* safety margin */
|
iLen += 10; /* safety margin */
|
||||||
|
|
||||||
@ -106,10 +106,11 @@ char *makeFilename(SicsInterp *pSics, SConnection *pCon) {
|
|||||||
*/
|
*/
|
||||||
strcat(pRes,"/");
|
strcat(pRes,"/");
|
||||||
strcat(pRes,pPref->text);
|
strcat(pRes,pPref->text);
|
||||||
sprintf(pNumText,"%5.5d",iNum);
|
|
||||||
strcat(pRes,pNumText);
|
|
||||||
sprintf(pNumText,"%4.4d",iYear);
|
sprintf(pNumText,"%4.4d",iYear);
|
||||||
strcat(pRes,pNumText);
|
strcat(pRes,pNumText);
|
||||||
|
strcat(pRes,"n");
|
||||||
|
sprintf(pNumText,"%5.5d",iNum);
|
||||||
|
strcat(pRes,pNumText);
|
||||||
strcat(pRes,pEnd->text);
|
strcat(pRes,pEnd->text);
|
||||||
|
|
||||||
return pRes;
|
return pRes;
|
||||||
|
@ -17,4 +17,5 @@ int MakeNXScript(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
int NXScriptAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int NXScriptAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
char *makeFilename(SicsInterp *pSics, SConnection *pCon);
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,6 +43,7 @@ int MakeNXScript(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
int NXScriptAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int NXScriptAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
char *makeFilename(SicsInterp *pSics, SConnection *pCon);
|
||||||
#endif
|
#endif
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
59
scan.c
59
scan.c
@ -27,6 +27,7 @@
|
|||||||
#include "danu.h"
|
#include "danu.h"
|
||||||
#include "userscan.h"
|
#include "userscan.h"
|
||||||
#include "motor.h"
|
#include "motor.h"
|
||||||
|
#include "nxscript.h"
|
||||||
#include "site.h"
|
#include "site.h"
|
||||||
|
|
||||||
extern void SNXFormatTime(char *pBuffer, int iLen);
|
extern void SNXFormatTime(char *pBuffer, int iLen);
|
||||||
@ -34,7 +35,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
|||||||
from nxdata.c
|
from nxdata.c
|
||||||
*/
|
*/
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon, char *pExt)
|
char *ScanMakeFileName(SicsInterp *pSics, SConnection *pCon)
|
||||||
{
|
{
|
||||||
pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL;
|
pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL;
|
||||||
char *pRes = NULL;
|
char *pRes = NULL;
|
||||||
@ -48,56 +49,12 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
|||||||
if(pServ->simMode)
|
if(pServ->simMode)
|
||||||
return strdup("sim001001901.sim");
|
return strdup("sim001001901.sim");
|
||||||
|
|
||||||
|
pRes = makeFilename(pSics,pCon);
|
||||||
/* Try, get all the Variables */
|
if(pRes == NULL)
|
||||||
pPath = FindVariable(pSics,"sicsdatapath");
|
|
||||||
pPref = FindVariable(pSics,"sicsdataprefix");
|
|
||||||
pCom = FindCommand(pSics,"sicsdatanumber");
|
|
||||||
|
|
||||||
if( (!pPath) || (!pPref) || (!pCom))
|
|
||||||
{
|
{
|
||||||
SCWrite(pCon,
|
pRes = strdup("emergency.scn");
|
||||||
"ERROR: cannot read variables for automatic data file name creation",
|
|
||||||
eError);
|
|
||||||
SCWrite(pCon,"ERROR: This is a VERY, VERY, VERY serious installation problem",
|
|
||||||
eError);
|
|
||||||
SCWrite(pCon,"ERROR: your data will be dumped into emergency.hdf",eError);
|
|
||||||
return strdup("emergency.hdf");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find length */
|
|
||||||
iLen = strlen(pPath->text);
|
|
||||||
iLen += strlen(pPref->text);
|
|
||||||
iLen += 8; /* for number + year */
|
|
||||||
iLen += 3;
|
|
||||||
iLen += 10; /* safety margin */
|
|
||||||
|
|
||||||
/* allocate memory */
|
|
||||||
pRes = (char *)malloc(iLen*sizeof(char));
|
|
||||||
if(!pRes)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,"ERROR: no memory in SNXMakeFileName",eError);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
memset(pRes,0,iLen);
|
|
||||||
|
|
||||||
/* build the filename */
|
|
||||||
strcpy(pRes,pPath->text);
|
|
||||||
strcat(pRes,pPref->text);
|
|
||||||
iNum = IncrementDataNumber(pCom->pData,&iYear);
|
|
||||||
if(iNum < 0)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,"ERROR: cannot increment data number!",eError);
|
|
||||||
SCWrite(pCon,"ERROR: your data will be dumped to emergency.dat",eError);
|
|
||||||
free(pRes);
|
|
||||||
return strdup("emergency.dat");
|
|
||||||
}
|
|
||||||
sprintf(pNumText,"%5.5d",iNum);
|
|
||||||
strcat(pRes,pNumText);
|
|
||||||
sprintf(pNumText,"%4.4d",iYear);
|
|
||||||
strcat(pRes,pNumText);
|
|
||||||
strcat(pRes,pExt);
|
|
||||||
|
|
||||||
return pRes;
|
return pRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +466,6 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
|||||||
pNew->ScanDrive = ScanDrive;
|
pNew->ScanDrive = ScanDrive;
|
||||||
pNew->ScanCount = ScanCount;
|
pNew->ScanCount = ScanCount;
|
||||||
pNew->CollectScanData = CollectScanData;
|
pNew->CollectScanData = CollectScanData;
|
||||||
strcpy(pNew->ext,".dat");
|
|
||||||
pNew->iWindow = 6;
|
pNew->iWindow = 6;
|
||||||
|
|
||||||
return pNew;
|
return pNew;
|
||||||
@ -558,7 +514,6 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
|
|||||||
self->ScanCount = ScanCount;
|
self->ScanCount = ScanCount;
|
||||||
self->CollectScanData = CollectScanData;
|
self->CollectScanData = CollectScanData;
|
||||||
self->posSoft = 0;
|
self->posSoft = 0;
|
||||||
strcpy(self->ext,".dat");
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1362,7 +1317,7 @@ int StoreScanCounts(pScanData self, char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate a new data file */
|
/* allocate a new data file */
|
||||||
pPtr = ScanMakeFileName(self->pSics,self->pCon,self->ext);
|
pPtr = ScanMakeFileName(self->pSics,self->pCon);
|
||||||
if(!pPtr)
|
if(!pPtr)
|
||||||
{
|
{
|
||||||
SCWrite(self->pCon,
|
SCWrite(self->pCon,
|
||||||
@ -1492,7 +1447,7 @@ int StoreScanCounts(pScanData self, char *data)
|
|||||||
|
|
||||||
|
|
||||||
/* new scan data file */
|
/* new scan data file */
|
||||||
pPtr = ScanMakeFileName(self->pSics,self->pCon,self->ext);
|
pPtr = ScanMakeFileName(self->pSics,self->pCon);
|
||||||
if(!pPtr)
|
if(!pPtr)
|
||||||
{
|
{
|
||||||
SCWrite(self->pCon,"ERROR: cannot allocate new data filename, Scan aborted",
|
SCWrite(self->pCon,"ERROR: cannot allocate new data filename, Scan aborted",
|
||||||
|
1
scan.i
1
scan.i
@ -32,7 +32,6 @@
|
|||||||
int iMode;
|
int iMode;
|
||||||
float fPreset;
|
float fPreset;
|
||||||
char pFile[1024];
|
char pFile[1024];
|
||||||
char ext[5];
|
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
SicsInterp *pSics;
|
SicsInterp *pSics;
|
||||||
SConnection *pCon;
|
SConnection *pCon;
|
||||||
|
1
scan.tex
1
scan.tex
@ -60,7 +60,6 @@ $\langle$scandata {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ int iMode;@\\
|
\mbox{}\verb@ int iMode;@\\
|
||||||
\mbox{}\verb@ float fPreset;@\\
|
\mbox{}\verb@ float fPreset;@\\
|
||||||
\mbox{}\verb@ char pFile[1024];@\\
|
\mbox{}\verb@ char pFile[1024];@\\
|
||||||
\mbox{}\verb@ char ext[5];@\\
|
|
||||||
\mbox{}\verb@ FILE *fd;@\\
|
\mbox{}\verb@ FILE *fd;@\\
|
||||||
\mbox{}\verb@ SicsInterp *pSics;@\\
|
\mbox{}\verb@ SicsInterp *pSics;@\\
|
||||||
\mbox{}\verb@ SConnection *pCon;@\\
|
\mbox{}\verb@ SConnection *pCon;@\\
|
||||||
|
Reference in New Issue
Block a user