summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-06-21 18:24:35 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-06-21 18:24:35 (GMT)
commit83b77cb4eb777b8e04ba2bdc71e2c53bc9cfd1b5 (patch)
tree4b81ee58b585e9354574cc4849e89d080fa7bbc4 /tools/lib/h5tools_str.c
parent82a2e4ebca4dc595a7337703d6001f2adbe45e31 (diff)
downloadhdf5-83b77cb4eb777b8e04ba2bdc71e2c53bc9cfd1b5.zip
hdf5-83b77cb4eb777b8e04ba2bdc71e2c53bc9cfd1b5.tar.gz
hdf5-83b77cb4eb777b8e04ba2bdc71e2c53bc9cfd1b5.tar.bz2
[svn-r21014] Purpose:
HDFFV-5878 - GMQS: h5dump - incorrect output format for array type with multiple elements in an index Description: Fixed h5dump to display the first line of each element into correct position for multiple dimention array type. Before this fix, the first line of each element in array were displayed after the last line of previous element without moving to the next line (+indentation) Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE)
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index af3f7e7..f8597e6 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1042,6 +1042,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else if (H5Tget_class(type) == H5T_ARRAY) {
int k, ndims;
hsize_t i, dims[H5S_MAX_RANK], temp_nelmts;
+ static int is_next_arry_elmt=0;
/* Get the array's base datatype for each element */
memb = H5Tget_super(type);
@@ -1077,12 +1078,31 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
for (x = 0; x < ctx->indent_level + 1; x++)
h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
} /* end if */
- else if (i && info->arr_sep)
- h5tools_str_append(str, " ");
+ else if (i && info->arr_sep) {
+ /* if next element begin, add next line with indent */
+ if (is_next_arry_elmt) {
+ int x;
+ is_next_arry_elmt = 0;
+
+ h5tools_str_append(str, "%s", "\n ");
+
+ if (ctx->indent_level >= 0)
+ if (!info->pindex)
+ h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
+
+ for (x = 0; x < ctx->indent_level + 1; x++)
+ h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
+ }
+ /* otherwise just add space */
+ else
+ h5tools_str_append(str, " ");
+
+ } /* end else if */
ctx->indent_level++;
- /* Dump the array element */
+ /* Dump values in an array element */
+ is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */
h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx);
ctx->indent_level--;
@@ -1090,6 +1110,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* Print the closing bracket */
h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
+ is_next_arry_elmt = 1; /* set for begining of next array element */
H5Tclose(memb);
}
else if (H5Tget_class(type) == H5T_VLEN) {