packages feed

language-Modula2-0.1: examples/Modula-2_Libraries/andrea-m2/lib/eth-hamburg/getcharac.def

DEFINITION MODULE GetCharacter;

(*
  GET a single character from the terminal,
  without first setting the proper mode, ordinary non-GET mode is used
  wherein a RETURN is needed to input data.

  Use StartGet and StopGet to turn on and off single-character-mode.

  Set character modes on and off with the SET procedures,
  both PASSALL (all control characters passed to GET) and
     NOPASSALL (control characters not trapped) modes are available,
*)
(* J. Andrea, 1985 *)
(* This code may be freely used and distributed, it may not be sold. *)

EXPORT QUALIFIED
  Get, StartGet, StopGet,
  SetPassallCharacterMode, UnSetPassallCharacterMode,
  SetNoPassallCharacterMode ,UnSetNoPassallCharacterMode,
  GetNoWait;


  PROCEDURE Get(VAR ch :CHAR);
  (* return a single character, no Carriage-Return needed *)


  PROCEDURE GetNoWait(VAR ch :CHAR);
  (* return a single character, no Carriage-Return needed *)
  (* and don't wait till a character occurs, returns null character if there
   * is no character in the buffer *)


  PROCEDURE StartGet;
  (* Enter single character mode *)


  PROCEDURE StopGet;
  (* Exit single character mode *)
  (* And return to "carriage-return needed for input" mode *)


  PROCEDURE SetPassallCharacterMode;
  (* turn on the GET mode, trap control characters *)


  PROCEDURE UnSetPassallCharacterMode;
  (* turn off the GET mode, trap control characters *)


  PROCEDURE SetNoPassallCharacterMode;
  (* turn on the GET mode, don't trap control characters *)


  PROCEDURE UnSetNoPassallCharacterMode;
  (* turn off the GET mode, don't trap control characters *)

END GetCharacter.