[ Syntax Settings | Reference Manual | Alphabetic Index ]

current_macro(-TermClass, -TransPred, -Options, -Module)

Succeeds if TermClass is a macro with the transformation predicate TransPred defined in module Module and flags Options.
TermClass
Term in the form Atom/Integer or atom or variable.
TransPred
Term in the form Atom/Integer or variable.
Options
List or a variable.
Module
Atom or variable.

Description

This predicate enumerates all visible macros and retrieves their definition. The arguments TransPred and Options correspond to the arguments of macro/3 or portray/3. Module is the definition module of TransPred and it can be used for calling the TransPred explicitly (e.g. using :/2).

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(5) type error
TermClass not of form Atom/Integer.
(5) type error
TransPred not of form Atom/Integer.
(5) type error
Options not a list.

Examples

[eclipse]: [user].             % define a macro
 tr_a(a(X), b(X,X)).
 :- local macro(a/1, tr_a/2, []).

yes.
[eclipse]: current_macro(F, T, O, M).  % list visible macros

F = (-->) / 2                  % predefined macro
T = trdcg / 3
O = [global, clause]
M = macro     More? (;)

F = (if) / 2                   % predefined macro
T = tr_if / 2
O = [global, clause]
M = coroutine     More? (;)

F = a / 1                      % our user defined macro
T = tr_a / 2
O = [local]
M = eclipse     More? (;)

F = no_macro_expansion / 1     % predefined macro
T = trprotect / 2
O = [global, protect_arg]
M = macro     More? (;)

no (more) solution.



See Also

macro / 3, portray / 3, erase_macro / 2