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


Ulm's Oberon Library:
Listers


NAME

Listers - general interface for listers of compilation errors

SYNOPSIS

TYPE WriteLineProc =
   PROCEDURE (out: Streams.Stream;
	      line: Streams.Stream;
	      lineNumber, lineNumberWidth: Streams.Count;
	      m1begin, m1end, m2begin, m2end: Streams.Count) : BOOLEAN;
TYPE WriteMsgProc = PROCEDURE (out, msg: Streams.Stream) : BOOLEAN;
TYPE Interface = POINTER TO InterfaceRec;
TYPE InterfaceRec =
   RECORD
      (Objects.ObjectRec)
      writeLine: WriteLineProc;
      writeMsg: WriteMsgProc;
   END;


PROCEDURE Init(out: Streams.Stream; if: Interface);

PROCEDURE GenListing(out: Streams.Stream; errors: RelatedEvents.Object);

DESCRIPTION

Listers processes events of compilation errors (see CompilerErrors) by integrating source excerpts, marking relevant parts of the source, and printing error messages using a general interface.

Init ties an interface if to an output stream for the listing generation. The interface is expected to meet the specification following:

writeLine: PROCEDURE(out: Streams.Stream; line: Streams.Stream; lineNumber, lineNumberWidth: Streams.Count; m1begin, m1end, m2begin, m2end: Streams.Count) : BOOLEAN;
print line number lineNumber with a maximal width of lineNumberWidth, print one line of source text from line, a sub-stream (see SubStreams) representing just one line, and mark the stretches specified by the relative positions [m1begin, m1end) and [m2begin, m2end). Stretches are to be ignored if their relative positions equal -1. FALSE is to be returned in case of errors.

writeMsg: PROCEDURE(out: Streams.Stream; msg: Streams.Stream) : BOOLEAN;
copy error message from msg to out. Note that writeMsg is free to integrate textual marks within the error message if this was not done by writeLine. In this case, the relative positions passed before to writeLine must be preserved using disciplines (see Disciplines) that are attached to the output stream. FALSE is to be returned in case of errors.

If Init is not called for an output stream, a default implementation will be used instead that is not able to mark stretches.

GenListing extracts all error events that are an extension of CompilerErrors.ErrorEvent from errors using CompilerErrors.GetSortedErrors and prints them in an integrated form, using the interface passed to Init previously:

DIAGNOSTICS

Listers does not generate any error events itself but error events may be raised by underlying stream implementations of a source or output stream.

SEE ALSO

CompilerErrors
standardized events for compilation errors
TerminalListers
implementation of Listers that is based upon Terminals

Edited by: borchert, last change: 2000/05/29, revision: 1.1, converted to HTML: 2000/05/29

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