# B Narrators and Listeners

## B.1 The `Narrator` Module

The `Narrator` module, located at `x-oz://system/Narrator`, exports the class `Narrator.'class'` with the following methods.

Methods

`init(``?PrivateNarratorO``)`

`register(``+Port``)`

`newListener(``+Port``)`

`unregister(``+Port``)`

`tell(``X``)`

### The `PrivateNarrator` Class

Methods

`setLogPhases(``+B``)`

`setMaxNumberOfErrors(``+I``)`

`tell(``X``)`

`startBatch()`

`startPhase(``+V``)`

`startSubPhase(``+V``)`

`endBatch(``+A``)`

`error(coord:` `+Coord``<= unit
kind:` `+KindV``<= unit
msg:` `+MsgV``<= unit
items:` `+Ts``<= unit
abort:` `+B``<= true)`

`warn(coord:` `+Coord``<= unit
kind:` `+KindV``<= unit
msg:` `+MsgV``<= unit
items:` `+Ts``<= unit)`

`hasSeenError(``?B``)`

## B.2 The `Listener` Module

The `Listener` module, located at `x-oz://system/Listener`, exports the class `Listener.'class'` with the following methods.

Methods

`init(``+NarratorO``` `+ServeL``)`

  initializes a listener with a narrator and the label of a unary method. The listener creates a port, registers this with `NarratorO`, and creates a thread in which the `ServeL` method is applied to the port's stream.

`close()`

  undoes all effects of the `init` method: The server thread is terminated and the listener's port is unregistered.

`getNarrator(``?NarratorO``)`

  returns the narrator with which the listener's port is currently registered.

`getPort(``?Port``)`

  returns the associated port.

## B.3 The `ErrorListener` Module

The `ErrorListener` module, located at `x-oz://system/ErrorListener`, exports the class `ErrorListener.'class'` with the following methods.

Methods

`init(``+NarratorO``` `+ServeOneL``<= unit` `?VerboseL``<= false)`

`reset()`

`setVerbosity(``+L``)`

`hasErrors(``?B``)`

`isActive(``?B``)`

`getVS(``?B``)`

`getMessages(``?Xs``)`

`formatMessages(``+Xs``` `?V``)`