summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2016-09-26 18:27:50 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2016-09-26 18:27:50 (GMT)
commit3befe647ee9783b763208a581675988fbaabd321 (patch)
tree6750ccc6ea3956043c03546ff644c19b7eecf644 /fortran
parent41b22417b7e194f48c612c69c9259e83ddc3a3ac (diff)
downloadhdf5-3befe647ee9783b763208a581675988fbaabd321.zip
hdf5-3befe647ee9783b763208a581675988fbaabd321.tar.gz
hdf5-3befe647ee9783b763208a581675988fbaabd321.tar.bz2
Added number of integer KINDs found to the header files.
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5_f.c21
-rw-r--r--fortran/src/H5fort_type_defines.h.in1
-rw-r--r--fortran/src/H5match_types.c38
3 files changed, 33 insertions, 27 deletions
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;
}