diff --git a/configure.ac b/configure.ac index 44ab43a4664..b8ff31457c3 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ ## ---------------------------------------------------------------------- ## Initialize configure. ## -AC_PREREQ([2.71]) +AC_PREREQ([2.69]) ## AC_INIT takes the name of the package, the version number, and an ## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 53156731946..fd1c3973d7f 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -967,6 +967,7 @@ END SUBROUTINE h5get_free_list_sizes_f !! INTEGER(HID_T) FUNCTION h5kind_to_type(ikind, flag) RESULT(h5_type) USE ISO_C_BINDING + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : integer_kinds, real_kinds IMPLICIT NONE INTEGER, INTENT(IN) :: ikind INTEGER, INTENT(IN) :: flag @@ -980,7 +981,10 @@ INTEGER(HID_T) FUNCTION h5kind_to_type(ikind, flag) RESULT(h5_type) h5_type = -1 IF(flag.EQ.H5_INTEGER_KIND)THEN - do_kind: DO i = 1, H5_FORTRAN_NUM_INTEGER_KINDS + do_kind: DO i = 1, SIZE(integer_kinds) + PRINT*,integer_kinds + PRINT*,real_kinds + PRINT*, Fortran_INTEGER_AVAIL_KINDS(i), integer_kinds(i) IF(ikind.EQ.Fortran_INTEGER_AVAIL_KINDS(i))THEN h5_type = H5T_NATIVE_INTEGER_KIND(i) EXIT do_kind diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 40d21e97cc0..72fdaf5e14a 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -131,14 +131,18 @@ writeTypedefDefault(const char *c_typedef, int size) void writeToFiles(const char *c_typedef, const char *fortran_type, const char *c_type, int kind) { + if(fortran_type != NULL) fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind); + if(c_typedef != NULL) fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, kind, c_type); } void writeToFilesChr(const char *c_typedef, const char *fortran_type, const char *c_type, int size, const char *kind) { + if(fortran_type != NULL) fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind); + if(c_typedef != NULL) fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type); } int @@ -334,7 +338,7 @@ main(void) /* int_1, int_2, int_4, int_8 */ /* Defined different KINDs of integers */ - +#if 1 fprintf(fort_header, " INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", FORTRAN_NUM_INTEGER_KINDS); @@ -347,7 +351,7 @@ main(void) fprintf(fort_header, ","); } } - +#endif /* real_4, real_8, real_16 */ /* Defined different KINDs of reals: */ @@ -376,23 +380,23 @@ main(void) /* real_f */ #if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0 if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(long double)) { - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE"); } else #endif if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(double)) { - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE"); } else if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(float)) - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT"); else { /* No exact match, choose the next highest */ if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(long double)) - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE"); else if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(double)) - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE"); else if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(float)) - writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT"); + writeToFilesChr("float", NULL, "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT"); else { /* Error: couldn't find a size for real_f */ printf("Error: couldn't find a size for real_f \n"); @@ -403,25 +407,25 @@ main(void) /* double_f */ #if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0 if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(long double)) { - writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, + writeToFilesChr("float", NULL, "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_LONG_DOUBLE"); } else #endif if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(double)) { - writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_DOUBLE"); + writeToFilesChr("float", NULL, "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_DOUBLE"); } else if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(float)) - writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT"); + writeToFilesChr("float", NULL, "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT"); #ifdef H5_HAVE_FLOAT128 /* Don't select a higher precision than Fortran can support */ else if (sizeof(__float128) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) { - writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, + writeToFilesChr("float", NULL, "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128"); } #else else if (sizeof(long double) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) { - writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, + writeToFilesChr("float", NULL, "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128"); } #endif diff --git a/fortran/test/tH5A.F90 b/fortran/test/tH5A.F90 index 23b1addd3ce..809753b13e9 100644 --- a/fortran/test/tH5A.F90 +++ b/fortran/test/tH5A.F90 @@ -41,6 +41,8 @@ SUBROUTINE attribute_test(cleanup, total_error) LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(INOUT) :: total_error + INTEGER, PARAMETER :: Fortran_DOUBLE = KIND(1.D0) + CHARACTER(LEN=5), PARAMETER :: filename = "atest" !File name CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=9), PARAMETER :: dsetname = "atestdset" !Dataset name @@ -58,8 +60,6 @@ SUBROUTINE attribute_test(cleanup, total_error) INTEGER, PARAMETER :: NX = 4 INTEGER, PARAMETER :: NY = 5 - - INTEGER(HID_T) :: file_id ! File identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dataspace ! Dataspace identifier for dataset diff --git a/fortran/test/tH5T.F90 b/fortran/test/tH5T.F90 index a38cbeadf53..5056cbdb70a 100644 --- a/fortran/test/tH5T.F90 +++ b/fortran/test/tH5T.F90 @@ -53,6 +53,8 @@ SUBROUTINE compoundtest(cleanup, total_error) LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error + INTEGER, PARAMETER :: Fortran_DOUBLE = KIND(1.D0) + CHARACTER(LEN=8), PARAMETER :: filename = "compound" ! File name CHARACTER(LEN=80) :: fix_filename CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound" ! Dataset name diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 68a8f1b590c..dcc98f29e20 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -82,27 +82,17 @@ END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE !---- START ----- Determine the available KINDs for REALs and INTEGERs PROGRAM FC_AVAIL_KINDS - USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT, integer_kinds, real_kinds IMPLICIT NONE - INTEGER :: ik, jk, k, kk, max_decimal_prec - INTEGER :: prev_rkind, num_rkinds = 1, num_ikinds = 1 - INTEGER, DIMENSION(1:10) :: list_ikinds = -1 - INTEGER, DIMENSION(1:10) :: list_rkinds = -1 - LOGICAL :: new_kind + INTEGER :: ik, jk, k, max_decimal_prec + INTEGER :: num_rkinds, num_ikinds ! Find integer KINDs - list_ikinds(num_ikinds)=SELECTED_INT_KIND(1) - DO ik = 2, 36 - k = SELECTED_INT_KIND(ik) - IF(k.LT.0) EXIT - IF(k.GT.list_ikinds(num_ikinds))THEN - num_ikinds = num_ikinds + 1 - list_ikinds(num_ikinds) = k - ENDIF - ENDDO + + num_ikinds = SIZE(integer_kinds) DO k = 1, num_ikinds - WRITE(stdout,'(I0)', ADVANCE='NO') list_ikinds(k) + WRITE(stdout,'(I0)', ADVANCE='NO') integer_kinds(k) IF(k.NE.num_ikinds)THEN WRITE(stdout,'(A)',ADVANCE='NO') ',' ELSE @@ -111,35 +101,21 @@ PROGRAM FC_AVAIL_KINDS ENDDO ! Find real KINDs - list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1) + + num_rkinds = SIZE(real_kinds) + max_decimal_prec = 1 - prev_rkind=list_rkinds(num_rkinds) prec: DO ik = 2, 36 exp: DO jk = 1, 700 k = SELECTED_REAL_KIND(ik,jk) IF(k.LT.0) EXIT exp - IF(k.NE.prev_rkind)THEN - ! Check if we already have that kind - new_kind = .TRUE. - DO kk = 1, num_rkinds - IF(k.EQ.list_rkinds(kk))THEN - new_kind=.FALSE. - EXIT - ENDIF - ENDDO - IF(new_kind)THEN - num_rkinds = num_rkinds + 1 - list_rkinds(num_rkinds) = k - prev_rkind=list_rkinds(num_rkinds) - ENDIF - ENDIF max_decimal_prec = ik ENDDO exp ENDDO prec DO k = 1, num_rkinds - WRITE(stdout,'(I0)', ADVANCE='NO') list_rkinds(k) + WRITE(stdout,'(I0)', ADVANCE='NO') real_kinds(k) IF(k.NE.num_rkinds)THEN WRITE(stdout,'(A)',ADVANCE='NO') ',' ELSE