texlive[61785] Build/source/texk/web2c/cwebdir: [CWEB] Support HINT

commits+ascherer at tug.org commits+ascherer at tug.org
Sat Jan 29 16:55:26 CET 2022


Revision: 61785
          http://tug.org/svn/texlive?view=revision&revision=61785
Author:   ascherer
Date:     2022-01-29 16:55:26 +0100 (Sat, 29 Jan 2022)
Log Message:
-----------
[CWEB] Support HINT format.

The upcoming CWEB 4.7 will support HiTeX and its HINT format.

To use this material you can
$ hitex -ini -jobname=hitex tex.ini
$ make all PDF=hi fullmanual
$ hintview common.hnt # et al.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/Makefile
    trunk/Build/source/texk/web2c/cwebdir/comm-man.ch
    trunk/Build/source/texk/web2c/cwebdir/ctang-man.ch
    trunk/Build/source/texk/web2c/cwebdir/cweav-man.ch
    trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
    trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
    trunk/Build/source/texk/web2c/cwebdir/cwebman.tex
    trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2022-01-29 15:55:26 UTC (rev 61785)
@@ -1,3 +1,14 @@
+2022-01-29  Andreas Scherer  <https://ascherer.github.io>
+
+	* Makefile,
+	* comm-man.ch,
+	* ctang-man.ch,
+	* cweav-man.ch,
+	* cwebmac.tex,
+	* cwebman-w2c.ch,
+	* cwebman.tex,
+	* texinputs/pdfctwimac.tex: Support HINT format.
+
 2022-01-15  Andreas Scherer  <https://ascherer.github.io>
 
 	* comm-pc.ch,

Modified: trunk/Build/source/texk/web2c/cwebdir/Makefile
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/Makefile	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/Makefile	2022-01-29 15:55:26 UTC (rev 61785)
@@ -64,9 +64,11 @@
 
 # uncomment the second line if you use pdftex to bypass .dvi files
 # uncomment the third line if you use xetex to bypass .dvi files
+# uncomment the forth line if you use hitex for HINT output
 PDFTEX = dvipdfm
 #PDFTEX = pdftex
 #PDFTEX = xetex
+#PDFTEX = hitex
 
 ##########  You shouldn't have to change anything after this point #######
 
@@ -108,6 +110,7 @@
 	 dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \
 	 pdftex ) pdftex $* ;; \
 	 xetex ) xetex $* ;; \
+	 hitex ) hitex $* ;; \
 	esac
 
 all: ctangle cweave
@@ -163,7 +166,7 @@
 # be sure to leave ctangle.c and common.c for bootstrapping
 clean:
 	$(RM) -f -r *~ *.o common.tex cweave.tex cweave.c ctangle.tex \
-	  *.log *.dvi *.toc *.idx *.scn *.pdf core cweave ctangle
+	  *.log *.dvi *.toc *.idx *.scn *.pdf *.hnt core cweave ctangle
 
 install: all
 	- mkdir $(DESTDIR)

Modified: trunk/Build/source/texk/web2c/cwebdir/comm-man.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/comm-man.ch	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/comm-man.ch	2022-01-29 15:55:26 UTC (rev 61785)
@@ -16,7 +16,7 @@
 }
 @y
 \def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{28}
+\def\contentspagenumber{29}
 \def\title{APPENDIX D: COMMON}
 \let\K=\leftarrow
 @z

Modified: trunk/Build/source/texk/web2c/cwebdir/ctang-man.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctang-man.ch	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/ctang-man.ch	2022-01-29 15:55:26 UTC (rev 61785)
@@ -16,7 +16,7 @@
 }
 @y
 \def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{64}
+\def\contentspagenumber{65}
 \def\title{APPENDIX E: CTANGLE}
 \let\K=\leftarrow
 @z

Modified: trunk/Build/source/texk/web2c/cwebdir/cweav-man.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cweav-man.ch	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/cweav-man.ch	2022-01-29 15:55:26 UTC (rev 61785)
@@ -16,7 +16,7 @@
 }
 @y
 \def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{108}
+\def\contentspagenumber{109}
 \def\title{APPENDIX F: CWEAVE}
 \let\K=\leftarrow
 @z

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex	2022-01-29 15:55:26 UTC (rev 61785)
@@ -1,8 +1,8 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.6 --- December 2021
+% Version 4.7--- January 2022
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CWEB4.6}
-\chardef\cwebversion=4 \chardef\cwebrevision=6
+\xdef\fmtversion{\fmtversion+CWEB4.7}
+\chardef\cwebversion=4 \chardef\cwebrevision=7
 \newif\ifpdf
 \ifx\pdf+\pdftrue\fi
 % Uncomment the following line if you want PDF goodies to be the default
@@ -16,7 +16,10 @@
   \def\Black{\pdfliteral{0 g 0 G}}  % use rgb colors for direct PDF output too
   \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}}
 \fi\fi
+\newif\ifHINT
+\ifx\HINToutline\undefined \HINTfalse \else \HINTtrue \fi
 \newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\newif\ifacroHINT \ifacro\acroHINTtrue\fi \ifHINT\acroHINTtrue\fi
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -127,7 +130,7 @@
 \def\?{\mathrel?}
 \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
 \def\note#1#2.{\Y\noindent{\hangindent2em%
-    \baselineskip10pt\eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
+    \baselineskip10pt\eightrm#1~\ifacroHINT{\pdfnote#2.}\else#2\fi.\par}}
 
 \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
 \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
@@ -148,29 +151,6 @@
     \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
       depth \thedepth << /Type /Annot /Subtype /Link
       /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi
-\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
-\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
-    \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
-      \toksC={}\let\space\empty}\makenote}\maketoks}}
-\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
-  \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
-\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
-  \ifnum\countB>`9 \countB=0 \fi
-  \ifnum\countB<`0
-    \ifnum0=\countC\else\makenote\fi
-    \ifx\first.\let\next=\maketoksdone\else
-        \let\next=\maketoks
-        \addtokens\toksB{\the\toksD}
-        \ifx\first,\addtokens\toksB{\space}\fi
-    \fi
-  \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
-  \fi
-  \next
-}
-\def\makenote{\addtokens\toksB
-    {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
-\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 \def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
   attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A
       << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69
@@ -235,7 +215,7 @@
   \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi  % 0.1E5->\T{0.1\_5}
   \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi  % 0x77 -> \T{\^77}
   \else\ifx\nxt\\\\\ifTnum\addF{0b}\else\addF\\\fi  % 0b10111 -> \T{\\10111}
-  \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi % \T{77\$L}
+  \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi %$% \T{77\$L}
   \else\ifx\nxt\{\addF\lbchar       \else\ifx\nxt\}\addF\rbchar
   \else\ifx\nxt\ \addF\space        \else\ifx\nxt\#\addF{\string\#}%
   \else\ifx\nxt\PP\addF{++}\else\ifx\nxt\MM\addF{--}%
@@ -281,9 +261,53 @@
   \outlinest\let\outlinedone=\relax}
 \fi % End of pdf macros
 
+\ifHINT
+% The following uses HINT primitives to implement:
+% \HINThome to mark the position of the home page
+% \HINTlabel to attach a label to the top of a section
+% \HINTlink to link a section number to the section label
+% \HINTcontents to produce an 'outline' item
+% These are the top level HINT macros that are used in this file
+% No HINT primitives are used directly.
+\def\HINThome{\HINTdest name {HINT.home}%
+  \HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
+\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}}
+\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ???
+\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}}
+\let\pdflink=\HINTlink
+\fi % End of HINT macros
+
+% Common macros for \ifacro and \ifHINT
+\ifacroHINT
+\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
+\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
+    \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
+      \toksC={}\let\space\empty}\makenote}\maketoks}}
+\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
+  \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
+\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
+  \ifnum\countB>`9 \countB=0 \fi
+  \ifnum\countB<`0
+    \ifnum0=\countC\else\makenote\fi
+    \ifx\first.\let\next=\maketoksdone\else
+        \let\next=\maketoks
+        \addtokens\toksB{\the\toksD}
+        \ifx\first,\addtokens\toksB{\space}\fi
+    \fi
+  \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
+  \fi
+  \next
+}
+\def\makenote{\addtokens\toksB
+    {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
+\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % End of common macros
+
 \def\lapstar{\rlap{*}}
 \def\stsec{\rightskip=0pt % get out of C mode (cf. \B)
   \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
+  \ifHINT\HINTlabel\fi% Start page before section
   \noindent{\let\*=\lapstar\bf\secstar.\quad}%
   \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
     \ifpdftex \pdfdest num \secstar fith%
@@ -345,12 +369,12 @@
 \let\R=\lnot % logical not
 % \S is section sign
 \def\T#1{\leavevmode % octal, hex or decimal constant
-  \hbox{$\def\?{\kern.2em}%
+  \hbox{$\def\?{\kern.2em}%$%
     \let\ \, % C++ digit separator becomes a little white space
 %    \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant % versions < 3.67
     \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant % in version 3.67
     \def\_{\cdot 10^{\aftergroup}}% power of ten (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
@@ -357,7 +381,7 @@
 \let\W=\land % logical and
 \def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi %$% section name
   \XX$\langle\,${\let\I=\ne#2\eightrm\kern.5em
-    \ifacro{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX}
+    \ifacroHINT{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX}
 \def\Y{\par\yskip}
 \let\Z=\le
 \let\ZZ=\let % now you can \write the control sequence \ZZ
@@ -451,7 +475,9 @@
   \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height
   \hsize=.5\pagewidth \advance\hsize by -10pt
     % column width for the index (20pt between cols)
+  \ifHINT\else
   \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
+  \fi
   \def\lr{L} % this tells whether the left or right column is next
   \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
     \else\normaloutput{\vbox to\pageheight{\box\sbox\vss
@@ -460,7 +486,7 @@
   \message{Index:}
   \parskip 0pt plus .5pt
   \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em
-    \ifacro\pdfnote##2.\else##2\fi.} % index entry
+    \ifacroHINT\pdfnote##2.\else##2\fi.} % index entry
   \def\[##1]{$\underline{##1}$} % underlined index item
   \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
   \hyphenpenalty 10000 \parindent0pt
@@ -475,7 +501,7 @@
   \message{Section names:}
   \output={\normaloutput\page\lheader\rheader}
   \setpage
-  \def\note##1##2.{\quad{\eightrm##1~\ifacro{\pdfnote##2.}\else{##2}\fi.}}
+  \def\note##1##2.{\quad{\eightrm##1~\ifacroHINT{\pdfnote##2.}\else{##2}\fi.}}
   \def\Q{\note{Cited in section}} % crossref for mention of a section
   \def\Qs{\note{Cited in sections}} % crossref for mentions of a section
   \def\U{\note{Used in section}} % crossref for use of a section
@@ -512,8 +538,9 @@
   \pageno=\contentspagenumber
   \def\grouptitle{TABLE OF CONTENTS}
   \message{Table of contents:}
+  \ifHINT\HINThome\fi% Mark the Table of contents as home page
   \topofcontents \startpdf
-  \line{\hfil Section\hbox to3em{\hss Page}}
+  \line{\hfil Section\ifHINT\else\hbox to3em{\hss Page}\fi}% No Page in HINT
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info
   \botofcontents \end} % print the contents page(s) and terminate
@@ -520,7 +547,11 @@
 \def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi
     \line{\consetup{#2}#1
       \rm\leaders\hbox to .5em{.\hfil}\hfil
-      \ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}}
+      \ \ifHINT
+          \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT
+          \HINTcontents{#1}{#2}{#3}%
+        \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi
+          \hbox to3em{\hss#4}\fi}}
 \def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
   \or % depth 0 (@*)
   \or \hskip2em % depth 1 (@*1)

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2022-01-29 15:55:26 UTC (rev 61785)
@@ -18,7 +18,7 @@
 
 @x
 \input cwebmac
-\acrofalse\pdffalse\pdftexfalse
+\acrofalse\pdffalse\pdftexfalse\HINTfalse\acroHINTfalse
 @y
 \input cwebmac
 @z

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebman.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebman.tex	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebman.tex	2022-01-29 15:55:26 UTC (rev 61785)
@@ -2,7 +2,7 @@
 
 \def\tangref{3} % where the main explanation of CTANGLing is given
 \input cwebmac
-\acrofalse\pdffalse\pdftexfalse
+\acrofalse\pdffalse\pdftexfalse\HINTfalse\acroHINTfalse
 \def\page{\box255 } \normalbottom
 \parskip 0pt plus 1pt
 \def\RA{\char'31 } % right arrow

Modified: trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex	2022-01-29 10:40:22 UTC (rev 61784)
+++ trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex	2022-01-29 15:55:26 UTC (rev 61785)
@@ -1,11 +1,11 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.5 --- October 2021
+% Version 4.6 --- January 2022
 % modified for pages produced by CTWILL
 % further modified for page size of the MMIXware book
 % modified for PDF output with 'tex "\let\pdf+', 'pdftex', and 'xetex'
 % This file is not copyrighted and can be used freely.
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CTWILL4.5+LNCS+PDF}
+\xdef\fmtversion{\fmtversion+CTWILL4.6+LNCS+PDF}
 
 \newif\ifpdf
 \ifx\pdf+\pdftrue\fi
@@ -19,7 +19,10 @@
   \def\Black{\pdfliteral{0 g 0 G}}  % use rgb colors for direct PDF output too
   \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}}
 \fi\fi
+\newif\ifHINT
+\ifx\HINToutline\undefined \HINTfalse \else \HINTtrue \fi
 \newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\newif\ifacroHINT \ifacro\acroHINTtrue\fi \ifHINT\acroHINTtrue\fi
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -238,7 +241,7 @@
 \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
 \def\note#1#2.{\par\penalty5000
   \Y\noindent{\hangindent2\em\baselineskip10pt%
-    \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
+    \eightrm#1~\ifacroHINT{\pdfnote#2.}\else#2\fi.\par}}
 
 \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
 \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
@@ -259,29 +262,6 @@
     \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
       depth \thedepth << /Type /Annot /Subtype /Link
       /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi
-\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
-\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
-    \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
-      \toksC={}\let\space\empty}\makenote}\maketoks}}
-\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
-  \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
-\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
-  \ifnum\countB>`9 \countB=0 \fi
-  \ifnum\countB<`0
-    \ifnum0=\countC\else\makenote\fi
-    \ifx\first.\let\next=\maketoksdone\else
-        \let\next=\maketoks
-        \addtokens\toksB{\the\toksD}
-        \ifx\first,\addtokens\toksB{\space}\fi
-    \fi
-  \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
-  \fi
-  \next
-}
-\def\makenote{\addtokens\toksB
-    {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
-\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 \def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
   attr {/Border [0 0 0]} user {/Type /Action /Subtype /Link /A
       << /S /URI /URI (#2) >>}\PDFlinkcolor #1\Black \pdfendlink
@@ -392,9 +372,53 @@
   \outlinest\let\outlinedone=\relax}
 \fi % End of pdf macros
 
+\ifHINT
+% The following uses HINT primitives to implement:
+% \HINThome to mark the position of the home page
+% \HINTlabel to attach a label to the top of a section
+% \HINTlink to link a section number to the section label
+% \HINTcontents to produce an 'outline' item
+% These are the top level HINT macros that are used in this file
+% No HINT primitives are used directly.
+\def\HINThome{\HINTdest name {HINT.home}%
+  \HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
+\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}}
+\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ???
+\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}}
+\let\pdflink=\HINTlink
+\fi % End of HINT macros
+
+% Common macros for \ifacro and \ifHINT
+\ifacroHINT
+\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
+\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
+    \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
+      \toksC={}\let\space\empty}\makenote}\maketoks}}
+\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
+  \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
+\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
+  \ifnum\countB>`9 \countB=0 \fi
+  \ifnum\countB<`0
+    \ifnum0=\countC\else\makenote\fi
+    \ifx\first.\let\next=\maketoksdone\else
+        \let\next=\maketoks
+        \addtokens\toksB{\the\toksD}
+        \ifx\first,\addtokens\toksB{\space}\fi
+    \fi
+  \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
+  \fi
+  \next
+}
+\def\makenote{\addtokens\toksB
+    {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
+\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % End of common macros
+
 \def\lapstar{\rlap{*}}
 \def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B)
   \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
+  \ifHINT\HINTlabel\fi% Start page before section
   \noindent\strut{\let\*=\lapstar\bf\secno.\quad}%
   \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
     \ifpdftex \pdfdest num \secstar fith%
@@ -480,7 +504,7 @@
 \let\W=\land % logical and
 \def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi %$% section name
   \XX$\langle\,${\let\I=\ne#2\sevenrm\kern.5em
-    \ifacro{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX}
+    \ifacroHINT{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX}
 \def\Y{\par\yskip}
 \let\Z=\le
 \let\ZZ=\let % now you can \write the control sequence \ZZ
@@ -612,7 +636,7 @@
 {\obeylines\gdef\makeinref#1 #2 #3
   {\ifsorted\else\ttoks={\[#1 #2 #3}\immediate\write\reffile{+ \the\ttoks}\fi %
   \hangindent=1em \noindent #2\miniform#3, %<== space!
-    \S\ifacro{\pdfnote#1.}\else{#1}\fi.\par}}
+    \S\ifacroHINT{\pdfnote#1.}\else{#1}\fi.\par}}
 {\obeylines\gdef\makeoutref#1 #2 #3
   {\ifsorted\else\ttoks={\]#1 #2 #3}\immediate\write\reffile{+ \the\ttoks}\fi %
   \hangindent=1em \noindent #2\miniform#3, \extref#1.\par}}
@@ -704,8 +728,9 @@
   %\pageno=\contentspagenumber
   %\def\grouptitle{TABLE OF CONTENTS}
   %\message{Table of contents:}
+  %\ifHINT\HINThome\fi% Mark the Table of contents as home page
   %\topofcontents \startpdf
-  %\line{\hfil Section\hbox to3em{\hss Page}}
+  %\line{\hfil Section\ifHINT\else\hbox to3em{\hss Page}\fi}% No Page in HINT
   %\let\ZZ=\contentsline
   %\readcontents\relax % read the contents info
   %\botofcontents \end} % print the contents page(s) and terminate
@@ -712,7 +737,11 @@
 %\def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi
     %\line{\consetup{#2}#1
       %\rm\leaders\hbox to .5em{.\hfil}\hfil
-      %\ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}}
+      %\ \ifHINT
+          %\HINTlink{#3}{\romannumeral#3}% No page numbers in HINT
+          %\HINTcontents{#1}{#2}{#3}%
+        %\else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi
+          %\hbox to3em{\hss#4}\fi}}
 %\def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
   %\or % depth 0 (@*)
   %\or \hskip2em % depth 1 (@*1)



More information about the tex-live-commits mailing list.