updated to ed4

This commit is contained in:
ceriel 1989-03-08 17:28:08 +00:00
parent 15beade4d2
commit 24f3f2f10e
3 changed files with 18 additions and 2 deletions

View file

@ -21,7 +21,7 @@ DEFINITION MODULE RealConversions;
VAR ok: BOOLEAN);
PROCEDURE RealToString(r: REAL;
digits, width: INTEGER;
width, digits: INTEGER;
VAR str: ARRAY OF CHAR;
VAR ok: BOOLEAN);
(* Convert real number "r" to string "str", either in fixed-point or
@ -34,7 +34,7 @@ DEFINITION MODULE RealConversions;
*)
PROCEDURE LongRealToString(r: LONGREAL;
digits, width: INTEGER;
width, digits: INTEGER;
VAR str: ARRAY OF CHAR;
VAR ok: BOOLEAN);

View file

@ -24,6 +24,12 @@ DEFINITION MODULE RealInOut;
If fewer than n characters are needed, leading blanks are inserted.
*)
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 WriteRealOct(x: REAL);
(* Write x in octal words.
*)

View file

@ -31,6 +31,16 @@ IMPLEMENTATION MODULE RealInOut;
InOut.WriteString(buf);
END WriteReal;
PROCEDURE WriteFixPt(arg: REAL; n, k: CARDINAL);
VAR buf: RBUF;
ok : BOOLEAN;
BEGIN
IF n > MAXWIDTH THEN n := MAXWIDTH END;
RealConversions.RealToString(arg, n, k, buf, ok);
InOut.WriteString(buf);
END WriteFixPt;
PROCEDURE ReadReal(VAR x: REAL);
VAR Buf: ARRAY[0..512] OF CHAR;
ok: BOOLEAN;