Debian Codegraph @

gcc/testsuite/gm2/pim/run/pass/nestedproc5.mod

raw
1 (* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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, Boston, MA 02110-1301, USA. *)
17
18 MODULE nestedproc5 ;
19
20 FROM StrIO IMPORT WriteString, WriteLn ;
21 FROM StrLib IMPORT StrCopy, StrLen ;
22
23 PROCEDURE outer ;
24 VAR
25 a: ARRAY [0..80] OF CHAR ;
26
27 PROCEDURE flip (i, j: CARDINAL) ;
28 VAR
29 t: CHAR ;
30 BEGIN
31 t := a[i] ;
32 (*
33 a[i] := a[j] ;
34 a[j] := t
35 *)
36 END flip ;
37
38 PROCEDURE inner ;
39 VAR
40 h, l, k: CARDINAL ;
41 BEGIN
42 (*
43 h := HIGH(a) ; (* test it.. *)
44 IF h#80
45 THEN
46 HALT
47 END ;
48 k := 0 ;
49 l := StrLen(a)-1 ;
50 flip(3, 8)
51 *)
52 END inner ;
53 BEGIN
54 StrCopy('0128456739', a) ;
55 inner ;
56 WriteString(a) ; WriteLn
57 END outer ;
58
59
60 BEGIN
61 outer
62 END nestedproc5.