Epilogue.def 793 B

123456789101112131415161718192021
  1. (*$Foreign*)
  2. DEFINITION MODULE Epilogue;
  3. (*
  4. Module: install module termination procedures to be called at
  5. program termination
  6. Author: Ceriel J.H. Jacobs
  7. Version: $Id$
  8. MODULA-2 offers a facility for the initialization of modules, but there
  9. is no mechanism to have some code executed when the program finishes.
  10. This module is a feeble attempt at solving this problem.
  11. *)
  12. PROCEDURE CallAtEnd(p: PROC): BOOLEAN;
  13. (* Add procedure "p" to the list of procedures that must be executed when
  14. the program finishes.
  15. When the program finishes, these procedures are executed in the REVERSE
  16. order in which they were added to the list.
  17. This procedure returns FALSE when there are too many procedures to be
  18. called (the list has a fixed size).
  19. *)
  20. END Epilogue.