summaryrefslogtreecommitdiffstats
path: root/src/h5ls.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-06-05 21:03:49 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-06-05 21:03:49 (GMT)
commit1e8ebeecfc67073a3019f9c2084a5977d2b8c62e (patch)
tree9ad027ec237578472f22d62b8adb6edfa9aafdfa /src/h5ls.c
parenta63ccc0c6b02c232744a35ed6fbb8c3708f7a3aa (diff)
downloadhdf5-1e8ebeecfc67073a3019f9c2084a5977d2b8c62e.zip
hdf5-1e8ebeecfc67073a3019f9c2084a5977d2b8c62e.tar.gz
hdf5-1e8ebeecfc67073a3019f9c2084a5977d2b8c62e.tar.bz2
[svn-r410] Changes since 19980604
---------------------- ./src/H5A.c Named data types can have attributes. Fixed bugs where the API functions didn't check the return values of their internal counterparts and thus the automatic error reporting didn't work. Fixed some places where the error stack wasn't cleared after a function returned failure. Data types returned by H5Aget_type() are always read-only. If the `attr_num' argument of H5Aiterate() is null then it acts like H5Giterate() instead of failing -- it begins processing attributes with the first one. ./src/H5D.c We check for allocation overruns when scalar datasets are stored in external files. ./src/H5O.c H5O_modify() will fail if the message is >=16kB. ./src/H5Oattr.c Split some long lines ./src/H5T.c ./src/H5Tprivate.h Added H5T_entof() to support attributes on named types. ./src/h5ls.c Prints the names of attributes and their sizes. ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c ./test/gheap.c ./test/istore.c ./test/links.c ./test/shtype.c If the environment variable HDF5_NOCLEANUP is defined then the temporary files are not removed. The testhdf5 program still has the bug that it removes *.h5, clobbering test files from other programs... oh well. ./test/dtypes.c Added attribute tests.
Diffstat (limited to 'src/h5ls.c')
-rw-r--r--src/h5ls.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/h5ls.c b/src/h5ls.c
index 64207be..c1d6965 100644
--- a/src/h5ls.c
+++ b/src/h5ls.c
@@ -28,6 +28,46 @@ usage (const char *progname)
exit (1);
}
+
+/*-------------------------------------------------------------------------
+ * Function: list_attr
+ *
+ * Purpose: Prints information about attributes.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Friday, June 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+list_attr (hid_t obj, const char *attr_name, void __unused__ *op_data)
+{
+ hid_t attr;
+ int i;
+
+ printf ("%*s%s", 26, "", attr_name);
+ if ((attr = H5Aopen_name (obj, attr_name))) {
+ hid_t space = H5Aget_space (attr);
+ hsize_t size[64];
+ int ndims = H5Sget_dims (space, size);
+ H5Sclose (space);
+ printf (" {");
+ for (i=0; i<ndims; i++) {
+ HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]);
+ }
+ putchar ('}');
+ H5Aclose (attr);
+ }
+
+ putchar ('\n');
+ return 0;
+}
/*-------------------------------------------------------------------------
@@ -80,9 +120,11 @@ list (hid_t group, const char *name, void __unused__ *op_data)
}
printf ("}\n");
H5Dclose (space);
+ H5Aiterate (obj, NULL, list_attr, NULL);
H5Dclose (obj);
} else if ((obj=H5Gopen (group, name))>=0) {
printf ("Group\n");
+ H5Aiterate (obj, NULL, list_attr, NULL);
H5Gclose (obj);
} else if (H5Gget_linkval (group, name, sizeof(buf), buf)>=0) {
if (NULL==HDmemchr (buf, 0, sizeof(buf))) {
@@ -91,6 +133,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
printf (" -> %s\n", buf);
} else if ((obj=H5Topen (group, name))>=0) {
printf ("Data type\n");
+ H5Aiterate (obj, NULL, list_attr, NULL);
H5Tclose (obj);
} else {
printf ("Unknown Type\n");