Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : PROCTYPE.MOD

 
Output of file : PROCTYPE.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 13 - Program 10 *)
MODULE ProcType;

FROM InOut IMPORT WriteString, WriteLn;

VAR OutputStuff : PROCEDURE(ARRAY OF CHAR);
VarLine : ARRAY[0..50] OF CHAR;

PROCEDURE WriteWithNote(InString : ARRAY OF CHAR);
BEGIN
WriteString("Written with a note ---> ");
WriteString(InString);
WriteLn;
END WriteWithNote;

PROCEDURE WriteWithComment(InputLine : ARRAY OF CHAR);
BEGIN
WriteString(InputLine);
WriteString(" <--- Written with a comment");
WriteLn;
END WriteWithComment;

BEGIN
VarLine := "This is a line of data.";
(* This uses WriteWithNote *)
OutputStuff := WriteWithNote;
OutputStuff(VarLine);
OutputStuff("Extra output ");
(* This uses WiteWithComment *)
OutputStuff := WriteWithComment;
OutputStuff(VarLine);
(* This uses WriteString *)
OutputStuff := WriteString;
OutputStuff(VarLine);
OutputStuff(" End of the line");
WriteLn;
(* The Procedures can be used in normal fashion too *)
WriteLn;
WriteWithNote("This is straight output.");
WriteWithComment("This too is straight output.");
WriteString(VarLine);
END ProcType.




(* Result of execution

Written with a note ---> This is a line of data.
Written with a note ---> Extra output
This is a line of data. <--- Written with a comment
This is a line of data. End of the line

Written with a note ---> This is straight output.
This too is straight output. <--- Written with a comment
This is a line of data.

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : PROCTYPE.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/