- Switched to NAPI-3.0 with XML support
- Fixed exeman to write files by default into the first directory in batchpath - Fixed a bug in nxdict which prevented it from handling attributes containing :/ properly - Removed junk files - Fixed a bug in hklscan.c which made it dump core - Added XML support to nxscript.c - Added support for writing NeXus-XML data files to tasub
This commit is contained in:
87
napi5.c
87
napi5.c
@@ -27,10 +27,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
#include "napi.h"
|
||||
#include "napi5.h"
|
||||
*/
|
||||
|
||||
extern void *NXpData;
|
||||
|
||||
@@ -114,7 +112,8 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
NXstatus CALLING_STYLE NX5open(CONSTCHAR *filename, NXaccess am, NXhandle* pHandle)
|
||||
NXstatus CALLING_STYLE NX5open(CONSTCHAR *filename, NXaccess am,
|
||||
NXhandle* pHandle)
|
||||
{
|
||||
hid_t attr1,aid1, aid2;
|
||||
pNexusFile5 pNew = NULL;
|
||||
@@ -128,11 +127,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
unsigned int vers_major, vers_minor, vers_release, am1 ;
|
||||
hid_t fapl;
|
||||
int mdc_nelmts;
|
||||
#ifdef H5_WANT_H5_V1_4_COMPAT
|
||||
unsigned int rdcc_nelmts;
|
||||
#else
|
||||
size_t rdcc_nelmts;
|
||||
#endif
|
||||
unsigned long rdcc_nelmts;
|
||||
size_t rdcc_nbytes;
|
||||
double rdcc_w0;
|
||||
|
||||
@@ -395,7 +390,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
NXstatus CALLING_STYLE NX5makegroup (NXhandle fid, CONSTCHAR *name, char *nxclass)
|
||||
NXstatus CALLING_STYLE NX5makegroup (NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass)
|
||||
{
|
||||
pNexusFile5 pFile;
|
||||
hid_t iRet;
|
||||
@@ -451,7 +446,7 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
return strstr(member_name, attr_name) ? 1 : 0;
|
||||
}
|
||||
|
||||
NXstatus CALLING_STYLE NX5opengroup (NXhandle fid, CONSTCHAR *name, char *nxclass)
|
||||
NXstatus CALLING_STYLE NX5opengroup (NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass)
|
||||
{
|
||||
|
||||
pNexusFile5 pFile;
|
||||
@@ -870,6 +865,8 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
NXstatus CALLING_STYLE NX5putdata (NXhandle fid, void *data)
|
||||
{
|
||||
pNexusFile5 pFile;
|
||||
@@ -1090,7 +1087,8 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
if(pFile->iCurrentD <= 0){
|
||||
return NX_ERROR;
|
||||
}
|
||||
strcpy(sRes->iRef5,pFile->name_ref);
|
||||
strcpy(sRes->iRef5,"/");
|
||||
strcat(sRes->iRef5,pFile->name_ref);
|
||||
strcpy(sRes->iRefd,pFile->iCurrentLD);
|
||||
return NX_OK;
|
||||
}
|
||||
@@ -1101,10 +1099,11 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
{
|
||||
pNexusFile5 pFile;
|
||||
/* int iRet; */
|
||||
herr_t status;
|
||||
herr_t status, dataID, aid1, aid2, attID;
|
||||
int size_type;
|
||||
char buffer[1024];
|
||||
|
||||
char name[] = "target";
|
||||
|
||||
pFile = NXI5assert (fid);
|
||||
if (pFile->iCurrentG == 0) { /* root level, can not link here */
|
||||
return NX_ERROR;
|
||||
@@ -1132,6 +1131,36 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
strcat(sLink->iTag5,sLink->iRefd);
|
||||
}
|
||||
status = H5Glink(pFile->iFID, H5G_LINK_HARD, sLink->iRef5, sLink->iTag5);
|
||||
if(size_type > 0)
|
||||
{
|
||||
dataID = H5Dopen(pFile->iFID,sLink->iRef5);
|
||||
/*
|
||||
remove old attribute if existing
|
||||
*/
|
||||
status = H5Aopen_name(dataID,name);
|
||||
if(status > 0)
|
||||
{
|
||||
H5Aclose(status);
|
||||
status = H5Adelete(dataID,name);
|
||||
if(status < 0)
|
||||
{
|
||||
return NX_OK;
|
||||
}
|
||||
}
|
||||
aid2 = H5Screate(H5S_SCALAR);
|
||||
aid1 = H5Tcopy(H5T_C_S1);
|
||||
H5Tset_size(aid1,strlen(sLink->iRef5));
|
||||
attID = H5Acreate(dataID,name,aid1,aid2,H5P_DEFAULT);
|
||||
if(attID < 0)
|
||||
{
|
||||
return NX_OK;
|
||||
}
|
||||
H5Awrite(attID,aid1,sLink->iRef5);
|
||||
H5Tclose(aid1);
|
||||
H5Sclose(aid2);
|
||||
H5Aclose(attID);
|
||||
H5Dclose(dataID);
|
||||
}
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
@@ -2070,3 +2099,35 @@ NXstatus CALLING_STYLE NX5closegroup (NXhandle fid);
|
||||
NXI5KillDir (fid);
|
||||
return NX_OK;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void NX5assignFunctions(pNexusFunction fHandle)
|
||||
{
|
||||
fHandle->nxclose=NX5close;
|
||||
fHandle->nxflush=NX5flush;
|
||||
fHandle->nxmakegroup=NX5makegroup;
|
||||
fHandle->nxopengroup=NX5opengroup;
|
||||
fHandle->nxclosegroup=NX5closegroup;
|
||||
fHandle->nxmakedata=NX5makedata;
|
||||
fHandle->nxcompmakedata=NX5compmakedata;
|
||||
fHandle->nxcompress=NX5compress;
|
||||
fHandle->nxopendata=NX5opendata;
|
||||
fHandle->nxclosedata=NX5closedata;
|
||||
fHandle->nxputdata=NX5putdata;
|
||||
fHandle->nxputattr=NX5putattr;
|
||||
fHandle->nxputslab=NX5putslab;
|
||||
fHandle->nxgetdataID=NX5getdataID;
|
||||
fHandle->nxmakelink=NX5makelink;
|
||||
fHandle->nxgetdata=NX5getdata;
|
||||
fHandle->nxgetinfo=NX5getinfo;
|
||||
fHandle->nxgetnextentry=NX5getnextentry;
|
||||
fHandle->nxgetslab=NX5getslab;
|
||||
fHandle->nxgetnextattr=NX5getnextattr;
|
||||
fHandle->nxgetattr=NX5getattr;
|
||||
fHandle->nxgetattrinfo=NX5getattrinfo;
|
||||
fHandle->nxgetgroupID=NX5getgroupID;
|
||||
fHandle->nxgetgroupinfo=NX5getgroupinfo;
|
||||
fHandle->nxsameID=NX5sameID;
|
||||
fHandle->nxinitgroupdir=NX5initgroupdir;
|
||||
fHandle->nxinitattrdir=NX5initattrdir;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user