diff options
-rw-r--r-- | tools/h5dump.c | 9 | ||||
-rw-r--r-- | tools/h5tools.c | 25 |
2 files changed, 26 insertions, 8 deletions
diff --git a/tools/h5dump.c b/tools/h5dump.c index 33829b9..37b23e7 100644 --- a/tools/h5dump.c +++ b/tools/h5dump.c @@ -70,9 +70,9 @@ static h5dump_t dataformat = { 80, /*line_ncols*//*standard default columns*/ 0, /*line_per_line*/ - " ",/*line_pre*/ - " %s ",/*line_1st*/ - " %s",/*line_cont*/ + "",/*line_pre*/ + "%s",/*line_1st*/ + "%s",/*line_cont*/ "",/*line_suf*/ "",/*line_sep*/ 1,/*line_multi_new*/ @@ -1231,8 +1231,7 @@ dump_data (hid_t obj_id, int obj_data) { use indent but with the merging of the tools lib we have to do something different for the lib funtions... the normal indentation is 6 so when we dont need any extra indentation, depth will be 0.*/ - depth = indent/stdindent - 2; - +depth = indent/stdindent+1; indentation (indent); /* printf("%s %s\n", dump_header_format->databegin, BEGIN);*/ begin_obj(dump_header_format->databegin, NULL, dump_header_format->datablockbegin); diff --git a/tools/h5tools.c b/tools/h5tools.c index 9e5efe8..97a06fa 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -99,6 +99,7 @@ typedef struct h5dump_context_t { *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*/ } h5dump_context_t; typedef herr_t (*H5G_operator_t)(hid_t, const char*, void*); @@ -1118,19 +1119,36 @@ h5dump_simple_prefix(FILE *stream, const h5dump_t *info, } templength = h5dump_str_len(&prefix); indentlevel = ctx->indent_level; + for (i = 0; i < indentlevel; i++){ + fputs(h5dump_str_fmt(&prefix, 0, info->line_indent), stream); + templength += h5dump_str_len(&prefix); + } } else { /* this is because sometimes we dont print out all the header * info for the data(like the tattr-2.ddl example. if that happens * the ctx->indent_level a negative so we need to skip the above * and just print out 2 indent levels. maybe the 2 should be a value * of the ctx struct?? */ - indentlevel = 2; + if (0==elmtno && 0==secnum && info->line_1st) { + fputs(h5dump_str_fmt(&prefix, 0, info->line_1st), stream); + } else if (secnum && info->line_cont) { + fputs(h5dump_str_fmt(&prefix, 0, info->line_cont), + stream); + } else { + fputs(h5dump_str_fmt(&prefix, 0, info->line_pre), stream); + } + templength = h5dump_str_len(&prefix); + indentlevel = ctx->default_indent_level; + for (i = 0; i < indentlevel; i++){ + fputs(h5dump_str_fmt(&prefix, 0, info->line_indent), stream); + templength += h5dump_str_len(&prefix); + } } - for (i = 0; i < indentlevel; i++){ + /* for (i = 0; i < indentlevel; i++){ fputs(h5dump_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5dump_str_len(&prefix); } - +*/ ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; @@ -1371,6 +1389,7 @@ h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, */ memset(&ctx, 0, sizeof ctx); ctx.indent_level = indentlevel; + ctx.indent_level = indentlevel; ctx.need_prefix = 1; f_space = H5Dget_space(dset); ctx.ndims = H5Sget_simple_extent_ndims(f_space); |