Debian Codegraph @

gcc/m2/pge-boot/GM2RTS.h

raw
1 /* do not edit automatically generated by mc from M2RTS. */
2 /* M2RTS.def Implements the run time system facilities of Modula-2.
3
4 Copyright (C) 2001-2025 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <[email protected]>.
6
7 This file is part of GNU Modula-2.
8
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)
12 any later version.
13
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.
18
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
22
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
27
28
29 #if !defined (_M2RTS_H)
30 # define _M2RTS_H
31
32 # ifdef __cplusplus
33 extern "C" {
34 # endif
35 #include <stdbool.h>
36 # if !defined (PROC_D)
37 # define PROC_D
38 typedef void (*PROC_t) (void);
39 typedef struct { PROC_t proc; } PROC;
40 # endif
41
42 # include "GSYSTEM.h"
43
44 # if defined (_M2RTS_C)
45 # define EXTERN
46 # else
47 # define EXTERN extern
48 # endif
49
50 typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
51
52 typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
53 struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
54
55 EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
56 EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
57
58 /*
59 RegisterModule - adds module name to the list of outstanding
60 modules which need to have their dependencies
61 explored to determine initialization order.
62 */
63
64 EXTERN void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies);
65
66 /*
67 RequestDependant - used to specify that modulename is dependant upon
68 module dependantmodule.
69 */
70
71 EXTERN void M2RTS_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
72
73 /*
74 InstallTerminationProcedure - installs a procedure, p, which will
75 be called when the procedure
76 ExecuteTerminationProcedures
77 is invoked. It returns TRUE is the
78 procedure is installed.
79 */
80
81 EXTERN bool M2RTS_InstallTerminationProcedure (PROC p);
82
83 /*
84 ExecuteInitialProcedures - executes the initial procedures installed
85 by InstallInitialProcedure.
86 */
87
88 EXTERN void M2RTS_ExecuteInitialProcedures (void);
89
90 /*
91 InstallInitialProcedure - installs a procedure to be executed just
92 before the BEGIN code section of the main
93 program module.
94 */
95
96 EXTERN bool M2RTS_InstallInitialProcedure (PROC p);
97
98 /*
99 ExecuteTerminationProcedures - calls each installed termination procedure
100 in reverse order.
101 */
102
103 EXTERN void M2RTS_ExecuteTerminationProcedures (void);
104
105 /*
106 Terminate - provides compatibility for pim. It call exit with
107 the exitcode provided in a prior call to ExitOnHalt
108 (or zero if ExitOnHalt was never called). It does
109 not call ExecuteTerminationProcedures.
110 */
111
112 EXTERN void M2RTS_Terminate (void) __attribute__ ((noreturn));
113
114 /*
115 HALT - terminate the current program. The procedure Terminate
116 is called before the program is stopped. The parameter
117 exitcode is optional. If the parameter is not supplied
118 HALT will call libc 'abort', otherwise it will exit with
119 the code supplied. Supplying a parameter to HALT has the
120 same effect as calling ExitOnHalt with the same code and
121 then calling HALT with no parameter.
122 */
123
124 EXTERN void M2RTS_HALT (int exitcode) __attribute__ ((noreturn));
125
126 /*
127 Halt - provides a more user friendly version of HALT, which takes
128 four parameters to aid debugging. It writes an error message
129 to stderr and calls exit (1).
130 */
131
132 EXTERN void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line) __attribute__ ((noreturn));
133
134 /*
135 HaltC - provides a more user friendly version of HALT, which takes
136 four parameters to aid debugging. It writes an error message
137 to stderr and calls exit (1).
138 */
139
140 EXTERN void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn));
141
142 /*
143 ExitOnHalt - if HALT is executed then call exit with the exit code, e.
144 */
145
146 EXTERN void M2RTS_ExitOnHalt (int e);
147
148 /*
149 ErrorMessage - emits an error message to stderr and then calls exit (1).
150 */
151
152 EXTERN void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn));
153
154 /*
155 Length - returns the length of a string, a. This is called whenever
156 the user calls LENGTH and the parameter cannot be calculated
157 at compile time.
158 */
159
160 EXTERN unsigned int M2RTS_Length (const char *a_, unsigned int _a_high);
161 EXTERN void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
162 EXTERN void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
163 EXTERN void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
164 EXTERN void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
165 EXTERN void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
166 EXTERN void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
167 EXTERN void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
168 EXTERN void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
169 EXTERN void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
170 EXTERN void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
171 EXTERN void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
172 EXTERN void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
173 EXTERN void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
174 EXTERN void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
175 EXTERN void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
176 EXTERN void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
177 EXTERN void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
178 EXTERN void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
179 EXTERN void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
180 EXTERN void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
181 EXTERN void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
182 EXTERN void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
183 EXTERN void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
184 EXTERN void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
185 # ifdef __cplusplus
186 }
187 # endif
188
189 # undef EXTERN
190 #endif