From 5fd5aa58ca66c387551f1d79f0d49bbb76067109 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 20 Apr 2015 14:15:30 -0500 Subject: [svn-r26847] combined H5test_kind programs --- MANIFEST | 7 +- configure | 59 +--- configure.ac | 18 +- fortran/src/CMakeLists.txt | 27 +- fortran/src/H5config_f.inc.in | 9 + fortran/src/H5test_kind.F90 | 255 +++++++-------- fortran/src/H5test_kind_SIZEOF.F90 | 228 -------------- fortran/src/H5test_kind_STORAGE_SIZE.F90 | 230 -------------- fortran/src/Makefile.am | 11 +- fortran/src/Makefile.in | 13 +- fortran/test/CMakeLists.txt | 14 +- fortran/test/Makefile.am | 18 +- fortran/test/Makefile.in | 83 ++--- fortran/test/tf.F90 | 520 +++++++++++++++++++++++++++++++ fortran/test/tf.f90 | 393 ----------------------- fortran/test/tf_F03.f90 | 128 -------- fortran/test/tf_F08.f90 | 128 -------- fortran/test/tf_F90.f90 | 33 -- src/H5config.h.in | 9 + 19 files changed, 734 insertions(+), 1449 deletions(-) delete mode 100644 fortran/src/H5test_kind_SIZEOF.F90 delete mode 100644 fortran/src/H5test_kind_STORAGE_SIZE.F90 create mode 100644 fortran/test/tf.F90 delete mode 100644 fortran/test/tf.f90 delete mode 100644 fortran/test/tf_F03.f90 delete mode 100644 fortran/test/tf_F08.f90 delete mode 100644 fortran/test/tf_F90.f90 diff --git a/MANIFEST b/MANIFEST index 1d03f6d..b495598 100644 --- a/MANIFEST +++ b/MANIFEST @@ -306,8 +306,6 @@ ./fortran/src/H5f90kit.c ./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/H5config_f.inc.in @@ -327,10 +325,7 @@ ./fortran/test/fortranlib_test_F03.f90 ./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/tf.F90 ./fortran/test/tH5A.f90 ./fortran/test/tH5A_1_8.f90 ./fortran/test/tH5D.f90 diff --git a/configure b/configure index 6de2d2f..a67a27b 100755 --- a/configure +++ b/configure @@ -726,12 +726,6 @@ 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 F9XMODEXT F9XMODFLAG @@ -6539,6 +6533,23 @@ rm -f core conftest.err conftest.$ac_objext \ + ## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error + if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xno" && test "X$HAVE_C_SIZEOF_FORTRAN" = "Xno"; then + as_fn_error $? "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE" "$LINENO" 5 + fi + + +$as_echo "#define FORTRAN_HAVE_STORAGE_SIZE 1" >>confdefs.h + + + +$as_echo "#define FORTRAN_HAVE_C_SIZEOF 1" >>confdefs.h + + + +$as_echo "#define FORTRAN_HAVE_SIZEOF 1" >>confdefs.h + + ## Check to see if -r8 was specified to determine if we need to ## compile the DOUBLE PRECISION interfaces. @@ -6635,30 +6646,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"; then - FORTRAN_HAVE_SIZEOF_TRUE= - FORTRAN_HAVE_SIZEOF_FALSE='#' -else - FORTRAN_HAVE_SIZEOF_TRUE='#' - FORTRAN_HAVE_SIZEOF_FALSE= -fi - - if test "X$HAVE_C_SIZEOF_FORTRAN" = "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_FORTRAN" = "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='#' @@ -30223,18 +30210,6 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${FORTRAN_HAVE_SIZEOF_TRUE}" && test -z "${FORTRAN_HAVE_SIZEOF_FALSE}"; then - 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 9555d37..77036d68 100644 --- a/configure.ac +++ b/configure.ac @@ -441,9 +441,20 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "C_SIZEOF" PAC_PROG_FC_C_SIZEOF - + ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" - PAC_PROG_FC_STORAGE_SIZE + PAC_PROG_FC_STORAGE_SIZE + + ## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error + if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xno" && test "X$HAVE_C_SIZEOF_FORTRAN" = "Xno"; then + AC_MSG_ERROR([Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE]) + fi + + AC_DEFINE([FORTRAN_HAVE_STORAGE_SIZE], [1], [Define if we have Fortran intrinsic STORAGE_SIZE]) + + AC_DEFINE([FORTRAN_HAVE_C_SIZEOF], [1], [Define if we have Fortran intrinsic C_SIZEOF]) + + AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF]) ## Check to see if -r8 was specified to determine if we need to ## compile the DOUBLE PRECISION interfaces. @@ -468,9 +479,6 @@ fi ## Change back to the C language AC_LANG_POP(Fortran) -AM_CONDITIONAL([FORTRAN_HAVE_SIZEOF], [test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"]) -AM_CONDITIONAL([FORTRAN_HAVE_C_SIZEOF], [test "X$HAVE_C_SIZEOF_FORTRAN" = "Xyes"]) -AM_CONDITIONAL([FORTRAN_HAVE_STORAGE_SIZE], [test "X$HAVE_STORAGE_SIZE_FORTRAN" = "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 f2f8ded..e38460d 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -21,27 +21,16 @@ endif (WIN32) #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities -# 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 +# H5test_kind.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_STORAGE_SIZE) - add_executable (H5test_FortranHavekind - ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind_STORAGE_SIZE.F90 + +add_executable (H5test_FortranHavekind + ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind.F90 ) - 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 - ) - endif (FORTRAN_HAVE_SIZEOF) -endif (FORTRAN_HAVE_STORAGE_SIZE) +set (H5_TEST_KIND_NAME "h5test_kind_mod") + if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5test_FortranHavekind diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index aec8b08..ceecd36 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -2,3 +2,12 @@ ! Define if we have parallel support #undef HAVE_PARALLEL + +! Define if the intrinsic function STORAGE_SIZE exists +#undef FORTRAN_HAVE_STORAGE_SIZE + +! Define if the intrinsic function SIZEOF exists +#undef FORTRAN_HAVE_SIZEOF + +! Define if the intrinsic function C_SIZEOF exists +#undef FORTRAN_HAVE_C_SIZEOF diff --git a/fortran/src/H5test_kind.F90 b/fortran/src/H5test_kind.F90 index 1a1a0ec..6cd75bc 100644 --- a/fortran/src/H5test_kind.F90 +++ b/fortran/src/H5test_kind.F90 @@ -13,13 +13,17 @@ ! depending on which of the KIND values are found. ! ! NOTES -! This program is depreciated in favor of H5test_kind_SIZEOF.f90 and is only -! used when the Fortran intrinsic function SIZEOF is not available. It generates -! code that does not make use of SIZEOF in H5fortran_detect.f90 which is less -! portable in comparison to using SIZEOF. +! This program uses the Fortran 2008 intrinsic function STORAGE_SIZE or SIZEOF +! depending on availablity.It generates code that makes use of +! STORAGE_SIZE/SIZEOF in H5fortran_detect.f90. STORAGE_SIZE is standard +! compliant and should always be chosen over SIZEOF. ! -! The availability of SIZEOF is checked at configure time and the TRUE/FALSE -! condition is set in the configure variable "FORTRAN_HAVE_SIZEOF". +! The availability of STORAGE_SIZE/SIZEOF is checked at configure time and the TRUE/FALSE +! condition is set in the configure variable "FORTRAN_HAVE_STORAGE_SIZE" or +! "FORTRAN_HAVE_SIZEOF". +! +! The use of C_SIZOF(X) is not used since the argument X must be an interoperable +! data entity. ! ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -38,17 +42,22 @@ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! AUTHOR -! Elena Pourma +! M. Scot Breitenfeld ! !***** +#include "H5config_f.inc" + 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 - j = SELECTED_INT_KIND(18) + + ikind_numbers = 0 + rkind_numbers = 0 + DO i = 1,100 j = SELECTED_INT_KIND(i) IF(j .NE. last) THEN @@ -88,11 +97,7 @@ WRITE(*,'(40(A,/))') & '! H5fort_type_defines.h. The source code itself was automatically generated by',& '! the program H5test_kind.f90',& '!',& -'! NOTES',& -'! This source code does not make use of the Fortran intrinsic function SIZEOF because',& -'! the availability of the intrinsic function was determined to be not available at',& -'! configure time',& -'!',& +'! COPYRIGHT',& '! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',& '! Copyright by The HDF Group. *',& '! Copyright by the Board of Trustees of the University of Illinois. *',& @@ -113,156 +118,130 @@ WRITE(*,'(40(A,/))') & '!',& '!*****' -! Generate a program +! GENERATE A PROGRAM +! +! (a) Generate the module - WRITE(*,*) "PROGRAM int_kind" - 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 int_kind" + WRITE(*,*) "MODULE H5test_kind_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 = 0" - WRITE(*,*)" INTEGER :: a_size" - WRITE(*,*)" CHARACTER(LEN=2) :: jchr2" - WRITE(*,*)" a_size = BIT_SIZE(a)" - WRITE(*,*)" IF (a_size .EQ. 8) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",ji - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_1_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" endif" - WRITE(*,*)" IF (a_size .EQ. 16) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",ji - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_2_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" endif" - WRITE(*,*)" IF (a_size .EQ. 32) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",ji - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_4_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 64) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",ji - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_8_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 128) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",ji - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_NATIVE_16_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" + WRITE(*,*)" INTEGER :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" +#else + WRITE(*,*)" a_size = SIZEOF(a)" +#endif + 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 = KIND(1.0) - WRITE(*, "("" SUBROUTINE r"", i2.2,""()"")") j + jr = 0 + j = KIND(1.0) + WRITE(*, "("" SUBROUTINE r"", i2.2,""()"")") jr WRITE(*,*)" IMPLICIT NONE" - WRITE(*,*)" REAL :: b(32)" - WRITE(*,*)" INTEGER :: a(1)" - WRITE(*,*)" INTEGER :: a_size" - WRITE(*,*)" INTEGER :: real_size" - WRITE(*,*)" CHARACTER(LEN=2) :: jchr2" - WRITE(*,*)" a_size = BIT_SIZE(a(1)) ! Size in bits for integer" - WRITE(*,*)" real_size = (SIZE(TRANSFER(b,a))*a_size)/SIZE(b)" - WRITE(*,*)" IF (real_size .EQ. 32) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",jr - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_NATIVE_4_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (real_size .EQ. 64) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",jr - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_NATIVE_8_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (real_size .EQ. 128) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",jr - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_NATIVE_16_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" + WRITE(*,*)" REAL :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" +#else + WRITE(*,*)" a_size = SIZEOF(a)" +#endif + 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 = KIND(1.d0) - WRITE(*, "("" SUBROUTINE d"", i2.2,""()"")") j + jd = 0 + j = KIND(1.d0) + WRITE(*, "("" SUBROUTINE d"", i2.2,""()"")") jd WRITE(*,*)" IMPLICIT NONE" - WRITE(*,*)" DOUBLE PRECISION :: b=0" - WRITE(*,*)" INTEGER :: a(8)=0" - WRITE(*,*)" INTEGER :: a_size" - WRITE(*,*)" INTEGER :: b_size" - WRITE(*,*)" CHARACTER(LEN=2) :: jchr2" - WRITE(*,*)" a_size = BIT_SIZE(a(1))" - WRITE(*,*)" b_size = SIZE(transfer(b,a))*a_size" - WRITE(*,*)" IF (b_size .EQ. 64) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",jd - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (b_size .EQ. 128) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",jd - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" + WRITE(*,*)" DOUBLE PRECISION :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" +#else + WRITE(*,*)" a_size = SIZEOF(a)" +#endif + 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(*,*)" INTEGER(",j,") :: a = 0" - WRITE(*,*)" INTEGER :: a_size" - WRITE(*,*)" CHARACTER(LEN=2) :: jchr2" - WRITE(*,*)" a_size = BIT_SIZE(a)" - WRITE(*,*)" IF (a_size .EQ. 8) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_1_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 16) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_2_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 32) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_4_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 64) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_8_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (a_size .EQ. 128) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_INTEGER_16_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" + WRITE(*,'(A,I0,A)')" INTEGER(KIND=",j,") :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" +#else + WRITE(*,*)" a_size = SIZEOF(a)" +#endif + 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" + WRITE(*,*)"END SUBROUTINE" ENDDO DO i = 1, ir j = rkind_numbers(i) WRITE(*, "("" SUBROUTINE r"", i2.2,""()"")") j WRITE(*,*)" IMPLICIT NONE" - WRITE(*,*)" REAL(KIND=",j,") :: b(32)" - WRITE(*,*)" INTEGER :: a(1)" - WRITE(*,*)" INTEGER :: a_size" - WRITE(*,*)" INTEGER :: real_size" - WRITE(*,*)" CHARACTER(LEN=2) :: jchr2" - WRITE(*,*)" a_size = BIT_SIZE(a(1)) ! Size in bits for integer" - WRITE(*,*)" real_size = (SIZE(TRANSFER(b,a))*a_size)/SIZE(b)" - WRITE(*,*)" IF (real_size .EQ. 32) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_4_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" - WRITE(*,*)" IF (real_size .EQ. 64) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,*)' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_8_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" endif" - WRITE(*,*)" IF (real_size .EQ. 128) THEN" - WRITE(*,*)" WRITE(jchr2,'(I2)')",j - WRITE(*,'(A)')' WRITE(*,*) "#define H5_FORTRAN_HAS_REAL_16_KIND "'//"//ADJUSTL(jchr2)" - WRITE(*,*)" ENDIF" + WRITE(*,'(A,I0,A)')" REAL(KIND= ",j,") :: a" + WRITE(*,*)" INTEGER(C_SIZE_T) :: a_size" + WRITE(*,*)" CHARACTER(LEN=2) :: ichr2, jchr2" +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + WRITE(*,*)" a_size = STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" +#else + WRITE(*,*)" a_size = SIZEOF(a)" +#endif + 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" + WRITE(*,*)"END SUBROUTINE" + ENDDO + WRITE(*,*) "END MODULE H5test_kind_mod" + WRITE(*,*) "" + + ! (b) generate the main program + + WRITE(*,*) "PROGRAM H5test_kind" + WRITE(*,*) "USE H5test_kind_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" + END PROGRAM test_kind diff --git a/fortran/src/H5test_kind_SIZEOF.F90 b/fortran/src/H5test_kind_SIZEOF.F90 deleted file mode 100644 index 468086a..0000000 --- a/fortran/src/H5test_kind_SIZEOF.F90 +++ /dev/null @@ -1,228 +0,0 @@ -!****p* Program/H5test_kind_SIZEOF -! -! NAME -! Executable: H5test_kind -! -! FILE -! fortran/src/H5test_kind_SIZEOF.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 when the Fortran intrinsic -! function SIZEOF is available. It generates code that makes use of SIZEOF in -! H5fortran_detect.f90 which is a portable solution but is not standard -! compliant. The program H5test_kind_C_SIZEOF uses F2008 standard intrinsic -! function instead, which is the preferred method. -! -! The availability of SIZEOF is checked at configure time and the TRUE/FALSE -! condition is set in the configure variable "FORTRAN_HAVE_SIZEOF". -! -! 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_SIZEOF.f90',& -'!',& -'! NOTES',& -'! This source code makes use of the Fortran intrinsic function SIZEOF 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_SIZEOF.f90',& -'!',& -'!*****' - -! GENERATE A PROGRAM -! -! (a) Generate the module - - WRITE(*,*) "MODULE H5test_kind_SIZEOF_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 = SIZEOF(a)" - 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 = SIZEOF(a)" - 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 = SIZEOF(a)" - 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 = SIZEOF(a)" - 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 = SIZEOF(a)" - 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_SIZEOF_mod" - WRITE(*,*) "" - - ! (b) generate the main program - - WRITE(*,*) "PROGRAM H5test_kind_SIZEOF" - WRITE(*,*) "USE H5test_kind_SIZEOF_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_SIZEOF" - -END PROGRAM test_kind - - - diff --git a/fortran/src/H5test_kind_STORAGE_SIZE.F90 b/fortran/src/H5test_kind_STORAGE_SIZE.F90 deleted file mode 100644 index 89c904c..0000000 --- a/fortran/src/H5test_kind_STORAGE_SIZE.F90 +++ /dev/null @@ -1,230 +0,0 @@ -!****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 0250117..13e250b 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -159,15 +159,7 @@ 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 +H5test_kind_SOURCES = H5test_kind.f90 # Mark this directory as part of the Fortran API FORTRAN_API=yes @@ -180,7 +172,6 @@ H5f90global.lo: $(srcdir)/H5f90global.F90 H5fortran_types.lo H5fortran_types.lo: H5fortran_types.F90 H5fortran_detect.lo: H5fortran_detect.F90 H5test_kind.lo: $(srcdir)/H5test_kind.F90 -H5test_kind_SIZEOF.lo: $(srcdir)/H5test_kind_SIZEOF.F90 H5_ff.lo: $(srcdir)/H5_ff.F90 H5f90global.lo H5Aff.lo: $(srcdir)/H5Aff.F90 H5f90global.lo H5Dff.lo: $(srcdir)/H5Dff.F90 H5f90global.lo diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index df5f5a6..ea924f9 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -172,11 +172,7 @@ 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 \ - 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) +am_H5test_kind_OBJECTS = H5test_kind.$(OBJEXT) H5test_kind_OBJECTS = $(am_H5test_kind_OBJECTS) H5test_kind_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) @@ -242,7 +238,7 @@ SOURCES = $(libhdf5_fortran_la_SOURCES) $(H5fortran_detect_SOURCES) \ H5match_types.c $(H5test_kind_SOURCES) DIST_SOURCES = $(libhdf5_fortran_la_SOURCES) \ $(H5fortran_detect_SOURCES) H5match_types.c \ - $(am__H5test_kind_SOURCES_DIST) + $(H5test_kind_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -772,12 +768,10 @@ 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@@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_STORAGE_SIZE_TRUE@H5test_kind_SOURCES = H5test_kind_STORAGE_SIZE.F90 +H5test_kind_SOURCES = H5test_kind.f90 # Mark this directory as part of the Fortran API FORTRAN_API = yes @@ -1426,7 +1420,6 @@ H5f90global.lo: $(srcdir)/H5f90global.F90 H5fortran_types.lo H5fortran_types.lo: H5fortran_types.F90 H5fortran_detect.lo: H5fortran_detect.F90 H5test_kind.lo: $(srcdir)/H5test_kind.F90 -H5test_kind_SIZEOF.lo: $(srcdir)/H5test_kind_SIZEOF.F90 H5_ff.lo: $(srcdir)/H5_ff.F90 H5f90global.lo H5Aff.lo: $(srcdir)/H5Aff.F90 H5f90global.lo H5Dff.lo: $(srcdir)/H5Dff.F90 H5f90global.lo diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 2893156..335de81 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -23,18 +23,8 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/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) - 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_source_files_properties (tf.F90 PROPERTIES LANGUAGE Fortran) +add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.F90) set (SHARED_LINK_FLAGS " ") if (WIN32) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 735ab7a..f8c9d02 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -53,23 +53,7 @@ endif check_PROGRAMS=$(TEST_PROG) -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 +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 a776c96..3259f0174 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -103,20 +103,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libh5test_fortran_la_LIBADD = -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 +am_libh5test_fortran_la_OBJECTS = tf.lo 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@) @@ -192,6 +179,24 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/fortran depcomp = $(SHELL) $(top_srcdir)/bin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f +PPFCCOMPILE = $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_FCFLAGS) $(FCFLAGS) +AM_V_PPFC = $(am__v_PPFC_@AM_V@) +am__v_PPFC_ = $(am__v_PPFC_@AM_DEFAULT_V@) +am__v_PPFC_0 = @echo " PPFC " $@; +am__v_PPFC_1 = +FCLD = $(FC) +FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_FCLD = $(am__v_FCLD_@AM_V@) +am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) +am__v_FCLD_0 = @echo " FCLD " $@; +am__v_FCLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -217,20 +222,12 @@ AM_V_FC = $(am__v_FC_@AM_V@) am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@) am__v_FC_0 = @echo " FC " $@; am__v_FC_1 = -FCLD = $(FC) -FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_FCLD = $(am__v_FCLD_@AM_V@) -am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) -am__v_FCLD_0 = @echo " FCLD " $@; -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 = $(am__libh5test_fortran_la_SOURCES_DIST) \ - $(fflush1_SOURCES) $(fflush2_SOURCES) \ - $(fortranlib_test_SOURCES) $(fortranlib_test_1_8_SOURCES) \ +DIST_SOURCES = $(libh5test_fortran_la_SOURCES) $(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 \ @@ -742,30 +739,7 @@ noinst_LTLIBRARIES = libh5test_fortran.la # Our main targets, the tests themselves TEST_PROG = fortranlib_test fflush1 fflush2 fortranlib_test_1_8 \ $(am__append_2) - -# 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 +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. @@ -813,7 +787,7 @@ TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) all: all-am .SUFFIXES: -.SUFFIXES: .c .f90 .lo .log .o .obj .sh .sh$(EXEEXT) .trs +.SUFFIXES: .F90 .c .f90 .lo .log .o .obj .sh .sh$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -897,6 +871,15 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t.Plo@am__quote@ +.F90.o: + $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ $< + +.F90.obj: + $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.F90.lo: + $(AM_V_PPFC)$(LTPPFCCOMPILE) -c -o $@ $< + .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 new file mode 100644 index 0000000..aabccd3 --- /dev/null +++ b/fortran/test/tf.F90 @@ -0,0 +1,520 @@ +!****h* root/fortran/test/tf.f90 +! +! NAME +! tf.f90 +! +! FUNCTION +! Contains subroutines which are needed in all 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 +! write_test_status, check, verify, verifyLogical, verifyString, h5_fixname_f, +! h5_cleanup_f, h5_exit_f, h5_env_nocleanup_f,dreal_eqv +! +!***** + +#include "H5config_f.inc" + +MODULE TH5_MISC + + 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_TEST_DLL) +!DEC$attributes dllexport :: dreal_eq +!DEC$endif + LOGICAL FUNCTION dreal_eq(a,b) + + ! Check if two double precision reals are equivalent + REAL(dp), INTENT (in):: a,b + REAL(dp), PARAMETER :: eps = 1.e-8 + dreal_eq = ABS(a-b) .LT. eps + + END FUNCTION dreal_eq + +!This definition is needed for Windows DLLs +!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) + USE HDF5 + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + CHARACTER(LEN=*) :: string + REAL(real_kind_7) :: value, correct_value + INTEGER :: total_error + IF (.NOT.dreal_eq( REAL(value,dp), REAL(correct_value, dp)) ) THEN + total_error=total_error+1 + WRITE(*,*) "ERROR: INCORRECT REAL VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verify_real_kind_7 + +!This definition is needed for Windows DLLs +!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) + + ! Writes the results of the tests + + IMPLICIT NONE + + INTEGER, INTENT(IN) :: test_result ! negative, --skip -- + ! 0 , passed + ! positive, failed + + CHARACTER(LEN=*), INTENT(IN) :: test_title ! Short description of test + INTEGER, INTENT(INOUT) :: total_error ! Accumulated error + +! Controls the output style for reporting test results + + CHARACTER(LEN=8) :: error_string + CHARACTER(LEN=8), PARAMETER :: success = ' PASSED ' + CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*' + CHARACTER(LEN=8), PARAMETER :: skip = '--SKIP--' + + + error_string = failure + IF (test_result == 0) THEN + error_string = success + ELSE IF (test_result == -1) THEN + error_string = skip + ENDIF + + WRITE(*, fmt = '(A, T72, A)') test_title, error_string + + IF(test_result.GT.0) total_error = total_error + test_result + + END SUBROUTINE write_test_status + + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: check +!DEC$endif + SUBROUTINE check(string,error,total_error) + CHARACTER(LEN=*) :: string + INTEGER :: error, total_error + IF (error .LT. 0) THEN + total_error=total_error+1 + WRITE(*,*) string, " FAILED" + ENDIF + RETURN + END SUBROUTINE check + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: verify +!DEC$endif + SUBROUTINE VERIFY(string,value,correct_value,total_error) + CHARACTER(LEN=*) :: string + INTEGER :: value, correct_value, total_error + IF (value .NE. correct_value) THEN + total_error=total_error+1 + WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verify + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: verify_INTEGER_HID_T +!DEC$endif + SUBROUTINE verify_INTEGER_HID_T(string,value,correct_value,total_error) + USE HDF5 + CHARACTER(LEN=*) :: string + INTEGER(HID_T) :: value, correct_value + INTEGER :: total_error + IF (value .NE. correct_value) THEN + total_error=total_error+1 + WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verify_INTEGER_HID_T + +!This definition is needed for Windows DLLs +!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) + USE HDF5 + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) ! should map to INTEGER*4 on most modern processors + CHARACTER(LEN=*) :: string + INTEGER(int_kind_8) :: value, correct_value + INTEGER :: total_error + IF (value .NE. correct_value) THEN + total_error=total_error+1 + WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verify_Fortran_INTEGER_4 + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: verifyLogical +!DEC$endif + SUBROUTINE verifyLogical(string,value,correct_value,total_error) + CHARACTER(LEN=*) :: string + LOGICAL :: value, correct_value + INTEGER :: total_error + IF (value .NEQV. correct_value) THEN + total_error = total_error + 1 + WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verifyLogical + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: verifyString +!DEC$endif + SUBROUTINE verifyString(string, value,correct_value,total_error) + CHARACTER*(*) :: string + CHARACTER*(*) :: value, correct_value + INTEGER :: total_error + IF (TRIM(value) .NE. TRIM(correct_value)) THEN + total_error = total_error + 1 + WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string + ENDIF + RETURN + END SUBROUTINE verifyString + + +!---------------------------------------------------------------------- +! Name: h5_fixname_f +! +! Purpose: Create a file name from the a file base name. +! It is a fortran counterpart for the h5_fixname in ../../test/h5test.c +! +! Inputs: +! base_name - base name of the file +! fapl - file access property list +! Outputs: +! full_name - full file name +! hdferr: - error code +! Success: 0 +! Failure: -1 +! +! Programmer: Elena Pourmal +! September 13, 2002 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5_fixname_f +!DEC$endif + USE H5GLOBAL + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name + CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list + + INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string + INTEGER(SIZE_T) :: full_namelen ! Length of the full name character string +! INTEGER(HID_T) :: fapl_default + + INTERFACE + INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, & + full_name, full_namelen) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_FIXNAME_C':: h5_fixname_c + !DEC$ ENDIF + !DEC$ATTRIBUTES reference :: base_name + !DEC$ATTRIBUTES reference :: full_name + CHARACTER(LEN=*), INTENT(IN) :: base_name + INTEGER(SIZE_T) :: base_namelen + INTEGER(HID_T), INTENT(IN) :: fapl + CHARACTER(LEN=*), INTENT(IN) :: full_name + INTEGER(SIZE_T) :: full_namelen + END FUNCTION h5_fixname_c + END INTERFACE + + base_namelen = LEN(base_name) + full_namelen = LEN(full_name) + hdferr = h5_fixname_c(base_name, base_namelen, fapl, & + full_name, full_namelen) + + END SUBROUTINE h5_fixname_f + +!---------------------------------------------------------------------- +! Name: h5_cleanup_f +! +! Purpose: Cleanups tests files +! It is a fortran counterpart for the h5_cleanup in ../../test/h5test.c +! +! Inputs: +! base_name - base name of the file +! fapl - file access property list +! Outputs: +! hdferr: - error code +! Success: 0 +! Failure: -1 +! +! Programmer: Elena Pourmal +! September 19, 2002 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5_cleanup_f +!DEC$endif + USE H5GLOBAL + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list + + INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string + + INTERFACE + INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_CLEANUP_C':: h5_cleanup_c + !DEC$ ENDIF + !DEC$ATTRIBUTES reference :: base_name + CHARACTER(LEN=*), INTENT(IN) :: base_name + INTEGER(SIZE_T) :: base_namelen + INTEGER(HID_T), INTENT(IN) :: fapl + END FUNCTION h5_cleanup_c + END INTERFACE + + base_namelen = LEN(base_name) + hdferr = h5_cleanup_c(base_name, base_namelen, fapl) + + END SUBROUTINE h5_cleanup_f + +!---------------------------------------------------------------------- +! Name: h5_exit_f +! +! Purpose: Exit application +! It is a fortran counterpart for the standard C 'exit()' routine +! Be careful not to overflow the exit value range since +! UNIX supports a very small range such as 1 byte. +! Therefore, exit(256) may end up as exit(0). +! +! Inputs: +! status - Status to return from application +! +! Outputs: +! none +! +! Programmer: Quincey Koziol +! December 14, 2004 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_exit_f(status) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5_exit_f +!DEC$endif + IMPLICIT NONE + INTEGER, INTENT(IN) :: status ! Return code + + INTERFACE + SUBROUTINE h5_exit_c(status) + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_EXIT_C':: h5_exit_c + !DEC$ ENDIF + INTEGER, INTENT(IN) :: status + END SUBROUTINE h5_exit_c + END INTERFACE + + CALL h5_exit_c(status) + + END SUBROUTINE h5_exit_f + +!---------------------------------------------------------------------- +! Name: h5_env_nocleanup_f +! +! Purpose: Uses the HDF5_NOCLEANUP environment variable in Fortran +! tests to determine if the output files should be removed +! +! Inputs: +! +! Outputs: HDF5_NOCLEANUP: .true. - don't remove test files +! .false. - remove test files +! +! Programmer: M.S. Breitenfeld +! September 30, 2008 +! +!---------------------------------------------------------------------- + SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5_env_nocleanup_f +!DEC$endif + IMPLICIT NONE + LOGICAL, INTENT(OUT) :: HDF5_NOCLEANUP ! Return code + INTEGER :: status + + INTERFACE + SUBROUTINE h5_env_nocleanup_c(status) + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_ENV_NOCLEANUP_C':: h5_env_nocleanup_c + !DEC$ ENDIF + INTEGER :: status + END SUBROUTINE h5_env_nocleanup_c + END INTERFACE + + CALL h5_env_nocleanup_c(status) + + HDF5_NOCLEANUP = .FALSE. + IF(status.EQ.1) HDF5_NOCLEANUP = .TRUE. + + END SUBROUTINE h5_env_nocleanup_f + +! --------------------------------------------------------------------------------------------------- +! H5_SIZEOF routines +! +! NOTES +! (1) 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... +! +! (2) F08+TS29113 requires C interoperable variable as argument for C_SIZEOF. +! +! (3) Unfortunately we need to wrap the C_SIZEOF/STORAGE_SIZE functions to handle different +! data types from the various tests. +! +! --------------------------------------------------------------------------------------------------- + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_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 + +#ifdef H5_FORTRAN_FORTRAN_HAVE_C_SIZEOF + H5_SIZEOF_CMPD = C_SIZEOF(a) +#else + H5_SIZEOF_CMPD = SIZEOF(a) +#endif + + END FUNCTION H5_SIZEOF_CMPD + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_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 + +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + H5_SIZEOF_CHR = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) +#else + H5_SIZEOF_CHR = SIZEOF(a) +#endif + + END FUNCTION H5_SIZEOF_CHR + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_DLL) +!DEC$attributes dllexport :: h5_sizeof_i +!DEC$endif + INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a) + IMPLICIT NONE + INTEGER, INTENT(in):: a + +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + H5_SIZEOF_I = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) +#else + H5_SIZEOF_I = SIZEOF(a) +#endif + + END FUNCTION H5_SIZEOF_I + + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_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 + +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + H5_SIZEOF_SP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) +#else + H5_SIZEOF_SP = SIZEOF(a) +#endif + + END FUNCTION H5_SIZEOF_SP + +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_TEST_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 + +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + H5_SIZEOF_DP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t) +#else + H5_SIZEOF_DP = SIZEOF(a) +#endif + + END FUNCTION H5_SIZEOF_DP + +END MODULE TH5_MISC diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 deleted file mode 100644 index 450daf2..0000000 --- a/fortran/test/tf.f90 +++ /dev/null @@ -1,393 +0,0 @@ -!****h* root/fortran/test/tf.f90 -! -! NAME -! tf.f90 -! -! FUNCTION -! Contains subroutines which are needed in all 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 -! write_test_status, check, verify, verifyLogical, verifyString, h5_fixname_f, -! h5_cleanup_f, h5_exit_f, h5_env_nocleanup_f,dreal_eqv -! -!***** -MODULE TH5_MISC - - USE TH5_MISC_PROVISIONAL - - IMPLICIT NONE - -CONTAINS - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: dreal_eq -!DEC$endif - LOGICAL FUNCTION dreal_eq(a,b) - - ! Check if two double precision reals are equivalent - REAL(dp), INTENT (in):: a,b - REAL(dp), PARAMETER :: eps = 1.e-8 - dreal_eq = ABS(a-b) .LT. eps - - END FUNCTION dreal_eq - -!This definition is needed for Windows DLLs -!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) - USE HDF5 - INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors - CHARACTER(LEN=*) :: string - REAL(real_kind_7) :: value, correct_value - INTEGER :: total_error - IF (.NOT.dreal_eq( REAL(value,dp), REAL(correct_value, dp)) ) THEN - total_error=total_error+1 - WRITE(*,*) "ERROR: INCORRECT REAL VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verify_real_kind_7 - -!This definition is needed for Windows DLLs -!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) - - ! Writes the results of the tests - - IMPLICIT NONE - - INTEGER, INTENT(IN) :: test_result ! negative, --skip -- - ! 0 , passed - ! positive, failed - - CHARACTER(LEN=*), INTENT(IN) :: test_title ! Short description of test - INTEGER, INTENT(INOUT) :: total_error ! Accumulated error - -! Controls the output style for reporting test results - - CHARACTER(LEN=8) :: error_string - CHARACTER(LEN=8), PARAMETER :: success = ' PASSED ' - CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*' - CHARACTER(LEN=8), PARAMETER :: skip = '--SKIP--' - - - error_string = failure - IF (test_result == 0) THEN - error_string = success - ELSE IF (test_result == -1) THEN - error_string = skip - ENDIF - - WRITE(*, fmt = '(A, T72, A)') test_title, error_string - - IF(test_result.GT.0) total_error = total_error + test_result - - END SUBROUTINE write_test_status - - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: check -!DEC$endif - SUBROUTINE check(string,error,total_error) - CHARACTER(LEN=*) :: string - INTEGER :: error, total_error - IF (error .LT. 0) THEN - total_error=total_error+1 - WRITE(*,*) string, " FAILED" - ENDIF - RETURN - END SUBROUTINE check - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: verify -!DEC$endif - SUBROUTINE VERIFY(string,value,correct_value,total_error) - CHARACTER(LEN=*) :: string - INTEGER :: value, correct_value, total_error - IF (value .NE. correct_value) THEN - total_error=total_error+1 - WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verify - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: verify_INTEGER_HID_T -!DEC$endif - SUBROUTINE verify_INTEGER_HID_T(string,value,correct_value,total_error) - USE HDF5 - CHARACTER(LEN=*) :: string - INTEGER(HID_T) :: value, correct_value - INTEGER :: total_error - IF (value .NE. correct_value) THEN - total_error=total_error+1 - WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verify_INTEGER_HID_T - -!This definition is needed for Windows DLLs -!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) - USE HDF5 - INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) ! should map to INTEGER*4 on most modern processors - CHARACTER(LEN=*) :: string - INTEGER(int_kind_8) :: value, correct_value - INTEGER :: total_error - IF (value .NE. correct_value) THEN - total_error=total_error+1 - WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verify_Fortran_INTEGER_4 - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: verifyLogical -!DEC$endif - SUBROUTINE verifyLogical(string,value,correct_value,total_error) - CHARACTER(LEN=*) :: string - LOGICAL :: value, correct_value - INTEGER :: total_error - IF (value .NEQV. correct_value) THEN - total_error = total_error + 1 - WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verifyLogical - -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: verifyString -!DEC$endif - SUBROUTINE verifyString(string, value,correct_value,total_error) - CHARACTER*(*) :: string - CHARACTER*(*) :: value, correct_value - INTEGER :: total_error - IF (TRIM(value) .NE. TRIM(correct_value)) THEN - total_error = total_error + 1 - WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string - ENDIF - RETURN - END SUBROUTINE verifyString - - -!---------------------------------------------------------------------- -! Name: h5_fixname_f -! -! Purpose: Create a file name from the a file base name. -! It is a fortran counterpart for the h5_fixname in ../../test/h5test.c -! -! Inputs: -! base_name - base name of the file -! fapl - file access property list -! Outputs: -! full_name - full file name -! hdferr: - error code -! Success: 0 -! Failure: -1 -! -! Programmer: Elena Pourmal -! September 13, 2002 -! -! -!---------------------------------------------------------------------- - SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr) -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: h5_fixname_f -!DEC$endif - USE H5GLOBAL - IMPLICIT NONE - CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name - CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name - INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list - - INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string - INTEGER(SIZE_T) :: full_namelen ! Length of the full name character string -! INTEGER(HID_T) :: fapl_default - - INTERFACE - INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, & - full_name, full_namelen) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_FIXNAME_C':: h5_fixname_c - !DEC$ ENDIF - !DEC$ATTRIBUTES reference :: base_name - !DEC$ATTRIBUTES reference :: full_name - CHARACTER(LEN=*), INTENT(IN) :: base_name - INTEGER(SIZE_T) :: base_namelen - INTEGER(HID_T), INTENT(IN) :: fapl - CHARACTER(LEN=*), INTENT(IN) :: full_name - INTEGER(SIZE_T) :: full_namelen - END FUNCTION h5_fixname_c - END INTERFACE - - base_namelen = LEN(base_name) - full_namelen = LEN(full_name) - hdferr = h5_fixname_c(base_name, base_namelen, fapl, & - full_name, full_namelen) - - END SUBROUTINE h5_fixname_f - -!---------------------------------------------------------------------- -! Name: h5_cleanup_f -! -! Purpose: Cleanups tests files -! It is a fortran counterpart for the h5_cleanup in ../../test/h5test.c -! -! Inputs: -! base_name - base name of the file -! fapl - file access property list -! Outputs: -! hdferr: - error code -! Success: 0 -! Failure: -1 -! -! Programmer: Elena Pourmal -! September 19, 2002 -! -! -!---------------------------------------------------------------------- - SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr) -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: h5_cleanup_f -!DEC$endif - USE H5GLOBAL - IMPLICIT NONE - CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name - INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list - - INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string - - INTERFACE - INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_CLEANUP_C':: h5_cleanup_c - !DEC$ ENDIF - !DEC$ATTRIBUTES reference :: base_name - CHARACTER(LEN=*), INTENT(IN) :: base_name - INTEGER(SIZE_T) :: base_namelen - INTEGER(HID_T), INTENT(IN) :: fapl - END FUNCTION h5_cleanup_c - END INTERFACE - - base_namelen = LEN(base_name) - hdferr = h5_cleanup_c(base_name, base_namelen, fapl) - - END SUBROUTINE h5_cleanup_f - -!---------------------------------------------------------------------- -! Name: h5_exit_f -! -! Purpose: Exit application -! It is a fortran counterpart for the standard C 'exit()' routine -! Be careful not to overflow the exit value range since -! UNIX supports a very small range such as 1 byte. -! Therefore, exit(256) may end up as exit(0). -! -! Inputs: -! status - Status to return from application -! -! Outputs: -! none -! -! Programmer: Quincey Koziol -! December 14, 2004 -! -! -!---------------------------------------------------------------------- - SUBROUTINE h5_exit_f(status) -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: h5_exit_f -!DEC$endif - IMPLICIT NONE - INTEGER, INTENT(IN) :: status ! Return code - - INTERFACE - SUBROUTINE h5_exit_c(status) - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_EXIT_C':: h5_exit_c - !DEC$ ENDIF - INTEGER, INTENT(IN) :: status - END SUBROUTINE h5_exit_c - END INTERFACE - - CALL h5_exit_c(status) - - END SUBROUTINE h5_exit_f - -!---------------------------------------------------------------------- -! Name: h5_env_nocleanup_f -! -! Purpose: Uses the HDF5_NOCLEANUP environment variable in Fortran -! tests to determine if the output files should be removed -! -! Inputs: -! -! Outputs: HDF5_NOCLEANUP: .true. - don't remove test files -! .false. - remove test files -! -! Programmer: M.S. Breitenfeld -! September 30, 2008 -! -!---------------------------------------------------------------------- - SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP) -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_TEST_DLL) -!DEC$attributes dllexport :: h5_env_nocleanup_f -!DEC$endif - IMPLICIT NONE - LOGICAL, INTENT(OUT) :: HDF5_NOCLEANUP ! Return code - INTEGER :: status - - INTERFACE - SUBROUTINE h5_env_nocleanup_c(status) - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_ENV_NOCLEANUP_C':: h5_env_nocleanup_c - !DEC$ ENDIF - INTEGER :: status - END SUBROUTINE h5_env_nocleanup_c - END INTERFACE - - CALL h5_env_nocleanup_c(status) - - HDF5_NOCLEANUP = .FALSE. - IF(status.EQ.1) HDF5_NOCLEANUP = .TRUE. - - END SUBROUTINE h5_env_nocleanup_f -END MODULE TH5_MISC diff --git a/fortran/test/tf_F03.f90 b/fortran/test/tf_F03.f90 deleted file mode 100644 index b3f1399..0000000 --- a/fortran/test/tf_F03.f90 +++ /dev/null @@ -1,128 +0,0 @@ -!****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_TEST_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_TEST_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_TEST_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_TEST_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_TEST_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 deleted file mode 100644 index 20c2859..0000000 --- a/fortran/test/tf_F08.f90 +++ /dev/null @@ -1,128 +0,0 @@ -!****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_TEST_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_TEST_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_TEST_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_TEST_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_TEST_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 deleted file mode 100644 index 11a047c..0000000 --- a/fortran/test/tf_F90.f90 +++ /dev/null @@ -1,33 +0,0 @@ -!****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 diff --git a/src/H5config.h.in b/src/H5config.h.in index c089cd3..1cfc395 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -30,6 +30,15 @@ /* As FC_FUNC, but for C identifiers containing underscores. */ #undef FC_FUNC_ +/* Define if we have Fortran intrinsic C_SIZEOF */ +#undef FORTRAN_HAVE_C_SIZEOF + +/* Define if we have Fortran intrinsic SIZEOF */ +#undef FORTRAN_HAVE_SIZEOF + +/* Define if we have Fortran intrinsic STORAGE_SIZE */ +#undef FORTRAN_HAVE_STORAGE_SIZE + /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM -- cgit v0.12