m4-discuss
[Top][All Lists]
Advanced

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

Re: changequote problem ...


From: Stepan Kasal
Subject: Re: changequote problem ...
Date: Tue, 22 Mar 2005 10:45:39 +0100
User-agent: Mutt/1.4.1i

Hello,

On Mon, Mar 21, 2005 at 08:37:18PM +0100, Jonas Geiregat wrote:
> changequote([,]) define([foo],[fo`o`bar]) changequote(`,')
> define(`bar',`fo[o]')

when m4 expands the text, it uses the current value of quotes.
It cannot save the value which was set at the time when the
definition of the macro was stored.

So you have to decide which quotes will be effective when the
code is executed.  There are several possibilities:

1) the default ` and '
This won't work well, as you need _unmatched_ `.

2) [ and ]
This is the way autoconf takes:

changequote([,]) define([foo],[fo`o`bar])
define([bar], [fo[[o]]])

the last line can also be:
define([bar], [[fo[o]]])

The outermost pair of [] is removed when the macro is defined, another
one is removed at the time of the expanstion, and one pair remains in
the output text.

If you have some source files written with `...', you can use them as
they are (with changequote(`,'), of course), unless they contain some
of the problematic chars  -- any of the quotes: `'[].

3) You could use something else, eg. << and >>  but it'd take too much
time to rewrite all your sources.

HTH,
        Stepan Kasal




reply via email to

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