diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2005-10-19 20:03:03 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2005-10-19 20:03:03 (GMT) |
commit | 0b25880f205f0ed6e9deb48c3e988c6e1fa6c7ce (patch) | |
tree | 36fb241749e0fe5d6356cf8d919f0e657ab7fbbc /tools | |
parent | 95b889771b72240d71c1407a490b554621c1604f (diff) | |
download | hdf5-0b25880f205f0ed6e9deb48c3e988c6e1fa6c7ce.zip hdf5-0b25880f205f0ed6e9deb48c3e988c6e1fa6c7ce.tar.gz hdf5-0b25880f205f0ed6e9deb48c3e988c6e1fa6c7ce.tar.bz2 |
[svn-r11585] Purpose:
bug fix
Description:
indices not printed correctly
Solution:
pass to the prefix in h5tools_simple_prefix the total position instead of the current stripmine position i;
this is necessary to print the array indices; add a new field sm_pos in h5tools_context_t, the current stripmine element position
NOTE : this bug was already solved in 1.7
Platforms tested:
linux
Misc. update:
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5tools.c | 19 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 1 |
2 files changed, 19 insertions, 1 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 8fc8eab..06197a6 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -529,6 +529,12 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info, * Do not dereference the memory for a variable-length string here. * Deref in h5tools_str_sprint() instead so recursive types are * handled correctly. + * + * Pedro Vicente Nunes, THG, 2005-10-19 + * pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + * new field sm_pos in h5tools_context_t, the current stripmine element position *------------------------------------------------------------------------- */ void @@ -544,6 +550,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 @@ -662,7 +669,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, " ")); @@ -997,6 +1009,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; 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); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 7a0109e..01bcca7 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -416,6 +416,7 @@ typedef struct h5tools_context_t { int default_indent_level; /*this is used when the indent level gets changed */ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */ hsize_t pos[H5S_MAX_RANK]; /* matrix position */ + hsize_t sm_pos; /* current stripmine element position */ } h5tools_context_t; /* a structure to hold the subsetting particulars for a dataset */ |