Message Handling¶
The interaction between YAP and the user relies on YAP's ability to portray messages.
These messages range from prompts to error information. All message processing is performed through the builtin print_message//22, in two steps:
-
The message is processed into a list of commands
-
The commands in the list are sent to the
format//33builtin in sequence.
The first argument to print_message//22 specifies the importance of the message. The options are:
-
errorerror handling -
warningcompilation and run-time warnings, -
informationalgeneric informational messages -
helphelp messages (not currently implemented in YAP) -
queryquery used in query processing (not currently implemented in YAP) -
silent,M,Na,Ar,File, FilePos]], [nl, nl]. messages that do not produce output but that can be intercepted by hooks.
The next table shows the main predicates and hooks associated to message handling in YAP:
An error record comsists of An ISO compatible descriptor of the format
error(error_kind(Culprit,..), In)
In YAP, the info field describes:
-
what() more detauls on the event
-
input_stream, may be one of;
-
loop_stream
-
file()
-
non e
-
prolog_source(_) a record containing file, line, predicate, and clause that activated the goal, or a list therof. YAP tries to search for the user code generatinng the error.
c_source(0), a record containing the line of C-code thhat caused the event. This is reported under systm debugging mode, or if this is user code.
-
stream_source() - a record containg data on the the I/O stream datum causisng the evwnt.
-
user_message () - text on the event.
- print_message/2
- print_message_lines/4
- location:/0
- translate_message/4
- message_to_string/3
- message_hook/4