diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-04-22 17:26:01 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-04-22 17:26:01 (GMT) |
commit | 1c1679b2d43a14170ee6759f578a2ecad4ab56c1 (patch) | |
tree | e8462f942e88374904821fd56557fba95c99ba6d | |
parent | 91a34f543da20aee0de3ad2ec2cc58f86750bcf6 (diff) | |
download | hdf5-1c1679b2d43a14170ee6759f578a2ecad4ab56c1.zip hdf5-1c1679b2d43a14170ee6759f578a2ecad4ab56c1.tar.gz hdf5-1c1679b2d43a14170ee6759f578a2ecad4ab56c1.tar.bz2 |
[svn-r356] Changes since 19980421
----------------------
./bin/release
./src/H5.c
./src/H5private.h
./src/H5public.h
./src/H5Fpublic.h
Changed the version number constants to names that begin with
H5_VERS_ and added macros that check that the version numbers
in the include files match the version number of the library.
./MANIFEST
./html/H5.user.html
./html/Version.html [NEW]
./html/version.obj [NEW]
./html/version.gif [NEW]
Documented version numbers and the macros, constants, and
functions associated with them.
./bin/versinc
A perl script that increments the minor version number and
sets the patch level back to zero. This is intended to be
invoked from the top of the source tree by a cvs commit
anywhere in the source tree. Quincey?
./src/H5O.c
./src/H5Oprivate.h
Added H5O_count() to count the number of object header
messages of a particular type. Quincey needs this for the
attribute package.
./test/dsets.c
Fixed warnings. Enabled the small strip-mine buffer test.
./config/linux
Added optimizations for the Pentium-Pro for production mode.
-rw-r--r-- | INSTALL | 5 | ||||
-rw-r--r-- | MANIFEST | 3 | ||||
-rwxr-xr-x | bin/release | 22 | ||||
-rw-r--r-- | config/linux | 19 | ||||
-rw-r--r-- | src/H5.c | 65 | ||||
-rw-r--r-- | src/H5Fpublic.h | 16 | ||||
-rw-r--r-- | src/H5O.c | 46 | ||||
-rw-r--r-- | src/H5Oprivate.h | 1 | ||||
-rw-r--r-- | src/H5T.c | 6 | ||||
-rw-r--r-- | src/H5private.h | 6 | ||||
-rw-r--r-- | src/H5public.h | 11 | ||||
-rw-r--r-- | test/dsets.c | 14 |
12 files changed, 163 insertions, 51 deletions
@@ -13,6 +13,11 @@ can do the following: $ make install # Optional +Step 0: Install optional third-party packages. + + * GNU zlib compression library, version 1.0.2 or later is used for + the `deflate' compression method. + Step 1. Unpack the source tree. * The tarball will unpack into an hdf5-1.0.0a directory with one of @@ -60,6 +60,7 @@ ./html/MemoryManagement.html ./html/ObjectHeader.txt ./html/Properties.html +./html/Version.html ./html/chunk1.gif ./html/chunk1.obj ./html/compat.html @@ -103,6 +104,8 @@ ./html/study_p1.gif ./html/study_p1.obj ./html/symtab +./html/version.gif +./html/version.obj ./src/.distdep ./src/.indent.pro ./src/H5.c diff --git a/bin/release b/bin/release index 010acbb..8a476f7 100755 --- a/bin/release +++ b/bin/release @@ -21,12 +21,12 @@ $releases = "./releases"; # Directory for release tarballs sub getver () { my @ver; - open SRC, "./src/H5private.h" or die "cannot read HDF5 version"; + open SRC, "./src/H5public.h" or die "cannot read HDF5 version"; while (<SRC>) { - $ver[0] = $1 if /define\s+HDF5_MAJOR_VERSION\s+(\d+)/; - $ver[1] = $1 if /define\s+HDF5_MINOR_VERSION\s+(\d+)/; - $ver[2] = $1 if /define\s+HDF5_RELEASE_VERSION\s+(\d+)/; - $ver[3] = $1 if /define\s+HDF5_PATCH_VERSION\s+(\d+)/; + $ver[0] = $1 if /define\s+H5_VERS_MAJOR\s+(\d+)/; + $ver[1] = $1 if /define\s+H5_VERS_MINOR\s+(\d+)/; + $ver[2] = $1 if /define\s+H5_VERS_RELEASE\s+(\d+)/; + $ver[3] = $1 if /define\s+H5_VERS_PATCH\s+(\d+)/; } close SRC; wantarray ? @ver : "$ver[0].$ver[1].$ver[2]".chr(ord('a')+$ver[3]); @@ -44,12 +44,12 @@ sub setver ($;$$$) { $ver[3] = ord($ver[3])-ord('a'); } - $_ = `cat ./src/H5private.h`; - s/(define\s+HDF5_MAJOR_VERSION\s+)(\d+)/$1$ver[0]/; - s/(define\s+HDF5_MINOR_VERSION\s+)(\d+)/$1$ver[1]/; - s/(define\s+HDF5_RELEASE_VERSION\s+)(\d+)/$1$ver[2]/; - s/(define\s+HDF5_PATCH_VERSION\s+)(\d+)/$1$ver[3]/; - open SRC, "> ./src/H5private.h" or return ""; + $_ = `cat ./src/H5public.h`; + s/(define\s+H5_VERS_MAJOR\s+)(\d+)/$1$ver[0]/; + s/(define\s+H5_VERS_MINOR\s+)(\d+)/$1$ver[1]/; + s/(define\s+H5_VERS_RELEASE\s+)(\d+)/$1$ver[2]/; + s/(define\s+H5_VERS_PATCH\s+)(\d+)/$1$ver[3]/; + open SRC, "> ./src/H5public.h" or return ""; print SRC $_; close SRC; diff --git a/config/linux b/config/linux index 870aa3b..5aab032 100644 --- a/config/linux +++ b/config/linux @@ -10,15 +10,6 @@ # flags like `-DH5G_DEBUG' since these are added with the # `--enable-debug' switch of configure. CC=${CC:-gcc} - -# What must *always* be present for things to compile correctly? -CFLAGS="$CFLAGS -ansi" -#CPPFLAGS="$CPPFLAGS -I." - -# What compiler flags should be used for code development? -DEBUG_CFLAGS="-g -fverbose-asm" -DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" - case `$CC -v 2>&1 |tail -1 |sed 's/gcc version //'` in 2.7.*) echo "You have an old version of gcc, please upgrade to 2.8.1 or better" @@ -28,9 +19,17 @@ case `$CC -v 2>&1 |tail -1 |sed 's/gcc version //'` in ;; esac +# What must *always* be present for things to compile correctly? +CFLAGS="$CFLAGS -ansi" +#CPPFLAGS="$CPPFLAGS -I." + +# What compiler flags should be used for code development? +DEBUG_CFLAGS="-g -fverbose-asm" +DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + # What compiler flags should be used for building a production # library? -PROD_CFLAGS="-O3 -finline-functions -malign-double -fomit-frame-pointer" +PROD_CFLAGS="-O3 -finline-functions -malign-double -fomit-frame-pointer -march=pentiumpro -fschedule-insns2" PROD_CPPFLAGS= # What compiler flags enable code profiling? @@ -312,13 +312,58 @@ H5version(unsigned *majnum, unsigned *minnum, unsigned *relnum, FUNC_ENTER(H5version, FAIL); /* Set the version information */ - if (majnum) *majnum = HDF5_MAJOR_VERSION; - if (minnum) *minnum = HDF5_MINOR_VERSION; - if (relnum) *relnum = HDF5_RELEASE_VERSION; - if (patnum) *patnum = HDF5_PATCH_VERSION; + if (majnum) *majnum = H5_VERS_MAJOR; + if (minnum) *minnum = H5_VERS_MINOR; + if (relnum) *relnum = H5_VERS_RELEASE; + if (patnum) *patnum = H5_VERS_PATCH; FUNC_LEAVE(ret_value); } + + +/*------------------------------------------------------------------------- + * Function: H5vers_check + * + * Purpose: Verifies that the arguments match the version numbers + * compiled into the library. This function is intended to be + * called from user to verify that the versions of header files + * compiled into the application match the version of the hdf5 + * library. + * + * Return: Success: SUCCEED + * + * Failure: abort() + * + * Programmer: Robb Matzke + * Tuesday, April 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5vers_check (unsigned majnum, unsigned minnum, unsigned relnum, + unsigned patnum) +{ + /* Don't initialize the library quite yet */ + + if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum || + H5_VERS_RELEASE!=relnum || H5_VERS_PATCH!=patnum) { + fputs ("Warning! The HDF5 header files included by this application " + "do not match the\nversion used by the HDF5 library to which " + "this application is linked. Data\ncorruption or segmentation " + "faults would be likely if the application were\nallowed to " + "continue.\n", stderr); + fprintf (stderr, "Headers are %u.%u.%u%c, library is %u.%u.%u%c\n", + majnum, minnum, relnum, 'a'+patnum, + H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, + 'a'+H5_VERS_PATCH); + fputs ("Bye...\n", stderr); + abort (); + } + return SUCCEED; +} + /*------------------------------------------------------------------------- * Function: H5open @@ -792,8 +837,10 @@ H5_timer_begin (H5_timer_t *timer) #ifdef HAVE_GETRUSAGE getrusage (RUSAGE_SELF, &rusage); - timer->utime = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec/1e6; - timer->stime = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec/1e6; + timer->utime = (double)rusage.ru_utime.tv_sec + + (double)rusage.ru_utime.tv_usec/1e6; + timer->stime = (double)rusage.ru_stime.tv_sec + + (double)rusage.ru_stime.tv_usec/1e6; #else timer->utime = 0.0; timer->stime = 0.0; @@ -830,9 +877,9 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/) assert (timer); H5_timer_begin (&now); - timer->utime = now.utime - timer->utime; - timer->stime = now.stime - timer->stime; - timer->etime = now.etime - timer->etime; + timer->utime = MAX(0.0, now.utime - timer->utime); + timer->stime = MAX(0.0, now.stime - timer->stime); + timer->etime = MAX(0.0, now.etime - timer->etime); if (sum) { sum->utime += timer->utime; diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index cfce784..2f79a6e 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -23,13 +23,17 @@ /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine - * them as needed. + * them as needed. As a side effect, they call H5vers_check() to make sure + * that the application is compiled with a version of the hdf5 header files + * which are compatible with the library to which the application is linked. + * We're assuming that these constants are used rather early in the hdf5 + * session. */ -#define H5F_ACC_RDONLY 0x0000u /*absence of write implies read only */ -#define H5F_ACC_RDWR 0x0001u /*open file for reading and writing */ -#define H5F_ACC_TRUNC 0x0002u /*overwrite existing files during create*/ -#define H5F_ACC_EXCL 0x0004u /*create fails if file already exists */ -#define H5F_ACC_DEBUG 0x0008u /*print debug info */ +#define H5F_ACC_RDONLY (H5check(),0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5check(),0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5check(),0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5check(),0x0004u) /*fail if file already exists*/ +#define H5F_ACC_DEBUG (H5check(),0x0008u) /*print debug info */ #ifdef LATER @@ -732,6 +732,52 @@ H5O_link(H5G_entry_t *ent, intn adjust) /*------------------------------------------------------------------------- + * Function: H5O_count + * + * Purpose: Counts the number of messages in an object header which are a + * certain type. + * + * Return: Success: Number of messages of specified type. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, April 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5O_count (H5G_entry_t *ent, const H5O_class_t *type) +{ + H5O_t *oh = NULL; + intn i, acc; + + FUNC_ENTER (H5O_count, FAIL); + + /* Check args */ + assert (ent); + assert (ent->file); + assert (H5F_addr_defined (&(ent->header))); + assert (type); + + /* Load the object header */ + if (NULL==(oh=H5AC_find (ent->file, H5AC_OHDR, &(ent->header), + NULL, NULL))) { + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); + } + + for (i=acc=0; i<oh->nmesgs; i++) { + if (oh->mesg[i].type==type) acc++; + } + + FUNC_LEAVE (acc); +} + + +/*------------------------------------------------------------------------- * Function: H5O_read * * Purpose: Reads a message from an object header and returns a pointer diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index d3836f4..bd4503e 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -232,6 +232,7 @@ herr_t H5O_create (H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/); herr_t H5O_open (H5G_entry_t *ent); herr_t H5O_close (H5G_entry_t *ent); intn H5O_link (H5G_entry_t *ent, intn adjust); +intn H5O_count (H5G_entry_t *ent, const H5O_class_t *type); void *H5O_read (H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg); intn H5O_modify (H5G_entry_t *ent, const H5O_class_t *type, intn overwrite, @@ -3600,9 +3600,10 @@ H5T_timer_begin (H5_timer_t *timer, H5T_cdata_t *cdata) { assert (timer); assert (cdata); +#ifdef H5T_DEBUG assert (cdata->stats); - H5_timer_begin (timer); +#endif } @@ -3625,11 +3626,12 @@ H5T_timer_end (H5_timer_t *timer, H5T_cdata_t *cdata, size_t nelmts) { assert (timer); assert (cdata); +#ifdef H5T_DEBUG assert (cdata->stats); - H5_timer_end (&(cdata->stats->timer), timer); cdata->stats->ncalls++; cdata->stats->nelmts += nelmts; +#endif } diff --git a/src/H5private.h b/src/H5private.h index 328f907..3d3ca3d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -21,12 +21,6 @@ #define _H5private_H #include <H5public.h> /* Include Public Definitions */ -/* Version #'s of library code */ -#define HDF5_MAJOR_VERSION 1 /* For major interface changes */ -#define HDF5_MINOR_VERSION 0 /* For minor interface changes */ -#define HDF5_RELEASE_VERSION 1 /* For interface tweaks & bug-fixes */ -#define HDF5_PATCH_VERSION 0 /* For small groups of bug fixes */ - /* Version #'s of the major components of the file format */ #define HDF5_BOOTBLOCK_VERSION 0 /* of the boot block format */ #define HDF5_FREESPACE_VERSION 0 /* of the Free-Space Info */ diff --git a/src/H5public.h b/src/H5public.h index fbf96eb..81bbe17 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -23,6 +23,15 @@ # include <mpio.h> #endif +/* Version numbers */ +#define H5_VERS_MAJOR 1 /* For major interface changes */ +#define H5_VERS_MINOR 0 /* For minor interface changes */ +#define H5_VERS_RELEASE 2 /* For interface tweaks & bug-fixes */ +#define H5_VERS_PATCH 0 /* For small groups of bug fixes */ + +#define H5check() H5vers_check(H5_VERS_MAJOR,H5_VERS_MINOR,\ + H5_VERS_RELEASE, H5_VERS_PATCH) + /* * Status return values. Failed integer functions in HDF5 result almost * always in a negative value (unsigned failing functions sometimes return @@ -64,6 +73,8 @@ herr_t H5close (void); herr_t H5dont_atexit (void); herr_t H5version (unsigned *majnum, unsigned *minnum, unsigned *relnum, unsigned *patnum); +herr_t H5vers_check (unsigned majnum, unsigned minnum, unsigned relnum, + unsigned patnum); #ifdef __cplusplus } diff --git a/test/dsets.c b/test/dsets.c index a341abe..8ea23bf 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -372,10 +372,9 @@ test_tconv(hid_t file) *------------------------------------------------------------------------- */ static size_t -bogus (unsigned int flags, - size_t cd_size, const void *client_data, - size_t src_nbytes, const void *src, - size_t dst_nbytes, void *dst/*out*/) +bogus (unsigned int __unused__ flags, size_t __unused__ cd_size, + const void __unused__ *client_data, size_t src_nbytes, const void *src, + size_t __unused__ dst_nbytes, void *dst/*out*/) { memcpy (dst, src, src_nbytes); return src_nbytes; @@ -419,14 +418,15 @@ test_compression(hid_t file) space = H5Screate_simple(2, size, NULL); assert(space>=0); - /* Create a small conversion buffer to test strip mining */ + /* + * Create a small conversion buffer to test strip mining. We + * might as well test all we can! + */ xfer = H5Pcreate (H5P_DATASET_XFER); assert (xfer>=0); -#if 0 tconv_buf = malloc (1000); status = H5Pset_buffer (xfer, 1000, tconv_buf, NULL); assert (status>=0); -#endif /* Use chunked storage with compression */ dc = H5Pcreate (H5P_DATASET_CREATE); |