summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5debug.c27
-rw-r--r--tools/h5import.c15
-rw-r--r--tools/h5ls.c13
-rw-r--r--tools/h5repart.c18
-rw-r--r--tools/h5tools.h8
5 files changed, 74 insertions, 7 deletions
diff --git a/tools/h5debug.c b/tools/h5debug.c
index c2364a1..13826d5 100644
--- a/tools/h5debug.c
+++ b/tools/h5debug.c
@@ -23,10 +23,11 @@
#include <H5HGprivate.h>
#include <H5HLprivate.h>
#include <H5Oprivate.h>
-
+#include <h5tools.h>
/* File drivers */
+#ifdef VERSION13
#include <H5FDfamily.h>
-
+#endif
#define INDENT 3
#define VCOL 50
@@ -54,17 +55,30 @@ main(int argc, char *argv[])
{
hid_t fid, plist=H5P_DEFAULT;
H5F_t *f;
+#if defined VERSION13
haddr_t addr=0, extra=0;
+#elif defined VERSION12
+ haddr_t *addr,*extra;
+#endif
uint8_t sig[16];
intn i, ndims;
herr_t status = SUCCEED;
+#if defined VERSION12
+ addr = malloc(sizeof(haddr_t));
+ extra = malloc(sizeof(haddr_t));
+ addr->offset = 0;
+ extra->offset = 0;
+#endif
+
/*
* Open the file and get the file descriptor.
*/
if (strchr (argv[1], '%')) {
plist = H5Pcreate (H5P_FILE_ACCESS);
+#if defined VERSION13
H5Pset_fapl_family (plist, 0, H5P_DEFAULT);
+#endif
}
if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) {
fprintf(stderr, "cannot open file\n");
@@ -80,15 +94,24 @@ main(int argc, char *argv[])
*/
if (argc > 2) {
printf("New address: %s\n", argv[2]);
+#if defined VERSION13
addr = HDstrtoll(argv[2], NULL, 0);
+#elif defined VERSION12
+ addr->offset = HDstrtoll(argv[2], NULL, 0);
+#endif
}
if (argc > 3) {
+#if defined VERSION13
extra = HDstrtoll(argv[3], NULL, 0);
+#elif defined VERSION12
+ extra->offset = HDstrtoll(argv[3], NULL, 0);
+#endif
}
/*
* Read the signature at the specified file position.
*/
HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr);
+
if (H5F_block_read(f, addr, (hsize_t)sizeof(sig), H5P_DEFAULT, sig)<0) {
fprintf(stderr, "cannot read signature\n");
HDexit(3);
diff --git a/tools/h5import.c b/tools/h5import.c
index 53fae0b..a54c98f 100644
--- a/tools/h5import.c
+++ b/tools/h5import.c
@@ -10,21 +10,36 @@
/* See H5private.h for how to include system headers */
#include <hdf5.h>
+#include <h5tools.c>
#ifdef H5_STDC_HEADERS
# include <fcntl.h>
# include <string.h>
# include <stdlib.h>
# include <stdio.h>
+#elif defined STDC_HEADERS
+# include <fcntl.h>
+# include <string.h>
+# include <stdlib.h>
+# include <stdio.h>
#endif
#ifdef H5_HAVE_UNISTD_H
# include <sys/types.h>
# include <unistd.h>
+#elif defined HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
#endif
+#if defined VERSION12
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#elif defined VERSION13
#ifdef H5_HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
+#endif
diff --git a/tools/h5ls.c b/tools/h5ls.c
index d523cf0..1cad442 100644
--- a/tools/h5ls.c
+++ b/tools/h5ls.c
@@ -18,11 +18,15 @@
/*
* File drivers
*/
+#if defined VERSION13
#include <H5FDsec2.h>
#include <H5FDmulti.h>
#include <H5FDfamily.h>
-#define NDRIVERS 10
+#elif defined VERSION12
+#include <H5Fpublic.h>
+#endif
+#define NDRIVERS 10
/*
* If defined then include the file name as part of the object name when
* printing full object names. Otherwise leave the file name off.
@@ -1912,11 +1916,12 @@ main (int argc, char *argv[])
static char root_name[] = "/";
int ndrivers=0;
+
struct {
const char *name;
hid_t fapl;
} driver[NDRIVERS];
-
+
/* Build display table */
DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose,
@@ -2081,7 +2086,7 @@ main (int argc, char *argv[])
driver[ndrivers].name = "sec2";
driver[ndrivers].fapl = H5P_DEFAULT;
ndrivers++;
-
+#if defined VERSION13
driver[ndrivers].name = "family";
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_family(fapl, 0, H5P_DEFAULT);
@@ -2096,7 +2101,7 @@ main (int argc, char *argv[])
driver[ndrivers].fapl = fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_multi(fapl, NULL, NULL, NULL, NULL, TRUE);
ndrivers++;
-
+#endif
/*
* Each remaining argument is an hdf5 file followed by an optional slash
* and object name.
diff --git a/tools/h5repart.c b/tools/h5repart.c
index 6704f38..74acb26 100644
--- a/tools/h5repart.c
+++ b/tools/h5repart.c
@@ -14,6 +14,7 @@
/* See H5private.h for how to include system headers */
#include <hdf5.h>
+#include <h5tools.h>
#ifdef H5_STDC_HEADERS
# include <ctype.h>
# include <errno.h>
@@ -21,16 +22,33 @@
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
+#elif defined STDC_HEADERS
+# include <ctype.h>
+# include <errno.h>
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
#endif
#ifdef H5_HAVE_UNISTD_H
# include <sys/types.h>
# include <unistd.h>
+#elif defined HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
#endif
+
+#if defined VERSION12
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#elif defined VERSION13
#ifdef H5_HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
+#endif
#ifndef FALSE
#define FALSE 0
diff --git a/tools/h5tools.h b/tools/h5tools.h
index e6c4e40..0cbdc84 100644
--- a/tools/h5tools.h
+++ b/tools/h5tools.h
@@ -12,7 +12,13 @@
#include <hdf5.h>
#include <stdio.h>
-
+#if H5_VERS_MAJOR == 1
+#if H5_VERS_MINOR == 2
+#define VERSION12
+#elif H5_VERS_MINOR == 3
+#define VERSION13
+#endif
+#endif
#define ESCAPE_HTML 1