summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-07 20:13:31 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-07 20:13:31 (GMT)
commitbcf649388cb246fecf5bac670c54c7c4d654eb44 (patch)
treee73f696a48020d756c3eeda3c633047ef2465bfa /test
parent63be23d70dd9bb3d79d670bb94e26c829a4abc2e (diff)
downloadhdf5-bcf649388cb246fecf5bac670c54c7c4d654eb44.zip
hdf5-bcf649388cb246fecf5bac670c54c7c4d654eb44.tar.gz
hdf5-bcf649388cb246fecf5bac670c54c7c4d654eb44.tar.bz2
[svn-r460] Changes since 19980707
---------------------- ./bin/trace ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5P.c ./src/H5Pprivate.h ./src/H5S.c ./src/H5T.c Output-only arguments have their addresses printed during tracing and added symbolic output for the H5F_driver_t arguments. That's another reason that we should be careful to add `/*out*/' after arguments that are output-only and `/*in,out*/' after arguments that are used for both input and output values. No internal function calls H5Pget_class() anymore. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tpublic.h Added H5Tget_overflow() and H5Tset_overflow() so the application can query or set a function that will be called whenever an overflow occurs. Implemented as documented in previous e-mail except the overflow handler gets two buffers: one that contains the source value and one to receive the optional destination value. ./test/dtypes.c Tests overflow handler. ./src/H5.c We have to declare fdopen() because I'm getting errors when compiling on Irix64 even though we include <stdio.h> as documented in the fdopen() man page.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index e9e8f06..9bd8747 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -53,6 +53,9 @@ typedef enum flt_t {
FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
} flt_t;
+/* Count the number of overflows */
+static int noverflows_g = 0;
+
/*
* Some machines generate SIGFPE on floating point overflows. According to
* the Posix standard, we cannot assume that we can continue from such a
@@ -88,6 +91,31 @@ fpe_handler(int __unused__ signo)
/*-------------------------------------------------------------------------
+ * Function: overflow_handler
+ *
+ * Purpose: Gets called for all data type conversion overflows.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, July 7, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+overflow_handler(hid_t __unused__ src_id, hid_t __unused__ dst_id,
+ void __unused__ *src_buf, void __unused__ *dst_buf)
+{
+ noverflows_g++;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: cleanup
*
* Purpose: Removes test files
@@ -895,6 +923,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
dst_size = H5Tget_size(dst);
buf = malloc(nelmts*MAX(src_size, dst_size));
saved = malloc(nelmts*MAX(src_size, dst_size));
+ noverflows_g = 0;
for (i=0; i<ntests; i++) {
@@ -1074,6 +1103,9 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
}
puts(" PASSED");
}
+ if (noverflows_g>0) {
+ printf(" %d overflow%s\n", noverflows_g, 1==noverflows_g?"":"s");
+ }
done:
if (buf) free (buf);
@@ -1119,6 +1151,9 @@ main(void)
/* Set the error handler */
H5Eset_auto (display_error_cb, NULL);
+ /* Set the overflow handler */
+ H5Tset_overflow(overflow_handler);
+
/* Do the tests */
nerrors += test_classes()<0 ? 1 : 0;
nerrors += test_copy()<0 ? 1 : 0;