summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
blob: bcc7f58f6d56d299dea41a9be774839362128f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
% standard macros for CWEB listings (in addition to plain.tex)
% Version 4.0 --- February 2021
% 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.0+LNCS+PDF}

\newif\ifpdf
\ifx\pdf+\pdftrue\fi
% Uncomment the following line if you want PDF goodies to be the default
%\ifx\pdf-\else\pdftrue\fi
\def\pdflinkcolor{0 0 1} % the RGB values for hyperlink color
\ifx\undefined\XeTeXrevision\else\pdftrue\fi % XeTeX produces PDF output
\newif\ifpdftex
\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
\else \pdftextrue \pdfoutput=1
  \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\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi

\let\:=\. % preserve a way to get the dot accent
 % (all other accents will still work as usual)

\newdimen\em \em=10pt % this "em" will not change with font size
\parskip 0pt plus .1pt % almost no stretch between paragraphs
\parindent 1\em % for paragraphs and for the first line of C text

\newif\ifsorted
\newread\sreffile
\newwrite\reffile
\ifx\norefs\def\else
  \openin\sreffile=\jobname.sref
  \ifeof\sreffile \immediate\openout\reffile=\jobname.ref
       \sortedfalse \message{This is the first pass!}
  \else \sortedtrue \message{This is the second pass!} \fi
\fi

\font\ninerm=cmr9
\let\mc=\ninerm % medium caps
\def\CEE/{{\mc C\spacefactor1000}}
\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
\def\TEX/{\TeX}
\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
\def\Cee{\CEE/} % for backward compatibility
\def\9#1{}
\font\eightrm=cmr8
\font\sixrm=cmr6
\font\ninei=cmmi9
\font\eighti=cmmi8
\font\sixi=cmmi6
\skewchar\ninei='177 \skewchar\eighti='177 \skewchar\sixi='177
\font\ninesy=cmsy9
\font\eightsy=cmsy8
\font\sixsy=cmsy6
\skewchar\ninesy='60 \skewchar\eightsy='60 \skewchar\sixsy='60
\font\ninebf=cmbx9
\font\eightbf=cmbx8
\font\sixbf=cmbx6
\font\ninett=cmtt9
\font\eighttt=cmtt8
\hyphenchar\ninett=-1 \hyphenchar\eighttt=-1
\font\ninesl=cmsl9
\font\eightsl=cmsl8
\font\nineit=cmti9
\font\eightit=cmti8
\font\tentex=cmtex10
\font\ninetex=cmtex9 % TeX extended character set (used in strings)
\font\eighttex=cmtex8
\fontdimen7\tentex=0pt % no double space after sentences
\fontdimen7\ninetex=0pt
\fontdimen7\eighttex=0pt

\newif\iftenpoint
\def\tenpoint{\tenpointtrue
 \def\rm{\fam0\tenrm}%
  \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
  \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
  \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\fam\itfam\tenit}%
  \textfont\itfam=\tenit
  \def\sl{\fam\slfam\tensl}%
  \textfont\slfam=\tensl
  \def\bf{\fam\bffam\tenbf}%
  \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
   \scriptscriptfont\bffam=\fivebf
  \def\tt{\fam\ttfam\tentt}%
  \textfont\ttfam=\tentt
  \def\ttx{\tentex}%
  \normalbaselineskip=12pt
  \let\cmntfont=\tenrm
  \let\mc=\ninerm
  \let\sc=\eightrm
  \let\big=\tenbig
  \setbox\strutbox=\hbox{\vrule height8pt depth3pt width 0pt}%
  \normalbaselines\rm}

\def\ninepoint{\tenpointfalse
 \def\rm{\fam0\ninerm}%
  \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
  \textfont1=\ninei \scriptfont1=\sixi \scriptscriptfont1=\fivei
  \textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\fam\itfam\nineit}%
  \textfont\itfam=\nineit
  \def\sl{\fam\slfam\ninesl}%
  \textfont\slfam=\ninesl
  \def\bf{\fam\bffam\ninebf}%
  \textfont\bffam=\ninebf \scriptfont\bffam=\sixbf
   \scriptscriptfont\bffam=\fivebf
  \def\tt{\fam\ttfam\ninett}%
  \textfont\ttfam=\ninett
  \def\ttx{\ninetex}%
  \normalbaselineskip=11pt
  \let\cmntfont=\ninerm
  \let\mc=\eightrm
  \let\sc=\sevenrm
  \let\big=\ninebig
  \setbox\strutbox=\hbox{\vrule height8pt depth3pt width 0pt}%
  \normalbaselines\rm}

\def\eightpoint{%
 \def\rm{\fam0\eightrm}%
  \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
  \textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei
  \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\fam\itfam\eightit}%
  \textfont\itfam=\eightit
  \def\sl{\fam\slfam\eightsl}%
  \textfont\slfam=\eightsl
  \def\bf{\fam\bffam\eightbf}%
  \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
   \scriptscriptfont\bffam=\fivebf
  \def\tt{\fam\ttfam\eighttt}%
  \textfont\ttfam=\eighttt
  \def\ttx{\eighttex}%
  \normalbaselineskip=9pt
  \let\cmntfont=\eightrm
  \let\mc=\sevenrm
  \let\sc=\sixrm
  \let\big=\eightbig
  \setbox\strutbox=\hbox{\vrule height7pt depth2pt width 0pt}%
  \normalbaselines\rm}

\tenpoint
\def\tenbig#1{{\hbox{$\left#1\vbox to8.5pt{}\right.\nulldelimiterspace=0pt$}}}
\def\ninebig#1{{\hbox{$\textfont0=\tenrm\textfont2=\tensy
  \left#1\vbox to7.25pt{}\right.\nulldelimiterspace=0pt$}}}
\def\eightbig#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy
  \left#1\vbox to6.5pt{}\right.\nulldelimiterspace=0pt$}}}

%\font\tenss=cmss10 \let\cmntfont\tenss % alternative comment font
\font\titlefont=cmr7 scaled\magstep4 % title on the contents page
\font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title

\def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers
\def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
\def\&#1{\leavevmode\hbox{\bf
  \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
  #1\/\kern.05em}} % boldface type for reserved words
\def\.#1{\leavevmode\hbox{\ttx % typewriter type for strings
  \let\\=\BS % backslash in a string
  \let\{=\LB % left brace in a string
  \let\}=\RB % right brace in a string
  \let\~=\TL % tilde in a string
  \let\ =\SP % space in a string
  \let\_=\UL % underline in a string
  \let\&=\AM % ampersand in a string
  \let\^=\CF % circumflex in a string
  #1\kern.05em}}
\def\){{\tentex\kern-.05em}\discretionary{\hbox{\tentex\BS}}{}{}}
\def\AT{@} % at sign for control text (not needed in versions >= 2.9)
\def\ATL{\par\noindent\bgroup\catcode`\_=12 \postATL} % print @l in limbo
\def\postATL#1 #2 {\bf letter \\{\uppercase{\char"#1}}
   tangles as \tentex "#2"\egroup\par}
\def\noATL#1 #2 {}
\def\noatl{\let\ATL=\noATL} % suppress output from @l
\def\ATH{{\acrofalse\X\kern-.5em:Preprocessor definitions\X}}
\let\PB=\relax % hook for program brackets |...| in TeX part or section name

\chardef\AM=`\& % ampersand character in a string
\chardef\BS=`\\ % backslash in a string
\chardef\LB=`\{ % left brace in a string
\chardef\RB=`\} % right brace in a string
\def\SP{{\tt\char`\ }} % (visible) space in a string
\chardef\TL=`\~ % tilde in a string
\chardef\UL=`\_ % underline character in a string
\chardef\CF=`\^ % circumflex character in a string

\newbox\PPbox % symbol for ++
\setbox\PPbox=\hbox{\kern.5pt\raise1pt\hbox{\sevenrm+\kern-1pt+}\kern.5pt}
\def\PP{\copy\PPbox}
\newbox\MMbox \setbox\MMbox=\hbox{\kern.5pt\raise1pt\hbox{\sevensy\char0
 \kern-1pt\char0}\kern.5pt}
\def\MM{\copy\MMbox}
\newbox\MGbox % symbol for ->
\setbox\MGbox=\hbox{\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
\def\MG{\copy\MGbox}
\def\MRL#1{\mathrel{\let\K==#1}}
\let\GG=\gg
\let\LL=\ll
\let\NULL=\Lambda
\mathchardef\AND="2026 % bitwise and; also \& (unary operator)
\let\OR=\mid % bitwise or
\let\XOR=\oplus % bitwise exclusive or
\def\CM{{\sim}} % bitwise complement
\newbox\MODbox \setbox\MODbox=\hbox{\eightrm\%}
\def\MOD{\mathbin{\copy\MODbox}}
\def\DC{\kern.1em{::}\kern.1em} % symbol for ::
\def\PA{\mathbin{.*}} % symbol for .*
\def\MGA{\mathbin{\MG*}} % symbol for ->*
\def\this{\&{this}}

\newbox\bak \setbox\bak=\hbox to -1\em{} % backspace one em
\newbox\bakk\setbox\bakk=\hbox to -2\em{} % backspace two ems

\newcount\ind % current indentation in ems
\def\1{\global\advance\ind by1\hangindent\ind\em} % indent one more notch
\def\2{\global\advance\ind by-1} % indent one less notch
\def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement
\def\4{\copy\bak} % backspace one notch
\def\5{\hfil\penalty-1\hfilneg\kern2.5\em\copy\bakk\ignorespaces}% optional break
\def\6{\ifmmode\else\par % forced break
  \hangindent\ind\em\noindent\kern\ind\em\copy\bakk\ignorespaces\fi}
\def\7{\Y\6} % forced break and a little extra space
\def\8{\hskip-\ind\em\hskip 2\em} % no indentation

\newcount\gdepth % depth of current major group, plus one
\newtoks\gtitle % title of current major group
\newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections
\let\yskip=\smallskip
\def\?{\mathrel?}
\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}}

\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
\newcount\countA \countA=0 \newcount\countB \countB=0
\newcount\countC \countC=0
\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
{\def\\{\global\let\spacechar= }\\ }

\ifacro % The following are pdf macros
\def\thewidth{\the\wd0 \space}
\def\theheight{\the\ht\strutbox\space}
\def\thedepth{\the\dp\strutbox\space}
\ifpdftex
  \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
  \def\pdflink#1#2{\hbox{\pdfannotlink height\ht\strutbox depth\dp\strutbox
    attr{/Border [0 0 0]} goto num #1 \PDFlinkcolor #1\Black\pdfendlink}}
\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
    \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
  \else\ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
    \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight
      \space depth \thedepth\space << /Border [0 0 0]
      /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
  \else #1 ({\tt#2})\fi\fi}
{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL
{\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL
\def\sanitizecommand#1#2{\addtokens\usersanitizer
       {\noexpand\dosanitizecommand\noexpand#1{#2}}}
\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi}

\catcode`\[=1 \catcode`\]=2 \catcode`\{=12 \catcode`\}=12
  \def\lbchar[{]  \def\rbchar[}]
\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2
\catcode`\~=12 \def\tildechar{~}  \catcode`\~=13
\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12
\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= }
\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= }
\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= }
\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue}
% now comes a routine to "sanitize" section names, for pdf outlines
\def\makeolproctok{\tokprocessedfalse
  \let\next\makeolnexttok % default
  \ifx\nxt\outlinedone\let\next\outlinedone
  \else\ifx{\nxt \else\ifx}\nxt \Tnumfalse \instrfalse % skip braces
  \else\ifx$\nxt % or a $ sign
  \else\ifx^\nxt \addF^\else\ifx_\nxt \addF_% sanitize ^ and _
  \else\ifx\nxt\spacechar \addF\space
  \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know?
    \ifx\nxt~\addF\space
    \else\ifx\nxt\onespace\addF\space
    \else\the\usersanitizer
    \iftokprocessed\else\makeolproctokctli
    \iftokprocessed\else\makeolproctokctlii
    \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it
    \fi\fi\fi\fi\fi
   \else  % we don't have a control sequence, it's an ordinary char
    \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash
    \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}%
    \else\ifx[\nxt \addF{\string\[}\else\ifx]\nxt \addF{\string\]}%
    \else\expandafter\makeolproctokchar\meaning\nxt
   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \next
}
\def\makeolproctokchar#1 #2 #3{\addF{#3}}
\def\makeolproctokctli{%
  \ifx\nxt\CEE\addF{C}\let\next\makeolgobbletok % \CEE/
  \else\ifx\nxt\UNIX\addF{UNIX}\let\next\makeolgobbletok % \UNIX/
  \else\ifx\nxt\TEX\addF{TeX}\let\next\makeolgobbletok % \TEX/
  \else\ifx\nxt\TeX\addF{TeX}\else\ifx\nxt\LaTeX\addF{LaTeX}%
  \else\ifx\nxt\CPLUSPLUS\addF{C++}\let\next\makeolgobbletok % \CPLUSPLUS/
  \else\ifx\nxt\Cee\addF{C}%
  \else\ifx\nxt\PB \let\next\makeolgobbletok \tokprocessedtrue % \PB{...}
  \else\ifx\nxt\.\tokprocessedtrue\instrtrue % \.{...}
      % skip \|
  \else\ifx\nxt\\\ifinstr\addF{\bschar\bschar}\else\tokprocessedtrue\fi
  \else\ifx\nxt\&\ifinstr\addF&\else\tokprocessedtrue\fi
  \else\ifx\nxt\~\ifTnum\addF{0}\else\addF\tildechar\fi % 077->\T{\~77}
  \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\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{--}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
\def\makeolproctokctlii{%
  \ifx\nxt\MG\addF{->}\else\ifx\nxt\GG\addF{>>}%
  \else\ifx\nxt\LL\addF{<<}\else\ifx\nxt\NULL\addF{NULL}%
  \else\ifx\nxt\AND\addF&\else\ifx\nxt\OR\addF|%
  \else\ifx\nxt\XOR\addF^\else\ifx\nxt\CM\addF\tildechar
  \else\ifx\nxt\MOD\addF{\string\%}\else\ifx\nxt\DC\addF{::}%
  \else\ifx\nxt\PA\addF{.*}\else\ifx\nxt\MGA\addF{->*}%
  \else\ifx\nxt\this\addF{this}\else\ifx\nxt\?\addF?%
  \else\ifx\nxt\E\addF{==}\else\ifx\nxt\G\addF{>=}%
  \else\ifx\nxt\I\addF{!=}\else\ifx\nxt\K\addF{=}%
  \else\ifx\nxt\l\addF{l}\else\ifx\nxt\L\addF{L}%
  \else\ifx\nxt\o\addF{o}\else\ifx\nxt\O\addF{O}%
  \else\ifx\nxt\R\addF!%
  \else\ifx\nxt\T \Tnumtrue \let\next\makeolgobbletok
    \tokprocessedtrue % \T{number}
  \else\ifx\nxt\AM\addF&\else\ifx\nxt\%\addF{\string\%}%
  \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi\fi
}
\def\makeolproctokctliii{%
  \ifx\nxt\V\addF{||}\else\ifx\nxt\W\addF{&&}\else\ifx\nxt\Z\addF{<=}%
  \else\ifx\nxt\*\addF*\else\ifx\nxt\Xand\addF{\space and\space}%
  \else\ifx\nxt\Xandxeq\addF{\space and_eq\space}%
  \else\ifx\nxt\Xbitand\addF{\space bitand\space}%
  \else\ifx\nxt\Xbitor\addF{\space bitor\space}%
  \else\ifx\nxt\Xcompl\addF{\space compl\space}%
  \else\ifx\nxt\Xnot\addF{\space not\space}%
  \else\ifx\nxt\Xnotxeq\addF{\space not_eq\space}%
  \else\ifx\nxt\Xor\addF{\space or\space}%
  \else\ifx\nxt\Xorxeq\addF{\space or_eq\space}%
  \else\ifx\nxt\Xxor\addF{\space xor\space}%
  \else\ifx\nxt\Xxorxeq\addF{\space xor_eq\space}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi
}
\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}%
  \outlinest\let\outlinedone=\relax}
\fi % End of pdf macros

\def\lapstar{\rlap{*}}
\def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B)
  \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
  \noindent\strut{\let\*=\lapstar\bf\secno.\quad}%
  \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
    \ifpdftex \pdfdest num \secstar fith%
    \else \special{pdf: dest (\romannumeral\secstar)
      [ @thispage /FitH @ypos ]}\fi}}\fi}
\def\startsection{\titletrue
  \line{\smash{\titlefont\title}\quad\hrulefill}\bigskip
  \let\startsection=\stsec\stsec}
\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
\def\A{\note{See also section}} % xref for doubly defined section name
\def\As{\note{See also sections}} % xref for multiply defined section name
\def\B{\iftenpoint\ninepoint\fi
  \font\niness=cmss9 \let\cmntfont\niness % alternative comment font
  \rightskip=0pt plus 100pt minus 10pt % go into C mode
  \sfcode`;=3000
  \pretolerance 10000
  \hyphenpenalty 9999 % so strings can be broken (discretionary \ is inserted)
  \exhyphenpenalty 10000
  \global\ind=2 \1\ \unskip}
%\def\C#1{\5\5\quad$/\ast\,${\cmntfont #1}$\,\ast/$}
%\let\SHC\C % "// short comments" treated like "/* ordinary comments */"
\def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$}
\def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}}
\def\D{\defin{{\rm\#}define}} % macro definition
\let\E=\equiv % equivalence sign
\def\ET{ and~} % conjunction between two section numbers
\def\ETs{, and~} % conjunction between the last two of several section numbers
\def\F{\defin{format}} % format definition
\let\G=\ge % greater than or equal sign
% \H is long Hungarian umlaut accent
\let\I=\ne % unequal sign
\def\J{\.{@\&}} % TANGLE's join operation
%\let\K== % assignment operator
\let\K=\leftarrow % "honest" alternative to standard assignment operator
% \L is Polish letter suppressed-L
\outer\def\M#1{%
  {\xdef\secstar{#1}\let\*=\empty\xdef\secno{#1}}% remove \* from section name
  \vskip\intersecskip\startsection\ignorespaces}
\outer\def\N{\ifvoid\partialpage\lefttrue
  \else\ifdim\ht\partialpage<\pageht \leftfalse\else\lefttrue\fi\fi\NNN}
\outer\def\NN{\ifvoid\partialpage\leftfalse
  \else\ifdim\ht\partialpage<\pageht \lefttrue\else\leftfalse\fi\fi\NNN}
\outer\def\NNN#1#2#3.{% beginning of starred section
  \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi
  \gdepth=#1\gtitle={#3}\def\secno{#2}\xdef\secstar{#2}
  \ifleft \flushout
    \gdef\rlhead{\let\i=I\uppercase{\ignorespaces#3}} % running left headline
    \global\let\rrhead=\rlhead % running right headline
  \else\global\setbox\partialpage=\vbox{
          \vbox to\pageht{\unvbox\partialpage\vfill}\break}
      \gdef\rrhead{\let\i=I\uppercase{\ignorespaces#3}}
  \fi
  \message{*\secno} % progress report
  \ifpdftex\def\stripprefix##1>{}\def\gtitletoks{#3}%
    \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}%
    {\immediate\write\cont{\ZZ{\gtitletoks}{#1}{\secno}% write to contents file
      {\noexpand\the\pageno}{\the\toksE}}} % \ZZ{title}{depth}{sec}{page}{ss}
    \expandafter\xdef\csname curr#1\endcsname{\secno}
    \ifnum#1>0\countB=#1 \advance\countB by-1
      \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi
  \else\ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
    [ @thispage /FitH @ypos ] >>}\fi\fi
  \startsection{\bf\ignorespaces#3.\quad}\ignorespaces}
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
  \expandafter\xdef\csname#1\endcsname{\the\countA}}
% \O is Scandinavian letter O-with-slash
% \P is paragraph sign
\def\Q{\note{This code is cited in section}} % xref for mention of a section
\def\Qs{\note{This code is cited in sections}} % xref for mentions of a section
\let\R=\lnot % logical not
% \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
    \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
    \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick)
    \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
\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}
\def\Y{\par\yskip}
\let\Z=\le
\let\ZZ=\let % now you can \write the control sequence \ZZ
\let\*=*

%\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\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule
        \hbox{\strut\kern2pt\.{#1}\kern2pt}}
      \hrule}\vrule\kern2pt}} % verbatim string

% now here's the mini-index formatting control
\newcount\nrefs % total number of references in partial page
\newcount\baseno % smallest section number in partial page
\toksdef\prefs=199 % references to previous sections in current program
\toksdef\frefs=220 % references to future sections in current program
\toksdef\erefs=221 % references to sections in another program
% \count and \toks registers 200--219 are also used to keep track of refs
\catcode`\@=11
\newcount\@n \newcount\@m \newcount\@p
\newdimen\pageht \pageht=19cm
\newdimen\pagewd \pagewd=13cm
\newdimen\colwd \colwd=\pagewd
 \advance\colwd by -2pc \divide\colwd by 3 % for three columns
\newdimen\fullpageht \fullpageht=\pageht \advance\fullpageht by 4pc
\newdimen\pagethresh \pagethresh=2\pageht
\newdimen\nsize \newdimen\msize
\newskip\intersecskip \intersecskip=8pt plus 2pt minus 3pt
\newbox\partialpage
\newbox\newsec
\newtoks\newrefs
\newtoks\ttoks
\newdimen\ninept \ninept=9pt
\newif\iftitle \newif\ifleft

\def\flushout{\ifvoid\partialpage\else
    \setbox0=\vsplit\partialpage to \pageht
    \shipout\vbox{
      \vbox to 3pc{\leftheadline\vfill}
      \nointerlineskip\box0}
    \global\advance\pageno 1
    \global\let\[=\makeinref \global\let\]=\makeoutref
    \ifsorted \let\readin=\readln \readrefs
    \else \immediate\write\reffile{!\the\pageno}\let\readin=\readrefs \fi
    \setbox0=\vbox{\eightpoint \hsize=\colwd
      \rightskip=0pt plus 100pt minus 10pt
      \pretolerance 10000
      \hyphenpenalty 10000 \exhyphenpenalty 10000
      \noindent\vbox to1pt{}\par % 1pt = \topskip - \ninept
      \readin}
    \shipout\vbox to\fullpageht{
      \vbox to 3pc{\rightheadline\vfill}
      \unvbox\partialpage
      \vfill
      \ifdim\ht0>1pt \kern11pt\hrule \hbox{%
          \nsize=\ht0 \advance\nsize-\topskip
          \divide\nsize by 3 \divide\nsize by\ninept
          \multiply\nsize by\ninept \advance\nsize\topskip
          \vsplit0 to\nsize \kern1pc
          \msize=\ht0 \advance\msize-\topskip
          \divide\msize by 2 \divide\msize by\ninept
          \multiply\msize by\ninept \advance\msize\topskip
          \vbox to\nsize{\vsplit0 to\msize\vss}\kern1pc
          \vbox to\nsize{\box0\vss}} \fi}
    \global\advance\pageno 1 \global\let\rlhead=\rrhead\fi
  {\globaldefs=1
    \@n=199 \loop \ifnum\@n<222 \toks\@n={} \count\@n=0 \advance\@n 1 \repeat
    \nrefs=0
    \baseno=\secno}}
\def\leftheadline{\hbox to\pagewd{\vbox to10pt{}%
  \iftitle\global\titlefalse\else\ninerm\title:\enspace \eightsl\rlhead\fi
  \hfil\eightrm\folio}}
\def\rightheadline{\hbox to\pagewd{\vbox to10pt{}%
  \eightrm\folio\hfil\ninerm\title:\enspace \eightsl\rrhead\/}}

\def\mini{\begingroup \obeylines \globaldefs=1 \newrefs=\bgroup}
\def\FI{\@n=\secno \advance\@n-\baseno \advance\@n 200
  \advance\nrefs-\count\@n \@n=\nrefs
  \let\[=\countnewref \let\]=\cn \the\newrefs \endgroup
  \nobreak\null\nobreak\vskip-\baselineskip\penalty-500\vfil\eject}
\def\twillout{\setbox\newsec=\vbox{\unvbox255}
  \ifnum\@n=0 \nsize=0pt
  \else \nsize=3pt \multiply\nsize\@n \advance\nsize 1.25pc \fi
  \ifvoid\partialpage\else\advance\nsize 5pt \advance\nsize\ht\partialpage\fi
  \advance\nsize\ht\newsec 
  \message{\the\nsize} % show the page break decision amount
  \ifbr \global\brfalse \flushout \message{/\secno}\fi
  \ifdim\nsize>\pagethresh \flushout \message{\secno}\fi
  \addtopartialpage}
\def\addtopartialpage{\globaldefs=1
  \let\[=\addnewref \let\]=\addneweref \the\newrefs
  \setbox\partialpage=\ifvoid\partialpage \box\newsec
  \else \vbox{\unvbox\partialpage \vfilneg
      \vskip\intersecskip \unvbox\newsec}\fi}
\def\shortpage{\par\vskip-2\baselineskip
  \null\vfill\penalty-5000\message{(shortpage)}}
\newif\ifbr
\def\forcebr{\global\brtrue}

\def\countnewref #1 {\ifnum#1<\baseno \let\next\cn
  \else\ifnum#1>\secno \let\next\cn \else\let\next\flushref\fi\fi\next#1 }
\def\cn #1 #2 {\begintest{#1 #2}\cnr\endtest}

% here's a tricky way to present \cnr with a csname unexpanded inside:
\def\begintest#1{\def\TEST{#1}\expandafter\expandafter\expandafter}
\def\endtest{\csname\expandafter\gobb\meaning\TEST\endcsname}
\expandafter\def\expandafter\gobb\meaning\empty{}

{\obeylines\gdef\cnr#1#2
  {\ifx#1\relax \advance\@n 1 \fi}}
{\obeylines\gdef\flushref#1
  {}}
\def\addnewref #1 {\ifnum#1<\baseno \let\next\an \@n=199
  \else\ifnum#1>\secno \let\next\an \@n=#1 \advance\@n-\baseno
    \advance\@n200 \ifnum\@n>219 \@n=220 \fi
    \else\let\next\flushref\fi\fi\next#1 }
\def\an#1 #2 {\begintest{#1 #2}\anr\endtest\[#1 #2 }
\def\addneweref#1 #2 {\@n=221 \begintest{#1 #2}\anr\endtest\]#1 #2 }
{\obeylines\gdef\anr#1#2
  {\ifx#1\relax \advance\nrefs1 \advance\count\@n 1 %
  \def#1{#2
    }\toks\@n=\expandafter{\the\toks\@n\lmda#1}\fi}}
\ifsorted \def\lmda#1{\global\let#1\relax}
\else \def\lmda#1{#1\global\let#1\relax} \fi
{\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}}
{\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}}
\def\miniform{\futurelet\next\miniforma}
\def\miniforma{\ifx\next\zip
  \else\if=\noexpand\next \let\next\gobbleq
    \else\let\next\colon\fi\fi\next}
\def\zip{}
\def\gobbleq={\,=\,}
\def\colon{: }
\def\extref{\futurelet\next\extrefa}
\def\extrefa{\if"\next\let\next\gobblest\else\let\next\cite\fi\next}
\def\gobblest"#1"{{\ttx#1}}
\def\cite#1#2.{{\sc#1}\,\S#2.}
\def\uninitialized{???}

\def\readrefs{\the\prefs \@m=\secno \advance\@m-\baseno \advance\@m200
  {\def\lmda##1{\global\let##1\relax}\@p=200
    \loop\ifnum\@p<\@m \the\toks\@p \advance\@p 1 \repeat}
  \loop\ifnum\@m<222 \the\toks\@m \advance\@m 1 \repeat}
\def\readln{\read\sreffile to\next \expandafter\next\newline \readin}
{\obeylines\gdef\newline{\unskip\noexpand
  }}
\def\donewithpage#1 {\let\readin=\relax}
\catcode`\@=12

\hsize=\pagewd \vsize=\maxdimen \output={\twillout}

%\let\page=\pagebody \raggedbottom
% \def\page{\box255 }\normalbottom % faster, but loses plain TeX footnotes
%\def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi
 %\shipout\vbox{
  %\vbox to\fullpageht{
  %\iftitle\global\titlefalse
  %\else\hbox to\pagewd{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi
  %\vfill#1}} % parameter #1 is the page itself
  %\global\advance\pageno by1}
%\def\topofcontents{\centerline{\titlefont\title}\vskip.7in
  %\vfill} % this material will start the table of contents page
%\def\startpdf{\ifpdftex\pdfcatalog{/PageMode /UseOutlines}\else
    %\ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
%\def\botofcontents{\vfill
  %\centerline{\covernote}} % this material will end the table of contents page
%\def\covernote{}
\def\contentspagenumber{0} % default page number for table of contents
%\newdimen\pageshift \pageshift=\hoffset
   %% shift righthand pages wrt lefthand ones (changed in version 3.70)
%\def\setpage{\hsize\pagewd\vsize\pageht} % use after changing page size
\def\contentsfile{\jobname.toc} % file that gets table of contents info
\def\readcontents{\input \contentsfile}
\def\readsections{\input \jobname.scn}

\newwrite\cont
\ifpdftex
  \immediate\openout\cont=\contentsfile
  \immediate\write\cont{\catcode `\noexpand\@=11\relax} % \makeatletter
\fi

\def\inx{\flushout % No full index at the end
  \ifpdftex
    \immediate\write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
    \immediate\closeout\cont % the contents information has been fully gathered
  \fi}
\def\fin{\ifacro \message{Section names:}
  \def\U##1.{} \def\Us##1.{} \let\I=\relax \let\*=*
  \def\outsecname{Names of the sections}
  \ifpdftex \makebookmarks
    \pdfoutline goto num 1 count -\secno {\outsecname}
    \def\X##1:##2\X{\firstsecno##1.%
      {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
      \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
  \else \output={\shipout\box255}
    \special{pdf: outline -1 << /Title (\outsecname) >>}%
    \def\X##1:##2\X{\firstsecno##1.%
      {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
      \special{pdf: outline 0 << /Title (\the\toksE)
        /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
  \fi \readsections \fi}
\def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
\def\writebookmarkline#1#2#3#4#5{{%
  \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let
  \pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}}
\let\con=\end % no table of contents
%\def\con{\par\vfill\eject % finish the section names
% \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
  %\rightskip 0pt \hyphenpenalty 50 \tolerance 200
  %\setpage \output={\normaloutput\page\lheader\rheader}
  %\titletrue % prepare to output the table of contents
  %\pageno=\contentspagenumber
  %\def\grouptitle{TABLE OF CONTENTS}
  %\message{Table of contents:}
  %\topofcontents \startpdf
  %\line{\hfil Section\hbox to3em{\hss Page}}
  %\let\ZZ=\contentsline
  %\readcontents\relax % read the contents info
  %\botofcontents \end} % print the contents page(s) and terminate
%\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}}}
%\def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
  %\or % depth 0 (@*)
  %\or \hskip2em % depth 1 (@*1)
  %\or \hskip4em \or \hskip6em \or \hskip8em \or \hskip10em % depth 2,3,4,5
  %\else \hskip12em \fi} % depth 6 or more
\def\datethis{} \def\datecontentspage{}

% To produce only a subset of pages, put the page numbers on separate
% lines in a file called pages.tex
\let\Shipout=\shipout
\newread\pages \newcount\nextpage \openin\pages=pages
\def\getnextpage{\ifeof\pages\else
 {\endlinechar=-1\read\pages to\next
  \ifx\next\empty % in this case we should have eof now
  \else\global\nextpage=\next\fi}\fi}
\ifeof\pages\else\message{OK, I'll ship only the requested pages!}
 \getnextpage\fi
\def\shipout{\ifeof\pages\let\next=\Shipout
 \else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
  \else\let\next=\Tosspage\fi\fi \next}
\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}