diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | fortran/src/H5match_types.c | 224 |
2 files changed, 7 insertions, 218 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index efd8a02..b149017 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -157,7 +157,6 @@ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES if (HDF5_ENABLE_F2003) # F2003 features are enabled set (F_STATUS "_F03") - set (H5_HAVE_FORTRAN_2003 1) else (HDF5_ENABLE_F2003) # F2003 features are not enabled set (F_STATUS "_F90") diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index a15ae3c..3fa0efc 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -52,9 +52,7 @@ void writeTypedef(const char* c_type, unsigned int size); void writeFloatTypedef(const char* c_type, unsigned int size); void writeTypedefDefault(unsigned int size); void writeToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind); -void writeToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind); void writeFloatToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind); -void writeFloatToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind); static void initCfile(void) @@ -102,16 +100,12 @@ initFfile(void) ! access to either file, you may request a copy from help@hdfgroup.org. *\n\ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ !\n!\n\ -! This file is automatically generated by H5match_types.c and \n\ -! contains HDF5 Fortran90 type definitions.\n!\n\ +! This file is automatically generated and contains HDF5 Fortran90 type definitions.\n!\n\ MODULE H5FORTRAN_TYPES\n\ !\n\ ! HDF5 integers\n\ !\n"); -#ifdef H5_HAVE_FORTRAN_2003 - fprintf(fort_header," USE ISO_C_BINDING\n"); -#endif } static void @@ -153,35 +147,20 @@ void writeToFiles(const char* fortran_type, const char* c_type, int size, unsign fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type); } -void writeToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind) -{ - fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind); - fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type); -} - /* Create matching Fortran and C floating types by writing to both files */ void writeFloatToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind) { fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind); - fprintf(c_header, "typedef c_float_%d %s;\n", size, c_type); -} -void writeFloatToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind) -{ - fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind); + fprintf(c_header, "typedef c_float_%d %s;\n", size, c_type); } int main(void) { int FoundIntSize[4]; -#ifdef H5_HAVE_FORTRAN_2003 - const char *FoundIntSizeKind_F03[4]; - const char *FoundRealSizeKind_F03[3]; -#else unsigned FoundIntSizeKind[4]; - unsigned FoundRealSizeKind[3]; -#endif int FoundRealSize[3]; + unsigned FoundRealSizeKind[3]; int i,j,flag; char chrA[20],chrB[20]; int H5_C_HAS_REAL_NATIVE_16; @@ -255,6 +234,7 @@ int main(void) #endif /*H5_FORTRAN_HAS_INTEGER_8_KIND*/ /* Define c_float_x */ + #if defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND || defined H5_FORTRAN_HAS_REAL_4_KIND if(sizeof(long double) == 4) writeFloatTypedef("long double", 4); @@ -300,20 +280,6 @@ int main(void) /* Now begin defining fortran types. */ fprintf(c_header, "\n"); /* haddr_t */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HADDR_T >= 8 - writeToFilesF03("HADDR_T", "haddr_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HADDR_T >= 4 - writeToFilesF03("HADDR_T", "haddr_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HADDR_T >= 2 - writeToFilesF03("HADDR_T", "haddr_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HADDR_T >= 1 - writeToFilesF03("HADDR_T", "haddr_t_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for haddr_t */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HADDR_T >= 8 writeToFiles("HADDR_T", "haddr_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); #elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HADDR_T >= 4 @@ -326,23 +292,8 @@ int main(void) /* Error: couldn't find a size for haddr_t */ return -1; #endif -#endif /* hsize_t */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSIZE_T >= 8 - writeToFilesF03("HSIZE_T", "hsize_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSIZE_T >= 4 - writeToFilesF03("HSIZE_T", "hsize_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HSIZE_T >= 2 - writeToFilesF03("HSIZE_T", "hsize_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HSIZE_T >= 1 - writeToFilesF03("HSIZE_T", "hsize_t_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for hsize_t */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSIZE_T >= 8 writeToFiles("HSIZE_T", "hsize_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); #elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSIZE_T >= 4 @@ -355,23 +306,8 @@ int main(void) /* Error: couldn't find a size for hsize_t */ return -1; #endif -#endif /* hssize_t */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSSIZE_T >= 8 - writeToFilesF03("HSSIZE_T", "hssize_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSSIZE_T >= 4 - writeToFilesF03("HSSIZE_T", "hssize_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HSSIZE_T >= 2 - writeToFilesF03("HSSIZE_T", "hssize_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HSSIZE_T >= 1 - writeToFilesF03("HSSIZE_T", "hssize_t_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for hssize_t */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSSIZE_T >= 8 writeToFiles("HSSIZE_T", "hssize_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); #elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSSIZE_T >= 4 @@ -384,23 +320,7 @@ int main(void) /* Error: couldn't find a size for hssize_t */ return -1; #endif -#endif -#ifdef H5_HAVE_FORTRAN_2003 - /* off_t */ -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8 - writeToFilesF03("OFF_T", "off_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_OFF_T >= 4 - writeToFilesF03("OFF_T", "off_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_OFF_T >= 2 - writeToFilesF03("OFF_T", "off_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_OFF_T >= 1 - writeToFilesF03("OFF_T", "off_t_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for off_t */ - return -1; -#endif -#else /* off_t */ #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8 writeToFiles("OFF_T", "off_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); @@ -414,23 +334,8 @@ int main(void) /* Error: couldn't find a size for off_t */ return -1; #endif -#endif - /* size_t */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8 - writeToFilesF03("SIZE_T", "size_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_SIZE_T >= 4 - writeToFilesF03("SIZE_T", "size_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_SIZE_T >= 2 - writeToFilesF03("SIZE_T", "size_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_SIZE_T >= 1 - writeToFilesF03("SIZE_T", "size_t_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for size_t */ - return -1; -#endif -#else + /* size_t */ #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8 writeToFiles("SIZE_T", "size_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); #elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_SIZE_T >= 4 @@ -443,23 +348,8 @@ int main(void) /* Error: couldn't find a size for size_t */ return -1; #endif -#endif /* int */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_NATIVE_8_KIND - writeToFilesF03("Fortran_INTEGER", "int_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_NATIVE_4_KIND - writeToFilesF03("Fortran_INTEGER", "int_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_NATIVE_2_KIND - writeToFilesF03("Fortran_INTEGER", "int_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_NATIVE_1_KIND - writeToFilesF03("Fortran_INTEGER", "int_f", 1, "C_INT8_T"); -#else - /* Error: couldn't find a size for int */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_NATIVE_8_KIND writeToFiles("Fortran_INTEGER", "int_f", 8, H5_FORTRAN_HAS_NATIVE_8_KIND); #elif defined H5_FORTRAN_HAS_NATIVE_4_KIND @@ -472,7 +362,6 @@ int main(void) /* Error: couldn't find a size for int */ return -1; #endif -#endif /* int_1, int_2, int_4, int_8 */ @@ -488,35 +377,19 @@ int main(void) #if defined H5_FORTRAN_HAS_INTEGER_1_KIND FoundIntSize[0] = 1; -#ifdef H5_HAVE_FORTRAN_2003 - FoundIntSizeKind_F03[0] = "C_INT8_T"; -#else FoundIntSizeKind[0] = H5_FORTRAN_HAS_INTEGER_1_KIND; #endif -#endif #if defined H5_FORTRAN_HAS_INTEGER_2_KIND FoundIntSize[1] = 2; -#ifdef H5_HAVE_FORTRAN_2003 - FoundIntSizeKind_F03[1] = "C_INT16_T"; -#else FoundIntSizeKind[1] = H5_FORTRAN_HAS_INTEGER_2_KIND; #endif -#endif #if defined H5_FORTRAN_HAS_INTEGER_4_KIND FoundIntSize[2] = 4; -#ifdef H5_HAVE_FORTRAN_2003 - FoundIntSizeKind_F03[2] = "C_INT32_T"; -#else FoundIntSizeKind[2] = H5_FORTRAN_HAS_INTEGER_4_KIND; #endif -#endif #if defined H5_FORTRAN_HAS_INTEGER_8_KIND FoundIntSize[3] = 8; -#ifdef H5_HAVE_FORTRAN_2003 - FoundIntSizeKind_F03[3] = "C_INT64_T"; -#else - FoundIntSizeKind[3] = H5_FORTRAN_HAS_INTEGER_8_KIND; -#endif + FoundIntSizeKind[3] = H5_FORTRAN_HAS_INTEGER_8_KIND ; #endif for(i=0;i<4;i++) { @@ -524,11 +397,7 @@ int main(void) { sprintf(chrA, "Fortran_INTEGER_%d", FoundIntSize[i]); sprintf(chrB, "int_%d_f", FoundIntSize[i]); -#ifdef H5_HAVE_FORTRAN_2003 - writeToFilesF03(chrA, chrB, FoundIntSize[i], FoundIntSizeKind_F03[i]); -#else writeToFiles(chrA, chrB, FoundIntSize[i], FoundIntSizeKind[i]); -#endif } else /* Did not find the integer type */ { @@ -539,11 +408,7 @@ int main(void) { sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]); sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); -#ifdef H5_HAVE_FORTRAN_2003 - writeToFilesF03(chrA, chrB, FoundIntSize[j], FoundIntSizeKind_F03[j]); -#else writeToFiles(chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); -#endif flag = 1; break; } @@ -556,11 +421,7 @@ int main(void) { sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]); sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]); -#ifdef H5_HAVE_FORTRAN_2003 - writeToFilesF03(chrA, chrB, FoundIntSize[j], FoundIntSizeKind_F03[j]); -#else writeToFiles(chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]); -#endif flag = 1; break; } @@ -584,29 +445,17 @@ int main(void) #if defined H5_FORTRAN_HAS_REAL_4_KIND FoundRealSize[0] = 4; -#ifdef H5_HAVE_FORTRAN_2003 - FoundRealSizeKind_F03[0] = "C_FLOAT"; -#else FoundRealSizeKind[0] = H5_FORTRAN_HAS_REAL_4_KIND; #endif -#endif #if defined H5_FORTRAN_HAS_REAL_8_KIND FoundRealSize[1] = 8; -#ifdef H5_HAVE_FORTRAN_2003 - FoundRealSizeKind_F03[1] = "C_DOUBLE"; -#else FoundRealSizeKind[1] = H5_FORTRAN_HAS_REAL_8_KIND; #endif -#endif #if defined H5_FORTRAN_HAS_REAL_16_KIND if(H5_C_HAS_REAL_NATIVE_16 != 0) { FoundRealSize[2] = 16; -#ifdef H5_HAVE_FORTRAN_2003 - FoundRealSizeKind_F03[2] = "C_LONG_DOUBLE"; -#else FoundRealSizeKind[2] = H5_FORTRAN_HAS_REAL_16_KIND; -#endif } #endif @@ -615,11 +464,7 @@ int main(void) { sprintf(chrA, "Fortran_REAL_%d", FoundRealSize[i]); sprintf(chrB, "real_%d_f", FoundRealSize[i]); -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03(chrA, chrB, FoundRealSize[i], FoundRealSizeKind_F03[i]); -#else writeFloatToFiles(chrA, chrB, FoundRealSize[i], FoundRealSizeKind[i]); -#endif } else /* Did not find the real type */ { @@ -631,11 +476,7 @@ int main(void) sprintf(chrA, "Fortran_REAL_%d", (-1)*FoundRealSize[i]); sprintf(chrB, "real_%d_f", (-1)*FoundRealSize[i]); if(FoundRealSize[j]>4) { -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03(chrA, chrB, FoundRealSize[j], FoundRealSizeKind_F03[j]); -#else writeFloatToFiles(chrA, chrB, FoundRealSize[j], FoundRealSizeKind[j]); -#endif flag = 1; } /* else { */ @@ -654,11 +495,7 @@ int main(void) sprintf(chrA, "Fortran_REAL_%d", (-1)*FoundRealSize[i]); sprintf(chrB, "real_%d_f", (-1)*FoundRealSize[i]); if(FoundRealSize[j]>4) -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03(chrA, chrB, FoundRealSize[j], FoundRealSizeKind_F03[j]); -#else writeFloatToFiles(chrA, chrB, FoundRealSize[j], FoundRealSizeKind[j]); -#endif /* else { */ /* writeFloatToFiles(chrA, chrB, FoundRealSize[j]); */ /* } */ @@ -673,22 +510,6 @@ int main(void) } /* hid_t */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 8 - writeToFilesF03("HID_T", "hid_t_f", 8, "C_INT64_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HID_T >= 4 - writeToFilesF03("HID_T", "hid_t_f", 4, "C_INT32_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HID_T >= 2 - writeToFilesF03("HID_T", "hid_t_f", 2, "C_INT16_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HID_T >= 1 - writeToFilesF03("HID_T", "hid_t_f", 1, "C_INT8_T"); -#elif defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 4 - writeToFilesF03("HID_T", "hid_t_f", 8, "C_INT64_T"); -#else - /* Error: couldn't find a size for hid_t */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 8 writeToFiles("HID_T", "hid_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); #elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HID_T >= 4 @@ -703,23 +524,8 @@ int main(void) /* Error: couldn't find a size for hid_t */ return -1; #endif -#endif /* real_f */ -#ifdef H5_HAVE_FORTRAN_2003 -#if defined H5_FORTRAN_HAS_REAL_NATIVE_16_KIND - if(H5_C_HAS_REAL_NATIVE_16 != 0) { - writeFloatToFilesF03("Fortran_REAL", "real_f", 16, "C_LONG_DOUBLE"); - } -#elif defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND - writeFloatToFilesF03("Fortran_REAL", "real_f", 8, "C_DOUBLE"); -#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND - writeFloatToFilesF03("Fortran_REAL", "real_f", 4, "C_FLOAT"); -#else - /* Error: couldn't find a size for real_f */ - return -1; -#endif -#else #if defined H5_FORTRAN_HAS_REAL_NATIVE_16_KIND if(H5_C_HAS_REAL_NATIVE_16 != 0) { writeFloatToFiles("Fortran_REAL", "real_f", 16, H5_FORTRAN_HAS_REAL_NATIVE_16_KIND); @@ -732,30 +538,17 @@ int main(void) /* Error: couldn't find a size for real_f */ return -1; #endif -#endif /* double_f */ #if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */ -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 16, "C_LONG_DOUBLE"); -#else writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND); -#endif } else { #if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */ -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 8, "C_DOUBLE"); -#else writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND); -#endif } #elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */ -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 4, "C_FLOAT"); -#else writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND); -#endif } #else /* Error: couldn't find a size for double_f when fortran has 16 byte reals */ @@ -764,11 +557,7 @@ int main(void) #endif #elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND -#ifdef H5_HAVE_FORTRAN_2003 - writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 8, "C_DOUBLE"); -#else writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND); -#endif #else /* Error: couldn't find a size for real_f */ return -1; @@ -781,6 +570,7 @@ int main(void) fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 ); + /* Close files */ endCfile(); endFfile(); |