1 /* do not edit automatically generated by mc from mcError. */
2 /* mcError.def provides an interface between the string handling modules.
4 Copyright (C) 2015-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU Modula-2; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
24 #if !defined (_mcError_H)
33 # if !defined (PROC_D)
35 typedef void (*PROC_t
) (void);
36 typedef struct { PROC_t proc
; } PROC
;
40 # include "GDynamicStrings.h"
42 # if defined (_mcError_C)
45 # define EXTERN extern
48 #if !defined (mcError_error_D)
49 # define mcError_error_D
50 typedef void *mcError_error
;
55 internalError - displays an internal error message together with the compiler source
57 This function is not buffered and is used when the compiler is about
61 EXTERN
void mcError_internalError (const char *a_
, unsigned int _a_high
, const char *file_
, unsigned int _file_high
, unsigned int line
);
64 writeFormat0 - displays the source module and line together
65 with the encapsulated format string.
66 Used for simple error messages tied to the current token.
69 EXTERN
void mcError_writeFormat0 (const char *a_
, unsigned int _a_high
);
72 writeFormat1 - displays the source module and line together
73 with the encapsulated format string.
74 Used for simple error messages tied to the current token.
77 EXTERN
void mcError_writeFormat1 (const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
80 writeFormat2 - displays the module and line together with the encapsulated
82 Used for simple error messages tied to the current token.
85 EXTERN
void mcError_writeFormat2 (const char *a_
, unsigned int _a_high
, const unsigned char *w1_
, unsigned int _w1_high
, const unsigned char *w2_
, unsigned int _w2_high
);
88 writeFormat3 - displays the module and line together with the encapsulated
90 Used for simple error messages tied to the current token.
93 EXTERN
void mcError_writeFormat3 (const char *a_
, unsigned int _a_high
, const unsigned char *w1_
, unsigned int _w1_high
, const unsigned char *w2_
, unsigned int _w2_high
, const unsigned char *w3_
, unsigned int _w3_high
);
96 newError - creates and returns a new error handle.
99 EXTERN mcError_error
mcError_newError (unsigned int atTokenNo
);
102 newWarning - creates and returns a new error handle suitable for a warning.
103 A warning will not stop compilation.
106 EXTERN mcError_error
mcError_newWarning (unsigned int atTokenNo
);
109 chainError - creates and returns a new error handle, this new error
110 is associated with, e, and is chained onto the end of, e.
113 EXTERN mcError_error
mcError_chainError (unsigned int atTokenNo
, mcError_error e
);
114 EXTERN
void mcError_errorFormat0 (mcError_error e
, const char *a_
, unsigned int _a_high
);
115 EXTERN
void mcError_errorFormat1 (mcError_error e
, const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
116 EXTERN
void mcError_errorFormat2 (mcError_error e
, const char *a_
, unsigned int _a_high
, const unsigned char *w1_
, unsigned int _w1_high
, const unsigned char *w2_
, unsigned int _w2_high
);
117 EXTERN
void mcError_errorFormat3 (mcError_error e
, const char *a_
, unsigned int _a_high
, const unsigned char *w1_
, unsigned int _w1_high
, const unsigned char *w2_
, unsigned int _w2_high
, const unsigned char *w3_
, unsigned int _w3_high
);
118 EXTERN
void mcError_errorString (mcError_error e
, DynamicStrings_String str
);
119 EXTERN
void mcError_errorStringAt (DynamicStrings_String s
, unsigned int tok
);
120 EXTERN
void mcError_errorStringAt2 (DynamicStrings_String s
, unsigned int tok1
, unsigned int tok2
);
121 EXTERN
void mcError_errorStringsAt2 (DynamicStrings_String s1
, DynamicStrings_String s2
, unsigned int tok1
, unsigned int tok2
);
122 EXTERN
void mcError_warnStringAt (DynamicStrings_String s
, unsigned int tok
);
123 EXTERN
void mcError_warnStringAt2 (DynamicStrings_String s
, unsigned int tok1
, unsigned int tok2
);
124 EXTERN
void mcError_warnStringsAt2 (DynamicStrings_String s1
, DynamicStrings_String s2
, unsigned int tok1
, unsigned int tok2
);
127 warnFormat0 - displays the source module and line together
128 with the encapsulated format string.
129 Used for simple warning messages tied to the current token.
132 EXTERN
void mcError_warnFormat0 (const char *a_
, unsigned int _a_high
);
135 warnFormat1 - displays the source module and line together
136 with the encapsulated format string.
137 Used for simple warning messages tied to the current token.
140 EXTERN
void mcError_warnFormat1 (const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
143 flushErrors - switches the output channel to the error channel
144 and then writes out all errors.
145 If an error is present the compilation is terminated.
146 All warnings are ignored.
149 EXTERN
void mcError_flushErrors (void);
152 flushWarnings - switches the output channel to the error channel
153 and then writes out all warnings.
154 If an error is present the compilation is terminated,
155 if warnings only were emitted then compilation will
159 EXTERN
void mcError_flushWarnings (void);
162 errorAbort0 - aborts compiling, it flushes all warnings and errors before aborting.
165 EXTERN
void mcError_errorAbort0 (const char *a_
, unsigned int _a_high
);