diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-21 21:08:27 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-21 21:08:27 (GMT) |
commit | cdd4606430edbb9b322c1abd55b2a4cdff936088 (patch) | |
tree | a1bfe5c7d3027df3b9179958d426ef36143625b9 /src/H5Epublic.h | |
parent | 6262a14f2e6f669f72e0212b4ce3654c9526f1dc (diff) | |
download | hdf5-cdd4606430edbb9b322c1abd55b2a4cdff936088.zip hdf5-cdd4606430edbb9b322c1abd55b2a4cdff936088.tar.gz hdf5-cdd4606430edbb9b322c1abd55b2a4cdff936088.tar.bz2 |
[svn-r14097] Description:
First real use of API versioning code, H5E routines switched to use
new API versioning scheme.
Tested on:
Mac OS X/32 10.4.10 (amazon)
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
Solaris/32 5.10 (linew)
Diffstat (limited to 'src/H5Epublic.h')
-rw-r--r-- | src/H5Epublic.h | 107 |
1 files changed, 65 insertions, 42 deletions
diff --git a/src/H5Epublic.h b/src/H5Epublic.h index ce68b71..2ad7a06 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -34,20 +34,6 @@ typedef enum H5E_type_t { H5E_MINOR } H5E_type_t; -/* For backward compatibility with v1.6 */ -typedef hid_t H5E_major_t; -typedef hid_t H5E_minor_t; - -/* Information about an error; element of error stack. For backward compatibility with v1.6. */ -typedef struct H5E_error_t { - H5E_major_t maj_num; /*major error number */ - H5E_minor_t min_num; /*minor error number */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - unsigned line; /*line in file where error occurs */ - const char *desc; /*optional supplied description */ -} H5E_error_t; - /* Information about an error; element of error stack */ typedef struct H5E_error2_t { hid_t cls_id; /*class ID */ @@ -92,10 +78,11 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * These two macros still use the old API functions for backward compatibility * purpose. */ +#ifndef H5_NO_DEPRECATED_SYMBOLS #define H5E_BEGIN_TRY { \ unsigned H5E_saved_is_v2; \ union { \ - H5E_auto_t efunc; \ + H5E_auto1_t efunc1; \ H5E_auto2_t efunc2; \ } H5E_saved; \ void *H5E_saved_edata; \ @@ -105,16 +92,28 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; (void)H5Eget_auto2(H5E_DEFAULT, &H5E_saved.efunc2, &H5E_saved_edata); \ (void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL); \ } else { \ - (void)H5Eget_auto(&H5E_saved.efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(NULL, NULL); \ + (void)H5Eget_auto1(&H5E_saved.efunc1, &H5E_saved_edata); \ + (void)H5Eset_auto1(NULL, NULL); \ } #define H5E_END_TRY \ if(H5E_saved_is_v2) \ (void)H5Eset_auto2(H5E_DEFAULT, H5E_saved.efunc2, H5E_saved_edata); \ else \ - (void)H5Eset_auto(H5E_saved.efunc, H5E_saved_edata); \ + (void)H5Eset_auto1(H5E_saved.efunc1, H5E_saved_edata); \ +} +#else /* H5_NO_DEPRECATED_SYMBOLS */ +#define H5E_BEGIN_TRY { \ + H5E_auto_t saved_efunc; \ + void *H5E_saved_edata; \ + \ + (void)H5Eget_auto(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ + (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL); + +#define H5E_END_TRY \ + (void)H5Eset_auto(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* * Public API Convenience Macros for Error reporting - Documented @@ -152,11 +151,8 @@ extern "C" { #endif /* Error stack traversal callback function pointers */ -typedef herr_t (*H5E_walk_t)(unsigned n, const H5E_error_t *err_desc, - void *client_data); typedef herr_t (*H5E_walk2_t)(unsigned n, const H5E_error2_t *err_desc, void *client_data); -typedef herr_t (*H5E_auto_t)(void *client_data); typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data); /* Public API functions */ @@ -168,36 +164,63 @@ H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); H5_DLL hid_t H5Eget_current_stack(void); H5_DLL herr_t H5Eclose_stack(hid_t stack_id); H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); -H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, - size_t size); -H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); -H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); -H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); - -/* These old APIs are kept for backward compatibility. They don't have - * the error stack in the parameters. */ -H5_DLL herr_t H5Epush(const char *file, const char *func, unsigned line, - H5E_major_t maj, H5E_minor_t min, const char *str); -H5_DLL herr_t H5Eprint(FILE *stream); -H5_DLL herr_t H5Ewalk(H5E_direction_t direction, H5E_walk_t func, - void *client_data); -H5_DLL herr_t H5Eget_auto(H5E_auto_t *func, void **client_data); -H5_DLL herr_t H5Eset_auto(H5E_auto_t func, void *client_data); -H5_DLL herr_t H5Eclear(void); -H5_DLL const char *H5Eget_major(H5E_major_t maj); -H5_DLL const char *H5Eget_minor(H5E_minor_t min); - -/* New APIs function the same as the old ones above, with the error stack - * in the parameters */ H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...); +H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); H5_DLL herr_t H5Eclear2(hid_t err_stack); +H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, + size_t size); +H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); + + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Typedefs */ + +/* Alias major & minor error types to hid_t's, for compatibility with new + * error API in v1.8 + */ +typedef hid_t H5E_major_t; +typedef hid_t H5E_minor_t; + +/* Information about an error element of error stack. */ +typedef struct H5E_error1_t { + H5E_major_t maj_num; /*major error number */ + H5E_minor_t min_num; /*minor error number */ + const char *func_name; /*function in which error occurred */ + const char *file_name; /*file in which error occurred */ + unsigned line; /*line in file where error occurs */ + const char *desc; /*optional supplied description */ +} H5E_error1_t; + +/* Error stack traversal callback function pointers */ +typedef herr_t (*H5E_walk1_t)(unsigned n, const H5E_error1_t *err_desc, + void *client_data); +typedef herr_t (*H5E_auto1_t)(void *client_data); + +/* Function prototypes */ +H5_DLL herr_t H5Eclear1(void); +H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data); +H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, + H5E_major_t maj, H5E_minor_t min, const char *str); +H5_DLL herr_t H5Eprint1(FILE *stream); +H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data); +H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, + void *client_data); +H5_DLL char *H5Eget_major(H5E_major_t maj); +H5_DLL char *H5Eget_minor(H5E_minor_t min); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus } |