summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-06-28 19:34:08 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-06-28 19:34:08 (GMT)
commit7637b679337e4f8e6b260f6f94477ebd65622b5e (patch)
tree6b325ae157cb6c4110c46aa9d81384de6372cf24 /tools/h5dump
parent95a106f9fd78ce39ece6fef5e44de540b6bcd7a1 (diff)
downloadhdf5-7637b679337e4f8e6b260f6f94477ebd65622b5e.zip
hdf5-7637b679337e4f8e6b260f6f94477ebd65622b5e.tar.gz
hdf5-7637b679337e4f8e6b260f6f94477ebd65622b5e.tar.bz2
[svn-r12444] Purpose:
new feature Description: added support for h5dump to dump binary data using the file type format added one test to the test script that tests this Solution: Platforms tested: mir shanti copper Misc. update:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c53
-rw-r--r--tools/h5dump/testh5dump.sh.in3
2 files changed, 49 insertions, 7 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 7bf0ba3..ca21773 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -52,13 +52,10 @@ const char *progname = "h5dump";
int d_status = EXIT_SUCCESS;
static int unamedtype = 0; /* shared data type with no name */
-static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
-
+static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
static size_t prefix_len = 1024;
-static char *prefix;
-
-static const char *driver = NULL; /* The driver to open the file with. */
-
+static char *prefix;
+static const char *driver = NULL; /* The driver to open the file with. */
static const h5dump_header_t *dump_header_format;
/* things to display or which are set via command line parameters */
@@ -351,7 +348,7 @@ struct handler_t {
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b:s:S:A";
+static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b:F:s:S:A";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
@@ -601,6 +598,7 @@ 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 or DI for the disk file type)\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");
@@ -2702,6 +2700,35 @@ set_output_file(const char *fname, int is_bin)
return -1;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: set_binary_form
+ *
+ * Purpose:
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente Nunes
+ * June 28, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+set_binary_form(const char *form)
+{
+ int bform=-1;
+
+ if (strcmp(form,"NA")==0) /* native form */
+ bform = 0;
+ else if (strcmp(form,"DI")==0) /* file type form */
+ bform = 1;
+
+ return bform;
+}
+
/*-------------------------------------------------------------------------
* Function: handle_attributes
*
@@ -3276,6 +3303,16 @@ parse_start:
last_was_dset = FALSE;
break;
+ case 'F':
+ if ( ( bin_form = set_binary_form(opt_arg)) < 0){
+ /* failed to set binary form */
+ usage(progname);
+ leave(EXIT_FAILURE);
+ }
+
+ last_was_dset = FALSE;
+ break;
+
/** begin XML parameters **/
case 'x':
/* select XML output */
@@ -6051,3 +6088,5 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
HDstrcat(HDstrcat(*prfx, "/"), name);
} /* end add_prefix */
+
+
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index f390110..1505b9f 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -323,6 +323,9 @@ TOOLTEST tvms.ddl tvms.h5
# test for binary output
TOOLTEST tbin.ddl -d integer -b out.bin test1.h5
+# test for binary output using a file type form -F DI
+TOOLTEST tbin2.ddl -d integer -b out2.bin -F DI test1.h5
+
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."
fi