bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macro expansion in makeinfo


From: Eli Zaretskii
Subject: Re: macro expansion in makeinfo
Date: Thu, 25 Apr 2002 22:14:44 +0300

> From: Vladimir Volovich <address@hidden>
> Date: Thu, 25 Apr 2002 18:51:55 +0400
> 
>  EZ> It's a limitation of macros in Texinfo: macros in
>  EZ> @def... commands are not supported.
> 
> I.e. they should not be used, or it is not yet implemented?
> [i.e. it is a temporary limitation or a general limitation which will
> not be resolved?]

It's a temporary limitation, but one that isn't likely to be lifted
without a thorough rewrite of makeinfo.  Until such a rewrite is under
way, I'd recommend to refrain from using macros inside @def...  In
fact, I'd recommend to stay away of @def... themselves, unless you
really need them and cannot settle for @table instead.  (Karl will
probably recommend to stay away of macros instead. ;-)

> Is the reason they are not supported in difficulties of implementation?

Yes.  All the @def... commands are implemented as a gross hack (for
starters, they are the only commands in Texinfo where unescaped braces
can appear without triggering error messages).  This implementation,
coupled with the way macros are expanded by makeinfo, causes makeinfo
to barf during macro expansion inside these commands.

> perl -p -e 's,address@hidden,address@hidden,; s,address@hidden 
> defmac,address@hidden,' test.texi | \
> makeinfo --macro-expand=- | \
> perl -p -e 's,address@hidden,address@hidden,;s,address@hidden,address@hidden 
> defmac,' > test1.texi
> 
> so i wonder why makeinfo does not expand macros everywhere?

Two main reasons:

  - makeinfo is a one-pass translator, so 3 passes like what you did
    above is not something it can do without a total rewrite;

  - Texinfo macros are not simple text substitutions, they support
    recursion, semi-intelligent whitespace canonicalization,
    etc. (think what would have happened to your trick with Perl if
    @defmac was itself hidden inside some macro or @alias).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]