[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 |
Hi,
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.
includeq(`file')
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: ---
patsubst(include(`two'changecom(`,'))changecom(`#'),
`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: ---
patsubst(
include(`two'changecom(`,')changequote())dnl
changecom(`#')changequote(`,'),
`foo', `bar')
--- eof ---
Now, "m4 one_b" looks better.
But anyway, these are only kludges.
Have a nice day,
Stepan Kasal
m4-20050203-todo.patch
Description: Text document
- How to patsubst the result of an include?, Matthew Braithwaite, 2005/02/02
- Re: How to patsubst the result of an include?, Stepan Kasal, 2005/02/02
- Re: How to patsubst the result of an include?, Matthew Braithwaite, 2005/02/02
- Re: How to patsubst the result of an include?,
Stepan Kasal <=
- Re: How to patsubst the result of an include?, Gary V. Vaughan, 2005/02/04
- Re: How to patsubst the result of an include?, Stepan Kasal, 2005/02/04
- Re: How to patsubst the result of an include?, Gary V. Vaughan, 2005/02/04
- Re: How to patsubst the result of an include?, Stepan Kasal, 2005/02/07
- Re: How to patsubst the result of an include?, Gary V. Vaughan, 2005/02/07
- Re: How to patsubst the result of an include?, Steven Simpson, 2005/02/04
- Re: How to patsubst the result of an include?, Stepan Kasal, 2005/02/03