codekingpro/portable-devtools
114k
1module ops_module
2
3 abstract interface
4 subroutine op(x, y, z)
5 integer, intent(in) :: x, y
6 integer, intent(out) :: z
7 end subroutine
8 end interface
9
10contains
11
12 subroutine foo(x, y, r1, r2)
13 integer, intent(in) :: x, y
14 integer, intent(out) :: r1, r2
15 procedure (op) add1, add2
16 procedure (op), pointer::p
17 p=>add1
18 call p(x, y, r1)
19 p=>add2
20 call p(x, y, r2)
21 end subroutine
22end module
23
24subroutine add1(x, y, z)
25 integer, intent(in) :: x, y
26 integer, intent(out) :: z
27 z = x + y
28end subroutine
29
30subroutine add2(x, y, z)
31 integer, intent(in) :: x, y
32 integer, intent(out) :: z
33 z = x + 2 * y
34end subroutine
35 