diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-03-01 02:17:20 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-03-01 02:17:20 (GMT) |
commit | d9774f3852ad97a5ad99b037f501f272c8a82fd8 (patch) | |
tree | 61e6b4d1a9d5b06149163a8eec19c4af2a45f7d0 /tools | |
parent | 7fa510520b004b84c5c5ebfab378e99ed46a0e35 (diff) | |
download | hdf5-d9774f3852ad97a5ad99b037f501f272c8a82fd8.zip hdf5-d9774f3852ad97a5ad99b037f501f272c8a82fd8.tar.gz hdf5-d9774f3852ad97a5ad99b037f501f272c8a82fd8.tar.bz2 |
h5dump object reference fixed
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5tools_dump.c | 66 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 29 | ||||
-rw-r--r-- | tools/testfiles/treference.ddl | 288 |
3 files changed, 275 insertions, 108 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 34637c5..0b01ce6 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3928,7 +3928,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } } for (i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) { - void* memref = region_buf + i * nsize; + void *memref = region_buf + i * nsize; H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); @@ -3938,69 +3938,13 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_sprint(&buffer, &outputformat, obj_id, f_type, memref, &datactx); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - if (h5tools_is_zero(memref, nsize)) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION"); - -/* - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - + region_id = H5Rdereference2(obj_id, H5P_DEFAULT, H5R_OBJECT, memref); + if (region_id >= 0) { datactx.indent_level++; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - + h5tools_dump_data(stream, &outputformat, &datactx, region_id, TRUE); datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); -*/ } - else { - /* region data */ - region_id = H5Rdereference2(obj_id, H5P_DEFAULT, H5R_DATASET_REGION, memref); - if (region_id >= 0) { - region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref); - if (region_space >= 0) { - H5S_sel_type region_type; - - region_type = H5Sget_select_type(region_space); - if(region_type == H5S_SEL_POINTS) { - /* Print point information */ - H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION"); - h5tools_dump_region_data_points( - region_space, region_id, stream, &outputformat, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); - } - else if(region_type == H5S_SEL_HYPERSLABS) { - /* Print block information */ - H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION"); - h5tools_dump_region_data_blocks( - region_space, region_id, stream, &outputformat, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); - } - else { - H5TOOLS_INFO("invalid region type"); - } - if(H5Sclose(region_space) < 0) - H5TOOLS_INFO("H5Sclose failed"); - } /* end if (region_space >= 0) */ - else - H5TOOLS_INFO("H5Rget_region failed"); - if(H5Dclose(region_id) < 0) - H5TOOLS_INFO("H5Dclose failed"); - - } /* if (region_id >= 0) */ - else { - /* if (region_id < 0) - could mean that no reference was written do not throw failure */ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); - } - } /* end else to if (h5tools_is_zero(... */ + H5TOOLS_DEBUG("finished reference loop:%d",i); } /* end for (i = 0; i < nelmts... */ HDfree(region_buf); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3a139c3..fd58b69 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1100,7 +1100,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai * Object references -- show the type and OID of the referenced object. */ H5O_info_t oi; - const char *path; H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ"); obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); @@ -1109,15 +1108,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* Print object type and close object */ switch(oi.type) { case H5O_TYPE_GROUP: - h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_GROUP); + h5tools_str_append(str, H5_TOOLS_GROUP); break; case H5O_TYPE_DATASET: - h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_DATASET); + h5tools_str_append(str, H5_TOOLS_DATASET); break; case H5O_TYPE_NAMED_DATATYPE: - h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_DATATYPE); + h5tools_str_append(str, H5_TOOLS_DATATYPE); break; case H5O_TYPE_UNKNOWN: @@ -1128,21 +1127,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end switch */ H5Oclose(obj); - h5tools_str_sprint_reference(str, container, vp); - /* Print OID */ if(info->obj_hidefileno) h5tools_str_append(str, info->obj_format, oi.addr); else h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); - /* Print name */ - path = lookup_ref_path(*(haddr_t *) vp); - if(path) { - h5tools_str_append(str, " "); - h5tools_str_append(str, path); - h5tools_str_append(str, " "); - } /* end if */ + h5tools_str_sprint_reference(str, container, vp); } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; @@ -1303,22 +1294,30 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp) hid_t obj = H5I_INVALID_HID; hid_t region = H5I_INVALID_HID; char ref_name[1024]; + const char *path; H5TOOLS_START_DEBUG(""); + h5tools_str_append(str, " \""); obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, vp); if(obj >= 0) { region = H5Rget_region(container, H5R_DATASET_REGION, vp); if(region >= 0) { H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*) ref_name, 1024); - h5tools_str_append(str, " \""); h5tools_str_append(str, "%s", ref_name); - h5tools_str_append(str, "\""); H5Sclose(region); } /* end if (region >= 0) */ H5Dclose(obj); } /* end if (obj >= 0) */ + else { + /* Print name */ + path = lookup_ref_path(*(haddr_t *) vp); + if(path) { + h5tools_str_append(str, path); + } /* end if */ + } + h5tools_str_append(str, "\""); H5TOOLS_ENDDEBUG(""); } diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl index 4683ce5..3e133b6 100644 --- a/tools/testfiles/treference.ddl +++ b/tools/testfiles/treference.ddl @@ -847,34 +847,146 @@ GROUP "/" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { - (0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } ATTRIBUTE "reference2D" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { - (0,0): DATASET 976 /dset , DATASET 976 /dset , - (1,0): DATASET 976 /dset , DATASET 976 /dset , - (2,0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } ATTRIBUTE "reference3D" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { - (0,0,0): DATASET 976 /dset , DATASET 976 /dset , - (0,1,0): DATASET 976 /dset , DATASET 976 /dset , - (0,2,0): DATASET 976 /dset , DATASET 976 /dset , - (1,0,0): DATASET 976 /dset , DATASET 976 /dset , - (1,1,0): DATASET 976 /dset , DATASET 976 /dset , - (1,2,0): DATASET 976 /dset , DATASET 976 /dset , - (2,0,0): DATASET 976 /dset , DATASET 976 /dset , - (2,1,0): DATASET 976 /dset , DATASET 976 /dset , - (2,2,0): DATASET 976 /dset , DATASET 976 /dset , - (3,0,0): DATASET 976 /dset , DATASET 976 /dset , - (3,1,0): DATASET 976 /dset , DATASET 976 /dset , - (3,2,0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } ATTRIBUTE "string" { @@ -1805,34 +1917,146 @@ GROUP "/" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { - (0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } DATASET "reference2D" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { - (0,0): DATASET 976 /dset , DATASET 976 /dset , - (1,0): DATASET 976 /dset , DATASET 976 /dset , - (2,0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } DATASET "reference3D" { DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { - (0,0,0): DATASET 976 /dset , DATASET 976 /dset , - (0,1,0): DATASET 976 /dset , DATASET 976 /dset , - (0,2,0): DATASET 976 /dset , DATASET 976 /dset , - (1,0,0): DATASET 976 /dset , DATASET 976 /dset , - (1,1,0): DATASET 976 /dset , DATASET 976 /dset , - (1,2,0): DATASET 976 /dset , DATASET 976 /dset , - (2,0,0): DATASET 976 /dset , DATASET 976 /dset , - (2,1,0): DATASET 976 /dset , DATASET 976 /dset , - (2,2,0): DATASET 976 /dset , DATASET 976 /dset , - (3,0,0): DATASET 976 /dset , DATASET 976 /dset , - (3,1,0): DATASET 976 /dset , DATASET 976 /dset , - (3,2,0): DATASET 976 /dset , DATASET 976 /dset + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } + DATASET 976 "/dset" + DATA { + (0): 0, 0 + } } } DATASET "string" { |