Oberon || Library || Module Index || Search Engine || Definition || Module

Ulm's Oberon Library:


Maps - map a stream into multiple diversions


TYPE Stream = POINTER TO StreamRec;
TYPE StreamRec = RECORD (Streams.StreamRec) END;

PROCEDURE Open(VAR s: Streams.Stream); PROCEDURE AddMap(s: Streams.Stream; begin, end, offset: Streams.Count; to: Streams.Stream); PROCEDURE Valid(s: Streams.Stream; address: Streams.Count) : BOOLEAN;


Maps allows to map address ranges of a stream into other streams with given offsets. Maps.Stream supports all stream operations except trunc provided they are implemented by the underlying diversions. Streams.Close does not cause any of the diversions to be closed.

Open initializes the given stream. As long no maps have been added all read or write operations will fail.

AddMap adds the interval to the set of legal address ranges. An access to a byte inside of this interval is translated by Maps to an access of the stream to at offset + current position - begin. If multiple maps have been added, they are considered in the invocation order of AddMap. Maps differentiates between read and write accesses, i.e. a read-only and a write-only stream may cover the same address range.

Valid returns TRUE if address is a valid address to read from.




Maps does not check for common ranges of multiple maps.
Edited by: borchert, last change: 91/10/10, revision: 1.1, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module