Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Location =
   RECORD
      (Objects.ObjectRec)
      (* location in input stream *)
      line, pos: Streams.Count; (* both starting from 0 *)
      offset: Streams.Count;
   END;
CONST streamNotScannedYet = 0;
CONST lineNumberOutOfRange = 1;
CONST positionOutOfRange = 2;
CONST invalidPos = 3;
CONST errorcodes = 4;
TYPE ErrorEvent = POINTER TO ErrorEventRec;
TYPE ErrorEventRec =
   RECORD
      (Events.EventRec)
      errorcode: SHORTINT;
   END;
VAR error: Events.EventType;
VAR errormsg: ARRAY errorcodes OF Events.Message;
PROCEDURE Scan(s: Streams.Stream);
PROCEDURE Scanned(s: Streams.Stream) : BOOLEAN;
PROCEDURE ConvertPos(s: Streams.Stream; pos: Streams.Count;
                     VAR loc: Location);
PROCEDURE ConvertLoc(s: Streams.Stream; loc: Location;
                     VAR pos: Streams.Count);
PROCEDURE SetPos(s: Streams.Stream; loc: Location);
PROCEDURE GetPos(s: Streams.Stream; VAR loc: Location);
PROCEDURE NumberOfLines(s: Streams.Stream) : Streams.Count;
Scanned returns TRUE if the given stream has been scanned yet by Lines.
ConvertPos takes a stream offset and converts it into a line/column tuple. Please note that line numbers (component line) and columns (component pos) are counted from 0. The given stream offset must not point inside a line terminator or beyond the stream length. ConvertLoc takes a location and converts it into an absolute stream position.
Lines offers the operations GetPos and SetPos which are similar to those of Streams but take a location instead of an absolute stream position.
NumberOfLines returns the number of lines which have been found by Scan.
Oberon || Library || Module Index || Search Engine || Definition || Module