Hi, On 12 Nov 2001, Akim Demaille wrote:
> | Forthermore I believe the definition of m4_car is wrong. If I test > | m4_foreach with the example in the explanation in m4sugar.m4... : > | > | m4_define(a, 1)dnl > | m4_define(b, 2)dnl > | m4_define(c, 3)dnl > | m4_foreach([f], m4_split([a (b c)]), [echo f > | ])dnl > | > | ... the output is: > | echo 1 > | echo (2 > | echo 3) > > Because split has changed too. Hmm, no. I copy&pasted the exact definition out of m4sugar.m4 (of m4_foreach and all used macros) into a new .m4 file, added the above test-commands, and that was the output, so I used the unchanged def of m4_foreach and everything (of course I also used that file as my playground for the other tests, so may be I screwed something, but I believe not). Anyway... > I have one question though: did you run the test suite? ... I now did with autoconf-2.52. > How does your proposal behave? With the below patch applied directly to autoconf-2.52 this is the result: ============================= All 155 tests were successful ============================= ;-) Ciao, Michael. -- 2001-11-11 Michael Matz <[EMAIL PROTECTED]> * m4sugar.m4 (_m4_foreach): Make it linear instead quadratic. (m4_car2): New. (m4_car): Properly quote arguments. diff -urp autoconf-2.52/m4sugar.m4 autoconf-2.52-matz/m4sugar.m4 --- autoconf-2.52/m4sugar.m4 Wed Jul 18 13:11:14 2001 +++ autoconf-2.52-matz/m4sugar.m4 Tue Nov 13 02:58:01 2001 @@ -671,11 +671,12 @@ m4_define([m4_foreach], [m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])]) # Low level macros used to define m4_foreach. -m4_define([m4_car], [$1]) +m4_define([m4_car], [[$1]]) +m4_define([m4_car2], [[$@]]) m4_define([_m4_foreach], [m4_if(m4_quote($2), [], [], [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], - [m4_shift($2)], + m4_car2(m4_shift($2)), [$3])])])