summaryrefslogtreecommitdiffstats
path: root/tools/h5tools.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-01-07 11:42:27 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-01-07 11:42:27 (GMT)
commitdb48cdc44e1937448747a645e04ddf11d04ae355 (patch)
tree838cf39908647b0f2f6e7113f03c695e5d4ca03a /tools/h5tools.c
parent4f7e218959be3076c079a9cabede8c167bb35689 (diff)
downloadhdf5-db48cdc44e1937448747a645e04ddf11d04ae355.zip
hdf5-db48cdc44e1937448747a645e04ddf11d04ae355.tar.gz
hdf5-db48cdc44e1937448747a645e04ddf11d04ae355.tar.bz2
[svn-r1012] Changes since 19981217
---------------------- ./tools/h5ls.c Displays enumeration type information. ./tools/h5tools.c Displays enumerated data using symbol names.
Diffstat (limited to 'tools/h5tools.c')
-rw-r--r--tools/h5tools.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/h5tools.c b/tools/h5tools.c
index a4fe4fa..c4110a6 100644
--- a/tools/h5tools.c
+++ b/tools/h5tools.c
@@ -303,6 +303,15 @@ h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp)
}
strcat(temp, OPT(info->cmpd_suf, "}"));
+ } else if (H5T_ENUM==H5Tget_class(type)) {
+ if (H5Tenum_nameof(type, vp, temp, sizeof temp)<0) {
+ strcpy(temp, "0x");
+ n = H5Tget_size(type);
+ for (i=0; i<n; i++) {
+ sprintf(temp+strlen(temp), "%02x", ((unsigned char*)vp)[i]);
+ }
+ }
+
} else {
strcpy(temp, "0x");
n = H5Tget_size(type);
@@ -362,7 +371,7 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type)
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
hsize_t sm_nbytes; /*bytes per stripmine */
hsize_t sm_nelmts; /*elements per stripmine*/
- unsigned char *sm_buf; /*buffer for raw data */
+ unsigned char *sm_buf=NULL; /*buffer for raw data */
hid_t sm_space; /*stripmine data space */
/* Hyperslab info */
@@ -484,6 +493,7 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type)
}
H5Sclose(sm_space);
H5Sclose(f_space);
+ if (sm_buf) free(sm_buf);
return 0;
}
@@ -608,6 +618,10 @@ h5dump_fixtype(hid_t f_type)
}
break;
+ case H5T_ENUM:
+ m_type = H5Tcopy(f_type);
+ break;
+
case H5T_TIME:
case H5T_BITFIELD:
case H5T_OPAQUE: