YAP 7.1.0

The interaction between YAP and the user relies on YAP's ability to portray messages. More...

Detailed Description

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/2 , in two steps:

The first argument to print_message/2 specifies the importance of the message The options are:

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(errror_kind(Culprit,..), In)

In YAP, the info field describes:

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


Class Documentation

◆ message_to_string/2

class message_to_string/2

message_to_string(+ Term, - String)

Translates a message-term into a string object Primarily intended for SWI-Prolog emulation

◆ translate_message/3

class translate_message/3

translate_message(+Term, +Lines, -Lines0)

properties: deterministic

% % Print the message if the user did not intercept the message % The first is used for errors and warnings that can be related % to source-location Note that syntax errors have their own % source-location and should therefore not be handled this way

◆ print_message_lines/3

class print_message_lines/3

print_message_lines(+ Stream, + Prefix__, + _Lines)

Print a message (see print_message/2 ) that has been translated to a list of message elements The elements of this list are:

  • Format-_Args_ Where Format is an atom and Args is a list of format argument Handed to format/3
  • flush If this appears as the last element, stream is flushed (see flush_output/1 ) and no final newline is generated
  • at_same_line If this appears as first element, no prefix_ is printed for the line and the line-position is not forced to 0 (see format/1 , ~N)
  • prefix_(Prefix_) define a prefix_ for the next line, say ‘’'` will be seen as an empty prefix_ (see format/1 , ~N)+ <Format> Handed to format/3 as format(Stream, Format, []), may get confused with other commands
  • nl A new line is started and if the message is not complete the _Prefix__ is printed too

Definition at line 1 of file messages.yap.

◆ print_message/2

class print_message/2

print_message(+ Severity, +Term)

The predicate print_message/2 is used to print messages, notably from exceptions, in a human-readable format Kind is one of informational, banner, warning, error, help or silent In YAP, the message is always outut to the stream user_error

If the Prolog flag verbose is silent, messages with Kind informational, or banner are treated as silent See -q in [Running_YAP_Interactively]

4This predicate first translates the Term into a list of message lines (see print_message_lines/3 for details) Next it will call the hook message_hook/3 to allow the user intercepting the message If message_hook/3 fails it will print the message unless Kind is silent

If you need to report errors from your own predicates, we advise you to

stick to the existing error terms if you can; but should you need to invent new ones, you can define corresponding error messages by asserting clauses for prolog:message/2 You will need to declare the predicate as multifile/1

Note: errors in the implementation of print_message/2 are very confusing to YAP (who will process the error?) So we write this small stub to ensure everything os ok