From 943863160772f86ad635c253e6f26cb2c15de76a Mon Sep 17 00:00:00 2001
From: Andreas Scherer <andreas_tex@freenet.de>
Date: Sun, 31 Oct 2021 19:11:48 +0000
Subject: [CWEB] Restore '\T' macro backward compatibility.

CWEB 4.3 introduced a major change in the '\T' macro to allow C++ 'hex
exponent' notation (e.g., 0x1FFFFp10). This made CWEAVE/CTWILL mutually
incompatible with non-matching versions of their set of macros and v.v.

This change tries to reestablish the standard behavior at least for
numeric constants.  Of course, 'old' CWEAVE/CTWILL won't deliver on 'hex
exponents' in the CWEB input, but those should be rare anyway.

git-svn-id: svn://tug.org/texlive/trunk@60909 c570f23f-e606-0410-a88d-b1316a301751
---
 Build/source/texk/web2c/cwebdir/ctwimac.tex | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

(limited to 'Build/source/texk/web2c/cwebdir/ctwimac.tex')

diff --git a/Build/source/texk/web2c/cwebdir/ctwimac.tex b/Build/source/texk/web2c/cwebdir/ctwimac.tex
index b5a81e8364b..df249009256 100644
--- a/Build/source/texk/web2c/cwebdir/ctwimac.tex
+++ b/Build/source/texk/web2c/cwebdir/ctwimac.tex
@@ -1,9 +1,9 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.4 --- July 2021
+% Version 4.5 --- October 2021
 % modified for pages produced by CTWILL
 % further modified for page size of the MMIXware book
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CTWILL4.4+LNCS}
+\xdef\fmtversion{\fmtversion+CTWILL4.5+LNCS}
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -29,6 +29,7 @@
 \def\TEX/{\TeX}
 \def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
 \def\Cee{\CEE/} % for backward compatibility
+\def\Cpp{\CPLUSPLUS/} % for backward compatibility
 \def\9#1{}
 \font\eightrm=cmr8
 \font\sixrm=cmr6
@@ -278,10 +279,10 @@
 % \S is section sign
 \def\T#1{\leavevmode % octal, hex or decimal constant
   \hbox{$\def\?{\kern.2em}%$%
-    \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant
+    \let\ \, % C++ digit separator becomes a little white space
+    \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
     \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
-    \def\%{\cdot 2^{\aftergroup}}% power of two (via dirty trick)
-    \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$%
+    \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
 \def\U{\note{This code is used in section}} % xref for use of a section
 \def\Us{\note{This code is used in sections}} % xref for uses of a section
 \let\V=\lor % logical or
@@ -295,15 +296,13 @@
 
 %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style
 %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style
-\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style
-\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style
-\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd}
-\def\Od#1/{{\it#1}} % octal digit
-\def\Hd#1/{{\tt#1}} % hexadecimal digit
-\def\Bd#1/{{\tt#1}} % binary digit
+\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} % CWEB style
+\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style
+\def\bin{\hbox{$^{\scriptscriptstyle b}$\tt\aftergroup}} % new in CWEB 4.3
 \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule
         \hbox{\strut\kern2pt\.{#1}\kern2pt}}
       \hrule}\vrule\kern2pt}} % verbatim string
+\def\p#1{\cdot 2^{#1}} % power of two (hex exponent)
 
 % now here's the mini-index formatting control
 \newcount\nrefs % total number of references in partial page
-- 
cgit v1.2.3

