From 70b46a1d89e7f9f4a82748a9e1cc21fb4f121ebe Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 31 Jul 2006 11:04:31 -0500 Subject: [svn-r12518] h5dump binary output: 1. changed the -F flag option names to "BE and "LE" for big and little endian 2. added a more verbose usage message for these options 3. add a new test 4. add a make clean instruction to *.bin --- MANIFEST | 3 ++- tools/h5dump/Makefile.am | 2 +- tools/h5dump/Makefile.in | 2 +- tools/h5dump/h5dump.c | 9 ++++++--- tools/h5dump/testh5dump.sh.in | 5 +++-- tools/lib/h5tools.c | 1 - tools/testfiles/tbin.ddl | 11 ----------- tools/testfiles/tbin1.ddl | 11 +++++++++++ tools/testfiles/tbin3.ddl | 2 +- tools/testfiles/tbin4.ddl | 11 +++++++++++ tools/testfiles/tnofilename.ddl | 5 ++++- 11 files changed, 40 insertions(+), 22 deletions(-) delete mode 100644 tools/testfiles/tbin.ddl create mode 100644 tools/testfiles/tbin1.ddl create mode 100644 tools/testfiles/tbin4.ddl diff --git a/MANIFEST b/MANIFEST index 9eb0dc0..1127c94 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1089,9 +1089,10 @@ ./tools/testfiles/tvms.ddl ./tools/testfiles/tldouble.h5 ./tools/testfiles/tvms.h5 -./tools/testfiles/tbin.ddl +./tools/testfiles/tbin1.ddl ./tools/testfiles/tbin2.ddl ./tools/testfiles/tbin3.ddl +./tools/testfiles/tbin4.ddl # Expected output from h5ls tests diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index 94a6d73..400be5c 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -38,7 +38,7 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5) # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 +CHECK_CLEANFILES+=*.h5 *.bin DISTCLEANFILES=testh5dump.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 3c78e7e..658b023 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -335,7 +335,7 @@ TRACE = perl $(top_srcdir)/bin/trace # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 +CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.bin # Include files in /src directory and /tools/lib directory INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 5b5df95..4bd388a 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -598,7 +598,10 @@ usage(const char *prog) fprintf(stdout, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); fprintf(stdout, " -o F, --output=F Output raw data into file F\n"); fprintf(stdout, " -b F Output raw data into file F in binary form (use with -d)\n"); - fprintf(stdout, " -F T Form of binary output (T can be NA for native type, DI for the disk file type, LI or BI for pre-existing little or big endian types)\n"); + fprintf(stdout, " -F T Form of binary output (T can be NA for native type,\n"); + fprintf(stdout, " DI for the disk file type, LE or BE for pre-existing little or big endian types)\n"); + fprintf(stdout, " E.g., to dump a dataset called 'integer' in a file called `test1.h5', use\n"); + fprintf(stdout, " h5dump -b bin.out -F LE -d integer test1.h5\n"); fprintf(stdout, " -t P, --datatype=P Print the specified named data type\n"); fprintf(stdout, " -w N, --width=N Set the number of columns of output\n"); fprintf(stdout, " -x, --xml Output in XML using Schema\n"); @@ -2725,9 +2728,9 @@ set_binary_form(const char *form) bform = 0; else if (strcmp(form,"DI")==0) /* file type form */ bform = 1; - else if (strcmp(form,"LI")==0) /* convert to little endian */ + else if (strcmp(form,"LE")==0) /* convert to little endian */ bform = 2; - else if (strcmp(form,"BI")==0) /* convert to big endian */ + else if (strcmp(form,"BE")==0) /* convert to big endian */ bform = 3; diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 81bcab8..783634c 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -321,9 +321,10 @@ TOOLTEST tlonglinks.ddl tlonglinks.h5 TOOLTEST tvms.ddl tvms.h5 # test for binary output -TOOLTEST tbin.ddl -d integer -b out.bin test1.h5 +TOOLTEST tbin1.ddl -d integer -b out1.bin test1.h5 TOOLTEST tbin2.ddl -d integer -b out2.bin -F DI test1.h5 -TOOLTEST tbin3.ddl -d integer -b out3.bin -F LI test1.h5 +TOOLTEST tbin3.ddl -d integer -b out3.bin -F LE test1.h5 +TOOLTEST tbin4.ddl -d integer -b out4.bin -F BE test1.h5 if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a3cb2a8..a4ccf63 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1736,7 +1736,6 @@ int render_bin_output(FILE *stream, hid_t tid, void *_mem) } else { - /* all other types get printed as hexadecimal */ size_t i; if (1==size) { diff --git a/tools/testfiles/tbin.ddl b/tools/testfiles/tbin.ddl deleted file mode 100644 index 0ffebb8..0000000 --- a/tools/testfiles/tbin.ddl +++ /dev/null @@ -1,11 +0,0 @@ -############################# -Expected output for 'h5dump -d integer -b out.bin test1.h5' -############################# -HDF5 "test1.h5" { -DATASET "integer" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 2 ) / ( 2 ) } - DATA { - } -} -} diff --git a/tools/testfiles/tbin1.ddl b/tools/testfiles/tbin1.ddl new file mode 100644 index 0000000..6b7a155 --- /dev/null +++ b/tools/testfiles/tbin1.ddl @@ -0,0 +1,11 @@ +############################# +Expected output for 'h5dump -d integer -b out1.bin test1.h5' +############################# +HDF5 "test1.h5" { +DATASET "integer" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } + DATA { + } +} +} diff --git a/tools/testfiles/tbin3.ddl b/tools/testfiles/tbin3.ddl index 2571f4b..cbc2660 100644 --- a/tools/testfiles/tbin3.ddl +++ b/tools/testfiles/tbin3.ddl @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5dump -d integer -b out3.bin -F LI test1.h5' +Expected output for 'h5dump -d integer -b out3.bin -F LE test1.h5' ############################# HDF5 "test1.h5" { DATASET "integer" { diff --git a/tools/testfiles/tbin4.ddl b/tools/testfiles/tbin4.ddl new file mode 100644 index 0000000..3091874 --- /dev/null +++ b/tools/testfiles/tbin4.ddl @@ -0,0 +1,11 @@ +############################# +Expected output for 'h5dump -d integer -b out4.bin -F BE test1.h5' +############################# +HDF5 "test1.h5" { +DATASET "integer" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } + DATA { + } +} +} diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index f18b8d5..85aae8a 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -21,7 +21,10 @@ usage: h5dump [OPTIONS] file -l P, --soft-link=P Print the value(s) of the specified soft link -o F, --output=F Output raw data into file F -b F Output raw data into file F in binary form (use with -d) - -F T Form of binary output (T can be NA for native type, DI for the disk file type, LI or BI for pre-existing little or big endian types) + -F T Form of binary output (T can be NA for native type, + DI for the disk file type, LE or BE for pre-existing little or big endian types) + E.g., to dump a dataset called 'integer' in a file called `test1.h5', use + h5dump -b bin.out -F LE -d integer test1.h5 -t P, --datatype=P Print the specified named data type -w N, --width=N Set the number of columns of output -x, --xml Output in XML using Schema -- cgit v0.12