m4-discuss
[Top][All Lists]
Advanced

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

Re: changequote problem ...


From: Jonas Geiregat
Subject: Re: changequote problem ...
Date: Tue, 22 Mar 2005 13:38:17 +0100

Since none of my e xpanded text uses % I run changequote(%,%) and use
% as quotes. I don't know if this is a good solution ?
Also I'm really started to get hocked on macro's, even started
writting some prototype macro language of my own .. but the web
doesn't have many references about macro's.

On Tue, 22 Mar 2005 10:45:39 +0100, Stepan Kasal <address@hidden> wrote:
> 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
> 
> _______________________________________________
> M4-discuss mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/m4-discuss
>




reply via email to

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