summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2012-07-09 19:41:17 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2012-07-09 19:41:17 (GMT)
commit17eca872f13fb7e880438dca76f40d371293bc8a (patch)
tree40cc2f0e22be7ebc357ebb2e696e44e7a2f406ae /tools/lib
parent637df34074604c314cd55a3b0cad733e35255ceb (diff)
downloadhdf5-17eca872f13fb7e880438dca76f40d371293bc8a.zip
hdf5-17eca872f13fb7e880438dca76f40d371293bc8a.tar.gz
hdf5-17eca872f13fb7e880438dca76f40d371293bc8a.tar.bz2
[svn-r22531] HDFFV-5942: sort options with contents option
Added static local variables in h5trav to hold the index_by and index_order values. Defaults are set. H5dump only use of the trav_print function, added two parameters and passed in the sort_by and sort_order variables. Tested: local linux
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5trav.c16
-rw-r--r--tools/lib/h5trav.h2
2 files changed, 14 insertions, 4 deletions
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
}