File: procedure_20.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (60 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module procedure_20_mod1
    implicit none

    public cauchy

    interface cauchy
        module procedure cauchy_sngl
    end interface cauchy

    contains

    subroutine cauchy_sngl(f, i)
        interface
            function f(z) result(r)
                integer r
                complex, intent(in) :: z
            end function f
        end interface

        integer, intent(out) :: i
        integer, parameter :: n = 2
        i = n * f((1, 2))
    end subroutine cauchy_sngl
end module procedure_20_mod1

module procedure_20_mod2
    use procedure_20_mod1
    implicit none
    contains
    subroutine wind0_sngl(i, f)
        interface
            function f(z) result(r)
                integer r
                complex, intent(in) :: z
            end function f
        end interface

        integer, intent(out) :: i

        call cauchy(f, i)
    end subroutine wind0_sngl
end module procedure_20_mod2

program procedure_20
    use procedure_20_mod2
    implicit none
    integer :: i

    call wind0_sngl(i, test_function)
    print *, "i: ", i
    if (i /= 10) error stop

contains

    function test_function(z) result(r)
        complex, intent(in) :: z
        integer :: r
        r = 5
    end function test_function
end program procedure_20