mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[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
This commit is contained in:
parent
637df34074
commit
17eca872f1
2
MANIFEST
2
MANIFEST
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -60,6 +60,13 @@ static void trav_table_addlink(trav_table_t *table,
|
||||
haddr_t objno,
|
||||
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 */
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
11
tools/testfiles/tordercontents1.ddl
Normal file
11
tools/testfiles/tordercontents1.ddl
Normal file
@ -0,0 +1,11 @@
|
||||
HDF5 "torderattr.h5" {
|
||||
FILE_CONTENTS {
|
||||
group /
|
||||
dataset /d
|
||||
dataset /dt
|
||||
group /g
|
||||
group /gt
|
||||
datatype /t
|
||||
datatype /tt
|
||||
}
|
||||
}
|
11
tools/testfiles/tordercontents2.ddl
Normal file
11
tools/testfiles/tordercontents2.ddl
Normal file
@ -0,0 +1,11 @@
|
||||
HDF5 "torderattr.h5" {
|
||||
FILE_CONTENTS {
|
||||
group /
|
||||
datatype /tt
|
||||
datatype /t
|
||||
group /gt
|
||||
group /g
|
||||
dataset /dt
|
||||
dataset /d
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user