- Dokumentation updates
- Fixed bad file generated through nuweb - fixed problems in synchronize.c - New file writing scheme implemented - Changes to hkl
This commit is contained in:
385
nxdict.c
385
nxdict.c
@ -1,5 +1,6 @@
|
||||
|
||||
#line 2264 "nxdict.w"
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Nexus Dictionary API implementation file.
|
||||
@ -20,8 +21,17 @@
|
||||
August, 1997
|
||||
|
||||
Version: 1.0
|
||||
|
||||
Version 1.1
|
||||
|
||||
Updated to use the combined HDF4 HDF5 API. New keyword -chunk which
|
||||
defines the chunk buffer size for a SDS.
|
||||
|
||||
Mark Koennecke, August 2001
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
@ -41,14 +51,13 @@
|
||||
extern void *NXpData;
|
||||
extern void (*NXIReportError)(void *pData, char *pBuffer);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#define DEFDEBUG 1
|
||||
/* #define DEFDEBUG 1 */
|
||||
/* define DEFDEBUG when you wish to print your definition strings before
|
||||
action. This can help a lot to resolve mysteries when working with
|
||||
dictionaries.
|
||||
*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#line 362 "nxdict.w"
|
||||
|
||||
typedef struct __NXdict
|
||||
{
|
||||
@ -58,7 +67,6 @@
|
||||
/*------------------ verbosity level -------------------------------------*/
|
||||
static int iVerbosity = 0 ;
|
||||
|
||||
#line 2311 "nxdict.w"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static char *NXDIReadFile(FILE *fd)
|
||||
@ -100,7 +108,6 @@
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#line 490 "nxdict.w"
|
||||
|
||||
#define FWORD 1
|
||||
#define FHASH 2
|
||||
@ -173,11 +180,9 @@
|
||||
}
|
||||
|
||||
|
||||
#line 2351 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 566 "nxdict.w"
|
||||
|
||||
#define AMODE 0
|
||||
#define DMODE 1
|
||||
@ -266,7 +271,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
#line 2353 "nxdict.w"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
NXstatus NXDinitfromfile(char *filename, NXdict *pData)
|
||||
@ -277,7 +281,6 @@
|
||||
char pError[512];
|
||||
|
||||
|
||||
#line 383 "nxdict.w"
|
||||
|
||||
/* allocate a new NXdict structure */
|
||||
if(iVerbosity == NXalot)
|
||||
@ -302,10 +305,6 @@
|
||||
}
|
||||
|
||||
|
||||
#line 2362 "nxdict.w"
|
||||
|
||||
|
||||
#line 410 "nxdict.w"
|
||||
|
||||
/* is there a file name argument */
|
||||
if(filename == NULL)
|
||||
@ -318,10 +317,6 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2363 "nxdict.w"
|
||||
|
||||
|
||||
#line 424 "nxdict.w"
|
||||
|
||||
fd = fopen(filename,"rb");
|
||||
if(!fd)
|
||||
@ -334,12 +329,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
#line 2364 "nxdict.w"
|
||||
|
||||
|
||||
#line 444 "nxdict.w"
|
||||
|
||||
/* read the file contents */
|
||||
if(iVerbosity == NXalot)
|
||||
{
|
||||
@ -363,8 +352,6 @@
|
||||
}
|
||||
NXDIParse(pBuffer, pNew->pDictionary);
|
||||
|
||||
#line 2365 "nxdict.w"
|
||||
|
||||
|
||||
if(iVerbosity == NXalot)
|
||||
{
|
||||
@ -376,8 +363,6 @@
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#line 660 "nxdict.w"
|
||||
|
||||
NXdict NXDIAssert(NXdict handle)
|
||||
{
|
||||
NXdict self = NULL;
|
||||
@ -387,12 +372,9 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
#line 2376 "nxdict.w"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#line 671 "nxdict.w"
|
||||
|
||||
NXstatus NXDclose(NXdict handle, char *filename)
|
||||
{
|
||||
NXdict self;
|
||||
@ -441,12 +423,8 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2378 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 724 "nxdict.w"
|
||||
|
||||
NXstatus NXDadd(NXdict handle, char *alias, char *pDef)
|
||||
{
|
||||
NXdict self;
|
||||
@ -491,14 +469,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
|
||||
#line 2380 "nxdict.w"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#line 776 "nxdict.w"
|
||||
|
||||
#define NORMAL 1
|
||||
#define ALIAS 2
|
||||
pDynString NXDItextreplace(NXdict handle, char *pDefString)
|
||||
@ -595,23 +566,12 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2382 "nxdict.w"
|
||||
|
||||
/*------------------- The Defintion String Parser -----------------------*/
|
||||
/*------- Data structures */
|
||||
|
||||
#line 886 "nxdict.w"
|
||||
|
||||
typedef struct {
|
||||
char pText[20];
|
||||
int iCode;
|
||||
} TokDat;
|
||||
|
||||
#line 2385 "nxdict.w"
|
||||
|
||||
|
||||
#line 896 "nxdict.w"
|
||||
|
||||
#define TERMSDS 100
|
||||
#define TERMVG 200
|
||||
#define TERMLINK 300
|
||||
@ -625,32 +585,15 @@
|
||||
int iTerminal;
|
||||
} ParDat;
|
||||
|
||||
#line 2386 "nxdict.w"
|
||||
|
||||
|
||||
#line 1101 "nxdict.w"
|
||||
|
||||
static void DummyError(void *pData, char *pError)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#line 2387 "nxdict.w"
|
||||
|
||||
|
||||
#line 1215 "nxdict.w"
|
||||
|
||||
typedef struct {
|
||||
char name[256];
|
||||
char value[256];
|
||||
}AttItem;
|
||||
|
||||
#line 2388 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 918 "nxdict.w"
|
||||
|
||||
/*---------------- Token name defines ---------------------------*/
|
||||
#define DSLASH 0
|
||||
#define DKOMMA 1
|
||||
@ -665,10 +608,14 @@
|
||||
#define DCLOSE 11
|
||||
#define DATTR 12
|
||||
#define DEND 13
|
||||
#define DLZW 14
|
||||
#define DHUF 15
|
||||
#define DRLE 16
|
||||
#define CHUNK 17
|
||||
|
||||
/*----------------- Keywords ----------------------------------------*/
|
||||
|
||||
static TokDat TokenList[8] = {
|
||||
static TokDat TokenList[12] = {
|
||||
{"SDS",DSDS},
|
||||
{"NXLINK",DLINK},
|
||||
{"NXVGROUP",DGROUP},
|
||||
@ -676,7 +623,11 @@
|
||||
{"-type",DTYPE},
|
||||
{"-rank",DRANK},
|
||||
{"-attr",DATTR},
|
||||
{"",0} };
|
||||
{"-chunk",CHUNK},
|
||||
{"-LZW",DLZW},
|
||||
{"-HUF",DHUF},
|
||||
{"-RLE",DRLE},
|
||||
{NULL,0} };
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static void NXDIDefToken(ParDat *sStat)
|
||||
@ -744,7 +695,7 @@
|
||||
sStat->pToken[i] = '\0';
|
||||
|
||||
/*--------- try to find word in Tokenlist */
|
||||
for(i = 0; i < 7; i++)
|
||||
for(i = 0; i < 10; i++)
|
||||
{
|
||||
if(strcmp(sStat->pToken,TokenList[i].pText) == 0)
|
||||
{
|
||||
@ -759,12 +710,8 @@
|
||||
}
|
||||
|
||||
|
||||
#line 2390 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1114 "nxdict.w"
|
||||
|
||||
int NXDIParsePath(NXhandle hfil, ParDat *pParse)
|
||||
{
|
||||
int iRet, iToken;
|
||||
@ -855,12 +802,8 @@
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
#line 2392 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1481 "nxdict.w"
|
||||
|
||||
static int NXDIParseAttr(ParDat *pParse, int iList)
|
||||
{
|
||||
char pError[256];
|
||||
@ -919,12 +862,7 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2394 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1428 "nxdict.w"
|
||||
|
||||
static int NXDIParseDim(ParDat *pParse, int *iDim)
|
||||
{
|
||||
char pError[256];
|
||||
@ -972,13 +910,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2396 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1379 "nxdict.w"
|
||||
|
||||
static TokDat tDatType[] = {
|
||||
{"DFNT_FLOAT32",DFNT_FLOAT32},
|
||||
{"DFNT_FLOAT64",DFNT_FLOAT64},
|
||||
@ -988,7 +920,8 @@
|
||||
{"DFNT_UINT16",DFNT_UINT16},
|
||||
{"DFNT_INT32",DFNT_INT32},
|
||||
{"DFNT_UINT32",DFNT_UINT32},
|
||||
{"",0} };
|
||||
{"DFNT_CHAR",DFNT_CHAR},
|
||||
{NULL,-122} };
|
||||
|
||||
|
||||
|
||||
@ -1023,19 +956,15 @@
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
#line 2398 "nxdict.w"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#line 1223 "nxdict.w"
|
||||
|
||||
static int NXDIParseSDS(NXhandle hfil, ParDat *pParse)
|
||||
{
|
||||
int iType = DFNT_FLOAT32;
|
||||
int iRank = 1;
|
||||
int32 iDim[MAX_VAR_DIMS];
|
||||
int iList;
|
||||
int iRet, iStat;
|
||||
int iCompress = NX_COMP_NONE;
|
||||
int32 iDim[MAX_VAR_DIMS], iChunk[MAX_VAR_DIMS];
|
||||
int iList, iChunkDefined = 0 ;
|
||||
int iRet, iStat, i;
|
||||
char pError[256];
|
||||
char pName[MAX_NC_NAME];
|
||||
void (*ErrFunc)(void *pData, char *pErr);
|
||||
@ -1079,8 +1008,17 @@
|
||||
}
|
||||
iRank = atoi(pParse->pToken);
|
||||
break;
|
||||
case CHUNK: /* chunk size for compression */
|
||||
iRet = NXDIParseDim(pParse, iChunk);
|
||||
if(iRet == NX_ERROR)
|
||||
{
|
||||
LLDdelete(iList);
|
||||
return iRet;
|
||||
}
|
||||
iChunkDefined = 1;
|
||||
break;
|
||||
case DDIM:
|
||||
iRet = NXDIParseDim (pParse, (int *) iDim);
|
||||
iRet = NXDIParseDim(pParse, iDim);
|
||||
if(iRet == NX_ERROR)
|
||||
{
|
||||
LLDdelete(iList);
|
||||
@ -1103,6 +1041,15 @@
|
||||
return iRet;
|
||||
}
|
||||
break;
|
||||
case DLZW:
|
||||
iCompress = NX_COMP_LZW;
|
||||
break;
|
||||
case DRLE:
|
||||
iCompress = NX_COMP_RLE;
|
||||
break;
|
||||
case DHUF:
|
||||
iCompress = NX_COMP_HUF;
|
||||
break;
|
||||
case DEND:
|
||||
break;
|
||||
default:
|
||||
@ -1115,8 +1062,19 @@
|
||||
}
|
||||
NXDIDefToken(pParse);
|
||||
}
|
||||
|
||||
/* whew! got all information for doing the SDS
|
||||
However, if the chunk sizes for compression have not
|
||||
been set, default them to the dimensions of the data set
|
||||
*/
|
||||
if(iChunkDefined == 0)
|
||||
{
|
||||
for(i = 0; i < iRank; i++)
|
||||
{
|
||||
iChunk[i] = iDim[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* whew! got all information for doing the SDS */
|
||||
/* first install dummy error handler, try open it, then
|
||||
deinstall again and create if allowed
|
||||
*/
|
||||
@ -1136,7 +1094,8 @@
|
||||
/* we need to create it, if we may */
|
||||
if(pParse->iMayCreate)
|
||||
{
|
||||
iRet = NXmakedata (hfil, pName, iType, iRank, (int *) iDim);
|
||||
iRet = NXcompmakedata(hfil,pName,iType, iRank,iDim,
|
||||
iCompress,iChunk);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
/* a comment on this one has already been written! */
|
||||
@ -1150,6 +1109,7 @@
|
||||
LLDdelete(iList);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/* put attributes in */
|
||||
iRet = LLDnodePtr2First(iList);
|
||||
while(iRet != 0)
|
||||
@ -1179,13 +1139,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2400 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1544 "nxdict.w"
|
||||
|
||||
static int NXDIParseLink(NXhandle hfil, NXdict pDict,ParDat *pParse)
|
||||
{
|
||||
char pError[256];
|
||||
@ -1214,14 +1168,8 @@
|
||||
return NXDopenalias(hfil, pDict, pParse->pToken);
|
||||
|
||||
}
|
||||
|
||||
#line 2402 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1034 "nxdict.w"
|
||||
|
||||
static int NXDIDefParse(NXhandle hFil, NXdict pDict, ParDat *pParse)
|
||||
int NXDIDefParse(NXhandle hFil, NXdict pDict, ParDat *pParse)
|
||||
{
|
||||
int iRet;
|
||||
char pError[256];
|
||||
@ -1271,14 +1219,8 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2404 "nxdict.w"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#line 1576 "nxdict.w"
|
||||
|
||||
static NXstatus NXDIUnwind(NXhandle hFil, int iDepth)
|
||||
NXstatus NXDIUnwind(NXhandle hFil, int iDepth)
|
||||
{
|
||||
int i, iRet;
|
||||
|
||||
@ -1292,13 +1234,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2406 "nxdict.w"
|
||||
|
||||
/*-------------------- The Data Transfer Functions ----------------------*/
|
||||
|
||||
#line 1597 "nxdict.w"
|
||||
|
||||
NXstatus NXDopendef(NXhandle hfil, NXdict dict, char *pDef)
|
||||
{
|
||||
NXdict pDict;
|
||||
@ -1332,24 +1268,18 @@
|
||||
/* do not rewind on links */
|
||||
return iRet;
|
||||
}
|
||||
|
||||
#line 2408 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1637 "nxdict.w"
|
||||
|
||||
NXstatus NXDopenalias(NXhandle hfil, NXdict dict, char *pAlias)
|
||||
{
|
||||
NXdict pDict;
|
||||
int iRet;
|
||||
char pDefinition[1024];
|
||||
char pDefinition[2048];
|
||||
pDynString pReplaced = NULL;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Definition String */
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||
@ -1369,13 +1299,7 @@
|
||||
DeleteDynString(pReplaced);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
#line 2410 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1674 "nxdict.w"
|
||||
|
||||
NXstatus NXDputdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
||||
{
|
||||
NXdict pDict;
|
||||
@ -1422,24 +1346,18 @@
|
||||
}
|
||||
return iStat;
|
||||
}
|
||||
|
||||
#line 2412 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1725 "nxdict.w"
|
||||
|
||||
NXstatus NXDputalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
||||
{
|
||||
NXdict pDict;
|
||||
int iRet;
|
||||
char pDefinition[1024];
|
||||
char pDefinition[2048];
|
||||
pDynString pReplaced = NULL;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Definition String */
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||
@ -1459,13 +1377,7 @@
|
||||
DeleteDynString(pReplaced);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
#line 2414 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1760 "nxdict.w"
|
||||
|
||||
NXstatus NXDgetdef(NXhandle hFil, NXdict dict, char *pDef, void *pData)
|
||||
{
|
||||
NXdict pDict;
|
||||
@ -1514,23 +1426,18 @@
|
||||
return iStat;
|
||||
}
|
||||
|
||||
#line 2416 "nxdict.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1812 "nxdict.w"
|
||||
|
||||
NXstatus NXDgetalias(NXhandle hFil, NXdict dict, char *pAlias, void *pData)
|
||||
{
|
||||
NXdict pDict;
|
||||
int iRet;
|
||||
char pDefinition[1024];
|
||||
char pDefinition[2048];
|
||||
pDynString pReplaced = NULL;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Definition String */
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,1023);
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||
@ -1550,13 +1457,92 @@
|
||||
DeleteDynString(pReplaced);
|
||||
return iRet;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 2418 "nxdict.w"
|
||||
NXstatus NXDinfodef(NXhandle hFil, NXdict dict, char *pDef, int *rank,
|
||||
int dimension[], int *iType)
|
||||
{
|
||||
NXdict pDict;
|
||||
ParDat pParse;
|
||||
int iRet, i, iStat;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* parse and act on definition string */
|
||||
pParse.iMayCreate = 0;
|
||||
pParse.pPtr = pDef;
|
||||
pParse.iDepth = 0;
|
||||
#ifdef DEFDEBUG
|
||||
printf("Getting: %s\n",pDef);
|
||||
#endif
|
||||
iRet = NXDIDefParse(hFil,pDict,&pParse);
|
||||
if(iRet == NX_ERROR)
|
||||
{
|
||||
/* unwind and throw up */
|
||||
NXDIUnwind(hFil,pParse.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* only SDS can be written */
|
||||
if(pParse.iTerminal != TERMSDS)
|
||||
{
|
||||
NXIReportError(NXpData,
|
||||
"ERROR: can only write to an SDS!");
|
||||
iStat = NX_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* the SDS should be open by now, read it */
|
||||
iStat = NXgetinfo(hFil, rank,dimension, iType);
|
||||
iRet = NXclosedata(hFil);
|
||||
}
|
||||
|
||||
|
||||
/* rewind the hierarchy */
|
||||
iRet = NXDIUnwind(hFil,pParse.iDepth);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
return NX_ERROR;
|
||||
}
|
||||
return iStat;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 1849 "nxdict.w"
|
||||
NXstatus NXDinfoalias(NXhandle hFil, NXdict dict, char *pAlias, int *rank,
|
||||
int dimension[], int *iType)
|
||||
{
|
||||
NXdict pDict;
|
||||
int iRet;
|
||||
char pDefinition[2048];
|
||||
pDynString pReplaced = NULL;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Definition String */
|
||||
iRet = NXDget(pDict,pAlias,pDefinition,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pDefinition,"ERROR: alias %s not recognized",pAlias);
|
||||
NXIReportError(NXpData,pDefinition);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* do text replacement */
|
||||
pReplaced = NXDItextreplace(dict,pDefinition);
|
||||
if(!pReplaced)
|
||||
{
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* call NXDgetdef */
|
||||
iRet = NXDinfodef(hFil,dict,GetCharArray(pReplaced),rank,dimension,iType);
|
||||
DeleteDynString(pReplaced);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
NXstatus NXDdeflink(NXhandle hFil, NXdict dict,
|
||||
char *pTarget, char *pVictim)
|
||||
{
|
||||
@ -1645,7 +1631,7 @@
|
||||
NXstatus NXDaliaslink(NXhandle hFil, NXdict dict,
|
||||
char *pTarget, char *pVictim)
|
||||
{
|
||||
char pTargetDef[1024], pVictimDef[1024];
|
||||
char pTargetDef[2048], pVictimDef[2048];
|
||||
int iRet;
|
||||
NXdict pDict;
|
||||
pDynString pRep1 = NULL, pRep2 = NULL;
|
||||
@ -1653,7 +1639,7 @@
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Target Definition String */
|
||||
iRet = NXDget(pDict,pTarget,pTargetDef,1023);
|
||||
iRet = NXDget(pDict,pTarget,pTargetDef,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
||||
@ -1662,7 +1648,7 @@
|
||||
}
|
||||
|
||||
/* get Victim definition string */
|
||||
iRet = NXDget(pDict,pVictim,pVictimDef,1023);
|
||||
iRet = NXDget(pDict,pVictim,pVictimDef,2047);
|
||||
if(iRet != NX_OK)
|
||||
{
|
||||
sprintf(pTargetDef,"ERROR: alias %s not recognized",pTarget);
|
||||
@ -1688,14 +1674,6 @@
|
||||
DeleteDynString(pRep2);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
#line 2420 "nxdict.w"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#line 1986 "nxdict.w"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void SNXFormatTime(char *pBuffer, int iBufLen)
|
||||
{
|
||||
@ -1706,7 +1684,7 @@
|
||||
iDate = time(NULL);
|
||||
psTime = localtime(&iDate);
|
||||
memset(pBuffer,0,iBufLen);
|
||||
strftime(pBuffer,iBufLen,"%Y-%d-%m %H:%M:%S",psTime);
|
||||
strftime(pBuffer,iBufLen,"%Y-%m-%d %H:%M:%S",psTime);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
NXstatus NXUwriteglobals(NXhandle pFile,
|
||||
@ -1721,26 +1699,28 @@
|
||||
char pBueffel[512];
|
||||
int iStat;
|
||||
|
||||
/* store global attributes */
|
||||
/* store global attributes, now done by NXopen
|
||||
iStat = NXputattr(pFile,"file_name",filename,
|
||||
strlen(filename)+1,DFNT_INT8);
|
||||
strlen(filename)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return NX_ERROR;
|
||||
}
|
||||
*/
|
||||
|
||||
/* write creation time */
|
||||
/* write creation time, now done by NXopen
|
||||
SNXFormatTime(pBueffel,512);
|
||||
iStat = NXputattr(pFile,"file_time",pBueffel,
|
||||
strlen(pBueffel)+1,DFNT_INT8);
|
||||
strlen(pBueffel)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return NX_ERROR;
|
||||
}
|
||||
*/
|
||||
|
||||
/* instrument name */
|
||||
iStat = NXputattr(pFile,"instrument",instrument,
|
||||
strlen(instrument)+1,DFNT_INT8);
|
||||
strlen(instrument)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
@ -1748,7 +1728,7 @@
|
||||
|
||||
/* owner */
|
||||
iStat = NXputattr(pFile,"owner",owner,
|
||||
strlen(owner)+1,DFNT_INT8);
|
||||
strlen(owner)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
@ -1756,7 +1736,7 @@
|
||||
|
||||
/* Adress */
|
||||
iStat = NXputattr(pFile,"owner_adress",adress,
|
||||
strlen(adress)+1,DFNT_INT8);
|
||||
strlen(adress)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
@ -1764,7 +1744,7 @@
|
||||
|
||||
/* phone */
|
||||
iStat = NXputattr(pFile,"owner_telephone_number",phone,
|
||||
strlen(phone)+1,DFNT_INT8);
|
||||
strlen(phone)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
@ -1772,7 +1752,7 @@
|
||||
|
||||
/* fax */
|
||||
iStat = NXputattr(pFile,"owner_fax_number",fax,
|
||||
strlen(fax)+1,DFNT_INT8);
|
||||
strlen(fax)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
@ -1780,20 +1760,14 @@
|
||||
|
||||
/* email */
|
||||
iStat = NXputattr(pFile,"owner_email",email,
|
||||
strlen(email)+1,DFNT_INT8);
|
||||
strlen(email)+1,NX_CHAR);
|
||||
if(iStat == NX_ERROR)
|
||||
{
|
||||
return iStat;
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2422 "nxdict.w"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#line 2082 "nxdict.w"
|
||||
|
||||
NXstatus NXUentergroup(NXhandle hFil, char *name, char *class)
|
||||
{
|
||||
void (*ErrFunc)(void *pData, char *pErr);
|
||||
@ -1828,13 +1802,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2424 "nxdict.w"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#line 2119 "nxdict.w"
|
||||
|
||||
NXstatus NXUenterdata(NXhandle hFil, char *label, int datatype,
|
||||
int rank, int dim[], char *pUnits)
|
||||
{
|
||||
@ -1877,13 +1845,7 @@
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2426 "nxdict.w"
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#line 2165 "nxdict.w"
|
||||
|
||||
NXstatus NXUallocSDS(NXhandle hFil, void **pData)
|
||||
{
|
||||
int iDIM[MAX_VAR_DIMS];
|
||||
@ -1913,6 +1875,8 @@
|
||||
lLength *= sizeof(float64);
|
||||
break;
|
||||
case DFNT_INT8:
|
||||
case DFNT_CHAR:
|
||||
case DFNT_UCHAR8:
|
||||
lLength *= sizeof(int8);
|
||||
break;
|
||||
case DFNT_UINT8:
|
||||
@ -1943,15 +1907,10 @@
|
||||
NXIReportError(NXpData,"ERROR: memory exhausted in NXUallocSDS");
|
||||
return NX_ERROR;
|
||||
}
|
||||
memset(*pData,0,lLength);
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2428 "nxdict.w"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#line 2229 "nxdict.w"
|
||||
|
||||
NXstatus NXUfreeSDS(void **pData)
|
||||
{
|
||||
free(*pData);
|
||||
@ -1959,5 +1918,3 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
#line 2430 "nxdict.w"
|
||||
|
||||
|
Reference in New Issue
Block a user