Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / libm2 / RealInOut.def
1 DEFINITION MODULE RealInOut;
2 (*
3   Module:       InOut for REAL numbers
4   From:         "Programming in Modula-2", 3rd, corrected edition, by N. Wirth
5   Version:      $Id: RealInOut.def,v 1.6 1994/06/24 12:49:28 ceriel Exp $
6 *)
7
8   VAR Done: BOOLEAN;
9
10   PROCEDURE ReadReal(VAR x: REAL);
11   (* Read a real number "x" according to the syntax:
12      
13         ['+'|'-'] digit {digit} ['.' digit {digit}]
14         [('E'|'e') ['+'|'-'] digit {digit}]
15
16      Done := "a number was read".
17      Input terminates with a blank or any control character.
18      When reading from a terminal, backspacing may be done by either
19      DEL or BACKSPACE, depending on the implementation of ReadString.
20   *)
21
22   PROCEDURE ReadLongReal(VAR x: LONGREAL);
23   (* Like ReadReal, but for LONGREAL *)
24
25   PROCEDURE WriteReal(x: REAL; n: CARDINAL);
26   (* Write x using n characters.
27      If fewer than n characters are needed, leading blanks are inserted.
28   *)
29
30   PROCEDURE WriteLongReal(x: LONGREAL; n: CARDINAL);
31   (* Like WriteReal, but for LONGREAL *)
32
33   PROCEDURE WriteFixPt(x: REAL; n, k: CARDINAL);
34   (* Write x in fixed-point notation usign n characters with k digits
35      after the decimal point. If fewer than n characters are needed,
36      leading blanks are inserted.
37   *)
38
39   PROCEDURE WriteLongFixPt(x: LONGREAL; n, k: CARDINAL);
40   (* Like WriteFixPt, but for LONGREAL *)
41
42   PROCEDURE WriteRealOct(x: REAL);
43   (* Write x in octal words.
44   *)
45
46   PROCEDURE WriteLongRealOct(x: LONGREAL);
47   (* Like WriteRealOct, but for LONGREAL *)
48 END RealInOut.