]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-libs/M2RTS.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs / M2RTS.def
CommitLineData
1eee94d3
GM
1(* M2RTS.def Implements the run time system facilities of Modula-2.
2
83ffe9cd 3Copyright (C) 2001-2023 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25<http://www.gnu.org/licenses/>. *)
26
27DEFINITION MODULE M2RTS ;
28
29FROM SYSTEM IMPORT ADDRESS ;
30
31
32TYPE
33 ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
34
35
36PROCEDURE ConstructModules (applicationmodule: ADDRESS;
37 argc: INTEGER; argv, envp: ADDRESS) ;
38
39PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
40 argc: INTEGER; argv, envp: ADDRESS) ;
41
42
43(*
44 RegisterModule - adds module name to the list of outstanding
45 modules which need to have their dependencies
46 explored to determine initialization order.
47*)
48
49PROCEDURE RegisterModule (name: ADDRESS;
50 init, fini: ArgCVEnvP;
51 dependencies: PROC) ;
52
53
54(*
55 RequestDependant - used to specify that modulename is dependant upon
56 module dependantmodule.
57*)
58
59PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
60
61
62(*
63 InstallTerminationProcedure - installs a procedure, p, which will
64 be called when the procedure
65 ExecuteTerminationProcedures
66 is invoked. It returns TRUE is the
67 procedure is installed.
68*)
69
70PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ;
71
72
73(*
74 ExecuteInitialProcedures - executes the initial procedures installed
75 by InstallInitialProcedure.
76*)
77
78PROCEDURE ExecuteInitialProcedures ;
79
80
81(*
82 InstallInitialProcedure - installs a procedure to be executed just
83 before the BEGIN code section of the main
84 program module.
85*)
86
87PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ;
88
89
90(*
91 ExecuteTerminationProcedures - calls each installed termination procedure
92 in reverse order.
93*)
94
95PROCEDURE ExecuteTerminationProcedures ;
96
97
98(*
99 Terminate - provides compatibility for pim. It call exit with
100 the exitcode provided in a prior call to ExitOnHalt
101 (or zero if ExitOnHalt was never called). It does
102 not call ExecuteTerminationProcedures.
103*)
104
105PROCEDURE Terminate <* noreturn *> ;
106
107
108(*
109 HALT - terminate the current program. The procedure Terminate
110 is called before the program is stopped. The parameter
111 exitcode is optional. If the parameter is not supplied
112 HALT will call libc 'abort', otherwise it will exit with
113 the code supplied. Supplying a parameter to HALT has the
114 same effect as calling ExitOnHalt with the same code and
115 then calling HALT with no parameter.
116*)
117
118PROCEDURE HALT ([exitcode: INTEGER = -1]) <* noreturn *> ;
119
120
121(*
122 Halt - provides a more user friendly version of HALT, which takes
123 four parameters to aid debugging.
124*)
125
126PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
127 function: ARRAY OF CHAR; description: ARRAY OF CHAR)
128 <* noreturn *> ;
129
130
131(*
132 ExitOnHalt - if HALT is executed then call exit with the exit code, e.
133*)
134
135PROCEDURE ExitOnHalt (e: INTEGER) ;
136
137
138(*
139 ErrorMessage - emits an error message to stderr and then calls exit (1).
140*)
141
142PROCEDURE ErrorMessage (message: ARRAY OF CHAR;
143 file: ARRAY OF CHAR;
144 line: CARDINAL;
145 function: ARRAY OF CHAR) <* noreturn *> ;
146
147
148(*
149 Length - returns the length of a string, a. This is called whenever
150 the user calls LENGTH and the parameter cannot be calculated
151 at compile time.
152*)
153
154PROCEDURE Length (a: ARRAY OF CHAR) : CARDINAL ;
155
156
157(*
158 The following are the runtime exception handler routines.
159*)
160
161PROCEDURE AssignmentException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
162PROCEDURE ReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
163PROCEDURE IncException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
164PROCEDURE DecException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
165PROCEDURE InclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
166PROCEDURE ExclException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
167PROCEDURE ShiftException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
168PROCEDURE RotateException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
169PROCEDURE StaticArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
170PROCEDURE DynamicArraySubscriptException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
171PROCEDURE ForLoopBeginException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
172PROCEDURE ForLoopToException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
173PROCEDURE ForLoopEndException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
174PROCEDURE PointerNilException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
175PROCEDURE NoReturnException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
176PROCEDURE CaseException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
177PROCEDURE WholeNonPosDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
178PROCEDURE WholeNonPosModException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
179PROCEDURE WholeZeroDivException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
180PROCEDURE WholeZeroRemException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
181PROCEDURE WholeValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
182PROCEDURE RealValueException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
183PROCEDURE ParameterException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
184PROCEDURE NoException (filename: ADDRESS; line, column: CARDINAL; scope, message: ADDRESS) ;
185
186
187END M2RTS.