name changes

This commit is contained in:
ceriel 1987-07-03 16:07:18 +00:00
parent 54a85f705b
commit 5838d4899d
5 changed files with 158 additions and 156 deletions

View file

@ -4,7 +4,7 @@ ASCII.def
Arguments.def Arguments.def
Conversion.def Conversion.def
EM.def EM.def
PascalIo.def PascalIO.def
InOut.def InOut.def
Makefile Makefile
Mathlib.def Mathlib.def

View file

@ -1,5 +1,5 @@
tail_m2.a tail_m2.a
PascalIo.mod PascalIO.mod
RealInOut.mod RealInOut.mod
InOut.mod InOut.mod
Terminal.mod Terminal.mod

View file

@ -5,7 +5,7 @@ SOURCES = ASCII.def EM.def MathLib0.def Processes.def \
RealInOut.def Storage.def Arguments.def Conversion.def \ RealInOut.def Storage.def Arguments.def Conversion.def \
random.def Semaphores.def Unix.def RealConver.def \ random.def Semaphores.def Unix.def RealConver.def \
Strings.def InOut.def Terminal.def TTY.def \ Strings.def InOut.def Terminal.def TTY.def \
Mathlib.def PascalIo.def Traps.def Mathlib.def PascalIO.def Traps.def
all: all:

View file

@ -1,85 +1,87 @@
DEFINITION MODULE PascalIo; DEFINITION MODULE PascalIO;
(* This module provides for I/O that is essentially equivalent to the I/O (* This module provides for I/O that is essentially equivalent to the I/O
provided by Pascal with "text", or "file of char". provided by Pascal with "text", or "file of char".
However, the user must call a cleanup routine at the end of his program However, the user must call a cleanup routine at the end of his program
for the output buffers to be flushed. for the output buffers to be flushed.
*) *)
CONST EOS = 0C; (* End of string character *) CONST Eos = 0C; (* End of string character *)
TYPE Text; TYPE Text;
VAR input, output: Text; (* standard input and standard output available VAR Input, Output: Text; (* standard input and standard output available
immediately. immediately.
Standard output is not buffered when Standard output is not buffered when
connected to a terminal. connected to a terminal.
*) *)
VAR notext: Text; (* Initialize your Text variables with this *) VAR Notext: Text; (* Initialize your Text variables with this *)
PROCEDURE Reset(filename: ARRAY OF CHAR; VAR inputtext: Text); PROCEDURE Reset(Filename: ARRAY OF CHAR; VAR InputText: Text);
(* When inputtext indicates an open textfile, it is first flushed (* When InputText indicates an open textfile, it is first flushed
and closed. Then, the file indicated by "filename" is opened for reading. and closed. Then, the file indicated by "Filename" is opened for reading.
If this fails, a runtime error results. Otherwise, inputtext is If this fails, a runtime error results. Otherwise, InputText is
associated with the new input file. associated with the new input file.
*) *)
PROCEDURE Rewrite(filename: ARRAY OF CHAR; VAR outputtext: Text); PROCEDURE Rewrite(Filename: ARRAY OF CHAR; VAR OutputText: Text);
(* When outputtext indicates an open textfile, it is first flushed (* When OutputText indicates an open textfile, it is first flushed
and closed. Then, the file indicated by "filename" is opened for writing. and closed. Then, the file indicated by "Filename" is opened for writing.
If this fails, a runtime error results. Otherwise, outputtext is If this fails, a runtime error results. Otherwise, OutputText is
associated with the new output file. associated with the new output file.
*) *)
PROCEDURE PascalIoCleanup(); PROCEDURE CloseOutput();
(* To be called at the end of the program, to flush all output buffers *) (* To be called at the end of the program, to flush all output buffers *)
(*************************************************************************** (***************************************************************************
Input routines; Input routines;
All these routines result in a runtime error when not called with either All these routines result in a runtime error when not called with either
"input", or a "Text" value obtained by Reset. "Input", or a "Text" value obtained by Reset.
Also, the routines that actually advance the "read pointer", result in a Also, the routines that actually advance the "read pointer", result in a
runtime error when end of file is reached prematurely. runtime error when end of file is reached prematurely.
****************************************************************************) ****************************************************************************)
PROCEDURE NextCHAR(inputtext: Text): CHAR; PROCEDURE NextChar(InputText: Text): CHAR;
(* Returns the next character of the inputtext, 0C on end of file. (* Returns the next character of the InputText, 0C on end of file.
Does not advance the "read pointer", so behaves much like "input^" Does not advance the "read pointer", so behaves much like "input^"
in Pascal. However, unlike Pascal, if Eoln(inputtext) is true, it in Pascal. However, unlike Pascal, if Eoln(InputText) is true, it
returns the newline character, rather than a space. returns the newline character, rather than a space.
*) *)
PROCEDURE Get(inputtext: Text); PROCEDURE Get(InputText: Text);
(* Advances the "read pointer" by one character *) (* Advances the "read pointer" by one character *)
PROCEDURE Eoln(inputtext: Text): BOOLEAN; PROCEDURE Eoln(InputText: Text): BOOLEAN;
(* Returns TRUE if the next character of the inputtext is a linefeed *) (* Returns TRUE if the next character of the InputText is a linefeed *)
PROCEDURE Eof(inputtext: Text): BOOLEAN; PROCEDURE Eof(InputText: Text): BOOLEAN;
(* Returns TRUE if the end of the inputtext is reached *) (* Returns TRUE if the end of the InputText is reached *)
PROCEDURE ReadCHAR(inputtext: Text; VAR ch: CHAR); PROCEDURE ReadChar(InputText: Text; VAR Char: CHAR);
(* Read a character from the inputtext, and leave result in "ch" *) (* Read a character from the InputText, and leave result in "Char" *)
PROCEDURE ReadLn(inputtext: Text); PROCEDURE ReadLn(InputText: Text);
(* Skip the rest of the current line of the inputtext, including the linefeed *) (* Skip the rest of the current line of the InputText,
including the linefeed
*)
PROCEDURE ReadINTEGER(inputtext: Text; VAR int: INTEGER); PROCEDURE ReadInteger(InputText: Text; VAR Integer: INTEGER);
(* Skip leading blanks, read an optionally signed integer from the (* Skip leading blanks, read an optionally signed integer from the
inputtext, and leave the result in "int". InputText, and leave the result in "Integer".
If no integer is read, or when overflow occurs, a runtime error results. If no integer is read, or when overflow occurs, a runtime error results.
Input stops at the character following the integer. Input stops at the character following the integer.
*) *)
PROCEDURE ReadCARDINAL(inputtext: Text; VAR card: CARDINAL); PROCEDURE ReadCardinal(InputText: Text; VAR Cardinal: CARDINAL);
(* Skip leading blanks, read a cardinal from the inputtext, and leave the (* Skip leading blanks, read a cardinal from the InputText, and leave the
result in "card". result in "card".
If no cardinal is read, or when overflow occurs, a runtime error results. If no cardinal is read, or when overflow occurs, a runtime error results.
Input stops at the character following the integer. Input stops at the character following the integer.
*) *)
PROCEDURE ReadREAL(inputtext: Text; VAR real: REAL); PROCEDURE ReadReal(InputText: Text; VAR Real: REAL);
(* Skip leading blanks, read a real from the inputtext, and leave the (* Skip leading blanks, read a real from the InputText, and leave the
result in "card". result in "Real".
Syntax: Syntax:
real --> [(+|-)] digit {digit} [. digit {digit}] real --> [(+|-)] digit {digit} [. digit {digit}]
[ E [(+|-)] digit {digit} ] [ E [(+|-)] digit {digit} ]
@ -91,48 +93,48 @@ DEFINITION MODULE PascalIo;
(*************************************************************************** (***************************************************************************
Output routines; Output routines;
All these routines result in a runtime error when not called with either All these routines result in a runtime error when not called with either
"output", or a "Text" value obtained by Rewrite. "Output", or a "Text" value obtained by Rewrite.
****************************************************************************) ****************************************************************************)
PROCEDURE WriteCHAR(outputtext: Text; ch: CHAR); PROCEDURE WriteChar(OutputText: Text; Char: CHAR);
(* Writes the character "ch" to the outputtext *) (* Writes the character "Char" to the OutputText *)
PROCEDURE WriteLn(outputtext: Text); PROCEDURE WriteLn(OutputText: Text);
(* Writes a linefeed to the outputtext *) (* Writes a linefeed to the OutputText *)
PROCEDURE Page(outputtext: Text); PROCEDURE Page(OutputText: Text);
(* Writes a form-feed to the outputtext *) (* Writes a form-feed to the OutputText *)
PROCEDURE WriteINTEGER(outputtext: Text; int: INTEGER; width: CARDINAL); PROCEDURE WriteInteger(OutputText: Text; Integer: INTEGER; Width: CARDINAL);
(* Write integer "int" to the outputtext, using at least "width" places, (* Write integer "Integer" to the OutputText, using at least "Width" places,
blank-padding to the left if needed. blank-padding to the left if needed.
*) *)
PROCEDURE WriteCARDINAL(outputtext: Text; card: CARDINAL; width: CARDINAL); PROCEDURE WriteCardinal(OutputText: Text; Cardinal, Width: CARDINAL);
(* Write cardinal "card" to the outputtext, using at least "width" places, (* Write cardinal "Cardinal" to the OutputText, using at least
blank-padding to the left if needed. "Width" places, blank-padding to the left if needed.
*) *)
PROCEDURE WriteBOOLEAN(outputtext: Text; bool: BOOLEAN; width: CARDINAL); PROCEDURE WriteBoolean(OutputText: Text; Boolean: BOOLEAN; Width: CARDINAL);
(* Write boolean "bool" to the outputtext, using at least "width" places, (* Write boolean "Boolean" to the OutputText, using at least "Width" places,
blank-padding to the left if needed. blank-padding to the left if needed.
Equivalent to WriteSTRING(" TRUE", width), or Equivalent to WriteString(" TRUE", Width), or
WriteSTRING("FALSE", width) WriteString("FALSE", Width)
*) *)
PROCEDURE WriteSTRING(outputtext: Text; PROCEDURE WriteString(OutputText: Text;
str: ARRAY OF CHAR; width: CARDINAL); String: ARRAY OF CHAR; Width: CARDINAL);
(* Write string "str" to the outputtext, using at least "width" places, (* Write string "String" to the OutputText, using at least "Width" places,
blank-padding to the left if needed. blank-padding to the left if needed.
The string is terminated either by the character EOS, or the upperbound of The string is terminated either by the character Eos, or the upperbound of
the array "str". the array "String".
*) *)
PROCEDURE WriteREAL(outputtext: Text; real: REAL; width, nfrac: CARDINAL); PROCEDURE WriteReal(OutputText: Text; Real: REAL; Width, Nfrac: CARDINAL);
(* Write real "real" to the outputtext. If "nfrac" = 0, use scientific (* Write real "Real" to the OutputText. If "Nfrac" = 0, use scientific
notation, otherwise use fixed-point notation with "nfrac" digits behind notation, otherwise use fixed-point notation with "Nfrac" digits behind
the dot. the dot.
Always use at least "width" places, blank-padding to the left if needed. Always use at least "Width" places, blank-padding to the left if needed.
*) *)
END PascalIo. END PascalIO.

View file

@ -1,4 +1,4 @@
IMPLEMENTATION MODULE PascalIo; IMPLEMENTATION MODULE PascalIO;
IMPORT Unix; IMPORT Unix;
IMPORT Conversions; IMPORT Conversions;
@ -30,13 +30,13 @@ IMPLEMENTATION MODULE PascalIo;
VAR ibuf, obuf: IOBuf; VAR ibuf, obuf: IOBuf;
head: Text; head: Text;
PROCEDURE Reset(filename: ARRAY OF CHAR; VAR inputtext: Text); PROCEDURE Reset(Filename: ARRAY OF CHAR; VAR InputText: Text);
BEGIN BEGIN
doclose(inputtext); doclose(InputText);
getstruct(inputtext); getstruct(InputText);
WITH inputtext^ DO WITH InputText^ DO
eof := FALSE; eof := FALSE;
fildes := Unix.open(ADR(filename), 0); fildes := Unix.open(ADR(Filename), 0);
IF fildes < 0 THEN IF fildes < 0 THEN
Traps.Message("could not open input file"); Traps.Message("could not open input file");
HALT; HALT;
@ -48,13 +48,13 @@ IMPLEMENTATION MODULE PascalIo;
END; END;
END Reset; END Reset;
PROCEDURE Rewrite(filename: ARRAY OF CHAR; VAR outputtext: Text); PROCEDURE Rewrite(Filename: ARRAY OF CHAR; VAR OutputText: Text);
BEGIN BEGIN
doclose(outputtext); doclose(OutputText);
getstruct(outputtext); getstruct(OutputText);
WITH outputtext^ DO WITH OutputText^ DO
eof := FALSE; eof := FALSE;
fildes := Unix.creat(ADR(filename), 666B); fildes := Unix.creat(ADR(Filename), 666B);
IF fildes < 0 THEN IF fildes < 0 THEN
Traps.Message("could not open output file"); Traps.Message("could not open output file");
HALT; HALT;
@ -66,7 +66,7 @@ IMPLEMENTATION MODULE PascalIo;
END; END;
END Rewrite; END Rewrite;
PROCEDURE PascalIoCleanup(); PROCEDURE CloseOutput();
VAR text: Text; VAR text: Text;
BEGIN BEGIN
text := head; text := head;
@ -74,12 +74,12 @@ IMPLEMENTATION MODULE PascalIo;
doclose(text); doclose(text);
text := text^.next; text := text^.next;
END; END;
END PascalIoCleanup; END CloseOutput;
PROCEDURE doclose(text: Text); PROCEDURE doclose(text: Text);
VAR dummy: INTEGER; VAR dummy: INTEGER;
BEGIN BEGIN
IF text # notext THEN IF text # Notext THEN
WITH text^ DO WITH text^ DO
IF type = writing THEN IF type = writing THEN
Flush(text); Flush(text);
@ -117,37 +117,37 @@ IMPLEMENTATION MODULE PascalIo;
END; END;
END chk; END chk;
PROCEDURE ReadCHAR(inputtext: Text; VAR ch : CHAR); PROCEDURE ReadChar(InputText: Text; VAR ch : CHAR);
BEGIN BEGIN
ch := NextCHAR(inputtext); ch := NextChar(InputText);
Get(inputtext); Get(InputText);
END ReadCHAR; END ReadChar;
PROCEDURE NextCHAR(inputtext: Text): CHAR; PROCEDURE NextChar(InputText: Text): CHAR;
VAR c: CHAR; VAR c: CHAR;
BEGIN BEGIN
chk(inputtext, reading); chk(InputText, reading);
WITH inputtext^ DO WITH InputText^ DO
IF cnt <= maxcnt THEN IF cnt <= maxcnt THEN
c := buf[cnt]; c := buf[cnt];
ELSE ELSE
c := FillBuf(inputtext); c := FillBuf(InputText);
END; END;
END; END;
RETURN c; RETURN c;
END NextCHAR; END NextChar;
PROCEDURE Get(inputtext: Text); PROCEDURE Get(InputText: Text);
VAR dummy: CHAR; VAR dummy: CHAR;
BEGIN BEGIN
chk(inputtext, reading); chk(InputText, reading);
WITH inputtext^ DO WITH InputText^ DO
IF eof THEN IF eof THEN
Traps.Message("unexpected EOF"); Traps.Message("unexpected EOF");
HALT; HALT;
END; END;
IF cnt > maxcnt THEN IF cnt > maxcnt THEN
dummy := FillBuf(inputtext); dummy := FillBuf(InputText);
END; END;
INC(cnt); INC(cnt);
END; END;
@ -170,21 +170,21 @@ IMPLEMENTATION MODULE PascalIo;
RETURN c; RETURN c;
END FillBuf; END FillBuf;
PROCEDURE Eoln(inputtext: Text): BOOLEAN; PROCEDURE Eoln(InputText: Text): BOOLEAN;
BEGIN BEGIN
RETURN NextCHAR(inputtext) = 12C; RETURN NextChar(InputText) = 12C;
END Eoln; END Eoln;
PROCEDURE Eof(inputtext: Text): BOOLEAN; PROCEDURE Eof(InputText: Text): BOOLEAN;
BEGIN BEGIN
RETURN (NextCHAR(inputtext) = 0C) AND inputtext^.eof; RETURN (NextChar(InputText) = 0C) AND InputText^.eof;
END Eof; END Eof;
PROCEDURE ReadLn(inputtext: Text); PROCEDURE ReadLn(InputText: Text);
VAR ch: CHAR; VAR ch: CHAR;
BEGIN BEGIN
REPEAT REPEAT
ReadCHAR(inputtext, ch) ReadChar(InputText, ch)
UNTIL ch = 12C; UNTIL ch = 12C;
END ReadLn; END ReadLn;
@ -197,29 +197,29 @@ IMPLEMENTATION MODULE PascalIo;
END; END;
END Flush; END Flush;
PROCEDURE WriteCHAR(outputtext: Text; ch: CHAR); PROCEDURE WriteChar(OutputText: Text; ch: CHAR);
BEGIN BEGIN
chk(outputtext, writing); chk(OutputText, writing);
WITH outputtext^ DO WITH OutputText^ DO
INC(cnt); INC(cnt);
buf[cnt] := ch; buf[cnt] := ch;
IF cnt >= bufferedcount THEN IF cnt >= bufferedcount THEN
Flush(outputtext); Flush(OutputText);
END; END;
END; END;
END WriteCHAR; END WriteChar;
PROCEDURE WriteLn(outputtext: Text); PROCEDURE WriteLn(OutputText: Text);
BEGIN BEGIN
WriteCHAR(outputtext, 12C); WriteChar(OutputText, 12C);
END WriteLn; END WriteLn;
PROCEDURE Page(outputtext: Text); PROCEDURE Page(OutputText: Text);
BEGIN BEGIN
WriteCHAR(outputtext, 14C); WriteChar(OutputText, 14C);
END Page; END Page;
PROCEDURE ReadINTEGER(inputtext: Text; VAR int : INTEGER); PROCEDURE ReadInteger(InputText: Text; VAR int : INTEGER);
CONST CONST
SAFELIMITDIV10 = MAX(INTEGER) DIV 10; SAFELIMITDIV10 = MAX(INTEGER) DIV 10;
SAFELIMITREM10 = MAX(INTEGER) MOD 10; SAFELIMITREM10 = MAX(INTEGER) MOD 10;
@ -229,17 +229,17 @@ IMPLEMENTATION MODULE PascalIo;
ch: CHAR; ch: CHAR;
chvalue: CARDINAL; chvalue: CARDINAL;
BEGIN BEGIN
WHILE NextCHAR(inputtext) IN spaces DO WHILE NextChar(InputText) IN spaces DO
Get(inputtext); Get(InputText);
END; END;
ch := NextCHAR(inputtext); ch := NextChar(InputText);
IF ch = '-' THEN IF ch = '-' THEN
Get(inputtext); Get(InputText);
ch := NextCHAR(inputtext); ch := NextChar(InputText);
neg := TRUE; neg := TRUE;
ELSIF ch = '+' THEN ELSIF ch = '+' THEN
Get(inputtext); Get(InputText);
ch := NextCHAR(inputtext); ch := NextChar(InputText);
neg := FALSE; neg := FALSE;
ELSE ELSE
neg := FALSE neg := FALSE
@ -258,8 +258,8 @@ IMPLEMENTATION MODULE PascalIo;
HALT; HALT;
ELSE ELSE
int := 10*int - VAL(INTEGER, chvalue); int := 10*int - VAL(INTEGER, chvalue);
Get(inputtext); Get(InputText);
ch := NextCHAR(inputtext); ch := NextChar(InputText);
END; END;
END; END;
IF NOT neg THEN IF NOT neg THEN
@ -269,9 +269,9 @@ IMPLEMENTATION MODULE PascalIo;
Traps.Message("integer expected"); Traps.Message("integer expected");
HALT; HALT;
END; END;
END ReadINTEGER; END ReadInteger;
PROCEDURE ReadCARDINAL(inputtext: Text; VAR card : CARDINAL); PROCEDURE ReadCardinal(InputText: Text; VAR card : CARDINAL);
CONST CONST
SAFELIMITDIV10 = MAX(CARDINAL) DIV 10; SAFELIMITDIV10 = MAX(CARDINAL) DIV 10;
SAFELIMITREM10 = MAX(CARDINAL) MOD 10; SAFELIMITREM10 = MAX(CARDINAL) MOD 10;
@ -281,10 +281,10 @@ IMPLEMENTATION MODULE PascalIo;
safedigit: CARDINAL; safedigit: CARDINAL;
chvalue: CARDINAL; chvalue: CARDINAL;
BEGIN BEGIN
WHILE NextCHAR(inputtext) IN spaces DO WHILE NextChar(InputText) IN spaces DO
Get(inputtext); Get(InputText);
END; END;
ch := NextCHAR(inputtext); ch := NextChar(InputText);
safedigit := SAFELIMITREM10; safedigit := SAFELIMITREM10;
card := 0; card := 0;
IF (ch >= '0') AND (ch <= '9') THEN IF (ch >= '0') AND (ch <= '9') THEN
@ -297,17 +297,17 @@ IMPLEMENTATION MODULE PascalIo;
HALT; HALT;
ELSE ELSE
card := 10*card + chvalue; card := 10*card + chvalue;
Get(inputtext); Get(InputText);
ch := NextCHAR(inputtext); ch := NextChar(InputText);
END; END;
END; END;
ELSE ELSE
Traps.Message("cardinal expected"); Traps.Message("cardinal expected");
HALT; HALT;
END; END;
END ReadCARDINAL; END ReadCardinal;
PROCEDURE ReadREAL(inputtext: Text; VAR real: REAL); PROCEDURE ReadReal(InputText: Text; VAR real: REAL);
VAR VAR
buf: numbuf; buf: numbuf;
ch: CHAR; ch: CHAR;
@ -318,17 +318,17 @@ IMPLEMENTATION MODULE PascalIo;
BEGIN BEGIN
buf[index] := ch; buf[index] := ch;
INC(index); INC(index);
Get(inputtext); Get(InputText);
RETURN NextCHAR(inputtext); RETURN NextChar(InputText);
END inch; END inch;
BEGIN BEGIN
index := 0; index := 0;
ok := TRUE; ok := TRUE;
WHILE NextCHAR(inputtext) IN spaces DO WHILE NextChar(InputText) IN spaces DO
Get(inputtext); Get(InputText);
END; END;
ch := NextCHAR(inputtext); ch := NextChar(InputText);
IF (ch ='+') OR (ch = '-') THEN IF (ch ='+') OR (ch = '-') THEN
ch := inch(); ch := inch();
END; END;
@ -370,34 +370,34 @@ IMPLEMENTATION MODULE PascalIo;
Traps.Message("Illegal real"); Traps.Message("Illegal real");
HALT; HALT;
END; END;
END ReadREAL; END ReadReal;
PROCEDURE WriteCARDINAL(outputtext: Text; card: CARDINAL; width: CARDINAL); PROCEDURE WriteCardinal(OutputText: Text; card: CARDINAL; width: CARDINAL);
VAR VAR
buf : numbuf; buf : numbuf;
BEGIN BEGIN
Conversions.ConvertCardinal(card, 1, buf); Conversions.ConvertCardinal(card, 1, buf);
WriteSTRING(outputtext, buf, width); WriteString(OutputText, buf, width);
END WriteCARDINAL; END WriteCardinal;
PROCEDURE WriteINTEGER(outputtext: Text; int: INTEGER; width: CARDINAL); PROCEDURE WriteInteger(OutputText: Text; int: INTEGER; width: CARDINAL);
VAR VAR
buf : numbuf; buf : numbuf;
BEGIN BEGIN
Conversions.ConvertInteger(int, 1, buf); Conversions.ConvertInteger(int, 1, buf);
WriteSTRING(outputtext, buf, width); WriteString(OutputText, buf, width);
END WriteINTEGER; END WriteInteger;
PROCEDURE WriteBOOLEAN(outputtext: Text; bool: BOOLEAN; width: CARDINAL); PROCEDURE WriteBoolean(OutputText: Text; bool: BOOLEAN; width: CARDINAL);
BEGIN BEGIN
IF bool THEN IF bool THEN
WriteSTRING(outputtext, " TRUE", width); WriteString(OutputText, " TRUE", width);
ELSE ELSE
WriteSTRING(outputtext, "FALSE", width); WriteString(OutputText, "FALSE", width);
END; END;
END WriteBOOLEAN; END WriteBoolean;
PROCEDURE WriteREAL(outputtext: Text; real: REAL; width, nfrac: CARDINAL); PROCEDURE WriteReal(OutputText: Text; real: REAL; width, nfrac: CARDINAL);
VAR VAR
buf: numbuf; buf: numbuf;
ok: BOOLEAN; ok: BOOLEAN;
@ -417,28 +417,28 @@ IMPLEMENTATION MODULE PascalIo;
END; END;
RealConversions.RealToString(real, width, digits, buf, ok); RealConversions.RealToString(real, width, digits, buf, ok);
END; END;
WriteSTRING(outputtext, buf, 0); WriteString(OutputText, buf, 0);
END WriteREAL; END WriteReal;
PROCEDURE WriteSTRING(outputtext: Text; str: ARRAY OF CHAR; width: CARDINAL); PROCEDURE WriteString(OutputText: Text; str: ARRAY OF CHAR; width: CARDINAL);
VAR index: CARDINAL; VAR index: CARDINAL;
BEGIN BEGIN
index := 0; index := 0;
WHILE (index <= HIGH(str)) AND (str[index] # EOS) DO WHILE (index <= HIGH(str)) AND (str[index] # Eos) DO
INC(index); INC(index);
END; END;
WHILE index < width DO WHILE index < width DO
WriteCHAR(outputtext, " "); WriteChar(OutputText, " ");
INC(index); INC(index);
END; END;
index := 0; index := 0;
WHILE (index <= HIGH(str)) AND (str[index] # EOS) DO WHILE (index <= HIGH(str)) AND (str[index] # Eos) DO
WriteCHAR(outputtext, str[index]); WriteChar(OutputText, str[index]);
INC(index); INC(index);
END; END;
END WriteSTRING; END WriteString;
BEGIN (* PascalIo initialization *) BEGIN (* PascalIO initialization *)
WITH ibuf DO WITH ibuf DO
eof := FALSE; eof := FALSE;
type := reading; type := reading;
@ -458,10 +458,10 @@ BEGIN (* PascalIo initialization *)
END; END;
cnt := 0; cnt := 0;
END; END;
notext := NIL; Notext := NIL;
input := ADR(ibuf); Input := ADR(ibuf);
output := ADR(obuf); Output := ADR(obuf);
input^.next := output; Input^.next := Output;
output^.next := NIL; Output^.next := NIL;
head := input; head := Input;
END PascalIo. END PascalIO.