diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools.h | 13 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 35 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 30 |
3 files changed, 48 insertions, 30 deletions
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index cf841e5..6512f9b 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -95,13 +95,14 @@ #define PACKED_LENGTH "LENGTH" #define VDS_VIRTUAL "VIRTUAL" #define VDS_MAPPING "MAPPING" -#define VDS_REG_HYPERSLAB "REGULAR_HYPERSLAB" -#define VDS_IRR_HYPERSLAB "IRREGULAR_HYPERSLAB" +#define VDS_SOURCE "SOURCE" +#define VDS_REG_HYPERSLAB "SELECTION REGULAR_HYPERSLAB" +#define VDS_IRR_HYPERSLAB "SELECTION IRREGULAR_HYPERSLAB" #define VDS_POINT "POINT" -#define VDS_SRC_FILE "SRC_FILE" -#define VDS_SRC_DATASET "SRC_DATASET" -#define VDS_NONE "SELECTION_NONE" -#define VDS_ALL "SELECTION_ALL" +#define VDS_SRC_FILE "FILE" +#define VDS_SRC_DATASET "DATASET" +#define VDS_NONE "SELECTION NONE" +#define VDS_ALL "SELECTION ALL" #define BEGIN "{" #define END "}" diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 366ca81..66d6cea 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -181,13 +181,13 @@ BLOCK, /*blockbegin */ ")", /*dataspacedimend */ "", /*virtualselectionbegin */ -";", /*virtualselectionend */ +"", /*virtualselectionend */ "{", /*virtualselectionblockbegin */ "}", /*virtualselectionblockend */ "\"", /*virtualfilenamebeginbegin */ -"\";", /*virtualfilenamebeginend */ +"\"", /*virtualfilenamebeginend */ "\"", /*virtualdatasetnamebegin */ -"\";", /*virtualdtatasetnameend */ +"\"", /*virtualdtatasetnameend */ }; const h5tools_dump_header_t* h5tools_dump_header_format; @@ -3165,9 +3165,30 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", VDS_VIRTUAL, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + + ctx->indent_level++; + + h5tools_str_reset(&buffer); h5tools_print_virtual_selection(&buffer, info, ctx, virtual_vspace, dcpl_id, next); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + ctx->indent_level--; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", VDS_SOURCE, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + + ctx->indent_level++; + ssize_out = H5Pget_virtual_filename(dcpl_id, next, NULL, 0); H5Pget_virtual_filename(dcpl_id, next, name, sizeof(name)); ssize_out = H5Pget_virtual_dsetname(dcpl_id, next, NULL, 0); @@ -3191,11 +3212,17 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualdatasetnameend); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + h5tools_str_reset(&buffer); + h5tools_print_virtual_selection(&buffer, info, ctx, virtual_srcspace, dcpl_id, next); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + + ctx->indent_level--; + ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_print_virtual_selection(&buffer, info, ctx, virtual_srcspace, dcpl_id, next); + h5tools_str_append(&buffer, "%s", END); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); ctx->indent_level--; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 6aab146..8302c48 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -432,17 +432,12 @@ void h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info, h5tools_context_t *ctx) { - hsize_t *start; - hsize_t *stride; - hsize_t *count; - hsize_t *block; - int j; - int ndims = H5Sget_simple_extent_ndims(rspace); - - start = (hsize_t *)malloc(sizeof(hsize_t) * ndims); - stride = (hsize_t *)malloc(sizeof(hsize_t) * ndims); - count = (hsize_t *)malloc(sizeof(hsize_t) * ndims); - block = (hsize_t *)malloc(sizeof(hsize_t) * ndims); + hsize_t start[H5S_MAX_RANK]; + hsize_t stride[H5S_MAX_RANK]; + hsize_t count[H5S_MAX_RANK]; + hsize_t block[H5S_MAX_RANK]; + int j; + int ndims = H5Sget_simple_extent_ndims(rspace); H5Sget_regular_hyperslab(rspace, start, stride, count, block); @@ -454,7 +449,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, h5tools_str_append(str, "%s ", START); for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", start[j]); - h5tools_str_append(str, ");"); + h5tools_str_append(str, ")"); h5tools_str_append(str, "%s", "\n"); h5tools_str_indent(str, info, ctx); @@ -462,7 +457,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, h5tools_str_append(str, "%s ", STRIDE); for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", stride[j]); - h5tools_str_append(str, ");"); + h5tools_str_append(str, ")"); h5tools_str_append(str, "%s", "\n"); h5tools_str_indent(str, info, ctx); @@ -474,7 +469,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, else h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", count[j]); } - h5tools_str_append(str, ");"); + h5tools_str_append(str, ")"); h5tools_str_append(str, "%s", "\n"); h5tools_str_indent(str, info, ctx); @@ -486,14 +481,9 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, else h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", block[j]); } - h5tools_str_append(str, ");"); + h5tools_str_append(str, ")"); h5tools_str_append(str, "%s", "\n"); h5tools_str_indent(str, info, ctx); - - HDfree(block); - HDfree(count); - HDfree(stride); - HDfree(start); } /*------------------------------------------------------------------------- |