diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-01-30 19:25:44 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-01-30 19:25:44 (GMT) |
commit | b227b388533896337f436f01763ad26def14844c (patch) | |
tree | 4771c187539c0f8bd36572914b63b0137fde2ea8 /src | |
parent | 0a7b2071a0589bef1abf8fd1b2f7cd470312d7f9 (diff) | |
download | hdf5-b227b388533896337f436f01763ad26def14844c.zip hdf5-b227b388533896337f436f01763ad26def14844c.tar.gz hdf5-b227b388533896337f436f01763ad26def14844c.tar.bz2 |
[svn-r204] Changes since 19980129
----------------------
./RELEASE
Added Library functions that I missed the first time.
./html/Datasets.html
Added an example for Elena's question about how to read a
single member of a compound data type so it becomes an array
of that member in memory.
./src/H5Pprivate.h
Fixed the prototype for H5P_get_hyperslab() to match the
definition.
./src/H5Psimp.c
Oops, added the kludge back in for the offset argument, which
is still an `intn' instead of a `size_t'.
./src/H5.c
./src/H5public.h
./src/H5F.c
./src/H5T.c
./src/H5Tpublic.h
Changed H5init() to H5open() and added an H5close() to fit our
create/open/close paradigm. The H5open() happens
automatically on the first call to the HDF5 library. The
H5close() happens automatically on exit() (unless the app
turns off that feature). H5close() closes all datasets and
files and releases all resources used by the library.
./test/dsets.c
Added calls to H5open() and H5close() to test them.
./test/dtypes.c
Removed call to H5init() since we no longer need it there.
./src/H5Fstdio.c
Changed the PABLO_MASK to the right value. Thanks Kim.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 37 | ||||
-rw-r--r-- | src/H5F.c | 3 | ||||
-rw-r--r-- | src/H5Fstdio.c | 2 | ||||
-rw-r--r-- | src/H5Pprivate.h | 2 | ||||
-rw-r--r-- | src/H5Psimp.c | 60 | ||||
-rw-r--r-- | src/H5T.c | 26 | ||||
-rw-r--r-- | src/H5Tpublic.h | 52 | ||||
-rw-r--r-- | src/H5public.h | 3 |
8 files changed, 151 insertions, 34 deletions
@@ -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; +} @@ -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, @@ -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); |