bug-texinfo
[Top][All Lists]
Advanced

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

Re: macro expansion in makeinfo


From: Vladimir Volovich
Subject: Re: macro expansion in makeinfo
Date: Sun, 28 Apr 2002 23:19:19 +0400
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (sparc-sun-solaris2.8)

Eli,

in my email below, i ask two questions.

"EZ" == Eli Zaretskii writes:

 >> you can look at autoconf.texi in the current autoconf sources (i
 >> loaded them via CVS), - it uses @ovar macros (and maybe some
 >> others) heavily in @defmac
 >> 
 >> it would be good to know the recommended way of writing texinfo
 >> files to achieve the same effect.

 EZ> The recommended way is to include @defmac in the macro body.
 EZ> That is, if you _must_ use macros in the first place...

1) i'm sorry, but i did not understand what you mean by this.

as an example, autoconf.texi contains:

==========================================================
  ...

@macro ovar{varname}
@address@hidden@r{]}
@end macro

  ...

@defmac AC_INIT (@var{package}, @var{version}, @ovar{bug-report}, 
@ovar{tarname})
@acindex INIT
Process any command-line arguments and perform various initializations
and verifications.

Set the name of the @var{package} and its @var{version}.  These are
typically used in @option{--version} support, including that of
@command{configure}.  The optional argument @var{bug-report} should be
the email to which users should send bug reports.  The package
@var{tarname} differs from @var{package}: the latter designates the full
package name (e.g., @samp{GNU Autoconf}), while the former is meant for
distribution tar ball names (e.g., @samp{autoconf}).  It defaults to
@var{package} once @samp{GNU } strip, lower cased, and all non
alphanumeric character mapped onto @samp{-}.

It is preferable that these arguments be static, i.e., there should not
be any shell computation, but they can be computed by M4.  The following
M4 macros (e.g., @code{AC_PACKAGE_NAME}), output variables (e.g.,
@code{PACKAGE_NAME}), and preprocessor symbols (e.g.,
@code{PACKAGE_NAME}) are then defined:

@table @asis
@item @code{AC_PACKAGE_NAME}, @code{PACKAGE_NAME}
@acindex PACKAGE_NAME
@ovindex PACKAGE_NAME
@cvindex PACKAGE_NAME
Exactly @var{package}.

@item @code{AC_PACKAGE_TARNAME}, @code{PACKAGE_TARNAME}
@acindex PACKAGE_TARNAME
@ovindex PACKAGE_TARNAME
@cvindex PACKAGE_TARNAME
Exactly @var{tarname}.

@item @code{AC_PACKAGE_VERSION}, @code{PACKAGE_VERSION}
@acindex PACKAGE_VERSION
@ovindex PACKAGE_VERSION
@cvindex PACKAGE_VERSION
Exactly @var{version}.

@item @code{AC_PACKAGE_STRING}, @code{PACKAGE_STRING}
@acindex PACKAGE_STRING
@ovindex PACKAGE_STRING
@cvindex PACKAGE_STRING
Exactly @address@hidden @var{version}}.

@item @code{AC_PACKAGE_BUGREPORT}, @code{PACKAGE_BUGREPORT}
@acindex PACKAGE_BUGREPORT
@ovindex PACKAGE_BUGREPORT
@cvindex PACKAGE_BUGREPORT
Exactly @var{bug-report}.
@end table
@end defmac
==========================================================

How this should be changed?

2) BTW, although "makeinfo --macro-expand=-" does not expand macros
on @defmac lines, the resulting *.info files DO expand macros
EVEN ON @defmac lines.

E.g. for the following input:

==========================================================
@macro ovar{varname}
@address@hidden@r{]}
@end macro

@ovar{Testvar}

@defmac TEST (@ovar{bug-report}, @ovar{tarname})
Test @ovar
@end defmac
==========================================================

the output of "makeinfo --macro-expand=-" is:

==========================================================

@address@hidden@r{]}

@defmac TEST (@ovar{bug-report}, @ovar{tarname})
Test @address@hidden@r{]}
@end defmac
==========================================================

(note that @ovar was expanded in the body of @defmac, but not on the
first line of @defmac)

and the resulting *.info file is:

==========================================================
This is stdin.info, produced by makeinfo version 4.0 from stdin.

   [TESTVAR]

 - Macro: TEST ([BUG-REPORT], [TARNAME])
     Test []

==========================================================

Note that @ovar WAS EXPANDED everywhere.

So - why --macro-expand=- does not expand macros on @defmac lines, but
the info files have them expanded???

Best,
v.




reply via email to

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