next up previous index
Next: System Interrupt Handlers Up: Events Previous: User-Defined Events   Index


System Event Handlers

In the tables above the default event handlers for all the events are given. Here follows a short description of these handlers. Some of them only print error massages. Those can easily be redefined by the user. Others do more complex things to achieve a certain behaviour of the ECLiPSe system. If those are redefined by the user, this may have unexpected results. Note that the default handler can always be called (even while the active handler is redefined) by using
    error(default(Number), Goal [, Module])
It is therefore not necessary to know the names of the default handlers. Moreover, most of them are not accessible for the user.
close_handler/2
prevents system stream from being closed. If an attempt is made to close a stream that a system stream is redirected to, the system stream is first reset to its standard value.

autoload_handler/3
Load the appropriate library and recall the autoloaded goal.

compare_handler/3
applies arithmetic evaluation to the first two arguments of the goal, then re-calls the culprit goal with the evaluated arguments.

compiler_error_handler/2
prints error message with relevant line, then fails.

compiled_file_handler/2
prints the message about compiled or dumped file, possible with size and time indication

compiler_abort_handler/2
prints the error message with the file name. If it can find out the line number, it is printed as well.

compiler_warning_handler/2
prints error message with relevant line, then succeeds.

delayed_goals_handler/3
prints a list of delayed goals and succeeds.

dynamic_handler/3
retracts all clauses of the predicate that is already dynamic and succeeds.

eof_handler/2
takes the appropriate action for reaching end of file, depending on the culprit goal, e.g. binding the result to end_of_file if the goal was read/1. The handler fails for unknown goals.

error_handler/2
prints the error message and the culprit. Then it raises the event 157 (error exit) which by default aborts via exit_block(abort).

error_handler/3
used for errors inside tools. It is like error_handler/2 but it also prints the module used by the culprit.

integer_overflow_handler/2
redo an overflowed word-sized-integer arithmetic operation with bignums.

locked_access_handler/2
allows certain goals to be executed in spite of the module lock.

macro_handler/3
prints a warning and redefines a macro.

make_array_handler/3
If the error number is 42 (redefining an existing array), it prints the warning, erases the existing array and replaces it by a new one. Otherwise, it calls the default handler.

message_handler/2
prints the error message followed by the second argument onto toplevel_output and succeeds. Note that the second argument is not necessarily the culprit goal, but rather just a string to be printed. This handler is used for events which are not errors.

output_error_handler/2
closes a related stream if necessary and calls system_error_handler/2.

parser_error_handler/1
prints the faulty input line and the corresponding error message, then fails. Used when the culprit is not important and when no abort should occur.

past_eof_handler/2
closes the stream that has been read past end of file, then calls error_handler/2.

system_error_handler/2
gets the operating system error number (from errno) and prints the corresponding error message. Then it raises the event 157 (error exit) which by default aborts via exit_block(abort).

undef_array_handler/3
If the culprit was setval/2 with an atom as first argument, a local non-logical variable of that name is created using variable/1 and the culprit is re-called. Otherwise like error_handler/2.

undef_dynamic_handler/3
when a non-dynamic clause has been asserted, it makes it dynamic (if possible), then asserts it.

warning_handler/2
prints the error message and the culprit and succeeds.


next up previous index
Next: System Interrupt Handlers Up: Events Previous: User-Defined Events   Index
Warwick Harvey
2002-05-15