next node: BasicIO,
prev node: LineFormat,
up to node: Subsystem Streams


Stream

This structure contains basic commands for stream I/O. These functions are not dependent on the operating system.

Signature of Stream

List of Import References :
See BOOL
See Char
See Com
See DENOTATION
See File
See Int
See Nat
See Option
See Seq
See String
See Void

SIGNATURE Stream

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

IMPORT  Nat             ONLY nat
        Void            ONLY void            
        Char            ONLY char            
        String          ONLY string        
        Seq[string]     ONLY seq
        Com[bool]       ONLY com
        Com[void]       ONLY com
        Com[char]       ONLY com
        Com[denotation] ONLY com
        Com[string]     ONLY com
        Com[seq]        ONLY com
        Com[input]      ONLY com
        Com[output]     ONLY com

Sorts

SORT input output

Standard Streams

FUN stdIn               : input
    stdOut stdErr       : output

Input Streams

Opening and Closing Input Streams

Open named file; close input stream

FUN open                : denotation -> com[input] 
    close               : input -> com[void]

Reading

Read a character, at most n characters, or all characters which fulfill a certain predicate

FUN read                : input -> com[char] 
FUN read                : input ** nat -> com[string]
FUN read                : input ** (char -> bool) -> com[string]

Read next line from, drop newline character

FUN readLine            : input -> com[string]

Read whole text stream or named file as a sequence of lines

FUN readLines           : input -> com[seq[string]]
FUN load                : denotation -> com[seq[string]]

Information

Look at next character to be read

FUN look                : input -> com[char]

End of input stream reached?

FUN eos?                : input -> com[bool]

Output Streams

Opening and Closing Output Streams

Create named output stream

FUN create              : denotation -> com[output]

Append to existing named output stream (or create if not existing)

FUN append              : denotation -> com[output]

Close & make permanent

FUN close               :  output -> com[void]

Writing

write argument to output stream

FUN write               : output ** char -> com[void]
    write               : output ** denotation -> com[void]
    write               : output ** string -> com[void]

write argument as line to output stream

    writeLine           : output ** denotation -> com[void]
    writeLine           : output ** string -> com[void]

write sequence of lines to named file

    writeLines          : output ** seq[string] -> com[void]
    store               : denotation ** seq[string] -> com[void]

not for user purpose

representation

IMPORT  File ONLY file
FUN abs : file -> input
FUN rep : input -> file
FUN abs : file -> output
FUN rep : output -> file


next node: BasicIO,
prev node: LineFormat,
up to node: Subsystem Streams