(*
 * =========== macro processed output from MPP  ==========
 *
 * input file  : terminal.dpp
 * time stamp  : 1996 Nov 07 15:03:41
 *
 * output file : terminal.def
 * created at  : 2003 Jan 16 12:04:38
 *
 * options ... :  -Dlinux
 *
 * =======================================================
 *)

(****************************************************************)
(*                                                              *)
(*         Gardens Point Modula-2 Library Definition            *)
(*                                                              *)
(*                                                              *)
(*     (c) Copyright 1996 Faculty of Information Technology     *)
(*              Queensland University of Technology             *)
(*                                                              *)
(*     Permission is granted to use, copy and change this       *)
(*     program as long as the copyright message is left intact  *)
(*                                                              *)
(****************************************************************)

FOREIGN DEFINITION MODULE Terminal;
  IMPORT IMPLEMENTATION FROM "terminal.o";

(* output always goes to the UNIX std output  *)
(* input always comes from the UNIX std input *)

  PROCEDURE WriteString(str : ARRAY OF CHAR);

  PROCEDURE WriteLn;

  PROCEDURE WriteCard(card  : CARDINAL;
                      width : CARDINAL);

  PROCEDURE Write(ch : CHAR);

  PROCEDURE Read(VAR ch : CHAR);

  PROCEDURE EofIn() : BOOLEAN; (* returns "input ended" *)
  PROCEDURE EofOut();          (* closes stdout stream  *)

  PROCEDURE GetKeyStroke(VAR ch : CHAR);
  (* gets keystroke without waiting for <EOL> *)
  (* does not echo the character, there is no *)
  (* erase and kill processing. Restores tty  *)
  (* mode after reading each character in     *)

  PROCEDURE WasKeyPressed(VAR ok:BOOLEAN;VAR c:CHAR); 
  (* returns ok=TRUE if a key was pressed and  *)
  (* c is the character pressed.  If no key    *)
  (* has been pressed then ok=FALSE is returned*)
  (* and c has no valid or meaningful value.   *)

PROCEDURE Echo ();
  (* Enable echo for all terminal channels.
   * Echoing is on by default, and can be controlled by use of
   * TextIO.Read (echo) cf IOChan.Look/Skip (no echo).
   * However NoEcho truns off echoing globally, and this procedure
   * allows it to be turned back on.
   *)

PROCEDURE NoEcho ();
  (* Disable echoing for all terminal channels.
   * LookKey disables echo when it checks for (and reads) a character;
   * however a typical LookKey loop will often be outside LookKey when a key is
   * pressed, and default operatijg system echo will occur.
   * This procedure allows echoing to be globally suppressed, so that LookKey
   * echo is entirely under user control.
   *)

END Terminal.