1 (* Library module defined by the International Standard
2 Information technology - programming languages
3 BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language.
5 Copyright ISO/IEC (International Organization for Standardization
6 and International Electrotechnical Commission) 1996-2021.
8 It may be freely copied for the purpose of implementation (see page
9 707 of the Information technology - Programming languages Part 1:
10 Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *)
12 DEFINITION MODULE STextIO
;
14 (* Input and output of character and string types over default channels. The read result
15 is of the type IOConsts.ReadResults.
18 (* The following procedures do not read past line marks *)
20 PROCEDURE ReadChar (VAR ch
: CHAR);
21 (* If possible, removes a character from the default input stream, and assigns the
22 corresponding value to ch. The read result is set to allRight, endOfLine or
26 PROCEDURE ReadRestLine (VAR s
: ARRAY OF CHAR);
27 (* Removes any remaining characters from the default input stream before the next line
28 mark, copying to s as many as can be accommodated as a string value. The read result
29 is set to the value allRight, outOfRange, endOfLine, or endOfInput.
32 PROCEDURE ReadString (VAR s
: ARRAY OF CHAR);
33 (* Removes only those characters from the default input stream before the next line mark
34 that can be accommodated in s as a string value, and copies them to s. The read result
35 is set to the value allRight, endOfLine, or endOfInput.
38 PROCEDURE ReadToken (VAR s
: ARRAY OF CHAR);
39 (* Skips leading spaces, and then removes characters from the default input stream before
40 the next space or line mark, copying to s as many as can be accommodated as a string
41 value. The read result is set to the value allRight, outOfRange, endOfLine, or
45 (* The following procedure reads past the next line mark *)
48 (* Removes successive items from the default input stream up to and including the next
49 line mark or until the end of input is reached. The read result is set to the value
50 allRight, or endOfInput.
54 (* Output procedures *)
56 PROCEDURE WriteChar (ch
: CHAR);
57 (* Writes the value of ch to the default output stream. *)
60 (* Writes a line mark to the default output stream. *)
62 PROCEDURE WriteString (s
: ARRAY OF CHAR);
63 (* Writes the string value of s to the default output stream. *)