]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/m4sugar/m4sugar.m4 (m4_text_wrap): Handle quadrigraphs
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 11 Jan 2006 08:05:55 +0000 (08:05 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 11 Jan 2006 08:05:55 +0000 (08:05 +0000)
correctly: pad with spaces after FIRST_PREFIX if necessary,
and compute string lenghts with `m4_qlen' instead of `m4_len'.
* lib/m4sugar/m4sh.m4 (AS_HELP_STRING): Comments updated.
* tests/m4sh.at (AS_HELP_STRING): Test extended.
* NEWS: Updated.
Reported by numerous people, numerous times.

ChangeLog
NEWS
lib/m4sugar/m4sh.m4
lib/m4sugar/m4sugar.m4
tests/m4sh.at

index e1d183d90950ff46ff2196616af2b2f6e0b210a3..2819b9ea9ad162e6d4c352ba967bab0de21d6258 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-01-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * lib/m4sugar/m4sugar.m4 (m4_text_wrap): Handle quadrigraphs
+       correctly: pad with spaces after FIRST_PREFIX if necessary,
+       and compute string lenghts with `m4_qlen' instead of `m4_len'.
+       * lib/m4sugar/m4sh.m4 (AS_HELP_STRING): Comments updated.
+       * tests/m4sh.at (AS_HELP_STRING): Test extended.
+       * NEWS: Updated.
+       Reported by numerous people, numerous times.
+
 2006-01-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        * bin/autoconf.as, bin/autoheader.in, bin/autom4te.in
diff --git a/NEWS b/NEWS
index 75753a2a34dd11358c790a7bace284a6badc2c0a..587702727be258457cc26088579d34935b0be2e7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -61,6 +61,9 @@
   New macro which is defined to the name of the first declared config header
   or undefined if no config headers have been declared yet.
 
+** AS_HELP_STRING
+  The macro correctly handles quadrigraphs now.
+
 ** AT_COPYRIGHT
   New macro for copyright notices in testsuite files.
 
@@ -1266,7 +1269,7 @@ Various bug fixes.
 -----
 
 Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
-2003, 2004, 2005 Free Software Foundation, Inc.
+2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Autoconf.
 
index 4dc656104f82907a87ea045956b2e3f5b70d4789..fda56cfd999cff501eaca68bda9adda102329652 100644 (file)
@@ -1171,16 +1171,8 @@ esac[]dnl
 #  column 0                  column 26
 #
 #
-# FIXME: Handle quadrigraphs in LHS correctly.
-# another one:
-# FIXME: the m4_text_wrap interface design seems to be wrong.  I see two ways:
-# 1) m4_text_wrap could pad the FIRST_PREFIX to the length of PREFIX; then
-#    there would be no need to handle quadrigraphs in AS_HELP_STRING.
-# 2) The special case when FIRST_PREFIX is longer than PREFIX could be moved
-#    from m4_text_wrap here; then one could call
-#      m4_text_wrap(TEXT, [], [    ])
-#    to get an indented paragraph.
-# My first impression is that 2) is better.  --kasal 19apr05
+# m4_text_wrap hacks^Wworks around the fact that m4_format does not
+# know quadrigraphs.
 #
 m4_define([AS_HELP_STRING],
 [m4_pushdef([AS_Prefix], m4_default([$3], [                          ]))dnl
index ad184c25f3dc648a167881f4218b3a73bd555522..cc45c2570293d115bf8fefee5a3eed7817665475 100644 (file)
@@ -3,7 +3,7 @@ divert(-1)#                                                  -*- Autoconf -*-
 # Base M4 layer.
 # Requires GNU M4.
 #
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -1559,9 +1559,6 @@ m4_define([m4_append_uniq],
 # we really want to bother with people trying each single corner
 # of a software?
 #
-# more important:
-# FIXME: handle quadrigraphs correctly, both in TEXT and in FIRST_PREFIX.
-#
 # This macro does not leave a trailing space behind the last word,
 # what complicates it a bit.  The algorithm is stupid simple: all the
 # words are preceded by m4_Separator which is defined to empty for the
@@ -1570,19 +1567,25 @@ m4_define([m4_text_wrap],
 [m4_pushdef([m4_Prefix], [$2])dnl
 m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl
 m4_pushdef([m4_Width], m4_default([$4], 79))dnl
-m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl
+m4_pushdef([m4_Cursor], m4_qlen(m4_Prefix1))dnl
 m4_pushdef([m4_Separator], [])dnl
 m4_Prefix1[]dnl
-m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)),
+m4_if(m4_eval(m4_qlen(m4_Prefix1) > m4_len(m4_Prefix)),
       1, [m4_define([m4_Cursor], m4_len(m4_Prefix))
-m4_Prefix])[]dnl
+m4_Prefix],
+      m4_if(m4_eval(m4_qlen(m4_Prefix1) < m4_len(m4_Prefix)),
+           [0], [],
+           [m4_define([m4_Cursor], m4_len(m4_Prefix))[]dnl
+m4_for(m4_Space, m4_qlen(m4_Prefix1), m4_eval(m4_len(m4_Prefix) - 1),
+                   [], [ ])])[]dnl
+)[]dnl
 m4_foreach_w([m4_Word], [$1],
-[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_len(m4_defn([m4_Word])) + 1))dnl
+[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen(m4_defn([m4_Word])) + 1))dnl
 dnl New line if too long, else insert a space unless it is the first
 dnl of the words.
 m4_if(m4_eval(m4_Cursor > m4_Width),
       1, [m4_define([m4_Cursor],
-                   m4_eval(m4_len(m4_Prefix) + m4_len(m4_defn([m4_Word])) + 1))]
+                   m4_eval(m4_len(m4_Prefix) + m4_qlen(m4_defn([m4_Word])) + 1))]
 m4_Prefix,
        [m4_Separator])[]dnl
 m4_defn([m4_Word])[]dnl
index 3e784723d769aa98ce25b937640d128e93713471..be124ff19ea0471e321c0f4038b1af81cbddd33c 100644 (file)
@@ -2,7 +2,7 @@
 
 AT_BANNER([M4sh.])
 
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -457,14 +457,79 @@ _AS_LINENO_PREPARE
 echo "AS_HELP_STRING([--an-option],[some text])"
 echo "AS_HELP_STRING([--another-much-longer-option],
 [some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--fooT=barT], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123], [foo bar])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123],
+[some other text which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
+echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123],
+[some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
 ]])
 
 AT_CHECK_M4SH
 AT_CHECK([./script], [0],
-[  --an-option             some text
+[[  --an-option             some text
   --another-much-longer-option
                           some other text which should wrap at our default of
                           80 characters.
-])
+  --fooT=barT             foo bar
+  --foo[=bar]             foo bar
+  --foo[=bar]123456789    foo bar
+  --foo[=bar]1234567890   foo bar
+  --foo[=bar]12345678901  foo bar
+  --foo[=bar]123456789012 foo bar
+  --foo[=bar]1234567890123
+                          foo bar
+  --foo[=bar]             some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]123456789    some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]1234567890   some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]12345678901  some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]123456789012 some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]1234567890123
+                          some other text which should wrap at our default of
+                          80 characters.
+  --foo[=bar]             some other [ex] which should wrap at our default of
+                          80 characters.
+  --foo[=bar]123456789    some other [ex] which should wrap at our default of
+                          80 characters.
+  --foo[=bar]1234567890   some other [ex] which should wrap at our default of
+                          80 characters.
+  --foo[=bar]12345678901  some other [ex] which should wrap at our default of
+                          80 characters.
+  --foo[=bar]123456789012 some other [ex] which should wrap at our default of
+                          80 characters.
+  --foo[=bar]1234567890123
+                          some other [ex] which should wrap at our default of
+                          80 characters.
+]])
 
 AT_CLEANUP