| 1 |
(* Copyright (C) 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 localproc ; |
| 19 |
|
| 20 |
FROM M2RTS IMPORT HALT ; |
| 21 |
|
| 22 |
(* (outer (a, (b (c)))) *) |
| 23 |
PROCEDURE outer ; |
| 24 |
VAR |
| 25 |
k, l: INTEGER ; |
| 26 |
|
| 27 |
PROCEDURE a (VAR x: INTEGER) ; |
| 28 |
VAR |
| 29 |
j: CARDINAL ; |
| 30 |
BEGIN |
| 31 |
j := 1 ; |
| 32 |
k := x ; |
| 33 |
x := j |
| 34 |
END a ; |
| 35 |
|
| 36 |
PROCEDURE b (VAR x: INTEGER) ; |
| 37 |
VAR |
| 38 |
j: CARDINAL ; |
| 39 |
|
| 40 |
PROCEDURE c (x: INTEGER) ; |
| 41 |
BEGIN |
| 42 |
k := x |
| 43 |
END c ; |
| 44 |
|
| 45 |
BEGIN |
| 46 |
j := 1 ; |
| 47 |
k := x ; |
| 48 |
x := j |
| 49 |
END b ; |
| 50 |
|
| 51 |
BEGIN |
| 52 |
k := 0 ; |
| 53 |
l := 2 ; |
| 54 |
a(l) ; |
| 55 |
IF k#2 |
| 56 |
THEN |
| 57 |
HALT |
| 58 |
END ; |
| 59 |
IF l#1 |
| 60 |
THEN |
| 61 |
HALT |
| 62 |
END |
| 63 |
END outer ; |
| 64 |
|
| 65 |
BEGIN |
| 66 |
outer |
| 67 |
END localproc. |