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-2022 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)
32 # if !defined (PROC_D)
34 typedef void (*PROC_t
) (void);
35 typedef struct { PROC_t proc
; } PROC
;
39 # include "GDynamicStrings.h"
41 # if defined (_mcError_C)
44 # define EXTERN extern
47 #if !defined (mcError_error_D)
48 # define mcError_error_D
49 typedef void *mcError_error
;
54 internalError - displays an internal error message together with the compiler source
56 This function is not buffered and is used when the compiler is about
60 EXTERN
void mcError_internalError (const char *a_
, unsigned int _a_high
, const char *file_
, unsigned int _file_high
, unsigned int line
);
63 writeFormat0 - displays the source module and line together
64 with the encapsulated format string.
65 Used for simple error messages tied to the current token.
68 EXTERN
void mcError_writeFormat0 (const char *a_
, unsigned int _a_high
);
71 writeFormat1 - displays the source module and line together
72 with the encapsulated format string.
73 Used for simple error messages tied to the current token.
76 EXTERN
void mcError_writeFormat1 (const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
79 writeFormat2 - displays the module and line together with the encapsulated
81 Used for simple error messages tied to the current token.
84 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
);
87 writeFormat3 - displays the module and line together with the encapsulated
89 Used for simple error messages tied to the current token.
92 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
);
95 newError - creates and returns a new error handle.
98 EXTERN mcError_error
mcError_newError (unsigned int atTokenNo
);
101 newWarning - creates and returns a new error handle suitable for a warning.
102 A warning will not stop compilation.
105 EXTERN mcError_error
mcError_newWarning (unsigned int atTokenNo
);
108 chainError - creates and returns a new error handle, this new error
109 is associated with, e, and is chained onto the end of, e.
112 EXTERN mcError_error
mcError_chainError (unsigned int atTokenNo
, mcError_error e
);
113 EXTERN
void mcError_errorFormat0 (mcError_error e
, const char *a_
, unsigned int _a_high
);
114 EXTERN
void mcError_errorFormat1 (mcError_error e
, const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
115 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
);
116 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
);
117 EXTERN
void mcError_errorString (mcError_error e
, DynamicStrings_String str
);
118 EXTERN
void mcError_errorStringAt (DynamicStrings_String s
, unsigned int tok
);
119 EXTERN
void mcError_errorStringAt2 (DynamicStrings_String s
, unsigned int tok1
, unsigned int tok2
);
120 EXTERN
void mcError_errorStringsAt2 (DynamicStrings_String s1
, DynamicStrings_String s2
, unsigned int tok1
, unsigned int tok2
);
121 EXTERN
void mcError_warnStringAt (DynamicStrings_String s
, unsigned int tok
);
122 EXTERN
void mcError_warnStringAt2 (DynamicStrings_String s
, unsigned int tok1
, unsigned int tok2
);
123 EXTERN
void mcError_warnStringsAt2 (DynamicStrings_String s1
, DynamicStrings_String s2
, unsigned int tok1
, unsigned int tok2
);
126 warnFormat0 - displays the source module and line together
127 with the encapsulated format string.
128 Used for simple warning messages tied to the current token.
131 EXTERN
void mcError_warnFormat0 (const char *a_
, unsigned int _a_high
);
134 warnFormat1 - displays the source module and line together
135 with the encapsulated format string.
136 Used for simple warning messages tied to the current token.
139 EXTERN
void mcError_warnFormat1 (const char *a_
, unsigned int _a_high
, const unsigned char *w_
, unsigned int _w_high
);
142 flushErrors - switches the output channel to the error channel
143 and then writes out all errors.
144 If an error is present the compilation is terminated.
145 All warnings are ignored.
148 EXTERN
void mcError_flushErrors (void);
151 flushWarnings - switches the output channel to the error channel
152 and then writes out all warnings.
153 If an error is present the compilation is terminated,
154 if warnings only were emitted then compilation will
158 EXTERN
void mcError_flushWarnings (void);
161 errorAbort0 - aborts compiling, it flushes all warnings and errors before aborting.
164 EXTERN
void mcError_errorAbort0 (const char *a_
, unsigned int _a_high
);