| Did you know ... | Search Documentation: |
| messages.pl |
translate_message(+Term)// is detformat(Fmt, Args)format(Fmt)ansi(Class, Fmt, Args), the latter
combining a hyperlink with a style class.
The elements begin(Class, Ctx) and end(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
term_message(+Term)//error(Format, ImplDefined)
exception terms. The ImplDefined argument is handled by
swi_location//2.
permission_error(Action, Type, Object)//[private]
tabling_existence_error(+Ball, +Context)//[private]
dwim_predicates(+PI, -Dwims)[private]
swi_location(+Term)// is deterror(Formal, ImplDefined) from the
ImplDefined term.
swi_extra(+Term)// is det[private]error(Formal,
ImplDefined) that is printed after the core of the message.
prolog_message(+Term)//[private]
user_predicate_indicator(+QPI, -PI) is det[private]
extra_line// is det[private]toplevel_extra_white_line is true, add an
empty line. The ~N cannot be replaced by nl because the answer
is not always left at a non-empty line. The eol element paints
the remainder of the line if the message has a background colour,
which ~N cannot do as it is written using format/3.
Note that eol ends 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]welcome message to print information registered
using version/1.
predicate_list(+Specs)// is det[private]
goal_style(+Port, -Style) is det[private]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]
frame_location(+Frame, -Location) is semidet[private]File:Line for 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]debugger_goal_links, which
is one of true, false or auto. Using auto (default) we create
the links if the console can render them.
message_lang(-Lang) is multi[private]nl_BE) and ends with en.
current_message_lang(-Lang) is det[private]
predicate_indicator(+Spec, -QPI) is semidetModule:Name/Arity
or, for a non-terminal, Module:Name//Arity for Spec. Spec is one
of
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]// notation if the predicate
is a non-terminal.
predicate_head(+Spec, -QHead) is semidet[private]user.
predicate_reference(+Spec)// is det
predicate_reference(+Spec, +Options)// is detcode and, 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:
auto (default), hide or show. Using auto, the
module qualification is removed if hidden_module/1 holds for it.false, do not try to create a hyperlink. Default true.code.true, add a tag that indicates the kind of predicate.
See predicate_kind/2. Default false. 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
code class and ~p, i.e., we never fail on a malformed message.
pref_option(?Option, +Options, +Default) is semidet[private]boot/messages.pl must
be able to print a message before the libraries are available.
predicate_location(+Spec, -Location) is semidetFile:Line for 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
predicate_kind(+Spec, -Kind) is semidetlibrary(Name)module(Module)
library_file(+File) is semidet[private]
library_name(+File, -Name) is det[private]library(Name).
predicate_reference_tag(+QPI, +Options)// is det[private]
predicate_kind_tag(+Kind)// is det[private]
print_message(+Kind, +Term)
print_system_message(+Term, +Kind, +Lines)[private]
msg_context(+Prefix0, -Prefix) is det[private]message_context. Recognised context terms are:
time(Format)In addition, the hook message_prefix_hook/2 is called that allows for additional context information.
print_message_lines(+Stream, +PrefixOrKind, +Lines)
If PrefixOrKind is kind(Kind), the message as a whole may be
decorated. To this end the lines are wrapped in begin(Class, Ctx)
and end(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]message(Kind) (see
level_attrs/2).
insert_prefix(+Lines, +Prefix, ?Ctx, -PrefixedLines) is det[private]at_same_line the 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]nl and make the message context Ctx
available to the elements that need it:
nl(Ctx), flush(Ctx) and eol(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) becomes ansi(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 nl or flush an nl is 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 using eol.
print_message_lines(+Stream, +Lines)[private]
link_label(+Label, -Format, -Args) is det~.
safe_format(+Stream, +Format, +Args) is det[private]
message_to_string(+Term, -String)
print_once(Message, Level)[private]
must_print(+Level, +Message)[private]