Skip to content

Commit 4dca148

Browse files
Merge pull request #391 from chrisemblhh/hide-internal-fortran
Hide internal API
2 parents accd990 + 3402f69 commit 4dca148

13 files changed

Lines changed: 414 additions & 302 deletions

File tree

applications/NXbrowse/NXbrowse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <string.h>
3434
#include <stdlib.h>
3535
#include "napi.h"
36+
#include "napi_internal.h" /* for NXM{En,Dis}ableErrorReporting */
3637
#include "napiconfig.h"
3738
static char *my_readline(const char *prompt)
3839
{

applications/NXsummary/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "preferences.hpp"
3838
#include "string_util.hpp"
3939
#include "tclap/CmdLine.h"
40+
#include "napi_internal.h" // needed for NXMDisableErrorReporting
4041

4142
using std::cerr;
4243
using std::cout;

include/napi.h

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,6 @@ typedef struct {
249249
# define NXlinkexternaldataset MANGLE(nxilinkexternaldataset)
250250
# define NXgetversion MANGLE(nxigetversion)
251251

252-
/*
253-
* FORTRAN helpers - for NeXus internal use only
254-
*/
255-
# define NXfopen MANGLE(nxifopen)
256-
# define NXfclose MANGLE(nxifclose)
257-
# define NXfflush MANGLE(nxifflush)
258-
# define NXfmakedata MANGLE(nxifmakedata)
259-
# define NXfcompmakedata MANGLE(nxifcompmakedata)
260-
# define NXfcompress MANGLE(nxifcompress)
261-
# define NXfputattr MANGLE(nxifputattr)
262-
# define NXfgetpath MANGLE(nxifgetpath)
263-
264252
/*
265253
* Standard interface
266254
*
@@ -861,154 +849,8 @@ extern const char* NXgetversion();
861849
extern NXstatus NXfree(void** data);
862850

863851

864-
/*-----------------------------------------------------------------------
865-
NAPI internals
866-
------------------------------------------------------------------------*/
867-
/**
868-
* Retrieve information about the currently open dataset. In contrast to the main function below,
869-
* this function does not try to find out about the size of strings properly.
870-
* \param handle A NeXus file handle as initialized by NXopen.
871-
* \param rank A pointer to an integer which will be filled with the rank of
872-
* the dataset.
873-
* \param dimension An array which will be initialized with the size of the dataset in any of its
874-
* dimensions. The array must have at least the size of rank.
875-
* \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset.
876-
* \return NX_OK on success, NX_ERROR in the case of an error.
877-
* \ingroup c_metadata
878-
*/
879-
extern NXstatus NXgetrawinfo(NXhandle handle, int* rank, int dimension[], int* datatype);
880-
881-
/**
882-
* @copydoc NXgetrawinfo
883-
*/
884-
extern NXstatus NXgetrawinfo64(NXhandle handle, int* rank, int64_t dimension[], int* datatype);
885-
886-
/** \typedef void (*ErrFunc)(void *data, char *text)
887-
* All NeXus error reporting happens through this special function, the
888-
* ErrFunc. The NeXus-API allows to replace this error reporting function
889-
* through a user defined implementation. The default error function prints to stderr. User
890-
* defined ones may pop up dialog boxes or whatever.
891-
* \param data A pointer to some user defined data structure
892-
* \param text The text of the error message to display.
893-
*/
894-
typedef void (*ErrFunc)(void *data, char *text);
895-
896-
/**
897-
* Set a global error function.
898-
* Not threadsafe.
899-
* \param pData A pointer to a user defined data structure which be passed to
900-
* the error display function.
901-
* \param newErr The new error display function.
902-
*/
903-
extern void NXMSetError(void *pData, ErrFunc newErr);
904-
905-
/**
906-
* Set an error function for the current thread.
907-
* When used this overrides anything set in NXMSetError (for the current thread).
908-
* Use this method in threaded applications.
909-
* \param pData A pointer to a user defined data structure which be passed to
910-
* the error display function.
911-
* \param newErr The new error display function.
912-
*/
913-
extern void NXMSetTError(void *pData, ErrFunc newErr);
914-
915-
/**
916-
* Retrieve the current error display function
917-
* \return The current error display function.
918-
*/
919-
extern ErrFunc NXMGetError();
920-
921-
/**
922-
* Suppress error reports from the NeXus-API
923-
*/
924-
extern void NXMDisableErrorReporting();
925-
926-
/**
927-
* Enable error reports from the NeXus-API
928-
*/
929-
extern void NXMEnableErrorReporting();
930-
931-
/**
932-
* Dispatches the error message to the error function defined by NXMSetTError
933-
*/
934-
extern void NXReportError(char *text);
935-
936-
/**
937-
* Do not use, first parameter should be set by NXMSetTError
938-
*/
939-
extern void NXIReportError(void *pData,char *text);
940-
/* extern void *NXpData; */
941-
extern char *NXIformatNeXusTime();
942852
extern NXstatus NXIprintlink(NXhandle fid, NXlink* link);
943853

944-
/**
945-
* A function for setting the default cache size for HDF-5
946-
* \ingroup c_init
947-
*/
948-
extern NXstatus NXsetcache(long newVal);
949-
950-
typedef struct {
951-
NXhandle pNexusData;
952-
NXstatus ( *nxreopen)(NXhandle pOrigHandle, NXhandle* pNewHandle);
953-
NXstatus ( *nxclose)(NXhandle* pHandle);
954-
NXstatus ( *nxflush)(NXhandle* pHandle);
955-
NXstatus ( *nxmakegroup) (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass);
956-
NXstatus ( *nxopengroup) (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass);
957-
NXstatus ( *nxclosegroup)(NXhandle handle);
958-
NXstatus ( *nxmakedata64) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int64_t dim[]);
959-
NXstatus ( *nxcompmakedata64) (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int64_t dim[], int comp_typ, int64_t bufsize[]);
960-
NXstatus ( *nxcompress) (NXhandle handle, int compr_type);
961-
NXstatus ( *nxopendata) (NXhandle handle, CONSTCHAR* label);
962-
NXstatus ( *nxclosedata)(NXhandle handle);
963-
NXstatus ( *nxputdata)(NXhandle handle, const void* data);
964-
NXstatus ( *nxputattr)(NXhandle handle, CONSTCHAR* name, const void* data, int iDataLen, int iType);
965-
NXstatus ( *nxputattra)(NXhandle handle, CONSTCHAR* name, const void* data, const int rank, const int dim[], const int iType);
966-
NXstatus ( *nxputslab64)(NXhandle handle, const void* data, const int64_t start[], const int64_t size[]);
967-
NXstatus ( *nxgetdataID)(NXhandle handle, NXlink* pLink);
968-
NXstatus ( *nxmakelink)(NXhandle handle, NXlink* pLink);
969-
NXstatus ( *nxmakenamedlink)(NXhandle handle, CONSTCHAR *newname, NXlink* pLink);
970-
NXstatus ( *nxgetdata)(NXhandle handle, void* data);
971-
NXstatus ( *nxgetinfo64)(NXhandle handle, int* rank, int64_t dimension[], int* datatype);
972-
NXstatus ( *nxgetnextentry)(NXhandle handle, NXname name, NXname nxclass, int* datatype);
973-
NXstatus ( *nxgetslab64)(NXhandle handle, void* data, const int64_t start[], const int64_t size[]);
974-
NXstatus ( *nxgetnextattr)(NXhandle handle, NXname pName, int *iLength, int *iType);
975-
NXstatus ( *nxgetnextattra)(NXhandle handle, NXname pName, int *rank, int dim[], int *iType);
976-
NXstatus ( *nxgetattr)(NXhandle handle, char* name, void* data, int* iDataLen, int* iType);
977-
NXstatus ( *nxgetattra)(NXhandle handle, char* name, void* data);
978-
NXstatus ( *nxgetattrainfo)(NXhandle handle, NXname pName, int *rank, int dim[], int *iType);
979-
NXstatus ( *nxgetattrinfo)(NXhandle handle, int* no_items);
980-
NXstatus ( *nxgetgroupID)(NXhandle handle, NXlink* pLink);
981-
NXstatus ( *nxgetgroupinfo)(NXhandle handle, int* no_items, NXname name, NXname nxclass);
982-
NXstatus ( *nxsameID)(NXhandle handle, NXlink* pFirstID, NXlink* pSecondID);
983-
NXstatus ( *nxinitgroupdir)(NXhandle handle);
984-
NXstatus ( *nxinitattrdir)(NXhandle handle);
985-
NXstatus ( *nxsetnumberformat)(NXhandle handle, int type, char *format);
986-
NXstatus ( *nxprintlink)(NXhandle handle, NXlink* link);
987-
NXstatus ( *nxnativeexternallink)(NXhandle handle, CONSTCHAR* name, CONSTCHAR* externalfile, CONSTCHAR* remotetarget);
988-
NXstatus ( *nxnativeinquirefile)(NXhandle handle, char* externalfile, const int filenamelength);
989-
NXstatus ( *nxnativeisexternallink)(NXhandle handle, CONSTCHAR* name, char* url, int urllen);
990-
int stripFlag;
991-
int checkNameSyntax;
992-
} NexusFunction, *pNexusFunction;
993-
/*---------------------*/
994-
extern long nx_cacheSize;
995-
996-
/* FORTRAN internals */
997-
998-
extern NXstatus NXfopen(char * filename, NXaccess* am,
999-
NXhandle pHandle);
1000-
extern NXstatus NXfclose (NXhandle pHandle);
1001-
extern NXstatus NXfputattr(NXhandle fid, const char *name, const void *data,
1002-
int *pDatalen, int *pIType);
1003-
extern NXstatus NXfcompress(NXhandle fid, int *compr_type);
1004-
extern NXstatus NXfcompmakedata(NXhandle fid, char *name,
1005-
int *pDatatype,
1006-
int *pRank, int dimensions[],
1007-
int *compression_type, int chunk[]);
1008-
extern NXstatus NXfmakedata(NXhandle fid, char *name, int *pDatatype,
1009-
int *pRank, int dimensions[]);
1010-
extern NXstatus NXfflush(NXhandle pHandle);
1011-
extern NXstatus NXfgetpath(NXhandle fid, char *path, int *pathlen);
1012854
#ifdef __cplusplus
1013855
};
1014856
#endif /* __cplusplus */

include/napi_fortran_helper.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*---------------------------------------------------------------------------
2+
NeXus - Neutron & X-ray Common Data Format
3+
4+
Application Program Interface Header File
5+
6+
Copyright (C) 2015 NeXus International Advisory Committee
7+
8+
This library is free software; you can redistribute it and/or
9+
modify it under the terms of the GNU Lesser General Public
10+
License as published by the Free Software Foundation; either
11+
version 2 of the License, or (at your option) any later version.
12+
13+
This library is distributed in the hope that it will be useful,
14+
but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
Lesser General Public License for more details.
17+
18+
You should have received a copy of the GNU Lesser General Public
19+
License along with this library; if not, write to the Free Software
20+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21+
22+
For further information, see <http://www.nexusformat.org>
23+
24+
----------------------------------------------------------------------------*/
25+
26+
#include <napi.h>
27+
28+
/*
29+
* FORTRAN helpers - for NeXus internal use only
30+
*/
31+
32+
# define NXfopen MANGLE(nxifopen)
33+
# define NXfclose MANGLE(nxifclose)
34+
# define NXfflush MANGLE(nxifflush)
35+
# define NXfmakedata MANGLE(nxifmakedata)
36+
# define NXfcompmakedata MANGLE(nxifcompmakedata)
37+
# define NXfcompress MANGLE(nxifcompress)
38+
# define NXfputattr MANGLE(nxifputattr)
39+
# define NXfgetpath MANGLE(nxifgetpath)
40+
41+
extern NXstatus NXfopen(char * filename, NXaccess* am,
42+
NXhandle pHandle);
43+
extern NXstatus NXfclose (NXhandle pHandle);
44+
extern NXstatus NXfputattr(NXhandle fid, const char *name, const void *data,
45+
int *pDatalen, int *pIType);
46+
extern NXstatus NXfcompress(NXhandle fid, int *compr_type);
47+
extern NXstatus NXfcompmakedata(NXhandle fid, char *name,
48+
int *pDatatype,
49+
int *pRank, int dimensions[],
50+
int *compression_type, int chunk[]);
51+
extern NXstatus NXfmakedata(NXhandle fid, char *name, int *pDatatype,
52+
int *pRank, int dimensions[]);
53+
extern NXstatus NXfflush(NXhandle pHandle);
54+
extern NXstatus NXfgetpath(NXhandle fid, char *path, int *pathlen);

0 commit comments

Comments
 (0)