diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 6 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 1 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 85 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 25 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 2 | ||||
-rw-r--r-- | tools/testfiles/treference.ddl | 288 |
7 files changed, 328 insertions, 85 deletions
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 6f699fd..e4e9010 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -531,8 +531,8 @@ static int copy_refs_attr(hid_t loc_in, ref_comp_size = NULL; } } - /* This line below needs to be moved in this loop instead of inserting outside. Otherwise, - ref_comp_field_n may be >0 for the next attribute, which may not be + /* This line below needs to be moved in this loop instead of inserting outside. Otherwise, + ref_comp_field_n may be >0 for the next attribute, which may not be the reference type and will be accidently treated as the reference type. It will then cause the H5Acreate2 failed since that attribute is already created. KY 2020-02-05 @@ -836,7 +836,7 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, ref_obj_id = H5Rdereference(obj_id, ref_type, ref_in); if (ref_obj_id < 0) - H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference failed"); ref_obj_name = MapIdToName(ref_obj_id, travt); if (ref_obj_name == NULL) diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 896301d..16169a2 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -185,7 +185,7 @@ void print_type(hid_t type) * Purpose: Returns a pointer to the last component absolute name *------------------------------------------------------------------------- */ - const char* +const char* diff_basename(const char *name) { size_t i; @@ -242,7 +242,7 @@ get_type(h5trav_type_t type) * Purpose: Returns the sign as a string *------------------------------------------------------------------------- */ - const char* +const char* get_sign(H5T_sign_t sign) { switch(sign) { @@ -270,7 +270,7 @@ get_sign(H5T_sign_t sign) * Purpose: Returns the class as a string *------------------------------------------------------------------------- */ - const char* +const char* get_class(H5T_class_t tclass) { switch(tclass) { diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 7229031..0e830c0 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -91,6 +91,7 @@ #define PACKED_BITS "PACKED_BITS" #define PACKED_OFFSET "OFFSET" #define PACKED_LENGTH "LENGTH" +#define REGION "REGION" #define BEGIN "{" #define END "}" diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 4b338ef..f9560a0 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3738,8 +3738,8 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * H5TOOLS_GOTO_DONE_NO_RET(); } } - for (i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) { - void* memref = region_buf + i * nsize; + for (i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { + void *memref = region_buf + i * nsize; H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); @@ -3749,51 +3749,70 @@ 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"); + if ((region_id = H5Rdereference(obj_id, H5R_OBJECT, memref)) >= 0) { + datactx.indent_level++; + h5tools_dump_data(stream, &outputformat, &datactx, region_id, TRUE); + datactx.indent_level--; } else { - /* region data */ - region_id = H5Rdereference(obj_id, 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); + if ((region_id = H5Rdereference(obj_id, H5R_DATASET_REGION, memref)) >= 0) { + if ((region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref)) >= 0) { + if (h5tools_is_zero(memref, H5Tget_size(f_type))) { + 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); + + datactx.need_prefix = TRUE; + datactx.indent_level++; + 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); + 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 { - H5TOOLS_INFO("invalid region type"); - } + 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, (hsize_t)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, (hsize_t)i, elmt_counter); + } + else + H5TOOLS_INFO("invalid region type"); + } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(region_space) < 0) - H5TOOLS_INFO("H5Sclose failed"); + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION failed"); } /* end if (region_space >= 0) */ else - H5TOOLS_INFO("H5Rget_region failed"); + H5TOOLS_INFO("H5Rget_region H5R_DATASET_REGION failed"); if(H5Dclose(region_id) < 0) - H5TOOLS_INFO("H5Dclose failed"); - + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION 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... */ + } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */ HDfree(region_buf); } ctx->indent_level--; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 7939e69..cc6397d 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -892,11 +892,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_COMPOUND: + H5TOOLS_DEBUG("H5T_COMPOUND"); { unsigned nmembs; unsigned j; - H5TOOLS_DEBUG("H5T_COMPOUND"); nmembs = (unsigned)H5Tget_nmembers(type); h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); @@ -959,7 +959,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { if(nsize == H5R_DSET_REG_REF_BUF_SIZE) { /* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */ - H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG"); h5tools_str_append(str, H5_TOOLS_DATASET); h5tools_str_sprint_reference(str, container, vp); } @@ -969,9 +969,8 @@ 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("ref_type is H5R_OBJECT"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ"); obj = H5Rdereference(container, H5R_OBJECT, vp); H5Oget_info(obj, &oi); @@ -1003,13 +1002,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai 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; @@ -1170,6 +1163,7 @@ 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(""); @@ -1179,19 +1173,24 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp) 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, "%s", ref_name); 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(""); } - /*------------------------------------------------------------------------- * Function: h5tools_escape * diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 2dbb5c6..0bfe825 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -680,7 +680,7 @@ dump_tables(find_objs_t *info) * Failure: FAIL if object is not found *------------------------------------------------------------------------- */ - obj_t * +obj_t * search_obj(table_t *table, haddr_t objno) { unsigned u; 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" { |