| 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 |
#include "config.h" |
| 33 |
#include "system.h" |
| 34 |
# ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
# endif |
| 37 |
#include <stdbool.h> |
| 38 |
# if !defined (PROC_D) |
| 39 |
# define PROC_D |
| 40 |
typedef void (*PROC_t) (void); |
| 41 |
typedef struct { PROC_t proc; } PROC; |
| 42 |
# endif |
| 43 |
|
| 44 |
# include "GSYSTEM.h" |
| 45 |
|
| 46 |
# if defined (_M2RTS_C) |
| 47 |
# define EXTERN |
| 48 |
# else |
| 49 |
# define EXTERN extern |
| 50 |
# endif |
| 51 |
|
| 52 |
typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; |
| 53 |
|
| 54 |
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); |
| 55 |
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; |
| 56 |
|
| 57 |
EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp); |
| 58 |
EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp); |
| 59 |
|
| 60 |
/* |
| 61 |
RegisterModule - adds module name to the list of outstanding |
| 62 |
modules which need to have their dependencies |
| 63 |
explored to determine initialization order. |
| 64 |
*/ |
| 65 |
|
| 66 |
EXTERN void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies); |
| 67 |
|
| 68 |
/* |
| 69 |
RequestDependant - used to specify that modulename is dependant upon |
| 70 |
module dependantmodule. |
| 71 |
*/ |
| 72 |
|
| 73 |
EXTERN void M2RTS_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); |
| 74 |
|
| 75 |
/* |
| 76 |
InstallTerminationProcedure - installs a procedure, p, which will |
| 77 |
be called when the procedure |
| 78 |
ExecuteTerminationProcedures |
| 79 |
is invoked. It returns TRUE is the |
| 80 |
procedure is installed. |
| 81 |
*/ |
| 82 |
|
| 83 |
EXTERN bool M2RTS_InstallTerminationProcedure (PROC p); |
| 84 |
|
| 85 |
/* |
| 86 |
ExecuteInitialProcedures - executes the initial procedures installed |
| 87 |
by InstallInitialProcedure. |
| 88 |
*/ |
| 89 |
|
| 90 |
EXTERN void M2RTS_ExecuteInitialProcedures (void); |
| 91 |
|
| 92 |
/* |
| 93 |
InstallInitialProcedure - installs a procedure to be executed just |
| 94 |
before the BEGIN code section of the main |
| 95 |
program module. |
| 96 |
*/ |
| 97 |
|
| 98 |
EXTERN bool M2RTS_InstallInitialProcedure (PROC p); |
| 99 |
|
| 100 |
/* |
| 101 |
ExecuteTerminationProcedures - calls each installed termination procedure |
| 102 |
in reverse order. |
| 103 |
*/ |
| 104 |
|
| 105 |
EXTERN void M2RTS_ExecuteTerminationProcedures (void); |
| 106 |
|
| 107 |
/* |
| 108 |
Terminate - provides compatibility for pim. It call exit with |
| 109 |
the exitcode provided in a prior call to ExitOnHalt |
| 110 |
(or zero if ExitOnHalt was never called). It does |
| 111 |
not call ExecuteTerminationProcedures. |
| 112 |
*/ |
| 113 |
|
| 114 |
EXTERN void M2RTS_Terminate (void) __attribute__ ((noreturn)); |
| 115 |
|
| 116 |
/* |
| 117 |
HALT - terminate the current program. The procedure Terminate |
| 118 |
is called before the program is stopped. The parameter |
| 119 |
exitcode is optional. If the parameter is not supplied |
| 120 |
HALT will call libc 'abort', otherwise it will exit with |
| 121 |
the code supplied. Supplying a parameter to HALT has the |
| 122 |
same effect as calling ExitOnHalt with the same code and |
| 123 |
then calling HALT with no parameter. |
| 124 |
*/ |
| 125 |
|
| 126 |
EXTERN void M2RTS_HALT (int exitcode) __attribute__ ((noreturn)); |
| 127 |
|
| 128 |
/* |
| 129 |
Halt - provides a more user friendly version of HALT, which takes |
| 130 |
four parameters to aid debugging. It writes an error message |
| 131 |
to stderr and calls exit (1). |
| 132 |
*/ |
| 133 |
|
| 134 |
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)); |
| 135 |
|
| 136 |
/* |
| 137 |
HaltC - provides a more user friendly version of HALT, which takes |
| 138 |
four parameters to aid debugging. It writes an error message |
| 139 |
to stderr and calls exit (1). |
| 140 |
*/ |
| 141 |
|
| 142 |
EXTERN void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn)); |
| 143 |
|
| 144 |
/* |
| 145 |
ExitOnHalt - if HALT is executed then call exit with the exit code, e. |
| 146 |
*/ |
| 147 |
|
| 148 |
EXTERN void M2RTS_ExitOnHalt (int e); |
| 149 |
|
| 150 |
/* |
| 151 |
ErrorMessage - emits an error message to stderr and then calls exit (1). |
| 152 |
*/ |
| 153 |
|
| 154 |
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)); |
| 155 |
|
| 156 |
/* |
| 157 |
Length - returns the length of a string, a. This is called whenever |
| 158 |
the user calls LENGTH and the parameter cannot be calculated |
| 159 |
at compile time. |
| 160 |
*/ |
| 161 |
|
| 162 |
EXTERN unsigned int M2RTS_Length (const char *a_, unsigned int _a_high); |
| 163 |
EXTERN void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 164 |
EXTERN void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 165 |
EXTERN void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 166 |
EXTERN void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 167 |
EXTERN void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 168 |
EXTERN void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 169 |
EXTERN void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 170 |
EXTERN void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 171 |
EXTERN void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 172 |
EXTERN void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 173 |
EXTERN void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 174 |
EXTERN void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 175 |
EXTERN void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 176 |
EXTERN void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 177 |
EXTERN void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 178 |
EXTERN void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 179 |
EXTERN void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 180 |
EXTERN void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 181 |
EXTERN void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 182 |
EXTERN void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 183 |
EXTERN void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 184 |
EXTERN void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 185 |
EXTERN void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 186 |
EXTERN void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); |
| 187 |
# ifdef __cplusplus |
| 188 |
} |
| 189 |
# endif |
| 190 |
|
| 191 |
# undef EXTERN |
| 192 |
#endif |