summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-03 03:29:38 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-03 03:29:38 (GMT)
commita780cdd178f849afbc8cbb24e416eef733cbc9f2 (patch)
treec9e0162ab42567a4872a5c37444be0e08d4c1914
parent2a77c19b2216f04a6f8c50995ca0bf09f69e63d0 (diff)
downloadhdf5-a780cdd178f849afbc8cbb24e416eef733cbc9f2.zip
hdf5-a780cdd178f849afbc8cbb24e416eef733cbc9f2.tar.gz
hdf5-a780cdd178f849afbc8cbb24e416eef733cbc9f2.tar.bz2
[svn-r335] Changes since 19980330
---------------------- ./MANIFEST ./src/Makefile.in ./test/Makefile.in Added new files. ./config/linux ./src/H5HL.c ./src/H5HLprivate.h ./src/H5MF.c ./src/H5MFprivate.h Added `-DH5HL_DEBUG -DH5MF_DEBUG' to the debug list. ./html/H5.format.html Updated shared object message information. ./src/H5D.c Datasets can now share data types. ./src/H5F.c Updated a comment that referred to H5ACC_WRITE. ./src/H5HG.c ./src/H5HGprivate.h Moved a few things around. Made debugging better so you can now give a collection address to ./src/debug and it shows some useful stuff. ./src/H5O.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Olayout.c ./src/H5Oname.c ./src/H5Onull.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c [NEW] ./src/H5Ostab.c Supports shared messages. ./src/H5T.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5Tpublic.h The H5Tshare() function allows the user to give the library hints about how a data type will be used. ./test/shtype.c Tests the H5Tshare() function. ./test/gheap.c Tests the global heap. ./configure.in ./config/BlankForm [NEW] ./config/alpha-dec ./config/freebsd2.2.1 ./config/hpux10.20 ./config/irix6.2 ./config/irix64 ./config/linux ./config/powerpc-ibm-aix4.2.1.0 ./config/rs6000-ibm-aix4.1.4.0 ./config/solaris2.5 Cleaned up lots of configuration stuff and made the site configuration files lots easier and more uniform. To make a new file grab the BlankForm and modify it. By default, debugging is turned on for most packages. Within a package one can use `#ifdef H5AC_DEBUG' to wrap debugging code. Other options are: --enable-debug --enable-debug=yes The default, most but not all packages. --disable-debug --enable-debug=no --enable-debug=none The symbol NDEBUG is defined and none of the package debug symbols. --enable-debug=all Debugging is turned on for all packages. This might produce lots of output. --enable-debug=g,d Debugging is turned on for H5G and H5D. A compile mode is also now supported --enable-production --enable-production=yes The library is compiled with optimizations turned on. The compiler flags are augmented by adding PROD_CFLAGS and PROD_CPPFLAGS which are defined in the site config file. --disable-production --enable-production=no The default. The library is compiled for development by including DEBUG_CFLAGS and DEBUG_CPPFLAGS defined in the site config file. This is usually just `-g'. --enable-production=profile --enable-production=pg Builds a library for profiling by including the flags from PROFILE_CFLAGS and PROFILE_CPPFLAGS defined in the site config file. This is usullay just `-pg' but it could include optimization flags as well depending on the type of profile one wants. In summary, configure by saying `./configure' and you'll get a development version of the library. Configure by saying `./configure --enable-production --disable-debug' and you'll get a production version with no debugging code.
-rw-r--r--MANIFEST3
-rw-r--r--config/BlankForm43
-rw-r--r--config/alpha-dec74
-rw-r--r--config/freebsd2.2.158
-rw-r--r--config/hpux10.2040
-rw-r--r--config/irix6.240
-rw-r--r--config/irix6469
-rw-r--r--config/linux95
-rw-r--r--config/powerpc-ibm-aix4.2.1.040
-rw-r--r--config/rs6000-ibm-aix4.1.4.040
-rw-r--r--config/solaris2.543
-rwxr-xr-xconfigure265
-rw-r--r--configure.in67
-rw-r--r--src/H5AC.c4
-rw-r--r--src/H5B.c2
-rw-r--r--src/H5D.c19
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5Ffamily.c10
-rw-r--r--src/H5Flow.c8
-rw-r--r--src/H5HG.c66
-rw-r--r--src/H5HGprivate.h23
-rw-r--r--src/H5HL.c44
-rw-r--r--src/H5HLprivate.h8
-rw-r--r--src/H5MF.c2
-rw-r--r--src/H5MFprivate.h8
-rw-r--r--src/H5O.c374
-rw-r--r--src/H5Ocont.c15
-rw-r--r--src/H5Odtype.c93
-rw-r--r--src/H5Oefl.c12
-rw-r--r--src/H5Olayout.c15
-rw-r--r--src/H5Oname.c34
-rw-r--r--src/H5Onull.c1
-rw-r--r--src/H5Oprivate.h45
-rw-r--r--src/H5Osdspace.c13
-rw-r--r--src/H5Oshared.c184
-rw-r--r--src/H5Ostab.c13
-rw-r--r--src/H5T.c562
-rw-r--r--src/H5Tconv.c6
-rw-r--r--src/H5Tpkg.h3
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Tpublic.h1
-rw-r--r--src/Makefile.in2
-rw-r--r--test/.distdep37
-rw-r--r--test/Makefile.in15
-rw-r--r--test/gheap.c398
45 files changed, 2161 insertions, 743 deletions
diff --git a/MANIFEST b/MANIFEST
index e3a7e89..9bfacae 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -15,6 +15,7 @@
./bin/errors
./bin/install-sh
./bin/release
+./config/BlankForm
./config/alpha-dec
./config/commence.in
./config/conclude.in
@@ -158,6 +159,7 @@
./src/H5Oprivate.h
./src/H5Opublic.h
./src/H5Osdspace.c
+./src/H5Oshared.c
./src/H5Ostab.c
./src/H5P.c
./src/H5Pprivate.h
@@ -189,6 +191,7 @@
./test/dtypes.c
./test/extend.c
./test/external.c
+./test/gheap.c
./test/hyperslab.c
./test/iopipe.c
./test/istore.c
diff --git a/config/BlankForm b/config/BlankForm
new file mode 100644
index 0000000..a844dea
--- /dev/null
+++ b/config/BlankForm
@@ -0,0 +1,43 @@
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+
+
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# Sometimes a particular compiler must be used. If that's the case
+# then uncomment the following line. Otherwise the main configure
+# script will try to detect the compiler automatically.
+#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
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=-O
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/alpha-dec b/config/alpha-dec
index 3e54c78..2c10695 100644
--- a/config/alpha-dec
+++ b/config/alpha-dec
@@ -1,54 +1,38 @@
-#!/bin/sh
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-# Based on the setting of environment variable `HDF5_MODE' we set the
-# compiler flags unless they're already set. Its value can be one or
-# more of the following words (be sure to use single quotes when
-# setting its value or the dollar signs will be expanded as variables
-# too soon):
-#
-# $warn -- Generates compiler warnings. You should always
-# include this since it has no effect on the speed of
-# the code produced.
-#
-# $debug -- Compiles in code to check for invariant conditions
-# and turns on the `-g' flag for interactive
-# debugging. It also turns off seek optimizations in
-# the low-level file driver. This version of the
-# library can be significantly slower than a production
-# version.
-#
-# $production -- Compiles an optimized version of the library
-# and disables code that checks for invariant
-# conditions.
-#
-# $profile -- Compiles code with the `-pg' flag which
-# produces a `gmon.out' file when the library
-# runs. The gprof(1) command can read that file
-# and produce detailed run-time statistics.
-#
-# If HDF5_MODE is undefined then we use the value
-#
-# $debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2
-#
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
-# Unconditionally set the compiler to gcc since the following flags
-# only apply to that compiler.
-CC=cc
+# What must *always* be present for things to compile correctly?
+#CFLAGS="$CFLAGS -ansi"
+#CPPFLAGS="$CPPFLAGS -I."
-warn=""
+# What compiler flags should be used for code development?
+DEBUG_CFLAGS=-g
+DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2"
-profile="-pg"
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=-O
+PROD_CPPFLAGS=
-debug="-g -DH5AC_DEBUG -DH5B_DEBUG -DH5F_DEBUG -DH5G_DEBUG -UH5O_DEBUG -DH5T_DEBUG -DH5F_OPT_SEEK=0"
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
-production="-O -DNDEBUG"
-default_mode='$debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2'
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
-# Don't set CFLAGS if the user already did.
-if test -z "$CFLAGS"; then
- CFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`"
- export CFLAGS
-fi
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/freebsd2.2.1 b/config/freebsd2.2.1
index ef1c706..2cf310c 100644
--- a/config/freebsd2.2.1
+++ b/config/freebsd2.2.1
@@ -1,54 +1,6 @@
-#!/bin/sh
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-
-# Based on the setting of environment variable `HDF5_MODE' we set the
-# compiler flags unless they're already set. Its value can be one or
-# more of the following words (be sure to use single quotes when
-# setting its value or the dollar signs will be expanded as variables
-# too soon):
-#
-# $warn -- Generates compiler warnings. You should always
-# include this since it has no effect on the speed of
-# the code produced.
-#
-# $debug -- Compiles in code to check for invariant conditions
-# and turns on the `-g' flag for interactive
-# debugging. It also turns off seek optimizations in
-# the low-level file driver. This version of the
-# library can be significantly slower than a production
-# version.
-#
-# $production -- Compiles an optimized version of the library
-# and disables code that checks for invariant
-# conditions.
-#
-# $profile -- Compiles code with the `-pg' flag which
-# produces a `gmon.out' file when the library
-# runs. The gprof(1) command can read that file
-# and produce detailed run-time statistics.
-#
-# If HDF5_MODE is undefined then we use the value
-#
-# $debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2
-#
-
-# Unconditionally set the compiler to gcc since the following flags
-# only apply to that compiler.
-CC=gcc
-
-warn="-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
-
-profile="-pg"
-
-debug="-g -DH5AC_DEBUG -DH5B_DEBUG -DH5D_DEBUG -DH5F_DEBUG -DH5G_DEBUG -UH5O_DEBUG -DH5T_DEBUG -DH5F_OPT_SEEK=0 -fverbose-asm"
-
-production="-O3 -DNDEBUG -finline-functions -funroll-loops -malign-double -fomit-frame-pointer"
-
-default_mode='-ansi $debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2'
-
-# Don't set CFLAGS if the user already did.
-if test -z "$CFLAGS"; then
- CFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`"
- export CFLAGS
-fi
+. config/linux
diff --git a/config/hpux10.20 b/config/hpux10.20
index 46bf4ee..99d333b 100644
--- a/config/hpux10.20
+++ b/config/hpux10.20
@@ -1,6 +1,38 @@
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-if test "x$CFLAGS" = "x"; then
- CFLAGS="-Ae"
-fi
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# What must *always* be present for things to compile correctly?
+CFLAGS="$CFLAGS -Ae"
+#CPPFLAGS="$CPPFLAGS -I."
+
+# What compiler flags should be used for code development?
+DEBUG_CFLAGS=
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/irix6.2 b/config/irix6.2
index a1c55c4..1ec4f4b 100644
--- a/config/irix6.2
+++ b/config/irix6.2
@@ -1,6 +1,38 @@
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-if test "x$CFLAGS" = "x"; then
- CFLAGS="-ansi -n32"
-fi
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# What must *always* be present for things to compile correctly?
+CFLAGS="$CFLAGS -ansi -n32"
+#CPPFLAGS="$CPPFLAGS -I."
+
+# What compiler flags should be used for code development?
+DEBUG_CFLAGS=-g
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=-O
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/irix64 b/config/irix64
index 95207fb..6c07765 100644
--- a/config/irix64
+++ b/config/irix64
@@ -1,27 +1,46 @@
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+
+
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# What must *always* be present for things to compile correctly?
+# Always turn off these warnings:
+# 1174: function declared but not used
+# 1429: the `long long' type is not standard
+# 1209: constant expressions
+# 1196: __vfork() (this is an SGI config problem)
+#
+CFLAGS="$CFLAGS -fullwarn -ansi -64 -woff 1174,1429,1209,1196"
+#CPPFLAGS="$CPPFLAGS -I."
+
+# What compiler flags should be used for code development?
+DEBUG_CFLAGS=-g
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=-O
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
#!/bin/sh
-# Site configuration -- do not distribute this file.
-CC="cc -ansi -64"
-
-# -woff 1174 about function declared but not used
-# -woff 1429 about long long type non-standard
-# -woff 1209 about constant expressions
-# -woff 1196 about __vfork() being implicitly declared, config prob.
-warn="-fullwarn -woff 1174,1429,1209,1196"
-#warn="-woff 1174,1429,1209,1196"
-
-profile="-pg"
-
-debug="-g"
-
-#production="-O -DNDEBUG"
-
-default_mode='$debug $warn'
-
-RANLIB=: # SGI needs not ranlib
-
-# Don't set CFLAGS if the user already did.
-if test -z "$CFLAGS"; then
- CFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`"
- export CFLAGS
-fi
diff --git a/config/linux b/config/linux
index 78a9913..d17b5de 100644
--- a/config/linux
+++ b/config/linux
@@ -1,63 +1,38 @@
-#!/bin/sh
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-# Based on the setting of environment variable `HDF5_MODE' we set the
-# compiler flags unless they're already set. Its value can be one or
-# more of the following words (be sure to use single quotes when
-# setting its value or the dollar signs will be expanded as variables
-# too soon):
-#
-# $warn -- Generates compiler warnings. You should always
-# include this since it has no effect on the speed of
-# the code produced.
-#
-# $debug -- Compiles in code to check for invariant conditions
-# and turns on the `-g' flag for interactive
-# debugging. It also turns off seek optimizations in
-# the low-level file driver. This version of the
-# library can be significantly slower than a production
-# version.
-#
-# $production -- Compiles an optimized version of the library
-# and disables code that checks for invariant
-# conditions.
-#
-# $profile -- Compiles code with the `-pg' flag which
-# produces a `gmon.out' file when the library
-# runs. The gprof(1) command can read that file
-# and produce detailed run-time statistics.
-#
-# If HDF5_MODE is undefined then we use the value
-#
-# $debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2
-#
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# 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_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
-if [ arborea = `hostname` -a -z "$enable_parallel" ]; then
- enable_parallel=mpio
-fi
-
-# The following flags only apply to the gcc compiler.
-CC=${CC:-gcc}
-
-# First set up the CFLAGS arguments.
-if test "X" = "X$CFLAGS"; then
- warn="-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
- profile="-pg"
- debug="-g -fverbose-asm"
- production="-O3 -finline-functions -funroll-loops -malign-double -fomit-frame-pointer"
- parallel=""
- default_mode='-ansi $debug $warn $parallel'
- CFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`"
-fi
-
-# Then set up the CPPFLAGS arguments.
-if test "X" = "X$CPPFLAGS"; then
- warn=
- profile=
- debug="-DH5AC_DEBUG -DH5B_DEBUG -DH5D_DEBUG -DH5F_DEBUG -DH5G_DEBUG -UH5O_DEBUG -DH5T_DEBUG -DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2"
- production="-DNDEBUG"
- parallel=""
- default_mode='$debug $warn $parallel'
- CPPFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`"
-fi
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/powerpc-ibm-aix4.2.1.0 b/config/powerpc-ibm-aix4.2.1.0
index e5e8738..522f50b 100644
--- a/config/powerpc-ibm-aix4.2.1.0
+++ b/config/powerpc-ibm-aix4.2.1.0
@@ -1 +1,39 @@
-ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} # or 'no'
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+
+
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# 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=
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
+
diff --git a/config/rs6000-ibm-aix4.1.4.0 b/config/rs6000-ibm-aix4.1.4.0
index e5e8738..522f50b 100644
--- a/config/rs6000-ibm-aix4.1.4.0
+++ b/config/rs6000-ibm-aix4.1.4.0
@@ -1 +1,39 @@
-ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} # or 'no'
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+
+
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# 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=
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
+
diff --git a/config/solaris2.5 b/config/solaris2.5
index 87dd710..581415e 100644
--- a/config/solaris2.5
+++ b/config/solaris2.5
@@ -1,6 +1,41 @@
-# Site configuration -- do not distribute this file.
+# -*- shell-script -*-
+#
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
-if test "x$CFLAGS" = "x"; then
- CFLAGS="-Wall -g -O2"
-fi
+#----------------------------------------------------------------------------
+# Compiler flags. The CPPFLAGS values should not include package debug
+# flags like `-DH5G_DEBUG' since these are added with the
+# `--enable-debug' switch of configure.
+
+# We can only use gcc
+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
+DEBUG_CPPFLAGS=
+
+# What compiler flags should be used for building a production
+# library?
+PROD_CFLAGS=-O2
+PROD_CPPFLAGS=
+
+# What compiler flags enable code profiling?
+PROFILE_CFLAGS=-pg
+PROFILE_CPPFLAGS=
+
+
+#----------------------------------------------------------------------------
+# Values for overriding configuration tests when cross compiling.
+# This includes compiling on some machines where the serial front end
+# compiles for a parallel back end.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/configure b/configure
index 8ed46c1..4bb5a4d 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,13 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
+--enable-production=yes|no Determines how to run the compiler."
+ac_help="$ac_help
+--enable-debug=all Turn on debugging in all packages. One may also
+ specify a comma-separated list of package names
+ without the leading H5 or the word no. The default
+ is most packages."
+ac_help="$ac_help
--enable-parallel=mpio Enable parallel support with MPIO"
# Initialize some variables set by options.
@@ -548,7 +555,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:552: checking host system type" >&5
+echo "configure:559: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -571,7 +578,7 @@ echo "$ac_t""$host" 1>&6
echo $ac_n "checking for cached host""... $ac_c" 1>&6
-echo "configure:575: checking for cached host" >&5
+echo "configure:582: checking for cached host" >&5
if eval "test \"`echo '$''{'hdf5_cv_host'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -590,7 +597,7 @@ fi
echo $ac_n "checking for site config file""... $ac_c" 1>&6
-echo "configure:594: checking for site config file" >&5
+echo "configure:601: checking for site config file" >&5
site_config="none"
for f in $host \
$host_vendor-$host_os \
@@ -613,7 +620,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:617: checking for $ac_word" >&5
+echo "configure:624: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -642,7 +649,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:646: checking for $ac_word" >&5
+echo "configure:653: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -690,7 +697,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:694: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:701: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -700,11 +707,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 704 "configure"
+#line 711 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -724,12 +731,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:735: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:733: checking whether we are using GNU C" >&5
+echo "configure:740: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -738,7 +745,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -753,7 +760,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:757: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:764: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -781,7 +788,7 @@ else
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:785: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:792: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -818,7 +825,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:822: checking for a BSD compatible install" >&5
+echo "configure:829: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -870,7 +877,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:874: checking for $ac_word" >&5
+echo "configure:881: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -903,7 +910,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:907: checking for $ac_word" >&5
+echo "configure:914: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -936,7 +943,7 @@ fi
echo $ac_n "checking for GNU Make""... $ac_c" 1>&6
-echo "configure:940: checking for GNU Make" >&5
+echo "configure:947: checking for GNU Make" >&5
if test "`${MAKE-make} --version -f /dev/null 2>/dev/null |\
sed -n 1p|cut -c1-8`" = "GNU Make"; then
echo "$ac_t""yes" 1>&6
@@ -945,10 +952,43 @@ else
echo "$ac_t""no" 1>&6
fi
+echo $ac_n "checking for production mode""... $ac_c" 1>&6
+echo "configure:957: checking for production mode" >&5
+# Check whether --enable-production or --disable-production was given.
+if test "${enable_production+set}" = set; then
+ enableval="$enable_production"
+ :
+fi
+
+
+case "X-$enableval" in
+ X-yes)
+ echo "$ac_t"""production"" 1>&6
+ CFLAGS="$CFLAGS $PROD_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $PROD_CPPFLAGS"
+ ;;
+ X-|X-no)
+ echo "$ac_t"""development"" 1>&6
+ CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS"
+ ;;
+ X-pg|X-profile)
+ echo "$ac_t"""profile"" 1>&6
+ CFLAGS="$CFLAGS $PROFILE_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $PROFILE_CPPFLAGS"
+ ;;
+ *)
+ echo "$ac_t"""user-defined"" 1>&6
+ ;;
+esac
+
+if test Xyes = "X$GCC"; then
+ CFLAGS="$CFLAGS -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
+fi
echo $ac_n "checking for main in -lcoug""... $ac_c" 1>&6
-echo "configure:952: checking for main in -lcoug" >&5
+echo "configure:992: checking for main in -lcoug" >&5
ac_lib_var=`echo coug'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -956,14 +996,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcoug $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 960 "configure"
+#line 1000 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -992,7 +1032,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:996: checking how to run the C preprocessor" >&5
+echo "configure:1036: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1007,13 +1047,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1011 "configure"
+#line 1051 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1024,13 +1064,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1028 "configure"
+#line 1068 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1074: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1053,12 +1093,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1057: checking for ANSI C header files" >&5
+echo "configure:1097: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1062 "configure"
+#line 1102 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1066,7 +1106,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1070: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1083,7 +1123,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1087 "configure"
+#line 1127 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1101,7 +1141,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1105 "configure"
+#line 1145 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1122,7 +1162,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1126 "configure"
+#line 1166 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1133,7 +1173,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1160,17 +1200,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1164: checking for $ac_hdr" >&5
+echo "configure:1204: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1169 "configure"
+#line 1209 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1199,12 +1239,12 @@ done
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1203: checking for off_t" >&5
+echo "configure:1243: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1208 "configure"
+#line 1248 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1232,12 +1272,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1236: checking for size_t" >&5
+echo "configure:1276: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1241 "configure"
+#line 1281 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1270,12 +1310,12 @@ fi
for ac_func in getpwuid gethostname system
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1274: checking for $ac_func" >&5
+echo "configure:1314: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1279 "configure"
+#line 1319 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1298,7 +1338,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1324,24 +1364,24 @@ done
cat > conftest.$ac_ext <<EOF
-#line 1328 "configure"
+#line 1368 "configure"
#include "confdefs.h"
#include<sys/types.h>
int main() {
off64_t n = 0;
; return 0; }
EOF
-if { (eval echo configure:1335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
for ac_func in lseek64 fseek64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1340: checking for $ac_func" >&5
+echo "configure:1380: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1345 "configure"
+#line 1385 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1364,7 +1404,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1398,14 +1438,14 @@ rm -f conftest*
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1402: checking whether byte ordering is bigendian" >&5
+echo "configure:1442: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1409 "configure"
+#line 1449 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1416,11 +1456,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 1424 "configure"
+#line 1464 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1431,7 +1471,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1451,7 +1491,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1455 "configure"
+#line 1495 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1464,7 +1504,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1488,7 +1528,7 @@ EOF
fi
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:1492: checking size of short" >&5
+echo "configure:1532: checking size of short" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1496,7 +1536,7 @@ else
ac_cv_sizeof_short=2
else
cat > conftest.$ac_ext <<EOF
-#line 1500 "configure"
+#line 1540 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1507,7 +1547,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
@@ -1527,7 +1567,7 @@ EOF
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:1531: checking size of int" >&5
+echo "configure:1571: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1535,7 +1575,7 @@ else
ac_cv_sizeof_int=4
else
cat > conftest.$ac_ext <<EOF
-#line 1539 "configure"
+#line 1579 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1546,7 +1586,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
@@ -1566,7 +1606,7 @@ EOF
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:1570: checking size of long" >&5
+echo "configure:1610: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1574,7 +1614,7 @@ else
ac_cv_sizeof_long=4
else
cat > conftest.$ac_ext <<EOF
-#line 1578 "configure"
+#line 1618 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1585,7 +1625,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
@@ -1605,7 +1645,7 @@ EOF
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:1609: checking size of long long" >&5
+echo "configure:1649: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1613,7 +1653,7 @@ else
ac_cv_sizeof_long_long=8
else
cat > conftest.$ac_ext <<EOF
-#line 1617 "configure"
+#line 1657 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1624,7 +1664,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -1644,7 +1684,7 @@ EOF
echo $ac_n "checking size of float""... $ac_c" 1>&6
-echo "configure:1648: checking size of float" >&5
+echo "configure:1688: checking size of float" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1652,7 +1692,7 @@ else
ac_cv_sizeof_float=4
else
cat > conftest.$ac_ext <<EOF
-#line 1656 "configure"
+#line 1696 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1663,7 +1703,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_float=`cat conftestval`
else
@@ -1683,7 +1723,7 @@ EOF
echo $ac_n "checking size of double""... $ac_c" 1>&6
-echo "configure:1687: checking size of double" >&5
+echo "configure:1727: checking size of double" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1691,7 +1731,7 @@ else
ac_cv_sizeof_double=8
else
cat > conftest.$ac_ext <<EOF
-#line 1695 "configure"
+#line 1735 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1702,7 +1742,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_double=`cat conftestval`
else
@@ -1722,7 +1762,7 @@ EOF
echo $ac_n "checking size of size_t""... $ac_c" 1>&6
-echo "configure:1726: checking size of size_t" >&5
+echo "configure:1766: checking size of size_t" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1730,7 +1770,7 @@ else
ac_cv_sizeof_size_t=4
else
cat > conftest.$ac_ext <<EOF
-#line 1734 "configure"
+#line 1774 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1741,7 +1781,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_size_t=`cat conftestval`
else
@@ -1764,7 +1804,7 @@ cat >>confdefs.h <<\EOF
#include <sys/types.h> /*for off_t definition*/
EOF
echo $ac_n "checking size of off_t""... $ac_c" 1>&6
-echo "configure:1768: checking size of off_t" >&5
+echo "configure:1808: checking size of off_t" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1772,7 +1812,7 @@ else
ac_cv_sizeof_off_t=4
else
cat > conftest.$ac_ext <<EOF
-#line 1776 "configure"
+#line 1816 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1783,7 +1823,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_off_t=`cat conftestval`
else
@@ -1807,12 +1847,12 @@ EOF
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1811: checking for working const" >&5
+echo "configure:1851: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1816 "configure"
+#line 1856 "configure"
#include "confdefs.h"
int main() {
@@ -1861,7 +1901,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:1865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -1882,21 +1922,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1886: checking for inline" >&5
+echo "configure:1926: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 1893 "configure"
+#line 1933 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:1900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -1923,16 +1963,16 @@ esac
echo $ac_n "checking for __attribute__ extension""... $ac_c" 1>&6
-echo "configure:1927: checking for __attribute__ extension" >&5
+echo "configure:1967: checking for __attribute__ extension" >&5
cat > conftest.$ac_ext <<EOF
-#line 1929 "configure"
+#line 1969 "configure"
#include "confdefs.h"
int main() {
int __attribute__((unused)) f(void){return 1;}
; return 0; }
EOF
-if { (eval echo configure:1936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_ATTRIBUTE 1
@@ -1948,16 +1988,16 @@ fi
rm -f conftest*
echo $ac_n "checking for __FUNCTION__ extension""... $ac_c" 1>&6
-echo "configure:1952: checking for __FUNCTION__ extension" >&5
+echo "configure:1992: checking for __FUNCTION__ extension" >&5
cat > conftest.$ac_ext <<EOF
-#line 1954 "configure"
+#line 1994 "configure"
#include "confdefs.h"
int main() {
int f(void){return __FUNCTION__;}
; return 0; }
EOF
-if { (eval echo configure:1961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_FUNCTION 1
@@ -1972,6 +2012,37 @@ else
fi
rm -f conftest*
+echo $ac_n "checking for debug flags""... $ac_c" 1>&6
+echo "configure:2017: checking for debug flags" >&5;
+# Check whether --enable-debug or --disable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval="$enable_debug"
+ DEBUG_PKG=$enableval
+fi
+
+
+all_packages="ac,b,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v"
+if test X = "X$DEBUG_PKG" -o Xyes = "X$DEBUG_PKG"; then
+ DEBUG_PKG=ac,b,d,e,f,g,hg,hl,i,mf,mm,p,s,t,v
+ CPPFLAGS="$CPPFLAGS -UNDEBUG"
+ echo "$ac_t""default ($DEBUG_PKG)" 1>&6
+elif test Xall = "X$DEBUG_PKG"; then
+ DEBUG_PKG=$all_packages
+ CPPFLAGS="$CPPFLAGS -UNDEBUG"
+ echo "$ac_t""all ($DEBUG_PKG)" 1>&6
+elif test Xno = "X$DEBUG_PKG" -o Xnone = "X$DEBUG_PKG"; then
+ echo "$ac_t""none" 1>&6
+ DEBUG_PKG=
+ CPPFLAGS="$CPPFLAGS -DNDEBUG"
+else
+ echo "$ac_t""$DEBUG_PKG" 1>&6
+fi
+
+if test "X" != "X$DEBUG_PKG"; then
+ for pkg in `echo $DEBUG_PKG | tr 'a-z,' 'A-Z '`; do
+ CPPFLAGS="$CPPFLAGS -DH5${pkg}_DEBUG"
+ done
+fi
# Check whether --enable-parallel or --disable-parallel was given.
if test "${enable_parallel+set}" = set; then
@@ -1980,7 +2051,7 @@ if test "${enable_parallel+set}" = set; then
fi
echo $ac_n "checking for parallel support""... $ac_c" 1>&6
-echo "configure:1984: checking for parallel support" >&5;
+echo "configure:2055: checking for parallel support" >&5;
@@ -2006,7 +2077,7 @@ EOF
CPPFLAGS="$CPPFLAGS $MPI_INC"
CFLAGS="$CFLAGS $MPI_LIB"
echo $ac_n "checking for main in -lmpi""... $ac_c" 1>&6
-echo "configure:2010: checking for main in -lmpi" >&5
+echo "configure:2081: checking for main in -lmpi" >&5
ac_lib_var=`echo mpi'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2014,14 +2085,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lmpi $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2018 "configure"
+#line 2089 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2048,7 +2119,7 @@ else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for main in -lmpio""... $ac_c" 1>&6
-echo "configure:2052: checking for main in -lmpio" >&5
+echo "configure:2123: checking for main in -lmpio" >&5
ac_lib_var=`echo mpio'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2056,14 +2127,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lmpio $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2060 "configure"
+#line 2131 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
diff --git a/configure.in b/configure.in
index 3f046da..8476064 100644
--- a/configure.in
+++ b/configure.in
@@ -86,9 +86,43 @@ else
AC_MSG_RESULT(no)
fi
+dnl ----------------------------------------------------------------------
+dnl Production flags?
+dnl
+AC_MSG_CHECKING(for production mode)
+AC_ARG_ENABLE(production,
+ [--enable-production=yes|no Determines how to run the compiler.])
+
+case "X-$enableval" in
+ X-yes)
+ AC_MSG_RESULT("production")
+ CFLAGS="$CFLAGS $PROD_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $PROD_CPPFLAGS"
+ ;;
+ X-|X-no)
+ AC_MSG_RESULT("development")
+ CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS"
+ ;;
+ X-pg|X-profile)
+ AC_MSG_RESULT("profile")
+ CFLAGS="$CFLAGS $PROFILE_CFLAGS"
+ CPPFLAGS="$CPPFLAGS $PROFILE_CPPFLAGS"
+ ;;
+ *)
+ AC_MSG_RESULT("user-defined")
+ ;;
+esac
dnl ----------------------------------------------------------------------
+dnl Turn on warning flags for gcc.
+dnl
+if test Xyes = "X$GCC"; then
+ CFLAGS="$CFLAGS -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
+fi
+
+dnl ----------------------------------------------------------------------
dnl Check for libraries. (none required yet)
dnl
AC_CHECK_LIB(coug, main) dnl ...for ASCI/Red
@@ -157,6 +191,39 @@ AC_TRY_COMPILE(,[int f(void){return __FUNCTION__;}],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
+dnl ----------------------------------------------------------------------
+dnl Turn on debugging by setting compiler flags
+dnl
+AC_MSG_CHECKING(for debug flags);
+AC_ARG_ENABLE(debug,
+ [--enable-debug=all Turn on debugging in all packages. One may also
+ specify a comma-separated list of package names
+ without the leading H5 or the word no. The default
+ is most packages.],
+ DEBUG_PKG=$enableval)
+
+all_packages="ac,b,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v"
+if test X = "X$DEBUG_PKG" -o Xyes = "X$DEBUG_PKG"; then
+ DEBUG_PKG=ac,b,d,e,f,g,hg,hl,i,mf,mm,p,s,t,v
+ CPPFLAGS="$CPPFLAGS -UNDEBUG"
+ AC_MSG_RESULT(default ($DEBUG_PKG))
+elif test Xall = "X$DEBUG_PKG"; then
+ DEBUG_PKG=$all_packages
+ CPPFLAGS="$CPPFLAGS -UNDEBUG"
+ AC_MSG_RESULT(all ($DEBUG_PKG))
+elif test Xno = "X$DEBUG_PKG" -o Xnone = "X$DEBUG_PKG"; then
+ AC_MSG_RESULT(none)
+ DEBUG_PKG=
+ CPPFLAGS="$CPPFLAGS -DNDEBUG"
+else
+ AC_MSG_RESULT($DEBUG_PKG)
+fi
+
+if test "X" != "X$DEBUG_PKG"; then
+ for pkg in `echo $DEBUG_PKG | tr 'a-z,' 'A-Z '`; do
+ CPPFLAGS="$CPPFLAGS -DH5${pkg}_DEBUG"
+ done
+fi
dnl ----------------------------------------------------------------------
dnl Check for parallel support
diff --git a/src/H5AC.c b/src/H5AC.c
index 23e86e4..9813af7 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -641,7 +641,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
#ifdef H5AC_DEBUG
static int ncalls = 0;
if (0 == ncalls++) {
- fprintf(stderr, "HDF5-DIAG: debugging cache (expensive)\n");
+ fprintf(stderr, "H5AC: debugging cache (expensive)\n");
}
#endif
@@ -838,7 +838,7 @@ H5AC_debug(H5F_t *f)
FUNC_ENTER(H5AC_debug, FAIL);
- fprintf(stderr, "HDF5-DIAG: cache diagnostics for %s\n", f->name);
+ fprintf(stderr, "H5AC: cache diagnostics for %s\n", f->name);
fprintf(stderr, " %18s %8s %8s %8s %8s+%-8s\n",
"", "Hits", "Misses", "MissRate", "Inits", "Flushes");
diff --git a/src/H5B.c b/src/H5B.c
index e061625..86e34ac 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -1640,7 +1640,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
FUNC_ENTER(H5B_assert, FAIL);
if (0 == ncalls++) {
- fprintf(stderr, "HDF5-DIAG: debugging B-trees (expensive)\n");
+ fprintf(stderr, "H5B: debugging B-trees (expensive)\n");
}
/* Initialize the queue */
bt = H5AC_find(f, H5AC_BT, addr, type, udata);
diff --git a/src/H5D.c b/src/H5D.c
index 8a527cd..8df99c0 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -820,7 +820,8 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
}
/* Update the type and space header messages */
- if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0, H5O_FLAG_CONSTANT,
+ if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0,
+ (H5O_FLAG_CONSTANT|H5O_FLAG_SHARED),
new_dset->type) < 0 ||
H5S_modify(&(new_dset->ent), new_dset->space) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
@@ -1162,7 +1163,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
mem_space, buf/*out*/);
if (status>=0) goto succeed;
#ifdef H5D_DEBUG
- fprintf (stderr, "HDF5-DIAG: input pipe optimization failed "
+ fprintf (stderr, "H5D: input pipe optimization failed "
"(falling through)\n");
#endif
H5E_clear ();
@@ -1217,7 +1218,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/* Strip mine diagnostics.... */
size_t buffer_size = smine_nelmts * MAX (src_type_size, dst_type_size);
if (smine_nelmts<nelmts) {
- fprintf (stderr, "HDF5-DIAG: strip mine");
+ fprintf (stderr, "H5D: strip mine");
if (smine_nelmts!=request_nelmts) {
fprintf (stderr, " got %lu of %lu",
(unsigned long)smine_nelmts,
@@ -1225,10 +1226,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
}
if (buffer_size!=target_size) {
fprintf (stderr, " (%1.1f%% of buffer)",
- 100.0*buffer_size/target_size);
+ 100.0*(double)buffer_size/(double)target_size);
}
fprintf (stderr, " %1.1f iterations\n",
- (double)nelmts/smine_nelmts);
+ (double)nelmts/(double)smine_nelmts);
}
}
#endif
@@ -1388,7 +1389,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
mem_space, buf);
if (status>=0) goto succeed;
#ifdef H5D_DEBUG
- fprintf (stderr, "HDF5-DIAG: output pipe optimization failed "
+ fprintf (stderr, "H5D: output pipe optimization failed "
"(falling through)\n");
#endif
H5E_clear ();
@@ -1443,7 +1444,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/* Strip mine diagnostics.... */
size_t buffer_size = smine_nelmts * MAX (src_type_size, dst_type_size);
if (smine_nelmts<nelmts) {
- fprintf (stderr, "HDF5-DIAG: strip mine");
+ fprintf (stderr, "H5D: strip mine");
if (smine_nelmts!=request_nelmts) {
fprintf (stderr, " got %lu of %lu",
(unsigned long)smine_nelmts,
@@ -1451,10 +1452,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
}
if (buffer_size!=target_size) {
fprintf (stderr, " (%1.1f%% of buffer)",
- 100.0*buffer_size/target_size);
+ 100.0*(double)buffer_size/(double)target_size);
}
fprintf (stderr, " %1.1f iterations\n",
- (double)nelmts/smine_nelmts);
+ (double)nelmts/(double)smine_nelmts);
}
}
#endif
diff --git a/src/H5F.c b/src/H5F.c
index 4bec710..f29eec7 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -553,7 +553,7 @@ H5F_dest(H5F_t *f)
* following flags which are similar in nature to the Posix
* open(2) flags.
*
- * H5F_ACC_WRITE: Open with read/write access. If the file is
+ * H5F_ACC_RDWR: Open with read/write access. If the file is
* currently open for read-only access then it
* will be reopened. Absence of this flag
* implies read-only access.
@@ -968,7 +968,7 @@ H5F_open(const char *name, uintn flags,
* hdf5 data.
*/
#ifdef H5F_DEBUG
- fprintf(stderr, "HDF5-DIAG: resetting EOF from ");
+ fprintf(stderr, "H5F: resetting EOF from ");
H5F_addr_print(stderr, &addr1);
fprintf(stderr, " to ");
H5F_addr_print(stderr, &addr2);
@@ -1323,7 +1323,7 @@ H5F_close(H5F_t *f)
*/
if (f->nopen>0) {
#ifndef NDEBUG
- fprintf(stderr, "HDF5-DIAG: H5F_close: %u object header%s still "
+ fprintf(stderr, "H5F: H5F_close: %u object header%s still "
"open (file close will complete when %s closed)\n",
f->nopen,
1 == f->nopen ? " is" : "s are",
@@ -1333,7 +1333,7 @@ H5F_close(H5F_t *f)
HRETURN(SUCCEED);
} else if (f->close_pending) {
#ifndef NDEBUG
- fprintf(stderr, "HDF5-DIAG: H5F_close: operation completed\n");
+ fprintf(stderr, "H5F: H5F_close: operation completed\n");
#endif
}
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index b89b983..e9596b8 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -187,7 +187,7 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
if (size != mask) {
size++;
#ifdef H5F_DEBUG
- fprintf(stderr, "HDF5-DIAG: family member size was "
+ fprintf(stderr, "H5F: family member size was "
"rounded up to a power of 2");
#endif
}
@@ -199,16 +199,16 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
#ifdef H5F_DEBUG
if (nbits >= 30) {
- fprintf(stderr, "HDF5-DIAG: family members are %dGB\n",
+ fprintf(stderr, "H5F: family members are %dGB\n",
1 << (nbits-30));
} else if (nbits >= 20) {
- fprintf(stderr, "HDF5-DIAG: family members are %dMB\n",
+ fprintf(stderr, "H5F: family members are %dMB\n",
1 << (nbits-20));
} else if (nbits >= 10) {
- fprintf(stderr, "HDF5-DIAG: family members are %dkB\n",
+ fprintf(stderr, "H5F: family members are %dkB\n",
1 << (nbits-10));
} else {
- fprintf(stderr, "HDF5-DIAG: family members are %d bytes\n",
+ fprintf(stderr, "H5F: family members are %d bytes\n",
1 << nbits);
}
#endif
diff --git a/src/H5Flow.c b/src/H5Flow.c
index 125f8ed..545659a 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -283,7 +283,7 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
tmp_addr = *addr;
H5F_addr_inc(&tmp_addr, size);
if (H5F_addr_gt(&tmp_addr, &(lf->eof))) {
- fprintf(stderr, "HDF5-DIAG: extending file w/o allocation\n");
+ fprintf(stderr, "H5F: extending file w/o allocation\n");
lf->eof = tmp_addr;
}
/* Write the data */
@@ -718,7 +718,7 @@ H5F_addr_encode(H5F_t *f, uint8 **pp, const haddr_t *addr)
*-------------------------------------------------------------------------
*/
void
-H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr /*out */ )
+H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
{
int i;
haddr_t tmp;
@@ -763,9 +763,9 @@ H5F_addr_decode(H5F_t *f, const uint8 **pp, haddr_t *addr /*out */ )
*-------------------------------------------------------------------------
*/
void
-H5F_addr_print(FILE * stream, const haddr_t *addr)
+H5F_addr_print(FILE *stream, const haddr_t *addr)
{
- haddr_t tmp;
+ haddr_t tmp;
assert(stream);
assert(addr);
diff --git a/src/H5HG.c b/src/H5HG.c
index 63b41a3..9af1074 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -33,25 +33,20 @@
#define PABLO_MASK H5HG_mask
-struct H5HG_t {
- haddr_t addr; /*address of collection */
- intn idx; /*object ID within collection */
-};
-
typedef struct H5HG_obj_t {
intn nrefs; /*reference count */
size_t size; /*total size of object */
uint8 *begin; /*ptr to object into heap->chunk*/
} H5HG_obj_t;
-typedef struct H5HG_heap_t {
+struct H5HG_heap_t {
haddr_t addr; /*collection address */
hbool_t dirty; /*does heap need to be saved? */
size_t size; /*total size of collection */
uint8 *chunk; /*the collection, incl. header */
intn nalloc; /*numb object slots allocated */
H5HG_obj_t *obj; /*array of object descriptions */
-} H5HG_heap_t;
+};
/* PRIVATE PROTOTYPES */
static H5HG_heap_t *H5HG_load(H5F_t *f, const haddr_t *addr,
@@ -81,9 +76,11 @@ static intn interface_initialize_g = FALSE;
* new collection is allocated in the file and added to the
* beginning of the CWFS list.
*
- * Return: Success: SUCCEED
+ * Return: Success: Ptr to a cached heap. The pointer is valid
+ * only until some other hdf5 library function
+ * is called.
*
- * Failure: FAIL
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Friday, March 27, 1998
@@ -92,15 +89,15 @@ static intn interface_initialize_g = FALSE;
*
*-------------------------------------------------------------------------
*/
-herr_t
+H5HG_heap_t *
H5HG_create (H5F_t *f, size_t size)
{
H5HG_heap_t *heap = NULL;
- herr_t ret_value = FAIL;
+ H5HG_heap_t *ret_value = NULL;
uint8 *p = NULL;
haddr_t addr;
- FUNC_ENTER (H5HG_create, FAIL);
+ FUNC_ENTER (H5HG_create, NULL);
/* Check args */
assert (f);
@@ -108,7 +105,7 @@ H5HG_create (H5F_t *f, size_t size)
/* Create it */
if (H5MF_alloc (f, H5MF_META, size, &addr/*out*/)<0) {
- HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL,
+ HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL,
"unable to allocate file space for global heap");
}
heap = H5MM_xcalloc (1, sizeof(H5HG_heap_t));
@@ -123,7 +120,9 @@ H5HG_create (H5F_t *f, size_t size)
HDmemcpy (heap->chunk, H5HG_MAGIC, H5HG_SIZEOF_MAGIC);
p = heap->chunk + H5HG_SIZEOF_MAGIC;
*p++ = H5HG_VERSION;
- p += 3; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
H5F_encode_length (f, p, size);
/* The freespace object */
@@ -136,7 +135,7 @@ H5HG_create (H5F_t *f, size_t size)
/* Add the heap to the cache */
if (H5AC_set (f, H5AC_GHEAP, &addr, heap)<0) {
- HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL,
+ HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL,
"unable to cache global heap collection");
}
@@ -152,10 +151,10 @@ H5HG_create (H5F_t *f, size_t size)
f->shared->ncwfs = MIN (H5HG_NCWFS, f->shared->ncwfs+1);
}
- ret_value = SUCCEED;
+ ret_value = heap;
done:
- if (ret_value<0 && heap) {
+ if (!ret_value && heap) {
H5MM_xfree (heap->chunk);
H5MM_xfree (heap->obj);
H5MM_xfree (heap);
@@ -263,7 +262,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
UINT16DECODE (p, heap->obj[idx].nrefs);
H5F_decode_length (f, p, heap->obj[idx].size);
heap->obj[idx].begin = begin;
- p += heap->obj[idx].size;
+ p = begin + heap->obj[idx].size;
}
}
assert (p==heap->chunk+heap->size);
@@ -502,8 +501,8 @@ H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
f->shared->cwfs[cwfsno] = f->shared->cwfs[cwfsno-1];
f->shared->cwfs[cwfsno-1] = tmp;
--cwfsno;
- break;
}
+ break;
}
}
@@ -512,11 +511,12 @@ H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
* new collection large enough for the message plus the collection header.
*/
if (cwfsno>=f->shared->ncwfs) {
- if (H5HG_create (f, need+H5HG_SIZEOF_HDR (f))<0) {
+ if (NULL==(heap=H5HG_create (f, need+H5HG_SIZEOF_HDR (f)))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL,
"unable to allocate a global heap collection");
}
assert (f->shared->ncwfs>0);
+ assert (f->shared->cwfs[0]==heap);
assert (f->shared->cwfs[0]->obj[0].size >= need+H5HG_SIZEOF_HDR(f));
cwfsno = 0;
}
@@ -763,6 +763,8 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
heap->obj[0].begin = heap->chunk + (heap->size-size);
heap->obj[0].size = size;
heap->obj[0].nrefs = 0;
+ } else {
+ heap->obj[0].size += size;
}
HDmemmove (obj_start, obj_start+size,
heap->size-((obj_start+size)-heap->chunk));
@@ -830,9 +832,11 @@ herr_t
H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
intn fwidth)
{
- int i, nused, maxobj;
+ int i, j, k, nused, maxobj;
H5HG_heap_t *h = NULL;
char buf[64];
+ size_t size;
+ uint8 *p = NULL;
FUNC_ENTER(H5HG_debug, FAIL);
@@ -873,13 +877,31 @@ H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
for (i=1; i<h->nalloc; i++) {
if (h->obj[i].begin) {
sprintf (buf, "Object %d", i);
- fprintf (stream, "%*s%-*s:\n", indent, "", fwidth, buf);
+ fprintf (stream, "%*s%s\n", indent, "", buf);
fprintf (stream, "%*s%-*s %d\n", indent+3, "", MIN(fwidth-3, 0),
"Reference count:",
h->obj[i].nrefs);
fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MIN(fwidth-3, 0),
"Size of object body:",
(unsigned long)(h->obj[i].size));
+ size = h->obj[i].size - H5HG_SIZEOF_OBJHDR (f);
+ p = h->obj[i].begin + H5HG_SIZEOF_OBJHDR (f);
+ for (j=0; j<size; j+=16) {
+ fprintf (stream, "%*s%04d: ", indent+6, "", j);
+ for (k=0; k<16; k++) {
+ if (8==k) fprintf (stream, " ");
+ if (j+k<size) {
+ fprintf (stream, "%02x ", p[j+k]);
+ } else {
+ fputs (" ", stream);
+ }
+ }
+ for (k=0; k<16 && j+k<size; k++) {
+ if (8==k) fprintf (stream, " ");
+ fputc (p[j+k]>' ' && p[j+k]<='~' ? p[j+k] : '.', stream);
+ }
+ fprintf (stream, "\n");
+ }
}
}
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index aebb3f8..c6ec1cd 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -10,6 +10,8 @@
#include <H5HGpublic.h>
+#include <H5Fprivate.h>
+
/*
* Each collection has a magic number for some redundancy.
*/
@@ -59,14 +61,27 @@
* The initial guess for the number of messages in a collection. We assume
* that all objects in that collection are zero length, giving the maximum
* possible number of objects in the collection. The collection itself has
- * some overhead and each message has some overhead.
+ * some overhead and each message has some overhead. The `+2' accounts for
+ * rounding and for the free space object.
*/
#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \
- H5HG_SIZEOF_OBJHDR(f)+1))
+ H5HG_SIZEOF_OBJHDR(f)+2))
+
+/*
+ * Makes a global heap object pointer undefined, or checks whether one is
+ * defined.
+ */
+#define H5HG_undef(HGP) ((HGP)->idx=0)
+#define H5HG_defined(HGP) ((HGP)->idx!=0)
+
+typedef struct H5HG_t {
+ haddr_t addr; /*address of collection */
+ intn idx; /*object ID within collection */
+} H5HG_t;
-typedef struct H5HG_t H5HG_t;
+typedef struct H5HG_heap_t H5HG_heap_t;
-herr_t H5HG_create (H5F_t *f, size_t size);
+H5HG_heap_t *H5HG_create (H5F_t *f, size_t size);
herr_t H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/);
void *H5HG_peek (H5F_t *f, H5HG_t *hobj);
void *H5HG_read (H5F_t *f, H5HG_t *hobj, void *object);
diff --git a/src/H5HL.c b/src/H5HL.c
index f6fa4f0..8c141a0 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -529,9 +529,6 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
size_t offset = 0;
size_t need_size, old_size, need_more;
hbool_t found;
-#ifndef NDEBUG
- static int nmessages = 0;
-#endif
FUNC_ENTER(H5HL_insert, (size_t)(-1));
@@ -601,14 +598,10 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
assert (max_fl->size==H5HL_ALIGN (max_fl->size));
if (max_fl->size < H5HL_SIZEOF_FREE(f)) {
-#ifndef NDEBUG
+#ifdef H5HL_DEBUG
if (max_fl->size) {
- fprintf(stderr, "H5HL_insert: lost %lu bytes at line %d\n",
- (unsigned long) (max_fl->size), __LINE__);
- if (0 == nmessages++) {
- fprintf(stderr, "Messages from H5HL_insert() will go "
- "away when assertions are turned off.\n");
- }
+ fprintf(stderr, "H5HL: lost %lu bytes at line %d\n",
+ (unsigned long)(max_fl->size), __LINE__);
}
#endif
max_fl = H5HL_remove_free(heap, max_fl);
@@ -629,26 +622,18 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
fl->next = heap->freelist;
if (heap->freelist) heap->freelist->prev = fl;
heap->freelist = fl;
-#ifndef NDEBUG
+#ifdef H5HL_DEBUG
} else if (need_more > need_size) {
fprintf(stderr, "H5HL_insert: lost %lu bytes at line %d\n",
- (unsigned long) (need_more - need_size), __LINE__);
- if (0 == nmessages++) {
- fprintf(stderr, "Messages from H5HL_insert() will go away "
- "when assertions are turned off.\n");
- }
+ (unsigned long)(need_more - need_size), __LINE__);
#endif
}
}
-#ifndef NDEBUG
- fprintf(stderr, "H5HL_insert: resize mem buf from %lu to %lu bytes\n",
- (unsigned long) (heap->mem_alloc),
- (unsigned long) (heap->mem_alloc + need_more));
- if (0 == nmessages++) {
- fprintf(stderr, "Messages from H5HL_insert() will go away "
- "when assertions are turned off.\n");
- }
+#ifdef H5HL_DEBUG
+ fprintf(stderr, "H5HL: resize mem buf from %lu to %lu bytes\n",
+ (unsigned long)(heap->mem_alloc),
+ (unsigned long)(heap->mem_alloc + need_more));
#endif
old_size = heap->mem_alloc;
heap->mem_alloc += need_more;
@@ -748,9 +733,6 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
{
H5HL_t *heap = NULL;
H5HL_free_t *fl = heap->freelist, *fl2 = NULL;
-#ifndef NDEBUG
- static int nmessages = 0;
-#endif
FUNC_ENTER(H5HL_remove, FAIL);
@@ -817,12 +799,8 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
* lost.
*/
if (size < H5HL_SIZEOF_FREE(f)) {
-#ifndef NDEBUG
- fprintf(stderr, "H5HL_remove: lost %lu bytes\n", (unsigned long) size);
- if (0 == nmessages++) {
- fprintf(stderr, "Messages from H5HL_remove() will go away "
- "when assertions are turned off.\n");
- }
+#ifdef H5HL_DEBUG
+ fprintf(stderr, "H5HL: lost %lu bytes\n", (unsigned long) size);
#endif
HRETURN(SUCCEED);
}
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 8ccc2ed..b1af51a 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -23,6 +23,14 @@
#include <H5private.h>
#include <H5Fprivate.h>
+/*
+ * Feature: Define H5HL_DEBUG on the compiler command line if you want to
+ * diagnostic messages from this layer.
+ */
+#ifdef NDEBUG
+# undef H5HL_DEBUG
+#endif
+
#define H5HL_MAGIC "HEAP" /*heap magic number */
#define H5HL_SIZEOF_MAGIC 4
diff --git a/src/H5MF.c b/src/H5MF.c
index 8985490..46d5bae 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -116,7 +116,7 @@ H5MF_free(H5F_t *f, const haddr_t *addr, size_t size)
HRETURN(SUCCEED);
assert(!H5F_addr_zerop(addr));
-#ifndef NDEBUG
+#ifdef H5MF_DEBUG
fprintf(stderr, "H5MF_free: lost %lu bytes of file storage\n",
(unsigned long) size);
#endif
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 403da90..739966a 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -23,6 +23,14 @@
#include <H5private.h>
#include <H5Fprivate.h>
+/*
+ * Feature: Define H5MF_DEBUG on the compiler command line if you want to
+ * see diagnostics from this layer.
+ */
+#ifdef NDEBUG
+# undef H5MF_DEBUG
+#endif
+
#define H5MF_META 0 /*request storage for meta data */
#define H5MF_RAW 1 /*request storage for raw data */
diff --git a/src/H5O.c b/src/H5O.c
index bf60b09..87f29fc 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -107,6 +107,7 @@ H5O_init_interface(void)
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_create
@@ -281,6 +282,7 @@ H5O_close(H5G_entry_t *obj_ent)
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_load
@@ -317,7 +319,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
haddr_t chunk_addr;
size_t chunk_size;
H5O_cont_t *cont = NULL;
- hbool_t constant; /*is message a constant mesg? */
+ uint8 flags;
FUNC_ENTER(H5O_load, NULL);
@@ -392,14 +394,8 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
UINT16DECODE(p, id);
UINT16DECODE(p, mesg_size);
assert (mesg_size==H5O_ALIGN (mesg_size));
- p += 4; /*reserved*/
-
- /*
- * The message ID field actually contains some bits near the
- * high-order end that are not part of the ID.
- */
- constant = (id & H5O_FLAG_CONSTANT) ? TRUE : FALSE;
- id &= ~H5O_FLAG_BITS;
+ flags = *p++;
+ p += 3; /*reserved*/
if (id >= NELMTS(message_type_g) || NULL == message_type_g[id]) {
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL,
@@ -424,7 +420,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
mesgno = oh->nmesgs++;
oh->mesg[mesgno].type = message_type_g[id];
oh->mesg[mesgno].dirty = FALSE;
- oh->mesg[mesgno].constant = constant;
+ oh->mesg[mesgno].flags = flags;
oh->mesg[mesgno].native = NULL;
oh->mesg[mesgno].raw = p;
oh->mesg[mesgno].raw_size = mesg_size;
@@ -439,7 +435,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
curmesg++) {
if (H5O_CONT_ID == oh->mesg[curmesg].type->id) {
uint8 *p2 = oh->mesg[curmesg].raw;
- cont = (H5O_CONT->decode) (f, oh->mesg[curmesg].raw_size, p2);
+ cont = (H5O_CONT->decode) (f, p2, NULL);
oh->mesg[curmesg].native = cont;
chunk_addr = cont->addr;
chunk_size = cont->size;
@@ -464,6 +460,7 @@ H5O_load(H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
}
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_flush
@@ -491,6 +488,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
uint8 buf[16], *p;
intn i, id;
H5O_cont_t *cont = NULL;
+ herr_t (*encode)(H5F_t*, uint8*, const void*) = NULL;
FUNC_ENTER(H5O_flush, FAIL);
@@ -532,12 +530,10 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
if (oh->mesg[i].dirty) {
p = oh->mesg[i].raw - H5O_SIZEOF_MSGHDR(f);
- /* The message id has some flags in the high-order bits. */
id = oh->mesg[i].type->id;
- id |= oh->mesg[i].constant ? H5O_FLAG_CONSTANT : 0;
UINT16ENCODE(p, id);
UINT16ENCODE(p, oh->mesg[i].raw_size);
- *p++ = 0; /*reserved*/
+ *p++ = oh->mesg[i].flags;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
@@ -563,7 +559,11 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
oh->chunk[cont->chunkno].addr = cont->addr;
}
- /* encode the message */
+ /*
+ * Encode the message. If the message is shared then we
+ * encode a Shared Object message instead of the object
+ * which is being shared.
+ */
assert(oh->mesg[i].raw >=
oh->chunk[oh->mesg[i].chunkno].image);
assert (oh->mesg[i].raw_size ==
@@ -571,9 +571,12 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
assert(oh->mesg[i].raw + oh->mesg[i].raw_size <=
oh->chunk[oh->mesg[i].chunkno].image +
oh->chunk[oh->mesg[i].chunkno].size);
- if ((oh->mesg[i].type->encode) (f, oh->mesg[i].raw_size,
- oh->mesg[i].raw,
- oh->mesg[i].native) < 0) {
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ encode = H5O_SHARED->encode;
+ } else {
+ encode = oh->mesg[i].type->encode;
+ }
+ if ((encode)(f, oh->mesg[i].raw, oh->mesg[i].native)<0) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL,
"unable to encode object header message");
}
@@ -607,7 +610,11 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
/* destroy messages */
for (i = 0; i < oh->nmesgs; i++) {
- H5O_reset(oh->mesg[i].type, oh->mesg[i].native);
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ H5O_reset (H5O_SHARED, oh->mesg[i].native);
+ } else {
+ H5O_reset(oh->mesg[i].type, oh->mesg[i].native);
+ }
oh->mesg[i].native = H5MM_xfree(oh->mesg[i].native);
}
oh->mesg = H5MM_xfree(oh->mesg);
@@ -617,6 +624,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
}
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_reset
@@ -654,6 +662,7 @@ H5O_reset(const H5O_class_t *type, void *native)
}
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_link
@@ -676,8 +685,8 @@ H5O_reset(const H5O_class_t *type, void *native)
intn
H5O_link(H5G_entry_t *ent, intn adjust)
{
- H5O_t *oh = NULL;
- intn ret_value = FAIL;
+ H5O_t *oh = NULL;
+ intn ret_value = FAIL;
FUNC_ENTER(H5O_link, FAIL);
@@ -714,6 +723,7 @@ H5O_link(H5G_entry_t *ent, intn adjust)
}
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_read
@@ -739,11 +749,11 @@ H5O_link(H5G_entry_t *ent, intn adjust)
void *
H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
{
- H5O_t *oh = NULL;
- void *retval = NULL;
- intn idx;
- H5G_cache_t *cache = NULL;
- H5G_type_t cache_type;
+ H5O_t *oh = NULL;
+ void *ret_value = NULL;
+ intn idx;
+ H5G_cache_t *cache = NULL;
+ H5G_type_t cache_type;
FUNC_ENTER(H5O_read, NULL);
@@ -757,9 +767,9 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
/* can we get it from the symbol table entry? */
cache = H5G_ent_cache(ent, &cache_type);
if (H5O_fast_g[cache_type]) {
- retval = (H5O_fast_g[cache_type]) (cache, type, mesg);
- if (retval)
- HRETURN(retval);
+ ret_value = (H5O_fast_g[cache_type]) (cache, type, mesg);
+ if (ret_value)
+ HRETURN(ret_value);
H5E_clear(); /*don't care, try reading from header */
}
@@ -776,19 +786,54 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, intn sequence, void *mesg)
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
"unable to load object header");
}
- retval = (type->copy) (oh->mesg[idx].native, mesg);
+ if (oh->mesg[idx].flags & H5O_FLAG_SHARED) {
+ /*
+ * If the message is shared then then the native pointer points to an
+ * H5O_SHARED message. We use that information to look up the real
+ * message in the global heap.
+ */
+ H5O_shared_t *shared;
+ void *tmp_buf, *tmp_mesg;
+
+ shared = (H5O_shared_t *)(oh->mesg[idx].native);
+ if (NULL==(tmp_buf = H5HG_read (ent->file, shared, NULL))) {
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL,
+ "unable to read shared message from global heap");
+ }
+ tmp_mesg = (type->decode)(ent->file, tmp_buf, shared);
+ if (!tmp_mesg) {
+ H5MM_xfree (tmp_buf);
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL,
+ "unable to decode object header shared message");
+ }
+ if (mesg) {
+ HDmemcpy (mesg, tmp_mesg, type->native_size);
+ H5MM_xfree (tmp_mesg);
+ } else {
+ ret_value = tmp_mesg;
+ }
+ } else {
+ /*
+ * The message is not shared, but rather exists in the object
+ * header. The object header caches the native message (along with
+ * the raw message) so we must copy the native message before
+ * returning.
+ */
+ if (NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg))) {
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL,
+ "unable to copy message to user space");
+ }
+ }
+
+ done:
if (H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, NULL,
"unable to release object header");
}
oh = NULL;
-
- if (!retval) {
- HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
- "unable to copy object header message to user space");
- }
- FUNC_LEAVE(retval);
+ FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_find_in_ohdr
@@ -812,23 +857,24 @@ static intn
H5O_find_in_ohdr(H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p,
intn sequence)
{
- H5O_t *oh = NULL;
- int i;
+ H5O_t *oh = NULL;
+ int i;
+ const H5O_class_t *type = NULL;
FUNC_ENTER(H5O_find_in_ohdr, FAIL);
- /* check args */
+ /* Check args */
assert(f);
assert(addr && H5F_addr_defined(addr));
assert(type_p);
- /* load the object header */
+ /* Load the object header */
if (NULL == (oh = H5AC_find(f, H5AC_OHDR, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
}
- /* scan through the messages looking for the right one */
+ /* Scan through the messages looking for the right one */
for (i = 0; i < oh->nmesgs; i++) {
if (*type_p && (*type_p)->id != oh->mesg[i].type->id) continue;
if (--sequence < 0) break;
@@ -838,24 +884,32 @@ H5O_find_in_ohdr(H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p,
"unable to find object header message");
}
- /* decode the message if necessary */
+ /*
+ * Decode the message if necessary. If the message is shared then decode
+ * a shared message, ignoring the message type.
+ */
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ type = H5O_SHARED;
+ } else {
+ type = oh->mesg[i].type;
+ }
if (NULL == oh->mesg[i].native) {
- assert(oh->mesg[i].type->decode);
- assert (oh->mesg[i].raw_size==H5O_ALIGN (oh->mesg[i].raw_size));
- oh->mesg[i].native = (oh->mesg[i].type->decode) (f,
- oh->mesg[i].raw_size,
- oh->mesg[i].raw);
+ assert(type->decode);
+ oh->mesg[i].native = (type->decode) (f, oh->mesg[i].raw, NULL);
if (NULL == oh->mesg[i].native) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL,
"unable to decode message");
}
}
- /*return the message type */
+ /*
+ * Return the message type. If this is a shared message then return the
+ * pointed-to type.
+ */
*type_p = oh->mesg[i].type;
-
FUNC_LEAVE(i);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_modify
@@ -898,10 +952,11 @@ intn
H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
uintn flags, const void *mesg)
{
- H5O_t *oh = NULL;
- intn idx, sequence;
- intn ret_value = FAIL;
- size_t size;
+ H5O_t *oh = NULL;
+ intn idx, sequence;
+ intn ret_value = FAIL;
+ size_t size = 0;
+ H5O_shared_t *sh_mesg = NULL;
FUNC_ENTER(H5O_modify, FAIL);
@@ -911,6 +966,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
assert(H5F_addr_defined(&(ent->header)));
assert(type);
assert(mesg);
+ assert (0==(flags & ~H5O_FLAG_BITS));
if (NULL == (oh = H5AC_protect(ent->file, H5AC_OHDR, &(ent->header),
NULL, NULL))) {
@@ -937,27 +993,59 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
}
if (overwrite < 0) {
/* Allocate space for the new message */
- size = (type->raw_size) (ent->file, mesg);
+ if (flags & H5O_FLAG_SHARED) {
+ if (NULL==type->share) {
+ HGOTO_ERROR (H5E_OHDR, H5E_UNSUPPORTED, FAIL,
+ "message class is not sharable");
+ }
+ sh_mesg = H5MM_xcalloc (1, sizeof *sh_mesg);
+ if ((type->share)(ent->file, mesg, sh_mesg/*out*/)<0) {
+ /*
+ * If the message isn't shared then turn of the shared bit
+ * and treat it as an unshared message.
+ */
+ H5E_clear ();
+ flags &= ~H5O_FLAG_SHARED;
+ } else {
+ if (H5HG_link (ent->file, sh_mesg, 1)<0) {
+ HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL,
+ "unable to adjust shared object link count");
+ }
+ size = (H5O_SHARED->raw_size)(ent->file, sh_mesg);
+ }
+ }
+ if (0==(flags & H5O_FLAG_SHARED)) {
+ size = (type->raw_size) (ent->file, mesg);
+ }
size = H5O_ALIGN(size);
idx = H5O_alloc(ent->file, oh, type, size);
if (idx < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL,
- "unable to allocate object header space for message");
+ "unable to allocate space for message");
}
sequence++;
-
- } else if (oh->mesg[idx].constant) {
+
+ } else if (oh->mesg[idx].flags & H5O_FLAG_CONSTANT) {
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL,
"unable to modify constant message");
+ } else if (oh->mesg[idx].flags & H5O_FLAG_SHARED) {
+ HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL,
+ "unable to modify shared (constant) message");
}
+
/* Copy the native value into the object header */
- oh->mesg[idx].native = (type->copy) (mesg, oh->mesg[idx].native);
- if (NULL == oh->mesg[idx].native) {
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL,
- "unable to copy message to object header");
+ if (flags & H5O_FLAG_SHARED) {
+ oh->mesg[idx].native = sh_mesg;
+ } else {
+ oh->mesg[idx].native = (type->copy) (mesg, oh->mesg[idx].native);
+ if (NULL == oh->mesg[idx].native) {
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL,
+ "unable to copy message to object header");
+ }
}
- oh->mesg[idx].constant = (flags & H5O_FLAG_CONSTANT) ? TRUE : FALSE;
+
+ oh->mesg[idx].flags = flags;
oh->mesg[idx].dirty = TRUE;
oh->dirty = TRUE;
ret_value = sequence;
@@ -967,8 +1055,10 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,
"unable to release object header");
}
+
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_remove
@@ -1000,9 +1090,10 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
herr_t
H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
{
- H5O_t *oh = NULL;
- intn i, seq, nfailed = 0;
- herr_t ret_value = FAIL;
+ H5O_t *oh = NULL;
+ intn i, seq, nfailed = 0;
+ herr_t ret_value = FAIL;
+ H5O_shared_t *sh_mesg = NULL;
FUNC_ENTER(H5O_remove, FAIL);
@@ -1018,6 +1109,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
"unable to load object header");
}
+
for (i = seq = 0; i < oh->nmesgs; i++) {
if (type->id != oh->mesg[i].type->id) continue;
if (seq++ == sequence || H5O_ALL == sequence) {
@@ -1025,11 +1117,27 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
* Keep track of how many times we failed trying to remove constant
* messages.
*/
- if (oh->mesg[i].constant) {
+ if (oh->mesg[i].flags & H5O_FLAG_CONSTANT) {
nfailed++;
continue;
}
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ if (NULL==oh->mesg[i].native) {
+ sh_mesg = (H5O_SHARED->decode)(ent->file, oh->mesg[i].raw,
+ NULL);
+ if (NULL==(oh->mesg[i].native = sh_mesg)) {
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTDECODE, FAIL,
+ "unable to decode shared message info");
+ }
+ }
+ if (H5HG_link (ent->file, sh_mesg, -1)<0) {
+ HGOTO_ERROR (H5E_OHDR, H5E_LINK, FAIL,
+ "unable to decrement link count on shared "
+ "message");
+ }
+ }
+
/* change message type to nil and zero it */
oh->mesg[i].type = H5O_NULL;
HDmemset(oh->mesg[i].raw, 0, oh->mesg[i].raw_size);
@@ -1055,6 +1163,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
}
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_alloc_extend_chunk
@@ -1083,9 +1192,9 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, intn sequence)
static intn
H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
{
- intn idx, i;
- size_t delta;
- uint8 *old_addr;
+ intn idx, i;
+ size_t delta;
+ uint8 *old_addr;
FUNC_ENTER(H5O_alloc_extend_chunk, FAIL);
@@ -1167,6 +1276,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
}
FUNC_LEAVE(idx);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_alloc_new_chunk
@@ -1339,6 +1449,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
FUNC_LEAVE(idx);
}
+
/*-------------------------------------------------------------------------
* Function: H5O_alloc
@@ -1360,9 +1471,9 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
static intn
H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
{
- intn chunkno;
- intn idx;
- intn null_idx;
+ intn chunkno;
+ intn idx;
+ intn null_idx;
FUNC_ENTER(H5O_alloc, FAIL);
@@ -1441,6 +1552,60 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
oh->dirty = TRUE;
FUNC_LEAVE(idx);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_share
+ *
+ * Purpose: Writes a message to the global heap.
+ *
+ * Return: Success: SUCCEED, and HOBJ describes the global heap
+ * object.
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg,
+ H5HG_t *hobj/*out*/)
+{
+ size_t size;
+ void *buf = NULL;
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER (H5O_share, FAIL);
+
+ /* Check args */
+ assert (f);
+ assert (type);
+ assert (mesg);
+ assert (hobj);
+
+ /* Encode the message put it in the global heap */
+ if ((size = (type->raw_size)(f, mesg))>0) {
+ buf = H5MM_xmalloc (size);
+ if ((type->encode)(f, buf, mesg)<0) {
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL,
+ "unable to encode message");
+ }
+ if (H5HG_insert (f, size, buf, hobj)<0) {
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL,
+ "unable to store message in global heap");
+ }
+ }
+ ret_value = SUCCEED;
+
+ done:
+ H5MM_xfree (buf);
+ FUNC_LEAVE (ret_value);
+}
+
/*-------------------------------------------------------------------------
* Function: H5O_debug
@@ -1463,12 +1628,14 @@ herr_t
H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
intn fwidth)
{
- H5O_t *oh = NULL;
- intn i, chunkno;
- size_t mesg_total = 0, chunk_total = 0;
- int *sequence;
- haddr_t tmp_addr;
- herr_t ret_value = FAIL;
+ H5O_t *oh = NULL;
+ intn i, chunkno;
+ size_t mesg_total = 0, chunk_total = 0;
+ int *sequence;
+ haddr_t tmp_addr;
+ herr_t ret_value = FAIL;
+ void *(*decode)(H5F_t*, const uint8*, H5HG_t*);
+ herr_t (*debug)(H5F_t*, const void*, FILE*, intn, intn)=NULL;
FUNC_ENTER(H5O_debug, FAIL);
@@ -1540,6 +1707,7 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
oh->mesg[i].type->id);
continue;
}
+
/* message name and size */
fprintf(stream, "%*s%-*s 0x%04x %s(%d)\n",
indent + 3, "", MAX(0, fwidth - 3),
@@ -1547,12 +1715,20 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
(unsigned) (oh->mesg[i].type->id),
oh->mesg[i].type->name,
sequence[oh->mesg[i].type->id]++);
- fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3),
- "Raw size in bytes:",
- (unsigned long) (oh->mesg[i].raw_size));
+ fprintf (stream, "%*s%-*s %s\n", indent+3, "", MAX (0, fwidth-3),
+ "Shared message:",
+ (oh->mesg[i].flags & H5O_FLAG_SHARED) ? "Yes" : "No");
fprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3),
"Constant:",
- oh->mesg[i].constant ? "Yes" : "No");
+ (oh->mesg[i].flags & H5O_FLAG_CONSTANT) ? "Yes" : "No");
+ if (oh->mesg[i].flags & ~H5O_FLAG_BITS) {
+ fprintf (stream, "%*s%-*s 0x%02x\n", indent+3,"",MAX(0,fwidth-3),
+ "*** ADDITIONAL UNKNOWN FLAGS --->",
+ oh->mesg[i].flags & ~H5O_FLAG_BITS);
+ }
+ fprintf(stream, "%*s%-*s %lu bytes\n", indent+3, "", MAX(0,fwidth-3),
+ "Raw size in obj header:",
+ (unsigned long) (oh->mesg[i].raw_size));
fprintf(stream, "%*s%-*s %d\n", indent + 3, "", MAX(0, fwidth - 3),
"Chunk number:",
(int) (oh->mesg[i].chunkno));
@@ -1560,25 +1736,47 @@ H5O_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
if (chunkno < 0 || chunkno >= oh->nchunks) {
fprintf(stream, "*** BAD CHUNK NUMBER\n");
}
+
/* check the size */
if ((oh->mesg[i].raw + oh->mesg[i].raw_size >
oh->chunk[chunkno].image + oh->chunk[chunkno].size) ||
(oh->mesg[i].raw < oh->chunk[chunkno].image)) {
fprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n");
}
+
/* decode the message */
if (NULL == oh->mesg[i].native && oh->mesg[i].type->decode) {
- oh->mesg[i].native = (oh->mesg[i].type->decode) (f,
- oh->mesg[i].raw_size,
- oh->mesg[i].raw);
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ decode = H5O_SHARED->decode;
+ debug = H5O_SHARED->debug;
+ } else {
+ decode = oh->mesg[i].type->decode;
+ debug = oh->mesg[i].type->debug;
+ }
+ oh->mesg[i].native = (decode)(f, oh->mesg[i].raw, NULL);
+ } else {
+ debug = NULL;
}
+
/* print the message */
- if (oh->mesg[i].type->debug) {
- (oh->mesg[i].type->debug)(f, oh->mesg[i].native, stream, indent+3,
- MAX(0, fwidth-3));
+ if (debug) {
+ (debug)(f, oh->mesg[i].native, stream, indent+3, MAX(0, fwidth-3));
} else {
fprintf(stream, "%*sNo info for this message.\n", indent + 3, "");
}
+
+ /* If the message is shared then also print the pointed-to message */
+ if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
+ void *p = H5HG_read (f, oh->mesg[i].native, NULL);
+ void *mesg = (oh->mesg[i].type->decode)(f, p, oh->mesg[i].native);
+ if (oh->mesg[i].type->debug) {
+ (oh->mesg[i].type->debug)(f, mesg, stream, indent+3,
+ MAX (0, fwidth-3));
+ }
+ H5O_reset (oh->mesg[i].type, mesg);
+ H5MM_xfree (mesg);
+ H5MM_xfree (p);
+ }
}
sequence = H5MM_xfree(sequence);
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index b3226e2..5d59875 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -25,9 +25,8 @@
#define PABLO_MASK H5O_cont_mask
/* PRIVATE PROTOTYPES */
-static void *H5O_cont_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_cont_encode(H5F_t *f, size_t size, uint8 *p,
- const void *_mesg);
+static void *H5O_cont_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_cont_encode(H5F_t *f, uint8 *p, const void *_mesg);
static herr_t H5O_cont_debug(H5F_t *f, const void *_mesg, FILE * stream,
intn indent, intn fwidth);
@@ -41,6 +40,7 @@ const H5O_class_t H5O_CONT[1] = {{
NULL, /*no copy method */
NULL, /*no size method */
NULL, /*default reset method */
+ NULL, /*no share method */
H5O_cont_debug, /*debugging */
}};
@@ -65,8 +65,8 @@ static intn interface_initialize_g = FALSE;
*
*-------------------------------------------------------------------------
*/
-static void *
-H5O_cont_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+static void *
+H5O_cont_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5O_cont_t *cont = NULL;
@@ -74,8 +74,8 @@ H5O_cont_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* check args */
assert(f);
- assert(raw_size == H5O_ALIGN (H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f)));
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* decode */
cont = H5MM_xcalloc(1, sizeof(H5O_cont_t));
@@ -103,7 +103,7 @@ H5O_cont_decode(H5F_t *f, size_t raw_size, const uint8 *p)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cont_encode(H5F_t *f, size_t size, uint8 *p, const void *_mesg)
+H5O_cont_encode(H5F_t *f, uint8 *p, const void *_mesg)
{
const H5O_cont_t *cont = (const H5O_cont_t *) _mesg;
@@ -111,7 +111,6 @@ H5O_cont_encode(H5F_t *f, size_t size, uint8 *p, const void *_mesg)
/* check args */
assert(f);
- assert(size == H5O_ALIGN (H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f)));
assert(p);
assert(cont);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index fe30d00..c3b46cd 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -28,29 +28,28 @@ static char RcsId[] = "@(#)$Revision$";
#define PABLO_MASK H5O_dtype_mask
/* PRIVATE PROTOTYPES */
-static herr_t H5O_dtype_encode(H5F_t *f, size_t raw_size, uint8 *p,
- const void *mesg);
-static void *H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static void *H5O_dtype_copy(const void *_mesg, void *_dest);
-static size_t H5O_dtype_size(H5F_t *f, const void *_mesg);
-static herr_t H5O_dtype_reset(void *_mesg);
-static herr_t H5O_dtype_debug(H5F_t *f, const void *_mesg,
- FILE * stream, intn indent, intn fwidth);
+static herr_t H5O_dtype_encode (H5F_t *f, uint8 *p, const void *mesg);
+static void *H5O_dtype_decode (H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static void *H5O_dtype_copy (const void *_mesg, void *_dest);
+static size_t H5O_dtype_size (H5F_t *f, const void *_mesg);
+static herr_t H5O_dtype_reset (void *_mesg);
+static herr_t H5O_dtype_debug (H5F_t *f, const void *_mesg,
+ FILE * stream, intn indent, intn fwidth);
+static herr_t H5O_dtype_share (H5F_t *f, const void *_mesg, H5HG_t *hobj);
/* This message derives from H5O */
-const H5O_class_t H5O_DTYPE[1] =
-{
- {
- H5O_DTYPE_ID, /* message id number */
- "data_type", /* message name for debugging */
- sizeof(H5T_t), /* native message size */
- H5O_dtype_decode, /* decode message */
- H5O_dtype_encode, /* encode message */
- H5O_dtype_copy, /* copy the native value */
- H5O_dtype_size, /* size of raw message */
- H5O_dtype_reset, /* reset method */
- H5O_dtype_debug, /* debug the message */
- }};
+const H5O_class_t H5O_DTYPE[1] = {{
+ H5O_DTYPE_ID, /* message id number */
+ "data_type", /* message name for debugging */
+ sizeof(H5T_t), /* native message size */
+ H5O_dtype_decode, /* decode message */
+ H5O_dtype_encode, /* encode message */
+ H5O_dtype_copy, /* copy the native value */
+ H5O_dtype_size, /* size of raw message */
+ H5O_dtype_reset, /* reset method */
+ H5O_dtype_share, /* share method */
+ H5O_dtype_debug, /* debug the message */
+}};
/* Interface initialization */
static hbool_t interface_initialize_g = FALSE;
@@ -436,8 +435,8 @@ H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt)
into a struct in memory native format. The struct is allocated within this
function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
-static void *
-H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+static void *
+H5O_dtype_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5T_t *dt = NULL;
@@ -445,7 +444,6 @@ H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* check args */
assert(f);
- assert(raw_size > 0);
assert(p);
dt = H5MM_xcalloc(1, sizeof(H5T_t));
@@ -455,7 +453,10 @@ H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p)
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL,
"can't decode type");
}
- assert(raw_size == H5O_ALIGN (H5O_dtype_size(f, (void *) dt)));
+ if (hobj) {
+ dt->sh_heap = *hobj;
+ dt->sh_file = f;
+ }
FUNC_LEAVE(dt);
}
@@ -478,7 +479,7 @@ H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p)
message in the "raw" disk form.
--------------------------------------------------------------------------*/
static herr_t
-H5O_dtype_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
+H5O_dtype_encode(H5F_t *f, uint8 *p, const void *mesg)
{
const H5T_t *dt = (const H5T_t *) mesg;
@@ -486,7 +487,6 @@ H5O_dtype_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
/* check args */
assert(f);
- assert(raw_size == H5O_ALIGN (H5O_dtype_size(f, mesg)));
assert(p);
assert(dt);
@@ -625,6 +625,45 @@ H5O_dtype_reset(void *_mesg)
FUNC_LEAVE(SUCCEED);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_dtype_share
+ *
+ * Purpose: Returns, through argument HOBJ, whether a data type is shared
+ * in the specified file.
+ *
+ * Return: Success: SUCCEED if the data type is shared in file F,
+ * and HOBJ is set to the global heap address.
+ *
+ * Failure: FAIL if the data type is not shared, or
+ * shared but not in file F. The value of HOBJ
+ * is undefined.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_dtype_share (H5F_t *f, const void *_mesg, H5HG_t *hobj/*out*/)
+{
+ const H5T_t *dt = (const H5T_t *)_mesg;
+
+ FUNC_ENTER (H5O_dtype_share, FAIL);
+
+ if (!H5HG_defined (&(dt->sh_heap)) ||
+ NULL==dt->sh_file ||
+ dt->sh_file->shared != f->shared) {
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "data type is not shared");
+ }
+
+ *hobj = dt->sh_heap;
+ FUNC_LEAVE (SUCCEED);
+}
+
/*--------------------------------------------------------------------------
NAME
H5O_dtype_debug
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index b4bdf19..18dd40d 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -14,9 +14,8 @@
#define PABLO_MASK H5O_efl_mask
/* PRIVATE PROTOTYPES */
-static void *H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_efl_encode(H5F_t *f, size_t size, uint8 *p,
- const void *_mesg);
+static void *H5O_efl_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_efl_encode(H5F_t *f, uint8 *p, const void *_mesg);
static void *H5O_efl_copy(const void *_mesg, void *_dest);
static size_t H5O_efl_size(H5F_t *f, const void *_mesg);
static herr_t H5O_efl_reset(void *_mesg);
@@ -33,6 +32,7 @@ const H5O_class_t H5O_EFL[1] = {{
H5O_efl_copy, /*copy native value */
H5O_efl_size, /*size of message on disk */
H5O_efl_reset, /*reset method */
+ NULL, /*no share method */
H5O_efl_debug, /*debug the message */
}};
@@ -59,7 +59,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+H5O_efl_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5O_efl_t *mesg = NULL;
int i;
@@ -70,6 +70,7 @@ H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* Check args */
assert(f);
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* Decode the header */
mesg = H5MM_xcalloc(1, sizeof(H5O_efl_t));
@@ -122,7 +123,7 @@ H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_efl_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
+H5O_efl_encode(H5F_t *f, uint8 *p, const void *_mesg)
{
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
int i;
@@ -134,7 +135,6 @@ H5O_efl_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
/* check args */
assert(f);
assert(mesg);
- assert(raw_size == H5O_ALIGN (H5O_efl_size(f, _mesg)));
assert(p);
/* Encode header */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 71fe092..7949136 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -14,9 +14,8 @@
#include <H5Oprivate.h>
/* PRIVATE PROTOTYPES */
-static void *H5O_layout_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_layout_encode(H5F_t *f, size_t size, uint8 *p,
- const void *_mesg);
+static void *H5O_layout_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_layout_encode(H5F_t *f, uint8 *p, const void *_mesg);
static void *H5O_layout_copy(const void *_mesg, void *_dest);
static size_t H5O_layout_size(H5F_t *f, const void *_mesg);
static herr_t H5O_layout_debug(H5F_t *f, const void *_mesg, FILE * stream,
@@ -32,6 +31,7 @@ const H5O_class_t H5O_LAYOUT[1] = {{
H5O_layout_copy, /*copy the native value */
H5O_layout_size, /*size of message on disk */
NULL, /*reset method */
+ NULL, /*no share method */
H5O_layout_debug, /*debug the message */
}};
@@ -58,8 +58,8 @@ static hbool_t interface_initialize_g = FALSE;
*
*-------------------------------------------------------------------------
*/
-static void *
-H5O_layout_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+static void *
+H5O_layout_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5O_layout_t *mesg = NULL;
intn i;
@@ -69,12 +69,12 @@ H5O_layout_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* check args */
assert(f);
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* decode */
mesg = H5MM_xcalloc(1, sizeof(H5O_layout_t));
H5F_addr_decode(f, &p, &(mesg->addr));
mesg->ndims = *p++;
- assert(raw_size == H5O_ALIGN (H5O_layout_size(f, mesg)));
/* Layout class */
mesg->type = *p++;
@@ -108,7 +108,7 @@ H5O_layout_decode(H5F_t *f, size_t raw_size, const uint8 *p)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
+H5O_layout_encode(H5F_t *f, uint8 *p, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
int i;
@@ -119,7 +119,6 @@ H5O_layout_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
assert(f);
assert(mesg);
assert(mesg->ndims > 0 && mesg->ndims <= H5O_LAYOUT_NDIMS);
- assert(raw_size == H5O_ALIGN (H5O_layout_size(f, _mesg)));
assert(p);
/* data or B-tree address */
diff --git a/src/H5Oname.c b/src/H5Oname.c
index b36c550..cd7e144 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -22,9 +22,8 @@
#define PABLO_MASK H5O_name_mask
/* PRIVATE PROTOTYPES */
-static void *H5O_name_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_name_encode(H5F_t *f, size_t raw_size, uint8 *p,
- const void *_mesg);
+static void *H5O_name_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_name_encode(H5F_t *f, uint8 *p, const void *_mesg);
static void *H5O_name_copy(const void *_mesg, void *_dest);
static size_t H5O_name_size(H5F_t *f, const void *_mesg);
static herr_t H5O_name_reset(void *_mesg);
@@ -41,6 +40,7 @@ const H5O_class_t H5O_NAME[1] = {{
H5O_name_copy, /*copy the native value */
H5O_name_size, /*raw message size */
H5O_name_reset, /*free internal memory */
+ NULL, /*no share method */
H5O_name_debug, /*debug the message */
}};
@@ -67,23 +67,22 @@ static hbool_t interface_initialize_g = FALSE;
*
*-------------------------------------------------------------------------
*/
-static void *
-H5O_name_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+static void *
+H5O_name_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5O_name_t *mesg;
- char *s;
FUNC_ENTER(H5O_name_decode, NULL);
/* check args */
assert(f);
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* decode */
mesg = H5MM_xcalloc(1, sizeof(H5O_name_t));
- s = H5MM_xmalloc(raw_size);
- HDmemcpy(s, p, raw_size);
- mesg->s = s;
+ mesg->s = H5MM_xmalloc (strlen ((const char*)p)+1);
+ strcpy (mesg->s, (const char*)p);
FUNC_LEAVE(mesg);
}
@@ -106,10 +105,9 @@ H5O_name_decode(H5F_t *f, size_t raw_size, const uint8 *p)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_name_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
+H5O_name_encode(H5F_t *f, uint8 *p, const void *_mesg)
{
const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
- size_t size;
FUNC_ENTER(H5O_name_encode, FAIL);
@@ -118,14 +116,8 @@ H5O_name_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
assert(p);
assert(mesg && mesg->s);
- /* message size */
- size = HDstrlen(mesg->s) + 1;
- assert(size <= raw_size);
-
/* encode */
- HDmemcpy(p, mesg->s, size);
- HDmemset(p + size, 0, raw_size - size);
-
+ strcpy ((char*)p, mesg->s);
FUNC_LEAVE(SUCCEED);
}
@@ -255,10 +247,10 @@ H5O_name_reset(void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_name_debug(H5F_t *f, const void *_mesg, FILE * stream,
- intn indent, intn fwidth)
+H5O_name_debug(H5F_t *f, const void *_mesg, FILE *stream, intn indent,
+ intn fwidth)
{
- const H5O_name_t *mesg = (const H5O_name_t *) _mesg;
+ const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
FUNC_ENTER(H5O_name_debug, FAIL);
diff --git a/src/H5Onull.c b/src/H5Onull.c
index 57cec41..b2b9136 100644
--- a/src/H5Onull.c
+++ b/src/H5Onull.c
@@ -29,5 +29,6 @@ const H5O_class_t H5O_NULL[1] = {{
NULL, /*no copy method */
NULL, /*no size method */
NULL, /*no reset method */
+ NULL, /*no share method */
NULL, /*no debug method */
}};
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index b20e6ed..90317fc 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -19,10 +19,11 @@
#include <H5Opublic.h>
-/* Private headers neede by this file */
+/* Private headers needed by this file */
#include <H5private.h>
#include <H5Fprivate.h>
#include <H5Gprivate.h>
+#include <H5HGprivate.h>
#include <H5Tprivate.h>
#include <H5Sprivate.h>
@@ -40,9 +41,10 @@
#define H5O_NEW_MESG (-1) /*new message */
#define H5O_ALL (-1) /*delete all messages of type */
-/* Flags which are part of the message id */
-#define H5O_FLAG_CONSTANT 0x8000
-#define H5O_FLAG_BITS 0x8000
+/* Flags which are part of a message */
+#define H5O_FLAG_CONSTANT 0x01
+#define H5O_FLAG_SHARED 0x02
+#define H5O_FLAG_BITS 0x03
#define H5O_VERSION 1
/*
@@ -64,21 +66,22 @@
4) /*reserved */
typedef struct H5O_class_t {
- intn id; /*message type ID on disk*/
- const char *name; /*message name for debugging*/
- size_t native_size; /*size of native message*/
- void *(*decode) (H5F_t *, size_t, const uint8 *);
- herr_t (*encode) (H5F_t *, size_t, uint8 *, const void *);
- void *(*copy) (const void *, void *); /*copy native value */
- size_t (*raw_size) (H5F_t *, const void *); /*sizeof raw val */
- herr_t (*reset) (void *); /*free nested data structures*/
- herr_t (*debug) (H5F_t *, const void *, FILE *, intn, intn);
+ intn id; /*message type ID on disk */
+ const char *name; /*for debugging */
+ size_t native_size; /*size of native message */
+ void *(*decode)(H5F_t*, const uint8*, H5HG_t*);
+ herr_t (*encode)(H5F_t*, uint8*, const void*);
+ void *(*copy)(const void*, void*); /*copy native value */
+ size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */
+ herr_t (*reset)(void *); /*free nested data structs */
+ herr_t (*share)(H5F_t*, const void*, H5HG_t*);
+ herr_t (*debug)(H5F_t*, const void*, FILE*, intn, intn);
} H5O_class_t;
typedef struct H5O_mesg_t {
const H5O_class_t *type; /*type of message */
hbool_t dirty; /*raw out of date wrt native */
- hbool_t constant; /*is message constant? */
+ uint8 flags; /*message flags */
void *native; /*native format message */
uint8 *raw; /*ptr to raw data */
size_t raw_size; /*size with alignment */
@@ -169,10 +172,20 @@ typedef struct H5O_layout_t {
extern const H5O_class_t H5O_NAME[1];
typedef struct H5O_name_t {
- const char *s; /*ptr to malloc'd memory */
+ char *s; /*ptr to malloc'd memory */
} H5O_name_t;
/*
+ * Shared object message. This message ID never really appears in an object
+ * header. Instead, bit 2 of the `Flags' field will be set and the ID field
+ * will be the ID of the pointed-to message.
+ */
+#define H5O_SHARED_ID 0x000f
+extern const H5O_class_t H5O_SHARED[1];
+
+typedef H5HG_t H5O_shared_t;
+
+/*
* Object header continuation message.
*/
#define H5O_CONT_ID 0x0010
@@ -211,6 +224,8 @@ intn H5O_modify (H5G_entry_t *ent, const H5O_class_t *type, intn overwrite,
uintn flags, const void *mesg);
herr_t H5O_remove (H5G_entry_t *ent, const H5O_class_t *type, intn sequence);
herr_t H5O_reset (const H5O_class_t *type, void *native);
+herr_t H5O_share (H5F_t *f, const H5O_class_t *type, const void *mesg,
+ H5HG_t *hobj/*out*/);
herr_t H5O_debug (H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
intn fwidth);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 9818130..21d8f3c 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -25,9 +25,8 @@ static char RcsId[] = "@(#)$Revision$";
#define PABLO_MASK H5O_sdspace_mask
/* PRIVATE PROTOTYPES */
-static void *H5O_sdspace_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_sdspace_encode(H5F_t *f, size_t size, uint8 *p,
- const void *_mesg);
+static void *H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *_mesg);
static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg);
static herr_t H5O_sdspace_debug(H5F_t *f, const void *_mesg,
@@ -43,6 +42,7 @@ const H5O_class_t H5O_SDSPACE[1] = {{
H5O_sdspace_copy, /* copy the native value */
H5O_sdspace_size, /* size of symbol table entry */
NULL, /* default reset method */
+ NULL, /* no share method */
H5O_sdspace_debug, /* debug the message */
}};
@@ -69,7 +69,7 @@ static hbool_t interface_initialize_g = FALSE;
within this function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
static void *
-H5O_sdspace_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
uintn u; /* local counting variable */
@@ -79,8 +79,8 @@ H5O_sdspace_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* check args */
assert(f);
- assert(raw_size >= 8); /* at least the rank and flags must be present */
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* decode */
if ((sdim = H5MM_xcalloc(1, sizeof(H5S_simple_t))) != NULL) {
@@ -131,7 +131,7 @@ H5O_sdspace_decode(H5F_t *f, size_t raw_size, const uint8 *p)
dimensionality message in the "raw" disk form.
--------------------------------------------------------------------------*/
static herr_t
-H5O_sdspace_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
+H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
uintn u; /* Local counting variable */
@@ -141,7 +141,6 @@ H5O_sdspace_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
/* check args */
assert(f);
- assert(raw_size >= 8); /* at least the rank & flags must be present */
assert(p);
assert(sdim);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
new file mode 100644
index 0000000..a62a562
--- /dev/null
+++ b/src/H5Oshared.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Wednesday, April 1, 1998
+ *
+ * Purpose: Functions that operate on a shared message. The shared
+ * message doesn't ever actually appear in the object header as
+ * a normal message. Instead, if a message is shared, the
+ * H5O_FLAG_SHARED bit is set and the message body is that
+ * defined here for H5O_SHARED. The message ID is the ID of the
+ * pointed-to message and the pointed-to message is stored in
+ * the global heap.
+ */
+#include <H5private.h>
+#include <H5Eprivate.h>
+#include <H5MMprivate.h>
+#include <H5Oprivate.h>
+
+static void *H5O_shared_decode (H5F_t*, const uint8*, H5HG_t *hobj);
+static herr_t H5O_shared_encode (H5F_t*, uint8*, const void*);
+static size_t H5O_shared_size (H5F_t*, const void*);
+static herr_t H5O_shared_debug (H5F_t*, const void*, FILE*, intn, intn);
+
+/* This message derives from H5O */
+const H5O_class_t H5O_SHARED[1] = {{
+ H5O_SHARED_ID, /*message id number */
+ "shared", /*message name for debugging */
+ sizeof(H5O_shared_t), /*native message size */
+ H5O_shared_decode, /*decode method */
+ H5O_shared_encode, /*encode method */
+ NULL, /*no copy method */
+ H5O_shared_size, /*size method */
+ NULL, /*no reset method */
+ NULL, /*no share method */
+ H5O_shared_debug, /*debug method */
+}};
+
+/* Interface initialization */
+#define PABLO_MASK H5O_shared_mask
+static hbool_t interface_initialize_g = FALSE;
+#define INTERFACE_INIT NULL
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_shared_decode
+ *
+ * Purpose: Decodes a shared object message and returns it.
+ *
+ * Return: Success: Ptr to a new shared object message.
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5O_shared_decode (H5F_t *f, const uint8 *buf, H5HG_t *hobj)
+{
+ H5O_shared_t *mesg;
+
+ FUNC_ENTER (H5O_shared_decode, NULL);
+
+ /* Check args */
+ assert (f);
+ assert (buf);
+ assert (!hobj || !H5HG_defined (hobj));
+
+ /* Decode */
+ mesg = H5MM_xcalloc (1, sizeof *mesg);
+ H5F_addr_decode (f, &buf, &(mesg->addr));
+ INT32DECODE (buf, mesg->idx);
+
+ FUNC_LEAVE (mesg);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_shared_encode
+ *
+ * Purpose: Encodes message _MESG into buffer BUF.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_shared_encode (H5F_t *f, uint8 *buf/*out*/, const void *_mesg)
+{
+ const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg;
+
+ FUNC_ENTER (H5O_shared_encode, FAIL);
+
+ /* Check args */
+ assert (f);
+ assert (buf);
+ assert (mesg);
+
+ /* Encode */
+ H5F_addr_encode (f, &buf, &(mesg->addr));
+ INT32ENCODE (buf, mesg->idx);
+
+ FUNC_LEAVE (SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_shared_size
+ *
+ * Purpose: Returns the length of a shared object message.
+ *
+ * Return: Success: Length
+ *
+ * Failure: 0
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5O_shared_size (H5F_t *f, const void *_mesg)
+{
+ FUNC_ENTER (H5O_shared_size, 0);
+ FUNC_LEAVE (H5F_SIZEOF_ADDR(f)+4);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_shared_debug
+ *
+ * Purpose: Prints debugging info for the message
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, April 2, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_shared_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent,
+ intn fwidth)
+{
+ const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg;
+
+ FUNC_ENTER (H5O_shared_debug, FAIL);
+
+ /* Check args */
+ assert (f);
+ assert (mesg);
+ assert (stream);
+ assert (indent>=0);
+ assert (fwidth>=0);
+
+ fprintf (stream, "%*s%-*s ", indent, "", fwidth,
+ "Collection address:");
+ H5F_addr_print (stream, &(mesg->addr));
+ fprintf (stream, "\n");
+
+ fprintf (stream, "%*s%-*s %d\n", indent, "", fwidth,
+ "Object ID within collection:",
+ mesg->idx);
+
+ FUNC_LEAVE (SUCCEED);
+}
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 56d3955..a5b0dc7 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -23,9 +23,8 @@
#define PABLO_MASK H5O_stab_mask
/* PRIVATE PROTOTYPES */
-static void *H5O_stab_decode(H5F_t *f, size_t raw_size, const uint8 *p);
-static herr_t H5O_stab_encode(H5F_t *f, size_t size, uint8 *p,
- const void *_mesg);
+static void *H5O_stab_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj);
+static herr_t H5O_stab_encode(H5F_t *f, uint8 *p, const void *_mesg);
static void *H5O_stab_copy(const void *_mesg, void *_dest);
static size_t H5O_stab_size(H5F_t *f, const void *_mesg);
static herr_t H5O_stab_debug(H5F_t *f, const void *_mesg,
@@ -41,6 +40,7 @@ const H5O_class_t H5O_STAB[1] = {{
H5O_stab_copy, /*copy the native value */
H5O_stab_size, /*size of symbol table entry */
NULL, /*default reset method */
+ NULL, /*no share method */
H5O_stab_debug, /*debug the message */
}};
@@ -67,7 +67,7 @@ static hbool_t interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
static void *
-H5O_stab_decode(H5F_t *f, size_t raw_size, const uint8 *p)
+H5O_stab_decode(H5F_t *f, const uint8 *p, H5HG_t *hobj)
{
H5O_stab_t *stab;
@@ -75,8 +75,8 @@ H5O_stab_decode(H5F_t *f, size_t raw_size, const uint8 *p)
/* check args */
assert(f);
- assert(raw_size == H5O_ALIGN (2 * H5F_SIZEOF_ADDR(f)));
assert(p);
+ assert (!hobj || !H5HG_defined (hobj));
/* decode */
stab = H5MM_xcalloc(1, sizeof(H5O_stab_t));
@@ -104,7 +104,7 @@ H5O_stab_decode(H5F_t *f, size_t raw_size, const uint8 *p)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_stab_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
+H5O_stab_encode(H5F_t *f, uint8 *p, const void *_mesg)
{
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
@@ -112,7 +112,6 @@ H5O_stab_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
/* check args */
assert(f);
- assert(raw_size == H5O_ALIGN (2 * H5F_SIZEOF_ADDR(f)));
assert(p);
assert(stab);
diff --git a/src/H5T.c b/src/H5T.c
index fe23b04..be72fa6 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1,16 +1,10 @@
/*
- *
-* NCSA HDF *
-* Software Development Group *
-* National Center for Supercomputing Applications *
-* University of Illinois at Urbana-Champaign *
-* 605 E. Springfield, Champaign IL 61820 *
-* *
-* For conditions of distribution and use, see the accompanying *
-* hdf/COPYING file. *
-* *
-****************************************************************************/
-
+ * Copyright (C) 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Tuesday, March 31, 1998
+ */
#ifdef RCSID
static char RcsId[] = "@(#)$Revision$";
#endif
@@ -19,7 +13,8 @@ static char RcsId[] = "@(#)$Revision$";
#include <H5private.h> /*generic functions */
#include <H5Iprivate.h> /*ID functions */
-#include <H5Eprivate.h> /*error handling */
+#include <H5Eprivate.h> /*error handling */
+#include <H5HGprivate.h> /*global heap */
#include <H5MMprivate.h> /*memory management */
#include <H5Sprivate.h> /*data space */
#include <H5Tpkg.h> /*data-type functions */
@@ -29,47 +24,47 @@ static char RcsId[] = "@(#)$Revision$";
#define H5T_COMPND_INC 64 /*typical max numb of members per struct */
/* Interface initialization */
-static intn interface_initialize_g = FALSE;
+static intn interface_initialize_g = FALSE;
#define INTERFACE_INIT H5T_init_interface
-static void H5T_term_interface(void);
+static void H5T_term_interface(void);
/* Predefined types */
-hid_t H5T_NATIVE_CHAR_g = FAIL;
-hid_t H5T_NATIVE_UCHAR_g = FAIL;
-hid_t H5T_NATIVE_SHORT_g = FAIL;
-hid_t H5T_NATIVE_USHORT_g = FAIL;
-hid_t H5T_NATIVE_INT_g = FAIL;
-hid_t H5T_NATIVE_UINT_g = FAIL;
-hid_t H5T_NATIVE_LONG_g = FAIL;
-hid_t H5T_NATIVE_LLONG_g = FAIL;
-hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_HYPER_g = FAIL;
-hid_t H5T_NATIVE_UHYPER_g = FAIL;
-hid_t H5T_NATIVE_INT8_g = FAIL;
-hid_t H5T_NATIVE_UINT8_g = FAIL;
-hid_t H5T_NATIVE_INT16_g = FAIL;
-hid_t H5T_NATIVE_UINT16_g = FAIL;
-hid_t H5T_NATIVE_INT32_g = FAIL;
-hid_t H5T_NATIVE_UINT32_g = FAIL;
-hid_t H5T_NATIVE_INT64_g = FAIL;
-hid_t H5T_NATIVE_UINT64_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
-hid_t H5T_NATIVE_FLOAT_g = FAIL;
-hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-hid_t H5T_NATIVE_TIME_g = FAIL;
-hid_t H5T_NATIVE_STRING_g = FAIL;
-hid_t H5T_NATIVE_BITFIELD_g = FAIL;
-hid_t H5T_NATIVE_OPAQUE_g = FAIL;
+hid_t H5T_NATIVE_CHAR_g = FAIL;
+hid_t H5T_NATIVE_UCHAR_g = FAIL;
+hid_t H5T_NATIVE_SHORT_g = FAIL;
+hid_t H5T_NATIVE_USHORT_g = FAIL;
+hid_t H5T_NATIVE_INT_g = FAIL;
+hid_t H5T_NATIVE_UINT_g = FAIL;
+hid_t H5T_NATIVE_LONG_g = FAIL;
+hid_t H5T_NATIVE_LLONG_g = FAIL;
+hid_t H5T_NATIVE_ULLONG_g = FAIL;
+hid_t H5T_NATIVE_HYPER_g = FAIL;
+hid_t H5T_NATIVE_UHYPER_g = FAIL;
+hid_t H5T_NATIVE_INT8_g = FAIL;
+hid_t H5T_NATIVE_UINT8_g = FAIL;
+hid_t H5T_NATIVE_INT16_g = FAIL;
+hid_t H5T_NATIVE_UINT16_g = FAIL;
+hid_t H5T_NATIVE_INT32_g = FAIL;
+hid_t H5T_NATIVE_UINT32_g = FAIL;
+hid_t H5T_NATIVE_INT64_g = FAIL;
+hid_t H5T_NATIVE_UINT64_g = FAIL;
+hid_t H5T_NATIVE_ULONG_g = FAIL;
+hid_t H5T_NATIVE_FLOAT_g = FAIL;
+hid_t H5T_NATIVE_DOUBLE_g = FAIL;
+hid_t H5T_NATIVE_TIME_g = FAIL;
+hid_t H5T_NATIVE_STRING_g = FAIL;
+hid_t H5T_NATIVE_BITFIELD_g = FAIL;
+hid_t H5T_NATIVE_OPAQUE_g = FAIL;
/* The path database */
-static intn H5T_npath_g = 0; /*num paths defined */
-static intn H5T_apath_g = 0; /*num slots allocated */
-static H5T_path_t *H5T_path_g = NULL; /*path array */
+static intn H5T_npath_g = 0; /*num paths defined */
+static intn H5T_apath_g = 0; /*num slots allocated */
+static H5T_path_t *H5T_path_g = NULL; /*path array */
/* The soft conversion function master list */
-static intn H5T_nsoft_g = 0; /*num soft funcs defined */
-static intn H5T_asoft_g = 0; /*num slots allocated */
-static H5T_soft_t *H5T_soft_g = NULL; /*master soft list */
+static intn H5T_nsoft_g = 0; /*num soft funcs defined */
+static intn H5T_asoft_g = 0; /*num slots allocated */
+static H5T_soft_t *H5T_soft_g = NULL; /*master soft list */
/*--------------------------------------------------------------------------
NAME
@@ -86,8 +81,8 @@ DESCRIPTION
herr_t
H5T_init_interface(void)
{
- H5T_t *dt = NULL;
- herr_t ret_value = SUCCEED;
+ H5T_t *dt = NULL;
+ herr_t ret_value = SUCCEED;
interface_initialize_g = TRUE;
FUNC_ENTER(H5T_init_interface, FAIL);
@@ -285,7 +280,7 @@ H5T_term_interface(void)
path->cdata.command = H5T_CONV_FREE;
if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "HDF5-DIAG: conversion function failed "
+ fprintf (stderr, "H5T: conversion function failed "
"to free private data\n");
#endif
H5E_clear(); /*ignore the error*/
@@ -336,6 +331,7 @@ H5T_term_interface(void)
H5T_NATIVE_BITFIELD_g = FAIL;
H5T_NATIVE_OPAQUE_g = FAIL;
}
+
/*-------------------------------------------------------------------------
* Function: H5Tcreate
@@ -362,8 +358,8 @@ H5T_term_interface(void)
hid_t
H5Tcreate(H5T_class_t type, size_t size)
{
- H5T_t *dt = NULL;
- hid_t ret_value = FAIL;
+ H5T_t *dt = NULL;
+ hid_t ret_value = FAIL;
FUNC_ENTER(H5Tcreate, FAIL);
@@ -371,17 +367,21 @@ H5Tcreate(H5T_class_t type, size_t size)
if (size <= 0) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size");
}
+
/* create the type */
if (NULL == (dt = H5T_create(type, size))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create type");
}
+
/* Make it an atom */
if ((ret_value = H5I_register(H5_DATATYPE, dt)) < 0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
"can't register data type atom");
}
+
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tcopy
@@ -404,9 +404,9 @@ H5Tcreate(H5T_class_t type, size_t size)
hid_t
H5Tcopy(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_t *new_dt = NULL;
- hid_t ret_value = FAIL;
+ H5T_t *dt = NULL;
+ H5T_t *new_dt = NULL;
+ hid_t ret_value = FAIL;
FUNC_ENTER(H5Tcopy, FAIL);
@@ -420,14 +420,17 @@ H5Tcopy(hid_t type_id)
if (NULL == (new_dt = H5T_copy(dt))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't copy");
}
- /* atomize result */
+
+ /* Atomize result */
if ((ret_value = H5I_register(H5_DATATYPE, new_dt)) < 0) {
H5T_close(new_dt);
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
"can't register data type atom");
}
+
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tclose
@@ -448,7 +451,7 @@ H5Tcopy(hid_t type_id)
herr_t
H5Tclose(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tclose, FAIL);
@@ -460,12 +463,15 @@ H5Tclose(hid_t type_id)
if (dt->locked) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "predefined data type");
}
+
/* When the reference count reaches zero the resources are freed */
if (H5I_dec_ref(type_id) < 0) {
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id");
}
+
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tequal
@@ -488,9 +494,9 @@ H5Tclose(hid_t type_id)
hbool_t
H5Tequal(hid_t type1_id, hid_t type2_id)
{
- const H5T_t *dt1 = NULL;
- const H5T_t *dt2 = NULL;
- hbool_t ret_value = FAIL;
+ const H5T_t *dt1 = NULL;
+ const H5T_t *dt2 = NULL;
+ hbool_t ret_value = FAIL;
FUNC_ENTER(H5Tequal, FAIL);
@@ -505,6 +511,7 @@ H5Tequal(hid_t type1_id, hid_t type2_id)
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tlock
@@ -530,7 +537,7 @@ H5Tequal(hid_t type1_id, hid_t type2_id)
herr_t
H5Tlock(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tlock, FAIL);
@@ -540,8 +547,10 @@ H5Tlock(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
dt->locked = TRUE;
+
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_class
@@ -563,7 +572,7 @@ H5Tlock(hid_t type_id)
H5T_class_t
H5Tget_class(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tget_class, H5T_NO_CLASS);
@@ -572,8 +581,10 @@ H5Tget_class(hid_t type_id)
NULL == (dt = H5I_object(type_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type");
}
+
FUNC_LEAVE(dt->type);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_size
@@ -596,8 +607,8 @@ H5Tget_class(hid_t type_id)
size_t
H5Tget_size(hid_t type_id)
{
- H5T_t *dt = NULL;
- size_t size;
+ H5T_t *dt = NULL;
+ size_t size;
FUNC_ENTER(H5Tget_size, 0);
@@ -606,11 +617,13 @@ H5Tget_size(hid_t type_id)
NULL == (dt = H5I_object(type_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type");
}
+
/* size */
size = H5T_get_size(dt);
FUNC_LEAVE(size);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_size
@@ -643,8 +656,8 @@ H5Tget_size(hid_t type_id)
herr_t
H5Tset_size(hid_t type_id, size_t size)
{
- H5T_t *dt = NULL;
- size_t prec, offset;
+ H5T_t *dt = NULL;
+ size_t prec, offset;
FUNC_ENTER(H5Tset_size, FAIL);
@@ -713,12 +726,14 @@ H5Tset_size(hid_t type_id, size_t size)
}
/* Commit */
+ H5T_unshare (dt);
dt->size = size;
dt->u.atomic.offset = offset;
dt->u.atomic.prec = prec;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_order
@@ -739,8 +754,8 @@ H5Tset_size(hid_t type_id, size_t size)
H5T_order_t
H5Tget_order(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_order_t order;
+ H5T_t *dt = NULL;
+ H5T_order_t order;
FUNC_ENTER(H5Tget_order, H5T_ORDER_ERROR);
@@ -751,11 +766,13 @@ H5Tget_order(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR,
"not an atomic data type");
}
- /* order */
+
+ /* Order */
order = dt->u.atomic.order;
FUNC_LEAVE(order);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_order
@@ -776,7 +793,7 @@ H5Tget_order(hid_t type_id)
herr_t
H5Tset_order(hid_t type_id, H5T_order_t order)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_order, FAIL);
@@ -792,10 +809,13 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
if (order < 0 || order > H5T_ORDER_NONE) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order");
}
- /* order */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.order = order;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_precision
@@ -820,8 +840,8 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
size_t
H5Tget_precision(hid_t type_id)
{
- H5T_t *dt = NULL;
- size_t prec;
+ H5T_t *dt = NULL;
+ size_t prec;
FUNC_ENTER(H5Tget_precision, 0);
@@ -831,11 +851,13 @@ H5Tget_precision(hid_t type_id)
!H5T_is_atomic(dt)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an atomic data type");
}
- /* precision */
+
+ /* Precision */
prec = dt->u.atomic.prec;
FUNC_LEAVE(prec);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_precision
@@ -870,8 +892,8 @@ H5Tget_precision(hid_t type_id)
herr_t
H5Tset_precision(hid_t type_id, size_t prec)
{
- H5T_t *dt = NULL;
- size_t offset, size;
+ H5T_t *dt = NULL;
+ size_t offset, size;
FUNC_ENTER(H5Tset_prec, FAIL);
@@ -888,6 +910,7 @@ H5Tset_precision(hid_t type_id, size_t prec)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"precision must be positive");
}
+
/* Adjust the offset and size */
offset = dt->u.atomic.offset;
size = dt->size;
@@ -934,12 +957,14 @@ H5Tset_precision(hid_t type_id, size_t prec)
}
/* Commit */
+ H5T_unshare (dt);
dt->size = size;
dt->u.atomic.offset = offset;
dt->u.atomic.prec = prec;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_offset
@@ -976,8 +1001,8 @@ H5Tset_precision(hid_t type_id, size_t prec)
size_t
H5Tget_offset(hid_t type_id)
{
- H5T_t *dt = NULL;
- size_t offset;
+ H5T_t *dt = NULL;
+ size_t offset;
FUNC_ENTER(H5Tget_offset, 0);
@@ -987,11 +1012,13 @@ H5Tget_offset(hid_t type_id)
!H5T_is_atomic(dt)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an atomic data type");
}
- /* offset */
+
+ /* Offset */
offset = dt->u.atomic.offset;
FUNC_LEAVE(offset);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_offset
@@ -1035,7 +1062,7 @@ H5Tget_offset(hid_t type_id)
herr_t
H5Tset_offset(hid_t type_id, size_t offset)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_offset, FAIL);
@@ -1052,15 +1079,19 @@ H5Tset_offset(hid_t type_id, size_t offset)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"offset must be zero for this type");
}
+
/* Adjust the size */
if (offset + dt->u.atomic.prec > 8 * dt->size) {
dt->size = (offset + dt->u.atomic.prec + 7) / 8;
}
+
/* Commit */
+ H5T_unshare (dt);
dt->u.atomic.offset = offset;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_pad
@@ -1081,9 +1112,9 @@ H5Tset_offset(hid_t type_id, size_t offset)
*-------------------------------------------------------------------------
*/
herr_t
-H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ )
+H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tget_pad, FAIL);
@@ -1093,14 +1124,14 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ )
!H5T_is_atomic(dt)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type");
}
+
/* Get values */
- if (lsb)
- *lsb = dt->u.atomic.lsb_pad;
- if (msb)
- *msb = dt->u.atomic.msb_pad;
+ if (lsb) *lsb = dt->u.atomic.lsb_pad;
+ if (msb) *msb = dt->u.atomic.msb_pad;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_pad
@@ -1121,7 +1152,7 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ )
herr_t
H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_pad, FAIL);
@@ -1137,11 +1168,15 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb)
if (lsb < 0 || lsb >= H5T_NPAD || msb < 0 || msb >= H5T_NPAD) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type");
}
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.lsb_pad = lsb;
dt->u.atomic.msb_pad = msb;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_sign
@@ -1162,8 +1197,8 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb)
H5T_sign_t
H5Tget_sign(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_sign_t sign;
+ H5T_t *dt = NULL;
+ H5T_sign_t sign;
FUNC_ENTER(H5Tget_sign, H5T_SGN_ERROR);
@@ -1174,11 +1209,13 @@ H5Tget_sign(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR,
"not an integer data type");
}
- /* sign */
+
+ /* Sign */
sign = dt->u.atomic.u.i.sign;
FUNC_LEAVE(sign);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_sign
@@ -1199,7 +1236,7 @@ H5Tget_sign(hid_t type_id)
herr_t
H5Tset_sign(hid_t type_id, H5T_sign_t sign)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_sign, FAIL);
@@ -1215,10 +1252,13 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign)
if (sign < 0 || sign >= H5T_NSGN) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type");
}
- /* sign */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.i.sign = sign;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_fields
@@ -1243,11 +1283,11 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign)
*-------------------------------------------------------------------------
*/
herr_t
-H5Tget_fields(hid_t type_id, size_t *spos /*out */ ,
- size_t *epos /*out */ , size_t *esize /*out */ ,
- size_t *mpos /*out */ , size_t *msize /*out */ )
+H5Tget_fields(hid_t type_id, size_t *spos/*out*/,
+ size_t *epos/*out*/, size_t *esize/*out*/,
+ size_t *mpos/*out*/, size_t *msize/*out*/)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tget_fields, FAIL);
@@ -1258,20 +1298,17 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out */ ,
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a floating-point data type");
}
+
/* Get values */
- if (spos)
- *spos = dt->u.atomic.u.f.sign;
- if (epos)
- *epos = dt->u.atomic.u.f.epos;
- if (esize)
- *esize = dt->u.atomic.u.f.esize;
- if (mpos)
- *mpos = dt->u.atomic.u.f.mpos;
- if (msize)
- *msize = dt->u.atomic.u.f.msize;
+ if (spos) *spos = dt->u.atomic.u.f.sign;
+ if (epos) *epos = dt->u.atomic.u.f.epos;
+ if (esize) *esize = dt->u.atomic.u.f.esize;
+ if (mpos) *mpos = dt->u.atomic.u.f.mpos;
+ if (msize) *msize = dt->u.atomic.u.f.msize;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_fields
@@ -1299,7 +1336,7 @@ herr_t
H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
size_t mpos, size_t msize)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_fields, FAIL);
@@ -1325,6 +1362,7 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"sign location is not valid");
}
+
/* Check for overlap */
if (spos >= epos && spos < epos + esize) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -1339,7 +1377,9 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"exponent and mantissa fields overlap");
}
+
/* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.f.sign = spos;
dt->u.atomic.u.f.epos = epos;
dt->u.atomic.u.f.mpos = mpos;
@@ -1348,6 +1388,7 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_ebias
@@ -1368,8 +1409,8 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize,
size_t
H5Tget_ebias(hid_t type_id)
{
- H5T_t *dt = NULL;
- size_t ebias;
+ H5T_t *dt = NULL;
+ size_t ebias;
FUNC_ENTER(H5Tget_ebias, 0);
@@ -1380,11 +1421,13 @@ H5Tget_ebias(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0,
"not a floating-point data type");
}
+
/* bias */
ebias = dt->u.atomic.u.f.ebias;
FUNC_LEAVE(ebias);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_ebias
@@ -1405,7 +1448,7 @@ H5Tget_ebias(hid_t type_id)
herr_t
H5Tset_ebias(hid_t type_id, size_t ebias)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_ebias, FAIL);
@@ -1419,10 +1462,14 @@ H5Tset_ebias(hid_t type_id, size_t ebias)
if (dt->locked) {
HRETURN_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
}
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.f.ebias = ebias;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_norm
@@ -1444,8 +1491,8 @@ H5Tset_ebias(hid_t type_id, size_t ebias)
H5T_norm_t
H5Tget_norm(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_norm_t norm;
+ H5T_t *dt = NULL;
+ H5T_norm_t norm;
FUNC_ENTER(H5Tget_norm, H5T_NORM_ERROR);
@@ -1456,11 +1503,13 @@ H5Tget_norm(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR,
"not a floating-point data type");
}
+
/* norm */
norm = dt->u.atomic.u.f.norm;
FUNC_LEAVE(norm);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_norm
@@ -1482,7 +1531,7 @@ H5Tget_norm(hid_t type_id)
herr_t
H5Tset_norm(hid_t type_id, H5T_norm_t norm)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_norm, FAIL);
@@ -1499,10 +1548,13 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm)
if (norm < 0 || norm > H5T_NORM_NONE) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization");
}
- /* norm */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.f.norm = norm;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_inpad
@@ -1526,8 +1578,8 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm)
H5T_pad_t
H5Tget_inpad(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_pad_t pad;
+ H5T_t *dt = NULL;
+ H5T_pad_t pad;
FUNC_ENTER(H5Tget_inpad, H5T_PAD_ERROR);
@@ -1538,11 +1590,13 @@ H5Tget_inpad(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR,
"not a floating-point data type");
}
+
/* pad */
pad = dt->u.atomic.u.f.pad;
FUNC_LEAVE(pad);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_inpad
@@ -1566,7 +1620,7 @@ H5Tget_inpad(hid_t type_id)
herr_t
H5Tset_inpad(hid_t type_id, H5T_pad_t pad)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_inpad, FAIL);
@@ -1584,10 +1638,13 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"illegal internal pad type");
}
- /* pad */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.f.pad = pad;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_cset
@@ -1610,8 +1667,8 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad)
H5T_cset_t
H5Tget_cset(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_cset_t cset;
+ H5T_t *dt = NULL;
+ H5T_cset_t cset;
FUNC_ENTER(H5Tget_cset, H5T_CSET_ERROR);
@@ -1622,11 +1679,13 @@ H5Tget_cset(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR,
"not a string data type");
}
+
/* result */
cset = dt->u.atomic.u.s.cset;
FUNC_LEAVE(cset);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_cset
@@ -1649,7 +1708,7 @@ H5Tget_cset(hid_t type_id)
herr_t
H5Tset_cset(hid_t type_id, H5T_cset_t cset)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_cset, FAIL);
@@ -1666,10 +1725,13 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"illegal character set type");
}
- /* set */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.s.cset = cset;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_strpad
@@ -1693,8 +1755,8 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset)
H5T_str_t
H5Tget_strpad(hid_t type_id)
{
- H5T_t *dt = NULL;
- H5T_str_t strpad;
+ H5T_t *dt = NULL;
+ H5T_str_t strpad;
FUNC_ENTER(H5Tget_strpad, H5T_STR_ERROR);
@@ -1705,11 +1767,13 @@ H5Tget_strpad(hid_t type_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR,
"not a string data type");
}
+
/* result */
strpad = dt->u.atomic.u.s.pad;
FUNC_LEAVE(strpad);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tset_strpad
@@ -1733,7 +1797,7 @@ H5Tget_strpad(hid_t type_id)
herr_t
H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tset_strpad, FAIL);
@@ -1749,10 +1813,13 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
if (strpad < 0 || strpad >= H5T_NSTR) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type");
}
- /* set */
+
+ /* Commit */
+ H5T_unshare (dt);
dt->u.atomic.u.s.pad = strpad;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_nmembers
@@ -1777,7 +1844,7 @@ int
H5Tget_nmembers(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tget_num_members, FAIL);
@@ -1787,8 +1854,10 @@ H5Tget_nmembers(hid_t type_id)
H5T_COMPOUND != dt->type) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type");
}
+
FUNC_LEAVE(dt->u.compnd.nmembs);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_member_name
@@ -1813,8 +1882,8 @@ H5Tget_nmembers(hid_t type_id)
char *
H5Tget_member_name(hid_t type_id, int membno)
{
- H5T_t *dt = NULL;
- char *s = NULL;
+ H5T_t *dt = NULL;
+ char *s = NULL;
FUNC_ENTER(H5Tget_member_name, NULL);
@@ -1827,9 +1896,12 @@ H5Tget_member_name(hid_t type_id, int membno)
if (membno < 0 || membno >= dt->u.compnd.nmembs) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number");
}
+
+ /* Value */
s = H5MM_xstrdup(dt->u.compnd.memb[membno].name);
FUNC_LEAVE(s);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_member_offset
@@ -1854,8 +1926,8 @@ H5Tget_member_name(hid_t type_id, int membno)
size_t
H5Tget_member_offset(hid_t type_id, int membno)
{
- H5T_t *dt = NULL;
- size_t offset = 0;
+ H5T_t *dt = NULL;
+ size_t offset = 0;
FUNC_ENTER(H5Tget_member_offset, 0);
@@ -1868,9 +1940,13 @@ H5Tget_member_offset(hid_t type_id, int membno)
if (membno < 0 || membno >= dt->u.compnd.nmembs) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number");
}
+
+ /* Value */
offset = dt->u.compnd.memb[membno].offset;
+
FUNC_LEAVE(offset);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_member_dims
@@ -1895,8 +1971,8 @@ int
H5Tget_member_dims(hid_t type_id, int membno,
size_t dims[]/*out*/, int perm[]/*out*/)
{
- H5T_t *dt = NULL;
- intn ndims, i;
+ H5T_t *dt = NULL;
+ intn ndims, i;
FUNC_ENTER(H5Tget_member_dims, FAIL);
@@ -1909,16 +1985,17 @@ H5Tget_member_dims(hid_t type_id, int membno,
if (membno < 0 || membno >= dt->u.compnd.nmembs) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number");
}
+
+ /* Value */
ndims = dt->u.compnd.memb[membno].ndims;
for (i = 0; i < ndims; i++) {
- if (dims[i])
- dims[i] = dt->u.compnd.memb[membno].dim[i];
- if (perm[i])
- perm[i] = dt->u.compnd.memb[membno].perm[i];
+ if (dims[i]) dims[i] = dt->u.compnd.memb[membno].dim[i];
+ if (perm[i]) perm[i] = dt->u.compnd.memb[membno].perm[i];
}
FUNC_LEAVE(ndims);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tget_member_type
@@ -1943,8 +2020,8 @@ H5Tget_member_dims(hid_t type_id, int membno,
hid_t
H5Tget_member_type(hid_t type_id, int membno)
{
- H5T_t *dt = NULL, *memb_dt = NULL;
- hid_t memb_type_id;
+ H5T_t *dt = NULL, *memb_dt = NULL;
+ hid_t memb_type_id;
FUNC_ENTER(H5Tget_member_type, FAIL);
@@ -1957,6 +2034,7 @@ H5Tget_member_type(hid_t type_id, int membno)
if (membno < 0 || membno >= dt->u.compnd.nmembs) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number");
}
+
/* Copy data type into an atom */
if (NULL == (memb_dt = H5T_copy(dt->u.compnd.memb[membno].type))) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
@@ -1967,8 +2045,10 @@ H5Tget_member_type(hid_t type_id, int membno)
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
"can't register data type atom");
}
+
FUNC_LEAVE(memb_type_id);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tinsert
@@ -2001,8 +2081,8 @@ H5Tget_member_type(hid_t type_id, int membno)
herr_t
H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id)
{
- H5T_t *parent = NULL; /*the compound parent data type */
- H5T_t *member = NULL; /*the atomic member type */
+ H5T_t *parent = NULL; /*the compound parent data type */
+ H5T_t *member = NULL; /*the atomic member type */
FUNC_ENTER(H5Tinsert, FAIL);
@@ -2022,12 +2102,16 @@ H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id)
NULL == (member = H5I_object(member_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
}
+
+ /* Insert */
if (H5T_insert(parent, name, offset, member) < 0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL,
"can't insert member");
}
+
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5Tpack
@@ -2049,7 +2133,7 @@ H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id)
herr_t
H5Tpack(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5Tpack, FAIL);
@@ -2062,12 +2146,64 @@ H5Tpack(hid_t type_id)
if (dt->locked) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data type is read-only");
}
+
+ /* Pack */
if (H5T_pack(dt) < 0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to pack compound data type");
}
+
FUNC_LEAVE(SUCCEED);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tshare
+ *
+ * Purpose: Marks a data type as sharable. Using the type during the
+ * creation of a dataset will cause the dataset object header to
+ * point to the type in the global heap instead of containing
+ * the type directly in its object header. Subsequent
+ * modifications to a shared type cause the type to become
+ * unshared.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Tshare (hid_t loc_id, hid_t type_id)
+{
+ H5G_t *loc = NULL;
+ H5T_t *dt = NULL;
+
+ FUNC_ENTER (H5Tshare, FAIL);
+
+ /* Check arguments */
+ if (NULL==(loc=H5G_loc (loc_id))) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
+ }
+ if (H5_DATATYPE!=H5I_group (type_id) ||
+ NULL==(dt=H5I_object (type_id))) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ }
+
+ /* Make it sharable */
+ if (H5T_share (H5G_fileof (loc), dt)<0) {
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "unable to make data type sharable");
+ }
+
+ FUNC_LEAVE (SUCCEED);
+}
+
/*-------------------------------------------------------------------------
* Function: H5Tregister_hard
@@ -2217,7 +2353,7 @@ H5Tregister_soft(H5T_class_t src_cls, H5T_class_t dst_cls, H5T_conv_t func)
if ((path->func)(src_id, dst_id, &(path->cdata),
0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "HDF5-DIAG: conversion function failed "
+ fprintf (stderr, "H5T: conversion function failed "
"to free private data.\n");
#endif
H5E_clear();
@@ -2289,7 +2425,7 @@ H5Tunregister(H5T_conv_t func)
path->cdata.command = H5T_CONV_FREE;
if ((func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "HDF5-DIAG: conversion function failed to "
+ fprintf (stderr, "H5T: conversion function failed to "
"free private data.\n");
#endif
H5E_clear();
@@ -2364,8 +2500,8 @@ H5Tunregister(H5T_conv_t func)
H5T_conv_t
H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
{
- H5T_conv_t ret_value = NULL;
- H5T_t *src = NULL, *dst = NULL;
+ H5T_conv_t ret_value = NULL;
+ H5T_t *src = NULL, *dst = NULL;
FUNC_ENTER(H5Tfind, NULL);
@@ -2387,6 +2523,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
HRETURN_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL,
"conversion function not found");
}
+
FUNC_LEAVE(ret_value);
}
@@ -2413,10 +2550,10 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
*
*-------------------------------------------------------------------------
*/
-H5T_t *
+H5T_t *
H5T_create(H5T_class_t type, size_t size)
{
- H5T_t *dt = NULL;
+ H5T_t *dt = NULL;
FUNC_ENTER(H5T_create, NULL);
@@ -2445,6 +2582,7 @@ H5T_create(H5T_class_t type, size_t size)
dt->size = size;
FUNC_LEAVE(dt);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_copy
@@ -2466,9 +2604,9 @@ H5T_create(H5T_class_t type, size_t size)
H5T_t *
H5T_copy(const H5T_t *old_dt)
{
- H5T_t *new_dt=NULL, *tmp=NULL;
- intn i;
- char *s;
+ H5T_t *new_dt=NULL, *tmp=NULL;
+ intn i;
+ char *s;
FUNC_ENTER(H5T_copy, NULL);
@@ -2498,8 +2636,10 @@ H5T_copy(const H5T_t *old_dt)
new_dt->u.compnd.memb[i].type = tmp;
}
}
+
FUNC_LEAVE(new_dt);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_close
@@ -2542,6 +2682,93 @@ H5T_close(H5T_t *dt)
FUNC_LEAVE(SUCCEED);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_share
+ *
+ * Purpose: Causes a data type to be marked as sharable. If the data
+ * type isn't already marked sharable in the specified file then
+ * it is written to the global heap of that file and the heap
+ * location information is added to the sh_file and sh_heap
+ * fields of the data type.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_share (H5F_t *f, H5T_t *dt)
+{
+ FUNC_ENTER (H5T_share, FAIL);
+
+ /* Check args */
+ assert (f);
+ assert (dt);
+
+ /*
+ * If the type is sharable in some other file then unshare it first. A
+ * type can only be sharable in one file at a time.
+ */
+ if (H5HG_defined (&(dt->sh_heap)) && f->shared!=dt->sh_file->shared) {
+ H5T_unshare (dt);
+ H5E_clear (); /*don't really care if it fails*/
+ }
+
+ /*
+ * Write the message to the global heap if it isn't already shared in
+ * this file.
+ */
+ if (!H5HG_defined (&(dt->sh_heap))) {
+ if (H5O_share (f, H5O_DTYPE, dt, &(dt->sh_heap))<0) {
+ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "unable to store data type message in global heap");
+ }
+ dt->sh_file = f;
+ }
+
+ FUNC_LEAVE (SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_unshare
+ *
+ * Purpose: If a data type is in the global heap then this function
+ * removes that information from the H5T_t struct.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_unshare (H5T_t *dt)
+{
+ FUNC_ENTER (H5T_unshare, FAIL);
+
+ /* Check args */
+ assert (dt);
+
+ H5HG_undef (&(dt->sh_heap));
+ dt->sh_file = NULL;
+
+ FUNC_LEAVE (SUCCEED);
+}
+
/*-------------------------------------------------------------------------
* Function: H5T_is_atomic
@@ -2568,6 +2795,7 @@ H5T_is_atomic(const H5T_t *dt)
FUNC_LEAVE(H5T_COMPOUND == dt->type ? FALSE : TRUE);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_get_size
@@ -2597,6 +2825,7 @@ H5T_get_size(const H5T_t *dt)
FUNC_LEAVE(dt->size);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_insert
@@ -2659,6 +2888,7 @@ H5T_insert(H5T_t *parent, const char *name, off_t offset, const H5T_t *member)
}
/* Add member to end of member array */
+ H5T_unshare (parent);
i = parent->u.compnd.nmembs;
parent->u.compnd.memb[i].name = H5MM_xstrdup(name);
parent->u.compnd.memb[i].offset = offset;
@@ -2668,6 +2898,7 @@ H5T_insert(H5T_t *parent, const char *name, off_t offset, const H5T_t *member)
parent->u.compnd.nmembs++;
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_pack
@@ -2689,14 +2920,15 @@ H5T_insert(H5T_t *parent, const char *name, off_t offset, const H5T_t *member)
herr_t
H5T_pack(H5T_t *dt)
{
- int i;
- size_t offset;
+ int i;
+ size_t offset;
FUNC_ENTER(H5T_pack, FAIL);
assert(dt);
assert(!dt->locked);
+ H5T_unshare (dt);
if (H5T_COMPOUND == dt->type) {
/* Recursively pack the members */
for (i = 0; i < dt->u.compnd.nmembs; i++) {
@@ -2716,8 +2948,10 @@ H5T_pack(H5T_t *dt)
/* Change total size */
dt->size = MAX(1, offset);
}
+
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_sort_by_offset
@@ -2740,8 +2974,8 @@ H5T_pack(H5T_t *dt)
herr_t
H5T_sort_by_offset(H5T_t *dt)
{
- int i, j, nmembs;
- hbool_t swapped;
+ int i, j, nmembs;
+ hbool_t swapped;
FUNC_ENTER(H5T_sort_by_offset, FAIL);
@@ -2771,6 +3005,7 @@ H5T_sort_by_offset(H5T_t *dt)
FUNC_LEAVE(SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_cmp
@@ -2793,10 +3028,10 @@ H5T_sort_by_offset(H5T_t *dt)
intn
H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
{
- intn *idx1 = NULL, *idx2 = NULL;
- intn ret_value = 0;
- intn i, j, tmp;
- hbool_t swapped;
+ intn *idx1 = NULL, *idx2 = NULL;
+ intn ret_value = 0;
+ intn i, j, tmp;
+ hbool_t swapped;
FUNC_ENTER(H5T_equal, 0);
@@ -3016,6 +3251,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_find
*
@@ -3157,7 +3393,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create,
}
if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "HDF5-DIAG: conversion function init "
+ fprintf (stderr, "H5T: conversion function init "
"failed\n");
#endif
H5E_clear(); /*ignore the failure*/
@@ -3213,9 +3449,9 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create,
herr_t
H5T_debug(H5T_t *dt, FILE * stream)
{
- const char *s = "";
- int i, j;
- uint64 tmp;
+ const char *s = "";
+ int i, j;
+ uint64 tmp;
FUNC_ENTER(H5T_debug, FAIL);
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 02b7db3..0b4e86f 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -63,7 +63,7 @@ H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Nothing to free */
#ifdef H5T_DEBUG
if (cdata->ncalls>0) {
- fprintf (stderr, "HDF5-DIAG: H5T_conv_noop statistics...\n");
+ fprintf (stderr, "H5T: H5T_conv_noop statistics...\n");
fprintf (stderr, " Number of calls: %lu\n", cdata->ncalls);
fprintf (stderr, " Data points converted: %lu\n", cdata->nelmts);
}
@@ -174,7 +174,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Free private data */
#ifdef H5T_DEBUG
if (cdata->ncalls>0) {
- fprintf (stderr, "HDF5-DIAG: H5T_conv_order statistics...\n");
+ fprintf (stderr, "H5T: H5T_conv_order statistics...\n");
fprintf (stderr, " Number of calls: %lu\n", cdata->ncalls);
fprintf (stderr, " Data points converted: %lu\n", cdata->nelmts);
}
@@ -396,7 +396,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
#ifdef H5T_DEBUG
if (cdata->ncalls>0) {
- fprintf (stderr, "HDF5-DIAG: H5T_conv_struct statistics...\n");
+ fprintf (stderr, "H5T: H5T_conv_struct statistics...\n");
fprintf (stderr, " Number of calls: %lu\n", cdata->ncalls);
fprintf (stderr, " Data points converted: %lu\n", cdata->nelmts);
}
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index be52256..84b1235 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -23,6 +23,7 @@
# undef H5T_DEBUG
#endif
+#include <H5HGprivate.h>
#include <H5Tprivate.h>
typedef struct H5T_atomic_t {
@@ -62,6 +63,8 @@ typedef struct H5T_compnd_t {
struct H5T_t {
hbool_t locked; /*if locked, then can't be modified */
+ H5HG_t sh_heap; /*if defined, type is in global heap */
+ H5F_t *sh_file; /*file pointer if this is a shared type */
H5T_class_t type; /*which class of type is this? */
size_t size; /*total size of an instance of this type */
union {
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 7ff5d18..27d27f3 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -32,6 +32,8 @@ herr_t H5T_init_interface (void);
H5T_t *H5T_create (H5T_class_t type, size_t size);
H5T_t *H5T_copy (const H5T_t *old_dt);
herr_t H5T_close (H5T_t *dt);
+herr_t H5T_share (H5F_t *f, H5T_t *dt);
+herr_t H5T_unshare (H5T_t *dt);
size_t H5T_get_size (const H5T_t *dt);
intn H5T_cmp (const H5T_t *dt1, const H5T_t *dt2);
hbool_t H5T_is_atomic (const H5T_t *dt);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index f546200..f362cdf 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -184,6 +184,7 @@ hid_t H5Tcopy (hid_t type_id);
herr_t H5Tclose (hid_t type_id);
hbool_t H5Tequal (hid_t type1_id, hid_t type2_id);
herr_t H5Tlock (hid_t type_id);
+herr_t H5Tshare (hid_t location_id, hid_t type_id);
/* Operations defined on compound data types */
herr_t H5Tinsert (hid_t parent_id, const char *name, off_t offset,
diff --git a/src/Makefile.in b/src/Makefile.in
index 7c5a8a5..20b4ae3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -20,7 +20,7 @@ LIB_SRC=H5.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c H5Ffamily.c \
H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c H5G.c H5Gent.c \
H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c H5MM.c H5O.c H5Ocont.c \
H5Odtype.c H5Oefl.c H5Olayout.c H5Oname.c H5Onull.c H5Osdspace.c \
- H5Ostab.c H5P.c H5S.c H5Ssimp.c H5T.c H5Tconv.c H5Tinit.c \
+ H5Oshared.c H5Ostab.c H5P.c H5S.c H5Ssimp.c H5T.c H5Tconv.c H5Tinit.c \
H5V.c @PARALLEL_SRC@
LIB_OBJ=$(LIB_SRC:.c=.o)
diff --git a/test/.distdep b/test/.distdep
index 03ec460..895c967 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -66,9 +66,12 @@ tohdr.o: \
../src/H5Bpublic.h \
../src/H5Oprivate.h \
../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
../src/H5Tprivate.h \
../src/H5Tpublic.h \
- ../src/H5Sprivate.h
+ ../src/H5Sprivate.h \
+ ../src/H5Spublic.h
tstab.o: \
tstab.c \
testhdf5.h \
@@ -92,9 +95,12 @@ tstab.o: \
../src/H5Bpublic.h \
../src/H5Oprivate.h \
../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
../src/H5Tprivate.h \
../src/H5Tpublic.h \
- ../src/H5Sprivate.h
+ ../src/H5Sprivate.h \
+ ../src/H5Spublic.h
th5s.o: \
th5s.c \
testhdf5.h \
@@ -114,10 +120,10 @@ th5s.o: \
../src/H5Gpublic.h \
../src/H5Oprivate.h \
../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Pprivate.h \
- ../src/H5Ppublic.h
+ ../src/H5Tpublic.h
dtypes.o: \
dtypes.c \
../src/hdf5.h \
@@ -169,8 +175,11 @@ istore.o: \
../src/H5MMpublic.h \
../src/H5Oprivate.h \
../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
../src/H5Tprivate.h \
- ../src/H5Tpublic.h
+ ../src/H5Tpublic.h \
+ ../src/H5Sprivate.h
dsets.o: \
dsets.c \
../src/hdf5.h \
@@ -262,3 +271,19 @@ iopipe.o: \
../src/H5Ppublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
+gheap.o: \
+ gheap.c \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Bprivate.h \
+ ../src/H5Bpublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h
diff --git a/test/Makefile.in b/test/Makefile.in
index f4d9009..7017e9d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -11,9 +11,9 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-PROGS=testhdf5 hyperslab istore dtypes dsets cmpd_dset extend external \
+PROGS=testhdf5 gheap hyperslab istore dtypes dsets cmpd_dset extend external \
iopipe
-TESTS=testhdf5 hyperslab istore dtypes dsets cmpd_dset extend external
+TESTS=testhdf5 gheap hyperslab istore dtypes dsets cmpd_dset extend external
TIMINGS=iopipe
# Temporary files
@@ -21,7 +21,8 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
tfile3.h5 th5s1.h5 theap.h5 tohdr.h5 tstab1.h5 tstab2.h5 \
extern_1.h5 extern_2.h5 extern_3.h5 extern_1.raw extern_1b.raw \
extern_2.raw extern_2b.raw extern_3.raw extern_3b.raw \
- extern_4.raw extern_4b.raw iopipe.raw iopipe.h5
+ extern_4.raw extern_4b.raw iopipe.raw iopipe.h5 gheap0.h5 \
+ gheap1.h5 gheap2.h5 gheap3.h5 gheap4.h5
# Source and object files for programs... The PROG_SRC list contains all the
# source files and is used for things like dependencies, archiving, etc. The
@@ -29,12 +30,15 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
# overlap with other tests.
PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c dtypes.c \
hyperslab.c istore.c dsets.c cmpd_dset.c extend.c external.c \
- iopipe.c
+ iopipe.c gheap.c
PROG_OBJ=$(PROG_SRC:.c=.o)
TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c
TESTHDF5_OBJ=$(TESTHDF5_SRC:.c=.o)
+GHEAP_SRC=gheap.c
+GHEAP_OBJ=$(GHEAP_SRC:.c=.o)
+
DSETS_SRC=dsets.c
DSETS_OBJ=$(DSETS_SRC:.c=.o)
@@ -79,6 +83,9 @@ timings _timings: $(TIMINGS)
testhdf5: $(TESTHDF5_OBJ) ../src/libhdf5.a
$(CC) $(CFLAGS) -o $@ $(TESTHDF5_OBJ) ../src/libhdf5.a $(LIBS)
+gheap: $(GHEAP_OBJ) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ $(GHEAP_OBJ) ../src/libhdf5.a $(LIBS)
+
dsets: $(DSETS_OBJ) ../src/libhdf5.a
$(CC) $(CFLAGS) -o $@ $(DSETS_OBJ) ../src/libhdf5.a $(LIBS)
diff --git a/test/gheap.c b/test/gheap.c
new file mode 100644
index 0000000..4183a84
--- /dev/null
+++ b/test/gheap.c
@@ -0,0 +1,398 @@
+/*
+ * Copyright (C) 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Tuesday, March 31, 1998
+ *
+ * Purpose: Tests the global heap. The global heap is the set of all
+ * collections but the collections are not related to one
+ * another by anything that appears in the file format.
+ */
+#include <H5private.h>
+#include <H5Eprivate.h>
+#include <H5Fprivate.h>
+#include <H5Gprivate.h>
+#include <H5HGprivate.h>
+#include <H5Pprivate.h>
+
+#ifndef HAVE_FUNCTION
+# undef __FUNCTION__
+# define __FUNCTION__ ""
+#endif
+
+#define FAILED(S) { \
+ puts ("*FAILED*"); \
+ printf (" Failed at %s:%d in %s()%s%s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ (S)&&*(S)?": ":"", (S)?(S):""); \
+ H5Eprint (stdout); \
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: emit_diagnostics
+ *
+ * Purpose: If debugging is turned on then this function will cause the
+ * library to emit it's diagnostic messages now instead of when
+ * we're trying to make the output look nice.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+emit_diagnostics (void)
+{
+ H5F_t *f = H5F_open ("gheap0.h5", H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
+ NULL, NULL);
+ H5G_t *g = H5G_create (f->shared->root_grp, "emit", 0);
+ H5G_close (g);
+ H5F_close (f);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_1
+ *
+ * Purpose: Writes a sequence of objects to the global heap where each
+ * object is larger than the one before.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_1 (void)
+{
+ H5F_t *f;
+ H5HG_t obj[1024];
+ uint8 out[1024];
+ uint8 in[1024];
+ int i;
+ size_t size;
+ herr_t status;
+ int retval = 0;
+
+ printf ("%-70s", "...monotonically increasing lengths");
+ fflush (stdout);
+
+ /* Open a clean file */
+ H5Eclear ();
+ f = H5F_open ("gheap1.h5", H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
+ NULL, NULL);
+ if (!f) {
+ FAILED ("unable to create file");
+ return -1;
+ }
+
+ /*
+ * Write the objects, monotonically increasing in length. Since this is
+ * a clean file, the addresses allocated for the collections should also
+ * be monotonically increasing.
+ */
+ for (i=0; i<1024; i++) {
+ size = i+1;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ status = H5HG_insert (f, size, out, obj+i);
+ if (status<0) {
+ FAILED ("unable to insert object into global heap");
+ --retval;
+ } else if (i && H5F_addr_gt (&(obj[i-1].addr), &(obj[i].addr))) {
+ FAILED ("collection addresses are not monotonically increasing");
+ --retval;
+ }
+ }
+
+ /*
+ * Now try to read each object back.
+ */
+ for (i=0; i<1024; i++) {
+ size = i+1;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ if (NULL==H5HG_read (f, obj+i, in)) {
+ FAILED ("unable to read object");
+ --retval;
+ } else if (memcmp (in, out, size)) {
+ FAILED ("value read doesn't match value written");
+ --retval;
+ }
+ }
+
+ H5F_close (f);
+ puts (" PASSED");
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_2
+ *
+ * Purpose: Writes a sequence of objects to the global heap where each
+ * object is smaller than the one before.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_2 (void)
+{
+ H5F_t *f;
+ H5HG_t obj[1024];
+ uint8 out[1024];
+ uint8 in[1024];
+ int i;
+ size_t size;
+ herr_t status;
+ int retval = 0;
+
+ printf ("%-70s", "...monotonically decreasing lengths");
+ fflush (stdout);
+
+ /* Open a clean file */
+ H5Eclear ();
+ f = H5F_open ("gheap2.h5", H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
+ NULL, NULL);
+ if (!f) {
+ FAILED ("unable to create file");
+ return -1;
+ }
+
+ /*
+ * Write the objects, monotonically decreasing in length.
+ */
+ for (i=0; i<1024; i++) {
+ size = 1024-i;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ status = H5HG_insert (f, size, out, obj+i);
+ if (status<0) {
+ FAILED ("unable to insert object into global heap");
+ --retval;
+ }
+ }
+
+ /*
+ * Now try to read each object back.
+ */
+ for (i=0; i<1024; i++) {
+ size = 1024-i;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ if (NULL==H5HG_read (f, obj+i, in)) {
+ FAILED ("unable to read object");
+ --retval;
+ } else if (memcmp (in, out, size)) {
+ FAILED ("value read doesn't match value written");
+ --retval;
+ }
+ }
+
+ H5F_close (f);
+ puts (" PASSED");
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_3
+ *
+ * Purpose: Creates a few global heap objects and then removes them all.
+ * The collection should also be removed.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_3 (void)
+{
+ H5F_t *f;
+ H5HG_t obj[1024];
+ uint8 out[1024];
+ int i;
+ size_t size;
+ herr_t status;
+ int retval = 0;
+
+ printf ("%-70s", "...complete object removal");
+ fflush (stdout);
+
+ /* Open a clean file */
+ H5Eclear ();
+ f = H5F_open ("gheap3.h5", H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
+ NULL, NULL);
+ if (!f) {
+ FAILED ("unable to create file");
+ return -1;
+ }
+
+ /* Create some stuff */
+ for (i=0; i<1024; i++) {
+ size = i%30+100;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ status = H5HG_insert (f, size, out, obj+i);
+ if (status<0) {
+ FAILED ("unable to insert object into global heap");
+ --retval;
+ }
+ }
+
+ /* Remove everything */
+ for (i=0; i<1024; i++) {
+ status = H5HG_remove (f, obj+i);
+ if (status<0) {
+ FAILED ("unable to remove object");
+ --retval;
+ }
+ }
+
+ H5F_close (f);
+ puts (" PASSED");
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_4
+ *
+ * Purpose: Tests the H5HG_remove() feature by writing lots of objects
+ * and occassionally removing some. When we're done they're all
+ * removed.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_4 (void)
+{
+ H5F_t *f;
+ H5HG_t obj[1024];
+ uint8 out[1024];
+ int i;
+ size_t size;
+ herr_t status;
+ int retval = 0;
+
+ printf ("%-70s", "...partial object removal");
+ fflush (stdout);
+
+ /* Open a clean file */
+ H5Eclear ();
+ f = H5F_open ("gheap4.h5", H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
+ NULL, NULL);
+ if (!f) {
+ FAILED ("unable to create file");
+ return -1;
+ }
+
+
+ for (i=0; i<1024; i++) {
+ /* Insert */
+ size = i%30+100;
+ memset (out, 'A'+i%26, size);
+ H5Eclear ();
+ status = H5HG_insert (f, size, out, obj+i);
+ if (status<0) {
+ FAILED ("unable to insert object into global heap");
+ --retval;
+ }
+
+ /*
+ * Remove every third one beginning with the second, but after the
+ * next one has already been inserted. That is, insert A, B, C;
+ * remove B, insert D, E, F; remove E; etc.
+ */
+ if (1==i%3) {
+ H5Eclear ();
+ status = H5HG_remove (f, obj+i-1);
+ if (status<0) {
+ FAILED ("unable to remove object");
+ --retval;
+ }
+ memset (obj+i-1, 0, sizeof *obj);
+ }
+ }
+
+ H5F_close (f);
+ puts (" PASSED");
+ return retval;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests global heap.
+ *
+ * Return: Success: zero
+ *
+ * Failure: non-zero
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 31, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ int nfailed=0;
+
+ emit_diagnostics ();
+
+
+ nfailed += test_1()<0 ? 1 : 0;
+ nfailed += test_2()<0 ? 1 : 0;
+ nfailed += test_3()<0 ? 1 : 0;
+ nfailed += test_4()<0 ? 1 : 0;
+
+ if (nfailed) {
+ printf ("*** %d global heap test%s failed ***\n",
+ nfailed, 1==nfailed?"":"s");
+ } else {
+ printf ("All global heap tests passed.\n");
+ }
+ return nfailed?-1:0;
+}