From 26e709edc65f279cb4a9fbd4e31a9531ce62a8b7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 13 Apr 2015 15:15:00 -0500 Subject: [svn-r26794] Fix formatting for selection. Irregular reuses blocks and points for datasets however indentation after line breaks are an issue. --- tools/lib/h5tools_dump.c | 34 ++++++++++++++++++---------------- tools/lib/h5tools_str.c | 9 ++------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 29a6d68..54b7015 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2890,15 +2890,33 @@ h5tools_print_virtual_selection(hid_t vspace, hid_t dcpl_id, size_t index, h5tools_str_append(buffer, " %s", h5tools_dump_header_format->virtualselectionblockend); break; case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + h5tools_str_reset(buffer); if (H5Sis_regular_hyperslab(vspace)) { h5tools_str_append(buffer, "%s %s ", VDS_REG_HYPERSLAB, h5tools_dump_header_format->virtualselectionblockbegin); + h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); + + h5tools_str_reset(buffer); h5tools_str_dump_space_slabs(buffer, vspace, info, ctx); } else { h5tools_str_append(buffer, "%s %s ", VDS_IRR_HYPERSLAB, h5tools_dump_header_format->virtualselectionblockbegin); + 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_str_dump_space_blocks(buffer, vspace, info); + ctx->indent_level--; } + 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", h5tools_dump_header_format->virtualselectionblockend); break; case H5S_SEL_ALL: /* Entire extent selected */ @@ -3001,11 +3019,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); 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); - stl = H5Pget_layout(dcpl_id); switch (stl) { case H5D_CHUNKED: @@ -3243,21 +3256,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); -/*EIP 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->indent_level--; } - - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - - 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); } break; default: @@ -3266,8 +3270,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0); }/*switch*/ - ctx->indent_level--; - ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 4381df8..cd1bec8 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -438,11 +438,9 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, H5Sget_regular_hyperslab(rspace, start, stride, count, block); /* Print hyperslab information */ - h5tools_str_append(str, "%s", "\n"); - h5tools_str_indent(str, info, ctx); /* Start coordinates */ - h5tools_str_append(str, "%s ", START); + h5tools_str_append(str, "%s%s ", info->line_indent, START); for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", start[j]); h5tools_str_append(str, ")"); @@ -478,8 +476,6 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", block[j]); } h5tools_str_append(str, ")"); - h5tools_str_append(str, "%s", "\n"); - h5tools_str_indent(str, info, ctx); } /*------------------------------------------------------------------------- @@ -523,8 +519,7 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, for (i = 0; i < nblocks; i++) { int j; - h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", - (unsigned long)i); + h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) -- cgit v0.12