print_message_lines(+Stream,
+Prefix, +Lines)- <Format>-<Args>
- Where Format is an atom and Args is a list of format arguments. 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. This is combined with a subsequent
message that starts with
at_same_lineto complete the line. - at_same_line
- If this appears as first element, no prefix is printed for the first
line and the line position is not forced to 0 (see format/1,
~N). - eol
- End the decorated part of the line: paint the remainder using the
background colour of the message, if it has one, and reset the
attributes. This is used for the last line of a message if that line is
not ended using
nl, for example because it is ended using~Nin a Format element. Resetting matters because a terminal that scrolls while a background colour is in effect paints the newly exposed line with it, which would colour the empty line that follows the message. Without a background colour this element produces no output. - ansi(+Attributes, +Format, +Args)
- This message may be intercepted by means of the hook
prolog:message_line_element/2.
The library
library(ansi_term)implements this hook to achieve coloured output. If it is not intercepted it invokesformat(Stream, Format, Args). - url(Location)
- Print a source location. Location is one of the terms
File:Line:Column,File:LineorFile. When using librarylibrary(ansi_term), this is translated into a hyperlink for modern terminals. - url(URL, Label)
- Print Label. URL is either a real URL or a source
location as accepted by
url(Location)above. When using librarylibrary(ansi_term), this is translated into a hyperlink for modern terminals. Label is one of- An atom or string, which is printed as plain text.
- A term Format
Args, which is handed to format/3.- - A term
ansi(Class, Format, Args), which prints the label using the attributes of Class as well as making it a hyperlink. This is how a predicate reference in a message is both coloured using thecodeclass and linked to its definition.
- nl
- A new line is started. If the message is not complete, Prefix is printed before the remainder of the message.
- begin(Class, Context)
- end(Context)
- The entire message is headed by
begin(Class, Context)and ended byend(Context). This feature is used by, e.g., librarylibrary(ansi_term)to colour entire messages. Class is normally the message kind. The interactive top level usesanswer(Parity)for the messages of kindquerythat show bindings, which stripes the answers of a non-deterministic query. See section 2.5. - <Format>
- Handed to format/3
as
format(Stream, Format,[]). Deprecated because it is ambiguous if Format collides with one of the atomic commands.
Context above is a variable that is bound by the handler
for
begin(Class, Context) and is passed to the elements that
follow it. It allows this handler to restore the decoration of the
message as a whole after an element that installs a decoration of its
own, and to paint the remainder of a line. Its value is opaque: only the
code that implements prolog:message_line_element/2
for begin(Class, Context) may interpret it. If this hook is
not defined, or the output is not a terminal, Context is left
unbound.
To make Context available to the elements that need it,
print_message_lines/3
rewrites the elements nl, flush,
eol and ansi(Attributes, Format, Args) of Lines
into nl(Context), flush(Context), eol(Context)
and
ansi(Attributes, Format, Args, Context) before passing them
to
prolog:message_line_element/2.
A message that is created using prolog:message//1 always uses the short
forms.
See also print_message/2 and message_hook/3.