Re: Require m4_ prefix from within the file?

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paul Kirkaas on 3/17/2009 7:01 AM:
> Hi;

Hello Paul,

> Is there any m4 command I can put inside the file to have the same
> effect, so that users don't need to remember to invoke m4 with the -P
> command line argument?

Yes, you can rename macros on the fly.  For example,

define(`m4_defn', defn(`defn'))
define(`m4_define', m4_defn(`define'))
m4_define(`m4_undefine', m4_defn(`undefine'))
m4_undefine(`defn', `define', `undefine')

The manual also mentions this:
http://www.gnu.org/software/m4/manual/m4.html#Defn

And it is how Autoconf's m4sugar does things, in line 74-169 of:
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=lib/m4sugar/m4sugar.m4;h=8356d08;hb=239b052

Note how m4sugar takes care to _not_ rename dnl, as well as being careful
to create m4_exit rather than m4_m4exit.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm/p+YACgkQ84KuGfSFAYC8ZACeKiZPCLtKqush2wDcmnVhF5AA
zGYAnROwsRPtB0qQTmjLwTNU6L8vcTZ6
=GMS6
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.