summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--RELEASE5
-rwxr-xr-xbin/checkposix4
-rw-r--r--src/H5.c37
-rw-r--r--src/H5F.c3
-rw-r--r--src/H5Fstdio.c2
-rw-r--r--src/H5Pprivate.h2
-rw-r--r--src/H5Psimp.c60
-rw-r--r--src/H5T.c26
-rw-r--r--src/H5Tpublic.h52
-rw-r--r--src/H5public.h3
-rw-r--r--test/cmpd_dset.c1
-rw-r--r--test/dsets.c7
-rw-r--r--test/dtypes.c2
13 files changed, 165 insertions, 39 deletions
diff --git a/RELEASE b/RELEASE
index 6904651..2456a5c 100644
--- a/RELEASE
+++ b/RELEASE
@@ -10,6 +10,11 @@ The following functions are implemented. Errors are returned if an
attempt is made to use some feature which is not implemented and
printing the error stack will show `not implemented yet'.
+Library
+ H5dont_atexit - don't call library close on exit
+ H5init - initialize library (happens automatically)
+ H5version - retrieve library version info
+
Templates
H5Cclose - release template resources
H5Ccopy - copy a template
diff --git a/bin/checkposix b/bin/checkposix
index aaf9169..229a106 100755
--- a/bin/checkposix
+++ b/bin/checkposix
@@ -42,11 +42,11 @@ while (<>) {
# Ignore C statements that look sort of like function
# calls.
- next if $name =~ /^(if|for|return|sizeof|switch|while)$/;
+ next if $name =~ /^(if|for|return|sizeof|switch|while|void)$/;
# These are really HDF5 functions/macros even though they don't
# start with `h' or `H'.
- next if $name =~ /^FUNC_(ENTER|LEAVE)$/;
+ next if $name =~ /^FUNC_(ENTER|LEAVE)(_INIT)?$/;
next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)$/;
next if $name =~ /^(MIN|MAX3?|NELMTS|BOUND|CONSTR)$/;
diff --git a/src/H5.c b/src/H5.c
index abbc54d..30a33e0 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -142,7 +142,7 @@ H5_add_exit(void (*func) (void))
PURPOSE
Terminate various static buffers and shutdown the library.
USAGE
- void HPend()
+ void H5_term_library()
RETURNS
SUCCEED/FAIL
DESCRIPTION
@@ -322,7 +322,7 @@ H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum)
}
/*-------------------------------------------------------------------------
- * Function: H5init
+ * Function: H5open
*
* Purpose: Initialize the library. This is normally called
* automatically, but if you find that an HDF5 library function
@@ -341,9 +341,38 @@ H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum)
*-------------------------------------------------------------------------
*/
herr_t
-H5init(void)
+H5open(void)
{
- FUNC_ENTER(H5init, FAIL);
+ FUNC_ENTER(H5open, FAIL);
/* all work is done by FUNC_ENTER() */
FUNC_LEAVE(SUCCEED);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5close
+ *
+ * Purpose: Terminate the library and release all resources.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Friday, January 30, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5close (void)
+{
+ /*
+ * Don't call FUNC_ENTER() since we don't want to initialize the whole
+ * thing just to release it all right away. It is safe to call this
+ * function for an uninitialized library.
+ */
+ H5_term_library ();
+ return SUCCEED;
+}
diff --git a/src/H5F.c b/src/H5F.c
index a07e134..d6098fc 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -126,7 +126,8 @@ H5F_init_interface(void)
FUNC_ENTER(H5F_init_interface, FAIL);
/* Initialize the atom group for the file IDs */
- if ((ret_value = H5A_init_group(H5_FILE, H5A_FILEID_HASHSIZE, 0, NULL)) != FAIL)
+ if ((ret_value = H5A_init_group(H5_FILE, H5A_FILEID_HASHSIZE, 0,
+ (herr_t (*)(void*))H5Fclose)) != FAIL)
ret_value = H5_add_exit(&H5F_term_interface);
FUNC_LEAVE(ret_value);
diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c
index 09f61bc..f4e076d 100644
--- a/src/H5Fstdio.c
+++ b/src/H5Fstdio.c
@@ -16,7 +16,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#define PABLO_MASK H5F_sec2
+#define PABLO_MASK H5F_stdio
static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index a42ec8f..aa4c710 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -103,7 +103,7 @@ hbool_t H5P_is_simple (const H5P_t *sdim);
uintn H5P_nelem (const H5P_t *space);
const H5P_conv_t *H5P_find (const H5P_t *mem_space, const H5P_t *file_space);
intn H5P_get_hyperslab (const H5P_t *ds, int offset[]/*out*/,
- int size[]/*out*/, int stride[]/*out*/);
+ size_t size[]/*out*/, size_t stride[]/*out*/);
/* Conversion functions for simple data spaces */
size_t H5P_simp_init (const struct H5O_layout_t *layout,
diff --git a/src/H5Psimp.c b/src/H5Psimp.c
index 60f9bd6..c0e0c36 100644
--- a/src/H5Psimp.c
+++ b/src/H5Psimp.c
@@ -93,6 +93,9 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+#ifndef LATER
+ intn file_offset_signed[H5O_LAYOUT_NDIMS];
+#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -120,10 +123,22 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
+#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset,
hsize, sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
+#else
+ if ((space_ndims=H5P_get_hyperslab (file_space, file_offset_signed,
+ hsize, sample))<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
+ "unable to retrieve hyperslab parameters");
+ }
+ for (i=0; i<space_ndims; i++) {
+ assert (file_offset_signed[i]>=0);
+ file_offset[i] = file_offset_signed[i];
+ }
+#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, 0,
@@ -176,6 +191,9 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+#ifndef LATER
+ intn mem_offset_signed[H5O_LAYOUT_NDIMS];
+#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -201,11 +219,23 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
+#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
+#else
+ if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset_signed,
+ hsize, sample))<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
+ "unable to retrieve hyperslab parameters");
+ }
+ for (i=0; i<space_ndims; i++) {
+ assert (mem_offset_signed[i]>=0);
+ mem_offset[i] = mem_offset_signed[i];
+ }
+#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -266,6 +296,9 @@ H5P_simp_mgath (const void *buf, size_t elmt_size,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+#ifndef LATER
+ intn mem_offset_signed[H5O_LAYOUT_NDIMS];
+#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@@ -291,11 +324,23 @@ H5P_simp_mgath (const void *buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
+#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
+#else
+ if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset_signed,
+ hsize, sample))<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
+ "unable to retrieve hyperslab parameters");
+ }
+ for (i=0; i<space_ndims; i++) {
+ assert (mem_offset_signed[i]>=0);
+ mem_offset[i] = mem_offset_signed[i];
+ }
+#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, 0,
@@ -355,6 +400,9 @@ H5P_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
+#ifndef LATER
+ intn file_offset_signed[H5O_LAYOUT_NDIMS];
+#endif
intn space_ndims; /*space dimensionality */
intn i; /*counters */
@@ -382,11 +430,23 @@ H5P_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
+#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
+#else
+ if ((space_ndims=H5P_get_hyperslab (file_space, file_offset_signed,
+ hsize, sample))<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
+ "unable to retrieve hyperslab parameters");
+ }
+ for (i=0; i<space_ndims; i++) {
+ assert (file_offset_signed[i]>=0);
+ file_offset[i] = file_offset_signed[i];
+ }
+#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
diff --git a/src/H5T.c b/src/H5T.c
index 74a93af..97a7fac 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -309,6 +309,32 @@ H5T_term_interface(void)
}
H5A_destroy_group(H5_DATATYPE);
+ H5T_NATIVE_CHAR_g = FAIL;
+ H5T_NATIVE_UCHAR_g = FAIL;
+ H5T_NATIVE_SHORT_g = FAIL;
+ H5T_NATIVE_USHORT_g = FAIL;
+ H5T_NATIVE_INT_g = FAIL;
+ H5T_NATIVE_UINT_g = FAIL;
+ H5T_NATIVE_LONG_g = FAIL;
+ H5T_NATIVE_LLONG_g = FAIL;
+ H5T_NATIVE_ULLONG_g = FAIL;
+ H5T_NATIVE_HYPER_g = FAIL;
+ H5T_NATIVE_UHYPER_g = FAIL;
+ H5T_NATIVE_INT8_g = FAIL;
+ H5T_NATIVE_UINT8_g = FAIL;
+ H5T_NATIVE_INT16_g = FAIL;
+ H5T_NATIVE_UINT16_g = FAIL;
+ H5T_NATIVE_INT32_g = FAIL;
+ H5T_NATIVE_UINT32_g = FAIL;
+ H5T_NATIVE_INT64_g = FAIL;
+ H5T_NATIVE_UINT64_g = FAIL;
+ H5T_NATIVE_ULONG_g = FAIL;
+ H5T_NATIVE_FLOAT_g = FAIL;
+ H5T_NATIVE_DOUBLE_g = FAIL;
+ H5T_NATIVE_TIME_g = FAIL;
+ H5T_NATIVE_STRING_g = FAIL;
+ H5T_NATIVE_BITFIELD_g = FAIL;
+ H5T_NATIVE_OPAQUE_g = FAIL;
}
/*-------------------------------------------------------------------------
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 03becfa..1515206 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -121,32 +121,32 @@ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, void *buf, void *bkg);
/* The predefined types */
-#define H5T_NATIVE_CHAR (H5init(), H5T_NATIVE_CHAR_g)
-#define H5T_NATIVE_UCHAR (H5init(), H5T_NATIVE_UCHAR_g)
-#define H5T_NATIVE_SHORT (H5init(), H5T_NATIVE_SHORT_g)
-#define H5T_NATIVE_USHORT (H5init(), H5T_NATIVE_USHORT_g)
-#define H5T_NATIVE_INT (H5init(), H5T_NATIVE_INT_g)
-#define H5T_NATIVE_UINT (H5init(), H5T_NATIVE_UINT_g)
-#define H5T_NATIVE_LONG (H5init(), H5T_NATIVE_LONG_g)
-#define H5T_NATIVE_ULONG (H5init(), H5T_NATIVE_ULONG_g)
-#define H5T_NATIVE_LLONG (H5init(), H5T_NATIVE_LLONG_g)
-#define H5T_NATIVE_ULLONG (H5init(), H5T_NATIVE_ULLONG_g)
-#define H5T_NATIVE_HYPER (H5init(), H5T_NATIVE_HYPER_g)
-#define H5T_NATIVE_UHYPER (H5init(), H5T_NATIVE_UHYPER_g)
-#define H5T_NATIVE_INT8 (H5init(), H5T_NATIVE_INT8_g)
-#define H5T_NATIVE_UINT8 (H5init(), H5T_NATIVE_UINT8_g)
-#define H5T_NATIVE_INT16 (H5init(), H5T_NATIVE_INT16_g)
-#define H5T_NATIVE_UINT16 (H5init(), H5T_NATIVE_UINT16_g)
-#define H5T_NATIVE_INT32 (H5init(), H5T_NATIVE_INT32_g)
-#define H5T_NATIVE_UINT32 (H5init(), H5T_NATIVE_UINT32_g)
-#define H5T_NATIVE_INT64 (H5init(), H5T_NATIVE_INT64_g)
-#define H5T_NATIVE_UINT64 (H5init(), H5T_NATIVE_UINT64_g)
-#define H5T_NATIVE_FLOAT (H5init(), H5T_NATIVE_FLOAT_g)
-#define H5T_NATIVE_DOUBLE (H5init(), H5T_NATIVE_DOUBLE_g)
-#define H5T_NATIVE_TIME (H5init(), H5T_NATIVE_TIME_g)
-#define H5T_NATIVE_STRING (H5init(), H5T_NATIVE_STRING_g)
-#define H5T_NATIVE_BITFIELD (H5init(), H5T_NATIVE_BITFIELD_g)
-#define H5T_NATIVE_OPAQUE (H5init(), H5T_NATIVE_OPAQUE_g)
+#define H5T_NATIVE_CHAR (H5open(), H5T_NATIVE_CHAR_g)
+#define H5T_NATIVE_UCHAR (H5open(), H5T_NATIVE_UCHAR_g)
+#define H5T_NATIVE_SHORT (H5open(), H5T_NATIVE_SHORT_g)
+#define H5T_NATIVE_USHORT (H5open(), H5T_NATIVE_USHORT_g)
+#define H5T_NATIVE_INT (H5open(), H5T_NATIVE_INT_g)
+#define H5T_NATIVE_UINT (H5open(), H5T_NATIVE_UINT_g)
+#define H5T_NATIVE_LONG (H5open(), H5T_NATIVE_LONG_g)
+#define H5T_NATIVE_ULONG (H5open(), H5T_NATIVE_ULONG_g)
+#define H5T_NATIVE_LLONG (H5open(), H5T_NATIVE_LLONG_g)
+#define H5T_NATIVE_ULLONG (H5open(), H5T_NATIVE_ULLONG_g)
+#define H5T_NATIVE_HYPER (H5open(), H5T_NATIVE_HYPER_g)
+#define H5T_NATIVE_UHYPER (H5open(), H5T_NATIVE_UHYPER_g)
+#define H5T_NATIVE_INT8 (H5open(), H5T_NATIVE_INT8_g)
+#define H5T_NATIVE_UINT8 (H5open(), H5T_NATIVE_UINT8_g)
+#define H5T_NATIVE_INT16 (H5open(), H5T_NATIVE_INT16_g)
+#define H5T_NATIVE_UINT16 (H5open(), H5T_NATIVE_UINT16_g)
+#define H5T_NATIVE_INT32 (H5open(), H5T_NATIVE_INT32_g)
+#define H5T_NATIVE_UINT32 (H5open(), H5T_NATIVE_UINT32_g)
+#define H5T_NATIVE_INT64 (H5open(), H5T_NATIVE_INT64_g)
+#define H5T_NATIVE_UINT64 (H5open(), H5T_NATIVE_UINT64_g)
+#define H5T_NATIVE_FLOAT (H5open(), H5T_NATIVE_FLOAT_g)
+#define H5T_NATIVE_DOUBLE (H5open(), H5T_NATIVE_DOUBLE_g)
+#define H5T_NATIVE_TIME (H5open(), H5T_NATIVE_TIME_g)
+#define H5T_NATIVE_STRING (H5open(), H5T_NATIVE_STRING_g)
+#define H5T_NATIVE_BITFIELD (H5open(), H5T_NATIVE_BITFIELD_g)
+#define H5T_NATIVE_OPAQUE (H5open(), H5T_NATIVE_OPAQUE_g)
#ifdef __cplusplus
extern "C" {
diff --git a/src/H5public.h b/src/H5public.h
index 336c624..7436cc2 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -104,7 +104,8 @@ extern "C" {
#endif
/* Functions in H5.c */
-herr_t H5init (void);
+herr_t H5open (void);
+herr_t H5close (void);
herr_t H5dont_atexit (void);
herr_t H5version (uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum);
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index dc2231b..489d8f4 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -397,7 +397,6 @@ STEP 8: Read middle third hyperslab into memory array.\n");
/* Create memory data space */
s8_m_sid = H5Pcreate_simple (2, h_size);
assert (s8_m_sid>=0);
- }
/* Read the dataset */
s8 = calloc (h_size[0]*h_size[1], sizeof(s1_t));
diff --git a/test/dsets.c b/test/dsets.c
index edb951d..58bfc4c 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -366,6 +366,9 @@ main(void)
herr_t status;
intn nerrors = 0;
+ status = H5open ();
+ assert (status>=0);
+
unlink("dataset.h5");
file = H5Fcreate("dataset.h5", H5ACC_DEFAULT, H5C_DEFAULT, H5C_DEFAULT);
assert(file >= 0);
@@ -391,5 +394,9 @@ main(void)
exit(1);
}
printf("All dataset tests passed.\n");
+
+ status = H5close ();
+ assert (status>=0);
+
exit(0);
}
diff --git a/test/dtypes.c b/test/dtypes.c
index 056734f..707fe29 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -215,8 +215,6 @@ main(void)
herr_t status;
intn nerrors = 0;
- H5init();
-
status = test_classes();
nerrors += status < 0 ? 1 : 0;