On Fri, Aug 25, 2023 at 09:41:12PM +0000, Barry Davidson wrote: > Hello, > Page 116: when talking about forloop and forloop2, the text incorrectly > calls them foreach and foreach2. "... improved version used '_$0' rather > than '_foreach' to...".
Thanks, that's definitely worth fixing. I've pushed that patch now. > > My suggestions: > # 1. Add example macro to print current left and right quote symbols > literally: > define(`lquo', `ifelse(`$#', `0', ``$0'', `changequote(`[',`]')`dnl' > changequote([`], ['])')') > > define(`rquo', `ifelse(`$#', `0', ``$0'', `changequote(`[', `]')dnl` > 'changequote([`], ['])')') > > lquo()rquo() Also seems worthwhile; probably in the section on changequote. Will be a separate patch. > > # 2. Add example macro of settable counters: > define(`countup', `ifelse(`$#', `0', > `define(`_$0', `0')define(`$0', `_$0`'define(`_$0', incr(_$0))')', > `define(`_$0', `$1')define(`$0', `_$0`'define(`_$0', incr(_$0))')')') > > define(`countdown', `ifelse(`$#', `0', > `define(`_$0', `0')define(`$0', `_$0`'define(`_$0', decr(_$0))')', > `define(`_$0', `$1')define(`$0', `_$0`'define(`_$0', decr(_$0))')')') > > define(`counter', defn(`countup')) > # set counter > counter(`42') > # use counter > counter counter counter counter > > define(`counter', defn(`countdown')) > # set counter > counter(`22') > # use counter > counter counter counter counter Also seems worthwhile; probably in the section on incr. Will be a separate patch. > > ######################## > This code license comply to "Appendix A How to make copies of the overall > M4 package" of GNU m4 manual. Your contribution is border-line trivial: it is definitely new content, but the examples are short enough that I think we can get by without copyright assignment on file for you at this time. However, if you'd like to make further contributions to M4, you'll probably need to sign a copyright disclaimer with the FSF (alas, a mere blurb like this in email won't work for them). -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org