home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF1 Files / Terminal.DEF < prev   
Encoding:
Modula Definition  |  1990-06-14  |  1.9 KB  |  51 lines  |  [TEXT/PMED]

  1. DEFINITION MODULE Terminal; (* Franz Kronseder / ETHZ / 19.06.85 /15.8.85 *)
  2.  
  3.  (* Standard Screen Output and Keyboard Input for Modula-2 programs *)                           *)
  4.  
  5.  EXPORT QUALIFIED Write, WriteString, WriteLn, Read, ReadString,
  6.                   BusyRead, ReadAgain, KeyPress, GotoXY, ClearTerminal;
  7.  
  8.  PROCEDURE Write (ch: CHAR);
  9.    (* Write a character. Interprets CR,FF,BS,DEL,BEL,36C. CR-only is 35C!  *)
  10.  
  11.  PROCEDURE WriteString (VAR s: ARRAY OF CHAR);
  12.     (* write string in "s". A NUL-character signals end of string. *)
  13.  
  14.  PROCEDURE WriteLn;
  15.  
  16.  PROCEDURE Read (VAR ch: CHAR);
  17.     (* reads one character from keyboard. The character is not echoed! *)
  18.     (* returns the character code of the of the key pressed            *)
  19.  
  20.  PROCEDURE ReadString (VAR s: ARRAY OF CHAR);
  21.     (* read a string; does echo, interprets BS,CAN, terminates with CR or ESC*)
  22.  
  23.  PROCEDURE BusyRead (VAR ch: CHAR);
  24.     (* reads a character without waiting; returns 0C if there was no character *)
  25.  
  26.  PROCEDURE ReadAgain;
  27.     (* put the last character read back in the input buffer. *)
  28.     (* usefull, if you want to do your own line editing.     *)
  29.  
  30.  PROCEDURE KeyPress(): BOOLEAN;
  31.   (* returns TRUE if keyboard buffer not empty *)
  32.  
  33.  PROCEDURE GotoXY(x,y: INTEGER);
  34.   (* sets cursor to screen-position (x=horizontal,y=vertical) in characters.
  35.      for proportional fonts, measure is in (always non-proportional) digits   *)
  36.  
  37.  PROCEDURE ClearTerminal;
  38.    (* sets the terminal bitmap to background colour and positions the cursor on
  39.       the first line *)
  40.  
  41.  
  42.  (* Note for the Macintosh: Read/BusyRead also simulate ctrl-X characters, as
  43.     follows:
  44.     command-A .. command-Z :     01C .. 32C    (ctrl-alpha)
  45.     command-a .. command-z :     01C .. 32C    (ctrl-alpha)
  46.     command-[, -], -\, -^,-_:    33C .. 37C    (ctrl-special)
  47.     command-3 .. command-7 :     33C .. 37C.   (ctrl-others. ctrl-3=ESC)
  48.  *)
  49.  
  50.  END Terminal.
  51.