DEFINITION MODULE RealInOut;
(*
  Module:	InOut for REAL numbers
  From:		"Programming in Modula-2", 3rd, corrected edition, by N. Wirth
  Version:	$Header$
*)

  VAR Done: BOOLEAN;

  PROCEDURE ReadReal(VAR x: REAL);
  (* Read a real number "x" according to the syntax:
     
	['+'|'-'] digit {digit} ['.' digit {digit}]
	[('E'|'e') ['+'|'-'] digit {digit}]

     Done := "a number was read".
     Input terminates with a blank or any control character.
     When reading from a terminal, backspacing may be done by either
     DEL or BACKSPACE, depending on the implementation of ReadString.
  *)

  PROCEDURE ReadLongReal(VAR x: LONGREAL);
  (* Like ReadReal, but for LONGREAL *)

  PROCEDURE WriteReal(x: REAL; n: CARDINAL);
  (* Write x using n characters.
     If fewer than n characters are needed, leading blanks are inserted.
  *)

  PROCEDURE WriteLongReal(x: LONGREAL; n: CARDINAL);
  (* Like WriteReal, but for LONGREAL *)

  PROCEDURE WriteFixPt(x: REAL; n, k: CARDINAL);
  (* Write x in fixed-point notation usign n characters with k digits
     after the decimal point. If fewer than n characters are needed,
     leading blanks are inserted.
  *)

  PROCEDURE WriteLongFixPt(x: LONGREAL; n, k: CARDINAL);
  (* Like WriteFixPt, but for LONGREAL *)

  PROCEDURE WriteRealOct(x: REAL);
  (* Write x in octal words.
  *)

  PROCEDURE WriteLongRealOct(x: LONGREAL);
  (* Like WriteRealOct, but for LONGREAL *)
END RealInOut.
