diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-08-28 20:57:41 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-08-28 20:57:41 (GMT) |
commit | a31524e4aee50324ccbc6707584b1758279f984e (patch) | |
tree | bffd22d55739fd897b06ec9d3c9339fc1f1bd7c3 /fortran | |
parent | 0286bb12de563c6aeb1b9d0c5be4afe717305477 (diff) | |
parent | 1847391fc51728811407f3e1586213758c1d0e89 (diff) | |
download | hdf5-a31524e4aee50324ccbc6707584b1758279f984e.zip hdf5-a31524e4aee50324ccbc6707584b1758279f984e.tar.gz hdf5-a31524e4aee50324ccbc6707584b1758279f984e.tar.bz2 |
[svn-r27607] merge from trunk.
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/examples/CMakeLists.txt | 12 | ||||
-rw-r--r-- | fortran/examples/CMakeTests.cmake | 24 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 18 | ||||
-rw-r--r-- | fortran/src/H5Dff.F90 | 3 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 15 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 11 | ||||
-rw-r--r-- | fortran/src/H5f90global.F90 | 12 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 12 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 1 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 52 | ||||
-rw-r--r-- | fortran/test/CMakeTests.cmake | 4 | ||||
-rw-r--r-- | fortran/test/fortranlib_test.f90 | 3 | ||||
-rw-r--r-- | fortran/test/tH5D.f90 | 120 |
13 files changed, 212 insertions, 75 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index f2dc896..aad5f33 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -52,7 +52,7 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (f90_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED " " " ") @@ -66,7 +66,7 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endforeach (example ${examples}) foreach (example ${F2003_examples}) @@ -83,7 +83,7 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (f03_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ") @@ -97,7 +97,7 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endforeach (example ${F2003_examples}) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) @@ -115,7 +115,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) TARGET_NAMING (f90_ex_ph5example-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED " " " ") @@ -130,7 +130,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) if (BUILD_TESTING) diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 173984c..63e75c2 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -9,12 +9,12 @@ add_test ( NAME f90_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove compound.h5 copy1.h5 copy2.h5 dsetf.h5 - extend.h5 + extend.h5 FORTRAN.h5 groupf.h5 groupsf.h5 @@ -28,16 +28,16 @@ set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f90_ex-clear-objects") - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test ( NAME f90_ex-shared-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove compound.h5 copy1.h5 copy2.h5 dsetf.h5 - extend.h5 + extend.h5 FORTRAN.h5 groupf.h5 groupsf.h5 @@ -51,7 +51,7 @@ set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f90_ex-shared-clear-objects") - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) foreach (example ${examples}) add_test (NAME f90_ex_${example} COMMAND $<TARGET_FILE:f90_ex_${example}>) @@ -59,13 +59,13 @@ foreach (example ${examples}) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f90_ex_${example}") - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test (NAME f90_ex-shared_${example} COMMAND $<TARGET_FILE:f90_ex_${example}-shared>) if (NOT "${last_test}" STREQUAL "") set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f90_ex-shared_${example}") - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endforeach (example ${examples}) if (HDF5_ENABLE_F2003) @@ -75,19 +75,19 @@ if (HDF5_ENABLE_F2003) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>) if (NOT "${last_test}" STREQUAL "") set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "f03_ex-shared_${example}") - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endforeach (example ${F2003_examples}) endif (HDF5_ENABLE_F2003) if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:f90_ex_ph5example>) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:f90_ex_ph5example>) - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 261e52a..857b26d 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -62,19 +62,19 @@ set_target_properties (H5_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) if (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif (WIN32) -else (BUILD_SHARED_LIBS) +else (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) if (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) else (WIN32) set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) endif (WIN32) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) @@ -133,7 +133,7 @@ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES ) set (install_targets ${HDF5_F90_C_LIB_TARGET}) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SRCS} ${f90CStub_C_HDRS}) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) @@ -147,7 +147,7 @@ if (BUILD_SHARED_LIBS) INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5_gen.F90 PROPERTIES GENERATED TRUE) @@ -221,7 +221,7 @@ if (WIN32) endif (WIN32) set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SRCS}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) @@ -248,7 +248,7 @@ if (BUILD_SHARED_LIBS) ) endif (WIN32) set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET}) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -299,10 +299,10 @@ install ( # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - endif (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) install ( TARGETS diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index afdb5ba..e44d90e 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -1094,8 +1094,7 @@ CONTAINS offset = h5dget_offset(dset_id) - hdferr = 0 - IF(offset .LT. 0) hdferr = -1 + hdferr = 0 ! never returns a function error because C API never returns a function error. END SUBROUTINE h5dget_offset_f diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index e527dce..f3bc42f 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -436,11 +436,12 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, */ int_f h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, - int_f *h5e_flags, hid_t_f *h5e_hid_flags, int_f *h5f_flags, - int_f *h5fd_flags, hid_t_f *h5fd_hid_flags, - int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, - hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, - hsize_t_f *h5s_hsize_flags, int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags) + int_f *h5e_flags, hid_t_f *h5e_hid_flags, int_f *h5f_flags, + int_f *h5fd_flags, hid_t_f *h5fd_hid_flags, + int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, + hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, + hsize_t_f *h5s_hsize_flags, int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, + haddr_t_f *h5_haddr_generic_flags) /******/ { int ret_value = -1; @@ -773,7 +774,9 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5_generic_flags[5] = (int_f)H5_ITER_INC; /* Increasing order */ h5_generic_flags[6] = (int_f)H5_ITER_DEC; /* Decreasing order */ h5_generic_flags[7] = (int_f)H5_ITER_NATIVE; /* No particular order, whatever is fastest */ - h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */ + h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */ + + h5_haddr_generic_flags[0] = (haddr_t_f)HADDR_UNDEF; /* undefined address */ ret_value = 0; return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 4ceb1a8..169864f 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -105,16 +105,17 @@ CONTAINS i_H5S_hsize_flags, & i_H5T_flags, & i_H5Z_flags, & - i_H5generic_flags) & + i_H5generic_flags, & + i_H5generic_haddr_flags) & BIND(C,NAME='h5init_flags_c') - IMPORT :: HID_T, SIZE_T, HSIZE_T + IMPORT :: HID_T, SIZE_T, HSIZE_T, HADDR_T IMPORT :: H5D_FLAGS_LEN, H5D_SIZE_FLAGS_LEN, & H5E_FLAGS_LEN, H5E_HID_FLAGS_LEN, & H5F_FLAGS_LEN, H5G_FLAGS_LEN, H5FD_FLAGS_LEN, & H5FD_HID_FLAGS_LEN, H5I_FLAGS_LEN, H5L_FLAGS_LEN, & H5O_FLAGS_LEN, H5P_FLAGS_LEN, H5P_FLAGS_INT_LEN, & H5R_FLAGS_LEN, H5S_FLAGS_LEN, H5S_HSIZE_FLAGS_LEN, & - H5T_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN + H5T_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN IMPLICIT NONE INTEGER i_H5D_flags(H5D_FLAGS_LEN) INTEGER(SIZE_T) i_H5D_size_flags(H5D_SIZE_FLAGS_LEN) @@ -135,6 +136,7 @@ CONTAINS INTEGER i_H5T_flags(H5T_FLAGS_LEN) INTEGER i_H5Z_flags(H5Z_FLAGS_LEN) INTEGER i_H5generic_flags(H5generic_FLAGS_LEN) + INTEGER(HADDR_T) i_H5generic_haddr_flags(H5generic_haddr_FLAGS_LEN) END FUNCTION h5init_flags_c END INTERFACE INTERFACE @@ -164,7 +166,8 @@ CONTAINS H5S_hsize_flags, & H5T_flags, & H5Z_flags, & - H5generic_flags) + H5generic_flags,& + H5generic_haddr_flags) error_3 = h5init1_flags_c(H5LIB_flags ) error = error_1 + error_2 + error_3 END SUBROUTINE h5open_f diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index c88327c..947eff4 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -316,6 +316,18 @@ MODULE H5GLOBAL EQUIVALENCE(H5generic_flags(7), H5_ITER_DEC_F) EQUIVALENCE(H5generic_flags(8), H5_ITER_NATIVE_F) EQUIVALENCE(H5generic_flags(9), H5_ITER_N_F) + + INTEGER, PARAMETER :: H5generic_haddr_FLAGS_LEN = 1 + INTEGER(HADDR_T) :: H5generic_haddr_flags(H5generic_haddr_FLAGS_LEN) + !DEC$if defined(BUILD_HDF5_DLL) + !DEC$ATTRIBUTES DLLEXPORT :: /H5generic_haddr_FLAGS/ + !DEC$endif + COMMON /H5generic_haddr_FLAGS/ H5generic_haddr_flags + + INTEGER(HADDR_T) :: HADDR_UNDEF_F + + EQUIVALENCE(H5generic_haddr_flags(1), HADDR_UNDEF_F) + ! ! H5G flags declaration ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index b26e985..1d08d7e 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -23,9 +23,6 @@ H5_FCDLL char * HD5f2cstring (_fcd fdesc, size_t len); H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len); -#ifdef H5_VMS -#define H5_FC_FUNC_(name, NAME) NAME -#endif /*H5_VMS*/ /* * Storage info struct used by H5O_info_t and H5F_info_t @@ -527,10 +524,11 @@ H5_FCDLL int_f h5close_c(void); H5_FCDLL int_f h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes); H5_FCDLL int_f h5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f *floatingtypes, int_f *floatinglen, hid_t_f *integertypes, int_f *integerlen); H5_FCDLL int_f h5init_flags_c(int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5e_flags, hid_t_f *h5e_hid_flags, int_f *h5f_flags, - int_f *h5fd_flags, hid_t_f *h5fd_hid_flags, - int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, - hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, - hsize_t_f *h5s_hsize_flags, int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags); + int_f *h5fd_flags, hid_t_f *h5fd_hid_flags, + int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, + hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags, int_f *h5s_flags, + hsize_t_f *h5s_hsize_flags, int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, + haddr_t_f *h5_haddr_generic_flags); H5_FCDLL int_f h5init1_flags_c(int_f *h5lib_flags); H5_FCDLL int_f h5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum); H5_FCDLL int_f h5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index e931a97..1333262 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -64,6 +64,7 @@ H5D_mp_H5DFILL_CHAR H5D_mp_H5DFILL_INTEGER H5D_mp_H5DGET_SPACE_STATUS_F H5D_mp_H5DCREATE_ANON_F +H5D_mp_H5DGET_OFFSET_F H5D_mp_H5DGET_SPACE_F H5D_mp_H5DGET_TYPE_F H5D_mp_H5DSET_EXTENT_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 19d4975..49b8da8 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -22,7 +22,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} @@ -37,13 +37,13 @@ if (BUILD_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES LANGUAGE Fortran) add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} @@ -64,7 +64,7 @@ if (WIN32) COMPILE_DEFINITIONS "HDF5F90_WINDOWS" ) endif (WIN32) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL") @@ -90,7 +90,7 @@ if (BUILD_SHARED_LIBS) COMPILE_DEFINITIONS "BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS" ) endif (WIN32) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities @@ -150,7 +150,7 @@ add_executable (testhdf5_fortran ) TARGET_NAMING (testhdf5_fortran STATIC) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC " " " ") -target_link_libraries (testhdf5_fortran +target_link_libraries (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -164,7 +164,7 @@ set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (testhdf5_fortran-shared fortranlib_test.f90 tH5A.f90 @@ -184,7 +184,7 @@ if (BUILD_SHARED_LIBS) ) TARGET_NAMING (testhdf5_fortran-shared SHARED) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED " " " ") - target_link_libraries (testhdf5_fortran-shared + target_link_libraries (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -198,7 +198,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for testhdf5_fortran_1_8 add_executable (testhdf5_fortran_1_8 @@ -211,7 +211,7 @@ add_executable (testhdf5_fortran_1_8 ) TARGET_NAMING (testhdf5_fortran_1_8 STATIC) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC " " " ") -target_link_libraries (testhdf5_fortran_1_8 +target_link_libraries (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -225,7 +225,7 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (testhdf5_fortran_1_8-shared fortranlib_test_1_8.f90 tH5O.f90 @@ -236,7 +236,7 @@ if (BUILD_SHARED_LIBS) ) TARGET_NAMING (testhdf5_fortran_1_8-shared SHARED) TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED " " " ") - target_link_libraries (testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -250,7 +250,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fortranlib_test_F03 add_executable (fortranlib_test_F03 @@ -265,7 +265,7 @@ add_executable (fortranlib_test_F03 ) TARGET_NAMING (fortranlib_test_F03 STATIC) TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC " " " ") -target_link_libraries (fortranlib_test_F03 +target_link_libraries (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -279,7 +279,7 @@ set_target_properties (fortranlib_test_F03 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fortranlib_test_F03-shared fortranlib_test_F03.f90 tH5E_F03.f90 @@ -292,7 +292,7 @@ if (BUILD_SHARED_LIBS) ) TARGET_NAMING (fortranlib_test_F03-shared SHARED) TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED " " " ") - target_link_libraries (fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -306,13 +306,13 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fflush1 add_executable (fflush1 fflush1.f90) TARGET_NAMING (fflush1 STATIC) TARGET_FORTRAN_PROPERTIES (fflush1 STATIC " " " ") -target_link_libraries (fflush1 +target_link_libraries (fflush1 ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -326,11 +326,11 @@ set_target_properties (fflush1 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fflush1-shared fflush1.f90) TARGET_NAMING (fflush1-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED " " " ") - target_link_libraries (fflush1-shared + target_link_libraries (fflush1-shared ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -344,13 +344,13 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #-- Adding test for fflush2 add_executable (fflush2 fflush2.f90) TARGET_NAMING (fflush2 STATIC) TARGET_FORTRAN_PROPERTIES (fflush2 STATIC " " " ") -target_link_libraries (fflush2 +target_link_libraries (fflush2 ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -364,11 +364,11 @@ set_target_properties (fflush2 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_executable (fflush2-shared fflush2.f90) TARGET_NAMING (fflush2-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED " " " ") - target_link_libraries (fflush2-shared + target_link_libraries (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -382,6 +382,6 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 94f6b64..154e70c 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -27,7 +27,7 @@ add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>) add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $<TARGET_FILE:testhdf5_fortran-shared>) set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) @@ -51,4 +51,4 @@ if (BUILD_SHARED_LIBS) #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2-shared COMMAND $<TARGET_FILE:fflush2-shared>) set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) -endif (BUILD_SHARED_LIBS) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 79ff161..f41d811 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -93,6 +93,9 @@ PROGRAM fortranlibtest ret_total_error = 0 CALL extenddsettest(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' Extendible dataset test', total_error) +! MSB--DISABLED TEST-- Fails for unknown reasons on platypus with pgf90 compiler +! CALL test_userblock_offset(cleanup, ret_total_error) +! CALL write_test_status(ret_total_error, ' Dataset offset with user block', total_error) ! write(*,*) ! write(*,*) '=========================================' diff --git a/fortran/test/tH5D.f90 b/fortran/test/tH5D.f90 index b5febb3..c9ba952 100644 --- a/fortran/test/tH5D.f90 +++ b/fortran/test/tH5D.f90 @@ -343,7 +343,7 @@ CONTAINS !Modify dataset creation properties, i.e. enable chunking ! CALL h5pcreate_f(H5P_DATASET_CREATE_F, crp_list, error) - CALL check("h5pcreat_f",error,total_error) + CALL check("h5pcreate_f",error,total_error) CALL h5pset_chunk_f(crp_list, RANK, dims1, error) CALL check("h5pset_chunk_f",error,total_error) @@ -508,5 +508,123 @@ CONTAINS RETURN END SUBROUTINE extenddsettest + +! +! The following subroutine tests h5dget_offset_f functionality +! + + SUBROUTINE test_userblock_offset(cleanup, total_error) + + USE ISO_C_BINDING + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + ! + !the dataset is stored in file "offset.h5" + ! + INTEGER, PARAMETER :: dset_dim1=2, dset_dim2=10 + CHARACTER(LEN=6), PARAMETER :: filename = "offset" + CHARACTER(LEN=80) :: fix_filename + + INTEGER(hid_t) :: file, fcpl, dataset, space + INTEGER :: i, j, n, ios + INTEGER(hsize_t), DIMENSION(1:2) :: dims + INTEGER :: f + INTEGER(haddr_t) :: offset + INTEGER, DIMENSION(1:dset_dim1,1:dset_dim2), TARGET :: rdata, data_in + INTEGER :: error + TYPE(C_PTR) :: f_ptr + ! + !Create a new file using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + STOP + ENDIF + + CALL h5pcreate_f(H5P_FILE_CREATE_F, fcpl, error) + CALL check("h5pcreate_f",error,total_error) + + ! Initialize the dataset + n = 0 + DO i = 1, dset_dim1 + DO j = 1, dset_dim2 + n = n + 1 + data_in(i,j) = n + END DO + END DO + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file, error, fcpl) + CALL check("h5fcreate_f",error,total_error) + + ! Create the data space + dims(1:2) = (/dset_dim1,dset_dim2/) + + CALL h5screate_simple_f(2, dims, space, error) + CALL check("h5screate_simple_f",error,total_error) + + ! Create the dataset + CALL h5dcreate_f(file, "dset1", H5T_NATIVE_INTEGER, space, dataset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Test dataset address. Should be undefined. + CALL h5dget_offset_f(dataset, offset, error) + CALL VERIFY("h5dget_offset_f",offset, HADDR_UNDEF_F, total_error) + + ! Write the data to the dataset + f_ptr = C_LOC(data_in(1,1)) + CALL h5dwrite_f(dataset, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("h5dwrite_f", error, total_error) + + ! Test dataset address in file. Open the same file as a C file, seek + ! the data position as H5Dget_offset points to, read the dataset, and + ! compare it with the data written in. + CALL h5dget_offset_f(dataset, offset, error) + CALL check("h5dget_offset_f", error, total_error) + IF(offset.EQ.HADDR_UNDEF_F)THEN + total_error = total_error + 1 + ENDIF + + CALL h5dclose_f(dataset, error) + CALL check("h5dclose_f", error, total_error) + CALL h5fclose_f(file, error) + CALL check("h5fclose_f", error, total_error) + + IF(total_error.NE.0) RETURN + + OPEN(10,FILE=fix_filename, ACCESS="STREAM", IOSTAT=ios) + IF(ios.NE.0)THEN + WRITE(*,'(A)') "Failed to open file "//TRIM(fix_filename) + total_error = total_error + 1 + RETURN + ENDIF + ! The pos= specifier illustrates that positions are in bytes, + ! starting from byte 1 (as opposed to C, where they start from byte 0) + READ(10, POS=offset+1, IOSTAT=ios) rdata + IF(ios.NE.0)THEN + WRITE(*,'(A)') "Failed to read data from stream I/O " + total_error = total_error + 1 + CLOSE(10) + RETURN + ENDIF + + ! Check that the values read are the same as the values written + DO i = 1, dset_dim1 + DO j = 1, dset_dim2 + CALL VERIFY("h5dget_offset_f",rdata(i,j), data_in(i,j), total_error) + IF(total_error.NE.0)THEN + WRITE(*,'(A)') " Read different values than written." + WRITE(*,'(2(A,I0))') " At index ",i,",",j + CLOSE(10) + RETURN + ENDIF + END DO + END DO + + CLOSE(10) + + END SUBROUTINE test_userblock_offset + END MODULE TH5D |