diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-02-22 12:16:30 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-02-22 12:16:30 (GMT) |
commit | c07d8036591313caf15cf626122bd7ce4e61be49 (patch) | |
tree | de3cfcb2639a3c84254d536d2f4a1ec9239af019 /fortran | |
parent | 179f3b7879e28165869034255b5852b551700ad6 (diff) | |
parent | f634105bdb7c494a5ab39291d64c00676c11b476 (diff) | |
download | hdf5-c07d8036591313caf15cf626122bd7ce4e61be49.zip hdf5-c07d8036591313caf15cf626122bd7ce4e61be49.tar.gz hdf5-c07d8036591313caf15cf626122bd7ce4e61be49.tar.bz2 |
[svn-r26274] Merge of r26096 to r26271 from trunk.
Tested on: jam - serial: C++/Fortran
parallel: Fortran
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/CMakeLists.txt | 2 | ||||
-rw-r--r-- | fortran/examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 7 | ||||
-rw-r--r-- | fortran/src/H5Tf.c | 72 | ||||
-rw-r--r-- | fortran/src/H5Tff.f90 | 51 | ||||
-rw-r--r-- | fortran/src/H5Tff_F03.f90 | 107 | ||||
-rw-r--r-- | fortran/src/H5Tff_F90.f90 | 56 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 1 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 4 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fortran/test/CMakeTests.cmake | 2 | ||||
-rw-r--r-- | fortran/test/tH5T_F03.f90 | 20 | ||||
-rw-r--r-- | fortran/test/tf.f90 | 24 | ||||
-rw-r--r-- | fortran/test/tf_F03.f90 | 10 | ||||
-rw-r--r-- | fortran/test/tf_F08.f90 | 10 | ||||
-rw-r--r-- | fortran/testpar/CMakeLists.txt | 2 |
16 files changed, 275 insertions, 103 deletions
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index 3fe9e7d..c725047 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_F90 C CXX Fortran) if (H5_HAVE_PARALLEL) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 322ae35..1f59f32 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_F90_EXAMPLES C CXX Fortran) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 5b641d1..22a091e 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- @@ -11,6 +11,8 @@ if (WIN32) endif (NOT H5_HAVE_PARALLEL) if (NOT HDF5_ENABLE_F2003) set (H5_NOF03EXP ";") + else (NOT HDF5_ENABLE_F2003) + set (H5_F03EXP ";") endif (NOT HDF5_ENABLE_F2003) configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) endif (MSVC) @@ -132,7 +134,6 @@ if (H5_HAVE_PARALLEL) ${HDF5_F90_SRC_SOURCE_DIR}/H5FDmpiof.c ) endif (H5_HAVE_PARALLEL) - set_source_files_properties (${f90CStub_C_SRCS} PROPERTIES LANGUAGE C) set (f90CStub_C_HDRS @@ -224,6 +225,7 @@ else (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.f90 ) endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) +set_source_files_properties (${f90_F_SRCS} PROPERTIES LANGUAGE Fortran) #----------------------------------------------------------------------------- # Add Main fortran library @@ -255,6 +257,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} ${LIB_TYPE}) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran + LINKER_LANGUAGE Fortran INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index ca9c30f..878119f 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -1738,21 +1738,23 @@ nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id) /****if* H5Tf/h5tenum_insert_c * NAME - * h5tenum_insert_c + * h5tenum_insert_c * PURPOSE - * Call H5Tenum_insert to insert a new enumeration datatype member. + * Call H5Tenum_insert to insert a new enumeration datatype member. * INPUTS - * type_id - identifier of the datatype - * name - Name of the new member - * namelen - length of the name - * value - value of the new member + * type_id - identifier of the datatype + * name - Name of the new member + * namelen - length of the name + * value - value of the new member * RETURNS - * 0 on success, -1 on failure + * 0 on success, -1 on failure * AUTHOR * XIANGYANG SU - * Thursday, February 3, 2000 + * Thursday, February 3, 2000 * HISTORY - * + * 'value' is no longer cast into an int. If the user passes in an 8 byte integer then + * it should not be cast to an int (which might be 4 bytes). Instead the value + * is written as the size of an int_f. * SOURCE */ @@ -1761,19 +1763,18 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value) /******/ { int ret_value = -1; - hid_t c_type_id; char* c_name; size_t c_namelen; - int_f c_value; herr_t error; + int_f c_value; c_namelen = *namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; - c_type_id = (hid_t)*type_id; - c_value = (int)*value; - error = H5Tenum_insert(c_type_id, c_name, &c_value); + c_value = *value; + error = H5Tenum_insert((hid_t)*type_id, c_name, &c_value); + HDfree(c_name); if(error < 0) return ret_value; @@ -2421,3 +2422,46 @@ h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void return ret_value; } +/****if* H5Tf/h5tenum_insert_ptr_c + * NAME + * /h5tenum_insert_ptr_c + * PURPOSE + * Calls H5Tenum_insert + * INPUTS + * type_id - Datatype identifier for the enumeration datatype. + * name - Datatype identifier. + * value - Pointer to the value of the new member. + * + * OUTPUTS + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * February 6, 2015 + * + * SOURCE +*/ +int_f +h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value) +/******/ +{ + int ret_value = -1; + hid_t status; + char *c_name; + size_t c_namelen; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + status = H5Tenum_insert( (hid_t)*type_id, c_name, value); + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + + diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90 index 0e1dbb0..4b4c0b6 100644 --- a/fortran/src/H5Tff.f90 +++ b/fortran/src/H5Tff.f90 @@ -2335,57 +2335,6 @@ CONTAINS hdferr = h5tenum_create_c(parent_id, new_type_id) END SUBROUTINE h5tenum_create_f - -! -!****s* H5T/h5tenaum_insert_f -! -! NAME -! h5tenaum_insert_f -! -! PURPOSE -! Inserts a new enumeration datatype member. -! -! INPUTS -! type_id - datatype identifier -! OUTPUTS -! hdferr - Returns 0 if successful and -1 if fails -! -! AUTHOR -! Elena Pourmal -! August 12, 1999 -! -! HISTORY -! Explicit Fortran interfaces were added for -! called C functions (it is needed for Windows -! port). March 7, 2001 -! SOURCE - SUBROUTINE h5tenum_insert_f(type_id, name, value, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier - CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member - INTEGER, INTENT(IN) :: value !value of the new member - INTEGER, INTENT(OUT) :: hdferr ! Error code -!***** - INTEGER :: namelen - - INTERFACE - INTEGER FUNCTION h5tenum_insert_c(type_id, name, namelen, value) - USE H5GLOBAL - !DEC$IF DEFINED(HDF5F90_WINDOWS) - !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_C'::h5tenum_insert_c - !DEC$ENDIF - !DEC$ATTRIBUTES reference :: name - INTEGER(HID_T), INTENT(IN) :: type_id - CHARACTER(LEN=*), INTENT(IN) :: name - INTEGER, INTENT(IN) :: value - INTEGER :: namelen - END FUNCTION h5tenum_insert_c - END INTERFACE - - namelen = LEN(name) - hdferr = h5tenum_insert_c(type_id, name, namelen, value) - END SUBROUTINE h5tenum_insert_f - ! !****s* H5T/h5tenum_nameof_f ! diff --git a/fortran/src/H5Tff_F03.f90 b/fortran/src/H5Tff_F03.f90 index 2405837..2c9f212 100644 --- a/fortran/src/H5Tff_F03.f90 +++ b/fortran/src/H5Tff_F03.f90 @@ -47,6 +47,11 @@ MODULE H5T_PROVISIONAL !***** + INTERFACE h5tenum_insert_f + MODULE PROCEDURE h5tenum_insert_f03 + MODULE PROCEDURE h5tenum_insert_f90 + END INTERFACE + CONTAINS !****s* H5T (F03)/H5Tconvert_f_F03 @@ -93,6 +98,7 @@ CONTAINS BIND(C, NAME='h5tconvert_c') USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr USE H5GLOBAL + IMPLICIT NONE INTEGER(HID_T) , INTENT(IN) :: src_id INTEGER(HID_T) , INTENT(IN) :: dst_id INTEGER(SIZE_T), INTENT(IN) :: nelmts @@ -111,6 +117,107 @@ CONTAINS hdferr = H5Tconvert_c(src_id, dst_id, nelmts, buf, background_default, plist_id_default) END SUBROUTINE h5tconvert_f +! +!****s* (F03) H5T/h5tenum_insert_f90 +! +! NAME +! h5tenum_insert_f +! +! PURPOSE +! Inserts a new enumeration datatype member. +! +! INPUTS +! type_id - Datatype identifier for the enumeration datatype. +! name - Datatype identifier. +! value - Value of the new member. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). March 7, 2001 +! SOURCE + SUBROUTINE h5tenum_insert_f90(type_id, name, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member + INTEGER, INTENT(IN) :: value ! value of the new member + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: namelen + INTERFACE + INTEGER FUNCTION h5tenum_insert_c(type_id, name, namelen, value) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_C'::h5tenum_insert_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(HID_T), INTENT(IN) :: type_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER, INTENT(IN) :: value + INTEGER :: namelen + END FUNCTION h5tenum_insert_c + END INTERFACE + + namelen = LEN(name) + hdferr = h5tenum_insert_c(type_id, name, namelen, value) + END SUBROUTINE h5tenum_insert_f90 + +! +!****s* (F03) H5T/h5tenum_insert_f03 +! +! NAME +! h5tenum_insert_f +! +! PURPOSE +! Inserts a new enumeration datatype member. +! +! INPUTS +! type_id - Datatype identifier for the enumeration datatype. +! name - Datatype identifier. +! value - Pointer to the value of the new member. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! M. Scot Breitenfeld +! February 6, 2015 +! +! HISTORY +! F2003 implementation of function +! SOURCE + SUBROUTINE h5tenum_insert_f03(type_id, name, value, hdferr) + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, c_char + USE H5GLOBAL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: type_id + CHARACTER(LEN=*), INTENT(IN) :: name + TYPE(C_PTR) , INTENT(IN) :: value + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER :: namelen + + INTERFACE + INTEGER FUNCTION h5tenum_insert_ptr_c(type_id, name, namelen, value) & + BIND(C, NAME='h5tenum_insert_ptr_c') + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, c_char + USE H5GLOBAL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: type_id + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER :: namelen + TYPE(C_PTR), VALUE :: value + END FUNCTION h5tenum_insert_ptr_c + END INTERFACE + + namelen = LEN(name) + hdferr = h5tenum_insert_ptr_c(type_id, name, namelen, value) + END SUBROUTINE h5tenum_insert_f03 END MODULE H5T_PROVISIONAL diff --git a/fortran/src/H5Tff_F90.f90 b/fortran/src/H5Tff_F90.f90 index a95b31f..380fbec 100644 --- a/fortran/src/H5Tff_F90.f90 +++ b/fortran/src/H5Tff_F90.f90 @@ -36,4 +36,60 @@ MODULE H5T_PROVISIONAL + USE H5GLOBAL + +CONTAINS + +! +!****s* H5T/h5tenum_insert_f +! +! NAME +! h5tenum_insert_f +! +! PURPOSE +! Inserts a new enumeration datatype member. +! +! INPUTS +! type_id - Datatype identifier for the enumeration datatype. +! name - Datatype identifier. +! value - Value of the new member. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). March 7, 2001 +! SOURCE + SUBROUTINE h5tenum_insert_f(type_id, name, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER, INTENT(IN) :: value + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER :: namelen + + INTERFACE + INTEGER FUNCTION h5tenum_insert_c(type_id, name, namelen, value) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_C'::h5tenum_insert_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(HID_T), INTENT(IN) :: type_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER, INTENT(IN) :: value + INTEGER :: namelen + END FUNCTION h5tenum_insert_c + END INTERFACE + + namelen = LEN(name) + hdferr = h5tenum_insert_c(type_id, name, namelen, value) + END SUBROUTINE h5tenum_insert_f + END MODULE H5T_PROVISIONAL diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 284ffbd..b5e40a8 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -772,6 +772,7 @@ H5_FCDLL int_f nh5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen H5_FCDLL int_f nh5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id); H5_FCDLL int_f nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id); H5_FCDLL int_f nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); +H5_FCDLL int_f h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value); H5_FCDLL int_f nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen); H5_FCDLL int_f nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); H5_FCDLL int_f nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index c9c5e76..48fb343 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -543,7 +543,6 @@ H5T_mp_H5TINSERT_F H5T_mp_H5TPACK_F H5T_mp_H5TARRAY_CREATE_F H5T_mp_H5TENUM_CREATE_F -H5T_mp_H5TENUM_INSERT_F H5T_mp_H5TENUM_NAMEOF_F H5T_mp_H5TENUM_VALUEOF_F H5T_mp_H5TGET_MEMBER_VALUE_F @@ -560,6 +559,9 @@ H5T_mp_H5TGET_CREATE_PLIST_F H5T_mp_H5TCOMPILER_CONV_F H5T_mp_H5TGET_NATIVE_TYPE_F @H5_NOF03EXP@H5T_PROVISIONAL_mp_H5TCONVERT_F +@H5_F03EXP@H5T_PROVISIONAL_mp_H5TENUM_INSERT_F +@H5_NOF03EXP@H5T_PROVISIONAL_mp_H5TENUM_INSERT_F90 +@H5_NOF03EXP@H5T_PROVISIONAL_mp_H5TENUM_INSERT_F03 ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d10f2ef..3395906 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${ # Add Test Lib #----------------------------------------------------------------------------- add_library (${HDF5_F90_C_TEST_LIB_TARGET} ${LIB_TYPE} t.c) +set_source_files_properties (t.c PROPERTIES LANGUAGE C) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} @@ -18,12 +19,14 @@ target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ${LIB_TYPE}) set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran + LINKER_LANGUAGE C INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) # See if the F2008 intrinsic STORAGE_SIZE and C_SIZEOF are supported. If not then # fall back to F2003. If F2003 not supported then use F90 for the tests. +set_source_files_properties (tf_F90.f90 tf_F03.f90 tf_F08.f90 tf.f90 PROPERTIES LANGUAGE Fortran) if (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF) add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F08.f90 tf.f90) elseif (HDF5_ENABLE_F2003) @@ -36,7 +39,7 @@ endif (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF) set (SHARED_LINK_FLAGS " ") if (WIN32) if (BUILD_SHARED_LIBS) - set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_HDF5_DLL) + set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_HDF5_TEST_DLL) if (MSVC) set (SHARED_LINK_FLAGS "/DLL") endif (MSVC) @@ -53,6 +56,7 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} ${LIB_TYPE}) set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran + LINKER_LANGUAGE Fortran INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 6a9c535..4df50ad 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -11,11 +11,13 @@ set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSIO #-- Adding test for testhdf5_fortran_1_8 add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND $<TARGET_FILE:testhdf5_fortran_1_8>) set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") +set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_F2003) add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>) set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) endif (HDF5_ENABLE_F2003) #-- Adding test for fflush1 diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index f15424d..e019d0f 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -1419,7 +1419,7 @@ SUBROUTINE t_enum(total_error) ! Insert enumerated value for memtype. ! val(1) = i - CALL H5Tenum_insert_f(memtype, TRIM(names(i+1)), val(1), error) + CALL H5Tenum_insert_f(memtype, TRIM(names(i+1)), C_LOC(val(1)), error) CALL check("H5Tenum_insert_f", error, total_error) ! ! Insert enumerated value for filetype. We must first convert @@ -1428,7 +1428,11 @@ SUBROUTINE t_enum(total_error) f_ptr = C_LOC(val(1)) CALL H5Tconvert_f(M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, error) CALL check("H5Tconvert_f",error, total_error) - CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), val(1), error) + IF(i.GE.1)THEN ! test both F90 and F03 APIs + CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, error) + ELSE + CALL H5Tenum_insert_f(filetype, TRIM(names(i+1)), val(1), error) + ENDIF CALL check("H5Tenum_insert_f",error, total_error) ENDDO ! @@ -3134,7 +3138,7 @@ SUBROUTINE t_enum_conv(total_error) ENUMERATOR :: E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK END ENUM - INTEGER :: val + INTEGER(KIND(E1_RED)), TARGET :: val ! Enumerated data array ! Some values are out of range for testing. The library should accept them @@ -3185,19 +3189,19 @@ SUBROUTINE t_enum_conv(total_error) ! Initialize enum data. ! val = E1_RED - CALL H5Tenum_insert_f(dtype, "RED", val, error) + CALL H5Tenum_insert_f(dtype, "RED", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_GREEN - CALL H5Tenum_insert_f(dtype, "GREEN", val, error) + CALL H5Tenum_insert_f(dtype, "GREEN", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_BLUE - CALL H5Tenum_insert_f(dtype, "BLUE", val, error) + CALL H5Tenum_insert_f(dtype, "BLUE", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_WHITE - CALL H5Tenum_insert_f(dtype, "WHITE", val, error) + CALL H5Tenum_insert_f(dtype, "WHITE", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) val = E1_BLACK - CALL H5Tenum_insert_f(dtype, "BLACK", val, error) + CALL H5Tenum_insert_f(dtype, "BLACK", C_LOC(val), error) CALL check("h5tenum_insert_f",error, total_error) ! ! Create dataspace. Setting maximum size to be the current size. diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 063e93d..6d5911f 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -36,7 +36,7 @@ MODULE TH5_MISC CONTAINS !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: dreal_eq !DEC$endif LOGICAL FUNCTION dreal_eq(a,b) @@ -49,7 +49,7 @@ CONTAINS END FUNCTION dreal_eq !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: verify_real_kind_7 !DEC$endif SUBROUTINE verify_real_kind_7(string,value,correct_value,total_error) @@ -66,7 +66,7 @@ CONTAINS END SUBROUTINE verify_real_kind_7 !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: write_test_status !DEC$endif SUBROUTINE write_test_status( test_result, test_title, total_error) @@ -105,7 +105,7 @@ CONTAINS !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: check !DEC$endif SUBROUTINE check(string,error,total_error) @@ -119,7 +119,7 @@ CONTAINS END SUBROUTINE check !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: verify !DEC$endif SUBROUTINE VERIFY(string,value,correct_value,total_error) @@ -133,7 +133,7 @@ CONTAINS END SUBROUTINE verify !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: verify_Fortran_INTEGER_4 !DEC$endif SUBROUTINE verify_Fortran_INTEGER_4(string,value,correct_value,total_error) @@ -150,7 +150,7 @@ CONTAINS END SUBROUTINE verify_Fortran_INTEGER_4 !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: verifyLogical !DEC$endif SUBROUTINE verifyLogical(string,value,correct_value,total_error) @@ -165,7 +165,7 @@ CONTAINS END SUBROUTINE verifyLogical !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: verifyString !DEC$endif SUBROUTINE verifyString(string, value,correct_value,total_error) @@ -203,7 +203,7 @@ CONTAINS SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr) ! !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_fixname_f !DEC$endif USE H5GLOBAL @@ -263,7 +263,7 @@ CONTAINS SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr) ! !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_cleanup_f !DEC$endif USE H5GLOBAL @@ -315,7 +315,7 @@ CONTAINS SUBROUTINE h5_exit_f(status) ! !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_exit_f !DEC$endif IMPLICIT NONE @@ -352,7 +352,7 @@ CONTAINS SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP) ! !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_env_nocleanup_f !DEC$endif IMPLICIT NONE diff --git a/fortran/test/tf_F03.f90 b/fortran/test/tf_F03.f90 index 4513783..b3f1399 100644 --- a/fortran/test/tf_F03.f90 +++ b/fortran/test/tf_F03.f90 @@ -66,7 +66,7 @@ MODULE TH5_MISC_PROVISIONAL CONTAINS !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_cmpd !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CMPD(a) @@ -78,7 +78,7 @@ CONTAINS END FUNCTION H5_SIZEOF_CMPD !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_chr !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a) @@ -90,7 +90,7 @@ CONTAINS END FUNCTION H5_SIZEOF_CHR !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_i !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a) @@ -102,7 +102,7 @@ CONTAINS END FUNCTION H5_SIZEOF_I !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_sp !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_SP(a) @@ -114,7 +114,7 @@ CONTAINS END FUNCTION H5_SIZEOF_SP !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_dp !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_DP(a) diff --git a/fortran/test/tf_F08.f90 b/fortran/test/tf_F08.f90 index 5583f3f..20c2859 100644 --- a/fortran/test/tf_F08.f90 +++ b/fortran/test/tf_F08.f90 @@ -65,7 +65,7 @@ MODULE TH5_MISC_PROVISIONAL CONTAINS !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_cmpd !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CMPD(a) @@ -77,7 +77,7 @@ CONTAINS END FUNCTION H5_SIZEOF_CMPD !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_chr !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a) @@ -89,7 +89,7 @@ CONTAINS END FUNCTION H5_SIZEOF_CHR !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_i !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a) @@ -102,7 +102,7 @@ CONTAINS !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_sp !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_SP(a) @@ -114,7 +114,7 @@ CONTAINS END FUNCTION H5_SIZEOF_SP !This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) +!DEC$if defined(BUILD_HDF5_TEST_DLL) !DEC$attributes dllexport :: h5_sizeof_dp !DEC$endif INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_DP(a) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 3361220..dfe9ce7 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran) #----------------------------------------------------------------------------- |