summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-22 13:51:51 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-22 13:51:51 (GMT)
commitb56f0119896adefa8e55bebf0c151f8fcef5d33f (patch)
tree17be114da3f1ca32b431b4d07bd9dac839783d0e /tools
parent0aa506cc6cc9e3d054dd98e46add8e6a6e492f7e (diff)
downloadhdf5-b56f0119896adefa8e55bebf0c151f8fcef5d33f.zip
hdf5-b56f0119896adefa8e55bebf0c151f8fcef5d33f.tar.gz
hdf5-b56f0119896adefa8e55bebf0c151f8fcef5d33f.tar.bz2
[svn-r526] Changes since 19980721
---------------------- ./tools/h5ls.c If the dataset is of type H5T_NATIVE_CHAR then we print the value as a string. This is temporary -- I plan to add better control of this later but needed something now for debugging. ./src/H5Fistore.c Squashed a bug in the chunk caching code that caused the wrong chunk to be returned. ./bin/trace ./src/H5.c Added support for printing values of array arguments when the size of the array is supplied by some previous argument. You must declare the argument as an array in order for the automatic tracing stuff to work. For instance, the third argument of H5Pset_chunk() is an array whose size is determined by the second argument `ndims'. Here's how you should declare it: herr_t H5Pset_chunk(hid_t plist_id, intn rank, hsize_t dims[/*rank*/]) The comment inside the `[]' is the name of some previous integer argument (int, unsigned, size_t, ssize_t, hsize_t, hssize_t). The trace output will look something like: H5Pset_chunk(plist=1234567, rank=2, dims=0x112233 {11, 22}) Changed tracing so that data types are printed out symbolically when possible. Changed tracing so data type initializations are not printed. This used to be confusing because lots of H5Tcopy() and H5Tregister...() calls showed up before the applications first explicit API call. ./src/H5Ipublic.h Changed the file atom group from zero to one so printing of atoms during tracing is more consistent -- they're all big numbers now. ./src/H5A.c ./src/H5E.c ./src/H5F.c ./src/H5G.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Accidently modified these when working on the tracing, but nothing should have changed. ./src/H5P.c Changed the definition of H5Pset_chunk() for tracing. ./src/H5S.c ./src/H5Spublic.h Changed the definitions of H5Sset_extent_simple() and H5Screate_simple() for tracing. Changed the FUNC_ENTER() name for H5Screate_simple() so tracing shows the correct name.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/h5ls.c b/tools/h5ls.c
index 7a88ac4..18a1636 100644
--- a/tools/h5ls.c
+++ b/tools/h5ls.c
@@ -5,6 +5,7 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Monday, March 23, 1998
*/
+#include <ctype.h>
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
@@ -56,6 +57,59 @@ usage: %s [OPTIONS] FILE [GROUP]\n\
/*-------------------------------------------------------------------------
+ * Function: dump_dataset_values
+ *
+ * Purpose: Prints all values of a dataset.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, July 21, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+dump_dataset_values(hid_t dset)
+{
+ hid_t file_space, mem_space, type;
+ hsize_t start, file_nelmts, mem_nelmts;
+ hssize_t zero = 0;
+ unsigned char buf[1024];
+ hsize_t i;
+
+ file_space = H5Dget_space(dset);
+ type = H5Dget_type(dset);
+
+ if (H5Tequal(type, H5T_NATIVE_CHAR)) {
+ printf("%*svalue = \"", 26, "");
+ file_nelmts = H5Sextent_npoints(file_space);
+ mem_nelmts = sizeof(buf);
+ mem_space = H5Screate_simple(1, &mem_nelmts, NULL);
+ for (start=0; start<file_nelmts; start+=mem_nelmts) {
+ mem_nelmts = MIN(mem_nelmts, file_nelmts-start);
+ H5Sselect_hyperslab(file_space, H5S_SELECT_SET, &start, NULL,
+ &mem_nelmts, NULL);
+ H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, &zero, NULL,
+ &mem_nelmts, NULL);
+ H5Dread(dset, H5T_NATIVE_CHAR, mem_space, file_space, H5P_DEFAULT,
+ buf);
+ for (i=0; i<mem_nelmts; i++) {
+ if (isprint(buf[i])) putchar(buf[i]);
+ else printf("\\%03o", buf[i]);
+ }
+ }
+ H5Sclose(mem_space);
+ printf("\"\n");
+ }
+
+ H5Sclose(file_space);
+ H5Tclose(type);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: list_attr
*
* Purpose: Prints information about attributes.
@@ -153,6 +207,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
printf ("}\n");
H5Dclose (space);
H5Aiterate (obj, NULL, list_attr, NULL);
+ dump_dataset_values(obj);
H5Dclose (obj);
} else if ((obj=H5Gopen (group, name))>=0) {
printf ("Group\n");