A macro #define(Macro, Expanded) :- Body. is, after some 
basic sanity checks, translated into a rule
'$macro'(Macro, Var), Body => Var = Expanded.
The #import(File) is translated into :- use_module(File, []) 
and a
link clause that links the macro expansion from the module 
defined in
File to the current module.
Macro expansion is realised by creating a clause for term_expansion/2 
in the current module. This clause results from expanding the first
#define or #import definition. Thus, if macros 
are defined before any other local definition for term_expansion/2 
it is executed as the first step. The macro expansion fails if no macros 
were encounted in the term, allowing other term_expansion rules local to 
the module to take effect. In other words, a term holding macros is not 
subject to any other term expansion local to the module. It is subject 
to term expansion defined in module user and system 
that is performed after the local expansion is completed.