Copyright (C) 1994, Digital Equipment Corp.The
IO interface provides textual input and output for simple
programs. For more detailed control, use the interfaces Rd,
Wr, Stdio, FileRd, FileWr, Fmt, and Lex.
The input procedures take arguments of type Rd.T that specify
which input stream to use. If this argument is defaulted, standard
input (Stdio.stdin) is used. Similarly, if an argument of type
Wr.T to an output procedure is defaulted, Stdio.stdout is used.
INTERFACEIO ; IMPORT Rd, Wr; PROCEDURE Put(txt: TEXT; wr: Wr.T := NIL);
Outputtxttowrand flushwr.
PROCEDURE PutInt(n: INTEGER; wr: Wr.T := NIL);
OutputFmt.Int(n)towrand flushwr.
PROCEDURE PutReal(r: REAL; wr: Wr.T := NIL);
OutputFmt.Real(r)towrand flushwr.
PROCEDURE EOF(rd: Rd.T := NIL): BOOLEAN;
ReturnTRUEiffrdis at end-of-file.
EXCEPTION Error;The exception
Error is raised whenever a Get procedure
encounters syntactically invalid input, including unexpected
end-of-file.
PROCEDURE GetLine(rd: Rd.T := NIL): TEXT RAISES {Error};
Read a line of text from rd and return it. A line of text is either zero or more characters terminated by a line break, or one or more characters terminated by an end-of-file. In the former case,
GetLine consumes the line break but does not
include it in the returned value. A line break is either {\tt
"\n"} or {\tt
"\r\n"}.
PROCEDURE GetChar(rd: Rd.T := NIL): CHAR RAISES {Error};
Read the next character from rd and return it.
PROCEDURE GetInt(rd: Rd.T := NIL): INTEGER RAISES {Error};
Read a decimal numeral fromrdusingLex.Intand return its value.
PROCEDURE GetReal(rd: Rd.T := NIL): REAL RAISES {Error};
Read a real number fromrdusingLex.Realand return its value.
PROCEDURE OpenRead(f: TEXT): Rd.T;
Open the file nameffor reading and return a reader on its contents. If the file doesn't exist or is not readable, returnNIL.
PROCEDURE OpenWrite(f: TEXT): Wr.T;
Open the file namedffor writing and return a writer on its contents. If the file does not exist it will be created. If the process does not have the authority to modify or create the file, returnNIL.
END IO.