From 4f735a2e7b0ab3673c0eac82211838a8f6d075d3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Aug 2023 12:44:59 -0500 Subject: [PATCH 1/3] Deprecate use of enum/str/vlen dataformat for structblock{begin/end] --- tools/lib/h5tools_dump.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index e1fab359145..2b12bd5b9b1 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -149,14 +149,14 @@ const h5tools_dump_header_t h5tools_standardformat = { "}", /*extlinkblockend */ "{", /*udlinkblockbegin */ "}", /*udlinkblockend */ - "{", /*strblockbegin */ - "}", /*strblockend */ - "{", /*enumblockbegin */ - "}", /*enumblockend */ + "{", /*DO NOT USE strblockbegin */ + "}", /*DO NOT USE strblockend */ + "{", /*DO NOT USEenumblockbegin */ + "}", /*DO NOT USEenumblockend */ "{", /*structblockbegin */ "}", /*structblockend */ - "{", /*vlenblockbegin */ - "}", /*vlenblockend */ + "{", /*DO NOT USEvlenblockbegin */ + "}", /*DO NOT USEvlenblockend */ "{", /*subsettingblockbegin */ "}", /*subsettingblockend */ "(", /*startblockbegin */ @@ -2236,7 +2236,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, "H5T_STRING %s", h5tools_dump_header_format->structblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2415,7 +2415,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if (H5Tclose(tmp_type) < 0) H5TOOLS_ERROR((-1), "H5Tclose failed"); - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); break; case H5T_BITFIELD: @@ -2532,7 +2532,7 @@ 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_ENUM %s", h5tools_dump_header_format->enumblockbegin); + h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->structblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -2556,7 +2556,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->enumblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); break; @@ -2564,14 +2564,14 @@ 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, "H5T_VLEN %s ", h5tools_dump_header_format->structblockbegin); 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->structblockend); break; From 5dd07716d9fdab629ec267e937ec7fa98edc186c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 9 Aug 2023 13:35:39 -0500 Subject: [PATCH 2/3] Change dump struct to allow container types to be changed --- tools/lib/h5tools.h | 16 +++++++++--- tools/lib/h5tools_dump.c | 55 +++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 27 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 2b12bd5b9b1..db43e6892f1 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -149,14 +149,22 @@ const h5tools_dump_header_t h5tools_standardformat = { "}", /*extlinkblockend */ "{", /*udlinkblockbegin */ "}", /*udlinkblockend */ - "{", /*DO NOT USE strblockbegin */ - "}", /*DO NOT USE strblockend */ - "{", /*DO NOT USEenumblockbegin */ - "}", /*DO NOT USEenumblockend */ + "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 */ - "{", /*DO NOT USEvlenblockbegin */ - "}", /*DO NOT USEvlenblockend */ "{", /*subsettingblockbegin */ "}", /*subsettingblockend */ "(", /*startblockbegin */ @@ -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->structblockbegin); + 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); @@ -2415,7 +2423,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if (H5Tclose(tmp_type) < 0) H5TOOLS_ERROR((-1), "H5Tclose failed"); - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); break; case H5T_BITFIELD: @@ -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->structblockbegin); + 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++; @@ -2556,7 +2565,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->enumblockend); break; @@ -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->structblockbegin); + 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->structblockend); + 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; From 9cb4198dac183239cd3f0f6b25e0ef318db9f067 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 18:37:57 +0000 Subject: [PATCH 3/3] Committing clang-format changes --- tools/lib/h5tools_dump.c | 96 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index db43e6892f1..2986de7d395 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -127,54 +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 */ - "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 */ + "{", /*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 */