Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add other types and full type to enum/str/vlen dataformat for structblock[begin/end] #3353

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions tools/lib/h5tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
119 changes: 64 additions & 55 deletions tools/lib/h5tools_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -2473,15 +2481,15 @@ 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:
if ((snmembers = H5Tget_nmembers(type)) < 0)
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);

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down