From 0a0245d171ab1cd36991c6912c993cf033d83a6f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 24 Aug 2023 11:12:35 -0500 Subject: [PATCH] Add other types and full type to enum/str/vlen dataformat for structblock[begin/end] (#3358) --- tools/lib/h5tools.h | 16 ++++-- tools/lib/h5tools_dump.c | 119 +++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 59 deletions(-) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 97f56e0c8be..98ced407be9 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -170,14 +170,22 @@ typedef struct h5tools_dump_header_t { const char *extlinkblockend; const char *udlinkblockbegin; const char *udlinkblockend; - const char *strblockbegin; - const char *strblockend; + const char *arrblockbegin; + const char *arrblockend; + const char *cmpdblockbegin; + const char *cmpdblockend; const char *enumblockbegin; const char *enumblockend; - const char *structblockbegin; - const char *structblockend; + const char *opaqblockbegin; + const char *opaqblockend; + const char *refblockbegin; + const char *refblockend; + const char *strblockbegin; + const char *strblockend; const char *vlenblockbegin; const char *vlenblockend; + const char *structblockbegin; + const char *structblockend; const char *subsettingblockbegin; const char *subsettingblockend; const char *startblockbegin; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index e1fab359145..2986de7d395 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -127,46 +127,54 @@ const h5tools_dump_header_t h5tools_standardformat = { BLOCK, /*blockbegin */ "", /*blockend */ - "{", /*fileblockbegin */ - "}", /*fileblockend */ - "{", /*bootblockblockbegin */ - "}", /*bootblockblockend */ - "{", /*groupblockbegin */ - "}", /*groupblockend */ - "{", /*datasetblockbegin */ - "}", /*datasetblockend */ - "{", /*attributeblockbegin */ - "}", /*attributeblockend */ - "", /*datatypeblockbegin */ - "", /*datatypeblockend */ - "", /*dataspaceblockbegin */ - "", /*dataspaceblockend */ - "{", /*datablockbegin */ - "}", /*datablockend */ - "{", /*softlinkblockbegin */ - "}", /*softlinkblockend */ - "{", /*extlinkblockbegin */ - "}", /*extlinkblockend */ - "{", /*udlinkblockbegin */ - "}", /*udlinkblockend */ - "{", /*strblockbegin */ - "}", /*strblockend */ - "{", /*enumblockbegin */ - "}", /*enumblockend */ - "{", /*structblockbegin */ - "}", /*structblockend */ - "{", /*vlenblockbegin */ - "}", /*vlenblockend */ - "{", /*subsettingblockbegin */ - "}", /*subsettingblockend */ - "(", /*startblockbegin */ - ");", /*startblockend */ - "(", /*strideblockbegin */ - ");", /*strideblockend */ - "(", /*countblockbegin */ - ");", /*countblockend */ - "(", /*blockblockbegin */ - ");", /*blockblockend */ + "{", /*fileblockbegin */ + "}", /*fileblockend */ + "{", /*bootblockblockbegin */ + "}", /*bootblockblockend */ + "{", /*groupblockbegin */ + "}", /*groupblockend */ + "{", /*datasetblockbegin */ + "}", /*datasetblockend */ + "{", /*attributeblockbegin */ + "}", /*attributeblockend */ + "", /*datatypeblockbegin */ + "", /*datatypeblockend */ + "", /*dataspaceblockbegin */ + "", /*dataspaceblockend */ + "{", /*datablockbegin */ + "}", /*datablockend */ + "{", /*softlinkblockbegin */ + "}", /*softlinkblockend */ + "{", /*extlinkblockbegin */ + "}", /*extlinkblockend */ + "{", /*udlinkblockbegin */ + "}", /*udlinkblockend */ + "H5T_ARRAY { ", /*arrblockbegin */ + " }", /*arrblockend */ + "H5T_COMPOUND {", /*cmpdblockbegin */ + "}", /*cmpdblockend */ + "H5T_ENUM {", /*enumblockbegin */ + "}", /*enumblockend */ + "H5T_OPAQUE {", /*opaqblockbegin */ + "}", /*opaqblockend */ + "H5T_REFERENCE { ", /*refblockbegin */ + " }", /*refblockend */ + "H5T_STRING {", /*strblockbegin */ + "}", /*strblockend */ + "H5T_VLEN { ", /*vlenblockbegin */ + " }", /*vlenblockend */ + "{", /*structblockbegin */ + "}", /*structblockend */ + "{", /*subsettingblockbegin */ + "}", /*subsettingblockend */ + "(", /*startblockbegin */ + ");", /*startblockend */ + "(", /*strideblockbegin */ + ");", /*strideblockend */ + "(", /*countblockbegin */ + ");", /*countblockend */ + "(", /*blockblockbegin */ + ");", /*blockblockend */ "", /*dataspacedescriptionbegin */ "", /*dataspacedescriptionend */ @@ -2236,7 +2244,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ is_vlstr = H5Tis_variable_str(tmp_type); curr_pos = ctx->cur_column; - h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2440,7 +2448,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ break; case H5T_OPAQUE: - h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->opaqblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -2473,7 +2481,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->need_prefix = TRUE; h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->opaqblockend); break; case H5T_COMPOUND: @@ -2481,7 +2489,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5TOOLS_THROW((-1), "H5Tget_nmembers failed"); nmembers = (unsigned)snmembers; - h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->cmpdblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2509,30 +2517,31 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->need_prefix = TRUE; h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->cmpdblockend); break; case H5T_REFERENCE: - h5tools_str_append(buffer, "H5T_REFERENCE"); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->refblockbegin); if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { - h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }"); + h5tools_str_append(buffer, "H5T_STD_REF_DSETREG"); } else if (H5Tequal(type, H5T_STD_REF_OBJ) == TRUE) { - h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }"); + h5tools_str_append(buffer, "H5T_STD_REF_OBJECT"); } else if (H5Tequal(type, H5T_STD_REF) == TRUE) { - h5tools_str_append(buffer, " { H5T_STD_REF }"); + h5tools_str_append(buffer, "H5T_STD_REF"); } else { - h5tools_str_append(buffer, " { UNDEFINED }"); + h5tools_str_append(buffer, "UNDEFINED"); } + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->refblockend); break; case H5T_ENUM: if ((super = H5Tget_super(type)) < 0) H5TOOLS_THROW((-1), "H5Tget_super failed"); - h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -2564,19 +2573,19 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if ((super = H5Tget_super(type)) < 0) H5TOOLS_THROW((-1), "H5Tget_super failed"); - h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockbegin); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if (H5Tclose(super) < 0) H5TOOLS_ERROR((-1), "H5Tclose failed"); - h5tools_str_append(buffer, " %s", h5tools_dump_header_format->vlenblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); break; case H5T_ARRAY: - h5tools_str_append(buffer, "H5T_ARRAY { "); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->arrblockbegin); /* Get array information */ if ((sndims = H5Tget_array_ndims(type)) >= 0) { @@ -2606,7 +2615,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ else H5TOOLS_ERROR((-1), "H5Tget_super failed"); - h5tools_str_append(buffer, " }"); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->arrblockend); break;