summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-12-11 19:25:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-12-11 19:25:08 (GMT)
commit57afb68e465d8a0bc521a68c96c6d67db358e482 (patch)
tree0761afb1ad3c8a606a9be6b6b93654fbc980de8e /tools/lib
parentcc6eb939f4dec06e234835acbb5b3bc269b228c5 (diff)
downloadhdf5-57afb68e465d8a0bc521a68c96c6d67db358e482.zip
hdf5-57afb68e465d8a0bc521a68c96c6d67db358e482.tar.gz
hdf5-57afb68e465d8a0bc521a68c96c6d67db358e482.tar.bz2
Bring SWMR-related tools changes from revise_chunks to develop.
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.h9
-rw-r--r--tools/lib/h5tools_dump.c4
-rw-r--r--tools/lib/h5tools_str.c64
3 files changed, 76 insertions, 1 deletions
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index ed93a46..38739c8 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -203,6 +203,10 @@ typedef struct h5tools_dump_header_t {
} h5tools_dump_header_t;
+/* Forward declaration (see declaration in h5tools_str.c) */
+struct H5LD_memb_t;
+
+
/*
* Information about how to format output.
*/
@@ -338,12 +342,16 @@ typedef struct h5tool_format_t {
*
* end: a string to print after we reach the last element of
* each compound type. prints out before the suf.
+ *
+ * listv: h5watch: vector containing info about the list of compound fields to be printed.
*/
const char *cmpd_name;
const char *cmpd_sep;
const char *cmpd_pre;
const char *cmpd_suf;
const char *cmpd_end;
+ const struct H5LD_memb_t * const *cmpd_listv;
+
/*
* Fields associated with vlen data types.
@@ -516,6 +524,7 @@ typedef struct h5tools_context_t {
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
hsize_t sm_pos; /* current stripmine element position */
+ struct H5LD_memb_t **cmpd_listv; /* h5watch: vector containing info about the list of compound fields to be printed */
} h5tools_context_t;
typedef struct subset_d {
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index cae3107..67585d1 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -61,6 +61,7 @@ NULL, /*fmt_ullong */
"{", /*cmpd_pre */
"}", /*cmpd_suf */
"\n", /*cmpd_end */
+NULL, /* cmpd_listv */
", ", /*vlen_sep */
"(", /*vlen_pre */
@@ -1485,6 +1486,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
ctx->size_last_dim = total_size[ctx->ndims - 1];
+ /* Set the compound datatype field list for display */
+ ctx->cmpd_listv = info->cmpd_listv;
+
h5tools_display_simple_subset(stream, info, ctx, dset, p_type, sset, f_space, total_size);
CATCH
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index a0a78f5..358e993 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -29,6 +29,15 @@
#include "h5tools_ref.h"
#include "h5tools_str.h" /*function prototypes */
+/* Copied from hl/src/H5LDprivate.h */
+/* Info about the list of comma-separated compound fields */
+typedef struct H5LD_memb_t {
+ size_t tot_offset;
+ size_t last_tsize;
+ hid_t last_tid;
+ char **names;
+} H5LD_memb_t;
+
/*
* If REPEAT_VERBOSE is defined then character strings will be printed so
* that repeated character sequences like "AAAAAAAAAA" are displayed as
@@ -730,6 +739,9 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
* PVN, 28 March 2006
* added H5T_NATIVE_LDOUBLE case
*
+ * Vailin Choi; August 2010
+ * Modified to handle printing of selected compound fields for h5watch.
+ *
* Raymond Lu, 2011-09-01
* CLANG compiler complained about the line (about 800):
* tempint = (tempint >> packed_data_offset) & packed_data_mask;
@@ -1024,7 +1036,57 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
break;
case H5T_COMPOUND:
- {
+ if(ctx->cmpd_listv) { /* there is <list_of_fields> */
+ int save_indent_level; /* The indentation level */
+ size_t curr_field; /* Current field to display */
+ int i = 0, x = 0; /* Local index variable */
+ H5LD_memb_t **listv; /* Vector of information for <list_of_fields> */
+
+ listv = ctx->cmpd_listv;
+ ctx->cmpd_listv = NULL;
+
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+
+ /*
+ * Go through the vector containing info about the comma-separated list of
+ * compound fields and then members in each field:
+ * put in "{", "}", ",", member name and value accordingly.
+ */
+ save_indent_level = ctx->indent_level;
+ for(curr_field = 0; listv[curr_field] != NULL; curr_field++) {
+ if (curr_field)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ else
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+
+ if(info->arr_linebreak)
+ h5tools_str_indent(str, info, ctx);
+
+ /* Process members of each field */
+ for(i = 0; listv[curr_field]->names[i] != NULL; i++) {
+ h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[curr_field]->names[i]);
+ if(i) {
+ ctx->indent_level++;
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+ }
+ }
+ h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid, cp_vp + listv[curr_field]->tot_offset, ctx);
+ if(ctx->indent_level > 0)
+ for(x = ctx->indent_level; x > 0; x--)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
+ ctx->indent_level = save_indent_level;
+ }
+
+
+ if(info->arr_linebreak) {
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ h5tools_str_indent(str, info, ctx);
+ }
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
+
+ ctx->cmpd_listv = info->cmpd_listv;
+
+ } else {
unsigned nmembs;
unsigned j;