summaryrefslogtreecommitdiffstats
path: root/test/h5test.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-11-27 23:01:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-11-27 23:01:48 (GMT)
commit0726621eaa2c3423c8d8969fae314af54e902604 (patch)
tree550e6ebf64bf191fdc21633ee760759b9c2f9950 /test/h5test.c
parente7b7e14a88f37a6d348e62abf10765059383d645 (diff)
downloadhdf5-0726621eaa2c3423c8d8969fae314af54e902604.zip
hdf5-0726621eaa2c3423c8d8969fae314af54e902604.tar.gz
hdf5-0726621eaa2c3423c8d8969fae314af54e902604.tar.bz2
[svn-r3005] Purpose:
Backward compatibility code Description: Add in code to allow the library to emulate the v1.2 API and behavior. Platforms tested: FreeBSD 4.2 (hawkwind)
Diffstat (limited to 'test/h5test.c')
-rw-r--r--test/h5test.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/h5test.c b/test/h5test.c
index bfd18df..b3d91ca 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -119,7 +119,9 @@ h5_cleanup(const char *base_name[], hid_t fapl)
char temp[2048];
int i, j;
int retval=0;
+#ifndef H5_WANT_H5_V1_2_COMPAT
hid_t driver;
+#endif /* H5_WANT_H5_V1_2_COMPAT */
if (!getenv("HDF5_NOCLEANUP")) {
for (i=0; base_name[i]; i++) {
@@ -128,6 +130,31 @@ h5_cleanup(const char *base_name[], hid_t fapl)
continue;
}
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ switch (H5Pget_driver(fapl)) {
+ case H5F_LOW_CORE:
+ break; /*nothing to remove*/
+
+ case H5F_LOW_SPLIT:
+ HDsnprintf(temp, sizeof temp, "%s.raw", filename);
+ remove(temp);
+ HDsnprintf(temp, sizeof temp, "%s.meta", filename);
+ remove(temp);
+ break;
+
+ case H5F_LOW_FAMILY:
+ for (j=0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
+ if (access(temp, F_OK)<0) break;
+ remove(temp);
+ }
+ break;
+
+ default:
+ remove(filename);
+ break;
+ }
+#else /* H5_WANT_H5_V1_2_COMPAT */
driver = H5Pget_driver(fapl);
if (H5FD_FAMILY==driver) {
for (j=0; /*void*/; j++) {
@@ -148,6 +175,7 @@ h5_cleanup(const char *base_name[], hid_t fapl)
} else {
remove(filename);
}
+#endif /* H5_WANT_H5_V1_2_COMPAT */
}
retval=1;
}
@@ -229,10 +257,15 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
const char *prefix=NULL;
const char *suffix=".h5"; /* suffix has default */
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ H5F_driver_t driver;
+#else /* H5_WANT_H5_V1_2_COMPAT */
hid_t driver;
+#endif /* H5_WANT_H5_V1_2_COMPAT */
if (!base_name || !fullname || size<1) return NULL;
+#ifndef H5_WANT_H5_V1_2_COMPAT
/* figure out the suffix */
if (H5P_DEFAULT!=fapl){
if ((driver=H5Pget_driver(fapl))<0) return NULL;
@@ -262,6 +295,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!prefix) prefix = HDF5_PREFIX;
#endif
}
+#endif /* H5_WANT_H5_V1_2_COMPAT */
/* Prepend the prefix value to the base name */
@@ -275,6 +309,22 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
strcpy(fullname, base_name);
}
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ /* Append a suffix */
+ if ((driver=H5Pget_driver(fapl))<0) return NULL;
+ switch (driver) {
+ case H5F_LOW_SPLIT:
+ case H5F_LOW_CORE:
+ suffix = NULL;
+ break;
+ case H5F_LOW_FAMILY:
+ suffix = "%05d.h5";
+ break;
+ default:
+ suffix = ".h5";
+ break;
+ }
+#endif /* H5_WANT_H5_V1_2_COMPAT */
/* Append a suffix */
if (suffix) {
if (strlen(fullname)+strlen(suffix)>=size) return NULL;