IMP Events

Preamble

Synchronous Events in Imp 2.0 et seq as proposed April 1984

How to signal and trap them

Events may be signalled by the system or by the user (using %SIGNAL in IMP) and trapped in am IMP program by the %ON %EVENT.. construction.

%on %event <eventno>, <eventno>, ..... %start
...
finish

"%event" is optional in the statement above.

Once the event has been trapped, further information may be obtained by interrogating the built-in record EVENT..

%recordformat eventfm(%byte event,sub,%short line,%integer extra,
%string(255)message,%integerarray r(0:15))

where sub and extra have the meanings defined in a later section.

Caveats

In general, reliance should not be placed on the detailed distinctions made by the EVENT_SUB field: the EVENT_MESSAGE field provides a textual explanation for the occurrence of the event.

The differences between the new scheme and the old one are..

There are some changes in the detailed meaning of some sub-events. Event 9 is now reserved strictly for End-of-Input. Filestore failures are handled by Event 3. Events 3 and 4 switch meanings.

The reversal of the significance of events 3 and 4 compared with EMAS IMP was unintended in IMP - 77. The re-reversal shown above corrects this in the interests of goodwill.

Event Numbering

The event numbering is presented below as follows: The event NUMBER is specified in the title of each page. Each page contains a list of SUB-event numbers, and, where relevant, explains the meaning of the EXTRA field.

Event 0: Program Termination

0    -       normal termination (%stop)
1    -       forced termination (^Y)
2    a       Bus Error:
             Attempt to access an operand at non-existant location a.
3    a       Address Error:
             Attempt to access a non-byte operand at odd address a.
4    -       Illegal Instruction        /  Usually a result of the
5    -       Reserved Exception or Trap /  program being corrupted
8    -       Using a privileged instruction while in user mode.

Event 1: Overflow

1    -       integer overflow
2    -       real overflow
3    -       string overflow (more than 255 characters)
4    -       division by zero

Event 2: Resource exceeded

1    -       store space exhausted
2    -       output limit exceeded
3    -       time limit exceeded

Event 3: Input/Output Error

1    -       data transmission error
2    -       timeout
3   code     failure to open file
4   code     failure on other file system operation

Event 4: Input Data Type Error

1   char     non - numeric char for numeric input

Event 5: Invalid arguments

1    -       invalid values for %for loop
2   culprit  illegal exponent for exponentiation
3    -       upper bound less than lower in array declaration

Event 6: Range error

1   value    value outside range of destination/result
2   index    array index out of bounds
3   index    switch index out of bounds (if distinguished from 2)

Event 7: String resolution failure

No additional information supplied.

Event 8: Undefined Value

1    -       unassigned variable (value or pointer)
2   index    switch to undefined label
3    -       %for loop variable corrupt

Event 9: End of Input

This event is no longer signalled for miscellaneous I/O errors such as "invalid stream number or "file not found", but is reserved exclusively for attempting to read past the end of a file. No additional information supplied.

Event 10: Library Procedure error

This is generated by certain utility libraries, such as Edwin. The SUB and EXTRA meanings are defined in the documentation relating to the libraries concerned.

Events 11 to 15

These numbers are not used by system components or standard libraries, and are intended for general purpose use by the programmer.

view:events printed on 16/02/89 at 16.49

APM Manual pages