m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/doc/m4.texinfo


From: Gary V . Vaughan
Subject: Changes to m4/doc/m4.texinfo
Date: Sat, 07 May 2005 20:37:45 -0400

Index: m4/doc/m4.texinfo
diff -u m4/doc/m4.texinfo:1.20 m4/doc/m4.texinfo:1.21
--- m4/doc/m4.texinfo:1.20      Mon May  2 21:21:43 2005
+++ m4/doc/m4.texinfo   Sun May  8 00:37:44 2005
@@ -22,8 +22,7 @@
 @ifinfo
 This file documents GNU @code{m4} @value{VERSION}
 
-Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1998, 1999, 2000,
-2001, 2004
+Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1998, 1999, 2000, 2001, 
2004, 2005
 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -50,8 +49,7 @@
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1989, 1990, 1991, 1992, 1993, 1994, 1998, 1999,
-2000, 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 1989, 1990, 1991, 1992, 1993, 1994, 1998, 1999, 2000, 
2001, 2004, 2005 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1
@@ -158,6 +156,7 @@
 * Undefine::                    Deleting a macro
 * Defn::                        Renaming macros
 * Pushdef::                     Temporarily redefining macros
+* Erenamesyms and Renamesyms::  Renaming macros with regular expressions
 
 * Indir::                       Indirect call of macros
 * Builtin::                     Indirect call of builtins
@@ -996,6 +995,7 @@
 * Undefine::                    Deleting a macro
 * Defn::                        Renaming macros
 * Pushdef::                     Temporarily redefining macros
+* Erenamesyms and Renamesyms::  Renaming macros with regular expressions
 
 * Indir::                       Indirect call of macros
 * Builtin::                     Indirect call of builtins
@@ -1379,6 +1379,65 @@
 It is possible to temporarily redefine a builtin with @code{pushdef}
 and @code{defn}.
 
address@hidden Erenamesyms and Renamesyms
address@hidden Renaming macros with regular expressions
+
address@hidden regular expressions
address@hidden macros, how to rename
address@hidden renaming macros
address@hidden GNU extensions
address@hidden {Builtin (gnu)} erenamesyms (@var{regexp}, @var{replacement})
+Global renaming of macros is done by @code{erenamesyms}, which selects
+all macros with names that match @var{regexp}, and renames each match
+according to @var{replacement}.
+
+A macro that does not have a name that matches @var{regexp} is left
+with its original name.  If only part of the name matches, any part of
+the name that is not covered by @var{regexp} is copied to the
+replacement name.  Whenever a match is found in the name, the search
+proceeds from the end of the match, so no character in the original
+name can be substituted twice.  If @var{regexp} matches a string of
+zero length, the start position for the continued search is
+incremented to avoid infinite loops.
+
+Where a replacement is to be made, @var{replacement} replaces the
+matched text in the original name, with @address@hidden substituted by
+the text matched by the @var{n}th parenthesized sub-expression of
address@hidden, and @samp{\&} being the text matched by the entire
+regular expression.
+
+The builtin macro @code{erenamesyms} is recognized only when given
+arguments.
address@hidden deffn
+
+Here is an example that performs the same renaming as the
address@hidden option.  Where @option{--prefix-builtins}
+only renames M4 builtin macros, @code{erenamesyms} will rename any
+macros that match when it runs, including text macros.
+
address@hidden
+erenamesyms(`^.*$', `m4_\&')
address@hidden
address@hidden example
+
+Here is a more realistic example that performs a similar renaming on
+macros with lowercase names, except that it ignores macros with names
+that begin with @samp{_}, and avoids creating macros with names that
+begin with @samp{m4_m4}.
+
address@hidden
+erenamesyms(`^[^_]\w*$', `m4_\&')
address@hidden
+m4_erenamesyms(`^m4_m4(\w*)$', `m4_\1')
address@hidden
address@hidden example
+
address@hidden {Builtin (gnu)} renamesyms (@var{regexp}, @var{replacement})
+Same as @code{erenamesyms}, but using Basic Regular Expression syntax,
+see @xref{Eregexp and Regexp}, for more details.
address@hidden deffn
+
+
 @node Indir
 @section Indirect call of macros
 
@@ -3034,7 +3093,7 @@
 @cindex substitution by regular expression
 @cindex GNU extensions
 @deffn {Builtin (gnu)} epatsubst (@var{string}, @var{regexp}, @w{opt 
@var{replacement})}
-Global substitution in a string is done by @code{patsubst}, which
+Global substitution in a string is done by @code{epatsubst}, which
 searches @var{string} for matches of @var{regexp}, and substitutes
 @var{replacement} for each match.  It uses Extended Regular Expressions
 syntax.
@@ -3054,7 +3113,7 @@
 The @var{replacement} argument can be omitted, in which case the text
 matched by @var{regexp} is deleted.
 
-The builtin macro @code{patsubst} is recognized only when given
+The builtin macro @code{epatsubst} is recognized only when given
 arguments.
 @end deffn
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]