#import(File)
. It calls’$macro’/2 in M,
but fails silently in case Macro is not defined in M
as it may be defined in another imported macro file or further down in
the current file.This predicate is not intended for direct usage.
File:Line:LinePos
. If File is unknown it is
unified with -
. If Line and/or LinePos are unknown they are
unified with 0. This predicate can be used in the body of a macro
definition to provide the source location. The example below defines #pp(Var)
to print a variable together with the variable name and source location.
#define(pp(Var), print_message(debug, dump_var(Pos, Name, Var))) :- ( var_property(Var, name(Name)) -> true ; Name = 'Var' ), macro_position(Pos). :- multifile prolog:message//1. prolog:message(dump_var(Pos,Name,Var)) --> [ url(Pos), ': ', ansi([fg(magenta),bold], '~w', [Name]), ' = ', ansi(code, '~p', [Var]) ].