summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools.c')
-rw-r--r--tools/lib/h5tools.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 3a23059..ddf476d 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -541,6 +541,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
size_t ncols = 80; /*available output width */
h5tools_str_t buffer; /*string into which to render */
int multiline; /*datum was multiline */
+ hsize_t curr_pos; /* total data element position */
int elmt_counter = 0;/*counts the # elements printed.
*I (ptl?) needed something that
*isn't going to get reset when a new
@@ -659,7 +660,12 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
if (secnum)
multiline++;
- h5tools_simple_prefix(stream, info, ctx, i, secnum);
+ /* pass to the prefix the total position instead of the current
+ stripmine position i; this is necessary to print the array
+ indices */
+ curr_pos = ctx->sm_pos + i;
+
+ h5tools_simple_prefix(stream, info, ctx, curr_pos, secnum);
} else if ((i || ctx->continuation) && secnum == 0) {
fputs(OPT(info->elmt_suf2, " "), stream);
ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
@@ -994,6 +1000,11 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
/* Print the data */
flags = (elmtno == 0) ? START_OF_DATA : 0;
flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0;
+
+ /* initialize the current stripmine position i; this is necessary to print the array
+ indices */
+ ctx.sm_pos = elmtno;
+
h5tools_dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts,
p_type, sm_buf);