diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 2 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 2 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 16 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 2 | ||||
-rw-r--r-- | tools/testfiles/tordercontents1.ddl | 11 | ||||
-rw-r--r-- | tools/testfiles/tordercontents2.ddl | 11 |
8 files changed, 43 insertions, 5 deletions
@@ -1471,6 +1471,8 @@ ./tools/testfiles/tall-2A.ddl ./tools/testfiles/tall-2B.ddl ./tools/testfiles/tcontents.ddl +./tools/testfiles/tordercontents1.ddl +./tools/testfiles/tordercontents2.ddl ./tools/testfiles/tfilters.h5 ./tools/testfiles/tchunked.ddl ./tools/testfiles/tcompact.ddl diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 3bc481d..d89db0d 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -1096,6 +1096,8 @@ IF (BUILD_TESTING) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) + ADD_H5_TEST (tordercontents1 0 --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5) + ADD_H5_TEST (tordercontents2 0 --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5) # tests for storage layout # compact diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 22d2a2b..c0a9884 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1294,7 +1294,7 @@ dump_fcontents(hid_t fid) } /* print objects in the files */ - h5trav_print(fid); + h5trav_print(fid, sort_by, sort_order); HDfprintf(rawoutstream, " %s\n",END); } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 3bd0dfd..8c7d754 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -720,6 +720,8 @@ TOOLTEST3 tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5 # test for file contents TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5 +TOOLTEST tordercontents1.ddl --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5 +TOOLTEST tordercontents2.ddl --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5 # tests for storage layout # compact diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index ad8b9fe..ed2abeb 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -61,6 +61,13 @@ static void trav_table_addlink(trav_table_t *table, const char *path); /*------------------------------------------------------------------------- + * local variables + *------------------------------------------------------------------------- + */ +static H5_index_t trav_index_by = H5_INDEX_NAME; +static H5_iter_order_t trav_index_order = H5_ITER_INC; + +/*------------------------------------------------------------------------- * "h5trav info" public functions. used in h5diff *------------------------------------------------------------------------- */ @@ -255,12 +262,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, /* Check for iteration of links vs. visiting all links recursively */ if(recurse) { /* Visit all links in group, recursively */ - if(H5Lvisit_by_name(file_id, grp_name, H5_INDEX_NAME, H5_ITER_INC, traverse_cb, &udata, H5P_DEFAULT) < 0) + if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0) return -1; } /* end if */ else { /* Iterate over links in group */ - if(H5Literate_by_name(file_id, grp_name, H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) + if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) return -1; } /* end else */ @@ -948,8 +955,11 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) */ int -h5trav_print(hid_t fid) +h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order) { + trav_index_by = print_index_by; + trav_index_order = print_index_order; + trav_print_udata_t print_udata; /* User data for traversal */ trav_visitor_t print_visitor; /* Visitor structure for printing objects */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index da8dc69..7311897 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -158,7 +158,7 @@ H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt); * "h5trav print" public functions *------------------------------------------------------------------------- */ -H5TOOLS_DLL int h5trav_print(hid_t fid); +H5TOOLS_DLL int h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order); #ifdef __cplusplus } diff --git a/tools/testfiles/tordercontents1.ddl b/tools/testfiles/tordercontents1.ddl new file mode 100644 index 0000000..18c5589 --- /dev/null +++ b/tools/testfiles/tordercontents1.ddl @@ -0,0 +1,11 @@ +HDF5 "torderattr.h5" { +FILE_CONTENTS { + group / + dataset /d + dataset /dt + group /g + group /gt + datatype /t + datatype /tt + } +} diff --git a/tools/testfiles/tordercontents2.ddl b/tools/testfiles/tordercontents2.ddl new file mode 100644 index 0000000..430638b --- /dev/null +++ b/tools/testfiles/tordercontents2.ddl @@ -0,0 +1,11 @@ +HDF5 "torderattr.h5" { +FILE_CONTENTS { + group / + datatype /tt + datatype /t + group /gt + group /g + dataset /dt + dataset /d + } +} |