]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/mc/mcError.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc / mcError.def
CommitLineData
1eee94d3
GM
1(* mcError.def provides an interface between the string handling modules.
2
83ffe9cd 3Copyright (C) 2015-2023 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Modula-2; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. *)
21
22DEFINITION MODULE mcError ;
23
24
25FROM SYSTEM IMPORT BYTE ;
26FROM DynamicStrings IMPORT String ;
27
28TYPE
29 error ;
30
31
32(*
33 internalError - displays an internal error message together with the compiler source
34 file and line number.
35 This function is not buffered and is used when the compiler is about
36 to give up.
37*)
38
39PROCEDURE internalError (a: ARRAY OF CHAR; file: ARRAY OF CHAR; line: CARDINAL) ;
40
41
42
43(* ***************************************************************************
44 The following routines are used for normal syntax and semantic error reporting
45 *************************************************************************** *)
46
47
48(*
49 writeFormat0 - displays the source module and line together
50 with the encapsulated format string.
51 Used for simple error messages tied to the current token.
52*)
53
54PROCEDURE writeFormat0 (a: ARRAY OF CHAR) ;
55
56
57(*
58 writeFormat1 - displays the source module and line together
59 with the encapsulated format string.
60 Used for simple error messages tied to the current token.
61*)
62
63PROCEDURE writeFormat1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
64
65
66(*
67 writeFormat2 - displays the module and line together with the encapsulated
68 format strings.
69 Used for simple error messages tied to the current token.
70*)
71
72PROCEDURE writeFormat2 (a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
73
74
75(*
76 writeFormat3 - displays the module and line together with the encapsulated
77 format strings.
78 Used for simple error messages tied to the current token.
79*)
80
81PROCEDURE writeFormat3 (a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
82
83
84(*
85 newError - creates and returns a new error handle.
86*)
87
88PROCEDURE newError (atTokenNo: CARDINAL) : error ;
89
90
91(*
92 newWarning - creates and returns a new error handle suitable for a warning.
93 A warning will not stop compilation.
94*)
95
96PROCEDURE newWarning (atTokenNo: CARDINAL) : error ;
97
98
99(*
100 chainError - creates and returns a new error handle, this new error
101 is associated with, e, and is chained onto the end of, e.
102*)
103
104PROCEDURE chainError (atTokenNo: CARDINAL; e: error) : error ;
105
106
107(*
108 errorFormat routines provide a printf capability for the error handle.
109*)
110
111PROCEDURE errorFormat0 (e: error; a: ARRAY OF CHAR) ;
112PROCEDURE errorFormat1 (e: error; a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
113PROCEDURE errorFormat2 (e: error; a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
114PROCEDURE errorFormat3 (e: error; a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
115PROCEDURE errorString (e: error; str: String) ;
116
117
118(* ***************************************************************************
119 The following routines are useful for positioning and warnings and errors
120 at tokens. The strings are emitted later, so the caller must not destroy
121 the strings.
122 *************************************************************************** *)
123
124PROCEDURE errorStringAt (s: String; tok: CARDINAL) ;
125PROCEDURE errorStringAt2 (s: String; tok1, tok2: CARDINAL) ;
126PROCEDURE errorStringsAt2 (s1, s2: String; tok1, tok2: CARDINAL) ;
127PROCEDURE warnStringAt (s: String; tok: CARDINAL) ;
128PROCEDURE warnStringAt2 (s: String; tok1, tok2: CARDINAL) ;
129PROCEDURE warnStringsAt2 (s1, s2: String; tok1, tok2: CARDINAL) ;
130
131
132(*
133 warnFormat0 - displays the source module and line together
134 with the encapsulated format string.
135 Used for simple warning messages tied to the current token.
136*)
137
138PROCEDURE warnFormat0 (a: ARRAY OF CHAR) ;
139
140
141(*
142 warnFormat1 - displays the source module and line together
143 with the encapsulated format string.
144 Used for simple warning messages tied to the current token.
145*)
146
147PROCEDURE warnFormat1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
148
149
150(*
151 flushErrors - switches the output channel to the error channel
152 and then writes out all errors.
153 If an error is present the compilation is terminated.
154 All warnings are ignored.
155*)
156
157PROCEDURE flushErrors ;
158
159
160(*
161 flushWarnings - switches the output channel to the error channel
162 and then writes out all warnings.
163 If an error is present the compilation is terminated,
164 if warnings only were emitted then compilation will
165 continue.
166*)
167
168PROCEDURE flushWarnings ;
169
170
171(*
172 errorAbort0 - aborts compiling, it flushes all warnings and errors before aborting.
173*)
174
175PROCEDURE errorAbort0 (a: ARRAY OF CHAR) ;
176
177
178END mcError.