m4-discuss
[Top][All Lists]
Advanced

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

Re: Require m4_ prefix from within the file?


From: Eric Blake
Subject: Re: Require m4_ prefix from within the file?
Date: Tue, 17 Mar 2009 07:38:46 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666

-----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             address@hidden
-----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-----




reply via email to

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