Go to the first, previous, next, last section, table of contents.
A Wr.T (or "writer") is a character output stream. The
basic operation on a writer is "PutChar", which extends a writer's
character sequence by one character. Some writers (called
seekable writers) also allow overwriting in the middle of the
sequence. For example, writers to random access files are
seekable, but writers to terminals and sequential files are not.
- PROCEDURE PutChar(wr: T; ch: CHAR) RAISES {Failure, Alerted};
- Output "ch" to "wr".
Many operations on a writer can wait indefinitely. For example,
"PutChar" can wait if the user has suspended output to his
terminal. These waits can be alertable, so each procedure that
might wait includes "Thread.Alerted" in its raises clause.
- PROCEDURE PutText(wr: T; t: TEXT) RAISES {Failure, Alerted};
- Output "t" to "wr".
- PROCEDURE PutString(wr: T; READONLY a: ARRAY OF CHAR) RAISES {Failure, Alerted};
- Output "a" to "wr".
- PROCEDURE Seek(wr: T; n: CARDINAL) RAISES {Failure, Alerted};
- Set the current position of "wr" to "n". This is an error if "wr"
is closed.
- PROCEDURE Flush(wr: T) RAISES {Failure, Alerted};
- Perform all buffered operations. That is, set "target(wr) :=
c(wr)". It is a checked runtime error if "wr" is closed.
- PROCEDURE Close(wr: T) RAISES {Failure, Alerted};
- Flush "wr", release any resources associated with "wr", and set
"closed(wr) := TRUE". This leaves "closed(wr)" equal to "TRUE"
even if it raises an exception, and is a no-op if "wr" is closed.
- PROCEDURE Length(wr: T): CARDINAL RAISES {Failure, Alerted};
- PROCEDURE Index(wr: T): CARDINAL;
- PROCEDURE Seekable(wr: T): BOOLEAN;
- PROCEDURE Closed(wr: T): BOOLEAN;
- PROCEDURE Buffered(wr: T): BOOLEAN;
- These procedures return "len(wr)", "cur(wr)", "seekable(wr)",
"closed(wr)", and "buffered(wr)", respectively. "Length" and
"Index" cause a checked runtime error if "wr" is closed; the other
three procedures do not.
Go to the first, previous, next, last section, table of contents.