Debian Codegraph @

gcc/testsuite/gm2/pim/pass/nestedfor.mod

raw
1 (* Copyright (C) 2010 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA. *)
18
19 MODULE nestedfor ;
20
21 FROM SYSTEM IMPORT INTEGER32 ;
22
23 VAR
24 a: ARRAY [1..9] OF INTEGER32 ;
25
26
27 PROCEDURE one (q: INTEGER32) ;
28 PROCEDURE two (p: INTEGER32) ;
29 VAR
30 i: INTEGER32 ;
31 BEGIN
32 FOR i := 1 TO p-1 DO
33 INC(s, a[i])
34 END
35 END two ;
36 VAR
37 j: INTEGER32 ;
38 BEGIN
39 RETURN ;
40 FOR j := 1 TO q-1 DO
41 INC(s, a[j])
42 END ;
43 two(q)
44 END one ;
45
46 PROCEDURE three (q: INTEGER32) ;
47 PROCEDURE four (p: INTEGER32) ;
48 VAR
49 i: INTEGER32 ;
50 BEGIN
51 FOR i := 1 TO p-1 DO
52 INC(s, a[i])
53 END
54 END four ;
55 VAR
56 j: INTEGER32 ;
57 BEGIN
58 RETURN ;
59 FOR j := 1 TO q-1 DO
60 INC(s, a[j])
61 END ;
62 four(q)
63 END three ;
64
65 VAR
66 s: INTEGER32 ;
67 BEGIN
68 s := 0 ;
69 one(1) ;
70 three(1)
71 END nestedfor.