[comp.bugs.4bsd] m4 doesn't see macros after sharp signs

matt@oddjob.UChicago.EDU (I am not a Grook) (05/15/87)

Description:
	Any macros that come after a sharp-sign (#) are not
	expanded.
Repeat-By:
	m4 << EOF
	define(`ignored', `recognized')dnl
	This macro is ignored
	But this # macro is ignored
	EOF

	The word "ignored" is changed to "recognized" in the
	first output line.

	The code makes it clear that this is intentional.  The
	manual does not mention it.  Which should be changed?

pdg@ihdev.UUCP (05/15/87)

In article <3780@oddjob.UChicago.EDU> matt@oddjob.uchicago.edu (I am not a Grook) writes:
>Description:
>	Any macros that come after a sharp-sign (#) are not
>	expanded.


True.  A sharp is the comment indicator (left side) for m4.

This can be easily changed with changecom() to disable comments, or
something like changecom(/*,*/).

Try this:

m4<<!
define(xyzzy,plugh)
the magic word is xyzzy
the magic word is # xyzzy
changecom(/*,*/)
the magic word is # xyzzy
the magic word is /* xyzzy */
!
-- 

Paul Guthrie
ihnp4!ihdev!pdg			This Brain left intentionally blank.

rossc@metro.oz (Ross Cartlidge) (05/17/87)

In article <3780@oddjob.UChicago.EDU> matt@oddjob.uchicago.edu (I am not a Grook) writes:
>Description:
>	Any macros that come after a sharp-sign (#) are not
>	expanded.
>Repeat-By:

By default everything from a # to the end of line is treated as
a m4 comment as is left unprocessed.
See "changecom" in m4(1) SysV.