From 528a7dd3b8ac56d61d0f82e9e90fe4ed361eebc6 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 30 Oct 2008 15:49:08 -0500 Subject: [svn-r16006] Modify the commit of r15943 for H5_USE_16_API. Let H5version.h check if H5_USE_16_API_DEFAULT is defined by the configure. Then define H5_USE_16_API and use it throughout. Tested on kagiso - supposed to be simple. --- bin/make_vers | 9 +++++++++ src/H5E.c | 6 +++--- src/H5version.h | 8 ++++++-- test/err_compat.c | 6 +++--- test/error_test.c | 12 ++++++------ 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/bin/make_vers b/bin/make_vers index 07b6de6..2cfad4c 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -106,6 +106,15 @@ sub print_globalapivers ($) { print $fh " * API symbol, the individual API version macro takes priority.\n"; print $fh " */\n"; + for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { + # Print API version ifdef + print $fh "#if defined(H5_USE_1", ($curr_idx * 2), "_API_DEFAULT) && !defined(H5_USE_1", ($curr_idx * 2), "_API)\n"; + # Print API version definition + print $fh "#define H5_USE_1", ($curr_idx * 2), "_API 1\n"; + # Print API version endif + print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n\n"; + } + # Loop over supported older library APIs and define the appropriate macros for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { # Print API version ifdef diff --git a/src/H5E.c b/src/H5E.c index dbf79d2..6eb7768 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -170,13 +170,13 @@ H5E_set_default_auto(H5E_t *stk) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_set_default_auto) -#if defined(H5_USE_16_API) || defined(H5_USE_16_API_DEFAULT) +#ifdef H5_USE_16_API stk->auto_op.vers = 1; stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; -#else /* H5_USE_16_API || H5_USE_16_API_DEFAULT */ +#else /* H5_USE_16_API */ stk->auto_op.vers = 2; stk->auto_op.u.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_USE_16_API || H5_USE_16_API_DEFAULT */ +#endif /* H5_USE_16_API */ stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5version.h b/src/H5version.h index 49a346f..fd9e780 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -32,7 +32,11 @@ * Note: If an application has already chosen a particular version for an * API symbol, the individual API version macro takes priority. */ -#ifdef H5_USE_16_API_DEFAULT +#if defined(H5_USE_16_API_DEFAULT) && !defined(H5_USE_16_API) +#define H5_USE_16_API 1 +#endif /* H5_USE_16_API_DEFAULT && !H5_USE_16_API */ + +#ifdef H5_USE_16_API /*************/ /* Functions */ @@ -130,7 +134,7 @@ #define H5E_auto_t_vers 1 #endif /* !defined(H5E_auto_t_vers) */ -#endif /* H5_USE_16_API_DEFAULT */ +#endif /* H5_USE_16_API */ /* Choose the correct version of each API symbol, defaulting to the latest diff --git a/test/err_compat.c b/test/err_compat.c index a16d903..33c172f 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -99,13 +99,13 @@ test_error(hid_t file) TEST_ERROR; if (!old_func) TEST_ERROR; -#ifdef H5_USE_16_API_DEFAULT +#ifdef H5_USE_16_API if (old_func != (H5E_auto1_t)H5Eprint1) TEST_ERROR; -#else /* H5_USE_16_API_DEFAULT */ +#else /* H5_USE_16_API */ if (old_func != (H5E_auto1_t)H5Eprint2) TEST_ERROR; -#endif /* H5_USE_16_API_DEFAULT */ +#endif /* H5_USE_16_API */ if(H5Eset_auto1(NULL, NULL)<0) TEST_ERROR; diff --git a/test/error_test.c b/test/error_test.c index 2ceb05f..027f31b 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -21,13 +21,13 @@ */ #include "h5test.h" -#ifdef H5_USE_16_API_DEFAULT +#ifdef H5_USE_16_API int main(void) { printf("Test skipped because backward compatbility with v1.6 is configured in\n"); return 0; } -#else /* H5_USE_16_API_DEFAULT */ +#else /* H5_USE_16_API */ const char *FILENAME[] = { "errors", @@ -129,13 +129,13 @@ test_error(hid_t file) TEST_ERROR; if(old_data != NULL) TEST_ERROR; -#ifdef H5_USE_16_API_DEFAULT +#ifdef H5_USE_16_API if (old_func != (H5E_auto_t)H5Eprint) TEST_ERROR; -#else /* H5_USE_16_API_DEFAULT */ +#else /* H5_USE_16_API */ if (old_func != (H5E_auto2_t)H5Eprint2) TEST_ERROR; -#endif /* H5_USE_16_API_DEFAULT */ +#endif /* H5_USE_16_API */ if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) TEST_ERROR; @@ -620,5 +620,5 @@ error: printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /* H5_USE_16_API_DEFAULT */ +#endif /* H5_USE_16_API */ -- cgit v0.12