[comp.lang.c] m4 problems

dave@aspect.UUCP (Dave Corcoran) (07/11/90)

Netters:

(It seems like comp.lang.c is a good a place as any...)

I thought that m4 was the cat's meow in pre-processors until I tried
to use the "include" key-word for a quick and dirty include facility
in the make(1) process. 

So I tried to include paths.x:

	rebar.o    : ../concrete/include/wall.h
	pvcvalve.o : ../car/include/smog.h

thus
	include(paths.x)

resulting in 

	rebar.o    : ../concrete//wall.h
	pvcvalve.o : ../car//smog.h

the "include" in the pathname was eaten i.e. interpreted to be the key-word
"inlcude" by m4 complicating the task so I abandoned the exercize.

If I define include thus:

	define(`include',``include'')

it works (via sinclude()) but the "include" key-word has lost its use i.e. the
statement include(paths.x) yields include(paths.x) not the contents of paths.x. 

Comments anyone? Commiseration welcome
--

David Corcoran			-@@
..!uunet!aspect!dave		  ~

Good, Fast, Cheap -- pick any two.

peter@ficc.ferranti.com (Peter da Silva) (07/11/90)

In article <2794@aspect.UUCP> dave@aspect.UUCP (Dave Corcoran) writes:
> I thought that m4 was the cat's meow in pre-processors until I tried
> to use the "include" key-word for a quick and dirty include facility
> in the make(1) process. 
[macro preprocessing on the included file caused problems]

> Comments anyone? Commiseration welcome

define(`include',`define(`include',``include'')sinclude($1)undefine(`include')')

This is probably the biggest problem in M4. I did an implementation of it
for preprocessing RATFOR under RSX-11 once, and I made all the M4 keywords
begin with a dollar sign ($include(filename)...).
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.
<peter@ficc.ferranti.com>