]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs/PushBackInput.def
1bc8aad4d75d2ee6d6072c7974726061756e75b6
[thirdparty/gcc.git] / gcc / m2 / gm2-libs / PushBackInput.def
1 (* PushBackInput.def provides a method for pushing back and consuming input.
2
3 Copyright (C) 2001-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE PushBackInput ;
28
29 FROM FIO IMPORT File ;
30 FROM DynamicStrings IMPORT String ;
31
32 EXPORT QUALIFIED Open, PutCh, GetCh, Error, WarnError, WarnString,
33 Close, SetDebug, GetExitStatus, PutStr,
34 PutString, GetColumnPosition, GetCurrentLine ;
35
36
37 (*
38 Open - opens a file for reading.
39 *)
40
41 PROCEDURE Open (a: ARRAY OF CHAR) : File ;
42
43
44 (*
45 GetCh - gets a character from either the push back stack or
46 from file, f.
47 *)
48
49 PROCEDURE GetCh (f: File) : CHAR ;
50
51
52 (*
53 PutCh - pushes a character onto the push back stack, it also
54 returns the character which has been pushed.
55 *)
56
57 PROCEDURE PutCh (ch: CHAR) : CHAR ;
58
59
60 (*
61 PutString - pushes a string onto the push back stack.
62 *)
63
64 PROCEDURE PutString (a: ARRAY OF CHAR) ;
65
66
67 (*
68 PutStr - pushes a dynamic string onto the push back stack.
69 The string, s, is not deallocated.
70 *)
71
72 PROCEDURE PutStr (s: String) ;
73
74
75 (*
76 Error - emits an error message with the appropriate file, line combination.
77 *)
78
79 PROCEDURE Error (a: ARRAY OF CHAR) ;
80
81
82 (*
83 WarnError - emits an error message with the appropriate file, line combination.
84 It does not terminate but when the program finishes an exit status of
85 1 will be issued.
86 *)
87
88 PROCEDURE WarnError (a: ARRAY OF CHAR) ;
89
90
91 (*
92 WarnString - emits an error message with the appropriate file, line combination.
93 It does not terminate but when the program finishes an exit status of
94 1 will be issued.
95 *)
96
97 PROCEDURE WarnString (s: String) ;
98
99
100 (*
101 Close - closes the opened file.
102 *)
103
104 PROCEDURE Close (f: File) ;
105
106
107 (*
108 GetExitStatus - returns the exit status which will be 1 if any warnings were issued.
109 *)
110
111 PROCEDURE GetExitStatus () : CARDINAL ;
112
113
114 (*
115 SetDebug - sets the debug flag on or off.
116 *)
117
118 PROCEDURE SetDebug (d: BOOLEAN) ;
119
120
121 (*
122 GetColumnPosition - returns the column position of the current character.
123 *)
124
125 PROCEDURE GetColumnPosition () : CARDINAL ;
126
127
128 (*
129 GetCurrentLine - returns the current line number.
130 *)
131
132 PROCEDURE GetCurrentLine () : CARDINAL ;
133
134
135 END PushBackInput.