Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!tektronix!percival!qiclab!m2xenix!dawggon!p101.f19.n490.z2.fidonet.org!Pat.Terry From: Pat.Terry@p101.f19.n490.z2.fidonet.org (Pat Terry) Newsgroups: comp.lang.modula2 Subject: Termination code Message-ID: <846.242C4BE0@dawggon.fidonet.org> Date: 26 Mar 89 05:13:05 GMT Sender: ufgate@dawggon.fidonet.org (newsout1.26) Organization: FidoNet node 2:490/19.101 - Settler City Fido, Grahamstown RSA Lines: 33 Jelske Kloppenberg has asked about module termination. The forthcoming draft ISO standard is likely to require a procedure somewhere (in a required library module) to handle this problem. The syntax will be something like IMPLEMENTATION MODULE Library; FROM Finish IMPORT SetTerminate; PROCEDURE TermProc; BEGIN (* code required for termination when this Library is used *) END TermProc; BEGIN (*Initialisation code*); SetTerminate(TermProc) END Library. That is, Finish.SetTerminate(T : PROC) will install T in a stack of procedures that are called automatically, at least when the program ends normally or executes HALT. It is still to be decided what will happen in other situations (eg when exceptions are raised, coroutines "stop" and so on). Incidentally, this feature is already present in many MS-DOS implementations. JPI, StonyBrook, FST, FTL and Logitech all have it (with slight variations on how it's actually done). I suspect it's in many other implementations too, as it's such an obvious thing to want to do! -- uucp: ..!{mcvax!uunet,tektronix,sun!nosun}!oresoft!dawggon!2!490!19.101!Pat.Terry Internet: Pat.Terry@p101.f19.n490.z2.fidonet.org