16 lines
650 B
Modula-2
16 lines
650 B
Modula-2
(*$Foreign*)
|
|
DEFINITION MODULE Epilogue;
|
|
(* MODULA-2 offers a facility for the initialization of modules, but there
|
|
is no mechanism to have some code executed when the program finishes.
|
|
This module is a feeble attempt at solving this problem.
|
|
*)
|
|
PROCEDURE CallAtEnd(p: PROC): BOOLEAN;
|
|
(* Add procedure "p" to the list of procedures that must be executed when
|
|
the program finishes.
|
|
When the program finishes, these procedures are executed in the order in
|
|
which they were added to the list.
|
|
This procedure returns FALSE when there are too many procedures to be
|
|
called (the list has a fixed size).
|
|
*)
|
|
END Epilogue.
|