From 442f9854645775a2bc7b20efe2170fb5a15ea29b Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 18 Jul 2014 17:17:58 -0500 Subject: [svn-r25433] Brought changes from the trunk into the branch. For the top level, brings in changes for configure.ac, configure and the MANIFEST: svn merge -c25286 https://svn.hdfgroup.uiuc.edu/hdf5/trunk . svn merge -c25287 https://svn.hdfgroup.uiuc.edu/hdf5/trunk . svn merge -c25290 https://svn.hdfgroup.uiuc.edu/hdf5/trunk . For the fortran level: 384 17:00 svn merge -r25235:25272 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/fortran 389 17:01 svn merge -r25284:25432 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/fortran For the fortran merges, I skipped changes relating to hyperslab selection since the C source has not been merged from the trunk yet. These changes should be in place in the fortran source when the C source is merged to the 1.8 branch. --- MANIFEST | 4 + configure | 97 ++++++++++++- configure.ac | 31 +++++ fortran/src/CMakeLists.txt | 28 ++-- fortran/src/H5test_kind.f90 | 24 ++-- fortran/src/H5test_kind_SIZEOF.f90 | 24 ++-- fortran/src/H5test_kind_STORAGE_SIZE.f90 | 230 +++++++++++++++++++++++++++++++ fortran/src/Makefile.am | 4 + fortran/src/Makefile.in | 15 +- fortran/test/CMakeLists.txt | 13 +- fortran/test/Makefile.am | 18 ++- fortran/test/Makefile.in | 46 ++++++- fortran/test/tH5MISC_1_8.f90 | 2 +- fortran/test/tH5P_F03.f90 | 34 +++-- fortran/test/tH5T_F03.f90 | 13 +- fortran/test/tf.f90 | 4 +- fortran/test/tf_F03.f90 | 128 +++++++++++++++++ fortran/test/tf_F08.f90 | 128 +++++++++++++++++ fortran/test/tf_F90.f90 | 33 +++++ 19 files changed, 800 insertions(+), 76 deletions(-) create mode 100644 fortran/src/H5test_kind_STORAGE_SIZE.f90 create mode 100644 fortran/test/tf_F03.f90 create mode 100644 fortran/test/tf_F08.f90 create mode 100644 fortran/test/tf_F90.f90 diff --git a/MANIFEST b/MANIFEST index b160d5c..464cc95 100644 --- a/MANIFEST +++ b/MANIFEST @@ -248,6 +248,7 @@ ./fortran/src/H5f90proto.h ./fortran/src/H5test_kind.f90 ./fortran/src/H5test_kind_SIZEOF.f90 +./fortran/src/H5test_kind_STORAGE_SIZE.f90 ./fortran/src/H5match_types.c ./fortran/src/HDF5.f90 ./fortran/src/HDF5mpio.f90 @@ -268,6 +269,9 @@ ./fortran/test/t.c ./fortran/test/t.h ./fortran/test/tf.f90 +./fortran/test/tf_F90.f90 +./fortran/test/tf_F03.f90 +./fortran/test/tf_F08.f90 ./fortran/test/tH5A.f90 ./fortran/test/tH5A_1_8.f90 ./fortran/test/tH5D.f90 diff --git a/configure b/configure index 688ef96..109d1e9 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Id: configure.ac 25396 2014-07-07 00:22:09Z hdftest . +# From configure.ac Id: configure.ac 25402 2014-07-10 14:36:34Z chaarawi . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for HDF5 1.8.14-snap9. # @@ -738,6 +738,10 @@ FORTRAN_DEFAULT_REALisDBLE_F_FALSE FORTRAN_DEFAULT_REALisDBLE_F_TRUE FORTRAN_2003_CONDITIONAL_F_FALSE FORTRAN_2003_CONDITIONAL_F_TRUE +FORTRAN_HAVE_STORAGE_SIZE_FALSE +FORTRAN_HAVE_STORAGE_SIZE_TRUE +FORTRAN_HAVE_C_SIZEOF_FALSE +FORTRAN_HAVE_C_SIZEOF_TRUE FORTRAN_HAVE_SIZEOF_FALSE FORTRAN_HAVE_SIZEOF_TRUE FCLIBS @@ -5357,6 +5361,8 @@ else fi HAVE_SIZEOF="no" +HAVE_C_SIZEOF="no" +HAVE_STORAGE_SIZE="no" FORTRAN_DEFAULT_REALisDBLE="no" if test "X$HDF_FORTRAN" = "Xyes"; then @@ -6696,6 +6702,71 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi + ## See if the fortran compiler supports the intrinsic function "C_SIZEOF" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran compiler supports intrinsic C_SIZEOF" >&5 +$as_echo_n "checking if Fortran compiler supports intrinsic C_SIZEOF... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat > conftest.$ac_ext <<_ACEOF + + PROGRAM main + USE ISO_C_BINDING + INTEGER(C_INT) :: a + INTEGER(C_SIZE_T) :: result + result = C_SIZEOF(a) + END PROGRAM + +_ACEOF +if ac_fn_fc_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_C_SIZEOF="yes" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + + ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran compiler supports intrinsic STORAGE_SIZE" >&5 +$as_echo_n "checking if Fortran compiler supports intrinsic STORAGE_SIZE... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat > conftest.$ac_ext <<_ACEOF + + PROGRAM main + INTEGER :: a + INTEGER :: result + result = STORAGE_SIZE(a) + END PROGRAM + +_ACEOF +if ac_fn_fc_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_STORAGE_SIZE="yes" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ## Check to see if -r8 was specified to determine if we need to ## compile the DOUBLE PRECISION interfaces. @@ -6806,6 +6877,22 @@ else FORTRAN_HAVE_SIZEOF_FALSE= fi + if test "X$HAVE_C_SIZEOF" = "Xyes"; then + FORTRAN_HAVE_C_SIZEOF_TRUE= + FORTRAN_HAVE_C_SIZEOF_FALSE='#' +else + FORTRAN_HAVE_C_SIZEOF_TRUE='#' + FORTRAN_HAVE_C_SIZEOF_FALSE= +fi + + if test "X$HAVE_STORAGE_SIZE" = "Xyes"; then + FORTRAN_HAVE_STORAGE_SIZE_TRUE= + FORTRAN_HAVE_STORAGE_SIZE_FALSE='#' +else + FORTRAN_HAVE_STORAGE_SIZE_TRUE='#' + FORTRAN_HAVE_STORAGE_SIZE_FALSE= +fi + if test "X$HAVE_FORTRAN_2003" = "Xyes"; then FORTRAN_2003_CONDITIONAL_F_TRUE= FORTRAN_2003_CONDITIONAL_F_FALSE='#' @@ -33335,6 +33422,14 @@ if test -z "${FORTRAN_HAVE_SIZEOF_TRUE}" && test -z "${FORTRAN_HAVE_SIZEOF_FALSE as_fn_error $? "conditional \"FORTRAN_HAVE_SIZEOF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${FORTRAN_HAVE_C_SIZEOF_TRUE}" && test -z "${FORTRAN_HAVE_C_SIZEOF_FALSE}"; then + as_fn_error $? "conditional \"FORTRAN_HAVE_C_SIZEOF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FORTRAN_HAVE_STORAGE_SIZE_TRUE}" && test -z "${FORTRAN_HAVE_STORAGE_SIZE_FALSE}"; then + as_fn_error $? "conditional \"FORTRAN_HAVE_STORAGE_SIZE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${FORTRAN_2003_CONDITIONAL_F_TRUE}" && test -z "${FORTRAN_2003_CONDITIONAL_F_FALSE}"; then as_fn_error $? "conditional \"FORTRAN_2003_CONDITIONAL_F\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 6fc6a3c..f230546 100644 --- a/configure.ac +++ b/configure.ac @@ -403,6 +403,8 @@ else fi HAVE_SIZEOF="no" +HAVE_C_SIZEOF="no" +HAVE_STORAGE_SIZE="no" FORTRAN_DEFAULT_REALisDBLE="no" if test "X$HDF_FORTRAN" = "Xyes"; then @@ -483,6 +485,33 @@ if test "X$HDF_FORTRAN" = "Xyes"; then HAVE_SIZEOF="yes"], [AC_MSG_RESULT([no])]) + ## See if the fortran compiler supports the intrinsic function "C_SIZEOF" + + AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_SIZEOF]) + AC_TRY_RUN([ + PROGRAM main + USE ISO_C_BINDING + INTEGER(C_INT) :: a + INTEGER(C_SIZE_T) :: result + result = C_SIZEOF(a) + END PROGRAM + ], [AC_MSG_RESULT([yes]) + HAVE_C_SIZEOF="yes"], + [AC_MSG_RESULT([no])]) + + ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" + + AC_MSG_CHECKING([if Fortran compiler supports intrinsic STORAGE_SIZE]) + AC_TRY_RUN([ + PROGRAM main + INTEGER :: a + INTEGER :: result + result = STORAGE_SIZE(a) + END PROGRAM + ], [AC_MSG_RESULT([yes]) + HAVE_STORAGE_SIZE="yes"], + [AC_MSG_RESULT([no])]) + ## Check to see if -r8 was specified to determine if we need to ## compile the DOUBLE PRECISION interfaces. @@ -552,6 +581,8 @@ fi AC_LANG_POP(Fortran) AM_CONDITIONAL([FORTRAN_HAVE_SIZEOF], [test "X$HAVE_SIZEOF" = "Xyes"]) +AM_CONDITIONAL([FORTRAN_HAVE_C_SIZEOF], [test "X$HAVE_C_SIZEOF" = "Xyes"]) +AM_CONDITIONAL([FORTRAN_HAVE_STORAGE_SIZE], [test "X$HAVE_STORAGE_SIZE" = "Xyes"]) AM_CONDITIONAL([FORTRAN_2003_CONDITIONAL_F], [test "X$HAVE_FORTRAN_2003" = "Xyes"]) AM_CONDITIONAL([FORTRAN_DEFAULT_REALisDBLE_F], [test "X$FORTRAN_DEFAULT_REALisDBLE" = "Xyes"]) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 723e930..66f6634 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -19,19 +19,28 @@ endif (WIN32) #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities -# H5test_kind(_SIZEOF).f90 used to generate H5fortran_detect.f90 +# H5test_kind(_SIZEOF,_STORAGE_SIZE).f90 used to generate H5fortran_detect.f90 # H5fortran_detect.f90 used to generate H5fort_type_defines.h # H5fort_type_defines.h used to generate H5f90i_gen.h + H5fortran_types.f90 #----------------------------------------------------------------------------- -if (FORTRAN_HAVE_SIZEOF) +if (FORTRAN_HAVE_STORAGE_SIZE) add_executable (H5test_FortranHavekind - ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind_SIZEOF.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind_STORAGE_SIZE.f90 ) -else (FORTRAN_HAVE_SIZEOF) - add_executable (H5test_FortranHavekind - ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind.f90 - ) -endif (FORTRAN_HAVE_SIZEOF) + set (H5_TEST_KIND_NAME "h5test_kind_storage_size_mod") +else (FORTRAN_HAVE_STORAGE_SIZE) + if (FORTRAN_HAVE_SIZEOF) + add_executable (H5test_FortranHavekind + ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind_SIZEOF.f90 + ) + set (H5_TEST_KIND_NAME "h5test_kind_sizeof_mod") + else (FORTRAN_HAVE_SIZEOF) + add_executable (H5test_FortranHavekind + ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind.f90 + ) + set (H5_TEST_KIND_NAME "h5test_kind_mod") + endif (FORTRAN_HAVE_SIZEOF) +endif (FORTRAN_HAVE_STORAGE_SIZE) if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5test_FortranHavekind @@ -270,7 +279,7 @@ if (WIN32) install ( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5fortran_types.mod - ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5test_kind_sizeof_mod.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/${H5_TEST_KIND_NAME}.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/hdf5.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5global.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5a.mod @@ -307,6 +316,7 @@ else (WIN32) install ( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/h5fortran_types.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/${H5_TEST_KIND_NAME}.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/hdf5.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/h5global.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/h5f.mod diff --git a/fortran/src/H5test_kind.f90 b/fortran/src/H5test_kind.f90 index 3182853..1a1a0ec 100644 --- a/fortran/src/H5test_kind.f90 +++ b/fortran/src/H5test_kind.f90 @@ -23,18 +23,18 @@ ! ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! AUTHOR diff --git a/fortran/src/H5test_kind_SIZEOF.f90 b/fortran/src/H5test_kind_SIZEOF.f90 index 7a58b0e..468086a 100644 --- a/fortran/src/H5test_kind_SIZEOF.f90 +++ b/fortran/src/H5test_kind_SIZEOF.f90 @@ -24,18 +24,18 @@ ! ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! AUTHOR diff --git a/fortran/src/H5test_kind_STORAGE_SIZE.f90 b/fortran/src/H5test_kind_STORAGE_SIZE.f90 new file mode 100644 index 0000000..89c904c --- /dev/null +++ b/fortran/src/H5test_kind_STORAGE_SIZE.f90 @@ -0,0 +1,230 @@ +!****p* Program/H5test_kind_STORAGE_SIZE +! +! NAME +! Executable: H5test_kind +! +! FILE +! fortran/src/H5test_kind_STORAGE_SIZE.f90 +! +! PURPOSE +! This stand alone program is used at build time to generate the program +! H5fortran_detect.f90. It cycles through all the available KIND parameters for +! integers and reals. The appropriate program and subroutines are then generated +! depending on which of the KIND values are found. +! +! NOTES +! This program is used in place of H5test_kind.f90 or H5test_kind_SIZEOF.f90 when +! the Fortran 2008 intrinsic function STORAGE_SIZE is available. It generates code +! that makes use of STORAGE_SIZE in H5fortran_detect.f90, which will be standard +! compliant. This program is the preferred method. +! +! The availability of STORAGE_SIZE is checked at configure time and the TRUE/FALSE +! condition is set in the configure variable "FORTRAN_HAVE_STORAGE_SIZE". +! +! The use of C_SIZOF(X) is not used since the argument X must be an interoperable +! data entity. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! AUTHOR +! M. Scot Breitenfeld +! +!***** + +PROGRAM test_kind + IMPLICIT NONE + INTEGER :: i, j, ii, ir, last, ikind_numbers(10), rkind_numbers(10) + INTEGER :: ji, jr, jd + last = -1 + ii = 0 + + ikind_numbers = 0 + rkind_numbers = 0 + + DO i = 1,100 + j = SELECTED_INT_KIND(i) + IF(j .NE. last) THEN + IF(last .NE. -1) THEN + ii = ii + 1 + ikind_numbers(ii) = last + ENDIF + last = j + IF(j .EQ. -1) EXIT + ENDIF + ENDDO + + last = -1 + ir = 0 + DO i = 1,100 + j = SELECTED_REAL_KIND(i) + IF(j .NE. last) THEN + IF(last .NE. -1) THEN + ir = ir + 1 + rkind_numbers(ir) = last + ENDIF + last = j + IF(j .EQ. -1) EXIT + ENDIF + ENDDO + +! Generate program information: + +WRITE(*,'(40(A,/))') & +'!****h* ROBODoc/H5fortran_detect.f90',& +'!',& +'! NAME',& +'! H5fortran_detect',& +'! ',& +'! PURPOSE',& +'! This stand alone program is used at build time to generate the header file',& +'! H5fort_type_defines.h. The source code itself was automatically generated by',& +'! the program H5test_kind_STORAGE_SIZE.f90',& +'!',& +'! NOTES',& +'! This source code makes use of the Fortran intrinsic function STORAGE_SIZE because',& +'! the availability of the intrinsic function was determined to be available at',& +'! configure time',& +'!',& +'! COPYRIGHT',& +'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',& +'! Copyright by The HDF Group. *',& +'! Copyright by the Board of Trustees of the University of Illinois. *',& +'! All rights reserved. *',& +'! *',& +'! This file is part of HDF5. The full HDF5 copyright notice, including *',& +'! terms governing use, modification, and redistribution, is contained in *',& +'! the files COPYING and Copyright.html. COPYING can be found at the root *',& +'! of the source code distribution tree; Copyright.html can be found at the *',& +'! root level of an installed copy of the electronic HDF5 document set and *',& +'! is linked from the top-level documents page. It can also be found at *',& +'! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *',& +'! access to either file, you may request a copy from help@hdfgroup.org. *',& +'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',& +'!',& +'! AUTHOR',& +'! H5test_kind_C_SIZEOF.f90',& +'!',& +'!*****' + +! GENERATE A PROGRAM +! +! (a) Generate the module + + WRITE(*,*) "MODULE H5test_kind_STORAGE_SIZE_mod" + WRITE(*,*) "USE ISO_C_BINDING" + WRITE(*,*) "IMPLICIT NONE" + WRITE(*,*) "CONTAINS" + j = 0 + ji = KIND(1) + WRITE(*, "("" SUBROUTINE i"", i2.2,""()"")") j + WRITE(*,*)" IMPLICIT NONE" + WRITE(*,*)" INTEGER :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" + WRITE(*,*)" WRITE(ichr2,'(I2)') a_size" + WRITE(*,'(A,I0)')" WRITE(jchr2,'(I2)') ",ji + WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_"'// & + "//TRIM(ADJUSTL(ichr2))//"//'"_KIND "'//"//ADJUSTL(jchr2)" + WRITE(*,*)" RETURN" + WRITE(*,*)"END SUBROUTINE" + jr = 0 + j = KIND(1.0) + WRITE(*, "("" SUBROUTINE r"", i2.2,""()"")") jr + WRITE(*,*)" IMPLICIT NONE" + WRITE(*,*)" REAL :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" + WRITE(*,*)" WRITE(ichr2,'(I2)') a_size" + WRITE(*,'(A,I0)')" WRITE(jchr2,'(I2)') ",j + WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_NATIVE_"'// & + "//TRIM(ADJUSTL(ichr2))//"//'"_KIND "'//"//ADJUSTL(jchr2)" + WRITE(*,*)" RETURN" + WRITE(*,*)"END SUBROUTINE" + jd = 0 + j = KIND(1.d0) + WRITE(*, "("" SUBROUTINE d"", i2.2,""()"")") jd + WRITE(*,*)" IMPLICIT NONE" + WRITE(*,*)" DOUBLE PRECISION :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" + WRITE(*,*)" WRITE(ichr2,'(I2)') a_size" + WRITE(*,'(A,I0)')" WRITE(jchr2,'(I2)') ",j + WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_DOUBLE_NATIVE_"'// & + "//TRIM(ADJUSTL(ichr2))//"//'"_KIND "'//"//ADJUSTL(jchr2)" + WRITE(*,*)" RETURN" + WRITE(*,*)"END SUBROUTINE" + DO i = 1, ii + j = ikind_numbers(i) + WRITE(*, "("" SUBROUTINE i"", i2.2,""()"")") j + WRITE(*,*)" IMPLICIT NONE" + WRITE(*,'(A,I0,A)')" INTEGER(KIND=",j,") :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" + WRITE(*,*)" WRITE(ichr2,'(I2)') a_size" + WRITE(*,'(A,I0)')" WRITE(jchr2,'(I2)') ",j + WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_"'// & + "//TRIM(ADJUSTL(ichr2))//"//'"_KIND "'//"//ADJUSTL(jchr2)" + WRITE(*,*)" RETURN" + WRITE(*,*)"END SUBROUTINE" + ENDDO + DO i = 1, ir + j = rkind_numbers(i) + WRITE(*, "("" SUBROUTINE r"", i2.2,""()"")") j + WRITE(*,*)" IMPLICIT NONE" + WRITE(*,'(A,I0,A)')" REAL(KIND= ",j,") :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" + WRITE(*,*)" WRITE(ichr2,'(I2)') a_size" + WRITE(*,'(A,I0)')" WRITE(jchr2,'(I2)') ", j + WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_"'// & + "//TRIM(ADJUSTL(ichr2))//"//'"_KIND "'//"//ADJUSTL(jchr2)" + WRITE(*,*)" RETURN" + WRITE(*,*)"END SUBROUTINE" + ENDDO + WRITE(*,*) "END MODULE H5test_kind_STORAGE_SIZE_mod" + WRITE(*,*) "" + + ! (b) generate the main program + + WRITE(*,*) "PROGRAM H5test_kind_STORAGE_SIZE" + WRITE(*,*) "USE H5test_kind_STORAGE_SIZE_mod" + WRITE(*,*) "WRITE(*,*) "" /*generating header file*/ """ + ji = 0 + WRITE(*, "("" CALL i"", i2.2,""()"")") ji + jr = 0 + WRITE(*, "("" CALL r"", i2.2,""()"")") jr + jd = 0 + WRITE(*, "("" CALL d"", i2.2,""()"")") jd + DO i = 1, ii + j = ikind_numbers(i) + WRITE(*, "("" CALL i"", i2.2,""()"")") j + ENDDO + DO i = 1, ir + j = rkind_numbers(i) + WRITE(*, "("" CALL r"", i2.2,""()"")") j + ENDDO + WRITE(*,*) "END PROGRAM H5test_kind_STORAGE_SIZE" + +END PROGRAM test_kind + + + diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index af0e6ee..a4b3843 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -176,11 +176,15 @@ H5fortran_detect.f90: H5test_kind$(EXEEXT) # H5test_kind.f90 is included in the distribution, and Automake knows # how to compile a fortran program given its sources. +if FORTRAN_HAVE_STORAGE_SIZE + H5test_kind_SOURCES = H5test_kind_STORAGE_SIZE.f90 +else if FORTRAN_HAVE_SIZEOF H5test_kind_SOURCES = H5test_kind_SIZEOF.f90 else H5test_kind_SOURCES = H5test_kind.f90 endif +endif # Mark this directory as part of the Fortran API FORTRAN_API=yes diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index a9114b0..d74793d 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -189,11 +189,11 @@ H5fortran_detect_LDADD = $(LDADD) H5match_types_SOURCES = H5match_types.c H5match_types_OBJECTS = H5match_types.$(OBJEXT) H5match_types_LDADD = $(LDADD) -am__H5test_kind_SOURCES_DIST = H5test_kind.f90 H5test_kind_SIZEOF.f90 -@FORTRAN_HAVE_SIZEOF_FALSE@am_H5test_kind_OBJECTS = \ -@FORTRAN_HAVE_SIZEOF_FALSE@ H5test_kind.$(OBJEXT) -@FORTRAN_HAVE_SIZEOF_TRUE@am_H5test_kind_OBJECTS = \ -@FORTRAN_HAVE_SIZEOF_TRUE@ H5test_kind_SIZEOF.$(OBJEXT) +am__H5test_kind_SOURCES_DIST = H5test_kind.f90 H5test_kind_SIZEOF.f90 \ + H5test_kind_STORAGE_SIZE.f90 +@FORTRAN_HAVE_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@am_H5test_kind_OBJECTS = H5test_kind.$(OBJEXT) +@FORTRAN_HAVE_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@am_H5test_kind_OBJECTS = H5test_kind_SIZEOF.$(OBJEXT) +@FORTRAN_HAVE_STORAGE_SIZE_TRUE@am_H5test_kind_OBJECTS = H5test_kind_STORAGE_SIZE.$(OBJEXT) H5test_kind_OBJECTS = $(am_H5test_kind_OBJECTS) H5test_kind_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) @@ -798,11 +798,12 @@ BUILT_SOURCES = H5f90i_gen.h # Automake knows how to build fortran programs if we tell it the source # files. H5fortran_detect_SOURCES = H5fortran_detect.f90 -@FORTRAN_HAVE_SIZEOF_FALSE@H5test_kind_SOURCES = H5test_kind.f90 +@FORTRAN_HAVE_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@H5test_kind_SOURCES = H5test_kind.f90 +@FORTRAN_HAVE_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@H5test_kind_SOURCES = H5test_kind_SIZEOF.f90 # H5test_kind.f90 is included in the distribution, and Automake knows # how to compile a fortran program given its sources. -@FORTRAN_HAVE_SIZEOF_TRUE@H5test_kind_SOURCES = H5test_kind_SIZEOF.f90 +@FORTRAN_HAVE_STORAGE_SIZE_TRUE@H5test_kind_SOURCES = H5test_kind_STORAGE_SIZE.f90 # Mark this directory as part of the Fortran API FORTRAN_API = yes diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 28b2ae1..d10f2ef 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -21,7 +21,18 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.f90) +# 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. + +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) + add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F03.f90 tf.f90) +else (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF) + add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F90.f90 tf.f90) +endif (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF) + + set (SHARED_LINK_FLAGS " ") if (WIN32) if (BUILD_SHARED_LIBS) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index c0b5395..735ab7a 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -53,7 +53,23 @@ endif check_PROGRAMS=$(TEST_PROG) -libh5test_fortran_la_SOURCES= tf.f90 t.c +if FORTRAN_HAVE_STORAGE_SIZE +if FORTRAN_HAVE_C_SIZEOF + libh5test_fortran_la_SOURCES = tf_F08.f90 +else + libh5test_fortran_la_SOURCES = tf_F03.f90 +endif +else +if FORTRAN_2003_CONDITIONAL_F + libh5test_fortran_la_SOURCES = tf_F03.f90 +else + libh5test_fortran_la_SOURCES = tf_F90.f90 +endif +endif + +# tf.f90 depends on either tf_F08.f90 or tf_F03.f90 so they need to be +# compiled first +libh5test_fortran_la_SOURCES += tf.f90 t.c # Source files are used for both the library and fortranlib_test. # Automake will complain about this without the following workaround. diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 1cf96a1..ca91cf5 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -101,7 +101,20 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libh5test_fortran_la_LIBADD = -am_libh5test_fortran_la_OBJECTS = tf.lo t.lo +am__libh5test_fortran_la_SOURCES_DIST = tf_F90.f90 tf.f90 t.c \ + tf_F03.f90 tf_F08.f90 +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@am_libh5test_fortran_la_OBJECTS = tf_F90.lo \ +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ tf.lo \ +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ t.lo +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@am_libh5test_fortran_la_OBJECTS = tf_F03.lo \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ tf.lo \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ t.lo +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@am_libh5test_fortran_la_OBJECTS = tf_F03.lo \ +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ tf.lo \ +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ t.lo +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@am_libh5test_fortran_la_OBJECTS = tf_F08.lo \ +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ tf.lo \ +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ t.lo libh5test_fortran_la_OBJECTS = $(am_libh5test_fortran_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -213,9 +226,9 @@ am__v_FCLD_1 = SOURCES = $(libh5test_fortran_la_SOURCES) $(fflush1_SOURCES) \ $(fflush2_SOURCES) $(fortranlib_test_SOURCES) \ $(fortranlib_test_1_8_SOURCES) $(fortranlib_test_F03_SOURCES) -DIST_SOURCES = $(libh5test_fortran_la_SOURCES) $(fflush1_SOURCES) \ - $(fflush2_SOURCES) $(fortranlib_test_SOURCES) \ - $(fortranlib_test_1_8_SOURCES) \ +DIST_SOURCES = $(am__libh5test_fortran_la_SOURCES_DIST) \ + $(fflush1_SOURCES) $(fflush2_SOURCES) \ + $(fortranlib_test_SOURCES) $(fortranlib_test_1_8_SOURCES) \ $(am__fortranlib_test_F03_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -738,7 +751,30 @@ noinst_LTLIBRARIES = libh5test_fortran.la # Our main targets, the tests themselves TEST_PROG = fortranlib_test fflush1 fflush2 fortranlib_test_1_8 \ $(am__append_2) -libh5test_fortran_la_SOURCES = tf.f90 t.c + +# tf.f90 depends on either tf_F08.f90 or tf_F03.f90 so they need to be +# compiled first +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@libh5test_fortran_la_SOURCES = tf_F90.f90 \ +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ tf.f90 \ +@FORTRAN_2003_CONDITIONAL_F_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ t.c + +# tf.f90 depends on either tf_F08.f90 or tf_F03.f90 so they need to be +# compiled first +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@libh5test_fortran_la_SOURCES = tf_F03.f90 \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ tf.f90 \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_FALSE@ t.c + +# tf.f90 depends on either tf_F08.f90 or tf_F03.f90 so they need to be +# compiled first +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@libh5test_fortran_la_SOURCES = tf_F03.f90 \ +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ tf.f90 \ +@FORTRAN_HAVE_C_SIZEOF_FALSE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ t.c + +# tf.f90 depends on either tf_F08.f90 or tf_F03.f90 so they need to be +# compiled first +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@libh5test_fortran_la_SOURCES = tf_F08.f90 \ +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ tf.f90 \ +@FORTRAN_HAVE_C_SIZEOF_TRUE@@FORTRAN_HAVE_STORAGE_SIZE_TRUE@ t.c # Source files are used for both the library and fortranlib_test. # Automake will complain about this without the following workaround. diff --git a/fortran/test/tH5MISC_1_8.f90 b/fortran/test/tH5MISC_1_8.f90 index bb7d50a..efc350e 100644 --- a/fortran/test/tH5MISC_1_8.f90 +++ b/fortran/test/tH5MISC_1_8.f90 @@ -257,7 +257,7 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) ! /* Verify the decoded dataspace */ CALL h5sget_simple_extent_npoints_f(decoded_sid1, n, error) CALL check("h5sget_simple_extent_npoints_f", error, total_error) - CALL VERIFY("h5sget_simple_extent_npoints_f", INT(n), SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, & + CALL VERIFY("h5sget_simple_extent_npoints_f", INT(n), INT(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3), & total_error) ! diff --git a/fortran/test/tH5P_F03.f90 b/fortran/test/tH5P_F03.f90 index 6039a52..91d9e3a 100644 --- a/fortran/test/tH5P_F03.f90 +++ b/fortran/test/tH5P_F03.f90 @@ -106,20 +106,12 @@ SUBROUTINE test_create(total_error) INTEGER(hsize_t), DIMENSION(1:5), PARAMETER :: ch_size= (/1, 1, 1, 4, 1/) CHARACTER(LEN=14) :: filename ='test_create.h5' - ! /* compound datatype operations */ - TYPE, BIND(C) :: comp_datatype - REAL :: a - INTEGER :: x - DOUBLE PRECISION :: y - CHARACTER(LEN=1) :: z - END TYPE comp_datatype - TYPE(comp_datatype), TARGET :: rd_c, fill_ctype INTEGER :: error INTEGER(SIZE_T) :: h5off TYPE(C_PTR) :: f_ptr LOGICAL :: differ1, differ2 - + !/* ! * Create a file. ! */ @@ -136,8 +128,7 @@ SUBROUTINE test_create(total_error) CALL check("h5pset_chunk_f",error, total_error) ! /* Create a compound datatype */ - - CALL h5tcreate_f(H5T_COMPOUND_F, INT(SIZEOF(fill_ctype),size_t), comp_type_id, error) + CALL h5tcreate_f(H5T_COMPOUND_F, H5_SIZEOF(fill_ctype), comp_type_id, error) CALL check("h5tcreate_f", error, total_error) h5off = H5OFFSETOF(C_LOC(fill_ctype), C_LOC(fill_ctype%a)) CALL h5tinsert_f(comp_type_id, "a", h5off , H5T_NATIVE_REAL, error) @@ -394,6 +385,8 @@ SUBROUTINE test_h5p_file_image(total_error) TYPE(C_PTR), DIMENSION(1:count) :: f_ptr1 TYPE(C_PTR), DIMENSION(1:1) :: f_ptr2 + INTEGER(HSIZE_T) :: sizeof_buffer + ! Initialize file image buffer DO i = 1, count buffer(i) = i*10 @@ -412,7 +405,8 @@ SUBROUTINE test_h5p_file_image(total_error) ! Set file image f_ptr = C_LOC(buffer(1)) - size = SIZEOF(buffer) + size = H5_SIZEOF(buffer(1))*count + CALL h5pset_file_image_f(fapl_1, f_ptr, size, error) CALL check("h5pset_file_image_f", error, total_error) @@ -465,8 +459,8 @@ SUBROUTINE external_test_offset(cleanup,total_error) INTEGER(hid_t) :: dset=-1 ! dataset INTEGER(hid_t) :: grp=-1 ! group to emit diagnostics INTEGER(size_t) :: i, j ! miscellaneous counters - CHARACTER(LEN=180) :: filename ! file names - INTEGER, DIMENSION(1:25) :: part ! raw data buffers + CHARACTER(LEN=180) :: filename ! file names + INTEGER, DIMENSION(1:25) :: part INTEGER, DIMENSION(1:100), TARGET :: whole ! raw data buffers INTEGER(hsize_t), DIMENSION(1:1) :: cur_size ! current data space size INTEGER(hid_t) :: hs_space ! hyperslab data space @@ -475,6 +469,7 @@ SUBROUTINE external_test_offset(cleanup,total_error) CHARACTER(LEN=1) :: ichr1 ! character conversion holder INTEGER :: error ! error status TYPE(C_PTR) :: f_ptr ! fortran pointer + INTEGER(HSIZE_T) :: sizeof_part CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:30) :: temparray @@ -503,15 +498,18 @@ SUBROUTINE external_test_offset(cleanup,total_error) CALL check("h5gcreate_f",error, total_error) ! Create the dataset + + sizeof_part = INT(H5_SIZEOF(part(1))*25, hsize_t) + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) CALL check("h5pcreate_f", error, total_error) - CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), INT(SIZEOF(part), hsize_t), error) + CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), sizeof_part, error) CALL check("h5pset_external_f",error,total_error) - CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), INT(SIZEOF(part), hsize_t), error) + CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), sizeof_part, error) CALL check("h5pset_external_f",error,total_error) - CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), INT(SIZEOF(part), hsize_t), error) + CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), sizeof_part, error) CALL check("h5pset_external_f",error,total_error) - CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), INT(SIZEOF(part), hsize_t), error) + CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), sizeof_part, error) CALL check("h5pset_external_f",error,total_error) cur_size(1) = 100 diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index fc3ebd0..f15424d 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -661,9 +661,6 @@ END SUBROUTINE test_array_compound_atomic USE ISO_C_BINDING IMPLICIT NONE - INTEGER, PARAMETER :: r_k4 = SELECTED_REAL_KIND(5) - INTEGER, PARAMETER :: r_k8 = SELECTED_REAL_KIND(10) - INTEGER, INTENT(INOUT) :: total_error INTEGER, PARAMETER :: LENGTH = 5 @@ -685,8 +682,8 @@ END SUBROUTINE test_array_compound_atomic TYPE CmpField_struct INTEGER, DIMENSION(1:ALEN) :: a - REAL(KIND=r_k4), DIMENSION(1:ALEN) :: b - REAL(KIND=r_k8), DIMENSION(1:ALEN) :: c + REAL(KIND=sp), DIMENSION(1:ALEN) :: b + REAL(KIND=dp), DIMENSION(1:ALEN) :: c ENDTYPE CmpField_struct TYPE(CmpField_struct), DIMENSION(1:LENGTH), TARGET :: cf @@ -702,7 +699,7 @@ END SUBROUTINE test_array_compound_atomic TYPE(CmpDTSinfo_struct) :: dtsinfo TYPE fld_t_struct - REAL(KIND=r_k4), DIMENSION(1:ALEN) :: b + REAL(KIND=sp), DIMENSION(1:ALEN) :: b END TYPE fld_t_struct INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype @@ -741,10 +738,10 @@ END SUBROUTINE test_array_compound_atomic ! ----------------------- CALL h5tget_size_f(H5T_NATIVE_INTEGER, type_sizei, error) CALL check("h5tget_size_f", error, total_error) - IF(sizeof(cf(1)%b(1)).EQ.4)THEN + IF(h5_sizeof(cf(1)%b(1)).EQ.4_size_t)THEN CALL h5tget_size_f(H5T_NATIVE_REAL_4, type_sizer, error) CALL check("h5tget_size_f", error, total_error) - ELSE IF(sizeof(cf(1)%b(1)).EQ.8)THEN + ELSE IF(h5_sizeof(cf(1)%b(1)).EQ.8_size_t)THEN CALL h5tget_size_f(H5T_NATIVE_REAL_8, type_sizer, error) CALL check("h5tget_size_f", error, total_error) ENDIF diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 2964840..063e93d 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -29,7 +29,9 @@ !***** MODULE TH5_MISC - INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(15, 307) + USE TH5_MISC_PROVISIONAL + + IMPLICIT NONE CONTAINS diff --git a/fortran/test/tf_F03.f90 b/fortran/test/tf_F03.f90 new file mode 100644 index 0000000..4513783 --- /dev/null +++ b/fortran/test/tf_F03.f90 @@ -0,0 +1,128 @@ +!****h* root/fortran/test/tf_F03.f90 +! +! NAME +! tf_F03.f90 +! +! FUNCTION +! Contains functions that are part of the F2003 standard, and are not F2008 compliant. +! Needed by the hdf5 fortran tests. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! CONTAINS SUBROUTINES +! H5_SIZEOF +! +! NOTES +! The Sun/Oracle compiler has the following restrictions on the SIZEOF intrinsic function: +! +! "The SIZEOF intrinsic cannot be applied to arrays of an assumed size, characters of a +! length that is passed, or subroutine calls or names. SIZEOF returns default INTEGER*4 data. +! If compiling for a 64-bit environment, the compiler will issue a warning if the result overflows +! the INTEGER*4 data range. To use SIZEOF in a 64-bit environment with arrays larger +! than the INTEGER*4 limit (2 Gbytes), the SIZEOF function and +! the variables receiving the result must be declared INTEGER*8." +! +! Thus, we can not overload the H5_SIZEOF function to handle arrays (as used in tH5P_F03.f90), or +! characters that do not have a set length (as used in tH5P_F03.f90), sigh... +! +!***** +MODULE TH5_MISC_PROVISIONAL + + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors + + ! generic compound datatype + TYPE, BIND(C) :: comp_datatype + REAL :: a + INTEGER :: x + DOUBLE PRECISION :: y + CHARACTER(LEN=1) :: z + END TYPE comp_datatype + + PUBLIC :: H5_SIZEOF + INTERFACE H5_SIZEOF + MODULE PROCEDURE H5_SIZEOF_CMPD + MODULE PROCEDURE H5_SIZEOF_I, H5_SIZEOF_CHR + MODULE PROCEDURE H5_SIZEOF_SP,H5_SIZEOF_DP + END INTERFACE + +CONTAINS + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_cmpd + !DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CMPD(a) + IMPLICIT NONE + TYPE(comp_datatype), INTENT(in) :: a + + H5_SIZEOF_CMPD = SIZEOF(a) + + END FUNCTION H5_SIZEOF_CMPD + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_chr +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a) + IMPLICIT NONE + CHARACTER(LEN=1), INTENT(in):: a + + H5_SIZEOF_CHR = SIZEOF(a) + + END FUNCTION H5_SIZEOF_CHR + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_i +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a) + IMPLICIT NONE + INTEGER, INTENT(in):: a + + H5_SIZEOF_I = SIZEOF(a) + + END FUNCTION H5_SIZEOF_I + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_sp +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_SP(a) + IMPLICIT NONE + REAL(sp), INTENT(in):: a + + H5_SIZEOF_SP = SIZEOF(a) + + END FUNCTION H5_SIZEOF_SP + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_dp +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_DP(a) + IMPLICIT NONE + REAL(dp), INTENT(in):: a + + H5_SIZEOF_DP = SIZEOF(a) + + END FUNCTION H5_SIZEOF_DP + +END MODULE TH5_MISC_PROVISIONAL diff --git a/fortran/test/tf_F08.f90 b/fortran/test/tf_F08.f90 new file mode 100644 index 0000000..5583f3f --- /dev/null +++ b/fortran/test/tf_F08.f90 @@ -0,0 +1,128 @@ +!****h* root/fortran/test/tf_F08.f90 +! +! NAME +! tf_F08.f90 +! +! FUNCTION +! Contains functions that are part of the F2008 standard and needed by +! the hdf5 fortran tests. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! CONTAINS SUBROUTINES +! H5_SIZEOF +! +! NOTES +! This file contains "sizeof" functions that are F2008 standard compliant +! and replace the non-standard 'SIZEOF' functions found in the file tf_F03. +! Unfortunity we need to wrap the C_SIZEOF/STORAGE_SIZE functions to handle different +! data types from the various tests. +! +! F08+TS29113 requires C interoperable variable as argument for C_SIZEOF. +! +! This file will be build instead of tf_F03.f90 if the intrinsic fortran +! function C_SIZEOF/STORAGE_SIZE is found during configure. +! +!***** +MODULE TH5_MISC_PROVISIONAL + + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors + + ! generic compound datatype + TYPE, BIND(C) :: comp_datatype + REAL :: a + INTEGER :: x + DOUBLE PRECISION :: y + CHARACTER(LEN=1) :: z + END TYPE comp_datatype + + PUBLIC :: H5_SIZEOF + INTERFACE H5_SIZEOF + MODULE PROCEDURE H5_SIZEOF_CMPD + MODULE PROCEDURE H5_SIZEOF_CHR + MODULE PROCEDURE H5_SIZEOF_I + MODULE PROCEDURE H5_SIZEOF_SP,H5_SIZEOF_DP + END INTERFACE + +CONTAINS + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_cmpd +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CMPD(a) + IMPLICIT NONE + TYPE(comp_datatype), INTENT(in) :: a + + H5_SIZEOF_CMPD = C_SIZEOF(a) + + END FUNCTION H5_SIZEOF_CMPD + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_chr +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(in) :: a + + H5_SIZEOF_CHR = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) + + END FUNCTION H5_SIZEOF_CHR + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_i +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a) + IMPLICIT NONE + INTEGER, INTENT(in):: a + + H5_SIZEOF_I = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) + + END FUNCTION H5_SIZEOF_I + + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_sp +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_SP(a) + IMPLICIT NONE + REAL(sp), INTENT(in):: a + + H5_SIZEOF_SP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) + + END FUNCTION H5_SIZEOF_SP + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_sizeof_dp +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_DP(a) + IMPLICIT NONE + REAL(dp), INTENT(in):: a + + H5_SIZEOF_DP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) + + END FUNCTION H5_SIZEOF_DP + +END MODULE TH5_MISC_PROVISIONAL diff --git a/fortran/test/tf_F90.f90 b/fortran/test/tf_F90.f90 new file mode 100644 index 0000000..11a047c --- /dev/null +++ b/fortran/test/tf_F90.f90 @@ -0,0 +1,33 @@ +!****h* root/fortran/test/tf_F90.f90 +! +! NAME +! tf_F90.f90 +! +! FUNCTION +! Module for when the compiler is not F2003 or F2008 compliant. +! Needed by tf.f90 for the test programs. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** +MODULE TH5_MISC_PROVISIONAL + IMPLICIT NONE + + INTEGER, PARAMETER :: sp = KIND(0.0) + INTEGER, PARAMETER :: dp = KIND(0.D0) + +END MODULE TH5_MISC_PROVISIONAL -- cgit v0.12