diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-07-15 15:53:17 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-07-15 15:53:17 (GMT) |
commit | f6ffaf1f69b71caf958c8d71ea1decc5ea696b03 (patch) | |
tree | bac59b0037c12d4afdf53877c4704b9c6db3a6ac /tools/h5dump | |
parent | a3a410b643b56463359732f384d215e1cb673384 (diff) | |
download | hdf5-f6ffaf1f69b71caf958c8d71ea1decc5ea696b03.zip hdf5-f6ffaf1f69b71caf958c8d71ea1decc5ea696b03.tar.gz hdf5-f6ffaf1f69b71caf958c8d71ea1decc5ea696b03.tar.bz2 |
[svn-r23898] HDFFV-8476: Add optional arg to -A for excluding attributes.
Merged from trunk.
Tested: local linux
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tools/h5dump/errfiles/tall-2A0.err | 25 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 21 | ||||
-rw-r--r-- | tools/h5dump/h5dump.h | 1 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 25 | ||||
-rw-r--r-- | tools/h5dump/h5dump_extern.h | 1 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 5 |
7 files changed, 63 insertions, 22 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index ad9a6a1..f14ff1b 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -51,6 +51,7 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2A.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2A0.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2B.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-3.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-4s.ddl @@ -303,6 +304,7 @@ IF (BUILD_TESTING) ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err ${PROJECT_SOURCE_DIR}/errfiles/tall-1.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err + ${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2B.err ${PROJECT_SOURCE_DIR}/errfiles/tarray1_big.err ${PROJECT_SOURCE_DIR}/errfiles/tattrregR.err @@ -1068,6 +1070,8 @@ IF (BUILD_TESTING) tall-2.out.err tall-2A.out tall-2A.out.err + tall-2A0.out + tall-2A0.out.err tall-2B.out tall-2B.out.err tall-3.out @@ -1502,6 +1506,9 @@ IF (BUILD_TESTING) # test '-A' to suppress data but print attr's ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5) + # test '-A' to suppress attr's but print data + ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5) + # test '-r' to print attributes in ASCII instead of decimal ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5) diff --git a/tools/h5dump/errfiles/tall-2A0.err b/tools/h5dump/errfiles/tall-2A0.err new file mode 100644 index 0000000..ba691d0 --- /dev/null +++ b/tools/h5dump/errfiles/tall-2A0.err @@ -0,0 +1,25 @@ +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Oopen(): unable to open object + major: Symbol table + minor: Can't open object + #001: (file name) line (number) in H5O_open_name(): object not found + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed + major: Links + minor: Link traversal failure + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + major: Links + minor: Link traversal failure + #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID + major: Symbol table + minor: Unable to find atom information (already closed?) + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile' + major: Links + minor: Unable to open file diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ef979b2..9b304bd 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:O*"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -175,7 +175,7 @@ static struct long_options l_opts[] = { { "xml-n", require_arg, 'X' }, { "xml", no_arg, 'x' }, { "xm", no_arg, 'x' }, - { "onlyattr", no_arg, 'A' }, + { "onlyattr", optional_arg, 'A' }, { "escape", no_arg, 'e' }, { "noindex", no_arg, 'y' }, { "binary", optional_arg, 'b' }, @@ -221,11 +221,6 @@ leave(int ret) * Purpose: Print the usage message about dumper * * Return: void - * - * Programmer: Ruey-Hsia Li - * - * Modifications: - * Pedro Vicente, October 5, 2007. Add -q and -z flags *------------------------------------------------------------------------- */ static void @@ -240,6 +235,7 @@ usage(const char *prog) 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, " Optional value 0 suppresses printing 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"); @@ -1093,9 +1089,14 @@ parse_start: last_was_dset = FALSE; break; case 'A': - display_data = FALSE; - display_attr_data = TRUE; - last_was_dset = FALSE; + if ( opt_arg != NULL) { + if(0 == HDatoi(opt_arg)) include_attrs = FALSE; + } + else { + display_data = FALSE; + display_attr_data = TRUE; + last_was_dset = FALSE; + } break; case 'i': display_oid = TRUE; diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 7d4f460..7bfead7 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -76,6 +76,7 @@ int display_region = FALSE; /*print region reference data */ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ +int include_attrs = TRUE; /* Display attributes */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 348a293..e18b2f0 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -556,19 +556,20 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags) { /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); + if(include_attrs) { + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ } /* end if */ - } /* end else */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + } } /*------------------------------------------------------------------------- diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 5a0f2bd..08f9e36 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -76,6 +76,7 @@ extern int display_region; /*print region reference data */ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ +extern int include_attrs; /* Display attributes */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index a05b477..c90cba4 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -173,6 +173,7 @@ $SRC_H5DUMP_TESTFILES/packedbits.ddl $SRC_H5DUMP_TESTFILES/tall-1.ddl $SRC_H5DUMP_TESTFILES/tall-2.ddl $SRC_H5DUMP_TESTFILES/tall-2A.ddl +$SRC_H5DUMP_TESTFILES/tall-2A0.ddl $SRC_H5DUMP_TESTFILES/tall-2B.ddl $SRC_H5DUMP_TESTFILES/tall-3.ddl $SRC_H5DUMP_TESTFILES/tall-4s.ddl @@ -333,6 +334,7 @@ LIST_ERROR_TEST_FILES=" ${SRC_H5DUMP_ERRORFILES}/filter_fail.err ${SRC_H5DUMP_ERRORFILES}/tall-1.err ${SRC_H5DUMP_ERRORFILES}/tall-2A.err +${SRC_H5DUMP_ERRORFILES}/tall-2A0.err ${SRC_H5DUMP_ERRORFILES}/tall-2B.err ${SRC_H5DUMP_ERRORFILES}/tarray1_big.err ${SRC_H5DUMP_ERRORFILES}/tattr-3.err @@ -1003,6 +1005,9 @@ TOOLTEST tlarge_objname.ddl --enable-error-stack -w157 tlarge_objname.h5 # test '-A' to suppress data but print attr's TOOLTEST4 tall-2A.ddl --enable-error-stack -A tall.h5 +# test '-A' to suppress attr's but print data +TOOLTEST4 tall-2A0.ddl --enable-error-stack -A 0 tall.h5 + # test '-r' to print attributes in ASCII instead of decimal TOOLTEST4 tall-2B.ddl --enable-error-stack -A -r tall.h5 |