next node: BinStream,
prev node: Stream,
up to node: Subsystem Streams


BasicIO

This structure provides functions for more convenient control of input and output.

Signature of BasicIO

List of Import References :
See BOOL
See Char
See Com
See DENOTATION
See Int
See Nat
See Option
See Pair
See Real
See Seq
See Void

SIGNATURE BasicIO

$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)

IMPORT Nat ONLY nat
       Char ONLY char
       Int ONLY int
       Real ONLY real
       Void ONLY void
       Com[void] ONLY com
       Pair[denotation, com[void]] ONLY pair
       Seq[pair] ONLY seq
       Com[bool] ONLY com
       Com[nat] ONLY com
       Com[int] ONLY com
       Com[real] ONLY com
       Com[char] ONLY com
       Com[denotation] ONLY com

Input

There are prompting input functions for basic types.

FUN ask: denotation -> com[bool]
FUN ask: denotation -> com[nat]
FUN ask: denotation -> com[int]
FUN ask: denotation -> com[real]
FUN ask: denotation -> com[char]
FUN ask: denotation -> com[denotation]

Output

Shortcuts which will always write to stdOut.

FUN write: denotation -> com[void]
FUN write: bool -> com[void]
FUN write: nat -> com[void]
FUN write: int -> com[void]
FUN write: real -> com[void]
FUN write: char -> com[void]

FUN writeLine: denotation -> com[void]
FUN writeLine: bool -> com[void]
FUN writeLine: nat -> com[void]
FUN writeLine: int -> com[void]
FUN writeLine: real -> com[void]
FUN writeLine: char -> com[void]

Menu for choosing commands: menu(title, item1 & com1 :: item2 & com2 :: ... :: <>) prints the title and offers the user to choose from a list of item1, item2, ... or to stop. If the user chooses an item the corresponding command is called, and then again the menu.

FUN menu: denotation ** seq[pair[denotation, com[void]]] -> com[void]

produce a sound

FUN beep: com[void]

Commands

Repeat a command forever.

FUN repeat: com[void] -> com[void]

Call command, ask with prompt whether it shall be repeated. Prompt should end with a space, because it is augmented with "(y/n)".

FUN repeatAsk: denotation ** com[void] -> com[void]


next node: BinStream,
prev node: Stream,
up to node: Subsystem Streams