| 1 |
(* M2Dependent.def defines the run time module dependencies interface. |
| 2 |
|
| 3 |
Copyright (C) 2022-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 M2Dependent ; |
| 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 (modulename, libname: ADDRESS; |
| 51 |
init, fini: ArgCVEnvP; |
| 52 |
dependencies: PROC) ; |
| 53 |
|
| 54 |
|
| 55 |
(* |
| 56 |
RequestDependant - used to specify that modulename:libname |
| 57 |
is dependant upon |
| 58 |
module dependantmodule:dependantlibname |
| 59 |
*) |
| 60 |
|
| 61 |
PROCEDURE RequestDependant (modulename, libname, |
| 62 |
dependantmodule, dependantlibname: ADDRESS) ; |
| 63 |
|
| 64 |
|
| 65 |
(* |
| 66 |
InstallTerminationProcedure - installs a procedure, p, which will |
| 67 |
be called when the procedure |
| 68 |
ExecuteTerminationProcedures |
| 69 |
is invoked. It returns TRUE is the |
| 70 |
procedure is installed. |
| 71 |
*) |
| 72 |
|
| 73 |
PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ; |
| 74 |
|
| 75 |
|
| 76 |
(* |
| 77 |
ExecuteInitialProcedures - executes the initial procedures installed |
| 78 |
by InstallInitialProcedure. |
| 79 |
*) |
| 80 |
|
| 81 |
PROCEDURE ExecuteInitialProcedures ; |
| 82 |
|
| 83 |
|
| 84 |
(* |
| 85 |
InstallInitialProcedure - installs a procedure to be executed just |
| 86 |
before the BEGIN code section of the main |
| 87 |
program module. |
| 88 |
*) |
| 89 |
|
| 90 |
PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ; |
| 91 |
|
| 92 |
|
| 93 |
(* |
| 94 |
ExecuteTerminationProcedures - calls each installed termination procedure |
| 95 |
in reverse order. |
| 96 |
*) |
| 97 |
|
| 98 |
PROCEDURE ExecuteTerminationProcedures ; |
| 99 |
|
| 100 |
|
| 101 |
END M2Dependent. |