summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-10-20 17:46:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-10-20 17:46:55 (GMT)
commitf1f675be430dc3f0c0999e42018795d25f713f57 (patch)
tree8672218a776c5a6df495644776189b8125a8abc0
parent4d1a3a289220ade9ff4948723fc67a18eda65097 (diff)
downloadhdf5-f1f675be430dc3f0c0999e42018795d25f713f57.zip
hdf5-f1f675be430dc3f0c0999e42018795d25f713f57.tar.gz
hdf5-f1f675be430dc3f0c0999e42018795d25f713f57.tar.bz2
[svn-r1783] Added public H5Epush... routines and macros.
-rw-r--r--src/H5E.c31
-rw-r--r--src/H5Epublic.h24
2 files changed, 55 insertions, 0 deletions
diff --git a/src/H5E.c b/src/H5E.c
index e5dfc84..189de15 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -524,6 +524,37 @@ H5E_push(H5E_major_t maj_num, H5E_minor_t min_num, const char *function_name,
/*-------------------------------------------------------------------------
+ * Function: H5Epush
+ *
+ * Purpose: Pushes a new error record onto error stack for the current
+ * thread. The error has major and minor numbers MAJ_NUM and
+ * MIN_NUM, the name of a function where the error was detected,
+ * the name of the file where the error was detected, the
+ * line within that file, and an error description string. The
+ * function name, file name, and error description strings must
+ * be statically allocated.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, October 18, 1999
+ *
+ * Notes: Basically a public API wrapper around the H5E_push function.
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+__DLL__ herr_t H5Epush(const char *file, const char *func,
+ unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str)
+{
+ FUNC_ENTER(H5Epush, FAIL);
+
+ FUNC_LEAVE(H5E_push(maj,min,func,file,line,str));
+} /* end H5Epush() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5E_clear
*
* Purpose: Clears the error stack for the current thread.
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 07ba0f1..ce8af46 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -46,6 +46,28 @@
H5Eset_auto (H5E_saved_efunc, H5E_saved_edata); \
} while(0)
+/*
+ * Public API Convenience Macros for Error reporting - Documented
+ */
+/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */
+#define H5Epush_sim(func,maj,min,str) H5Epush(__FILE__,func,__LINE__,maj,min,str)
+
+/*
+ * Public API Convenience Macros for Error reporting - Undocumented
+ */
+/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */
+/* And return after pushing error onto stack */
+#define H5Epush_ret(func,maj,min,str,ret) { \
+ H5Epush(__FILE__,func,__LINE__,maj,min,str); \
+ return(ret); \
+}
+
+/* Use the Standard C __FILE__ & __LINE__ macros instead of typing them in */
+/* And goto a label after pushing error onto stack */
+#define H5Epush_goto(func,maj,min,str,label) { \
+ H5Epush(__FILE__,func,__LINE__,maj,min,str); \
+ goto (label); \
+}
/*
* Declare an enumerated type which holds all the valid major HDF error codes.
@@ -187,6 +209,8 @@ __DLL__ herr_t H5Ewalk (H5E_direction_t direction, H5E_walk_t func,
__DLL__ herr_t H5Ewalk_cb (int n, H5E_error_t *err_desc, void *client_data);
__DLL__ const char *H5Eget_major (H5E_major_t major_number);
__DLL__ const char *H5Eget_minor (H5E_minor_t minor_number);
+__DLL__ herr_t H5Epush(const char *file, const char *func,
+ unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str);
#ifdef __cplusplus
}