From 2b18e934c6812fd1b487ebfebf9240b009c3e4ae Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 21 Oct 2013 11:12:33 -0500 Subject: [svn-r24336] Bring revisions #24118 - #24200 from trunk. --- CMakeFilters.cmake | 10 +- CMakeInstallation.cmake | 18 +- CMakeLists.txt | 1 + CTestConfig.cmake | 4 +- MANIFEST | 9 + Makefile.in | 1 + README.txt | 2 +- UserMacros.cmake | 5 + c++/Makefile.in | 1 + c++/examples/Makefile.am | 20 +- c++/examples/Makefile.in | 22 +- c++/examples/h5tutr_cmprss.cpp | 162 +++++++ c++/examples/h5tutr_crtatt.cpp | 95 ++++ c++/examples/h5tutr_crtdat.cpp | 82 ++++ c++/examples/h5tutr_crtgrp.cpp | 69 +++ c++/examples/h5tutr_crtgrpar.cpp | 92 ++++ c++/examples/h5tutr_crtgrpd.cpp | 141 ++++++ c++/examples/h5tutr_extend.cpp | 176 ++++++++ c++/examples/h5tutr_rdwt.cpp | 79 ++++ c++/examples/h5tutr_subset.cpp | 183 ++++++++ c++/examples/run-c++-ex.sh.in | 31 ++ c++/src/H5AbstractDs.h | 13 +- c++/src/H5ArrayType.h | 6 +- c++/src/H5AtomType.cpp | 4 +- c++/src/H5AtomType.h | 8 +- c++/src/H5Attribute.cpp | 4 +- c++/src/H5Attribute.h | 6 +- c++/src/H5Classes.h | 6 +- c++/src/H5CommonFG.cpp | 133 +----- c++/src/H5CommonFG.h | 20 +- c++/src/H5CompType.h | 6 +- c++/src/H5Cpp.h | 6 +- c++/src/H5CppDoc.h | 6 +- c++/src/H5DataSet.cpp | 59 +-- c++/src/H5DataSet.h | 16 +- c++/src/H5DataSpace.cpp | 7 +- c++/src/H5DataSpace.h | 9 +- c++/src/H5DataType.cpp | 64 +-- c++/src/H5DataType.h | 16 +- c++/src/H5DcreatProp.h | 6 +- c++/src/H5DxferProp.h | 6 +- c++/src/H5EnumType.h | 6 +- c++/src/H5Exception.h | 6 +- c++/src/H5FaccProp.h | 6 +- c++/src/H5FcreatProp.h | 6 +- c++/src/H5File.cpp | 13 +- c++/src/H5File.h | 12 +- c++/src/H5FloatType.h | 6 +- c++/src/H5Group.cpp | 42 +- c++/src/H5Group.h | 18 +- c++/src/H5IdComponent.cpp | 15 +- c++/src/H5IdComponent.h | 8 +- c++/src/H5IntType.h | 6 +- c++/src/H5Library.h | 6 +- c++/src/H5Location.cpp | 491 ++++++++++++++------- c++/src/H5Location.h | 59 ++- c++/src/H5Object.cpp | 3 +- c++/src/H5Object.h | 8 +- c++/src/H5PredType.cpp | 2 + c++/src/H5PredType.h | 8 +- c++/src/H5PropList.cpp | 10 +- c++/src/H5PropList.h | 8 +- c++/src/H5StrType.h | 6 +- c++/src/H5VarLenType.h | 6 +- c++/src/Makefile.am | 5 +- c++/src/Makefile.in | 11 +- c++/test/Makefile.in | 1 + c++/test/dsets.cpp | 11 +- c++/test/h5cpputil.cpp | 24 + c++/test/h5cpputil.h | 2 + c++/test/th5s.cpp | 5 +- c++/test/trefer.cpp | 676 ++++++++++++++++++++++++----- config/cmake/CPack.Info.plist.in | 57 ++- config/cmake/CTestCustom.cmake | 2 + config/cmake/ConfigureChecks.cmake | 18 +- config/cmake/H5pubconf.h.in | 78 ++-- config/cmake/UserMacros/Windows_MT.cmake | 2 + config/gnu-flags | 5 - config/lt_vers.am | 2 +- configure | 125 ++++-- configure.ac | 56 ++- examples/Makefile.in | 1 + fortran/Makefile.in | 1 + fortran/examples/Makefile.in | 1 + fortran/src/Makefile.am | 5 +- fortran/src/Makefile.in | 11 +- fortran/test/Makefile.in | 1 + fortran/testpar/Makefile.in | 1 + hl/Makefile.in | 1 + hl/c++/Makefile.in | 1 + hl/c++/examples/Makefile.in | 1 + hl/c++/src/Makefile.am | 5 +- hl/c++/src/Makefile.in | 11 +- hl/c++/test/Makefile.in | 1 + hl/examples/Makefile.in | 1 + hl/fortran/Makefile.in | 1 + hl/fortran/examples/Makefile.in | 1 + hl/fortran/src/Makefile.am | 5 +- hl/fortran/src/Makefile.in | 11 +- hl/fortran/test/Makefile.in | 1 + hl/src/Makefile.am | 5 +- hl/src/Makefile.in | 11 +- hl/test/Makefile.in | 1 + hl/tools/Makefile.in | 1 + hl/tools/gif2h5/Makefile.in | 1 + hl/tools/h5watch/Makefile.in | 1 + perform/Makefile.in | 1 + release_docs/INSTALL_CMake.txt | 27 +- release_docs/RELEASE.txt | 26 +- src/CMakeLists.txt | 7 +- src/H5F.c | 13 +- src/H5Fpkg.h | 2 +- src/H5Fsuper.c | 62 +-- src/H5PL.c | 6 +- src/H5Z.c | 4 - src/H5config.h.in | 2 +- src/H5detect.c | 329 ++++++++------ src/H5public.h | 4 +- src/Makefile.am | 1 - src/Makefile.in | 27 +- src/libhdf5.settings.in | 2 +- test/Makefile.in | 1 + test/testfiles/error_test_1 | 3 + testpar/Makefile.in | 1 + tools/Makefile.in | 1 + tools/h5copy/Makefile.in | 1 + tools/h5diff/Makefile.in | 1 + tools/h5diff/h5diff_common.c | 7 +- tools/h5dump/Makefile.in | 1 + tools/h5dump/errfiles/filter_fail.err | 3 + tools/h5dump/h5dump_ddl.c | 6 +- tools/h5import/Makefile.in | 1 + tools/h5jam/Makefile.in | 1 + tools/h5ls/Makefile.in | 1 + tools/h5ls/h5ls.c | 70 +-- tools/h5repack/Makefile.am | 4 +- tools/h5repack/Makefile.in | 3 +- tools/h5repack/h5repack_main.c | 148 +++---- tools/h5repack/h5repack_plugin.sh.in | 2 +- tools/h5repack/testfiles/h5repack-help.txt | 10 +- tools/h5stat/Makefile.in | 1 + tools/lib/Makefile.in | 1 + tools/lib/h5diff.c | 14 +- tools/lib/h5diff.h | 2 +- tools/lib/h5diff_array.c | 10 +- tools/lib/h5diff_attr.c | 12 +- tools/lib/h5tools_filters.c | 2 +- tools/misc/Makefile.in | 1 + vms/src/h5pubconf.h | 6 +- 149 files changed, 3082 insertions(+), 1261 deletions(-) create mode 100644 c++/examples/h5tutr_cmprss.cpp create mode 100644 c++/examples/h5tutr_crtatt.cpp create mode 100644 c++/examples/h5tutr_crtdat.cpp create mode 100644 c++/examples/h5tutr_crtgrp.cpp create mode 100644 c++/examples/h5tutr_crtgrpar.cpp create mode 100644 c++/examples/h5tutr_crtgrpd.cpp create mode 100644 c++/examples/h5tutr_extend.cpp create mode 100644 c++/examples/h5tutr_rdwt.cpp create mode 100644 c++/examples/h5tutr_subset.cpp diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 01594d0..bc78fa6 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -25,11 +25,11 @@ IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT SET (ZLIB_URL ${ZLIB_SVN_URL}) SET (SZIP_URL ${SZIP_SVN_URL}) ELSEIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - IF (NOT TGZ_PATH) - SET (TGZ_PATH ${HDF5_SOURCE_DIR}) - ENDIF (NOT TGZ_PATH) - SET (ZLIB_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME}) - SET (SZIP_URL ${TGZ_PATH}/${SZIP_TGZ_NAME}) + IF (NOT TGZPATH) + SET (TGZPATH ${HDF5_SOURCE_DIR}) + ENDIF (NOT TGZPATH) + SET (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) + SET (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") SET (ZLIB_USE_EXTERNAL 0) SET (SZIP_USE_EXTERNAL 0) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 8a7cf16..18464ac 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -229,7 +229,16 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_PACKAGE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") SET (CPACK_SET_DESTDIR TRUE) # Required when packaging, and set CMAKE_INSTALL_PREFIX to "/". - LIST (APPEND CPACK_GENERATOR "Bundle") +# LIST (APPEND CPACK_GENERATOR "Bundle") + SET (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") + SET (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / + SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") + SET (CPACK_BUNDLE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") + SET (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") +# SET (CPACK_BUNDLE_STARTUP_COMMAND "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-startup.sh") + SET (CPACK_APPLE_GUI_INFO_STRING "HDF5 (Hierarchical Data Format 5) Software Library and Utilities") + SET (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2013 by The HDF Group. All rights reserved.") + SET (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}") #----------------------------------------------------------------------------- # Configure the Info.plist file for the install bundle #----------------------------------------------------------------------------- @@ -237,13 +246,8 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ${HDF5_RESOURCES_DIR}/CPack.Info.plist.in ${HDF5_BINARY_DIR}/CMakeFiles/Info.plist @ONLY ) - SET (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") - SET (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / - SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") - SET (CPACK_BUNDLE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") - SET (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") -# SET (CPACK_BUNDLE_STARTUP_COMMAND "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-startup.sh") ELSE (WIN32) + LIST (APPEND CPACK_GENERATOR "STGZ") SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ddc562..fde7616 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,6 +460,7 @@ ENDIF (HDF5_DISABLE_COMPILER_WARNINGS) # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- IF (NOT MSVC) + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") # Append warning flags # Don't use the '-Wtraditional' flag, we're way past having K&R C code # SET (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 5d8f25c..92bd300 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -9,8 +9,8 @@ SET (CTEST_NIGHTLY_START_TIME "18:00:00 CST") SET (CTEST_DROP_METHOD "http") IF (CDASH_LOCAL) - SET (CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu") - SET (CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5+Trunk") + SET (CTEST_DROP_SITE "72.36.68.252") + SET (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk") ELSE (CDASH_LOCAL) SET (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu") SET (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk") diff --git a/MANIFEST b/MANIFEST index e4c9963..846ebc0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -402,6 +402,15 @@ ./c++/examples/expected.out ./c++/examples/extend_ds.cpp ./c++/examples/h5group.cpp +./c++/examples/h5tutr_cmprss.cpp +./c++/examples/h5tutr_crtatt.cpp +./c++/examples/h5tutr_crtdat.cpp +./c++/examples/h5tutr_crtgrpar.cpp +./c++/examples/h5tutr_crtgrp.cpp +./c++/examples/h5tutr_crtgrpd.cpp +./c++/examples/h5tutr_extend.cpp +./c++/examples/h5tutr_rdwt.cpp +./c++/examples/h5tutr_subset.cpp ./c++/examples/readdata.cpp ./c++/examples/testh5c++.sh.in ./c++/examples/writedata.cpp diff --git a/Makefile.in b/Makefile.in index a53e904..0c6890b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -290,6 +290,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/README.txt b/README.txt index 5271969..8394049 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.164-swmr0 currently under development +HDF5 version 1.9.165-swmr0 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/UserMacros.cmake b/UserMacros.cmake index d7d3ef9..4c680ed 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -3,6 +3,8 @@ ######################################################## #----------------------------------------------------------------------------- +#------------------- E X A M P L E B E G I N-------------------------------- +#----------------------------------------------------------------------------- # Option to Build with User Defined Values #----------------------------------------------------------------------------- MACRO (MACRO_USER_DEFINED_LIBS) @@ -14,4 +16,7 @@ OPTION (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) IF (BUILD_USER_DEFINED_LIBS) MACRO_USER_DEFINED_LIBS () ENDIF (BUILD_USER_DEFINED_LIBS) +#----------------------------------------------------------------------------- +#------------------- E X A M P L E E N D ----------------------------------- +#----------------------------------------------------------------------------- \ No newline at end of file diff --git a/c++/Makefile.in b/c++/Makefile.in index 232299d..492970b 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -255,6 +255,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am index cd9a9f6..f479776 100644 --- a/c++/examples/Makefile.am +++ b/c++/examples/Makefile.am @@ -23,12 +23,18 @@ include $(top_srcdir)/config/commence.am # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group +EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group \ + h5tutr_cmprss h5tutr_crtatt h5tutr_crtdat h5tutr_crtgrpar \ + h5tutr_crtgrp h5tutr_crtgrpd h5tutr_extend h5tutr_rdwt \ + h5tutr_subset TEST_SCRIPT=testh5c++.sh # These are the example files to be installed INSTALL_FILES=create.cpp readdata.cpp writedata.cpp compound.cpp \ - extend_ds.cpp chunks.cpp h5group.cpp + extend_ds.cpp chunks.cpp h5group.cpp \ + h5tutr_cmprss.cpp h5tutr_crtatt.cpp h5tutr_crtdat.cpp \ + h5tutr_crtgrpar.cpp h5tutr_crtgrp.cpp h5tutr_crtgrpd.cpp \ + h5tutr_extend.cpp h5tutr_rdwt.cpp h5tutr_subset.cpp INSTALL_SCRIPT_FILES = run-c++-ex.sh # Some of the examples depend on files created by running other examples @@ -58,5 +64,15 @@ extend_ds: $(srcdir)/extend_ds.cpp chunks: $(srcdir)/chunks.cpp h5group: $(srcdir)/h5group.cpp +h5tutr_cmprss: $(srcdir)/h5tutr_cmprss.cpp +h5tutr_crtatt: $(srcdir)/h5tutr_crtatt.cpp +h5tutr_crtdat: $(srcdir)/h5tutr_crtdat.cpp +h5tutr_crtgrpar: $(srcdir)/h5tutr_crtgrpar.cpp +h5tutr_crtgrp: $(srcdir)/h5tutr_crtgrp.cpp +h5tutr_crtgrpd: $(srcdir)/h5tutr_crtgrpd.cpp +h5tutr_extend: $(srcdir)/h5tutr_extend.cpp +h5tutr_rdwt: $(srcdir)/h5tutr_rdwt.cpp +h5tutr_subset: $(srcdir)/h5tutr_subset.cpp + include $(top_srcdir)/config/examples.am include $(top_srcdir)/config/conclude.am diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index e8aa093..f392787 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -391,12 +392,19 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG = create readdata writedata compound extend_ds chunks h5group +EXAMPLE_PROG = create readdata writedata compound extend_ds chunks h5group \ + h5tutr_cmprss h5tutr_crtatt h5tutr_crtdat h5tutr_crtgrpar \ + h5tutr_crtgrp h5tutr_crtgrpd h5tutr_extend h5tutr_rdwt \ + h5tutr_subset + TEST_SCRIPT = testh5c++.sh # These are the example files to be installed INSTALL_FILES = create.cpp readdata.cpp writedata.cpp compound.cpp \ - extend_ds.cpp chunks.cpp h5group.cpp + extend_ds.cpp chunks.cpp h5group.cpp \ + h5tutr_cmprss.cpp h5tutr_crtatt.cpp h5tutr_crtdat.cpp \ + h5tutr_crtgrpar.cpp h5tutr_crtgrp.cpp h5tutr_crtgrpd.cpp \ + h5tutr_extend.cpp h5tutr_rdwt.cpp h5tutr_subset.cpp INSTALL_SCRIPT_FILES = run-c++-ex.sh @@ -668,6 +676,16 @@ extend_ds: $(srcdir)/extend_ds.cpp chunks: $(srcdir)/chunks.cpp h5group: $(srcdir)/h5group.cpp +h5tutr_cmprss: $(srcdir)/h5tutr_cmprss.cpp +h5tutr_crtatt: $(srcdir)/h5tutr_crtatt.cpp +h5tutr_crtdat: $(srcdir)/h5tutr_crtdat.cpp +h5tutr_crtgrpar: $(srcdir)/h5tutr_crtgrpar.cpp +h5tutr_crtgrp: $(srcdir)/h5tutr_crtgrp.cpp +h5tutr_crtgrpd: $(srcdir)/h5tutr_crtgrpd.cpp +h5tutr_extend: $(srcdir)/h5tutr_extend.cpp +h5tutr_rdwt: $(srcdir)/h5tutr_rdwt.cpp +h5tutr_subset: $(srcdir)/h5tutr_subset.cpp + # How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): -$(top_srcdir)/bin/mkdirs $@ diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp new file mode 100644 index 0000000..7db73c4 --- /dev/null +++ b/c++/examples/h5tutr_cmprss.cpp @@ -0,0 +1,162 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a compressed dataset. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("cmprss.h5"); +const H5std_string DATASET_NAME("Compressed_Data"); +const int DIM0 = 100; +const int DIM1 = 20; + +int main (void) +{ + hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions + hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions + int i,j, buf[DIM0][DIM1]; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. + DataSpace *dataspace = new DataSpace(2, dims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList *plist = new DSetCreatPropList; + plist->setChunk(2, chunk_dims); + + // Set ZLIB (DEFLATE) Compression using level 6. + // To use SZIP compression comment out this line. + plist->setDeflate(6); + + // Uncomment these lines to set SZIP Compression + // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; + // unsigned szip_pixels_per_block = 16; + // plist->setSzip(szip_options_mask, szip_pixels_per_block); + + // Create the dataset. + DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, *dataspace, *plist) ); + + for (i = 0; i< DIM0; i++) + for (j=0; jwrite(buf, PredType::NATIVE_INT); + + // Close objects and file. Either approach will close the HDF5 item. + delete dataspace; + delete dataset; + delete plist; + file.close(); + + // ----------------------------------------------- + // Re-open the file and dataset, retrieve filter + // information for dataset and read the data back. + // ----------------------------------------------- + + int rbuf[DIM0][DIM1]; + int numfilt; + size_t nelmts={1}, namelen={1}; + unsigned flags, filter_info, cd_values[1], idx; + char name[1]; + H5Z_filter_t filter_type; + + // Open the file and the dataset in the file. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASET_NAME)); + + // Get the create property list of the dataset. + plist = new DSetCreatPropList(dataset->getCreatePlist ()); + + // Get the number of filters associated with the dataset. + numfilt = plist->getNfilters(); + cout << "Number of filters associated with dataset: " << numfilt << endl; + + for (idx=0; idx < numfilt; idx++) { + nelmts = 0; + + filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); + + cout << "Filter Type: "; + + switch (filter_type) { + case H5Z_FILTER_DEFLATE: + cout << "H5Z_FILTER_DEFLATE" << endl; + break; + case H5Z_FILTER_SZIP: + cout << "H5Z_FILTER_SZIP" << endl; + break; + default: + cout << "Other filter type included." << endl; + } + } + + // Read data. + dataset->read(rbuf, PredType::NATIVE_INT); + + delete plist; + delete dataset; + file.close(); // can be skipped + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp new file mode 100644 index 0000000..651dc69 --- /dev/null +++ b/c++/examples/h5tutr_crtatt.cpp @@ -0,0 +1,95 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create an attribute attached to a + * dataset. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME( "dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const H5std_string ATTR_NAME( "Units" ); + +const int DIM1 = 2; + +int main (void) +{ + int attr_data[2] = { 100, 200}; + hsize_t dims[1] = { DIM1 }; + + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Open an existing file and dataset. + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + // Create the data space for the attribute. + DataSpace attr_dataspace = DataSpace (1, dims ); + + // Create a dataset attribute. + Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, + attr_dataspace); + + // Write the attribute data. + attribute.write( PredType::NATIVE_INT, attr_data); + + } // end of try block + + // catch failure caused by the H5File operations + catch( DataSpaceIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the H5File operations + catch( AttributeIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the H5File operations + catch( FileIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch( DataSetIException error ) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp new file mode 100644 index 0000000..d7f887e --- /dev/null +++ b/c++/examples/h5tutr_crtdat.cpp @@ -0,0 +1,82 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset that is a 4 x 6 + * array. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME("dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int NX = 4; // dataset dimensions +const int NY = 6; +const int RANK = 2; + +int main (void) +{ + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. + hsize_t dims[2]; // dataset dimensions + dims[0] = NX; + dims[1] = NY; + DataSpace dataspace(RANK, dims); + + // Create the dataset. + DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp new file mode 100644 index 0000000..bbafd10 --- /dev/null +++ b/c++/examples/h5tutr_crtgrp.cpp @@ -0,0 +1,69 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create and close a group. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("group.h5"); + +int main(void) +{ + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create a group named "/MygGroup" in the file + Group group(file.createGroup("/MyGroup")); + + // File and group will be closed as their instances go out of scope. + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp new file mode 100644 index 0000000..d58dff6 --- /dev/null +++ b/c++/examples/h5tutr_crtgrpar.cpp @@ -0,0 +1,92 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates the creation of groups using absolute and + * relative names. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("groups.h5"); + +int main(void) +{ + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately. + + Exception::dontPrint(); + + // Create a new file using default properties. + + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create group "MyGroup" in the root group using an absolute name. + + Group group1(file.createGroup( "/MyGroup")); + + // Create group "Group_A" in group "MyGroup" using an + // absolute name. + + Group group2(file.createGroup("/MyGroup/Group_A")); + + // Create group "Group_B" in group "MyGroup" using a + // relative name. + + Group group3(group1.createGroup ("Group_B")); + + // Close the groups and file. + + group1.close(); + group2.close(); + group3.close(); + file.close(); + + } // end of try block + + // catch failure caused by the File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} + + diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp new file mode 100644 index 0000000..fdb9108 --- /dev/null +++ b/c++/examples/h5tutr_crtgrpd.cpp @@ -0,0 +1,141 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset in a group. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("groups.h5"); +const H5std_string DATASET_NAME1("/MyGroup/dset1"); +const H5std_string DATASET_NAME2("dset2"); +const int RANK = 2; +const int D1DIM1 = 3; +const int D1DIM2 = 3; +const int D2DIM1 = 2; +const int D2DIM2 = 10; + +int main(void) +{ + int dset1_data[D1DIM1][D1DIM2], dset2_data[D2DIM1][D2DIM2]; // data buffers + int i, j; + + // Try block to catch exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Initialize the first dataset. + for (i = 0; i < D1DIM1; i++) + for (j = 0; j < D1DIM2; j++) + dset1_data[i][j] = j + 1; + + // Initialize the second dataset. + for (i = 0; i < D2DIM1; i++) + for (j = 0; j < D2DIM2; j++) + dset2_data[i][j] = j + 1; + + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); + + // Create the data space for the first dataset. Note the use of + // pointer for the instance 'dataspace'. It can be deleted and + // used again later for another data space. An HDF5 identifier is + // closed by the destructor or the method 'close()'. + hsize_t dims[RANK]; // dataset dimensions + dims[0] = D1DIM1; + dims[1] = D1DIM2; + DataSpace *dataspace = new DataSpace (RANK, dims); + + // Create the dataset in group "MyGroup". Same note as for the + // dataspace above. + DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset1_data, PredType::NATIVE_INT); + + // Close the current dataset and data space. + delete dataset; + delete dataspace; + + // Create the data space for the second dataset. + dims[0] = D2DIM1; + dims[1] = D2DIM2; + dataspace = new DataSpace (RANK, dims); + + // Create group "Group_A" in group "MyGroup". + Group group(file.openGroup("/MyGroup/Group_A")); + + // Create the second dataset in group "Group_A". + dataset = new DataSet (group.createDataSet(DATASET_NAME2, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset2_data, PredType::NATIVE_INT); + + // Close all objects. + delete dataspace; + delete dataset; + group.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp new file mode 100644 index 0000000..c3a18d7 --- /dev/null +++ b/c++/examples/h5tutr_extend.cpp @@ -0,0 +1,176 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset that is a 4 x 6 + * array. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("extend.h5"); +const H5std_string DATASETNAME("ExtendibleArray"); + +int main (void) +{ + hsize_t dims[2] = {3,3}; // dataset dimensions at creation + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={2, 5}; + int data[3][3] = { {1, 1, 1}, // data to write + {1, 1, 1}, + {1, 1, 1} }; + + // Variables used in extending and writing to the extended portion of dataset + + hsize_t size[2]; + hsize_t offset[2]; + hsize_t dimsext[2] = {7, 3}; // extend dimensions + int dataext[7][3] = { {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4} }; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. Note the use of pointer + // for the instance 'dataspace'. It can be deleted and used again + // later for another dataspace. An HDF5 identifier can be closed + // by the destructor or the method 'close()'. + DataSpace *dataspace = new DataSpace (2, dims, maxdims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList prop; + prop.setChunk(2, chunk_dims); + + // Create the chunked dataset. Note the use of pointer. + DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, + PredType::STD_I32BE, *dataspace, prop) ); + + // Write data to dataset. + dataset->write(data, PredType::NATIVE_INT); + + // Extend the dataset. Dataset becomes 10 x 3. + size[0] = dims[0] + dimsext[0]; + size[1] = dims[1]; + dataset->extend(size); + + // Select a hyperslab in extended portion of the dataset. + DataSpace *filespace = new DataSpace(dataset->getSpace ()); + offset[0] = 3; + offset[1] = 0; + filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); + + // Define memory space. + DataSpace *memspace = new DataSpace(2, dimsext, NULL); + + // Write data to the extended portion of the dataset. + dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataspace; + delete dataset; + file.close(); + + // --------------------------------------- + // Re-open the file and read the data back + // --------------------------------------- + + int rdata[10][3]; + int i,j, rank, rank_chunk; + hsize_t chunk_dimsr[2], dimsr[2]; + + // Open the file and dataset. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASETNAME)); + + // Get the dataset's dataspace and creation property list. + filespace = new DataSpace(dataset->getSpace()); + prop = dataset->getCreatePlist(); + + // Get information to obtain memory dataspace. + rank = filespace->getSimpleExtentNdims(); + herr_t status_n = filespace->getSimpleExtentDims(dimsr); + + if (H5D_CHUNKED == prop.getLayout()) + rank_chunk = prop.getChunk(rank, chunk_dimsr); + + memspace = new DataSpace(rank, dimsr, NULL); + dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); + + cout << endl; + for (j = 0; j < dimsr[0]; j++) { + for (i = 0; i < dimsr[1]; i++) + cout << " " << rdata[j][i]; + cout << endl; + } + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataset; + file.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp new file mode 100644 index 0000000..e6e45b7 --- /dev/null +++ b/c++/examples/h5tutr_rdwt.cpp @@ -0,0 +1,79 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to write to and read from an existing + * dataset. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME( "dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const int DIM0 = 4; // dataset dimensions +const int DIM1 = 6; + +int main (void) +{ + + // Data initialization. + + int i, j; + int data[DIM0][DIM1]; // buffer for data to write + + for (j = 0; j < DIM0; j++) + for (i = 0; i < DIM1; i++) + data[j][i] = i * 6 + j + 1; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Open an existing file and dataset. + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset.write( data, PredType::NATIVE_INT ); + + } // end of try block + + // catch failure caused by the H5File operations + catch( FileIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch( DataSetIException error ) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp new file mode 100644 index 0000000..77174ab --- /dev/null +++ b/c++/examples/h5tutr_subset.cpp @@ -0,0 +1,183 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to read/write a subset of data (a slab) + * from/to a dataset in an HDF5 file. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("subset.h5"); +const H5std_string DATASET_NAME("IntArray"); + +const int RANK = 2; +const int DIM0_SUB = 3; // subset dimensions +const int DIM1_SUB = 4; +const int DIM0 = 8; // size of dataset +const int DIM1 = 10; + +int main (void) +{ + int i,j; + int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1]; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // --------------------------------------------------- + // Create a new file using the default property lists. + // Then create a dataset and write data to it. + // Close the file and dataset. + // --------------------------------------------------- + + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + hsize_t dims[2]; + dims[0] = DIM0; + dims[1] = DIM1; + DataSpace dataspace = DataSpace (RANK, dims); + + DataSet dataset(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, dataspace) ); + + + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + if (i< (DIM1/2)) + data[j][i] = 1; + else + data[j][i] = 2; + } + + dataset.write(data, PredType::NATIVE_INT); + + cout << endl << "Data Written to File:" << endl; + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + cout << " " << data[j][i]; + cout << endl; + } + + dataspace.close(); + dataset.close(); + file.close(); + + // --------------------------------------------------- + // Reopen the file and dataset and write a subset of + // values to the dataset. + // --------------------------------------------------- + + hsize_t offset[2], count[2], stride[2], block[2]; + hsize_t dimsm[2]; + + file.openFile(FILE_NAME, H5F_ACC_RDWR); + dataset = file.openDataSet(DATASET_NAME); + + // Specify size and shape of subset to write. + + offset[0] = 1; + offset[1] = 2; + + count[0] = DIM0_SUB; + count[1] = DIM1_SUB; + + stride[0] = 1; + stride[1] = 1; + + block[0] = 1; + block[1] = 1; + + // Define Memory Dataspace. Get file dataspace and select + // a subset from the file dataspace. + + dimsm[0] = DIM0_SUB; + dimsm[1] = DIM1_SUB; + + DataSpace memspace(RANK, dimsm, NULL); + + dataspace = dataset.getSpace(); + dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); + + // Write a subset of data to the dataset, then read the + // entire dataset back from the file. + + cout << endl << "Write subset to file specifying: " << endl; + cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; + for (j = 0; j < DIM0_SUB; j++) { + for (i = 0; i < DIM1_SUB; i++) + sdata[j][i] = 5; + } + + dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); + dataset.read(rdata, PredType::NATIVE_INT); + + + cout << endl << "Data in File after Subset is Written:" << endl; + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) + cout << " " << rdata[i][j]; + cout << endl; + } + cout << endl; + + // It is not necessary to close these objects because close() will + // be called when the object instances are going out of scope. + dataspace.close(); + memspace.close(); + dataset.close(); + file.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index 6b33577..77ac36a 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -64,6 +64,10 @@ RunTest() # Run tests if [ $? -eq 0 ] then + echo "*************************************************" + echo "** Run C++ API Examples **" + echo "** **" + echo "*************************************************" if (RunTest create &&\ rm create &&\ RunTest readdata &&\ @@ -82,6 +86,33 @@ then else EXIT_VALUE=${EXIT_FAILURE} fi + echo + echo "***************************************************" + echo "** Run Tutorial Examples **" + echo "** **" + echo "***************************************************" + if (RunTest h5tutr_crtdat &&\ + rm h5tutr_crtdat &&\ + RunTest h5tutr_rdwt &&\ + rm h5tutr_rdwt &&\ + RunTest h5tutr_crtatt &&\ + rm h5tutr_crtatt &&\ + RunTest h5tutr_crtgrp &&\ + rm h5tutr_crtgrp &&\ + RunTest h5tutr_crtgrpar &&\ + rm h5tutr_crtgrpar &&\ + RunTest h5tutr_crtgrpd &&\ + rm h5tutr_crtgrpd &&\ + RunTest h5tutr_extend &&\ + rm h5tutr_extend &&\ + RunTest h5tutr_subset &&\ + rm h5tutr_subset &&\ + RunTest h5tutr_cmprss &&\ + rm h5tutr_cmprss ); then + EXIT_VALUE=${EXIT_SUCCESS} + else + EXIT_VALUE=${EXIT_FAILURE} + fi fi # Cleanup diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 354b47b..6635f78 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -19,8 +19,8 @@ // Attribute and DataSet. It also inherits from H5Object and passes down // the services that H5Object provides. -#ifndef _AbstractDs_H -#define _AbstractDs_H +#ifndef __AbstractDs_H +#define __AbstractDs_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -51,18 +51,17 @@ class H5_DLLCPP AbstractDs { StrType getStrType() const; VarLenType getVarLenType() const; - // Gets the size in memory of this abstract dataset. + ///\brief Gets the size in memory of this abstract dataset. virtual size_t getInMemDataSize() const = 0; - // Gets the dataspace of this abstract dataset - pure virtual. + ///\brief Gets the dataspace of this abstract dataset - pure virtual. virtual DataSpace getSpace() const = 0; // Gets the class of the datatype that is used by this abstract // dataset. H5T_class_t getTypeClass() const; - // Returns the amount of storage size required for this abstract - // dataset - pure virtual. + ///\brief Returns the amount of storage size required - pure virtual. virtual hsize_t getStorageSize() const = 0; ///\brief Returns this class name. @@ -88,4 +87,4 @@ class H5_DLLCPP AbstractDs { #ifndef H5_NO_NAMESPACE } #endif -#endif // _AbstractDs_H +#endif // __AbstractDs_H diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 7daafed..d2e3c29 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -17,8 +17,8 @@ // Class ArrayType inherits from DataType and provides wrappers for the // HDF5 C's Array Datatypes. -#ifndef _H5ArrayType_H -#define _H5ArrayType_H +#ifndef __H5ArrayType_H +#define __H5ArrayType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -59,4 +59,4 @@ class H5_DLLCPP ArrayType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5ArrayType_H diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 975cad6..09f762f 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -45,7 +45,6 @@ AtomType::AtomType() : DataType() {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType copy constructor @@ -53,6 +52,7 @@ AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType( const AtomType& original ) : DataType( original ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType::setSize @@ -285,12 +285,14 @@ void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::~AtomType() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 25770f5..e8d6513 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -19,8 +19,8 @@ // subclasses. It also inherits from DataType and passes down the // services that are common to all the datatypes. -#ifndef _H5AtomType_H -#define _H5AtomType_H +#ifndef __H5AtomType_H +#define __H5AtomType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -60,11 +60,13 @@ class H5_DLLCPP AtomType : public DataType { ///\brief Returns this class name. virtual H5std_string fromClass () const { return("AtomType"); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Copy constructor - makes copy of the original object AtomType( const AtomType& original ); // Noop destructor virtual ~AtomType(); +#endif // DOXYGEN_SHOULD_SKIP_THIS protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -78,4 +80,4 @@ class H5_DLLCPP AtomType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5AtomType_H diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 120ed39..a98a970 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,6 +44,7 @@ namespace H5 { #endif // H5_NO_STD #endif +class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute @@ -411,7 +412,8 @@ void Attribute::flush(H5F_scope_t scope) const //-------------------------------------------------------------------------- // Function: Attribute::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this attribute +///\return Attribute identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index dd37a99..2d01205 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Attribute_H -#define _H5Attribute_H +#ifndef __H5Attribute_H +#define __H5Attribute_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -99,4 +99,4 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Attribute_H diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index c3b61ca..de7cf4a 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Classes_H -#define _H5Classes_H +#ifndef __H5Classes_H +#define __H5Classes_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -49,4 +49,4 @@ namespace H5 { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Classes_H diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 0651c29..3bf4b4f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,137 +460,6 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::setComment( const char* name, const char* comment ) const -{ - herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const -{ - setComment( name.c_str(), comment.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May 2005 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getLocId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if( ret_value < 0 ) { - delete []comment_C; - throwException("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const -{ - return( getComment( name.c_str(), bufsize )); -} - -//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group @@ -1138,6 +1007,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const } #endif /* H5_NO_DEPRECATED_SYMBOLS */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: CommonFG default constructor ///\brief Default constructor. @@ -1151,6 +1021,7 @@ CommonFG::CommonFG() {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CommonFG::~CommonFG() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 4f32d21..1748d1d 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -18,8 +18,8 @@ // common services that are provided by H5File and Group. The file or // group in the context of this class is referred to as 'location'. -#ifndef _CommonFG_H -#define _CommonFG_H +#ifndef __CommonFG_H +#define __CommonFG_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -49,18 +49,6 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; - - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; @@ -152,7 +140,6 @@ class H5_DLLCPP CommonFG { /// object id, i.e. file or group id. virtual hid_t getLocId() const = 0; -#endif // DOXYGEN_SHOULD_SKIP_THIS /// For subclasses, H5File and Group, to throw appropriate exception. virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0; @@ -162,11 +149,12 @@ class H5_DLLCPP CommonFG { // Noop destructor. virtual ~CommonFG(); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of CommonFG declaration #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __CommonFG_H diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 9b2b572..16ae839 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -17,8 +17,8 @@ // Class CompType inherits from DataType and provides accesses to a compound // datatype. -#ifndef _H5CompType_H -#define _H5CompType_H +#ifndef __H5CompType_H +#define __H5CompType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -111,4 +111,4 @@ class H5_DLLCPP CompType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5CompType_H diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index ddf4f19..044108b 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5CPP_H -#define _H5CPP_H +#ifndef __H5Cpp_H +#define __H5Cpp_H #include "H5Include.h" #include "H5Exception.h" @@ -56,4 +56,4 @@ #define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#endif +#endif // __H5Cpp_H diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index ab3fa79..baeca64 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5CPPDOC_H -#define _H5CPPDOC_H +#ifndef __H5CppDoc_H +#define __H5CppDoc_H //------------------------------------------------------------------------- // The following section will be used to generate the 'Mainpage' @@ -88,4 +88,4 @@ /// This example shows how to work with groups. ///\example h5group.cpp -#endif +#endif // __H5CppDoc_H diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 6a1524d..0722ef9 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -79,57 +79,29 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 location, creates a /// DataSet object -///\param obj - IN: Dataset reference object is in or location of +///\param loc - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c obj can be DataSet, Group, H5File, or named DataType, that +/// \c loc can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by object", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a -/// DataSet object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by HDF5 file", - deref_error.getDetailMsg()); - } + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced"); } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 attribute, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -140,14 +112,9 @@ DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : Abstrac // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) { - try { - id = p_dereference(attr.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by attribute", - deref_error.getDetailMsg()); - } + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -430,7 +397,7 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp // Function: DataSet::read ///\brief This is an overloaded member function, provided for convenience. /// It takes a reference to a \c H5std_string for the buffer. -///\param buf - IN: Buffer for read data +///\param strg - IN: Buffer for read data string ///\param mem_type - IN: Memory datatype ///\param mem_space - IN: Memory dataspace ///\param file_space - IN: Dataset's dataspace in the file @@ -647,6 +614,7 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) //-------------------------------------------------------------------------- // Function: DataSet::getId ///\brief Get the id of this dataset. +///\return DataSet identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDs and Attribute are moved out of H5Object. In @@ -726,8 +694,9 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space HDfree(strg_C); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataSet::p_setId (private) +// Function: DataSet::p_setId (protected) ///\brief Sets the identifier of this dataset to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 @@ -749,10 +718,8 @@ void DataSet::p_setId(const hid_t new_id) } // reset object's id to the given id id = new_id; - - // increment the reference counter of the new id - //incRefCount(); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSet::close diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 54e9d6f..a3a6a76 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -16,8 +16,8 @@ // Class DataSet inherits from AbstractDs and provides accesses to a dataset. -#ifndef _H5DataSet_H -#define _H5DataSet_H +#ifndef __H5DataSet_H +#define __H5DataSet_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -76,16 +76,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Default constructor. DataSet(); @@ -105,7 +101,6 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { private: hid_t id; // HDF5 dataset id -#ifndef DOXYGEN_SHOULD_SKIP_THIS // This function contains the common code that is used by // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific @@ -117,6 +112,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataset id. virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS @@ -124,4 +120,4 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataSet_H diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 755ca5b..059c812 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::H5Sselect_elements +// Function: DataSpace::selectElements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be @@ -556,7 +556,8 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h //-------------------------------------------------------------------------- // Function: DataSpace::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this dataspace +///\return Dataspace identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -570,6 +571,7 @@ hid_t DataSpace::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSpace::p_setId ///\brief Sets the identifier of this object to a new value. @@ -594,6 +596,7 @@ void DataSpace::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSpace::close diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 9afb8ab..1ea7188 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DataSpace_H -#define _H5DataSpace_H +#ifndef __H5DataSpace_H +#define __H5DataSpace_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -122,10 +122,13 @@ class H5_DLLCPP DataSpace : public IdComponent { hid_t id; // HDF5 dataspace id protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataspace id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS + }; #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataSpace_H diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 99525bc..be05623 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -49,6 +49,13 @@ namespace H5 { #endif //-------------------------------------------------------------------------- +// Function: DataType default constructor +///\brief Default constructor: Creates a stub datatype +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +DataType::DataType() : H5Object(), id(0) {} + +//-------------------------------------------------------------------------- // Function: DataType overloaded constructor ///\brief Creates a datatype using an existing datatype's id ///\param existing_id - IN: Id of the existing datatype @@ -88,32 +95,6 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Function: DataType overload constructor - dereference ///\brief Given a reference, ref, to an hdf5 group, creates a /// DataType object -///\param obj - IN: Specifying location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::ReferenceException -///\par Description -/// \c obj can be DataSet, Group, or named DataType, that -/// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() -{ - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataType constructor - located by an H5Object", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a -/// DataType object ///\param h5file - IN: Location referenced object is in ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT @@ -123,14 +104,11 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataType constructor - located by an H5File", - deref_error.getDetailMsg()); - } + /* H5Location::dereference(loc, ref, ref_type, plist); + */ + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -146,24 +124,19 @@ DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Obj // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(attr.getId(), ref, ref_type); + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); + /* try { + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- -// Function: DataType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType::DataType() : H5Object(), id(0) {} - -//-------------------------------------------------------------------------- // Function: DataType copy constructor ///\brief Copy constructor: makes a copy of the original DataType object. // Programmer Binh-Minh Ribler - 2000 @@ -681,7 +654,8 @@ bool DataType::isVariableStr() const //-------------------------------------------------------------------------- // Function: DataType::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this datatype +///\return Datatype identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -695,6 +669,7 @@ hid_t DataType::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataType::p_setId ///\brief Sets the identifier of this object to a new value. @@ -719,6 +694,7 @@ void DataType::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataType::close diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 98514bb..104eed4 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DataType_H -#define _H5DataType_H +#ifndef __H5DataType_H +#define __H5DataType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -30,9 +30,8 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Closes this datatype. virtual void close(); @@ -101,9 +100,6 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } @@ -120,10 +116,12 @@ class H5_DLLCPP DataType : public H5Object { virtual ~DataType(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS hid_t id; // HDF5 datatype id // Sets the datatype id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS private: void p_commit(hid_t loc_id, const char* name); @@ -131,4 +129,4 @@ class H5_DLLCPP DataType : public H5Object { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataType_H diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index ac7664e..385bc61 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DSCreatPropList_H -#define _H5DSCreatPropList_H +#ifndef __H5DSCreatPropList_H +#define __H5DSCreatPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -123,4 +123,4 @@ class H5_DLLCPP DSetCreatPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DSCreatPropList_H diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index bf481c3..b136ba4 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DSetMemXferPropList_H -#define _H5DSetMemXferPropList_H +#ifndef __H5DSetMemXferPropList_H +#define __H5DSetMemXferPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -102,5 +102,5 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DSetMemXferPropList_H diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 914eb66..71e36c3 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5EnumType_H -#define _H5EnumType_H +#ifndef __H5EnumType_H +#define __H5EnumType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -74,4 +74,4 @@ class H5_DLLCPP EnumType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5EnumType_H diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index b4af2ba..8b12abc 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Exception_H -#define _H5Exception_H +#ifndef __H5Exception_H +#define __H5Exception_H #include @@ -161,4 +161,4 @@ class H5_DLLCPP IdComponentException : public Exception { } #endif -#endif // _H5Exception_H +#endif // __H5Exception_H diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 0c2cc21..040b3e9 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FileAccPropList_H -#define _H5FileAccPropList_H +#ifndef __H5FileAccPropList_H +#define __H5FileAccPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -139,4 +139,4 @@ class H5_DLLCPP FileAccPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FileAccPropList_H diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 61074ea..b11be62 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FileCreatPropList_H -#define _H5FileCreatPropList_H +#ifndef __H5FileCreatPropList_H +#define __H5FileCreatPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -78,4 +78,4 @@ class H5_DLLCPP FileCreatPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FileCreatPropList_H diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index ede7469..77dd7be 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -82,7 +82,7 @@ H5File::H5File() : H5Location(), id(0) {} // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) +H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) { try { p_get_file(name, flags, create_plist, access_plist); @@ -107,7 +107,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) +H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) { try { p_get_file(name.c_str(), flags, create_plist, access_plist); @@ -116,6 +116,7 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // This function is private and contains common code between the // constructors taking a string or a char* @@ -146,6 +147,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } } } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5File copy constructor @@ -518,7 +520,8 @@ hid_t H5File::getLocId() const //-------------------------------------------------------------------------- // Function: H5File::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this file +///\return File identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -532,8 +535,9 @@ hid_t H5File::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File::p_setId +// Function: H5File::p_setId (protected) ///\brief Sets the identifier of this object to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 @@ -556,6 +560,7 @@ void H5File::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5File::close diff --git a/c++/src/H5File.h b/c++/src/H5File.h index cfb6bdf..830dda0 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5File_H -#define _H5File_H +#ifndef __H5File_H +#define __H5File_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -61,9 +61,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; @@ -100,13 +97,12 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { private: hid_t id; // HDF5 file id -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // This function is private and contains common code between the // constructors taking a string or a char* void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file id. virtual void p_setId(const hid_t new_id); @@ -116,4 +112,4 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5File_H diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index cbb9541..06148d6 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FloatType_H -#define _H5FloatType_H +#ifndef __H5FloatType_H +#define __H5FloatType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -71,4 +71,4 @@ class H5_DLLCPP FloatType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FloatType_H diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index e83b635..6299ea3 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,33 +99,11 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("Group constructor - located by an H5Object", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("Group constructor - located by an H5File", - deref_error.getDetailMsg()); - } + /* H5Location::dereference(loc, ref, ref_type, plist); + */ + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -137,19 +115,23 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); +/* try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); } +*/ } //-------------------------------------------------------------------------- // Function: Group::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this group +///\return Group identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -163,6 +145,7 @@ hid_t Group::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: Group::p_setId ///\brief Sets the identifier of this object to a new value. @@ -187,6 +170,7 @@ void Group::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: Group::close diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index e4c2415..a5e324c 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Group_H -#define _H5Group_H +#ifndef __H5Group_H +#define __H5Group_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -26,9 +26,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -39,9 +36,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + */ + Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // default constructor Group(); @@ -62,10 +60,12 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { hid_t id; // HDF5 group id protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Group_H diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 9f96277..c60d05c 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -144,6 +144,8 @@ int IdComponent::getCounter() const //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id) { + if (obj_id == 0) + return H5I_BADID; // invalid H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) return H5I_BADID; // invalid @@ -269,7 +271,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// H5File and H5Object subclasses. +// Attribute and H5Location subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const @@ -314,6 +316,9 @@ H5std_string IdComponent::p_get_file_name() const //-------------------------------------------------------------------------- bool IdComponent::p_valid_id(const hid_t obj_id) { + if (obj_id == 0) + return false; + H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) return false; @@ -321,6 +326,14 @@ bool IdComponent::p_valid_id(const hid_t obj_id) return true; } +// Notes about IdComponent::id +// May 2008 - BMR +// Class hierarchy is revised to address bugzilla 1068... +// ...member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. +// (reasons: 1. encountered problems when adding H5Location; +// 2. Scott Meyers, item 33) + #endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 7dc1da3..5a61947 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _IdComponent_H -#define _IdComponent_H +#ifndef __IdComponent_H +#define __IdComponent_H // IdComponent represents an HDF5 object that has an identifier. @@ -44,8 +44,10 @@ class H5_DLLCPP IdComponent { // Assignment operator. IdComponent& operator=( const IdComponent& rhs ); +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Gets the identifier of this object. virtual hid_t getId () const = 0; +#endif // DOXYGEN_SHOULD_SKIP_THIS // Sets the identifier of this object to a new value. void setId(const hid_t new_id); @@ -96,4 +98,4 @@ class H5_DLLCPP IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __IdComponent_H diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 53864ee..02efb64 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5IntType_H -#define _H5IntType_H +#ifndef __H5IntType_H +#define __H5IntType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -53,4 +53,4 @@ class H5_DLLCPP IntType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5IntType_H diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index a3e1c99..c92a943 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Library_H -#define _H5Library_H +#ifndef __H5Library_H +#define __H5Library_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -67,4 +67,4 @@ class H5_DLLCPP H5Library { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Library_H diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 98878d7..22db85c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -55,22 +55,20 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Location::H5Location() : IdComponent(0) {} +H5Location::H5Location() : IdComponent() {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS - //-------------------------------------------------------------------------- // Function: H5Location copy constructor ///\brief Copy constructor: makes a copy of the original H5Location @@ -80,6 +78,8 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5Location::createAttribute ///\brief Creates an attribute for a group, dataset, or named datatype. @@ -342,7 +342,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException +///\exception H5::Exception ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -355,7 +355,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + throw Exception(inMemFunc("flush"), "H5Fflush failed"); } } @@ -377,36 +377,198 @@ H5std_string H5Location::getFileName() const } //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::Exception +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* name, const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const +{ + setComment(name.c_str(), comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it doesn't take +/// an object name. +// Programmer Binh-Minh Ribler - Sep 2013 +// Modification +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a comment. +// Programmer Binh-Minh Ribler - Sep 2013 +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& comment) const +{ + setComment(comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::Exception +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::Exception +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const char* name, size_t bufsize) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if (ret_value < 0) { + delete []comment_C; + throw Exception(inMemFunc("getComment"), "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const +{ + return(getComment(name.c_str(), bufsize)); +} +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +//-------------------------------------------------------------------------- +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); if (ret_value < 0) { - throw ReferenceException("", "H5Rcreate failed"); + throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed"); } } +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -414,48 +576,79 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa p_reference(ref, name, dataspace.getId(), ref_type); } catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::ReferenceException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name) const +void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const { try { - p_reference(ref, name, -1, H5R_OBJECT); + p_reference(ref, name.c_str(), dataspace.getId(), ref_type); } catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it does not take +/// a DataSpace object and the reference type must be specified. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\exception H5::ReferenceException +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const +{ + try { + p_reference(ref, name, -1, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name) const +void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const { - reference(ref, name.c_str()); + reference(ref, name.c_str(), ref_type); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::p_dereference (protected) // Purpose Dereference a ref into an hdf5 object. @@ -470,18 +663,23 @@ void H5Location::reference(void* ref, const H5std_string& name) const // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func) { - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + hid_t plist_id; + if (p_valid_id(plist.getId())) + plist_id = plist.getId(); + else + plist_id = H5P_DEFAULT; + + hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); if (temp_id < 0) { - throw ReferenceException("", "H5Rdereference failed"); + throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed"); } - // No failure, set id to the object return(temp_id); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::dereference @@ -490,45 +688,14 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(obj.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); + p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); } //-------------------------------------------------------------------------- @@ -538,21 +705,14 @@ void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_typ ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { - hid_t temp_id; - try { - temp_id = p_dereference(attr.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); - } - p_setId(temp_id); + p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference")); } #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -560,16 +720,16 @@ void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_ty // Function: H5Location::getObjType ///\brief Retrieves the type of object that an object reference points to. ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. ///\param ref - IN: Reference to query ///\return An object type, which can be one of the following: -/// \li \c H5G_UNKNOWN \tA failure occurs. (-1) -/// \li \c H5G_GROUP \tObject is a group. -/// \li \c H5G_DATASET \tObject is a dataset. -/// \li \c H5G_TYPE Object \tis a named datatype -/// \li \c H5G_LINK \tObject is a symbolic link. -/// \li \c H5G_UDLINK \tObject is a user-defined link. +/// \li \c H5G_UNKNOWN - A failure occurs. (-1) +/// \li \c H5G_GROUP - Object is a group. +/// \li \c H5G_DATASET - Object is a dataset. +/// \li \c H5G_TYPE Object - is a named datatype +/// \li \c H5G_LINK - Object is a symbolic link. +/// \li \c H5G_UDLINK - Object is a user-defined link. ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - May, 2004 // Modification @@ -581,25 +741,26 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const return(p_get_obj_type(ref, ref_type)); } catch (ReferenceException E) { - throw ReferenceException("H5Location::getObjType", E.getDetailMsg()); + throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg()); } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -607,28 +768,28 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const if (obj_type == H5G_UNKNOWN) { - throw ReferenceException("", "H5Rget_obj_type1 failed"); + throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed"); } return(obj_type); } +#endif // DOXYGEN_SHOULD_SKIP_THIS #endif /* H5_NO_DEPRECATED_SYMBOLS */ - //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -636,24 +797,25 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const return(p_get_ref_obj_type(ref, ref_type)); } catch (ReferenceException E) { - throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg()); + throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg()); } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -662,31 +824,36 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) { - throw ReferenceException("", "H5Rget_obj_type2 failed"); + throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed"); } return(obj_type); } //-------------------------------------------------------------------------- -// Function: H5Location::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRegion +///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of +///\param ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +///\return DataSpace object +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { - throw ReferenceException("", "H5Rget_region failed"); + throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed"); + } + try { + DataSpace dataspace(space_id); + return(dataspace); + } + catch (DataSpaceIException E) { + throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg()); } - return(space_id); } @@ -697,6 +864,8 @@ hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- H5Location::~H5Location() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS + #ifndef H5_NO_NAMESPACE } // end namespace #endif diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 8eae454..4ea13cd 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Location_H -#define _H5Location_H +#ifndef __H5Location_H +#define __H5Location_H #include "H5Classes.h" // constains forward class declarations @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, named datatype, or attribute. +// An H5Location can be a file, group, dataset, or committed datatype. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,29 +85,49 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + void setComment(const char* comment) const; + void setComment(const H5std_string& comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; // Creates a reference to a named object or to a dataset region // in this object. + void reference(void* ref, const char* name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const H5std_string& name, + H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; + void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // For subclasses. - virtual hid_t getId() const = 0; + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -124,7 +144,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -134,9 +154,6 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - // Noop destructor. virtual ~H5Location(); @@ -147,4 +164,4 @@ class H5_DLLCPP H5Location : public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Location_H diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index e29e80e..1d96f2e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,8 +52,6 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS - //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object @@ -69,6 +67,7 @@ H5Object::H5Object( const H5Object& original ) : H5Location( original ) {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::~H5Object() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index bfd5e6f..3f9c343 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Object_H -#define _H5Object_H +#ifndef __H5Object_H +#define __H5Object_H #include "H5Location.h" #include "H5Classes.h" // constains forward class declarations @@ -40,6 +40,7 @@ namespace H5 { class H5_DLLCPP H5Object : public H5Location { public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Copy constructor: makes copy of an H5Object object. H5Object(const H5Object& original); @@ -47,7 +48,6 @@ class H5_DLLCPP H5Object : public H5Location { virtual ~H5Object(); protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Default constructor H5Object(); @@ -61,4 +61,4 @@ class H5_DLLCPP H5Object : public H5Location { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Object_H diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 9dfc760..27cfd3a 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -56,6 +56,7 @@ PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id ) // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType() : AtomType() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PredType copy constructor @@ -65,6 +66,7 @@ PredType::PredType() : AtomType() {} //-------------------------------------------------------------------------- PredType::PredType( const PredType& original ) : AtomType( original ) {} +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Flag to terminate HDF5 library in DataType::~DataType const PredType PredType::AtExit(H5CPP_EXITED); diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 8a04f0c..65e1c07 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -19,8 +19,8 @@ // closed by H5Tclose. They are treated as constants. ///////////////////////////////////////////////////////////////////// -#ifndef _H5PredType_H -#define _H5PredType_H +#ifndef __H5PredType_H +#define __H5PredType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -32,7 +32,9 @@ namespace H5 { before the other PredType objects are created. At exit, when this special PredType object is to be destructed, no HDF5 library function will be called and the library will be terminated. -BMR, Mar 30, 2012 */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS #define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere +#endif // DOXYGEN_SHOULD_SKIP_THIS class H5_DLLCPP PredType : public AtomType { public: @@ -256,4 +258,4 @@ class H5_DLLCPP PredType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5PredType_H diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index ceea15f..9476d46 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT( H5P_DEFAULT ); +const PropList PropList::DEFAULT; //-------------------------------------------------------------------------- // Function Default constructor @@ -74,6 +74,9 @@ PropList::PropList(const PropList& original) : IdComponent(original) //-------------------------------------------------------------------------- PropList::PropList( const hid_t plist_id ) : IdComponent() { + if (plist_id == 0) + id = H5P_DEFAULT; + H5I_type_t id_type = H5Iget_type(plist_id); switch (id_type) { case H5I_GENPROP_CLS: @@ -216,7 +219,8 @@ void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name //-------------------------------------------------------------------------- // Function: PropList::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this property list +///\return Property list identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In @@ -229,6 +233,7 @@ hid_t PropList::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PropList::p_setId ///\brief Sets the identifier of this object to a new value. @@ -253,6 +258,7 @@ void PropList::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PropList::close diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 7e47b32..b2c50d4 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5PropList_H -#define _H5PropList_H +#ifndef __H5PropList_H +#define __H5PropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -110,13 +110,15 @@ class H5_DLLCPP PropList : public IdComponent { virtual ~PropList(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS hid_t id; // HDF5 property list id // Sets the property list id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } #endif -#endif // _H5PropList_H +#endif // __H5PropList_H diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index be9fed8..251b0b8 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5StrType_H -#define _H5StrType_H +#ifndef __H5StrType_H +#define __H5StrType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -65,4 +65,4 @@ class H5_DLLCPP StrType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5StrType_H diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 0cee219..caa347a 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -17,8 +17,8 @@ // Class VarLenType inherits from DataType and provides wrappers for // the HDF5 C's Variable-length Datatypes. -#ifndef _H5VarLenType_H -#define _H5VarLenType_H +#ifndef __H5VarLenType_H +#define __H5VarLenType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -49,4 +49,4 @@ class H5_DLLCPP VarLenType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5VarLenType_H diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index ec942fd..759b4a7 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -47,8 +47,11 @@ libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp -# HDF5 C++ library depends on HDF5 Library. +# HDF5 C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_cpp_la_LIBADD=$(LIBHDF5) +endif # Public headers include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index f601487..4cb0ac1 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -118,7 +118,8 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_cpp_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \ H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \ H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \ @@ -297,6 +298,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -467,7 +469,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory @@ -490,8 +492,9 @@ libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp -# HDF5 C++ library depends on HDF5 Library. -libhdf5_cpp_la_LIBADD = $(LIBHDF5) +# HDF5 C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_cpp_la_LIBADD = $(LIBHDF5) # Public headers include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index ef1455c..3c4c645 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -258,6 +258,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 643762b..811d8c7 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -283,13 +283,13 @@ test_simple_io( H5File& file) *------------------------------------------------------------------------- */ static herr_t -test_datasize() +test_datasize(FileAccPropList &fapl) { SUBTEST("DataSet::getInMemDataSize()"); try { // Open FILE1. - H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, FileAccPropList::DEFAULT); + H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Open dataset DSET_SIMPLE_IO_NAME. DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME); @@ -1058,7 +1058,7 @@ void test_dset() // Cause the library to emit initial messages Group grp = file.createGroup( "emit diagnostics", 0); - grp.setComment( ".", "Causes diagnostic messages to be emitted"); + grp.setComment("Causes diagnostic messages to be emitted"); nerrors += test_create(file)<0 ?1:0; nerrors += test_simple_io(file)<0 ?1:0; @@ -1067,9 +1067,12 @@ void test_dset() nerrors += test_multiopen (file)<0 ?1:0; nerrors += test_types(file)<0 ?1:0; + // Close group "emit diagnostics". + grp.close(); + // Close the file before testing data size. file.close(); - nerrors += test_datasize() <0 ? 1:0; + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception E) { diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index c6a7a2a..cd85b6e 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -107,6 +107,30 @@ void issue_fail_msg(const char* where, int line, const char* file_name, } /*------------------------------------------------------------------------- + * Function: issue_fail_msg + * + * Purpose: Displays that a function has failed with its location. + * + * Return: None + * + * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C) + * Monday, December 20, 2004 + * + *------------------------------------------------------------------------- + */ +void issue_fail_msg(const char* where, int line, const char* file_name, + const char* func_name, const char* message) +{ + //if (GetTestVerbosity()>=VERBO_HI) + { + cerr << endl; + cerr << ">>> FAILED in " << where << ": " << func_name << endl << + " at line " << line << " in " << file_name << endl << + " C library detail: " << message << endl << endl; + } +} + +/*------------------------------------------------------------------------- * Function: check_values * * Purpose: Checks a read value against the written value. If they are diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 02f3d0d..e6aba79 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -42,6 +42,8 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck); int test_report (int, const H5std_string&); void issue_fail_msg(const char* where, int line, const char* file_name, const char* message=""); +void issue_fail_msg(const char* where, int line, const char* file_name, + const char* func_name, const char* message); class InvalidActionException : public Exception { public: diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 7947a9b..cfdeb1f 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,7 +188,10 @@ static void test_h5s_basic() * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenating the th5s.h5 file. */ - const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); + char *tmp_str = new char[TESTFILE.length()+1]; + strcpy(tmp_str, TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(tmp_str); + delete []tmp_str; // Create file H5File fid1(testfile, H5F_ACC_RDONLY); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index ce18e58..36c2ee4 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,13 +27,6 @@ #endif #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cerr; - using std::endl; -#endif // H5_NO_STD -#endif - #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -44,27 +37,25 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); -const H5std_string FILE3("trefer3.h5"); -const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); -const int DSET1_LEN = 8; +const H5std_string DSET2_NAME("Dataset2"); const H5std_string MEMBER1( "a_name" ); const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions -const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -// 2-D dataset with fixed dimensions -const H5std_string SPACE2_NAME("Space2"); +/* Larger 1-D dataset with fixed dimensions */ +const int SPACE3_RANK = 1; +const int SPACE3_DIM1 = 100; -// Larger 1-D dataset with fixed dimensions -const H5std_string SPACE3_NAME("Space3"); +/* Element selection information */ +const int POINT1_NPOINTS = 10; // Compound datatype typedef struct s1_t { @@ -75,8 +66,123 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_obj(): Test basic object reference functionality. -** Tests references to various kinds of objects +** test_reference_params(): Test basic H5R (reference) parameters +** for correct processing +** +****************************************************************/ +static void +test_reference_params(void) +{ + const char *write_comment = "Foo!"; /* Comments for group */ + + // Output message about test being performed + SUBTEST("Object Reference Parameters"); + + H5File* file1 = NULL; + try { + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a group + Group group = file1->createGroup("Group1"); + + // Set group's comment + group.setComment(".", write_comment); + + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + + unsigned *tu32; // Temporary pointer to uint32 data + int i; + for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + + /* Test parameters to H5Location::reference */ + try { + file1->reference(NULL, "/Group1/Dataset1"); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], NULL); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], ""); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); + } catch (ReferenceException E) {} // We expect this to fail + + // Close resources + dataset.close(); + file1->close(); + // Let sid1 go out of scope + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_param()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_param() */ + +/**************************************************************** +** +** test_reference_obj(): Test basic object reference functions +** to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -106,8 +212,11 @@ static void test_reference_obj(void) hsize_t dims1[] = {SPACE1_DIM1}; DataSpace sid1(SPACE1_RANK, dims1); + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + // Create a group - Group group = file1->createGroup("Group1", (size_t)-1); + Group group = file1->createGroup("Group1"); // Set group's comment group.setComment(".", write_comment); @@ -116,7 +225,7 @@ static void test_reference_obj(void) DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); unsigned *tu32; // Temporary pointer to uint32 data - for (tu32=(unsigned *)wbuf, i=0; ireference(&wbuf[0], "/Group1/Dataset1"); H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to dataset and test getRefObjType file1->reference(&wbuf[1], "/Group1/Dataset2"); refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to group file1->reference(&wbuf[2], "/Group1"); refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to named datatype file1->reference(&wbuf[3], "/Group1/Datatype1"); refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__); // Write selection to disk dataset.write(wbuf, PredType::STD_REF_OBJ); @@ -188,18 +297,18 @@ static void test_reference_obj(void) // Dereference dataset object by ctor, from the location where // 'dataset' is located - DataSet dset2(dataset, &rbuf[0]); + DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl); // Check information in the referenced dataset sid1 = dset2.getSpace(); hssize_t n_elements = sid1.getSimpleExtentNpoints(); - verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); // Read from disk dset2.read(tbuf, PredType::NATIVE_UINT); - for(tu32=(unsigned *)tbuf,i=0; iclose(); - // Free memory buffers + // Free allocated buffers HDfree(wbuf); HDfree(rbuf); HDfree(tbuf); @@ -314,13 +356,431 @@ static void test_reference_obj(void) PASSED(); } // end try catch (Exception E) { - issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_reference_obj()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } if(file1) delete file1; } // test_reference_obj() + +/**************************************************************** +** +** test_reference_group(): Test object reference functionality +** Tests for correct behavior of various routines on +** dereferenced group +** +****************************************************************/ +#define GROUPNAME "/group" +#define GROUPNAME2 "group2" +#define GROUPNAME3 "group3" +#define DSETNAME "/dset" +#define DSETNAME2 "dset2" +#define NAME_SIZE 16 + +static void +test_reference_group(void) +{ + hobj_ref_t wref; /* Reference to write */ + hobj_ref_t rref; /* Reference to read */ + const H5std_string write_comment="Foo!"; // Comments for group + + // Output message about test being performed + SUBTEST("Object Reference to Group"); + + H5File* file1 = NULL; + try { + /* + * Create file with a group and a dataset containing an object + * reference to the group + */ + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create scalar dataspace + DataSpace sid1; + + // Create a group + Group group = file1->createGroup(GROUPNAME); + + /* Create nested groups */ + Group group2 = group.createGroup(GROUPNAME2); + group2.close(); + group2 = group.createGroup(GROUPNAME3); + group2.close(); + + // Create bottom dataset + DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); + dset1.close(); + + // Close group 1 + group.close(); + + // Create dataset + DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); + + file1->reference(&wref, GROUPNAME); + + // Write selection to disk + dset2.write(&wref, PredType::STD_REF_OBJ); + + // Close resources + dset2.close(); + sid1.close(); + file1->close(); + + /* + * Re-open the file and test deferencing group + */ + + // Re-open file + file1->openFile(FILE1, H5F_ACC_RDWR); + + // Re-open dataset + dset1 = file1->openDataSet(DSETNAME); + + // Read in the reference + dset1.read(&rref, PredType::STD_REF_OBJ); + + // Dereference to get the group + Group refgroup(dset1, &rref); + + // Dereference group object the other way + group.dereference(dset1, &rref); + + /* + * Various queries on the group opened + */ + + // Check number of objects in the group dereferenced by constructor + hsize_t nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Check number of objects in the group dereferenced by ::reference + nobjs = group.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Check getting file name given the group dereferenced via constructor + H5std_string fname = refgroup.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + + // Check getting file name given the group dereferenced by ::reference + fname = group.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + + // Unlink one of the objects in the dereferenced group, and re-check + refgroup.unlink(GROUPNAME2); + nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 2, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Close resources + group.close(); + refgroup.close(); + dset1.close(); + file1->close(); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_group()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_group() */ + +/**************************************************************** +** +** test_reference_region_1D(): Test 1-D reference functionality +** Tests 1-D references to various kinds of objects +** +****************************************************************/ +static void +test_reference_region_1D(void) +{ + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + int i; /* counting variables */ + + // Output message about test being performed + SUBTEST("1-D Dataset Region Reference Functions"); + + try { + hdset_reg_ref_t *wbuf, // buffer to write to disk + *rbuf; // buffer read from disk + uint8_t *dwbuf, // Buffer for writing numeric data to disk + *drbuf; // Buffer for reading numeric data from disk + + // Allocate write & read buffers + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + + // Create file FILE1 + H5File file1(FILE2, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims3[] = {SPACE3_DIM1}; + DataSpace sid3(SPACE3_RANK, dims3); + + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + + // Create a dataset + DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); + + uint8_t *tu8; // Temporary pointer to uint8 data + for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) + *tu8++ = i * 3; // from C test + + // Write selection to disk + dset3.write(dwbuf, PredType::STD_U8LE); + + // Close Dataset + dset3.close(); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset + DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); + + /* + * Create references and prepare for testing + */ + + /* Select 15 2x1 hyperslabs for first reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; + + // Select a hyperslab region to add to the current selected region + sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + // Get and verify the number of elements in a dataspace selection + hssize_t nelms = sid3.getSelectNpoints(); + verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Store first dataset region + file1.reference(&wbuf[0], "/Dataset2", sid3); + + // Get and verify object type + H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + + /* Select sequence of ten points for second reference */ + coord1[0][0] = 16; + coord1[1][0] = 22; + coord1[2][0] = 38; + coord1[3][0] = 41; + coord1[4][0] = 52; + coord1[5][0] = 63; + coord1[6][0] = 70; + coord1[7][0] = 89; + coord1[8][0] = 97; + coord1[9][0] = 3; + + // Selects array elements to be included in the selection for sid3 + sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + + // Get and verify the number of elements in a dataspace selection + nelms = sid3.getSelectNpoints(); + verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Store first dataset region + file1.reference(&wbuf[1], "/Dataset2", sid3); + + // Write selection to disk + dset1.write(wbuf, PredType::STD_REF_DSETREG); + + // Close disk dataspace, dataset, and file + sid1.close(); + dset1.close(); + sid3.close(); + file1.close(); + + /* + * Testing various dereference functions + */ + + // Re-open the file + file1.openFile(FILE2, H5F_ACC_RDWR); + + // Open the dataset + dset1 = file1.openDataSet("/Dataset1"); + + // Read selection from disk + dset1.read(rbuf, PredType::STD_REF_DSETREG); + + { // Test DataSet::dereference + dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get and verify object type + obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Get dataspace of dset3 the verify number of elements + sid1 = dset3.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + } // End of test DataSet::dereference + + { // Test DataSet constructor -by dereference + // Dereference dataset object by ctor, from the location where + // 'dset1' is located + DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get dataspace of newds then verify number of elements + sid1 = newds.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + // Close objects for this mini test + newds.close(); + sid1.close(); + } // End of test DataSet constructor -by dereference + + // Read from disk + dset3.read(drbuf, PredType::STD_U8LE); + + for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + /* + * Test getting the referenced region + */ + + // Get region + DataSpace reg_sp = dset1.getRegion(&rbuf[0]); + + // Get and verify number of elements in a dataspace selection + nelms = reg_sp.getSelectNpoints(); + verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + // Get and verify number of hyperslab blocks + nelms = reg_sp.getSelectHyperNblocks(); + verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + + // Get the list of hyperslab blocks currently selected + reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + + // Verify values in the list + verify_val(coords[0], 2, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[1], 3, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[2], 7, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[3], 8, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[4], 12, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[5], 13, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[6], 17, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[7], 18, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[8], 22, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[9], 23, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[10], 27, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[11], 28, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[12], 32, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[13], 33, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[14], 37, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[15], 38, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[16], 42, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[17], 43, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[18], 47, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[19], 48, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[20], 52, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[21], 53, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[22], 57, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[23], 58, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[24], 62, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[25], 63, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[26], 67, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[27], 68, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[28], 72, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[29], 73, "Hyperslab Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + reg_sp.getSelectBounds(low, high); + verify_val(low[0], 2, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0], 73, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + /* Close region space */ + reg_sp.close(); + + /* + * Another test on getting the referenced region + */ + + // Get region + DataSpace elm_sp = dset1.getRegion(&rbuf[1]); + + // Get and verify number of element points in the current selection + hssize_t nelmspts = elm_sp.getSelectElemNpoints(); + verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + + // Get the list of element points currently selected + elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + + // Verify points + verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + elm_sp.getSelectBounds(low, high); + verify_val(low[0], 3, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0], 97, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + // Close element space + elm_sp.close(); + + // Close resources + sid1.close(); + dset3.close(); + dset1.close(); + file1.close(); + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } +} /* test_reference_region_1D() */ + + /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -346,7 +806,10 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); + test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality + test_reference_group(); // Test group reference functionality + test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -363,5 +826,6 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); } diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in index a701a61..6cf2a94 100644 --- a/config/cmake/CPack.Info.plist.in +++ b/config/cmake/CPack.Info.plist.in @@ -1,37 +1,32 @@ - -IFMajorVersion -@CPACK_PACKAGE_VERSION_MAJOR@ -IFMinorVersion -@CPACK_PACKAGE_VERSION_MINOR@ -IFPkgFlagAllowBackRev - -IFPkgFlagAuthorizationAction -AdminAuthorization -IFPkgFlagDefaultLocation -@CPACK_PACKAGE_DEFAULT_LOCATION@ -IFPkgFlagInstallFat - -IFPkgFlagIsRequired - -IFPkgFlagOverwritePermissions - -IFPkgFlagRelocatable -<@CPACK_PACKAGE_RELOCATABLE@/> -IFPkgFlagRestartAction -NoRestart -IFPkgFlagRootVolumeOnly - -IFPkgFlagUpdateInstalledLanguages - -IFPkgFlagUseUserMask - -IFPkgFormatVersion -0.10000000149011612 -CFBundleIdentifier -org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleDevelopmentRegion + English + CFBundleExecutable + @CPACK_PACKAGE_FILE_NAME@ + CFBundleIconFile + @CPACK_BUNDLE_ICON@ + CFBundleIdentifier + org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + @CPACK_PACKAGE_VERSIO@ + CFBundleShortVersionString + @CPACK_SHORT_VERSION_STRING@ + CSResourcesFileMapped + + CFBundleName + @CPACK_BUNDLE_NAME@ + CFBundleGetInfoString + @CPACK_APPLE_GUI_INFO_STRING@ + NSHumanReadableCopyright + @CPACK_APPLE_GUI_COPYRIGHT@ diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index c16f9a6..cb32827 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -35,6 +35,7 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE h5test-clear-error_test-objects h5test-clear-links_env-objects PERFORM_h5perform-clear-objects + HL_TOOLS-clear-objects hl_test-clear-objects hl_fortran_test-clear-objects ######### tools/h5copy ######### @@ -202,6 +203,7 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK_VERIFY_LAYOUT-contig_small_fixed_compa #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-layout_long_switches #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake + H5REPACK-plugin ######### tools/h5stat ######### H5STAT-clearall-objects ######### tools/misc ######### diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index e495d9b..769483e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -152,13 +152,13 @@ ENDIF (WIN32) # SET (H5_DEFAULT_VFD H5FD_SEC2) -IF (NOT DEFINED "H5_DEFAULT_PLUGIN") +IF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) - SET (H5_DEFAULT_PLUGIN "%ALLUSERSPROFILE%/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin") ELSE (WINDOWS) - SET (H5_DEFAULT_PLUGIN "/usr/local/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") ENDIF (WINDOWS) -ENDIF (NOT DEFINED "H5_DEFAULT_PLUGIN") +ENDIF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) @@ -565,7 +565,9 @@ IF (NOT APPLE) IF (NOT H5_SIZEOF_SSIZE_T) SET (H5_SIZEOF_SSIZE_T 0) ENDIF (NOT H5_SIZEOF_SSIZE_T) - H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) + IF (NOT WINDOWS) + H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) + ENDIF (NOT WINDOWS) ENDIF (NOT APPLE) H5_CHECK_TYPE_SIZE (off_t H5_SIZEOF_OFF_T) @@ -1069,7 +1071,11 @@ H5ConversionTests (H5_ULONG_TO_FLOAT_ACCURATE "Checking IF accurately converting # 64-bit machines, where the short program below tests if round-up is # correctly handled. # -H5ConversionTests (H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE "Checking IF accurately converting unsigned long long to floating-point values") +IF (CMAKE_SYSTEM MATCHES "solaris2.*") + H5ConversionTests (H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE "Checking IF accurately converting unsigned long long to floating-point values") +ELSE (CMAKE_SYSTEM MATCHES "solaris2.*") + SET(H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE 1) +ENDIF (CMAKE_SYSTEM MATCHES "solaris2.*") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert # 'float' or 'double' to 'unsigned long long' values. diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2160ee8..bef9d77 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -55,7 +55,7 @@ #cmakedefine H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM @H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM@ /* Define the default plugins path to compile */ -#cmakedefine H5_DEFAULT_PLUGIN "@H5_DEFAULT_PLUGIN@" +#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@" /* Define the default virtual file driver to compile */ #cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@ @@ -575,62 +575,62 @@ #cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ /* The size of `char', as computed by sizeof. */ -#define H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@ +#cmakedefine H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@ /* The size of `double', as computed by sizeof. */ -#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ +#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ /* The size of `float', as computed by sizeof. */ -#define H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@ +#cmakedefine H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@ /* The size of `int', as computed by sizeof. */ -#define H5_SIZEOF_INT @H5_SIZEOF_INT@ +#cmakedefine H5_SIZEOF_INT @H5_SIZEOF_INT@ /* The size of `int16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT16_T @H5_SIZEOF_INT16_T@ +#cmakedefine H5_SIZEOF_INT16_T @H5_SIZEOF_INT16_T@ /* The size of `int32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT32_T @H5_SIZEOF_INT32_T@ +#cmakedefine H5_SIZEOF_INT32_T @H5_SIZEOF_INT32_T@ /* The size of `int64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT64_T @H5_SIZEOF_INT64_T@ +#cmakedefine H5_SIZEOF_INT64_T @H5_SIZEOF_INT64_T@ /* The size of `int8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT8_T @H5_SIZEOF_INT8_T@ +#cmakedefine H5_SIZEOF_INT8_T @H5_SIZEOF_INT8_T@ /* The size of `int_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST16_T @H5_SIZEOF_INT_FAST16_T@ +#cmakedefine H5_SIZEOF_INT_FAST16_T @H5_SIZEOF_INT_FAST16_T@ /* The size of `int_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST32_T @H5_SIZEOF_INT_FAST32_T@ +#cmakedefine H5_SIZEOF_INT_FAST32_T @H5_SIZEOF_INT_FAST32_T@ /* The size of `int_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST64_T @H5_SIZEOF_INT_FAST64_T@ +#cmakedefine H5_SIZEOF_INT_FAST64_T @H5_SIZEOF_INT_FAST64_T@ /* The size of `int_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST8_T @H5_SIZEOF_INT_FAST8_T@ +#cmakedefine H5_SIZEOF_INT_FAST8_T @H5_SIZEOF_INT_FAST8_T@ /* The size of `int_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST16_T @H5_SIZEOF_INT_LEAST16_T@ +#cmakedefine H5_SIZEOF_INT_LEAST16_T @H5_SIZEOF_INT_LEAST16_T@ /* The size of `int_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST32_T @H5_SIZEOF_INT_LEAST32_T@ +#cmakedefine H5_SIZEOF_INT_LEAST32_T @H5_SIZEOF_INT_LEAST32_T@ /* The size of `int_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST64_T @H5_SIZEOF_INT_LEAST64_T@ +#cmakedefine H5_SIZEOF_INT_LEAST64_T @H5_SIZEOF_INT_LEAST64_T@ /* The size of `int_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST8_T @H5_SIZEOF_INT_LEAST8_T@ +#cmakedefine H5_SIZEOF_INT_LEAST8_T @H5_SIZEOF_INT_LEAST8_T@ #if !defined(__APPLE__) /* The size of `size_t', as computed by sizeof. */ -#define H5_SIZEOF_SIZE_T @H5_SIZEOF_SIZE_T@ +#cmakedefine H5_SIZEOF_SIZE_T @H5_SIZEOF_SIZE_T@ /* The size of `ssize_t', as computed by sizeof. */ -#define H5_SIZEOF_SSIZE_T @H5_SIZEOF_SSIZE_T@ +#cmakedefine H5_SIZEOF_SSIZE_T @H5_SIZEOF_SSIZE_T@ /* The size of `long', as computed by sizeof. */ -#define H5_SIZEOF_LONG @H5_SIZEOF_LONG@ +#cmakedefine H5_SIZEOF_LONG @H5_SIZEOF_LONG@ #else # if defined(__LP64__) && __LP64__ @@ -646,66 +646,66 @@ #endif /* The size of `long double', as computed by sizeof. */ -#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ /* Define size of long long and/or __int64 bit integer type only if the type exists. */ #if !defined(__APPLE__) - #define H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ + #cmakedefine H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ #else #define H5_SIZEOF_LONG_LONG 8 #endif /* The size of `off64_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@ +#cmakedefine H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@ /* The size of `off_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@ +#cmakedefine H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@ /* The size of `ptrdiff_t', as computed by sizeof. */ -/* #define H5_SIZEOF_PTRDIFF_T @H5_SIZEOF_PTRDIFF_T@ */ +#cmakedefine H5_SIZEOF_PTRDIFF_T @H5_SIZEOF_PTRDIFF_T@ /* The size of `short', as computed by sizeof. */ -#define H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ +#cmakedefine H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ /* The size of `uint16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@ +#cmakedefine H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@ /* The size of `uint32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT32_T @H5_SIZEOF_UINT32_T@ +#cmakedefine H5_SIZEOF_UINT32_T @H5_SIZEOF_UINT32_T@ /* The size of `uint64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT64_T @H5_SIZEOF_UINT64_T@ +#cmakedefine H5_SIZEOF_UINT64_T @H5_SIZEOF_UINT64_T@ /* The size of `uint8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT8_T @H5_SIZEOF_UINT8_T@ +#cmakedefine H5_SIZEOF_UINT8_T @H5_SIZEOF_UINT8_T@ /* The size of `uint_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST16_T @H5_SIZEOF_UINT_FAST16_T@ +#cmakedefine H5_SIZEOF_UINT_FAST16_T @H5_SIZEOF_UINT_FAST16_T@ /* The size of `uint_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST32_T @H5_SIZEOF_UINT_FAST32_T@ +#cmakedefine H5_SIZEOF_UINT_FAST32_T @H5_SIZEOF_UINT_FAST32_T@ /* The size of `uint_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST64_T @H5_SIZEOF_UINT_FAST64_T@ +#cmakedefine H5_SIZEOF_UINT_FAST64_T @H5_SIZEOF_UINT_FAST64_T@ /* The size of `uint_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST8_T @H5_SIZEOF_UINT_FAST8_T@ +#cmakedefine H5_SIZEOF_UINT_FAST8_T @H5_SIZEOF_UINT_FAST8_T@ /* The size of `uint_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST16_T @H5_SIZEOF_UINT_LEAST16_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST16_T @H5_SIZEOF_UINT_LEAST16_T@ /* The size of `uint_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST32_T @H5_SIZEOF_UINT_LEAST32_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST32_T @H5_SIZEOF_UINT_LEAST32_T@ /* The size of `uint_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST64_T @H5_SIZEOF_UINT_LEAST64_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST64_T @H5_SIZEOF_UINT_LEAST64_T@ /* The size of `uint_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST8_T @H5_SIZEOF_UINT_LEAST8_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST8_T @H5_SIZEOF_UINT_LEAST8_T@ /* The size of `unsigned', as computed by sizeof. */ -#define H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ +#cmakedefine H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ /* The size of `__int64', as computed by sizeof. */ #define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index 9be5404..175c420 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -4,6 +4,8 @@ # To use this option, copy both the macro and option code # into the root UserMacros.cmake file. +# OR add an include to the root UserMacros.cmake file: +# INCLUDE(path_to_file/WINDOWS_MT.cmake) #----------------------------------------------------------------------------- # Option to Build with Static CRT libraries on Windows diff --git a/config/gnu-flags b/config/gnu-flags index 57fc23a..b965bf0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -156,11 +156,6 @@ case "$cc_vendor-$cc_version" in gcc-3.*) PROD_CFLAGS="-O3" ;; - gcc-4.8.*) - # temp patch: when GCC 4.8.x is used for Linux, dt_arith fails if -O* - # is used. Remove any -O* flags. (AKC HDFFV-8500) - PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" - ;; gcc-4.*) PROD_CFLAGS="-O3" ;; diff --git a/config/lt_vers.am b/config/lt_vers.am index 8d9927b..0f47d62 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 3518a6c..b4092b3 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.164-swmr0. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.165-swmr0. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.164-swmr0' -PACKAGE_STRING='HDF5 1.9.164-swmr0' +PACKAGE_VERSION='1.9.165-swmr0' +PACKAGE_STRING='HDF5 1.9.165-swmr0' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -690,7 +690,12 @@ LL_PATH USE_FILTER_SZIP USE_FILTER_DEFLATE AM_MAKEFLAGS +LT_ADD_LIBHDF5_DEPENDENCY +LT_ADD_LIBHDF5_DEPENDENCY_FALSE +LT_ADD_LIBHDF5_DEPENDENCY_TRUE LT_STATIC_EXEC +USE_PLUGINS_CONDITIONAL_FALSE +USE_PLUGINS_CONDITIONAL_TRUE CPP OTOOL64 OTOOL @@ -921,8 +926,8 @@ with_mpe enable_mpi_size enable_filters with_default_vfd -with_default_plugin enable_direct_vfd +with_default_plugindir enable_dconv_exception enable_dconv_accuracy enable_hl @@ -1487,7 +1492,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.164-swmr0 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.165-swmr0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1557,7 +1562,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.164-swmr0:";; + short | recursive ) echo "Configuration of HDF5 1.9.165-swmr0:";; esac cat <<\_ACEOF @@ -1668,7 +1673,7 @@ Optional Packages: --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] - --with-default-plugin=location + --with-default-plugindir=location Specify default location for plugins [default="/usr/local/hdf5/lib/plugin"] --with-default-api-version=(v16|v18|v110) @@ -1756,7 +1761,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.164-swmr0 +HDF5 configure 1.9.165-swmr0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2850,7 +2855,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.164-swmr0, which was +It was created by HDF5 $as_me 1.9.165-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3682,7 +3687,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.164-swmr0' + VERSION='1.9.165-swmr0' cat >>confdefs.h <<_ACEOF @@ -22036,12 +22041,22 @@ if test "X$STATIC_EXEC" = "Xyes"; then ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" + else + LT_STATIC_EXEC="-all-static" fi - LT_STATIC_EXEC="-all-static" else echo "no" LT_STATIC_EXEC="" fi + if test "X$LT_STATIC_EXEC" = X; then + USE_PLUGINS_CONDITIONAL_TRUE= + USE_PLUGINS_CONDITIONAL_FALSE='#' +else + USE_PLUGINS_CONDITIONAL_TRUE='#' + USE_PLUGINS_CONDITIONAL_FALSE= +fi + @@ -22084,6 +22099,20 @@ $as_echo "error" >&6; } as_fn_error $? "\'$enableval\' is not a valid rpath type" "$LINENO" 5 ;; esac +## ---------------------------------------------------------------------- +## When sharedlib-rpath is disabled, setting runpath_var to "" above, don't +## add libhdf5 as a dependency for the other hdf5 libs, either. This keeps +## the rpath to libhdf5 out of the lib files as well as the executables. + if test "X$runpath_var" != X; then + LT_ADD_LIBHDF5_DEPENDENCY_TRUE= + LT_ADD_LIBHDF5_DEPENDENCY_FALSE='#' +else + LT_ADD_LIBHDF5_DEPENDENCY_TRUE='#' + LT_ADD_LIBHDF5_DEPENDENCY_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking make" >&5 $as_echo_n "checking make... " >&6; } @@ -29275,36 +29304,6 @@ _ACEOF fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Custom Plugin Default Path definition" >&5 -$as_echo_n "checking for Custom Plugin Default Path definition... " >&6; } - -# Check whether --with-default-plugin was given. -if test "${with_default_plugin+set}" = set; then : - withval=$with_default_plugin; -else - withval="/usr/local/hdf5/lib/plugin" -fi - - -if test "X$withval" = "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 -$as_echo "default" >&6; } - default_plugin="/usr/local/hdf5/lib/plugin" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 -$as_echo "$withval" >&6; } - default_plugin=$withval -fi - - -cat >>confdefs.h <<_ACEOF -#define DEFAULT_PLUGIN "$default_plugin" -_ACEOF - - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -29408,6 +29407,36 @@ fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for custom plugin default path definition" >&5 +$as_echo_n "checking for custom plugin default path definition... " >&6; } + +# Check whether --with-default-plugindir was given. +if test "${with_default_plugindir+set}" = set; then : + withval=$with_default_plugindir; +else + withval="/usr/local/hdf5/lib/plugin" +fi + + +if test "X$withval" = "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 +$as_echo "default" >&6; } + default_plugindir="/usr/local/hdf5/lib/plugin" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 +$as_echo "$withval" >&6; } + default_plugindir=$withval +fi + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PLUGINDIR "$default_plugindir" +_ACEOF + + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can @@ -31647,7 +31676,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.164-swmr0 +HDF5 config.lt 1.9.165-swmr0 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33347,6 +33376,14 @@ if test -z "${CXX_SHARED_CONDITIONAL_TRUE}" && test -z "${CXX_SHARED_CONDITIONAL as_fn_error $? "conditional \"CXX_SHARED_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_PLUGINS_CONDITIONAL_TRUE}" && test -z "${USE_PLUGINS_CONDITIONAL_FALSE}"; then + as_fn_error $? "conditional \"USE_PLUGINS_CONDITIONAL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${LT_ADD_LIBHDF5_DEPENDENCY_TRUE}" && test -z "${LT_ADD_LIBHDF5_DEPENDENCY_FALSE}"; then + as_fn_error $? "conditional \"LT_ADD_LIBHDF5_DEPENDENCY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_SHARED_SZIP_CONDITIONAL_TRUE}" && test -z "${BUILD_SHARED_SZIP_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"BUILD_SHARED_SZIP_CONDITIONAL\" was never defined. @@ -33777,7 +33814,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.164-swmr0, which was +This file was extended by HDF5 $as_me 1.9.165-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33843,7 +33880,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.164-swmr0 +HDF5 config.status 1.9.165-swmr0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 38d8575..aabe0ed 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.164-swmr0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.165-swmr0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -1046,12 +1046,15 @@ if test "X$STATIC_EXEC" = "Xyes"; then ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" + else + LT_STATIC_EXEC="-all-static" fi - LT_STATIC_EXEC="-all-static" else echo "no" LT_STATIC_EXEC="" fi +AM_CONDITIONAL([USE_PLUGINS_CONDITIONAL], [test "X$LT_STATIC_EXEC" = X]) AC_SUBST([LT_STATIC_EXEC]) @@ -1089,6 +1092,13 @@ case "X-$RPATH" in AC_MSG_ERROR([\'$enableval\' is not a valid rpath type]) ;; esac +## ---------------------------------------------------------------------- +## When sharedlib-rpath is disabled, setting runpath_var to "" above, don't +## add libhdf5 as a dependency for the other hdf5 libs, either. This keeps +## the rpath to libhdf5 out of the lib files as well as the executables. +AM_CONDITIONAL([LT_ADD_LIBHDF5_DEPENDENCY], [test "X$runpath_var" != X]) + +AC_SUBST([LT_ADD_LIBHDF5_DEPENDENCY]) AC_MSG_CHECKING([make]) @@ -3052,27 +3062,6 @@ if test "X$default_vfd" = "Xyes"; then fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -AC_MSG_CHECKING([for Custom Plugin Default Path definition]) -AC_ARG_WITH([default-plugin], - [AS_HELP_STRING([--with-default-plugin=location], - [Specify default location for plugins - [default="/usr/local/hdf5/lib/plugin"]])],, - withval="/usr/local/hdf5/lib/plugin") - -if test "X$withval" = "X"; then - AC_MSG_RESULT([default]) - default_plugin="/usr/local/hdf5/lib/plugin" -else - AC_MSG_RESULT([$withval]) - default_plugin=$withval -fi - -AC_DEFINE_UNQUOTED([DEFAULT_PLUGIN], ["$default_plugin"], - [Define the default plugins path to compile]) - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -3115,6 +3104,27 @@ fi AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +AC_MSG_CHECKING([for custom plugin default path definition]) +AC_ARG_WITH([default-plugindir], + [AS_HELP_STRING([--with-default-plugindir=location], + [Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"]])],, + withval="/usr/local/hdf5/lib/plugin") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + default_plugindir="/usr/local/hdf5/lib/plugin" +else + AC_MSG_RESULT([$withval]) + default_plugindir=$withval +fi + +AC_DEFINE_UNQUOTED([DEFAULT_PLUGINDIR], ["$default_plugindir"], + [Define the default plugins path to compile]) + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can diff --git a/examples/Makefile.in b/examples/Makefile.in index 064cb84..a564dd4 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/Makefile.in b/fortran/Makefile.in index acab031..4196fe2 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 93a2af1..1cc0825 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -230,6 +230,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 12c38e2..2d597c6 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -79,8 +79,11 @@ libhdf5_fortran_la_SOURCES=H5f90global.f90 \ H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) -# HDF5 Fortran library depends on HDF5 Library. +# HDF5 Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_fortran_la_LIBADD=$(LIBHDF5) +endif # h5fc is generated during configure. # Remove it only when distclean. diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index e826a35..d2cb3e0 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -120,7 +120,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_fortran_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_fortran_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am__libhdf5_fortran_la_SOURCES_DIST = H5f90global.f90 \ H5fortran_types.f90 H5_ff$(F_STATUS).f90 H5_ff.f90 H5Aff.f90 \ H5Dff.f90 H5Eff.f90 H5Fff.f90 H5Gff.f90 H5Iff.f90 H5Lff.f90 \ @@ -348,6 +349,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -518,7 +520,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used @@ -561,8 +563,9 @@ libhdf5_fortran_la_SOURCES = H5f90global.f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) -# HDF5 Fortran library depends on HDF5 Library. -libhdf5_fortran_la_LIBADD = $(LIBHDF5) +# HDF5 Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_fortran_la_LIBADD = $(LIBHDF5) # h5fc is generated during configure. # Remove it only when distclean. diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 6c226bc..9f8b6d0 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -333,6 +333,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 9a93367..1903529 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -257,6 +257,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/Makefile.in b/hl/Makefile.in index 786bfba..6ca962b 100644 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 60baefe..210fcc5 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -255,6 +255,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index 8297d0a..1e66687 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -221,6 +221,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am index d2794c9..7961747 100644 --- a/hl/c++/src/Makefile.am +++ b/hl/c++/src/Makefile.am @@ -40,8 +40,11 @@ endif # At the moment, only the H5PT Packet Table has a C++ API. libhdf5_hl_cpp_la_SOURCES=H5PacketTable.cpp -# HDF5 HL C++ library depends on HDF5 HL Library and HDF5 C++ Library. +# HDF5 HL C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_hl_cpp_la_LIBADD=$(LIBH5_HL) $(LIBH5CPP) +endif # Public headers include_HEADERS=H5PacketTable.h diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 102fe39..39daa9a 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -116,7 +116,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_hl_cpp_la_DEPENDENCIES = $(LIBH5_HL) $(LIBH5CPP) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_cpp_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBH5_HL) $(LIBH5CPP) am_libhdf5_hl_cpp_la_OBJECTS = H5PacketTable.lo libhdf5_hl_cpp_la_OBJECTS = $(am_libhdf5_hl_cpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -288,6 +289,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -458,7 +460,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory @@ -474,8 +476,9 @@ libhdf5_hl_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISIO # At the moment, only the H5PT Packet Table has a C++ API. libhdf5_hl_cpp_la_SOURCES = H5PacketTable.cpp -# HDF5 HL C++ library depends on HDF5 HL Library and HDF5 C++ Library. -libhdf5_hl_cpp_la_LIBADD = $(LIBH5_HL) $(LIBH5CPP) +# HDF5 HL C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_cpp_la_LIBADD = $(LIBH5_HL) $(LIBH5CPP) # Public headers include_HEADERS = H5PacketTable.h diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index f8ad89b..c873d32 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -254,6 +254,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 2713377..ee4d885 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -221,6 +221,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 8b7f728..8cb74cd 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 9f08f21..8413c2d 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index 9835196..edc5895 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -49,8 +49,11 @@ endif libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 -# HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. +# HDF5 HL Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) +endif # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index c69b952..577c524 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -116,7 +116,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5hl_fortran_la_DEPENDENCIES = $(LIBH5_HL) $(LIBH5F) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5hl_fortran_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBH5_HL) $(LIBH5F) am_libhdf5hl_fortran_la_OBJECTS = H5DSfc.lo H5LTfc.lo H5IMfc.lo \ H5IMcc.lo H5TBfc.lo H5DSff.lo H5LTff.lo H5IMff.lo H5TBff.lo libhdf5hl_fortran_la_OBJECTS = $(am_libhdf5hl_fortran_la_OBJECTS) @@ -304,6 +305,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -474,7 +476,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src @@ -496,8 +498,9 @@ libhdf5hl_fortran_la_SOURCES = H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 -# HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. -libhdf5hl_fortran_la_LIBADD = $(LIBH5_HL) $(LIBH5F) +# HDF5 HL Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5hl_fortran_la_LIBADD = $(LIBH5_HL) $(LIBH5F) # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 2acee8c..5d576d0 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -268,6 +268,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index c1e6810..1565c51 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -33,8 +33,11 @@ libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$( # List sources to include in the HDF5 HL Library. libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c -# HDF5 HL library depends on HDF5 Library. +# HDF5 HL library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_hl_la_LIBADD=$(LIBHDF5) +endif # Public header files (to be installed) include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index a796bd1..650519b 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -113,7 +113,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_hl_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am_libhdf5_hl_la_OBJECTS = H5DO.lo H5DS.lo H5IM.lo H5LT.lo \ H5LTanalyze.lo H5LTparse.lo H5PT.lo H5TB.lo H5LD.lo libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS) @@ -287,6 +288,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -457,7 +459,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # This library is our main target. @@ -469,8 +471,9 @@ libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$ # List sources to include in the HDF5 HL Library. libhdf5_hl_la_SOURCES = H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c -# HDF5 HL library depends on HDF5 Library. -libhdf5_hl_la_LIBADD = $(LIBHDF5) +# HDF5 HL library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_la_LIBADD = $(LIBHDF5) # Public header files (to be installed) include_HEADERS = hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index a19cdad..d043334 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -308,6 +308,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index e32dc7c..aa4aa92 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index 3d7e7fe..e587f5f 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -270,6 +270,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/tools/h5watch/Makefile.in b/hl/tools/h5watch/Makefile.in index 2cb8c41..1725cd0 100644 --- a/hl/tools/h5watch/Makefile.in +++ b/hl/tools/h5watch/Makefile.in @@ -267,6 +267,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/perform/Makefile.in b/perform/Makefile.in index 4cc5b2b..091f4f1 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -296,6 +296,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 95ebec9..80a13f7 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -8,7 +8,8 @@ Section I: Quick Step Building HDF5 Libraries with CMake Section II: Preconditions Section III: Building HDF5 C/C++ Libraries with CMake Section IV: All Options for HDF5 C/C++ Libraries with CMake -Section V: APPENDIX +Section V: User Defined Options for HDF5 Libraries with CMake +Section VI: APPENDIX ************************************************************************ @@ -102,7 +103,7 @@ II. Preconditions HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" - TGZ_PATH:STRING="some_location" + TGZPATH:STRING="some_location" where "some_location" is the URL or full path to the compressed file and ext is the type of compression file. @@ -327,7 +328,7 @@ These five steps are described in detail below. file) are: ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" - TGZ_PATH:STRING="some_location" + TGZPATH:STRING="some_location" where "some_location/xxxx_src.ext" is the URL or full path to the compressed file and where ext is the type of the compression file such as .bz2, .tar, .tar.gz, .tgz, or .zip. @@ -445,11 +446,29 @@ HDF5_USE_FILTER_SCALEOFFSET "Use the SCALEOFFSET Filter" ON HDF5_USE_FILTER_SHUFFLE "Use the SHUFFLE Filter" ON IF (HDF5_ENABLE_SZIP_SUPPORT) HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF +IF (WINDOWS) + H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" +ELSE (WINDOWS) + H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" +ENDIF (WINDOWS) ======================================================================== -V. APPENDIX +V. User Defined Options for HDF5 Libraries with CMake +======================================================================== + +Support for User Defined macros and options has been added. The file +UserMacros.cmake has an example of the technique. In the folder, +config/cmake/UserMacros, is an implementation for Windows Visual Studio +users for linking libraries to the static CRT - Windows_MT.cmake. + +Copy the contents of the file, both macro and option, into the +UserMacros.cmake file. Then enable the option to the CMake configuration, +build and test process. + +======================================================================== +VI. APPENDIX ======================================================================== Below are examples of the ctest scripts used by The HDF Group. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3a61890..482a9da 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.164-swmr0 currently under development +HDF5 version 1.9.165-swmr0 currently under development INTRODUCTION @@ -42,8 +42,9 @@ New Features ------------- - New configuration option added to change the default plugin path. configure option is --with-default-plugin=location - cmake option is -DH5_DEFAULT_PLUGIN:PATH=location + cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location HDFFV-8513. (ADB 2013/09/04) + - Rename FFLAGS to FCFLAGS in configure (ADB 2013/08/13) - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to buildhdf5 is added and is available in the bin directory. @@ -676,6 +677,9 @@ Bug Fixes since HDF5-1.8.0 release Configuration ------------- + - Modified H5detect.c to scan floating point types for padding bits before + analyzing the type further. This should fix problems with gcc 4.8 + (NAF - 2013/09/19 - HDFFV-8523/HDFFV-8500) - Fixed Makefile issue in which "-Wl," was not properly specified prior to -rpath when building parallel fortran libraries with an Intel compiler. (MAM - 2012/03/26) @@ -1170,13 +1174,13 @@ Supported Platforms Windows 7 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) Visual Studio 2012 w/ Intel Fortran 13 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.7.3) compiler and gfortran) (cmake and autotools) Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) Visual Studio 2012 w/ Intel Fortran 13 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.8.1) compiler and gfortran) (cmake and autotools) Windows 8 Visual Studio 2012 w/ Intel Fortran 13 (cmake) @@ -1217,7 +1221,7 @@ Platform C F90/ F90 C++ zlib SZIP Solaris2.11 32-bit n y/y n y y y Solaris2.11 64-bit n y/n n y y y Windows 7 y y/y n y y y -Windows 7 x64 y y/y n y y y +Windows 7 x64 y y/y n y y y Windows 7 Cygwin n y/n n y y y Windows 7 x64 Cygwin n y/n n y y y Windows 8 y y/y n y y y @@ -1297,14 +1301,14 @@ The following platforms are not supported but have been tested for this release. GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b667199..bbd02e0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -786,13 +786,8 @@ INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}) # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG "-O0") -ELSE (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG " ") -ENDIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c) -TARGET_C_PROPERTIES (H5detect ${LOCAL_OPT_FLAG} " ") +TARGET_C_PROPERTIES (H5detect " " " ") IF (MSVC) TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib") ENDIF (MSVC) diff --git a/src/H5F.c b/src/H5F.c index 6b89c4e..756a958 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -825,22 +825,25 @@ done: htri_t H5Fis_hdf5(const char *name) { - H5FD_t *file = NULL; /* Low-level file struct */ - htri_t ret_value; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr; /* Address of hdf5 file signature */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); /* Check args and all the boring stuff. */ if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") /* The file is an hdf5 file if the hdf5 file signature can be found */ - ret_value = (HADDR_UNDEF != H5F_locate_signature(file, H5AC_ind_dxpl_id)); + if(H5F_locate_signature(file, H5AC_ind_dxpl_id, &sig_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + ret_value = (HADDR_UNDEF != sig_addr); done: /* Close the file */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index e47662e..828d464 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -296,7 +296,7 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; /* General routines */ H5_DLL herr_t H5F_init(void); -H5_DLL haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); +H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); /* File mount related routines */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 8205392..a1c67ec 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -100,34 +100,33 @@ H5F_init_super_interface(void) /*------------------------------------------------------------------------- - * Function: H5F_locate_signature + * Function: H5F_locate_signature * - * Purpose: Finds the HDF5 superblock signature in a file. The signature - * can appear at address 0, or any power of two beginning with - * 512. + * Purpose: Finds the HDF5 superblock signature in a file. The + * signature can appear at address 0, or any power of two + * beginning with 512. * - * Return: Success: The absolute format address of the signature. - * - * Failure: HADDR_UNDEF + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Programmer: Robb Matzke + * Friday, November 7, 1997 * *------------------------------------------------------------------------- */ -haddr_t -H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) +herr_t +H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr) { - haddr_t addr, eoa; - uint8_t buf[H5F_SIGNATURE_LEN]; - unsigned n, maxpow; - haddr_t ret_value; /* Return value */ + haddr_t addr, eoa; + uint8_t buf[H5F_SIGNATURE_LEN]; + unsigned n, maxpow; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Find the least N such that 2^N is larger than the file size */ if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to obtain EOF/EOA value") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value") for(maxpow = 0; addr; maxpow++) addr >>= 1; maxpow = MAX(maxpow, 9); @@ -137,26 +136,27 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { - addr = (8 == n) ? 0 : (haddr_t)1 << n; - if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature") - if(H5FD_read(file, dxpl_id, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature") - if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) + addr = (8 == n) ? 0 : (haddr_t)1 << n; + if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature") + if(H5FD_read(file, dxpl_id, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") + if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; } /* end for */ /* * If the signature was not found then reset the EOA value and return - * failure. + * HADDR_UNDEF. */ if(n >= maxpow) { - (void)H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa); /* Ignore return value */ - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to find a valid file signature") + if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") + *sig_addr = HADDR_UNDEF; } /* end if */ - - /* Set return value */ - ret_value = addr; + else + /* Set return value */ + *sig_addr = addr; done: FUNC_LEAVE_NOAPI(ret_value) @@ -330,8 +330,10 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Find the superblock */ - if(HADDR_UNDEF == (super_addr = H5F_locate_signature(f->shared->lf, dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to find file signature") + if(H5F_locate_signature(f->shared->lf, dxpl_id, &super_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + if(HADDR_UNDEF == super_addr) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found") /* Check for userblock present */ if(H5F_addr_gt(super_addr, 0)) { diff --git a/src/H5PL.c b/src/H5PL.c index 1c4b355..21bc0f2 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -85,7 +85,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ -#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGIN +#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" @@ -273,6 +273,10 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) + /* Check for "no plugins" indicated" */ + if(H5PL_no_plugin_g) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + /* Initialize the location paths for dynamic libraries, if they aren't * already set up. */ diff --git a/src/H5Z.c b/src/H5Z.c index d415060..901b506 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1326,9 +1326,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, hbool_t issue_error = FALSE; /* Check for "no plugins" indicated" */ - if(H5PL_no_plugin()) - issue_error = TRUE; - else { const H5Z_class2_t *filter_info; /* Try loading the filter */ @@ -1343,7 +1340,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } /* end if */ else issue_error = TRUE; - } /* end else */ /* Check for error */ if(issue_error) { diff --git a/src/H5config.h.in b/src/H5config.h.in index a86970a..02bafd8 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -18,7 +18,7 @@ #undef CXX_HAVE_OFFSETOF /* Define the default plugins path to compile */ -#undef DEFAULT_PLUGIN +#undef DEFAULT_PLUGINDIR /* Define the default virtual file driver to compile */ #undef DEFAULT_VFD diff --git a/src/H5detect.c b/src/H5detect.c index 2bf0d2d..be661ea 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -118,10 +118,12 @@ static volatile int nd_g = 0, na_g = 0; static void print_results(int nd, detected_t *d, int na, malign_t *m); static void iprint(detected_t *); -static int byte_cmp(int, const void *, const void *); -static int bit_cmp(int, int *, volatile void *, volatile void *); +static int byte_cmp(int, const void *, const void *, const unsigned char *); +static int bit_cmp(int, int *, volatile void *, volatile void *, + const unsigned char *); static void fix_order(int, int, int *, const char **); -static int imp_bit(int, int *, volatile void *, volatile void *); +static int imp_bit(int, int *, volatile void *, volatile void *, + const unsigned char *); static unsigned long find_bias(int, int, int *, void *); static void precision (detected_t*); static void print_header(void); @@ -200,15 +202,17 @@ precision (detected_t *d) } } - /*------------------------------------------------------------------------- - * Function: DETECT_I + * Function: DETECT_I/DETECT_BYTE * - * Purpose: This macro takes a type like `int' and a base name like + * Purpose: These macro takes a type like `int' and a base name like * `nati' and detects the byte order. The VAR is used to * construct the names of the C variables defined. * + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. + * * Return: void * * Programmer: Robb Matzke @@ -229,46 +233,52 @@ precision (detected_t *d) * Robb Matzke, 5 Nov 1996 * Removed HFILE and CFILE arguments. * + * Neil Fortner, 6 Sep 2013 + * Split macro into DETECT_I and DETECT_BYTE macros, extracted + * common cod einto DETECT_I_BYTE_CORE. This was done to remove + * "will never be executed" warnings. + * *------------------------------------------------------------------------- */ -#define DETECT_I(TYPE,VAR,INFO) { \ - TYPE _v; \ - int _int_v; \ - int _i, _j; \ - unsigned char *_x; \ +#define DETECT_I_BYTE_CORE(TYPE,VAR,INFO,DETECT_TYPE) { \ + DETECT_TYPE _v; \ + int _i, _j; \ + unsigned char *_x; \ + \ + HDmemset(&INFO, 0, sizeof(INFO)); \ + INFO.varname = #VAR; \ + INFO.size = sizeof(TYPE); \ \ - HDmemset(&INFO, 0, sizeof(INFO)); \ - INFO.varname = #VAR; \ - INFO.size = sizeof(TYPE); \ + for(_i = sizeof(DETECT_TYPE), _v = 0; _i > 0; --_i) \ + _v = (_v << 8) + _i; \ + for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(DETECT_TYPE); _i++) { \ + _j = (*_x++) - 1; \ + HDassert(_j < (signed)sizeof(DETECT_TYPE)); \ + INFO.perm[_i] = _j; \ + } /* end for */ \ \ - if(sizeof(TYPE) != 1) { \ - for(_i = sizeof(TYPE), _v = 0; _i > 0; --_i) \ - _v = (_v << 8) + _i; \ - for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(TYPE); _i++) { \ - _j = (*_x++) - 1; \ - HDassert(_j < (signed)sizeof(TYPE)); \ - INFO.perm[_i] = _j; \ - } /* end for */ \ - } else { /*Not able to detect order if type size is 1 byte. Use native int \ - *instead. No effect on data, just make it look correct. */ \ - for(_i = sizeof(int), _int_v = 0; _i > 0; --_i) \ - _int_v = (_int_v << 8) + _i; \ - for(_i = 0, _x = (unsigned char *)&_int_v; _i < (signed)sizeof(int); _i++) { \ - _j = (*_x++)-1; \ - HDassert(_j < (signed)sizeof(int)); \ - INFO.perm[_i] = _j; \ - } /* end for */ \ - } /* end else */ \ + INFO.sign = ('U' != *(#VAR)); \ + precision (&(INFO)); \ + ALIGNMENT(TYPE, INFO); \ + if(!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \ + !HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \ + !HDstrcmp(INFO.varname, "LLONG")) { \ + COMP_ALIGNMENT(TYPE, INFO.comp_align); \ + } \ +} + +#define DETECT_BYTE(TYPE,VAR,INFO) { \ + HDcompile_assert(sizeof(TYPE) == 1); \ \ - INFO.sign = ('U' != *(#VAR)); \ - precision (&(INFO)); \ - ALIGNMENT(TYPE, INFO); \ - if(!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \ - !HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \ - !HDstrcmp(INFO.varname, "LLONG")) { \ - COMP_ALIGNMENT(TYPE, INFO.comp_align); \ - } \ + DETECT_I_BYTE_CORE(TYPE,VAR,INFO,int) \ } + +#define DETECT_I(TYPE,VAR,INFO) { \ + HDcompile_assert(sizeof(TYPE) > 1); \ + \ + DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ +} + /*------------------------------------------------------------------------- * Function: DETECT_F @@ -290,71 +300,88 @@ precision (detected_t *d) * *------------------------------------------------------------------------- */ -#define DETECT_F(TYPE,VAR,INFO) { \ - volatile TYPE _v1, _v2, _v3; \ - unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ - int _i, _j, _last = (-1); \ - char *_mesg; \ - \ - HDmemset(&INFO, 0, sizeof(INFO)); \ - INFO.varname = #VAR; \ - INFO.size = sizeof(TYPE); \ - \ - /* Completely initialize temporary variables, in case the bits used in */ \ - /* the type take less space than the number of bits used to store the type */ \ - HDmemset(&_v3, 0, sizeof(TYPE)); \ - HDmemset(&_v2, 0, sizeof(TYPE)); \ - HDmemset(&_v1, 0, sizeof(TYPE)); \ - \ - /* Byte Order */ \ - for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \ - _v3 = _v1; \ - _v1 += _v2; \ - _v2 /= 256.0; \ - HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ - HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ - _j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \ - if(_j >= 0) { \ - INFO.perm[_i] = _j; \ - _last = _i; \ - } \ - } \ - fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \ +#define DETECT_F(TYPE,VAR,INFO) { \ + volatile TYPE _v1, _v2, _v3; \ + unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ + unsigned char _pad_mask[sizeof(TYPE)]; \ + unsigned char _byte_mask; \ + int _i, _j, _last = (-1); \ + char *_mesg; \ \ - if(!HDstrcmp(_mesg, "VAX")) \ - INFO.is_vax = TRUE; \ - \ - /* Implicit mantissa bit */ \ - _v1 = 0.5; \ - _v2 = 1.0; \ - INFO.imp = imp_bit (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - \ - /* Sign bit */ \ - _v1 = 1.0; \ - _v2 = -1.0; \ - INFO.sign = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - \ - /* Mantissa */ \ - INFO.mpos = 0; \ - \ - _v1 = 1.0; \ - _v2 = 1.5; \ - INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ - \ - /* Exponent */ \ - INFO.epos = INFO.mpos + INFO.msize; \ - \ - INFO.esize = INFO.sign - INFO.epos; \ - \ - _v1 = 1.0; \ - INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \ - precision (&(INFO)); \ - ALIGNMENT(TYPE, INFO); \ - if(!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \ - !HDstrcmp(INFO.varname, "LDOUBLE")) { \ - COMP_ALIGNMENT(TYPE,INFO.comp_align); \ - } \ + HDmemset(&INFO, 0, sizeof(INFO)); \ + INFO.varname = #VAR; \ + INFO.size = sizeof(TYPE); \ + \ + /* Initialize padding mask */ \ + HDmemset(_pad_mask, 0, sizeof(_pad_mask)); \ + \ + /* Padding bits. Set a variable to 4.0, then flip each bit and see if \ + * the modified variable is equal ("==") to the original. Build a \ + * padding bitmask to indicate which bits in the type are padding (i.e. \ + * have no effect on the value and should be ignored by subsequent \ + * steps). This is necessary because padding bits can change arbitrarily \ + * and interfere with detection of the various properties below unless we \ + * know to ignore them. */ \ + _v1 = 4.0; \ + HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + for(_i = 0; _i < (int)sizeof(TYPE); _i++) \ + for(_byte_mask = (unsigned char)1; _byte_mask; _byte_mask <<= 1) { \ + _buf1[_i] ^= _byte_mask; \ + HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ + if(_v1 != _v2) \ + _pad_mask[_i] |= _byte_mask; \ + _buf1[_i] ^= _byte_mask; \ + } /* enf for */ \ + \ + /* Byte Order */ \ + for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \ + _v3 = _v1; \ + _v1 += _v2; \ + _v2 /= 256.0; \ + HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ + _j = byte_cmp(sizeof(TYPE), _buf3, _buf1, _pad_mask); \ + if(_j >= 0) { \ + INFO.perm[_i] = _j; \ + _last = _i; \ + } \ + } \ + fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \ + \ + if(!HDstrcmp(_mesg, "VAX")) \ + INFO.is_vax = TRUE; \ + \ + /* Implicit mantissa bit */ \ + _v1 = 0.5; \ + _v2 = 1.0; \ + INFO.imp = imp_bit (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Sign bit */ \ + _v1 = 1.0; \ + _v2 = -1.0; \ + INFO.sign = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Mantissa */ \ + INFO.mpos = 0; \ + \ + _v1 = 1.0; \ + _v2 = 1.5; \ + INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ + \ + /* Exponent */ \ + INFO.epos = INFO.mpos + INFO.msize; \ + \ + INFO.esize = INFO.sign - INFO.epos; \ + \ + _v1 = 1.0; \ + INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \ + precision (&(INFO)); \ + ALIGNMENT(TYPE, INFO); \ + if(!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \ + !HDstrcmp(INFO.varname, "LDOUBLE")) { \ + COMP_ALIGNMENT(TYPE,INFO.comp_align); \ + } \ } @@ -879,7 +906,8 @@ iprint(detected_t *d) * * Purpose: Compares two chunks of memory A and B and returns the * byte index into those arrays of the first byte that - * differs between A and B. + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * * Return: Success: Index of differing byte. * @@ -894,13 +922,16 @@ iprint(detected_t *d) *------------------------------------------------------------------------- */ static int -byte_cmp(int n, const void *_a, const void *_b) +byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) { - int i; - const unsigned char *a = (const unsigned char *) _a; - const unsigned char *b = (const unsigned char *) _b; + int i; + const unsigned char *a = (const unsigned char *) _a; + const unsigned char *b = (const unsigned char *) _b; + + for(i = 0; i < n; i++) + if((a[i] & pad_mask[i]) != (b[i] & pad_mask[i])) + return i; - for (i = 0; i < n; i++) if (a[i] != b[i]) return i; return -1; } @@ -911,7 +942,8 @@ byte_cmp(int n, const void *_a, const void *_b) * Purpose: Compares two bit vectors and returns the index for the * first bit that differs between the two vectors. The * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * * Return: Success: Index of first differing bit. * @@ -926,22 +958,24 @@ byte_cmp(int n, const void *_a, const void *_b) *------------------------------------------------------------------------- */ static int -bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b) +bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b, + const unsigned char *pad_mask) { - int i, j; - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - unsigned char aa, bb; + int i, j; + volatile unsigned char *a = (volatile unsigned char *) _a; + volatile unsigned char *b = (volatile unsigned char *) _b; + unsigned char aa, bb; for (i = 0; i < nbytes; i++) { - HDassert(perm[i] < nbytes); - if ((aa = a[perm[i]]) != (bb = b[perm[i]])) { - for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { - if ((aa & 1) != (bb & 1)) return i * 8 + j; - } - HDassert("INTERNAL ERROR" && 0); - HDabort(); - } + HDassert(perm[i] < nbytes); + if ((aa = a[perm[i]] & pad_mask[perm[i]]) + != (bb = b[perm[i]] & pad_mask[perm[i]])) { + for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if ((aa & 1) != (bb & 1)) return i * 8 + j; + } + fprintf(stderr, "INTERNAL ERROR"); + HDabort(); + } } return -1; } @@ -1050,18 +1084,19 @@ fix_order(int n, int last, int *perm, const char **mesg) *------------------------------------------------------------------------- */ static int -imp_bit(int n, int *perm, volatile void *_a, volatile void *_b) +imp_bit(int n, int *perm, volatile void *_a, volatile void *_b, + const unsigned char *pad_mask) { - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - int changed, major, minor; - int msmb; /*most significant mantissa bit */ + volatile unsigned char *a = (volatile unsigned char *) _a; + volatile unsigned char *b = (volatile unsigned char *) _b; + int changed, major, minor; + int msmb; /*most significant mantissa bit */ /* * Look for the least significant bit that has changed between - * A and B. This is the least significant bit of the exponent. + * A and B. This is the least significant bit of the exponent. */ - changed = bit_cmp(n, perm, a, b); + changed = bit_cmp(n, perm, a, b, pad_mask); HDassert(changed >= 0); /* @@ -1279,8 +1314,8 @@ bit.\n"; static void detect_C89_integers(void) { - DETECT_I(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_I(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; DETECT_I(int, INT, d_g[nd_g]); nd_g++; @@ -1330,22 +1365,46 @@ static void detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 + #if H5_SIZEOF_INT8_T==1 + DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; + #else DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT8_T>0 - DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #if H5_SIZEOF_UINT8_T==1 + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #else + DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_INT_LEAST8_T>0 + #if H5_SIZEOF_INT_LEAST8_T==1 + DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 + #if H5_SIZEOF_UINT_LEAST8_T==1 + DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 + #if H5_SIZEOF_INT_FAST8_T==1 + DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #if H5_SIZEOF_UINT_FAST8_T==1 + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #else + DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #endif #endif } diff --git a/src/H5public.h b/src/H5public.h index 49c9fbb..6136c05 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 164 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 165 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "swmr0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.164-swmr0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.165-swmr0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.am b/src/Makefile.am index 2e16d52..43d1d30 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,6 @@ include $(top_srcdir)/config/lt_vers.am # a long time to compile it with any optimization on. H5detect is used # to generate H5Tinit.c once. So, optimization is not critical. noinst_PROGRAMS = H5detect H5make_libsettings -H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES=libhdf5.la diff --git a/src/Makefile.in b/src/Makefile.in index de6ae97..a1666be 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -185,11 +185,8 @@ libhdf5_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(libhdf5_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(noinst_PROGRAMS) H5detect_SOURCES = H5detect.c -H5detect_OBJECTS = H5detect-H5detect.$(OBJEXT) +H5detect_OBJECTS = H5detect.$(OBJEXT) H5detect_LDADD = $(LDADD) -H5detect_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(H5detect_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ H5make_libsettings_SOURCES = H5make_libsettings.c H5make_libsettings_OBJECTS = H5make_libsettings.$(OBJEXT) H5make_libsettings_LDADD = $(LDADD) @@ -355,6 +352,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -525,9 +523,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 -H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES = libhdf5.la @@ -751,7 +748,7 @@ clean-noinstPROGRAMS: rm -f $$list H5detect$(EXEEXT): $(H5detect_OBJECTS) $(H5detect_DEPENDENCIES) $(EXTRA_H5detect_DEPENDENCIES) @rm -f H5detect$(EXEEXT) - $(AM_V_CCLD)$(H5detect_LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) H5make_libsettings$(EXEEXT): $(H5make_libsettings_OBJECTS) $(H5make_libsettings_DEPENDENCIES) $(EXTRA_H5make_libsettings_DEPENDENCIES) @rm -f H5make_libsettings$(EXEEXT) $(AM_V_CCLD)$(LINK) $(H5make_libsettings_OBJECTS) $(H5make_libsettings_LDADD) $(LIBS) @@ -1033,7 +1030,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ztrans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5checksum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5dbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect-H5detect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5lib_settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5make_libsettings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5system.Plo@am__quote@ @@ -1061,20 +1058,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -H5detect-H5detect.o: H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.o -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='H5detect.c' object='H5detect-H5detect.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c - -H5detect-H5detect.obj: H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.obj -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='H5detect.c' object='H5detect-H5detect.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` - mostlyclean-libtool: -rm -f *.lo diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 343fa34..b594cc2 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -25,7 +25,7 @@ Compiling Options: AM_CPPFLAGS: @AM_CPPFLAGS@ Shared C Library: @enable_shared@ Static C Library: @enable_static@ - Statically Linked Executables: @STATIC_EXEC@ + Statically Linked Executables: @LT_STATIC_EXEC@ LDFLAGS: @LDFLAGS@ H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ diff --git a/test/Makefile.in b/test/Makefile.in index 7a71fcc..62a2a7f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -777,6 +777,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index b322460..ddc995e 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -56,5 +56,8 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '305' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache All error API tests passed. diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 2fbf5fc..6ddfef2 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -283,6 +283,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/Makefile.in b/tools/Makefile.in index 4af6d74..5b9568a 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 3278f80..b922c9b 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -262,6 +262,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 9b46f4e..1b732b0 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -269,6 +269,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index b8e46f3..cf46e74 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -15,6 +15,7 @@ #include #include +#include "H5private.h" #include "h5diff.h" #include "h5diff_common.h" #include "h5tools.h" @@ -135,7 +136,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if (!strncmp (argv[i], "-v", 2)) + else if (!strncmp (argv[i], "-v", (size_t)2)) { options->m_verbose_level = atoi(&argv[i][2]); break; @@ -149,7 +150,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if ( !strncmp (argv[i], "--verbose", 9) && argv[i][9]=='=') + else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') { options->m_verbose_level = atoi(&argv[i][10]); break; @@ -164,7 +165,7 @@ void parse_command_line(int argc, options->m_report = 1; break; case 'l': - options->follow_links = 1; + options->follow_links = TRUE; break; case 'x': options->no_dangle_links = 1; diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 4741683..21a622d 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -268,6 +268,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5dump/errfiles/filter_fail.err b/tools/h5dump/errfiles/filter_fail.err index 8f0f990..db21044 100644 --- a/tools/h5dump/errfiles/filter_fail.err +++ b/tools/h5dump/errfiles/filter_fail.err @@ -14,6 +14,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '312' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache h5dump error: unable to print data H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 6aaa499..d714f39 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1154,6 +1154,9 @@ dump_fcpl(hid_t fid) hsize_t userblock; /* userblock size retrieved from FCPL */ size_t off_size; /* size of offsets in the file */ size_t len_size; /* size of lengths in the file */ + H5F_file_space_type_t fs_strategy; /* file space strategy */ + hsize_t fs_threshold; /* free-space section threshold */ + H5F_info2_t finfo; /* file information */ #ifdef SHOW_FILE_DRIVER hid_t fapl; /* file access property list ID */ hid_t fdriver; /* file driver */ @@ -1162,9 +1165,6 @@ dump_fcpl(hid_t fid) unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ unsigned sym_ik; /* symbol table B-tree internal 'K' value */ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ - H5F_file_space_type_t fs_strategy; /* file space strategy */ - hsize_t fs_threshold; /* free-space section threshold */ - H5F_info2_t finfo; /* file information */ fcpl=H5Fget_create_plist(fid); H5Fget_info2(fid, &finfo); diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 9ad2341..bfb777a 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -262,6 +262,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index fd170fd..7256d6e 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -276,6 +276,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 1861b03..d67249f 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index d4e1cb3..6295ffb 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1461,13 +1461,13 @@ dump_dataset_values(hid_t dset) /* Print all the values. */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Unable to print data."); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } H5Tclose(f_type); @@ -1535,7 +1535,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, case H5S_SCALAR: /* scalar dataspace */ h5tools_str_append(&buffer, " scalar\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5S_SIMPLE: @@ -1546,20 +1546,20 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, nelmts *= size[i]; } h5tools_str_append(&buffer, "}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5S_NULL: /* null dataspace */ h5tools_str_append(&buffer, " null\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5S_NO_CLASS: default: /* Unknown dataspace type */ h5tools_str_append(&buffer, " unknown\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -1568,7 +1568,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, h5tools_str_append(&buffer, " Type: "); print_type(&buffer, type, 15); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Data */ outputformat = *info; @@ -1584,7 +1584,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, else { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); outputformat.line_1st = NULL; outputformat.line_pre = " %s "; outputformat.line_cont = " %s "; @@ -1720,7 +1720,7 @@ dataset_list1(hid_t dset) if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR"); else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL"); h5tools_str_append(&buffer, "}"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); H5Sclose (space); h5tools_str_close(&buffer); @@ -1787,7 +1787,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) if (H5D_CHUNKED==H5Pget_layout(dcpl)) { hsize_t chsize[64]; /* chunk size in elements */ - ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/); + ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/); h5tools_str_append(&buffer, " %-10s {", "Chunks:"); total = H5Tget_size(type); for (i=0; iline_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Print address information */ if(address_g) @@ -1960,7 +1960,7 @@ datatype_list2(hid_t type, const char UNUSED *name) h5tools_str_append(&buffer, " %-10s ", "Type:"); print_type(&buffer, type, 15); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2010,7 +2010,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_append(&buffer, "{"); if(obj_type >= 0 && dispatch_g[obj_type].name) h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Check if we've seen this object before */ if(first_seen) { @@ -2020,7 +2020,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if(!iter->symlink_target) { h5tools_str_append(&buffer, "\n"); } - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* end if */ else { hid_t obj = (-1); /* ID of object opened */ @@ -2031,7 +2031,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if(obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " *ERROR*\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; } /* end if */ @@ -2041,7 +2041,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if(!iter->symlink_target || (verbose_g > 0)) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* Show detailed information about the object, beginning with information @@ -2059,7 +2059,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Modification time */ if(oinfo->mtime > 0) { @@ -2074,7 +2074,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* end if */ } /* end if */ @@ -2094,7 +2094,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_append(&buffer, " %-10s \"", "Comment:"); print_string(&buffer, comment, FALSE); h5tools_str_append(&buffer, "\"\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* end if */ HDfree(comment); } @@ -2114,7 +2114,7 @@ done: if(iter->symlink_target) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); iter->symlink_target = FALSE; } h5tools_str_close(&buffer); @@ -2181,7 +2181,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_append(&buffer, "Soft Link {"); h5tools_str_append(&buffer, buf); h5tools_str_append(&buffer, "}"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); if(follow_symlink_g) { hbool_t orig_grp_literal = grp_literal_g; @@ -2192,10 +2192,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) { h5tools_str_append(&buffer, "{Already Visited}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; } - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Add this link to the list of seen softlinks */ if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0) @@ -2221,7 +2221,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) else { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } break; @@ -2253,7 +2253,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_append(&buffer, "/"); h5tools_str_append(&buffer, path); h5tools_str_append(&buffer, "}"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Recurse through the external link */ /* keep the follow_elink_g for backward compatibility with -E */ @@ -2267,10 +2267,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) { h5tools_str_append(&buffer, "{Already Visited}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; } - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Add this link to the list of seen elinks */ if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) @@ -2305,7 +2305,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) case H5L_TYPE_MAX: default: h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -2356,7 +2356,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) } else print_obj_name(&buffer, iter, oname, "**NOT FOUND**"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); retval = -1; goto done; } /* end if */ @@ -2366,7 +2366,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) /* Get ID for group */ if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) { h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; /* Previously "continue", when this code was in main(). * We don't "continue" here in order to close the file * and free the file name properly. */ @@ -2460,7 +2460,7 @@ get_width(void) { /* Unix with ioctl(TIOCGWINSZ) */ struct winsize w; - if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0) + if (ioctl(2, (int)TIOCGWINSZ, &w)>=0 && w.ws_col>0) width = w.ws_col; } #elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL) @@ -2617,9 +2617,9 @@ main(int argc, const char *argv[]) simple_output_g = TRUE; } else if(!HDstrcmp(argv[argno], "--string")) { string_g = TRUE; - } else if(!HDstrncmp(argv[argno], "--vfd=", 6)) { + } else if(!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { preferred_driver = argv[argno]+6; - } else if(!HDstrncmp(argv[argno], "--width=", 8)) { + } else if(!HDstrncmp(argv[argno], "--width=", (size_t)8)) { width_g = (int)HDstrtol(argv[argno]+8, &rest, 0); if(0 == width_g) @@ -2647,7 +2647,7 @@ main(int argc, const char *argv[]) leave(EXIT_SUCCESS); } else if(!HDstrcmp(argv[argno], "--hexdump")) { hexdump_g = TRUE; - } else if(!HDstrncmp(argv[argno], "-w", 2)) { + } else if(!HDstrncmp(argv[argno], "-w", (size_t)2)) { if(argv[argno][2]) { s = argv[argno] + 2; } else if((argno + 1) >= argc) { @@ -2857,7 +2857,7 @@ main(int argc, const char *argv[]) h5tools_str_reset(&buffer); print_obj_name(&buffer, &iter, oname, "**NOT FOUND**"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); leave(EXIT_FAILURE); } /* end if */ } /* end if */ diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index c52112b..663e501 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -30,7 +30,9 @@ noinst_PROGRAMS=testh5repack_detect_szip SCRIPT_DEPEND=h5repack$(EXEEXT) if HAVE_SHARED_CONDITIONAL - TEST_SCRIPT += h5repack_plugin.sh +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5repack_plugin.sh +endif endif check_SCRIPTS=$(TEST_SCRIPT) diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index addb530..fc37649 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -74,7 +74,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT) -@HAVE_SHARED_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh +@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh check_PROGRAMS = $(am__EXEEXT_1) bin_PROGRAMS = h5repack$(EXEEXT) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) @@ -312,6 +312,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index d7bfd02..3815679 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -32,19 +32,30 @@ const char *outfile = NULL; * parameters. */ static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; -static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", - no_arg, 'V' }, { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, { "layout", require_arg, 'l' }, { - "minimum", require_arg, 'm' }, { "file", require_arg, 'e' }, { - "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, { "compact", - require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", - require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", - require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { - "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; +static struct long_options l_opts[] = { + { "help", no_arg, 'h' }, + { "version", no_arg, 'V' }, + { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, + { "layout", require_arg, 'l' }, + { "minimum", require_arg, 'm' }, + { "file", require_arg, 'e' }, + { "native", no_arg, 'n' }, + { "latest", no_arg, 'L' }, + { "compact", require_arg, 'c' }, + { "indexed", require_arg, 'd' }, + { "ssize", require_arg, 's' }, + { "ublock", require_arg, 'u' }, + { "block", require_arg, 'b' }, + { "metadata_block_size", require_arg, 'M' }, + { "threshold", require_arg, 't' }, + { "alignment", require_arg, 'a' }, + { "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, + { NULL, 0, '\0' } +}; /*------------------------------------------------------------------------- * Function: usage @@ -61,81 +72,55 @@ static void usage(const char *prog) { printf(" file2 Output HDF5 File\n"); printf(" OPTIONS\n"); printf(" -h, --help Print a usage message and exit\n"); - printf( - " -v, --verbose Verbose mode, print object information\n"); + printf(" -v, --verbose Verbose mode, print object information\n"); printf(" -V, --version Print version number and exit\n"); - printf( - " -n, --native Use a native HDF5 type when repacking\n"); + printf(" -n, --native Use a native HDF5 type when repacking\n"); printf(" -L, --latest Use latest version of file format\n"); - printf( - " -c L1, --compact=L1 Maximum number of links in header messages\n"); - printf( - " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); - printf( - " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); - printf( - " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); - printf( - " -e E, --file=E Name of file E with the -f and -l options\n"); - printf( - " -u U, --ublock=U Name of file U with user block data to be added\n"); + printf(" -c L1, --compact=L1 Maximum number of links in header messages\n"); + printf(" -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); + printf(" -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); + printf(" -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); + printf(" -e E, --file=E Name of file E with the -f and -l options\n"); + printf(" -u U, --ublock=U Name of file U with user block data to be added\n"); printf(" -b B, --block=B Size of user block to be added\n"); - printf( - " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); + printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); printf(" -f FILT, --filter=FILT Filter type\n"); printf(" -l LAYT, --layout=LAYT Layout type\n"); - printf( - " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); - printf( - " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); - + printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); + printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); printf("\n"); - - printf( - " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); + printf(" M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); printf(" E - is a filename.\n"); printf(" S - is an integer\n"); printf(" U - is a filename.\n"); printf(" T - is an integer\n"); printf(" A - is an integer greater than zero\n"); - printf( - " B - is the user block size, any value that is 512 or greater and is\n"); + printf(" B - is the user block size, any value that is 512 or greater and is\n"); printf(" a power of 2 (1024 default)\n"); - printf( - " F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); + printf(" F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); printf("\n"); - printf( - " FS_STRGY is the file space management strategy to use for the output file.\n"); + printf(" FS_STRGY is the file space management strategy to use for the output file.\n"); printf(" It is a string as listed below:\n"); - printf( - " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); + printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); printf(" for file space allocation\n"); - printf( - " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); + printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); printf(" for file space allocation\n"); - printf( - " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); + printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); printf(" VFD - Use virtual file driver for file space allocation\n"); printf("\n"); - printf( - " FS_THRD is the free-space section threshold to use for the output file.\n"); - printf( - " It is the minimum size (in bytes) of free-space sections to be tracked\n"); + printf(" FS_THRD is the free-space section threshold to use for the output file.\n"); + printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n"); printf(" by the the library's free-space managers.\n"); printf("\n"); - printf(" FILT - is a string with the format:\n"); printf("\n"); printf(" :=\n"); printf("\n"); - printf( - " is a comma separated list of object names, meaning apply\n"); - printf( - " compression only to those objects. If no names are specified, the filter\n"); + printf(" is a comma separated list of object names, meaning apply\n"); + printf(" compression only to those objects. If no names are specified, the filter\n"); printf(" is applied to all objects\n"); printf(" can be:\n"); printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); @@ -146,22 +131,17 @@ static void usage(const char *prog) { printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); printf(" UD, to apply a user defined filter\n"); printf(" NONE, to remove all filters\n"); - printf( - " is optional filter parameter information\n"); + printf(" is optional filter parameter information\n"); printf(" GZIP= from 1-9\n"); - printf( - " SZIP= pixels per block is a even number in\n"); + printf(" SZIP= pixels per block is a even number in\n"); printf(" 2-32 and coding method is either EC or NN\n"); printf(" SHUF (no parameter)\n"); printf(" FLET (no parameter)\n"); printf(" NBIT (no parameter)\n"); - printf( - " SOFF= scale_factor is an integer and scale_type\n"); + printf(" SOFF= scale_factor is an integer and scale_type\n"); printf(" is either IN or DS\n"); - printf( - " UD=\n"); - printf( - " required values for filter_number,cd_value_count,value_1\n"); + printf(" UD=\n"); + printf(" required values for filter_number,cd_value_count,value_1\n"); printf(" optional values for value_2 to value_N\n"); printf(" NONE (no parameter)\n"); printf("\n"); @@ -169,18 +149,15 @@ static void usage(const char *prog) { printf("\n"); printf(" :=\n"); printf("\n"); - printf( - " is a comma separated list of object names, meaning that\n"); - printf( - " layout information is supplied for those objects. If no names are\n"); + printf(" is a comma separated list of object names, meaning that\n"); + printf(" layout information is supplied for those objects. If no names are\n"); printf(" specified, the layout type is applied to all objects\n"); printf(" can be:\n"); printf(" CHUNK, to apply chunking layout\n"); printf(" COMPA, to apply compact layout\n"); printf(" CONTI, to apply contiguous layout\n"); printf(" is optional layout information\n"); - printf( - " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); + printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); printf(" COMPA (no parameter)\n"); printf(" CONTI (no parameter)\n"); printf("\n"); @@ -190,21 +167,18 @@ static void usage(const char *prog) { printf("\n"); printf(" GZIP compression with level 1 to all objects\n"); printf("\n"); - printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); + printf("2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n"); printf("\n"); - printf( - " SZIP compression with 8 pixels per block and NN coding method to object A\n"); + printf(" SZIP compression with 8 pixels per block and NN coding method to object dset1\n"); printf("\n"); - printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); + printf("3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n"); printf("\n"); - printf( - " Chunked layout, with a layout size of 20x10, to objects A and B\n"); - printf(" and remove filters to objects C, D, F\n"); + printf(" Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n"); + printf(" and remove filters to objects dset3, dset4, dset5\n"); printf("\n"); printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); printf("\n"); - printf( - " Using latest file format with maximum compact group size of 10 and\n"); + printf(" Using latest file format with maximum compact group size of 10 and\n"); printf(" and minimum shared datatype size of 20\n"); printf("\n"); printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index e8ba83e..a45d1fe 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -222,7 +222,7 @@ COPY_TESTFILES_TO_TESTDIR # Run the test arg="h5repack_layout.h5 -v -f UD=257,1,9" -#TOOLTEST_DUMP plugin_test $arg +TOOLTEST_DUMP plugin_test $arg # print results if test $nerrors -ne 0 ; then diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt index 6de1eb4..c70b031 100644 --- a/tools/h5repack/testfiles/h5repack-help.txt +++ b/tools/h5repack/testfiles/h5repack-help.txt @@ -98,14 +98,14 @@ Examples of use: GZIP compression with level 1 to all objects -2) h5repack -v -f A:SZIP=8,NN file1 file2 +2) h5repack -v -f dset1:SZIP=8,NN file1 file2 - SZIP compression with 8 pixels per block and NN coding method to object A + SZIP compression with 8 pixels per block and NN coding method to object dset1 -3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2 +3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2 - Chunked layout, with a layout size of 20x10, to objects A and B - and remove filters to objects C, D, F + Chunked layout, with a layout size of 20x10, to objects dset1 and dset2 + and remove filters to objects dset3, dset4, dset5 4) h5repack -L -c 10 -s 20:dtype file1 file2 diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index ec77732..d2c26a2 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -291,6 +291,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 743e158..6f7f3b9 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -254,6 +254,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1752155..541525d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -839,10 +839,10 @@ hsize_t h5diff(const char *fname1, { h5difftrace("h5diff no object specified\n"); /* set root group */ - obj1fullname = (char*)HDcalloc(2, sizeof(char)); + obj1fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj1fullname, "/"); obj1type = H5TRAV_TYPE_GROUP; - obj2fullname = (char*)HDcalloc(2, sizeof(char)); + obj2fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj2fullname, "/"); obj2type = H5TRAV_TYPE_GROUP; } @@ -1554,9 +1554,9 @@ hsize_t diff(hid_t file1_id, hid_t grp1_id = (-1); hid_t grp2_id = (-1); int ret; - int is_dangle_link1 = 0; - int is_dangle_link2 = 0; - int is_hard_link = 0; + hbool_t is_dangle_link1 = FALSE; + hbool_t is_dangle_link2 = FALSE; + hbool_t is_hard_link = FALSE; hsize_t nfound = 0; h5trav_type_t object_type; @@ -1598,7 +1598,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link1 = 1; + is_dangle_link1 = TRUE; } else if (ret < 0) goto out; @@ -1616,7 +1616,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link2 = 1; + is_dangle_link2 = TRUE; } else if (ret < 0) goto out; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 9e1c8bb..04b640f 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -71,7 +71,7 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ - int follow_links; /* follow symbolic links */ + hbool_t follow_links; /* follow symbolic links */ int no_dangle_links; /* return error when find dangling link */ int err_stat; /* an error ocurred (1, error, 0, no error) */ int cmn_objs; /* do we have common objects */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 7dba0e5..d08c23f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -5792,14 +5792,14 @@ int ull2float(unsigned long long ull_value, float *f_value) src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)HDcalloc(1, MAX(src_size, dst_size)); + buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); if(!buf) goto error; HDmemcpy(buf, &ull_value, src_size); /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) goto error; HDmemcpy(f_value, buf, dst_size); @@ -6358,9 +6358,9 @@ static void get_member_types(hid_t tid, mcomp_t *members) return; members->n = (unsigned)nmembs; - members->ids = (hid_t *)HDcalloc(members->n, sizeof(hid_t)); - members->offsets = (size_t *)HDcalloc(members->n, sizeof(size_t)); - members->m = (mcomp_t **)HDcalloc(members->n, sizeof(mcomp_t *)); + members->ids = (hid_t *)HDcalloc((size_t)members->n, sizeof(hid_t)); + members->offsets = (size_t *)HDcalloc((size_t)members->n, sizeof(size_t)); + members->m = (mcomp_t **)HDcalloc((size_t)members->n, sizeof(mcomp_t *)); for(u = 0; u < members->n; u++) { diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index ef1d761..44b623f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -169,7 +169,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; /*------------------ @@ -177,7 +177,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; /* criteria is string compare */ @@ -225,7 +225,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; table_attr_mark_exist(infile, name1, table_lp); @@ -247,7 +247,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; table_attr_mark_exist(infile, name2, table_lp); @@ -447,8 +447,8 @@ hsize_t diff_attr(hid_t loc1_id, for(j = 0; j < rank1; j++) nelmts1 *= dims1[j]; - buf1 = (void *)HDmalloc((unsigned)(nelmts1 * msize1)); - buf2 = (void *)HDmalloc((unsigned)(nelmts1 * msize2)); + buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1)); + buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2)); if(buf1 == NULL || buf2 == NULL) { parallel_print( "cannot read into memory\n" ); goto error; diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 341a5c9..2da21ef 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -62,7 +62,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr /* check availability of filters */ for(i = 0; i < nfilters; i++) { - if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, 0, 0, NULL)) < 0) + if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, (size_t)0, 0, NULL)) < 0) return -1; switch(filtn) diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 3320276..47bf60d 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -316,6 +316,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index ac70b34..8a17117 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -511,7 +511,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.164-swmr0" +#define H5_PACKAGE_STRING "HDF5 1.9.165-swmr0" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -520,7 +520,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.164-swmr0" +#define H5_PACKAGE_VERSION "1.9.165-swmr0" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -683,7 +683,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.164-swmr0" +#define H5_VERSION "1.9.165-swmr0" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12