summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-06-22 21:22:33 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-06-22 21:22:33 (GMT)
commitb5fbe95269323490a89f6d580a215c4763c18a2a (patch)
treec7bf5ade9e79e858626a3f6d05ac8a5731501c99 /tools/lib
parentcb05ffd2bb6e03d1759eb877b14382144a8b4c5d (diff)
downloadhdf5-b5fbe95269323490a89f6d580a215c4763c18a2a.zip
hdf5-b5fbe95269323490a89f6d580a215c4763c18a2a.tar.gz
hdf5-b5fbe95269323490a89f6d580a215c4763c18a2a.tar.bz2
[svn-r21018] Purpose:
HDFFV-5878 - GMQS: h5dump - incorrect output format for array type with multiple elements in an index Description: Merged from HDF5 trunk r21014. 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)
Diffstat (limited to 'tools/lib')
-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) {