[SCM] GNU Autoconf source repository branch, master, updated. v2.63b-35-gce15384

"Eric Blake" <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=ce153844ca431e668ef93e5ece8e794ca89e4047

The branch, master has been updated
       via  ce153844ca431e668ef93e5ece8e794ca89e4047 (commit)
       via  46e87ded26df81d18bf73e7b23f4c8f8441dd884 (commit)
      from  d29bb704e584a0d6ecd0ddfde0d4a2979fffd950 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ce153844ca431e668ef93e5ece8e794ca89e4047
Author: Eric Blake <[email protected]>
Date:   Wed Apr 22 16:53:19 2009 -0600

    Change FOO placeholder to use @var{text} instead.
    
    * doc/autoconf.texi (Configuration Actions): Rename AC_CONFIG_FOOS
    to AC_CONFIG_@var{ITEMS}.
    * doc/autoconf.texi (config.status Invocation): Likewise.
    (AC_FOO_IFELSE vs AC_TRY_FOO): Rename node...
    (AC_ACT_IFELSE vs AC_TRY_ACT): ...to this.
    
    Signed-off-by: Eric Blake <[email protected]>

commit 46e87ded26df81d18bf73e7b23f4c8f8441dd884
Author: Eric Blake <[email protected]>
Date:   Wed Apr 22 10:43:51 2009 -0600

    Add m4_argn.
    
    * lib/m4sugar/m4sugar.m4 (m4_argn): New macro.
    * NEWS: Document it.
    * doc/autoconf.texi (Looping constructs) <m4_argn>: Likewise.
    <m4_car, m4_cdr>: Improve documentation.
    * tests/m4sugar.at (m4 lists): New test.
    
    Signed-off-by: Eric Blake <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog              |   18 ++++++++++++++++
 NEWS                   |    3 +-
 doc/autoconf.texi      |   49 +++++++++++++++++++++++++++-----------------
 lib/m4sugar/m4sugar.m4 |   29 ++++++++++++++++++++------
 tests/m4sugar.at       |   52 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d966d3..0afe9d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-04-23  Eric Blake  <[email protected]>
+
+	Change FOO placeholder to use @var{text} instead.
+	* doc/autoconf.texi (Configuration Actions): Rename AC_CONFIG_FOOS
+	to AC_CONFIG_@var{ITEMS}.
+	* doc/autoconf.texi (config.status Invocation): Likewise.
+	(AC_FOO_IFELSE vs AC_TRY_FOO): Rename node...
+	(AC_ACT_IFELSE vs AC_TRY_ACT): ...to this.
+
+2009-04-22  Eric Blake  <[email protected]>
+
+	Add m4_argn.
+	* lib/m4sugar/m4sugar.m4 (m4_argn): New macro.
+	* NEWS: Document it.
+	* doc/autoconf.texi (Looping constructs) <m4_argn>: Likewise.
+	<m4_car, m4_cdr>: Improve documentation.
+	* tests/m4sugar.at (m4 lists): New test.
+
 2009-04-22  Ralf Wildenhues  <[email protected]>
 
 	Improve description of AC_PROG_CC_C89 and AC_PROG_CC_C99.
diff --git a/NEWS b/NEWS
index 60a6e20..107a10c 100644
--- a/NEWS
+++ b/NEWS
@@ -19,7 +19,8 @@ GNU Autoconf NEWS - User visible changes.
 ** The autotest macro AT_CHECK_NOESCAPE is now documented.
 
 ** The following documented m4sugar macros are new:
-   m4_default_nblank  m4_default_nblank_quoted  m4_ifblank  m4_ifnblank
+   m4_argn  m4_default_nblank  m4_default_nblank_quoted  m4_ifblank
+   m4_ifnblank
 
 * Major changes in Autoconf 2.63b (2009-03-31) [beta]
   Released by Eric Blake, based on git versions 2.63.*.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 1256095..7dda1d8 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -594,7 +594,7 @@ Upgrading From Version 2.13
 * New Macros::                  Interaction with foreign macros
 * Hosts and Cross-Compilation::  Bugward compatibility kludges
 * AC_LIBOBJ vs LIBOBJS::        LIBOBJS is a forbidden token
-* AC_FOO_IFELSE vs AC_TRY_FOO::  A more generic scheme for testing sources
+* AC_ACT_IFELSE vs AC_TRY_ACT::  A more generic scheme for testing sources
 
 Generating Test Suites with Autotest
 
@@ -2105,7 +2105,7 @@ have this prototype:
 @c FIXME: Can't use @ovar here, Texinfo 4.0 goes lunatic and emits something
 @c awful.
 @example
-AC_CONFIG_FOOS(@var{tag}@dots{}, [@var{commands}], [@var{init-cmds}])
+AC_CONFIG_@var{ITEMS}(@var{tag}@dots{}, [@var{commands}], [@var{init-cmds}])
 @end example
 
 @noindent
@@ -2122,15 +2122,15 @@ should avoid
 @example
 @dots{} && my_foos="$my_foos fooo"
 @dots{} && my_foos="$my_foos foooo"
-AC_CONFIG_FOOS([$my_foos])
+AC_CONFIG_@var{ITEMS}([$my_foos])
 @end example
 
 @noindent
 and use this instead:
 
 @example
-@dots{} && AC_CONFIG_FOOS([fooo])
-@dots{} && AC_CONFIG_FOOS([foooo])
+@dots{} && AC_CONFIG_@var{ITEMS}([fooo])
+@dots{} && AC_CONFIG_@var{ITEMS}([foooo])
 @end example
 
 The macros @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use
@@ -3434,7 +3434,7 @@ breed: they are executed directly by @file{configure}, so you cannot use
 Execute the @var{cmds} right before creating @file{config.status}.
 
 This macro presents the last opportunity to call @code{AC_SUBST},
-@code{AC_DEFINE}, or @code{AC_CONFIG_FOOS} macros.
+@code{AC_DEFINE}, or @code{AC_CONFIG_@var{ITEMS}} macros.
 @end defmac
 
 @defmac AC_CONFIG_COMMANDS_POST (@var{cmds})
@@ -11146,26 +11146,35 @@ m4_foreach([i], [list], [i])
 @result{}123
 @end example
 
-@defmac m4_car (@var{list})
+@defmac m4_argn (@var{n}, @ovar{arg}@dots{})
+@msindex{argn}
+Extracts argument @var{n} (larger than 0) from the remaining arguments.
+If there are too few arguments, the empty string is used.  For any
+@var{n} besides 1, this is more efficient than the similar
+@samp{m4_car(m4_shiftn([@var{n}], [], [@var{arg}@dots{}]))}.
+@end defmac
+
+@defmac m4_car (@var{arg}@dots{})
 @msindex{car}
-Expands to the quoted first element of the comma-separated quoted
-@var{list}.  Often used with @code{m4_cdr} to recursively iterate
+Expands to the quoted first @var{arg}.  Can be used with @code{m4_cdr}
+to recursively iterate
 through a list.  Generally, when using quoted lists of quoted elements,
 @code{m4_car} should be called without any extra quotes.
 @end defmac
 
-@defmac m4_cdr (@var{list})
+@defmac m4_cdr (@var{arg}@dots{})
 @msindex{cdr}
-Expands to a quoted list of all but the first element of the
-comma-separated quoted @var{list}, or the empty string if @var{list} had
-only one element.  Generally, when using quoted lists of quoted
-elements, @code{m4_cdr} should be called without any extra quotes.
+Expands to a quoted list of all but the first @var{arg}, or the empty
+string if there was only one argument.  Generally, when using quoted
+lists of quoted elements, @code{m4_cdr} should be called without any
+extra quotes.
 
 For example, this is a simple implementation of @code{m4_map}; note how
 each iteration checks for the end of recursion, then merely applies the
 first argument to the first element of the list, then repeats with the
 rest of the list.  (The actual implementation in M4sugar is a bit more
-involved, to gain some speed and share code with @code{m4_map_sep}).
+involved, to gain some speed and share code with @code{m4_map_sep}, and
+also to avoid expanding side effects in @samp{$2} twice).
 @example
 m4_define([m4_map], [m4_ifval([$2],
   [m4_apply([$1], m4_car($2))[]$0([$1], m4_cdr($2))])])dnl
@@ -20055,7 +20064,7 @@ Synopsis:
 
 It configures each @var{tag}; if none are specified, all the templates
 are instantiated.  A @var{tag} refers to a file or other tag associated
-with a configuration action, as specified by an @code{AC_CONFIG_FOOS}
+with a configuration action, as specified by an @code{AC_CONFIG_@var{ITEMS}}
 macro (@pxref{Configuration Actions}).  The files must be specified
 without their dependencies, as in
 
@@ -21669,7 +21678,7 @@ features in version 2.50; the changes are summarized in the file
 * New Macros::                  Interaction with foreign macros
 * Hosts and Cross-Compilation::  Bugward compatibility kludges
 * AC_LIBOBJ vs LIBOBJS::        LIBOBJS is a forbidden token
-* AC_FOO_IFELSE vs AC_TRY_FOO::  A more generic scheme for testing sources
+* AC_ACT_IFELSE vs AC_TRY_ACT::  A more generic scheme for testing sources
 @end menu
 
 @node Changed Quotation
@@ -21965,8 +21974,10 @@ referencing @code{LIBOBJS} and @code{LTLIBOBJS} in another directory.
 The @code{LIBOBJDIR} feature is experimental.
 
 
-@node AC_FOO_IFELSE vs AC_TRY_FOO
-@subsection @code{AC_FOO_IFELSE} vs.@: @code{AC_TRY_FOO}
+@node AC_ACT_IFELSE vs AC_TRY_ACT
+@subsection @code{AC_@var{ACT}_IFELSE} vs.@: @code{AC_TRY_@var{ACT}}
+@c the anchor keeps the old node name, to try to avoid breaking links
+@anchor{AC_FOO_IFELSE vs AC_TRY_FOO}
 
 Since Autoconf 2.50, internal codes uses @code{AC_PREPROC_IFELSE},
 @code{AC_COMPILE_IFELSE}, @code{AC_LINK_IFELSE}, and
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 420fd99..f5a1f1c 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -454,20 +454,35 @@ m4_define([m4_bmatch],
        [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))],
 	      [$3])])])
 
+# m4_argn(N, ARGS...)
+# -------------------
+# Extract argument N (greater than 0) from ARGS.  Example:
+#   m4_define([b], [B])
+#   m4_argn([2], [a], [b], [c]) => b
+#
+# Rather than using m4_car(m4_shiftn([$1], $@)), we exploit the fact that
+# GNU m4 can directly reference any argument, through an indirect macro.
+m4_define([m4_argn],
+[m4_assert([0 < $1])]dnl
+[m4_pushdef([_$0], [_m4_popdef([_$0])]m4_dquote([$]m4_incr([$1])))_$0($@)])
 
-# m4_car(LIST)
-# m4_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
+
+# m4_car(ARGS...)
+# m4_cdr(ARGS...)
+# ---------------
+# Manipulate m4 lists.  m4_car returns the first argument.  m4_cdr
+# bundles all but the first argument into a quoted list.  These two
+# macros are generally used with list arguments, with quoting removed
+# to break the list into multiple m4 ARGS.
 m4_define([m4_car], [[$1]])
 m4_define([m4_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
        [$#], 1, [],
        [m4_dquote(m4_shift($@))])])
 
-# _m4_cdr(LIST)
-# -------------
-# Like m4_cdr, except include a leading comma unless only one element
+# _m4_cdr(ARGS...)
+# ----------------
+# Like m4_cdr, except include a leading comma unless only one argument
 # remains.  Why?  Because comparing a large list against [] is more
 # expensive in expansion time than comparing the number of arguments; so
 # _m4_cdr can be used to reduce the number of arguments when it is time
diff --git a/tests/m4sugar.at b/tests/m4sugar.at
index 2dd81dc..bf56c4d 100644
--- a/tests/m4sugar.at
+++ b/tests/m4sugar.at
@@ -787,6 +787,58 @@ AT_CLEANUP
 
 
 ## ---------- ##
+## m4 lists.  ##
+## ---------- ##
+
+AT_SETUP([m4 lists])
+
+AT_KEYWORDS([m4@&t@_car m4@&t@_cdr m4@&t@_argn _m4@&t_cdr])
+
+AT_CHECK_M4SUGAR_TEXT([[dnl
+m4_define([a], [A])m4_define([b], [B])m4_define([c], [C])
+m4_argn([1], [a], [b], [c])
+m4_argn([2], [a], [b], [c])
+m4_argn([3], [a], [b], [c])
+m4_argn([4], [a], [b], [c])
+m4_car([a], [b], [c])
+m4_cdr([a], [b], [c])
+m4_cdr([a], [b])
+m4_cdr([a])
+_m4_cdr([a], [b], [c])
+_m4_cdr([a], [b])
+_m4_cdr([a])
+m4_if(m4_cdr([], []), [[]], [good], [bad])
+m4_if(m4_cdr([]), [], [good], [bad])
+]], [[
+a
+b
+c
+
+a
+[b],[c]
+[b]
+
+, [b],[c]
+, [b]
+
+good
+good
+]])
+
+AT_DATA_M4SUGAR([script.4s],
+[[m4_init
+m4_argn([0], [a], [b], [c])
+]])
+AT_CHECK_M4SUGAR([-o-], [1], [],
+[[script.4s:2: error: assert failed: 0 < 0
+script.4s:2: the top level
+autom4te: m4 failed with exit status: 1
+]])
+
+AT_CLEANUP
+
+
+## ---------- ##
 ## m4_split.  ##
 ## ---------- ##
 


hooks/post-receive
--
GNU Autoconf source repository
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.