[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19 Feb 2001 17:02:04 +0100
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)
Pavel Roskin <address@hidden> writes:
> Hello, Akim!
> I'm very glad that you are back!
I'm happy to be here again :)
> The idea was that some macros take some test on input. There are some
> constraints on that text. It's better if m4 checks for them rather than
> the shell, since the later will be unable to generate useful error
The thing is, given that you are absolutely *free* to give any input,
and since any input is potentially correct, there is no solution in
Prototyping in M4 only amounts to checking the number of the arguments
(and a bit more is doable), but quotation checking can not be done, by
> In the case of AT_DATA, the requirement is that the argument ends with a
> newline unless it's empty.
It's a stupid requirement in itself! There is no reason not to create
files without ending newline. That's basically why I didn't have
AT_DATA insert the last new line itself.
Or we introduce another macro AT_DATA_NO_NEW_LINE?
> Now, there are three allowed cases for the end of the argument -
> nothing, end of line and end of line followed by a closing quote. The
> later is especially hard to deal with.
IMHO, you are willing to go way too far in the that direction.
Troubles to come, and worse yet, obfuscation of the existing code.
Really, if you want to do things like this, it is in m4 the program
that you should hack, not in M4 the language.
> The hardest part was to write m4_unquote. But soon I found that in some
> places macros are used in the argument to AT_DATA and they only get a
> newline after expansion (see e.g. "Torturing config.status"), so I
> abandoned this idea.
*Any* input is potentially correct.
> > > m4_define([m4_unquote],
> > > [m4_patsubst([[$1]], [^\[\[\(.*\)\]\]$], [[\1]])])
> > m4_define([m4_unquote], address@hidden)
> > or am I missing something?
> Let's expand the arguments:
> m4_patsubst([$1], ^\[\[\(.*\)\]\]$, [\1])
> If [$1] doesn't match, it's expanded so the the quotes are removed and it
> remains unchanged.
Ah, OK, I didn't catch this part of it. It's m4_unquote_if_quoted so,