[not loaded]
messages.pl
translate_message(+Term)// is det- Translate a message Term into message lines. The produced lines
is a list of
- nl
- Emit a newline
- Fmt - Args
- Emit the result of
format(Fmt, Args) - Fmt
- Emit the result of
format(Fmt) - ansi(Class, Fmt, Args)
- Use ansi_format/3 for color output.
- url(Location)
- Emit a source location as a hyperlink. Location is File:Line:Column, File:Line, File or a URL.
- url(Location, Label)
- As above, but print Label rather than Location. Label is
plain text, Fmt-Args or
ansi(Class, Fmt, Args), the latter combining a hyperlink with a style class. - flush
- Used only as last element of the list. Simply flush the output instead of producing a final newline.
- at_same_line
- Start the messages at the same line (instead of using ~N)
- eol
- End the decorated part of the last line. See print_message_lines/3.
The elements
begin(Class, Ctx)andend(Ctx)that decorate the message as a whole are added by print_message_lines/3.Use predicate_reference//1,2 to refer to a predicate rather than formatting the predicate indicator by hand.
translate_message(+Term)// is det- Translate a message term into message lines. This version may be called from user and library definitions for message translation.
term_message(+Term)//- Deal with the formal argument of
error(Format, ImplDefined)exception terms. The ImplDefined argument is handled by swi_location//2.
permission_error(Action, Type, Object)//[private]- Translate permission errors. Most follow te pattern "No permission to Action Type Object", but some are a bit different.
tabling_existence_error(+Ball, +Context)//[private]- Called on invalid shift/1 calls. Track those that result from tabling errors.
dwim_predicates(+PI, -Dwims)[private]- Find related predicate indicators.
swi_location(+Term)// is det- Print location information for
error(Formal, ImplDefined)from the ImplDefined term.
swi_extra(+Term)// is det[private]- Extract information from the second argument of an
error(Formal, ImplDefined)that is printed after the core of the message.
prolog_message(+Term)//[private]
user_predicate_indicator(+QPI, -PI) is det[private]- Remove the module qualification from QPI if it does not add information for the user. This is the single module hiding policy of this file. See also predicate_reference//2.
- out_of_c_stack[private]
- The thread's C-stack limit was exceeded. Give some advice on how to resolve this.
extra_line// is det[private]- End the answer and, if
toplevel_extra_white_lineis true, add an empty line. The~Ncannot be replaced bynlbecause the answer is not always left at a non-empty line. Theeolelement paints the remainder of the line if the message has a background colour, which~Ncannot do as it is written using format/3.Note that
eolends the last line of the answer. The empty line that separates the answer from the next query is not part of the answer and keeps the default background.
user_version_messages(+Terms)//[private]- Helper for the
welcomemessage to print information registered using version/1. - user_version_message(+Term)[private]
predicate_list(+Specs)// is det[private]- Emit a list of predicates, one per line, each tagged with its kind. See predicate_reference//2.
goal_style(+Port, -Style) is det[private]- Style is the colour class used for the goal of a frame that is being
reported for Port. It is a term
goal(Port, Parity), which allows themes to decorate the goal depending on the port, on the parity of the step count (striping, which separates the steps of a trace visually) or both. See also '$answer_class'/1, which does the same for the answers of the interactive toplevel.
predicate_goal(+Goal, +Port)// is det[private]- Emit Goal, linking it to the definition of its predicate. Used if we have no frame, i.e., for the messages of library(prolog_trace).
frame_location(+Frame, -Location) is semidet[private]- Location is
File:Linefor the call site of Frame, i.e., the place in the clause of the parent frame from which Frame was called. This is the position the user is at while tracing. If we cannot find it, fall back to the clause that runs in Frame and finally to the file that defines the predicate.Resolving the call site uses library(prolog_stack), which has to run the decompiler and read the source file. This is affordable for an interactive tracer, but we only do it if the location can actually be used, i.e., if hyperlinks are rendered. See goal_links/0.
goal_links is semidet[private]- True when goals printed by the debugger should be linked to their
source location. Controlled by the flag
debugger_goal_links, which is one oftrue,falseorauto. Usingauto(default) we create the links if the console can render them.
message_lang(-Lang) is multi[private]- True when Lang is a language id preferred for messages. Starts with
the most specific language (e.g.,
nl_BE) and ends withen.
current_message_lang(-Lang) is det[private]- Get the current language for messages.
predicate_indicator(+Spec, -QPI) is semidet- QPI is the fully qualified predicate indicator
Module:Name/Arityor, for a non-terminal,Module:Name//Arityfor Spec. Spec is one of- A callable term (a head), optionally module qualified
- A predicate indicator, optionally module qualified
The module is kept here. Whether or not it is printed is left to predicate_reference//2, which uses user_predicate_indicator/2.
dcg_indicator(+Module, +PI, -QPI) is det[private]- Qualify PI with Module and use the
//notation if the predicate is a non-terminal.
predicate_head(+Spec, -QHead) is semidet[private]- QHead is the module qualified head for Spec, accepting the same
input as predicate_indicator/2. Unqualified specs are qualified
using
user.
predicate_reference(+Spec)// is det
predicate_reference(+Spec, +Options)// is det- Emit a reference to a predicate. Spec is a (possibly qualified)
head or predicate indicator. The reference is printed using the
style class
codeand, if the location of the predicate is known and the output is a terminal that supports it, it is a hyperlink to the definition. Options:- module(+Which)
- One of
auto(default),hideorshow. Usingauto, the module qualification is removed if hidden_module/1 holds for it. - link(+Bool)
- If
false, do not try to create a hyperlink. Defaulttrue. - style(+Class)
- Style class for the reference. Default
code. - tag(+Bool)
- If
true, add a tag that indicates the kind of predicate. See predicate_kind/2. Defaultfalse. Only sensible if the reference is the only thing on the line.
If Spec cannot be interpreted as a predicate it is printed using the
codeclass and~p, i.e., we never fail on a malformed message.
pref_option(?Option, +Options, +Default) is semidet[private]- Get an option from the option list of predicate_reference//2. Fails
if Options holds a value for Option that does not unify. Note that
this deliberately does not use library(option):
boot/messages.plmust be able to print a message before the libraries are available.
predicate_location(+Spec, -Location) is semidet- Location is
File:Linefor the definition of the predicate Spec. Also deals with predicates defined in C. Note that predicates that are not loaded but can be autoloaded are located from the autoload index, i.e., printing a message never loads a library.
predicate_definition(+Spec, +Message)// is det- Emit "Message at File:Line" on a new line if the location of Spec is known and nothing at all if it is not.
predicate_kind(+Spec, -Kind) is semidet- Classify a predicate for the benefit of the user who has to pick one
from a list of candidates. Fails if Spec is not a predicate. Kind
is one of
- iso
- built_in
- foreign
library(Name)module(Module)- user
- undefined
library_file(+File) is semidet[private]
library_name(+File, -Name) is det[private]- True if File is in one of the library directories and, if so, Name
is how the file is referred to as
library(Name).
predicate_reference_tag(+QPI, +Options)// is det[private]
predicate_kind_tag(+Kind)// is det[private]- Emit the kind of the predicate as a short tag.
current_theme(-Theme) is det- Theme is the theme that defines the console colours (see
prolog:console_color/3). This is the value of the Prolog flag
theme, unless this isdefaultorauto. In that case it is the theme of a loaded theme file, e.g., a file loaded from the init file or by library(theme/auto). If no theme file is loaded, Theme isdefault.
theme_ancestor(+Theme, -Ancestor) is nondet- Ancestor is Theme or a theme Theme is based on, nearest first. A theme is based on another theme using the multifile hook prolog:theme_base/2. A theme uses the settings of its base theme that it does not define itself.
print_message(+Kind, +Term)- Print an error message using a term as generated by the exception system.
print_system_message(+Term, +Kind, +Lines)[private]- Print the message if the user did not intecept 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.
msg_context(+Prefix0, -Prefix) is det[private]- Add contextual information to a message. This uses the Prolog flag
message_context. Recognised context terms are:- time
time(Format)- thread
In addition, the hook message_prefix_hook/2 is called that allows for additional context information.
print_message_lines(+Stream, +PrefixOrKind, +Lines)- Quintus compatibility predicate to print message lines using
a prefix.
If PrefixOrKind is
kind(Kind), the message as a whole may be decorated. To this end the lines are wrapped inbegin(Class, Ctx)andend(Ctx), where Class is derived from Kind using msg_color_class/2. Ctx is a variable that is bound by whoever implements prolog:message_line_element/2 for begin/2 (normally library(ansi_term)) and remains unbound if the decoration is not available, e.g., because Stream is not a terminal.The elements that need Ctx are rewritten by prefix_nl/4 to carry it. See there for the details.
msg_color_class(+Kind, -Class) is det[private]- Colour class used to decorate an entire message of the given Kind.
Defaults to Kind itself, which is mapped to
message(Kind)(see level_attrs/2).
insert_prefix(+Lines, +Prefix, ?Ctx, -PrefixedLines) is det[private]- Add Prefix to the start of each line of Lines. If the first element
is
at_same_linethe message continues the line and no initial prefix is added. Ctx is the message context; see prefix_nl/4 and print_message_lines/3.
prefix_nl(+Lines, +Prefix, ?Ctx, -Lines) is det[private]- Insert Prefix after each
nland make the message context Ctx available to the elements that need it:- nl, flush and eol become
nl(Ctx),flush(Ctx)andeol(Ctx). Their handler writes the sequence that paints the remainder of the line before ending it if the message has a background colour. ansi(Attrs, Fmt, Args)becomesansi(Attrs, Fmt, Args, Ctx). Its handler re-installs the decoration of the message as a whole after writing the element, as the element ends with a full reset. The same applies to an ansi/3 element used as the label of an url/2 element.
The last line of a message is ended implicitly: if Lines does not end in
nlorflushannlis added. This one does not paint: what follows the message is not part of it. A message that wants its last line painted ends it usingeol. - nl, flush and eol become
print_message_lines(+Stream, +Lines)[private]
link_label(+Label, -Format, -Args) is det- Decompose the label of an url/2 message element. See url/2 in
print_message_lines/3. Note that a plain label is text rather than
a format: it typically holds a file name, which may contain
~.
safe_format(+Stream, +Format, +Args) is det[private]
message_to_string(+Term, -String)- Translate an error term into a string
print_once(Message, Level)[private]- True for messages that must be printed only once.
must_print(+Level, +Message)[private]- True if the message must be printed.