summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5test_kind.f90
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2005-06-08 21:05:07 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2005-06-08 21:05:07 (GMT)
commit602a9ce693270280f917bd7d90710df153dcbbd1 (patch)
tree5747a4852e17941e611aeac7c9a0ee8c1219778d /fortran/src/H5test_kind.f90
parent24ccb5da13fd45c346aee164314c27b865425f92 (diff)
downloadhdf5-602a9ce693270280f917bd7d90710df153dcbbd1.zip
hdf5-602a9ce693270280f917bd7d90710df153dcbbd1.tar.gz
hdf5-602a9ce693270280f917bd7d90710df153dcbbd1.tar.bz2
[svn-r10882] Purpose:
Bug fix/improvement Description: Added another step to fortran type detection. This should help on some bizarre platforms. Solution: Formerly, H5fortran_detect.f90 was included in the distribution. Now it is generated by H5test_kind.f90 (written by Elena). Platforms tested: verbena, modi4, copper
Diffstat (limited to 'fortran/src/H5test_kind.f90')
-rw-r--r--fortran/src/H5test_kind.f9059
1 files changed, 59 insertions, 0 deletions
diff --git a/fortran/src/H5test_kind.f90 b/fortran/src/H5test_kind.f90
new file mode 100644
index 0000000..4af696f
--- /dev/null
+++ b/fortran/src/H5test_kind.f90
@@ -0,0 +1,59 @@
+! H5test_kind.f90
+!
+! This fortran program generates H5fortran_detect.f90
+!
+ program test_kind
+ integer :: i, j, last, kind_numbers(10)
+ last = -1
+ ii = 0
+ j = selected_int_kind(18)
+! write(*,*) j
+ do i = 1,100
+ j = selected_int_kind(i)
+ if(j .ne. last) then
+ if(last .ne. -1) then
+ ii = ii + 1
+ kind_numbers(ii) = last
+ endif
+ last = j
+ if(j .eq. -1) exit
+ endif
+ enddo
+! write(*,*) kind_numbers(1:ii)
+! Generate a program
+ write(*,*) "program int_kind"
+ write(*,*) "write(*,*) "" /*generating header file*/ """
+ do i = 1, ii
+ j = kind_numbers(i)
+ write(*, "("" call i"", i2.2,""()"")") j
+ enddo
+ write(*,*) "end program int_kind"
+ do i = 1, ii
+ j = kind_numbers(i)
+ write(*, "("" subroutine i"" i2.2,""()"")") j
+ write(*,*)" implicit none"
+ write(*,*)" integer(",j,") :: a"
+ write(*,*)" integer :: a_size"
+ write(*,*)" a_size = bit_size(a)"
+ write(*,*)" if (a_size .eq. 8) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_INTEGER_1"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 16) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_INTEGER_2"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 32) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_INTEGER_4"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 64) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_INTEGER_8"" "
+ write(*,*)" endif"
+ write(*,*)" if (a_size .eq. 128) then"
+ write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_INTEGER_16"" "
+ write(*,*)" endif"
+ write(*,*)" return"
+ write(*,*)" end subroutine"
+ enddo
+ end program
+
+
+