>>>>> "Alexandre" == Alexandre Oliva <[EMAIL PROTECTED]> writes:
Alexandre> On Mar 2, 2000, "Lars J. Aas" <[EMAIL PROTECTED]> wrote:
>> define([m4_noquote],
>> [changequote(-=<{,}>=-)$1-=<{}>=-changequote([,])])
>> That's my final offer :)
Alexandre> I must say that I find this extremely ugly (but then,
Alexandre> probably so does anybody else, and that's the point).
Well, we agree it looks more like a joke than something else. {{ }}
would have been fine too.
Alexandre> Anyway, I was wondering if we couldn't do it some other
Alexandre> way, For example, by adding a line-break after $1, and
Alexandre> editing it out somehow after the whole thing is processed:
The less processing, the better. m4_noquote is somewhere back door, I
don't think we need it to be much bigger, harder to write etc. With
m4, take the most simple way.
| define([m4_noquote],[m4_remove_trailing_newline([changequote(,)$1
| changequote([,])])])
I don't know how to say the `trailing new line'. I only know how to
speak of all of them.
Your m4_remove_trailing_newline should be robust to the active symbol,
it's a low level text process macro, so it has no reason to evaluate
its argument. I mean, the proper implementation should be something
like:
define(m4_remove_trailing_newline,
[patsubst([$1], [
], [])])
so your macro will not work:
| define([m4_noquote],[m4_remove_trailing_newline([changequote(,)$1
| changequote([,])])])
it receives
| [changequote(,)$1
| changequote([,])]
as argument (the text before evaluation (well, of course $1 is already
substituted)), it will remove the new line before evaluating the
changequotes. So you'd get the very same result as $1changequote.
So you need to strip one level of quoting somewhere.
At the top level:
| define([m4_noquote],[m4_remove_trailing_newline(changequote(,)$1
| changequote([,]))])
then you no longer preserve the commas of $1, if you give it [a, b],
you get a only at the end.
Then you might want to try to remove the inner quotation?
define(m4_remove_trailing_newline,
[patsubst($1, [
], [])])
Well, then you know it is the same: if you have a comma, or a hash,
they the macro will have too many or not enough arguments.
In m4, go straight to the most simple, it is the right one :)
Akim