]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gm2/pim/pass/stdio.mod
Merge modula-2 front end onto gcc.
[thirdparty/gcc.git] / gcc / testsuite / gm2 / pim / pass / stdio.mod
1 (* Copyright (C) 2015 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 3, 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 stdio ; (*!m2pim*)
20
21 CONST
22 MaxStack = 40 ;
23
24 TYPE
25 ProcWrite = PROCEDURE (CHAR) ;
26
27 VAR
28 StackW : ARRAY [0..MaxStack] OF ProcWrite ;
29 StackWPtr: CARDINAL ;
30
31
32 PROCEDURE write (ch: CHAR) ;
33 BEGIN
34
35 END write ;
36
37
38 PROCEDURE PushOutput (p: ProcWrite) ;
39 BEGIN
40 IF StackWPtr=MaxStack
41 THEN
42 HALT
43 ELSE
44 INC(StackWPtr) ;
45 StackW[StackWPtr] := p
46 END
47 END PushOutput ;
48
49
50 BEGIN
51 StackWPtr := 0 ;
52 PushOutput(write)
53 END stdio.