From b969dce6e5625dd9d9f9cc42717a1b2027fdeeb1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 30 Oct 2007 17:56:15 -0500 Subject: [svn-r14224] Description: Change H5Literate -> H5Literate_by_name and add simpler form of H5Literate, to bring this routine into alignment with the other new API routines. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode --- c++/examples/h5group.cpp | 4 +-- examples/h5_group.c | 6 ++-- hl/src/H5LT.c | 2 +- src/H5Gdeprec.c | 2 +- src/H5Gname.c | 11 ++++--- src/H5Gobj.c | 4 +-- src/H5Gpkg.h | 2 +- src/H5Gprivate.h | 5 ++-- src/H5I.c | 2 +- src/H5L.c | 76 ++++++++++++++++++++++++++++++++++++++++++++--- src/H5Lpublic.h | 6 ++-- src/H5R.c | 9 +++--- test/links.c | 28 ++++++++--------- test/titerate.c | 18 +++++------ test/trefer.c | 2 +- tools/h5dump/h5dump.c | 16 +++++----- tools/h5ls/h5ls.c | 4 +-- tools/h5stat/h5stat.c | 2 +- tools/lib/h5tools_ref.c | 4 +-- tools/lib/h5tools_utils.c | 4 +-- tools/lib/h5trav.c | 4 +-- 21 files changed, 143 insertions(+), 68 deletions(-) diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index 19245ae..09dc7ee 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -167,7 +167,7 @@ int main(void) * root directory. */ cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Literate(file->getId(), "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); + herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* @@ -185,7 +185,7 @@ int main(void) cout << "\"Data\" is unlinked" << endl; cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Literate(file->getId(), "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); + idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* diff --git a/examples/h5_group.c b/examples/h5_group.c index da6a848..6b73210 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -137,7 +137,7 @@ main(void) /* * Use iterator to see the names of the objects in the root group. */ - idx_f = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); + idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Unlink name "Data" and use iterator to see the names @@ -148,13 +148,13 @@ main(void) else printf("\"Data\" is unlinked \n"); - idx_f = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); + idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Use iterator to see the names of the objects in the group * /Data_new. */ - idx_g = H5Literate(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); + idx_g = H5Literate_by_name(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); /* * Close the file. diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index d47fad1..78df61a 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -816,7 +816,7 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) { - return H5Literate(loc_id, ".", H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name, H5P_DEFAULT ); + return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); } diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index b71c509..76542dd 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -773,7 +773,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.u.old_op = op; /* Call private function. */ - if((ret_value = H5G_obj_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 2bc0174..e341ee7 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -53,6 +53,7 @@ typedef struct H5G_names_t { typedef struct H5G_ref_path_iter_t { /* In */ hid_t file; /* File id where it came from */ + hid_t lapl_id; /* LAPL for operations */ hid_t dxpl_id; /* DXPL for operations */ hbool_t is_root_group; /* Flag to indicate that the root group is being looked at */ const H5O_loc_t *loc; /* The location of the object we're looking for */ @@ -437,7 +438,8 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) *------------------------------------------------------------------------- */ ssize_t -H5G_get_name(hid_t id, char *name/*out*/, size_t size, hid_t dxpl_id) +H5G_get_name(hid_t id, char *name/*out*/, size_t size, hid_t lapl_id, + hid_t dxpl_id) { H5G_loc_t loc; /* Object location */ ssize_t ret_value = FAIL; @@ -466,7 +468,7 @@ H5G_get_name(hid_t id, char *name/*out*/, size_t size, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve file ID") /* Search for name of object */ - if((len = H5G_get_refobj_name(file, dxpl_id, loc.oloc, name, size)) < 0) { + if((len = H5G_get_refobj_name(file, lapl_id, dxpl_id, loc.oloc, name, size)) < 0) { H5I_dec_ref(file); HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") } /* end if */ @@ -1149,7 +1151,7 @@ H5G_refname_iterator(hid_t group, const char *name, const H5L_info_t *link_info, lnk_op.op_type = H5G_LINK_OP_APP; lnk_op.u.app_op = H5G_refname_iterator; - ret_value = H5G_obj_iterate(udata->file, udata->container, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, &last_obj, &lnk_op, udata, udata->dxpl_id); + ret_value = H5G_obj_iterate(udata->file, udata->container, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, &last_obj, &lnk_op, udata, udata->lapl_id, udata->dxpl_id); /* If we didn't find the object, truncate the name to not include group name anymore */ if(!ret_value) @@ -1211,7 +1213,7 @@ H5G_free_ref_path_node(void *item, void UNUSED *key, void UNUSED *operator_data/ *------------------------------------------------------------------------- */ ssize_t -H5G_get_refobj_name(hid_t file, hid_t dxpl_id, const H5O_loc_t *loc, +H5G_get_refobj_name(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t *loc, char *name, size_t size) { H5G_ref_path_iter_t udata; /* User data for iteration */ @@ -1231,6 +1233,7 @@ H5G_get_refobj_name(hid_t file, hid_t dxpl_id, const H5O_loc_t *loc, /* Set up user data for iterator */ udata.file = file; + udata.lapl_id = lapl_id; udata.dxpl_id = dxpl_id; udata.is_root_group = TRUE; if(NULL == (udata.container = H5MM_strdup(""))) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index a626514..00bac73 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -638,7 +638,7 @@ done: herr_t H5G_obj_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, - H5G_link_iterate_t *lnk_op, void *op_data, hid_t dxpl_id) + H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id) { H5G_loc_t loc; /* Location of parent for group */ H5O_linfo_t linfo; /* Link info message */ @@ -659,7 +659,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name, */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (grp = H5G_open_name(&loc, group_name, H5P_DEFAULT, dxpl_id))) + if(NULL == (grp = H5G_open_name(&loc, group_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((gid = H5I_register(H5I_GROUP, grp)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 1200c52..f5b2582 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -512,7 +512,7 @@ H5_DLL herr_t H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, hbool_t adj_link, hid_t dxpl_id); H5_DLL herr_t H5G_obj_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_obj, - H5G_link_iterate_t *lnk_op, void *op_data, hid_t dxpl_id); + H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id); H5_DLL ssize_t H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index ccbb66e..9717b77 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -187,8 +187,9 @@ H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5_DLL herr_t H5G_name_reset(H5G_name_t *name); H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_name_free(H5G_name_t *name); -H5_DLL ssize_t H5G_get_name(hid_t id, char *name/*out*/, size_t size, hid_t dxpl_id); -H5_DLL ssize_t H5G_get_refobj_name(hid_t fid, hid_t dxpl_id, +H5_DLL ssize_t H5G_get_name(hid_t id, char *name/*out*/, size_t size, + hid_t lapl_id, hid_t dxpl_id); +H5_DLL ssize_t H5G_get_refobj_name(hid_t fid, hid_t lapl_id, hid_t dxpl_id, const struct H5O_loc_t *loc, char* name, size_t size); /* diff --git a/src/H5I.c b/src/H5I.c index 195bb38..0b8b84e 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2003,7 +2003,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) H5TRACE3("Zs", "ixz", id, name, size); /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(id, name, size, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(id, name, size, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5L.c b/src/H5L.c index d9f8e0d..d7a6224 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1197,7 +1197,75 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t loc_id, const char *group_name, +H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate_t op, void *op_data) +{ + H5I_type_t id_type; /* Type of ID */ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(H5Literate, FAIL) + H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, + op_data); + + /* Check arguments */ + id_type = H5I_get_type(grp_id); + if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_APP; + lnk_op.u.app_op = op; + + /* Iterate over the links */ + if((ret_value = H5G_obj_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + + /* Set the index we stopped at */ + if(idx_p) + *idx_p = last_lnk; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Literate() */ + + +/*------------------------------------------------------------------------- + * Function: H5Literate_by_name + * + * Purpose: Iterates over links in a group, with user callback routine, + * according to the order within an index. + * + * Same pattern of behavior as H5Giterate. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * + * Programmer: Quincey Koziol + * Thursday, November 16, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { @@ -1206,7 +1274,7 @@ H5Literate(hid_t loc_id, const char *group_name, hsize_t idx; /* Internal location to hold index */ herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Literate, FAIL) + FUNC_ENTER_API(H5Literate_by_name, FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id); @@ -1234,7 +1302,7 @@ H5Literate(hid_t loc_id, const char *group_name, lnk_op.u.app_op = op; /* Iterate over the links */ - if((ret_value = H5G_obj_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1243,7 +1311,7 @@ H5Literate(hid_t loc_id, const char *group_name, done: FUNC_LEAVE_API(ret_value) -} /* end H5Literate() */ +} /* end H5Literate_by_name() */ /* *------------------------------------------------------------------------- diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 863155e..9a85900 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -127,7 +127,7 @@ typedef struct { H5L_query_func_t query_func; /* Callback for queries */ } H5L_class_t; -/* Prototype for H5Literate() operator */ +/* Prototype for H5Literate/H5Literate_by_name() operator */ typedef herr_t (*H5L_iterate_t)(hid_t group, const char *name, const H5L_info_t *info, void *op_data); @@ -167,7 +167,9 @@ H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id); -H5_DLL herr_t H5Literate(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Literate(hid_t grp_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data); +H5_DLL herr_t H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data, hid_t lapl_id); diff --git a/src/H5R.c b/src/H5R.c index 373bde5..627626b 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -39,7 +39,7 @@ static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id); static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref); static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref); -static ssize_t H5R_get_name(H5F_t *file, hid_t dxpl_id, hid_t id, +static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size); @@ -805,6 +805,7 @@ done: ssize_t H5R_get_name(f, dxpl_id, ref_type, ref, name, size) H5F_t *f; IN: Pointer to the file that the reference is pointing into + hid_t lapl_id; IN: LAPL to use for operation hid_t dxpl_id; IN: DXPL to use for operation hid_t id; IN: Location ID given for reference H5R_type_t ref_type; IN: Type of reference @@ -824,7 +825,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R_get_name(H5F_t *f, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, +H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { hid_t file_id = (-1); /* ID for file that the reference is in */ @@ -884,7 +885,7 @@ H5R_get_name(H5F_t *f, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID") /* Get name, length, etc. */ - if((ret_value = H5G_get_refobj_name(file_id, dxpl_id, &oloc, name, size)) < 0) + if((ret_value = H5G_get_refobj_name(file_id, lapl_id, dxpl_id, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name") done: @@ -945,7 +946,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, file = loc.oloc->file; /* Get name */ - if((ret_value = H5R_get_name(file, H5AC_dxpl_id, id, ref_type, _ref, name, size)) < 0) + if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_dxpl_id, id, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") done: diff --git a/test/links.c b/test/links.c index ce3714f..9f648ba 100644 --- a/test/links.c +++ b/test/links.c @@ -7220,7 +7220,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_cb, iter_info, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -7252,7 +7252,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_cb, iter_info, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -7316,7 +7316,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_cb, iter_info, H5P_DEFAULT)) < 0) TEST_ERROR + if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -7338,7 +7338,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_fail_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -7457,7 +7457,7 @@ link_iterate(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, ".", idx_type, order, NULL, link_iterate_cb, NULL, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7477,7 +7477,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -7503,7 +7503,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", idx_type, order, &skip, link_iterate_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -7677,7 +7677,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, ".", H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -7709,7 +7709,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, ".", H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -7773,7 +7773,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, ".", H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info, H5P_DEFAULT)) < 0) TEST_ERROR + if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -7795,7 +7795,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -7863,7 +7863,7 @@ link_iterate_old(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, ".", H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { @@ -7883,7 +7883,7 @@ link_iterate_old(hid_t fapl) /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -7891,7 +7891,7 @@ link_iterate_old(hid_t fapl) /* (should fail) */ skip = (hsize_t)0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, ".", H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL, H5P_DEFAULT); + ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/titerate.c b/test/titerate.c index 9f93427..397e3c0 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -146,7 +146,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); VERIFY(ret, SUCCEED, "H5Literate"); datatype = H5Tcopy(H5T_NATIVE_INT); @@ -257,35 +257,35 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_ZERO; idx = (hsize_t)-1; H5E_BEGIN_TRY { - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; H5E_BEGIN_TRY { - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; H5E_BEGIN_TRY { - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Literate"); /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) > 0) + if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; idx = i = 0; - while((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) > 0) { + while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Literate"); @@ -310,7 +310,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; idx = i = 0; - while((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) >= 0) { + while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Literate"); @@ -670,13 +670,13 @@ test_iter_group_large(hid_t fapl) /* Iterate through the file to see members of the root group */ curr_name = &names[0]; - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); CHECK(ret, FAIL, "H5Literate"); for(i = 1; i < 100; i++) { hsize_t idx = i; curr_name = &names[i]; - ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name, H5P_DEFAULT); + ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); CHECK(ret, FAIL, "H5Literate"); } /* end for */ diff --git a/test/trefer.c b/test/trefer.c index bef497f..e3ffd76 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1077,7 +1077,7 @@ test_reference_group(void) CHECK(gid, FAIL, "H5Rdereference"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count, H5P_DEFAULT); + ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index be1d80a..b713194 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1937,9 +1937,9 @@ dump_group(hid_t gid, const char *name) in the group, then, sort by creation order, otherwise by name */ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, ".", sort_by, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, ".", H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } } @@ -1960,9 +1960,9 @@ dump_group(hid_t gid, const char *name) in the group, then, sort by creation order, otherwise by name */ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, ".", sort_by, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, ".", H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } @@ -5455,9 +5455,9 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ if( (sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, ".", sort_by, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, ".", H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } @@ -5520,9 +5520,9 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ if( (sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, ".", sort_by, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, ".", H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL, H5P_DEFAULT); + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } indent -= COL; diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index db77b84..d270b0c 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1668,7 +1668,7 @@ group_list2(hid_t grp, const char *name) if (recursive_g) { iter.container = name; - H5Literate(grp, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT); + H5Literate(grp, H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter); } return 0; } @@ -2321,7 +2321,7 @@ main(int argc, const char *argv[]) } /* end if */ /* list */ - H5Literate(file, oname, H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT); + H5Literate_by_name(file, oname, H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT); free(container); } else if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) { leave(1); /*major problem!*/ diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 2d67cc7..2fe3302 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -512,7 +512,7 @@ group_stats(hid_t group, const char *name, const char *fullname, iter->curr_depth++; /* Recursively descend into current group's objects */ - H5Literate(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, walk, iter, H5P_DEFAULT); + H5Literate_by_name(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, walk, iter, H5P_DEFAULT); /* Revert current container info */ iter->container = last_container; diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 715d05e..69ea08d 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -327,7 +327,7 @@ fill_ref_path_table_cb(hid_t group, const char *obj_name, const H5L_info_t *linf /* Iterate over objects in this group, using this group's * name as their prefix */ - if(H5Literate(group, obj_name, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, thepath, H5P_DEFAULT) < 0) { + if(H5Literate_by_name(group, obj_name, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, thepath, H5P_DEFAULT) < 0) { error_msg(progname, "unable to dump group \"%s\"\n", thepath); d_status = EXIT_FAILURE; } /* end if */ @@ -375,7 +375,7 @@ fill_ref_path_table(hid_t fid) ref_path_table_put(root_path, oinfo.addr); /* Iterate over objects in this file */ - if(H5Literate(fid, root_path, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, (void *)"", H5P_DEFAULT) < 0) { + if(H5Literate(fid, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, (void *)"") < 0) { error_msg(progname, "unable to dump root group\n"); d_status = EXIT_FAILURE; } /* end if */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index de2043e..fba76ad 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -506,7 +506,7 @@ find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void info->prefix = HDmalloc(tmp_len+1); HDstrcpy(info->prefix, tmp); - if(H5Literate(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT) < 0) + if(H5Literate_by_name(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT) < 0) ret_value = FAIL; info->prefix = old_prefix; @@ -613,7 +613,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, } /* end else */ /* Find all shared objects */ - return(H5Literate(fid, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT)); + return(H5Literate(fid, H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info)); } diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 58d618d..14c59c4 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -188,7 +188,7 @@ traverse_cb(hid_t loc_id, const char *link_name, const H5L_info_t *linfo, udata->curr_path = link_path; /* Iterate over all links in group object */ - if(H5Literate(loc_id, link_name, H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, udata, H5P_DEFAULT) < 0) + if(H5Literate_by_name(loc_id, link_name, H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, udata, H5P_DEFAULT) < 0) return(H5_ITER_ERROR); /* Restore path in udata */ @@ -244,7 +244,7 @@ traverse(hid_t file_id, const trav_visitor_t *visitor) udata.visitor = visitor; /* Iterate over all links in root group */ - if(H5Literate(file_id, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) + if(H5Literate(file_id, H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, &udata) < 0) return -1; /* Free visited addresses table */ -- cgit v0.12