diff options
38 files changed, 562 insertions, 286 deletions
@@ -1488,6 +1488,9 @@ ./tools/testfiles/tnestedcomp.h5 ./tools/testfiles/tnestedcmpddt.ddl ./tools/testfiles/tnestedcmpddt.h5 +./tools/testfiles/tnoattrdata.ddl +./tools/testfiles/tnoattrddl.ddl +./tools/testfiles/tnodata.ddl ./tools/testfiles/tnoddl.ddl ./tools/testfiles/tnoddlfile.ddl ./tools/testfiles/tnoddlfile.exp @@ -1590,7 +1593,7 @@ ./tools/testfiles/tbigdims.h5 ./tools/testfiles/thyperslab.h5 ./tools/testfiles/twidedisplay.ddl -./tools/testfiles/twithddl.ddl +./tools/testfiles/twithddl.exp ./tools/testfiles/twithddlfile.ddl ./tools/testfiles/twithddlfile.exp @@ -1,4 +1,4 @@ -HDF5 version 1.9.141 currently under development +HDF5 version 1.9.142 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 4627828..cdd75c0 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -19,9 +19,32 @@ $DPRINT $cfgfile # Remove temporary generated files if exit 0 trap "rm -f $cminfile $cfgfile" 0 +#============= +# Function definitions +#============= +TIMESTAMP() +{ + echo "=====" "`date`" "=====" +} + + #========== # main #========== +# Show a start time stamp +TIMESTAMP + +# Explain what and where log files are. +cat <<EOF +ctest.log: output of ctest script. +Log files will be stored in Testing/Temporary: + LastConfigure_<timestamp>.log: output of configure + LastBuild_<timestamp>.log: output of build + LastTest_<timestamp>.log: output of testing + LastTestsFailed_<timestamp>.log: list of failed tests + +EOF + # First generate the two needed input files, the $cimnfile and $cfgfile. # Then use ctest to use the two input files. @@ -49,7 +72,7 @@ set (CTEST_CMAKE_GENERATOR "Unix Makefiles") set (CTEST_BUILD_CONFIGURATION "Release") # -- CDash variables -#set (LOCAL_NO_SUBMIT TRUE) +set (LOCAL_NO_SUBMIT TRUE) # No CDash submit. set (MODEL "Experimental") set (CDASH_LOCAL TRUE) set (SITE_BUILDNAME_SUFFIX "SHARED") @@ -184,13 +207,12 @@ EOF # Run ctest -date -ctest -S $cfgfile -C Release -O testhdf.log +ctest -S $cfgfile -C Release -O ctest.log exit_code=$? if [ $exit_code = 0 ]; then echo Complete without error else echo Error encountered fi -date +TIMESTAMP exit $exit_code diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 566ec2f..5e75ab1 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -459,7 +459,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 131 +LT_VERS_REVISION = 132 LT_VERS_AGE = 0 # Include src directory diff --git a/config/lt_vers.am b/config/lt_vers.am index 82d664d..5757e36 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 = 131 +LT_VERS_REVISION = 132 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.141. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.142. # # 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.141' -PACKAGE_STRING='HDF5 1.9.141' +PACKAGE_VERSION='1.9.142' +PACKAGE_STRING='HDF5 1.9.142' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1484,7 +1484,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.141 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.142 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1554,7 +1554,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.141:";; + short | recursive ) echo "Configuration of HDF5 1.9.142:";; esac cat <<\_ACEOF @@ -1750,7 +1750,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.141 +HDF5 configure 1.9.142 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2844,7 +2844,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.141, which was +It was created by HDF5 $as_me 1.9.142, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3676,7 +3676,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.141' + VERSION='1.9.142' cat >>confdefs.h <<_ACEOF @@ -31723,7 +31723,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.141, which was +This file was extended by HDF5 $as_me 1.9.142, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31789,7 +31789,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.141 +HDF5 config.status 1.9.142 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -34562,7 +34562,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.141 +HDF5 config.lt 1.9.142 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. diff --git a/configure.ac b/configure.ac index 15ecc37..1c32c43 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.141], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.142], [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 070e366..9c47c1d 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -507,7 +507,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 = 131 +LT_VERS_REVISION = 132 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 2086025..436b6aa 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -450,7 +450,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 = 131 +LT_VERS_REVISION = 132 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 2d84aad..22580bb 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -464,7 +464,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 = 131 +LT_VERS_REVISION = 132 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/Makefile.in b/hl/src/Makefile.in index 7df4d8f..56ce333 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -449,7 +449,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 = 131 +LT_VERS_REVISION = 132 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 146f3e2..883a300 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.141 currently under development +HDF5 version 1.9.142 currently under development ================================================================================ @@ -42,6 +42,9 @@ New Features Configuration: ------------- - CMake minimum is now 2.8.10. (ADB 2013/1/14) + - A new tool, cmakehdf5, which is a build command script similar to + buildhdf5 is added and is available in the bin directory. + (AKC - 2012/12/12) - Fixed AIX Fortran compiler flags to use appropriate settings for debugging, profiling, optimization situations. HDFFV-8069. (AKC 2012/09/27) diff --git a/src/H5Dio.c b/src/H5Dio.c index e61205e..e08e079 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -252,9 +252,9 @@ H5D__pre_write(H5D_t *dset, hid_t mem_type_id, const H5S_t *mem_space, if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* Get the dataset transfer property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &direct_write) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting flag for direct chunk write") diff --git a/src/H5public.h b/src/H5public.h index 793d4df..bd9d859 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 141 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 142 /* 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.141" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.142" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index c9b6e3b..9dff326 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -514,7 +514,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 = 131 +LT_VERS_REVISION = 132 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 28b40b4..1d0012e 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -140,6 +140,9 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcmpddt.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnbit.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoattrdata.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoattrddl.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnodata.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoddl.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tno-subset.ddl @@ -188,7 +191,6 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvms.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/twidedisplay.ddl - ${HDF5_TOOLS_SRC_DIR}/testfiles/twithddl.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/twithddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/h5dump-help.txt ${HDF5_TOOLS_SRC_DIR}/testfiles/out3.h5import @@ -199,6 +201,7 @@ IF (BUILD_TESTING) trawdatafile.exp tstr2bin2.exp tstr2bin6.exp + twithddl.exp twithddlfile.exp ) SET (HDF5_REFERENCE_TEST_FILES @@ -1139,6 +1142,12 @@ IF (BUILD_TESTING) tnestedcmpddt.out.err tnbit.out tnbit.out.err + tnoattrdata.out + tnoattrdata.out.err + tnoattrddl.out + tnoattrddl.out.err + tnodata.out + tnodata.out.err tnoddl.out tnoddl.out.err tnoddlfile.out @@ -1253,9 +1262,12 @@ IF (BUILD_TESTING) ADD_HELP_TEST(help 0 -h) # test data output redirection - ADD_H5_TEST (tnoddl 0 --enable-error-stack --redirect-ddl=NULL -y packedbits.h5) + ADD_H5_TEST (tnoddl 0 --enable-error-stack --ddl=NULL -y packedbits.h5) + ADD_H5_TEST (tnodata 0 --enable-error-stack --output=NULL packedbits.h5) + ADD_H5_TEST (tnoattrddl 0 --enable-error-stack --ddl=NULL -y tattr.h5) + ADD_H5_TEST (tnoattrdata 0 --enable-error-stack -A --output=NULL tattr.h5) ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o) - ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack --redirect-ddl=NULL -y -o) + ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack --ddl=NULL -y -o) ADD_TEST ( NAME H5DUMP-clear-twithddlfile-export COMMAND ${CMAKE_COMMAND} @@ -1266,11 +1278,11 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5DUMP-clear-twithddlfile-export PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") SET (last_test "H5DUMP-clear-twithddlfile-export") - ADD_H5_TEST_EXPORT (twithddlfile packedbits.h5 0 --enable-error-stack --redirect-ddl=twithddl.txt -y -o) + ADD_H5_TEST_EXPORT (twithddlfile packedbits.h5 0 --enable-error-stack --ddl=twithddl.txt -y -o) ADD_TEST ( NAME H5DUMP-output-cmp-meta-twithddlfile COMMAND ${CMAKE_COMMAND} - -E compare_files twithddl.txt twithddl.ddl + -E compare_files twithddl.txt twithddl.exp ) SET_TESTS_PROPERTIES (H5DUMP-output-cmp-meta-twithddlfile PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") IF (NOT "${last_test}" STREQUAL "") diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 34b8bc4..0d667df 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RECM:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RECM:O:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -187,6 +187,7 @@ static struct long_options l_opts[] = { { "enable-error-stack", no_arg, 'E' }, { "packed-bits", require_arg, 'M' }, { "no-compact-subset", no_arg, 'C' }, + { "ddl", require_arg, 'O' }, { NULL, 0, '\0' } }; @@ -230,39 +231,39 @@ leave(int ret) static void usage(const char *prog) { - HDfflush(rawoutstream); - HDfprintf(rawoutstream, "usage: %s [OPTIONS] files\n", prog); - HDfprintf(rawoutstream, " OPTIONS\n"); - HDfprintf(rawoutstream, " -h, --help Print a usage message and exit\n"); - HDfprintf(rawoutstream, " -n, --contents Print a list of the file contents and exit\n"); - HDfprintf(rawoutstream, " Optional value 1 also prints attributes.\n"); - HDfprintf(rawoutstream, " -B, --superblock Print the content of the super block\n"); - HDfprintf(rawoutstream, " -H, --header Print the header only; no data is displayed\n"); - HDfprintf(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); - HDfprintf(rawoutstream, " -i, --object-ids Print the object ids\n"); - HDfprintf(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); - HDfprintf(rawoutstream, " -e, --escape Escape non printing characters\n"); - HDfprintf(rawoutstream, " -V, --version Print version number and exit\n"); - HDfprintf(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); - HDfprintf(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); - HDfprintf(rawoutstream, " slash with a preceding backslash (\\).\n"); - HDfprintf(rawoutstream, " (See example section below.)\n"); - HDfprintf(rawoutstream, " -d P, --dataset=P Print the specified dataset\n"); - HDfprintf(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); - HDfprintf(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); - HDfprintf(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n"); - HDfprintf(rawoutstream, " -g P, --group=P Print the specified group and all members\n"); - HDfprintf(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); - HDfprintf(rawoutstream, " -o F, --output=F Output raw data into file F\n"); - HDfprintf(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); - HDfprintf(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n"); - HDfprintf(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); - HDfprintf(rawoutstream, " sets the number of columns to the maximum (65535).\n"); - HDfprintf(rawoutstream, " Default width is 80 columns.\n"); - HDfprintf(rawoutstream, " -m T, --format=T Set the floating point output format\n"); - HDfprintf(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); - HDfprintf(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); - HDfprintf(rawoutstream, + FLUSHSTREAM(rawoutstream); + 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, " -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, " -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, " -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" @@ -270,92 +271,94 @@ usage(const char *prog) " the data value and length is the number of bits of\n" " the mask.\n" ); - HDfprintf(rawoutstream, " -R, --region Print dataset pointed by region references\n"); - HDfprintf(rawoutstream, " -x, --xml Output in XML using Schema\n"); - HDfprintf(rawoutstream, " -u, --use-dtd Output in XML using DTD\n"); - HDfprintf(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); - HDfprintf(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); - HDfprintf(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n"); - HDfprintf(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n"); - HDfprintf(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - HDfprintf(rawoutstream, " occur.\n"); - HDfprintf(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); - HDfprintf(rawoutstream, " of \"[\" in dataset names.\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); - HDfprintf(rawoutstream, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); - HDfprintf(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n"); - HDfprintf(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); - HDfprintf(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); - HDfprintf(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n"); - HDfprintf(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); - HDfprintf(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); - HDfprintf(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); - HDfprintf(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); - HDfprintf(rawoutstream, " number of dimensions in the dataspace being queried\n"); - HDfprintf(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n"); - HDfprintf(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); - HDfprintf(rawoutstream, " the file driver flag, the file will be opened with each driver in\n"); - HDfprintf(rawoutstream, " turn and in the order specified above until one driver succeeds\n"); - HDfprintf(rawoutstream, " in opening the file.\n"); - HDfprintf(rawoutstream, " These are the letters that are appended to the file name(without .h5) when opening\n"); - HDfprintf(rawoutstream, " names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:\n"); - HDfprintf(rawoutstream, " m: All meta data when using the split driver.\n"); - HDfprintf(rawoutstream, " s: The userblock, superblock, and driver info block\n"); - HDfprintf(rawoutstream, " b: B-tree nodes\n"); - HDfprintf(rawoutstream, " r: Dataset raw data\n"); - HDfprintf(rawoutstream, " g: Global heap\n"); - HDfprintf(rawoutstream, " l: local heap (object names)\n"); - HDfprintf(rawoutstream, " o: object headers\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " F - is a filename.\n"); - HDfprintf(rawoutstream, " P - is the full path from the root group to the object.\n"); - HDfprintf(rawoutstream, " N - is an integer greater than 1.\n"); - HDfprintf(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n"); - HDfprintf(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); - HDfprintf(rawoutstream, " updated by [IETF RFC 2732])\n"); - HDfprintf(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); - HDfprintf(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n"); - HDfprintf(rawoutstream, " Must be used with -o (output file) and it is recommended that\n"); - HDfprintf(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n"); - HDfprintf(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n"); - HDfprintf(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Examples:\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n"); - HDfprintf(rawoutstream, " using a little-endian type\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 5) Dataset foo in files file1.h5 file2.h5 file3.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo file1.h5 file2.h5 file3.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo -f split splitfile\n"); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\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, " Use NULL as filename to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, "\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"); + PRINTVALSTREAM(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); + PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n"); + PRINTVALSTREAM(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); + PRINTVALSTREAM(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); + PRINTVALSTREAM(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); + PRINTVALSTREAM(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); + 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, " 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"); + PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n"); + PRINTVALSTREAM(rawoutstream, " in opening the file.\n"); + PRINTVALSTREAM(rawoutstream, " These are the letters that are appended to the file name(without .h5) when opening\n"); + PRINTVALSTREAM(rawoutstream, " names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:\n"); + PRINTVALSTREAM(rawoutstream, " m: All meta data when using the split driver.\n"); + PRINTVALSTREAM(rawoutstream, " s: The userblock, superblock, and driver info block\n"); + PRINTVALSTREAM(rawoutstream, " b: B-tree nodes\n"); + PRINTVALSTREAM(rawoutstream, " r: Dataset raw data\n"); + PRINTVALSTREAM(rawoutstream, " g: Global heap\n"); + PRINTVALSTREAM(rawoutstream, " l: local heap (object names)\n"); + PRINTVALSTREAM(rawoutstream, " o: object headers\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " F - is a filename.\n"); + PRINTVALSTREAM(rawoutstream, " P - is the full path from the root group to the object.\n"); + PRINTVALSTREAM(rawoutstream, " N - is an integer greater than 1.\n"); + PRINTVALSTREAM(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n"); + PRINTVALSTREAM(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); + PRINTVALSTREAM(rawoutstream, " updated by [IETF RFC 2732])\n"); + PRINTVALSTREAM(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); + PRINTVALSTREAM(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n"); + PRINTVALSTREAM(rawoutstream, " Must be used with -o (output file) and it is recommended that\n"); + PRINTVALSTREAM(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n"); + 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, "\n"); + PRINTVALSTREAM(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n"); + PRINTVALSTREAM(rawoutstream, " using a little-endian type\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " 5) Dataset foo in files file1.h5 file2.h5 file3.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -d /foo file1.h5 file2.h5 file3.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f split splitfile\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } @@ -500,6 +503,7 @@ table_list_free(void) 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 */ @@ -510,21 +514,68 @@ set_data_output_file(const char *fname, int is_bin) rawdatastream = NULL; } - /* binary output */ - if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { - rawdatastream = f; - return 0; + /* First check if filename is string "NULL" */ + if (HDstrcmp(fname, "NULL") == 0) { + rawdatastream = NULL; + retvalue = SUCCEED; + } + else { + /* 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; + } } } + + 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 (HDstrcmp(fname, "NULL") == 0) { + rawattrstream = NULL; + retvalue = SUCCEED; + } else { if ((f = HDfopen(fname, "w")) != NULL) { - rawdatastream = f; - return 0; + rawattrstream = f; + retvalue = SUCCEED; } } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -541,6 +592,7 @@ set_data_output_file(const char *fname, int is_bin) 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 */ @@ -550,13 +602,17 @@ set_output_file(const char *fname) else rawoutstream = NULL; } - - if ((f = HDfopen(fname, "w")) != NULL) { + /* First check if filename is string "NULL" */ + if (HDstrcmp(fname, "NULL") == 0) { + rawoutstream = NULL; + retvalue = SUCCEED; + } + else if ((f = HDfopen(fname, "w")) != NULL) { rawoutstream = f; - return 0; + retvalue = SUCCEED; } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -573,6 +629,7 @@ set_output_file(const char *fname) 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 */ @@ -585,10 +642,10 @@ set_error_file(const char *fname) if ((f = HDfopen(fname, "w")) != NULL) { rawerrorstream = f; - return 0; + retvalue = SUCCEED; } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -1125,6 +1182,13 @@ parse_start: last_was_dset = FALSE; break; + case 'O': + if (set_output_file(opt_arg) < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; + case 'o': if ( bin_output ) { if (set_data_output_file(opt_arg, 1) < 0) { @@ -1133,9 +1197,17 @@ parse_start: } } else { - if (set_data_output_file(opt_arg, 0) < 0) { - usage(h5tools_getprogname()); - goto error; + if(display_attr_data && !display_data) { + if (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) { + usage(h5tools_getprogname()); + goto error; + } } } @@ -1558,12 +1630,12 @@ main(int argc, const char *argv[]) begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); } else { - HDfprintf(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); /* alternative first element, depending on schema or DTD. */ if (useschema) { if (HDstrcmp(xmlnsprefix,"") == 0) { - HDfprintf(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", + PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri); } else { @@ -1575,7 +1647,7 @@ main(int argc, const char *argv[]) indx = HDstrrchr(ns,(int)':'); if (indx) *indx = '\0'; - HDfprintf(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " + PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); @@ -1583,17 +1655,17 @@ main(int argc, const char *argv[]) } } else { - HDfprintf(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri); - HDfprintf(rawoutstream, "<HDF5-File>\n"); + PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri); + PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n"); } } if (!doxml) { if (display_fi) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); dump_fcontents(fid); end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); goto done; } @@ -1612,7 +1684,7 @@ main(int argc, const char *argv[]) dump_function_table->dump_group_function(gid, "/" ); if (!doxml) dump_indent -= COL; - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } if(H5Gclose(gid) < 0) { @@ -1634,15 +1706,15 @@ main(int argc, const char *argv[]) hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); } } - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } if (!doxml) { end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } else { - HDfprintf(rawoutstream, "</%sHDF5-File>\n", xmlnsprefix); + PRINTSTREAM(rawoutstream, "</%sHDF5-File>\n", xmlnsprefix); } /* Free tables for objects */ table_list_free(); diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 6f5fd3f..c4a9ecb 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1168,23 +1168,23 @@ dump_fcpl(hid_t fid) * SUPER_BLOCK *------------------------------------------------------------------------- */ - HDfprintf(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); + PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); + PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version); + PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ + PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); + PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + PRINTSTREAM(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); indentation(dump_indent + COL); - HDfprintf(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + PRINTSTREAM(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); + PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); + PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); #ifdef SHOW_FILE_DRIVER if (H5FD_CORE==fdriver) @@ -1215,37 +1215,42 @@ dump_fcpl(hid_t fid) /* Take out this because the driver used can be different from the * standard output. */ /*indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ + PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ #endif indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); + PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); indentation(dump_indent + COL); - if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); - else if(fs_strategy == H5F_FILE_SPACE_ALL) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); - else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); - else if(fs_strategy == H5F_FILE_SPACE_VFD) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); - else - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) { + PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); + } + else if(fs_strategy == H5F_FILE_SPACE_ALL) { + PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); + } + else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) { + PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); + } + else if(fs_strategy == H5F_FILE_SPACE_VFD) { + PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); + } + else { + PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + } indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); + PRINTSTREAM(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); /*------------------------------------------------------------------------- * USER_BLOCK *------------------------------------------------------------------------- */ indentation(dump_indent + COL); - HDfprintf(rawoutstream, "USER_BLOCK %s\n",BEGIN); + PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN); indentation(dump_indent + COL + COL); - HDfprintf(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); + PRINTSTREAM(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s\n",END); + PRINTSTREAM(rawoutstream, "%s\n",END); - HDfprintf(rawoutstream, "%s",END); + PRINTSTREAM(rawoutstream, "%s",END); } /*------------------------------------------------------------------------- @@ -1264,7 +1269,7 @@ dump_fcpl(hid_t fid) void dump_fcontents(hid_t fid) { - HDfprintf(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); + PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); /* special case of unamed types in root group */ if (unamedtype) { @@ -1272,14 +1277,14 @@ dump_fcontents(hid_t fid) for (u = 0; u < type_table->nobjs; u++) { if (!type_table->objs[u].recorded) - HDfprintf(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); } } /* print objects in the files */ h5trav_print(fid); - HDfprintf(rawoutstream, " %s\n",END); + PRINTSTREAM(rawoutstream, " %s\n",END); } /*------------------------------------------------------------------------- @@ -1564,12 +1569,12 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if(found_obj) { if (found_obj->displayed) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(dump_indent); begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); + PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); } @@ -1621,9 +1626,9 @@ handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const cha if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { if (pe) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); error_msg("unable to open group \"%s\"\n", real_name); end_obj(h5tools_dump_header_format->groupend, h5tools_dump_header_format->groupblockend); @@ -1678,15 +1683,15 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co } else { char *buf = (char *)HDmalloc(linfo.u.val_size); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); switch(linfo.type) { case H5L_TYPE_SOFT: /* Soft link */ begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) - HDfprintf(rawoutstream, "LINKTARGET \"%s\"\n", buf); + PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf); else { error_msg("h5dump error: unable to get link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); @@ -1696,21 +1701,21 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co case H5L_TYPE_EXTERNAL: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { const char *elink_file; const char *elink_path; if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { indentation(COL); - HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); indentation(COL); - HDfprintf(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); + PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); - HDfprintf(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); + PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); @@ -1726,12 +1731,12 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co default: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); - HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); break; } /* end switch */ @@ -1785,9 +1790,9 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const if(idx == type_table->nobjs) { if (pe) { /* unknown type */ - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); error_msg("unable to open datatype \"%s\"\n", real_name); end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend); diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h index 4af5360..66d73e3 100644 --- a/tools/h5dump/h5dump_defines.h +++ b/tools/h5dump/h5dump_defines.h @@ -26,20 +26,20 @@ #define begin_obj(obj,name,begin) \ do { \ if (name) \ - HDfprintf(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ + PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ else \ - HDfprintf(rawoutstream, "%s %s", (obj), (begin)); \ + PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \ } while(0); #define end_obj(obj,end) \ do { \ if(HDstrlen(end)) { \ - HDfprintf(rawoutstream, "%s", end); \ + PRINTSTREAM(rawoutstream, "%s", end); \ if(HDstrlen(obj)) \ - HDfprintf(rawoutstream, " "); \ + PRINTVALSTREAM(rawoutstream, " "); \ } \ if(HDstrlen(obj)) \ - HDfprintf(rawoutstream, "%s", obj); \ + PRINTSTREAM(rawoutstream, "%s", obj); \ } while(0); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 88ec698..c766b51 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -31,7 +31,7 @@ H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary -CMP='cmp -s' +CMP='diff -b' # Compares without end of file newlines DIFF='diff -c' CP='cp' DIRNAME='dirname' @@ -261,6 +261,9 @@ $SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.ddl $SRC_H5DUMP_TESTFILES/tnestcomp-1.ddl $SRC_H5DUMP_TESTFILES/tnestedcmpddt.ddl $SRC_H5DUMP_TESTFILES/tnbit.ddl +$SRC_H5DUMP_TESTFILES/tnoattrdata.ddl +$SRC_H5DUMP_TESTFILES/tnoattrddl.ddl +$SRC_H5DUMP_TESTFILES/tnodata.ddl $SRC_H5DUMP_TESTFILES/tnoddl.ddl $SRC_H5DUMP_TESTFILES/tnoddlfile.ddl $SRC_H5DUMP_TESTFILES/tnoddlfile.exp @@ -313,7 +316,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes5.ddl $SRC_H5DUMP_TESTFILES/tvlstr.ddl $SRC_H5DUMP_TESTFILES/tvms.ddl $SRC_H5DUMP_TESTFILES/twidedisplay.ddl -$SRC_H5DUMP_TESTFILES/twithddl.ddl +$SRC_H5DUMP_TESTFILES/twithddl.exp $SRC_H5DUMP_TESTFILES/twithddlfile.ddl $SRC_H5DUMP_TESTFILES/twithddlfile.exp $SRC_H5DUMP_TESTFILES/h5dump-help.txt @@ -507,7 +510,7 @@ TOOLTEST2A() { actual_err="$TESTDIR/`basename $1 .exp`.err" shift expectmeta="$TESTDIR/$1" - actualmeta="$TESTDIR/`basename $1 .ddl`.txt" + actualmeta="$TESTDIR/`basename $1 .exp`.txt" shift # Run test. @@ -527,7 +530,7 @@ TOOLTEST2A() { # Create the expect data file if it doesn't yet exist. echo " CREATED" cp $actualdata $expectdata - elif $CMP $expectdata $actualdata; then + elif $DIFF $expectdata $actualdata; then if [ ! -f $expectmeta ]; then # Create the expect meta file if it doesn't yet exist. echo " CREATED" @@ -796,10 +799,13 @@ COPY_TESTFILES_TO_TESTDIR #TOOLTEST h5dump-help.txt -h # test data output redirection -#TOOLTEST tnoddl.ddl --enable-error-stack --ddl=NULL -y packedbits.h5 -#TOOLTEST2 trawdatafile.exp --enable-error-stack -y -o trawdatafile.txt packedbits.h5 -#TOOLTEST2 tnoddlfile.exp --enable-error-stack --ddl=NULL -y -o tnoddlfile.txt packedbits.h5 -#TOOLTEST2A twithddlfile.exp twithddl.ddl --enable-error-stack --ddl=twithddl.txt -y -o twithddlfile.txt packedbits.h5 +TOOLTEST tnoddl.ddl --enable-error-stack --ddl=NULL -y packedbits.h5 +TOOLTEST tnodata.ddl --enable-error-stack --output=NULL packedbits.h5 +TOOLTEST tnoattrddl.ddl --enable-error-stack --ddl=NULL -y tattr.h5 +TOOLTEST tnoattrdata.ddl --enable-error-stack -A --output=NULL tattr.h5 +TOOLTEST2 trawdatafile.exp --enable-error-stack -y -o trawdatafile.txt packedbits.h5 +TOOLTEST2 tnoddlfile.exp --enable-error-stack --ddl=NULL -y -o tnoddlfile.txt packedbits.h5 +TOOLTEST2A twithddlfile.exp twithddl.exp --enable-error-stack --ddl=twithddl.txt -y -o twithddlfile.txt packedbits.h5 # test for maximum display datasets TOOLTEST twidedisplay.ddl --enable-error-stack -w0 packedbits.h5 diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 0fc0531..2266480 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1453,7 +1453,7 @@ dump_dataset_values(hid_t dset) h5tools_str_close(&buffer); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } @@ -1637,7 +1637,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, } h5tools_str_close(&buffer); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); return 0; } @@ -2263,7 +2263,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } else - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } break; @@ -2749,7 +2749,7 @@ main(int argc, const char *argv[]) if(file >= 0) { if(verbose_g) - HDfprintf(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); + PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ } /* end if */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 3e29cbd..254c8b4 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -40,6 +40,7 @@ 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 */ @@ -119,6 +120,8 @@ h5tools_init(void) H5tools_ERR_STACK_g = H5Ecreate_stack(); H5TOOLS_INIT_ERROR() + if (!rawattrstream) + rawattrstream = stdout; if (!rawdatastream) rawdatastream = stdout; if (!rawoutstream) @@ -157,6 +160,12 @@ h5tools_close(void) H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); if(tools_func!=NULL) H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream); + if (rawattrstream && rawattrstream != stdout) { + if (fclose(rawattrstream)) + perror("closing rawattrstream"); + else + rawattrstream = NULL; + } if (rawdatastream && rawdatastream != stdout) { if (fclose(rawdatastream)) perror("closing rawdatastream"); @@ -573,6 +582,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, size_t templength = 0; int i, indentlevel = 0; + if (stream == NULL) + return; + if (!ctx->need_prefix) return; @@ -581,9 +593,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, /* Terminate previous line, if any */ if (ctx->cur_column) { - HDfputs(OPT(info->line_suf, ""), stream); + PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); - HDfputs(OPT(info->line_sep, ""), stream); + PUTSTREAM(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -607,23 +619,26 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } - if (elmtno == 0 && secnum == 0 && info->line_1st) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); - else if (secnum && info->line_cont) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); - else - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + if (elmtno == 0 && secnum == 0 && info->line_1st) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + } + else if (secnum && info->line_cont) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + } + else { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + } templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -662,6 +677,9 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, size_t templength = 0; int i, indentlevel = 0; + if (stream == NULL) + return; + if (!ctx->need_prefix) return; @@ -670,9 +688,9 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /* Terminate previous line, if any */ if (ctx->cur_column) { - HDfputs(OPT(info->line_suf, ""), stream); + PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); - HDfputs(OPT(info->line_sep, ""), stream); + PUTSTREAM(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -696,23 +714,26 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } - if (elmtno == 0 && secnum == 0 && info->line_1st) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); - else if (secnum && info->line_cont) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); - else - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + if (elmtno == 0 && secnum == 0 && info->line_1st) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + } + else if (secnum && info->line_cont) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + } + else { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + } templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -766,6 +787,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, int secnum; /*section sequence number */ int multiline; /*datum was multiline */ + if (stream == NULL) + return dimension_break; + s = h5tools_str_fmt(buffer, 0, "%s"); /* @@ -870,12 +894,12 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - HDfputs(OPT(info->elmt_suf2, " "), stream); + PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - HDfputs(section, stream); + PUTSTREAM(section, stream); ctx->cur_column += HDstrlen(section); } @@ -1026,12 +1050,12 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_region_simple_prefix(stream, info, ctx, local_elmt_counter, ptdata, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - HDfputs(OPT(info->elmt_suf2, " "), stream); + PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - HDfputs(section, stream); + PUTSTREAM(section, stream); ctx->cur_column += HDstrlen(section); } diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 4fbd84f..efadba4 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -36,6 +36,12 @@ #define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK +/* Stream macros */ +#define FLUSHSTREAM(S) if(S != NULL) HDfflush(S) +#define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__) +#define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V) +#define PUTSTREAM(X,S) if(S != NULL) HDfputs(X, S); + /* * Strings for output - these were duplicated from the h5dump.h * file in order to support region reference data display @@ -524,6 +530,7 @@ H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ 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 *rawoutstream; /* output stream for raw output */ H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */ diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index c68c699..f83c664 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -283,9 +283,9 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai *to the ctx->size_last_dim. */ /* binary dump */ - if (bin_output) { + if (bin_output && (rawdatastream != NULL)) { if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) { - HDfprintf(rawoutstream,"\nError in writing binary stream\n"); + PRINTVALSTREAM(rawoutstream, "\nError in writing binary stream\n"); } } /* end if */ else { @@ -1834,7 +1834,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c if (H5Sis_simple(space) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") - H5_LEAVE(h5tools_dump_simple_mem(stream, info, ctx, obj_id, type, space, mem)) + H5_LEAVE(h5tools_dump_simple_mem(rawattrstream, info, ctx, obj_id, type, space, mem)) CATCH return ret_value; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 79322bc..d45eab2 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -152,8 +152,9 @@ error_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(rawdatastream); - HDfflush(rawoutstream); + FLUSHSTREAM(rawattrstream); + FLUSHSTREAM(rawdatastream); + FLUSHSTREAM(rawoutstream); HDfprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); @@ -182,8 +183,9 @@ warn_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(rawdatastream); - HDfflush(rawoutstream); + FLUSHSTREAM(rawattrstream); + FLUSHSTREAM(rawdatastream); + FLUSHSTREAM(rawoutstream); HDfprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); HDva_end(ap); @@ -388,7 +390,7 @@ indentation(int x) { if (x < h5tools_nCols) { while (x-- > 0) - HDfprintf(rawoutstream, " "); + PRINTVALSTREAM(rawoutstream, " "); } else { HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); @@ -414,7 +416,7 @@ indentation(int x) void print_version(const char *progname) { - HDfprintf(rawoutstream, "%s: Version %u.%u.%u%s%s\n", + PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } @@ -494,9 +496,9 @@ dump_table(char* tablename, table_t *table) { unsigned u; - HDfprintf(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); + PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); for (u = 0; u < table->nobjs; u++) - HDfprintf(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, + PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, table->objs[u].objname, table->objs[u].displayed, table->objs[u].recorded); } diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 74fc104..12629c9 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tnoattrdata.ddl b/tools/testfiles/tnoattrdata.ddl new file mode 100644 index 0000000..a5d40fe --- /dev/null +++ b/tools/testfiles/tnoattrdata.ddl @@ -0,0 +1,39 @@ +HDF5 "tattr.h5" { +GROUP "/" { + ATTRIBUTE "/attr1" { + DATATYPE H5T_STD_I8BE + DATASPACE SIMPLE { ( 24 ) / ( 24 ) } + DATA { + } + } + ATTRIBUTE "attr2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + DATA { + } + } + ATTRIBUTE "attr3" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + DATA { + } + } + ATTRIBUTE "attr4" { + DATATYPE H5T_STD_I32BE + DATASPACE SCALAR + DATA { + } + } + ATTRIBUTE "attr5" { + DATATYPE H5T_STRING { + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SCALAR + DATA { + } + } +} +} diff --git a/tools/testfiles/tnoattrddl.ddl b/tools/testfiles/tnoattrddl.ddl new file mode 100644 index 0000000..c68877d --- /dev/null +++ b/tools/testfiles/tnoattrddl.ddl @@ -0,0 +1,7 @@ + + 97, 116, 116, 114, 105, 98, 117, 116, 101, 32, 111, 102, 32, 114, 111, + 111, 116, 32, 103, 114, 111, 117, 112, 0 + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 + 100 + "string attribute"
\ No newline at end of file diff --git a/tools/testfiles/twithddl.ddl b/tools/testfiles/tnodata.ddl index f99d906..f99d906 100644 --- a/tools/testfiles/twithddl.ddl +++ b/tools/testfiles/tnodata.ddl diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index 5e6f580..e8b733c 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 10b5a23..0af7386 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 17dd963..bf1ced8 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index 6d05b47..4aa79bd 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index eca1248..89a767c 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index b0c655d..2f89be6 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 213641b..e3bca0c 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files 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 + Use NULL as filename to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/twithddl.exp b/tools/testfiles/twithddl.exp new file mode 100644 index 0000000..f99d906 --- /dev/null +++ b/tools/testfiles/twithddl.exp @@ -0,0 +1,58 @@ +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } +} +} diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 021967a..a5910dd 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -505,7 +505,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.141" +#define H5_PACKAGE_STRING "HDF5 1.9.142" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -514,7 +514,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.141" +#define H5_PACKAGE_VERSION "1.9.142" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -677,7 +677,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.141" +#define H5_VERSION "1.9.142" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ |