diff options
88 files changed, 2273 insertions, 935 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index eddb4e9..aa3bbbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ SET (EXE_EXT "") IF (WIN32) SET (EXE_EXT ".exe") IF (NOT CYGWIN) - ADD_DEFINITIONS (-DBIND_TO_CURRENT_VCLIBS_VERSION=1) + ADD_DEFINITIONS (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS) ADD_DEFINITIONS (-D_CONSOLE) ENDIF (NOT CYGWIN) @@ -1108,6 +1108,31 @@ INSTALL ( ) #----------------------------------------------------------------------------- +# Configure the HDF518_Examples.cmake file and the examples +#----------------------------------------------------------------------------- +OPTION (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) +IF (HDF5_PACK_EXAMPLES) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/HDF518_Examples.cmake.in + ${HDF5_BINARY_DIR}/HDF518_Examples.cmake @ONLY + ) + INSTALL ( + FILES ${HDF5_BINARY_DIR}/HDF518_Examples.cmake + DESTINATION ${HDF5_INSTALL_DATA_DIR} + COMPONENT hdfdocuments + ) + IF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") + INSTALL ( + FILES + ${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED} + ${HDF5_SOURCE_DIR}/release_docs/USING_CMake_Examples.txt + DESTINATION ${HDF5_INSTALL_DATA_DIR} + COMPONENT hdfdocuments + ) + ENDIF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") +ENDIF (HDF5_PACK_EXAMPLES) + +#----------------------------------------------------------------------------- # Add Document File(s) to CMake Install #----------------------------------------------------------------------------- IF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -1183,16 +1208,37 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") SET (CPACK_PACKAGE_RELOCATABLE TRUE) + SET (CPACK_GENERATOR "TGZ") IF (WIN32) - SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDF5_PACKAGE_NAME}-${HDF5_PACKAGE_VERSION}-${LIB_TYPE}") + LIST (APPEND CPACK_GENERATOR "NSIS") + SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${LIB_TYPE}") SET (CPACK_MONOLITHIC_INSTALL ON) SET (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") SET (CPACK_NSIS_MODIFY_PATH ON) - SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}") + SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${CPACK_PACKAGE_VERSION}") ELSEIF (APPLE) + LIST (APPEND CPACK_GENERATOR "DragNDrop") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) SET (CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}") SET (CPACK_PACKAGING_INSTALL_PREFIX "/") + SET (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") + 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") + #----------------------------------------------------------------------------- + # Configure the Info.plist file for the install bundle + #----------------------------------------------------------------------------- + CONFIGURE_FILE ( + ${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) SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) @@ -87,6 +87,12 @@ and/or accompanying materials: opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. + ----------------------------------------------------------------------------- +HDF5 is available with the SZIP compression library but SZIP is not part +of HDF5 and has separate copyright and license terms. See “Szip Compression +in HDF Products” (www.hdfgroup.org/doc_resource/SZIP/) for further details. + +----------------------------------------------------------------------------- @@ -1326,6 +1326,12 @@ # h5stat test files ./tools/h5stat/h5stat_gentest.c ./tools/h5stat/testh5stat.sh.in +./tools/h5stat/testfiles/h5stat_dims1.ddl +./tools/h5stat/testfiles/h5stat_dims2.ddl +./tools/h5stat/testfiles/h5stat_err1_dims.ddl +./tools/h5stat/testfiles/h5stat_err1_links.ddl +./tools/h5stat/testfiles/h5stat_err1_numattrs.ddl +./tools/h5stat/testfiles/h5stat_err2_numattrs.ddl ./tools/h5stat/testfiles/h5stat_filters.ddl ./tools/h5stat/testfiles/h5stat_filters-d.ddl ./tools/h5stat/testfiles/h5stat_filters-dT.ddl @@ -1337,11 +1343,22 @@ ./tools/h5stat/testfiles/h5stat_filters.h5 ./tools/h5stat/testfiles/h5stat_help1.ddl ./tools/h5stat/testfiles/h5stat_help2.ddl +./tools/h5stat/testfiles/h5stat_links1.ddl +./tools/h5stat/testfiles/h5stat_links2.ddl +./tools/h5stat/testfiles/h5stat_links3.ddl +./tools/h5stat/testfiles/h5stat_links4.ddl +./tools/h5stat/testfiles/h5stat_links5.ddl ./tools/h5stat/testfiles/h5stat_newgrat.ddl ./tools/h5stat/testfiles/h5stat_newgrat-UA.ddl ./tools/h5stat/testfiles/h5stat_newgrat-UG.ddl ./tools/h5stat/testfiles/h5stat_newgrat.h5 +./tools/h5stat/testfiles/h5stat_nofile.ddl ./tools/h5stat/testfiles/h5stat_notexist.ddl +./tools/h5stat/testfiles/h5stat_numattrs1.ddl +./tools/h5stat/testfiles/h5stat_numattrs2.ddl +./tools/h5stat/testfiles/h5stat_numattrs3.ddl +./tools/h5stat/testfiles/h5stat_numattrs4.ddl +./tools/h5stat/testfiles/h5stat_threshold.h5 ./tools/h5stat/testfiles/h5stat_tsohm.ddl ./tools/h5stat/testfiles/h5stat_tsohm.h5 @@ -2395,12 +2412,18 @@ ./config/cmake/CTestCustom.cmake ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.cmake +./config/cmake/CPack.Info.plist.in +./config/cmake/hdf.gif ./config/cmake/NSIS.template.in ./config/cmake/NSIS.InstallOptions.ini.in # CMake-specific User Files ./config/cmake/UserMacros/Windows_MT.cmake +# CMake-specific Examples Files +./config/cmake/HDF518_Examples.cmake.in +./release_docs/USING_CMake_Examples.txt + ./CMakeLists.txt ./CTestConfig.cmake ./UserMacros.cmake @@ -1,4 +1,4 @@ -HDF5 version 1.9.156 currently under development +HDF5 version 1.9.161 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index b3889a0..0651c29 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -568,8 +568,10 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // if H5Oget_comment_by_name returns SUCCEED, return the string comment, // otherwise, throw an exception - if( ret_value < 0 ) - throwException("getComment", "H5Oget_comment_by_name failed"); + if( ret_value < 0 ) { + delete []comment_C; + throwException("getComment", "H5Oget_comment_by_name failed"); + } H5std_string comment = H5std_string(comment_C); delete []comment_C; diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index cb01519..6e88509 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -467,7 +467,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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 9e60655..257e4be 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -230,7 +230,7 @@ void test_szip_filter(H5File& file1) issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); } - delete tconv_buf; + delete[] tconv_buf; } // if szip presents else { SKIPPED(); diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in new file mode 100644 index 0000000..a701a61 --- /dev/null +++ b/config/cmake/CPack.Info.plist.in @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + +<plist version="1.0"> +<dict> +<key>IFMajorVersion</key> +<integer>@CPACK_PACKAGE_VERSION_MAJOR@</integer> +<key>IFMinorVersion</key> +<integer>@CPACK_PACKAGE_VERSION_MINOR@</integer> +<key>IFPkgFlagAllowBackRev</key> +<false/> +<key>IFPkgFlagAuthorizationAction</key> +<string>AdminAuthorization</string> +<key>IFPkgFlagDefaultLocation</key> +<string>@CPACK_PACKAGE_DEFAULT_LOCATION@</string> +<key>IFPkgFlagInstallFat</key> +<false/> +<key>IFPkgFlagIsRequired</key> +<false/> +<key>IFPkgFlagOverwritePermissions</key> +<true/> +<key>IFPkgFlagRelocatable</key> +<@CPACK_PACKAGE_RELOCATABLE@/> +<key>IFPkgFlagRestartAction</key> +<string>NoRestart</string> +<key>IFPkgFlagRootVolumeOnly</key> +<false/> +<key>IFPkgFlagUpdateInstalledLanguages</key> +<false/> +<key>IFPkgFlagUseUserMask</key> +<false/> +<key>IFPkgFormatVersion</key> +<real>0.10000000149011612</real> +<key>CFBundleIdentifier</key> +<string>org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string> +</dict> +</plist> diff --git a/config/cmake/CPack.cmake b/config/cmake/CPack.cmake index d96fe43..bdfa5b8 100644 --- a/config/cmake/CPack.cmake +++ b/config/cmake/CPack.cmake @@ -442,6 +442,7 @@ if(NOT CPACK_GENERATOR) endif() else() option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) + option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) endif() @@ -457,6 +458,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) endif() @@ -487,7 +489,7 @@ endif() mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11 CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ - CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE + CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) @@ -526,6 +528,9 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") +# WiX specific variables +cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") + if(DEFINED CPACK_COMPONENTS_ALL) if(CPACK_MONOLITHIC_INSTALL) message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in new file mode 100644 index 0000000..699e2d0 --- /dev/null +++ b/config/cmake/HDF518_Examples.cmake.in @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) +############################################################################################################### +# This script will build and run the examples from a compressed file +# Execute from a command line: +# ctest -S HDF518_Examples.cmake,HDF5Examples-0.1.1-Source -C Release -O test.log +############################################################################################################### + +set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@/@HDF5_PACKAGE_VERSION@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(STATICLIBRARIES "@H5_ENABLE_STATIC_LIB@") +set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_BUILD_CONFIGURATION "Release") + +############################################################################################################### +# Adjust the following SET Commands as needed +############################################################################################################### +if(WIN32) + if(STATICLIBRARIES) + set(BUILD_OPTIONS "-DUSE_SHARED_LIBS:BOOL=OFF") + endif(STATICLIBRARIES) + set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake/hdf5") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else(WIN32) + if(STATICLIBRARIES) + set(BUILD_OPTIONS "-DUSE_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + endif(STATICLIBRARIES) + set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake/hdf5") + set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif(WIN32) + +############################################################################################################### +# For any comments please contact cdashhelp@hdfgroup.org +# +############################################################################################################### + +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if(APPLE) + # Compiler choice + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ENV{CC} "${XCODE_CC}") + set(ENV{CXX} "${XCODE_CXX}") + # Shared fortran is not supported, build static + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif(APPLE) + +#----------------------------------------------------------------------------- +set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +## Uncompress source in tar file provided +## -------------------------- +if(WIN32) + set(CTEST_7Z_COMMAND "C:/Program Files/7-Zip/7z.exe") + message("extracting... [${CTEST_7Z_COMMAND} x ${CTEST_SOURCE_NAME}.zip]") + execute_process(COMMAND ${CTEST_7Z_COMMAND} x ${CTEST_SOURCE_NAME}.zip RESULT_VARIABLE rv) +else(WIN32) + message("extracting... [${CTEST_CMAKE_COMMAND} -E tar -xvf ${CTEST_SOURCE_NAME}.tar.gz]") + execute_process(COMMAND tar -xvf ${CTEST_SOURCE_NAME}.tar.gz RESULT_VARIABLE rv) +endif(WIN32) + +if(NOT rv EQUAL 0) + message("extracting... [error-(${rv}) clean up]") + file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") +endif(NOT rv EQUAL 0) + +#----------------------------------------------------------------------------- +## Clear the build directory +## -------------------------- +set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +# Use multiple CPU cores to build +include(ProcessorCount) +ProcessorCount(N) +if(NOT N EQUAL 0) + if(NOT WIN32) + set(CTEST_BUILD_FLAGS -j${N}) + endif(NOT WIN32) + set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif() +set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" +) + +#----------------------------------------------------------------------------- +## -- set output to english +set($ENV{LC_MESSAGES} "en_EN") + +#----------------------------------------------------------------------------- + ## NORMAL process + ## -------------------------- + CTEST_START (Experimental) + CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") + CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") + CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + if(res GREATER 0) + message (FATAL_ERROR "tests FAILED") + endif(res GREATER 0) +#----------------------------------------------------------------------------- +############################################################################################################## +message("DONE")
\ No newline at end of file diff --git a/config/cmake/hdf.gif b/config/cmake/hdf.gif Binary files differnew file mode 100644 index 0000000..656617b --- /dev/null +++ b/config/cmake/hdf.gif diff --git a/config/lt_vers.am b/config/lt_vers.am index c3ec683..e9ee77d 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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and @@ -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.156. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.161. # # Report bugs to <help@hdfgroup.org>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.156' -PACKAGE_STRING='HDF5 1.9.156' +PACKAGE_VERSION='1.9.161' +PACKAGE_STRING='HDF5 1.9.161' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1486,7 +1486,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.156 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.161 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1556,7 +1556,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.156:";; + short | recursive ) echo "Configuration of HDF5 1.9.161:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.156 +HDF5 configure 1.9.161 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2846,7 +2846,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.156, which was +It was created by HDF5 $as_me 1.9.161, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3678,7 +3678,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.156' + VERSION='1.9.161' cat >>confdefs.h <<_ACEOF @@ -31632,7 +31632,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.156 +HDF5 config.lt 1.9.161 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33762,7 +33762,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.156, which was +This file was extended by HDF5 $as_me 1.9.161, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33828,7 +33828,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.156 +HDF5 config.status 1.9.161 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0a4d854..16f2e3e 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.156], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.161], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 8b6036b..31d9871 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -518,7 +518,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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 6639a92..d805db3 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -458,7 +458,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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/examples/ex_image2.c b/hl/examples/ex_image2.c index 77398c4..76c3a75 100644 --- a/hl/examples/ex_image2.c +++ b/hl/examples/ex_image2.c @@ -46,6 +46,10 @@ int main( void ) /* make the image */ status=H5IMmake_image_8bit( file_id, IMAGE1_NAME, width, height, gbuf ); + if (gbuf) { + free(gbuf); + gbuf = NULL; + } /*------------------------------------------------------------------------- * define a palette, blue to red tones @@ -75,6 +79,10 @@ int main( void ) /* make dataset */ status=H5IMmake_image_24bit( file_id, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf ); + if (gbuf) { + free(gbuf); + gbuf = NULL; + } /* close the file. */ H5Fclose( file_id ); diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index caed99d..353b844 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -474,7 +474,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 = 146 +LT_VERS_REVISION = 151 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 diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 88f8de4..b2c8949 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2175,8 +2175,10 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) input_len = HDstrlen(text); myinput = HDstrdup(text); - if((type_id = H5LTyyparse()) < 0) + if((type_id = H5LTyyparse()) < 0) { + HDfree(myinput); goto out; + } HDfree(myinput); input_len = 0; diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 5ec795b..f02bed6 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1400,54 +1400,58 @@ case 57: YY_RULE_SETUP #line 159 "H5LTanalyze.l" { +#ifdef H5_HAVE_WIN32_API + H5LTyylval.sval = _strdup(yytext); +#else /* H5_HAVE_WIN32_API */ H5LTyylval.sval = strdup(yytext); +#endif /* H5_HAVE_WIN32_API */ BEGIN INITIAL; return STRING; } YY_BREAK case 58: YY_RULE_SETUP -#line 165 "H5LTanalyze.l" +#line 169 "H5LTanalyze.l" {return token('{');} YY_BREAK case 59: YY_RULE_SETUP -#line 166 "H5LTanalyze.l" +#line 170 "H5LTanalyze.l" {return token('}');} YY_BREAK case 60: YY_RULE_SETUP -#line 167 "H5LTanalyze.l" +#line 171 "H5LTanalyze.l" {return token('[');} YY_BREAK case 61: YY_RULE_SETUP -#line 168 "H5LTanalyze.l" +#line 172 "H5LTanalyze.l" {return token(']');} YY_BREAK case 62: YY_RULE_SETUP -#line 169 "H5LTanalyze.l" +#line 173 "H5LTanalyze.l" {return token(':');} YY_BREAK case 63: YY_RULE_SETUP -#line 170 "H5LTanalyze.l" +#line 174 "H5LTanalyze.l" {return token(';');} YY_BREAK case 64: YY_RULE_SETUP -#line 171 "H5LTanalyze.l" +#line 175 "H5LTanalyze.l" ; YY_BREAK case 65: YY_RULE_SETUP -#line 172 "H5LTanalyze.l" +#line 176 "H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 174 "H5LTanalyze.l" +#line 178 "H5LTanalyze.l" ECHO; YY_BREAK #line 1432 "H5LTanalyze.c" @@ -2032,7 +2036,11 @@ FILE *file; #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#ifdef H5_HAVE_WIN32_API + b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0; +#else /* H5_HAVE_WIN32_API */ + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif /* H5_HAVE_WIN32_API */ #endif #endif } @@ -2327,7 +2335,7 @@ int main() return 0; } #endif -#line 174 "H5LTanalyze.l" +#line 178 "H5LTanalyze.l" int my_yyinput(char *buf, int max_size) { diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 3f63f50..581672b 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -157,7 +157,11 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} return token('"'); } <TAG_STRING>[^\"]+ { +#ifdef H5_HAVE_WIN32_API + H5LTyylval.sval = _strdup(yytext); +#else /* H5_HAVE_WIN32_API */ H5LTyylval.sval = strdup(yytext); +#endif /* H5_HAVE_WIN32_API */ BEGIN INITIAL; return STRING; } diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index a021efc..b91e97e 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -329,7 +329,11 @@ enum_list : ; enum_def : '"' enum_symbol '"' { is_enum_memb = 1; /*indicate member of enum*/ +#ifdef H5_HAVE_WIN32_API + enum_memb_symbol = _strdup(yylval.sval); +#else /* H5_HAVE_WIN32_API */ enum_memb_symbol = strdup(yylval.sval); +#endif /* H5_HAVE_WIN32_API */ } enum_val ';' { diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 3f82131..e189ecd 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -457,7 +457,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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 # This library is our main target. diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 0e3190c..87fa82c 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -245,52 +245,52 @@ do_pio(parameters param) /* Validate transfer buffer size & block size*/ if(blk_size<=0) { HDfprintf(stderr, - "Transfer block size (%Hd) must be > 0\n", (long long)blk_size); + "Transfer block size (%zu) must be > 0\n", blk_size); GOTOERROR(FAIL); } if(buf_size<=0) { HDfprintf(stderr, - "Transfer buffer size (%Hd) must be > 0\n", (long long)buf_size); + "Transfer buffer size (%zu) must be > 0\n", buf_size); GOTOERROR(FAIL); } if ((buf_size % blk_size) != 0){ HDfprintf(stderr, - "Transfer buffer size (%Hd) must be a multiple of the " - "interleaved I/O block size (%Hd)\n", - (long long)buf_size, (long long)blk_size); + "Transfer buffer size (%zu) must be a multiple of the " + "interleaved I/O block size (%zu)\n", + buf_size, blk_size); GOTOERROR(FAIL); } if((snbytes%pio_mpi_nprocs_g)!=0) { HDfprintf(stderr, - "Dataset size (%Hd) must be a multiple of the " - "number of processes (%d)\n", - (long long)snbytes, pio_mpi_nprocs_g); + "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "number of processes (%d)\n", + (long long)snbytes, pio_mpi_nprocs_g); GOTOERROR(FAIL); } if (!param.dim2d){ if(((snbytes/pio_mpi_nprocs_g)%buf_size)!=0) { HDfprintf(stderr, - "Dataset size/process (%Hd) must be a multiple of the " - "trasfer buffer size (%Hd)\n", - (long long)(snbytes/pio_mpi_nprocs_g), (long long)buf_size); + "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size (%zu)\n", + (long long)(snbytes/pio_mpi_nprocs_g), buf_size); GOTOERROR(FAIL); } } else { if((snbytes%buf_size)!=0) { HDfprintf(stderr, - "Dataset side size (%Hd) must be a multiple of the " - "trasfer buffer size (%Hd)\n", - (long long)snbytes, (long long)buf_size); + "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size (%zu)\n", + (long long)snbytes, buf_size); GOTOERROR(FAIL); } } /* Allocate transfer buffer */ if ((buffer = malloc(bsize)) == NULL){ - HDfprintf(stderr, "malloc for transfer buffer size (%Hd) failed\n", - (long long)(bsize)); + HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", + bsize); GOTOERROR(FAIL); } @@ -651,13 +651,13 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, HDprint_rank(output); if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%Hd, bytes_begin=%Hd, bytes_count=%Hd\n", - (long long)buf_size, (long long)bytes_begin[0], + "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%Hd, bytes_begin=(%Hd,%Hd), bytes_count=%Hd\n", - (long long)buf_size*blk_size, (long long)bytes_begin[0], + "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size*blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } } @@ -1625,13 +1625,13 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, HDprint_rank(output); if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%Hd, bytes_begin=%Hd, bytes_count=%Hd\n", - (long long)buf_size, (long long)bytes_begin[0], + "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%Hd, bytes_begin=(%Hd,%Hd), bytes_count=%Hd\n", - (long long)buf_size*blk_size, (long long)bytes_begin[0], + "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + buf_size*blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } } @@ -2336,10 +2336,10 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, if (++nerror < 20){ /* report at most 20 errors */ HDprint_rank(output); - HDfprintf(output, "read data error, expected (%Hd), " - "got (%Hd)\n", - (long long)pio_mpi_rank_g+1, - (long long)*(ucharptr-1)); + HDfprintf(output, "read data error, expected (%d), " + "got (%d)\n", + pio_mpi_rank_g+1, + (int)*(ucharptr-1)); } /* end if */ } /* end if */ } /* end for */ diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 337e982..a47754b 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -1116,14 +1116,14 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_KB && (val % ONE_KB) == 0) { if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) - HDfprintf(output, "%HdGB%s", val / ONE_GB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end); else - HDfprintf(output, "%HdMB%s", val / ONE_MB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end); } else { - HDfprintf(output, "%HdKB%s", val / ONE_KB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end); } } else { - HDfprintf(output, "%Hd%s", val, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end); } } @@ -1150,12 +1150,12 @@ report_parameters(struct options *opts) HDfprintf(output, "rank %d: IO API=", rank); print_io_api(opts->io_types); - HDfprintf(output, "rank %d: Number of files=%Hd\n", rank, - (long long)opts->num_files); - HDfprintf(output, "rank %d: Number of datasets=%Hd\n", rank, - (long long)opts->num_dsets); - HDfprintf(output, "rank %d: Number of iterations=%Hd\n", rank, - (long long)opts->num_iters); + HDfprintf(output, "rank %d: Number of files=%ld\n", rank, + opts->num_files); + HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, + opts->num_dsets); + HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, + opts->num_iters); HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, opts->min_num_procs, opts->max_num_procs); diff --git a/perform/sio_engine.c b/perform/sio_engine.c index 4d6afd8..0953507 100644 --- a/perform/sio_engine.c +++ b/perform/sio_engine.c @@ -196,15 +196,15 @@ do_sio(parameters param) /* Validate transfer buffer size */ if (param.buf_size[i]<=0) { HDfprintf(stderr, - "Transfer buffer size[%d] (%Hd) must be > 0\n", i,(long long)buf_size[i]); + "Transfer buffer size[%d] (%zu) must be > 0\n", i,buf_size[i]); GOTOERROR(FAIL); } if ((param.dset_size[i]%param.buf_size[i])!=0) { HDfprintf(stderr, - "Dataset size[%d] (%Hd) must be a multiple of the " - "trasfer buffer size[%d] (%Hd)\n",param.rank, - (long long)param.dset_size[i], param.rank, (long long)param.buf_size[i]); + "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "trasfer buffer size[%d] (%zu)\n",param.rank, + (long long)param.dset_size[i], param.rank, param.buf_size[i]); GOTOERROR(FAIL); } @@ -212,7 +212,7 @@ do_sio(parameters param) /* Allocate transfer buffer */ if ((buffer = malloc(linear_buf_size)) == NULL){ - HDfprintf(stderr, "malloc for transfer buffer size (%Hd) failed\n", (long long)(linear_buf_size)); + HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size); GOTOERROR(FAIL); } diff --git a/perform/sio_perf.c b/perform/sio_perf.c index 985f3c4..7df9337 100644 --- a/perform/sio_perf.c +++ b/perform/sio_perf.c @@ -832,14 +832,14 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_KB && (val % ONE_KB) == 0) { if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) - HDfprintf(output, "%HdGB%s", val / ONE_GB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end); else - HDfprintf(output, "%HdMB%s", val / ONE_MB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end); } else { - HDfprintf(output, "%HdKB%s", val / ONE_KB, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end); } } else { - HDfprintf(output, "%Hd%s", val, end); + HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end); } } @@ -865,8 +865,8 @@ report_parameters(struct options *opts) HDfprintf(output, "IO API="); print_io_api(opts->io_types); - HDfprintf(output, "Number of iterations=%Hd\n", - (long long)opts->num_iters); + HDfprintf(output, "Number of iterations=%d\n", + opts->num_iters); HDfprintf(output, "Dataset size="); diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h index 677a8ae..b407ecb 100644 --- a/perform/sio_standalone.h +++ b/perform/sio_standalone.h @@ -62,7 +62,15 @@ */ #define HDabort() abort() #define HDabs(X) abs(X) +#ifdef H5_HAVE_WIN32_API +#define HDaccess(F,M) _access(F, M) +#define R_OK 4 /* Test for read permission. */ +#define W_OK 2 /* Test for write permission. */ +#define X_OK 1 /* Test for execute permission. */ +#define F_OK 0 /* Test for existence. */ +#else /* H5_HAVE_WIN32_API */ #define HDaccess(F,M) access(F, M) +#endif /* H5_HAVE_WIN32_API */ #define HDacos(X) acos(X) #ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) @@ -214,7 +222,12 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgetpwuid(U) getpwuid(U) #define HDgetrusage(X,S) getrusage(X,S) #define HDgets(S) gets(S) +#ifdef H5_HAVE_VISUAL_STUDIO + H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); +#define HDgettimeofday(V,Z) Wgettimeofday(V,Z) +#else /* H5_HAVE_VISUAL_STUDIO */ #define HDgettimeofday(S,P) gettimeofday(S,P) +#endif /* H5_HAVE_VISUAL_STUDIO */ #define HDgetuid() getuid() #define HDgmtime(T) gmtime(T) #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ @@ -355,7 +368,8 @@ int HDremove_all(const char * fname); #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) #ifdef H5_HAVE_WIN32_API -#define HDsnprintf _snprintf /*varargs*/ +H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); +#define HDsnprintf c99_snprintf /*varargs*/ #else #define HDsnprintf snprintf /*varargs*/ #endif @@ -373,7 +387,11 @@ H5_DLL void HDsrand(unsigned int seed); #endif /* sscanf() variable arguments */ +#ifdef H5_HAVE_WIN32_API +#define HDstrcasecmp(A,B) _stricmp(A,B) +#else #define HDstrcasecmp(X,Y) strcasecmp(X,Y) +#endif #define HDstrcat(X,Y) strcat(X,Y) #define HDstrchr(S,C) strchr(S,C) #define HDstrcmp(X,Y) strcmp(X,Y) @@ -433,7 +451,8 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDvprintf(FMT,A) vprintf(FMT,A) #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) #ifdef H5_HAVE_WIN32_API -# define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) +H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); +#define HDvsnprintf c99_vsnprintf #else # define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A) #endif diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 585dc13..f76e10b 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -157,11 +157,11 @@ error(const char *fmt, ...) va_list ap; va_start(ap, fmt); - fprintf(stderr, "%s: error: ", prog); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); + HDfprintf(stderr, "%s: error: ", prog); + HDvfprintf(stderr, fmt, ap); + HDfprintf(stderr, "\n"); va_end(ap); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* @@ -174,9 +174,9 @@ error(const char *fmt, ...) static void cleanup(void) { - if (!getenv("HDF5_NOCLEANUP")) - unlink(filename); - free(filename); + if (!HDgetenv("HDF5_NOCLEANUP")) + HDunlink(filename); + HDfree(filename); } static void @@ -189,7 +189,7 @@ write_file(Bytef *source, uLongf sourceLen) /* destination buffer needs to be at least 0.1% larger than sourceLen * plus 12 bytes */ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12; - dest = (Bytef *)malloc(destLen); + dest = (Bytef *)HDmalloc(destLen); if (!dest) error("out of memory"); @@ -204,7 +204,7 @@ write_file(Bytef *source, uLongf sourceLen) ((double)timer_start.tv_usec) / MICROSECOND); if (report_once_flag) { - printf("\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen); + HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen); report_once_flag = 0; } @@ -213,10 +213,10 @@ write_file(Bytef *source, uLongf sourceLen) /* loop to make sure we write everything out that we want to write */ for (;;) { - int rc = (int)write(output, d_ptr, (size_t)d_len); + int rc = (int)HDwrite(output, d_ptr, (size_t)d_len); if (rc == -1) - error(strerror(errno)); + error(HDstrerror(errno)); if (rc == (int)d_len) break; @@ -225,7 +225,7 @@ write_file(Bytef *source, uLongf sourceLen) d_ptr += rc; } - free(dest); + HDfree(dest); } /* @@ -299,7 +299,7 @@ static void get_unique_name(void) { const char *prefix = NULL; - const char *env = getenv("HDF5_PREFIX"); + const char *env = HDgetenv("HDF5_PREFIX"); if (env) prefix = env; @@ -309,19 +309,19 @@ get_unique_name(void) if (prefix) /* 2 = 1 for '/' + 1 for null terminator */ - filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2); + filename = (char *) HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2); else - filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1); + filename = (char *) HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1); if (!filename) error("out of memory"); filename[0] = 0; if (prefix){ - strcpy(filename, prefix); - strcat(filename, "/"); + HDstrcpy(filename, prefix); + HDstrcat(filename, "/"); } - strcat(filename, ZIP_PERF_FILE); + HDstrcat(filename, ZIP_PERF_FILE); } /* @@ -334,30 +334,30 @@ get_unique_name(void) static void usage(void) { - printf("usage: %s [OPTIONS]\n", prog); - printf(" OPTIONS\n"); - printf(" -h, --help Print this usage message and exit\n"); - printf(" -1...-9 Level of compression, from 1 to 9\n"); - printf(" -c P, --compressability=P Percentage of compressability of the random\n"); - printf(" data you want [default: 0]"); - printf(" -s S, --file-size=S Maximum size of uncompressed file [default: 64M]\n"); - printf(" -B S, --max-buffer_size=S Maximum size of buffer [default: 1M]\n"); - printf(" -b S, --min-buffer_size=S Minumum size of buffer [default: 128K]\n"); - printf(" -p D, --prefix=D The directory prefix to place the file\n"); - printf(" -r, --random-test Use random data to write to the file\n"); - printf(" [default: no]\n"); - printf("\n"); - printf(" D - a directory which exists\n"); - printf(" P - a number between 0 and 100\n"); - printf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); - printf("\n"); - printf(" K - Kilobyte (%d)\n", ONE_KB); - printf(" M - Megabyte (%d)\n", ONE_MB); - printf(" G - Gigabyte (%d)\n", ONE_GB); - printf("\n"); - printf(" Example: 37M = 37 Megabytes = %d bytes\n", 37 * ONE_MB); - printf("\n"); - fflush(stdout); + HDfprintf(stdout, "usage: %s [OPTIONS]\n", prog); + HDfprintf(stdout, " OPTIONS\n"); + HDfprintf(stdout, " -h, --help Print this usage message and exit\n"); + HDfprintf(stdout, " -1...-9 Level of compression, from 1 to 9\n"); + HDfprintf(stdout, " -c P, --compressability=P Percentage of compressability of the random\n"); + HDfprintf(stdout, " data you want [default: 0]"); + HDfprintf(stdout, " -s S, --file-size=S Maximum size of uncompressed file [default: 64M]\n"); + HDfprintf(stdout, " -B S, --max-buffer_size=S Maximum size of buffer [default: 1M]\n"); + HDfprintf(stdout, " -b S, --min-buffer_size=S Minumum size of buffer [default: 128K]\n"); + HDfprintf(stdout, " -p D, --prefix=D The directory prefix to place the file\n"); + HDfprintf(stdout, " -r, --random-test Use random data to write to the file\n"); + HDfprintf(stdout, " [default: no]\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, " D - a directory which exists\n"); + HDfprintf(stdout, " P - a number between 0 and 100\n"); + HDfprintf(stdout, " S - is a size specifier, an integer >=0 followed by a size indicator:\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, " K - Kilobyte (%d)\n", ONE_KB); + HDfprintf(stdout, " M - Megabyte (%d)\n", ONE_MB); + HDfprintf(stdout, " G - Gigabyte (%d)\n", ONE_GB); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, " Example: 37M = 37 Megabytes = %d bytes\n", 37 * ONE_MB); + HDfprintf(stdout, "\n"); + HDfflush(stdout); } /* @@ -380,7 +380,7 @@ parse_size_directive(const char *size) unsigned long s; char *endptr; - s = strtoul(size, &endptr, 10); + s = HDstrtoul(size, &endptr, 10); if (endptr && *endptr) { while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t')) @@ -419,16 +419,16 @@ fill_with_random_data(Bytef *src, uLongf src_len) Bytef *buf = src; int fd = HDopen("/dev/urandom", O_RDONLY, 0); - printf("Using /dev/urandom for random data\n"); + HDfprintf(stdout, "Using /dev/urandom for random data\n"); if (fd < 0) - error(strerror(errno)); + error(HDstrerror(errno)); for (;;) { - ssize_t rc = read(fd, buf, src_len); + ssize_t rc = HDread(fd, buf, src_len); if (rc == -1) - error(strerror(errno)); + error(HDstrerror(errno)); if (rc == (ssize_t)len) break; @@ -437,7 +437,7 @@ fill_with_random_data(Bytef *src, uLongf src_len) len -= rc; } } else { - printf("Using random() for random data\n"); + HDfprintf(stdout, "Using random() for random data\n"); for (u = 0; u < src_len; ++u) src[u] = (Bytef)(0xff & HDrandom()); @@ -446,7 +446,7 @@ fill_with_random_data(Bytef *src, uLongf src_len) if (compress_percent) { unsigned long s = src_len * compress_percent / 100; - memset(src, '\0', s); + HDmemset(src, '\0', s); } } @@ -463,7 +463,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, register unsigned long i, iters; iters = file_size / src_len; - src = (Bytef *)calloc(1, sizeof(Bytef) * src_len); + src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len); if (!src) { cleanup(); @@ -475,26 +475,26 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, if (random_test) fill_with_random_data(src, src_len); - printf("Buffer size == "); + HDfprintf(stdout, "Buffer size == "); if (src_len >= ONE_KB && (src_len % ONE_KB) == 0) { if (src_len >= ONE_MB && (src_len % ONE_MB) == 0) { - printf("%ldMB", src_len / ONE_MB); + HDfprintf(stdout, "%ldMB", src_len / ONE_MB); } else { - printf("%ldKB", src_len / ONE_KB); + HDfprintf(stdout, "%ldKB", src_len / ONE_KB); } } else { - printf("%ld", src_len); + HDfprintf(stdout, "%ld", src_len); } - printf("\n"); + HDfprintf(stdout, "\n"); /* do uncompressed data write */ HDgettimeofday(&timer_start, NULL); output = HDopen(filename, O_RDWR | O_CREAT, S_IRWXU); if (output == -1) - error(strerror(errno)); + error(HDstrerror(errno)); for (i = 0; i <= iters; ++i) { Bytef *s_ptr = src; @@ -502,10 +502,10 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, /* loop to make sure we write everything out that we want to write */ for (;;) { - ssize_t rc = write(output, s_ptr, s_len); + ssize_t rc = HDwrite(output, s_ptr, s_len); if (rc == -1) - error(strerror(errno)); + error(HDstrerror(errno)); if (rc == (ssize_t)s_len) break; @@ -515,7 +515,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, } } - close(output); + HDclose(output); HDgettimeofday(&timer_stop, NULL); total_time = ((double)timer_stop.tv_sec + @@ -523,17 +523,17 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND); - printf("\tUncompressed Write Time: %.2fs\n", total_time); - printf("\tUncompressed Write Throughput: %.2fMB/s\n", + HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time); + HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time)); - unlink(filename); + HDunlink(filename); /* do compressed data write */ output = HDopen(filename, O_RDWR | O_CREAT, S_IRWXU); if (output == -1) - error(strerror(errno)); + error(HDstrerror(errno)); report_once_flag = 1; HDgettimeofday(&timer_start, NULL); @@ -541,7 +541,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, for (total_len = 0; total_len < file_size; total_len += src_len) write_file(src, src_len); - close(output); + HDclose(output); HDgettimeofday(&timer_stop, NULL); total_time = ((double)timer_stop.tv_sec + @@ -549,13 +549,13 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND); - printf("\tCompressed Write Time: %.2fs\n", total_time); - printf("\tCompressed Write Throughput: %.2fMB/s\n", + HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time); + HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time)); - printf("\tCompression Time: %gs\n", compression_time); + HDfprintf(stdout, "\tCompression Time: %gs\n", compression_time); - unlink(filename); - free(src); + HDunlink(filename); + HDfree(src); } } @@ -593,7 +593,7 @@ main(int argc, char **argv) min_buf_size = parse_size_directive(opt_arg); break; case 'c': - compress_percent = (int)strtol(opt_arg, NULL, 10); + compress_percent = (int)HDstrtol(opt_arg, NULL, 10); if (compress_percent < 0) compress_percent = 0; @@ -626,12 +626,12 @@ main(int argc, char **argv) error("minmum buffer size (%d) exceeds maximum buffer size (%d)", min_buf_size, max_buf_size); - printf("Filesize: %ld\n", file_size); + HDfprintf(stdout, "Filesize: %ld\n", file_size); if (compress_level == Z_DEFAULT_COMPRESSION) - printf("Compression Level: 6\n"); + HDfprintf(stdout, "Compression Level: 6\n"); else - printf("Compression Level: %d\n", compress_level); + HDfprintf(stdout, "Compression Level: %d\n", compress_level); get_unique_name(); do_write_test(file_size, min_buf_size, max_buf_size); @@ -652,7 +652,7 @@ main(int argc, char **argv) int main(void) { - printf("No compression IO performance because zlib was not configured\n"); + HDfprintf(stdout, "No compression IO performance because zlib was not configured\n"); return EXIT_SUCCESS; } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ed3ec6b..dcdc2f9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.156 currently under development +HDF5 version 1.9.161 currently under development ================================================================================ @@ -418,6 +418,8 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Added const qualifier to source buffer parameters in H5Dgather and + H5D_scatter_func_t (H5Dscatter callback). (NAF - 2013/7/02) - Fixed an error involving failure to write fill values to the user's buffer when reading unallocated chunks from datasets that have a fill value set to H5D_FILL_VALUE_DEFAULT. A consequence of this @@ -1063,44 +1065,47 @@ Bug Fixes since HDF5-1.8.0 release C++ APIs -------- - - The constructor PropList::PropList(id) was fixed to act properly - according to the nature of 'id'. When 'id' is a property class id, - a new property list will be created. When 'id' id a property list id, - a copy of the property list will be made. (BMR - 2010/5/9) - - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and - CommonFG::getComment, respectively, now have default values for - user's convenience. (BMR - 2009/10/23) - - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) - - read/write methods of DataSet and Attribute classes were fixed - to handle string correctly. (BMR - 2009/07/26) - - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) - - Fixed bug in PropList::getClassName to use portable HDfree instead - of free. (BMR - 2008/04/20) - - Fixed a design bug which allowed an Attribute object to create/modify - attributes (bugzilla #1068). The API class hierarchy was revised - to address the problem. Classes AbstractDS and Attribute are moved - out of H5Object. Class Attribute now multiply inherits from - IdComponent and AbstractDs and class DataSet from H5Object and - AbstractDs. In addition, the data member IdComponent::id was - moved into subclasses: Attribute, DataSet, DataSpace, DataType, - H5File, Group, and PropList. (BMR - 2008/08/10) - - IdComponent::dereference was incorrect and replaced as described - in "New Features" section. - (BMR - 2008/08/10) + - The constructor PropList::PropList(id) was fixed to act properly + according to the nature of 'id'. When 'id' is a property class id, + a new property list will be created. When 'id' id a property list id, + a copy of the property list will be made. (BMR - 2010/5/9) + - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and + CommonFG::getComment, respectively, now have default values for + user's convenience. (BMR - 2009/10/23) + - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) + - read/write methods of DataSet and Attribute classes were fixed + to handle string correctly. (BMR - 2009/07/26) + - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) + - Fixed bug in PropList::getClassName to use portable HDfree instead + of free. (BMR - 2008/04/20) + - Fixed a design bug which allowed an Attribute object to create/modify + attributes (bugzilla #1068). The API class hierarchy was revised + to address the problem. Classes AbstractDS and Attribute are moved + out of H5Object. Class Attribute now multiply inherits from + IdComponent and AbstractDs and class DataSet from H5Object and + AbstractDs. In addition, the data member IdComponent::id was + moved into subclasses: Attribute, DataSet, DataSpace, DataType, + H5File, Group, and PropList. (BMR - 2008/08/10) + - IdComponent::dereference was incorrect and replaced as described + in "New Features" section. + (BMR - 2008/08/10) Testing ------- - - In some Mac system, testlibinfo.sh failed with this error: - Check file ../src/.libs/libhdf5.7.dylib - strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ - (unknown load command 15) - The strings command of Mac inspects library files and older - versions of strings may not know newer library format, resulting - in errors. Fixed by sending the library file as stdin to the strings - coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) - - - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation - faulted when used before. (AKC - 2013/02/12 HDFFV-8267) + - tools/h5diff/testh5diff.sh is run in every "make check", even after it + has passed in the previous run. It should not run again if there is no + code changes. Fixed. (AKC - 2013/07/19 HDFFV-8392) + - In some Mac system, testlibinfo.sh failed with this error: + Check file ../src/.libs/libhdf5.7.dylib + strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ + (unknown load command 15) + The strings command of Mac inspects library files and older + versions of strings may not know newer library format, resulting + in errors. Fixed by sending the library file as stdin to the strings + coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) + + - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation + faulted when used before. (AKC - 2013/02/12 HDFFV-8267) Supported Platforms @@ -1154,19 +1159,20 @@ Supported Platforms (emu) Sun Fortran 95 8.6 SunOS_sparc Sun C++ 5.12 SunOS_sparc - Windows XP Visual Studio 2008 w/ Intel Fortran 10.1 (project files) - - Windows XP x64 Visual Studio 2008 w/ Intel Fortran 10.1 (project files) - - Windows 7 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) + 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) (cmake and autotools) - Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) + 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) (cmake and autotools) + Windows 8 Visual Studio 2012 w/ Intel Fortran 13 (cmake) + + Windows 8 x64 Visual Studio 2012 w/ Intel Fortran 13 (cmake) Mac OS X Snow Leopard 10.6.8 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 3.2.6 Darwin Kernel Version 10.8.0 g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 3.2.6 @@ -1202,8 +1208,12 @@ Platform C F90/ F90 C++ zlib SZIP parallel F2003 parallel 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/n n y y y -Windows 7 x64 y 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 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 +Windows 8 x64 y y/y n y y y Mac OS X Snow Leopard 10.6.8 64-bit n y/y n y y y Mac OS X Lion 10.7.3 32-bit n y/y n y y n Mac OS X Lion 10.7.3 64-bit n y/y n y y y @@ -1224,6 +1234,10 @@ Solaris2.11 32-bit y y y y Solaris2.11 64-bit y y y y Windows 7 y y y y Windows 7 x64 y y y y +Windows 7 Cygwin n n n y +Windows 7 x64 Cygwin n n n y +Windows 8 y y y y +Windows 8 x64 y y y y Mac OS X Snow Leopard 10.6.8 64-bit y n y n Mac OS X Lion 10.7.3 32-bit y n y y Mac OS X Lion 10.7.3 64-bit y n y y @@ -1255,46 +1269,45 @@ The following platforms are not supported but have been tested for this release. g++ 4.6.1 20110422 gfortran 4.6.1 20110422 - Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux - gcc (Debian 4.4.5-8) 4.4.5 - GNU Fortran (Debian 4.4.5-8) 4.4.5 + Debian7.1.0 3.2.0-4-686 #1 SMP Debian 3.2.46-1 i686 GNU/Linux + gcc (Debian 4.7.2-5) 4.7.2 + GNU Fortran (Debian 4.7.2-5) 4.7.2 (cmake and autotools) - Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux - gcc (Debian 4.4.5-8) 4.4.5 - GNU Fortran (Debian 4.4.5-8) 4.4.5 + Debian7.1.0 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux + gcc (Debian 4.7.2-5) 4.7.2 + GNU Fortran (Debian 4.7.2-5) 4.7.2 (cmake and autotools) - Fedora17 3.5.2-1.fc17.i6866 #1 SMP i686 i686 i386 GNU/Linux - gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) - GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + Fedora19 3.9.9-301.fc19.i6866 #1 SMP i686 i686 i386 GNU/Linux + gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) + GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - Fedora17 3.5.2-1.fc17.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux - gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) - GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + Fedora19 3.9.9-301.fc19.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) + GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + 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 (cmake and autotools) - SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + 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 (cmake and autotools) - Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP i686 GNU/Linux - gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 - GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux + gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 + GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu1) 4.7.3 (cmake and autotools) - Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP x86_64 GNU/Linux - gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 - GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP x86_64 GNU/Linux + gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 + GNU Fortran (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 (cmake and autotools) - (Use optimization level -O1) Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt new file mode 100644 index 0000000..33c43a3 --- /dev/null +++ b/release_docs/USING_CMake_Examples.txt @@ -0,0 +1,12 @@ +The compressed examples file, located in the HDF5 install folder, +can be built and tested with CMake and the supplied +HDF518_Examples.cmake file. It is recommended that you copy those +two files to your development location before continuing. + +The command line to be used is shown at the top of the file. Also, +the location of the HDF5 installation should be verified and +changed if necessary. + +When executed, the ctest script will save the results to the log file +indicated by the ctest command. If you wish the to see more build +and test information, add "-VV" to the ctest command. diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index bbfc501..b817f7e 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -7,7 +7,7 @@ These suggestions are for Visual Studio users. Instructions for building and testing HDF5 applications using CMake can -be found in the USING_CMake.txt file found in this folder. +be found in the USING_HDF5_CMake.txt file found in this folder. The following two sections are helpful if you do not use CMake to build your applications. diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 484b176..4309d64 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -108,7 +108,7 @@ typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); /* Define the operator function pointer for H5Dscatter() */ -typedef herr_t (*H5D_scatter_func_t)(void **src_buf/*out*/, +typedef herr_t (*H5D_scatter_func_t)(const void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, void *op_data); @@ -142,7 +142,7 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf); -H5_DLL herr_t H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, +H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); H5_DLL herr_t H5Ddebug(hid_t dset_id); diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 60a8800..4b0846f 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -925,7 +925,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, H5S_t *dst_space; /* Dataspace */ H5S_sel_iter_t iter; /* Selection iteration info*/ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ - void *src_buf = NULL; /* Source (contiguous) data buffer */ + const void *src_buf = NULL; /* Source (contiguous) data buffer */ size_t src_buf_nbytes = 0; /* Size of src_buf */ size_t type_size; /* Datatype element size */ hssize_t nelmts; /* Number of remaining elements in selection */ @@ -1018,8 +1018,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, size_t dst_buf_size, - void *dst_buf, H5D_gather_func_t op, void *op_data) +H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, + size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data) { H5T_t *type; /* Datatype */ H5S_t *src_space; /* Dataspace */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 8f4f7f0..64919ed 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -414,7 +414,11 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, } /* Get the file descriptor (needed for truncate and some Windows information) */ +#ifdef H5_HAVE_WIN32_API + file->fd = _fileno(file->fp); +#else /* H5_HAVE_WIN32_API */ file->fd = fileno(file->fp); +#endif /* H5_HAVE_WIN32_API */ if(file->fd < 0) { free(file); fclose(f); diff --git a/src/H5Opline.c b/src/H5Opline.c index 1a2baa0..0a0f12a 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -183,7 +183,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, else filter->name = filter->_name; - HDstrcpy(filter->name, (const char *)p); + HDstrncpy(filter->name, (const char *)p, actual_name_length); p += name_length; } /* end if */ @@ -375,12 +375,9 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) /* Allocate space for the filter name, or use the internal buffer */ if(namelen > H5Z_COMMON_NAME_LEN) { - dst->filter[i].name = (char *)H5MM_malloc(namelen); + dst->filter[i].name = (char *)H5MM_strdup(src->filter[i].name); if(NULL == dst->filter[i].name) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name") - - /* Copy name */ - HDstrcpy(dst->filter[i].name, src->filter[i].name); } /* end if */ else dst->filter[i].name = dst->filter[i]._name; @@ -464,7 +461,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg) } /* end else */ ret_value += 2 + /*filter identification number */ - ((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ + (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ 2 + /*flags */ 2 + /*number of client data values */ (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ @@ -633,7 +630,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s for(i = 0; i < pline->nused; i++) { char name[32]; - sprintf(name, "Filter at position %u", (unsigned)i); + HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Filter identification:", @@ -656,7 +653,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s for(j = 0; j < pline->filter[i].cd_nelmts; j++) { char field_name[32]; - sprintf(field_name, "CD value %lu", (unsigned long)j); + HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, pline->filter[i].cd_values[j]); diff --git a/src/H5public.h b/src/H5public.h index ad13851..9e05cc9 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 156 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 161 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.156" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.161" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index a93a128..4280066 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -114,6 +114,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) char modifier[8]; int conv; char *rest, format_templ[128]; + int len; const char *s; va_list ap; @@ -138,7 +139,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) s = fmt + 1; /* Flags */ - while(HDstrchr ("-+ #", *s)) { + while(HDstrchr("-+ #", *s)) { switch(*s) { case '-': leftjust = 1; @@ -155,6 +156,9 @@ HDfprintf(FILE *stream, const char *fmt, ...) case '#': prefix = 1; break; + + default: + HDassert(0 && "Unknown format flag"); } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ s++; } /* end while */ @@ -189,7 +193,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) } /* Extra type modifiers */ - if(HDstrchr("ZHhlqLI", *s)) { + if(HDstrchr("zZHhlqLI", *s)) { switch(*s) { /*lint --e{506} Don't issue warnings about constant value booleans */ /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ @@ -203,6 +207,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) break; case 'Z': + case 'z': if(sizeof(size_t) < sizeof(long)) modifier[0] = '\0'; else if(sizeof(size_t) == sizeof(long)) @@ -242,16 +247,17 @@ HDfprintf(FILE *stream, const char *fmt, ...) conv = *s++; /* Create the format template */ - sprintf(format_templ, "%%%s%s%s%s%s", (leftjust ? "-" : ""), + len = 0; + len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : "")); if(fwidth > 0) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); if(prec > 0) - sprintf(format_templ+HDstrlen(format_templ), ".%d", prec); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec); if(*modifier) - sprintf(format_templ+HDstrlen(format_templ), "%s", modifier); - sprintf (format_templ+HDstrlen(format_templ), "%c", conv); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier); + HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv); /* Conversion */ @@ -323,31 +329,42 @@ HDfprintf(FILE *stream, const char *fmt, ...) haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ if(H5F_addr_defined(x)) { - sprintf(format_templ, "%%%s%s%s%s%s", + len = 0; + len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : "")); if(fwidth > 0) - sprintf(format_templ + HDstrlen(format_templ), "%d", fwidth); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); /*lint --e{506} Don't issue warnings about constant value booleans */ /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - if(sizeof(x) == H5_SIZEOF_INT) - HDstrcat(format_templ, "u"); - else if(sizeof(x) == H5_SIZEOF_LONG) - HDstrcat(format_templ, "lu"); + if(sizeof(x) == H5_SIZEOF_INT) { + HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ + else if(sizeof(x) == H5_SIZEOF_LONG) { + HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ else if(sizeof(x) == H5_SIZEOF_LONG_LONG) { - HDstrcat(format_templ, H5_PRINTF_LL_WIDTH); - HDstrcat(format_templ, "u"); + HDstrncat(format_templ, H5_PRINTF_LL_WIDTH, (sizeof(format_templ) - (size_t)(len + 1))); + len += (int)sizeof(H5_PRINTF_LL_WIDTH); + HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); + len++; } n = fprintf(stream, format_templ, x); } else { - HDstrcpy(format_templ, "%"); - if(leftjust) - HDstrcat(format_templ, "-"); + len = 0; + HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + if(leftjust) { + HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ if(fwidth) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); - HDstrcat(format_templ, "s"); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); + HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1))); fprintf(stream, format_templ, "UNDEF"); } } @@ -456,8 +473,9 @@ HDstrtoll(const char *s, const char **rest, int base) errno = 0; if (!s || (base && (base<2 || base>36))) { - if (rest) *rest = s; - return 0; + if (rest) + *rest = s; + return 0; } /* Skip white space */ @@ -465,21 +483,21 @@ HDstrtoll(const char *s, const char **rest, int base) /* Optional minus or plus sign */ if ('+'==*s) { - s++; + s++; } else if ('-'==*s) { - sign = -1; - s++; + sign = -1; + s++; } /* Zero base prefix */ if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) { - base = 16; - s += 2; + base = 16; + s += 2; } else if (0==base && '0'==*s) { - base = 8; - s++; + base = 8; + s++; } else if (0==base) { - base = 10; + base = 10; } /* Digits */ @@ -487,34 +505,39 @@ HDstrtoll(const char *s, const char **rest, int base) (base>10 && ((*s>='0' && *s<='9') || (*s>='a' && *s<'a'+base-10) || (*s>='A' && *s<'A'+base-10)))) { - if (!overflow) { - int64_t digit = 0; - if (*s>='0' && *s<='9') digit = *s - '0'; - else if (*s>='a' && *s<='z') digit = (*s-'a')+10; - else digit = (*s-'A')+10; - - if (acc*base+digit < acc) { - overflow = TRUE; - } else { - acc = acc*base + digit; - } - } - s++; + if (!overflow) { + int64_t digit = 0; + + if (*s>='0' && *s<='9') + digit = *s - '0'; + else if (*s>='a' && *s<='z') + digit = (*s-'a')+10; + else + digit = (*s-'A')+10; + + if (acc*base+digit < acc) { + overflow = TRUE; + } else { + acc = acc*base + digit; + } + } + s++; } /* Overflow */ if (overflow) { - if (sign>0) { - acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; - } else { - acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); - } - errno = ERANGE; + if (sign>0) { + acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; + } else { + acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); + } + errno = ERANGE; } /* Return values */ acc *= sign; - if (rest) *rest = s; + if (rest) + *rest = s; return acc; } /* end HDstrtoll() */ @@ -575,12 +598,13 @@ int HDremove_all(const char *fname) { int ret_value = -1; + size_t fname_len; char *_fname; - _fname = (char *)H5MM_malloc(HDstrlen(fname) + 3); /* to accomodate ;* and null */ + fname_len = HDstrlen(fname) + 3; /* to accomodate ";*" and null terminator */ + _fname = (char *)H5MM_malloc(fname_len); if(_fname) { - HDstrcpy(_fname, fname); - HDstrcat(_fname,";*"); + HDsnprintf(_fname, fname_len, "%s;*", fname); /* Do not use HDremove; function becomes recursive (see H5private.h file)*/ remove(_fname); H5MM_xfree(_fname); @@ -666,6 +690,30 @@ Wgetlogin() return NULL; } +int c99_snprintf(char* str, size_t size, const char* format, ...) +{ + int count; + va_list ap; + + va_start(ap, format); + count = c99_vsnprintf(str, size, format, ap); + va_end(ap); + + return count; +} + +int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) +{ + int count = -1; + + if (size != 0) + count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); + if (count == -1) + count = _vscprintf(format, ap); + + return count; +} + #endif @@ -698,6 +746,10 @@ H5_build_extpath(const char *name, char **extpath/*out*/) FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ + HDassert(name); + HDassert(extpath); + /* Clear external path pointer to begin with */ *extpath = NULL; @@ -713,11 +765,13 @@ H5_build_extpath(const char *name, char **extpath/*out*/) } /* end if */ else { /* relative pathname */ char *retcwd; + size_t name_len; int drive; if(NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (new_name = (char *)H5MM_strdup(name))) + name_len = HDstrlen(name) + 1; + if(NULL == (new_name = (char *)H5MM_malloc(name_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") /* @@ -729,7 +783,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if(H5_CHECK_ABS_DRIVE(name)) { drive = name[0] - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); - HDstrcpy(new_name, &name[2]); + HDstrncpy(new_name, &name[2], name_len); } /* end if */ /* * Windows: name[0] is a '/' or '\' @@ -738,20 +792,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/) * OpenVMS: does not apply */ else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { - sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]); + HDsnprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]); retcwd = cwdpath; - HDstrcpy(new_name, &name[1]); + HDstrncpy(new_name, &name[1], name_len); } /* totally relative for Unix, Windows, and OpenVMS: get current working directory */ - else + else { retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN); + HDstrncpy(new_name, name, name_len); + } /* end if */ if(retcwd != NULL) { size_t cwdlen; size_t path_len; + HDassert(cwdpath); cwdlen = HDstrlen(cwdpath); HDassert(cwdlen); + HDassert(new_name); path_len = cwdlen + HDstrlen(new_name) + 2; if(NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -768,7 +826,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) char *tmp = new_name; full_path[cwdlen - 1] = '\0'; - HDstrcat(full_path, ++tmp); + HDstrncat(full_path, ++tmp, HDstrlen(tmp)); } /* end if */ else HDstrncat(full_path, new_name, HDstrlen(new_name)); @@ -793,9 +851,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/) done: /* Release resources */ if(cwdpath) - H5MM_xfree(cwdpath); + H5MM_xfree(cwdpath); if(new_name) - H5MM_xfree(new_name); + H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* H5_build_extpath() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index e9b87625..d452925 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -29,6 +29,7 @@ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; #define HDaccess(F,M) _access(F,M) +#define HDchdir(S) _chdir(S) #define HDclose(F) _close(F) #define HDdup(F) _dup(F) #define HDfdopen(N,S) _fdopen(N,S) @@ -47,16 +48,15 @@ typedef __int64 h5_stat_size_t; */ #define HDopen(S,F,M) _open(S,F|_O_BINARY,M) #define HDread(F,M,Z) _read(F,M,Z) +#define HDrmdir(S) _rmdir(S) #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) #define HDsleep(S) Sleep(S*1000) #define HDstat(S,B) _stati64(S,B) #define HDstrcasecmp(A,B) _stricmp(A,B) #define HDstrtoull(S,R,N) _strtoui64(S,R,N) #define HDstrdup(S) _strdup(S) -#define HDsnprintf _snprintf /*varargs*/ #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) -#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) #define HDwrite(F,M,Z) _write(F,M,Z) #ifdef H5_HAVE_VISUAL_STUDIO @@ -75,11 +75,15 @@ struct timezone { #endif /* __cplusplus */ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); H5_DLL char* Wgetlogin(); + H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); + H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); #ifdef __cplusplus } #endif /* __cplusplus */ #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) -#define HDgetlogin() Wgetlogin() +#define HDgetlogin() Wgetlogin() +#define HDsnprintf c99_snprintf /*varargs*/ +#define HDvsnprintf c99_vsnprintf #endif /* H5_HAVE_VISUAL_STUDIO */ diff --git a/src/Makefile.in b/src/Makefile.in index ae0d0ff..276052e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -522,7 +522,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 = 146 +LT_VERS_REVISION = 151 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am index 190c083..05417f5 100644 --- a/tools/h5diff/Makefile.am +++ b/tools/h5diff/Makefile.am @@ -43,7 +43,7 @@ TEST_SCRIPT=testh5diff.sh check_PROGRAMS=$(TEST_PROG) check_SCRIPTS=$(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. -SCRIPT_DEPEND=h5diff$(EXEEXT) $(H5PDIFF) $(srcdir)/testh5diff.sh +SCRIPT_DEPEND=h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh # Source files for the program h5diff_SOURCES=h5diff_main.c h5diff_common.c diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 5567ceb..9b46f4e 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -456,7 +456,7 @@ TEST_PROG = h5diffgentest TEST_SCRIPT = testh5diff.sh check_SCRIPTS = $(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. -SCRIPT_DEPEND = h5diff$(EXEEXT) $(H5PDIFF) $(srcdir)/testh5diff.sh +SCRIPT_DEPEND = h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh # Source files for the program h5diff_SOURCES = h5diff_main.c h5diff_common.c diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 9b304bd..6218631 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -230,57 +230,61 @@ usage(const char *prog) PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] files\n", prog); PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); + PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Formatting Options ---------------\n"); + PRINTVALSTREAM(rawoutstream, " -e, --escape Escape non printing characters\n"); + PRINTVALSTREAM(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); + PRINTVALSTREAM(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); + PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n"); + PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); + PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); + PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); + PRINTVALSTREAM(rawoutstream, " occur.\n"); + PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); + PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n"); + PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); + PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n"); + PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n"); + PRINTVALSTREAM(rawoutstream, "--------------- File Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -n, --contents Print a list of the file contents and exit\n"); PRINTVALSTREAM(rawoutstream, " Optional value 1 also prints attributes.\n"); PRINTVALSTREAM(rawoutstream, " -B, --superblock Print the content of the super block\n"); PRINTVALSTREAM(rawoutstream, " -H, --header Print the header only; no data is displayed\n"); - PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); - PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); - PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); - PRINTVALSTREAM(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); - PRINTVALSTREAM(rawoutstream, " -e, --escape Escape non printing characters\n"); - PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n"); + PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n"); + PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); + PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n"); + PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); PRINTVALSTREAM(rawoutstream, " slash with a preceding backslash (\\).\n"); PRINTVALSTREAM(rawoutstream, " (See example section below.)\n"); PRINTVALSTREAM(rawoutstream, " -d P, --dataset=P Print the specified dataset\n"); - PRINTVALSTREAM(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); - PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); - PRINTVALSTREAM(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n"); PRINTVALSTREAM(rawoutstream, " -g P, --group=P Print the specified group and all members\n"); PRINTVALSTREAM(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); - PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n"); - PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); PRINTVALSTREAM(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n"); - PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); - PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n"); - PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n"); - PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n"); - PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); - PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); - PRINTVALSTREAM(rawoutstream, - " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n" - " format L for an integer dataset specified with\n" - " option -d. L is a list of offset,length values,\n" - " separated by commas. Offset is the beginning bit in\n" - " the data value and length is the number of bits of\n" - " the mask.\n" - ); + PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); + PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); + PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); + PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); + PRINTVALSTREAM(rawoutstream, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n"); + PRINTVALSTREAM(rawoutstream, " format L for an integer dataset specified with\n"); + PRINTVALSTREAM(rawoutstream, " option -d. L is a list of offset,length values,\n"); + PRINTVALSTREAM(rawoutstream, " separated by commas. Offset is the beginning bit in\n"); + PRINTVALSTREAM(rawoutstream, " the data value and length is the number of bits of\n"); + PRINTVALSTREAM(rawoutstream, " the mask.\n"); PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\n"); + PRINTVALSTREAM(rawoutstream, "--------------- XML Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -x, --xml Output in XML using Schema\n"); PRINTVALSTREAM(rawoutstream, " -u, --use-dtd Output in XML using DTD\n"); PRINTVALSTREAM(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n"); PRINTVALSTREAM(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - PRINTVALSTREAM(rawoutstream, " occur.\n"); - PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); - PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n"); - PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n"); - PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); PRINTVALSTREAM(rawoutstream, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); PRINTVALSTREAM(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n"); @@ -296,6 +300,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " number of dimensions in the dataspace being queried\n"); PRINTVALSTREAM(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n"); PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n"); PRINTVALSTREAM(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n"); @@ -324,7 +329,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n"); PRINTVALSTREAM(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Examples:\n"); + PRINTVALSTREAM(rawoutstream, "--------------- Examples ---------------\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); PRINTVALSTREAM(rawoutstream, "\n"); @@ -481,172 +486,6 @@ table_list_free(void) } /* end table_list_free() */ /*------------------------------------------------------------------------- - * Function: set_data_output_file - * - * Purpose: Open fname as the output file for dataset raw data. - * Set rawdatastream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - * Programmer: Albert Cheng, 2000/09/30 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static int -set_data_output_file(const char *fname, int is_bin) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawdatastream is changed only when succeeded */ - - if (rawdatastream && rawdatastream != stdout) { - if (HDfclose(rawdatastream)) - HDperror("closing rawdatastream"); - else - rawdatastream = NULL; - } - - /* First check if filename is string "NULL" */ - if (fname != NULL) { - /* binary output */ - if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { - rawdatastream = f; - retvalue = SUCCEED; - } - } - else { - if ((f = HDfopen(fname, "w")) != NULL) { - rawdatastream = f; - retvalue = SUCCEED; - } - } - } - else { - rawdatastream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_attr_output_file - * - * Purpose: Open fname as the output file for attribute raw data. - * Set rawattrstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_attr_output_file(const char *fname, int is_bin) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawattrstream is changed only when succeeded */ - - if (rawattrstream && rawattrstream != stdout) { - if (HDfclose(rawattrstream)) - HDperror("closing rawattrstream"); - else - rawattrstream = NULL; - } - - /* First check if filename is string "NULL" */ - if (fname != NULL) { - if ((f = HDfopen(fname, "w")) != NULL) { - rawattrstream = f; - retvalue = SUCCEED; - } - } - else { - rawattrstream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_output_file - * - * Purpose: Open fname as the output file for raw output. - * Set rawoutstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_output_file(const char *fname) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawoutstream is changed only when succeeded */ - - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) - HDperror("closing rawoutstream"); - else - rawoutstream = NULL; - } - /* First check if filename is string "NULL" */ - if (fname != NULL) { - if ((f = HDfopen(fname, "w")) != NULL) { - rawoutstream = f; - retvalue = SUCCEED; - } - } - else { - rawoutstream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_error_file - * - * Purpose: Open fname as the error output file for dataset raw error. - * Set rawerrorstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_error_file(const char *fname) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawerrorstream is changed only when succeeded */ - - if (rawerrorstream && rawerrorstream != stderr) { - if (HDfclose(rawerrorstream)) - HDperror("closing rawerrorstream"); - else - rawerrorstream = NULL; - } - - if ((f = HDfopen(fname, "w")) != NULL) { - rawerrorstream = f; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- * Function: set_binary_form * * Purpose: set the binary form of output by translating from a string input @@ -1186,7 +1025,7 @@ parse_start: break; case 'O': - if (set_output_file(opt_arg) < 0) { + if (h5tools_set_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1194,20 +1033,20 @@ parse_start: case 'o': if ( bin_output ) { - if (set_data_output_file(opt_arg, 1) < 0) { + if (h5tools_set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; } } else { if(display_attr_data && !display_data) { - if (set_attr_output_file(opt_arg, 0) < 0) { + if (h5tools_set_attr_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } } if(display_data || display_all) { - if (set_data_output_file(opt_arg, 0) < 0) { + if (h5tools_set_data_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1229,7 +1068,7 @@ parse_start: } bin_output = TRUE; if (outfname!=NULL) { - if (set_data_output_file(outfname, 1) < 0) { + if (h5tools_set_data_output_file(outfname, 1) < 0) { /* failed to set output file */ usage(h5tools_getprogname()); goto error; diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index a9a23a5..bb54e3f 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1179,9 +1179,9 @@ dump_fcpl(hid_t fid) indentation(dump_indent + COL); PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); indentation(dump_indent + COL); - PRINTSTREAM(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + PRINTSTREAM(rawoutstream,"%s %zu\n","OFFSET_SIZE", off_size); indentation(dump_indent + COL); - PRINTSTREAM(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + PRINTSTREAM(rawoutstream,"%s %zu\n","LENGTH_SIZE", len_size); indentation(dump_indent + COL); PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); indentation(dump_indent + COL); diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 691e2f2..40358c6 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -27,7 +27,7 @@ hsize_t write_pad( int , hsize_t ); hsize_t compute_pad( hsize_t ); -herr_t copy_to_file( int , int , ssize_t, ssize_t ); +herr_t copy_to_file( FILE *, FILE * , ssize_t, ssize_t ); int do_delete = FALSE; char *output_file = NULL; @@ -137,20 +137,28 @@ static int parse_command_line(int argc, const char *argv[]) { int opt = FALSE; - - /* parse command line options */ + + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch((char)opt) { case 'o': output_file = HDstrdup(opt_arg); - break; + if (output_file) + h5tools_set_data_output_file(output_file, 1); + break; case 'i': input_file = HDstrdup(opt_arg); - break; + if (input_file) + h5tools_set_input_file(input_file, 1); + break;; case 'u': ub_file = HDstrdup(opt_arg); + if (ub_file) + h5tools_set_output_file(ub_file, 1); + else + rawoutstream = stdout; break; case 'd': @@ -205,9 +213,6 @@ done: int main(int argc, const char *argv[]) { - int ifid = -1; - int ufid = -1; - int h5fid = -1; void *edata; H5E_auto2_t func; hid_t ifile = -1; @@ -222,24 +227,24 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ + /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ + /* Initialize h5tools lib */ h5tools_init(); if(EXIT_FAILURE == parse_command_line(argc, argv)) goto done; if (input_file == NULL) { - /* no user block */ + /* no user block */ error_msg("missing arguemnt for HDF5 file input.\n"); help_ref_msg(stderr); h5tools_setstatus(EXIT_FAILURE); goto done; } - + testval = H5Fis_hdf5(input_file); if (testval <= 0) { @@ -283,14 +288,7 @@ main(int argc, const char *argv[]) goto done; } - ifid = HDopen(input_file,O_RDONLY,0); - if(ifid < 0) { - error_msg("unable to open input HDF5 file \"%s\"\n", input_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - res = HDfstat(ifid, &sbuf); + res = HDfstat(HDfileno(rawinstream), &sbuf); if(res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); h5tools_setstatus(EXIT_FAILURE); @@ -305,43 +303,15 @@ main(int argc, const char *argv[]) goto done; } - if (ub_file == NULL) { - /* write to sdtout */ - ufid = HDdup(1); - } - else { - ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); - - if (ufid < 0) { - error_msg("unable to open user block file for output\"%s\"\n", ub_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - if (output_file == NULL) { - h5fid = HDopen(input_file,O_WRONLY, 0); - - if (h5fid < 0) { error_msg("unable to open output HDF5 file \"%s\"\n", input_file); h5tools_setstatus(EXIT_FAILURE); goto done; - } } - else { - h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); - - if (h5fid < 0) { - error_msg("unable to open output HDF5 file \"%s\"\n", output_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - - /* copy from 0 to 'usize - 1' into ufid */ + /* copy from 0 to 'usize - 1' into ufid */ if (!do_delete) { - if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) { + if(copy_to_file(rawinstream, rawoutstream, 0, (ssize_t) usize) < 0) { error_msg("unable to copy user block to output file \"%s\"\n", ub_file); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -349,34 +319,25 @@ main(int argc, const char *argv[]) } /* copy from usize to end of file into h5fid, - * starting at end of user block if present - */ - if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) { + * starting at end of user block if present */ + if(copy_to_file(rawinstream, rawdatastream, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) { error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file); h5tools_setstatus(EXIT_FAILURE); goto done; } - + done: if(input_file) HDfree(input_file); + if(output_file) HDfree(output_file); + if(ub_file) { HDfree(ub_file); - if(ufid >= 0) - status = HDclose(ufid); - HDassert(status >= 0); - } - - if(h5fid >= 0) { - status = HDclose(h5fid); - HDassert(status >= 0); - } - if(ifid >= 0) { - status = HDclose(ifid); - HDassert(status >= 0); } + + h5tools_close(); return h5tools_getstatus(); } @@ -388,54 +349,60 @@ done: * Returns 0 on success, -1 on failure. */ herr_t -copy_to_file( int infid, int ofid, ssize_t where, ssize_t how_much ) +copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much ) { static char buf[COPY_BUF_SIZE]; + off_t where = (off_t)_where; off_t to; off_t from; - ssize_t nchars = -1; - ssize_t wnchars = -1; herr_t ret_value = 0; /* nothing to copy */ if(how_much <= 0) goto done; + /* rewind */ + HDfseek(infid, 0L, 0); + from = where; to = 0; - while(how_much > 0) { - /* Seek to correct position in input file */ - HDlseek(infid,from,SEEK_SET); + size_t bytes_in = 0; /* # of bytes to read */ + size_t bytes_read = 0; /* # of bytes actually read */ + size_t bytes_wrote = 0; /* # of bytes written */ - /* Read data to buffer */ if (how_much > COPY_BUF_SIZE) - nchars = HDread(infid,buf,(unsigned)COPY_BUF_SIZE); + bytes_in = COPY_BUF_SIZE; else - nchars = HDread(infid,buf,(unsigned)how_much); - if(nchars < 0) { + bytes_in = how_much; + + /* Seek to correct position in input file */ + HDfseek(infid, from, SEEK_SET); + + /* Read data to buffer */ + bytes_read = HDfread(buf, (size_t)1, bytes_in, infid); + if(0 == bytes_read && HDferror(infid)) { ret_value = -1; goto done; } /* end if */ + if(0 == bytes_read && HDfeof(infid)) { + goto done; + } /* end if */ /* Seek to correct position in output file */ - HDlseek(ofid,to,SEEK_SET); + HDfseek(ofid, to, SEEK_SET); /* Update positions/size */ - how_much -= nchars; - from += nchars; - to += nchars; - - /* Write nchars bytes to output file */ - wnchars = nchars; - while(nchars > 0) { - wnchars = HDwrite(ofid,buf,(unsigned)nchars); - if(wnchars < 0) { - ret_value = -1; - goto done; - } /* end if */ - nchars -= wnchars; - } /* end while */ + how_much -= bytes_read; + from += bytes_read; + to += bytes_read; + + /* Write nchars bytes to output file */ + bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid); + if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */ + ret_value = -1; + goto done; + } /* end if */ } /* end while */ done: diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index f61c961..921b390 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -241,7 +241,7 @@ static void usage(const char *prog) printf(" <layout type> can be:\n"); printf(" CHUNK, to apply chunking layout\n"); printf(" COMPA, to apply compact layout\n"); - printf(" CONTI, to apply continuous layout\n"); + printf(" CONTI, to apply contiguous layout\n"); printf(" <layout parameters> is optional layout information\n"); printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); printf(" COMPA (no parameter)\n"); diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 70eadd2..9f798e9 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -460,7 +460,7 @@ obj_list_t* parse_filter(const char *str, * chunked. NULL, on error * the layout type can be: * CHUNK, to apply chunking layout - * CONTI, to apply continuous layout + * CONTI, to apply contiguous layout * COMPA, to apply compact layout * * Example: diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index dcc2c08..6fc1dc4 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -26,10 +26,13 @@ #define PROGRAMNAME "h5stat" /* Parameters to control statistics gathered */ -#define SIZE_SMALL_GROUPS 10 -#define SIZE_SMALL_ATTRS 10 -#define SIZE_SMALL_DSETS 10 -#define SIZE_SMALL_SECTS 10 + +/* Default threshold for small groups/datasets/attributes */ +#define DEF_SIZE_SMALL_GROUPS 10 +#define DEF_SIZE_SMALL_DSETS 10 +#define DEF_SIZE_SMALL_ATTRS 10 + +#define SIZE_SMALL_SECTS 10 #define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to accommodate for user-define filters + one @@ -69,22 +72,22 @@ typedef struct iter_t { unsigned long max_links; /* Maximum # of links to an object */ hsize_t max_fanout; /* Maximum fanout from a group */ - unsigned long num_small_groups[SIZE_SMALL_GROUPS]; /* Size of small groups tracked */ + unsigned long *num_small_groups; /* Size of small groups tracked */ unsigned group_nbins; /* Number of bins for group counts */ unsigned long *group_bins; /* Pointer to array of bins for group counts */ ohdr_info_t group_ohdr_info; /* Object header information for groups */ - hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long num_small_attrs[SIZE_SMALL_ATTRS]; /* Size of small attributes tracked */ + hsize_t max_attrs; /* Maximum attributes from a group */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ unsigned max_dset_rank; /* Maximum rank of dataset */ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */ hsize_t max_dset_dims; /* Maximum dimension size of dataset */ - unsigned long small_dset_dims[SIZE_SMALL_DSETS]; /* Size of dimensions of small datasets tracked */ + unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ - unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ + unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */ @@ -134,15 +137,19 @@ static int display_dset_metadata = FALSE; /* display file space info f static int display_object = FALSE; /* not implemented yet */ +/* Initialize threshold for small groups/datasets/attributes */ +static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS; +static int sdsets_threshold = DEF_SIZE_SMALL_DSETS; +static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS; + /* a structure for handling the order command-line parameters come in */ struct handler_t { size_t obj_count; char **obj; }; - -static const char *s_opts ="ADdFfhGgsSTO:V"; -/* e.g. "filemetadata" has to precedue "file"; "groupmetadata" has to precede "group" etc. */ +static const char *s_opts ="Aa:Ddm:FfhGgl:sSTO:V"; +/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ static struct long_options l_opts[] = { {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, @@ -170,6 +177,10 @@ static struct long_options l_opts[] = { {"grou", no_arg, 'g'}, {"gro", no_arg, 'g'}, {"gr", no_arg, 'g'}, + { "links", require_arg, 'l' }, + { "link", require_arg, 'l' }, + { "lin", require_arg, 'l' }, + { "li", require_arg, 'l' }, {"dsetmetadata", no_arg, 'D'}, {"dsetmetadat", no_arg, 'D'}, {"dsetmetada", no_arg, 'D'}, @@ -181,6 +192,9 @@ static struct long_options l_opts[] = { {"dset", no_arg, 'd'}, {"dse", no_arg, 'd'}, {"ds", no_arg, 'd'}, + {"dims", require_arg, 'm'}, + {"dim", require_arg, 'm'}, + {"di", require_arg, 'm'}, {"dtypemetadata", no_arg, 'T'}, {"dtypemetadat", no_arg, 'T'}, {"dtypemetada", no_arg, 'T'}, @@ -212,6 +226,13 @@ static struct long_options l_opts[] = { { "attr", no_arg, 'A' }, { "att", no_arg, 'A' }, { "at", no_arg, 'A' }, + { "numattrs", require_arg, 'a' }, + { "numattr", require_arg, 'a' }, + { "numatt", require_arg, 'a' }, + { "numat", require_arg, 'a' }, + { "numa", require_arg, 'a' }, + { "num", require_arg, 'a' }, + { "nu", require_arg, 'a' }, { "freespace", no_arg, 's' }, { "freespac", no_arg, 's' }, { "freespa", no_arg, 's' }, @@ -237,6 +258,16 @@ leave(int ret) } + +/*------------------------------------------------------------------------- + * Function: usage + * + * Purpose: Compute the ceiling of log_10(x) + * + * Return: >0 on success, 0 on failure + * + *------------------------------------------------------------------------- + */ static void usage(const char *prog) { HDfflush(stdout); @@ -248,11 +279,20 @@ static void usage(const char *prog) HDfprintf(stdout, " -f, --file Print file information\n"); HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n"); HDfprintf(stdout, " -g, --group Print group information\n"); + HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n"); + HDfprintf(stdout, " information for small groups. N is an integer greater\n"); + HDfprintf(stdout, " than 0. The default threshold is 10.\n"); HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n"); HDfprintf(stdout, " -d, --dset Print dataset information\n"); + HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n"); + HDfprintf(stdout, " information for small datasets. N is an integer greater\n"); + HDfprintf(stdout, " than 0. The default threshold is 10.\n"); HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n"); HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n"); HDfprintf(stdout, " -A, --attribute Print attribute information\n"); + HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n"); + HDfprintf(stdout, " information for small # of attributes. N is an integer greater\n"); + HDfprintf(stdout, " than 0. The default threshold is 10.\n"); HDfprintf(stdout, " -s, --freespace Print free space information\n"); HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); } @@ -268,8 +308,6 @@ static void usage(const char *prog) * Programmer: Quincey Koziol * Monday, August 22, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static unsigned @@ -311,7 +349,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size; /* Update small # of attribute count & limits */ - if(oi->num_attrs < SIZE_SMALL_ATTRS) + if(oi->num_attrs <= (hsize_t)sattrs_threshold) (iter->num_small_attrs[(size_t)oi->num_attrs])++; if(oi->num_attrs > iter->max_attrs) iter->max_attrs = oi->num_attrs; @@ -382,8 +420,10 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HDassert(ret >= 0); /* Update link stats */ - if(ginfo.nlinks < SIZE_SMALL_GROUPS) + /* Collect statistics for small groups */ + if(ginfo.nlinks < (hsize_t)sgroups_threshold) (iter->num_small_groups[(size_t)ginfo.nlinks])++; + /* Determine maximum link count */ if(ginfo.nlinks > iter->max_fanout) iter->max_fanout = ginfo.nlinks; @@ -514,8 +554,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Only gather dim size statistics on 1-D datasets */ if(ndims == 1) { - iter->max_dset_dims = dims[0]; - if(dims[0] < SIZE_SMALL_DSETS) + /* Determine maximum dimension size */ + if(dims[0] > iter->max_dset_dims) + iter->max_dset_dims = dims[0]; + /* Collect statistics for small datasets */ + if(dims[0] < (hsize_t)sdsets_threshold) (iter->small_dset_dims[(size_t)dims[0]])++; /* Add dim count to proper bin */ @@ -871,6 +914,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) display_group = TRUE; break; + case 'l': + sgroups_threshold = HDatoi(opt_arg); + if(sgroups_threshold < 1) { + error_msg("Invalid threshold for small groups\n"); + goto error; + } /* end if */ + + break; + case 'D': display_all = FALSE; display_dset_metadata = TRUE; @@ -881,6 +933,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) display_dset = TRUE; break; + case 'm': + sdsets_threshold = HDatoi(opt_arg); + if(sdsets_threshold < 1) { + error_msg("Invalid threshold for small datasets\n"); + goto error; + } /* end if */ + + break; + case 'T': display_all = FALSE; display_dset_dtype_meta = TRUE; @@ -891,6 +952,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) display_attr = TRUE; break; + case 'a': + sattrs_threshold = HDatoi(opt_arg); + if(sattrs_threshold < 1) { + error_msg("Invalid threshold for small # of attributes\n"); + goto error; + } /* end if */ + + break; + case 's': display_all = FALSE; display_free_sections = TRUE; @@ -967,18 +1037,31 @@ error: static void iter_free(iter_t *iter) { + /* Clear array of bins for group counts */ if(iter->group_bins) { HDfree(iter->group_bins); iter->group_bins = NULL; } /* end if */ + /* Clear array for tracking small groups */ + if(iter->num_small_groups) { + HDfree(iter->num_small_groups); + iter->num_small_groups = NULL; + } /* end if */ + /* Clear array of bins for attribute counts */ if(iter->attr_bins) { HDfree(iter->attr_bins); iter->attr_bins = NULL; } /* end if */ + /* Clear array for tracking small attributes */ + if(iter->num_small_attrs) { + HDfree(iter->num_small_attrs); + iter->num_small_attrs= NULL; + } /* end if */ + /* Clear dataset datatype information found */ if(iter->dset_type_info) { HDfree(iter->dset_type_info); @@ -991,6 +1074,12 @@ iter_free(iter_t *iter) iter->dset_dim_bins = NULL; } /* end if */ + /* Clear array of tracking 1-D small datasets */ + if(iter->small_dset_dims) { + HDfree(iter->small_dset_dims); + iter->small_dset_dims = NULL; + } /* end if */ + /* Clear array of bins for free-space section sizes */ if(iter->sect_bins) { HDfree(iter->sect_bins); @@ -1117,11 +1206,11 @@ print_group_info(const iter_t *iter) unsigned long total; /* Total count for various statistics */ unsigned u; /* Local index variable */ - printf("Small groups:\n"); + printf("Small groups (with 0 to %u links):\n", sgroups_threshold-1); total = 0; - for(u = 0; u < SIZE_SMALL_GROUPS; u++) { + for(u = 0; u < (unsigned)sgroups_threshold; u++) { if(iter->num_small_groups[u] > 0) { - printf("\t# of groups of size %u: %lu\n", u, iter->num_small_groups[u]); + printf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]); total += iter->num_small_groups[u]; } /* end if */ } /* end for */ @@ -1130,13 +1219,13 @@ print_group_info(const iter_t *iter) printf("Group bins:\n"); total = 0; if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) { - printf("\t# of groups of size 0: %lu\n", iter->group_bins[0]); + printf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]); total = iter->group_bins[0]; } /* end if */ power = 1; for(u = 1; u < iter->group_nbins; u++) { if(iter->group_bins[u] > 0) { - printf("\t# of groups of size %lu - %lu: %lu\n", power, (power * 10) - 1, + printf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1, iter->group_bins[u]); total += iter->group_bins[u]; } /* end if */ @@ -1207,29 +1296,29 @@ print_dataset_info(const iter_t *iter) printf("1-D Dataset information:\n"); HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims); - printf("\tSmall 1-D datasets:\n"); + printf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1); total = 0; - for(u = 0; u < SIZE_SMALL_DSETS; u++) { + for(u = 0; u < (unsigned)sdsets_threshold; u++) { if(iter->small_dset_dims[u] > 0) { - printf("\t\t# of dataset dimensions of size %u: %lu\n", u, + printf("\t\t# of datasets with dimension sizes %u: %lu\n", u, iter->small_dset_dims[u]); total += iter->small_dset_dims[u]; } /* end if */ } /* end for */ - printf("\t\tTotal small datasets: %lu\n", total); + printf("\t\tTotal # of small datasets: %lu\n", total); /* Protect against no datasets in file */ if(iter->dset_dim_nbins > 0) { printf("\t1-D Dataset dimension bins:\n"); total = 0; if(iter->dset_dim_bins[0] > 0) { - printf("\t\t# of datasets of size 0: %lu\n", iter->dset_dim_bins[0]); + printf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]); total = iter->dset_dim_bins[0]; } /* end if */ power = 1; for(u = 1; u < iter->dset_dim_nbins; u++) { if(iter->dset_dim_bins[u] > 0) { - printf("\t\t# of datasets of size %lu - %lu: %lu\n", power, (power * 10) - 1, + printf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->dset_dim_bins[u]); total += iter->dset_dim_bins[u]; } /* end if */ @@ -1346,8 +1435,6 @@ print_dset_dtype_meta(const iter_t *iter) * Programmer: Vailin Choi * July 12, 2007 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1357,9 +1444,9 @@ print_attr_info(const iter_t *iter) unsigned long total; /* Total count for various statistics */ unsigned u; /* Local index variable */ - printf("Small # of attributes:\n"); + printf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold); total = 0; - for(u = 1; u < SIZE_SMALL_ATTRS; u++) { + for(u = 1; u <= (unsigned)sattrs_threshold; u++) { if(iter->num_small_attrs[u] > 0) { printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]); total += iter->num_small_attrs[u]; @@ -1660,6 +1747,16 @@ main(int argc, const char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ + iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long)); + + if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { + error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if((fcpl = H5Fget_create_plist(fid)) < 0) warn_msg("Unable to retrieve file creation property\n"); diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index a7bb4b0..5ad73f7 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -16,88 +16,325 @@ /* * Generate the binary hdf5 files for the h5stat tests. * Usage: just execute the program without any arguments will - * generate all the binary hdf5 files in the ./testfiles directory. + * generate all the binary hdf5 files * * If you regenerate the test files (e.g., changing some code, * trying it on a new platform, ...), you need to verify the correctness * of the expected output and update the corresponding *.ddl files. */ - -#include <assert.h> #include "hdf5.h" -#define FILE "h5stat_newgrat.h5" +/* For gen_newgrat_file() */ +#define NEWGRAT_FILE "h5stat_newgrat.h5" #define DATASET_NAME "DATASET_NAME" #define GROUP_NAME "GROUP" #define ATTR_NAME "ATTR" #define NUM_GRPS 35000 #define NUM_ATTRS 100 +/* For gen_threshold_file() */ +#define THRESHOLD_FILE "h5stat_threshold.h5" +#define THRES_ATTR_NAME "attr" +#define THRES_ATTR_GRP_NAME "grp_attr" +#define THRES_DSET_NAME "dset" +#define THRES_NUM 10 +#define THRES_NUM_25 25 + /* - * Generate 1.8 HDF5 file - * with NUM_GRPS groups - * with NUM_ATTRS attributes on the dataset + * Generate HDF5 file with latest format with + * NUM_GRPS groups and NUM_ATTRS attributes for the dataset + * */ -static void gen_file(void) +static void +gen_newgrat_file(const char *fname) { - hid_t fcpl; /* File creation property */ - hid_t fapl; /* File access property */ - hid_t file; /* File id */ - hid_t gid; /* Group id */ - hid_t type_id; /* Datatype id */ - hid_t space_id; /* Dataspace id */ - hid_t attr_id; /* Attribute id */ - hid_t dset_id; /* Dataset id */ - char name[30]; /* Group name */ - char attrname[30]; /* Attribute name */ - int ret; /* Return value */ - int i; /* Local index variable */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); - ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - assert(ret >= 0); + hid_t fcpl; /* File creation property */ + hid_t fapl; /* File access property */ + hid_t fid; /* File id */ + hid_t gid; /* Group id */ + hid_t tid; /* Datatype id */ + hid_t sid; /* Dataspace id */ + hid_t attr_id; /* Attribute id */ + hid_t did; /* Dataset id */ + char name[30]; /* Group name */ + char attrname[30]; /* Attribute name */ + int i; /* Local index variable */ + + /* Get a copy file access property list */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Set to use latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; + + /* Get a copy of file creation property list */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; /* Set file space handling strategy */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); - assert(ret >= 0); + if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0) + goto error; + + /* Create file */ + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + goto error; - /* Create dataset */ - file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl); + /* Create NUM_GRPS groups in the root group */ for(i = 1; i <= NUM_GRPS; i++) { sprintf(name, "%s%d", GROUP_NAME,i); - gid = H5Gcreate2(file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(gid); + if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid) < 0) + goto error; } /* end for */ /* Create a datatype to commit and use */ - type_id = H5Tcopy(H5T_NATIVE_INT); + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + goto error; /* Create dataspace for dataset */ - space_id = H5Screate(H5S_SCALAR); + if((sid = H5Screate(H5S_SCALAR)) < 0) + goto error; + + /* Create dataset */ + if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Create dataset */ - dset_id = H5Dcreate2(file, DATASET_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* Create NUM_ATTRS for the dataset */ for(i = 1; i <= NUM_ATTRS; i++) { sprintf(attrname, "%s%d", ATTR_NAME,i); - attr_id = H5Acreate2(dset_id, attrname, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); - ret = H5Aclose(attr_id); - assert(ret >= 0); + if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr_id) < 0) + goto error; } /* end for */ - ret = H5Dclose(dset_id); - assert(ret >= 0); - ret = H5Sclose(space_id); - assert(ret >= 0); - ret = H5Tclose(type_id); - assert(ret >= 0); - ret = H5Fclose(file); - assert(ret >= 0); -} + /* Close dataset, dataspace, datatype, file */ + if(H5Dclose(did) < 0) + goto error; + if(H5Sclose(sid) < 0) + goto error; + if(H5Tclose(tid) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; + +error: + H5E_BEGIN_TRY { + H5Aclose(attr_id); + H5Dclose(did); + H5Tclose(tid); + H5Sclose(sid); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + +} /* gen_newgrat_file() */ + +/* + * Generate an HDF5 file with groups, datasets, attributes for testing the options: + * -l N (--links=N): Set the threshold for # of links when printing information for small groups. + * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets. + * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes. + */ +static void +gen_threshold_file(const char *fname) +{ + hid_t fid; /* File ID */ + hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */ + hid_t did; /* Dataset ID */ + hid_t attr_id; /* Attribute ID */ + hid_t gid; /* Group ID */ + hsize_t two_dims[] = {2, 5}; /* Dimension array */ + hsize_t one_dims[] = {6}; /* Dimension array */ + hsize_t zero_dims[] = {0}; /* Dimension array */ + char name[30]; /* Name */ + unsigned i; /* Local index variable */ + + /* Create file */ + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create 1-D dataspace with zero dimension size */ + if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0) + goto error; + + /* Create 1-D dataspace with non-zero dimension size*/ + if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0) + goto error; + + /* Create 2-D dataspace */ + if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0) + goto error; + + /* Create scalar dataspace */ + if((sid3 = H5Screate(H5S_SCALAR)) < 0) + goto error; + + /* Create null dataspace */ + if((sid4 = H5Screate(H5S_NULL)) < 0) + goto error; + + /* Create an attribute for the root group */ + if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr_id) < 0) + goto error; + + /* Create 1-D dataset with zero dimension size for the root group */ + if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create 11 attributes for the dataset */ + for(i = 1; i <= (THRES_NUM+1); i++) { + sprintf(name, "%s%d", THRES_ATTR_NAME,i); + if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr_id) < 0) + goto error; + } + if(H5Dclose(did) < 0) + goto error; + + /* Create dataset with scalar dataspace for the root group */ + if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Dclose(did) < 0) + goto error; + + /* Create dataset with null dataspace for the root group */ + if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Dclose(did) < 0) + goto error; + + /* Create 2-D dataset for the root group */ + if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create 10 attributes for the 2-D dataset */ + for(i = 1; i <= THRES_NUM; i++) { + sprintf(name, "%s%d", THRES_ATTR_NAME,i); + if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Aclose(attr_id) < 0) + goto error; + } + if(H5Dclose(did) < 0) + goto error; + + /* Create first group */ + if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create an attribute for the group */ + if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Close attribute */ + if(H5Aclose(attr_id) < 0) + goto error; + + /* Create 10 1-D datasets with non-zero dimension size for the group */ + for(i = 1; i <= THRES_NUM; i++) { + /* set up dataset name */ + sprintf(name, "%s%d", THRES_DSET_NAME,i); + + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; + } + + /* Close the group */ + if(H5Gclose(gid) < 0) + goto error; + + + /* Create second group */ + if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create 25 attributes for the group */ + for(i = 1; i <= THRES_NUM_25; i++) { + /* Set up attribute name */ + sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); + + /* Create the attribute */ + if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Close the attribute */ + if(H5Aclose(attr_id) < 0) + goto error; + } + + /* Close the group */ + if(H5Gclose(gid) < 0) + goto error; + + /* Create third group */ + if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create 9 1-D datasets with non-zero dimension size for the group */ + for(i = 1; i < THRES_NUM; i++) { + /* set up dataset name */ + sprintf(name, "%s%d", THRES_DSET_NAME,i); + + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; + } + + /* Close the group */ + if(H5Gclose(gid) < 0) + goto error; + + + /* Close dataspaces */ + if(H5Sclose(sid0) < 0) + goto error; + if(H5Sclose(sid1) < 0) + goto error; + if(H5Sclose(sid2) < 0) + goto error; + if(H5Sclose(sid3) < 0) + goto error; + if(H5Sclose(sid4) < 0) + goto error; + + /* Close file */ + if(H5Fclose(fid) < 0) + goto error; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Aclose(attr_id); + H5Dclose(did); + H5Sclose(sid0); + H5Sclose(sid1); + H5Sclose(sid2); + H5Sclose(sid3); + H5Sclose(sid4); + H5Fclose(fid); + } H5E_END_TRY; + +} /* gen_threshold_file() */ int main(void) { - gen_file(); + gen_newgrat_file(NEWGRAT_FILE); + gen_threshold_file(THRESHOLD_FILE); return 0; } diff --git a/tools/h5stat/testfiles/h5stat_dims1.ddl b/tools/h5stat/testfiles/h5stat_dims1.ddl new file mode 100644 index 0000000..182d31a --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_dims1.ddl @@ -0,0 +1,47 @@ +############################# +Expected output for 'h5stat -gd -m 5 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Small groups (with 0 to 9 links): + # of groups with 0 link(s): 1 + # of groups with 7 link(s): 1 + # of groups with 9 link(s): 1 + Total # of small groups: 3 +Group bins: + # of groups with 0 link: 1 + # of groups with 1 - 9 links: 2 + # of groups with 10 - 99 links: 1 + Total # of groups: 4 +Dataset dimension information: + Max. rank of datasets: 2 + Dataset ranks: + # of dataset with rank 0: 2 + # of dataset with rank 1: 20 + # of dataset with rank 2: 1 +1-D Dataset information: + Max. dimension size of 1-D datasets: 6 + Small 1-D datasets (with dimension sizes 0 to 4): + # of datasets with dimension sizes 0: 1 + Total # of small datasets: 1 + 1-D Dataset dimension bins: + # of datasets with dimension size 0: 1 + # of datasets with dimension size 1 - 9: 19 + Total # of datasets: 20 +Dataset storage information: + Total raw data size: 0 + Total external raw data size: 0 +Dataset layout information: + Dataset layout counts[COMPACT]: 0 + Dataset layout counts[CONTIG]: 23 + Dataset layout counts[CHUNKED]: 0 + Number of external files : 0 +Dataset filters information: + Number of datasets with: + NO filter: 23 + GZIP filter: 0 + SHUFFLE filter: 0 + FLETCHER32 filter: 0 + SZIP filter: 0 + NBIT filter: 0 + SCALEOFFSET filter: 0 + USER-DEFINED filter: 0 diff --git a/tools/h5stat/testfiles/h5stat_dims2.ddl b/tools/h5stat/testfiles/h5stat_dims2.ddl new file mode 100644 index 0000000..abf3f61 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_dims2.ddl @@ -0,0 +1,38 @@ +############################# +Expected output for 'h5stat -d --di=15 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Dataset dimension information: + Max. rank of datasets: 2 + Dataset ranks: + # of dataset with rank 0: 2 + # of dataset with rank 1: 20 + # of dataset with rank 2: 1 +1-D Dataset information: + Max. dimension size of 1-D datasets: 6 + Small 1-D datasets (with dimension sizes 0 to 14): + # of datasets with dimension sizes 0: 1 + # of datasets with dimension sizes 6: 19 + Total # of small datasets: 20 + 1-D Dataset dimension bins: + # of datasets with dimension size 0: 1 + # of datasets with dimension size 1 - 9: 19 + Total # of datasets: 20 +Dataset storage information: + Total raw data size: 0 + Total external raw data size: 0 +Dataset layout information: + Dataset layout counts[COMPACT]: 0 + Dataset layout counts[CONTIG]: 23 + Dataset layout counts[CHUNKED]: 0 + Number of external files : 0 +Dataset filters information: + Number of datasets with: + NO filter: 23 + GZIP filter: 0 + SHUFFLE filter: 0 + FLETCHER32 filter: 0 + SZIP filter: 0 + NBIT filter: 0 + SCALEOFFSET filter: 0 + USER-DEFINED filter: 0 diff --git a/tools/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/h5stat/testfiles/h5stat_err1_dims.ddl new file mode 100644 index 0000000..8f0686f --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_err1_dims.ddl @@ -0,0 +1,4 @@ +############################# +Expected output for 'h5stat -d --dims=-1 h5stat_threshold.h5' +############################# +h5stat error: Invalid threshold for small datasets diff --git a/tools/h5stat/testfiles/h5stat_err1_links.ddl b/tools/h5stat/testfiles/h5stat_err1_links.ddl new file mode 100644 index 0000000..07987a2 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_err1_links.ddl @@ -0,0 +1,4 @@ +############################# +Expected output for 'h5stat -l 0 h5stat_threshold.h5' +############################# +h5stat error: Invalid threshold for small groups diff --git a/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl new file mode 100644 index 0000000..8eea546 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl @@ -0,0 +1,4 @@ +############################# +Expected output for 'h5stat -a -2 h5stat_threshold.h5' +############################# +h5stat error: Invalid threshold for small # of attributes diff --git a/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl new file mode 100644 index 0000000..a1ecb31 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl @@ -0,0 +1,4 @@ +############################# +Expected output for 'h5stat --numattrs h5stat_threshold.h5' +############################# +h5stat error: Invalid threshold for small # of attributes diff --git a/tools/h5stat/testfiles/h5stat_filters-d.ddl b/tools/h5stat/testfiles/h5stat_filters-d.ddl index 3cc9071..dae1f06 100644 --- a/tools/h5stat/testfiles/h5stat_filters-d.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-d.ddl @@ -9,10 +9,10 @@ Dataset dimension information: # of dataset with rank 2: 14 1-D Dataset information: Max. dimension size of 1-D datasets: 100 - Small 1-D datasets: - Total small datasets: 0 + Small 1-D datasets (with dimension sizes 0 to 9): + Total # of small datasets: 0 1-D Dataset dimension bins: - # of datasets of size 100 - 999: 1 + # of datasets with dimension size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: Total raw data size: 8659 diff --git a/tools/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/h5stat/testfiles/h5stat_filters-dT.ddl index ae9121d..5c7a4ab 100644 --- a/tools/h5stat/testfiles/h5stat_filters-dT.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-dT.ddl @@ -9,10 +9,10 @@ Dataset dimension information: # of dataset with rank 2: 14 1-D Dataset information: Max. dimension size of 1-D datasets: 100 - Small 1-D datasets: - Total small datasets: 0 + Small 1-D datasets (with dimension sizes 0 to 9): + Total # of small datasets: 0 1-D Dataset dimension bins: - # of datasets of size 100 - 999: 1 + # of datasets with dimension size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: Total raw data size: 8659 diff --git a/tools/h5stat/testfiles/h5stat_filters-g.ddl b/tools/h5stat/testfiles/h5stat_filters-g.ddl index d488b8f..6cb791c 100644 --- a/tools/h5stat/testfiles/h5stat_filters-g.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-g.ddl @@ -2,8 +2,8 @@ Expected output for 'h5stat -g h5stat_filters.h5' ############################# Filename: h5stat_filters.h5 -Small groups: +Small groups (with 0 to 9 links): Total # of small groups: 0 Group bins: - # of groups of size 10 - 99: 1 + # of groups with 10 - 99 links: 1 Total # of groups: 1 diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl index ddafd81..0a6733d 100644 --- a/tools/h5stat/testfiles/h5stat_filters.ddl +++ b/tools/h5stat/testfiles/h5stat_filters.ddl @@ -35,10 +35,10 @@ File space information for file metadata (in bytes): Free-space managers: Header: 0 Amount of free space: 0 -Small groups: +Small groups (with 0 to 9 links): Total # of small groups: 0 Group bins: - # of groups of size 10 - 99: 1 + # of groups with 10 - 99 links: 1 Total # of groups: 1 Dataset dimension information: Max. rank of datasets: 2 @@ -47,10 +47,10 @@ Dataset dimension information: # of dataset with rank 2: 14 1-D Dataset information: Max. dimension size of 1-D datasets: 100 - Small 1-D datasets: - Total small datasets: 0 + Small 1-D datasets (with dimension sizes 0 to 9): + Total # of small datasets: 0 1-D Dataset dimension bins: - # of datasets of size 100 - 999: 1 + # of datasets with dimension size 100 - 999: 1 Total # of datasets: 1 Dataset storage information: Total raw data size: 8659 @@ -79,7 +79,7 @@ Dataset datatype information: Count (total/named) = (1/0) Size (desc./elmt) = (14/4) Total dataset datatype count: 15 -Small # of attributes: +Small # of attributes (objects with 1 to 10 attributes): Total # of objects with small # of attributes: 0 Attribute bins: Total # of objects with attributes: 0 diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl index 5665b35..d79c99f 100644 --- a/tools/h5stat/testfiles/h5stat_help1.ddl +++ b/tools/h5stat/testfiles/h5stat_help1.ddl @@ -9,10 +9,19 @@ Usage: h5stat [OPTIONS] file -f, --file Print file information -F, --filemetadata Print file space information for file's metadata -g, --group Print group information + -l N, --links=N Set the threshold for the # of links when printing + information for small groups. N is an integer greater + than 0. The default threshold is 10. -G, --groupmetadata Print file space information for groups' metadata -d, --dset Print dataset information + -m N, --dims=N Set the threshold for the dimension sizes when printing + information for small datasets. N is an integer greater + than 0. The default threshold is 10. -D, --dsetmetadata Print file space information for datasets' metadata -T, --dtypemetadata Print datasets' datatype information -A, --attribute Print attribute information + -a N, --numattrs=N Set the threshold for the # of attributes when printing + information for small # of attributes. N is an integer greater + than 0. The default threshold is 10. -s, --freespace Print free space information -S, --summary Print summary of file space information diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl index 3fb303a..af48e3a 100644 --- a/tools/h5stat/testfiles/h5stat_help2.ddl +++ b/tools/h5stat/testfiles/h5stat_help2.ddl @@ -9,10 +9,19 @@ Usage: h5stat [OPTIONS] file -f, --file Print file information -F, --filemetadata Print file space information for file's metadata -g, --group Print group information + -l N, --links=N Set the threshold for the # of links when printing + information for small groups. N is an integer greater + than 0. The default threshold is 10. -G, --groupmetadata Print file space information for groups' metadata -d, --dset Print dataset information + -m N, --dims=N Set the threshold for the dimension sizes when printing + information for small datasets. N is an integer greater + than 0. The default threshold is 10. -D, --dsetmetadata Print file space information for datasets' metadata -T, --dtypemetadata Print datasets' datatype information -A, --attribute Print attribute information + -a N, --numattrs=N Set the threshold for the # of attributes when printing + information for small # of attributes. N is an integer greater + than 0. The default threshold is 10. -s, --freespace Print free space information -S, --summary Print summary of file space information diff --git a/tools/h5stat/testfiles/h5stat_links1.ddl b/tools/h5stat/testfiles/h5stat_links1.ddl new file mode 100644 index 0000000..e77a788 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_links1.ddl @@ -0,0 +1,13 @@ +############################# +Expected output for 'h5stat -g -l 8 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Small groups (with 0 to 7 links): + # of groups with 0 link(s): 1 + # of groups with 7 link(s): 1 + Total # of small groups: 2 +Group bins: + # of groups with 0 link: 1 + # of groups with 1 - 9 links: 2 + # of groups with 10 - 99 links: 1 + Total # of groups: 4 diff --git a/tools/h5stat/testfiles/h5stat_links2.ddl b/tools/h5stat/testfiles/h5stat_links2.ddl new file mode 100644 index 0000000..5207343 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_links2.ddl @@ -0,0 +1,107 @@ +############################# +Expected output for 'h5stat --links=8 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +File information + # of unique groups: 4 + # of unique datasets: 23 + # of unique named datatypes: 0 + # of unique links: 0 + # of unique other: 0 + Max. # of links to object: 1 + Max. # of objects in group: 10 +File space information for file metadata (in bytes): + Superblock: 96 + Superblock extension: 0 + User block: 0 + Object headers: (total/unused) + Groups: 3576/0 + Datasets(exclude compact data): 7896/2912 + Datatypes: 0/0 + Groups: + B-tree/List: 3816 + Heap: 744 + Attributes: + B-tree/List: 0 + Heap: 0 + Chunked datasets: + Index: 0 + Datasets: + Heap: 0 + Shared Messages: + Header: 0 + B-tree/List: 0 + Heap: 0 + Free-space managers: + Header: 0 + Amount of free space: 0 +Small groups (with 0 to 7 links): + # of groups with 0 link(s): 1 + # of groups with 7 link(s): 1 + Total # of small groups: 2 +Group bins: + # of groups with 0 link: 1 + # of groups with 1 - 9 links: 2 + # of groups with 10 - 99 links: 1 + Total # of groups: 4 +Dataset dimension information: + Max. rank of datasets: 2 + Dataset ranks: + # of dataset with rank 0: 2 + # of dataset with rank 1: 20 + # of dataset with rank 2: 1 +1-D Dataset information: + Max. dimension size of 1-D datasets: 6 + Small 1-D datasets (with dimension sizes 0 to 9): + # of datasets with dimension sizes 0: 1 + # of datasets with dimension sizes 6: 19 + Total # of small datasets: 20 + 1-D Dataset dimension bins: + # of datasets with dimension size 0: 1 + # of datasets with dimension size 1 - 9: 19 + Total # of datasets: 20 +Dataset storage information: + Total raw data size: 0 + Total external raw data size: 0 +Dataset layout information: + Dataset layout counts[COMPACT]: 0 + Dataset layout counts[CONTIG]: 23 + Dataset layout counts[CHUNKED]: 0 + Number of external files : 0 +Dataset filters information: + Number of datasets with: + NO filter: 23 + GZIP filter: 0 + SHUFFLE filter: 0 + FLETCHER32 filter: 0 + SZIP filter: 0 + NBIT filter: 0 + SCALEOFFSET filter: 0 + USER-DEFINED filter: 0 +Dataset datatype information: + # of unique datatypes used by datasets: 1 + Dataset datatype #0: + Count (total/named) = (23/0) + Size (desc./elmt) = (14/1) + Total dataset datatype count: 23 +Small # of attributes (objects with 1 to 10 attributes): + # of objects with 1 attributes: 2 + # of objects with 10 attributes: 1 + Total # of objects with small # of attributes: 3 +Attribute bins: + # of objects with 1 - 9 attributes: 2 + # of objects with 10 - 99 attributes: 3 + Total # of objects with attributes: 5 + Max. # of attributes to objects: 25 +Free-space section threshold: 1 bytes +Small size free-space sections (< 10 bytes): + Total # of small size sections: 0 +Free-space section bins: + Total # of sections: 0 +File space management strategy: H5F_FILE_SPACE_ALL +Summary of file space information: + File metadata: 16128 bytes + Raw data: 0 bytes + Amount/Percent of tracked free space: 0 bytes/0.0% + Unaccounted space: 184 bytes +Total space: 16312 bytes diff --git a/tools/h5stat/testfiles/h5stat_links3.ddl b/tools/h5stat/testfiles/h5stat_links3.ddl new file mode 100644 index 0000000..d0071d7 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_links3.ddl @@ -0,0 +1,15 @@ +############################# +Expected output for 'h5stat --links=20 -g h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Small groups (with 0 to 19 links): + # of groups with 0 link(s): 1 + # of groups with 7 link(s): 1 + # of groups with 9 link(s): 1 + # of groups with 10 link(s): 1 + Total # of small groups: 4 +Group bins: + # of groups with 0 link: 1 + # of groups with 1 - 9 links: 2 + # of groups with 10 - 99 links: 1 + Total # of groups: 4 diff --git a/tools/h5stat/testfiles/h5stat_links4.ddl b/tools/h5stat/testfiles/h5stat_links4.ddl new file mode 100644 index 0000000..ca3911c --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_links4.ddl @@ -0,0 +1,11 @@ +############################# +Expected output for 'h5stat -g h5stat_newgrat.h5' +############################# +Filename: h5stat_newgrat.h5 +Small groups (with 0 to 9 links): + # of groups with 0 link(s): 35000 + Total # of small groups: 35000 +Group bins: + # of groups with 0 link: 35000 + # of groups with 10000 - 99999 links: 1 + Total # of groups: 35001 diff --git a/tools/h5stat/testfiles/h5stat_links5.ddl b/tools/h5stat/testfiles/h5stat_links5.ddl new file mode 100644 index 0000000..44ec161 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_links5.ddl @@ -0,0 +1,12 @@ +############################# +Expected output for 'h5stat -g -l 40000 h5stat_newgrat.h5' +############################# +Filename: h5stat_newgrat.h5 +Small groups (with 0 to 39999 links): + # of groups with 0 link(s): 35000 + # of groups with 35001 link(s): 1 + Total # of small groups: 35001 +Group bins: + # of groups with 0 link: 35000 + # of groups with 10000 - 99999 links: 1 + Total # of groups: 35001 diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl index 70f9a82..18f91f3 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl +++ b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl @@ -2,7 +2,7 @@ Expected output for 'h5stat -A h5stat_newgrat.h5' ############################# Filename: h5stat_newgrat.h5 -Small # of attributes: +Small # of attributes (objects with 1 to 10 attributes): Total # of objects with small # of attributes: 0 Attribute bins: # of objects with 100 - 999 attributes: 1 diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl index b93fa17..7d4ef91 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat.ddl +++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl @@ -33,14 +33,14 @@ File space information for file metadata (in bytes): B-tree/List: 0 Heap: 0 Free-space managers: - Header: 1584 - Amount of free space: 6042 -Small groups: - # of groups of size 0: 35000 + Header: 180 + Amount of free space: 132 +Small groups (with 0 to 9 links): + # of groups with 0 link(s): 35000 Total # of small groups: 35000 Group bins: - # of groups of size 0: 35000 - # of groups of size 10000 - 99999: 1 + # of groups with 0 link: 35000 + # of groups with 10000 - 99999 links: 1 Total # of groups: 35001 Dataset dimension information: Max. rank of datasets: 0 @@ -48,8 +48,8 @@ Dataset dimension information: # of dataset with rank 0: 1 1-D Dataset information: Max. dimension size of 1-D datasets: 0 - Small 1-D datasets: - Total small datasets: 0 + Small 1-D datasets (with dimension sizes 0 to 9): + Total # of small datasets: 0 Dataset storage information: Total raw data size: 0 Total external raw data size: 0 @@ -74,7 +74,7 @@ Dataset datatype information: Count (total/named) = (1/0) Size (desc./elmt) = (14/4) Total dataset datatype count: 1 -Small # of attributes: +Small # of attributes (objects with 1 to 10 attributes): Total # of objects with small # of attributes: 0 Attribute bins: # of objects with 100 - 999 attributes: 1 @@ -83,20 +83,15 @@ Attribute bins: Free-space section threshold: 1 bytes Small size free-space sections (< 10 bytes): # of sections of size 1: 1 - # of sections of size 2: 12 - # of sections of size 3: 1 - # of sections of size 7: 1 - # of sections of size 8: 2 - Total # of small size sections: 17 + Total # of small size sections: 1 Free-space section bins: - # of sections of size 1 - 9: 17 - # of sections of size 10 - 99: 49 - # of sections of size 100 - 999: 27 - Total # of sections: 93 + # of sections of size 1 - 9: 1 + # of sections of size 10 - 99: 4 + Total # of sections: 5 File space management strategy: H5F_FILE_SPACE_ALL_PERSIST Summary of file space information: - File metadata: 6363440 bytes + File metadata: 6362036 bytes Raw data: 0 bytes - Amount/Percent of tracked free space: 6042 bytes/0.1% + Amount/Percent of tracked free space: 132 bytes/0.0% Unaccounted space: 0 bytes -Total space: 6369482 bytes +Total space: 6362168 bytes diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5 Binary files differindex cb5f47f..c919b71 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat.h5 +++ b/tools/h5stat/testfiles/h5stat_newgrat.h5 diff --git a/tools/h5stat/testfiles/h5stat_nofile.ddl b/tools/h5stat/testfiles/h5stat_nofile.ddl new file mode 100644 index 0000000..cf20995 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_nofile.ddl @@ -0,0 +1,28 @@ +############################# +Expected output for 'h5stat ' +############################# +Usage: h5stat [OPTIONS] file + + OPTIONS + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -f, --file Print file information + -F, --filemetadata Print file space information for file's metadata + -g, --group Print group information + -l N, --links=N Set the threshold for the # of links when printing + information for small groups. N is an integer greater + than 0. The default threshold is 10. + -G, --groupmetadata Print file space information for groups' metadata + -d, --dset Print dataset information + -m N, --dims=N Set the threshold for the dimension sizes when printing + information for small datasets. N is an integer greater + than 0. The default threshold is 10. + -D, --dsetmetadata Print file space information for datasets' metadata + -T, --dtypemetadata Print datasets' datatype information + -A, --attribute Print attribute information + -a N, --numattrs=N Set the threshold for the # of attributes when printing + information for small # of attributes. N is an integer greater + than 0. The default threshold is 10. + -s, --freespace Print free space information + -S, --summary Print summary of file space information +h5stat error: missing file name diff --git a/tools/h5stat/testfiles/h5stat_numattrs1.ddl b/tools/h5stat/testfiles/h5stat_numattrs1.ddl new file mode 100644 index 0000000..86cfcb0 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_numattrs1.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5stat -AS -a 10 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Small # of attributes (objects with 1 to 10 attributes): + # of objects with 1 attributes: 2 + # of objects with 10 attributes: 1 + Total # of objects with small # of attributes: 3 +Attribute bins: + # of objects with 1 - 9 attributes: 2 + # of objects with 10 - 99 attributes: 3 + Total # of objects with attributes: 5 + Max. # of attributes to objects: 25 +File space management strategy: H5F_FILE_SPACE_ALL +Summary of file space information: + File metadata: 16128 bytes + Raw data: 0 bytes + Amount/Percent of tracked free space: 0 bytes/0.0% + Unaccounted space: 184 bytes +Total space: 16312 bytes diff --git a/tools/h5stat/testfiles/h5stat_numattrs2.ddl b/tools/h5stat/testfiles/h5stat_numattrs2.ddl new file mode 100644 index 0000000..5ee3adf --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_numattrs2.ddl @@ -0,0 +1,107 @@ +############################# +Expected output for 'h5stat -a 1 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +File information + # of unique groups: 4 + # of unique datasets: 23 + # of unique named datatypes: 0 + # of unique links: 0 + # of unique other: 0 + Max. # of links to object: 1 + Max. # of objects in group: 10 +File space information for file metadata (in bytes): + Superblock: 96 + Superblock extension: 0 + User block: 0 + Object headers: (total/unused) + Groups: 3576/0 + Datasets(exclude compact data): 7896/2912 + Datatypes: 0/0 + Groups: + B-tree/List: 3816 + Heap: 744 + Attributes: + B-tree/List: 0 + Heap: 0 + Chunked datasets: + Index: 0 + Datasets: + Heap: 0 + Shared Messages: + Header: 0 + B-tree/List: 0 + Heap: 0 + Free-space managers: + Header: 0 + Amount of free space: 0 +Small groups (with 0 to 9 links): + # of groups with 0 link(s): 1 + # of groups with 7 link(s): 1 + # of groups with 9 link(s): 1 + Total # of small groups: 3 +Group bins: + # of groups with 0 link: 1 + # of groups with 1 - 9 links: 2 + # of groups with 10 - 99 links: 1 + Total # of groups: 4 +Dataset dimension information: + Max. rank of datasets: 2 + Dataset ranks: + # of dataset with rank 0: 2 + # of dataset with rank 1: 20 + # of dataset with rank 2: 1 +1-D Dataset information: + Max. dimension size of 1-D datasets: 6 + Small 1-D datasets (with dimension sizes 0 to 9): + # of datasets with dimension sizes 0: 1 + # of datasets with dimension sizes 6: 19 + Total # of small datasets: 20 + 1-D Dataset dimension bins: + # of datasets with dimension size 0: 1 + # of datasets with dimension size 1 - 9: 19 + Total # of datasets: 20 +Dataset storage information: + Total raw data size: 0 + Total external raw data size: 0 +Dataset layout information: + Dataset layout counts[COMPACT]: 0 + Dataset layout counts[CONTIG]: 23 + Dataset layout counts[CHUNKED]: 0 + Number of external files : 0 +Dataset filters information: + Number of datasets with: + NO filter: 23 + GZIP filter: 0 + SHUFFLE filter: 0 + FLETCHER32 filter: 0 + SZIP filter: 0 + NBIT filter: 0 + SCALEOFFSET filter: 0 + USER-DEFINED filter: 0 +Dataset datatype information: + # of unique datatypes used by datasets: 1 + Dataset datatype #0: + Count (total/named) = (23/0) + Size (desc./elmt) = (14/1) + Total dataset datatype count: 23 +Small # of attributes (objects with 1 to 1 attributes): + # of objects with 1 attributes: 2 + Total # of objects with small # of attributes: 2 +Attribute bins: + # of objects with 1 - 9 attributes: 2 + # of objects with 10 - 99 attributes: 3 + Total # of objects with attributes: 5 + Max. # of attributes to objects: 25 +Free-space section threshold: 1 bytes +Small size free-space sections (< 10 bytes): + Total # of small size sections: 0 +Free-space section bins: + Total # of sections: 0 +File space management strategy: H5F_FILE_SPACE_ALL +Summary of file space information: + File metadata: 16128 bytes + Raw data: 0 bytes + Amount/Percent of tracked free space: 0 bytes/0.0% + Unaccounted space: 184 bytes +Total space: 16312 bytes diff --git a/tools/h5stat/testfiles/h5stat_numattrs3.ddl b/tools/h5stat/testfiles/h5stat_numattrs3.ddl new file mode 100644 index 0000000..515b76c --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_numattrs3.ddl @@ -0,0 +1,15 @@ +############################# +Expected output for 'h5stat -A --numattrs=25 h5stat_threshold.h5' +############################# +Filename: h5stat_threshold.h5 +Small # of attributes (objects with 1 to 25 attributes): + # of objects with 1 attributes: 2 + # of objects with 10 attributes: 1 + # of objects with 11 attributes: 1 + # of objects with 25 attributes: 1 + Total # of objects with small # of attributes: 5 +Attribute bins: + # of objects with 1 - 9 attributes: 2 + # of objects with 10 - 99 attributes: 3 + Total # of objects with attributes: 5 + Max. # of attributes to objects: 25 diff --git a/tools/h5stat/testfiles/h5stat_numattrs4.ddl b/tools/h5stat/testfiles/h5stat_numattrs4.ddl new file mode 100644 index 0000000..515a4a9 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_numattrs4.ddl @@ -0,0 +1,11 @@ +############################# +Expected output for 'h5stat -A -a 100 h5stat_newgrat.h5' +############################# +Filename: h5stat_newgrat.h5 +Small # of attributes (objects with 1 to 100 attributes): + # of objects with 100 attributes: 1 + Total # of objects with small # of attributes: 1 +Attribute bins: + # of objects with 100 - 999 attributes: 1 + Total # of objects with attributes: 1 + Max. # of attributes to objects: 100 diff --git a/tools/h5stat/testfiles/h5stat_threshold.h5 b/tools/h5stat/testfiles/h5stat_threshold.h5 Binary files differnew file mode 100644 index 0000000..9f7c8c8 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_threshold.h5 diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl index 6ee8aa8..788421b 100644 --- a/tools/h5stat/testfiles/h5stat_tsohm.ddl +++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl @@ -35,11 +35,11 @@ File space information for file metadata (in bytes): Free-space managers: Header: 0 Amount of free space: 0 -Small groups: - # of groups of size 3: 1 +Small groups (with 0 to 9 links): + # of groups with 3 link(s): 1 Total # of small groups: 1 Group bins: - # of groups of size 1 - 9: 1 + # of groups with 1 - 9 links: 1 Total # of groups: 1 Dataset dimension information: Max. rank of datasets: 2 @@ -47,8 +47,8 @@ Dataset dimension information: # of dataset with rank 2: 3 1-D Dataset information: Max. dimension size of 1-D datasets: 0 - Small 1-D datasets: - Total small datasets: 0 + Small 1-D datasets (with dimension sizes 0 to 9): + Total # of small datasets: 0 Dataset storage information: Total raw data size: 0 Total external raw data size: 0 @@ -73,7 +73,7 @@ Dataset datatype information: Count (total/named) = (3/0) Size (desc./elmt) = (14/8) Total dataset datatype count: 3 -Small # of attributes: +Small # of attributes (objects with 1 to 10 attributes): Total # of objects with small # of attributes: 0 Attribute bins: Total # of objects with attributes: 0 diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index ab97698..f780c97 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -13,7 +13,12 @@ # 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. # -# Tests for the h5dump tool +# Tests for the h5stat tool +# +# Modifcations: +# Vailin Choi; July 2013 +# Add tests for -l, -m, -a options +# srcdir=@srcdir@ @@ -72,12 +77,14 @@ LIST_HDF5_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_filters.h5 $SRC_H5STAT_TESTFILES/h5stat_tsohm.h5 $SRC_H5STAT_TESTFILES/h5stat_newgrat.h5 +$SRC_H5STAT_TESTFILES/h5stat_threshold.h5 " LIST_OTHER_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_help1.ddl $SRC_H5STAT_TESTFILES/h5stat_help2.ddl $SRC_H5STAT_TESTFILES/h5stat_notexist.ddl +$SRC_H5STAT_TESTFILES/h5stat_nofile.ddl $SRC_H5STAT_TESTFILES/h5stat_filters.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl @@ -90,6 +97,21 @@ $SRC_H5STAT_TESTFILES/h5stat_tsohm.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl +$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl +$SRC_H5STAT_TESTFILES/h5stat_links1.ddl +$SRC_H5STAT_TESTFILES/h5stat_links2.ddl +$SRC_H5STAT_TESTFILES/h5stat_links3.ddl +$SRC_H5STAT_TESTFILES/h5stat_links4.ddl +$SRC_H5STAT_TESTFILES/h5stat_links5.ddl +$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl +$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl +$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl +$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl +$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl +$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl +$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl +$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl +$SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl " # @@ -210,6 +232,7 @@ TOOLTEST h5stat_help1.ddl -h TOOLTEST h5stat_help2.ddl --help # Test when h5stat a file that does not exist TOOLTEST h5stat_notexist.ddl notexist.h5 +TOOLTEST h5stat_nofile.ddl '' # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 @@ -229,6 +252,47 @@ TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5 TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5 TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5 TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5 +# +# Tests for -l (--links) option on h5stat_threshold.h5: +# -l 0 (incorrect threshold value) +# -g -l 8 +# --links=8 +# --links=20 -g +TOOLTEST h5stat_err1_links.ddl -l 0 h5stat_threshold.h5 +TOOLTEST h5stat_links1.ddl -g -l 8 h5stat_threshold.h5 +TOOLTEST h5stat_links2.ddl --links=8 h5stat_threshold.h5 +TOOLTEST h5stat_links3.ddl --links=20 -g h5stat_threshold.h5 +# +# Tests for -l (--links) option on h5stat_newgrat.h5: +# -g +# -g -l 40000 +TOOLTEST h5stat_links4.ddl -g h5stat_newgrat.h5 +TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5 +# +# Tests for -m (--dims) option on h5stat_threshold.h5 +# -d --dims=-1 (incorrect threshold value) +# -gd -m 5 +# -d --di=15 +TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5 +TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5 +TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5 +# +# Tests for -a option on h5stat_threshold.h5 +# -a -2 (incorrect threshold value) +# --numattrs (without threshold value) +# -AS -a 10 +# -a 1 +# -A --numattrs=25 +TOOLTEST h5stat_err1_numattrs.ddl -a -2 h5stat_threshold.h5 +TOOLTEST h5stat_err2_numattrs.ddl --numattrs h5stat_threshold.h5 +TOOLTEST h5stat_numattrs1.ddl -AS -a 10 h5stat_threshold.h5 +TOOLTEST h5stat_numattrs2.ddl -a 1 h5stat_threshold.h5 +TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5 +# +# Tests for -a option on h5stat_newgrat.h5 +# -A -a 100 +TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5 +# if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 3e9c43e..d229eec 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -36,10 +36,11 @@ hid_t H5tools_ERR_CLS_g = -1; hid_t H5E_tools_g = -1; hid_t H5E_tools_min_id_g = -1; int compound_data; -FILE *rawattrstream; /* should initialize to stdout but gcc moans about it */ -FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ -FILE *rawoutstream; /* should initialize to stdout but gcc moans about it */ -FILE *rawerrorstream; /* should initialize to stderr but gcc moans about it */ +FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */ +FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */ int bin_output; /* binary output */ int bin_form; /* binary form */ int region_output; /* region output */ @@ -120,6 +121,8 @@ h5tools_init(void) rawattrstream = stdout; if (!rawdatastream) rawdatastream = stdout; + if (!rawinstream) + rawinstream = stdin; if (!rawoutstream) rawoutstream = stdout; if (!rawerrorstream) @@ -172,6 +175,12 @@ h5tools_close(void) else rawdatastream = NULL; } + if (rawinstream && rawinstream != stdin) { + if (fclose(rawinstream)) + perror("closing rawinstream"); + else + rawinstream = NULL; + } if (rawoutstream && rawoutstream != stdout) { if (fclose(rawoutstream)) perror("closing rawoutstream"); @@ -198,6 +207,254 @@ h5tools_close(void) } /*------------------------------------------------------------------------- + * Function: h5tools_set_data_output_file + * + * Purpose: Open fname as the output file for dataset raw data. + * Set rawdatastream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + * Programmer: Albert Cheng, 2000/09/30 + * + * Modifications: + * pvn June, 1, 2006. Add a switch for binary output + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_data_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawdatastream is changed only when succeeded */ + + if (rawdatastream && rawdatastream != stdout) { + if (HDfclose(rawdatastream)) + HDperror("closing rawdatastream"); + else + rawdatastream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } + } + } + else { + rawdatastream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_attr_output_file + * + * Purpose: Open fname as the output file for attribute raw data. + * Set rawattrstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_attr_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawattrstream is changed only when succeeded */ + + if (rawattrstream && rawattrstream != stdout) { + if (HDfclose(rawattrstream)) + HDperror("closing rawattrstream"); + else + rawattrstream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawattrstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawattrstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawattrstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_input_file + * + * Purpose: Open fname as the input file for raw input. + * Set rawinstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_input_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawinstream is changed only when succeeded */ + + if (rawinstream && rawinstream != stdin) { + if (HDfclose(rawinstream)) + HDperror("closing rawinstream"); + else + rawinstream = NULL; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "rb")) != NULL) { + rawinstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "r")) != NULL) { + rawinstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawinstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_output_file + * + * Purpose: Open fname as the output file for raw output. + * Set rawoutstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + HDperror("closing rawoutstream"); + else + rawoutstream = NULL; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawoutstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawoutstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_error_file + * + * Purpose: Open fname as the error output file for dataset raw error. + * Set rawerrorstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_error_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawerrorstream is changed only when succeeded */ + + if (rawerrorstream && rawerrorstream != stderr) { + if (HDfclose(rawerrorstream)) + HDperror("closing rawerrorstream"); + else + rawerrorstream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawerrorstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawerrorstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawerrorstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- * Audience: Private * Chapter: H5Tools Library * Purpose: Get a FAPL for a driver @@ -1468,7 +1725,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -static int +int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index efadba4..ea6a44f 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -532,6 +532,7 @@ H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ +H5TOOLS_DLLVAR FILE *rawinstream; /* input stream for raw input */ H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */ H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */ H5TOOLS_DLLVAR int bin_output; /* binary output */ @@ -549,6 +550,11 @@ H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */ /* Definitions of useful routines */ H5TOOLS_DLL void h5tools_init(void); H5TOOLS_DLL void h5tools_close(void); +H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin); H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, char *drivername, size_t drivername_len); H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); @@ -568,8 +574,6 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); -H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index b735b18..3a4864e 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index e8d6d84..e8df31c 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 06c5613..c27e0ce 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index ffd9910..58c0e05 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index a54812b..8a93cbc 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index 1a8dd11..21c5af4 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index 7527131..52d901d 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 21b573d..82b6c88 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -1,35 +1,45 @@ usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit + -V, --version Print version number and exit +--------------- Formatting Options --------------- + -e, --escape Escape non printing characters + -r, --string Print 1-byte integer datasets as ASCII + -y, --noindex Do not print array indices with the data + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in dataset names. + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. +--------------- File Options --------------- -n, --contents Print a list of the file contents and exit Optional value 1 also prints attributes. -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - Optional value 0 suppresses printing attributes. - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit + -f D, --filedriver=D Specify which driver to open the file with + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display +--------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the slash with a preceding backslash (\). (See example section below.) -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with -g P, --group=P Print the specified group and all members -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z + -A, --onlyattr Print the header and value of attributes + Optional value 0 suppresses printing attributes. +--------------- Object Property Options --------------- + -i, --object-ids Print the object ids + -p, --properties Print dataset filters, storage layout and fill value -M L, --packedbits=L Print packed bits as unsigned integers, using mask format L for an integer dataset specified with option -d. L is a list of offset,length values, @@ -37,19 +47,15 @@ usage: h5dump [OPTIONS] files the data value and length is the number of bits of the mask. -R, --region Print dataset pointed by region references +--------------- XML Options --------------- -x, --xml Output in XML using Schema -u, --use-dtd Output in XML using DTD -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - --no-compact-subset Disable compact form of subsetting and allow the use - of "[" in dataset names. - -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display +--------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. @@ -65,6 +71,7 @@ usage: h5dump [OPTIONS] files number of dimensions in the dataspace being queried (Alternate compact form of subsetting is described in the Reference Manual) +--------------- Option Argument Conventions --------------- D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without the file driver flag, the file will be opened with each driver in @@ -93,7 +100,7 @@ usage: h5dump [OPTIONS] files Q - is the sort index type. It can be "creation_order" or "name" (default) Z - is the sort order type. It can be "descending" or "ascending" (default) - Examples: +--------------- Examples --------------- 1) Attribute foo of the group /bar_none in file quux.h5 diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 7085a06..f7d42b0 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.156" +#define H5_PACKAGE_STRING "HDF5 1.9.161" /* 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.156" +#define H5_PACKAGE_VERSION "1.9.161" /* 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.156" +#define H5_VERSION "1.9.161" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ |