This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GENERIC MODULE Node(Elem); | |
TYPE | |
T = BRANDED REF RECORD | |
Data:Elem.T; | |
(* etc whatever... *) | |
END; | |
BEGIN | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GENERIC MODULE SkipList(Elem); | |
REVEAL T = BRANDED Brand REF RECORD | |
MaxLevels,Levels:CARDINAL := 0; | |
Head:Node.T := NIL; | |
(* Say I want to specialize Node with INTEGER type, | |
then I have to make .i3 and .m3 files before hand | |
containing these: | |
INTERFACE IntNode = Node(Integer) END IntNode. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRY | |
wr := IO.OpenWrite("output.txt"); | |
EXCEPT | |
| Wr.Failure => | |
SIO.PutText("Failed opening file to write!\n"); | |
TRY | |
Wr.Close(wr); | |
EXCEPT Wr.Failure => SIO.PutText("Failed closing file!\n"); | |
| Thread.Alerted => SIO.PutText("Thread.Alerted!\n"); | |
END; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODULE BasicTypes EXPORTS Main; | |
IMPORT IO; | |
PROCEDURE RepeatChar(READONLY C:CHAR;READONLY Start,End:CARDINAL) = | |
BEGIN | |
FOR I := Start TO End DO IO.PutChar(C) END; | |
IO.Put("\n") | |
END RepeatChar; |