diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-07-13 15:18:27 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-07-13 15:18:27 (GMT) |
commit | d9ba5c234c9971b67f6922ee85cabb638fc0e186 (patch) | |
tree | 17b1b5e613731058809663ee0fd00d0a0771106d /tools/h5dump/h5dump_ddl.c | |
parent | 5096b7d3ec1047e234049f351b111ef62deb6030 (diff) | |
download | hdf5-d9ba5c234c9971b67f6922ee85cabb638fc0e186.zip hdf5-d9ba5c234c9971b67f6922ee85cabb638fc0e186.tar.gz hdf5-d9ba5c234c9971b67f6922ee85cabb638fc0e186.tar.bz2 |
[svn-r22571] HDFFV-7784,-8095,7936 merge from trunk
Tested: local linux with cmake
Diffstat (limited to 'tools/h5dump/h5dump_ddl.c')
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 133 |
1 files changed, 58 insertions, 75 deletions
diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 0f9be1f..5db4103 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -543,6 +543,56 @@ done: } /*------------------------------------------------------------------------- + * Function: attr_iteration + * + * Purpose: Iterate and display attributes within the specified group + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +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); + } /* end if */ + } /* end else */ +} + +/*------------------------------------------------------------------------- + * Function: link_iteration + * + * Purpose: Iterate and display links within the specified group + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +link_iteration(hid_t gid, unsigned crt_order_flags) +{ + + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + 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); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); +} + +/*------------------------------------------------------------------------- * Function: dump_named_datatype * * Purpose: Dump named datatype @@ -659,21 +709,7 @@ dump_named_datatype(hid_t tid, const char *name) /* print attributes */ dump_indent += COL; - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the datatype's create property list 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(tid, 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(tid, 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 */ + attr_iteration(tid, attr_crt_order_flags); dump_indent -= COL; @@ -829,53 +865,13 @@ dump_group(hid_t gid, const char *name) } else { found_obj->displayed = TRUE; - /* 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); - } /* end if */ - } /* end else */ - - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - 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); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + attr_iteration(gid, attr_crt_order_flags); + link_iteration(gid, crt_order_flags); } } else { - /* 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); - } /* end if */ - } /* end else */ - - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - 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); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + attr_iteration(gid, attr_crt_order_flags); + link_iteration(gid, crt_order_flags); } dump_indent -= COL; @@ -1050,20 +1046,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) H5Tclose(type); if (!bin_output) { - /* 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(did, 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(did, 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 */ + attr_iteration(did, attr_crt_order_flags); } ctx.indent_level--; dump_indent -= COL; @@ -1280,7 +1263,7 @@ dump_fcontents(hid_t fid) } /* print objects in the files */ - h5trav_print(fid, sort_by, sort_order); + h5trav_print(fid); HDfprintf(rawoutstream, " %s\n",END); } @@ -1308,7 +1291,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe hid_t oid = -1; hid_t attr_id = -1; char *obj_name; - const char *attr_name; + char *attr_name; int j; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ |