summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2003-07-23 03:13:27 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2003-07-23 03:13:27 (GMT)
commit4b0fa0dbf06a93c7cb7c62a374019543ffa70fe6 (patch)
tree308f7e073432340fa18ab5faa4a8e234170284e7
parent49e9863714840caa2e60d8caa12c6144b5b182f9 (diff)
downloadhdf5-4b0fa0dbf06a93c7cb7c62a374019543ffa70fe6.zip
hdf5-4b0fa0dbf06a93c7cb7c62a374019543ffa70fe6.tar.gz
hdf5-4b0fa0dbf06a93c7cb7c62a374019543ffa70fe6.tar.bz2
[svn-r7256] Purpose: gradual checkin for error api
Platforms tested: RH 8(simple checkin)
-rw-r--r--src/H5E.c271
-rw-r--r--src/H5Eprivate.h277
-rw-r--r--src/H5Epublic.h227
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5TS.c8
-rw-r--r--src/H5TSprivate.h3
-rw-r--r--src/H5private.h1
7 files changed, 512 insertions, 276 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 222f0e9..6a5689e 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -209,7 +209,7 @@ hid_t H5E_ERR_CLS_g = FAIL;
#endif /* NEW_ERR */
-#ifndef NEW_ERR
+#ifdef NEW_ERR
#ifdef H5_HAVE_THREADSAFE
/*
* The per-thread error stack. pthread_once() initializes a special
@@ -352,8 +352,141 @@ H5E_init_interface(void)
H5I_init_group(H5I_ERROR_STACK, H5I_ERRSTK_HASHSIZE, H5E_RESERVED_ATOMS,
(H5I_free_t)H5E_close_stack);
+#ifndef H5_HAVE_THREADSAFE
H5E_stack_g_new[0].func = &(H5Eprint_new);
H5E_stack_g_new[0].auto_data = stderr;
+#endif /* H5_HAVE_THREADSAFE */
+
+ H5E_ERR_CLS_g = H5E_register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, H5E_CLS_LIB_VERS);
+
+ H5E_NONE_MAJOR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_NONE_MAJOR_MSG_new);
+ H5E_ARGS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_ARGS_MSG_new);
+ H5E_RESOURCE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_RESOURCE_MSG_new);
+ H5E_INTERNAL_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_INTERNAL_MSG_new);
+ H5E_FILE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_FILE_MSG_new);
+
+ H5E_IO_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_IO_MSG_new);
+ H5E_FUNC_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_FUNC_MSG_new);
+ H5E_ATOM_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_ATOM_MSG_new);
+ H5E_CACHE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_CACHE_MSG_new);
+ H5E_BTREE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_BTREE_MSG_new);
+
+ H5E_SYM_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_SYM_MSG_new);
+ H5E_HEAP_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_HEAP_MSG_new);
+ H5E_OHDR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_HEAP_MSG_new);
+ H5E_DATATYPE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_DATATYPE_MSG_new);
+ H5E_DATASPACE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_DATASPACE_MSG_new);
+
+ H5E_DATASET_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_DATASET_MSG_new);
+ H5E_STORAGE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_STORAGE_MSG_new);
+ H5E_PLIST_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_PLIST_MSG_new);
+ H5E_ATTR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_ATTR_MSG_new);
+ H5E_PLINE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_PLINE_MSG_new);
+
+ H5E_EFL_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_EFL_MSG_new);
+ H5E_REFERENCE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_REFERENCE_MSG_new);
+ H5E_VFL_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_VFL_MSG_new);
+ H5E_TBBT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_TBBT_MSG_new);
+ H5E_FPHDF5_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_FPHDF5_MSG_new);
+
+ H5E_TST_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_TST_MSG_new);
+ H5E_RS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_RS_MSG_new);
+ H5E_ERROR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MAJ_ERROR_MSG_new);
+
+ /* Minor errors */
+ H5E_NONE_MINOR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MINOR_new, H5E_NONE_MINOR_MSG_new);
+ H5E_UNINITIALIZED_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_UNINITIALIZED_MSG_new);
+ H5E_UNSUPPORTED_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_UNSUPPORTED_MSG_new);
+ H5E_BADTYPE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADTYPE_MSG_new);
+ H5E_BADRANGE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADRANGE_MSG_new);
+ H5E_BADVALUE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADVALUE_MSG_new);
+
+ H5E_NOSPACE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOSPACE_MSG_new);
+ H5E_CANTCOPY_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCOPY_MSG_new);
+ H5E_CANTFREE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTFREE_MSG_new);
+ H5E_ALREADYEXISTS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_ALREADYEXISTS_MSG_new);
+ H5E_CANTLOCK_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTLOCK_MSG_new);
+ H5E_CANTUNLOCK_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTUNLOCK_MSG_new);
+ H5E_CANTGC_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTGC_MSG_new);
+
+ H5E_FILEEXISTS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_FILEEXISTS_MSG_new);
+ H5E_FILEOPEN_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_FILEOPEN_MSG_new);
+ H5E_CANTCREATE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCREATE_MSG_new);
+ H5E_CANTOPENFILE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTOPENFILE_MSG_new);
+ H5E_CANTCLOSEFILE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCLOSEFILE_MSG_new);
+ H5E_NOTHDF5_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOTHDF5_MSG_new);
+ H5E_BADFILE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADFILE_MSG_new);
+ H5E_TRUNCATED_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_TRUNCATED_MSG_new);
+ H5E_MOUNT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_MOUNT_MSG_new);
+
+ H5E_SEEKERROR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_SEEKERROR_MSG_new);
+ H5E_READERROR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_READERROR_MSG_new);
+ H5E_WRITEERROR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_WRITEERROR_MSG_new);
+ H5E_CLOSEERROR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CLOSEERROR_MSG_new);
+
+ H5E_CANTINIT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTINIT_MSG_new);
+ H5E_ALREADYINIT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_ALREADYINIT_MSG_new);
+ H5E_CANTRELEASE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTRELEASE_MSG_new);
+
+ H5E_BADATOM_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADATOM_MSG_new);
+ H5E_BADGROUP_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADGROUP_MSG_new);
+ H5E_CANTREGISTER_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTREGISTER_MSG_new);
+ H5E_CANTINC_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTINC_MSG_new);
+ H5E_CANTDEC_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTDEC_MSG_new);
+ H5E_NOIDS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOIDS_MSG_new);
+
+ H5E_CANTFLUSH_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTFLUSH_MSG_new);
+ H5E_CANTLOAD_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTLOAD_MSG_new);
+ H5E_PROTECT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_PROTECT_MSG_new);
+ H5E_NOTCACHED_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOTCACHED_MSG_new);
+
+ H5E_NOTFOUND_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOTFOUND_MSG_new);
+ H5E_EXISTS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_EXISTS_MSG_new);
+ H5E_CANTENCODE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTENCODE_MSG_new);
+ H5E_CANTDECODE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTDECODE_MSG_new);
+ H5E_CANTSPLIT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTSPLIT_MSG_new);
+ H5E_CANTINSERT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTINSERT_MSG_new);
+ H5E_CANTLIST_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTLIST_MSG_new);
+
+ H5E_LINKCOUNT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_LINKCOUNT_MSG_new);
+ H5E_VERSION_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_VERSION_MSG_new);
+ H5E_ALIGNMENT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_ALIGNMENT_MSG_new);
+ H5E_BADMESG_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADMESG_MSG_new);
+ H5E_CANTDELETE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTDELETE_MSG_new);
+
+ H5E_CANTOPENOBJ_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTOPENOBJ_MSG_new);
+ H5E_COMPLEN_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_COMPLEN_MSG_new);
+ H5E_CWG_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CWG_MSG_new);
+ H5E_LINK_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_LINK_MSG_new);
+ H5E_SLINK_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_SLINK_MSG_new);
+
+ H5E_CANTCONVERT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCONVERT_MSG_new);
+ H5E_BADSIZE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADSIZE_MSG_new);
+
+ H5E_CANTCLIP_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCLIP_MSG_new);
+ H5E_CANTCOUNT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCOUNT_MSG_new);
+ H5E_CANTSELECT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTSELECT_MSG_new);
+ H5E_CANTNEXT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTNEXT_MSG_new);
+ H5E_BADSELECT_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_BADSELECT_MSG_new);
+ H5E_CANTCOMPARE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCOMPARE_MSG_new);
+
+ H5E_CANTGET_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTGET_MSG_new);
+ H5E_CANTSET_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTSET_MSG_new);
+ H5E_DUPCLASS_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_DUPCLASS_MSG_new);
+
+ H5E_MPI_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_MPI_MSG_new);
+ H5E_MPIERRSTR_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_MPIERRSTR_MSG_new);
+
+ H5E_CANTMAKETREE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTMAKETREE_MSG_new);
+ H5E_CANTRECV_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTRECV_MSG_new);
+ H5E_CANTSENDMDATA_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTSENDMDATA_MSG_new);
+ H5E_CANTCHANGE_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTCHANGE_MSG_new);
+ H5E_CANTALLOC_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANTALLOC_MSG_new);
+
+ H5E_NOFILTER_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_NOFILTER_MSG_new);
+ H5E_CALLBACK_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CALLBACK_MSG_new);
+ H5E_CANAPPLY_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_CANAPPLY_MSG_new);
+ H5E_SETLOCAL_new = H5E_create_msg(H5E_ERR_CLS_g, H5E_MAJOR_new, H5E_MIN_SETLOCAL_MSG_new);
/* From the old function; take out later */
H5E_auto_data_g = stderr;
@@ -362,6 +495,67 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5E_term_interface
+ *
+ * Purpose: Terminates the H5E interface
+ *
+ * Return: Success: Positive if anything is done that might
+ * affect other interfaces; zero otherwise.
+ *
+ * Failure: Negative.
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, July 22, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5E_term_interface(void)
+{
+ int ncls, nmsg, nstk, n=0;
+
+ FUNC_ENTER_NOINIT(H5E_term_interface);
+
+ if (interface_initialize_g) {
+ /* Check if there are any open property list classes or lists */
+ ncls = H5I_nmembers(H5I_ERROR_CLASS);
+ nmsg = H5I_nmembers(H5I_ERROR_MSG);
+ nstk = H5I_nmembers(H5I_ERROR_STACK);
+
+ n = ncls + nmsg + nstk;
+ if(n>0) {
+ if (nmsg>0)
+ H5I_clear_group(H5I_ERROR_MSG, FALSE);
+
+ if (ncls>0) {
+ H5I_clear_group(H5I_ERROR_CLASS, FALSE);
+
+ /* Reset the error class, if they've been closed */
+ if(H5I_nmembers(H5I_ERROR_CLASS)==0)
+ H5E_ERR_CLS_g = -1;
+ }
+ if (nstk>0)
+ H5I_clear_group(H5I_ERROR_STACK, FALSE);
+
+ } else {
+ /* Destroy the error class, message, and stack id groups */
+ H5I_destroy_group(H5I_ERROR_CLASS);
+ H5I_destroy_group(H5I_ERROR_MSG);
+ H5I_destroy_group(H5I_ERROR_STACK);
+
+ /* Mark closed */
+ interface_initialize_g = 0;
+ n = 1; /*H5I*/
+ }
+ }
+
+ FUNC_LEAVE_NOAPI(n);
+}
+
#else /* NEW_ERR */
/*-------------------------------------------------------------------------
@@ -597,15 +791,18 @@ ssize_t
H5E_get_class_name(H5E_cls_t *cls, char *name, size_t size)
{
ssize_t ret_value; /* Return value */
- ssize_t len;
+ ssize_t len = FAIL;
FUNC_ENTER_NOAPI(H5E_get_class_name, FAIL);
- len = HDstrlen(cls->cls_name);
+ if(cls->cls_name)
+ len = HDstrlen(cls->cls_name);
+ else
+ len = 0;
if(name) {
- HDstrncpy(name, cls->cls_name, MIN(len+1, size));
- if(len >= size)
+ HDstrncpy(name, cls->cls_name, MIN(len+1, (ssize_t)size));
+ if(len >= (ssize_t)size)
name[size-1]='\0';
}
@@ -844,7 +1041,7 @@ H5E_get_msg(H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size)
if(msg) {
HDstrncpy(msg, msg_ptr->msg, MIN(len+1, size));
- if(len >= size)
+ if(len >= (ssize_t)size)
msg[size-1]='\0';
}
@@ -884,13 +1081,14 @@ H5E_get_stack_new(void)
FUNC_ENTER_NOAPI(H5E_get_stack_new,NULL);
- estack = pthread_getspecific(H5TS_errstk_key_g);
+ estack = pthread_getspecific(H5TS_errstk_key_g_new);
+
if (!estack) {
/* no associated value with current thread - create one */
estack = (H5E_t_new *)H5MM_calloc(sizeof(H5E_t_new));
- estack->func = &(H5Eprint_new);
+ estack->func = H5Eprint_new;
estack->auto_data = stderr;
- pthread_setspecific(H5TS_errstk_key_g, (void *)estack);
+ pthread_setspecific(H5TS_errstk_key_g_new, (void *)estack);
}
/* Set return value */
@@ -1637,39 +1835,32 @@ herr_t
H5E_print_new(H5E_t_new *estack, FILE *stream)
{
herr_t ret_value = SUCCEED;
- H5E_print_t *eprint = NULL;
+ H5E_print_t eprint;
H5E_cls_t origin_cls={"Unknown class", "Unknown library", "Unknown library version"};
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(H5Eprint, FAIL);
/*NO TRACE*/
- eprint = H5MM_calloc(sizeof(H5E_print_t));
-
if (!stream)
- eprint->stream = stderr;
+ eprint.stream = stderr;
else
- eprint->stream = stream;
+ eprint.stream = stream;
- eprint->cls = H5MM_calloc(sizeof(H5E_cls_t));
-
- eprint->cls->cls_name = HDstrdup(origin_cls.cls_name);
- eprint->cls->lib_name = HDstrdup(origin_cls.lib_name);
- eprint->cls->lib_vers = HDstrdup(origin_cls.lib_vers);
+ eprint.cls.cls_name = HDstrdup(origin_cls.cls_name);
+ eprint.cls.lib_name = HDstrdup(origin_cls.lib_name);
+ eprint.cls.lib_vers = HDstrdup(origin_cls.lib_vers);
- ret_value = H5E_walk_new (estack, H5E_WALK_DOWNWARD, H5E_walk_cb_new, (void*)eprint);
-
- /* Free memory. */
- if(eprint && eprint->cls) {
- if(eprint->cls->cls_name) H5MM_free(eprint->cls->cls_name);
- if(eprint->cls->lib_name) H5MM_free(eprint->cls->lib_name);
- if(eprint->cls->lib_vers) H5MM_free(eprint->cls->lib_vers);
- }
- if(eprint) {
- if(eprint->cls) H5MM_free(eprint->cls);
- H5MM_free(eprint);
- }
-
+ ret_value = H5E_walk_new (estack, H5E_WALK_DOWNWARD, H5E_walk_cb_new, (void*)&eprint);
+
+ /* Free memory */
+ if(eprint.cls.cls_name)
+ H5MM_free(eprint.cls.cls_name);
+ if(eprint.cls.lib_name)
+ H5MM_free(eprint.cls.lib_name);
+ if(eprint.cls.lib_vers)
+ H5MM_free(eprint.cls.lib_vers);
+
done:
FUNC_LEAVE_API(ret_value);
}
@@ -1849,15 +2040,15 @@ H5E_walk_cb_new(int n, H5E_error_t_new *err_desc, void *client_data)
cls_str = maj_ptr->cls->cls_name;
/* Print error message */
- if(HDstrcmp(cls_ptr->lib_name, eprint->cls->lib_name)) {
+ if(HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) {
/* store the new class information, free the old one. */
- if(eprint->cls->cls_name) H5MM_free(eprint->cls->cls_name);
- if(eprint->cls->lib_name) H5MM_free(eprint->cls->lib_name);
- if(eprint->cls->lib_vers) H5MM_free(eprint->cls->lib_vers);
+ if(eprint->cls.cls_name) H5MM_free(eprint->cls.cls_name);
+ if(eprint->cls.lib_name) H5MM_free(eprint->cls.lib_name);
+ if(eprint->cls.lib_vers) H5MM_free(eprint->cls.lib_vers);
- if(cls_ptr->cls_name) eprint->cls->cls_name = HDstrdup(cls_ptr->cls_name);
- if(cls_ptr->lib_name) eprint->cls->lib_name = HDstrdup(cls_ptr->lib_name);
- if(cls_ptr->lib_vers) eprint->cls->lib_vers = HDstrdup(cls_ptr->lib_vers);
+ if(cls_ptr->cls_name) eprint->cls.cls_name = HDstrdup(cls_ptr->cls_name);
+ if(cls_ptr->lib_name) eprint->cls.lib_name = HDstrdup(cls_ptr->lib_name);
+ if(cls_ptr->lib_vers) eprint->cls.lib_vers = HDstrdup(cls_ptr->lib_vers);
fprintf (stream, "%s-DIAG: Error detected in %s ", cls_ptr->lib_name, cls_ptr->lib_vers);
@@ -2051,7 +2242,7 @@ H5E_set_auto_new(H5E_t_new *estack, H5E_auto_t func, void *client_data)
assert(estack);
- estack->func = &func;
+ estack->func = func;
estack->auto_data = client_data;
done:
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index d4ce7e5..5d58fe1 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -44,7 +44,7 @@ typedef struct H5E_msg_t {
/* Printing information */
typedef struct H5E_print_t {
FILE *stream;
- H5E_cls_t *cls;
+ H5E_cls_t cls;
} H5E_print_t;
/*H5_DLLVAR herr_t (*H5E_auto_g_new)(hid_t estack, void *client_data);
@@ -59,165 +59,197 @@ typedef struct H5E_t_new {
void *auto_data;
} H5E_t_new;
-#ifdef TMP
+/* HDF5 error class */
+/*#define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)*/
+H5_DLLVAR hid_t H5E_ERR_CLS_g;
+
/* HDF5 error class */
#define H5E_CLS_NAME "HDF5"
#define H5E_CLS_LIB_NAME "HDF5"
#define H5E_CLS_LIB_VERS "" /* How to find out version number? */
/* HDF5 error class: major errors */
-#define H5E_NONE_MAJOR_MSG "No error"
-#define H5E_MAJ_ARGS_MSG "Function arguments"
-#define H5E_MAJ_RESOURCE_MSG "Resource unavailable"
-#define H5E_MAJ_INTERNAL_MSG "Internal HDF5 error"
-#define H5E_MAJ_FILE_MSG "File interface"
-#define H5E_MAJ_IO_MSG "Low-level I/O layer"
-#define H5E_MAJ_FUNC_MSG "Function entry/exit"
-#define H5E_MAJ_ATOM_MSG "Atom layer"
-#define H5E_MAJ_CACHE_MSG "Meta data cache layer"
-#define H5E_MAJ_BTREE_MSG "B-tree layer"
-#define H5E_MAJ_SYM_MSG "Symbol table layer"
-#define H5E_MAJ_HEAP_MSG "Heap layer"
-#define H5E_MAJ_OHDR_MSG "Object header layer"
-#define H5E_MAJ_DATATYPE_MSG "Datatype interface"
-#define H5E_MAJ_DATASPACE_MSG "Dataspace interface"
-#define H5E_MAJ_DATASET_MSG "Dataset interface"
-#define H5E_MAJ_STORAGE_MSG "Data storage layer"
-#define H5E_MAJ_PLIST_MSG "Property list interface"
-#define H5E_MAJ_ATTR_MSG "Attribute layer"
-#define H5E_MAJ_PLINE_MSG "Data filters layer"
-#define H5E_MAJ_EFL_MSG "External file list"
-#define H5E_MAJ_REFERENCE_MSG "References layer"
-#define H5E_MAJ_VFL_MSG "Virtual File Layer"
-#define H5E_MAJ_TBBT_MSG "Threaded, Balanced, Binary Trees"
-#define H5E_MAJ_FPHDF5_MSG "Flexible Parallel HDF5"
-#define H5E_MAJ_TST_MSG "Ternary Search Trees"
-#define H5E_MAJ_RS_MSG "Reference Counted Strings"
-#define H5E_MAJ_ERROR_MSG "Error API"
+#define H5E_NONE_MAJOR_MSG_new "No error"
+#define H5E_MAJ_ARGS_MSG_new "Function arguments"
+#define H5E_MAJ_RESOURCE_MSG_new "Resource unavailable"
+#define H5E_MAJ_INTERNAL_MSG_new "Internal HDF5 error"
+#define H5E_MAJ_FILE_MSG_new "File interface"
+#define H5E_MAJ_IO_MSG_new "Low-level I/O layer"
+#define H5E_MAJ_FUNC_MSG_new "Function entry/exit"
+#define H5E_MAJ_ATOM_MSG_new "Atom layer"
+#define H5E_MAJ_CACHE_MSG_new "Meta data cache layer"
+#define H5E_MAJ_BTREE_MSG_new "B-tree layer"
+#define H5E_MAJ_SYM_MSG_new "Symbol table layer"
+#define H5E_MAJ_HEAP_MSG_new "Heap layer"
+#define H5E_MAJ_OHDR_MSG_new "Object header layer"
+#define H5E_MAJ_DATATYPE_MSG_new "Datatype interface"
+#define H5E_MAJ_DATASPACE_MSG_new "Dataspace interface"
+#define H5E_MAJ_DATASET_MSG_new "Dataset interface"
+#define H5E_MAJ_STORAGE_MSG_new "Data storage layer"
+#define H5E_MAJ_PLIST_MSG_new "Property list interface"
+#define H5E_MAJ_ATTR_MSG_new "Attribute layer"
+#define H5E_MAJ_PLINE_MSG_new "Data filters layer"
+#define H5E_MAJ_EFL_MSG_new "External file list"
+#define H5E_MAJ_REFERENCE_MSG_new "References layer"
+#define H5E_MAJ_VFL_MSG_new "Virtual File Layer"
+#define H5E_MAJ_TBBT_MSG_new "Threaded, Balanced, Binary Trees"
+#define H5E_MAJ_FPHDF5_MSG_new "Flexible Parallel HDF5"
+#define H5E_MAJ_TST_MSG_new "Ternary Search Trees"
+#define H5E_MAJ_RS_MSG_new "Reference Counted Strings"
+#define H5E_MAJ_ERROR_MSG_new "Error API"
/* HDF5 error class: minor errors */
-#define H5E_NONE_MINOR "No error"
-
/* Argument errors */
-#define H5E_MIN_UNINITIALIZED_MSG "Information is uninitialized"
-#define H5E_MIN_UNSUPPORTED_MSG "Feature is unsupported"
-#define H5E_MIN_BADTYPE_MSG "Inappropriate type"
-#define H5E_MIN_BADRANGE_MSG "Out of range"
-#define H5E_MIN_BADVALUE_MSG "Bad value"
+#define H5E_NONE_MINOR_MSG_new "No error"
+#define H5E_MIN_UNINITIALIZED_MSG_new "Information is uninitialized"
+#define H5E_MIN_UNSUPPORTED_MSG_new "Feature is unsupported"
+#define H5E_MIN_BADTYPE_MSG_new "Inappropriate type"
+#define H5E_MIN_BADRANGE_MSG_new "Out of range"
+#define H5E_MIN_BADVALUE_MSG_new "Bad value"
/* Resource errors */
-#define H5E_MIN_NOSPACE_MSG "No space available for allocation"
-#define H5E_MIN_CANTCOPY_MSG "Unable to copy object"
-#define H5E_MIN_CANTFREE_MSG "Unable to free object"
-#define H5E_MIN_ALREADYEXISTS_MSG "Object already exists"
-#define H5E_MIN_CANTLOCK_MSG "Unable to lock object"
-#define H5E_MIN_CANTUNLOCK_MSG "Unable to unlock object"
-#define H5E_MIN_CANTGC_MSG "Unable to garbage collect"
+#define H5E_MIN_NOSPACE_MSG_new "No space available for allocation"
+#define H5E_MIN_CANTCOPY_MSG_new "Unable to copy object"
+#define H5E_MIN_CANTFREE_MSG_new "Unable to free object"
+#define H5E_MIN_ALREADYEXISTS_MSG_new "Object already exists"
+#define H5E_MIN_CANTLOCK_MSG_new "Unable to lock object"
+#define H5E_MIN_CANTUNLOCK_MSG_new "Unable to unlock object"
+#define H5E_MIN_CANTGC_MSG_new "Unable to garbage collect"
/* File accessability errors */
-#define H5E_MIN_FILEEXISTS_MSG "File already exists"
-#define H5E_MIN_FILEOPEN_MSG "File already open"
-#define H5E_MIN_CANTCREATE_MSG "Unable to create file"
-#define H5E_MIN_CANTOPENFILE_MSG "Unable to open file"
-#define H5E_MIN_CANTCLOSEFILE_MSG "Unable to close file"
-#define H5E_MIN_NOTHDF5_MSG "Not an HDF5 file"
-#define H5E_MIN_BADFILE_MSG "Bad file ID accessed"
-#define H5E_MIN_TRUNCATED_MSG "File has been truncated"
-#define H5E_MIN_MOUNT_MSG "File mount error"
+#define H5E_MIN_FILEEXISTS_MSG_new "File already exists"
+#define H5E_MIN_FILEOPEN_MSG_new "File already open"
+#define H5E_MIN_CANTCREATE_MSG_new "Unable to create file"
+#define H5E_MIN_CANTOPENFILE_MSG_new "Unable to open file"
+#define H5E_MIN_CANTCLOSEFILE_MSG_new "Unable to close file"
+#define H5E_MIN_NOTHDF5_MSG_new "Not an HDF5 file"
+#define H5E_MIN_BADFILE_MSG_new "Bad file ID accessed"
+#define H5E_MIN_TRUNCATED_MSG_new "File has been truncated"
+#define H5E_MIN_MOUNT_MSG_new "File mount error"
/* Generic low-level file I/O errors */
-#define H5E_MIN_SEEKERROR_MSG "Seek failed"
-#define H5E_MIN_READERROR_MSG "Read failed"
-#define H5E_MIN_WRITEERROR_MSG "Write failed"
-#define H5E_MIN_CLOSEERROR_MSG "Close failed"
-#define H5E_MIN_OVERFLOW_MSG "Address overflowed"
-#define H5E_MIN_FCNTL_MSG "File control (fcntl) failed"
+#define H5E_MIN_SEEKERROR_MSG_new "Seek failed"
+#define H5E_MIN_READERROR_MSG_new "Read failed"
+#define H5E_MIN_WRITEERROR_MSG_new "Write failed"
+#define H5E_MIN_CLOSEERROR_MSG_new "Close failed"
+#define H5E_MIN_OVERFLOW_MSG_new "Address overflowed"
+#define H5E_MIN_FCNTL_MSG_new "File control (fcntl) failed"
/* Function entry/exit interface errors */
-#define H5E_MIN_CANTINIT_MSG "Unable to initialize object"
-#define H5E_MIN_ALREADYINIT_MSG "Object already initialized"
-#define H5E_MIN_CANTRELEASE_MSG "Unable to release object"
+#define H5E_MIN_CANTINIT_MSG_new "Unable to initialize object"
+#define H5E_MIN_ALREADYINIT_MSG_new "Object already initialized"
+#define H5E_MIN_CANTRELEASE_MSG_new "Unable to release object"
/* Object atom related errors */
-#define H5E_MIN_BADATOM_MSG "Unable to find atom information (already closed?)"
-#define H5E_MIN_BADGROUP_MSG "Unable to find ID group information"
-#define H5E_MIN_CANTREGISTER_MSG "Unable to register new atom"
-#define H5E_MIN_CANTINC_MSG "Unable to increment reference count"
-#define H5E_MIN_CANTDEC_MSG "Unable to decrement reference count"
-#define H5E_MIN_NOIDS_MSG "Out of IDs for group"
+#define H5E_MIN_BADATOM_MSG_new "Unable to find atom information (already closed?)"
+#define H5E_MIN_BADGROUP_MSG_new "Unable to find ID group information"
+#define H5E_MIN_CANTREGISTER_MSG_new "Unable to register new atom"
+#define H5E_MIN_CANTINC_MSG_new "Unable to increment reference count"
+#define H5E_MIN_CANTDEC_MSG_new "Unable to decrement reference count"
+#define H5E_MIN_NOIDS_MSG_new "Out of IDs for group"
/* Cache related errors */
-#define H5E_MIN_CANTFLUSH_MSG "Unable to flush data from cache"
-#define H5E_MIN_CANTLOAD_MSG "Unable to load meta data into cache"
-#define H5E_MIN_PROTECT_MSG "Protected meta data error"
-#define H5E_MIN_NOTCACHED_MSG "Meta data not currently cached"
+#define H5E_MIN_CANTFLUSH_MSG_new "Unable to flush data from cache"
+#define H5E_MIN_CANTLOAD_MSG_new "Unable to load meta data into cache"
+#define H5E_MIN_PROTECT_MSG_new "Protected meta data error"
+#define H5E_MIN_NOTCACHED_MSG_new "Meta data not currently cached"
/* B-tree related errors */
-#define H5E_MIN_NOTFOUND_MSG "Object not found"
-#define H5E_MIN_EXISTS_MSG "Object already exists"
-#define H5E_MIN_CANTENCODE_MSG "Unable to encode value"
-#define H5E_MIN_CANTDECODE_MSG "Unable to decode value"
-#define H5E_MIN_CANTSPLIT_MSG "Unable to split node"
-#define H5E_MIN_CANTINSERT_MSG "Unable to insert object"
-#define H5E_MIN_CANTLIST_MSG "Unable to list node"
+#define H5E_MIN_NOTFOUND_MSG_new "Object not found"
+#define H5E_MIN_EXISTS_MSG_new "Object already exists"
+#define H5E_MIN_CANTENCODE_MSG_new "Unable to encode value"
+#define H5E_MIN_CANTDECODE_MSG_new "Unable to decode value"
+#define H5E_MIN_CANTSPLIT_MSG_new "Unable to split node"
+#define H5E_MIN_CANTINSERT_MSG_new "Unable to insert object"
+#define H5E_MIN_CANTLIST_MSG_new "Unable to list node"
/* Object header related errors */
-#define H5E_MIN_LINKCOUNT_MSG "Bad object header link count"
-#define H5E_MIN_VERSION_MSG "Wrong version number"
-#define H5E_MIN_ALIGNMENT_MSG "Alignment error"
-#define H5E_MIN_BADMESG_MSG "Unrecognized message"
-#define H5E_MIN_CANTDELETE_MSG "Can't delete message"
+#define H5E_MIN_LINKCOUNT_MSG_new "Bad object header link count"
+#define H5E_MIN_VERSION_MSG_new "Wrong version number"
+#define H5E_MIN_ALIGNMENT_MSG_new "Alignment error"
+#define H5E_MIN_BADMESG_MSG_new "Unrecognized message"
+#define H5E_MIN_CANTDELETE_MSG_new "Can't delete message"
/* Group related errors */
-#define H5E_MIN_CANTOPENOBJ_MSG "Can't open object"
-#define H5E_MIN_COMPLEN_MSG "Name component is too long"
-#define H5E_MIN_CWG_MSG "Problem with current working group"
-#define H5E_MIN_LINK_MSG "Link count failure"
-#define H5E_MIN_SLINK_MSG "Symbolic link error"
+#define H5E_MIN_CANTOPENOBJ_MSG_new "Can't open object"
+#define H5E_MIN_COMPLEN_MSG_new "Name component is too long"
+#define H5E_MIN_CWG_MSG_new "Problem with current working group"
+#define H5E_MIN_LINK_MSG_new "Link count failure"
+#define H5E_MIN_SLINK_MSG_new "Symbolic link error"
/* Datatype conversion errors */
-#define H5E_MIN_CANTCONVERT_MSG "Can't convert datatypes"
-#define H5E_MIN_BADSIZE_MSG "Bad size for object"
+#define H5E_MIN_CANTCONVERT_MSG_new "Can't convert datatypes"
+#define H5E_MIN_BADSIZE_MSG_new "Bad size for object"
/* Dataspace errors */
-#define H5E_MIN_CANTCLIP_MSG "Can't clip hyperslab region"
-#define H5E_MIN_CANTCOUNT_MSG "Can't count elements"
-#define H5E_MIN_CANTSELECT_MSG "Can't select hyperslab"
-#define H5E_MIN_CANTNEXT_MSG "Can't move to next iterator location"
-#define H5E_MIN_BADSELECT_MSG "Invalid selection"
-#define H5E_MIN_CANTCOMPARE_MSG "Can't compare objects"
+#define H5E_MIN_CANTCLIP_MSG_new "Can't clip hyperslab region"
+#define H5E_MIN_CANTCOUNT_MSG_new "Can't count elements"
+#define H5E_MIN_CANTSELECT_MSG_new "Can't select hyperslab"
+#define H5E_MIN_CANTNEXT_MSG_new "Can't move to next iterator location"
+#define H5E_MIN_BADSELECT_MSG_new "Invalid selection"
+#define H5E_MIN_CANTCOMPARE_MSG_new "Can't compare objects"
/* Property list errors */
-#define H5E_MIN_CANTGET_MSG "Can't get value"
-#define H5E_MIN_CANTSET_MSG "Can't set value"
-#define H5E_MIN_DUPCLASS_MSG "Duplicate class name in parent class"
+#define H5E_MIN_CANTGET_MSG_new "Can't get value"
+#define H5E_MIN_CANTSET_MSG_new "Can't set value"
+#define H5E_MIN_DUPCLASS_MSG_new "Duplicate class name in parent class"
/* Parallel MPI errors */
-#define H5E_MIN_MPI_MSG "Some MPI function failed"
-#define H5E_MIN_MPIERRSTR_MSG "MPI Error String"
+#define H5E_MIN_MPI_MSG_new "Some MPI function failed"
+#define H5E_MIN_MPIERRSTR_MSG_new "MPI Error String"
/* FPHDF5 errors */
-#define H5E_MIN_CANTMAKETREE_MSG "Can't create a binary tree node"
-#define H5E_MIN_CANTRECV_MSG "Can't receive messages from processes"
-#define H5E_MIN_CANTSENDMDATA_MSG "Can't send metadata message"
-#define H5E_MIN_CANTCHANGE_MSG "Can't register change with server"
-#define H5E_MIN_CANTALLOC_MSG "Can't allocate from file"
+#define H5E_MIN_CANTMAKETREE_MSG_new "Can't create a binary tree node"
+#define H5E_MIN_CANTRECV_MSG_new "Can't receive messages from processes"
+#define H5E_MIN_CANTSENDMDATA_MSG_new "Can't send metadata message"
+#define H5E_MIN_CANTCHANGE_MSG_new "Can't register change with server"
+#define H5E_MIN_CANTALLOC_MSG_new "Can't allocate from file"
/* I/O pipeline errors */
-#define H5E_MIN_NOFILTER_MSG "Requested filter is not available"
-#define H5E_MIN_CALLBACK_MSG "Callback failed"
-#define H5E_MIN_CANAPPLY_MSG "Error from filter \"can apply\" callback"
-#define H5E_MIN_SETLOCAL_MSG "Error from filter \"set local\" callback"
-#endif /* TMP */
+#define H5E_MIN_NOFILTER_MSG_new "Requested filter is not available"
+#define H5E_MIN_CALLBACK_MSG_new "Callback failed"
+#define H5E_MIN_CANAPPLY_MSG_new "Error from filter \"can apply\" callback"
+#define H5E_MIN_SETLOCAL_MSG_new "Error from filter \"set local\" callback"
#endif /* NEW_ERR */
+#ifndef NEW_ERR
+#ifdef H5_HAVE_THREADSAFE
+/*
+ * The per-thread error stack. pthread_once() initializes a special
+ * key that will be used by all threads to create a stack specific to
+ * each thread individually. The association of stacks to threads will
+ * be handled by the pthread library.
+ *
+ * In order for this macro to work, H5E_get_my_stack() must be preceeded
+ * by "H5E_t *estack =".
+ */
+#define H5E_get_my_stack_new() H5E_get_stack_new()
+#else /* H5_HAVE_THREADSAFE */
+/*
+ * The current error stack. Eventually we'll have some sort of global table
+ * so each thread has it's own stack. The stacks will be created on demand
+ * when the thread first calls H5E_push(). */
+H5E_t_new H5E_stack_g_new[1];
+#define H5E_get_my_stack_new() (H5E_stack_g_new+0)
+#endif /* H5_HAVE_THREADSAFE */
+#endif /* NEW_ERR */
+
+
/*
* HERROR macro, used to facilitate error reporting between a FUNC_ENTER()
* and a FUNC_LEAVE() within a function body. The arguments are the major
* error number, the minor error number, and a description of the error.
*/
#ifdef NEW_ERR
-#define HERROR(maj, min, str) H5E_push_new(H5E_DEFAULT, __FILE__, FUNC, __LINE__, maj, min, str)
+#define HERROR(maj_id, min_id, str) { \
+ H5E_msg_t *maj_ptr, *min_ptr; \
+ hid_t cls_id; \
+ maj_ptr = H5I_object_verify(maj_id, H5I_ERROR_MSG); \
+ min_ptr = H5I_object_verify(min_id, H5I_ERROR_MSG); \
+ /*check error: cls of maj and min should be same*/ \
+ cls_id = H5I_register(H5I_ERROR_CLASS, maj_ptr->cls); \
+ H5E_push_new(H5E_DEFAULT, __FILE__, FUNC, __LINE__, cls_id, maj_id, min_id, str); \
+}
#else
#define HERROR(maj, min, str) H5E_push(maj, min, FUNC, __FILE__, __LINE__, str)
#endif /* NEW_ERR */
@@ -226,10 +258,18 @@ typedef struct H5E_t_new {
* HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR
* (Shouldn't need to be used outside this header file)
*/
+#ifdef NEW_ERR
+#define HCOMMON_ERROR(maj, min, str) \
+ H5E_t_new *estack = H5E_get_my_stack_new(); \
+ HERROR (maj, min, str); \
+ if (H5_IS_API(FUNC) && estack->auto_data) \
+ (void)((estack->func)(H5E_DEFAULT, estack->auto_data))
+#else
#define HCOMMON_ERROR(maj, min, str) \
HERROR (maj, min, str); \
if (H5_IS_API(FUNC) && H5E_auto_g) \
(void)((H5E_auto_g)(H5E_auto_data_g))
+#endif /* NEW_ERR */
/*
* HDONE_ERROR macro, used to facilitate error reporting between a
@@ -297,13 +337,14 @@ H5_DLL herr_t H5E_walk (H5E_direction_t dir, H5E_walk_t func,
#ifndef NEW_ERR
/* New error API */
-H5_DLL hid_t H5E_register_class(const char *cls_name, const char *lib_name,
+H5E_t_new * H5E_get_stack_new(void);
+H5_DLL hid_t H5E_register_class(const char *cls_name, const char *lib_name,
const char *version);
H5_DLL herr_t H5E_unregister_class(H5E_cls_t *cls);
-H5_DLL herr_t H5E_close_msg(H5E_msg_t *err);
-H5_DLL hid_t H5E_create_msg(hid_t cls_id, H5E_type_t msg_type, const char *msg);
-H5_DLL hid_t H5E_get_current_stack(void);
-H5_DLL herr_t H5E_close_stack(H5E_t_new *err_stack);
+H5_DLL herr_t H5E_close_msg(H5E_msg_t *err);
+H5_DLL hid_t H5E_create_msg(hid_t cls_id, H5E_type_t msg_type, const char *msg);
+H5_DLL hid_t H5E_get_current_stack(void);
+H5_DLL herr_t H5E_close_stack(H5E_t_new *err_stack);
H5_DLL ssize_t H5E_get_class_name(H5E_cls_t *cls, char *name, size_t size);
H5_DLL ssize_t H5E_get_msg(H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size);
H5_DLL int H5E_get_num(H5E_t_new *err_stack);
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 28ecb77..77523cf 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -30,10 +30,10 @@
/* Take out _new later */
typedef enum H5E_type_t {
- H5E_ERROR_new =-1,
+ H5E_LLIMIT_new =-1,
H5E_MAJOR_new,
H5E_MINOR_new,
- H5E_LIMIT_new
+ H5E_ULIMIT_new
} H5E_type_t;
/* Information about an error; element of error stack */
@@ -55,155 +55,150 @@ typedef struct H5E_error_t_new {
#define H5OPEN
#endif /* _H5Eprivate_H */
-/* HDF5 error class */
-#define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g)
-H5_DLLVAR hid_t H5E_ERR_CLS_g;
-
-#ifdef TMP
/* HDF5 error class: major errors. */
-hid_t H5E_NONE_MAJOR; /*special zero, no error */
-hid_t H5E_ARGS; /*invalid arguments to routine */
-hid_t H5E_RESOURCE; /*resource unavailable */
-hid_t H5E_INTERNAL; /*Internal error (too specific to document in detail) */
-hid_t H5E_FILE; /*file Accessability */
-hid_t H5E_IO; /*Low-level I/O */
-hid_t H5E_FUNC; /*function Entry/Exit */
-hid_t H5E_ATOM; /*object Atom */
-hid_t H5E_CACHE; /*object Cache */
-hid_t H5E_BTREE; /*B-Tree Node */
-hid_t H5E_SYM; /*symbol Table */
-hid_t H5E_HEAP; /*Heap */
-hid_t H5E_OHDR; /*object Header */
-hid_t H5E_DATATYPE; /*Datatype */
-hid_t H5E_DATASPACE; /*Dataspace */
-hid_t H5E_DATASET; /*Dataset */
-hid_t H5E_STORAGE; /*data storage */
-hid_t H5E_PLIST; /*Property lists */
-hid_t H5E_ATTR; /*Attribute */
-hid_t H5E_PLINE; /*Data filters */
-hid_t H5E_EFL; /*External file list */
-hid_t H5E_REFERENCE; /*References */
-hid_t H5E_VFL; /*Virtual File Layer */
-hid_t H5E_TBBT; /*Threaded, Balanced, Binary Trees */
-hid_t H5E_FPHDF5; /*Flexible Parallel HDF5 */
-hid_t H5E_TST; /*Ternary Search Trees */
-hid_t H5E_RS; /*Reference Counted Strings */
-hid_t H5E_ERROR; /*Error API */
+hid_t H5E_NONE_MAJOR_new; /*special zero, no error */
+hid_t H5E_ARGS_new; /*invalid arguments to routine */
+hid_t H5E_RESOURCE_new; /*resource unavailable */
+hid_t H5E_INTERNAL_new; /*Internal error (too specific to document in detail) */
+hid_t H5E_FILE_new; /*file Accessability */
+hid_t H5E_IO_new; /*Low-level I/O */
+hid_t H5E_FUNC_new; /*function Entry/Exit */
+hid_t H5E_ATOM_new; /*object Atom */
+hid_t H5E_CACHE_new; /*object Cache */
+hid_t H5E_BTREE_new; /*B-Tree Node */
+hid_t H5E_SYM_new; /*symbol Table */
+hid_t H5E_HEAP_new; /*Heap */
+hid_t H5E_OHDR_new; /*object Header */
+hid_t H5E_DATATYPE_new; /*Datatype */
+hid_t H5E_DATASPACE_new; /*Dataspace */
+hid_t H5E_DATASET_new; /*Dataset */
+hid_t H5E_STORAGE_new; /*data storage */
+hid_t H5E_PLIST_new; /*Property lists */
+hid_t H5E_ATTR_new; /*Attribute */
+hid_t H5E_PLINE_new; /*Data filters */
+hid_t H5E_EFL_new; /*External file list */
+hid_t H5E_REFERENCE_new; /*References */
+hid_t H5E_VFL_new; /*Virtual File Layer */
+hid_t H5E_TBBT_new; /*Threaded, Balanced, Binary Trees */
+hid_t H5E_FPHDF5_new; /*Flexible Parallel HDF5 */
+hid_t H5E_TST_new; /*Ternary Search Trees */
+hid_t H5E_RS_new; /*Reference Counted Strings */
+hid_t H5E_ERROR_new; /*Error API */
/* HDF5 error class: minor errors. */
-hid_t H5E_NONE_MINOR; /*special zero, no error */
-hid_t H5E_UNINITIALIZED; /*information is unitialized */
-hid_t H5E_UNSUPPORTED; /*feature is unsupported */
-hid_t H5E_BADTYPE; /*incorrect type found */
-hid_t H5E_BADRANGE; /*argument out of range */
-hid_t H5E_BADVALUE; /*bad value for argument */
+ /* Argument errors */
+hid_t H5E_NONE_MINOR_new; /*special zero, no error */
+hid_t H5E_UNINITIALIZED_new; /*information is unitialized */
+hid_t H5E_UNSUPPORTED_new; /*feature is unsupported */
+hid_t H5E_BADTYPE_new; /*incorrect type found */
+hid_t H5E_BADRANGE_new; /*argument out of range */
+hid_t H5E_BADVALUE_new; /*bad value for argument */
/* Resource errors */
-hid_t H5E_NOSPACE; /*no space available for allocation */
-hid_t H5E_CANTCOPY; /*unable to copy object */
-hid_t H5E_CANTFREE; /*unable to free object */
-hid_t H5E_ALREADYEXISTS; /*Object already exists */
-hid_t H5E_CANTLOCK; /*Unable to lock object */
-hid_t H5E_CANTUNLOCK; /*Unable to unlock object */
-hid_t H5E_CANTGC; /*Unable to garbage collect */
+hid_t H5E_NOSPACE_new; /*no space available for allocation */
+hid_t H5E_CANTCOPY_new; /*unable to copy object */
+hid_t H5E_CANTFREE_new; /*unable to free object */
+hid_t H5E_ALREADYEXISTS_new; /*Object already exists */
+hid_t H5E_CANTLOCK_new; /*Unable to lock object */
+hid_t H5E_CANTUNLOCK_new; /*Unable to unlock object */
+hid_t H5E_CANTGC_new; /*Unable to garbage collect */
/* File accessability errors */
-hid_t H5E_FILEEXISTS; /*file already exists */
-hid_t H5E_FILEOPEN; /*file already open */
-hid_t H5E_CANTCREATE; /*Can't create file */
-hid_t H5E_CANTOPENFILE; /*Can't open file */
-hid_t H5E_CANTCLOSEFILE; /*Can't close file */
-hid_t H5E_NOTHDF5; /*not an HDF5 format file */
-hid_t H5E_BADFILE; /*bad file ID accessed */
-hid_t H5E_TRUNCATED; /*file has been truncated */
-hid_t H5E_MOUNT; /*file mount error */
+hid_t H5E_FILEEXISTS_new; /*file already exists */
+hid_t H5E_FILEOPEN_new; /*file already open */
+hid_t H5E_CANTCREATE_new; /*Can't create file */
+hid_t H5E_CANTOPENFILE_new; /*Can't open file */
+hid_t H5E_CANTCLOSEFILE_new; /*Can't close file */
+hid_t H5E_NOTHDF5_new; /*not an HDF5 format file */
+hid_t H5E_BADFILE_new; /*bad file ID accessed */
+hid_t H5E_TRUNCATED_new; /*file has been truncated */
+hid_t H5E_MOUNT_new; /*file mount error */
/* Generic low-level file I/O errors */
-hid_t H5E_SEEKERROR; /*seek failed */
-hid_t H5E_READERROR; /*read failed */
-hid_t H5E_WRITEERROR; /*write failed */
-hid_t H5E_CLOSEERROR; /*close failed */
-hid_t H5E_OVERFLOW; /*address overflowed */
-hid_t H5E_FCNTL; /*file fcntl failed */
+hid_t H5E_SEEKERROR_new; /*seek failed */
+hid_t H5E_READERROR_new; /*read failed */
+hid_t H5E_WRITEERROR_new; /*write failed */
+hid_t H5E_CLOSEERROR_new; /*close failed */
+hid_t H5E_OVERFLOW_new; /*address overflowed */
+hid_t H5E_FCNTL_new; /*file fcntl failed */
/* Function entry/exit interface errors */
-hid_t H5E_CANTINIT; /*Can't initialize object */
-hid_t H5E_ALREADYINIT; /*object already initialized */
-hid_t H5E_CANTRELEASE; /*Can't release object */
+hid_t H5E_CANTINIT_new; /*Can't initialize object */
+hid_t H5E_ALREADYINIT_new; /*object already initialized */
+hid_t H5E_CANTRELEASE_new; /*Can't release object */
/* Object atom related errors */
-hid_t H5E_BADATOM; /*Can't find atom information */
-hid_t H5E_BADGROUP; /*Can't find group information */
-hid_t H5E_CANTREGISTER; /*Can't register new atom */
-hid_t H5E_CANTINC; /*Can't increment reference count */
-hid_t H5E_CANTDEC; /*Can't decrement reference count */
-hid_t H5E_NOIDS; /*Out of IDs for group */
+hid_t H5E_BADATOM_new; /*Can't find atom information */
+hid_t H5E_BADGROUP_new; /*Can't find group information */
+hid_t H5E_CANTREGISTER_new; /*Can't register new atom */
+hid_t H5E_CANTINC_new; /*Can't increment reference count */
+hid_t H5E_CANTDEC_new; /*Can't decrement reference count */
+hid_t H5E_NOIDS_new; /*Out of IDs for group */
/* Cache related errors */
-hid_t H5E_CANTFLUSH; /*Can't flush object from cache */
-hid_t H5E_CANTLOAD; /*Can't load object into cache */
-hid_t H5E_PROTECT; /*protected object error */
-hid_t H5E_NOTCACHED; /*object not currently cached */
+hid_t H5E_CANTFLUSH_new; /*Can't flush object from cache */
+hid_t H5E_CANTLOAD_new; /*Can't load object into cache */
+hid_t H5E_PROTECT_new; /*protected object error */
+hid_t H5E_NOTCACHED_new; /*object not currently cached */
/* B-tree related errors */
-hid_t H5E_NOTFOUND; /*object not found */
-hid_t H5E_EXISTS; /*object already exists */
-hid_t H5E_CANTENCODE; /*Can't encode value */
-hid_t H5E_CANTDECODE; /*Can't decode value */
-hid_t H5E_CANTSPLIT; /*Can't split node */
-hid_t H5E_CANTINSERT; /*Can't insert object */
-hid_t H5E_CANTLIST; /*Can't list node */
+hid_t H5E_NOTFOUND_new; /*object not found */
+hid_t H5E_EXISTS_new; /*object already exists */
+hid_t H5E_CANTENCODE_new; /*Can't encode value */
+hid_t H5E_CANTDECODE_new; /*Can't decode value */
+hid_t H5E_CANTSPLIT_new; /*Can't split node */
+hid_t H5E_CANTINSERT_new; /*Can't insert object */
+hid_t H5E_CANTLIST_new; /*Can't list node */
/* Object header related errors */
-hid_t H5E_LINKCOUNT; /*bad object header link count */
-hid_t H5E_VERSION; /*wrong version number */
-hid_t H5E_ALIGNMENT; /*alignment error */
-hid_t H5E_BADMESG; /*unrecognized message */
-hid_t H5E_CANTDELETE; /* Can't delete message */
+hid_t H5E_LINKCOUNT_new; /*bad object header link count */
+hid_t H5E_VERSION_new; /*wrong version number */
+hid_t H5E_ALIGNMENT_new; /*alignment error */
+hid_t H5E_BADMESG_new; /*unrecognized message */
+hid_t H5E_CANTDELETE_new; /* Can't delete message */
/* Group related errors */
-hid_t H5E_CANTOPENOBJ; /*Can't open object */
-hid_t H5E_COMPLEN; /*name component is too long */
-hid_t H5E_CWG; /*problem with current working group */
-hid_t H5E_LINK; /*link count failure */
-hid_t H5E_SLINK; /*symbolic link error */
+hid_t H5E_CANTOPENOBJ_new; /*Can't open object */
+hid_t H5E_COMPLEN_new; /*name component is too long */
+hid_t H5E_CWG_new; /*problem with current working group */
+hid_t H5E_LINK_new; /*link count failure */
+hid_t H5E_SLINK_new; /*symbolic link error */
/* Datatype conversion errors */
-hid_t H5E_CANTCONVERT; /*Can't convert datatypes */
-hid_t H5E_BADSIZE; /*Bad size for object */
+hid_t H5E_CANTCONVERT_new; /*Can't convert datatypes */
+hid_t H5E_BADSIZE_new; /*Bad size for object */
/* Dataspace errors */
-hid_t H5E_CANTCLIP; /*Can't clip hyperslab region */
-hid_t H5E_CANTCOUNT; /*Can't count elements */
-hid_t H5E_CANTSELECT; /*Can't select hyperslab */
-hid_t H5E_CANTNEXT; /*Can't move to next iterator location */
-hid_t H5E_BADSELECT; /*Invalid selection */
-hid_t H5E_CANTCOMPARE; /*Can't compare objects */
+hid_t H5E_CANTCLIP_new; /*Can't clip hyperslab region */
+hid_t H5E_CANTCOUNT_new; /*Can't count elements */
+hid_t H5E_CANTSELECT_new; /*Can't select hyperslab */
+hid_t H5E_CANTNEXT_new; /*Can't move to next iterator location */
+hid_t H5E_BADSELECT_new; /*Invalid selection */
+hid_t H5E_CANTCOMPARE_new; /*Can't compare objects */
/* Property list errors */
-hid_t H5E_CANTGET; /*Can't get value */
-hid_t H5E_CANTSET; /*Can't set value */
-hid_t H5E_DUPCLASS; /*Duplicate class name in parent class */
+hid_t H5E_CANTGET_new; /*Can't get value */
+hid_t H5E_CANTSET_new; /*Can't set value */
+hid_t H5E_DUPCLASS_new; /*Duplicate class name in parent class */
/* Parallel errors */
-hid_t H5E_MPI; /*some MPI function failed */
-hid_t H5E_MPIERRSTR; /*MPI Error String */
+hid_t H5E_MPI_new; /*some MPI function failed */
+hid_t H5E_MPIERRSTR_new; /*MPI Error String */
/* FPHDF5 errors */
-hid_t H5E_CANTMAKETREE; /*can't make a TBBT tree */
-hid_t H5E_CANTRECV; /*can't receive messages from processes */
-hid_t H5E_CANTSENDMDATA; /*can't send metadata message */
-hid_t H5E_CANTCHANGE; /*can't register change on server */
-hid_t H5E_CANTALLOC; /*can't allocate from file */
+hid_t H5E_CANTMAKETREE_new; /*can't make a TBBT tree */
+hid_t H5E_CANTRECV_new; /*can't receive messages from processes */
+hid_t H5E_CANTSENDMDATA_new; /*can't send metadata message */
+hid_t H5E_CANTCHANGE_new; /*can't register change on server */
+hid_t H5E_CANTALLOC_new; /*can't allocate from file */
/* I/O pipeline errors */
-hid_t H5E_NOFILTER; /*requested filter is not available */
-hid_t H5E_CALLBACK; /*callback failed */
-hid_t H5E_CANAPPLY; /*error from filter "can apply" callback */
-hid_t H5E_SETLOCAL; /*error from filter "set local" callback */
+hid_t H5E_NOFILTER_new; /*requested filter is not available */
+hid_t H5E_CALLBACK_new; /*callback failed */
+hid_t H5E_CANAPPLY_new; /*error from filter "can apply" callback */
+hid_t H5E_SETLOCAL_new; /*error from filter "set local" callback */
-#endif /* TMP */
#endif /* NEW_ERR */
/*
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 3087ce9..a2b26e2 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -45,7 +45,6 @@ typedef enum {
H5I_ERROR_CLASS, /*group ID for error classes */
H5I_ERROR_MSG, /*group ID for error messages */
H5I_ERROR_STACK, /*group ID for error stacks */
-
H5I_NGROUPS /*number of valid groups, MUST BE LAST! */
} H5I_type_t;
diff --git a/src/H5TS.c b/src/H5TS.c
index 943e21b..e57c5e6 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -32,6 +32,9 @@ typedef struct H5TS_cancel_struct {
/* Global variable definitions */
pthread_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
pthread_key_t H5TS_errstk_key_g;
+#ifndef NEW_ERR
+pthread_key_t H5TS_errstk_key_g_new;
+#endif /* NEW_ERR */
pthread_key_t H5TS_funcstk_key_g;
pthread_key_t H5TS_cancel_key_g;
hbool_t H5TS_allow_concurrent_g = FALSE; /* concurrent APIs override this */
@@ -107,7 +110,10 @@ H5TS_first_thread_init(void)
/* initialize key for thread-specific error stacks */
pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor);
-
+#ifndef NEW_ERR
+ /* initialize key for thread-specific error stacks */
+ pthread_key_create(&H5TS_errstk_key_g_new, H5TS_key_destructor);
+#endif /* NEW_ERR */
/* initialize key for thread-specific function stacks */
pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor);
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index f79e666..8701a16 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -44,6 +44,9 @@ typedef struct H5TS_mutex_struct {
/* Extern global variables */
extern pthread_once_t H5TS_first_init_g;
extern pthread_key_t H5TS_errstk_key_g;
+#ifndef NEW_ERR
+extern pthread_key_t H5TS_errstk_key_g_new;
+#endif
extern pthread_key_t H5TS_funcstk_key_g;
#if defined c_plusplus || defined __cplusplus
diff --git a/src/H5private.h b/src/H5private.h
index 5832054..e9967f2 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1333,6 +1333,7 @@ H5_DLL void H5_term_library(void);
H5_DLL int H5A_term_interface(void);
H5_DLL int H5AC_term_interface(void);
H5_DLL int H5D_term_interface(void);
+H5_DLL int H5E_term_interface(void);
H5_DLL int H5F_term_interface(void);
H5_DLL int H5G_term_interface(void);
H5_DLL int H5I_term_interface(void);