$a include=template_file $n$lm Imp Core Environment Standard $b2$lm Section 2: Event Signalling $a sectno=2; pageno=1 $a indent=0 $v5$p Central to the IMP language and its environment is a mechanism for reporting and handling exceptional circumstances which may occur during the execution of a program. These exceptions (called %events by IMP) may be %signalled in two ways. Firstly, the programmer may use an explicit %signal statement: this technique is often used to report errors from libraries and packages such as the EDWIN graphics package. The definition of the IMP environment in this standard contains several examples of this: an event is signalled on an attempt to read characters past the end of a file, for example. The second possibility for an event being signalled is as a result of an error condition being detected by the underlying hardware or operating system. Most implementations of IMP attempt to translate such hardware exceptions as floating-point overflow into a corresponding event. $v5$p Note that this section of the core environment standard is intended to define and standardise the event mechanism as it is currently implemented. Alternate proposals and extensions are being considered in another document by Alan Culloch of Lattice Logic, Document$_IMP$_Signals. Furthermore, details of the propagation of events and other language-related issues are to be found in the language manual rather than in this standard. $a indent=1 $B4$v5$t0 * $t %record %format Event FM ( $.$.$. {see text} $.$.$. ) $p The pre-declared record format EVENT FM must contain the following field definitions: $b$v4$l0 %integer Event %integer Sub %integer Extra _s_t_r_i_n_g(255) Message $b0 $b Note that the exact definition of the EVENT$ FM record format is implementation defined (DEF0002; definition of EVENT$ FM). Thus the order of these fields within the record format is also implementation defined. In addition, a conforming implementation is free to include other fields within this record format for its own purposes, although if it does so a method must be available to specify that the implementation reject use of such identifiers as non-standard. This condition is a special case of the general rule concerning "extension" identifiers given in section 1.3.2 on implementation conformance. $B4$v5$t0 * $t _r_e_c_o_r_d(Event Fm) Event$B0 $p A single record of type EVENT$ FM is pre-declared.