summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2005-06-22 18:23:21 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2005-06-22 18:23:21 (GMT)
commitea66068977639b7b2737bb9db1e59b26db914d1e (patch)
treebc1ce12c71d0f91dba3c2d0ddccd81862a588c89 /fortran/src
parentec071c6c149c44d9b3a056948502ca2af3b875b9 (diff)
downloadhdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.zip
hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.gz
hdf5-ea66068977639b7b2737bb9db1e59b26db914d1e.tar.bz2
[svn-r10970] Purpose: New feature/bug #350 fix
Description: When compiler flag was used to set the size of Fortran integer to 8 bytes, library would fail. Solution: Cleaned up the code; added detection of Fortran INTEGER type size and appropriately defined int_f type for C-stubs routines. Platforms tested: Solaris 2.8 32 and 64-bit, AIX 5.1 64-bit parallel PGI Fortran with -i8 flag on heping Absoft Fortran with -i8 flag on heping g95 on mir (Fortran integer is 8 bytes by default that cannot be changed - compiler bug ;-) AIX Fortran with -qintsize=8 32 and 64-bit modes on copper Misc. update:
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Aff.f904
-rw-r--r--fortran/src/H5Df.c9
-rw-r--r--fortran/src/H5Dff.f905
-rw-r--r--fortran/src/H5Ff.c20
-rw-r--r--fortran/src/H5Fff.f9014
-rw-r--r--fortran/src/H5Pf.c2
-rw-r--r--fortran/src/H5Tf.c11
-rw-r--r--fortran/src/H5_f.c23
-rw-r--r--fortran/src/H5_ff.f904
-rw-r--r--fortran/src/H5f90global.f9018
-rw-r--r--fortran/src/H5f90proto.h4
-rw-r--r--fortran/src/H5match_types.c8
-rw-r--r--fortran/src/H5test_kind.f9025
13 files changed, 95 insertions, 52 deletions
diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90
index 56d5782..7b772f3 100644
--- a/fortran/src/H5Aff.f90
+++ b/fortran/src/H5Aff.f90
@@ -153,7 +153,7 @@
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp
! Attribute creation property
! list identifier
- INTEGER :: creation_prp_default
+ INTEGER(HID_T) :: creation_prp_default
INTEGER(SIZE_T) :: namelen
! INTEGER, EXTERNAL :: h5acreate_c
! MS FORTRAN needs explicit interface for C functions called here.
@@ -171,7 +171,7 @@
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T), INTENT(IN) :: type_id
INTEGER(HID_T), INTENT(IN) :: space_id
- INTEGER :: creation_prp_default
+ INTEGER(HID_T) :: creation_prp_default
INTEGER(HID_T), INTENT(OUT) :: attr_id
END FUNCTION h5acreate_c
END INTERFACE
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index ccf9804..d8abc88 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -91,6 +91,9 @@ nh5dopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id)
int c_namelen;
hid_t c_loc_id;
hid_t c_dset_id;
+ hid_t plist;
+ off_t offset;
+ hsize_t size;
/*
* Convert FORTRAN name to C name
@@ -759,7 +762,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_
hid_t c_file_space_id;
hid_t c_xfer_prp;
herr_t status;
- int *tmp;
+ int_f *tmp;
size_t max_len;
hvl_t *c_buf;
@@ -777,7 +780,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_
c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t));
if (c_buf == NULL) return ret_value;
- tmp = (int *)buf;
+ tmp = (int_f *)buf;
for (i=0; i < num_elem; i++) {
c_buf[i].len = (size_t)len[i];
c_buf[i].p = tmp;
@@ -849,7 +852,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s
if ( status < 0 ) goto DONE;
for (i=0; i < num_elem; i++) {
len[i] = (size_t_f)c_buf[i].len;
- memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(int));
+ memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(int_f));
}
H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
ret_value = 0;
diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90
index 7ceb9f0..a279e87 100644
--- a/fortran/src/H5Dff.f90
+++ b/fortran/src/H5Dff.f90
@@ -165,7 +165,7 @@
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp
! Dataset creation propertly
! list identifier
- INTEGER :: creation_prp_default
+ INTEGER(HID_T) :: creation_prp_default
INTEGER :: namelen ! Name length
! INTEGER, EXTERNAL :: h5dcreate_c
@@ -184,7 +184,7 @@
INTEGER :: namelen
INTEGER(HID_T), INTENT(IN) :: type_id
INTEGER(HID_T), INTENT(IN) :: space_id
- INTEGER :: creation_prp_default
+ INTEGER(HID_T) :: creation_prp_default
INTEGER(HID_T), INTENT(OUT) :: dset_id
END FUNCTION h5dcreate_c
END INTERFACE
@@ -629,7 +629,6 @@
if (present(xfer_prp)) xfer_prp_default = xfer_prp
if (present(mem_space_id)) mem_space_id_default = mem_space_id
if (present(file_space_id)) file_space_id_default = file_space_id
-
hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, &
file_space_id_default, xfer_prp_default, &
buf, dims)
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c
index 9ad8de7..cc3fb36 100644
--- a/fortran/src/H5Ff.c
+++ b/fortran/src/H5Ff.c
@@ -36,7 +36,7 @@ nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, h
{
int ret_value = -1;
char *c_name;
- int c_namelen;
+ int_f c_namelen;
hid_t c_file_id;
unsigned c_access_flags;
hid_t c_crt_prp;
@@ -65,7 +65,7 @@ nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, h
* Convert FORTRAN name to C name
*/
c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
+ c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
if (c_name == NULL) return ret_value;
/*
@@ -133,7 +133,7 @@ nh5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, h
{
int ret_value = -1;
char *c_name;
- int c_namelen;
+ int_f c_namelen;
hid_t c_loc_id;
hid_t c_file_id;
hid_t c_acc_prp;
@@ -153,7 +153,7 @@ nh5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, h
* Convert FORTRAN name to C name
*/
c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
if (c_name == NULL) return ret_value;
/*
@@ -183,7 +183,7 @@ nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen)
{
int ret_value = -1;
char *c_name;
- int c_namelen;
+ int_f c_namelen;
hid_t c_loc_id;
htri_t status;
@@ -193,7 +193,7 @@ nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen)
* Convert FORTRAN name to C name
*/
c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, c_namelen);
+ c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
if (c_name == NULL) return ret_value;
/*
@@ -227,7 +227,7 @@ nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hi
{
int ret_value = -1;
char *c_name;
- int c_namelen;
+ int_f c_namelen;
hid_t c_file_id;
unsigned c_access_flags;
hid_t c_acc_prp;
@@ -249,7 +249,7 @@ nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hi
* Convert FORTRAN name to C name
*/
c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
+ c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
if (c_name == NULL) return ret_value;
/*
@@ -360,14 +360,14 @@ nh5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag)
{
int ret_value = -1;
char *c_name;
- int c_namelen;
+ int_f c_namelen;
htri_t status;
/*
* Convert FORTRAN name to C name
*/
c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
+ c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
if (c_name == NULL) return ret_value;
/*
diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90
index 4fbeba9..126fde1 100644
--- a/fortran/src/H5Fff.f90
+++ b/fortran/src/H5Fff.f90
@@ -68,8 +68,8 @@
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp
! File access property list
! identifier
- INTEGER :: creation_prp_default
- INTEGER :: access_prp_default
+ INTEGER(HID_T) :: creation_prp_default
+ INTEGER(HID_T) :: access_prp_default
INTEGER :: namelen ! Length of the name character string
! INTEGER, EXTERNAL :: h5fcreate_c
@@ -86,8 +86,8 @@
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER, INTENT(IN) :: access_flags
INTEGER(HID_T), INTENT(OUT) :: file_id
- INTEGER, INTENT(IN) :: creation_prp_default
- INTEGER, INTENT(IN) :: access_prp_default
+ INTEGER(HID_T), INTENT(IN) :: creation_prp_default
+ INTEGER(HID_T), INTENT(IN) :: access_prp_default
INTEGER :: namelen
END FUNCTION h5fcreate_c
END INTERFACE
@@ -223,7 +223,7 @@
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp
! File access property list
! identifier
- INTEGER :: access_prp_default
+ INTEGER(HID_T) :: access_prp_default
INTEGER :: namelen ! Length of the name character string
! INTEGER, EXTERNAL :: h5fmount_c
@@ -360,7 +360,7 @@
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp
! File access property list
! identifier
- INTEGER :: access_prp_default
+ INTEGER(HID_T) :: access_prp_default
INTEGER :: namelen ! Length of the name character string
! INTEGER, EXTERNAL :: h5fopen_c
@@ -377,7 +377,7 @@
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER :: namelen
INTEGER, INTENT(IN) :: access_flags
- INTEGER, INTENT(IN) :: access_prp_default
+ INTEGER(HID_T), INTENT(IN) :: access_prp_default
INTEGER(HID_T), INTENT(OUT) :: file_id
END FUNCTION h5fopen_c
END INTERFACE
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 910ab89..2b6e8be 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1646,7 +1646,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name,
* Call H5Pget_external function.
*/
c_prp_id = (hid_t)*prp_id;
- c_idx = (unsigned)*idx;
+ c_idx = (unsigned)*idx;
status = H5Pget_external(c_prp_id, c_idx, c_namelen, c_name, &c_offset, &size );
if (status < 0) goto DONE;
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index 8fbcbef..cd1ccd0 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1397,7 +1397,7 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
hid_t c_type_id;
char* c_name;
int c_namelen;
- int c_value;
+ int_f c_value;
herr_t error;
c_namelen = *namelen;
@@ -1437,11 +1437,11 @@ nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen)
char* c_name;
size_t c_namelen;
herr_t error;
- int c_value;
+ int_f c_value;
c_value = *value;
c_namelen = ((size_t)*namelen) +1;
c_name = (char *)malloc(sizeof(char)*c_namelen);
- c_type_id = *type_id;
+ c_type_id = (hid_t)*type_id;
error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen);
HD5packFstring(c_name, _fcdtocp(name), (int)strlen(c_name));
HDfree(c_name);
@@ -1472,17 +1472,16 @@ nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
hid_t c_type_id;
char* c_name;
int c_namelen;
- int c_value;
herr_t error;
c_namelen = *namelen;
c_name = (char *)HD5f2cstring(name, c_namelen);
if (c_name == NULL) return ret_value;
c_type_id = *type_id;
- error = H5Tenum_valueof(c_type_id, c_name, &c_value);
+ error = H5Tenum_valueof(c_type_id, c_name, value);
HDfree(c_name);
+
if(error < 0) return ret_value;
- *value = (int_f)c_value;
ret_value = 0;
return ret_value;
}
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 07eff36..8d88667 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -43,7 +43,22 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype
int ret_value = -1;
hid_t c_type_id;
+ size_t tmp_val;
+
+/* Fortran INTEGER is may not be the same as C in; do all checking to find
+ an appropriate size
+*/
+ if (sizeof(int_f) == sizeof(int)) {
if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value;
+ } /*end if */
+ else if (sizeof(int_f) == sizeof(long)) {
+ if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value;
+ } /*end if */
+ else
+ if (sizeof(int_f) == sizeof(long long)) {
+ if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value;
+ } /*end else */
+
/* Accomodate Crays with this check */
if(sizeof(real_f)==sizeof(double)) {
if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
@@ -52,11 +67,13 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype
if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
} /* end else */
if ((types[2] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+
/*
if ((types[3] = H5Tcopy(H5T_NATIVE_UINT8)) < 0) return ret_value;
*/
if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value;
- if(H5Tset_size(c_type_id, 1) < 0) return ret_value;
+ tmp_val = 1;
+ if(H5Tset_size(c_type_id, tmp_val) < 0) return ret_value;
if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value;
types[3] = (hid_t_f)c_type_id;
@@ -188,7 +205,7 @@ int_f
nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
int_f *h5fd_flags, hid_t_f *h5fd_hid_flags,
int_f *h5g_flags, int_f *h5i_flags,
- int_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
+ hid_t_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
int_f *h5t_flags, int_f *h5z_flags)
{
int ret_value = -1;
@@ -317,7 +334,7 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
h5s_flags[3] = H5S_SELECT_SET;
h5s_flags[4] = H5S_SELECT_OR;
h5s_flags[5] = (int_f)H5S_UNLIMITED;
- h5s_flags[6] = H5S_ALL;
+ h5s_flags[6] = (int_f)H5S_ALL;
h5s_flags[7] = H5S_SELECT_NOOP;
h5s_flags[8] = H5S_SELECT_AND;
diff --git a/fortran/src/H5_ff.f90 b/fortran/src/H5_ff.f90
index 1e8d215..4974c9a 100644
--- a/fortran/src/H5_ff.f90
+++ b/fortran/src/H5_ff.f90
@@ -91,9 +91,9 @@
INTEGER i_H5G_flags(H5G_FLAGS_LEN)
INTEGER i_H5D_flags(H5D_FLAGS_LEN)
INTEGER i_H5FD_flags(H5FD_FLAGS_LEN)
- INTEGER i_H5FD_hid_flags(H5FD_HID_FLAGS_LEN)
+ INTEGER(HID_T) i_H5FD_hid_flags(H5FD_HID_FLAGS_LEN)
INTEGER i_H5I_flags(H5I_FLAGS_LEN)
- INTEGER i_H5P_flags(H5P_FLAGS_LEN)
+ INTEGER(HID_T) i_H5P_flags(H5P_FLAGS_LEN)
INTEGER i_H5R_flags(H5R_FLAGS_LEN)
INTEGER i_H5S_flags(H5S_FLAGS_LEN)
INTEGER i_H5T_flags(H5T_FLAGS_LEN)
diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90
index b17680e..ebd3c93 100644
--- a/fortran/src/H5f90global.f90
+++ b/fortran/src/H5f90global.f90
@@ -313,7 +313,7 @@
! H5FD file drivers flags declaration
!
INTEGER, PARAMETER :: H5FD_HID_FLAGS_LEN = 8
- INTEGER H5FD_hid_flags(H5FD_HID_FLAGS_LEN)
+ INTEGER(HID_T) H5FD_hid_flags(H5FD_HID_FLAGS_LEN)
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: /H5FD_HID_FLAGS/
!DEC$endif
@@ -369,19 +369,19 @@
! H5P flags declaration
!
INTEGER, PARAMETER :: H5P_FLAGS_LEN = 7
- INTEGER H5P_flags(H5P_FLAGS_LEN)
+ INTEGER(HID_T) H5P_flags(H5P_FLAGS_LEN)
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: /H5P_FLAGS/
!DEC$endif
COMMON /H5P_FLAGS/ H5P_flags
- INTEGER :: H5P_FILE_CREATE_F
- INTEGER :: H5P_FILE_ACCESS_F
- INTEGER :: H5P_DATASET_CREATE_F
- INTEGER :: H5P_DATASET_XFER_F
- INTEGER :: H5P_MOUNT_F
- INTEGER :: H5P_DEFAULT_F
- INTEGER :: H5P_NO_CLASS_F
+ INTEGER(HID_T) :: H5P_FILE_CREATE_F
+ INTEGER(HID_T) :: H5P_FILE_ACCESS_F
+ INTEGER(HID_T) :: H5P_DATASET_CREATE_F
+ INTEGER(HID_T) :: H5P_DATASET_XFER_F
+ INTEGER(HID_T) :: H5P_MOUNT_F
+ INTEGER(HID_T) :: H5P_DEFAULT_F
+ INTEGER(HID_T) :: H5P_NO_CLASS_F
EQUIVALENCE(H5P_flags(1), H5P_FILE_CREATE_F)
EQUIVALENCE(H5P_flags(2), H5P_FILE_ACCESS_F)
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 537ae97..6768f19 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -50,7 +50,7 @@ H5_FCDLL int_f nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2);
H5_FCDLL int_f nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id);
H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id);
H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_count);
-H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, int_f *obj_ids);
+H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, hid_t_f *obj_ids);
H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space);
H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope);
H5_FCDLL int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen);
@@ -653,7 +653,7 @@ H5_FCDLL int_f nh5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f * float
H5_FCDLL int_f nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
int_f *h5fd_flags, hid_t_f *h5fd_hid_flags,
int_f *h5g_flags, int_f *h5i_flags,
- int_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
+ hid_t_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags,
int_f *h5t_flags, int_f *h5z_flags);
H5_FCDLL int_f nh5init1_flags_c(int_f *h5lib_flags);
H5_FCDLL int_f nh5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum);
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 97dcf33..2edc813 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -221,13 +221,13 @@ int main()
#endif
/* int */
-#if defined H5_FORTRAN_HAS_INTEGER_8 && H5_SIZEOF_INT >= 8
+#if defined H5_FORTRAN_HAS_NATIVE_8
writeToFiles("INT", "int_f", 8);
-#elif defined H5_FORTRAN_HAS_INTEGER_4 && H5_SIZEOF_INT >= 4
+#elif defined H5_FORTRAN_HAS_NATIVE_4
writeToFiles("INT", "int_f", 4);
-#elif defined H5_FORTRAN_HAS_INTEGER_2 && H5_SIZEOF_INT >= 2
+#elif defined H5_FORTRAN_HAS_NATIVE_2
writeToFiles("INT", "int_f", 2);
-#elif defined H5_FORTRAN_HAS_INTEGER_1 && H5_SIZEOF_INT >= 1
+#elif defined H5_FORTRAN_HAS_NATIVE_1
writeToFiles("INT", "int_f", 1);
#else
/* Error: couldn't find a size for int */
diff --git a/fortran/src/H5test_kind.f90 b/fortran/src/H5test_kind.f90
index db2971e..1f5dca3 100644
--- a/fortran/src/H5test_kind.f90
+++ b/fortran/src/H5test_kind.f90
@@ -23,11 +23,36 @@
! Generate a program
write(*,*) "program int_kind"
write(*,*) "write(*,*) "" /*generating header file*/ """
+ j = 0
+ write(*, "("" call i"", i2.2,""()"")") j
do i = 1, ii
j = kind_numbers(i)
write(*, "("" call i"", i2.2,""()"")") j
enddo
write(*,*) "end program int_kind"
+ j = 0
+ write(*, "("" subroutine i"" i2.2,""()"")") j
+ write(*,*)" implicit none"
+ write(*,*)" integer :: a"
+ write(*,*)" integer :: a_size"
+ write(*,*)" a_size = bit_size(a)"
+ write(*,*)" if (a_size .eq. 8) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_NATIVE_1"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 16) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_NATIVE_2"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 32) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_NATIVE_4"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 64) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_NATIVE_8"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 128) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_NATIVE_16"" "
+ write(*,*)" endif"
+ write(*,*)" return"
+ write(*,*)" end subroutine"
do i = 1, ii
j = kind_numbers(i)
write(*, "("" subroutine i"" i2.2,""()"")") j