From 2fcce1d3b0b0a5781a63b2ceb2f7729c0623b7ba Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@gnu.org>
Date: Wed, 1 Apr 1998 00:33:30 +0000
Subject: (\doignore): Ignore everything after `c', so @end ifinfo and the like
 can be commented out. (\macrocsname): New macro. Reported by: "James A. Lupo"
 <lupoja@feynman.ml.wpafb.af.mil>

---
 texinfo.tex | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'texinfo.tex')

diff --git a/texinfo.tex b/texinfo.tex
index 1701ae1..56167d6 100644
--- a/texinfo.tex
+++ b/texinfo.tex
@@ -25,8 +25,10 @@
 %
 % Please try the latest version of texinfo.tex before submitting bug
 % reports; you can get the latest version from:
-% ftp://ftp.cs.umb.edu/pub/tex/texinfo.tex
 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
+% ftp://tug.org/tex/texinfo.tex
+% ftp://ctan.org/macros/texinfo/texinfo.tex
+% (and all CTAN mirrors, finger info@ctan.org for a list).
 % 
 % Send bug reports to bug-texinfo@gnu.org.
 % Please include a precise test case in each bug report,
@@ -772,6 +774,7 @@ where each line of input produces a line of output.}
 % Also ignore @macro ... @end macro.  The user must run texi2dvi,
 % which runs makeinfo to do macro expansion.  Ignore @unmacro, too.
 \def\macro{\doignore{macro}}
+\def\macrocsname{macro}
 \let\unmacro = \comment
 
 
@@ -786,7 +789,9 @@ where each line of input produces a line of output.}
   \ignoresections
   %
   % Define a command to swallow text until we reach `@end #1'.
-  \long\def\doignoretext##1\end #1{\enddoignore}%
+  % This @ is a catcode 12 token (that is the normal catcode of @ in
+  % this texinfo.tex file).  We change the catcode of @ below to match.
+  \long\def\doignoretext##1@end #1{\enddoignore}%
   %
   % Make sure that spaces turn into tokens that match what \doignoretext wants.
   \catcode32 = 10
@@ -795,6 +800,22 @@ where each line of input produces a line of output.}
   \catcode`\{ = 9
   \catcode`\} = 9
   %
+  % We must not have @c interpreted as a control sequence.
+  \catcode`\@ = 12
+  %
+  % Make the letter c a comment character so that the rest of the line
+  % will be ignored. This way, the document can have (for example)
+  %   @c @end ifinfo
+  % and the @end ifinfo will be properly ignored.
+  % (We've just changed @ to catcode 12.)
+  % 
+  % But we can't do this if #1 is `macro', since that actually contains a c.
+  % Happily, none of the other conditionals have the letter `c' in their names!
+  \def\temp{#1}%
+  \ifx\temp\macrocsname \else
+    \catcode`\c = 14
+  \fi
+  %
   % And now expand that command.
   \doignoretext
 }
-- 
cgit v1.2.3

