summaryrefslogtreecommitdiff
path: root/web/pwebmac/makeall
diff options
context:
space:
mode:
Diffstat (limited to 'web/pwebmac/makeall')
-rwxr-xr-xweb/pwebmac/makeall147
1 files changed, 67 insertions, 80 deletions
diff --git a/web/pwebmac/makeall b/web/pwebmac/makeall
index a97508f416..228860f3c3 100755
--- a/web/pwebmac/makeall
+++ b/web/pwebmac/makeall
@@ -57,7 +57,21 @@ for f in \
do
f=$(basename $f .web)
- if $CHANGES
+ if [ ctwill = $f ]
+ then
+ # amend TeX Live's 'prod-twill.w' for (c)twill'ing
+ if [ ! -e prod-twill.w ]
+ then
+ tie -m prod-twill.w prod-twill.w prod-mini.ch
+ fi
+ # apply tons of editorial changes to 'ctwill.w'
+ CWEBINPUTS=.:$CWEBINPUTS \
+ ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
+ cp -an $KNUTHWARE/cwebdir/*.bux .
+ $CTWILL $f
+ $CTWILL $f
+
+ elif $CHANGES
then
# pdftex.ch and xetex.ch for TeX Live are assembled here
WEBINPUTS=$KNUTHWARE/../../Work//:$WEBINPUTS:
@@ -66,63 +80,69 @@ do
common ) $CWEAVE $f comm-w2c ;;
ctangle ) $CWEAVE $f ctang-w2c ;;
cweave ) $CWEAVE $f cweav-w2c ;;
- ctwill ) ;; # do nothing for CTWILL
ctie ) $CWEAVE $f $f-k ;;
tie ) $CWEAVE $f $f-w2c ;;
* ) weave $f $f ;;
esac
- # only document changed modules/sections
- case $f in
- # pdfTeX and XeTeX have overlong tables-of-contents
- pdftex ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
- -e "s/\(\\\\pageno=3\)/\1\n\\\\def\\\\contentspagenumber{1}/" \
- $f.tex ;;
-
- # XeTeX uses '\pdfTeX' from section 114, which
- # is not changed and thus 'disappears'
- xetex ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse\n\\\\def\\\\pdfTeX{pdf\\\\TeX}/" \
- -e "s/\(\\\\pageno=3\)/\1\n\\\\def\\\\contentspagenumber{1}/" \
- $f.tex ;;
-
- ctwill ) ;; # do nothing for CTWILL
+ # FIX: XeTeX uses '\pdfTeX' from section 114, which
+ # is not changed and thus 'disappears'
+ if [ xetex = $f ]
+ then
+ sed -i -e "s/\(\\\\let\\\\maybe\)/\\\\def\\\\pdfTeX{pdf\\\\TeX}\n\1/" \
+ $f.tex
+ fi
- * ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
- $f.tex ;;
- esac
+ # only document changed modules/sections
+ sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
+ $f.tex
else
case $f in
- common | ctangle | cweave | ctie | tie ) $CWEAVE $f ;;
- ctwill ) ;; # do nothing for CTWILL
+ c* | tie ) $CWEAVE $f ;;
+
* ) weave $f ;;
esac
fi
- # Format CTWILL in its own format
- if [ ctwill = $f ]
- then
- WEBINPUTS=/opt/github/cwebbin:$WEBINPUTS \
- tie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
- cp -an /opt/github/cwebbin/*.bux .
- $CTWILL $f
- $CTWILL $f
- fi
-
- # use extended macros for TeX Live PDF documentation
if $NEW
then
+ # use extended WEB macros for TeX Live PDF documentation
sed -i -e "1 s/\\\\input webmac/\\\\input pwebmac/" $f.tex
# timestamp on table-of-contents page or the first page
case $f in
+ c* | tie ) ;; # do nothing for CWEB programs
+
bibtex | patgen | tangle | weave )
sed -i -e "s/\(\\\\def\\\\title\)/\\\\datecontentspage\n\1/" $f.tex ;;
mf | tex | pdftex | xetex )
- sed -i -e "s/\(\\\\def\\\\botofcontents\)/\\\\datethis\n\1/" $f.tex ;;
+ sed -i -e "s/\(\\\\def\\\\botofcontents\)/\\\\datethis\n\1/" $f.tex
- c* | tie ) ;; # do nothing for CWEB programs
+ # amend '\N' redefinition for PDF outlines in
+ # Metafont and TeX (also pdfTeX and XeTeX)
+ # 'pwebmac' defines headers differently
+ sed -i -e "s/\(\\\\outer\\\\def\\\\N.*{\)/\1%/" \
+ -e "s/\\\\def\\\\rhead\(.*}\)/\\\\gtitle=\1\\\\MN#1.\\\\vfill\\\\eject/" \
+ $f.tex
+
+ # active links in PDF outlines/bookmarks
+ cat > texmf-pdf.patch << FI
+ \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
+FI
+ sed -i -e "/\\\\outer\\\\def\\\\N/ {
+ r texmf-pdf.patch
+ }" $f.tex
+
+ cat > texmf-pdf.patch << FI
+ \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
+ [ @thispage /FitH @ypos ] >>}\fi
+FI
+ sed -i -e "/ \\\\edef\\\\next/ {
+ r texmf-pdf.patch
+ }" $f.tex
+ rm texmf-pdf.patch ;;
* ) sed -i -e "s/\(\\\\def\\\\botofcontents\)/%\1/" \
-e "s/ \\\\centerline{\(\\\\hsize\)/\\\\def\\\\covernote{\1/" \
@@ -137,7 +157,7 @@ do
# FIX: most of the WEB codes will be corrected.
sed -i -e "s/\\\\def\\\\titlepage{F}/\\\\titlefalse/" $f.tex
- # special treatment for individual WEB programs
+ # special treatment for individual (C)WEB programs
case $f in
# purge conflict between bibtex.web and webmac.tex
# 'E' no longer free to be active character
@@ -153,62 +173,29 @@ do
# FIX: should be fixed upstream.
tangle ) sed -i -e "s/number{123}/number{125}/" $f.tex ;;
- # amend '\N' redefinition for PDF outlines in mf.tex and
- # tex.tex (also pdftex.web and xetex.web); depends on the
- # extended 'pwebmac.tex' macros
- mf | tex | pdftex | xetex )
- if [ xetex = $f ]
- then
- # purge obsolete macros from XeTeX
- sed -i -e "/\\\\input xewebmac/d" $f.tex
- fi
- if $NEW
- then
- if [ pdftex = $f ]
- then
- # pdfTeX has a looong table-of-contents
- cat > pdftex.patch << FI
- \advance\vsize by 4\baselineskip
- \ifacro\advance\pdfpageheight by 4\baselineskip\fi
-FI
- sed -i -e "/\\\\def\\\\topofcontents.*/ {
- r pdftex.patch
- }" $f.tex
- fi
- # active links in PDF outlines/bookmarks
- cat > texmf-pdf.patch << FI
- \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
-FI
- sed -i -e "/\\\\outer\\\\def\\\\N.*/ {
- r texmf-pdf.patch
- }" $f.tex
- cat > texmf-pdf.patch << FI
- \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
-FI
- sed -i -e "/ \\\\edef\\\\next.*/ {
- r texmf-pdf.patch
- }" $f.tex
- rm texmf-pdf.patch
- fi ;;
+ # FIX: purge obsolete macros from XeTeX
+ xetex ) sed -i -e "/\\\\input xewebmac/d" $f.tex ;;
- common | ctangle | cweave | ctie | tie )
- # Use nicer format for C comments and assignment
+ # Use nicer format for C comments and assignment
+ common | ctangle | cweave | ctie | tie ) # sans ctwill
sed -i -e "1 s/\(cwebmac\)/\1\n\\\\input Xcwebmac/" \
$f.tex ;;
esac
- if $PDFTOCFRONT
+ # shift table-of-contents pages to the front in PDF
+ if $PDFTOCFRONT && [ ctwill != $f ]
then
- # shift table-of-contents pages to the front in PDF
- sed -i -e "1 s/\(webmac\)/\1\n\\\\input pdfwebtocfront/" $f.tex
+ sed -i -e "0,/\\\\N[1{]/s/\(\\\\N[1{]\)/\\\\input pdfwebtocfront\n\n\1/" \
+ $f.tex
+ # only XeTeX can process XETEX.WEB
if [ xetex = $f ]
then $f $f # run TeX twice
else $TEX $f # run TeX twice
fi
fi
+ # only XeTeX can process XETEX.WEB
if [ xetex = $f ]
then $f $f
else $TEX $f
@@ -216,6 +203,7 @@ FI
if [ ctwill = $f ]
then
+ # sort mini-indexes
ctwill-refsort < $f.ref > $f.sref
$TEX $f
fi
@@ -280,8 +268,7 @@ then
-wvzf "$OUTDIR/ctie-changes.tar.gz" -s ,^,ctie/,
pax tie-changes.pdf \
-wvzf "$OUTDIR/tie-changes.tar.gz" -s ,^,tie/,
- pax common-changes.pdf ctangle-changes.pdf \
- cweave-changes.pdf \
+ pax common-changes.pdf ctangle-changes.pdf cweave-changes.pdf \
-wvzf "$OUTDIR/cweb-changes.tar.gz" -s ,^,cweb/,
else
pax vftovp.pdf vptovf.pdf -wvzf "$OUTDIR/etc.tar.gz" -s ,^,etc/,