⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cwebmac.tex

📁 著名算法大师高爷爷设计的语言。此语言结合了Tex和C
💻 TEX
📖 第 1 页 / 共 2 页
字号:
% standard macros for CWEB listings (in addition to plain.tex)% Version 3.65 --- March 2005\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros\xdef\fmtversion{\fmtversion+CWEB3.65}\chardef\cwebversion=3 \chardef\cwebrevision=65\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\ifnum\pdfoutput=0 \pdftexfalse\else \pdftextrue \pdfoutput=1 \input pdfcolor \let\setcolor\pdfsetcolor \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)\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\&#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{\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}}\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 \BlueGreen #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) >>}\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\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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -