diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-29 17:42:09 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-29 17:42:09 (GMT) |
commit | d4eec2cb073e4e9f02ca990cbd93480e526a130e (patch) | |
tree | 41fceceb69736cd18354a986d2d34544b55c4ffc /tools/h5dump | |
parent | 3edde57e73c43474ee146b0c8073fba4eafe9e34 (diff) | |
download | hdf5-d4eec2cb073e4e9f02ca990cbd93480e526a130e.zip hdf5-d4eec2cb073e4e9f02ca990cbd93480e526a130e.tar.gz hdf5-d4eec2cb073e4e9f02ca990cbd93480e526a130e.tar.bz2 |
[svn-r8758] Purpose:
h5dump new feature, bug fix
Description:
added the dump of unmamed types to the file contents
fixed a bug in the type array, it was printing invalid characters with the array indices option on
Solution:
Platforms tested:
linux
AIX
solaris
Misc. update:
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 35 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 18 |
2 files changed, 43 insertions, 10 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 163bad8..06c6b95 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -476,7 +476,7 @@ static void dump_data(hid_t, int, struct subset_t *, int); static void dump_dcpl(hid_t dcpl, hid_t type_id, hid_t obj_id); static void dump_comment(hid_t obj_id); static void dump_fcpl(hid_t fid); -static void dump_list(hid_t fid); +static void dump_fcontents(hid_t fid); /* XML format: same interface, alternative output */ @@ -1949,11 +1949,11 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) } - /* print the matrix indices */ + /* print the matrix indices */ outputformat->pindex=pindex; if (outputformat->pindex) { - outputformat->idx_fmt = "(%s),"; + outputformat->idx_fmt = "(%s):"; outputformat->idx_n_fmt = "%lu"; outputformat->idx_sep = ","; outputformat->line_pre = " %s "; @@ -2544,7 +2544,7 @@ dump_fcpl(hid_t fid) } /*------------------------------------------------------------------------- - * Function: dump_list + * Function: dump_fcontents * * Purpose: prints all objects * @@ -2556,10 +2556,32 @@ dump_fcpl(hid_t fid) * *------------------------------------------------------------------------- */ -static void dump_list(hid_t fid) + +static void dump_fcontents(hid_t fid) { + hid_t did, tid, gid; + char type_name[1024]; + int i; + printf("%s %s\n",FILE_CONTENTS, BEGIN); + /* special case of unamed types in root group */ + if (unamedtype) + { + gid=H5Gopen(fid,"/"); + for (i = 0; i < type_table->nobjs; i++) + if (!type_table->objs[i].recorded) + { + did = H5Dopen(gid, type_table->objs[i].objname); + tid = H5Dget_type(did); + sprintf(type_name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[i].objno); + H5Tclose(tid); + H5Dclose(did); + printf(" %-10s %s\n", "datatype", type_name ); + } + H5Gclose(gid); + } + /* print objects in the files */ h5trav_getinfo(fid, NULL, 1); @@ -2570,6 +2592,7 @@ static void dump_list(hid_t fid) + /*------------------------------------------------------------------------- * Function: set_output_file * @@ -3540,7 +3563,7 @@ main(int argc, const char *argv[]) { if (display_fi) { - dump_list(fid); + dump_fcontents(fid); end_obj(dump_header_format->fileend,dump_header_format->fileblockend); goto done; } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index aaba2e5..16c3db4 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -4987,15 +4987,25 @@ static void gent_fcontents(void) assert(ret>=0); /*------------------------------------------------------------------------- - * datatype + * datatypes *------------------------------------------------------------------------- */ - tid=H5Tcopy(H5T_STD_B8LE); + tid=H5Tcopy(H5T_NATIVE_INT); ret=H5Tcommit(fid, "mytype", tid); assert(ret>=0); ret=H5Tclose(tid); assert(ret>=0); + /* no name datatype */ + tid=H5Tcopy(H5T_NATIVE_INT); + ret=H5Tcommit(fid, "mytype2", tid); + assert(ret>=0); + write_dset(fid,1,dims,"dsetmytype2",tid,buf); + ret=H5Gunlink(fid,"mytype2"); + assert(ret>=0); + ret=H5Tclose(tid); + assert(ret>=0); + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -5010,12 +5020,12 @@ static void gent_fcontents(void) ret=H5Fclose(fid); assert(ret>=0); - - } + + /*------------------------------------------------------------------------- * Function: gent_null_space * |