@@ -57,7 +57,21 @@ for f in \
5757do
5858 f=$( basename $f .web)
5959
60- if $CHANGES
60+ if [ ctwill = $f ]
61+ then
62+ # amend TeX Live's 'prod-twill.w' for (c)twill'ing
63+ if [ ! -e prod-twill.w ]
64+ then
65+ tie -m prod-twill.w prod-twill.w prod-mini.ch
66+ fi
67+ # apply tons of editorial changes to 'ctwill.w'
68+ CWEBINPUTS=.:$CWEBINPUTS \
69+ ctie -m $f .w cweave.w $f -w2c.ch $f -mini.ch
70+ cp -an $KNUTHWARE /cwebdir/* .bux .
71+ $CTWILL $f
72+ $CTWILL $f
73+
74+ elif $CHANGES
6175 then
6276 # pdftex.ch and xetex.ch for TeX Live are assembled here
6377 WEBINPUTS=$KNUTHWARE /../../Work//:$WEBINPUTS :
6680 common ) $CWEAVE $f comm-w2c ;;
6781 ctangle ) $CWEAVE $f ctang-w2c ;;
6882 cweave ) $CWEAVE $f cweav-w2c ;;
69- ctwill ) ;; # do nothing for CTWILL
7083 ctie ) $CWEAVE $f $f -k ;;
7184 tie ) $CWEAVE $f $f -w2c ;;
7285
7386 * ) weave $f $f ;;
7487 esac
7588
76- # only document changed modules/sections
77- case $f in
78- # XeTeX uses '\pdfTeX' from section 114, which
79- # is not changed and thus 'disappears'
80- xetex ) sed -i -e " s/\(\\\\ let\\\\ maybe=\)\\\\ iftrue/\1\\\\ iffalse\n\\\\ def\\\\ pdfTeX{pdf\\\\ TeX}/" \
81- $f .tex ;;
82-
83- ctwill ) ;; # do nothing for CTWILL
89+ # FIX: XeTeX uses '\pdfTeX' from section 114, which
90+ # is not changed and thus 'disappears'
91+ if [ xetex = $f ]
92+ then
93+ sed -i -e " s/\(\\\\ let\\\\ maybe\)/\\\\ def\\\\ pdfTeX{pdf\\\\ TeX}\n\1/" \
94+ $f .tex
95+ fi
8496
85- * ) sed -i -e " s/\( \\\\ let \\\\ maybe=\) \\\\ iftrue/\1 \\\\ iffalse/ " \
86- $f .tex ;;
87- esac
97+ # only document changed modules/sections
98+ sed -i -e " s/\( \\\\ let \\\\ maybe=\) \\\\ iftrue/\1 \\\\ iffalse/ " \
99+ $f .tex
88100 else
89101 case $f in
90- common | ctangle | cweave | ctie | tie ) $CWEAVE $f ;;
91-
92- ctwill ) ;; # do nothing for CTWILL
102+ c* | tie ) $CWEAVE $f ;;
93103
94104 * ) weave $f ;;
95105 esac
96106 fi
97107
98- # Format CTWILL in its own format
99- if [ ctwill = $f ]
100- then
101- # amend TeX Live's 'prod-twill.w' for (c)twill'ing
102- if [ ! -e prod-twill.w ]
103- then
104- tie -m prod-twill.w prod-twill.w prod-mini.ch
105- fi
106- CWEBINPUTS=.:$CWEBINPUTS \
107- ctie -m $f .w cweave.w $f -w2c.ch $f -mini.ch
108- cp -an $KNUTHWARE /cwebdir/* .bux .
109- $CTWILL $f
110- $CTWILL $f
111- fi
112-
113- # use extended WEB macros for TeX Live PDF documentation
114108 if $NEW
115109 then
110+ # use extended WEB macros for TeX Live PDF documentation
116111 sed -i -e " 1 s/\\\\ input webmac/\\\\ input pwebmac/" $f .tex
117112
118113 # timestamp on table-of-contents page or the first page
119114 case $f in
115+ c* | tie ) ;; # do nothing for CWEB programs
116+
120117 bibtex | patgen | tangle | weave )
121118 sed -i -e " s/\(\\\\ def\\\\ title\)/\\\\ datecontentspage\n\1/" $f .tex ;;
122119
123120 mf | tex | pdftex | xetex )
124- sed -i -e " s/\(\\\\ def\\\\ botofcontents\)/\\\\ datethis\n\1/" $f .tex ;;
121+ sed -i -e " s/\(\\\\ def\\\\ botofcontents\)/\\\\ datethis\n\1/" $f .tex
125122
126- c* | tie ) ;; # do nothing for CWEB programs
123+ # amend '\N' redefinition for PDF outlines in
124+ # Metafont and TeX (also pdfTeX and XeTeX)
125+ # 'pwebmac' defines headers differently
126+ sed -i -e " s/\(\\\\ outer\\\\ def\\\\ N.*{\)/\1%/" \
127+ -e " s/\\\\ def\\\\ rhead\(.*}\)/\\\\ gtitle=\1\\\\ MN#1.\\\\ vfill\\\\ eject/" \
128+ $f .tex
129+
130+ # active links in PDF outlines/bookmarks
131+ cat > texmf-pdf.patch << FI
132+ \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
133+ FI
134+ sed -i -e " /\\\\ outer\\\\ def\\\\ N/ {
135+ r texmf-pdf.patch
136+ }" $f .tex
137+
138+ cat > texmf-pdf.patch << FI
139+ \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
140+ [ @thispage /FitH @ypos ] >>}\fi
141+ FI
142+ sed -i -e " / \\\\ edef\\\\ next/ {
143+ r texmf-pdf.patch
144+ }" $f .tex
145+ rm texmf-pdf.patch ;;
127146
128147 * ) sed -i -e " s/\(\\\\ def\\\\ botofcontents\)/%\1/" \
129148 -e " s/ \\\\ centerline{\(\\\\ hsize\)/\\\\ def\\\\ covernote{\1/" \
138157 # FIX: most of the WEB codes will be corrected.
139158 sed -i -e " s/\\\\ def\\\\ titlepage{F}/\\\\ titlefalse/" $f .tex
140159
141- # special treatment for individual WEB programs
160+ # special treatment for individual (C) WEB programs
142161 case $f in
143162 # purge conflict between bibtex.web and webmac.tex
144163 # 'E' no longer free to be active character
154173 # FIX: should be fixed upstream.
155174 tangle ) sed -i -e " s/number{123}/number{125}/" $f .tex ;;
156175
157- # amend '\N' redefinition for PDF outlines in mf.tex and
158- # tex.tex (also pdftex.web and xetex.web); this depends on
159- # the extended 'pwebmac.tex' macros
160- mf | tex | pdftex | xetex )
161- if [ xetex = $f ]
162- then
163- # purge obsolete macros from XeTeX
164- sed -i -e " /\\\\ input xewebmac/d" $f .tex
165- fi
166- if $NEW
167- then
168- # 'pwebmac' defines headers differently
169- sed -i -e " s/\(\\\\ outer\\\\ def\\\\ N.*{\)/\1%/" \
170- -e " s/\\\\ def\\\\ rhead\(.*}\)/\\\\ gtitle=\1\\\\ MN#1.\\\\ vfill\\\\ eject/" \
171- $f .tex
172-
173- # active links in PDF outlines/bookmarks
174- cat > texmf-pdf.patch << FI
175- \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
176- FI
177- sed -i -e " /\\\\ outer\\\\ def\\\\ N/ {
178- r texmf-pdf.patch
179- }" $f .tex
180-
181- cat > texmf-pdf.patch << FI
182- \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
183- [ @thispage /FitH @ypos ] >>}\fi
184- FI
185- sed -i -e " / \\\\ edef\\\\ next/ {
186- r texmf-pdf.patch
187- }" $f .tex
188- rm texmf-pdf.patch
189- fi ;;
176+ # FIX: purge obsolete macros from XeTeX
177+ xetex ) sed -i -e " /\\\\ input xewebmac/d" $f .tex ;;
190178
179+ # Use nicer format for C comments and assignment
191180 common | ctangle | cweave | ctie | tie ) # sans ctwill
192- # Use nicer format for C comments and assignment
193181 sed -i -e " 1 s/\(cwebmac\)/\1\n\\\\ input Xcwebmac/" \
194182 $f .tex ;;
195183 esac
215203
216204 if [ ctwill = $f ]
217205 then
206+ # sort mini-indexes
218207 ctwill-refsort < $f .ref > $f .sref
219208 $TEX $f
220209 fi
0 commit comments