Next: DirectoryFile
Up: simlib
Previous: UnsafeConversion
Character_IO
NAME
character_io - perform raw character by character I/O to
terminals.
DESCRIPTION
Contains routines to perform raw terminal I/O, character by
character with no echo or tab substitution.
EXAMPLE
external class Character_IO= simlib/character_io";"
ref(Character_IO) TTY;
TTY:-new Character_IO;
TTY.open;
while true do
TTY.output(TTY.input); ! -- This will echo each
character as is. ;
AUTHOR
Per Holm, Lund University.
DETAILED INTERFACE
class Character_IO;
Perform character by charcter I/O to the terminal, bypassing
sysin/sysout. The characters are read without echo and
written directly, no expanssion of tabs etc are done. The
routins are used to write programs making interactive use of
Vt100-type terminals. When these routines are used normal
I/O should not be used.
Supers: -
Kind: Instantiable
Init: -
Sequencing: (Open (Input/Output/OutString)* Close)*
OPERATIONS
Open
procedure Open;
Must be called before any I/O operation. Will terminate the
program if it can not be performed.
Close
procedure Close;
Called to reset the terminal to normal operation. Should be
called before Sysin/sysout I/O is preformed or the program
is terminated.
Input
character procedure Input;
Wait until the user hits a key, then return the ASCII
equivelent. There is no automatic echoing on the terminal.
Output
procedure Output(Ch); character Ch;
Send the character Ch the the terminal as unprocessed as
possible.
OutString
procedure OutString(T,Length);
text T; integer Length;
Send the first Length characters of T to the terminal. This
operation is equivalent to, but more efficient than,
repeated calls to Output.