diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2005-05-09 14:53:22 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2005-05-09 14:53:22 (GMT) |
commit | 1b313aa2f65a5f35de6bf820f08de5045fd3c232 (patch) | |
tree | de7522a948aa2a7734709cca056f91519855a0fb /tools/lib | |
parent | bbe03d73613afbcdeca14c045c8b90fac37e0fe8 (diff) | |
download | hdf5-1b313aa2f65a5f35de6bf820f08de5045fd3c232.zip hdf5-1b313aa2f65a5f35de6bf820f08de5045fd3c232.tar.gz hdf5-1b313aa2f65a5f35de6bf820f08de5045fd3c232.tar.bz2 |
[svn-r10738] Purpose:
bug fix 366
Description:
the printing of the array indices was done relatively to the stripmine data (data read
by hyperslabs when its memory requiremnts are too large)
this was causing an incorrect numbering of the array indices (the next read would initialize
the indices to zero)
Solution:
added a field to the print context that keeps track of the stripmine position
and pass to the rendering function the total element position
Platforms tested:
Linux
Misc. update:
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools.c | 13 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 43 |
2 files changed, 34 insertions, 22 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); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 3fae481..ada098b 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -26,8 +26,8 @@ #define ESCAPE_HTML 1 #define OPT(X,S) ((X) ? (X) : (S)) #define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */ -#define START_OF_DATA 0x0001 -#define END_OF_DATA 0x0002 +#define START_OF_DATA 0x0001 +#define END_OF_DATA 0x0002 /* * Information about how to format output. @@ -399,23 +399,24 @@ typedef struct dump_header{ } dump_header; typedef struct h5tools_context_t { - size_t cur_column; /*current column for output */ - size_t cur_elmt; /*current element/output line */ - int need_prefix; /*is line prefix needed? */ - int ndims; /*dimensionality */ - hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */ - hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */ - int prev_multiline; /*was prev datum multiline? */ - size_t prev_prefix_len;/*length of previous prefix */ - int continuation; /*continuation of previous data?*/ - hsize_t size_last_dim; /*the size of the last dimension, - *needed so we can break after each - *row */ - int indent_level; /*the number of times we need some - *extra indentation */ - 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 */ + size_t cur_column; /*current column for output */ + size_t cur_elmt; /*current element/output line */ + int need_prefix; /*is line prefix needed? */ + int ndims; /*dimensionality */ + hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */ + hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */ + int prev_multiline; /*was prev datum multiline? */ + size_t prev_prefix_len; /*length of previous prefix */ + int continuation; /*continuation of previous data?*/ + hsize_t size_last_dim; /*the size of the last dimension, + *needed so we can break after each + *row */ + int indent_level; /*the number of times we need some + *extra indentation */ + 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; @@ -517,7 +518,7 @@ extern int h5tools_canreadf(const char* name, hid_t dcpl_id); extern int h5tools_can_encode(H5Z_filter_t filtn); -void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); +void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); -#endif /* H5TOOLS_H__ */ +#endif /* H5TOOLS_H__ */ |