[Top][All Lists]

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

Re: How to patsubst the result of an include?

From: Stepan Kasal
Subject: Re: How to patsubst the result of an include?
Date: Thu, 3 Feb 2005 08:24:34 +0100
User-agent: Mutt/1.4.1i


On Wed, Feb 02, 2005 at 08:10:24AM -0800, Matthew Braithwaite wrote:
> >     patsubst(include(`file'),`searchstring',`replacement')
> $ cat ab 
> a, b
> $ m4
> patsubst(include(`ab'), `a', `b')
> stdin:1: m4: Warning: Excess arguments to built-in `patsubst' ignored
> a

OK, it seems we need to enhance m4:
We need a macro to include the contents of the file, unexpanded, eg.


which could perhaps have this definition:

        define(`includeq', `expandonce(`include($@)')')

where expandonce would be a new builtin.  For the exact definition, please
see the attached patch which I'm going to mail to bug-m4.

In the meantime, we can try some workarounds:

--- file one_a: ---
         `foo', `bar')
---     eof     ---

this includes the file `two', without any problems with commas.
When I use this in conjunction with
--- file two: ---
foo, foo
`foo', `foo'
``foo'', ``foo''
```foo''', ```foo'''
---    eof    ---
I see it sort of works, but the quotes before and after a comma are not
handled consistently.

So we can have even more complicated version of file one:
--- file one_b: ---
         `foo', `bar')
---     eof     ---
Now, "m4 one_b" looks better.

But anyway, these are only kludges.

Have a nice day,
        Stepan Kasal

Attachment: m4-20050203-todo.patch
Description: Text document

reply via email to

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