help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Using m4 for c preprocessing


From: Roger Leigh
Subject: Re: Using m4 for c preprocessing
Date: Thu, 14 Apr 2005 11:28:45 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

himanshu.garg@gmail.com writes:

> Paul Jarc wrote:
>> himanshu.garg@gmail.com (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 preprocessor,
>> 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 custom
macros to do whatever you like.


Regards,
Roger

-- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.


reply via email to

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