📄 cwebmac.tex
字号:
% standard macros for CWEB listings (in addition to plain.tex)% Version 3.63 --- January 2001\ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros\xdef\fmtversion{\fmtversion+CWEB3.63}\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\newif\ifpdftex\ifx\pdfoutput\undefined \pdftexfalse\else \pdftextrue \pdfoutput=1 \pdfcompresslevel=9 \input pdfcolor \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)\parskip 0pt % no stretch between paragraphs\parindent 1em % for paragraphs and for the first line of C text\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{} % with this definition of \9 you can say @:sort key}{TeX code@> % to alphabetize an index entry by the sort key but format with the TeX code\font\eightrm=cmr8\let\sc=\eightrm % for smallish caps (NOT a caps-and-small-caps font)\let\mainfont=\tenrm\let\cmntfont\tenrm%\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\font\tentex=cmtex10 % TeX extended character set (used in strings)\fontdimen7\tentex=0pt % no double space after sentences\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\{\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{\tentex % 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}}%\def\MRL#1{\KK#1}\def\KK#1#2{\buildrel\;#1\over{#2}}\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 -1em{} % backspace one em\newbox\bakk\setbox\bakk=\hbox to -2em{} % 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.5em\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 2em} % no indentation\newcount\gdepth % depth of current major group, plus one\newcount\secpagedepth\secpagedepth=3 % page breaks will occur for depths -1, 0, and 1\newtoks\gtitle % title of current major group\newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections\let\yskip=\smallskip\def\?{\mathrel?}\def\note#1#2.{\Y\noindent{\hangindent2em% \baselineskip10pt\eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}% The following are pdf macros\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD\newcount\countA \countA=0 \newcount\countB \countB=0\def\thewidth{\the\wd0\space}\def\theheight{\the\ht0\space}\def\thedepth{\the\dp0\space}\ifpdftex \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 \def\pdflink#1#2{\hbox{\pdfannotlink attr{/Border [0 0 0]} goto num #1 \BlueGreen #1\Black\pdfendlink}}\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight \space depth \thedepth\space << /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\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}\def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS| \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makenote\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next}\def\makenote{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countA=0}\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}\def\pdfURL#1#2{\ifpdftex\pdfannotlink attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> }\BlueGreen #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% End of pdf macros\def\lapstar{\rlap{*}}\def\stsec{\rightskip=0pt % get out of C mode (cf. \B) \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 \noindent{\let\*=\lapstar\bf\secstar.\quad}% \ifpdftex\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\pdfdest num \secstar fith}} \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{% \let\*=\empty\special{% pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi}\let\startsection=\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{\rightskip=0pt plus 100pt minus 10pt % go into C mode \sfcode`;=3000 \pretolerance 10000 \hyphenpenalty 1000 % 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{\#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{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section \vskip\intersecskip\startsection\ignorespaces}\outer\def\N#1#2#3.{\gdepth=#1\gtitle={#3}\MN{#2}% beginning of starred section \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi \message{*\secno} % progress report \edef\next{\write\cont{\ZZ{#3}{#1}{\secno}% write to contents file {\noexpand\the\pageno}}}\next % \ZZ{title}{depth}{sec}{page} \ifpdf\special{pdf: outline #1 << /Title (#3) /Dest [ @thispage /FitH @ypos ] >>}\fi \ifon\startsection{\bf#3.\quad}\ignorespaces}\def\MN#1{\par % common code for \M, \N {\xdef\secstar{#1}\let\*=\empty\xdef\secno{#1}}% remove \* from section name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -