texinfo-commits
[Top][All Lists]
Advanced

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

[6634] macro arg backslashes for >1 argument


From: Gavin D. Smith
Subject: [6634] macro arg backslashes for >1 argument
Date: Sat, 19 Sep 2015 20:39:21 +0000

Revision: 6634
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6634
Author:   gavin
Date:     2015-09-19 20:39:20 +0000 (Sat, 19 Sep 2015)
Log Message:
-----------
macro arg backslashes for >1 argument

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/texinfo-tex-test.texi
    trunk/doc/texinfo.tex

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-09-19 13:05:24 UTC (rev 6633)
+++ trunk/ChangeLog     2015-09-19 20:39:20 UTC (rev 6634)
@@ -1,5 +1,22 @@
-2015-09-18  Gavin Smith  <address@hidden>
+2015-09-19  Gavin Smith  <address@hidden>
 
+       * doc/texinfo.tex (\defmacro) <2-9 arguments> Define 
+       \processmacroarg as \xprocessmacroarg, and make the latter 
+       unexpandable.
+       (\scanmacro): Define \xprocessmacroarg as 
+       \passargtomacro\eatspaces, to reduce doubled backslashes to one.
+       (\commondummiesnofonts): Give \xprocessmacroarg a definition.
+
+       (\defmacro): Define helper macros with names ending in "@" 
+       instead of "x", because this causes funny results when the file 
+       contains two user-defined macros one of which has the same name 
+       as the other with an extra "x" on the end.
+
+       * doc/texinfo-tex-test.texi: Add examples with a macro with two 
+       arguments.
+
+2015-09-19  Gavin Smith  <address@hidden>
+
        * doc/texinfo.tex (\afterenvbreak): Copy from \aboveenvbreak.
        (\aboveenvbreak): Insert a penalty for page breaking above 
        environment, instead of a bonus.

Modified: trunk/doc/texinfo-tex-test.texi
===================================================================
--- trunk/doc/texinfo-tex-test.texi     2015-09-19 13:05:24 UTC (rev 6633)
+++ trunk/doc/texinfo-tex-test.texi     2015-09-19 20:39:20 UTC (rev 6634)
@@ -32,7 +32,7 @@
 @end macro
 
 @macro Mactwo{x, y}
-B\x\B C\y\C
+<\x\>.<\y\>@.
 @end macro
 
 @rmacro RMac{x}
@@ -97,7 +97,13 @@
 
 three backslashes outside \\\
 
-test @,c for c cedilla
+Macros with two arguments:
+0+0 @Mactwo{A,B}
+0+0 @Mactwo{A, B}
+1+0 @Mactwo{\A, B}
+0+1 @Mactwo{A, \\B}
+2+1 @Mactwo{\\\A, \\B}
+2+2 @Mactwo{\\\A, \\\\B}
 
 @section Spaces in macro bodies
 
@@ -212,7 +218,6 @@
 
 @section Multi-line macro argument
 
address@hidden
 @macro Mac{text}
 @cartouche
 <@b{FIXME}>

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2015-09-19 13:05:24 UTC (rev 6633)
+++ trunk/doc/texinfo.tex       2015-09-19 20:39:20 UTC (rev 6634)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2015-09-20.15}
+\def\texinfoversion{2015-09-19.22}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -4679,6 +4679,7 @@
   % that we make for arg2 (see \parsemargdef ff.).  We want all this to be
   % expanded for the sake of the index, so we end up just seeing "bar".
   \let\xeatspaces = \eatspaces
+  \let\xprocessmacroarg\eatspaces
 }
 
 % For testing: output @{ and @} in index sort strings as \{ and \}.
@@ -7547,6 +7548,8 @@
 \def\scanmacro#1{%
   \newlinechar`\^^M
   \let\xeatspaces\eatspaces
+  % Reduce doubled backslashes to one
+  \def\xprocessmacroarg{\passargtomacro\eatspaces}%
   %
   % Process the macro body under the current catcode regime.
   \scantokens{#1\texinfoc}\aftermacro%
@@ -7804,12 +7807,12 @@
 {\catcode`\ address@hidden rmacro{%
 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
 
-%%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
-
 % Make @ a letter, so that we can make private-to-Texinfo macro names.
 address@hidden
 \catcode address@hidden
 
+%%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
+
 % If there are 10 or more arguments, a different technique is used, where the
 % hook remains in the body, and when macro is to be expanded the body is
 % processed again to replace the arguments.
@@ -8008,9 +8011,7 @@
    \long\def#2{#4}%
 }
 
-\catcode address@hidden % end private-to-Texinfo catcodes
 
-
 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
 
 
@@ -8023,7 +8024,7 @@
 
 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
 %    \macrobody has the body of the macro in it, with placeholders for
-% its parameters.
+% its parameters, looking like "\processmacroarg{\hash 1}".
 %    \paramno is the number of parameters
 %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
 % There are eight cases: recursive and nonrecursive macros of zero, one,
@@ -8040,8 +8041,8 @@
     % when the argument to \eatspaces is read, leading to line-based
     % commands like "@itemize" not being read correctly.
   \else
-    \let\xeatspaces\relax
-    \def\processmacroarg{\xeatspaces}%
+    \def\processmacroarg{\xprocessmacroarg}%
+    \let\xprocessmacroarg\relax
   \fi
   \ifrecursive   %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     \ifcase\paramno
@@ -8052,25 +8053,25 @@
       \expandafter\xdef\csname\the\macname\endcsname{%
          \bgroup
          \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-         \expandafter\noexpand\csname\the\macname xxxx\endcsname{%
+         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
+      \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
+         \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
            \noexpand\gobblespaces##1\empty}%
            % The \empty is for \gobblespaces in case #1 is empty
          }%
-      \expandafter\xdef\csname\the\macname xxxx\endcsname##1{%
+      \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
          \egroup\noexpand\scanmacro{\macrobody}}%
     \else
       \ifnum\paramno<10\relax % at most 9
         \expandafter\xdef\csname\the\macname\endcsname{%
            \bgroup\noexpand\macroargctxt
-           \noexpand\csname\the\macname xx\endcsname}%
-        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+           \noexpand\csname\the\macname @@\endcsname}%
+        \expandafter\xdef\csname\the\macname @@\endcsname##1{%
+            \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}%
         \expandafter\expandafter
         \expandafter\xdef
         \expandafter\expandafter
-          \csname\the\macname xxx\endcsname
+          \csname\the\macname @@@\endcsname
             \paramlist{\egroup\noexpand\scanmacro{\macrobody}}%
       \else % 10 or more
         \expandafter\xdef\csname\the\macname\endcsname{%
@@ -8089,13 +8090,13 @@
       \expandafter\xdef\csname\the\macname\endcsname{%
          \bgroup
          \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-         \expandafter\noexpand\csname\the\macname xxxx\endcsname{%
+         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
+      \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
+         \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
            \noexpand\gobblespaces##1\empty}%
            % The \empty is for \gobblespaces in case #1 is empty
          }%
-      \expandafter\xdef\csname\the\macname xxxx\endcsname##1{%
+      \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
         \egroup
         \noexpand\scanmacro{\macrobody}%
         }%
@@ -8103,13 +8104,13 @@
       \ifnum\paramno<10\relax
         \expandafter\xdef\csname\the\macname\endcsname{%
            \bgroup\noexpand\macroargctxt
-           \expandafter\noexpand\csname\the\macname xx\endcsname}%
-        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+           \expandafter\noexpand\csname\the\macname @@\endcsname}%
+        \expandafter\xdef\csname\the\macname @@\endcsname##1{%
+            \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}%
         \expandafter\expandafter
         \expandafter\xdef
         \expandafter\expandafter
-        \csname\the\macname xxx\endcsname
+        \csname\the\macname @@@\endcsname
         \paramlist{%
             \egroup
             \noexpand\scanmacro{\macrobody}%
@@ -8124,6 +8125,8 @@
     \fi
   \fi}
 
+\catcode address@hidden % end private-to-Texinfo catcodes
+
 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
 
 




reply via email to

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