diff options
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/src/H5private.h b/src/H5private.h index d8f7f15..526717c 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -289,7 +289,7 @@ # define FALSE 0 #endif #ifndef TRUE -# define TRUE (!FALSE) +# define TRUE 1 #endif /* @@ -844,9 +844,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDuname(S) uname(S) #define HDungetc(C,F) ungetc(C,F) #ifdef WIN32 -#define HDunlink(S) _unlink(S) +#define HDunlink(S) _unlink(S) #else -#define HDunlink(S) unlink(S) +#define HDunlink(S) unlink(S) #endif #define HDutime(S,T) utime(S,T) #define HDva_arg(A,T) va_arg(A,T) @@ -1125,6 +1125,25 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ assert(func_name) #endif /* H5_HAVE_FUNCTION */ +/* Macros for defining interface initialization routines */ +#ifdef H5_INTERFACE_INIT_FUNC +static int H5_interface_initialize_g = 0; +static herr_t H5_INTERFACE_INIT_FUNC(void); +#define H5_INTERFACE_INIT(err) \ + /* Initialize this interface or bust */ \ + if (!H5_interface_initialize_g) { \ + H5_interface_initialize_g = 1; \ + if (H5_INTERFACE_INIT_FUNC()<0) { \ + H5_interface_initialize_g = 0; \ + HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed") \ + } \ + } +#else /* H5_INTERFACE_INIT_FUNC */ +#define H5_INTERFACE_INIT(err) +#endif /* H5_INTERFACE_INIT_FUNC */ + + #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) \ PABLO_SAVE (ID_ ## func_name) \ \ @@ -1165,7 +1184,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \ + FUNC_ENTER_API_COMMON(func_name,err); \ /* Clear thread error stack entering public functions */ \ H5E_clear(); \ { @@ -1178,7 +1197,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \ + FUNC_ENTER_API_COMMON(func_name,err); \ { /* @@ -1198,7 +1217,13 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(func_name,err) { \ FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,INTERFACE_INIT,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ + { + +/* Use this macro for all non-API functions which don't issue errors */ +#define FUNC_ENTER_NOAPI_NOFUNC(func_name) { \ + FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* @@ -1235,12 +1260,16 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ * Use this macro for non-API functions which fall into these categories: * - functions which shouldn't push their name on the function stack * (so far, just the H5FS routines themselves) + * + * This macro is used for functions which fit the above categories _and_ + * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) + * */ -#define FUNC_ENTER_NOAPI_NOFS(func_name) { \ - FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \ +#define FUNC_ENTER_NOAPI_NOFUNC_NOFS(func_name) { \ + FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ { -#define FUNC_ENTER_API_COMMON(func_name,interface_init_func,err) \ +#define FUNC_ENTER_API_COMMON(func_name,err) \ /* Initialize the library */ \ if (!(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ @@ -1249,33 +1278,17 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ "library initialization failed") \ } \ \ - /* Initialize this interface or bust */ \ - if (!interface_initialize_g) { \ - interface_initialize_g = 1; \ - if (interface_init_func && \ - ((herr_t(*)(void))interface_init_func)()<0) { \ - interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed"); \ - } \ - } \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(func_name); \ \ BEGIN_MPE_LOG(func_name) -#define FUNC_ENTER_NOAPI_INIT(func_name,interface_init_func,err) \ - /* Initialize this interface or bust */ \ - if (!interface_initialize_g) { \ - interface_initialize_g = 1; \ - if (interface_init_func && \ - ((herr_t(*)(void))interface_init_func)()<0) { \ - interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed"); \ - } \ - } \ +#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(func_name); @@ -1362,7 +1375,6 @@ H5_DLL int H5I_term_interface(void); H5_DLL int H5P_term_interface(void); H5_DLL int H5R_term_interface(void); H5_DLL int H5S_term_interface(void); -H5_DLL int H5TN_term_interface(void); H5_DLL int H5T_term_interface(void); H5_DLL int H5Z_term_interface(void); |