object
logtalk
ï
Built-in object providing message printing, debugging, library, source file, and hacking methods.
built_in
static, built_in, context_switching_calls, threaded
Default message kinds:
silent
,silent(Key)
,banner
,help
,comment
,comment(Key)
,information
,information(Key)
,warning
,warning(Key)
,error
,error(Key)
,debug
,debug(Key)
,question
, andquestion(Key)
.Printing of silent messages: By default, silent messages are not printed. These messages are only useful when intercepted.
Printing of banner and comment messages: By default, banner and comment messages are only printed when the
report
flag is turned on.Printing of help, information, and question messages: These messages are always printed by default as they provide requested output.
Printing of warning messages: By default, warning messages are not printed when the
report
flag is turned off.Printing of error messages: These messages are always printed by default.
Printing of debug messages: By default, debug messages are only printed when the
debug
flag is turned on. The compiler suppresses debug message printing goals when compiling in optimized mode.Meta messages: A meta message is a message that have another message as argument and is typically used for debugging messages. Meta messages avoid the need of defining tokenizer rules for every message but can be intercepted as any other message.
Meta message
@Message
: By default, the message is printed as passed to thewrite/1
predicate followed by a newline.Meta message
Key-Value
: By default, the message is printed as âKey: Valueâ followed by a newline. The key is printed as passed to thewrite/1
predicate while the value is printed as passed to thewriteq/1
predicate.Meta message
Format+Arguments
: By default, the message is printed as passed to theformat/2
predicate.Meta message
List
: By default, the list items are printed indented one per line. The items are preceded by a dash and can be@Message
,Key-Value
, orFormat+Arguments
messages. If that is not the case, the item is printed as passed to thewriteq/1
predicate.Meta message
Title::List
: By default, the title is printed followed by a newline and the indented list items, one per line. The items are printed as in theList
meta message.Meta message
[Stream,Prefix]>>Goal
: By default, call user-definedGoal
in the context ofuser
. The use of a lambda expression allows passing the message stream and prefix. Printing the prefix is delegated to the goal.Meta message
[Stream]>>Goal
: By default, call user-definedGoal
in the context ofuser
. The use of a lambda expression allows passing the message stream.Message tokens:
at_same_line
,tab(Expression)
,nl
,flush
,Format-Arguments
,term(Term,Options)
,ansi(Attributes,Format,Arguments)
,begin(Kind,Variable)
, andend(Variable)
.
Public predicatesï
print_message/3
ï
Prints a message of the given kind for the specified component.
static
print_message(Kind,Component,Message)
print_message(+nonvar,+nonvar,+nonvar)
- one
print_message_tokens/3
ï
Print the messages tokens to the given stream, prefixing each line with the specified atom.
static
print_message_tokens(Stream,Prefix,Tokens)
print_message_tokens(@stream_or_alias,+atom,@list(nonvar))
- one
print_message_token/4
ï
User-defined hook predicate for printing a message token (see this object remarks).
dynamic, multifile
print_message_token(Stream,Prefix,Token,Tokens)
print_message_token(@stream_or_alias,@atom,@nonvar,@list(nonvar))
- zero_or_one
message_tokens//2
ï
User-defined hook grammar rule for converting a message into a list of tokens (see this object remarks).
dynamic, multifile
message_tokens(Message,Component)
message_tokens(+nonvar,+nonvar)
- zero_or_one
message_prefix_stream/4
ï
Message line prefix and output stream to be used when printing a message given its kind and component.
dynamic, multifile
message_prefix_stream(Kind,Component,Prefix,Stream)
message_prefix_stream(?nonvar,?nonvar,?atom,?stream_or_alias)
- zero_or_more
message_prefix_file/6
ï
Message line prefix and output file to be used when printing a message given its kind and component.
dynamic, multifile
message_prefix_file(Kind,Component,Prefix,File,Mode,Options)
message_prefix_file(?nonvar,?nonvar,?atom,?atom,?atom,?list(compound))
- zero_or_more
message_hook/4
ï
User-defined hook predicate for intercepting message printing calls.
dynamic, multifile
message_hook(Message,Kind,Component,Tokens)
message_hook(+nonvar,+nonvar,+nonvar,+list(nonvar))
- zero_or_one
ask_question/5
ï
Asks a question and reads the answer until the check predicate is true.
static
ask_question(Kind,Component,Question,Check,Answer)
ask_question(*,*,*,1,*)
ask_question(+nonvar,+nonvar,+nonvar,+callable,-term)
- one
question_hook/6
ï
User-defined hook predicate for intercepting question asking calls.
dynamic, multifile
question_hook(Question,Kind,Component,Tokens,Check,Answer)
question_hook(*,*,*,*,1,*)
question_hook(+nonvar,+nonvar,+nonvar,+list(nonvar),+callable,-term)
- zero_or_one
question_prompt_stream/4
ï
Prompt and input stream to be used when asking a question given its kind and component.
dynamic, multifile
question_prompt_stream(Kind,Component,Prompt,Stream)
question_prompt_stream(?nonvar,?nonvar,?atom,?stream_or_alias)
- zero_or_more
trace_event/2
ï
Trace event handler. The runtime calls all trace event handlers using a failure-driven loop before calling the debug event handler.
dynamic, multifile
trace_event(Event,ExecutionContext)
trace_event(@callable,@execution_context)
- zero
Unification events: Generated after a successful unification with a fact -
fact(Entity,Fact,Clause,File,Line)
- or a rule head -rule(Entity,Head,Clause,File,Line)
.Goal events: Generated when calling a goal:
top_goal(Goal,CompiledGoal)
orgoal(Goal,CompiledGoal)
.
debug_handler/1
ï
Enumerates, by backtracking, all declared debug handler providers. Define a clause for this predicate to declare a new debug handler provider.
static, multifile
debug_handler(Provider)
debug_handler(?object_identifier)
- zero_or_more
debug_handler(?category_identifier)
- zero_or_more
active_debug_handler/1
ï
Current active debug handler provider if any. There is at most one active debug handler provider at any given moment.
static
active_debug_handler(Provider)
active_debug_handler(?category_identifier)
- zero_or_one
active_debug_handler(?category_identifier)
- zero_or_one
activate_debug_handler/1
ï
Activates the given debug handler provider. There is at most one active debug handler provider at any given moment. Fails if the object or category is not declared as a debug handler provider.
static
activate_debug_handler(Provider)
activate_debug_handler(@object_identifier)
- zero_or_one
activate_debug_handler(@category_identifier)
- zero_or_one
deactivate_debug_handler/0
ï
Deactivates the current debug handler provider if any.
static
deactivate_debug_handler
- one
debug_handler/3
ï
Debug event handler. Called by the runtime when the given provider is active.
static, multifile
debug_handler(Provider,Event,ExecutionContext)
debug_handler(+object_identifier,+callable,+execution_context)
- zero_or_more
debug_handler(+category_identifier,+callable,+execution_context)
- zero_or_more
Unification events: Generated after a successful unification with a fact -
fact(Entity,Fact,Clause,File,Line)
- or a rule head -rule(Entity,Head,Clause,File,Line)
.Goal events: Generated when calling a goal:
top_goal(Goal,CompiledGoal)
orgoal(Goal,CompiledGoal)
.
expand_library_path/2
ï
Expands a library alias or a library path into its absolute path. Uses a depth bound to prevent loops.
static
expand_library_path(LibraryPath,AbsolutePath)
expand_library_path(+atom,?atom)
- zero_or_one
expand_library_path(+callable,?atom)
- zero_or_one
loaded_file/1
ï
Enumerates, by backtracking, all loaded files, returning their full paths.
static
loaded_file(Path)
loaded_file(?atom)
- zero_or_more
loaded_file_property/2
ï
Enumerates, by backtracking, loaded file properties.
static
loaded_file_property(Path,Property)
loaded_file_property(?atom,?compound)
- zero_or_more
Property
basename/1
: Basename of the file (includes the file extension, if any).Property
directory/1
: Directory of the file (ending with a slash).Property
mode/1
: Compilation mode of the file (possible values areoptimal
,normal
, anddebug
).Property
flags/1
: Explicit flags used for compiling the file.Property
text_properties/1
: List of the file text properties (encoding/1
andbom/1
). Empty if noencoding/1
directive is present and the stream used for reading the file does not have abom/1
(or equivalent) property.Property
target/1
: Full path of the generated intermediate Prolog file.Property
modified/1
: File modification time stamp (should be regarded as an opaque but otherwise comparable term).Property
parent/1
: Full path of the parent file that loaded the file.Property
includes/1
: Full path of a file included by the file.Property
library/1
: Library alias for the library that includes the file.Property
object/1
: Identifier for an object defined in the file.Property
protocol/1
: Identifier for a protocol defined in the file.Property
category/1
: Identifier for a category defined in the file.
file_type_extension/2
ï
Enumerates, by backtracking, all defined file type extensions. The defined types are: source
, object
, logtalk
, prolog
, and tmp
. The source type returns both logtalk
and prolog
type extensions.
static
file_type_extension(Type,Extension)
file_type_extension(?atom,?atom)
- zero_or_more
compile_aux_clauses/1
ï
Compiles a list of auxiliary clauses. Can only be called during source file compilation, usually from term_expansion/2
or goal_expansion/2
hook predicate definitions.
static
compile_aux_clauses(Clauses)
compile_aux_clauses(@list(clause))
- one
entity_prefix/2
ï
Converts between an entity identifier and the entity prefix that is used for its compiled code. When none of the arguments is instantiated, it returns the identifier and the prefix of the entity under compilation, if any.
static
entity_prefix(Entity,Prefix)
entity_prefix(?entity_identifier,?atom)
- zero_or_one
compile_predicate_heads/4
ï
Compiles clause heads. The heads are compiled in the context of the entity under compilation when the entity argument is not instantiated.
static
compile_predicate_heads(Heads,Entity,CompiledHeads,ExecutionContext)
compile_predicate_heads(@list(callable),?entity_identifier,-list(callable),@execution_context)
- zero_or_one
compile_predicate_heads(@conjunction(callable),?entity_identifier,-conjunction(callable),@execution_context)
- zero_or_one
compile_predicate_heads(@callable,?entity_identifier,-callable,@execution_context)
- zero_or_one
compile_predicate_indicators/3
ï
Compiles predicate indicators. The predicate are compiled in the context of the entity under compilation when the entity argument is not instantiated.
static
compile_predicate_indicators(PredicateIndicators,Entity,CompiledPredicateIndicators)
compile_predicate_indicators(@list(predicate_indicator),?entity_identifier,-list(predicate_indicator))
- zero_or_one
compile_predicate_indicators(@conjunction(predicate_indicator),?entity_identifier,-conjunction(predicate_indicator))
- zero_or_one
compile_predicate_indicators(@predicate_indicator,?entity_identifier,-predicate_indicator)
- zero_or_one
decompile_predicate_heads/4
ï
Decompiles clause heads. All compiled clause heads must belong to the same entity, which must be loaded.
static
decompile_predicate_heads(CompiledHeads,Entity,Type,Heads)
decompile_predicate_heads(@list(callable),-entity_identifier,-atom,-list(callable))
- zero_or_one
decompile_predicate_heads(@conjunction(callable),-entity_identifier,-atom,-conjunction(callable))
- zero_or_one
decompile_predicate_heads(@callable,-entity_identifier,-atom,-callable)
- zero_or_one
decompile_predicate_indicators/4
ï
Decompiles predicate indicators. All compiled predicate indicators must belong to the same entity, which must be loaded.
static
decompile_predicate_indicators(CompiledPredicateIndicators,Entity,Type,PredicateIndicators)
decompile_predicate_indicators(@list(predicate_indicator),-entity_identifier,-atom,-list(predicate_indicator))
- zero_or_one
decompile_predicate_indicators(@conjunction(predicate_indicator),-entity_identifier,-atom,-conjunction(predicate_indicator))
- zero_or_one
decompile_predicate_indicators(@predicate_indicator,-entity_identifier,-atom,-predicate_indicator)
- zero_or_one
execution_context/7
ï
Execution context term data. Execution context terms should be considered opaque terms subject to change without notice.
static
execution_context(ExecutionContext,Entity,Sender,This,Self,MetaCallContext,CoinductionStack)
execution_context(?nonvar,?entity_identifier,?object_identifier,?object_identifier,?object_identifier,@list(callable),@list(callable))
- zero_or_one
Protected predicatesï
(none)
Private predicatesï
active_debug_handler_/1
ï
Current active debug handler provider. There is at most one active debug handler provider at any given moment.
dynamic
active_debug_handler_(Provider)
active_debug_handler_(?entity_identifier)
- zero_or_one
Operatorsï
(none)