| 1 |
(* Copyright (C) 2008 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 mathconst ; |
| 19 |
|
| 20 |
FROM libc IMPORT printf, exit ; |
| 21 |
|
| 22 |
PROCEDURE func1 (r: REAL) ; |
| 23 |
BEGIN |
| 24 |
printf("value passed into function was %g\n", r) ; |
| 25 |
IF r#130.0 |
| 26 |
THEN |
| 27 |
exit(1) |
| 28 |
END |
| 29 |
END func1 ; |
| 30 |
|
| 31 |
PROCEDURE func2 (r: REAL) ; |
| 32 |
BEGIN |
| 33 |
printf("value passed into function was %g\n", r) ; |
| 34 |
IF r#7.0 |
| 35 |
THEN |
| 36 |
exit(1) |
| 37 |
END |
| 38 |
END func2 ; |
| 39 |
|
| 40 |
PROCEDURE func3 (r: REAL) ; |
| 41 |
BEGIN |
| 42 |
printf("value passed into function was %g\n", r) ; |
| 43 |
IF r#123.0 |
| 44 |
THEN |
| 45 |
exit(1) |
| 46 |
END |
| 47 |
END func3 ; |
| 48 |
|
| 49 |
VAR |
| 50 |
x: REAL ; |
| 51 |
BEGIN |
| 52 |
x := 123.0 ; |
| 53 |
func1(7.0+x) ; |
| 54 |
func2(7.0) ; |
| 55 |
func3(x) |
| 56 |
END mathconst. |