Oberon || Library || Module Index || Search Engine || Definition || Module
PROCEDURE ShortInt(VAR shortint: SHORTINT); PROCEDURE Int(VAR int: INTEGER); PROCEDURE LongInt(VAR longint: LONGINT); PROCEDURE Real(VAR real: REAL); PROCEDURE LongReal(VAR longreal: LONGREAL); PROCEDURE Char(VAR ch: CHAR); PROCEDURE Byte(VAR byte: BYTE); PROCEDURE Line(VAR line: ARRAY OF CHAR); PROCEDURE Ln; PROCEDURE String(VAR string: ARRAY OF CHAR); PROCEDURE Field(VAR string: ARRAY OF CHAR) : BOOLEAN; PROCEDURE ShortIntS(s: Streams.Stream; VAR shortint: SHORTINT); PROCEDURE IntS(s: Streams.Stream; VAR int: INTEGER); PROCEDURE LongIntS(s: Streams.Stream; VAR longint: LONGINT); PROCEDURE RealS(s: Streams.Stream; VAR real: REAL); PROCEDURE LongRealS(s: Streams.Stream; VAR longreal: LONGREAL); PROCEDURE CharS(s: Streams.Stream; VAR ch: CHAR); PROCEDURE ByteS(s: Streams.Stream; VAR byte: BYTE); PROCEDURE LineS(s: Streams.Stream; VAR line: ARRAY OF CHAR); PROCEDURE LnS(s: Streams.Stream); PROCEDURE StringS(s: Streams.Stream; VAR string: ARRAY OF CHAR); PROCEDURE FieldS(s: Streams.Stream; VAR string: ARRAY OF CHAR) : BOOLEAN;
ShortInt, Int, and LongInt read integer values in decimal representation. Integers must conform to following regular expression: "[+-][0-9]+". Preceding white space is skipped.
Real and LongReal read real values according to following syntax:
"[+-]?[0-9]+(\.[0-9]*)?([eEdD][+-]?[0-9]+)?"Leading white space is skipped. Char and Byte read the next character or byte, respectively.
Line reads a complete line (termination either by the line terminator or by the end of stream). The input line without terminating characters is copied to line. Line skips the rest of the line if it does not fit into line and guarantees line to be 0X-terminated. Streams.stdin.count (resp. s.count for LineS) equals the number of characters read including the line terminator. Note that the termination character is not pushed back to the input stream. Ln skips input until the next line termination or end of stream. Like Line, Ln does not push back the line termination character. Streams.stdin.count (resp. s.count for LnS) equals the number of characters read including the line terminator.
String skips input to the first non-white space character. Further input is copied into string until string is filled or white space is read. string is guaranteed to be 0X-terminated and does not contain white space characters. Streams.stdin.count (resp. s.count) equals the number of characters copied into string.
Field returns the next input field into string. Following the UNIX convention of small databases, records are separated by line terminators and fields are delimited either by field separators or line terminators. In normal case, each field separator separates two adjacent fields which allows possibly empty fields. However, field separators that are also whitespace are skipped at the beginning of a field. The resulting string is trimmed in respect to surrounding white space. The terminating field separator is consumed. Field returns FALSE if there are no more fields on the line, i.e. line terminators must be skipped explicitely. The resulting count (Streams.stdin.count resp. s.count) equals the number of characters read. Field skips the rest of the field if it does not fit into string.
LOOP WHILE Read.FieldS(in, field) DO (* process field *) END; IF in.eof OR in.error THEN EXIT END; Read.LnS(in); IF in.count = 0 THEN EXIT END; END;
Oberon || Library || Module Index || Search Engine || Definition || Module