Types
8-bit unsigned integer, 0..255.
Variables
TRUE after every Open, FALSE after the first error.
Done indicates the success of an input operation. If Done is TRUE after an input operation, the operation was successful and its result is valid. An unsuccessful input operation sets Done to FALSE; it remains FALSE until the next call to Open. In particular, Done is set to FALSE if an attempt is made to read beyond the end of the input stream.
Procedures
Initialization
Puts in x
the byte at the current position
Puts in ch
the character at the current position. May read 1 to 4 bytes if decoding from UTF-8 (on Linux/Unix and on Windows if input is redirected).
Returns 64-bit integer at the current position according to the format:
IntConst = [-] (digit {digit} | digit {hexDigit} "H").
Returns 32-bit integer in the same way as HugeInt does
Returns 16-bit integer in the same way as HugeInt does
Reads a line of characters until CR, LF or end of file
Alias for Int. Does the same thing.
Reads and puts in x
a 64-bit real number (LONGREAL) in format:
["-"] digit {digit} [{digit} ["E" ("+" | "-") digit {digit}]].
Reads the name s
at the current position according to the file name format of the operating system (e.g. "lib/My.Mod" under Unix). Skips the 0AX in the end (if any).
Open sets the current position to the beginning of the input stream. Done indicates if the operation was successful.
Note that on Windows or Linux/Unix rewind may not be possible. Also on these OS Open is not strictly required before any other operation.
Reads and puts in x
a 32-bit real number (REAL) in format:
["-"] digit {digit} [{digit} ["E" ("+" | "-") digit {digit}]].
Reads a string literal and puts it in s
.
A string literal is a quoted sequence of characters that may include spaces but not other whitespaces (tabs, new lines etc.). The quotes can be single or double quotes. The string must begin and end with the same quotation marks.
Reads a word and put it in s
.
Skips whitespaces, reads characters until the next whitespace and puts the read word in s
, then skips whitespaces until the next non-whitespace or a new line character. Skips the new line character.
Module In provides a set of basic routines for formatted input of characters, character sequences, numbers, and names. It assumes a standard input stream with a current position that can be reset to the beginning of the stream (but may not always do so on Linux/Unix or Windows).
Module In as in Oakwood Guidlines for Oberon-2 Compiler Developers, 1995.
With the following changes:
LongInt, Int, Int16 read and parse minus signs first.
Char reads a 2-byte character. On Linux it decodes input as UTF-8. On Windows it uses ReadConsoleW WinAPI call if console is attached, otherwise ReadFile is used and input is decoded from UTF-8.
Open may not rewind.
Extra procedures: Line, HugeInt, Int16.