ANSI -> K&R translator
Eamonn McManus
emcmanus at cs.tcd.ie
Fri Aug 31 21:54:06 AEST 1990
peter at ficc.ferranti.com (Peter da Silva) writes:
>The one problem with M4 is that it's got this annoying tendency to do
>replacements that aren't intended (what happens if you have a variable
>called "dnl"?). When I did a version of MACRO (m4 in Ratfor) for RSX, I
>made all the builtind start with "$".
Some versions of m4, System V for example, provide a builtin `defn'. The
manual says:
defn returns the quoted definition of its argument(s). It is useful
for renaming macros, especially built-ins.
Unfortunately, this is a lie. `defn' doesn't expand to anything if given
a builtin as its argument. If it worked, you could rename all the m4
built-ins to begin with the string `m4' or some such. It ought to be
quite easy to make defn work properly, for instance by having
defn(`somebuiltin') expand to `m4builtin(something)'. Thus defn(`define')
might expand to m4builtin(1), and m4builtin(1) would behave exactly like
define: one could write m4builtin(1)(`foo', `bar'). Then only the word
`m4builtin' would be reserved by m4. Other builtins could be renamed by a
sequence like:
define(`m4define', defn(`define'))
undefine(`define')
--
Eamonn McManus <emcmanus at cs.tcd.ie> <emcmanus%cs.tcd.ie at cunyvm.cuny.edu>
Fingers are for fuguing.
More information about the Comp.lang.c
mailing list