summaryrefslogtreecommitdiffstats
path: root/tools/h5ls/h5ls.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>2002-01-31 19:47:06 (GMT)
committerRobb Matzke <matzke@llnl.gov>2002-01-31 19:47:06 (GMT)
commit378df38955700bffd90303965e1685341e785b1d (patch)
tree27e5fbe98a9b3b5f06f2a553ed5cb3e23e5b511f /tools/h5ls/h5ls.c
parente0177ee0f35a759047126fc17f0e09b7b3f41395 (diff)
downloadhdf5-378df38955700bffd90303965e1685341e785b1d.zip
hdf5-378df38955700bffd90303965e1685341e785b1d.tar.gz
hdf5-378df38955700bffd90303965e1685341e785b1d.tar.bz2
[svn-r4892] ./hdf5-devel/tools/h5ls/h5ls.c
2002-01-31 15:22:24 Robb Matzke <matzke@arborea.spizella.com> *: Displays array data type information instead of saying `4-byte class-10 unknown'.
Diffstat (limited to 'tools/h5ls/h5ls.c')
-rw-r--r--tools/h5ls/h5ls.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index bfbe251..df9b0b5 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1056,6 +1056,64 @@ display_vlen_type(hid_t type, int ind)
return TRUE;
}
+/*---------------------------------------------------------------------------
+ * Purpose: Print information about an array type
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE
+ *
+ * Programmer: Robb Matzke
+ * Thursday, January 31, 2002
+ *
+ * Modifications:
+ *---------------------------------------------------------------------------
+ */
+static hbool_t
+display_array_type(hid_t type, int ind)
+{
+ hid_t super;
+ int ndims, i, *perm=NULL, identity;
+ hsize_t *dims=NULL;
+
+ if (H5T_ARRAY!=H5Tget_class(type)) return FALSE;
+ ndims = H5Tget_array_ndims(type);
+ if (ndims) {
+ dims = malloc(ndims*sizeof(dims[0]));
+ perm = malloc(ndims*sizeof(perm[0]));
+ H5Tget_array_dims(type, dims, perm);
+
+ /* Print dimensions */
+ for (i=0; i<ndims; i++)
+ HDfprintf(stdout, "%s%Hu" , i?",":"[", dims[i]);
+ putchar(']');
+
+ /* Print permutation vector if not identity */
+ for (i=0, identity=TRUE; identity && i<ndims; i++) {
+ if (i!=perm[i]) identity = FALSE;
+ }
+ if (!identity) {
+ fputs(" perm=[", stdout);
+ for (i=0; i<ndims; i++)
+ HDfprintf(stdout, "%s%d", i?",":"", perm[i]);
+ putchar(']');
+ }
+
+ free(dims);
+ free(perm);
+ } else {
+ fputs(" [SCALAR]", stdout);
+ }
+
+
+ /* Print parent type */
+ putchar(' ');
+ super = H5Tget_super(type);
+ display_type(super, ind+4);
+ H5Tclose(super);
+ return TRUE;
+}
+
/*-------------------------------------------------------------------------
* Function: display_type
@@ -1110,6 +1168,7 @@ display_type(hid_t type, int ind)
display_string_type(type, ind) ||
display_reference_type(type, ind) ||
display_vlen_type(type, ind) ||
+ display_array_type(type, ind) ||
display_opaque_type(type, ind)) {
return;
}