[Top][All Lists]

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

Re: Using m4 for c preprocessing

From: himanshu . garg
Subject: Re: Using m4 for c preprocessing
Date: 24 Apr 2005 06:12:49 -0700
User-agent: G2/0.2

Roger Leigh wrote:
> address@hidden writes:
> > Paul Jarc wrote:
> >> address@hidden (Himanshu Garg) wrote:
> >> >     Could you give me an example by which I could use m4 for c
> >> > preprocessing such as that for replacing #include<file.h> by its
> >> > contents.
> >>
> >> m4 wouldn't use the same syntax or search path as the C
> >> but it can do file inclusion:
> >> include(`/usr/include/file.h')
> >> See the m4 documentation for more.
> >
> > Thanks for the reply Paul. This won't do for me. In my case I would
> > like to treat statements beginning with % as preprocessor stmts.
> So just write
> define([%include], [include([$1])])
> or whatever variation you like.  You can extend m4 with you own
> macros to do whatever you like.

     Okay, how about "do loops", "procedures", "if/then/else" and
"goto". Would m4 make it easy to do all these. I am working on a
preprocessor for pl/1 which has all these as macros! Before I start
writing a parser etc, I was wondering if I should rather do it using

Thank You,

reply via email to

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