summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-21 21:08:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-21 21:08:27 (GMT)
commitcdd4606430edbb9b322c1abd55b2a4cdff936088 (patch)
treea1bfe5c7d3027df3b9179958d426ef36143625b9 /src
parent6262a14f2e6f669f72e0212b4ce3654c9526f1dc (diff)
downloadhdf5-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')
-rw-r--r--src/H5E.c92
-rw-r--r--src/H5Edeprec.c76
-rw-r--r--src/H5Eint.c238
-rw-r--r--src/H5Epkg.h60
-rw-r--r--src/H5Eprivate.h35
-rw-r--r--src/H5Epublic.h107
-rw-r--r--src/H5vers.txt21
-rw-r--r--src/H5version.h111
8 files changed, 460 insertions, 280 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 31922a0..b97f72f 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -22,7 +22,7 @@
* return some indication that an error occurred and the
* application can print the error stack.
*
- * Certain API functions in the H5E package (such as H5Eprint())
+ * Certain API functions in the H5E package (such as H5Eprint2())
* do not clear the error stack. Otherwise, any function which
* doesn't have an underscore immediately after the package name
* will clear the error stack. For instance, H5Fopen() clears
@@ -151,6 +151,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_init() */
+
/*--------------------------------------------------------------------------
* Function: H5E_init_interface
*
@@ -190,13 +191,13 @@ H5E_init_interface(void)
#ifndef H5_HAVE_THREADSAFE
H5E_stack_g[0].nused = 0;
-#ifdef H5_WANT_H5_V1_6_COMPAT
- H5E_stack_g[0].new_api = FALSE;
- H5E_stack_g[0].u.func = (H5E_auto_t)H5Eprint;
-#else /*H5_WANT_H5_V1_6_COMPAT*/
- H5E_stack_g[0].new_api = TRUE;
- H5E_stack_g[0].u.func2 = (H5E_auto2_t)H5Eprint2;
-#endif /*H5_WANT_H5_V1_6_COMPAT*/
+#ifdef H5_USE_16_API
+ H5E_stack_g[0].auto_op.vers = 1;
+ H5E_stack_g[0].auto_op.u.func1 = (H5E_auto1_t)H5Eprint1;
+#else /* H5_USE_16_API */
+ H5E_stack_g[0].auto_op.vers = 2;
+ H5E_stack_g[0].auto_op.u.func2 = (H5E_auto2_t)H5Eprint2;
+#endif /* H5_USE_16_API */
H5E_stack_g[0].auto_data = NULL;
#endif /* H5_HAVE_THREADSAFE */
@@ -320,8 +321,8 @@ H5E_get_stack(void)
/* Set the thread-specific info */
estack->nused = 0;
- estack->new_api = TRUE;
- estack->u.func2 = (H5E_auto2_t)H5Eprint2;
+ estack->auto_op.vers = 2;
+ estack->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2;
estack->auto_data = NULL;
/* (It's not necessary to release this in this API, it is
@@ -633,6 +634,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eclose_msg() */
+
/*-------------------------------------------------------------------------
* Function: H5E_close_msg
*
@@ -662,6 +664,7 @@ H5E_close_msg(H5E_msg_t *err)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E_close_msg() */
+
/*-------------------------------------------------------------------------
* Function: H5Ecreate_msg
*
@@ -1373,7 +1376,7 @@ H5Eprint2(hid_t err_stack, FILE *stream)
} /* end else */
/* Print error stack */
- if(H5E_print2(estack, stream, FALSE) < 0)
+ if(H5E_print(estack, stream, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
@@ -1397,8 +1400,9 @@ done:
herr_t
H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, void *client_data)
{
- H5E_t *estack; /* Error stack to operate on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t *estack; /* Error stack to operate on */
+ H5E_walk_op_t op; /* Operator for walking error stack */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(H5Ewalk2, FAIL)
@@ -1418,7 +1422,9 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi
} /* end else */
/* Walk the error stack */
- if(H5E_walk2(estack, direction, NULL, stack_func, FALSE, client_data) < 0)
+ op.vers = 2;
+ op.u.func2 = stack_func;
+ if(H5E_walk(estack, direction, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
done:
@@ -1445,7 +1451,7 @@ herr_t
H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
{
H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t f; /* Error stack function */
+ H5E_auto_op_t op; /* Error stack function */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Eget_auto2, FAIL)
@@ -1460,10 +1466,10 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Get the automatic error reporting information */
- if(H5E_get_auto2(estack, TRUE, &f, client_data) < 0)
+ if(H5E_get_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
if(func)
- *func = f.efunc2;
+ *func = op.u.func2;
done:
FUNC_LEAVE_API(ret_value)
@@ -1479,7 +1485,7 @@ done:
* call FUNC passing it CLIENT_DATA as an argument.
*
* The default values before this function is called are
- * H5Eprint() with client data being the standard error stream,
+ * H5Eprint2() with client data being the standard error stream,
* stderr.
*
* Automatic stack traversal is always in the H5E_WALK_DOWNWARD
@@ -1496,7 +1502,7 @@ herr_t
H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
{
H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t f; /* Error stack function */
+ H5E_auto_op_t op; /* Error stack operator */
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
@@ -1512,8 +1518,9 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Set the automatic error reporting information */
- f.efunc2 = func;
- if(H5E_set_auto2(estack, TRUE, &f, client_data) < 0)
+ op.vers = 2;
+ op.u.func2 = func;
+ if(H5E_set_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")
done:
@@ -1522,47 +1529,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5E_dump_api_stack
- *
- * Purpose: Private function to dump the error stack during an error in
- * an API function if a callback function is defined for the
- * current error stack.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, August 6, 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5E_dump_api_stack(int is_api)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5E_dump_api_stack, FAIL)
-
- /* Only dump the error stack during an API call */
- if(is_api) {
- H5E_t *estack = H5E_get_my_stack();
-
- assert(estack);
- if(estack->new_api) {
- if(estack->u.func2)
- (void)((estack->u.func2)(H5E_DEFAULT, estack->auto_data));
- } /* end if */
- else {
- if(estack->u.func)
- (void)((estack->u.func)(estack->auto_data));
- } /* end else */
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_dump_api_stack() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Eauto_is_v2
*
* Purpose: Determines if the error auto reporting function for an
@@ -1596,7 +1562,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
/* Check if the error stack reporting function is the "newer" stack type */
if(is_stack)
- *is_stack = estack->new_api;
+ *is_stack = estack->auto_op.vers > 1;
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 13a2f3d..c1a5a21 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -82,6 +82,7 @@
/*******************/
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/*--------------------------------------------------------------------------
NAME
@@ -117,7 +118,7 @@ H5E_init_deprec_interface(void)
*
*-------------------------------------------------------------------------
*/
-const char *
+char *
H5Eget_major(H5E_major_t maj)
{
H5E_msg_t *msg; /* Pointer to error message */
@@ -165,7 +166,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-const char *
+char *
H5Eget_minor(H5E_minor_t min)
{
H5E_msg_t *msg; /* Pointer to error message */
@@ -201,7 +202,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Epush
+ * Function: H5Epush1
*
* Purpose: This function definition is for backward compatibility only.
* It doesn't have error stack and error class as parameters.
@@ -221,13 +222,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Epush(const char *file, const char *func, unsigned line,
+H5Epush1(const char *file, const char *func, unsigned line,
H5E_major_t maj, H5E_minor_t min, const char *str)
{
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Epush, FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5Epush1, FAIL)
H5TRACE6("e", "*s*sIuii*s", file, func, line, maj, min, str);
/* Push the error on the default error stack */
@@ -236,11 +237,11 @@ H5Epush(const char *file, const char *func, unsigned line,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Epush() */
+} /* end H5Epush1() */
/*-------------------------------------------------------------------------
- * Function: H5Eclear
+ * Function: H5Eclear1
*
* Purpose: This function is for backward compatbility.
* Clears the error stack for the specified error stack.
@@ -253,12 +254,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eclear(void)
+H5Eclear1(void)
{
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Eclear, FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5Eclear1, FAIL)
H5TRACE0("e","");
/* Clear the default error stack */
@@ -267,11 +268,11 @@ H5Eclear(void)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Eclear() */
+} /* end H5Eclear1() */
/*-------------------------------------------------------------------------
- * Function: H5Eprint
+ * Function: H5Eprint1
*
* Purpose: This function is for backward compatbility.
* Prints the error stack in some default way. This is just a
@@ -287,29 +288,29 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eprint(FILE *stream)
+H5Eprint1(FILE *stream)
{
H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5Eprint1, FAIL)
/*NO TRACE*/
if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Print error stack */
- if(H5E_print2(estack, stream, TRUE) < 0)
+ if(H5E_print(estack, stream, TRUE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Eprint() */
+} /* end H5Eprint1() */
/*-------------------------------------------------------------------------
- * Function: H5Ewalk
+ * Function: H5Ewalk1
*
* Purpose: This function is for backward compatbility.
* Walks the error stack for the current thread and calls some
@@ -323,29 +324,32 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Ewalk(H5E_direction_t direction, H5E_walk_t func, void *client_data)
+H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data)
{
H5E_t *estack; /* Error stack to operate on */
+ H5E_walk_op_t walk_op; /* Error stack walking callback */
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Ewalk, FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5Ewalk1, FAIL)
/*NO TRACE*/
if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Walk the error stack */
- if(H5E_walk2(estack, direction, func, NULL, TRUE, client_data) < 0)
+ walk_op.vers = 1;
+ walk_op.u.func1 = func;
+ if(H5E_walk(estack, direction, &walk_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Ewalk() */
+} /* end H5Ewalk1() */
/*-------------------------------------------------------------------------
- * Function: H5Eget_auto
+ * Function: H5Eget_auto1
*
* Purpose: This function is for backward compatbility.
* Returns the current settings for the automatic error stack
@@ -361,13 +365,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eget_auto(H5E_auto_t *func, void **client_data)
+H5Eget_auto1(H5E_auto1_t *func, void **client_data)
{
H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t f; /* Error stack function */
+ H5E_auto_op_t auto_op; /* Error stack operator */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Eget_auto, FAIL)
+ FUNC_ENTER_API(H5Eget_auto1, FAIL)
H5TRACE2("e", "*x**x", func, client_data);
/* Retrieve default error stack */
@@ -375,18 +379,18 @@ H5Eget_auto(H5E_auto_t *func, void **client_data)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Get the automatic error reporting information */
- if(H5E_get_auto2(estack, FALSE, &f, client_data) < 0)
+ if(H5E_get_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
if(func)
- *func = f.efunc;
+ *func = auto_op.u.func1;
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Eget_auto() */
+} /* end H5Eget_auto1() */
/*-------------------------------------------------------------------------
- * Function: H5Eset_auto
+ * Function: H5Eset_auto1
*
* Purpose: This function is for backward compatbility.
* Turns on or off automatic printing of errors for certain
@@ -395,7 +399,7 @@ done:
* call FUNC passing it CLIENT_DATA as an argument.
*
* The default values before this function is called are
- * H5Eprint() with client data being the standard error stream,
+ * H5Eprint1() with client data being the standard error stream,
* stderr.
*
* Automatic stack traversal is always in the H5E_WALK_DOWNWARD
@@ -409,25 +413,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Eset_auto(H5E_auto_t func, void *client_data)
+H5Eset_auto1(H5E_auto1_t func, void *client_data)
{
H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t f; /* Error stack function */
+ H5E_auto_op_t auto_op; /* Error stack operator */
herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
- FUNC_ENTER_API_NOCLEAR(H5Eset_auto, FAIL)
+ FUNC_ENTER_API_NOCLEAR(H5Eset_auto1, FAIL)
H5TRACE2("e", "x*x", func, client_data);
if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Set the automatic error reporting information */
- f.efunc = func;
- if(H5E_set_auto2(estack, FALSE, &f, client_data) < 0)
+ auto_op.vers = 1;
+ auto_op.u.func1 = func;
+ if(H5E_set_auto(estack, &auto_op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Eset_auto() */
+} /* end H5Eset_auto1() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 168cc4d..95075d7 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -52,6 +52,12 @@
/* Local Typedefs */
/******************/
+/* Printing information */
+typedef struct H5E_print_t {
+ FILE *stream;
+ H5E_cls_t cls;
+} H5E_print_t;
+
/********************/
/* Package Typedefs */
@@ -61,8 +67,10 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5E_walk_cb(unsigned n, const H5E_error_t *err_desc,
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+static herr_t H5E_walk1_cb(unsigned n, const H5E_error1_t *err_desc,
void *client_data);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc,
void *client_data);
static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries);
@@ -105,7 +113,7 @@ hid_t H5E_ERR_CLS_g = FAIL;
*/
char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
int H5E_mpi_error_str_len;
-#endif
+#endif /* H5_HAVE_PARALLEL */
@@ -171,9 +179,10 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
FUNC_LEAVE_NOAPI(len)
} /* end H5E_get_msg() */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5E_walk_cb
+ * Function: H5E_walk1_cb
*
* Purpose: This function is for backward compatibility.
* This is a default error stack traversal callback function
@@ -206,7 +215,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
*-------------------------------------------------------------------------
*/
static herr_t
-H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data)
+H5E_walk1_cb(unsigned n, const H5E_error1_t *err_desc, void *client_data)
{
H5E_print_t *eprint = (H5E_print_t *)client_data;
FILE *stream; /* I/O stream to print output to */
@@ -217,7 +226,7 @@ H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data)
const char *min_str = "No minor description"; /* Minor error description */
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk_cb)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb)
/* Check arguments */
HDassert(err_desc);
@@ -290,7 +299,8 @@ H5E_walk_cb(unsigned n, const H5E_error_t *err_desc, void *client_data)
fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_walk_cb() */
+} /* end H5E_walk1_cb() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
@@ -413,7 +423,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
/*-------------------------------------------------------------------------
- * Function: H5E_print2
+ * Function: H5E_print
*
* Purpose: Private function to print the error stack in some default
* way. This is just a convenience function for H5Ewalk() and
@@ -429,13 +439,14 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
+H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
{
- H5E_print_t eprint; /* Callback information to pass to H5E_walk2() */
+ H5E_print_t eprint; /* Callback information to pass to H5E_walk() */
+ H5E_walk_op_t walk_op; /* Error stack walking callback */
herr_t ret_value = SUCCEED;
/* Don't clear the error stack! :-) */
- FUNC_ENTER_NOAPI_NOINIT(H5E_print2)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_print)
/* Sanity check */
HDassert(estack);
@@ -451,21 +462,29 @@ H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compatible)
/* Walk the error stack */
if(bk_compatible) {
- if(H5E_walk2(estack, H5E_WALK_DOWNWARD, H5E_walk_cb, NULL, TRUE, (void*)&eprint) < 0)
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ walk_op.vers = 1;
+ walk_op.u.func1 = H5E_walk1_cb;
+ if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ HDassert(0 && "version 1 error stack print without deprecated symbols!");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end if */
else {
- if(H5E_walk2(estack, H5E_WALK_DOWNWARD, NULL, H5E_walk2_cb, FALSE, (void*)&eprint) < 0)
+ walk_op.vers = 2;
+ walk_op.u.func2 = H5E_walk2_cb;
+ if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_print2() */
+} /* end H5E_print() */
/*-------------------------------------------------------------------------
- * Function: H5E_walk2
+ * Function: H5E_walk
*
* Purpose: Private function for H5Ewalk.
* Walks the error stack, calling the specified function for
@@ -480,7 +499,7 @@ done:
* each error record in the error stack. It's arguments will
* include an index number (beginning at zero regardless of
* stack traversal direction), an error stack entry, and the
- * CLIENT_DATA pointer passed to H5E_print2.
+ * CLIENT_DATA pointer passed to H5E_print.
*
* The function FUNC is also provided for backward compatibility.
* When BK_COMPATIBLE is set to be TRUE, FUNC is used to be
@@ -495,81 +514,91 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_walk2(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func, H5E_walk2_t stack_func,
- hbool_t bk_compatible, void *client_data)
+H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op,
+ void *client_data)
{
int i; /* Local index variable */
herr_t status; /* Status from callback function */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5E_walk2)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_walk)
/* Sanity check */
HDassert(estack);
+ HDassert(op);
/* check args, but rather than failing use some default value */
if(direction != H5E_WALK_UPWARD && direction != H5E_WALK_DOWNWARD)
direction = H5E_WALK_UPWARD;
/* Walk the stack if a callback function was given */
- if(bk_compatible && func) {
- H5E_error_t old_err;
-
- status = SUCCEED;
- if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++) {
- /* Point to each error record on the stack and pass it to callback function.*/
- old_err.maj_num = estack->slot[i].maj_num;
- old_err.min_num = estack->slot[i].min_num;
- old_err.func_name = estack->slot[i].func_name;
- old_err.file_name = estack->slot[i].file_name;
- old_err.desc = estack->slot[i].desc;
- old_err.line = estack->slot[i].line;
-
- status = (func)((unsigned)i, &old_err, client_data);
- } /* end for */
+ if(op->vers == 1) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ if(op->u.func1) {
+ H5E_error1_t old_err;
+
+ status = SUCCEED;
+ if(H5E_WALK_UPWARD == direction) {
+ for(i = 0; i < (int)estack->nused && status >= 0; i++) {
+ /* Point to each error record on the stack and pass it to callback function.*/
+ old_err.maj_num = estack->slot[i].maj_num;
+ old_err.min_num = estack->slot[i].min_num;
+ old_err.func_name = estack->slot[i].func_name;
+ old_err.file_name = estack->slot[i].file_name;
+ old_err.desc = estack->slot[i].desc;
+ old_err.line = estack->slot[i].line;
+
+ status = (op->u.func1)((unsigned)i, &old_err, client_data);
+ } /* end for */
+ } /* end if */
+ else {
+ H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
+ for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) {
+ /* Point to each error record on the stack and pass it to callback function.*/
+ old_err.maj_num = estack->slot[i].maj_num;
+ old_err.min_num = estack->slot[i].min_num;
+ old_err.func_name = estack->slot[i].func_name;
+ old_err.file_name = estack->slot[i].file_name;
+ old_err.desc = estack->slot[i].desc;
+ old_err.line = estack->slot[i].line;
+
+ status = (op->u.func1)((unsigned)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
+ } /* end for */
+ } /* end else */
+
+ if(status < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
} /* end if */
- else {
- H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) {
- /* Point to each error record on the stack and pass it to callback function.*/
- old_err.maj_num = estack->slot[i].maj_num;
- old_err.min_num = estack->slot[i].min_num;
- old_err.func_name = estack->slot[i].func_name;
- old_err.file_name = estack->slot[i].file_name;
- old_err.desc = estack->slot[i].desc;
- old_err.line = estack->slot[i].line;
-
- status = (func)((unsigned)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
- } /* end for */
- } /* end else */
-
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ HDassert(0 && "version 1 error stack walk without deprecated symbols!");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end if */
- else if(!bk_compatible && stack_func) {
- status = SUCCEED;
- if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++)
- status = (stack_func)((unsigned)i, estack->slot + i, client_data);
+ else {
+ HDassert(op->vers == 2);
+ if(op->u.func2) {
+ status = SUCCEED;
+ if(H5E_WALK_UPWARD == direction) {
+ for(i = 0; i < (int)estack->nused && status >= 0; i++)
+ status = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
+ } /* end if */
+ else {
+ H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
+ for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--)
+ status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
+ } /* end else */
+
+ if(status < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
} /* end if */
- else {
- H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--)
- status = (stack_func)((unsigned)(estack->nused-(size_t)(i + 1)), estack->slot + i, client_data);
- } /* end else */
-
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
- } /* end if */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5E_walk2() */
+} /* end H5E_walk() */
/*-------------------------------------------------------------------------
- * Function: H5E_get_auto2
+ * Function: H5E_get_auto
*
* Purpose: Private function to return the current settings for the
* automatic error stack traversal function and its data
@@ -584,19 +613,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void **client_data)
+H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_auto2)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_auto)
HDassert(estack);
/* Retrieve the requested information */
- if(func) {
- if(new_api)
- func->efunc2 = estack->u.func2;
- else
- func->efunc = estack->u.func;
- } /* end if */
+ if(op)
+ *op = estack->auto_op;
if(client_data)
*client_data = estack->auto_data;
@@ -605,7 +630,7 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void **
/*-------------------------------------------------------------------------
- * Function: H5E_set_auto2
+ * Function: H5E_set_auto
*
* Purpose: Private function to turn on or off automatic printing of
* errors for certain error stack. When turned on (non-null
@@ -614,7 +639,7 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void **
* as an argument.
*
* The default values before this function is called are
- * H5Eprint() with client data being the standard error stream,
+ * H5Eprint2() with client data being the standard error stream,
* stderr.
*
* Automatic stack traversal is always in the H5E_WALK_DOWNWARD
@@ -628,22 +653,18 @@ H5E_get_auto2(const H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void **
*-------------------------------------------------------------------------
*/
herr_t
-H5E_set_auto2(H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void *client_data)
+H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_auto2)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_auto)
HDassert(estack);
/* Set the automatic error reporting info */
- estack->new_api = new_api;
- if(new_api)
- estack->u.func2 = func->efunc2;
- else
- estack->u.func = func->efunc;
+ estack->auto_op = *op;
estack->auto_data = client_data;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5E_set_auto2() */
+} /* end H5E_set_auto() */
/*-------------------------------------------------------------------------
@@ -668,7 +689,7 @@ H5E_set_auto2(H5E_t *estack, hbool_t new_api, H5E_auto_op_t *func, void *client_
*/
herr_t
H5E_push_stack(H5E_t *estack, const char *file, const char *func, unsigned line,
- hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc)
+ hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -857,3 +878,48 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_pop() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5E_dump_api_stack
+ *
+ * Purpose: Private function to dump the error stack during an error in
+ * an API function if a callback function is defined for the
+ * current error stack.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 6, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5E_dump_api_stack(int is_api)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5E_dump_api_stack, FAIL)
+
+ /* Only dump the error stack during an API call */
+ if(is_api) {
+ H5E_t *estack = H5E_get_my_stack();
+
+ HDassert(estack);
+ if(estack->auto_op.vers == 1) {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ if(estack->auto_op.u.func1)
+ (void)((estack->auto_op.u.func1)(estack->auto_data));
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ HDassert(0 && "version 1 error stack dump without deprecated symbols!");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ } /* end if */
+ else {
+ if(estack->auto_op.u.func2)
+ (void)((estack->auto_op.u.func2)(H5E_DEFAULT, estack->auto_data));
+ } /* end else */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5E_dump_api_stack() */
+
diff --git a/src/H5Epkg.h b/src/H5Epkg.h
index 5e36b38..a85ddc9 100644
--- a/src/H5Epkg.h
+++ b/src/H5Epkg.h
@@ -41,6 +41,9 @@
/* Amount to indent each error */
#define H5E_INDENT 2
+/* Number of slots in an error stack */
+#define H5E_NSLOTS 32
+
#ifdef H5_HAVE_THREADSAFE
/*
* The per-thread error stack. pthread_once() initializes a special
@@ -65,11 +68,49 @@
/****************************/
/* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */
-typedef union {
- H5E_auto_t efunc; /* Old-style callback, NO error stack param. */
- H5E_auto2_t efunc2; /* New-style callback, with error stack param. */
+typedef struct {
+ unsigned vers; /* Which version callback to use */
+ union {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5E_auto1_t func1; /* Old-style callback, NO error stack param. */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5E_auto2_t func2; /* New-style callback, with error stack param. */
+ }u;
} H5E_auto_op_t;
+/* Some syntactic sugar to make the compiler happy with two different kinds of callbacks */
+typedef struct {
+ unsigned vers; /* Which version callback to use */
+ union {
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5E_walk1_t func1; /* Old-style callback, NO error stack param. */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5E_walk2_t func2; /* New-style callback, with error stack param. */
+ }u;
+} H5E_walk_op_t;
+
+/* Error class */
+typedef struct H5E_cls_t {
+ char *cls_name; /* Name of error class */
+ char *lib_name; /* Name of library within class */
+ char *lib_vers; /* Version of library */
+} H5E_cls_t;
+
+/* Major or minor message */
+typedef struct H5E_msg_t {
+ char *msg; /* Message for error */
+ H5E_type_t type; /* Type of error (major or minor) */
+ H5E_cls_t *cls; /* Which error class this message belongs to */
+} H5E_msg_t;
+
+/* Error stack */
+struct H5E_t {
+ size_t nused; /* Num slots currently used in stack */
+ H5E_error2_t slot[H5E_NSLOTS]; /* Array of error records */
+ H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */
+ void *auto_data; /* Callback data for 'automatic error reporting */
+};
+
/*****************************/
/* Package Private Variables */
@@ -91,14 +132,13 @@ H5_DLL H5E_t *H5E_get_stack(void);
#endif /* H5_HAVE_THREADSAFE */
H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type,
char *msg, size_t size);
-H5_DLL herr_t H5E_print2(const H5E_t *estack, FILE *stream, hbool_t bk_compat);
-H5_DLL herr_t H5E_walk2(const H5E_t *estack, H5E_direction_t direction,
- H5E_walk_t func, H5E_walk2_t stack_func, hbool_t bk_compatible,
+H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat);
+H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction,
+ const H5E_walk_op_t *op, void *client_data);
+H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op,
+ void **client_data);
+H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op,
void *client_data);
-H5_DLL herr_t H5E_get_auto2(const H5E_t *estack, hbool_t new_api,
- H5E_auto_op_t *func, void **client_data);
-H5_DLL herr_t H5E_set_auto2(H5E_t *estack, hbool_t new_api,
- H5E_auto_op_t *func, void *client_data);
H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count);
#endif /* _H5HFpkg_H */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 9d444bc..05ce10e 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -24,39 +24,8 @@
/* Private headers needed by this file */
#include "H5private.h"
-#define H5E_NSLOTS 32 /*number of slots in an error stack */
-
-/* Error class */
-typedef struct H5E_cls_t {
- char *cls_name; /* Name of error class */
- char *lib_name; /* Name of library within class */
- char *lib_vers; /* Version of library */
-} H5E_cls_t;
-
-/* Major or minor message */
-typedef struct H5E_msg_t {
- char *msg; /* Message for error */
- H5E_type_t type; /* Type of error (major or minor) */
- H5E_cls_t *cls; /* Which error class this message belongs to */
-} H5E_msg_t;
-
-/* Error stack */
-typedef struct H5E_t {
- size_t nused; /* Num slots currently used in stack */
- H5E_error2_t slot[H5E_NSLOTS]; /* Array of error records */
- hbool_t new_api; /* Indicate that the function pointer is for the new (stack) API or the old */
- union {
- H5E_auto_t func; /* Function for 'automatic' error reporting */
- H5E_auto2_t func2; /* Function for 'automatic' error reporting with error stacks */
- } u;
- void *auto_data; /* Callback data for 'automatic error reporting */
-} H5E_t;
-
-/* Printing information */
-typedef struct H5E_print_t {
- FILE *stream;
- H5E_cls_t cls;
-} H5E_print_t;
+/* Typedef for error stack (defined in H5Epkg.h) */
+typedef struct H5E_t H5E_t;
/*
* HERROR macro, used to facilitate error reporting between a FUNC_ENTER()
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
}
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 0fd4c4c..e01ea81 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -22,7 +22,9 @@
# Blank lines and lines beginning with '#' are ignored
#
# The format of this file is as follows:
-# <type>, <base routine name>, <version introduced>, <list of revised versions>
+# <type>: <base routine name>; <list of parameter types for function>; <version introduced>, <list of revised versions>
+#
+# Where <type> is either 'FUNCTION' or 'TYPEDEF'
#
# For example, the following sample input shows two functions with different
# API versions for each. The example below shows H5Gfoo being added to the
@@ -34,8 +36,8 @@
# revised in the v1.6 branch (so there should be two versioned names for the
# routine: H5Gbar1 and H5Gbar2).
#
-# FUNCTION, H5Gfoo, v10, v14, v18
-# FUNCTION, H5Gbar, v12, v16
+# FUNCTION: H5Gfoo; ; v10, v14, v18
+# FUNCTION: H5Gbar; ; v12, v16
#
# Programmer: Quincey Koziol
# Creation Date: 2007/07/10
@@ -43,6 +45,15 @@
# API function names
# (although not required, it's easier to compare this file with the headers
# generated if the list below is in alphanumeric sort order - QAK)
-#FUNCTION, H5Gcreate, v10, v14, v18
-#FUNCTION, H5Gopen, v12, v18
+FUNCTION: H5Eclear; ; v10, v18
+FUNCTION: H5Eget_auto; ; v10, v18
+FUNCTION: H5Eprint; ; v10, v18
+FUNCTION: H5Epush; ; v14, v18
+FUNCTION: H5Eset_auto; ; v10, v18
+FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
+
+# API typedefs
+# (although not required, it's easier to compare this file with the headers
+# generated if the list below is in alphanumeric sort order - QAK)
+TYPEDEF: H5E_auto; v10, v18
diff --git a/src/H5version.h b/src/H5version.h
index 6b27ce3..43e82dc 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -25,20 +25,119 @@
#error "Can't choose old API versions when deprecated APIs are disabled"
#endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */
+
/* If a particular "global" version of the library's interfaces is chosen,
- * set the versions for the API routines affected.
+ * set the versions for the API symbols affected.
*
* Note: If an application has already chosen a particular version for an
- * API routine, the individual API version macro takes priority.
+ * API symbol, the individual API version macro takes priority.
*/
#ifdef H5_USE_16_API
+
+/*************/
+/* Functions */
+/*************/
+#if !defined(H5Eclear_vers)
+#define H5Eclear_vers 1
+#endif /* !defined(H5Eclear_vers) */
+#if !defined(H5Eget_auto_vers)
+#define H5Eget_auto_vers 1
+#endif /* !defined(H5Eget_auto_vers) */
+#if !defined(H5Eprint_vers)
+#define H5Eprint_vers 1
+#endif /* !defined(H5Eprint_vers) */
+#if !defined(H5Epush_vers)
+#define H5Epush_vers 1
+#endif /* !defined(H5Epush_vers) */
+#if !defined(H5Eset_auto_vers)
+#define H5Eset_auto_vers 1
+#endif /* !defined(H5Eset_auto_vers) */
+#if !defined(H5Ewalk_vers)
+#define H5Ewalk_vers 1
+#endif /* !defined(H5Ewalk_vers) */
+
+/************/
+/* Typedefs */
+/************/
+#if !defined(H5E_auto_vers)
+#define H5E_auto_vers 1
+#endif /* !defined(H5E_auto_vers) */
+
#endif /* H5_USE_16_API */
-/* Choose the correct version of each API routine, defaulting to the latest
- * version of each API routine. The "best" name for API parameters/data
- * structures that have changed definitions is also set. An error is
- * issued for specifying an invalid API version.
+
+/* Choose the correct version of each API symbol, defaulting to the latest
+ * version of each. The "best" name for API parameters/data structures
+ * that have changed definitions is also set. An error is issued for
+ * specifying an invalid API version.
*/
+/*************/
+/* Functions */
+/*************/
+
+#if !defined(H5Eclear_vers) || H5Eclear_vers == 2
+#define H5Eclear H5Eclear2
+#elif H5Eclear_vers == 1
+#define H5Eclear H5Eclear1
+#else /* H5Eclear_vers */
+#error "H5Eclear_vers set to invalid value"
+#endif /* H5Eclear_vers */
+
+#if !defined(H5Eget_auto_vers) || H5Eget_auto_vers == 2
+#define H5Eget_auto H5Eget_auto2
+#elif H5Eget_auto_vers == 1
+#define H5Eget_auto H5Eget_auto1
+#else /* H5Eget_auto_vers */
+#error "H5Eget_auto_vers set to invalid value"
+#endif /* H5Eget_auto_vers */
+
+#if !defined(H5Eprint_vers) || H5Eprint_vers == 2
+#define H5Eprint H5Eprint2
+#elif H5Eprint_vers == 1
+#define H5Eprint H5Eprint1
+#else /* H5Eprint_vers */
+#error "H5Eprint_vers set to invalid value"
+#endif /* H5Eprint_vers */
+
+#if !defined(H5Epush_vers) || H5Epush_vers == 2
+#define H5Epush H5Epush2
+#elif H5Epush_vers == 1
+#define H5Epush H5Epush1
+#else /* H5Epush_vers */
+#error "H5Epush_vers set to invalid value"
+#endif /* H5Epush_vers */
+
+#if !defined(H5Eset_auto_vers) || H5Eset_auto_vers == 2
+#define H5Eset_auto H5Eset_auto2
+#elif H5Eset_auto_vers == 1
+#define H5Eset_auto H5Eset_auto1
+#else /* H5Eset_auto_vers */
+#error "H5Eset_auto_vers set to invalid value"
+#endif /* H5Eset_auto_vers */
+
+#if !defined(H5Ewalk_vers) || H5Ewalk_vers == 2
+#define H5Ewalk H5Ewalk2
+#define H5E_error_t H5E_error2_t
+#define H5E_walk_t H5E_walk2_t
+#elif H5Ewalk_vers == 1
+#define H5Ewalk H5Ewalk1
+#define H5E_error_t H5E_error1_t
+#define H5E_walk_t H5E_walk1_t
+#else /* H5Ewalk_vers */
+#error "H5Ewalk_vers set to invalid value"
+#endif /* H5Ewalk_vers */
+
+/************/
+/* Typedefs */
+/************/
+#if !defined(H5E_auto_vers) || H5E_auto_vers == 2
+#define H5E_auto_t H5E_auto2_t
+#elif H5E_auto_vers == 1
+#define H5E_auto_t H5E_auto1_t
+#else /* H5E_auto_vers */
+#error "H5E_auto_vers set to invalid value"
+#endif /* H5E_auto_vers */
+
#endif /* H5version_H */