parent
9dbd5f129b
commit
3f531be2e7
5 changed files with 61 additions and 19 deletions
@ -0,0 +1,24 @@ |
||||
implicit none |
||||
|
||||
integer :: x, y |
||||
|
||||
x = 1 |
||||
y = 0 |
||||
|
||||
! include "timestwo.f90" |
||||
|
||||
! double quote and inline comment check |
||||
include "timestwo.f90" ! inline comment check |
||||
if (x/=2) error stop 'failed on first include' |
||||
|
||||
! leading space and single quote check |
||||
include 'timestwo.f90' |
||||
if (x/=4) error stop 'failed on second include' |
||||
|
||||
! Most Fortran compilers can't handle the non-standard #include, |
||||
! including (ha!) Flang, Gfortran, Ifort and PGI. |
||||
! #include "timestwo.f90" |
||||
|
||||
print *, 'OK: Fortran include tests: x=',x |
||||
|
||||
end program |
@ -1,4 +1,5 @@ |
||||
project('use in same file', 'fortran') |
||||
project('Fortran 2003 use statement, in same file', 'fortran', |
||||
meson_version: '>= 0.50.0') |
||||
|
||||
e = executable('prog', 'prog.f90') |
||||
test('simple', e) |
||||
e = executable('use_syntax', 'use_syntax.f90') |
||||
test('Fortran 2003 use syntax', e) |
||||
|
@ -1,15 +0,0 @@ |
||||
MODULE Circle |
||||
REAL, PARAMETER :: Pi = 3.1415927 |
||||
REAL :: radius |
||||
INTERFACE DEFAULT |
||||
MODULE PROCEDURE func |
||||
END INTERFACE |
||||
CONTAINS |
||||
FUNCTION func() |
||||
func = 0 |
||||
END FUNCTION |
||||
END MODULE Circle |
||||
|
||||
PROGRAM PROG |
||||
print *, "Module procedure is working." |
||||
END PROGRAM PROG |
@ -0,0 +1,31 @@ |
||||
module circle |
||||
implicit none |
||||
|
||||
integer :: x |
||||
real :: radius |
||||
|
||||
interface default |
||||
module procedure timestwo |
||||
end interface |
||||
|
||||
contains |
||||
|
||||
elemental integer function timestwo(x) result(y) |
||||
integer, intent(in) :: x |
||||
y = 2*x |
||||
end function |
||||
end module circle |
||||
|
||||
program prog |
||||
|
||||
use, non_intrinsic :: circle, only: timestwo, x |
||||
|
||||
implicit none |
||||
|
||||
x = 3 |
||||
|
||||
if (timestwo(x) /= 6) error stop 'fortran module procedure problem' |
||||
|
||||
print *,'OK: Fortran module procedure' |
||||
|
||||
end program prog |
Loading…
Reference in new issue