diff options
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 3 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 21 | ||||
-rw-r--r-- | fortran/src/H5fort_type_defines.h.in | 1 | ||||
-rw-r--r-- | fortran/src/H5match_types.c | 38 | ||||
-rw-r--r-- | m4/aclocal_fc.m4 | 5 |
6 files changed, 41 insertions, 28 deletions
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 41efadc..2658ccf 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -159,9 +159,12 @@ set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") list(GET PROG_OUTPUT 3 NUM_IKIND) list(GET PROG_OUTPUT 4 NUM_RKIND) +set(PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}" + set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") +message (STATUS "....NUMBER OF INTEGER KINDS FOUND ${PAC_FORTRAN_NUM_INTEGER_KINDS}") message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") diff --git a/configure.ac b/configure.ac index 59d1bef..afbd474 100644 --- a/configure.ac +++ b/configure.ac @@ -551,6 +551,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([PAC_FC_ALL_REAL_KINDS]) AC_SUBST([PAC_FC_MAX_REAL_PRECISION]) + AC_SUBST([PAC_FORTRAN_NUM_INTEGER_KINDS]) AC_SUBST([PAC_FC_ALL_INTEGER_KINDS]) AC_SUBST([PAC_FC_ALL_REAL_KINDS_SIZEOF]) AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF]) diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index db05f67..f9fe927 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -34,16 +34,16 @@ int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; * Initialize predefined datatypes in Fortran * INPUTS * types - array with the predefined Native Fortran - * type, its element and length must be the - * same as the types array defined in the + * type, its element and length must be the + * same as the types array defined in the * H5f90global.F90 * floatingtypes - array with the predefined Floating Fortran - * type, its element and length must be the - * same as the floatingtypes array defined in the - * H5f90global.F90 + * type, its element and length must be the + * same as the floatingtypes array defined in the + * H5f90global.F90 * integertypes - array with the predefined Integer Fortran - * type, its element and length must be the - * same as the integertypes array defined in the + * type, its element and length must be the + * same as the integertypes array defined in the * H5f90global.F90 * RETURNS * 0 on success, -1 on failure @@ -68,8 +68,13 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes /* * Find the HDF5 type of the Fortran Integer KIND. */ + + /* Initialized INTEGER KIND types to default to native integer */ for(i=0;i<5;i++) { + if ((types[i] = (hid_t_f)H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + } + for(i=0;i<H5_FORTRAN_NUM_INTEGER_KINDS;i++) { if ( IntKinds_SizeOf[i] == sizeof(char)) { if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value; } /*end if */ @@ -83,7 +88,7 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value; } /*end if */ else { - if ((types[i] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ((types[i] = (hid_t_f)H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; if ( H5Tset_precision (types[i], 128) < 0) return ret_value; } /*end else */ diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in index 0e14e86..6feed4f 100644 --- a/fortran/src/H5fort_type_defines.h.in +++ b/fortran/src/H5fort_type_defines.h.in @@ -7,6 +7,7 @@ #define H5_FORTRAN_NATIVE_REAL_SIZEOF @PAC_FORTRAN_NATIVE_REAL_SIZEOF@ #define H5_FORTRAN_NATIVE_DOUBLE_KIND @PAC_FORTRAN_NATIVE_DOUBLE_KIND@ #define H5_FORTRAN_NATIVE_DOUBLE_SIZEOF @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@ +#define H5_FORTRAN_NUM_INTEGER_KINDS @PAC_FORTRAN_NUM_INTEGER_KINDS@ #define H5_FORTRAN_INTEGER_KINDS @PAC_FC_ALL_INTEGER_KINDS@ #define H5_FORTRAN_INTEGER_KINDS_SIZEOF @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ #define H5_FORTRAN_REAL_KINDS @PAC_FC_ALL_REAL_KINDS@ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 7340b13..4d62402 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -157,7 +157,7 @@ int main(void) int RealKinds_SizeOf[] = H5_FORTRAN_REAL_KINDS_SIZEOF; char Real_C_TYPES[10][32]; - int H5_FORTRAN_NUM_INTEGER_KINDS; + int FORTRAN_NUM_INTEGER_KINDS=H5_FORTRAN_NUM_INTEGER_KINDS; int H5_FORTRAN_NUM_REAL_KINDS; int found_long_double = 0; @@ -171,13 +171,13 @@ int main(void) /* (a) define c_int_x */ - H5_FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds)/sizeof(IntKinds[0])); + FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds)/sizeof(IntKinds[0])); H5_FORTRAN_NUM_REAL_KINDS = (int)(sizeof(RealKinds)/sizeof(RealKinds[0])); - fprintf(fort_header," INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n", H5_FORTRAN_NUM_INTEGER_KINDS); + fprintf(fort_header," INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n", FORTRAN_NUM_INTEGER_KINDS); - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(sizeof(long long) == IntKinds_SizeOf[i]) writeTypedef("int", "long long", IntKinds[i]); else if(sizeof(long) == IntKinds[i]) @@ -258,56 +258,56 @@ int main(void) fprintf(c_header, "\n"); /* haddr_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HADDR_T) { writeToFiles("int","HADDR_T", "haddr_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for haddr_t */ return -1; } /* hsize_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSIZE_T) { writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for hsize_t */ return -1; } /* hssize_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HSSIZE_T) { writeToFiles("int","HSSIZE_T", "hssize_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for hssize_t */ return -1; } /* off_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) { writeToFiles("int","OFF_T", "off_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for off_t */ return -1; } /* size_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) { writeToFiles("size_t","SIZE_T", "size_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for size_t */ return -1; } @@ -319,11 +319,11 @@ int main(void) /* Defined different KINDs of integers */ - fprintf(fort_header," INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", H5_FORTRAN_NUM_INTEGER_KINDS); + fprintf(fort_header," INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", FORTRAN_NUM_INTEGER_KINDS); - for(i=0;i<H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i<FORTRAN_NUM_INTEGER_KINDS;i++) { fprintf(fort_header,"%d",(int)IntKinds[i]); - if(i==H5_FORTRAN_NUM_INTEGER_KINDS-1) { + if(i==FORTRAN_NUM_INTEGER_KINDS-1) { fprintf(fort_header,"/)\n"); } else { fprintf(fort_header,","); @@ -347,12 +347,12 @@ int main(void) } /* hid_t */ - for(i=0;i< H5_FORTRAN_NUM_INTEGER_KINDS;i++) { + for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) { if(IntKinds_SizeOf[i] == H5_SIZEOF_HID_T) { writeToFiles("int","HID_T", "hid_t_f", IntKinds[i], IntKinds[i]); break; } - if(i == (H5_FORTRAN_NUM_INTEGER_KINDS-1) ) + if(i == (FORTRAN_NUM_INTEGER_KINDS-1) ) /* Error: couldn't find a size for hid_t */ return -1; } diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index 763ab77..2213a7c 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -280,7 +280,8 @@ AC_RUN_IFELSE([$TEST_SRC], PAC_FC_ALL_INTEGER_KINDS="{`echo $pac_validIntKinds`}" PAC_FC_ALL_REAL_KINDS="{`echo $pac_validRealKinds`}" - H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `sed -n '4p' pac_fconftest.out`" + PAC_FORTRAN_NUM_INTEGER_KINDS="`sed -n '4p' pac_fconftest.out`" + H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $PAC_FORTRAN_NUM_INTEGER_KINDS`" H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds`/)" H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `sed -n '5p' pac_fconftest.out`" H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $pac_validRealKinds`/)" @@ -290,6 +291,8 @@ AC_RUN_IFELSE([$TEST_SRC], AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs]) AC_DEFINE_UNQUOTED([H5CONFIG_F_IKIND], $H5CONFIG_F_IKIND, [Define valid Fortran INTEGER KINDs]) + AC_MSG_CHECKING([for Number of Fortran INTEGER KINDs]) + AC_MSG_RESULT([$PAC_FORTRAN_NUM_INTEGER_KINDS]) AC_MSG_CHECKING([for Fortran INTEGER KINDs]) AC_MSG_RESULT([$PAC_FC_ALL_INTEGER_KINDS]) AC_MSG_CHECKING([for Fortran REAL KINDs]) |