summaryrefslogtreecommitdiffstats
path: root/src/H5Epublic.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-09-09 02:37:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-09-09 02:37:02 (GMT)
commiteb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21 (patch)
tree5a15644f3f46cb73b22605f3d03b36918bbbd065 /src/H5Epublic.h
parent4389b976a5af4d4ca755f4ddab2e2e9ed861ea1e (diff)
downloadhdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.zip
hdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.tar.gz
hdf5-eb3e9ccd8ac3e1a69d0f9bc2c9e9f1c2b5108f21.tar.bz2
[svn-r9234] Purpose:
Code cleanup Description: Tweak recent "forward compatibility" changes to the H5E* API (which allowed for the old H5E API functions to remain unchanged) by allowing for the error stack callback function (H5E_auto_t) to also remain unchanged from the 1.6 branch. This required changing the H5E{get|set}_auto routines to have the old style H5E_auto_t type (which didn't have a stack ID parameter) and the new H5E{get|set}_auto_stack routines to have a newer "H5E_auto_stack_t" type (which has a stack ID parameter). This should make the H5E API changes as forwardly compatible as possible. One side-affect of this change was that it was impossible to determine if the current auto error callback was the old style (H5E_auto_t) or the new style (H5E_auto_stack_t) of callback, so a new API function (H5Eauto_is_stack) was adde to query this. Platforms tested: FreeBSD 4.10 (sleipnir) IRIX64 6.5 (modi4) h5committest
Diffstat (limited to 'src/H5Epublic.h')
-rw-r--r--src/H5Epublic.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 247767c..d5581dd 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -85,13 +85,28 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g;
* purpose.
*/
#define H5E_BEGIN_TRY { \
- H5E_auto_t H5E_saved_efunc; \
+ unsigned H5E_saved_is_stack; \
+ union { \
+ H5E_auto_stack_t stack_efunc; \
+ H5E_auto_t efunc; \
+ } H5E_saved; \
void *H5E_saved_edata; \
- (void)H5Eget_auto_stack(H5E_DEFAULT, &H5E_saved_efunc, &H5E_saved_edata); \
- (void)H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
+ \
+ (void)H5Eauto_is_stack(H5E_DEFAULT, &H5E_saved_is_stack); \
+ if(H5E_saved_is_stack) { \
+ (void)H5Eget_auto_stack(H5E_DEFAULT, &H5E_saved.stack_efunc, &H5E_saved_edata); \
+ (void)H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); \
+ } else { \
+ (void)H5Eget_auto(&H5E_saved.efunc, &H5E_saved_edata); \
+ (void)H5Eset_auto(NULL, NULL); \
+ }
#define H5E_END_TRY \
- (void)H5Eset_auto_stack(H5E_DEFAULT, H5E_saved_efunc, H5E_saved_edata); \
+ if(H5E_saved_is_stack) { \
+ (void)H5Eset_auto_stack(H5E_DEFAULT, H5E_saved.stack_efunc, H5E_saved_edata); \
+ } else { \
+ (void)H5Eset_auto(H5E_saved.efunc, H5E_saved_edata); \
+ } \
}
/*
@@ -131,7 +146,8 @@ extern "C" {
/* 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_auto_t)(hid_t estack, void *client_data);
+typedef herr_t (*H5E_auto_t)(void *client_data);
+typedef herr_t (*H5E_auto_stack_t)(hid_t estack, void *client_data);
/* Public API functions */
H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version);
@@ -142,9 +158,10 @@ 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 int 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 int 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_stack(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. */
@@ -166,8 +183,8 @@ H5_DLL herr_t H5Epush_stack(hid_t err_stack, const char *file, const char *func
H5_DLL herr_t H5Eprint_stack(hid_t err_stack, FILE *stream);
H5_DLL herr_t H5Ewalk_stack(hid_t err_stack, H5E_direction_t direction, H5E_walk_t func,
void *client_data);
-H5_DLL herr_t H5Eget_auto_stack(hid_t estack_id, H5E_auto_t *func, void **client_data);
-H5_DLL herr_t H5Eset_auto_stack(hid_t estack_id, H5E_auto_t func, void *client_data);
+H5_DLL herr_t H5Eget_auto_stack(hid_t estack_id, H5E_auto_stack_t *func, void **client_data);
+H5_DLL herr_t H5Eset_auto_stack(hid_t estack_id, H5E_auto_stack_t func, void *client_data);
H5_DLL herr_t H5Eclear_stack(hid_t err_stack);
#ifdef __cplusplus
}