diff options
Diffstat (limited to 'src/H5E.c')
-rw-r--r-- | src/H5E.c | 52 |
1 files changed, 46 insertions, 6 deletions
@@ -170,13 +170,20 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) -#ifdef H5_USE_16_API +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; - stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; #else /* H5_USE_16_API */ stk->auto_op.vers = 2; - stk->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_USE_16_API */ +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.is_default = TRUE; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1555,6 +1562,11 @@ done: * Programmer: Robb Matzke * Saturday, February 28, 1998 * + * Modification:Raymond Lu + * 4 October 2010 + * If the printing function isn't the default H5Eprint1 or 2, + * and H5Eset_auto1 has been called to set the old style + * printing function, a call to H5Eget_auto2 should fail. *------------------------------------------------------------------------- */ herr_t @@ -1578,8 +1590,15 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) /* Get the automatic error reporting information */ if(H5E_get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto1 */ + if(!op.is_default && op.vers == 1) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called") +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + if(func) - *func = op.u.func2; + *func = op.func2; done: FUNC_LEAVE_API(ret_value) @@ -1606,6 +1625,9 @@ done: * Programmer: Robb Matzke * Friday, February 27, 1998 * + * Modification:Raymond Lu + * 4 October 2010 + * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -1627,9 +1649,23 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* Get the automatic error reporting information */ + if(H5E_get_auto(estack, &op, NULL) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + /* Set the automatic error reporting information */ + if(func != op.func2_default) + op.is_default = FALSE; + else + op.is_default = TRUE; + op.vers = 2; - op.u.func2 = func; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + /* Set the automatic error reporting function */ + op.func2 = func; + if(H5E_set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") @@ -1672,7 +1708,11 @@ 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) +#ifndef H5_NO_DEPRECATED_SYMBOLS *is_stack = estack->auto_op.vers > 1; +#else + *is_stack = 1; +#endif done: FUNC_LEAVE_API(ret_value) |