diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2011-03-07 16:37:49 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2011-03-07 16:37:49 (GMT) |
commit | 79757db4c2ba2181ab88ba23f392790782802645 (patch) | |
tree | 93075de94c95b19ee2ccc2fda9814273dd2a7791 /tools | |
parent | 727b687ae6c80c9854cb53814fa1c12f27c2994c (diff) | |
download | hdf5-79757db4c2ba2181ab88ba23f392790782802645.zip hdf5-79757db4c2ba2181ab88ba23f392790782802645.tar.gz hdf5-79757db4c2ba2181ab88ba23f392790782802645.tar.bz2 |
[svn-r20196] This checkin consists of the following:
A) - Changes to add the new tool "h5watch" to High Level
- Changes to add three new High Level public routines for retrieving elements appended to a dataset
B) A patch from Mike M. to fix the H5Dflush/refresh problem:
src/H5Dpkg.h
src/H5Dint.c
src/H5D.c
C) Fix for an assertion failure in H5FS_sect_link_size() in H5FSsection.c
src/H5Dbtree2.c
h5committested; tested also on linew, duty, fred.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dump.c | 3 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 10 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 10 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 168 |
4 files changed, 140 insertions, 51 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 6b1f576..e89af7e 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -157,7 +157,7 @@ static h5tool_format_t dataformat = { "{\n", /*cmpd_pre */ "}", /*cmpd_suf */ "\n", /*cmpd_end */ - + NULL, /* cmpd_listv */ ", ", /*vlen_sep */ "(", /*vlen_pre */ ")", /*vlen_suf */ @@ -241,6 +241,7 @@ static h5tool_format_t xml_dataformat = { "", /*cmpd_pre */ "", /*cmpd_suf */ "", /*cmpd_end */ + "", /*cmpd_listv */ " ", /*vlen_sep */ " ", /*vlen_pre */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index e7ba801..dbb20a0 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -74,6 +74,7 @@ NULL, /*fmt_ullong */ "{\n", /*cmpd_pre */ "}", /*cmpd_suf */ "\n", /*cmpd_end */ +NULL, /* cmpd_listv */ ", ", /*vlen_sep */ "(", /*vlen_pre */ @@ -2269,6 +2270,9 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools * + index_y * size_x * + index_x * + * Modifications: + * Vailin Choi; August 2010 + * Modified for h5watch to handle the printing of compound fields. *------------------------------------------------------------------------- */ static herr_t @@ -2306,6 +2310,11 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); ctx.size_last_dim = total_size[ctx.ndims - 1]; + if(info->cmpd_listv) + ctx.cmpd_listv = info->cmpd_listv; + else + ctx.cmpd_listv = NULL; + h5tools_display_simple_subset(stream, info, &ctx, dset, p_type, sset, f_space, total_size); /* Terminate the output */ @@ -2316,6 +2325,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset } CATCH + if(f_space >= 0 && H5Sclose(f_space) < 0) H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index b3e3dd2..17abbd5 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -192,6 +192,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. */ @@ -327,12 +331,15 @@ 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 **cmpd_listv; /* * Fields associated with vlen data types. @@ -499,12 +506,13 @@ typedef struct h5tools_context_t { 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 + 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 */ + 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_str.c b/tools/lib/h5tools_str.c index 8c9960f..ae0646a 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 @@ -628,6 +637,10 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch) * * PVN, 28 March 2006 * added H5T_NATIVE_LDOUBLE case + * + * Vailin Choi; August 2010 + * Modified to handle printing of selected compound fields for h5watch. + * *------------------------------------------------------------------------- */ char * @@ -851,64 +864,121 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } else if (H5Tget_class(type) == H5T_COMPOUND) { - unsigned j; - - nmembs = H5Tget_nmembers(type); - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + if(ctx->cmpd_listv) { /* there is <list_of_fields> */ + int save_indent_level; /* The indentation level */ + int i = 0, n = 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(n = 0; listv[n] != NULL; n++) { + if(n) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK)); + + /* See notes for RPM 2000-10-31 below (copied) */ + if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { + + h5tools_str_append(str, OPT(info->line_pre, ""), ""); + + for (x = 0; x < ctx->indent_level + 1; x++) + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } - for (j = 0; j < nmembs; j++) { - if (j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK)); + /* Process members of each field */ + for(i = 0; listv[n]->names[i] != NULL; i++) { + h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[n]->names[i]); + if(i) { + ctx->indent_level++; + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + } + } + h5tools_str_sprint(str, info, container, listv[n]->last_tid, cp_vp + listv[n]->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; + } + + /* See notes for RPM 2000-10-31 below (copied) */ + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - /* RPM 2000-10-31 - * If the previous character is a line-feed (which is true when - * h5dump is running) then insert some white space for - * indentation. Be warned that column number calculations will be - * incorrect and that object indices at the beginning of the line - * will be missing (h5dump doesn't display them anyway). */ if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; h5tools_str_append(str, OPT(info->line_pre, ""), ""); - for (x = 0; x < ctx->indent_level + 1; x++) + for (x = 0; x < ctx->indent_level; x++) h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } - /* The name */ - name = H5Tget_member_name(type, j); - h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - free(name); - - /* The value */ - offset = H5Tget_member_offset(type, j); - memb = H5Tget_member_type(type, j); - - ctx->indent_level++; - h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - ctx->indent_level--; - - H5Tclose(memb); - } - - /* RPM 2000-10-31 - * If the previous character is a line feed (which is true when - * h5dump is running) then insert some white space for indentation. - * Be warned that column number calculations will be incorrect and - * that object indices at the beginning of the line will be missing - * (h5dump doesn't display them anyway). */ - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - - if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; - - h5tools_str_append(str, OPT(info->line_pre, ""), ""); - - for (x = 0; x < ctx->indent_level; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); - } - - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + ctx->cmpd_listv = info->cmpd_listv; + } else { + unsigned j = 0; + + nmembs = H5Tget_nmembers(type); + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + + for (j = 0; j < nmembs; j++) { + if (j) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK)); + + /* RPM 2000-10-31 + * If the previous character is a line-feed (which is true when + * h5dump is running) then insert some white space for + * indentation. Be warned that column number calculations will be + * incorrect and that object indices at the beginning of the line + * will be missing (h5dump doesn't display them anyway). */ + if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { + int x; + + h5tools_str_append(str, OPT(info->line_pre, ""), ""); + + for (x = 0; x < ctx->indent_level + 1; x++) + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } + + /* The name */ + name = H5Tget_member_name(type, j); + h5tools_str_append(str, OPT(info->cmpd_name, ""), name); + free(name); + + /* The value */ + offset = H5Tget_member_offset(type, j); + memb = H5Tget_member_type(type, j); + + ctx->indent_level++; + h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); + ctx->indent_level--; + + H5Tclose(memb); + } + + /* RPM 2000-10-31 + * If the previous character is a line feed (which is true when + * h5dump is running) then insert some white space for indentation. + * Be warned that column number calculations will be incorrect and + * that object indices at the beginning of the line will be missing + * (h5dump doesn't display them anyway). */ + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + + if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { + int x; + + h5tools_str_append(str, OPT(info->line_pre, ""), ""); + + for (x = 0; x < ctx->indent_level; x++) + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + } } else if (H5Tget_class(type) == H5T_ENUM) { char enum_name[1024]; |