A simple module finalization mechanism that does NOT require a change in the Oberon-07 language (i.e. no CLOSE as as Component Pascal) is available at https://github.com/andreaspirklbauer/Oberon-module-finalization Comments are welcome. Test program: MODULE Test; IMPORT Modules, Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Finalize; BEGIN Texts.WriteString(W, "Finalization of Test"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END Finalize; PROCEDURE Start*; BEGIN (*load module*) END Start; BEGIN Texts.OpenWriter(W); Modules.SetClose(Finalize) END Test. ORP.Compile Test.Mod/s ~ # compile Test Test.Start ~ # load Test System.Free Test ~ # unload Test (prints "Finalization of Test")
Andreas: wonderful! Thank you very much! Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Andreas Pirklbauer [andreas_pirklbauer@yahoo.com] Sent: Tuesday, December 29, 2020 6:44 PM To: Oberon List Subject: [EXT] [Oberon] Module finalization in PO2013 A simple module finalization mechanism that does NOT require a change in the Oberon-07 language (i.e. no CLOSE as as Component Pascal) is available at https://github.com/andreaspirklbauer/Oberon-module-finalization Comments are welcome. Test program: MODULE Test; IMPORT Modules, Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Finalize; BEGIN Texts.WriteString(W, "Finalization of Test"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END Finalize; PROCEDURE Start*; BEGIN (*load module*) END Start; BEGIN Texts.OpenWriter(W); Modules.SetClose(Finalize) END Test. ORP.Compile Test.Mod/s ~ # compile Test Test.Start ~ # load Test System.Free Test ~ # unload Test (prints "Finalization of Test")
participants (2)
-
Andreas Pirklbauer -
Skulski, Wojciech