Debian Codegraph @

gcc/m2/gm2-libs-iso/M2RTS.def

raw
1 (* M2RTS.def provides access to the exception handlers.
2
3 Copyright (C) 2010-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
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 M2RTS ;
28
29 FROM SYSTEM IMPORT ADDRESS ;
30
31
32 TYPE
33 ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
34
35
36 PROCEDURE ConstructModules (applicationmodule, libname: ADDRESS;
37 overrideliborder: ADDRESS;
38 argc: INTEGER; argv, envp: ADDRESS) ;
39
40 PROCEDURE DeconstructModules (applicationmodule, libname: ADDRESS;
41 argc: INTEGER; argv, envp: ADDRESS) ;
42
43
44 (*
45 RegisterModule - adds module name to the list of outstanding
46 modules which need to have their dependencies
47 explored to determine initialization order.
48 *)
49
50 PROCEDURE RegisterModule (name, libname: ADDRESS;
51 init, fini: ArgCVEnvP;
52 dependencies: PROC) ;
53
54
55 (*
56 RequestDependant - used to specify that modulename is dependant upon
57 module dependantmodule.
58 *)
59
60 PROCEDURE RequestDependant (modulename, libname,
61 dependantmodule, dependantlibname: ADDRESS) ;
62
63
64 (*
65 ExecuteTerminationProcedures - calls each installed termination
66 procedure in reverse order.
67 *)
68
69 PROCEDURE ExecuteTerminationProcedures ;
70
71
72 (*
73 InstallTerminationProcedure - installs a procedure, p, which will
74 be called when the procedure
75 ExecuteTerminationProcedures
76 is invoked. It returns TRUE is the
77 procedure is installed.
78 *)
79
80 PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
81
82
83 (*
84 ExecuteInitialProcedures - executes the initial procedures installed
85 by InstallInitialProcedure.
86 *)
87
88 PROCEDURE ExecuteInitialProcedures ;
89
90
91 (*
92 InstallInitialProcedure - installs a procedure to be executed just
93 before the BEGIN code section of the main
94 program module.
95 *)
96
97 PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
98
99
100 (*
101 HALT - terminate the current program. The procedure
102 ExecuteTerminationProcedures
103 is called before the program is stopped. The parameter
104 exitcode is optional. If the parameter is not supplied
105 HALT will call libc 'abort', otherwise it will exit with
106 the code supplied. Supplying a parameter to HALT has the
107 same effect as calling ExitOnHalt with the same code and
108 then calling HALT with no parameter.
109 *)
110
111 PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ;
112
113
114 (*
115 Halt - provides a more user friendly version of HALT, which takes
116 four parameters to aid debugging. It writes an error message
117 to stderr and calls exit (1).
118 *)
119
120 PROCEDURE Halt (description, filename, function: ARRAY OF CHAR;
121 line: CARDINAL) <* noreturn *> ;
122
123
124 (*
125 HaltC - provides a more user friendly version of HALT, which takes
126 four parameters to aid debugging. It writes an error message
127 to stderr and calls exit (1).
128 *)
129
130 PROCEDURE HaltC (description, filename, function: ADDRESS;
131 line: CARDINAL) <* noreturn *> ;
132
133
134
135 (*
136 ExitOnHalt - if HALT is executed then call exit with the exit code, e.
137 *)
138
139 PROCEDURE ExitOnHalt (e: INTEGER) ;
140
141
142 (*
143 ErrorMessage - emits an error message to stderr and then calls exit (1).
144 *)
145
146 PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
147 filename: ARRAY OF CHAR;
148 line: CARDINAL;
149 function: ARRAY OF CHAR) <* noreturn *> ;
150
151
152 (*
153 IsTerminating - Returns true if any coroutine has started program termination
154 and false otherwise.
155 *)
156
157 PROCEDURE IsTerminating () : BOOLEAN ;
158
159
160 (*
161 HasHalted - Returns true if a call to HALT has been made and false
162 otherwise.
163 *)
164
165 PROCEDURE HasHalted () : BOOLEAN ;
166
167
168 (*
169 Length - returns the length of a string, a. This is called whenever
170 the user calls LENGTH and the parameter cannot be calculated
171 at compile time.
172 *)
173
174 PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
175
176
177 (*
178 The following are the runtime exception handler routines.
179 *)
180
181 PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
182 PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
183 PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
184 PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
185 PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
186 PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
187 PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
188 PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
189 PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
190 PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
191 PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
192 PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
193 PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
194 PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
195 PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
196 PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
197 PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
198 PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
199 PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
200 PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
201 PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
202 PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
203 PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
204 PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
205
206
207 END M2RTS.