Debian Codegraph @

gcc/m2/gm2-libs/M2RTS.def

raw
1 (* M2RTS.def Implements the run time system facilities of Modula-2.
2
3 Copyright (C) 2001-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,
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 InstallTerminationProcedure - installs a procedure, p, which will
66 be called when the procedure
67 ExecuteTerminationProcedures
68 is invoked. It returns TRUE is the
69 procedure is installed.
70 *)
71
72 PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
73
74
75 (*
76 ExecuteInitialProcedures - executes the initial procedures installed
77 by InstallInitialProcedure.
78 *)
79
80 PROCEDURE ExecuteInitialProcedures ;
81
82
83 (*
84 InstallInitialProcedure - installs a procedure to be executed just
85 before the BEGIN code section of the main
86 program module.
87 *)
88
89 PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
90
91
92 (*
93 ExecuteTerminationProcedures - calls each installed termination procedure
94 in reverse order.
95 *)
96
97 PROCEDURE ExecuteTerminationProcedures ;
98
99
100 (*
101 Terminate - provides compatibility for pim. It call exit with
102 the exitcode provided in a prior call to ExitOnHalt
103 (or zero if ExitOnHalt was never called). It does
104 not call ExecuteTerminationProcedures.
105 *)
106
107 PROCEDURE Terminate <* noreturn *> ;
108
109
110 (*
111 HALT - terminate the current program. The procedure Terminate
112 is called before the program is stopped. The parameter
113 exitcode is optional. If the parameter is not supplied
114 HALT will call libc 'abort', otherwise it will exit with
115 the code supplied. Supplying a parameter to HALT has the
116 same effect as calling ExitOnHalt with the same code and
117 then calling HALT with no parameter.
118 *)
119
120 PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ;
121
122
123 (*
124 Halt - provides a more user friendly version of HALT, which takes
125 four parameters to aid debugging. It writes an error message
126 to stderr and calls exit (1).
127 *)
128
129 PROCEDURE Halt (description, filename, function: ARRAY OF CHAR;
130 line: CARDINAL) <* noreturn *> ;
131
132
133 (*
134 HaltC - provides a more user friendly version of HALT, which takes
135 four parameters to aid debugging. It writes an error message
136 to stderr and calls exit (1).
137 *)
138
139 PROCEDURE HaltC (description, filename, function: ADDRESS;
140 line: CARDINAL) <* noreturn *> ;
141
142
143 (*
144 ExitOnHalt - if HALT is executed then call exit with the exit code, e.
145 *)
146
147 PROCEDURE ExitOnHalt (e: INTEGER) ;
148
149
150 (*
151 ErrorMessage - emits an error message to stderr and then calls exit (1).
152 *)
153
154 PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
155 filename: ARRAY OF CHAR;
156 line: CARDINAL;
157 function: ARRAY OF CHAR) <* noreturn *> ;
158
159
160 (*
161 Length - returns the length of a string, a. This is called whenever
162 the user calls LENGTH and the parameter cannot be calculated
163 at compile time.
164 *)
165
166 PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
167
168
169 (*
170 The following are the runtime exception handler routines.
171 *)
172
173 PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
174 PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
175 PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
176 PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
177 PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
178 PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
179 PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
180 PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
181 PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
182 PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
183 PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
184 PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
185 PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
186 PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
187 PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
188 PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
189 PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
190 PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
191 PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
192 PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
193 PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
194 PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
195 PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
196 PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) <* noreturn *> ;
197
198
199 END M2RTS.