% This file generates the user manual; TeX it, don't read it! \def\tangref{3} % where the main explanation of CTANGLing is given \input cwebmac \def\page{\box255 } \normalbottom \parskip 0pt plus 1pt \def\RA{\char'31 } % right arrow \def\hang{\hangindent 4em\ignorespaces} \font\eightrm=cmr8 \font\ninerm=cmr9 \font\ninett=cmtt9 \font\eighttt=cmtt8 \font\twelvett=cmtt12 \font\quoterm=cmssq8 \font\quoteit=cmssqi8 \font\authorfont=cmr12 \font\sectionfont=cmbx12 \def\pb{\.{|...|}} \def\v{\.{\char'174}} % vertical (|) in typewriter font \def\lpile{\def\cr{\hfill\endline}\matrix} % I only use \lpile by itself \abovedisplayskip=.5\abovedisplayskip \belowdisplayskip=.5\belowdisplayskip \abovedisplayshortskip=.5\abovedisplayshortskip \belowdisplayshortskip=.5\belowdisplayshortskip \advance\baselineskip by -.5pt \advance\pageheight by \baselineskip % the manual just got a bit longer \advance\fullpageheight by \baselineskip \setpage \outer\def\section #1.{\penalty-500\bigskip \centerline{\sectionfont\def\.##1{{\twelvett##1}} #1}\nobreak\vskip 6pt \everypar{\hskip-\parindent\everypar{}}} \def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill} \def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno} \def\runninghead{����������� ������������ {\tentt CWEB} (������ 3.0)} % This verbatim mode assumes that ! marks are !! in the text being copied. \def\verbatim{\begingroup \def\do##1{\catcode`##1=12 } \dospecials \parskip 0pt \parindent 0pt \let\!=! \catcode`\ =13 \catcode`\^^M=13 \tt \catcode`\!=0 \verbatimdefs \verbatimgobble} {\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }} % \gdef\verbatimgobble#1^^M{}} \null\vfill \centerline{\titlefont The {\ttitlefont CWEB} System of Structured Documentation} \vskip 18pt\centerline{(Version 3.0)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill \noindent \TeX\ is a trademark of the American Mathematical Society. \bigskip\noindent The printed form of this manual is copyright \copyright\ 1994 by Addison-Wesley Publishing Company, Inc. All rights reserved. \smallskip\noindent The electronic form is copyright \copyright\ 1987, 1990, 1993 by Silvio Levy and Donald E. Knuth. \smallskip\noindent The russian translation is copyright \copyright\ 1999 by Sergey V. Korop \.{} \bigskip\noindent Permission is granted to make and distribute verbatim copies of the electronic form of this document provided that the electronic copyright notice and this permission notice are preserved on all copies. \smallskip\noindent Permission is granted to copy and distribute modified versions of the electronic form of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. \smallskip\noindent Individuals may make copies of the documentation from the electronic files for their own personal use. \pageno=0 \titletrue\eject \null\vfill \centerline{\titlefont ������� ������������ ���������������� {\ttitlefont CWEB}} \vskip 18pt\centerline{(������ 3.0)} \vskip 24pt \centerline{\authorfont ������� �. ���� � ������� ����} \vfill \noindent \TeX\ �������� �������� ������ American Mathematical Society. \bigskip\noindent \copyright\ 1994. ������� �� ������� ����� ����������� �������� Addison-Wesley Publishing Company, Inc. ��� ����� ���������. \smallskip\noindent \copyright\ 1987, 1990, 1993. ����� �� ����������� ����� ����� ����������� ����������� ������� ���� � �������� �. �����. \smallskip\noindent \copyright\ 1999. ������� �� ������� ����: ������ ����� \.{} \bigskip\noindent � ������ ��������� �������� �������� ������� ��������������� � �� ���������� ���������, ����������� ���������� ��������. \bigskip\noindent Permission is granted to make and distribute verbatim copies of the electronic form of this document provided that the electronic copyright notice and this permission notice are preserved on all copies. \smallskip\noindent Permission is granted to copy and distribute modified versions of the electronic form of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. \smallskip\noindent Individuals may make copies of the documentation from the electronic files for their own personal use. \smallskip\noindent ����������� ��������������� ������ ����� ����������� ������ ����� ��������� ��� �������, ��� ��������� �� ��������� ������ �� ����������� ������ � ��� ���������� ������������ �� ���� ������. \smallskip\noindent ����������� ��������������� ���������� ����� ����������� ������ ����� ��������� �� �������� ������� �����������, � ��� �������, ��� ����������� ������ ���������������� �� ��������, ���������� ����. \smallskip\noindent ������� ���� ����� ������ ����� ������������ �� ����������� ������ ��� ������� �������������. \pageno=0 \titletrue\eject \titletrue \centerline{\titlefont ������� ������������ ���������������� {\ttitlefont CWEB}} \vskip 15pt plus 3pt minus 3pt \centerline{\authorfont ������� �. ���� � ������� ����} \vskip 24pt plus 3pt minus 3pt \noindent ���� �������� �������� ��������� ������ ������� \.{WEB} �.~�����, �������������� � ����� \CEE/ ������� ����. � ������� ������ �������� � 1987~�., \.{CWEB} ����������� �������� ����� � ���� �� ������ ��� ������������� � �������. � ��������� ������ �� �������� ��� �������� ������� � ����������, �� ��� �� �����, ��������� �� �������, ����������� � ����������� ������ ���������� � ����� ������������ ���� (\.{levy@math.berkeley.edu}). ��������, �������� � ������������ ``The \.{WEB} System of Structured Documentation'' �����, ����� ���� ����� ������������ � ���� ����������, ��������� \.{CWEB} � \.{WEB} ����� ����� ��������� � (� ��������) ���������. � ��������� �������� \.{CWEB} �������� ���������� \.{WEB}: ��������, \.{CWEB} �� ��������� � ���������� ����������� �������� � ��������� ����� \.{WEB}, ��������� ���� \CEE/ � ��� ������������ ����� ��� ������ �� ����. ����������, ���������� \.{WEB} ������������ ������� ������������ � ����������������� ����� \.{@'77} � \.{@"3f} �������� ��������� � ����� \CEE/ \.{077} � \.{0x3f}. ��� ������ ����������� \.{WEB} ��������� � ���������. �� �������� ���� ������������� ����, ��� ������ ����������� � ����������� ���������� � ���������� \.{CWEB}. ������ ��������������� �� �������� Steve Avery, Nelson Beebe, Hans-Hermann Bode, Klaus Guntermann, Norman Ramsey � Joachim Schnitter, ������� ������������ ����������� ���, � ����� Cameron Smith, �� ��������� ����������� �� ������������. Ramsey ������ "��������� ����������������" ("literate programming",---��� �. ���� �������� �������� ���������������� � �������������� \.{CWEB}---{\sl ����. �����.\/}) ��������� ��� ������ ������ ����� �������� \.{SPIDER} [��. {\sl Communications of the ACM\/ \bf32} (1989), 1051--1055]. Bode ����������� \.{CWEB} � ����� \CPLUSPLUS/, ��� ��� ����� �� ������ ��� ������ �� \CEE/ ������������� � \CPLUSPLUS/. \section ��������. ���� ��������� \.{CWEB} � ���, ��� ������������, �������� �������� ���� ��������� ��������� �������������, ������ ������������ ������������ ������, �������� \TeX{}, ��� ���������� ������������ � ������, �������� \CEE/, ��� ����������������. �� ���, �� ������ ��� �� ���� �� ������������� ����� ������������, �� ������ ������� ������� ���������, ����������� ���� ����� ���������, ��� �������. ��������� ������������ ��������� ����� ���� ������������, ��� ``����'' (``web'' --- ``�������''), ��������� �� ��������� ������� ��������� ������. ����� ��������������� ����� ���������, ���������� ������� ������ ����� ����� � �� ��������������� � �������. �������� ��������� �������, ��������������� \TeX{}, ��������� ��� ������� ��������� ��������� ������ ����� ���������, � �������� ���������������� ����� \CEE/ --- ��������� � ���������� ��������������� ���������. �������� ��, �� �������� ����� ����������������, ����������� �������������� ��������� ��������� ������� ��������, � ������������ --- ������ ����������������� ���������, ��� ������� ������������� �������������� �������� ������������ ��������� � ������������. ������� \.{CWEB} ������� �� ���� ��������, ��������� \.{CWEAVE} � \.{CTANGLE}. ��� ���������������� � ������� \.{CWEB} ��������� �� ����� \CEE/ � ������������ � ��� ��������� � ����� �����, ���������� \.{CWEB}-����, � ������ ����� \.{something.w}. ������� `\.{cweave} \.{something}' ������� ���� \.{something.tex}, ������� � ������� \TeX{} ������������ � ������� ����������� (``pretty printed'') ������ \.{something.w}, ������� ��������� ��� ������������ ����������, ����� ��� ������ ��������, ������������� ��������, ��������� � ������ �������, �������������� ��������. ������������� ������������� �������� ������� ������������ ������. ����������, ������� `\.{ctangle} \.{something}' ��������� ��������� �� ����� \CEE/ \.{something.c}, ������� ����� ���� ��������������� � ���������� ���. ������ �������������� �������� �������� ����������������, \.{CWEB} ��������� ���� \CEE/ ������������ ������ ������� ����� ������ ���������, ��� ��� ������� ����������� ������� ����� ���� ���������� ������� � �������� ��������� ������ � �� ��������� ������������. ��������� \.{CTANGLE} ������� ��� ������, ��� ��� ����������� ������ web-��������� � �������, ��������� \CEE/; ������������� ���������������� � \.{CWEB} �������� ��, ��� ��������� ����� ���� �������� � "�����������" �����, � ������� ������ ������ ���������� �������� �� ������. ��������� \.{CWEAVE}, � ������������ ������ ��������, "��������" ������������ � ������ ������ \TeX � \CEE/-����� � ����������������� ��������. ��������, �� �������� �������� ������������ ``weave'' �������� ``{\it webe\/}'', � ��������������� �� ��������� ��������� --- ``{\it texe\/}''! ������������ \.{CWEB} ������ ���� ������ ������ � ������ \CEE/. ����������� ���������� � \TeX{} ����� ����������, �� ���������� ����� ���� �������� ��� � �������� ������ � \.{CWEB}, ��������� ������� ����� ���������������� � \TeX{} ����������� ��� ������-���� ������ ��� �����. ���, ��� ������ ������ � ������ ��������� ����������� ������ ��������� ������, ����� ������� ������� \.{CWEB}. \section �����. ���������� ������ \.{CWEB} ����� ���� \TeX{}-����� � \CEE/-�����. \.{CWEB}-����������� ������ ����� ������������ ��� ������������ � ���� ��� � �������� ��������� ������������, ��� � ���������, �.�. ����� ���� ���� ��� ��������, ������� ����� ������������� ��� \.{CWEB}-������ ����������� \.{CWEAVE} � \.{CTANGLE}. ����� � ������� \TeX{} ��������� ���������� ���������� \.{CWEAVE} � ������������ \.{CTANGLE}, ��� "������ ������������". � ������ �������, \CEE/-��������� ������������� \.{CWEAVE} � ������������� \.{CTANGLE} �� ��������, ������� ����� ������ ���������� �������. � ��������� ������ ���������� ������, ��� ���������� ��� ������������� ������. �������� \.{CWEB}-��������� � ���-�� ����� � ����������� ��������� \TeX{} � �������������� �������������� ``\CEE/-����'', �������� ��������� � \TeX{} ��������������, ������������ � �������������� �����. \.{CWEB}-���� �������� {\sl ������\/}, ������� ����� ��� ����� ��������������. ������ ������ ������� �� ���� ������: \yskip\item{$\bullet$} \TEX/-�����, ���������� ��������, ������������ ���� ����������� ������. \item{$\bullet$} ������������� (middle) ����� �������� ����������������, �������� ������������ ��� \CEE/-�����������, ������� �������� ���������� ������ ��� ������. ��� ������������� \.{CTANGLE} � ������� �������������. \item{$\bullet$} \CEE/-�����, ���������� ����� ���������, ������������ \.{CTANGLE}. ����� \CEE/-����� � ������ �� ������ ��������� ������ �������, ����� ��� ���������� ����������� �������� ��������� � ���� ����� ����������. \yskip\noindent ��� ����� ������ ������ ������ ������������� � ���� �������, �.�. \TeX-����������� ������ ��������� ������, ����� ������������� ����� �, �������, \CEE/-���. ����� �� ���� ������ ����� ���� ������. ������ ���������� ���� `\.{@\ }', ���� `\.{@*}', ��� `\.{\ }' �������� ������ "������". ������ ������������� ������� ��������� ������, �.�. ��������� `\.{@\ }' ��� `\.{@*}', ���� ������ �����. \.{CWEB}-���� ����� ��������� ������������ �����, ��������������� ����� ������� ������ ������ � �� �������� �� � ���� �� ������. �������� ����� ����� ����� ��������� "����������" (``in limbo''), �� ������������ \.{CTANGLE} � ��������� ���������� \.{CWEAVE}, ��� ��� ��� ���������� ������� � ����������� ������������ ���������� \TeX'�. ��� �������, ��� ���������� ��������� ��������� ������, ���������� �������, �������� ������� �������� �/��� ���������� ��������� ����. ������ ���������� ���������������, ������� �~1. ��� ������ ���������� � ������ ������ ������ � \TeX-���������, ���������� \.{CWEAVE}, � ����� � ������������, ���������� ������ � ����� ������ ������ � \CEE/-���������, ��������������� \.{CTANGLE}. \section ����� ������. � �������, ��� ������� ���������� ���������� ������ �������. ������ ��������� `\.{@\ }' ���� `\.{@*}' � ������ ������ ����� ������, � �� ������ ����� ������������� \.{CWEAVE} � \.{CTANGLE} �������������. ��� ������������� ������ ����� ���� ��������� {\sl ���} ������ ������. ��� ���������� `\.{@<}', ����� ������� ������������ ����� \TEX/, � ����� --- `\.{@>}'. ����� \.{CWEAVE} ������� ��� ������, `\.{@<}' � `\.{@>}' ���������� �������� ��������, � ����������� ����� ������ ����� ������ �������. �������, ����� �� ������� ����� \.{CWEAVE}, ����� ���������� ��� ����������� ����� ��������. ��� ����������� ��� ������ ������ ���� ������� ��������� ����������� ������, �.�. �������� ����������, �������������� �������. ������������ ������ ����� ���� "��������" � ������ ������ ���, ��� ������������ ������ �� ���������� �������� ��������. ��� ������, �������������, ������ ���� ���������� �������, ����� �������� ��� ���� �� ����. � ���������, ����������� � ������� �������� ������ ������� ��� ������ ����� � �����. ������� \.{CTANGLE} � \.{CWEAVE} ��������� ������������ ����������. ������ ���, ����� � \.{CWEB}-����� ������ ��������� ��� ������, �� ������ ������������ `\.{@<$\alpha$...@>}', ��� $\alpha$ --- ����� ������, ���������� ��������� ������� �����. ��������, `\.{@}' ����� ���� ��������� �� `\.{@}', ���� ������� ������ ��� ������ �� ���������� � `\.{Clear}'. ���������� ����� ������������ ���������� `\.{@}' � �.�. ����� ������ � ������ ������� ������ ��������� �����������, �� ����������� ������������������� ���������� �������� (���������� �������, �������� ���������, ����� ������ �/��� ��������), ������� ���������� ��� ���� ������. � ������ � ����� ����� ��� ���������� ������� ����� ���������. ���, `\.{@< Clear { }the arrays @>}' ����� ��������������� ����� � ���������� �������. ���������� ������� ����� ���������� ����� ����� ��������������, �� �� ����� ���, ��� ��� `\.{@}' �� ������������� `\.{@}'. \section ��� ������ \.{CTANGLE}. ��� ���� ������� ����, ������ ���������� `\.{@\ }' ���� `\.{@*}', �� ������ --- � ���, ��� ��� ������� �� \TeX-�����, ������������� � \CEE/-�����. ������������� ����� ���������� � ������ ���������� � ���� ������ `\.{@d}' ���� `\.{@f}', � \CEE/-����� ���������� ������ `\.{@c}' ��� `\.{@
=}'. � ��������� ������ ��� ������������� ������ \CEE/-������, ���� �� ������ ������ `\.{@c}', �� ��� ����� {\sl �������������}. ����������� `\.{@
}' ����� ��������� � ���� \CEE/-������ ������������ ���������� ���: ����������� ������ �� ��� �������� ��� "�������������", � �� "���������", �.�. ��� ����������� ������, ������������ ���-���� ���, ������ ���� ��������� � ��� ����� \CEE/-���������. �������������, �������� ���� \.{CTANGLE} --- ������� ���������, �������� ��������� ���������� ����������� � ������������� ������. ������ ������� ������ ���������� ������: ������� ��� ����������������, ���������� `\.{@d}' ������������� � ���������� ������������� � ���������� � ������ �����. ����� ���� ���������� ������������� \CEE/-������. ��� ���������� ������ ����������� ������ ��������� (������ ������������ ���� �� ���� ������������� ������). ����� ��� ����� ������, ��������� � ���������� ������, ���������� \CEE/-������� ��������������� ������ � ���� ������� ����������� ������������ �� ���������� ���� ������. ��� ����������� ���������, ��������� ���������� ��������� �� \CEE/ �� ��������������� ��� ������ ���������. ���� ���� � �� �� ��� ���� ���� ����� ��� ����� ������, \CEE/-�������� ���������� ����������� \CEE/-������ ���� ����� ������. ��� ����������� ��������, ��������, ���� ������� ������ � ������ `Global variables', � ������� ����� ������� ��� ���������� ����������, ��� �� ��� �� ���� ��������. ����� ��������� ������ ����� ���������� ���, \.{CWEAVE} �������� ����� ������ �� ��� �������, ��������������� ����� �����, � ��� ��������� � ����� ������ ������: `See also sections~\dots' ("��. ����� ������~\dots"), � ������� ����������� ������ ���� ��������� ������, ������� ��� �� ���. ��������������� \CEE/-����� ������������� \.{CWEAVE} ���, ��� ������ ����� ��������� � �������� ��������� ������������ ���� ���������������, �.�. `$\langle\,$section name$\,\rangle\equiv\null$\CEE/ text'. ��� ���� � ����������� ������� � ���� ������ ���� `$\equiv$' ���������� �� `$\mathrel+\equiv$', ����������� �� ��, ��� \CEE/-�������� ���� ������ ����� �������� � ��������� ������ ������. ����� \.{CTANGLE} �������� � ���������� ��������� ������, ��� ��������� � �������� ���� ��������� ������������� \.{\#line}, ��� ��� ������ ����� � ���������� �� ������� � ��� ������� ��������� ����� ��������� �� �������� \.{CWEB}-����. ��������� �����, � ����������� ������� � ���������� \CEE/-����� ����� ������ ������. \section ��� ������ \.{CWEAVE}. ����� ���� \.{CWEAVE} --- ������� �� ����� \.{CWEB} ���� \.{.tex} ����� �������: ������ ������ ����������� ����� \.{.tex} ��������� \TeX'� ��������� ���� ����������������, ����������� ������ \.{CWEB}-����������. ����� � \.{tex}-���� ���������� ����� ���������, ������������� ����� ������ �������. ����� ������� �� ������� ����� ������ ������, �������� ���������� � ��������� ��������� ��������. �������, \.{CWEAVE} ���������� ������� ������������ ������: ��� ������� \CEE/-�������������� ����������� ������ ���� ������, � ������� �� ������������, � ����� �������� ���������� ������ ���� ���� ������, � ����� ����������, ���������� ������ ������� � ������ ��� ���� ``���������'' ������. �� ��������, ��� ����� ``���������'' ������ (``starred-section'')? ������, ������� ���������� `\.{@*}' ������ `\.{@\ }' ���������� ������ ����� ������ ������. ����� `\.{@*}' ����������� ��� ������, �������������� ������. ����� ������ � ��������� \TEX/ ������ �������� ����� ��������, � �� ��� ������������ � ����������� ���� ����������� ������� �� ��������� ��������� ��������� ������. ��� ������ ����� ��������� � ���������� � ���������� � ������ ������ ������ �������. ���������������: �� ����������� � ����� ������ ����������� ����������� \TeX'�, ���� �� �� �������, ��� ���������������� �� \.{cwebmac} �� ����������� � ����. �������� ����� ������ ��, ��� ��� ������ ����� ������������� � ������� �������, ����� ��� ���������� � �����������, � ����� ����� �������� ������ ������� � ������ ������ � �������� �� ��������� ����-����������, ��� ��� ������������ ������� ������ �������� ��������� �� ���� ���� �������. \TeX-����, ���������� � ������� \.{CWEAVE}, ��� ������ ������ �������� ���������: ��-������, ����� ������ (�.�. `\.{\\M123.}' � ������ ������ ����� 123, �� ����������� ��������� ������, � ������ ������� ������ `\.{\\M}' ������� `\.{\\N}'). ����� ������� \TeX-����� ������, ������������� ����� ��������, ��� ������� ����. ����� �� ���� ���� ������������� � \CEE/-����� ������, ����������� ��������� �����������, ���� ��� ��� ��������. ��� ��� ����� �������� �������� ��������� ���������� \TeX-�������� � \CEE/-���������. ��� ������� ��������� ������������� �������������, ������, ��� ������, ���������� ����������� �������� � �������������� ��������, ��������� �� ������ � �������. \section \CEE/-��� � ������ \TeX'� � ��������. ����� �� ��������� \TeX-�����, ��������, ��� ��� ����������� ��������� �� ���������� � ������ ������ \CEE/-���������, ������ ����������, ����� �� ���������� ��������������� ����, ��� ������������ � ���������. ��� ����� \.{CWEB} ��������������� ����������� ���������� � ���� \TeX-������ ����������� ����� \CEE/, ��������� �� ��������� `\.|'. ��������, ����� �� ����� �������� ���-�� ����� $$\hbox{ If \\{pa} is declared as `\&{int} ${}{*}\\{pa}$', the assignment $\\{pa}\K{\AND}\|a[\T{0}]$ makes \\{pa} point to the zeroth element of \|a.}$$ ����� �� ����� \TeX\ � \.{CWEB}-����� ����� �����: $$\lpile{\.{If |pa| is declared as `|int *pa|', the}\cr \.{assignment |pa=\&a[0]| makes |pa| point to the zeroth element of |a|.}\cr}$$ � �������, \.{CWEAVE} ����������� ��� � ����� �����, ��� ������ �� ���������� �� ������� �������: $$\lpile{\.{If \\\\\{pa\} is declared as `\\\&\{int\} \$\{\}\{*\}\\\\\{pa\}\$',}\cr \.{the assignment \$\\\\\{pa\}\\K\{\\AND\}\\|a[\\T\{0\}]\$}\cr \.{makes \\\\\{pa\} point to the zeroth element of \\|a.}\cr}$$ �������, ��� ������� ������������ ������, ��������� \.{CWEAVE}, ��� ��������� ����������� ����� �������� ����� ������� ������ � ������ ������ �� \\{pa} �������� �� ��, ��� \\{pa} ����� � �� ��������� � \CEE/-����� ���� ������. �������������, ������ �������� ������ �� �������������� � ���������� ������������ ��� ��, ��� � � ����� ���������; ����� ������� ��� ����������� �� ����������� ����� �������. � �� �� �����, �������������� \&{int} � \|a\ � ������ �� �������, ������ ��� \.{CWEAVE} �� �������� � ������ ����������������� ����� � ������������� ��������������. ����� �������������� ���������� ����� �����������, ��� ��� ������ ����������� ��� �����, ��� ��� �����������. �������� �� ��, ��� ������ ���������� \TEX/-������ � ������������� \CEE/-������, ������� ����� ���� ����� �� ����������, ��������� \CEE/-��� ����� ���� ������� � ����� \TEX/, ���� �� ��������� `\pb'. ����������, ����� \TEX/ �������� ���������� ������ \CEE/-����, ��������� ���, ��� ��������� ������������ (�.�. ��� ������ \.{/*} � \.{*/}, ���� ����� \.{//}) ���������������� ��� ����� \TEX/. ����� ��� �� ��� ������ �������� ����� \TEX/, �� ����������� \.{@<��� ������@>} ������� ����� �������������� � \CEE/-����; �������������, ������� ����� �������� \CEE/ �~\TEX/ �������������� �����������, ��� � ���� ��������: $$ \displaylines{ \hbox{\.{if} \.{(x==0)} \.{@}} \cr \hbox{\.{...} \.{using} \.{the} \.{algorithm} \.{in} \.{|@|.}} } $$ ������ �� ��� ����� ���� ������ � \CEE/-����� ������, � ������� ����� �������� ��� �� ������, ��������� ``Empty the \\{buffer} array''. ������ ������ �� \TEX/-����� ������, ������� ���� ��������� �� ������ ������, �� �� ���������� � �� ���������� ��. (�������� �������� �� `\pb' ������ ����� ������ � ���� ������.) \section ����������������. ����������� ��� \.{@d}, �� ������� ������� $$\\{identifier}\.{ }\hbox{\CEE/-���}\qquad\hbox{����}\qquad \\{identifier}\.(\\{par}_1,\ldots,\\{par}_n\.{) }\hbox{\CEE/-���}$$ (\\{identifier} � ������ �� ������ ������ �� ������ ����������� ���������) ������������� \.{CTANGLE} � ��������� ������������� \.{\#define}, ������� ������������� � ������ ������������ \CEE/-���������, ��� ������� �����. ���������������� `\.{@d}' ����� ���� ������� �� ��������� �����, ������ �� ����� ������� � ����� ������ `\.{\\}' --- �� ������������� ������� \.{CTANGLE}. ���� �� �����-�� ������� ����������� ��������� \.{\#define} � ���������� ����� \CEE/-�����, ����� ������ �� � \CEE/-����, � �� � ������� \.{CWEB}, �� � ���� ������ �������� ����������� ������� �������� ������ ��������������. \section ������ � ���������. ���� ��� ����� � \CEE/-���� ��������� ���������, ������������ \.' ��� \.", �� ����� ������ ��� ������, �� ����������� ����, ��� ������ `\.@' ������ ���� ����������� `\.{@@}' (��� ������������ ����������� ������, ������� ����� ���������� ������ ������, ��. �����). ��������� ��������� �� ������ ��������� �������� �������� ������, ���� ��� �� �������������~`\.{\\}'. \TEX/ � \CEE/ ���������� ��������� ������� ������� ������������ � ����������������� ��������, ��������� \TEX/ ������������ �� ���������� ������ ���������, � \CEE/ --- �� �������� ���������. � \TEX/ ��������� ���������� ������������ ��� ����������������� � ������� �������� \.' ����~\." ��������������; � \CEE/ �������� ����� ��� \.0 � \.{0x}. �~\.{CWEB} ��������� ������������ ��� ���������� ���, ��� ��� �������: � \CEE/-���� ����� �������� $40_8$ �������� `\.{040}' � \.{CTANGLE} ��� ��������� �������� ��� � \CEE/-���� � ������������ �����������, � \.{CWEAVE} �������� ��� $\T{\~40}$. ����������, \.{CWEAVE} �������� ����������������� \CEE/-��������� `\.{0x20}' ��� \T{\^20}. ������������� ������� ��� ������������ ���� � ������ ������� ������� ��� ����������������� �������� ���������� ���� �������� � ���������. ��� ���������� �������� ����� ������������ `\.{|040|}' �~`\.{|0x20|}' � \TEX/-����� ������. \section ����������� �������. {\sl ����������� ������ (control code)\/} \.{CWEB} --- ��� ���������� ���� ��������, �� ������� ������ `\.@'. �� ��� ������������ � ����������� ��������� �� ���, � ������ ������� ��� ����� �����. � ������������� ������ ����� � ���������� ������� ��������� ��������, � ������� ������ ����������� ������ ����� �����. $L$ ��������, ��� ������ �������� � ���������, $T$ (\TEX/), $M$ (middle) � $C$ --- � ������ �� ���� ������ ������ �� ������� ������ (�.�. ����� ����������� `\pb' � ���� ������). ������� $\to$ ����������, ��� ����������� ������ ��������� ������� ����� \.{CWEB}-����� � �������� ��������� �����, ��������� ������ ����� �������. ��������, $[LTMC\to T]$ ����� \.{@\ } ������, ��� ����������� ��� ����� ��������� � ��������� ���� � ����� �� ���� ������ ������, � ��� �� �������� \TEX/-����� (�������� ������) ������� ������. ��� ��� ���������� ����� ���� ������� � ���� ���������� �������: �����~$r$ �������� {\it ������������ �������� (restricted context)}, �� ����, ���������� \CEE/-������������, ���� ������, \CEE/-����� � ����������� ������� (���������� �����). ����� $c$ --- ��� {\it ���������� \CEE/-�������� (inner \CEE/ context)} ��� \CEE/-��� ������`\pb' (������� ����������� ������ `\pb', �� �� � ������ ������������ ����������). ��������� $*$ ����� ������ ���������, ��� ���� ����������� �������� ���������� ������������ ��������, ������� ����������� ������ \.{@>} ����� � ����������� �������� �� ����������� �� ��������. ���, \.{@d} �������� �� �� �����, ��� � \.{@D}. ����� ����������� ������ ������� � ������� ������� ��������. \gdef\@#1[#2] {\penalty-50\yskip\hangindent 2em\noindent\.{@#1\unskip \spacefactor1000{ }}$[#2]$\quad} \def\more{\hangindent 2em \hangafter0} \def\subsec{\penalty-300\medskip\noindent} \@@ [LTMCrc] ���� �������� \.@ ������������ ��� ������ `\.@'. ��� ������������ ����������� ���, ������� ��������� �������. �������, ��� ��� �������� ������������ ��� ����������, ���� �� ���������� email-����� � \.{CWEB}-����� (��������, \.{levy@@geom.umn.edu}). \subsec ��������� ���� ������������ \TEX/-����� ������. \@\ [LTMC\to T] �������� ������ ����� (�� ���������) ������. ������ ���������, ������� �������� ��� ����� ������, ��������� �� ������ \.@, ������������ ������� (��� � � ����������� ������ �������). \@* [LTMC\to T] �������� ������ ����� ��������� ������, �.�. ������, ���������� ����� ������. �������� ���� ������ ������ ��������� �� \.{@*} � ����������� ������. ��� ������� ����, � ��� �� ������ �������������� ����������� ������������������ \TEX/'�, ����� ���������� �������. ����� \.{CWEAVE} � \.{CTANGLE} ��������� \.{@*}, ��� ������� �� �������� ������ `*' � ����� ������� ������, ��� ��� ������������ ����� ��������� ������� �� ������������ ������. ����� ������ ������ ���������� ������ ���� ���������. \more �� ������ ������� ``�������'' ��������� ������, ����� \.* ���� ������������ ����� ����� \.{@*}, ������� ���� ������������� ������������ ������� ������ ������ � �������� ���������. ����� ��������� �������� ������, ������������ \.{@**}, ���������� � ���������� ������ �������: ����� ��������, ��� �� �������~$-1$. � ��������� ������, ������� ������������ ����� ��������������� �����, ������� ���������� �������� ������� � ����������. �������� ������� �������� ��������� ��������� ������� ���������. ���� ������� �� ������� ����, ��� ���������� ������ 0. ���� ���� ��������� �������, ��, ��-��������, �������� ����� �������� �������� ������� �������. ��������� ������ ������ ������������� �� ����� �������� ������, ���� ������ ������� �� ���������~1. \subsec ������������� ����� ������ ������ �������� ������������ ���������� ���������������� (������������ � \.{@d}) � ����������� �������� (������������ \.{@f} ���� \.{@s}), ������������� � ������������ �������. \@d [TM\to M] ����������������: ���������� \.{@d}, �� ������� ���� �������������, �������������� ��������� � \CEE/-���, ��� ������� �����. \@f [TM\to M] ����������� �������: ���������� \.{@f}; ��� ��������� \.{CWEAVE} ������������ �������������� ������ �������, ����� ��� ����������� � \CEE/-����. ����� ��� ����������� ������� --- `\.{@f} \|l \|r', ����� ������� �������������� �����������, ������������ \.{/*} � \.{*/}, ��� \|l � \|r --- ��������������: \.{CWEAVE} � ���������� ����� ������������� ������������� \|l ���, ��� �� ��� ������ � ��������� ������ ��� \|r. ��� ���� \.{CWEB}-������������ ����������� ������� ����� ����������������� ����� �/��� �������� �������������� ��������� ��������������� ������ \CEE/. ���� \|r --- ����������� ������������� `\\{TeX}', ������������� \|l ����� �������������� ��� ����������� ������������������ \TEX/. ��������, `\.{@f foo TeX}' � \.{CWEB}-����� �������� � ����, ��� ������������� \\{foo} ����� ���������� \.{CWEAVE} ��� \.{\\foo}. ����������� ������ ���������� \.{\\foo} �� ������ ����������, �������, ��� \TEX/ ��������� � �������������� ����. (������ ������ ������������� ������������� � \.{x}, ����� ��������� ����������� ������������������ \TEX/; ���, \\{foo\_bar} ���������� \.{\\fooxbar}. ������ �������, ������� �����, �� �������������, ��� ��� \TEX/ ����� �������� �� ����������� �������, � �� ������ ����� ����������� ������������������. ��������, $$\.{\\def\\x\#1\{x\_\{\#1\}\} @f x1 TeX @f x2 TeX}$$ ����� �������� \.{x1} � \.{x2} �� ��� \\{x1} � \\{x2}, � ��� $x_1$ � $x_2$. \more \.{CWEAVE} ������������� ����������� ��������������, ��������� ����������� \&{typedef}, ��� ����������������� �����, ������� ��� �� �������� ���������� ������� ������� �����. \@s [TM\to M;\;L] ���������� \.{@f}, �� \.{CWEAVE} �� ���������� ����������� �������� � ����� ������, � �������������� \CEE/-����������� ����������. ������������ ������� ������� � \.{@i}-������. \subsec ��������� ���� ��������� \CEE/-������ ������. \@{c @p} [TM\to C] \CEE/-����� ������������� ������ ���������� \.{@c} (���� \.{@p}, �.�. ``program''; ��� ����������� ������� ������ ���� � �� ��). ��� ���������� \.{CTANGLE} ��������� ��������� \CEE/-����� ������ ����������� ������ ���������, ��� ������� �� ��������~\tangref. �������, ��� \.{CWEAVE} �� �������� `\.{@c}' � \TEX/-�����, ��� ��� ���� �� �������� ���� \.{CWEB}, ����������� �� ������������� \TEX/'�� \.{CWEB}-������������, �� �������� ������� \.{@c} � ��������������� ������ ������������� ������. \@< [TM\to C;\; C;\; c] $*$ ���� ����������� ������ ������������ ��� ������ (���� ���������� �������, ��� ������� ����), ���������� ����� \TEX/ � ������������� \.{@>}. ����������� \.{@<...@>} � ����� ������������� �������� ��������� \CEE/-����. �� ��������� ������� �� ���������: \more ������ \.{@<} � ���������� $T$ � $M$ ��������� ��������� ����� ��� ������ � ������� �������, � ��������� \CEE/-����� ������. ��� ����������� \.{@>}, �� ������� ������� \.{=} ��� \.{+=}. \more � ��������� $C$, \.{@<} ���������, ��� ������ ����� ������������ --- �� \CEE/-����������� ����� �������� ���� \.{CTANGLE}, ��� ������� �� ��������~\tangref. ��� ����� ������� ��������� ������ \.{CTANGLE} � \.{CWEAVE} ��������������� ����� ��������� � ������, ���� �� ����� ������ ������ ������� \.=, ��������� ��� ������ ����� �������� ����������� ����� ������, � ������� ������ ������������ \.{@\ }. ���� ��� ������������� ����� �������� $\langle\,$foo$\,\rangle=\\{bar}$, ��� $\langle\,$foo$\,\rangle$ ������������, � �� ������������, ��������� \.= �� ����� ������. \more �������, �� ���������� \CEE/-��������� (�.�., ������ `\pb' � \TEX/-����� ������ ��� � �����������), \.{@<...@>} ��������, ��� ��� ����� ����������. ����� ������������� ������������ \.{CTANGLE}. �������, ��� ���� � ���� ������ �� �������� ��� ������ ��� ������� \CEE/, ��� ��� ��� ���������� \pb. \@( [TM\to C;\;C;\;c] $*$ ��� ������ ����� ���������� \.{@(}. ��� ����� ��������, ��� � ��� \.{@<}, �� � ��� �����������, ��� \CEE/-��� ������, ��������� \.{@(foo@>} ����� ������� \.{CTANGLE} � ���� \.{foo}. ��� ����� �� ����� �������� �� ������ ����� \.{CWEB} ��������� �������� ������. (����������� \.{@d} �� �������� � ����� �����, � ���� � �������� \.{.c}-����.) ���� �� �������������� ���� ����������� � ���, ����� ������� ������������ ����� ��� ����������� �������. ������ �������� �� ������������� ������ ��������� ������, ���������������� � ����� ����������. �������� �������� ������ ���������, �� ������������ ����� � �������� ��������� ���������, �� ����� ������ ������ ���������� �� ���������������. �������, ��� ����������� ������ ����� ���� �������� � ��������� ��������� �������� ������, ��������� �� ������ ��������� \.{@} ��� � \.{@(bar1@>}, ��� � � \.{@(bar2@>}. \@h [Cc] ������������ \.{CTANGLE} �������� � ��� ����� ����������� \.{\#define} �� ������������� ������ ���� ������ � {\it ��\/} ���������� �� � ������ \CEE/-�����. �������, � �������, ��� ������������� ���������� ���������������� ����� ���������� ������. (������������ \.{CTANGLE} ������ `\pb'.) \subsec ��������� ��������� ����������� �������� �������� ``����������� ������'' (``control texts''), ������������� `\.{@>}'. ����������� `\.{@>}' ������ ���� �� ��� �� ������ \.{CWEB} �����, ��� � ������ ������������ ������. ��������, ������������ ����� ������������ ��������� � �������������� \.{@>}, �������� ������������. \@\^ [TMCc] $*$ ���������� ����������� �����, ������ �� `\.{@>}', ����� ������� � ������ ������ � ���������������� \CEE/-���������; ���� ����� ����� ������ ��������� �������. ��������, ����� ��������� ����� ``system dependencies'' (��������� �����������) � ������, ������������ \.{CWEAVE}, ��������� `\.{@\^system dependencies@>}' � ������ ������, ������ �� ������ �������� ��� ��������-���������. \@. [TMCc] $*$ ����������� ����������� ����� ����� ������� � ������ � ����� ������� ������� (\.{typewriter} \.{type}). \@: [TMCc] $*$ ��������������� ����� ����� ������� � ������ � �������, ��������� \TEX/-�������� `\.{\\9}', ������� �� ������ ���������� ���, ��� ��� ����������. \@t [MCc] $*$ ���������� ����������� ����� ����� �������� � \TEX/ \.{\\hbox} � �������������� ��� ����� ���������� ��� \CEE/-���������. ���� ����� ������������ \.{CTANGLE}, �� ����� �������������� � ��������� ����� \.{CWEAVE}. ��������, �� ������ ������ �����������, ������� �������� \CEE/ � ������������ ����������, ����� `$\\{size}<2^{15}$', ����� `\.{|size < 2@t\$\^\{15\}\$@>|}'. \@= [MCc] $*$ ����������� ����� ����� �������� ������� � \CEE/-���������. \@q [LTMCc] $*$ ����������� ����� ��������� ������������ --- ��� ����������� ������������� ��� ��������� \.{CWEB}-�����. ����, ��������������� ��� ��������� � ��������� � ������� \.{@i}, ����� ��������� ���������� � ���� ����� � \.{@q} �����������. ������ �������������� ���� ����������� ����� ���� �������������� ������� ������ ������ C-�����, ����� ��������� ���������, ������������� �� ��������, "�� ������ � ������" (��, ������ ���: "go into a tailspin" --- {\sl ����. �����.\/}). \@! [TMCc] $*$ ����� ������ � ������� ����� ����������, ���� `\.{@!}' ��������������� ������������ �������������� ���� ������������ ������, ����������� � ������. ��� ���������� ����������, ����� ��������� ������, � ������� ������������� ��������� ���� ���������� ��������� ������ �������, �� ������, ��� �� �����������. ������ �� ����������������� ����� ���� �������������� �������������� � ������ �� ����������, �� ����������� ������������. `\.{@!}' ������ ����������� \.{CWEAVE} ����� ������������� ���������� ���� ������������ � \CEE/-����; ��������, ����������� $$\hbox{\&{int} \\{array}[\\{max\_dim}], \\{count}${}=\\{old\_count};$}$$ �������� � ������ ����� \\{array} � \\{count}, ������� �� ��������������. �����, ����������� �������, �������� \\{main}(\&{int}~\\{argc},\,\&{char}~$*$\\{argv}[\,]), � ����������� \&{typedef} ����� ������������� �������������. ����������� ������� ������� ����� (��� ���������) �� ���������� �� ����������, ��� �� �����, ��������� ����� ���������� ������������� (� ����� ������������ � ������� � ��������������), ���� �� ���� �������� ����� ����� ������� ������� �������, (��������, `\&{int}~\\{argc}; \&{char}~${*}\\{argv}[\,]$; $\{\,\ldots\,\}$'). \subsec ��������, �������, � ����������� ��������, ������� ������ ������ �� ������ \.{CTANGLE}. \@' [MCc] ������������� ����� ������������ ������� ������, ��������� ��� �������� � \.{CWEB} ����������� ���������� �� ��� ��������� � \.{WEB}. � \.{CWEB} �� ������������ � ������������ ���������, ��������������� ASCII-���� ������ ��������� ����� (�.�. \.{@'a'} ������������� \.{CTANGLE} � \.{97}, � \.{@'\\t'} --- � \.9). �� ������ ��������������� ����, ���� ������ �������� � ASCII �� ������, �� ������������ ��� ���������, �� � ����������� ������� �������� ����� \CEE/, ������������ � \.{}, ������ ���������� ��� ���������� ����������� �� ��������� ��������. \@\& [MCc] �������� \.{@\&} �������� ����� ����� �� ���� � ������� ������ � ������� � \CEE/-���� ���, ��� �� �������, �� ������� ����� ������ �� ����� ��������� ����� ����. \@l [L] \.{CWEB}-������������ ������ ������������ � \TEX/�� ����� 8-������ ���������� ��� �� ������� ���������� ��������� 128--255; ��� ������� ����� ��������� � ������� � ���� � ��������������� \CEE/-���������. � ��������� ����������� �������� ��������� ASCII ������ ����� ������� (����, ������� 128) ������������� ������ � ��������������� �������, �������� �� ��������� ��������� � �.�. ����� ����� ������� ���������� � ���������������, \.{CTANGLE} �������� �� ������������ ���������-��������� ��������� ASCII ���� \.{\_}, ����� ����� ��������������� ����������� ����� \CEE/. ��� ���� ����������� ������� �������������, ������� �� ��������� ������������ � ������ ��������, ������� ASCII-��� \T{\^}$ab$ (��� $a$ � $b$ --- ����������������� ����� � $a\ge8$) ������ \.{Xab}. �������� � ��������� ����������� \.{@l\ ab\ newstring}, �� ������� \.{CTANGLE} �������� ���� ������ ������� \.{newstring}. ��������, � ��������� ISO Latin-1 ����� `\"u' ����� ��� \T{\^FC} (���� \.{'\char`\\374'}), � \.{CTANGLE} �� ��������� �������� � ��������������� ���� ��� ������������������� �������� \.{XFC}. ���� �� �������� \.{@l} \.{fc} \.{ue}, �� ����� ������ ���� ����� ����� ������������� \.{ue}. \more \.{CWEAVE} ���������� 8-������ ������� ����� � \TEX/ ��� ��������������; �� ��� ���� \TEX/ ������ ����, � ���� �������, ����������� � �� ���������. ���� �� ������������ ��� ������������� �������������� ��� ������ (``custom'') ����������� ������������������, ������� ��������� \TEX/ ���, ����� �� ����������� ��� �� ������� ��� �����. � ��������� ������ ������� ���� ������� � \TEX/'� 8-������ ������� ``���������'', ���� ��������� ������, ���������� � ��������������� ������� ������ ����������� �������. (��� ��������������� ������������ �����, ���������� �������� \TEX/'� \.{\\it}.) ����� ����������� �����������, ���������� ��� ������������� � \.{CWEB} ������ ����� ����, ���� �� ������� ����������, �������� ���� �����������. \subsec ��������� ������ ����������� �������� (� ������, `\.{@,}', `\.{@/}', `\.{@|}', `\.{@\#}', `\.{@+}', `\.{@;}', `\.{@[}', � `\.{@]}') �� ������ �� ��������� \CEE/-��������� \.{CTANGLE}, �� � ��������� ��������� ������� ����� ������ �������� ���������� �� \TEX/-�������������, ����������� \.{CWEAVE}. ��������� �������� �������������� ������ �����, ����� ����������� � ������������� ���������� ���������, �� �� ����� ������ ���� ��������� ��������, ������ ��� �������� � ����������� ������, ����������� ������� � ����� ������; ����� ��������� �� ������ ��������� ���������. �������� �� ��, ��� \.{CWEB} ��������� ����������� �������������� ��������������, ������ ���������� ����� ������ � ����, ��������� ����� ���������, ��� ����������� ���� ��������� ������ ���������. \@, [MCc] ���� ����������� ������ ��������� ������ ������ (thin space) � ����� \.{CWEAVE}. ������ �������������� ������ ����� ������������ ��� ��������� ������������� ��������, ��������, ����� ��� �������������� ����������� �����. \@/ [MC] ���� ����������� ������ �������� ������ ������ � \CEE/-���������, ����������������� \.{CWEAVE}. ������� ����� ������������� ���������� \TEX/'�� �� �����, ���������� ��������� � 99\%\ �������, �� ������ ���������� ����� ��������, ����� ��������� ���������������, ������ ������� �����������������, ������ ���������. ��������, ����������� `\.{@/@,}' ����� �������������, ����� ��� ���������� � ����� ������. \@| [MC] ���� ����������� ������ ������ �������������� ������ ������ ������� ���������. ��������, ���� ������� ������� ��������� � ������ ����� ������������, � ������� `\.{@|}' ����� ������� � ��� ��������� ����� �������, ������� ����� ����� ������������ ������ ���������, ������ ��������� \TEX/'�� �������������. \@\# [MC] ���� ����������� ������ �������� ������ ������ ������� \.{@/}, � ����� ��������� ��������� �������������� ������ � ����� �������. �� ����� ��������������, ��������, ����� ��������� ���������� �������� ��������, ������������ � ����� ������. \.{CWEB} ������������� ��������� ����� �������������� ������ ����� ���������, �������� ����������� � ���������, � ����� ����� ����������� � ����������� � ���� �������. \@+ [MC] ���� ����������� ������ ��������� ������ ������, ������� ������ ���� ������ \.{CWEAVE}, ��������, ����� `\&{else}', ���� �� ������ ���������� �������� if--else ����������� �� ����� ������. ���� ������� `\.{\{@+}' � ������ ���������� ���������, ����������� ����� �������, �� ������ ��������� ��� �������� ������� ����� ����������� �� ��� �� ������, ��� � ����������� ������, � � ��������, ������� ����� �������������� ������� ��������� ��� ��������� �� ��������� ������. \@; [MC] ���� ����������� ������ ��� �������������� ���������� ����� � �������, �� �������. �� ������ ��������������� ���, ��������, ����� ����� ������ ��� �������, ����� \CEE/-���, �������������� � ���� ������ ��� �������, ���� ��������� �������� ���� ������������ ������ � �������. �������� ����� ����������� �������� $$\lpile{\.{if (condition) macro @;}\cr \.{else break;}\cr}$$ ��� ������������ \\{macro} ������ ��������� �������� (����������� � �������� ������). ��� ������ ��������� ���������� ���������� \CEE/. \@{[} [MC] ��. \.{@]}. \@] [MC] ��������� ���������� ������ \.{@[...@]} ������ ������ ���������, ������� ������ ���� �������������� \.{CWEAVE} ��� ���������, ���� ����� �� ���������. (����� ������ ��������� � ���������� ����������� ��������.) ����� ���������� `\.{@[@]}' ����� ������ ���� � ����� �������, ����� ��������� ��������� �� �������, �����, $$\.{int @[@] (*f)();}$$ � ��������� ������ \.{CWEAVE} ������� ������ ����� ����� ����������� � ���������� \CPLUSPLUS/ `\&{int}($*f$)'. \subsec ��������� ����������� ������� \.{CWEB} ��������� ������ ������. \@{x @y @z}[\\{change\_file}] \.{CWEAVE} � \.{CTANGLE} ������������� ��� ������ � ����� �������� �������, ����������� \\{web\_file} � ���� ��������� \\{change\_file}, ��� \\{change\_file} �������� ������, ���������� ��������� ����� \\{web\_file}. �������������� ����� � ���� ��� ����� ���� \.{CWEB}, ������� ����������� ����������� � ���� �����������. \more ��� ��� ��������: ���� ��������� �������� ���� � ����� ``���������'', ��� ���������� ����� ��� `\.{@x}$\langle$������ ������$\rangle$\.{@y}$\langle$% ����� ������$\rangle$\.{@z}'. ����������� ����������� ������� \.{@x}, \.{@y}, \.{@z}, ���������� ������ � ������ ���������, ������ ���������� � ������ ������, ������� ����� ������ ������������. ���������� $\langle$������ ������$\rangle$ ������������ ��������, ������� ����� ������������� ���������������� ������� \\{web\_file}; � $\langle$����� ������$\rangle$ �������� ���� ��� ����� �����, �������� �������������� �������� ������. ��� ������ ������ ``������ ������'' ���������� ����������� ����������� �� ������� �~\\{web\_file}, ��� ��������� ������ ���� ���������� ����� ������ ��������. \more ����� ������������, ����� ������ ����������� � ����� ��������� ���������� ���� ��������� ����� ��������� ����� ���������� �����, �� ������������ `\.{@x}', `\.{@y}', ����~`\.{@z}'. ����� ������ ������������ � �� ������������ � �������������. \more ����� ����������� �������, ����� ��������� � ������������ \.{CWEB}-������, ���������� ������-���� (��������, \.{tangle.w} � \.{weave.w} ���� \.{tex.web}), ������� ���������� �������� ��� ��������� ��������� � ������������ ����� �������. �� ������ ���������� ���� ��������-��������� ���������, �� ��������� ��������� �����; � ��� ������ ��� ����������, �� ����� ����� ����� �������� � ����� ������ ��������� �����, ������� ����� ���������� ����� �� �������. \@i [\\{web\_file}] � ���� �������, \\{web\_file} ��� �� ���� ����� ���� ����������� ���������� ������. ����� \.{CWEAVE} ���� \.{CTANGLE}, �������� ����, ������������ ����������� ������ \.{@i} � ������ ������, ��� ��������� ������ � �������� ��������� �����, ��� �������� ������� �� \.{@i}, ������� ������������� ����������� \CEE/, ��������������� ��������� \.{\#include}. ����� ���������� ������ ����������� ����� ��������� ��������� � ��������� ������ ��������� �����. ��� �����, ��������� �� \.{@i}, ����� ���������� ��������� \.", �� ��� �������������. ��������� ����� ���� ���������. \more ����� ��������� ����� ����� ������, ������������ \.{@i}. ����� �������� �� ������ ��������� ���� ���������� ���� ������. �������������, ��������� ���� �������� ����������� ��������� ������, � ����� � ��� ������ �������������� ��������� \.{@i}. ���� \.{@i} \.{foo} �������� ����� \.{@y} � \.{@z} � ����� ���������, ��������� ������ ����� \.{foo} � �����, ������� �� ��������, �� ����������; ����������� ����� ���� ������� � ������, ������ ���������� �� ���������� ���������� input. \more � ������� UNIX (� ������, �������������� ���������� ���������), ���� ����������� ���������� \.{CWEBINPUTS}, ���� ���� ����������� ����������� ���� ������ ��� ����������, \.{CWEB} ����� ������������ �� �������� � �������� ����� ��������, � ������� ����� ����������� ����� ���������� ������, ���� ��� �� ����� ������� � ������� ��������. \section �������������� ����������� � ���������������. 1. � ��������� ����������� \.{CWEB}, ������� {\def\\#1#2{`{\tentex\char'#1#2}'}% ��������� ������������� ������������ ����������� ������, ������� \\13, \\01, \\31, \\32, \\34, \\35, \\36, \\37, \\04, \\20 �~\\21} ����� ����������� ��� ���������� ��� `\.{++}', `\.{--}', `\.{->}', `\.{!=}', `\.{<=}', `\.{>=}', `\.{==}', `\.{\v\v}', `\.{\&\&}', `\.{<<}' �~`\.{>>}' ��������������. 2. ���� ���� ������� ����� ����������� ����� ��������, �� ����� ���� ����������� � ������������ �������������, ��� ��� ������� ���� ��� ���������� \.{@l}. �� ��� ������� �������������� ����������� �������� ASCII, ���� �� ������ ������ ���������, ������� �������� ��������� � ���, ���� ����� ���������� ����������. 3. �������� \TEX/, ������������� \.{CWEAVE}, ����������� �� ������ � ������������ ������ 80 ��������. ����� ����� \TEX/ ����������, ��������������� � ������������ ������� �����. ���� �� �� ������� ������ ������� �������, \.{CWEAVE} ����������, ����� ����������� \TEX/'� ����������� �� ��������� �����, � ������� `\.\%' � ������ ������ ����� ������. 4. \CEE/-����� ������������� ``����������'' (``bottom up'') ����������, ������� ���������� ������ ������� ��� ``����� ����'' (``part of speech'') � ����������� ��� ����� �� ��� �\'������ � �\'������ �����, ���� ��� ��������, �������� ����������� ����������, ��������� � ������������ �~\.{CWEAVE}. ����� ������ �����, ����������� � ������� ������������, ����� ��� ��������� �������������� � �������� ���������, ������ ������ ��������� �������� ������ \.{CWEAVE}, �� ����� �������� ��������� �������, ��������� ������ ������������ ����� �������, ��� ������ \CEE/. ������ �����, ����� �������� �������, ������� ���������� \TEX/ ������ ������� � ������� ����� ��� ����������, �������������� �������������� ������� � ������� ��������. ��� ���������� ��������� ����������� ������������ �������� ���������� ������� \CEE/-������� � \pb, ��������� ������� � ������� ����� ������ ������������, ����� ���������� \pb\ ������������� � \CEE/ � \TEX/. ���������� � �������� ��������� � ����������. ���� ��������� ������������� ��������� � \pb, �� ���������� �� \.\# ������ ������������� � ������ ������, ����� \.{CWEAVE} �� ���������� �� ���������. 5. ����������� � \pb-������ �����������. ����� `\.|', ������������ �� ������� �� ������ \TEX/ � \CEE/, ��������� `\.|', ������� �� �������� ������ ������, ������������ ������ ���� ����� ������, ��������� \CEE/-�����. 6. ����������� ������ ����� ���������� �������� �������� ������, � ��������� ������ \.{CWEAVE} ������� ���� ������������, �� ��� ���� ������� ������� ������������ ������ ������, ��� ��� \TEX/'� �� �������� ������� ������. 7. ���� �� ����� ������� ��������� ��������� ������������� �������� ��������� ����� \CEE/-����, �� ������� �������� ������ ��� ``����������������''. ����� ����������� �� � ���� \.{CWEB}; ��������� ��� ��������� ����������� � ��������� �����������. ����� ����, ����������� ������ ���� ��������� � ����� ������ \TEX/'�; �������������, \.{CWEAVE} ����� � �����������, ���� �� ��������� ����������� \CEE/ � \.{/*...*/} ������ \.{/*|...|*/}. ���� ����� \CEE/-���� ������ ���� ``����������������'', �� ������ ���������� �� ����������� �������������, ��������� \.{\#if 0==1} � \.{\#endif}. 8. ��� ������ \.{@f} �������� ���������� ���� ������������� ���, ����� �� ��� ���� ������� �������, � ��� ����������� ������� ����������� ���������������. ������ ������, ������ ������������� ����� ������������ ������ ������ �� ���������� ����� ���������, � ���� ������ ������������ ���� �� ����, ��� ����� ��������� ����������� \.{@f}. ��� ���������� ���, ��� \.{CWEAVE} �������� � ��� �������; �� ������ ������� �������������� ��������� \.{@f} � ������������ ������, � �� ������ ������������ �����. (��� �� �����, ��������������, ��������� \.{typedef}, ������� ������ ������������� ������ ������ ������ �������, �� ������� ����� �������: ��� ��������� ��-������� �� � ����� ���������������� \.{typedef}. ��� ��������������, �� ���-���� ��������� ��������������. �� ������ ������ ��� �����������, ��������� \.{@s}, �� ���� ����� \.{typedef}.) 9. ������ ���������� �������� � ����������������� \CEE/-��� ������, �������� �� ���������������� `\.{@,}'. ��� ����� ����� ��������������� \.{@t}; ��������, `\.{@t\\hskip 1in@>}' ���� ������ ������ 1~����. ����� ����, `\.{@t\\4@>}' ����� �������������� ��� �������� �� ���� ������� �������, ��������� ����������� ������������������ \.{\\4} ���������� � \.{cwebmac} ���, ����� ������ ����� �������. (��� ������������, � �������, � ������ �����, ������� �������� ���������� ���������, ��� ��� ����� ����� ������� ������� �����.) �� ����� ������ ������������ `\.{@t\}\\3\{-5@>}' ��� ��������������� ������� ������ ������� ���������. 10. ������ ������������� � \.{CWEB} ����� ���� ����� ��������������. ������� �� �� ������ ������������ ���� � �� �� ��� ��� �������������� �����������, ��������, ����� ���� � ���� \.{struct}, �������� �� ��, ��� \CEE/ ��������� ���. \section ������ ��������. ��������� ������ \UNIX/ ��� ��� \.{CTANGLE}, ��� � ��� \.{CWEAVE} ����� ��� $$\.{ctangle [options] web\_file[.w] [\{change\_file[.ch]|-\} [out\_file]]}$$ ���� ���� ��������� ������ ���� ����� `\.-', �� ���������� ������. ���������� \.{.w} � \.{.ch} ����������� ������ � ��� ������, ���� �������� ����� ������ �� �������� �����. ���� ���� � ����� ������ �� ������, ����� ����������� ���������� \.{.web}. ��������, `\.{cweave} \.{cob}' ���������� ��������� \.{cob.w}; ���� ��� �� �������, ����� ����������� \.{cob.web} ����� ��������� ����������� ������. ���� ��� ��������� ����� �� ������, ��� \CEE/-�����, ������������� \.{CTANGLE}, ���������� ����������� ���������� \.{.c}; ��� \TEX/-�����, �������������� \.{CWEAVE}, ������� ���������� \.{.tex}. � ��������� ������, ����������� \.{CWEAVE}, \.{.tex} ���������� \.{.idx} � \.{.scn}. ����������� ������������ ����� ��� ��������� ���� ��������� �������������, ��� `\.{wv}' ����� �������� `\.{cweave -bhp}'; ��� ��������� ���� ����� \.{CWEAVE} �� ��������, �� ����������� ��������� �� �������. ���������-����� ���������� ���� �������� `\.-', ����������� �������� �����, ���� `\.+', ������� ��� ���������. ��������, `\.{-fb}' ��������� ����� \.f � \.b; `\.{+s}' ��������� ����� \.s. ����� ����� ���������� ����� ������� ������, ����� ���, ���� � ��, � ������. � ��������� ������ �������������� ��������� �����: \yskip \def\option#1 {\textindent{\.#1}\hangindent2\parindent} \option b �������� ��������� ��� ������. (��������� �� ���������.) \option f ���������� ��������� ������ �������� \CEE/, ����������������� \.{CWEAVE}, �������� ����� ������. (��������� �� ���������; \.{-f} �������� ������, �� ������ ��������, ��� ����� ����� �������������� ��������� �������� � \CEE/ "�������������".) (�� ������ �� \.{CTANGLE}.) \option h ����� ��������� � ���������� ���������� ���������. (�������� �� ���������.) \option p ���������� �� ����� ������ ��������� ��������� � �� ���������. (��������� �� ���������.) \option s ������ ���������� ������������� ������ �� ��������� ������ ���������. (��������� �� ���������.) ���� ���� \.{CWEB}-����� ���� ������ ������, ����� ��������� �������� �������, ��������� �� ������ � ���������� �������� \.{CTANGLE} �/��� \.{CWEAVE}. \option x �������� ������ � ���������� � \TEX/-����, ��������� \.{CWEAVE}. (��������� �� ���������.) (�� ������ �� \.{CTANGLE}.) \section �������������� �������� � ��������������. ��� ����� �� �����������, ��� \.{CWEAVE} ������������ ��������� ��������. ���� � ��� ��� ������� ������, �� ������ ��������� \.{CWEAVE} ������� ��� ����������. ��� ������� ����������� �������� �������, ������, ������� ����� ���������� �������������. ������� �������������� ������ ���������� � �������� ������� \.{CWEAVE}, � �� ������ ������� ��������� ����� ���� �������, ���������� ����~\.{prod.w}, ��������� � �������� ������� \.{CWEB} � ����������� `\.{cweave}~\.{-x}~\.{prod}' � `\.{tex}~\.{prod}'. �� ������ ����� ������, ��� \.{CWEAVE} ��������� ��� \CEE/-���, ���� ��������� ����� ��� ������ `\.{@ @c @2}'. (����������� ��� `\.{@2}' ������������ ``��������'' (``peeping'') ����� ������, � `\.{@0}' �������� ���.) ��������, ���� ���������� ����� \.{CWEAVE} ���� \medskip \begingroup \verbatim @ @c @2 main (argc,argv) char **argv; { for (;argc>0;argc--) printf("%s\n",argv[argc-1]); } !endgroup \endgroup \medskip\noindent �� ����� ����� �������� ��������� �����������: \medskip \begingroup \verbatim [...] 4:*exp ( +exp+ )... 11:*exp +exp+ int... 5:*+exp+ int +unorbinop+... [...] 60: +fn_decl+*+{+ -stmt- +}- 55:*+fn_decl+ -stmt- 52:*+function- [...] !endgroup \endgroup \medskip ������ ������ ���������, ��� ���� ��������� ������� ����� 4, � \.{CWEAVE} � ��������� ������ �������� � ����� ������ ������������������ ���������� (chunk) ������ � ������� \TEX/ (���������� ``���������'', ``scraps''), ������� �������������� ��� \\{exp} (��� ���������), ����������� ������, ����� \\{exp}, ����������� ������, � ����������� �������, ������� �� ���� ��� ������� �������������� ������������. (����� \.+ � \.- ���������, ��� \TEX/ ������ ����� � �������������� ���� ���� ����� �� ��� �� ������� �������. ������ \.* �������� ������� ������� �����������.) ����� ����������� ������� 11, � ������������������ $(\,exp\,)$ ������������ �� \\{exp} � ��� �����. � ����� ������ ���� \CEE/-����� ����������� ����� ������� �������� ���� \\{function}. ������ ��� ���� �� ��� ������, � �� ��������� ������ �����, ��������� � ���� ����. ��� ������, ��� \.{CWEAVE} �� ���� ���������� ���-�� � ����� \CEE/-����. ��������, ����� `\.{@}' ������ ����� `\.{char **argv;}' � ���������, ���������� ����. � ���� ������ \.{CWEAVE} ����� ������ ��������, ��������� �������, ��� ����� ������ ����� ���� ������ \\{exp}. ������� \TEX/'� ����� ���������� ������� `\X2:Argument declarations\X' � ��� �� ����� ������, ��� � `$\\{main}(\\{argc},\39\\{argv}{}$)'. � ���� ������ ����� ������ \.{CWEAVE}, ������� `\.{@/}' ����� `\.{main(argc,argv)}'. \.{CWEAVE} ������������� ��������� ��������� ���������� ����� ���������� � ������ ���������� �����. ��� ���� ������ �������� ��� ��������: $$\vbox{\halign{#\hfil\cr \.{int x;@+@t\}\\6\{@>}\cr \.{@@;@\#}\cr}}$$ `\.{@\#}' �������� �������������� ������ ����� `$\langle\,$Other locals$\,\rangle$'. \section ����������. ��� ������ �������� ���������, ���������� � \.{CWEB}, ����������~A �������� ��������� ��������, �������� � ������ ����� ������� \.{CWEB}. �� �� ���������, ��� ��������� ������ �������� � ���� ����������, ������ ������� �������������� �������� ���� \.{CWEB}. ����������~B --- ��� ���� �����������, ������� ����������� \TEX/ �� ������ � ������� \.{CWEAVE}, � � ����������~C �����������, ��� ������������ ��������� �� ���� �������� ��� ��������� ������� ������. ``������'' ������ ����� �����������, ������� ����� ���� ������������� �� �������� ������� \.{CWEB} �������� \UNIX/ \.{make} \.{fullmanual}, �������� ����� ���������� D, E, �~F, �������������� ����� ������ �������� ������ \.{CTANGLE} � \.{CWEAVE}. \vfil\eject\titletrue \def\runninghead{���������� A --- ������ ��������� ����� {\tentt CWEB}} \section ����������~A: ��������� �������� \.{CWEB}. ��� ���������� �������� ������ ��������. ������ �������� ������� ������ ��� \.{CWEB}, �� ������� ������������ ������~12--15 �����~\.{common.w}, ������� �������� ������������, ����� ��� \.{CWEAVE} �~\.{CTANGLE}. �������, ��� ��������� ������ �������� �������, �������������� ��������� ���������; ������� ��� ������������ ��� \.{CWEAVE}, ��� � \.{CTANGLE}, �� ������������ �������, ��� ����� \.{CWEB} ������� ����� ��������������, ���� � ��� ������� ����� �������. ������ � ������ �������� �������� ��������������� ��������� \CEE/-����, ���������������� \.{CTANGLE} � ������ � ������� \TEX/, ����������� \.{CWEAVE} ��� ��������� \.{common.w}. ��������� ������� �������������, ��� ����� ��������� ���� �������� ���� �� ������. \vskip 6pt \begingroup \def\tt{\eighttt} \baselineskip9pt \verbatim @ Procedure |prime_the_change_buffer| sets |change_buffer| in preparation for the next matching operation. Since blank lines in the change file are not used for matching, we have |(change_limit==change_buffer && !!changing)| if and only if the change file is exhausted. This procedure is called only when |changing| is 1; hence error messages will be reported correctly. @c void prime_the_change_buffer() { change_limit=change_buffer; /* this value is used if the change file ends */ @; @; @; } @ While looking for a line that begins with \.{@@x} in the change file, we allow lines that begin with \.{@@}, as long as they don't begin with \.{@@y}, \.{@@z} or \.{@@i} (which would probably mean that the change file is fouled up). @= while(1) { change_line++; if (!!input_ln(change_file)) return; if (limit } } @ Here we are looking at lines following the \.{@@x}. @= do { change_line++; if (!!input_ln(change_file)) { err_print("!! Change file ended after @@x"); @.Change file ended...@> return; } } while (limit==buffer); @ @= { change_limit=change_buffer-buffer+limit; strncpy(change_buffer,buffer,limit-buffer+1); } !endgroup \endgroup \vfill\eject \def\runninghead{���������� A --- ����� {\tentt CTANGLE}} ����� ��������� ������ \CEE/-����, ���������������� \.{CTANGLE}, ������� ������������� ��������� ������ �� ���������� ��������. �������� ��������, ��� ������~13, 14 �~15 ���� "��������" � ������~12. \vskip6pt \begingroup \def\tt{\eighttt} \baselineskip9pt \verbatim /*:9*//*12:*/ #line 247 "common.w" void prime_the_change_buffer() { change_limit= change_buffer; /*13:*/ #line 261 "common.w" while(1){ change_line++; if(!!input_ln(change_file))return; if(limit}', ��� �������� ������ `\.{\\}', � ���� ������� ������� �� �������� ������ � �������, ������������� �� T. �������� ����� ������������ ����������� `\.{@:}', ��������� ������, ������� ������ ������� ����: $$\.{\\def\\9\#1\{\}}$$ �� ������ ������, � �������, `\.{@:TeX\}\{\\TeX@>}' � ����� \.{CWEB}-�����; \.{CWEAVE} �������� ��� � ������ � ���������� �������, �������������� �����, � ����������� ���������� `\.{\\9\{TeX\}\{\\TeX\}}', ������� �����������, ��� ���� �� ����� ���������. ���������� � ����� ������ ����� ���������� ������� ��������, ��� ��� ��� ����� ���� ����������� � ����� ����������� �������. ��������� ���� �������� �������� ����� ``special refinements''; ������ ����� �� ``kludges''. \point 12. ���������� ����� \.{\\secno} ������������� ����� ������� �������������� ������. \point 13. ���� �� ������ ������� �� ������ ������ ������, ������� ���� �������� (� ������� ����� ���������) � ����������, ��������� ������� `\.{\\let\\maybe=\\iffalse}' � ���������, ����� ������ ������� ����� \.{CWEB}. ������������ ��������� �������� ������� �� ������ �����������. \point 14. ��� ������ �� ������ ������ (�� ��-���������), �������������� ������� \.{\\A}, \.{\\ET}, \.{\\Q}, \.{\\U}, \.{\\ch}, \.{\\fin}, \.{\\con}, \.{\\today}, \.{\\datethis}, � \.{\\datecontentspage}. ���������� \.{CWEAVE} �������� �� ���������. \point 15. ����� ��������� ������ ��������� ����� ���� ������������ �������� � ������� \.{\\noatl}, \.{\\noinx}, \.{\\nosecs}, \.{\\nocon}. \point 16. ��� �������������� ����� � ������ ����������� ��������� ������� ������� plain \TEX/ ����� �������� � ���������� \.{CWEB} � �������� ���, ��� ��� ������� � �����~9 {\sl The \TEX/book}, � ����� �����������. ������ "�����" (������ \.{\\.}) ������ ��������� ��� \.{\\:}. \point 17. "������������������" ������ \.{cwebmac.tex} ���������� ��������� �������������� �����������, ������� ����� ����������� �������������. ��������, ���� �� ��� ��������� ������ ��������, ���� � ��� ���������� �������. ���������� D, E, � F � ������ ������ ����� ����������� ���������� � �������������� ������������������ �����, ������� �������� `$\gets$' �� `$=$' � ��������� ��������. �� ������ ����������� ��� ����������, ����� ������, ����� ������ ��� ������ ��������. \vfill\end