Debian Codegraph @

texmf-dist/tex/plain/cweb/cttwinxmac.tex

raw
1 % macros for index produced by twinx
2
3 \let\:=\. % preserve a way to get the dot accent
4 % (all other accents will still work as usual)
5 \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
6 \let\mc=\ninerm % medium caps
7 \def\CEE/{{\mc C\spacefactor1000}}
8 \def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
9 \def\TEX/{\TeX}
10 \def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
11 \def\Cee{\CEE/} % for backward compatibility
12 \def\Cpp{\CPLUSPLUS/} % for backward compatibility
13 \def\9#1{}
14
15 \newdimen\em \em=10pt % this "em" will not change with font size
16 \parskip 0pt plus .1pt % almost no stretch between paragraphs
17 \parindent 1\em % for paragraphs and for the first line of C text
18
19 \font\ninerm=cmr9
20 \font\eightrm=cmr8
21 \font\sixrm=cmr6
22 \font\ninei=cmmi9
23 \font\eighti=cmmi8
24 \font\sixi=cmmi6
25 \skewchar\ninei='177 \skewchar\eighti='177 \skewchar\sixi='177
26 \font\ninesy=cmsy9
27 \font\eightsy=cmsy8
28 \font\sixsy=cmsy6
29 \skewchar\ninesy='60 \skewchar\eightsy='60 \skewchar\sixsy='60
30 \font\ninebf=cmbx9
31 \font\eightbf=cmbx8
32 \font\sixbf=cmbx6
33 \font\ninett=cmtt9
34 \font\eighttt=cmtt8
35 \hyphenchar\ninett=-1 \hyphenchar\eighttt=-1
36 \font\ninesl=cmsl9
37 \font\eightsl=cmsl8
38 \font\nineit=cmti9
39 \font\eightit=cmti8
40 \font\tentex=cmtex10
41 \font\ninetex=cmtex9 % TeX extended character set (used in strings)
42 \font\eighttex=cmtex8
43 \fontdimen7\tentex=0pt % no double space after sentences
44 \fontdimen7\ninetex=0pt
45 \fontdimen7\eighttex=0pt
46
47 \newif\iftenpoint
48 \def\tenpoint{\tenpointtrue
49 \def\rm{\fam0\tenrm}%
50 \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
51 \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
52 \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
53 \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
54 \def\it{\fam\itfam\tenit}%
55 \textfont\itfam=\tenit
56 \def\sl{\fam\slfam\tensl}%
57 \textfont\slfam=\tensl
58 \def\bf{\fam\bffam\tenbf}%
59 \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
60 \scriptscriptfont\bffam=\fivebf
61 \def\tt{\fam\ttfam\tentt}%
62 \textfont\ttfam=\tentt
63 \def\ttx{\tentex}%
64 \normalbaselineskip=12pt
65 \let\mc=\ninerm
66 \let\sc=\eightrm
67 \let\big=\tenbig
68 \setbox\strutbox=\hbox{\vrule height8pt depth3pt width 0pt}%
69 \normalbaselines\rm}
70
71 \def\ninepoint{\tenpointfalse
72 \def\rm{\fam0\ninerm}%
73 \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
74 \textfont1=\ninei \scriptfont1=\sixi \scriptscriptfont1=\fivei
75 \textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
76 \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
77 \def\it{\fam\itfam\nineit}%
78 \textfont\itfam=\nineit
79 \def\sl{\fam\slfam\ninesl}%
80 \textfont\slfam=\ninesl
81 \def\bf{\fam\bffam\ninebf}%
82 \textfont\bffam=\ninebf \scriptfont\bffam=\sixbf
83 \scriptscriptfont\bffam=\fivebf
84 \def\tt{\fam\ttfam\ninett}%
85 \textfont\ttfam=\ninett
86 \def\ttx{\ninetex}%
87 \normalbaselineskip=11pt
88 \let\mc=\eightrm
89 \let\sc=\sevenrm
90 \let\big=\ninebig
91 \setbox\strutbox=\hbox{\vrule height8pt depth3pt width 0pt}%
92 \normalbaselines\rm}
93
94 \def\eightpoint{%
95 \def\rm{\fam0\eightrm}%
96 \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
97 \textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei
98 \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
99 \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
100 \def\it{\fam\itfam\eightit}%
101 \textfont\itfam=\eightit
102 \def\sl{\fam\slfam\eightsl}%
103 \textfont\slfam=\eightsl
104 \def\bf{\fam\bffam\eightbf}%
105 \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
106 \scriptscriptfont\bffam=\fivebf
107 \def\tt{\fam\ttfam\eighttt}%
108 \textfont\ttfam=\eighttt
109 \def\ttx{\eighttex}%
110 \normalbaselineskip=9pt
111 \let\mc=\sevenrm
112 \let\sc=\sixrm
113 \let\big=\eightbig
114 \setbox\strutbox=\hbox{\vrule height7pt depth2pt width 0pt}%
115 \normalbaselines\rm}
116
117 \tenpoint
118 \def\tenbig#1{{\hbox{$\left#1\vbox to8.5pt{}\right.\nulldelimiterspace=0pt$}}}
119 \def\ninebig#1{{\hbox{$\textfont0=\tenrm\textfont2=\tensy
120 \left#1\vbox to7.25pt{}\right.\nulldelimiterspace=0pt$}}}
121 \def\eightbig#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy
122 \left#1\vbox to6.5pt{}\right.\nulldelimiterspace=0pt$}}}
123
124 \font\titlefont=cmr7 scaled\magstep4 % title on the contents page
125 \font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title
126
127 \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers
128 \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
129 \def\&#1{\leavevmode\hbox{\bf
130 \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
131 #1\/\kern.05em}} % boldface type for reserved words
132 \def\.#1{\leavevmode\hbox{\ttx % typewriter type for strings
133 \let\\=\BS % backslash in a string
134 \let\{=\LB % left brace in a string
135 \let\}=\RB % right brace in a string
136 \let\~=\TL % tilde in a string
137 \let\ =\SP % space in a string
138 \let\_=\UL % underline in a string
139 \let\&=\AM % ampersand in a string
140 \let\^=\CF % circumflex in a string
141 #1\kern.2em}}
142 \def\){\discretionary{\hbox{\tentex\BS}}{}{}}
143 \def\AT{@} % at sign for control text
144
145 \chardef\AM=`\& % ampersand character in a string
146 \chardef\BS=`\\ % backslash in a string
147 \chardef\LB=`\{ % left brace in a string
148 \chardef\RB=`\} % right brace in a string
149 \def\SP{{\tt\char`\ }} % (visible) space in a string
150 \chardef\TL=`\~ % tilde in a string
151 \chardef\UL=`\_ % underline character in a string
152 \chardef\CF=`\^ % circumflex character in a string
153
154 \newbox\PPbox % symbol for ++
155 \setbox\PPbox=\hbox{\kern.5pt\raise1pt\hbox{\sevenrm+\kern-1pt+}\kern.5pt}
156 \def\PP{\copy\PPbox}
157 \newbox\MMbox \setbox\MMbox=\hbox{\kern.5pt\raise1pt\hbox{\sevensy\char0
158 \kern-1pt\char0}\kern.5pt}
159 \def\MM{\copy\MMbox}
160 \newbox\MGbox % symbol for ->
161 \setbox\MGbox=\hbox{\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
162 \def\MG{\copy\MGbox}
163 \let\GG=\gg
164 \let\LL=\ll
165 \let\NULL=\Lambda
166 \mathchardef\AND="2026 % bitwise and; also \& (unary operator)
167 \let\OR=\mid % bitwise or
168 \let\XOR=\oplus % bitwise exclusive or
169 \def\CM{{\sim}} % bitwise complement
170 \newbox\MODbox \setbox\MODbox=\hbox{\eightrm\%}
171 \def\MOD{\mathbin{\copy\MODbox}}
172
173 \newbox\bak \setbox\bak=\hbox to -1\em{} % backspace one em
174 \newbox\bakk\setbox\bakk=\hbox to -2\em{} % backspace two ems
175
176 \newcount\ind % current indentation in ems
177 \def\1{\global\advance\ind by1\hangindent\ind \em} % indent one more notch
178 \def\2{\global\advance\ind by-1} % indent one less notch
179 \def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement
180 \def\4{\copy\bak} % backspace one notch
181 \def\5{\hfil\penalty-1\hfilneg\kern2.5\em\copy\bakk\ignorespaces}% optional break
182 \def\6{\ifmmode\else\par % forced break
183 \hangindent\ind \em\noindent\kern\ind \em\copy\bakk\ignorespaces\fi}
184 \def\7{\Y\6} % forced break and a little extra space
185 \def\8{\hskip-\ind \em\hskip 2\em} % no indentation
186
187 \let\yskip=\smallskip
188 \def\?{\mathrel?}
189 \def\note#1#2.{\par\penalty5000
190 \Y\noindent{\hangindent2\em\baselineskip10pt\eightrm#1~#2.\par}}
191 \def\lapstar{\rlap{*}}
192 \def\stsec{\tenpoint
193 \rightskip=0pt % get out of C mode (cf. \B)
194 \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
195 \noindent\strut{\bf\modno.\quad}}
196 \let\startsection=\stsec
197 \def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
198 \def\A{\note{See also section}} % xref for doubly defined section name
199 \def\As{\note{See also sections}} % xref for multiply defined section name
200 \def\B{\iftenpoint\ninepoint\fi
201 \rightskip=0pt plus 100pt minus 10pt % go into C mode
202 \sfcode`;=3000
203 \pretolerance 10000
204 \hyphenpenalty 9999 % so strings can be broken (discretionary \ is inserted)
205 \exhyphenpenalty 10000
206 \global\ind=2 \1\ \unskip}
207 \def\C#1{\5\5\quad$/\ast\,$#1$\,\ast/$}
208 \def\D{\defin{{\rm\#}define}} % macro definition
209 \let\E=\equiv % equivalence sign
210 \def\ET{ and~} % conjunction between two section numbers
211 \def\ETs{, and~} % conjunction between the last two of several section numbers
212 \def\F{\defin{format}} % format definition
213 \let\G=\ge % greater than or equal sign
214 % \H is long Hungarian umlaut accent
215 \let\I=\ne % unequal sign
216 \def\J{\.{@\&}} % CTANGLE's join operation
217 \let\K== % can be changed to left arrow, if desired
218 % \L is Polish letter suppressed-L; we have no shorthand for \le
219 % \O is Scandinavian letter O-with-slash
220 % \P is paragraph sign
221 % \Q is not used
222 \let\R=\lnot % logical not
223 % \S is section sign
224 \def\T#1{\leavevmode % octal, hex or decimal constant
225 \hbox{${\def\?{\kern.2em}%$%
226 \let\ \, % C++ digit separator becomes a little white space
227 \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
228 \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
229 \let\~=\oct \let\^=\hex \let\\=\bin #1}$}}%$%
230 \def\U{\note{This code is used in section}} % xref for use of a section
231 \def\Us{\note{This code is used in sections}} % xref for uses of a section
232 \let\V=\lor % logical or
233 \let\W=\land % logical and
234 \def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi %$% section name
235 \XX$\langle\,${#2\sevenrm\kern.5em#1}$\,\rangle$\XX}
236 \def\Y{\par\yskip}
237 \let\Z=\let % now you can \send the control sequence \Z
238 \let\*=*
239
240 %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style
241 %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style
242 \def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} % CWEB style
243 \def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style
244 \def\bin{\hbox{$^{\scriptscriptstyle b}$\tt\aftergroup}} % new in CWEB 4.3
245 \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule
246 \hbox{\strut\kern2pt\.{#1}\kern2pt}}
247 \hrule}\vrule\kern2pt}} % verbatim string
248 \def\p#1{\cdot 2^{#1}} % power of two (hex exponent)
249
250 \def\normaloutput#1{\shipout\vbox{
251 \vbox to 3pc{\ifodd\pageno\rightheadline\else\leftheadline\fi\vfill}
252 \nointerlineskip#1}
253 \global\advance\pageno 1 }
254 \def\page{\box255 }
255
256 \newif\ifpagesaved \newif\iftitle
257 \def\leftheadline{\hbox to\pagewd{\vbox to10pt{}%
258 \iftitle\global\titlefalse\else\ninesl\rhead\fi
259 \hfil\eightrm\folio}}
260 \def\rightheadline{\hbox to\pagewd{\vbox to10pt{}%
261 \eightrm\folio\hfil\ninesl\rhead\/}}
262 \def\rhead{MASTER INDEX}
263 \newbox\sbox % saved box preceding the index
264 \newbox\lbox % lefthand column in the index
265
266 \newdimen\pageht \pageht=19cm
267 \newdimen\pagewd \pagewd=13cm
268 \newdimen\colwd \colwd=\pagewd
269 \advance\colwd by -1pc \divide\colwd by 2 % for two columns
270
271 % Usually some text will be inserted at the beginning, preceded by
272 % \preinx and followed by \inx
273 \def\preinx{\tenpoint \hsize=\pagewd
274 \output{\ifpagesaved\normaloutput{\box\sbox}\fi
275 \global\setbox\sbox=\page \global\pagesavedtrue}
276 \rightskip0pt \tolerance 200
277 \pagesavedfalse \parindent=20pt}
278 \def\inx{\parindent=0pt
279 \vskip 15pt plus 1fil
280 \eject\setbox\sbox\vbox{\unvbox\sbox} % take text out of its box
281 \vsize=\pageht \advance\vsize by -\ht\sbox % the remaining height
282 \rightskip0pt plus 2.5em \tolerance 10000
283 \hsize=\colwd
284 \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
285 \output{\twocolout} \eightpoint}
286 \vsize=\pageht
287 \eightpoint
288 \def\lr{L} % this tells whether the left or right column is next
289 \def\twocolout{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
290 \else\normaloutput{\vbox to\pageht{\box\sbox\vss
291 \hbox to\pagewd{\box\lbox\hfil\page}}}
292 \global\vsize=\pageht\gdef\lr{L}\global\pagesavedfalse\fi}
293 \output{\twocolout}
294 \parskip 0pt plus .5pt
295 \outer\def\I#1\unskip, {\par\hangindent2em\noindent#1:\kern1em} % index entry
296 \def\[#1]{$\underline{#1}$} % underlined index item
297 \rm \rightskip0pt plus 2.5em \tolerance 10000
298 \hyphenpenalty 10000
299 \parindent0pt
300 \def\fin{\par\vfill\eject % this is done when we are ending the index
301 \ifpagesaved\null\vfill\eject\fi % output a null index column
302 \if L\lr\else\null\vfill\eject\fi % finish the current page
303 \end}
304
305 \input twinx-startup % custom IDs, \preinx copy, etc.
306
307 % To produce only a subset of pages, put the page numbers on separate
308 % lines in a file called pages.tex
309 \let\Shipout=\shipout
310 \newread\pages \newcount\nextpage \openin\pages=pages
311 \def\getnextpage{\ifeof\pages\else
312 {\endlinechar=-1\read\pages to\next
313 \ifx\next\empty % in this case we should have eof now
314 \else\global\nextpage=\next\fi}\fi}
315 \ifeof\pages\else\message{OK, I'll ship only the requested pages!}
316 \getnextpage\fi
317 \def\shipout{\ifeof\pages\let\next=\Shipout
318 \else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
319 \else\let\next=\Tosspage\fi\fi \next}
320 \newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}