summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-01-22 20:43:12 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-01-22 20:43:12 (GMT)
commitff421d9424233c92547e2bb649324983bf86c9dd (patch)
treed2a6cc9b0f35f5a29fc59feba2a7f937c0cf91e8
parent0b107827ece1f60ad92ee2e4799fdb4f9111faf0 (diff)
downloadhdf5-ff421d9424233c92547e2bb649324983bf86c9dd.zip
hdf5-ff421d9424233c92547e2bb649324983bf86c9dd.tar.gz
hdf5-ff421d9424233c92547e2bb649324983bf86c9dd.tar.bz2
[svn-r23190] HDFFV-8285: Add suppress ddl option.
Tested: local linux
-rw-r--r--MANIFEST3
-rw-r--r--tools/h5dump/CMakeLists.txt64
-rw-r--r--tools/h5dump/h5dump.c368
-rw-r--r--tools/h5dump/h5dump_ddl.c99
-rw-r--r--tools/h5dump/h5dump_defines.h10
-rw-r--r--tools/h5dump/testh5dump.sh.in14
-rw-r--r--tools/h5ls/h5ls.c8
-rw-r--r--tools/lib/h5tools.c72
-rw-r--r--tools/lib/h5tools.h7
-rw-r--r--tools/lib/h5tools_dump.c6
-rw-r--r--tools/lib/h5tools_utils.c18
-rw-r--r--tools/testfiles/h5dump-help.txt2
-rw-r--r--tools/testfiles/tnoattrdata.ddl39
-rw-r--r--tools/testfiles/tnoattrddl.ddl7
-rw-r--r--tools/testfiles/tnodata.ddl58
-rw-r--r--tools/testfiles/tnofilename-with-packed-bits.ddl2
-rw-r--r--tools/testfiles/tpbitsIncomplete.ddl2
-rw-r--r--tools/testfiles/tpbitsLengthExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsLengthPositive.ddl2
-rw-r--r--tools/testfiles/tpbitsMaxExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsOffsetExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsOffsetNegative.ddl2
22 files changed, 519 insertions, 270 deletions
diff --git a/MANIFEST b/MANIFEST
index eeb0895..93824d5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1480,6 +1480,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
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index c446948..321b446 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -137,11 +137,12 @@ IF (BUILD_TESTING)
#${HDF5_TOOLS_SRC_DIR}/testfiles/tqmarkfile.ddl
#${HDF5_TOOLS_SRC_DIR}/testfiles/tstarfile.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tnamed_dtype_attr.ddl
- ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp
-SET (HDF4_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
- -1.ddl
+ ${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
@@ -1141,6 +1142,12 @@ SET (HDF4_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API
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
@@ -1255,30 +1262,33 @@ SET (HDF4_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API
ADD_HELP_TEST(help 0 -h)
# test data output redirection
-# ADD_H5_TEST (tnoddl 0 --enable-error-stack --ddl=NULL -y packedbits.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 --ddl=NULL -y -o)
-# ADD_TEST (
-# NAME H5DUMP-clear-twithddlfile-export
-# COMMAND ${CMAKE_COMMAND}
-# -E remove twithddl.txt
-# )
-# SET_TESTS_PROPERTIES (H5DUMP-clear-twithddlfile-export PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
-# IF (NOT "${last_test}" STREQUAL "")
-# 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 --ddl=twithddl.txt -y -o)
-# ADD_TEST (
-# NAME H5DUMP-output-cmp-meta-twithddlfile
-# COMMAND ${CMAKE_COMMAND}
-# -E compare_files twithddl.txt twithddl.ddl
-# )
-# SET_TESTS_PROPERTIES (H5DUMP-output-cmp-meta-twithddlfile PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
-# IF (NOT "${last_test}" STREQUAL "")
-# SET_TESTS_PROPERTIES (H5DUMP-output-cmp-meta-twithddlfile PROPERTIES DEPENDS ${last_test})
-# ENDIF (NOT "${last_test}" STREQUAL "")
-# SET (last_test "H5DUMP-output-cmp-meta-twithddlfile")
+ 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 --ddl=NULL -y -o)
+ ADD_TEST (
+ NAME H5DUMP-clear-twithddlfile-export
+ COMMAND ${CMAKE_COMMAND}
+ -E remove twithddl.txt
+ )
+ SET_TESTS_PROPERTIES (H5DUMP-clear-twithddlfile-export PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ IF (NOT "${last_test}" STREQUAL "")
+ 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 --ddl=twithddl.txt -y -o)
+ ADD_TEST (
+ NAME H5DUMP-output-cmp-meta-twithddlfile
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files twithddl.txt twithddl.ddl
+ )
+ SET_TESTS_PROPERTIES (H5DUMP-output-cmp-meta-twithddlfile PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5DUMP-output-cmp-meta-twithddlfile PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5DUMP-output-cmp-meta-twithddlfile")
# test for maximum display datasets
ADD_H5_TEST (twidedisplay 0 --enable-error-stack -w0 packedbits.h5)
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..667908b 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -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
@@ -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.ddl --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/tnodata.ddl b/tools/testfiles/tnodata.ddl
new file mode 100644
index 0000000..f99d906
--- /dev/null
+++ b/tools/testfiles/tnodata.ddl
@@ -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/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.