[ ECLiPSe Prolog Environment built-in.|Group Index| Full 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 define_macro/3. Module is the definition module of TransPred and it can be used for calling the TransPred explicitly (e.g. using call_explicit/2).

Fail Conditions

Fails if no macro matches the input arguments.

Resatisfiable

Yes.

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)).
 :- define_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

current_functor / 1, define_macro / 3, erase_macro / 1