diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-01-22 20:43:12 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-01-22 20:43:12 (GMT) |
commit | ff421d9424233c92547e2bb649324983bf86c9dd (patch) | |
tree | d2a6cc9b0f35f5a29fc59feba2a7f937c0cf91e8 /tools/h5dump | |
parent | 0b107827ece1f60ad92ee2e4799fdb4f9111faf0 (diff) | |
download | hdf5-ff421d9424233c92547e2bb649324983bf86c9dd.zip hdf5-ff421d9424233c92547e2bb649324983bf86c9dd.tar.gz hdf5-ff421d9424233c92547e2bb649324983bf86c9dd.tar.bz2 |
[svn-r23190] HDFFV-8285: Add suppress ddl option.
Tested: local linux
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 64 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 368 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 99 | ||||
-rw-r--r-- | tools/h5dump/h5dump_defines.h | 10 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 14 |
5 files changed, 324 insertions, 231 deletions
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 |