summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5_f.c10
-rw-r--r--fortran/src/H5_ff.F902
-rw-r--r--fortran/src/H5config_f.inc.in3
-rw-r--r--fortran/src/H5fort_type_defines.h.in3
-rw-r--r--fortran/src/H5match_types.c30
-rw-r--r--fortran/src/Makefile.in1
6 files changed, 31 insertions, 18 deletions
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 241af79..cca36fb 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -221,21 +221,27 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes
/*
* FIND H5T_NATIVE_REAL_C_LONG_DOUBLE
*/
+#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE
if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(float)) {
if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
} /*end if */
else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(double)) {
if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
} /*end if */
-#if FORTRAN_HAVE_C_LONG_DOUBLE!=0
+# if FORTRAN_HAVE_C_LONG_DOUBLE!=0
else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) {
if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
} /*end else */
-#else
+# else
else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) {
if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
if ( H5Tset_precision (types[12], 128) < 0) return ret_value;
} /*end else */
+# endif
+
+#else
+ if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
+ if ( H5Tset_precision (types[12], 64) < 0) return ret_value;
#endif
/*
* FIND H5T_NATIVE_B_8
diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90
index 7939644..3ef6331 100644
--- a/fortran/src/H5_ff.F90
+++ b/fortran/src/H5_ff.F90
@@ -389,8 +389,10 @@ CONTAINS
h5_type = H5T_NATIVE_REAL_C_FLOAT
ELSE IF(kind.EQ.Fortran_REAL_C_DOUBLE)THEN
h5_type = H5T_NATIVE_REAL_C_DOUBLE
+#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0
ELSE IF(kind.EQ.Fortran_REAL_C_LONG_DOUBLE)THEN
h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE
+#endif
#if H5_PAC_FC_MAX_REAL_PRECISION > 28
#ifdef H5_HAVE_FLOAT128
ELSE IF(kind.EQ.Fortran_REAL_C_FLOAT128)THEN
diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in
index dbbf43b..d6909ed 100644
--- a/fortran/src/H5config_f.inc.in
+++ b/fortran/src/H5config_f.inc.in
@@ -18,6 +18,9 @@
! Define if the intrinsic function C_LONG_DOUBLE exists
#undef FORTRAN_HAVE_C_LONG_DOUBLE
+! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE
+#undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE
+
! Define if the intrinsic module ISO_FORTRAN_ENV exists
#undef HAVE_ISO_FORTRAN_ENV
diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in
index 279deb9..5511742 100644
--- a/fortran/src/H5fort_type_defines.h.in
+++ b/fortran/src/H5fort_type_defines.h.in
@@ -13,4 +13,5 @@
#define H5_FORTRAN_REAL_KINDS_SIZEOF @PAC_FC_ALL_REAL_KINDS_SIZEOF@
#define H5_PAC_FC_MAX_REAL_PRECISION @PAC_FC_MAX_REAL_PRECISION@
#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@
-#define H5_HAVE_Fortran_INTRINSIC_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@
+#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@
+#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index c22f423..27d314e 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -211,16 +211,16 @@ int main(void)
if (sizeof(float) == RealKinds_SizeOf[i]) {
writeTypedef("float", "float", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT");
- } else if(sizeof(double) == RealKinds_SizeOf[i]) {
+ strcpy(Real_C_TYPES[i], "C_FLOAT"); }
+ else if(sizeof(double) == RealKinds_SizeOf[i]) {
writeTypedef("float", "double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_DOUBLE");
-/* may not have long double in fortran need check */
- } else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) {
+ strcpy(Real_C_TYPES[i], "C_DOUBLE"); }
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
+ else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) {
writeTypedef("float", "long double", RealKinds[i]);
strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE");
- found_long_double = 1;
- }
+ found_long_double = 1; }
+#endif
#ifdef H5_HAVE_FLOAT128
/* Don't select a higher precision than Fortran can support */
else if(sizeof(__float128) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
@@ -240,15 +240,15 @@ int main(void)
/* } else if(sizeof(long double) > RealKinds_SizeOf[H5_FORTRAN_NUM_REAL_KINDS-2]) { */
/* writeTypedef("float", "long double", RealKinds[i]); */
/* strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); } */
- else {
- printf(" **** HDF5 WARNING ****\n");
- printf("Fortran REAL is %d bytes, but no corresponding C floating type exists\n",RealKinds_SizeOf[i]);
- printf("Fortran Interface will create a custom datatype to store Fortran Real\n",RealKinds_SizeOf[i]);
+ else {
+ printf(" **** HDF5 WARNING ****\n");
+ printf("Fortran REAL is %d bytes, but no corresponding C floating type exists\n",RealKinds_SizeOf[i]);
+ printf("Fortran Interface will create a custom datatype to store Fortran Real\n",RealKinds_SizeOf[i]);
- writeTypedef("float", "long double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); }
- }
-/* } */
+/* writeTypedef("float", "long double", RealKinds[i]); */
+/* strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); } */
+ }
+ }
/* Now begin defining fortran types. */
fprintf(c_header, "\n");
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index 0abfb53..5c9de7c 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -503,6 +503,7 @@ FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FC_VERSION = @FC_VERSION@
FGREP = @FGREP@
+FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@
FSEARCH_DIRS = @FSEARCH_DIRS@
GREP = @GREP@