home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / MOD2SRC.ZIP / PROCTYPE.MOD < prev    next >
Text File  |  1987-03-08  |  1KB  |  44 lines

  1.                                          (* Chapter 13 - Program 5 *)
  2. MODULE ProcType;
  3.  
  4. FROM InOut IMPORT WriteString, WriteLn;
  5.  
  6. VAR OutputStuff : PROCEDURE(ARRAY OF CHAR);
  7.     VarLine     : ARRAY[0..50] OF CHAR;
  8.  
  9.      PROCEDURE WriteWithNote(InString : ARRAY OF CHAR);
  10.      BEGIN
  11.         WriteString("Written with a note ---> ");
  12.         WriteString(InString);
  13.         WriteLn;
  14.      END WriteWithNote;
  15.  
  16.      PROCEDURE WriteWithComment(InputLine : ARRAY OF CHAR);
  17.      BEGIN
  18.         WriteString(InputLine);
  19.         WriteString(" <--- Written with a comment");
  20.         WriteLn;
  21.      END WriteWithComment;
  22.  
  23. BEGIN
  24.    VarLine := "This is a line of data.";
  25.                                         (* This uses WriteWithNote *)
  26.    OutputStuff := WriteWithNote;
  27.    OutputStuff(VarLine);
  28.    OutputStuff("Extra output ");
  29.                                       (* This uses WiteWithComment *)
  30.    OutputStuff := WriteWithComment;
  31.    OutputStuff(VarLine);
  32.                                           (* This uses WriteString *)
  33.    OutputStuff := WriteString;
  34.    OutputStuff(VarLine);
  35.    OutputStuff(" End of the line");
  36.    WriteLn;
  37.                (* The Procedures can be used in normal fashion too *)
  38.    WriteLn;
  39.    WriteWithNote("This is straight output.");
  40.    WriteWithComment("This too is straight output.");
  41.    WriteString(VarLine);
  42. END ProcType.
  43.  
  44.