summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-23 21:19:17 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-23 21:19:17 (GMT)
commitc8d2f1e17a828016487bb7661f3eff4135c92226 (patch)
treeb20e7514d7cf64ba6f8b21723b8e45bd4235f346
parent8821a3c0156e28a7fd49508c0b471361a9344984 (diff)
downloadhdf5-c8d2f1e17a828016487bb7661f3eff4135c92226.zip
hdf5-c8d2f1e17a828016487bb7661f3eff4135c92226.tar.gz
hdf5-c8d2f1e17a828016487bb7661f3eff4135c92226.tar.bz2
[svn-r537] Changes since 19980722
---------------------- ./src/H5A.c ./src/H5Apublic.h ./test/tattr.c Switched the order of the second and third argument of H5Aget_name() to make it consistent with other functions that take buffers and buffer sizes. ./src/H5G.c ./src/H5Gpublic.h ./src/H5Gprivate.h The H5Gget_comment() function returns the size of the comment including the null terminator. If the object has no comment then zero is returned. If an error occurs then a negative value is returned. ./MANIFEST ./tools/Makefile.in ./tools/h5tools.h [NEW] ./tools/h5dump.c [NEW] Created a library for printing values of datasets in a way that looks nice. It's not done yet, but I needed it for debugging the contents of files from Jim Reus. ./tools/h5ls.c Added the `-d' and `--dump' options which cause the contents of a dataset to be printed. Added `-w N' and `--width=N' options to control how wide the raw data output should be. If you want single-column output then say `-w1'. Printing dataset values can now handle datasets of any integer or floating point atomic type. As a special case, integers which are one byte wide are treated a character strings for now. Sample output: $ h5ls --dump --width=60 banana.hdf ARCHIVE 0:0:0:744 Dataset {52/Inf} Data: (0) "U struct complex { double R; double I; };\012V" (43) " double;\012" U 0:0:0:2500 Dataset {256/512} Data: printing of compound data types is not implemented yet V 0:0:0:3928 Dataset {256/512} Data: (0) 0, 0.015625, 0.03125, 0.046875, 0.0625, (5) 0.078125, 0.09375, 0.109375, 0.125, 0.140625, (10) 0.15625, 0.171875, 0.1875, 0.203125, 0.21875, (15) 0.234375, 0.25, 0.265625, 0.28125, 0.296875, ...
-rw-r--r--MANIFEST2
-rw-r--r--doc/html/Groups.html4
-rw-r--r--src/.distdep1103
-rw-r--r--src/H5A.c8
-rw-r--r--src/H5Apublic.h2
-rw-r--r--src/H5G.c31
-rw-r--r--src/H5Gprivate.h3
-rw-r--r--src/H5Gpublic.h3
-rw-r--r--src/H5S.c6
-rw-r--r--test/.distdep244
-rw-r--r--test/tattr.c20
-rw-r--r--tools/Makefile.in25
-rw-r--r--tools/h5ls.c129
-rw-r--r--tools/h5tools.c327
-rw-r--r--tools/h5tools.h81
15 files changed, 1790 insertions, 198 deletions
diff --git a/MANIFEST b/MANIFEST
index 019f1ea..34a2b7f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -283,6 +283,8 @@
./testpar/testphdf5.h
./tools/Makefile.in
./tools/h5debug.c
+./tools/h5dump.c
./tools/h5import.c
./tools/h5ls.c
./tools/h5repart.c
+./tools/h5tools.h
diff --git a/doc/html/Groups.html b/doc/html/Groups.html
index 5becb8b..f37a411 100644
--- a/doc/html/Groups.html
+++ b/doc/html/Groups.html
@@ -298,7 +298,7 @@
*<em>comment</em>)</code>
<dd>The comment string for an object is returned through the
<em>comment</em> buffer. At most <em>bufsize</em> characters
- including the null terminator are copied, and the result is
+ including a null terminator are copied, and the result is
not null terminated if the comment is longer than the supplied
buffer. If an object doesn't have a comment then the empty
string is returned.
@@ -308,7 +308,7 @@
<address><a href="mailto:matzke@llnl.gov">Robb Matzke</a></address>
<!-- Created: Tue Jan 27 09:11:27 EST 1998 -->
<!-- hhmts start -->
-Last modified: Mon Jul 20 16:45:40 EDT 1998
+Last modified: Wed Jul 22 14:24:34 EDT 1998
<!-- hhmts end -->
</body>
</html>
diff --git a/src/.distdep b/src/.distdep
new file mode 100644
index 0000000..fa381e5
--- /dev/null
+++ b/src/.distdep
@@ -0,0 +1,1103 @@
+H5AC.o: \
+ H5AC.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h
+H5B.o: \
+ H5B.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h
+H5Fcore.o: \
+ H5Fcore.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h
+H5Ffamily.o: \
+ H5Ffamily.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h
+H5Fmpio.o: \
+ H5Fmpio.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Fsec2.o: \
+ H5Fsec2.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Fstdio.o: \
+ H5Fstdio.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Gnode.o: \
+ H5Gnode.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gpkg.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5Gstab.o: \
+ H5Gstab.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gpkg.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5HL.o: \
+ H5HL.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h
+H5I.o: \
+ H5I.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h
+H5MF.o: \
+ H5MF.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h
+H5MM.o: \
+ H5MM.c \
+ H5private.h \
+ H5public.h \
+ H5config.h
+H5O.o: \
+ H5O.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h
+H5Ocomp.o: \
+ H5Ocomp.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Ocont.o: \
+ H5Ocont.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Oname.o: \
+ H5Oname.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Onull.o: \
+ H5Onull.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h
+H5Ostab.o: \
+ H5Ostab.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Tbit.o: \
+ H5Tbit.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Iprivate.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h
+H5Tconv.o: \
+ H5Tconv.c \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5public.h \
+ H5config.h \
+ H5private.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h
+H5Flow.o: \
+ H5Flow.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Fsplit.o: \
+ H5Fsplit.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h
+H5Gent.o: \
+ H5Gent.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Gpkg.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h
+H5HG.o: \
+ H5HG.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h
+H5Tinit.o: \
+ H5Tinit.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Gprivate.h
+H5Farray.o: \
+ H5Farray.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h
+H5Odtype.o: \
+ H5Odtype.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Oefl.o: \
+ H5Oefl.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5Olayout.o: \
+ H5Olayout.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h
+H5Osdspace.o: \
+ H5Osdspace.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Oshared.o: \
+ H5Oshared.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5E.o: \
+ H5E.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h
+H5Fistore.o: \
+ H5Fistore.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Oattr.o: \
+ H5Oattr.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5Z.o: \
+ H5Z.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5Sall.o: \
+ H5Sall.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5Ssimp.o: \
+ H5Ssimp.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5T.o: \
+ H5T.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Iprivate.h
+H5V.o: \
+ H5V.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5.o: \
+ H5.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Iprivate.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Pprivate.h \
+ H5Ppublic.h \
+ H5Zpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5A.o: \
+ H5A.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Pprivate.h
+H5D.o: \
+ H5D.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5F.o: \
+ H5F.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Pprivate.h \
+ H5Ppublic.h \
+ H5Zpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5G.o: \
+ H5G.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gpkg.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5HLprivate.h
+H5P.o: \
+ H5P.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Pprivate.h
+H5Shyper.o: \
+ H5Shyper.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5Spoint.o: \
+ H5Spoint.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5Sselect.o: \
+ H5Sselect.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
+ H5Iprivate.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h
+H5TB.o: \
+ H5TB.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h
+H5S.o: \
+ H5S.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h
diff --git a/src/H5A.c b/src/H5A.c
index ad04c68..befe020 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1025,10 +1025,10 @@ H5Aget_type (hid_t attr_id)
PURPOSE
Gets a copy of the name for an attribute
USAGE
- size_t H5Aget_name (attr_id, buf, buf_size)
+ size_t H5Aget_name (attr_id, buf_size, buf)
hid_t attr_id; IN: Attribute to get name of
- char *buf; IN: Buffer to store name in
size_t buf_size; IN: The size of the buffer to store the string in.
+ char *buf; IN: Buffer to store name in
RETURNS
This function returns the length of the attribute's name (which may be
longer than 'buf_size') on success or negative for failure.
@@ -1043,14 +1043,14 @@ H5Aget_type (hid_t attr_id)
properly terminate the string.
--------------------------------------------------------------------------*/
size_t
-H5Aget_name (hid_t attr_id, char *buf, size_t buf_size)
+H5Aget_name (hid_t attr_id, size_t buf_size, char *buf)
{
H5A_t *attr = NULL;
size_t copy_len=0;
size_t ret_value = FAIL;
FUNC_ENTER(H5Aget_name, FAIL);
- H5TRACE3("z","isz",attr_id,buf,buf_size);
+ H5TRACE3("z","izs",attr_id,buf_size,buf);
/* check arguments */
if (H5_ATTR != H5I_group(attr_id) ||
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 1520564..b3b556f 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -36,7 +36,7 @@ herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
herr_t H5Aclose(hid_t attr_id);
hid_t H5Aget_space(hid_t attr_id);
hid_t H5Aget_type(hid_t attr_id);
-size_t H5Aget_name(hid_t attr_id, char *buf, size_t buf_size);
+size_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
int H5Anum_attrs(hid_t loc_id);
int H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op,
void *op_data);
diff --git a/src/H5G.c b/src/H5G.c
index 2e24a15..c875814 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -767,9 +767,12 @@ H5Gset_comment (hid_t loc_id, const char *name, const char *comment)
* specified object. If BUFSIZE is large enough to hold the
* entire comment then the comment string will be null
* terminated, otherwise it will not. If the object does not
- * have a comment value then the empty string is returned.
+ * have a comment value then no bytes are copied to the BUF
+ * buffer.
*
- * Return: Success: SUCCEED
+ * Return: Success: Number of characters in the comment counting
+ * the null terminator. The value returned may
+ * be larger than the BUFSIZE argument.
*
* Failure: FAIL
*
@@ -780,13 +783,14 @@ H5Gset_comment (hid_t loc_id, const char *name, const char *comment)
*
*-------------------------------------------------------------------------
*/
-herr_t
+int
H5Gget_comment (hid_t loc_id, const char *name, size_t bufsize, char *buf)
{
H5G_t *loc = NULL;
+ intn retval = FAIL;
FUNC_ENTER(H5Gget_comment, FAIL);
- H5TRACE4("e","iszs",loc_id,name,bufsize,buf);
+ H5TRACE4("Is","iszs",loc_id,name,bufsize,buf);
if (NULL==(loc=H5G_loc(loc_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
@@ -794,16 +798,16 @@ H5Gget_comment (hid_t loc_id, const char *name, size_t bufsize, char *buf)
if (!name || !*name) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified");
}
- if (bufsize<1 || !buf) {
+ if (bufsize>0 && !buf) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified");
}
- if (H5G_get_comment(loc, name, bufsize, buf)<0) {
+ if ((retval=H5G_get_comment(loc, name, bufsize, buf))<0) {
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
"unable to set comment value");
}
- FUNC_LEAVE(SUCCEED);
+ FUNC_LEAVE(retval);
}
/*
@@ -2131,7 +2135,9 @@ H5G_set_comment(H5G_t *loc, const char *name, const char *buf)
*
* Purpose: Get the comment value for an object.
*
- * Return: Success: SUCCEED
+ * Return: Success: Number of bytes in the comment including the
+ * null terminator. Zero if the object has no
+ * comment.
*
* Failure: FAIL
*
@@ -2142,11 +2148,12 @@ H5G_set_comment(H5G_t *loc, const char *name, const char *buf)
*
*-------------------------------------------------------------------------
*/
-herr_t
+intn
H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize, char *buf)
{
H5O_name_t comment;
H5G_entry_t obj_ent;
+ intn retval = FAIL;
FUNC_ENTER(H5G_get_comment, FAIL);
@@ -2159,12 +2166,14 @@ H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize, char *buf)
/* Get the message */
comment.s = NULL;
if (NULL==H5O_read(&obj_ent, H5O_NAME, 0, &comment)) {
- buf[0] = '\0';
+ if (buf && bufsize>0) buf[0] = '\0';
+ retval = 0;
} else {
strncpy(buf, comment.s, bufsize);
+ retval = strlen(comment.s);
H5O_reset(H5O_NAME, &comment);
}
- FUNC_LEAVE(SUCCEED);
+ FUNC_LEAVE(retval);
}
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index b0ee5e8..991b343 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -118,8 +118,7 @@ herr_t H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link,
herr_t H5G_linkval (H5G_t *loc, const char *name, size_t size,
char *buf/*out*/);
herr_t H5G_set_comment(H5G_t *loc, const char *name, const char *buf);
-herr_t H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize,
- char *buf);
+intn H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize, char *buf);
herr_t H5G_insert (H5G_t *cwg, const char *name, H5G_entry_t *ent);
herr_t H5G_find (H5G_t *cwg, const char *name, H5G_entry_t *grp_ent/*out*/,
H5G_entry_t *ent/*out*/);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 294166f..217ad7e 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -70,8 +70,7 @@ herr_t H5Gstat (hid_t loc_id, const char *name, hbool_t follow_link,
herr_t H5Gget_linkval (hid_t loc_id, const char *name, size_t size,
char *buf/*out*/);
herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
-herr_t H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
- char *buf);
+int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf);
#ifdef __cplusplus
}
diff --git a/src/H5S.c b/src/H5S.c
index 33a0a45..524d19b 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -697,7 +697,8 @@ H5S_extent_ndims(const H5S_t *ds)
*-------------------------------------------------------------------------
*/
int
-H5Sextent_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/)
+H5Sextent_dims (hid_t space_id, hsize_t dims[]/*out*/,
+ hsize_t maxdims[]/*out*/)
{
H5S_t *ds = NULL;
intn ret_value = 0;
@@ -706,7 +707,8 @@ H5Sextent_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/)
H5TRACE3("Is","ixx",space_id,dims,maxdims);
/* Check args */
- if (H5_DATASPACE != H5I_group(space_id) || NULL == (ds = H5I_object(space_id))) {
+ if (H5_DATASPACE != H5I_group(space_id) ||
+ NULL == (ds = H5I_object(space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
}
ret_value = H5S_extent_dims(ds, dims, maxdims);
diff --git a/test/.distdep b/test/.distdep
index 767ca09..4b3f035 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -1,33 +1,3 @@
-testhdf5.o: \
- testhdf5.c \
- testhdf5.h \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h
-tattr.o: \
- tattr.c \
- testhdf5.h \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
- ../src/H5Ipublic.h \
- ../src/hdf5.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h
tfile.o: \
tfile.c \
testhdf5.h \
@@ -130,61 +100,6 @@ tstab.o: \
../src/H5Tpublic.h \
../src/H5Sprivate.h \
../src/H5Spublic.h
-th5s.o: \
- th5s.c \
- testhdf5.h \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
- ../src/H5Ipublic.h \
- ../src/H5Bprivate.h \
- ../src/H5Bpublic.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Sprivate.h \
- ../src/H5Spublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h \
- ../src/H5Oprivate.h \
- ../src/H5Opublic.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
- ../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Zprivate.h \
- ../src/H5Zpublic.h \
- ../src/H5Pprivate.h
-dtypes.o: \
- dtypes.c \
- ../src/hdf5.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Ipublic.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Epublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h \
- ../src/H5Tpkg.h \
- ../src/H5HGprivate.h \
- ../src/H5Fprivate.h \
- ../src/H5private.h \
- ../src/H5Tprivate.h \
- ../src/H5Gprivate.h
hyperslab.o: \
hyperslab.c \
../src/H5private.h \
@@ -216,28 +131,6 @@ istore.o: \
../src/H5Tprivate.h \
../src/H5Tpublic.h \
../src/H5Sprivate.h
-dsets.o: \
- dsets.c \
- ../src/hdf5.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Ipublic.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Epublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h
cmpd_dset.o: \
cmpd_dset.c \
../src/hdf5.h \
@@ -362,6 +255,67 @@ shtype.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
+links.o: \
+ links.c \
+ ../src/hdf5.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
+chunk.o: \
+ chunk.c \
+ ../src/hdf5.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
+bittests.o: \
+ bittests.c \
+ ../src/H5Tpkg.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5private.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Bprivate.h
big.o: \
big.c \
../src/hdf5.h \
@@ -385,8 +339,14 @@ big.o: \
../src/H5Spublic.h \
../src/H5Tpublic.h \
../src/H5private.h
-links.o: \
- links.c \
+testhdf5.o: \
+ testhdf5.c \
+ testhdf5.h \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h
+dsets.o: \
+ dsets.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -407,8 +367,8 @@ links.o: \
../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-chunk.o: \
- chunk.c \
+dtypes.o: \
+ dtypes.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -428,24 +388,37 @@ chunk.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h \
- ../src/H5Tpublic.h
-bittests.o: \
- bittests.c \
+ ../src/H5Tpublic.h \
../src/H5Tpkg.h \
../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5private.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Gprivate.h
+tattr.o: \
+ tattr.c \
+ testhdf5.h \
+ ../src/H5private.h \
../src/H5public.h \
../src/H5config.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
../src/H5Ipublic.h \
- ../src/H5private.h \
+ ../src/hdf5.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
../src/H5Dpublic.h \
- ../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Gprivate.h \
+ ../src/H5Fpublic.h \
../src/H5Gpublic.h \
- ../src/H5Bprivate.h
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h
tselect.o: \
tselect.c \
testhdf5.h \
@@ -470,3 +443,30 @@ tselect.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
+th5s.o: \
+ th5s.c \
+ testhdf5.h \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Bprivate.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Sprivate.h \
+ ../src/H5Spublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Oprivate.h \
+ ../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Zprivate.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Pprivate.h
diff --git a/test/tattr.c b/test/tattr.c
index b9cfa0f..e373d34 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -494,7 +494,7 @@ test_attr_compound_read(void)
} /* end if */
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR4_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR4_NAME);
@@ -830,7 +830,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr, ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR1_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME);
@@ -838,7 +838,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name with too small of a buffer */
- name_len=H5Aget_name(attr,attr_name,HDstrlen(ATTR1_NAME));
+ name_len=H5Aget_name(attr,HDstrlen(ATTR1_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
HDstrcpy(temp_name,ATTR1_NAME); /* make a copy of the name */
temp_name[HDstrlen(ATTR1_NAME)-1]='\0'; /* truncate it to match the one retrieved */
@@ -896,7 +896,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR2_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR2_NAME);
@@ -904,7 +904,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name with too small of a buffer */
- name_len=H5Aget_name(attr,attr_name,HDstrlen(ATTR2_NAME));
+ name_len=H5Aget_name(attr,HDstrlen(ATTR2_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name");
HDstrcpy(temp_name,ATTR2_NAME); /* make a copy of the name */
temp_name[HDstrlen(ATTR2_NAME)-1]='\0'; /* truncate it to match the one retrieved */
@@ -967,7 +967,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR3_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
@@ -975,7 +975,7 @@ test_attr_mult_read(void)
} /* end if */
/* Verify Name with too small of a buffer */
- name_len=H5Aget_name(attr,attr_name,HDstrlen(ATTR3_NAME));
+ name_len=H5Aget_name(attr,HDstrlen(ATTR3_NAME), attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
HDstrcpy(temp_name,ATTR3_NAME); /* make a copy of the name */
temp_name[HDstrlen(ATTR3_NAME)-1]='\0'; /* truncate it to match the one retrieved */
@@ -1133,7 +1133,7 @@ test_attr_delete(void)
CHECK(attr, FAIL, "H5Aopen_idx");
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN,attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR1_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME);
@@ -1149,7 +1149,7 @@ test_attr_delete(void)
CHECK(attr, FAIL, "H5Aopen_idx");
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR3_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
@@ -1173,7 +1173,7 @@ test_attr_delete(void)
CHECK(attr, FAIL, "H5Aopen_idx");
/* Verify Name */
- name_len=H5Aget_name(attr,attr_name,ATTR_NAME_LEN);
+ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
if(HDstrcmp(attr_name,ATTR3_NAME)) {
printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 1f93b00..2ab717a 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -7,26 +7,33 @@
@COMMENCE@
# Add include directory to the C preprocessor flags.
-CPPFLAGS=-I../src @CPPFLAGS@
+CPPFLAGS=-I../src -I. @CPPFLAGS@
# These are our main targets:
PROGS=h5debug h5import h5ls h5repart
+LIB=libh5tools.a
+LIBS=../src/libhdf5.a libh5tools.a @LIBS@
+
+# Source and object files for the library.
+LIB_SRC=h5dump.c
+LIB_OBJ=$(LIB_SRC:.c=.o)
# Source and object files for programs...
PROG_SRC=h5debug.c h5import.c h5ls.c h5repart.c
PROG_OBJ=$(PROG_SRC:.c=.o)
+PRIVATE_HDR=h5tools.h
# How to build the programs...
-h5debug: h5debug.o ../src/libhdf5.a
- $(CC) $(CFLAGS) -o $@ h5debug.o ../src/libhdf5.a $(LIBS)
+h5debug: h5debug.o $(LIB) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ h5debug.o $(LIBS)
-h5import: h5import.o ../src/libhdf5.a
- $(CC) $(CFLAGS) -o $@ h5import.o ../src/libhdf5.a $(LIBS)
+h5import: h5import.o $(LIB) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ h5import.o $(LIBS)
-h5ls: h5ls.o ../src/libhdf5.a
- $(CC) $(CFLAGS) -o $@ h5ls.o ../src/libhdf5.a $(LIBS)
+h5ls: h5ls.o $(LIB) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ h5ls.o $(LIBS)
-h5repart: h5repart.o ../src/libhdf5.a
- $(CC) $(CFLAGS) -o $@ h5repart.o ../src/libhdf5.a $(LIBS)
+h5repart: h5repart.o $(LIB) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ h5repart.o $(LIBS)
@CONCLUDE@
diff --git a/tools/h5ls.c b/tools/h5ls.c
index 8127d13..93a756a 100644
--- a/tools/h5ls.c
+++ b/tools/h5ls.c
@@ -6,6 +6,7 @@
* Monday, March 23, 1998
*/
#include <ctype.h>
+#include <h5tools.h>
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
@@ -20,8 +21,10 @@
# define __unused__ __attribute__((unused))
#endif
-/* Verbosity level */
+/* Command-line switches */
static int verbose_g = 0;
+static int dump_g = 0;
+static int width_g = 80;
/*-------------------------------------------------------------------------
@@ -45,6 +48,8 @@ usage (const char *progname)
usage: %s [OPTIONS] FILE [GROUP]\n\
OPTIONS\n\
-h, -?, --help Print a usage message and exit\n\
+ -d, --dump Print the values of datasets\n\
+ -wN, --width=N Set the number of columns of output\n\
-v, --verbose Generate more verbose output\n\
-V, --version Print version number and exit\n\
FILE\n\
@@ -73,41 +78,72 @@ usage: %s [OPTIONS] FILE [GROUP]\n\
static void
dump_dataset_values(hid_t dset)
{
- hid_t file_space, mem_space, type;
- hsize_t file_nelmts, mem_nelmts;
- hssize_t start, zero=0;
- unsigned char buf[1024];
- hsize_t i;
+ hid_t f_type, m_type=-1;
+ h5dump_t info;
+ size_t size;
- file_space = H5Dget_space(dset);
- type = H5Dget_type(dset);
+ /* Set to all default values and then override */
+ memset(&info, 0, sizeof info);
+ info.idx_fmt = " (%s) ";
+ info.line_ncols = width_g;
- 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<(hssize_t)file_nelmts;
- start+=(hssize_t)mem_nelmts) {
- mem_nelmts = MIN(mem_nelmts, file_nelmts-(hsize_t)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]);
- }
+ /*
+ * Decide which data type to use for printing the values and make any
+ * necessary adjustments to the way the values will be formatted.
+ */
+ f_type = H5Dget_type(dset);
+ size = H5Tget_size(f_type);
+ switch (H5Tget_class(f_type)) {
+ case H5T_INTEGER:
+ if (1==size) {
+ /*
+ * Assume that the dataset is being used to hold character values
+ * and print the values as strings.
+ */
+ info.elmt_suf1 = "";
+ info.elmt_suf2 = "";
+ info.idx_fmt = " (%s) \"";
+ info.line_suf = "\"";
}
- H5Sclose(mem_space);
- printf("\"\n");
- }
- H5Sclose(file_space);
- H5Tclose(type);
+ /*
+ * For printing use an integer which is the same width and sign as
+ * the file but in native byte order.
+ */
+ m_type = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_offset(m_type, 0);
+ H5Tset_precision(m_type, size*8);
+ H5Tset_size(m_type, size);
+ H5Tset_sign(m_type, H5Tget_sign(f_type));
+ break;
+
+ case H5T_FLOAT:
+ if (size==sizeof(float)) {
+ m_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ } else {
+ m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ }
+ break;
+
+ case H5T_COMPOUND:
+ printf(" Data: printing of compound data types is not implemented "
+ "yet\n");
+ break;
+
+ default:
+ /*unable to print*/
+ printf(" Data: [unable to print]\n");
+ break;
+ }
+ H5Tclose(f_type);
+ if (m_type<0) return; /*not printable*/
+
+ /*
+ * Print all the values.
+ */
+ printf(" Data:\n");
+ h5dump(stdout, &info, dset, m_type);
+ H5Tclose(m_type);
}
@@ -209,7 +245,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);
+ if (dump_g) dump_dataset_values(obj);
H5Dclose (obj);
} else if ((obj=H5Gopen (group, name))>=0) {
printf ("Group\n");
@@ -229,6 +265,7 @@ list (hid_t group, const char *name, void __unused__ *op_data)
}
/* Display the comment if the object has one */
+ comment[0] = '\0';
H5Gget_comment(group, name, sizeof(comment), comment);
strcpy(comment+sizeof(comment)-4, "...");
if (comment[0]) printf("%26s%s\n", "", comment);
@@ -264,6 +301,7 @@ main (int argc, char *argv[])
const char *gname = "/";
const char *progname;
const char *s;
+ char *rest;
int argno;
/* Name of this program without the path */
@@ -279,12 +317,34 @@ main (int argc, char *argv[])
} else if (!strcmp(argv[argno], "--help")) {
usage(progname);
exit(0);
+ } else if (!strcmp(argv[argno], "--dump")) {
+ dump_g++;
+ } else if (!strncmp(argv[argno], "--width=", 8)) {
+ width_g = strtol(argv[argno]+8, &rest, 0);
+ if (width_g<=0 || *rest) {
+ usage(progname);
+ exit(1);
+ }
} else if (!strcmp(argv[argno], "--verbose")) {
verbose_g++;
} else if (!strcmp(argv[argno], "--version")) {
printf("This is %s version %u.%u release %u\n",
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
exit(0);
+ } else if (!strncmp(argv[argno], "-w", 2)) {
+ if (argv[argno][2]) {
+ s = argv[argno]+2;
+ } else if (argno+1>=argc) {
+ usage(progname);
+ exit(1);
+ } else {
+ s = argv[++argno];
+ }
+ width_g = strtol(s, &rest, 0);
+ if (width_g<=0 || *rest) {
+ usage(progname);
+ exit(1);
+ }
} else if ('-'!=argv[argno][1]) {
/* Single-letter switches */
for (s=argv[argno]+1; *s; s++) {
@@ -293,6 +353,9 @@ main (int argc, char *argv[])
case 'h': /* --help */
usage(progname);
exit(0);
+ case 'd': /* --dump */
+ dump_g++;
+ break;
case 'v': /* --verbose */
verbose_g++;
break;
diff --git a/tools/h5tools.c b/tools/h5tools.c
new file mode 100644
index 0000000..ef1e954
--- /dev/null
+++ b/tools/h5tools.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright © 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Thursday, July 23, 1998
+ *
+ * Purpose: A library for displaying the values of a dataset in a human
+ * readable format.
+ */
+#include <assert.h>
+#include <ctype.h>
+#include <h5tools.h>
+#include <hdf5.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * The output functions need a temporary buffer to hold a piece of the
+ * dataset while it's being printed. This constant sets the limit on the
+ * size of that temporary buffer in bytes. For efficiency's sake, choose the
+ * largest value suitable for your machine (for testing use a small value).
+ */
+#define H5DUMP_BUFSIZE 1024
+
+#define OPT(X,S) ((X)?(X):(S))
+#define MIN(X,Y) ((X)<(Y)?(X):(Y))
+#define NELMTS(X) (sizeof(X)/sizeof(*X))
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5dump_prefix
+ *
+ * Purpose: Prints the prefix to show up at the begining of the line.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+h5dump_prefix(char *s/*out*/, const h5dump_t *info, hsize_t elmtno, int ndims,
+ hsize_t min_idx[], hsize_t max_idx[])
+{
+ hsize_t p_prod[8], p_idx[8];
+ hsize_t n, i;
+ char temp[1024];
+
+ /*
+ * Calculate the number of elements represented by a unit change in a
+ * certain index position.
+ */
+ for (i=ndims-1, p_prod[ndims-1]=1; i>0; --i) {
+ p_prod[i-1] = (max_idx[i]-min_idx[i]) * p_prod[i];
+ }
+
+ /*
+ * Calculate the index values from the element number.
+ */
+ for (i=0, n=elmtno; i<(hsize_t)ndims; i++) {
+ p_idx[i] = n / p_prod[i] + min_idx[i];
+ n %= p_prod[i];
+ }
+
+ /*
+ * Print the index values.
+ */
+ *temp = '\0';
+ for (i=0; i<(hsize_t)ndims; i++) {
+ if (i) strcat(temp, OPT(info->idx_sep, ","));
+ sprintf(temp+strlen(temp), OPT(info->idx_n_fmt, "%lu"),
+ (unsigned long)p_idx[i]);
+ }
+
+ /*
+ * Add prefix and suffix to the index.
+ */
+ sprintf(s, OPT(info->idx_fmt, "%s: "), temp);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5dump_sprint
+ *
+ * Purpose: Prints the value pointed to by VP into the string S assuming
+ * the data type of VP is TYPE.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp)
+{
+ size_t i, n;
+ char temp[1024];
+
+ if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
+ sprintf(temp, "%g", *((double*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
+ sprintf(temp, "%g", *((float*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_CHAR) ||
+ H5Tequal(type, H5T_NATIVE_UCHAR)) {
+ if ('\\'==*((char*)vp)) strcpy(temp, "\\\\");
+ else if (isprint(*((char*)vp))) sprintf(temp, "%c", *((char*)vp));
+ else sprintf(temp, "\\%03o", *((unsigned char*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
+ sprintf(temp, "%d", *((short*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
+ sprintf(temp, "%u", *((unsigned short*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_INT)) {
+ sprintf(temp, "%d", *((int*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_UINT)) {
+ sprintf(temp, "%u", *((unsigned*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_LONG)) {
+ sprintf(temp, "%ld", *((long*)vp));
+ } else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
+ sprintf(temp, "%lu", *((unsigned long*)vp));
+ } else {
+ strcpy(temp, "0x");
+ n = H5Tget_size(type);
+ for (i=0; i<n; i++) {
+ sprintf(temp+strlen(temp), "%02x", ((unsigned char*)vp)[i]);
+ }
+ }
+
+ sprintf(s, OPT(info->elmt_fmt, "%s"), temp);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5dump_simple
+ *
+ * Purpose: Print some values from a dataset with a simple data space.
+ * This is a special case of h5dump().
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type)
+{
+ hid_t f_space; /*file data space */
+ int ndims; /*dimensionality */
+ hsize_t elmtno, i; /*counters */
+ int carry; /*counter carry value */
+ hssize_t zero[8]; /*vector of zeros */
+ int need_prefix=1; /*indices need printing */
+
+ /* Print info */
+ hsize_t p_min_idx[8]; /*min selected index */
+ hsize_t p_max_idx[8]; /*max selected index */
+ size_t p_type_nbytes; /*size of memory type */
+ hsize_t p_nelmts; /*total selected elmts */
+ char p_buf[256]; /*output string */
+ size_t p_column=0; /*output column */
+ size_t p_ncolumns=80; /*default num columns */
+ char p_prefix[1024]; /*line prefix string */
+
+ /* Stripmine info */
+ hsize_t sm_size[8]; /*stripmine size */
+ hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nelmts; /*elements per stripmine*/
+ unsigned char *sm_buf; /*buffer for raw data */
+ hid_t sm_space; /*stripmine data space */
+
+ /* Hyperslab info */
+ hssize_t hs_offset[8]; /*starting offset */
+ hsize_t hs_size[8]; /*size this pass */
+ hsize_t hs_nelmts; /*elements in request */
+
+ /*
+ * Check that everything looks okay. The dimensionality must not be too
+ * great and the dimensionality of the items selected for printing must
+ * match the dimensionality of the dataset.
+ */
+ f_space = H5Dget_space(dset);
+ ndims = H5Sextent_ndims(f_space);
+ if ((size_t)ndims>NELMTS(sm_size)) return -1;
+
+ /* Assume entire data space to be printed */
+ for (i=0; i<(hsize_t)ndims; i++) p_min_idx[i] = 0;
+ H5Sextent_dims(f_space, p_max_idx, NULL);
+ for (i=0, p_nelmts=1; i<(hsize_t)ndims; i++) {
+ p_nelmts *= p_max_idx[i]-p_min_idx[i];
+ }
+
+ /*
+ * Determine the strip mine size and allocate a buffer. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
+ p_type_nbytes = H5Tget_size(p_type);
+ for (i=ndims, sm_nbytes=p_type_nbytes; i>0; --i) {
+ sm_size[i-1] = MIN (p_max_idx[i-1]-p_min_idx[i-1],
+ H5DUMP_BUFSIZE/sm_nbytes);
+ sm_nbytes *= sm_size[i-1];
+ assert(sm_nbytes>0);
+ }
+ sm_buf = malloc(sm_nbytes);
+ sm_nelmts = sm_nbytes/p_type_nbytes;
+ sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+
+ /* Local things */
+ if (info->line_ncols>0) p_ncolumns = info->line_ncols;
+
+ /* The stripmine loop */
+ memset(hs_offset, 0, sizeof hs_offset);
+ memset(zero, 0, sizeof zero);
+ for (elmtno=0; elmtno<p_nelmts; elmtno+=hs_nelmts) {
+
+ /* Calculate the hyperslab size */
+ for (i=0, hs_nelmts=1; i<(hsize_t)ndims; i++) {
+ hs_size[i] = MIN(sm_size[i], p_max_idx[i]-hs_offset[i]);
+ hs_nelmts *= hs_size[i];
+ }
+
+ /* Read the data */
+ H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL,
+ hs_size, NULL);
+ H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL,
+ &hs_nelmts, NULL);
+ H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf);
+
+ /* Print the data */
+ for (i=0; i<hs_nelmts; i++) {
+ /* Render the element */
+ h5dump_sprint(p_buf, info, p_type, sm_buf+i*p_type_nbytes);
+ if (i+1<hs_nelmts) {
+ strcat(p_buf, OPT(info->elmt_suf1, ","));
+ }
+
+ /* Print the prefix */
+ if ((p_column +
+ strlen(p_buf) +
+ strlen(OPT(info->elmt_suf2, " ")) +
+ strlen(OPT(info->line_suf, ""))) > p_ncolumns) {
+ need_prefix = 1;
+ }
+ if (need_prefix) {
+ h5dump_prefix(p_prefix, info, elmtno+i, ndims,
+ p_min_idx, p_max_idx);
+ if (p_column) {
+ fputs(OPT(info->line_suf, ""), stream);
+ putc('\n', stream);
+ fputs(OPT(info->line_sep, ""), stream);
+ }
+ fputs(p_prefix, stream);
+ p_column = strlen(p_prefix);
+ need_prefix = 0;
+ } else {
+ fputs(OPT(info->elmt_suf2, " "), stream);
+ p_column += strlen(OPT(info->elmt_suf2, " "));
+ }
+
+ fputs(p_buf, stream);
+ p_column += strlen(p_buf);
+ }
+
+ /* Calculate the next hyperslab offset */
+ for (i=ndims, carry=1; i>0 && carry; --i) {
+ hs_offset[i-1] += hs_size[i-1];
+ if (hs_offset[i-1]==(hssize_t)p_max_idx[i-1]) {
+ hs_offset[i-1] = p_min_idx[i-1];
+ } else {
+ carry = 0;
+ }
+ }
+ }
+
+ if (p_column) {
+ fputs(OPT(info->line_suf, ""), stream);
+ putc('\n', stream);
+ fputs(OPT(info->line_sep, ""), stream);
+ }
+ H5Sclose(sm_space);
+ H5Sclose(f_space);
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5dump
+ *
+ * Purpose: Print some values from a dataset. The values to print are
+ * determined by the P_SPACE argument and the format to use to
+ * print them is determined by the P_TYPE argument.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5dump(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type)
+{
+ hid_t f_space;
+
+ f_space = H5Dget_space(dset);
+ if (H5Sis_simple(f_space)<=0) return -1;
+ H5Sclose(f_space);
+
+ return h5dump_simple(stream, info, dset, p_type);
+}
diff --git a/tools/h5tools.h b/tools/h5tools.h
new file mode 100644
index 0000000..966eaff
--- /dev/null
+++ b/tools/h5tools.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Thursday, July 23, 1998
+ *
+ * Purpose: Support functions for the various tools.
+ */
+#ifndef _H5TOOLS_H
+#define _H5TOOLS_H
+
+#include <hdf5.h>
+#include <stdio.h>
+
+/*
+ * Information about how to format output.
+ */
+typedef struct h5dump_t {
+ /*
+ * Fields associated with the individual elements.
+ *
+ * fmt: A printf(3c) format to use to print the value string
+ * after it has been rendered. The default is "%s".
+ *
+ * suf1: This string is appended to elements which are followed by
+ * another element whether the following element is on the
+ * same line or the next line. The default is a comma.
+ *
+ * suf2: This string is appended (after `suf1') to elements which
+ * are followed on the same line by another element. The
+ * default is a single space.
+ */
+ const char *elmt_fmt;
+ const char *elmt_suf1;
+ const char *elmt_suf2;
+
+ /*
+ * Fields associated with the index values printed at the left edge of
+ * each line of output.
+ *
+ * n_fmt: Each index value is printed according to this printf(3c)
+ * format string which should include a format for a long
+ * integer. The default is "%lu".
+ *
+ * sep: Each integer in the index list will be separated from the
+ * others by this string, which defaults to a comma.
+ *
+ * fmt: After the index values are formated individually and
+ * separated from one another by some string, the entire
+ * resulting string will be formated according to this
+ * printf(3c) format which should include a format for a
+ * character string. The default is "%s".
+ */
+ const char *idx_n_fmt; /*index number format */
+ const char *idx_sep; /*separator between numbers */
+ const char *idx_fmt; /*entire index format */
+
+ /*
+ * Fields associated with entire lines.
+ *
+ * ncols: Number of columns per line defaults to 80.
+ *
+ * suf: This character string will be appended to each line of
+ * output. It should not contain line feeds. The default
+ * is the empty string.
+ *
+ * sep: A character string to be printed after every line feed
+ * defaulting to the empty string. It should end with a
+ * line feed.
+ */
+ int line_ncols; /*columns of output */
+ const char *line_suf; /*string to append to each line */
+ const char *line_sep; /*separates lines */
+
+} h5dump_t;
+
+
+int h5dump(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type);
+
+#endif