summaryrefslogtreecommitdiff
path: root/web/webfiles
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/webfiles
Initial commit
Diffstat (limited to 'web/webfiles')
-rw-r--r--web/webfiles/Changelog187
-rw-r--r--web/webfiles/README27
-rw-r--r--web/webfiles/cweave-f-spec.tex273
-rw-r--r--web/webfiles/cweb-fsa.latex61
-rw-r--r--web/webfiles/mtest.tex372
-rw-r--r--web/webfiles/mtest.web274
-rw-r--r--web/webfiles/spider/README44
-rw-r--r--web/webfiles/spider/sp-webfiles.ch223
-rw-r--r--web/webfiles/spider/webkernel.tex424
-rw-r--r--web/webfiles/swebbind.sty246
-rw-r--r--web/webfiles/test.tex65
-rw-r--r--web/webfiles/webfiles.dtx3882
-rw-r--r--web/webfiles/webfiles.ins9
-rw-r--r--web/webfiles/webfiles.pdfbin0 -> 361809 bytes
-rw-r--r--web/webfiles/webfiles.sty1002
-rw-r--r--web/webfiles/xwebdoc.sty300
16 files changed, 7389 insertions, 0 deletions
diff --git a/web/webfiles/Changelog b/web/webfiles/Changelog
new file mode 100644
index 0000000000..21fa5f4766
--- /dev/null
+++ b/web/webfiles/Changelog
@@ -0,0 +1,187 @@
+----------------------------
+version 1.0.1 2002/03/05
+New major version
+----------------------------
+version 1.0.43 2002/03/05
+changes to pdf links, suggested by Andreas Scherer
+ * use Blue instead of Red
+ * fith instead of fitbh
+ * raise and smash, to get it neatly in view
+new major version for release today
+----------------------------
+version 1.0.42 2002/03/05
+added
+ Notes on running weave
+ Acknowledgements
+----------------------------
+version 1.0.41 2001/11/21
+input pdfcolor.tex when pdftex macros are used
+----------------------------
+version 1.0.40 2001/02/09
+bug fix: redefined *all* reference macros \Us, \Us ... to prevent
+weird references in the last section or complaints about undefined
+macros when reflist is off
+----------------------------
+version 1.0.39 1999/05/26
+for compatibility, define \xweb_ModTitle in \N for cweb
+----------------------------
+version 1.0.38 1999/05/26
+added a hook
+----------------------------
+version 1.0.37 1998/10/02
+set default \xweb_cancel true; this prevents strange newpages
+(seen in MapLab srclib.tex)
+----------------------------
+version 1.0.36 1998/10/01
+take care of noindex and noreflist options in spidery webs
+----------------------------
+version 1.0.35 1998/10/01
+take care of xwebSecNoEject in spidery webs
+----------------------------
+version 1.0.34 1998/05/26
+fixes for twocolumn documents.
+----------------------------
+version 1.0.33 1998/05/26
+fixed typo.
+----------------------------
+version 1.0.32 1997/12/30
+* added "nofiles" option (and opposite: "writefiles")
+* use counter xwebOutlineDepth to decide what goes into
+ the PDF Outline
+----------------------------
+version 1.0.31 1997/12/30
+put all layout macros from cwebdoc.sty, webdoc.sty, progltx.sty, and
+logos.sty in xwebdoc.sty.
+----------------------------
+version 1.0.30 1997/12/30
+tagged all macro definitions with macro/macros environment
+----------------------------
+version 1.0.29 1997/12/27
+debugged; added \xwebInputIndex and \xwebInputReflist as a user
+interface to \xwebIdIndex and \xwebRefList.
+----------------------------
+version 1.0.28 1997/12/27
+gave \xwebIdIndex and \xwebRefList a filename argument.
+----------------------------
+version 1.0.27 1997/12/27
+cleaned up and improved documentation
+----------------------------
+version 1.0.26 1997/12/18
+improved documentation.
+save control sequence "foo" in "\xweb_s_foo" instead of "\xwebfoo".
+----------------------------
+version 1.0.25 1997/12/18
+fixed a space that slipped in
+----------------------------
+version 1.0.24 1997/12/17
+\xwebVerbString is \vb in cweb, but \= in spider; fixed Spider's
+rebinder.
+----------------------------
+version 1.0.23 1997/12/16
+moved the opening code for the .con file to the same place as the
+typesetting of the table of contents, to get it after the TOC is set.
+----------------------------
+version 1.0.22 1997/12/16
+commented out the vbox-unvbox trick; it forbits floats in the current
+implementation!
+----------------------------
+version 1.0.21 1997/12/16
+use #1 instead of global \xwebJobname in pdf outline code in
+\xwebContents
+----------------------------
+version 1.0.20 1997/12/15
+Do \xwebContents when the first module starts, that is, after the
+limbo section instead of before inputting the webfiles. This way, the
+user can set \xwebContentsTop and \xwebContentsBot, or redefine
+\xwebContents, in the limbo section, without having to do
+\xwebContents{...} explicitly in combination with [nocon].
+----------------------------
+version 1.0.19 1997/12/15
+Allow filename extensions in the argument of \webfile; strip them
+to create \xwebJobname.
+----------------------------
+version 1.0.18 1997/12/15
+don't set underlined index entries in math mode
+----------------------------
+version 1.0.17 1997/12/14
+fixed some errors in the documentation; added a summary of options.
+----------------------------
+version 1.0.16 1997/11/28
+added support for PDF outlines
+----------------------------
+version 1.0.15 1997/11/25
+* small fixes.
+* handle module numbers in the index by \xwebSetModNrList too.
+ (I believe everything that needs to be hyperlinked is hyperlinked
+ now; only need to implement a `contents' for pdftex)
+----------------------------
+version 1.0.14 1997/11/25
+Reorganized hyperlink code.
+Added "hyperref", "pdftex" and "nohype" options.
+Support for hyperref package works, direct pdftex support not yet
+implemented.
+----------------------------
+version 1.0.13 1997/11/24
+All cross-referencing macros now typeset number lists correctly.
+Hyperlinks are created by \xwebSetModuleNumber.
+The target for these links is the module number, that is typeset by
+\begin{xwebModule}.
+----------------------------
+version 1.0.12 1997/11/24
+Used macros from pdfcwebmac to scan lists of references, and add pdf
+links on the fly (works only with pdftex of course, and only the
+beginpoints of links are implemented now, so no jumping yet). It works
+for typesetting lists of ref. numbers, and the links look good in
+Acrobat, but the code must be made more readable, must be put in xweb
+namespace, must be tested better, and hyperlinks should be implemented
+through hyperref.sty, to make them useful with other TeX's
+----------------------------
+version 1.0.11 1997/11/23
+\xwebRefNumber and \xweb_contentsline use \xwebSetModuleNumber to
+typeset the module number. Custom formatted module numbers
+(i.e. \thexwebModule != \arabic{xwebModule}) are now set correctly in
+the per-web contents and in refinement names in the code. It was already
+correct in the number of the documentation parts, and in the List of
+Programs. Only (?) problem is in the List of Refinements, where a
+refinement can have multiple numbers if it was defined in more than one
+section.
+----------------------------
+version 1.0.10 1997/11/23
+cleaned up
+----------------------------
+version 1.0.9 1997/11/22
+improved documentation;
+added "hideformats" and "showformats" options;
+fixed the changeflag (see \xwebStar)
+----------------------------
+version 1.0.8 1997/11/22
+Typeset every module in a \vbox, that is \unvboxed at the end, to
+prevent name clashes with the output routine if it fires while the
+weave bindings are in effect. Thanks to Hans Hagen for this idea.
+----------------------------
+version 1.0.7 1997/11/22
+removed all \changes; changes are now logged with RCS
+----------------------------
+version 1.0.6 1997/11/22
+improved version-setting code in <driver> and <main>
+----------------------------
+version 1.0.5 1997/11/22
+fixed some occurences of "cweb" that slipped through
+----------------------------
+version 1.0.4 1997/11/22
+Moved all cseqs to xweb namespace. Use no underscore in catcode names.
+No underscore in \xweb_GroupLevel, this cseq occurs also in the lop
+file.
+----------------------------
+version 1.0.3 1997/11/21
+Major version number is now set manually in webfiles.dtx, minor
+version number is taken from the RCS revision number, and the complete
+version number is exported to version.tex, for use in Makefile. First
+part of RCS date is used in \date{}.
+----------------------------
+version 1.0.2 1997/11/19
+fiddled with rcs keywords
+----------------------------
+version 1.0.1 1997/11/19
+Initial revision
+=============================================================================
diff --git a/web/webfiles/README b/web/webfiles/README
new file mode 100644
index 0000000000..361d9e52af
--- /dev/null
+++ b/web/webfiles/README
@@ -0,0 +1,27 @@
+
+This is the WEBFILES package for inclusion of CWEB/Spidery WEB programs
+in LaTeX documents, based on the CWEB style by Joachim Schrod.
+It is documented with DOC and DOCSTRIP.
+
+To generate the style files, run LaTeX on webfiles.ins.
+
+To generate the user manual, run LaTeX on webfiles.dtx.
+
+To generate the complete documentation, comment out the
+"\OnlyDescription" command in the driver section of "webfiles.dtx" and
+run the "makedoc" script in this directory, or something equivalent.
+
+If you want to use the webfiles package with spidery webs, see the
+instructions in ./spider/README.
+
+december 1997, Mark Potse
+
+ Medical Physics Department
+ Academic Medical Center
+ Meibergdreef 15
+ 1105 AZ Amsterdam
+ The Netherlands
+
+ M.Potse@amc.uva.nl
+
+$Id: README,v 1.3 1999/12/21 10:20:37 potse Exp $ \ No newline at end of file
diff --git a/web/webfiles/cweave-f-spec.tex b/web/webfiles/cweave-f-spec.tex
new file mode 100644
index 0000000000..c9063e5585
--- /dev/null
+++ b/web/webfiles/cweave-f-spec.tex
@@ -0,0 +1,273 @@
+\iffalse
+% specification of CWEAVE/TeX interface for use in the documentation
+% of the cwebfiles style option
+% =========
+%
+% Based on cweave-spec.tex by Joachim Schrod.
+% [LaTeX]
+\fi
+
+ \chap The interface between \cweave{} and \TeX{}.
+ \label{sec:cweave-spec}
+
+
+
+Here we present all tags output by \cweave{}\footnote{This information
+ refers to \cweb{} 3.0.}
+in an ordered fashion. First we look at those
+tags which are part of the `protected interface,' ie, they are
+visible to a \cweb{} user, but he must not use them. Then we consider
+the private tags, some are used in the documentation part, others
+are needed to typeset program code, and there are a few tags for
+typesetting special characters in strings.
+
+
+\sect Some tags output by \cweave{} are part of the protected
+interface even though they are not prefixed by |cweb|. We'll present
+them in the order they'll arrive in the document instance.
+
+The following table specifies in the second column if this tag takes
+arguments. If the entry is non-empty, it's either a number listing
+just how many arguments are expected; then usual argument passing is
+used. Or it displays the context required.
+ %
+\begin{cseqtab}
+|\ATL| & \verb*|#1 #2 | & \cweb{} operator: |@l|
+ && (how to output non-ASCII chars in \ctangle{})
+ && \arg1 hex code of mapped character
+ && \arg2 string output by \ctangle{}
+|\M| & 1 & \cweb{} structure tag: start of a section
+ && \arg1 section number
+|\N| & |#1#2#3.| & \cweb{} structure tag: start of a section group
+ && \arg1 group depth, $0 \le |#1|$
+ && \arg2 section number
+ && \arg3 section group name
+|\PB| & 1 & restricted program mode material
+ && \arg1 program code
+|\Y| & & between major pieces of a program part
+|\B| & & start program material
+|\fi| & & \cweb{} structure tag: end of a section
+|\9| & 1 & index entry, user defined layout
+ && \arg1 text of index entry
+\end{cseqtab}
+
+|\ATL| does only appear in front of the very first section. The
+section number is an explicit \TeX{} number which might be followed
+by a `changed flag' (see section~\ref{sec:text-tag.priv}). Note the
+usage of |\fi|, ie, each section must open an according |\if|. |\PB|
+might appear within its own argument (created by restricted program
+mode material in a refinement name within restricted program mode).
+
+|\9| deserves a further explanation: It is expected, though not
+defined, that it expands to an empty token list. The parameter will
+be a sort key, actually; the real key to be typeset will appear
+afterwards. So a \cweb{} user might index \TeX{} as
+`|@:TeX}{\TeX@>|', the index will feature it in the ``T''~section,
+not in the ``|\|''~section.
+
+With the exception of |\PB| the tags above will not appear in math mode.
+
+
+\sect The following tags might appear to be public ones, but they
+are, in fact, never used. That's because they will be placed after
+the |\fi| which terminates the last section.
+The tags are given with their respective meaning in the Plain version:
+ %
+\begin{cseqtab}
+|\ch| & |#1.| & Note which sections are changed
+ && \arg1 list of section numbers, like in |\U| and such.
+|\inx| & & Create index
+|\fin| & & Create the table of refinement names
+|\con| & & Create the table of contents
+|\vfill\end| & & output if index and all lists were suppressed
+\end{cseqtab}
+
+
+
+\sect \label{sec:text-tag.priv}
+ Some tags appear only in special circumstances and may therefore be
+considered as private tags. The largest part of them concern the tagging of
+program code, we'll have a look at them later. First we present the
+tags used in other areas.
+
+Lists of section numbers occurs on several places: At the section
+start (where the list has actually only one element), within
+refinement names, in the identifier index, and for cross reference
+purposes. Cross references can be made at the end of a section, and
+in the refinement name list at the very end. Everywhere where a
+section number can occur it can be followed by a tag which shows that
+this section was changed by the changefile.
+ %
+\begin{cseqtab}
+|\*| & & tag after section number: this section is changed.
+\end{cseqtab}
+
+Within the identifier index we have also special tags. The identifiers
+are tagged like in the program mode, ie, with |\\| and |\&|. Remember
+that |\9|, listed above, appears also in the index.
+ %
+\begin{cseqtab}
+|\I| & \verb*|#1, | & start of an index entry
+ && \arg1 index entry
+|\[| & |#1]| & underlined section number in index
+ && \arg1 section number
+|\.| & 1 & |@.| index entry
+ && \arg1 index entry
+\end{cseqtab}
+
+In the list of refinement names the entries are marked similar to
+the index entries. But note that |\I| has no arg here.
+ %
+\begin{cseqtab}
+|\I| & & start of a new refinement name
+\end{cseqtab}
+
+
+\sect \label{sec:prog-tag}
+ OK, now we can have a look at the large amount of tags used
+for tagging program code. First, we have those which represent
+directly C or \C++ tokens.
+ %
+\begin{cseqtab}
+|\?| & & C operator: conditional expression
+|\AND| & & C operator: logical and
+|\CM| & & C operator: binary complement
+|\DC| & & \C++ operator: scope resolution
+|\E| & & C operator: equivalence
+ && and equivalence sign after refinement name on it's definition
+|\G| & & C operator: greater or equal
+|\GG| & & C operator: shift right
+|\I| & & C operator: not equal
+|\K| & & C operator: assignment
+|\LL| & & C operator: shift left
+|\MG| & & C operator: pointer to struct component
+|\MGA| & & \C++ operator: pointer to pointer to member
+|\MM| & & C operator: decrement
+|\MOD| & & C operator: modulo (actually, remainder)
+|\NULL| & & `quoted' identifier
+|\OR| & & C operator: binary or
+|\PA| & & \C++ operator: pointer to member
+|\PP| & & C operator: increment
+|\R| & & C operator: logical negation
+|\this| & & `quoted' identifier
+|\TeX| & & `customized' identifier
+|\V| & & C operator: logical or
+|\W| & & C operator: logical and
+|\XOR| & & C operator: binary exclusive or
+|\Z| & & C operator: less or equal
+\end{cseqtab}
+
+\def\vbar{\char"7C}
+Other tokens have variable parts, passed as arguments.
+ %
+\begin{cseqtab}
+|\.| & 1 & C string
+ && \arg1 string
+|\)| & & discretionary break between string parts
+|\&| & 1 & reserved identifier
+ && \arg1 identifier
+|\\| & 1 & ``normal'' identifier with more than one chars
+ && \arg1 identifier
+|\|{\tt\vbar} & 1 & ``normal'' identifier with one char
+ && \arg1 character
+|\C| & 1 & C comment
+ && \arg1 comment text
+|\MRL| & 1 & C operator: combined binary operators
+ && \arg1 operators, |\K| must print as `$=$'
+|\SHC| & 1 & \C++ comment
+ && \arg1 comment text
+|\T| & 1 & numeric constants
+ && \arg1 constant
+|\X| & |#1: #2\X| & refinement name
+ && \arg1 section number
+ && \arg2 refinement name
+\end{cseqtab}
+ %
+The refinement name (second argument of |\X|) may be a file name
+tagged by `|\.|'. Then the name must be set like a C~string.
+
+\cweb{} itself introduces its own operators:
+ %
+\begin{cseqtab}
+|\ATH| & & |@h| (place the preprocessor definitions here)
+|\D| & & |@d| (define macro)
+|\F| & & |@f| (format identifier like another one)
+|\J| & & |@&| (join)
+|\vb| & 1 & |@=| (pass arg verbatim by \ctangle{})
+ && \arg1 string
+\end{cseqtab}
+
+And we have some tags used for cross referencing. Section
+cross-referencing (actually, for program parts) is started with some
+tag, then follows a list of section numbers.
+ %
+\begingroup
+ \hfuzz=22pt
+\begin{cseqtab}
+|\A| & & one add-on definition (``See also section'')
+|\As| & & more than one add-on definition (``See also sections'')
+|\ET| & & separator between the last two numbers if there are only two
+|\ETs| & & separator between the last two numbers if there are more than two
+|\Q| & & the section where it is cited (``This code is cited in section'')
+|\Qs| & & more than one section where it is cited (``This code is cited in section'')
+|\U| & & used in one section (``This code is used in section'')
+|\Us| & & used in more than one section (``This code is used in sections'')
+\end{cseqtab}
+\endgroup
+
+Program code must be indented according to its structure. Each
+``larger'' statement is typeset as one paragraph, usually only one
+line long. The basic indentation of the next statement may be
+incremented and decremented in given units. If a statement has to be
+broken in more than one line nevertheless, a hanging indentation is
+added to the basic indentation for the subsequent lines. One can mark
+an `optional' statement start, ie, some kind of optional paragraph
+start. If a line break must be inserted it should be inserted here and
+no hanging indentation should be added to the basic indentation.
+ %
+\begin{cseqtab}
+|\1| & & future stmts indented one more unit
+|\2| & & future stmts indented one less unit
+|\3| & 1 & optional line break within a statement
+ && \arg1 digit, penalty for line break
+|\4| & & backspace one indentation unit
+|\5| & & optional line break or small space (between run-in statements)
+|\6| & & line break
+|\7| & & line break and additional vertical space
+|\8| & & line is a preprocessor directive (must be issued at start of line)
+\end{cseqtab}
+
+
+\sect Some args are designated as strings above. Within these args the
+following tags are used to represent special characters:
+ %
+\begin{cseqtab}
+\verb*|\ | & & space
+|\&| & & ampersand
+|\\| & & backslash
+|\^| & & hat
+|\_| & & underscore
+|\{| & & left brace
+|\}| & & right brace
+|\~| & & tilde
+\end{cseqtab}
+
+
+\sect Last, we have tags which are used in their ``standard''
+\LaTeX{} meaning. We don't have much work with them:
+ %
+\begin{cseqtab}
+|\#| & & hash mark in program or in string
+|\$| & & dollar
+|\%| & & percent
+|\{| & & block start (is set in math mode)
+|\}| & & block end (is set in math mode)
+|\,| & & thin space (like the \LaTeX{} default)
+|\langle| & & left delimiter in include directives, or in templates
+|\le| & & C operator: less or equal
+|\ldots| & & Function protoypes: Variable number of arguments
+|\rangle| & & right delimiter in include directives, or in templates
+\end{cseqtab}
+
+
+
diff --git a/web/webfiles/cweb-fsa.latex b/web/webfiles/cweb-fsa.latex
new file mode 100644
index 0000000000..f7cf14900a
--- /dev/null
+++ b/web/webfiles/cweb-fsa.latex
@@ -0,0 +1,61 @@
+\setlength{\unitlength}{0.012500in}%
+%
+\ifx \SetFigFont\undefined
+ \begingroup\makeatletter
+ \def\x#1#2#3#4#5#6#7\relax{\def\x{#1#2#3#4#5#6}}%
+ \expandafter\x\fmtname xxxxxx\relax \def\y{splain}%
+ \ifx\x\y % LaTeX or SliTeX?
+ \gdef\SetFigFont#1#2#3{%
+ \ifnum #1<17\tiny\else \ifnum #1<20\small\else
+ \ifnum #1<24\normalsize\else \ifnum #1<29\large\else
+ \ifnum #1<34\Large\else \ifnum #1<41\LARGE\else
+ \huge\fi\fi\fi\fi\fi\fi
+ \csname #3\endcsname}%
+ \else
+ \gdef\SetFigFont#1#2#3{\begingroup
+ \count@#1\relax \ifnum 25<\count@\count@25\fi
+ \def\x{\endgroup\@setsize\SetFigFont{#2pt}}%
+ \expandafter\x
+ \csname \romannumeral\the\count@ pt\expandafter\endcsname
+ \csname @\romannumeral\the\count@ pt\endcsname
+ \csname #3\endcsname}%
+ \fi
+ \endgroup
+\fi
+\begin{picture}(262,171)(37,651)
+\put( 84,735){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}Documentation}}}
+\put( 84,672){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}Restricted}}}
+\put( 84,659){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}Program}}}
+\thinlines
+\put( 84,669){\oval(94,36)}
+\put(165,807){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}(CR) Cross}}}
+\put(165,791){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}Reference}}}
+\put(165,804){\oval(94,36)}
+\put(252,669){\oval(94,36)}
+\put(252,665){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}\TeX}}}
+\put(252,739){\oval(94,36)}
+\put(252,735){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{}Program}}}
+\put(258,696){\makebox(0,0)[lb]{\smash{\SetFigFont{10}{12.0}{tt}\\SHC}}}
+\put(258,707){\makebox(0,0)[lb]{\smash{\SetFigFont{10}{12.0}{tt}\\C \\X}}}
+\put(224,782){\makebox(0,0)[lb]{\smash{\SetFigFont{10}{12.0}{tt}\\A \\Q}}}
+\put(236,770){\makebox(0,0)[lb]{\smash{\SetFigFont{10}{12.0}{tt}\\U}}}
+\put(255,720){\vector( 0,-1){ 33}}
+\put( 84,739){\oval(94,36)}
+\put(246,756){\vector(-1, 1){ 37}}
+\put(168,651){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{tt}\\X}}}
+\put(120,798){\vector(-3,-4){ 30}}
+\put(102,756){\vector( 3, 4){ 24}}
+\put(132,665){\vector( 1, 0){ 72}}
+\put(204,675){\vector(-1, 0){ 72}}
+\put( 90,687){\vector( 0, 1){ 33}}
+\put(132,744){\vector( 1, 0){ 72}}
+\put(204,734){\vector(-1, 0){ 72}}
+\put( 75,720){\vector( 0,-1){ 33}}
+\put(240,687){\vector( 0, 1){ 33}}
+\put( 73,703){\makebox(0,0)[rb]{\smash{\SetFigFont{10}{12.0}{tt}\\PB}}}
+\put(168,679){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{tt}\\PB}}}
+\put(167,747){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{tt}\\B}}}
+\put(167,722){\makebox(0,0)[b]{\smash{\SetFigFont{10}{12.0}{tt}\\M \\N}}}
+\put(102,779){\makebox(0,0)[rb]{\smash{\SetFigFont{10}{12.0}{tt}\\M \\N}}}
+\put(114,763){\makebox(0,0)[lb]{\smash{\SetFigFont{10}{12.0}{tt}\\ch}}}
+\end{picture}
diff --git a/web/webfiles/mtest.tex b/web/webfiles/mtest.tex
new file mode 100644
index 0000000000..94e51e9a2a
--- /dev/null
+++ b/web/webfiles/mtest.tex
@@ -0,0 +1,372 @@
+\input mweb.tex
+
+\def\title{Een testprogramma voor MWEB (Matlab Web)}
+\def\xwebContentsTop{\bfseries
+ \hrule\par\medskip
+ \centerline{\Large\title}
+ \vspace{2cm}
+ \centerline{\large Mark Potse}
+ \vspace{2cm}} % this material will start the table of contents page
+
+\def\Nchannels{N_{{\rm channels}}}
+
+\par\medskip\hrule
+
+
+\N1. Test. Deze file dient voor het testen van {\tt MWEB} (Matlab Web).
+Het bevat geen zinvol programma, maar alleen veel verschillende
+matlab-structuren voor het
+testen van de parser van {\tt mweave}.
+
+% test the rebinder
+\gdef\1{This is the replacement text of \string\1}
+
+Mark Potse
+
+e-mail: potse@amc.uva.nl
+
+\Y\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\P\F\\{maptype} \\{int}
+\par
+\Y\P$\|{x}=[\1\O{0}\ \O{0}\ \O{2}\ \pi,\;$\39$\O{2}{*}\pi,\;$\39$\O{5},\;$\39$%
+\O{4.5}\ \O{20}\ \O{9243857}\ \infty]\2;\;$\6
+$\|{a}=\O{1};\;$\6
+$\|{b}=\O{2}$\6
+$\|{c}=\pi/\O{4};\;$\6
+$\\{bs\_ColourOpt}=\O{1}$\Y\par
+\fi
+
+\N2. 2 if-elseif-else-end constructions. In the title of a ``starred
+section'' program text may not be used, but in the documentation it
+may: \CD{}\PB{$\&{if}\ $ $($ $\|{a}$ $=$ $\O{2}$ $)$}\DC{}, \CD{}\PB{$%
+\&{elseif}\ $}\DC{}, \CD{}\PB{$\&{else}$}\DC{} and \CD{}\PB{$\&{end}$}\DC{}.
+
+inserted \string\1 here: \1
+
+\Y\P$\&{if}\ (\1\|{a}\I\|{b})\2$\1\6
+$\|{a}=\|{b};\;$\2\6
+$\&{end};\;$\7
+$\&{if}\ (\1\|{a}\I\|{b})\2$\1\6
+\X12:adjust baseline\X\relax\2\6
+$\&{end};\;$\7
+$\&{if}\ (\1\|{a}\S\|{b})\2$\1\6
+$\|{a}=\\{some\_lousy\_variable\_with\_an\_ExtraordinaryLongName}$\6
+$\\{text}(\1\O{2},\;$\39$\O{3},\;$\39$\.{'blah\ bla\ blah'})\2;\;$\2\6
+$\&{elseif}\ $\1$(\1\|{a}<\|{b})\2$\6
+$\\{text}(\1\O{5},\;$\39$\O{3},\;$\39$\.{'blah\ bla\ bla'})\2$\2\6
+$\&{elseif}\ $\1$\|{x}$\6
+$\&{if}\ \|{x}\S\O{1}$\1\6
+$\|{y}=\|{x};\;$\2\6
+$\&{elseif}\ $\1$(\1\|{x}\S\O{2})\2$\6
+$\|{y}=\|{x}+\O{1};\;$\2\6
+$\&{else}$\1\6
+$\|{y}=\|{x}+\O{3};\;$\2\6
+$\&{end};\;$\2\6
+$\&{else}$\1\6
+$\\{text}(\1\O{2},\;$\39$\O{3},\;$\39$\.{'blah\ bla\ blah'})\2;\;$\6
+$\\{text}(\1\O{10},\;$\39$\O{7},\;$\39$\.{'bla\ blah\ blah'})\2;\;$\2\6
+$\&{end};\;$\Y\par
+\fi
+
+\M3. An \CD{}\PB{$\&{if}\ $}\DC{} without braces:
+\Y\P$\&{if}\ \|{a}\I\|{b}$\1\6
+$\|{a}=\|{b};\;$\2\6
+$\&{end};\;$\6
+\X4:a \PB{$\&{for}\ $} loop\X\relax\6
+$\|{c}=\O{2}/\O{3};\;$\Y\par
+\fi
+
+\N4. 2 for. Another example.
+\Y\P\4\X4:a \PB{$\&{for}\ $} loop\X${}\S{}$\7
+$\&{for}\ \|{i}=\O{1}\mathbin:\O{10}$\5
+\C{ with a comment }\1\6
+$\&{for}\ \|{j}=\O{1}\mathbin:\O{20}$\1\6
+$\\{vect}(\1\|{i})\2=\\{matrix}(\1\O{2}{*}\|{i}+\O{1},\;$\39$\|{j})\2;\;$\2\6
+$\&{end};\;$\2\6
+$\&{end};\;$\Y\par
+\A5.
+\U3.\fi
+
+\M5. vervolg.
+\Y\P\4\X4:a \PB{$\&{for}\ $} loop\X${}\mathrel+\S{}$\7
+$\&{for}\ \|{i}=[\1\O{1}\mathbin:\O{10}]\2$\1\6
+$\\{vect}(\1\|{i})\2=\O{2}{*}\|{i}+\O{1};\;$\2\6
+$\&{end};\;$\Y\par
+\fi
+
+\N6. bs\_map.
+Het volgende is overgenomen uit {\tt bs\_map.m}
+
+\fi
+
+\M7. For declarations like \CD{}\PB{$\&{clear}$}\DC{}, \CD{}\PB{$\&{global}$}%
+\DC{} etc.:
+\Y\P$\&{global}$\1\ $\\{PosInterval}\ \\{NegInterval}\ \\{bso\_Fine}\ \ldots$\6
+$\\{bso\_Points}\ \\{bs\_BeginSampleNr}\ \\{bs\_EndSampleNr}\ \ldots$\6
+$\\{bso\_MapAxSize}\ \\{bso\_Type}\ \\{bso\_Shoulders}\ \ldots$\6
+$\\{bso\_PlusMinSize}\ \\{bso\_Grey}\ \\{bso\_Nlevels}$ $\ldots$\6
+\X8:parameter handling\X\6
+\X12:adjust baseline\X\6
+\X13:make a figure window and axes\X\6
+\X14:patient information\X\6
+\X15:Make the map\X\6
+\X18:print map info\X\6
+\X19:create menu's\X\Y\par
+\fi
+
+\M8. String handling:
+\Y\P\4\X8:parameter handling\X${}\S{}$\6
+$\\{bso\_ml}(\1\.{'Display'},\;$\39$\.{'no'})\2;\;$\6
+$\\{bso\_map}(\1\.{'Display'},\;$\39$\.{'no'})\2;\;$\Y\par
+\A9.
+\U7.\fi
+
+\M9.
+\Y\P\4\X8:parameter handling\X${}\mathrel+\S{}$\6
+$\&{if}\ (\1\\{bs\_ColourOpt}\W(\1\\{bso\_Type}\S\.{'p'}\V\\{bso\_Type}\S%
+\.{'c'})\2)\2$\1\6
+$\\{textcolour}=\.{'y'};\;$\2\6
+$\&{else}$\1\6
+$\\{textcolour}=\.{'k'};\;$\2\6
+$\&{end};\;$\Y\par
+\fi
+
+\M10. In Matlab, the quote also serves as a transpose-operator:
+\Y\P$\|{a}=\\{ones}(\1\O{3},\;$\39$\O{3})\2;\;$\6
+$\|{c}=\|{b}^{\prime}$\6
+$\|{c}=\O{4}^{\prime};\;$\6
+$\|{c}=(\1\|{a}+\|{b})\2^{\prime};\;$\6
+$\|{c}$ $=$ $(\1\|{a}+\O{4}i)\2$ $.$ $^{\prime}$ \Y\par
+\fi
+
+\M11. Quotes in a string.
+\Y\P$\\{text}(\1\O{1},\;$\39$\O{2},\;$\39$\.{'He\ said:\ ''foo!'';\ ''''\ '})%
+\2$\Y\par
+\fi
+
+\N12. 2 function calls.
+
+\Y\P\4\D$\Nchannels\S$\5
+$\O{64}$ \par
+\P\F\\{Nchannels} \\{TeX}
+\par
+\Y\P\4\X12:adjust baseline\X${}\S{}$\6
+$\\{bs\_Reg}=\\{ones}(\1\Nchannels,\;$\39$\O{500})\2;\;$\6
+$\\{bs\_rejected}=\\{zeros}(\1\Nchannels)\2;\;$\6
+$\\{bs\_BaseLineAlgorithm}=\O{1};\;$\6
+$\\{bs\_BaseLn1}=\O{200};\;$\6
+$\\{bs\_BaseLn2}=\O{400};\;$\6
+$\\{bs\_BaseLineWidth}=\O{10};\;$\7
+$\\{bs\_BA\_Reg}=\\{bs\_adj}(\1\ldots$\6
+$\\{bs\_Reg},\;$\39$\\{bs\_rejected},\;$\39$\\{bs\_BaseLineAlgorithm},\;$\39$%
+\ldots$\6
+$\\{bs\_BaseLn1},\;$\39$\\{bs\_BaseLn2},\;$\39$\\{bs\_BaseLineWidth})\2;\;$\Y%
+\par
+\Us2\ET7.\fi
+
+\M13.
+\Y\P\4\X13:make a figure window and axes\X${}\S{}$\7
+$\\{bs\_map\_winH}=\\{a4paper}(\1\\{bs\_FigScale})\2;\;$\6
+$\\{bs\_map\_AX1}=\\{axes}(\1\ldots$\6
+$\.{'Units'},\;$\39$\.{'normalized'},\;$\39$\ldots$\6
+$\.{'Position'},\;$\39$[\1\O{0}\ \O{0}\ \O{1}\ \O{1}]\2,\;$\39$\ldots$\6
+$\.{'Visible'},\;$\39$\.{'off'},\;$\39$\ldots$\6
+$\.{'XLim'},\;$\39$[\1\O{0},\;$\39$\O{21}]\2,\;$\39$\ldots$\6
+$\.{'YLim'},\;$\39$[\1\O{0}\ \O{29.7}]\2,\;$\39$\ldots$\6
+$\.{'Clipping'},\;$\39$\.{'off'})\2;\;$\Y\par
+\U7.\fi
+
+\M14.
+\Y\P\4\X14:patient information\X${}\S{}$\6
+$\&{if}\ (\1\\{length}(\1\\{bs\_infostring})\2\G\O{16})\2$\1\6
+$\\{text}(\1\O{3},\;$\39$\O{28.5},\;$\39$\\{bs\_infostring}(\1\O{10}\mathbin:%
+\O{16})\2,\;$\39$\.{'Color'},\;$\39$\\{textcolour})\2;\;$\2\6
+$\&{else}$\1\6
+$\\{text}(\1\O{3},\;$\39$\O{28.5},\;$\39$\.{'?'},\;$\39$\.{'Color'},\;$\39$%
+\\{textcolour})\2;\;$\2\6
+$\&{end};\;$\6
+$\\{text}(\1\O{7},\;$\39$\O{28.5},\;$\39$\\{bs\_filename},\;$\39$\.{'Color'},%
+\;$\39$\\{textcolour})\2;\;$\Y\par
+\U7.\fi
+
+\M15.
+\Y\P\4\X15:Make the map\X${}\S{}$\7
+$\\{vec}=\\{zeros}(\1\O{64},\;$\39$\O{1})\2;\;$\6
+$\\{vec}=\\{bs\_BA\_Reg}(\1\O{1}\mathbin:\O{64},\;$\39$\\{bs\_CurSampleNr})\2;%
+\;$\6
+$\\{bs\_Map}=\\{getmap}(\1\\{vec},\;$\39$\\{bs\_rejected})\2;\;$\6
+\X16:define axes\X\6
+\X17:call \PB{$\\{bsm}$}\X\Y\par
+\U7.\fi
+
+\M16.
+\Y\P\4\X16:define axes\X${}\S{}$\6
+$\\{bs\_map\_AX2}=\\{axes}(\1\ldots$\6
+$\.{'Units'},\;$\39$\.{'normalized'},\;$\39$\ldots$\6
+$\.{'Position'},\;$\39$[\1\O{4}/\O{21},\;$\39$\O{12}/\O{29.7},\;$\39$\\{bso%
+\_MapAxSize}/\O{21},\;$\39$\\{bso\_MapAxSize}/\O{29.7}]\2,\;$\39$\ldots$\6
+$\.{'Clipping'},\;$\39$\.{'off'})\2;\;$\Y\par
+\Us15, 17\ETs18.\fi
+
+\M17. Genest inspringen:
+\Y\P\4\X17:call \PB{$\\{bsm}$}\X${}\S{}$\7
+\X16:define axes\X\6
+$\\{bsm}(\1\\{bs\_Map},\;$\39$\ldots$\6
+$\.{'Type'},\;$\39$\\{bso\_Type},\;$\39$\ldots$\6
+$\.{'Shoulders'},\;$\39$\\{bso\_Shoulders},\;$\39$\ldots$\6
+$\.{'PlusMinSize'},\;$\39$\\{bso\_PlusMinSize},\;$\39$\ldots$\6
+$\.{'Grey'},\;$\39$\\{bso\_Grey},\;$\39$\ldots$\6
+$\.{'Fine'},\;$\39$\\{bso\_Fine},\;$\39$\ldots$\6
+$\.{'Nlevels'},\;$\39$\\{bso\_Nlevels},\;$\39$\ldots$\6
+$\.{'Leadnr'},\;$\39$\\{bso\_Leadnr},\;$\39$\ldots$\6
+$\.{'Lead'},\;$\39$(\1\\{bs\_BA\_Reg}(\1\\{abs}(\1\\{bso\_Leadnr})\2,\;$\39$%
+\\{bso\_Lead\_Begin}\mathbin:\\{bso\_Lead\_End})\2)\2,\;$\39$\ldots$\6
+$\.{'Points'},\;$\39$[\1\\{bso\_Points}(\1\O{1})\2-\\{bso\_Lead\_Begin},\;$\39$%
+\ldots$\6
+$\\{bso\_Points}(\1\O{2})\2-\\{bso\_Lead\_Begin}]\2)\2;\;$\7
+$\\{drawnow}$\5
+\C{ Deze drawnow zorgt ervoor dat als er in het voorgaande een }\6
+\C{ sequence lost raakt het script daar niet op blijft hangen. }\Y\par
+\U15.\fi
+
+\M18.
+\Y\P\4\X18:print map info\X${}\S{}$\7
+\X16:define axes\X\6
+$\\{text}(\1\O{3},\;$\39$\O{6},\;$\39$[\1\.{'pos.\ contour\ interval:\ '},\;$%
+\39$\\{num2str}(\1\\{PosInterval})\2]\2,\;$\39$\ldots$\6
+$\.{'Color'},\;$\39$\\{textcolour})\2;\;$\6
+$\\{text}(\1\O{3},\;$\39$\O{5},\;$\39$[\1\.{'neg.\ contour\ interval:\ '},\;$%
+\39$\\{num2str}(\1\\{NegInterval})\2]\2,\;$\39$\ldots$\6
+$\.{'Color'},\;$\39$\\{textcolour})\2;\;$\6
+$\\{text}(\1\O{3},\;$\39$\O{4},\;$\39$[\1\.{'Sample:\ '},\;$\39$\\{num2str}(\1%
+\\{bs\_CurSampleNr})\2]\2,\;$\39$\ldots$\6
+$\.{'Color'},\;$\39$\\{textcolour})\2;\;$\6
+$\\{text}(\1\O{3},\;$\39$\O{3},\;$\39$[\1\.{'Baseline:\ '},\;$\39$\ldots$\6
+$\\{num2str}(\1\\{bs\_BaseLn1})\2,\;$\39$\.{'\ \ \ \ '},\;$\39$\ldots$\6
+$\\{num2str}(\1\\{bs\_BaseLn2})\2]\2,\;$\39$\.{'Color'},\;$\39$\\{textcolour})%
+\2;\;$\Y\par
+\U7.\fi
+
+\M19. De extra ruimte wordt gegenereerd door dubbele newlines, die in MWEB
+equivalent zijn met \verb"@#".
+\Y\P\4\X19:create menu's\X${}\S{}$\7
+$\\{bs\_bsmWin\_PrintMenu}=\\{uimenu}(\1\.{'Label'},\;$\39$\.{'Print'},\;$\39$%
+\.{'Separator'},\;$\39$\.{'on'})\2;\;$\7
+$\\{bs\_bsmWin\_PrintSubMenu}=\\{uimenu}(\1\\{bs\_bsmWin\_PrintMenu},\;$\39$%
+\ldots$\6
+$\.{'Label'},\;$\39$\.{'\ '},\;$\39$\ldots$\6
+$\.{'Separator'},\;$\39$\.{'on'},\;$\39$\ldots$\6
+$\.{'Callback'},\;$\39$[\1\.{'print\ -dps\ -f'},\;$\39$\\{num2str}(\1\\{gcf})%
+\2]\2)\2;\;$\Y\par
+\U7.\fi
+
+\M20. functiedefinities:
+
+\Y\P$\&{function}\ $\1$\\{blah}(\1\\{arg1},\;\\{arg2})\2$\7
+$\|{a}$ $=$ $\&{function}\ $\1$\\{boeh}(\1\\{arg1})\2$\7
+$\&{for}\ \|{i}=\O{1}\mathbin:\O{3}$\1\6
+$\|{a}=\|{b}+\|{c}(\1\|{i})\2$\2 $\&{end}$\6
+$\\{bs\_map\_AX2}=\\{axes}(\1\ldots$\6
+$\.{'Units'},\;$\39$\.{'normalized'},\;$\39$\ldots$\6
+$\.{'Position'},\;$\39$[\1\O{4}/\O{21},\;$\39$\O{12}/\O{29.7},\;$\39$\\{bso%
+\_MapAxSize}/\O{21},\;$\39$\\{bso\_MapAxSize}/\O{29.7}]\2,\;$\39$\ldots$\6
+$\.{'Clipping'},\;$\39$\.{'off'})\2;\;$\par
+\fi
+
+
+\inx
+\:\\{abs}, 17.
+\:\\{arg1}, 20.
+\:\\{arg2}, 20.
+\:\\{axes}, 13, 16, 20.
+\:\\{a4paper}, 13.
+\:\\{blah}, 20.
+\:\\{boeh}, 20.
+\:\\{bs\_adj}, 12.
+\:\\{bs\_BA\_Reg}, 12, 15, 17.
+\:\\{bs\_BaseLineAlgorithm}, 12.
+\:\\{bs\_BaseLineWidth}, 12.
+\:\\{bs\_BaseLn1}, 12, 18.
+\:\\{bs\_BaseLn2}, 12, 18.
+\:\\{bs\_BeginSampleNr}, \[7].
+\:\\{bs\_bsmWin\_PrintMenu}, 19.
+\:\\{bs\_bsmWin\_PrintSubMenu}, 19.
+\:\\{bs\_ColourOpt}, 1, 9.
+\:\\{bs\_CurSampleNr}, 15, 18.
+\:\\{bs\_EndSampleNr}, \[7].
+\:\\{bs\_FigScale}, 13.
+\:\\{bs\_filename}, 14.
+\:\\{bs\_infostring}, 14.
+\:\\{bs\_Map}, 15, 17.
+\:\\{bs\_map\_AX1}, 13.
+\:\\{bs\_map\_AX2}, 16, 20.
+\:\\{bs\_map\_winH}, 13.
+\:\\{bs\_Reg}, 12.
+\:\\{bs\_rejected}, 12, 15.
+\:\\{bsm}, 17.
+\:\\{bso\_Fine}, \[7], 17.
+\:\\{bso\_Grey}, \[7], 17.
+\:\\{bso\_Lead\_Begin}, 17.
+\:\\{bso\_Lead\_End}, 17.
+\:\\{bso\_Leadnr}, 17.
+\:\\{bso\_map}, 8.
+\:\\{bso\_MapAxSize}, \[7], 16, 20.
+\:\\{bso\_ml}, 8.
+\:\\{bso\_Nlevels}, \[7], 17.
+\:\\{bso\_PlusMinSize}, \[7], 17.
+\:\\{bso\_Points}, \[7], 17.
+\:\\{bso\_Shoulders}, \[7], 17.
+\:\\{bso\_Type}, \[7], 9, 17.
+\:\\{drawnow}, 17.
+\:\\{gcf}, 19.
+\:\\{getmap}, 15.
+\:\\{int}, 1.
+\:\\{length}, 14.
+\:\\{maptype}, \[1].
+\:\\{matrix}, 4.
+\:$\Nchannels$, \[12].
+\:\\{NegInterval}, \[7], 18.
+\:\\{num2str}, 18, 19.
+\:\\{ones}, 10, 12.
+\:\\{PosInterval}, \[7], 18.
+\:\\{some\_lousy\_variable\_with\_an\_ExtraordinaryLongName}, 2.
+\:\\{TeX}, 12.
+\:\\{text}, 2, 11, 14, 18.
+\:\\{textcolour}, 9, 14, 18.
+\:\\{uimenu}, 19.
+\:\\{vec}, 15.
+\:\\{vect}, 4, 5.
+\:\\{zeros}, 12, 15.
+\fin
+\:\X15:Make the map\X
+\U7.
+\:\X4, 5:a \PB{$\&{for}\ $} loop\X
+\U3.
+\:\X12:adjust baseline\X
+\Us2\ET7.
+\:\X17:call \PB{$\\{bsm}$}\X
+\U15.
+\:\X19:create menu's\X
+\U7.
+\:\X16:define axes\X
+\Us15, 17\ETs18.
+\:\X13:make a figure window and axes\X
+\U7.
+\:\X8, 9:parameter handling\X
+\U7.
+\:\X14:patient information\X
+\U7.
+\:\X18:print map info\X
+\U7.
+\con
diff --git a/web/webfiles/mtest.web b/web/webfiles/mtest.web
new file mode 100644
index 0000000000..e8462520da
--- /dev/null
+++ b/web/webfiles/mtest.web
@@ -0,0 +1,274 @@
+
+\def\title{Een testprogramma voor MWEB (Matlab Web)}
+\def\xwebContentsTop{\bfseries
+ \hrule\par\medskip
+ \centerline{\Large\title}
+ \vspace{2cm}
+ \centerline{\large Mark Potse}
+ \vspace{2cm}} % this material will start the table of contents page
+
+\def\Nchannels{N_{{\rm channels}}}
+
+\par\medskip\hrule
+
+@* Test. Deze file dient voor het testen van {\tt MWEB} (Matlab Web).
+Het bevat geen zinvol programma, maar alleen veel verschillende
+matlab-structuren voor het
+testen van de parser van {\tt mweave}.
+
+% test the rebinder
+\gdef\1{This is the replacement text of \string\1}
+
+ Mark Potse
+
+ e-mail: potse@@amc.uva.nl
+
+@f maptype int
+@f maptype int
+@f maptype int
+@f maptype int
+@f maptype int
+@f maptype int
+@f maptype int
+
+@u
+
+x = [0 0 2 pi, 2*pi, 5, 4.5 20 9243857 inf];
+a = 1;
+b = 2
+c = pi/4;
+bs_ColourOpt = 1
+
+
+@*2 if-elseif-else-end constructions. In the title of a ``starred
+section'' program text may not be used, but in the documentation it
+may: |if (a=2)|, |elseif|, |else| and |end|.
+
+inserted \string\1 here: \1
+
+@u
+
+if (a ~= b)
+ a = b;
+end;
+
+if (a ~= b)
+ @< adjust baseline @> @;
+end ;
+
+if (a == b)
+ a = some_lousy_variable_with_an_ExtraordinaryLongName
+ text(2, 3, 'blah bla blah');
+elseif ( a< b)
+ text(5, 3, 'blah bla bla')
+elseif x
+ if x == 1
+ y = x;
+ elseif (x == 2)
+ y = x + 1;
+ else
+ y = x + 3;
+ end;
+else
+ text(2, 3, 'blah bla blah');
+ text(10, 7, 'bla blah blah');
+end;
+
+
+@ An |if| without braces:
+@u
+if a ~= b
+ a = b;
+end;
+@<a |for| loop@> @;
+c = 2/3;
+
+
+
+@*2 for. Another example.
+@<a |for| loop@>=
+
+for i = 1:10 % with a comment
+for j = 1:20
+ vect(i) = matrix(2*i+1,j);
+end;
+end;
+
+@ vervolg.
+@<a |for| loop@>=
+
+for i = [1:10]
+ vect(i) = 2*i+1;
+end;
+
+
+
+@* bs\_map.
+Het volgende is overgenomen uit {\tt bs\_map.m}
+
+@ For declarations like |clear|, |global| etc.:
+@u
+
+
+ global PosInterval NegInterval bso_Fine ...
+ bso_Points bs_BeginSampleNr bs_EndSampleNr ...
+ bso_MapAxSize bso_Type bso_Shoulders ...
+ bso_PlusMinSize bso_Grey bso_Nlevels ...
+
+@< parameter handling @>
+@< adjust baseline @>
+@< make a figure window and axes @>
+@< patient information @>
+@< Make the map @>
+@< print map info @>
+@< create menu's @>
+
+
+@ String handling:
+@< parameter handling @>=
+ bso_ml('Display','no');
+ bso_map('Display','no');
+
+@
+@< parameter handling @>=
+ if (bs_ColourOpt & (bso_Type=='p' | bso_Type=='c'))
+ textcolour = 'y';
+ else
+ textcolour = 'k';
+ end;
+
+@ In Matlab, the quote also serves as a transpose-operator:
+@u
+
+a = ones(3,3);
+c = b'
+c = 4'; c = (a+b)';
+c = (a + 4i).'
+
+@ Quotes in a string.
+@u
+
+text(1, 2, 'He said: ''foo!''; '''' ')
+
+@*2 function calls.
+
+@d Nchannels = 64
+@f Nchannels TeX
+
+@< adjust baseline @>=
+bs_Reg = ones(Nchannels,500);
+bs_rejected = zeros(Nchannels);
+bs_BaseLineAlgorithm = 1;
+bs_BaseLn1 = 200;
+bs_BaseLn2 = 400;
+bs_BaseLineWidth = 10;
+
+ bs_BA_Reg = bs_adj( ...
+ bs_Reg, bs_rejected, bs_BaseLineAlgorithm, ...
+ bs_BaseLn1, bs_BaseLn2, bs_BaseLineWidth);
+
+
+@
+@< make a figure window and axes @>=
+
+ bs_map_winH = a4paper(bs_FigScale);
+ bs_map_AX1 = axes( ...
+ 'Units','normalized', ...
+ 'Position',[0 0 1 1], ...
+ 'Visible','off', ...
+ 'XLim',[0, 21], ...
+ 'YLim',[0 29.7], ...
+ 'Clipping','off');
+
+
+@
+@< patient information @>=
+ if (length(bs_infostring) >= 16)
+ text(3, 28.5, bs_infostring(10:16), 'Color', textcolour);
+ else
+ text(3, 28.5, '?', 'Color', textcolour);
+ end;
+ text(7, 28.5, bs_filename, 'Color', textcolour);
+
+
+@
+@< Make the map @>=
+
+vec = zeros(64,1);
+vec = bs_BA_Reg(1:64,bs_CurSampleNr);
+bs_Map = getmap(vec,bs_rejected);
+@< define axes @>
+@< call |bsm| @>
+
+
+
+@
+@< define axes @>=
+ bs_map_AX2 = axes( ...
+ 'Units','normalized', ...
+ 'Position',[4/21, 12/29.7, bso_MapAxSize/21, bso_MapAxSize/29.7], ...
+ 'Clipping','off');
+
+
+@ Genest inspringen:
+@< call |bsm| @>=
+
+ @< define axes @>
+ bsm(bs_Map, ...
+ 'Type',bso_Type, ...
+ 'Shoulders',bso_Shoulders, ...
+ 'PlusMinSize',bso_PlusMinSize, ...
+ 'Grey',bso_Grey, ...
+ 'Fine',bso_Fine, ...
+ 'Nlevels',bso_Nlevels, ...
+ 'Leadnr',bso_Leadnr, ...
+ 'Lead',(bs_BA_Reg(abs(bso_Leadnr),bso_Lead_Begin:bso_Lead_End)), ...
+ 'Points',[bso_Points(1)-bso_Lead_Begin, ...
+ bso_Points(2)-bso_Lead_Begin]);
+
+
+ drawnow % Deze drawnow zorgt ervoor dat als er in het voorgaande een
+ % sequence lost raakt het script daar niet op blijft hangen.
+
+
+@
+@< print map info @>=
+
+ @< define axes @>
+ text (3, 6,['pos. contour interval: ', num2str(PosInterval)], ...
+ 'Color', textcolour);
+ text (3, 5,['neg. contour interval: ', num2str(NegInterval)], ...
+ 'Color', textcolour);
+ text (3, 4,['Sample: ', num2str(bs_CurSampleNr)], ...
+ 'Color', textcolour);
+ text (3, 3,['Baseline: ', ...
+ num2str(bs_BaseLn1), ' ', ...
+ num2str(bs_BaseLn2)], 'Color', textcolour);
+
+
+
+@ De extra ruimte wordt gegenereerd door dubbele newlines, die in MWEB
+equivalent zijn met \verb"@@#".
+@< create menu's @>=
+
+ bs_bsmWin_PrintMenu = uimenu('Label','Print','Separator','on');
+
+ bs_bsmWin_PrintSubMenu = uimenu(bs_bsmWin_PrintMenu, ...
+ 'Label',' ', ...
+ 'Separator', 'on', ...
+ 'Callback',[ 'print -dps -f', num2str(gcf)]);
+
+@ functiedefinities:
+
+@u
+function blah(arg1, arg2)
+
+a = function boeh(arg1)
+
+ for i = 1:3
+ a = b + c(i)
+ end
+ bs_map_AX2 = axes( ...
+ 'Units','normalized', ...
+ 'Position',[4/21, 12/29.7, bso_MapAxSize/21, bso_MapAxSize/29.7], ...
+ 'Clipping','off');
diff --git a/web/webfiles/spider/README b/web/webfiles/spider/README
new file mode 100644
index 0000000000..d312f486cb
--- /dev/null
+++ b/web/webfiles/spider/README
@@ -0,0 +1,44 @@
+
+Using webfiles with spidery webs
+================================
+
+Spider is a very nice tool that can generates a weave and a tangle
+program from a description of a language.
+
+Unfortunately, the control sequences that are written by spidery
+weaves are not completely compatible with those output by
+cweave. Therefore some extra macros are needed for the webfiles
+package to handle spidery webs. The file "webkernel.tex", which goes
+together with spider, must therefore be replaced with the version
+found in this directory. (or patched, if you made changes to it
+yourself)
+
+More unfortunately, some parts of the spidery weave output cannot be
+handled by webfiles at all, due to small inconsistencies in
+spider. This can only be fixed by recompiling these weave programs
+using the changefile "sp-webfiles.ch", found in this directory.
+
+Please note also, that the control sequences that are defined in the
+language specific files "*web.tex" ("ceeweb.tex" in case of ceeweb,
+etc.) must be usable with both TeX and LaTeX if you want them to work
+with both formatters. It is also recommended to use safe names for
+them. (In fact, it is always recommended to use safe names in macro
+packages, but in case of webs it has been common practice to use very
+short names like \B, \1, or \ET; that's why I mention it here.)
+
+MWEB, the web system I created for the Matlab language, is already
+equipped for the webfiles package; just take care not to use it with
+an incompatible "webkernel.tex".
+
+
+december 1997, Mark Potse
+
+ Medical Physics Department
+ Academic Medical Center
+ Meibergdreef 15
+ 1105 AZ Amsterdam
+ The Netherlands
+
+ M.Potse@amc.uva.nl
+
+$Id: README,v 1.2 1999/12/21 10:23:03 potse Exp $ \ No newline at end of file
diff --git a/web/webfiles/spider/sp-webfiles.ch b/web/webfiles/spider/sp-webfiles.ch
new file mode 100644
index 0000000000..007ee16596
--- /dev/null
+++ b/web/webfiles/spider/sp-webfiles.ch
@@ -0,0 +1,223 @@
+\def\title{SP\_webfiles.ch}
+\def\cee{\eightrm C}
+\def\leftarrow{ = }
+
+@* Introduction.
+
+ This is a
+ changefile to make Spidery \.{weave} somewhat more compatible with
+ \.{cweave} 3.1, at least to work with the webfiles style option.
+
+@* Embedded program texts.
+
+ This change makes embedded program texts be tagged with \.{\\PB}, in
+ documentation,
+ in comments and in module names. (In documentation state, embedded program
+ text is also tagged with \.{\\CD ... \\DC.)}.
+ The lines with ``/* CWEB3.1 */'' are copied from \.{cweave} version 3.1 .
+
+
+@x
+@ @<Copy comment, including embedded program text@>=
+ small_app(break_space); app_str("\\C{");
+@.\\cee@>
+ bal=copy_comment(1); next_control=vertical_bar;
+ while (bal>0) {
+ p=text_ptr; freeze_text; q=C_translate();
+ /* at this point we have |tok_ptr+6<=max_toks| */ /* spider */
+ small_app(tok_flag+p-tok_start); small_app(inner_tok_flag+q-tok_start);
+ if (next_control==vertical_bar) bal=copy_comment(bal);
+ else bal=0; /* an error has been reported */
+ }
+ small_app(force);
+ app_scrap(SP_ignore_scrap,no_math);
+ /* the full comment becomes a scrap */
+@y
+
+@ @<Copy comment, including embedded program text@>=
+ small_app(break_space); app_str("\\C{");
+@.\\cee@>
+ bal=copy_comment(1); next_control=vertical_bar;
+ while (bal>0) {
+ p=text_ptr;
+ freeze_text;
+ q=C_translate();
+ /* at this point we have |tok_ptr+6<=max_toks| */ /* spider */
+ small_app(tok_flag+p-tok_start);
+ app_str("\\PB{"); @.\\PB@> /* CWEB3.1 */
+ small_app(inner_tok_flag+q-tok_start);
+ app_tok('}'); /* CWEB3.1 */
+ if (next_control==vertical_bar) bal=copy_comment(bal);
+ else bal=0; /* an error has been reported */
+ }
+ small_app(force);
+ app_scrap(SP_ignore_scrap,no_math);
+ /* the full comment becomes a scrap */
+
+@z
+
+@x
+@u
+output_C() /* outputs the current token list */
+{
+ token_pointer save_tok_ptr;
+ text_pointer save_text_ptr;
+ sixteen_bits save_next_control; /* values to be restored */
+ text_pointer p; /* translation of the \cee\ text */
+ save_tok_ptr=tok_ptr; save_text_ptr=text_ptr;
+ save_next_control=next_control; next_control=vertical_bar; p=C_translate();
+ small_app(p-tok_start+inner_tok_flag);
+ make_output(); /* output the list */
+#ifdef STAT
+ if (text_ptr>max_text_ptr) max_text_ptr=text_ptr;
+ if (tok_ptr>max_tok_ptr) max_tok_ptr=tok_ptr;
+#endif STAT
+ text_ptr=save_text_ptr; tok_ptr=save_tok_ptr; /* forget the tokens */
+ next_control=save_next_control; /* restore |next_control| to original state */
+}
+@y
+
+@u
+output_C() /* outputs the current token list */
+{
+ token_pointer save_tok_ptr;
+ text_pointer save_text_ptr;
+ sixteen_bits save_next_control; /* values to be restored */
+ text_pointer p; /* translation of the \cee\ text */
+ save_tok_ptr=tok_ptr;
+ save_text_ptr=text_ptr;
+ save_next_control=next_control;
+ next_control=vertical_bar;
+ p=C_translate();
+ small_app(inner_tok_flag + p-tok_start);
+ out_str("\\PB{"); @.\\PB@> /* CWEB3.1 */
+ make_output(); /* output the list */
+ out('}'); /* CWEB3.1 */
+#ifdef STAT
+ if (text_ptr>max_text_ptr) max_text_ptr=text_ptr;
+ if (tok_ptr>max_tok_ptr) max_tok_ptr=tok_ptr;
+#endif STAT
+ text_ptr=save_text_ptr; tok_ptr=save_tok_ptr; /* forget the tokens */
+ next_control=save_next_control; /* restore |next_control| to original state */
+}
+
+@z
+
+@* Multilingual Xref information.
+
+ Here, in the original Spider, the
+ footnote procedure outputs the word ``section'' after \.{\\U}, and
+ in \.{webkernel} \.{\\U} is defined as ``This code is used in''.
+ This makes output in other languages impossible, so we leave out the
+ \item |out_str(" section");|
+
+ \medskip\noindent
+ and append ``section'' to the definition of \.{\\U} in \.{webkernel.tex}.
+ @.webkernel.tex@>
+
+ The \.{`s'} that is output if the code is multiply used or defined will now
+ be appended after `\.{\\U}' or `\.{\\A}', respectively, making `\.{\\Us}' or
+ `\.{\\As}' as in \.{CWEB} 3.0.
+ In \.{webkernel.tex} \.{\\Us} and \.{\\As} will be defined to be the plural
+ equivalents of \.{\\U} and \.{\\A}, respectively.
+
+
+@x
+@ The |footnote| procedure gives cross-reference information about
+multiply defined module names (if the |flag| parameter is |def_flag|), or about
+the uses of a module name (if the |flag| parameter is zero). It assumes that
+|cur_xref| points to the first cross-reference entry of interest, and it
+leaves |cur_xref| pointing to the first element not printed. Typical outputs:
+`\.{\\A\ section 101.}'; `\.{\\U\ sections 370 and 1009.}';
+`\.{\\A\ sections 8, 27\\*, and 64.}'.
+
+@u footnote(flag) /* outputs module cross-references */
+sixteen_bits flag;
+{
+ xref_pointer q; /* cross-reference pointer variable */
+ if (cur_xref->num<=flag) return;
+ finish_line(); out('\\');
+@.\\A@>
+@.\\U@>
+ if (flag==0) out('U')@;@+else out('A');
+ out_str(" section");
+ @<Output all the module numbers on the reference list |cur_xref|@>;
+ out('.');
+}
+@y
+@ The |footnote| procedure gives cross-reference information about
+multiply defined module names (if the |flag| parameter is |def_flag|), or about
+the uses of a module name (if the |flag| parameter is zero). It assumes that
+|cur_xref| points to the first cross-reference entry of interest, and it
+leaves |cur_xref| pointing to the first element not printed. Typical outputs:
+`\.{\\A\ 101.}'; `\.{\\Us\ 370 and 1009.}';
+`\.{\\As\ 8, 27\\*, and 64.}'.
+Note that the output of \.{weave} is not English-specific; users may supply
+new definitions for the macros \.{\\A}. \.{\\As} etc.
+
+@u footnote(flag) /* outputs module cross-references */
+sixteen_bits flag;
+{
+ xref_pointer q; /* cross-reference pointer variable */
+ if (cur_xref->num<=flag) return;
+ finish_line(); out('\\');
+@.\\A@>
+@.\\U@>
+@.\\As@>
+@.\\Us@>
+ if (flag==0) @+ out('U') @;
+ else @+ out('A');
+ @<Output all the module numbers on the reference list |cur_xref|@>;
+ out('.');
+}
+@z
+
+
+Furthermore, the word ``and'' will be replaced by ``\.{\\ET}''
+if there are two xrefs or ``\.{\\ETs}'' if there are more than two.
+No comma is appended before ``\.{\\Ets}''.
+This is exactly the same as in \.{CWEAVE} 3, and it is necessary for
+languages in which there should not be a comma before the equivalent of ``and''
+(e.g., Dutch, German).
+
+
+@x
+@ The following code distinguishes three cases, according as the number
+of cross-references is one, two, or more than two. Variable |q| points
+to the first cross-reference, and the last link is a zero.
+
+@<Output all the module numbers...@>=
+q=cur_xref; if (q->xlink->num>flag) out('s'); /* plural */
+out('~');
+while (1) {
+ out_mod(cur_xref->num-flag);
+ cur_xref=cur_xref->xlink; /* point to the next cross-reference to output */
+ if (cur_xref->num<=flag) break;
+ if (cur_xref->xlink->num>flag || cur_xref!=q->xlink) out(',');
+ /* not the last of two */
+ out(' ');
+ if (cur_xref->xlink->num<=flag) out_str("and~"); /* the last */
+}
+@y
+@ The following code distinguishes three cases, according as the number
+of cross-references is one, two, or more than two. Variable |q| points
+to the first cross-reference, and the last link is a zero.
+
+@<Output all the module numbers...@>=
+q=cur_xref;
+if (q->xlink->num>flag) out('s'); /* plural */
+while (1) {
+ out_mod(cur_xref->num-flag);
+ cur_xref=cur_xref->xlink; /* point to the next cross-reference to output */
+ if (cur_xref->num<=flag) break;
+ if (cur_xref->xlink->num>flag) out_str(", "); /* not the last */
+ else{
+ out_str("\\ET");
+ if (cur_xref!=q->xlink) out('s') @; /* the last of more than two */
+ }
+}
+@.\\ET@>
+@.\\ETs@>
+@.\\As@>
+@.\\Us@>
+@z
diff --git a/web/webfiles/spider/webkernel.tex b/web/webfiles/spider/webkernel.tex
new file mode 100644
index 0000000000..aad579056d
--- /dev/null
+++ b/web/webfiles/spider/webkernel.tex
@@ -0,0 +1,424 @@
+%
+% WEBKERNEL.TEX
+%
+% by Mark Potse, september 1994 / december 1997
+%
+% Altered webkernel.tex, that first test if it's being input by TeX or LaTeX,
+% and acts appropriately, to work with the webfiles.sty
+%
+% This webkernel is meant to be used by Spidery weaves that are changed with
+% SPweave.ch, that goes together with the webfiles distribution.
+%
+
+% standard macros for WEB listings (in addition to PLAIN.TEX or LaTeX)
+
+\ifx\documentstyle\undefined % if it's TeX
+ % go on
+\else % if it's LaTeX (with webfiles.sty)
+ \input swebbind.sty
+ \endinput \fi % `\fi' must be on the same line!
+
+% \let\plainmark=\mark
+% \def\mark#1{\message{(Marking ``#1'')}\plainmark{#1}}
+
+\let\amp=\&
+\let\SS=\S
+\let\PP=\P
+\let\em=\it % compatibility with latex
+
+\newif\iftwoside
+\twosidefalse
+%\let\iftwoside=\iffalse
+\parskip 0pt % .1pt plus 0.1pt mins 0.1pt % no stretch between paragraphs
+\parindent 1em % for paragraphs and for the first line of Pascal text
+
+\font\eightrm=cmr8
+\font\sc=cmcsc10
+\let\mainfont=\tenrm
+\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)
+\let\idfont\it
+\let\reservedfont\bf
+
+\def\today{\ifcase\month\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+ \space\number\day, \number\year}
+
+\def\\#1{\leavevmode\hbox{\idfont#1\/\kern.05em}} % italic type for identifiers
+\def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
+\def\&#1{\leavevmode\hbox{\reservedfont#1\/}} % boldface type for reserved words
+\def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings
+ \let\\=\BS % backslash in a string
+ \let\'=\RQ % right quote in a string
+ \let\`=\LQ % left quote 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
+ #1}}
+\def\#{\hbox{\tt\char`\#}} % parameter sign
+\def\${\hbox{\tt\char`\$}} % dollar sign
+\def\%{\hbox{\tt\char`\%}} % percent sign
+\def\^{\ifmmode\mathchar"222 \else\char`^ \fi} % pointer or hat
+% circumflex accents can be obtained from \^^D instead of \^
+\def\AT!{@} % at sign for control text
+\def\@{@} % at sign in strings
+% EVERY WEAVE MUST DEFINE \? WHERE ? IS THE AT SIGN!!!!
+
+% Macros to surround text in |...|
+\def\CD{\relax\ifmmode\let\DC\egroup\hbox\bgroup\else\let\DC\relax\fi}
+\let\DC=\relax
+\let\PB=\relax % hook for program brackets |...| in TeX part or section name
+ % copied from cwebmac.tex version 3.0, to be able to
+ % work with webfiles.sty if LaTeX is used.
+
+\chardef\AM=`\& % ampersand character in a string
+\chardef\BS=`\\ % backslash in a string
+\chardef\LB=`\{ % left brace in a string
+\def\LQ{{\tt\char'22}} % left quote in a string
+\chardef\RB=`\} % right brace in a string
+\def\RQ{{\tt\char'23}} % right quote 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
+
+\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\0{\ifmmode\ifinner$\par % forced break
+ \hangindent\ind em\noindent\kern\ind em\ignorespaces$\fi
+ \else\par % forced break
+ \hangindent\ind em\noindent\kern\ind em\ignorespaces\fi}
+\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 with no indentation
+% \hangindent\ind em\noindent\kern\ind em\copy\bakk\ignorespaces\fi}
+\def\6{\ifmmode\else\par % forced break with no indentation
+ \hangindent\ind em\startline\ignorespaces\fi}
+\def\7{\Y\6} % forced break and a little extra space
+\def\8{\unskip} % no indentation--works only in code, not in |...|
+\def\startline{\noindent
+ \count255=\ind\advance\count255by-2
+ \hskip\count255 em}
+
+\let\yskip=\smallskip
+
+%
+% WEBFILES:
+% tie added.
+%
+\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}}
+\def\lapstar{\rlap{*}}
+\def\startsection{\Q\noindent{\let\*=\lapstar\bf\modstar.\quad}}
+\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
+%
+% WEBFILES:
+%
+\def\A{\note{See also section}} % cross-references for multiply defined
+\def\As{\note{See also sections}} % section names
+\def\B{\mathopen{\.{@\commentbegin}}} % begin controlled comment
+\def\C#1{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % C comments
+ \XX\hfil\penalty-1\hfilneg\quad
+ $\commentbegin\,${#1}$\,\commentend$\XX}
+\def\D{\defin{define}} % macro definition
+\def\ET{ and~} % WEBFILES: between the last 2 in section-xref
+\def\ETs{, and~} % WEBFILES: last if there are more than 2.
+\def\F{\defin{format}} % format definition
+\def\J{\.{@\&}} % TANGLE's join operation
+\outer\def\M#1.{\MN#1.\ifon\vfil\penalty-100\vfilneg % beginning of section
+ \vskip12ptminus3pt\startsection\ignorespaces}
+\outer\def\N#1.#2.{\MN#1.\headcheck#2\headcheck
+ \edef\rhead{\uppercase{\ignorespaces\themodtitle}} % define running headline
+ \message{*\modno} % progress report
+ \edef\next{\write\cont{\thetocskip
+ \Z{\theopen\relax
+ \themodtitle}{\modno}{\noexpand\the\pageno}}}\next % to contents file
+ \ifon\startsection{\bf\ignorespaces\themodtitle.\quad}\ignorespaces}
+\def\MN#1.{\par % common code for \M, \N
+ {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}
+ \ifx\modno\modstar \onmaybe \else\ontrue \fi \mark{\modno}}
+\def\O#1{% octal, hex or decimal constant
+ {\def\?{\kern.2em}%
+ \def\${\ell}% long constant
+ \def\_{\cdot 10^{\aftergroup}}% power of ten
+ \def\~{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}}% octal
+ \def\^{\hbox{\rm\char"7D\tt\aftergroup}}% double quotes for hex constant
+ #1}}
+\def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode
+ \sfcode`;=3000
+ \pretolerance 10000
+ \hyphenpenalty 10000 \exhyphenpenalty 10000
+ \global\ind=2 \1\startline}%\ \unskip}
+\def\Q{\rightskip=0pt % get out of Pascal mode
+ \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 }
+\def\T{\mathclose{\.{@\commentend}}} % terminate controlled comment
+%
+% WEBFILES:
+%
+\def\U{\note{This code is used in section}} % cross-references for uses of
+\def\Us{\note{This code is used in sections}} % sections
+\def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % section name
+ \XX$\langle\,$#2{\eightrm\kern.5em#1}$\,\rangle$\XX}
+\def\XF#1:#2\XF{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % section name
+ \XX{\tt(#2{\eightrm\kern.5em#1})}\XX}
+\def\Y{\par\yskip}
+\def\){\hbox{\.{@\$}}} % sign for string pool check sum
+\def\]{\hbox{\.{@\\}}} % sign for forced line break
+\def\=#1{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
+ \hbox{\strut\kern2pt\.{#1}\kern2pt}}
+ \hrule}\vrule}\kern2pt} % verbatim string
+\let\~=\ignorespaces
+\let\*=*
+
+
+\def\DO{\hbox{\sl\char'044}} % slant dollar sign
+\let\G=\ge % greater than or equal sign
+\def\H{{\rm\char'136}} % hat
+\let\I=\ne % unequal sign
+\let\K=\gets % left arrow
+\let\L=\le % less than or equal sign
+\let\R=\lnot % logical not
+\let\S=\equiv % equivalence sign
+\let\TI\sim % tilde
+\let\V=\lor % logical or
+\let\W=\land % logical and
+\let\Z=\let % now you can \send the control sequence \Z
+
+
+\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue
+\newif\ifon \newif\iftitle \newif\ifpagesaved
+\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead\hfill\title\qquad
+ \tensy x\mainfont\topmark} % top line on left-hand pages
+\def\rheader{\tensy x\mainfont\topmark\eightrm\qquad\title\hfill\rhead
+ \qquad\mainfont\the\pageno} % top line on right-hand pages
+\def\lfooter{\hfil} % bottom line on left-hand-pages
+\def\rfooter{\hfil} % bottom line on left-hand-pages
+\def\page{\box255 }
+\def\normaloutput#1#2#3#4#5{%
+%\message{(At start top, first, and bottom marks: \topmark, \firstmark, \botmark)}%
+\shipout\vbox{
+ \iftwoside\else\ifodd\pageno\hoffset=\pageshift\fi\fi
+ \vbox to\fullpageheight{
+ \iftitle
+ \else\hbox to\pagewidth{\vbox to10pt{}%
+ \ifodd\pageno#3\else
+ \iftwoside#2\else#3\fi
+ \fi}%
+ \fi
+ \vfill#1% parameter #1 is the page itself
+ \iftitle\global\titlefalse
+ \else\baselineskip=24pt\hbox to\pagewidth{\strut % see TeXbook p256
+ \ifodd\pageno#5\else
+ \iftwoside#4\else#5\fi
+ \fi}%
+ \fi
+ }%
+}%
+\global\advance\pageno by1
+%\message{(At end top, first, and bottom marks: \topmark, \firstmark, \botmark)}%
+}
+
+
+\def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections
+\def\title{} % an optional title can be set by the user
+\def\topofcontents{\centerline{\titlefont\title}
+ \vfill} % this material will start the table of contents page
+\def\botofcontents{\vfill} % this material will end the table of contents page
+\def\contentspagenumber{0} % default page number for table of contents
+\newdimen\pagewidth \pagewidth=6.5in % the width of each page
+\newdimen\pageheight \pageheight=8.4in % the height of each page
+\newdimen\fullpageheight \fullpageheight=9in % page height including
+ % headlines and footlines
+\newdimen\pageshift \pageshift=0in % shift righthand pages wrt lefthand ones
+\catcode`\@=11 % make at letter
+\def\m@g{\mag=\count@\pagewidth=6.5truein\pageheight=8.4truein
+ \fullpageheight=9truein\setpage}
+\catcode`\@=12 % make at other
+\def\setpage{\hsize\pagewidth\vsize\pageheight} % use after changing page size
+
+\edef\contentsfile{\jobname.toc } % file that gets table of contents info
+\def\readcontents{\expandafter\input \contentsfile}
+
+\newwrite\cont
+\output{\setbox0=\page % the first page is garbage
+ \openout\cont=\contentsfile
+ \write\cont{\string\catcode`\string\@=11}% a hack to make contents
+ % take stuff in \.{---}
+ \global\output{\normaloutput\page\lheader\rheader\lfooter\rfooter}}
+\setpage
+\vbox to \vsize{} % the first \topmark won't be null
+% Delete as per bug report from kademan@stat.wisc.edu
+% Causes headings on first page to be missing
+% \eject
+
+\def\ch{\note{The following sections were changed by the change file:}
+ \let\*=\relax}
+\newbox\sbox % saved box preceding the index
+\newbox\lbox % lefthand column in the index
+\def\inx{\par\vskip6pt plus 1fil % we are beginning the index
+ \write\cont{} % ensure that the contents file isn't empty
+ \closeout\cont % the contents information has been fully gathered
+ \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader
+ \lfooter\rfooter\fi
+ \global\setbox\sbox=\page \global\pagesavedtrue}
+ \pagesavedfalse \eject % eject the page-so-far and predecessors
+ \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box
+ \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height
+ \hsize=.5\pagewidth \advance\hsize by -10pt
+ % column width for the index (20pt between cols)
+ \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
+ \def\lr{L} % this tells whether the left or right column is next
+ \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
+ \else\normaloutput{\vbox to\pageheight{\box\sbox\vss
+ \hbox to\pagewidth{\box\lbox\hfil\page}}}\lheader\rheader
+ \lfooter\rfooter
+ \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi}
+ \message{Index:}
+ \parskip 0pt plus .5pt
+ \outer\def\:##1, {\par\hangindent2em\noindent##1:\kern1em} % index entry
+ \def\[##1]{$\underline{##1}$} % underlined index item
+ \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
+ \hyphenpenalty 10000 \parindent0pt}
+\def\fin{\par\vfill\eject % this is done when we are ending the index
+ \ifpagesaved\null\vfill\eject\fi % output a null index column
+ \if L\lr\else\null\vfill\eject\fi % finish the current page
+ \parfillskip 0pt plus 1fil
+ \def\rhead{NAMES OF THE SECTIONS}
+ \message{Section names:}
+ \output{\normaloutput\page\lheader\rheader\lfooter\rfooter}
+ \setpage
+ %
+ % WEBFILES:
+ % tie added.
+ %
+ \def\note##1##2.{\quad{\eightrm##1~##2.}}
+ \def\U{\note{Used in section}} % cross-reference for uses of sections
+ \def\Us{\note{Used in sections}} % for multiple uses of sections
+ \def\:{\par\hangindent 2em}\let\*=*}
+\def\con{\par\vfill\eject % finish the section names
+ \rightskip 0pt \hyphenpenalty 50 \tolerance 200
+ \setpage
+ \output{\normaloutput\page\lheader\rheader\lfooter\rfooter}
+ \titletrue % prepare to output the table of contents
+ \pageno=\contentspagenumber \def\rhead{TABLE OF CONTENTS}
+ \message{Table of contents:}
+ \topofcontents
+ \line{\hfil Section\hbox to3em{\hss Page}}
+ \def\Z##1##2##3{\line{{\ignorespaces##1}
+ \leaders\hbox to .5em{.\hfil}\hfil\ ##2\hbox to3em{\hss##3}}}
+ \readcontents\relax % read the contents info
+ \botofcontents \end} % print the contents page(s) and terminate
+%\tracingstats1 % temporary (during development)
+
+
+\def\vert{|}
+
+
+%%% this stuff is to allow inital =,1,2,3,4 in starred modules
+%%% = means ``part'', don't skip page
+%%% normal starred module is 0
+%%% 1,2,3,4 are submodules, and are indented
+%%%
+%%% @*= bold name in table of contents
+%%% causes page eject
+%%% suppresses page eject following
+%%%
+%%% @*1,2 first level of indentation
+%%% @*3,4 second level of indentation
+%%%
+%%% @*1,3 cause page eject
+%%% @*2,4 don't cause page eject
+%%%
+
+
+\newif\ifcancel\cancelfalse
+\catcode`\@=11
+\def\ifnextchar#1#2#3{\let\@tempe=#1\def\@tempa{#2}\def\@tempb{#3}\@ifnch}
+\def\@ifnch{\ifx \@tempc \@tempe\let\@tempd\@tempa\else\let\@tempd\@tempb\fi
+ \@tempd}
+\def\makethechar#1{\let\@tempc=#1}
+\catcode`\@=12
+
+\def\headcheck#1#2\headcheck{%
+ \makethechar{#1}%
+ \def\theskipper{\vfil\penalty-100\vfilneg\vskip12ptminus3pt}%
+ % skip before new module
+ \def\theopen{}% opening skip in toc entry
+ \def\thetocskip{}% vertical skip before toc entry
+ \def\themodtitle{{#2}}
+ \ifnextchar={%
+ \def\theskipper{\vfil\eject}%
+ \canceltrue
+ \def\theopen{\bf}%
+ \def\thetocskip{\vskip3ptplus1in\penalty-100
+ \vskip0ptplus-1in}%
+ }{\ifnextchar1{%
+ \cancelfalse
+ \def\theskipper{\vfil\eject}%
+ \def\theopen{\hskip2em}%
+ }{\ifnextchar2{%
+ \cancelfalse
+ \def\theopen{\hskip2em}%
+ }{\ifnextchar3{%
+ \cancelfalse
+ \def\theskipper{\vfil\eject}%
+ \def\theopen{\hskip4em}%
+ }{\ifnextchar4{%
+ \cancelfalse
+ \def\theopen{\hskip4em}%
+ }{% else
+ \ifcancel\else
+ \def\theskipper{\vfil\eject}%
+ \fi
+ \cancelfalse
+ \def\themodtitle{#1{#2}}%
+ }}}}}%
+ \theskipper
+}
+
+
+%%%%%%%% for verbatim quoting of code
+% The following are copied from manmanc.tex and are taken from p421 of
+% the TeXbook ... modified to \verbatim...\endverbatim
+% macros for verbatim scanning
+\chardef\other=12
+\def\ttverbatim{\begingroup
+ \catcode`\|=\other
+ \catcode`\\=\other
+ \catcode`\{=\other
+ \catcode`\}=\other
+ \catcode`\$=\other
+ \catcode`\&=\other
+ \catcode`\#=\other
+ \catcode`\%=\other
+ \catcode`\~=\other
+ \catcode`\_=\other
+ \catcode`\^=\other
+ \obeyspaces \obeylines \tt}
+{\obeyspaces\global\let =\ } % from texbook, p 381
+
+
+%\outer\def\verbatim{$$\let\par=\endgraf \ttverbatim \parskip=0pt
+% \catcode`\|=0 \rightskip-5pc \ttfinish}
+%{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
+% |obeylines % end of line is active
+% |gdef|ttfinish#1^^M#2\endverbatim{#1|vbox{#2}|endgroup$$}}
+
+\outer\def\verbatimcode{\par\ttverbatim\leftskip=2em\parskip=0pt
+ \ttfinishcode}
+{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
+ |obeylines % end of line is active
+ |gdef|ttfinishcode#1^^M#2\endverbatimcode{#1|vbox{#2}|endgroup}}
+
+
+% end of manmac stuff
+
+
diff --git a/web/webfiles/swebbind.sty b/web/webfiles/swebbind.sty
new file mode 100644
index 0000000000..6743c201f8
--- /dev/null
+++ b/web/webfiles/swebbind.sty
@@ -0,0 +1,246 @@
+%%
+%% This is file `swebbind.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% webfiles.dtx (with options: `spider')
+%% Package for inclusion of CWEB and Spidery WEB programs in
+%% LaTeX Documents.
+\catcode`\@=11
+\chardef\xwebCatUsCode=\catcode`\_ % top level macro file!
+\catcode`\_=11 % Catcode letter
+\chardef\xwebCatEscape=0
+\chardef\xwebCatOpen=1
+\chardef\xwebCatClose=2
+\chardef\xwebCatIgnore=9
+\chardef\xwebCatLetter=11
+\chardef\xwebCatOther=12
+\chardef\xwebCatActive=13
+\catcode`\_=\xwebCatLetter
+\catcode`\@=\xwebCatLetter
+\let\amp\& % ampersand
+\let\SS\S % section sign
+\let\PP\P % paragraph sign
+\def\N#1.#2.{%
+ \ifon\end{xwebModule}\fi % webfiles
+ \global\xwebGroupLevel 0% default value for group level
+ \xweb_headcheck#2\xweb_headcheck % spider: get group level and title
+ {\let\*=\empty%
+ \xdef\xweb_secno{#1}% webfiles: get the section number
+ }%
+ \message \expandafter{*\xweb_secno}%
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}{\bf\xweb_ModTitle.}%
+ % \xweb_ModTitle is generated by \xweb_headcheck.
+ %\hskip 1em plus.1em minus.1em%
+ \xweb_SpiderLopEntry{\xwebGroupLevel}%
+}
+\def\xweb_SpiderLopEntry#1{%
+ \ifnum\c@xwebLopDepth > \xwebGroupLevel
+ \addcontentsline{lop}{starred}{%
+ \protect\global\xwebGroupLevel #1 \thexwebModule.~\xweb_ModTitle}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{\xweb_ModTitle}{\the\xwebGroupLevel}%
+ {\xweb_secno}{\noexpand\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ \ifnum\c@xwebOutlineDepth > \xwebGroupLevel
+ \xwebPDFOutline{\xweb_secno}{\xweb_ModTitle}% args: nr, title
+ \fi}
+\newif\ifxweb_cancel\xweb_canceltrue
+\def\xweb_ifnextchar#1#2#3{\let\@tempe=#1\def\@tempa{#2}\def\@tempb{#3}%
+ \xweb_ifnch}
+\def\xweb_ifnch{%
+ \ifx \@tempc \@tempe\let\@tempd\@tempa
+ \else\let\@tempd\@tempb\fi
+ \@tempd}
+\def\xweb_makethechar#1{\let\@tempc=#1}
+
+\def\xweb_headcheck#1#2\xweb_headcheck{%
+ \xweb_makethechar{#1}%
+ \def\theskipper{\vskip 3pt}%
+ % extra skip before new starred module
+ \def\xweb_ModTitle{{#2}}%
+ \xweb_ifnextchar={% % @*= title.
+ \global\xwebGroupLevel 0% webfiles
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ \xweb_canceltrue
+ }{\xweb_ifnextchar1{% % @*1 title.
+ \global\xwebGroupLevel 1% webfiles
+ \xweb_cancelfalse
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ }{\xweb_ifnextchar2{% % @*2 title.
+ \global\xwebGroupLevel 2% webfiles
+ \xweb_cancelfalse
+ }{\xweb_ifnextchar3{% % @*3 title.
+ \global\xwebGroupLevel 3% webfiles
+ \xweb_cancelfalse
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ }{\xweb_ifnextchar4{% % @*4 title.
+ \global\xwebGroupLevel 4% webfiles
+ \xweb_cancelfalse
+ }{% else % @* title.
+ \global\xwebGroupLevel 0% webfiles
+ \ifxweb_cancel\else
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ \fi
+ \xweb_cancelfalse
+ \def\xweb_ModTitle{#1{#2}}%
+ }}}}}%
+ \theskipper
+}
+\def\CD#1\DC{#1}
+\def\P{\B}
+\def\xweb_CweaveBindings{%
+ \ifx \xweb_UserBindings\relax
+ \xweb_rebind
+ % indentation and paragraph layout
+ \xweb_break \0% % SPIDER
+ \xweb_IncrIndent \1%
+ \xweb_DecrIndent \2%
+ \xweb_ExprBreak \3%
+ \xweb_backup \4%
+ \xweb_OptBreak \5%
+ \xweb_break \6%
+ \xweb_BigBreak \7%
+ \xweb_noindent \8%
+ % C/C++ tokens
+ \xwebRel \?%
+ \xwebAddress \AND
+ \xwebComplement \CM
+ \xwebScope \DC
+ \xwebEquiv \S % SPIDER
+ \xwebGe \G
+ \xwebRightShift \GG
+ \xwebNe \I
+ \xwebAssign \K
+ \xwebLeftShift \LL
+ \xwebMod \MOD
+ \xwebNull \NULL
+ \xwebNot \R
+ \xwebBinOr \OR
+ \xwebMemberRef \PA
+ \xwebThis \this
+ \xwebOr \V
+ \xwebAnd \W
+ \xwebXor \XOR
+ \xwebLE \L % SPIDER
+ \xwebPointer \MG
+ \xwebPointerMemberRef \MGA
+ \xwebDecr \MM
+ \xwebIncr \PP
+ % more tokens
+ \xwebId \\%
+ \xwebIdLetter \|%
+ \xwebRes \&%
+ \xwebString \.% %% ( ...Emacs...
+ \xwebStringBreak \)%
+ \xwebNumber \O % SPIDER
+ \xwebCombinedOp \MRL
+ % goes to TeX state
+ \xwebComment \C
+ \xwebCxxComment \SHC
+ \xwebRefName \X
+ \xwebSpiderOutputFileName \XF
+ % CWEB tokens
+ \xwebMacrosHere \ATH
+ \xwebDefine \D
+ \xwebFormat \F
+ \xwebIdCat \J
+ \xwebVerbString \= % SPIDER
+ % cross reference tags
+ \xwebChangeFlag \*%
+ \xwebCRAlso \A
+ \xwebCRsAlso \As
+ \xwebCRCite \Q
+ \xwebCRsCite \Qs
+ \xwebCRUse \U
+ \xwebCRsUse \Us
+ \xwebCREt \ET
+ \xwebCRsEt \ETs
+ % finish the list
+ \stop\stop
+ \def\xweb_UserBindings{%
+ \xweb_RestoreBindings
+ \let\xweb_UserBindings\relax
+ }%
+ \fi
+ }
+\def\M#1.{%
+ \ifon\end{xwebModule}\fi
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}
+ \ifnum\c@xwebLopDepth>9
+ \addcontentsline{lop}{xwebsection}{%
+ \protect\global\xwebGroupLevel 4 \thexwebModule.}%
+ \edef\next{\write\xweb_cont{\ZZ{}{4}{\xweb_secno}%
+ {\thepage}}}\next % \ZZ{title}{depth}{sec}{page}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{}{4}{\xweb_secno}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ }
+\def\inx{
+ \ifxwebIndex
+ \xweb_SetupIndex
+ \def\:{\I}
+ \else
+ \def\:##1.{} % gobble \:\\{foo} 1, 2, 3.
+ \fi
+}
+\def\fin{
+ \ifxwebIndex
+ \xweb_FinishIndex
+ \fi
+ \ifxwebRef
+ \xweb_SetupReflist
+ \def\:{\I}
+ \else
+ \def\:{}
+ \def\XF##1\XF{}
+ \def\X##1\X{}
+ \def\U##1.{}
+ \def\Us##1.{}
+ \def\ET##1.{}
+ \def\ETs##1.{}
+ \fi
+}
+\def\con{
+ \ifxwebRef
+ \endgroup
+ \fi
+}
+\def\xwebComment#1{%
+ \5% % 0.5em will be discarded on line break
+ \hskip 1.5em
+ \commentbegin%
+ {\xweb_tex
+ \xwebCommentHook
+ #1%
+ }%
+ \commentend%
+ }
+\let\xwebCommentHook\relax
+\let\xwebCxxComment\xwebComment
+\def\xwebDefine{\xweb_macro{define}}
+\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
+ \4\xweb_macro{format}\\{#1} \\{#2}\par\fi}
+\def\xwebSpiderOutputFileName#1:#2\XF{\xwebRefName{#1}:\.{#2}\X}
+\catcode`\_=\xwebCatUsCode
+\catcode`\@=\xwebCatOther
+\endinput
+%%
+%% End of file `swebbind.sty'.
diff --git a/web/webfiles/test.tex b/web/webfiles/test.tex
new file mode 100644
index 0000000000..308458a0ea
--- /dev/null
+++ b/web/webfiles/test.tex
@@ -0,0 +1,65 @@
+\documentclass{report}
+\usepackage{epsf}
+\ifx\pdfoutput\undefined
+ \usepackage[raggedbottom]{webfiles}
+\else
+ \pdfoutput=1
+ %\usepackage[pdftex]{hyperref}
+ \usepackage[pdftex,raggedbottom]{webfiles}
+\fi
+\textwidth=16cm
+\textheight=21cm
+\topmargin=-\headheight
+ \advance \topmargin by -\headsep
+\oddsidemargin=0pt \evensidemargin=0pt
+\marginparwidth 0.5in
+\pagestyle{headings}
+\def\DO{\textbf{DO}}
+
+\begin{document}
+\title{Test voor {\tt webfiles} }
+\author{Mark Potse}
+\maketitle
+%\tableofcontents
+\listofprograms
+
+\setcounter{xwebSecNoEject}{0}
+\setcounter{xwebLopDepth}{9}
+
+%{\catcode`\_=11
+%\xweb_hypertype=2
+\def\xwebContentsTop{\bigskip\centerline{Contents of \texttt{mtest}}}
+\xwebContents{mtest}
+%}
+
+\chapter{{A CWEB program}}
+\def\thexwebModule{\arabic{xwebModule}}
+\webfile[reflist,hideformats]{CreateMap.tex}
+
+\def\thexwebModule{\Roman{chapter}-\arabic{xwebModule}}
+\chapter{An MWEB program}
+\webfile[nocon,noreflist,hideformats]{mtest}
+
+%\chapter{Spider (an AWKWEB program)}
+%\webfile{spider}
+
+%\def\thexwebModule{\arabic{xwebModule}}
+%\chapter{A CWEB program with only changes}
+%\webfile[onlychanges]{CreateMap}
+
+
+\chapter{Indexes and Reflists}
+
+\def\thexwebModule{\Roman{xwebModule}}
+\xwebInputIndex{CreateMap.idx}
+
+\def\thexwebModule{\arabic{xwebModule}}
+\xwebInputIndex{CreateMap}
+
+\xwebInputReflist{CreateMap.scn}
+
+\xwebInputReflist{fake.scn}
+\end{document}
+
+
+
diff --git a/web/webfiles/webfiles.dtx b/web/webfiles/webfiles.dtx
new file mode 100644
index 0000000000..a33898ecfc
--- /dev/null
+++ b/web/webfiles/webfiles.dtx
@@ -0,0 +1,3882 @@
+% ^^A WEBFILES.DTX $Revision: 2.1 $
+% ^^A LaTeX package webfiles, documented with DOC,
+% ^^A for use with DOCSTRIP.
+%
+%
+% \title{The \texttt{webfiles} Package \\ Version~\xwebVersion}
+% \author{Mark Potse%
+% \thanks{Medical Physics Department, University
+% of Amsterdam. \newline
+% Email: {\tt M.Potse@amc.uva.nl}
+% }\\
+% }
+% \date{\xwebDate}
+% \maketitle
+%
+% ^^A an environment to extend the doc macros:
+% ^^A (cannot be nested!)
+% \newtoks\Macros
+% \catcode`\@=11
+% \def\macros{\begingroup ^^A defines \begin{macros}{#1}
+% \catcode`\\=12
+% \catcode`\ =9 ^^A ignore spaces, tabs, and newlines
+% \catcode`\^^I=9
+% \catcode`\^^M=9
+% \MakePrivateLetters
+% \scanmacros}
+% \def\scanmacros#1{%
+% \global\Macros={#1}
+% \endgroup
+% \@for\tmpa:=#1\do{
+% \expandafter\macro \expandafter{\tmpa}}}
+% \def\endmacros{
+% \@for\tmpa:=\the\Macros\do{\endmacro}}
+% \catcode`\@=12
+%
+%
+% ^^A don't print macros in the margin; there are too many of them
+% \def\PrintMacroName#1{}
+% \MacroTopsep=-10pt
+%
+%
+% \section{Introduction}
+%
+% The \texttt{webfiles} package makes it possible to plug the
+% documentation of \cweb\footnote{version~3, this package does not
+% work with older versions} and Spidery \web\ programs into a
+% \LaTeX\ document. One can include any number of webs by
+% including the \weave\ processor's output with the command
+% \begin{quote}
+% |\webfile[|\meta{options}|]{|\meta{filename}|}|
+% \end{quote}
+% where \meta{filename} is the name of the \texttt{.tex} file (with
+% or without the extension) that
+% is output by the \weave\ processor and \meta{options} is a
+% comma-separated list of options, as explained later.
+% Of course, the \texttt{webfiles} package must be loaded:
+% \begin{quote}
+% |\usepackage[|\meta{options}|]{webfiles}|
+% \end{quote}
+% in the preamble of the document. The package recognizes the same
+% options as the |\webfiles| command.
+%
+% This manual does not describe the usage of \web{} systems
+% themselves; they have their own
+% manuals\cite{cweb:manual,spiderywebman,mweb:manual}.
+% In what follows, it is assumed that you read at least one of them, but
+% note that some of the information here overrides what was said
+% there.
+%
+% This package is based on the {\tt cweb} style
+% by Joachim Schrod (even this manual is based on his).
+% Apart from the fact that, with this package, {\tt web}'s are `plugged in'
+% while in Schrod's style they are the main and only body, there is a
+% number of differences:
+% \begin{enumerate}
+% \item This package can also work with Spidery webs.
+% \item The layout (determined by the document class and maybe
+% other packages) is not changed.
+% \item Existing counters are not affected.
+% \item The section numbers in \weave's output are used.
+% \item The contents of all webs are listed in a ``List of
+% Programs'', if the user wishes so.
+% \item The user may choose if pagebreaks may occur inside
+% sections. If not, the result is a `ragged bottom'.
+% \item A section is only printed if it is `on'. (Refer to the
+% documentation of
+% a \web\ to see what `on' means in this context.)
+% \item The \texttt{multicol} package is used, if present, to
+% typeset the identifier index in two columns. Therefore a
+% pagebreak between the identifier index and the list of
+% refinements is no longer necessary. If \texttt{multicol}
+% cannot be found, \LaTeX's \verb"\twocolumn" is used.
+% \item The index and list of refinements can be suppressed in
+% the \LaTeX{} document.
+% \item Format (|@f|) statements can be suppressed in the \LaTeX{}
+% document.
+% \item Support for hyperlinks is included, as well as direct
+% support for PDF\TeX.
+% \end{enumerate}
+%
+%
+%
+%
+%
+% \subsection{The overall structure}
+%
+% The philosophy behind this package is that you, like it's
+% author, may wish to import more than one \web\ program, maybe in
+% more than one programming language, in a single \LaTeX\ document.
+% With this package, you can regard to the {\tt .web} file as just
+% a part of your document, like the parts that you |\include|
+% when writing a large document in more than one file, and in the
+% documentation parts of the \web{} program you can use all features of
+% \LaTeX\ the way you would in that case.
+%
+% \cweb{} Version~3.0 introduced the notion of a starred section's
+% ``depth.'' As
+% in the layout produced by {\tt cwebmac.tex} the depth value does only
+% influence the web's table of contents (and ``List of
+% Programs''), not the rendering of the
+% title within the text. (\texttt{cwebmac.tex} is the original,
+% plain-based macro package used to typeset \cweb{} sources; I
+% refer henceforth to it as the ``plain version.'')
+%
+% The \emph{document} structure is tagged in the mother document, with
+% \verb"\section" and such. Although it is not forbidden to use
+% sectioning commands in the documentation part of the \web{}
+% program, it doesn't seem useful to do so. The only place where a
+% sectioning command could be useful is in the limbo section.
+%
+% The `mother document' must load the ``{\tt webfiles}'' package:
+% \begin{quote}
+% \verb"\usepackage{webfiles}"
+% \end{quote}
+% Then you can include a \web{} program with the following command:
+% \begin{quote}
+% \verb"\webfile{"\meta{filename}\verb"}"
+% \end{quote}
+% where \meta{filename} is the {\tt .tex} file that is
+% output by a \weave\ processor.
+%
+% The resulting structure of the mother document is exemplified in
+% figure~\ref{fig:structure}. Text may be inserted anywhere
+% inbetween the tags shown there.
+%
+% \begin{figure}[t]
+%
+% \setbox0=\vbox{\parindent=0pt \hsize=.9\textwidth
+% \begin{minipage}{\hsize}
+% \begin{verbatim}
+% \documentclass{report}
+% \usepackage{webfiles}
+%
+% \begin{document}
+%
+% \title{Three solutions for the Travelling Salesman problem}
+% \author{Joe L. User}
+%
+% \maketitle
+%
+% \tableofcontents % optional
+% \listoffigures % etc., optional
+% \listofprograms % optional
+%
+% \chapter{A PSPACE solution for the Travelling Salesman}
+% \webfile{pspace}
+%
+% \chapter{The Travelling Salesman problem, solved by Simulated
+% Annealing}
+% \webfile{anneal}
+%
+% \chapter{A Neural Network solution for the Travelling Salesman}
+% \webfile{neu_net}
+%
+% \appendix
+% \chapter{The Travelling Salesman Problem, solved by telepresence}
+% \input{internet-user}
+%
+% \end{document}
+%
+% \end{verbatim}
+% \end{minipage}
+% }
+%
+% \begin{center}
+% \fboxsep=1em
+% \fbox{\box0}
+% \end{center}
+%
+% \caption{Exemplified document structure}
+% \label{fig:structure}
+% \end{figure}
+%
+%
+% \subsection{Notes on running weave processors}
+%
+% \begin{itemize}
+% \item Recent versions of Levy \&\ Knuth's \texttt{cweave} should be
+% run with the \texttt{+e} flag to work correctly with the
+% \texttt{webfiles} package (if this flag is omitted, program code
+% fragments between vertical bars in the documentation part will not
+% be printed correctly).
+% \item If \texttt{cweave} or a Spidery weave is run with the |-x|
+% option, a (harmless) error message occurs about a file that ``ended
+% while scanning use of |\end|''.
+% \end{itemize}
+%
+%
+% \section{Customization}
+%
+% Both the |\webfile| command and the |\usepackage{webfiles}|
+% command accept an optional argument that may contain a
+% comma-separated list of options. Options specified to
+% |\usepackage| act as global defaults that can be overridden in
+% the optional argument to |\webfile|. Therefore each option has an
+% opposite. The recognized options are summarized in
+% table~\ref{opttab}, and discussed in the following sections.
+% \begin{table}
+% \def\*{*}
+% \begin{center}
+% \begin{tabular}{llp{8cm}}
+% \textit{option} & \textit{opposite} & \textit{effect} \\[4pt]
+% |index|\* & |noindex| & print identifier index \\
+% |noindex| & |index| & don't print identifier index \\
+% |reflist|\* & |noreflist| & print List of Refinements \\
+% |noreflist| & |reflist| & don't print List of Refinements \\
+% |contents|\* & |nocon| & print table of contents\\
+% |nocon| & |contents| & don't print table of contents\\
+% |allsections|\* & |onlychanges| & print all sections\\
+% |onlychanges| & |allsections| & print only changed sections\\
+% |showformats|\* & |hideformats| & show |@f| declarations \\
+% |hideformats| & |showformats| & don't show |@f| declarations \\
+% |raggedbottom|\* & |flushbottom| & try not to break modules
+% across pages \\
+% |flushbottom| & |raggedbottom| & try to create a flush
+% bottom, break modules if necessary \\
+% |hyperref| & |nohype| & make hyperlinks using |hyperref| package\\
+% |pdftex| & |nohype| & make hyperlinks and PDF outlines with
+% PDF\TeX\\
+% |nohype|\* & \ldots & no hyperlinks\\
+% |nofiles| & |writefiles| & dont't write a contents file
+% (equivalent to setting |\setcounter{xwebLopDepth}{-9}|).\\
+% |writefiles|\* & |nofiles| & do write a contents file.
+% (equivalent to setting |\setcounter{xwebLopDepth}{9}|).\\
+% \end{tabular}
+% \end{center}
+% \caption{Webfiles options. Defaults are tagged with a \*.}
+% \label{opttab}
+% \end{table}
+% Other customizations are possible through the redefinition of
+% macros and the setting of counters; the most important of these
+% will be explained in this section.
+%
+%
+% \subsection{The index and the list of refinements}
+%
+% An identifier index and a list of refinements are created at the
+% end of each \web{} document, if you didn't call \weave{} with
+% the {\tt -x}
+% option\footnote{%
+% The `{\tt-x}' option suppresses output of the index and
+% reflist---see the documentation.}.
+% You can specify an introductionary text for the index with
+% the tag \verb"\xwebIndexIntro", the introduction is the argument of this
+% tag.
+% To suppress generation of an identifier index, even when \weave{}
+% was not called with the {\tt -x} option you can use an optional
+% argument to the |\webfile| command; for example:
+% \begin{verbatim}
+% \webfile[noindex]{foo}
+% \end{verbatim}
+% To suppress identifier indexes in all web's, use this option in
+% the |\usepackage| command:
+% \begin{verbatim}
+% \usepackage[noindex]{webfiles}
+% \end{verbatim}
+% You can use the |index| option in the |\webfile| command to
+% override this global default.
+%
+% The same applies to the list of refinements, using the options
+% |reflist| and |noreflist|.
+%
+%
+% \subsection{The table of contents}
+%
+% Each web document gets its own table of contents. It can be suppressed
+% with the |nocon| option; the opposite option is |contents|.
+% You can produce the table of contents of any web document in any
+% position with the |\xwebContents| command. This command takes one
+% argument: the basename of the web document, and does not work
+% with Spidery webs (yet\footnote{I consider releasing a revised
+% version of Spider that is more compatible with CWEB, and has less
+% bugs}).
+%
+% The tables of contents are produced like all \LaTeX's tables of contents
+% etc., in the second \LaTeX\ run. They are stored in a file with name
+% \meta{basename}\texttt{.con}, where \meta{basename} is the basename
+% of the web document.
+%
+%
+% \subsection{The List of Programs}
+%
+% In addition to
+% the table of contents there is a
+% ``List of Programs'', analogous to the ``List of Figures''
+% etc.~that standard \LaTeX{} provides.
+% The list can be produced with a
+% \begin{verbatim}
+% \listofprograms
+% \end{verbatim}
+% command, which can be placed at any position.
+% It is customary to put it at the beginning of the mother
+% document, after it's table of contents.
+% As with the List of Figures, the List of Programs is generated at
+% the second \LaTeX{} run. It can list programs, main sections and
+% normal sections; the default is to list only programs and main
+% sections. You can control what goes into the list by setting the
+% counter {\tt xwebLopDepth\/}:
+% \begin{itemize}
+% \item Normal sections get into it if {\tt xwebLopDepth\/} is
+% greater than or equal to 10.
+% \item All starred sections that have a depth smaller than {\tt
+% xwebLopDepth\/} will be mentioned.
+% \item Programs will be mentioned unless {\tt xwebLopDepth\/} is
+% smaller than or equal to $-10$.
+% \end{itemize}
+% By setting {\tt xwebLopDepth\/} inbetween \verb"\webfile"
+% commands you can handle each \web{} file differently, if you
+% wish.
+% The default value is 9.
+% It is a \LaTeX{} counter, so its value can be changed using the
+% \verb"\setcounter" and
+% \verb"\addtocounter" commands.
+%
+% The PDF outline (if you use PDF\TeX) can be controlled in the
+% same way, using the counter \texttt{xwebOutlineDepth}, except
+% that normal sections never get into the outline.
+%
+% The entries for the List of Programs are put into the file
+% ``{\meta{jobname}\tt.lop}'', where \meta{jobname}
+% is the jobname that \TeX\ chose for the mother document (usually
+% the name of the {\tt.tex} file, without the extension).
+% Edit this file only if you're desparate, as with the {\tt.toc} and
+% {\tt.lof} files etc.
+%
+%
+%
+% \subsection{Newpages}
+%
+% The default behaviour of the |webfiles| package is never to break
+% sections across pages if they fit on a single page.
+% If sections may be broken across pages, the |webfiles| package
+% is able create `flush bottom' pages.
+% To enable this, specify the |flushbottom| option to the
+% |\webfile| or the |\usepackage| command.
+% To re-enable the default behaviour locally, specify the
+% |raggedbottom| option.
+%
+% A main section can start a new page regardless if it will fit on
+% the current one. To change this behaviour,
+% set the counter
+% {\tt xwebSecNoEject}, which keeps the lowest group level where
+% no new page is started at a main section. The default is~3.
+% It is a \LaTeX{} counter, so its value can be changed using the
+% |\setcounter| and |\addtocounter| commands.
+%
+%
+% \subsection{Hyperlinks}
+%
+% If the |hyperref| option is specified, all module references are
+% turned into hyperlinks using the \texttt{hyperref}
+% package\cite{hyperref}. To use this feature, you have to import the
+% \texttt{hyperref} package yourself, before importing the
+% \texttt{webfiles} package, e.g.:
+% \begin{verbatim}
+% \usepackage[hypertex]{hyperref}
+% \usepackage[hyperref]{webfiles}
+% \end{verbatim}
+% Alternatively, with the |pdftex| option, direct support for PDF\TeX\
+% can be enabled. This provides the same look and feel as the
+% \texttt{pdfcwebmac} macros, including the `PDF Outline', but of
+% course works only with PDF\TeX.
+%
+% Both types of hyperlinked references can be switched off with the
+% |nohype| option.
+%
+%
+% \subsection{Output in other languages}
+%
+% \web\ documentation can contain a few---predefined---informal texts.
+% As in the plain version, you can change these texts, for example
+% to obtain output in an other language than English, by redefining
+% some macros. The macro names concerned are listed below, together
+% with their default definitions.
+% \begin{verbatim}
+%
+% \def\xwebIndexName{Index of \xwebJobname}
+% \def\xwebReflistName{List of Refinements in \xwebJobname}
+% \def\xwebCRAlso{\xwebCrossRef{See also section}}
+% \def\xwebCRsAlso{\xwebCrossRef{See also sections}}
+% \def\xwebCRCite{\xwebCrossRef{This code is cited in section}}
+% \def\xwebCRsCite{\xwebCrossRef{This code is cited in sections}}
+% \def\xwebRLCite{\xwebCrossRef{Cited in section}}
+% \def\xwebRLsCite{\xwebCrossRef{Cited in sections}}
+% \def\xwebCRUse{\xwebCrossRef{This code is used in section}}
+% \def\xwebCRsUse{\xwebCrossRef{This code is used in sections}}
+% \def\xwebRLUse{\xwebCrossRef{Used in section}}
+% \def\xwebRLsUse{\xwebCrossRef{Used in sections}}
+% \def\xwebCRChanged{%
+% \xwebCrossRef{The following sections were changed by the change file:}%
+% \let\*\relax}
+% \def\xwebCREt{ and~}
+% \def\xwebCRsEt{, and~}
+% \def\xwebLopName{List of Programs}
+% \def\xwebTocName{Contents of \xwebJobname}
+% \def\xwebRefMacrosHere{Preprocessor Definitions}
+% \def\xwebSectionName{Section}
+% \def\xwebPageName{Page}
+%
+% \end{verbatim}
+%
+%
+% \subsection{Documenting changefiles}
+%
+% If a web file is included that has some sections changed by a
+% changefile you can have the |\webfile| command print only the
+% changed sections by giving the |onlychanges| option.
+% As with all options, this option can also be given to the
+% |\usepackage| command. Its opposite option is |allsections|.
+% Specifying |onlychanges| is equivalent to saying
+% |\let\maybe=\iffalse| in the plain version.
+%
+%
+%
+% \subsection{Miscellaneous}
+%
+% You can control the appearance of web section numbers by redefining
+% the appearance of |\thexwebModule|. Its default definition is
+% |\arabic{xwebModule}|.
+%
+% With the |noformats| option, you can suppress the printing of
+% |@f| specifiers. (In cweb, you can also use |@s| instead of |@f|,
+% that way you can control which format specifiers get printed and
+% which don't).
+%
+%
+% \section{Problems and Restrictions}
+%
+% Restrictions:
+% \begin{itemize}
+%
+% \item Please be aware that the vertical bar (`\verb"|"') is used
+% by \web{} to delimit small program code pieces in the
+% documentation parts, and is therefore processed by
+% \weave{}. {\it You cannot use it for \LaTeX{} anymore.}
+%
+% In particular, you cannot specify rules for the {\tt
+% tabular\/} or the
+% {\tt array\/} environment. Since you probably want to do
+% so: You have two choices left:
+%
+% \begin{enumerate}
+%
+% \item Make sure you have the {\tt array\/} package (by Frank
+% Mittelbach
+% and David Carlisle) installed. Then you may use the package
+% {\tt cwebarray\/}, it defines `{\tt I\/}' (that's an uppercase~i)
+% as a specifier
+% for rules. I.e., instead of
+% \begin{verbatim}
+% \begin{tabular}{l|l}
+% \end{verbatim}
+% you have to write
+% \begin{verbatim}
+% \begin{tabular}{lIl}
+% \end{verbatim}
+%
+% \item \begin{sloppypar}
+% Use `\verb"^^7c"' instead of `\verb"|"'. I.e., instead of
+% \verb"\begin{tabular}{l|l}" you may write
+% \verb"\begin{tabular}{l^^7cl}".
+% \end{sloppypar}
+%
+% \end{enumerate}
+% %
+% These two choices are compatible, you may use both in one document.
+% Needless to say, I consider the first alternative the better one.
+%
+% \item One cannot use restricted program mode in moving
+% arguments. Most
+% notably, this is annoying in the titles of starred sections
+% and in
+% \verb"\caption" tags.
+%
+% \begingroup
+% \hfuzz=10pt ^^A 9.89442pt too wide at a4-9
+% \item Neither a refinement name nor an index entry made
+% by~|@^| may consist of a {\it single\/} dot-accented
+% term. I.e., you must not write `|@<\.O@>|', `|@^\.o@>|', or
+% even `|@^\.{foolish}@>|'. Of course you may write
+% `|@^\.o accent@>|' or `|@< Handle accent \.o @>|'.
+% \endgroup
+%
+% \item If weave is run with the |-x| option, a (harmless) error
+% message occurs about a file that
+% ``ended while scanning use of |\end|''.
+%
+%
+% \end{itemize}
+%
+%
+% \subsection{Reserved Control Sequences}
+%
+% The following tags are reserved and must neither be used nor
+% redefined:
+% \begin{verbatim}
+% \ATL
+% \B
+% \M
+% \N
+% \PB
+% \Y
+% \end{verbatim}
+%
+% \verb"\9" is already explained in the \cweb{} user manual: It's a special
+% control sequence used for the index entries tagged with~`\verb"@:"'. Its
+% default definition is setup in such a way that you can cheat
+% \weave{} concerning the sort order of this entry: If you enter
+% `\verb"@:sort}{print@>"' you will get an index entry ``print'' next to the
+% place where the index entry ``sort'' would be. But you're allowed to
+% change this default definition.%
+%
+% The names of all other control sequences defined by this
+% package---besides the common \LaTeX{} control sequences---start with
+% \texttt{xweb}. Please don't define new control
+% sequences starting with this prefix. (The control sequences that
+% don't have a `|@|' or `|_|' in them may be
+% redefined to change the appearence of the \web{}
+% document, check the implementation's documentation for their
+% meaning.)
+%
+%
+%
+%
+% \subsection{Problems} \label{sec:problems}
+% Since this is still a test version of the package, there are some
+% known bugs and problems.
+%
+% \bigskip
+%
+% \noindent {\it Known Bugs\/}:
+% %
+% \begin{itemize}
+%
+% \item The presentation of \verb"@l" redefinitions is not proper. But it
+% wasn't in the plain version, either.
+%
+% \end{itemize}
+%
+% \noindent {\it Problems\/}:
+% %
+% \begin{itemize}
+% \item One cannot use an other basic font size than 10\,pt. A few
+% symbol definitions and layout parameters depend on this.
+% \item \C++ comments in \cweb\ (i.e., from \verb"//" to the end of
+% the line) are
+% typeset as C comments. This is especially bad if they are used for a
+% whole block of comment lines, as it is quite common. Please put such
+% comment blocks in the documentation part.
+% \end{itemize}
+%
+%
+%
+% \section{\TeX nical Data}
+%
+% \web{} programmers who used the plain version before
+% should note that the macros from {\tt cwebmac.tex} and {\tt
+% webkernel.tex} are not available anymore.
+% E.g., you cannot use \verb"\." to typeset typewriter material; use
+% either |\texttt| or~|\verb|, as it fits the situation. On
+% the other hand,
+% now you're able, for example, to use |\.| for the dot accent,
+% |\\| will be the newline again (as usual in \LaTeX),
+% you can define |\C++| for the \C++\ logo, etc.
+%
+% Another detail for ex-plainies: The ``List of Programs'' that
+% replaces the table of contents is produced by
+% the \verb"\listofprograms" tag (during the second \LaTeX{} run), not
+% automatically. But this is the standard \LaTeX{} way of handling
+% such things.
+%
+% There are now two kinds of indexes, both optional: Those that are
+% created by \weave{}, which come at the end of each \web{}
+% program, and the index of the mother document, that is, the one
+% that is created with \verb"\index" commands and the {\tt
+% theindex\/} environment (possibly with the help of
+% \MakeIndex\/\cite{makeindex}).
+% There are no problems in using these together, but it's for you
+% to decide in which of them the entries must go that you specify
+% yourself.
+% You may, with a few definitions, get the indexes of the \web{}
+% files into the index of the mother document.
+%
+% The modules are put in a new environment, called
+% \verb"xwebModule". They are not made into \verb"\section"s and
+% such, and they are numbered in a single layer, in exactly the
+% same way as in the plain version, so that the cross-reference
+% information output by \weave\ will always be right. (It refers
+% literally to the section numbers.)
+%
+% You can change this, e.g., you can let \verb"xwebModule"s be
+% \verb"\section"s, but you'll have to change the way
+% cross-references are printed too. For more information, consult
+% the documentation\cite{webfiles}.
+%
+% The \texttt{webfiles} package is documented with the \texttt{doc}
+% package, and uses \texttt{docstrip} to create its \texttt{.sty}
+% files. See the \emph{\LaTeX\ Companion} or the \texttt{README}
+% file that goes together with the \texttt{webfiles} package for
+% instructions on how to use these to change the sources or produce
+% typeset documentation.
+%
+% This package reserves the namespace |xweb|.
+%
+%
+% \subsection{Files}
+%
+% \def\xweave{{\tt{\it x\/}weave}}
+% \def\xweb{{\tt{\it x\/}web}}
+%
+% \begin{description}
+% \item[{\tt webfiles.sty}] is the main package file.
+% It suffices to handle \cweb\ files.
+% \item[{\tt cwebmac.tex}] is the macro package that is input on
+% the first line
+% of the {\tt .tex} file that \cweave\ creates. It contains
+% macros that enable
+% \TeX\ to handle \cweb, but it can see if it's being input by
+% \LaTeX\ (instead
+% of \TeX\/), and, if so, it won't define anything.
+% \item[{\tt{\it x\/}web.tex}] is the file that is input on the
+% first line of
+% output of \xweave, where \xweave\ is a Spidery \weave.
+% It inputs {\tt webkernel.tex}, and defines additional macros that are
+% specific for \xweb. The person that made \xweb\ should make
+% sure that these
+% macros work with \LaTeX\ too.
+% \item[{\tt webkernel.tex}] is input by {\tt{\it x\/}web.tex}; it
+% is the Spidery
+% analogon of {\tt cwebmac.tex\/}, but
+% it contains no language-dependent macros: These are concentrated in the
+% {\tt{\it x\/}web.tex} files.
+% If {\tt webkernel.tex} sees that it is being input by \LaTeX, it inputs
+% {\tt swebbind.sty}, and doesn't define anything, else it
+% defines the macros
+% that enable \TeX\ to handle a Spidery \web{}.
+% \item[{\tt swebbind.sty}] contains redefinitions of some macros in {\tt
+% webfiles.sty} that
+% make them able to handle Spidery \web{}s.
+% \end{description}
+% %
+% {\tt webfiles.sty} and {\tt swebbind.sty} are supplied with the
+% {\tt webfiles} package.
+% So is {\tt webkernel.tex}; this file replaces the file of the
+% same name that goes together with \spider.
+% The {\tt{\it x\/}web.tex} files are supplied with their
+% respective (Spidery) \web{}s.
+% {\tt cwebmac.tex} is supplied with \cweb.
+%
+% \filbreak\subsection{Bug reports}
+%
+% If you have any comments on the {\tt webfiles\/} package
+% that may be of interest to others, please report them to the
+% author:
+% \begin{quote}
+% \parbox{\textwidth}{
+% Mark Potse\\
+% Medical Physics department,\\
+% Academic Medical Center\\
+% Meibergdreef 15,\\
+% 1105 AZ Amsterdam,
+% The Netherlands.\\
+% email: \texttt{M.Potse@amc.uva.nl}}
+% \end{quote}
+% You may be able to fix bugs or customize the package after
+% consulting the documentation that goes
+% together with this manual.
+%
+%
+% \section{Acknowledgements}
+%
+% Most of the code in this package was shamelessly stolen from the
+% \texttt{cweb} style by Joachim Schrod (even this manual is based on
+% his). Thanks to Andreas Scherer and Amelie Stein for useful
+% comments. And if God had not given us \TeX\ it would have been
+% necessary to invent it.
+%
+%
+%
+% \StopEventually{
+% \bibliographystyle{unsrt}
+% \bibliography{webfiles}
+% \addcontentsline{toc}{section}{Bibliography}}
+%
+%
+%
+%
+% \chap The documentation driver.
+%
+% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
+% \DoNotIndex{\@ne}
+% \DoNotIndex{\advance,\begingroup}
+% \DoNotIndex{\begin,\bf,\bigskip}
+% \DoNotIndex{\catcode,\closein,\closeout}
+% \DoNotIndex{\copy,\csname,\cdot,\char,\chardef}
+% \DoNotIndex{\day,\def,\edef,\else,\empty,\endcsname,}
+% \DoNotIndex{\endgroup,\errmessage}
+% \DoNotIndex{\expandafter,\fi,\futurelet,\gdef,\global,\hbox,\if,\ifeof}
+% \DoNotIndex{\ifx,\immediate,\let,\loop,\m@ne,\message,\month}
+% \DoNotIndex{\newcount}
+% \DoNotIndex{\newif,\newlinechar,\newread,\newtoks,\newwrite}
+% \DoNotIndex{\noexpand,\par,\read,\relax,\repeat}
+% \DoNotIndex{\space,\the,\undefined,\write,\xdef,\year,\z@}
+%
+% The \texttt{webfiles} package is documented with \texttt{docstrip}.
+% This code will generate the documentation. Since it is the first piece
+% of code in the file, the documentation can be obtained by simply
+% processing this file with \LaTeXe.
+%
+% \begin{macros}{\MakePrivateLetters}
+% \begin{macrocode}
+%<*driver>
+\documentclass[twoside]{ltxdoc}
+\usepackage{xwebdoc,array,cwebarray}
+\pagestyle{headings}
+\renewcommand\MakePrivateLetters{\makeatletter\catcode`\_=11\relax}
+\IndexPrologue{\section*{Index}%
+ \markboth{Index}{Index}%
+ The italic numbers denote the code lines where the corresponding
+ entry is described, underlined numbers point to the definition,
+ all others indicate the places where it is used.}
+\EnableCrossrefs
+\CodelineIndex % \RecordChanges
+% \OnlyDescription
+%</driver>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The RCS version number is extracted from the keyword string
+% and joined with the manually-set major version number.
+% The complete version number is also written in
+% ``\texttt{version.tex}'' for use in the Makefile.
+%
+% \begin{macros}{\xwebMajor,\xwebVersion,\xwebDate}
+% \begin{macrocode}
+%<*driver|main>
+
+%%
+%% $Id: webfiles.dtx,v 2.1 2002/03/05 10:38:14 potse Exp $
+%%
+
+\begingroup
+ \catcode`\$=9 % ignore $
+ \gdef\xwebMajorNr{1.0.}
+ \def\setversion#1:#2.#3:{\xdef\xwebVersion{\xwebMajorNr #3}}
+ \setversion $Revision: 2.1 $:
+ \def\setdate#1: #2/#3/#4#5#6:#7:#8;{\gdef\xwebDate{#2/#3/#4#5}}
+ \setdate $Date: 2002/03/05 10:38:14 $;
+ \newwrite\vf \immediate\openout\vf=version.tex
+ \immediate\write\vf{\xwebVersion}\immediate\closeout\vf
+\endgroup
+%</driver|main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect After that, the document can be input by the driver.
+%
+% \begin{macrocode}
+%<*driver>
+\begin{document}
+ \DocInput{webfiles.dtx}
+ \PrintIndex
+ % \PrintChanges
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+%
+% \chap Implementation.
+%
+% The implementation is still somewhat messy.
+%
+% A good explanation of the vocabulary used here is given by Schrod
+% in the implementation of the {\tt cweb} style:
+%
+% \begin{quotation}
+%
+% Before we start with an overview of the implementation I want to
+% explain the \cweb{} vocabulary I use while I guide you through this
+% document. The commonly used terms sometimes denote two entities, but
+% for the purpose of this style we need exact terms. I've tried to stick
+% to a ``canonical'' computer science terminology.
+%
+% I distinguish two different structures in a \cweb{} file: The
+% \emph{document structure} and the \emph{program structure}.
+%
+% A \cweb{} document consists of a series of \emph{sections}. Within
+% this series some sections are especially emphasized, we call them the
+% \emph{main sections}. (They are also called \emph{starred sections},
+% since their corresponding \cweb{} tag is~|@*|.) These main sections
+% have a title, ordinary sections are untitled. A table of contents may
+% therefore list only the main sections. Note that there is no
+% hierarchy in the sections, they are all on the same level, i.e., they
+% are numbered subsequently.
+%
+% Each section consists of three parts: (1)~the \emph{documentation
+% part}, (2)~the \emph{definition part}, and (3)~the \emph{program part}.
+% Each of these parts can be empty. The documentation part is mostly text
+% with \LaTeX{} tags. In this text material from \emph{restricted program
+% mode} can appear. The definition part consists of a series of either
+% \emph{macro} or \emph{format definitions}. The program part is one
+% piece of a refinement, identified by a name (see below).
+%
+% A \cweb{} program consists of a tree of \emph{refinements}. A
+% refinement is a list of program parts with the same name, ordered in
+% appearence. The root of the tree is the refinement with the special
+% name~|@c|. The program text is defined by the DFS (i.e., infix-order)
+% traversal of the tree.
+%
+% \end{quotation}
+%
+%
+% \sect
+% Before we start we declare some names for category codes. By
+% declaring the underscore~`(|_|)' as letter we can use it in our
+% macros. As this is a \LaTeX{} package the at sign is a letter
+% anyhow; so we can use the ``private'' plain and \LaTeX{} control
+% sequences; and with the underscore we can make our own control
+% sequences (\emph{cseqs} for short) more readable. Since we have to
+% restore this category code at the end of this macro file, we save its
+% former value in the control sequence |\xwebCatUsCode|.
+% This method is better than to use a group, not all cseqs must be
+% defined global this way.
+%
+% \begin{macros}{\xwebCatEscape,\xwebCatOpen,\xwebCatClose,
+% \xwebCatIgnore,\xwebCatLetter,\xwebCatOther,\xwebCatActive,
+% \xwebCatUsCode}
+% \begin{macrocode}
+%<*main|spider>
+\catcode`\@=11
+\chardef\xwebCatUsCode=\catcode`\_ % top level macro file!
+\catcode`\_=11 % Catcode letter
+\chardef\xwebCatEscape=0
+\chardef\xwebCatOpen=1
+\chardef\xwebCatClose=2
+\chardef\xwebCatIgnore=9
+\chardef\xwebCatLetter=11
+\chardef\xwebCatOther=12
+\chardef\xwebCatActive=13
+%</main|spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Let's identify this package against the user and in the Log file.
+%
+% \begin{macrocode}
+%<*main>
+\ProvidesPackage{webfiles}
+\begingroup
+ \typeout{LaTeX package `webfiles', version \xwebVersion, \xwebDate}
+\endgroup
+%</main>
+% \end{macrocode}
+%
+% \sect The very first (alpha) version of the {\tt cweb} style was a style
+% option.
+% The version on which the {\tt webfiles} style is based was a full style.
+% {\tt webfiles.sty} itself is an option again, and since the author
+% has \LaTeXe, it has become a \emph{package}.
+% Therefore we test if a documentclass was chosen (by testing if
+% |\section| is defined).
+%
+% \begin{macrocode}
+%<*main>
+\ifx \section\undefined
+ \PackageError{webfiles}{`webfiles' is a package, not a class}{%
+ webfiles is not a document class, but only a package.
+ Please adapt your documentclass tag appropriately.
+ I.e., write \MessageBreak
+ \protect\usepackage{webfiles} instead of
+ \protect\documentclass{webfiles}.}
+\fi
+%</main>
+% \end{macrocode}
+%
+%
+% \chap Options.
+%
+% The package options may be used in the optional argument of the
+% \verb=\usepackage= command, or in the optional argument of the
+% \verb=\webfile= command. In the second case, they only apply to
+% a single web.
+% We keep track of the choices with logical variables and a count
+% register, each having a global and a local variant.
+%
+% \begin{macros}{\ifxwebIndex,\ifxwebRef,\ifxwebRagged,
+% \ifxwebHideFormats,\ifxwebCon,\xweb_hypertype}
+% \begin{macrocode}
+%<*main>
+\newif\ifxweb_GlobalIndex \newif\ifxwebIndex
+\newif\ifxweb_GlobalRef \newif\ifxwebRef
+\newif\ifxweb_GlobalRagged \newif\ifxwebRagged
+\newif\ifxweb_GlobalOC
+\newif\ifxweb_GlobalHideFormats \newif\ifxwebHideFormats
+\newif\ifxweb_GlobalCon \newif\ifxwebCon
+\DeclareOption{index}{\xweb_GlobalIndextrue}
+\DeclareOption{noindex}{\xweb_GlobalIndexfalse}
+\DeclareOption{reflist}{\xweb_GlobalReftrue}
+\DeclareOption{noreflist}{\xweb_GlobalReffalse}
+\DeclareOption{raggedbottom}{\xweb_GlobalRaggedtrue}
+\DeclareOption{flushbottom}{\xweb_GlobalRaggedfalse}
+\DeclareOption{onlychanges}{\xweb_GlobalOCtrue}
+\DeclareOption{allsections}{\xweb_GlobalOCfalse}
+\DeclareOption{nocon}{\xweb_GlobalConfalse}
+\DeclareOption{contents}{\xweb_GlobalContrue}
+\DeclareOption{hideformats}{\xweb_GlobalHideFormatstrue}
+\DeclareOption{showformats}{\xweb_GlobalHideFormatsfalse}
+
+\newcount\xweb_hypertype
+\newcount\xweb_GlobalHypertype
+\DeclareOption{hyperref}{\xweb_GlobalHypertype=1}
+\DeclareOption{pdftex}{\xweb_GlobalHypertype=2 \input pdfcolor}
+\DeclareOption{nohype}{\xweb_GlobalHypertype=0}
+
+\newcounter{xwebLopDepth} \setcounter{xwebLopDepth}{9}
+\newcounter{xwebOutlineDepth} \setcounter{xwebOutlineDepth}{9}
+\DeclareOption{nofiles}{\c@xwebLopDepth=-9}
+\DeclareOption{writefiles}{\c@xwebLopDepth=9}
+\ExecuteOptions{index,reflist,raggedbottom,allsections,%
+ contents,showformats,nohype,writefiles}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+% \iffalse
+% subdocument: The interface between CWEAVE and TeX
+% \fi
+% \input cweave-f-spec
+%
+%
+%
+% \chap Processing states.
+%
+% We have to typeset five different categories of material:
+% Documentation, program pieces---embedded within the documentation and
+% as large chunks, \TeX{} material within program pieces (i.e., comments
+% and refinement names), and cross reference information. Since we need
+% a complete other environment for the program pieces than for the rest
+% we design ``states'' where we switch to appropriately.
+% %
+% \begin{enumerate}
+%
+% \item A section starts in the {\it documentation state}.
+%
+% \item |\B| switches to {\it program state}. This can happen in
+% documentation and program state.
+%
+% \item While we process the argument of |\PB| we're in \emph{restricted
+% program state}; |\PB| may appear in documentation and in \TeX{}
+% state. Since \TeX{} state can be switched on within restricted
+% program state, |\PB| can appear within the argument of itself.
+%
+% \item In the arguments of |\C|, |\SHC|, and |\X| we switch to
+% {\it \TeX{} state}. All these cseqs appear only in (restricted)
+% program state, their official names are actually different. I.e., only
+% in (restricted) program state these cseqs are bound to the meaning
+% described here.
+%
+% \item Cross reference information are attached to most sections with
+% refinements. This information is processed in {\it CR state}.
+% After CR state material
+% comes always the next section or the document end, i.e., material in
+% documentation state.
+%
+% \end{enumerate}
+% %
+% This FSA is illustrated by the diagram in figure~\ref{fig:fsa}.
+%
+% \begin{figure}
+%
+% \begin{center}
+% \chardef\\=`\\
+% \input{cweb-fsa.latex}
+% \end{center}
+%
+% \caption{The processing state's FSA. The automaton starts and ends in
+% the ``documentation'' state.}
+% \label{fig:fsa}
+%
+% \end{figure}
+%
+% \begin{sloppypar}
+% |\xweb_documentation| will switch to documentation state,
+% |\xweb_program| to program state, |\xweb_Rprogram| to restricted
+% program state, |\xweb_tex| to \TeX{} state, and |\xweb_CR| to CR state.
+% If we're already in a state, the switch to this state shall be a
+% permissible null operation.
+% \end{sloppypar}
+%
+%
+% \sect The basic difference between these states can be named with
+% two parameters: (1)~The cseq bindings in effect and (2)~the layout
+% parameters used for paragraph makeup.
+%
+% In (restricted) program state and in CR state the text is output
+% under the control of \cweave{}, and tagged by \cweave{}. The used
+% tags are from a global namespace and should only be in effect during
+% these states. We call this tag set the \emph{CWEAVE bindings}. In the
+% other two states the tags are largely defined by the user, the tag
+% set is called the \emph{user bindings}. The switch to another binding
+% is always done locally, i.e., if we switch from documentation to
+% restricted program state within a group we don't have to bother about
+% the restauration of the user binding; it will be done automatically
+% by \TeX{} at the end of the group. Nevertheless we must be able to
+% switch from the \cweave{} bindings back to the user bindings which
+% were in effect when we activated the \cweave{} bindings. This is
+% needed for the \TeX{} state which is always activated within
+% (restricted) program state.
+%
+% The parameters for \emph{program layout} are really special ones
+% since they need to support the indentation which shows the program
+% structure. These parameters are used in program and in \TeX{} state.
+% The \emph{document layout} parameters established by the user are
+% used in the other three states.
+%
+% The following table shall summarize this. $C$~denotes \cweave{}
+% bindings, $U$~user bindings, $P$~program layout, and $D$~document
+% layout. If an entry is empty, its value is not changed on entry in
+% this state.
+%
+% \begin{quote}\rm
+% \begin{tabular}{rIcIc}
+% \multicolumn1{cI}{\sc State} & \sc Binding & \sc Layout \\[1pt]
+% \hline
+% documentation & $U$ & $D$ \\
+% program & $C$ & $P$ \\
+% restricted program & $C$ & \\
+% \TeX{} & $U$ & \\
+% CR & $C$ & $D$ \\
+% \end{tabular}
+% \end{quote}
+%
+%
+% \sect Since the user bindings and the document layout is defined
+% initially, we don't have to do anything if it's requested. Only if we
+% change it, i.e., within |\xweb_CweaveBindings| and
+% |\xweb_ProgramLayout|, we redefine |\xweb_UserBindings| and
+% |\xweb_DocLayout|. If they are eventually executed, they shall
+% rebind themselves back to |\relax|. This way we can switch to
+% documentation state as often as we want.
+%
+% \begin{macros}{\xweb_UserBindings,\xweb_DocLayout,
+% \xweb_documentation,
+% \xweb_Rprogram,\xweb_program,\xweb_tex,\xweb_CR}
+% \begin{macrocode}
+%<*main>
+\let\xweb_UserBindings=\relax
+\let\xweb_DocLayout=\relax
+\def\xweb_documentation{%
+ \xweb_UserBindings
+ \xweb_DocLayout}
+\def\xweb_Rprogram{%
+ \xweb_CweaveBindings}
+\def\xweb_program{%
+ \xweb_CweaveBindings
+ \xweb_ProgramLayout}
+\def\xweb_tex{%
+ \xweb_UserBindings}
+\def\xweb_CR{%
+ \xweb_CweaveBindings
+ \xweb_DocLayout}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \chap Saving and restoring control sequences.
+%
+% We have a lot of cseqs which are defined within the namespace of this
+% package and which will be used with other names. This usage is in a
+% controlled environment, namely neither in documentation nor in \TeX{}
+% state. (I.e., the text processed is tagged by \cweave{}, not by humans;
+% therefore we have a precise specification of the cseqs we have to
+% accept.) We cannot work with groups where a cseq is just redefined
+% and \TeX{} takes care for establishing the old binding again; when we
+% switch from program state to \TeX{} state all the bindings which were
+% in effect before the program state got active, i.e., in the
+% documentation state, must be in effect again. We cannot simply
+% consider the \TeX{} state as something parallel to program state, it
+% must be a hierarchical relationship: In the program state values are
+% set up which must be available after switching back from \TeX{} to
+% program state.
+%
+% We save the current binding of a cseq in another cseq, but only if
+% there exists a binding currently. This is done to save valuable
+% \TeX{} main memory. Actually, one
+% can assume that nearly no cseq bindings must be saved at all---the
+% used names are strange enough. The bindings of |\foo|, i.e., of the
+% cseq with the name \fbox{\tt foo}, is saved as the cseq with the name
+% \fbox{\tt xweb\_s\_\char `\\ foo}, i.e., as
+% |\csname xweb\_s\_\string\foo\endcsname|.
+%
+%
+% \sect The save process is not done statically, but by the macro
+% |\xweb_rebind| which interprets a list of tuples $({\it old\_name},
+% {\it new\_name})$, terminated by the tuple $(|\stop|, |\stop|)$.
+% Eventually it constructs two new lists, |\xweb_ToRestore| with the
+% cseqs which had a binding, and |\xweb_undefined| with the names which
+% didn't have one.
+%
+% The saving is actually done by |\xweb_SaveBinding|, |\xweb_rebind|
+% is responsible for the initialization, |\xweb_DoRebind| for the
+% effective rebinding and the tail recursion on the list.
+%
+% \begin{fixme}
+% We could pull the |\next| assignment in the |\else| branch out
+% of the loop to get a better performance. Should measure if
+% this is of interest.
+% \end{fixme}
+%
+% \begin{macros}{\xweb_undefined,\xweb_ToRestore,\xweb_rebind,
+% \xweb_DoRebind}
+% \begin{macrocode}
+%<*main>
+\newtoks\xweb_undefined
+\newtoks\xweb_ToRestore
+\def\xweb_rebind{%
+ \xweb_undefined{}%
+ \xweb_ToRestore{}%
+ \xweb_DoRebind
+ }
+\def\xweb_DoRebind#1#2{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \xweb_SaveBinding #2%
+ \let #2=#1%
+ \let\next\xweb_DoRebind
+ \fi
+ \next
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect If the cseq to be saved is undefined, it may just be added to
+% the ``undefined list.'' Otherwise its binding is saved and it's added
+% to the ``to-be-restored list.''
+%
+% \TeX{}nical note: The cseq-name for the saved binding must be created
+% before the |\let| is executed.
+%
+% \begin{macro}{\xweb_SaveBinding}
+% \begin{macrocode}
+%<*main>
+\def\xweb_SaveBinding#1{%
+ \ifx #1\undefined
+ \xweb_undefined \expandafter{\the\xweb_undefined #1}%
+ \else
+ \expandafter\let \csname xweb_s_\string#1\endcsname =#1%
+ \xweb_ToRestore \expandafter{\the\xweb_ToRestore #1}%
+ \fi
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The restoration of rebound cseqs is a two-tied activity: All
+% previously undefined cseqs must be made undefined again, and all saved
+% cseqs must be restored. Actually, we don't need to reset the two token
+% lists, but we do it to save space.
+%
+% Both |\xweb_undefine| and |\xweb_RestoreBinding| iterate over a list
+% of cseqs terminated by |\stop|.
+%
+% \begin{fixme}
+% And here the |\next| assignment could be prepended to the loop as
+% well.
+% \end{fixme}
+%
+% \begin{macros}{\xweb_RestoreBindings,\xweb_undefine}
+% \begin{macrocode}
+%<*main>
+\def\xweb_RestoreBindings{%
+ \expandafter\xweb_undefine \the\xweb_undefined \stop
+ \xweb_undefined{}%
+ \expandafter\xweb_RestoreBinding \the\xweb_ToRestore \stop
+ \xweb_ToRestore{}%
+ }
+\def\xweb_undefine#1{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \let#1\undefined
+ \let\next\xweb_undefine
+ \fi
+ \next
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect \TeX{}nical note: As in |\xweb_SaveBinding|, the cseq-name for
+% the saved binding must be created before the |\let|s are executed.
+%
+% \begin{fixme}
+% Another |\next| assignment.
+% \end{fixme}
+%
+% \begin{macro}{\xweb_RestoreBinding}
+% \begin{macrocode}
+%<*main>
+\def\xweb_RestoreBinding#1{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \expandafter\let \expandafter#1\csname xweb\string#1\endcsname
+ \expandafter\let \csname xweb_s_\string#1\endcsname \undefined
+ \let\next\xweb_RestoreBinding
+ \fi
+ \next
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \chap Hyperlinks.
+%
+% Because at least two implementations of hyperlinks are supported,
+% it is most convenient to define private macros for
+% hyperlinks and hypertargets. Their definition depends on
+% |\xweb_hypertype| and must therefore be performed as part
+% of the |\webfile| command, after the options are processed.
+% (This is more efficient than testing |\xweb_hypertype| again for
+% each link.)
+%
+% The anchor name depends on the current value of the |xwebModule|
+% counter; this value must be set before |\xweb_hyperlink| or
+% |\xweb_hypertarget| is used.
+%
+% \begin{macros}{\xweb_anchor,\xweb_SetupHrefs,
+% \xweb_hlink,\xweb_htarget}
+% \begin{macrocode}
+%<*main>
+\def\xweb_anchor{xwebmod:\xwebJobname:\arabic{xwebModule}}
+\def\xweb_SetupHrefs{
+ \ifnum\xweb_hypertype=0
+ \def\xweb_hlink##1{##1}
+ \def\xweb_htarget##1{##1}
+ \else\ifnum\xweb_hypertype=1
+ \def\xweb_hlink##1{\hyperlink{\xweb_anchor}{##1}}
+ \def\xweb_htarget##1{\hypertarget{\xweb_anchor}{##1}}
+ \else\ifnum\xweb_hypertype=2
+ \def\xweb_hlink##1{\xweb_pdflink{\xweb_anchor}{##1}}
+ \def\xweb_htarget##1{\xweb_pdftarget{\xweb_anchor}{##1}}
+ \else\PackageError{webfiles}{This can't happen.}{%
+ this may be a bug in the webfiles package}
+ \fi\fi\fi}
+\xweb_SetupHrefs
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \chap PDF\TeX\ support. PDF\TeX\ is an implementation of \TeX\
+% that has the ability to output pdf instead of dvi. It has some
+% extra primitives, that control pdf-specific things, such as
+% hyperlinks, colours, and `outlines'.
+%
+%
+% \sect The outline is a kind of table of contents, that is always
+% present at the left side of the pdf reader window (if the user
+% wishes so). Web documents and main sections get outline entries.
+%
+% \begin{macro}{\xwebPDFOutline}
+% \begin{macrocode}
+%<*main>
+\def\xwebPDFOutline#1#2{{%
+ \edef\tmpnr{#1}%
+ \edef\name{#2}%
+ \c@xwebModule=\tmpnr\relax
+ \ifnum\xweb_hypertype=2
+ \edef\anchor{\xweb_anchor}
+ \pdfoutline goto name{\anchor}{#1 \name}
+ \fi}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect PDF links are implemented using code copied from
+% \texttt{pdfcwebmac.tex}, with fixes from Andreas Scherer. The
+% raised |\hbox| is to ensure that the top line of the module will
+% be entirely visible. It must be |\smash|ed to avoid spurious
+% vertical material.
+%
+% \begin{macros}{\xweb_pdflink,\xweb_pdftarget}
+% \begin{macrocode}
+%<*main>
+ \def\xweb_pdflink#1#2{%
+ \pdfannotlink
+ attr{/Border [0 0 0]}
+ goto name{#1}
+ \Blue #2\Black
+ \pdfendlink}
+ \def\xweb_pdftarget#1#2{
+ \smash{\raise\baselineskip\hbox to 0pt{\pdfdest name{#1} fith}}
+ #2}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \chap Sections.
+%
+% We distinguish between main sections with titles which start a group
+% of sections and normal (untitled) sections within a group.
+% All sections are numbered sequentially by \cweave.
+% The section numbers are output in boldface at the very start of a
+% section, followed by a dot and a quad. The changeflag is a star
+% lapping to the right.
+%
+% \begin{macro}{\xwebLapStar}
+% \begin{macrocode}
+%<*main>
+\def\xwebLapStar{\rlap{*}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Important main sections are (optionally) started on a new
+% page, normal sections
+% have approximately two picas vertical space in front. The very first
+% main section does not automatically start on a new page since a title
+% may be in front of it.
+%
+% The user may also add a ``level'' to the title of a main section.
+% A newpage is inserted before a section if its level is smaller than the
+% value of the counter |xwebSecNoEject| which has default value~3.
+% And we will pay attention to this group level when
+% we create a table of contents.
+%
+% The title of a main section is set as a heading after the section
+% number, also in bold face. The first paragraph of the following
+% documentation has no indentation. The documentation part of normal
+% sections is run in after the section number.
+%
+% \begin{macros}{\xwebGroupLevel,xwebSecNoEject}
+% \begin{macrocode}
+%<*main>
+\newcount\xwebGroupLevel
+\newcounter{xwebSecNoEject}
+ \setcounter{xwebSecNoEject}{3}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The section number that is supplied by \cweave\ is used to
+% set the counter |xwebModule|.
+% This is necessary because the section numbers
+% can be non-sequentially, for example, if only changed sections are
+% printed, or if an excerpt from a web is taken. By using a
+% counter, the appearance of the number is made changeable in the
+% normal \LaTeX\ way through redefinition of |\thexwebModule|.
+% The number can contain a star, to indicate that the section is
+% changed by a changefile.
+% In that case, |\ifon| is made |true|; else it will be |\maybe|, and
+% by redefining |\maybe| the user can decide wether non-changed sections
+% should be printed. The default behaviour is to print them.
+% This weird interface is copied from the plain version, but this
+% package adds a friendlier interface.
+%
+% This is all implemented in the macro |\xweb_PrepareSection|, which
+% is used before each section.
+% This macro also changes to documentation state.
+%
+% \begin{macros}{xwebModule,\ifon,\onmaybe,\maybe,
+% \xweb_PrepareSection,\xweb_secno,\*,\xweb_star}
+% \begin{macrocode}
+%<*main>
+\newcounter{xwebModule}
+\newif\ifon % determines if the section is `on'
+\def\onmaybe{\let\ifon=\maybe} % analogous to \ontrue
+\let\maybe=\iftrue % initial meaning; the user can say "\let\maybe=\iffalse"
+\def\xweb_PrepareSection#1{%
+ {\xdef\secstar{#1}%
+ \let\*=\empty% remove \* from the number
+ \xdef\xweb_secno{#1}}
+ \ifx\xweb_secno\secstar % if they are the same; i.e.:
+ \onmaybe % if there was no star in #1
+ \xdef\xweb_star{}%
+ \else
+ \ontrue
+ \xdef\xweb_star{*}%
+ \fi
+ \setcounter{xwebModule}{#1}% global set!
+ \xweb_documentation
+}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Every web section is contained in a |xwebModule|
+% environment. This environment takes care of vertical space before
+% the section, optional page breaks, setting the section number,
+% and initializing the |\everypar| token register.
+%
+% |\everypar| must make |\@noskipsec| false, to indicate that the
+% first paragraph of the documentation part has been processed.
+% We have to initialize it ourselves, because there is no
+% |\section| to do it.
+% |\Y| and |\B| use |@noskipsec| to decide if there must be a |\par|
+% before the program part.
+%
+% The current reference, |\@currentlabel|, is set to the web
+% section.
+%
+% If |\xwebRaggedtrue|, the user has specified that sections should
+% preferably not be broken across pages, so every section will be
+% finished with optional vertical space and a negative penalty.
+% Else, just the negative penalty is inserted to indicate that this
+% is a good place for a page break.
+%
+% The module is typeset in a |\vbox| that is |\unvbox|ed at the end
+% of the environment. This way, the output routine cannot fire
+% while \TeX\ is processing a program text, and no name conflicts
+% can arise even when the weave bindings are in effect. Thanks to
+% Hans Hagen for the idea. ---No, we can't do it this way. The
+% documentation part cannot generate floats if it's in a vbox. Only
+% the program part should be vboxed and unvboxed, but this is more
+% difficult. Must think about it.
+%
+% The module is also the target for hyperlinks, using |\xweb_htarget|.
+% (This macro is defined to produce only its second argument if the
+% hyperref package is not in use.)
+%
+% If it is the first module, the table of contents is set
+% first. By setting the table of contents when the first module is
+% found, we allow the user to change |\xwebContentsTop| etc.~in the
+% limbo section.
+%
+% \begin{macros}{\thexwebModule,\xweb_ModBox,\ifxweb_FirstModule,
+% \xwebModuleHook}
+% \begin{environment}{xwebModule}
+% \begin{macrocode}
+%<*main>
+\def\thexwebModule{\arabic{xwebModule}}
+\newbox\xweb_ModBox
+\newif\ifxweb_FirstModule \xweb_FirstModulefalse
+\newenvironment{xwebModule}{%
+ \ifxweb_FirstModule
+ \ifxwebCon\xwebContents{\xwebJobname}\fi
+ \global\xweb_FirstModulefalse
+ \openout\xweb_cont=\xwebJobname.con
+ \write\xweb_cont{\catcode `\noexpand\@=11\relax}%
+ \fi
+ \ifxwebRagged\vfil\penalty-200\vfilneg% (TeXbook p.353)
+ % (this is a \filbreak without a \par)
+ \else\penalty-200\fi
+ %\setbox\xweb_ModBox=\vbox\bgroup
+ \edef\@currentlabel{\thexwebModule}
+ \par\bigskip
+ \everypar{%
+ \if@noskipsec%
+ \global\@noskipsecfalse%
+ \everypar{\penalty-100}%
+ \fi}
+ \@noskipsectrue
+ \mbox{}\hspace{-\parindent}%
+ \xwebModuleHook
+ \xweb_htarget{\textbf{\thexwebModule.}\xweb_star}% typeset module number
+ \hskip 1em plus0.1em minus 0.1em%
+ }{%\egroup\unvbox\xweb_ModBox
+ }
+\def\xwebModuleHook{}
+%</main>
+% \end{macrocode}
+% \end{environment}
+% \end{macros}
+%
+%
+% \sect The main sections are started with the macro |\N|.
+% The parameters are:
+% \begin{description}
+% \item{|#1|:} a number denoting the ``group level'' of the main
+% section, titles of main sections with lower numbers should be
+% presented more prominently in the table of contents.
+% \item{|#2|:} the section number.
+% \item{|#3|:} the title of the section
+% group. This last parameter must be terminated by a dot.
+% \end{description}
+% The group level must be passed to the macros that format the table
+% of contents. Since there is no easy place predetermined by \LaTeX{}
+% for such a wish we use a trick: The entry text for the table of
+% contents first sets the count register |\xwebGroupLevel| with the
+% respective level---this register may be tested after a pro-forma
+% evaluation of the entry.
+%
+% When writing to the \texttt{.con} file, we have to use
+% |\@unexpandable@protect|; else there will be trouble with
+% insertion of |\xweb_ModTitle| in the contents file.
+%
+% We tell the user that we have reached the next starred section.
+% The message is output after the section header is set, it shall be on
+% the correct page. Since the token list to be output is expanded at
+% shipout time, we must take care for the immediate expansion ourselves.
+%
+% A newpage is inserted if the level of the section is smaller than
+% the |xwebSecNoEject| counter and it is not the first section (if
+% the user wants the web document to begin on a new page, he can
+% insert a newpage himself).
+%
+% \begin{macros}{\N,\xwebMainSecSkip}
+% \begin{macrocode}
+%<*main>
+\def\xwebMainSecSkip{\clearpage}
+\def\N#1#2#3.{%
+ \ifon\end{xwebModule}\fi
+ \global\xwebGroupLevel #1 % <-- space!!
+ { \let\*=\empty%
+ \xdef\xweb_secno{#2}% get the section number
+ }%
+ \ifnum\xweb_secno>1
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \xwebMainSecSkip
+ \fi
+ \fi
+ \message \expandafter{*\xweb_secno}%
+ \xweb_PrepareSection{#2}
+ \ifon
+ \def\xweb_ModTitle{#3}%
+ \begin{xwebModule}{\textbf{#3.}}% title
+ \hskip 1em plus.1em minus.1em%
+ \ifnum\c@xwebLopDepth > #1%
+ \addcontentsline{lop}{starred}{%
+ \protect\global\xwebGroupLevel #1 % space after #1 !
+ {\thexwebModule.}~{#3}}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{#3}{#1}{\xweb_secno}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ \ifnum\c@xwebOutlineDepth > #1%
+ \xwebPDFOutline{\xweb_secno}{#3}% args: nr, title
+ \fi
+}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Normal sections are started with |\M|.
+%
+% \begin{macro}{\M}
+% \begin{macrocode}
+%<*main>
+\def\M#1{%
+ \ifon\end{xwebModule}\fi
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}%
+ \ifnum\c@xwebLopDepth>9%
+ \addcontentsline{lop}{xwebsection}{%
+ \protect\global\xwebGroupLevel 4 \thexwebModule.}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{}{4}{#1}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+%
+% \chap The List of Programs.
+%
+% \begin{macro}{\listofprograms}
+% The ``List of Programs'' is like the ``List of Figures'' or the ``List
+% of Tables'', which are defined in the document class.
+% The following definition is copied, with the necessary changes, from
+% |article.sty|, 16-Mar-88. It defines |\listofprograms| which is
+% used like |\listoffigures|.
+%
+% \begin{macros}{\xwebTocName,\xwebLopName}
+% \begin{macrocode}
+%<*main>
+\def\xwebTocName{Contents of \xwebJobname}
+\def\xwebLopName{List of Programs}
+\ifx\listofprograms\undefined
+ \ifx \chapter\undefined
+ \def\listofprograms{\section*{\xwebLopName\@mkboth
+ {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
+ \else
+ \newcommand{\listofprograms}{\chapter*{\xwebLopName\@mkboth
+ {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
+ \fi
+\fi
+%</main>
+% \end{macrocode}
+% \end{macros}
+% \end{macro}
+%
+%
+% \sect Entries for the |.lop| file are generated with
+% |\addcontentsline| by the following commands:
+%
+% \begin{itemize}
+% \item |\webfile| produces a |program| entry
+% \item |\N| produces a |starred| entry
+% \item |\M| produces a |xwebsection| entry
+% \end{itemize}
+%
+% \noindent
+% Program names are typeset with |\xweb_TTLopLine|, which sets
+% in large typewriter type:
+%
+% \begin{macro}{\l@program}
+% \begin{macrocode}
+%<*main>
+\def\l@program#1{%
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \xweb_TTLopLine{#1}%
+}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Normal sections are hardly ever mentioned in the list,
+% but it will be possible. The entry consists of the number only,
+% as they have no title.
+%
+% \begin{macro}{\l@xwebSection}
+% \begin{macrocode}
+%<*main>
+\def\l@xwebSection#1{
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \xweb_NormalTocLine{#1}%
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Titles of main sections might have an associated group level
+% that determines how they are featured in the table. Titles on group
+% level~0 are typeset boldface, other titles in roman.
+% They are indented proportionally to the group level, with
+% a basic indentation of |\xwebLopIndent|.
+% An entry on group level~1 is not indented, the different layout
+% suffices as a distinction to level~0.
+% The counter |\xwebLopIndentMaxLevel| constitutes an upper limit for
+% a recognized group level (concerning indentation, that is).
+%
+% \begin{macros}{\xwebLopIndent,\xwebLopIndentMaxLevel}
+% \begin{macrocode}
+%<*main>
+\newdimen\xwebLopIndent
+ \xwebLopIndent=2em
+\newcount\xwebLopIndentMaxLevel
+ \xwebLopIndentMaxLevel=4 % group level <= max level
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The group level is specified within the entry name, i.e., in the
+% first argument to |\l@starred|. If this argument is evaluated,
+% |\xwebGroupLevel| might be set to the respective value. If it is
+% not set, an explicit invocation of |\addcontentsline|
+% is responsible for this entry. Then we assume that the group level
+% is~0.
+%
+% \begin{macro}{\l@starred}
+% \begin{macrocode}
+%<*main>
+ \def\l@starred#1{% % page will be processed later
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \ifnum \xwebGroupLevel=\z@
+ \let\next\xweb_BoldTocLine
+ \else
+ \let\next\xweb_NormalTocLine
+ \fi
+ \next{#1}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+% A |\next| assignment is needed here, because the macro is
+% actually called with 2 arguments; the second is used by
+% |\@dottedtocline| and such, so a |\fi| after the expansion
+% is not allowed.
+%
+%
+% \sect A normal line has an indentation of $(l-1) \cdot {\it
+% toc\_indent}$, where $l = \min({\it group\_level},
+% {\it max\_level})$.
+%
+% The first argument of |\@dottedtocline| is used to specify a
+% depth of the issued entry. All entries with a depth larger than
+% |tocdepth| are discarded! So we always specify level 1, as the
+% level doesn't matter to \LaTeX\ and no entry is to be discarded.
+%
+% \begin{macro}{\xweb_NormalTocLine}
+% \begin{macrocode}
+%<*main>
+\def\xweb_NormalTocLine#1{% % page will be processed later
+ \ifnum \xwebGroupLevel>\xwebLopIndentMaxLevel
+ \xwebGroupLevel\xwebLopIndentMaxLevel
+ \fi
+ \advance\xwebGroupLevel\m@ne % group level -= 1
+ \@dottedtocline
+ % \xwebGroupLevel % level (old)
+ 1 % level
+ {\xwebGroupLevel\xwebLopIndent}% % basic indent
+ \xwebLopIndent % numwidth
+ {#1}% % entry
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \sect A bold line is typeset like a normal line, only the entry
+% is typeset in bold.
+%
+% \begin{macro}{\xweb_BoldTocLine}
+% \begin{macrocode}
+%<*main>
+\def\xweb_BoldTocLine#1{%
+ \@dottedtocline
+ 1 % level
+ {\xwebGroupLevel\xwebLopIndent}% % basic indent
+ \xwebLopIndent % numwidth
+ {{\bf #1}}% % entry
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect A |xweb@tt_lop_line| is like a |cweb@bold_toc_line| in the
+% |cweb| style:
+% It has no dots, but the entry is typeset in large typewriter type,
+% instead of
+% bold roman.
+%
+% \begin{macro}{\xweb_TTLopLine}
+% \begin{macrocode}
+%<*main>
+\def\xweb_TTLopLine#1#2{%
+ \addpenalty{\@secpenalty}%
+ \addvspace{2em plus\p@}%
+ \begingroup
+ \noindent
+ \hangindent\xwebLopIndent
+ \rightskip\@tocrmarg \parfillskip -\rightskip
+ \interlinepenalty\@M
+ \@tempdima\xwebLopIndent % for \numberline
+ {\large\bf\tt #1}\nobreak\hfill \hbox to\@pnumwidth{\hss #2}%
+ \par
+ \endgroup
+ \addvspace{.5em plus\p@}%
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \chap Typesetting programs.
+%
+% Program pieces come in two flavours: as argument of |\PB|, or as
+% material after |\B|. In the former case we can use a group for the
+% switch to the restricted program state, the group end will restore the
+% previous state again. In the latter case we use |\B| for the switch to
+% program state, the cross reference list or the next section will go to
+% another state. Since we have to do more for the material after |\B|,
+% we define this cseq later.
+%
+% \begin{macro}{\PB}
+% \begin{macrocode}
+%<*main>
+\def\PB#1{%
+ \begingroup
+ \xweb_Rprogram
+ \leavevmode
+ #1%
+ \endgroup}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Note, that |\Y| cannot just be |\smallskip|, as in the plain
+% version. We must assert that the current paragraph is ended before
+% the vertical glue is inserted, and that's not done by the \LaTeX{}
+% definition of |\smallskip|. In addition we add some negative penalty,
+% here is a good place for a page break. As the penalty value we use
+% half the section break penalty---of course a section start is an even
+% better place for a page break\,\dots
+%
+% It might be that |\Y| is the very first token in a ``normal''
+% section. Then the section number isn't set already since it is to be
+% run-in. In that case we don't set the vertical skip but simply start
+% the section with the program part.
+%
+% \TeX{}nical note: The flag |@noskipsec| may be used to test if we're
+% immediately after a run-in section heading.
+%
+% \begin{macros}{\xwebProgPenalty,\Y}
+% \begin{macrocode}
+%<*main>
+\newcount\xwebProgPenalty
+ \xwebProgPenalty=\@secpenalty
+ \divide\xwebProgPenalty by 2
+\def\Y{%
+ \if@noskipsec
+ \else
+ \par
+ \penalty\xwebProgPenalty
+ \smallskip
+ \fi}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Yep, let's unfold the ``official'' names of the cseqs used in
+% program state.
+%
+% If we turn on the \cweave{} bindings, they might be in effect already,
+% we don't need to establish them again. We can test
+% |\xweb_UserBindings| for this case, it will be redefined then.
+%
+% \errorcontextlines=20
+% \begin{macros}{\xweb_CweaveBindings,\xweb_UserBindings,
+% \1,\2,\3,\4,\5,\6,\7,\8,\?,\AND,\CM,\DC,\E,\G,\GG,\I,\K,
+% \LL,\MOD,\NULL,\R,\OR,\PA,\this,\V,\W,\XOR,\Z,\MG,\MGA,
+% \MM,\PP,\.,\T,\MRL,\C,\SHC,\X,\ATH,\D,\F,\J,
+% \vb,\*,\A,\As,\Q,\Qs,\U,\Us,\ET,\ETs,\)}
+% \begin{macro}{\\}
+% \begingroup\catcode`\&=12 \catcode`\|=12
+% \begin{macro}{\&}
+% \begin{macro}{\|}
+% \endgroup
+% \begin{macrocode}
+%<*main>
+\def\xweb_CweaveBindings{%
+ \ifx \xweb_UserBindings\relax
+ \xweb_rebind
+ % indentation and paragraph layout
+ \xweb_IncrIndent \1%
+ \xweb_DecrIndent \2%
+ \xweb_ExprBreak \3%
+ \xweb_backup \4%
+ \xweb_OptBreak \5%
+ \xweb_break \6%
+ \xweb_BigBreak \7%
+ \xweb_noindent \8%
+ % C/C++ tokens
+ \xwebRel \?%
+ \xwebAddress \AND
+ \xwebComplement \CM
+ \xwebScope \DC
+ \xwebEquiv \E
+ \xwebGe \G
+ \xwebRightShift \GG
+ \xwebNe \I
+ \xwebAssign \K
+ \xwebLeftShift \LL
+ \xwebMod \MOD
+ \xwebNull \NULL
+ \xwebNot \R
+ \xwebBinOr \OR
+ \xwebMemberRef \PA
+ \xwebThis \this
+ \xwebOr \V
+ \xwebAnd \W
+ \xwebXor \XOR
+ \xwebLE \Z
+ \xwebPointer \MG
+ \xwebPointerMemberRef \MGA
+ \xwebDecr \MM
+ \xwebIncr \PP
+ % more tokens
+ \xwebId \\%
+ \xwebIdLetter \|%
+ \xwebRes \&%
+ \xwebString \.% %% ( ...Emacs...
+ \xwebStringBreak \)%
+ \xwebNumber \T
+ \xwebCombinedOp \MRL
+ % goes to TeX state
+ \xwebComment \C
+ \xwebCxxComment \SHC
+ \xwebRefName \X
+ % CWEB tokens
+ \xwebMacrosHere \ATH
+ \xwebDefine \D
+ \xwebFormat \F
+ \xwebIdCat \J
+ \xwebVerbString \vb
+ % cross reference tags
+ \xwebChangeFlag \*%
+ \xwebCRAlso \A
+ \xwebCRsAlso \As
+ \xwebCRCite \Q
+ \xwebCRsCite \Qs
+ \xwebCRUse \U
+ \xwebCRsUse \Us
+ \xwebCREt \ET
+ \xwebCRsEt \ETs
+ % finish the list
+ \stop\stop
+ \def\xweb_UserBindings{%
+ \xweb_RestoreBindings
+ \let\xweb_UserBindings\relax
+ }%
+ \fi
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macros}
+%
+% \sect Since most of the \cweave{} bindings are simple and tedious
+% coding, we'll have a look at the program layout next. Between two
+% paragraphs there must not be any skip, the skip used in document
+% layout is saved in |\xweb_SaveParskip|. A few other layout
+% parameters from the document layout must be saved as well.
+%
+% \begin{macros}{\xweb_SaveParskip,\xweb_SaveRightskip,
+% \xweb_SaveSemSFCode,\xweb_SavePretolerance,
+% \xweb_SaveHyphenpenalty,\xweb_SaveExhyphenpenalty,
+% \xweb_SaveDocLayout,\xweb_RestoreDocLayout}
+% \begin{macrocode}
+%<*main>
+\newskip\xweb_SaveParskip
+\newskip\xweb_SaveRightskip
+\newcount\xweb_SaveSemSFCode
+\newcount\xweb_SavePretolerance
+\newcount\xweb_SaveHyphenpenalty
+\newcount\xweb_SaveExhyphenpenalty
+
+\def\xweb_SaveDocLayout{%
+ \xweb_SaveParskip\parskip
+ \xweb_SaveRightskip\rightskip
+ \xweb_SaveSemSFCode\sfcode`; % changed by \xweb_ProgramLayout
+ \xweb_SavePretolerance\pretolerance
+ \xweb_SaveHyphenpenalty\hyphenpenalty
+ \xweb_SaveExhyphenpenalty\exhyphenpenalty
+ }
+\def\xweb_RestoreDocLayout{%
+ \parskip\xweb_SaveParskip
+ \rightskip\xweb_SaveRightskip
+ \sfcode`;=\xweb_SaveSemSFCode
+ \pretolerance\xweb_SavePretolerance
+ \hyphenpenalty\xweb_SaveHyphenpenalty
+ \exhyphenpenalty\xweb_SaveExhyphenpenalty
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect When |\xweb_ProgramLayout| is called for the very first time
+% we have to set up some variables. This cannot be done in advance
+% since they depend on values that might be changed by the user in the
+% preamble. This setup is done in |\xweb_LayoutInit|.
+%
+% If the program layout is already active, we must not switch it on
+% another time. This can be tested by the current binding of
+% |\xweb_DocLayout|.
+%
+% \begin{macros}{\xweb_ProgramLayout,\xweb_DocLayout}
+% \begin{macrocode}
+%<*main>
+\def\xweb_ProgramLayout{%
+ \ifx \xweb_DocLayout\relax
+ \xweb_LayoutInit
+ \xweb_SaveDocLayout
+ \def\xweb_DocLayout{%
+ \xweb_RestoreDocLayout
+ \let\xweb_DocLayout\relax
+ }%
+ % set new values
+ \parskip\z@skip
+ \rightskip\z@ plus 100\p@ minus 10\p@
+ \sfcode`;=3000 % same stretch factor as period.
+ \pretolerance\@M
+ \hyphenpenalty 9999 % strings can be broken this way
+ \exhyphenpenalty\@M
+ \fi
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The unit of the basic indentation is stored in
+% |\xwebIndentUnit|. Continuation lines are indented two units further,
+% i.e., the initial hanging indentation is 3~units. The current hanging
+% indentation is kept in |\xweb_indent|.
+%
+% We need undiscardable items which can be used as backspaces, of one
+% and two units, respectively. This is done best by boxes. The
+% initialization of the boxes must be postponed until the user had the
+% chance to change |\xwebIndentUnit|, it's done in the program state
+% initialization.
+%
+% \begin{macros}{\xwebIndentUnit,\xweb_indent,\xweb_bak,\xweb_bakk,
+% \xweb_LayoutInit}
+% \begin{macrocode}
+%<*main>
+\newdimen\xwebIndentUnit \xwebIndentUnit=1em
+\newdimen\xweb_indent
+\newbox\xweb_bak % backspace one unit
+\newbox\xweb_bakk % backspace two units
+\def\xweb_LayoutInit{%
+ \global\setbox\xweb_bak \hbox to -1\xwebIndentUnit{}%
+ \global\setbox\xweb_bakk \hbox to -2\xwebIndentUnit{}%
+ \global\let\xweb_LayoutInit\relax
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Now we can formulate how to start typesetting program pieces: We
+% switch to program state, set the initial indentation, and add the basic
+% indentation of the first code line.
+%
+% If the code line is the very first text to be typeset in this
+% section, we don't add the basic indentation---we're already indented
+% from the run-in section number. But we must not start our section
+% with |\noindent|, the section number would be typeset in the left
+% margin then. So we just
+% emulate an empty documentation part, the section number is now
+% correctly set. |\B| can test for this case: |@noskipsec| is still true
+% then.
+%
+% \begin{macro}{\B}
+% \begin{macrocode}
+%<*main>
+\def\B{%
+ \if@noskipsec \hskip 1em \fi
+ \xweb_program
+ \xweb_indent 3\xwebIndentUnit \hangindent\xweb_indent
+ \ifvmode
+ \if@noskipsec
+ \indent % add an empty documentation part
+ \else
+ \noindent \kern\xwebIndentUnit
+ \fi
+ \fi
+}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect If a statement is finished, a new paragraph with the basic
+% indentation has to be started.
+%
+% An optional statement break is implemented by a low penalty which
+% will be selected if the line has to be broken. We assume that the
+% hanging indentation of the new line is already set correctly, and
+% have to backup two units to get the basic indentation. It might be
+% that the line break is not chosen by \TeX{}, we compensate the
+% backspace for this case. This compensation is discarded at the start
+% of a new line.
+%
+% \begin{macros}{\xweb_break,\xweb_ExprBreak,\xweb_BigBreak,
+% \xweb_OptBreak}
+% \begin{macrocode}
+%<*main>
+\def\xweb_break{% % forced break, between statements
+ \ifmmode\else
+ \endgraf % in LaTeX it isn't sure what \par is really...
+ \noindent
+ \hangindent\xweb_indent \kern\xweb_indent
+ \copy\xweb_bakk % go back to basic indentation
+ \ignorespaces
+ \fi
+ }
+\def\xweb_OptBreak{% % optional break between statements
+ \hfil \penalty\m@ne
+ \hfilneg \kern .5em \kern 2\xwebIndentUnit % discarded on line break
+ \copy\xweb_bakk
+ \ignorespaces
+ }
+\def\xweb_BigBreak{% % forced break and a little extra space
+ \Y
+ \xweb_break
+ }
+\def\xweb_ExprBreak#1{% % break with penalty #1 * 10
+ \hfil \penalty#10
+ \hfilneg % discarded on line break
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect When we increment the indentation, we must not forget to set
+% the hanging indentation immediately since |\xweb_OptBreak| relies on
+% the new value. If a continuation line is needed it will also be
+% indented one unit more, which is ok since it should be distinguishable
+% from the next line.
+% %
+% \begin{fixme}
+% Shouldn't the hanging indentation be set anew at the end of
+% |\xweb_DecrIndent| as well?
+% \end{fixme}
+%
+% \begin{macros}{\xweb_IncrIndent,\xweb_DecrIndent,\xweb_backup,
+% \xweb_noindent}
+% \begin{macrocode}
+%<*main>
+\def\xweb_IncrIndent{%
+ \global\advance\xweb_indent\xwebIndentUnit
+ \hangindent\xweb_indent
+ }
+\def\xweb_DecrIndent{\global\advance\xweb_indent -\xwebIndentUnit}
+\def\xweb_backup{\copy\xweb_bak}
+\def\xweb_noindent{% % no indentation
+ \hskip -\xweb_indent \hskip 2\xwebIndentUnit
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+% \chap Program (C or \C++) tokens.
+%
+% Since the user might want to change the (somewhat unusual) way some
+% of the operators are typeset, we supply names for them.
+%
+% \begin{macros}{\xwebAnd,\xwebEquiv,\xwebGe,\xwebLE,
+% \xwebNe,\xwebNull,\xwebNot,\xwebOr,\xwebXor}
+% \begin{macrocode}
+%<*main>
+\let\xwebAnd=\land % logical and, &&
+\let\xwebEquiv=\equiv % equiv sign, for ==
+\let\xwebGe=\ge % greater or equal
+\let\xwebLE=\le % less or equal
+\let\xwebNe=\ne % unequal, !=
+\let\xwebNull=\Lambda % NULL pointer
+\let\xwebNot=\lnot % logical not, !
+\let\xwebOr=\lor % logical or, ||
+\let\xwebXor=\oplus % bitwise exclusive or, ^
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Some symbols have to be shifted around, to save computation time
+% we put them in boxes.
+% %
+% \begin{fixme}
+% The amount of the shifting depends on the used fonts. Particularly,
+% it depends on the usage of 10\,pt fonts. We use the plain \TeX{}
+% names for these fonts since we need {\it them\/} especially, it's not
+% possible to substitute them without changing these macros. If the
+% NFSS is used with \LaTeX{} the font names are not available, we have
+% to assert that they exist and that they are preloaded.
+% \end{fixme}
+% %
+% But there is one exception where we try to define a general look: the
+% increment operator~|++|. We might want to use it for different logos,
+% nowadays it's en vogue to attach |++| to all kinds of product names.
+% We choose to use the plus sign from script size (whatever this is
+% currently), but we must be careful that it is not used as a binary
+% operation. Instead we convert it to an ordinary symbol and set a
+% back-kern in between.
+%
+% \begin{macros}{\teni,\sevensy,\xweb_pointer,\xweb_decr,\xweb_incr}
+% \begin{macrocode}
+%<*main>
+\font\teni=cmmi10
+\font\sevensy=cmsy7
+
+\newbox\xweb_pointer % pointer to struct component, ->
+\setbox\xweb_pointer=\hbox{\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
+
+\newbox\xweb_decr % decrement, --
+\setbox\xweb_decr=\hbox{%
+ \kern .5pt
+ \raise 1pt \hbox{\sevensy\char0 \kern-1pt\char0}%
+ \kern .5pt
+ }
+\newbox\xweb_incr % increment, ++
+\setbox\xweb_incr=\hbox{%
+ \kern .05em
+ \raise .1em \hbox{$\scriptstyle {+}\kern -.1em{+}$}%
+ \kern .05em
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Although the following symbols are typeset like an ``ordinary
+% \C++ programmer'' would expect them, we provide own module names
+% nevertheless. They can now be changed as well, i.e., orthogonality is
+% enhanced. (And we can use |\xweb_rebind| for assigning them to their
+% names while we switch to program state\,\dots).
+% %
+% \begin{fixme}
+% Must fix the comment on |\xwebMod|: Is C a ``modulo language''
+% or a ``remainder language.'' Well, IMHO $n
+% \mathbin{\hbox{\footnotesize\rm\%}}
+% i$ with $n < 0$ shouldn't be used anyhow\,\dots
+% \end{fixme}
+%
+% \begin{macros}{\xwebAddress,\xwebAssign,\xwebBinOr,\xwebComplement,
+% \xwebDecr,\xwebIncr,\xwebLeftShift,\xwebMod,\xwebMemberRef,
+% \xwebPointer,\xwebPointerMemberRef,\xwebRel,\xwebRightShift,
+% \xwebScope,\xwebThis}
+% \begin{macrocode}
+%<*main>
+\mathchardef\xwebAddress="2026 % `&', as binary op
+\let\xwebAssign== % assignment
+\let\xwebBinOr=\mid % binary or
+\def\xwebComplement{{\sim}} % `~', as ordinary symbol
+\def\xwebDecr{\copy\xweb_decr} % decrement
+\def\xwebIncr{\copy\xweb_incr} % increment
+\let\xwebLeftShift=\ll % left shift, <<
+\def\xwebMod{\mathbin{\hbox{\footnotesize\rm\%}}} % modulo/remainder, %
+\def\xwebMemberRef{\mathbin{.*}} % ptr to member (on object)
+\def\xwebPointer{\copy\xweb_pointer}
+\def\xwebPointerMemberRef{\mathbin{\xwebPointer*}} % ptr to member (on ptr)
+\def\xwebRel{\mathrel?} % relation operator
+\let\xwebRightShift=\gg % right shift, >>
+\def\xwebScope{\kern.1em{::}\kern.1em} % scope resolution
+
+\def\xwebThis{\xwebRes{this}} % reserved identifier `this'
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Some tokens don't have constant names, the name is supplied as
+% the argument.
+%
+% Identifiers are typeset in italics, reserved words and type names in
+% boldface, and strings in typewriter.
+% %
+% \begin{fixme}
+% The definition of the underscore in |\xwebRes| depends on a 10\,pt
+% type. Particularly, the height is 0.6\,pt and therefore 1.5~times as
+% high as the usual height (to get a bold impression). This height must
+% be adapted if another size is used. Is there a font dimension which
+% can be used as the default value for a rule?
+% \end{fixme}
+%
+% \begin{macros}{\xwebCombinedOp,\xwebId,\xwebIdLetter,\xwebRes}
+% \begin{macrocode}
+%<*main>
+\def\xwebCombinedOp#1{\mathrel{\let\K==#1}} % eg, += operator
+\def\xwebId#1{\hbox{\it#1\/\kern.05em}} % identifier, more than one char
+\def\xwebIdLetter#1{\hbox{$#1$}} % identifier, one letter
+\def\xwebRes#1{% % reserverd words and type names
+ \hbox{\bf
+ \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
+ #1\/\kern .05em
+ }%
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect In the plain version strings are typeset in the font |cmtex10|,
+% which is a typewriter font with extended ASCII characters. This font
+% does not have the usual accents and can therefore not used for
+% typesetting national characters. (Very often they are input in some
+% 8-bit encoding, the respective character code is made active and is
+% substituted by a cseq which expands to the correct glyph. Of course,
+% there are better ways, but that's the reality we have to cope with.)
+% Instead of this special font we use the standard typewriter font.
+% This has the further advantage that |cmtex10| may not be introduced
+% to NFSS\@.
+%
+% \begin{sloppypar}
+% Within strings certain cseqs have a special meaning; this is
+% introduced by |\xweb_StringSetup|. The cseqs within strings are
+% mostly accessible by their ASCII code.
+% \end{sloppypar}
+%
+% \begin{sloppypar}
+% Every once in a while we have discretionary breaks in a string,
+% denoted by |\xwebStringBreak|. This break is shown with the C
+% convention of escaped newlines.
+% \end{sloppypar}
+%
+% \begin{macros}{\xwebString,\xweb_StringSetup,\xwebStringBreak}
+% \begin{macrocode}
+%<*main>
+\def\xwebString#1{%
+ \hbox{\tt
+ \xweb_StringSetup
+ #1\kern .05em
+ }%
+ }
+\def\xweb_StringSetup{%
+ \chardef\ =`\ % % <-- two spaces !
+ \chardef\&=`\&
+ \chardef\\=`\\
+ \chardef\^=`\^
+ \chardef\_=`\_
+ \chardef\{=`\{
+ \chardef\}=`\}
+ \chardef\~=`\~
+ \def\`{`}%
+ }
+\def\xwebStringBreak{\discretionary{\hbox{\tt\char`\\}}{}{}}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Numbers are typeset in different ways. We use the definition of
+% the plain macros.
+% %
+% \begin{fixme}
+% Should add a specification of the possible input and an explanation
+% of the macros below. In particular, that the closing brace after
+% |\aftergroup| is used much later is probably not grokked by most
+% \TeX{} programmers.
+%
+% Zden\v{e}k Wagner notes that with NFSS |\rm| in math mode is a noop.
+% Have to check a clean work-around.
+% \end{fixme}
+%
+% \begin{macros}{\xweb_oct,\xweb_hex,\xwebNumber}
+% \begin{macrocode}
+%<*main>
+\def\xweb_oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
+\def\xweb_hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}
+
+\def\xwebNumber#1{% % octal, hex, or decimal constant
+ \hbox{%
+ $%
+ \def\?{\kern.2em}%
+ \def\$##1{\egroup\sb{\,\rm##1}\bgroup}% suffix to constant
+ \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
+ \let\~\xweb_oct \let\^\xweb_hex
+ {#1}%
+ $}%
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Comments are typeset in \TeX{} state. We add a hook, the user
+% shall be able to change the layout (eg, he might want another font).
+% %
+% \begin{fixme}
+% Currently \C++ comments are typeset like C comments. This is horrible
+% in usual circumstances, i.e., when complete blocks of text are prefixed
+% with |//|. We should simply catenate all these text and typeset it as
+% one paragraph, each line prefixed by |//|. But then we have to
+% implement an |\everyline| first, and since that's not so easy we
+% postpone it\,\dots
+% \end{fixme}
+% %
+% In front of a C comment there is an optional stmt break, with 2\,quad
+% in front if the line is not broken and 1.5\,quad if the line is broken.
+%
+% \begin{macros}{\xwebComment,\xwebCommentHook,\xwebCxxComment}
+% \begin{macrocode}
+%<*main>
+\def\xwebComment#1{%
+ \5% % 0.5em will be discarded on line break
+ \hskip 1.5em
+ $/\ast\,$%
+ {\xweb_tex
+ \xwebCommentHook
+ #1%
+ }%
+ $\,\ast/$%
+ }
+\let\xwebCommentHook\relax
+\let\xwebCxxComment\xwebComment
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+%
+% \chap \cweb{} tokens.
+%
+% We distinguish three categories of \cweb{} tokens: (1) Those which
+% output constant text, (2) those which have attributes to be displayed
+% in a special way, and (3) those which start a new structure element,
+% namely |@d| and~|@f|. Let's consider them in this order.
+%
+%
+% \sect \cweb{} tokens which expand in a constant string are the
+% identifier catenation operator~(`|@&|') and the macro placement
+% directive~(`|@h|').
+%
+% \begin{macros}{\xwebIdCat,\xwebMacrosHere,\xwebRefMacrosHere}
+% \begin{macrocode}
+%<*main>
+\def\xwebIdCat{\xwebString{@\&}}
+\def\xwebMacrosHere{%
+ \begingroup
+ \def\xwebRefNumber##1{}%
+ \xwebRefName :\xwebRefMacrosHere\X
+ \endgroup
+ }
+\def\xwebRefMacrosHere{Preprocessor Definitions}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Verbatim program strings, i.e., strings passed verbatim by
+% \ctangle{}~(`|@=|') are typeset like normal strings, but within a box.
+% We use 2\,pt as the separating distance, this is set locally.
+%
+% \begin{macro}{\xwebVerbString}
+% \begin{macrocode}
+%<*main>
+\def\xwebVerbString#1{{\fboxsep\tw@\p@ \fbox{\xwebString{#1}}}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The refinement names are typeset in angles, this has a long
+% tradition. We bury the typesetting of the section number (which is
+% the first parameter) in a macro call; the user may change this to
+% achieve special effects.
+% %
+% \begin{fixme}
+% One could think about handling special values of the section numbers
+% differently. Eg, an empty argument is not typeset at all, a~0 triggers
+% a marginal note about a missing definition, etc.
+% \end{fixme}
+%
+% \sect A refinement name may be typeset both in math and horizontal mode.
+% The name itself is typeset in horizontal mode, of course; for the
+% angles we need math mode. Therefore we assert at the start of the
+% macro that we're not in math mode any more. At the end we switch back
+% to math mode if we've started in it. This conditional switch from and
+% back to math mode is done by |\xweb_ToggleText|.
+%
+% \TeX{}nical note: If we're in math mode |\xweb_ToggleText| must be
+% defined globally, as it will turn off math mode and the definition
+% would be un-made then. The second invocation of |\xweb_ToggleText|
+% would be undefined then.
+%
+% \label{sec:refname-dot}
+% A refinement may also consist of the file name the expansion of this
+% refinement shall be written to. This file name is tagged with |\.|,
+% it shall be typeset like a string. But the user shall be able to use
+% the dot accent in the refinement name as well. We check if the text
+% consists solely of the tag and its argument; in this case we
+% substitute |\.| with |\xwebString|. Otherwise we leave it as it is.
+% Then a refinement name may not consist of a single dot-accented
+% expression---well, that's highly unlikely. (Nevertheless it's
+% documented in the user's manual)
+%
+% \begin{fixme}
+% I took the implementation strategy (i.e., the math mode toggle)
+% from the plain version. But
+% I don't understand why it was done this way. Why isn't it just an
+% hbox? Isn't that much simpler? Would it break something?
+% \end{fixme}
+%
+% \begin{macros}{\xwebRefName}
+% \begin{macrocode}
+%<*main>
+\def\xwebRefName#1:#2\X{%
+ \ifmmode \gdef\xweb_ToggleText{\null$\null}%
+ \else \let\xweb_ToggleText\relax
+ \fi
+ \xweb_ToggleText
+ $\langle\,${\xweb_tex \xweb_CheckDot{#2}\xwebRefNumber{#1}}$\,\rangle$%
+ \xweb_ToggleText
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The |\xwebRefNumber| macro is used in the module names in
+% program text; It switches to footnotesize and calls
+% |\xwebSetModuleNumber| to create the reference text.
+%
+% \begin{macro}{\xwebRefNumber}
+% \begin{macrocode}
+%<*main>
+\def\xwebRefNumber#1{%
+ {\reset@font \footnotesize \kern .5em%
+ \xwebSetModNrList#1.}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect There are two macros to typeset module numbers:
+% |\xwebSetModuleNumber| takes one number, and |\xwebSetModNrList|
+% takes a comma-separated list that is terminated by a period.
+% These macros must employ |\thexwebModule| to get consistent
+% numbers with nonstandard definitions of |\thexwebModule|. The
+% value of the |xwebModule| counter must be set with low-level
+% code; we cannot use |\setcounter| because it does a global set,
+% and we want to keep the change local, just for one-shot use.
+% (Else the number of the current module would be wrong after the
+% use of a module name.)
+%
+% In hypertext, every section number becomes
+% a link to the corresponding section.
+%
+% \begin{macro}{\xwebSetModuleNumber}
+% \begin{macrocode}
+%<*main>
+\def\xwebSetModuleNumber#1{{\edef\tmpnr{#1}%
+ \c@xwebModule=\tmpnr\relax
+ \xweb_hlink{\thexwebModule}}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect If we want to handle a comma-separated list of numbers, a
+% control sequence must be inserted before each element. The
+% following macros, essentially copied
+% from \texttt{pdfcwebmac.tex} (plain cweb macros modified by
+% Andreas Scherer), insert |\xweb_TagSec| before each
+% number, filter things like |\ET|, and then expand the list.
+%
+% \begin{macro}{\maketoks}
+% \begin{macrocode}
+%<*main>
+\newtoks\xweb_toksA
+\newtoks\xweb_toksB
+\newtoks\xweb_toksC
+\newtoks\xweb_toksD
+\newcount\xweb_countA
+\xweb_countA=0
+\def\xweb_AddTokens#1#2{%
+ \edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\xweb_adn#1{\xweb_AddTokens{\xweb_toksC}{#1}%
+ \global\xweb_countA=1\let\next=\maketoks}
+\def\xweb_poptoks#1#2|ENDTOKS|{%
+ \let\first=#1\xweb_toksD={#1}\xweb_toksA={#2}}
+\def\maketoks{%
+ \expandafter\xweb_poptoks\the\xweb_toksA|ENDTOKS|
+ \ifx\first0\xweb_adn0
+ \else\ifx\first1\xweb_adn1 \else\ifx\first2\xweb_adn2
+ \else\ifx\first3\xweb_adn3 \else\ifx\first4\xweb_adn4
+ \else\ifx\first5\xweb_adn5 \else\ifx\first6\xweb_adn6
+ \else\ifx\first7\xweb_adn7 \else\ifx\first8\xweb_adn8
+ \else\ifx\first9\xweb_adn9
+ \else
+ \ifnum0=\xweb_countA\else\xweb_makenote\fi
+ \ifx\first.\let\next=\xweb_tdone\else
+ \let\next=\maketoks
+ \xweb_AddTokens{\xweb_toksB}{\the\xweb_toksD}
+ \ifx\first,\xweb_AddTokens{\xweb_toksB}{\space}\fi
+ \fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next
+}
+\def\xweb_makenote{\xweb_AddTokens{\xweb_toksB}%
+ {\noexpand\xweb_TagSec{\the\xweb_toksC}}%
+ \xweb_toksC={}\global\xweb_countA=0}
+\def\xweb_tdone{\edef\st{\global\noexpand\xweb_toksA={\the\xweb_toksB}}\st}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect By defining |\xweb_TagSec| to |\xwebSetModuleNumber| we
+% can now employ |\maketoks| in |\xwebSetModNrList| to typeset a
+% list of references.
+%
+% \begin{macros}{\xweb_TagSec,\xwebSetModNrList}
+% \begin{macrocode}
+%<*main>
+\def\xweb_TagSec#1{\xwebSetModuleNumber{#1}}
+\def\xwebSetModNrList#1.{%
+ \setbox0=\hbox{\xweb_toksA={#1.}\xweb_toksB={}\maketoks}%
+ \the\xweb_toksA}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The next macro, |\xweb_CheckDot| is a hassle to implement. We
+% must check if it's argument consists solely of a `|\.|'~tag, together
+% with the argument to this tag. Then the `|\.|'-argument shall be
+% typeset like a string, |\.| itself must be ignored.
+%
+% The check for |\.| must not evaluate the parameter. Especially |\PB|
+% must not be evaluated within, it would lead to havoc with the
+% redefinition of all bindings, etc. (At least that's the empirical
+% result---it happened; although I don't know where the problems are.
+% Anyhow, it wasn't in the specs of the rebinding process.) All other
+% cseqs which shouldn't be used in moving arguments may cause problems
+% here, too. Note that |\protect| is no solution here, the user often is
+% not aware of the presence of \cweave{}-generated tags. As an example,
+% consider the refinement
+% {\tt |@< local variables of |\vbar|foo|\vbar|@>|\/} which will lead
+% to a call with the argument `|local variables of \PB{\\{foo}}|'.
+% |\\| must not be evaluated here.
+%
+% I use an approach where I hope that it will work---but to be honest,
+% I'm not sure. I want to define a macro |\next| which shall have an
+% empty expansion iff |#1| was a `|\.|'~tag with its argument. Empty
+% refinement names are not allowed so we can assume that |#1| consists
+% of at least one token. I evaluate the first token of |#1| before the
+% |\def| is done. With an appropriate binding a |\.| will disappear,
+% perhaps leaving an empty token list. I also take care that |\PB| is
+% not evaluated then, by temporary rebinding it to |\relax|. Thereby I
+% have taken care for all cseqs \cweave{} might have introduced at the
+% very front of |#1|. Other cseqs are user-tags. If they cause
+% problems, the user might circumvent them by adding |\protect|.
+%
+% \begin{macro}{\xweb_CheckDot}
+% \begin{macrocode}
+%<*main>
+\def\xweb_CheckDot#1{%
+ \begingroup
+ \let\.\@gobble
+ \let\PB\relax
+ \expandafter\def \expandafter\next \expandafter{#1}%
+ \ifx \next\empty
+ \gdef\next##1{\xwebString}%
+ \else
+ \global\let\next\relax
+ \fi
+ \endgroup
+ \next #1
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect \cweb{} macro definitions (done by~|@d|) and format
+% directives are
+% basically program text. When they are started we are already in
+% program state, i.e., |\B| has appeared in front of it. But since we have
+% an introductionary identifier (either |#define| or |format|) to set at
+% the very front we increase the indentation by three units.
+%
+% \begin{macros}{\xwebDefine,\xwebFormat,\xweb_macro}
+% \begin{macrocode}
+%<*main>
+\def\xwebDefine{\xweb_macro{\#define}}
+\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
+ \xweb_macro{format}\\{#1} \\{#2}\par\fi}
+\def\xweb_macro#1{%
+ \global\advance\xweb_indent \tw@\xwebIndentUnit
+ \xweb_IncrIndent
+ \xwebRes{#1 }% % <-- blank!
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+% \chap Section cross references and changes.
+%
+% At the end of sections with refinements, \cweave{} may output cross
+% reference information: In which sections additional definitions for
+% this refinement are found, where this refinement is used, and where it
+% is cited. This cross reference information is always introduced by a
+% tag followed by a non-empty list of section numbers. Different tags
+% are used for lists with only one element and for lists with more than
+% one element, this way the introductionary text may be adapted.
+%
+% Within a list of $n$~section numbers the first $n-1$~numbers are
+% separated by commas with one following blank. The last two numbers
+% are separated by |\ET| if~$n=2$, and by |\ETs| if~$n>2$. If a section
+% is changed by the changefile, a changeflag~(`|\*|') is appended to
+% its number. The list is eventually terminated by a full stop.
+%
+%
+% \sect We separate the cross reference information by a smallskip from
+% the refinement or from a previous cross reference information. The
+% information itself is typeset in a smaller font, as it is auxilliary,
+% inserted stuff. The number list has a hanging indentation of
+% |\xwebNumberListHangindent|. But beware: This isn't a dimension
+% register, it's a macro. This way one can use ems as dimensions.
+%
+% We must assert that we're in CR state while we set a cross reference.
+%
+% The first parameter of a cross reference information unit is the
+% introductionary text, the second is the number list. The parameters
+% must be evaluated in a group---local parameter changes therein must
+% not influence the environment. The list must be passed to
+% |\xwebSetModNrList| to typeset (and hyperreference) them correctly.
+%
+% \begin{macros}{\xwebNumberListHangindent,\xwebCrossRef}
+% \begin{macrocode}
+%<*main>
+\def\xwebNumberListHangindent{2em}
+\def\xwebCrossRef#1#2.{%
+ \par\smallskip% (= \Y)
+ \xweb_CR%
+ \begingroup%
+ \reset@font \footnotesize%
+ \noindent \hangindent\xwebNumberListHangindent%
+ #1~\xwebSetModNrList #2..\par%
+ \endgroup%
+ }%
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Well, let's define all introducing tags, which in fact start the
+% cross reference information unit. The number list is gathered by
+% |\xwebCrossRef|.
+%
+% \begin{macros}{\xwebCRAlso,\xwebCRCite,\xwebCRUse,
+% \xwebCRsAlso,\xwebCRsCite,\xwebCRsUse}
+% \begin{macrocode}
+%<*main>
+\def\xwebCRAlso{\xwebCrossRef{See also section}}
+\def\xwebCRsAlso{\xwebCrossRef{See also sections}}
+
+\def\xwebCRCite{\xwebCrossRef{This code is cited in section}}
+\def\xwebCRsCite{\xwebCrossRef{This code is cited in sections}}
+
+\def\xwebCRUse{\xwebCrossRef{This code is used in section}}
+\def\xwebCRsUse{\xwebCrossRef{This code is used in sections}}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The changeflag is set as a star.
+%
+% \begin{macros}{\xwebChangeFlag,\xwebCREt,\xwebCRsEt}
+% \begin{macrocode}
+%<*main>
+\let\xwebChangeFlag=*
+\def\xwebCREt{ and~}
+\def\xwebCRsEt{, and~}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+% \chap Including the web file. Because the web document is
+% included by the |\webfile| command, we have an easy way to
+% handle the index and list of refinements at the end; this is done
+% by the |\webfile| command itself.
+%
+% \sect As outlined above, we want to check if there are any entries in
+% the identifier index or the refinement list. The former is stored in
+% the file |\xwebJobname.idx|, the latter in the file |\xwebJobname.scn|.
+% For each of these files exists a flag named |xweb_|{\it
+% ext\/}|Entries| (where $\it ext \in \{ |idx|, |scn| \}$ is the
+% extension of the appropriate file) which tells if there are any
+% entries of the respective category.
+%
+% \begin{macros}{\ifxweb_idxEntries,\ifxweb_scnEntries}
+% \begin{macrocode}
+%<*main>
+\newif\ifxweb_idxEntries
+\newif\ifxweb_scnEntries
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect We consider a file as ``without entries'' if (1)~the file does
+% not exist, (2)~is empty, or (3)~has an empty line at the very front.
+% (In fact, case~(3) means that there should not be anything behind
+% it---but we can't test this portably.)
+%
+% |\xweb_HasEntries| tests the property, it's parametrized by the
+% extension. As a result, it sets the respective flag.
+%
+% We open the file first. Then we check if it doesn't exist or if it's
+% empty, both conditions deliver true on |\ifeof|; in this case we
+% pretend that there was an empty line. (The \LaTeX{} kernel
+% already provides
+% a macro for an empty line, |\@defpar|.) Otherwise we read the first
+% line. At this state, the emptiness of the first line is equivalent to
+% the non-availability of entries, we can easily construct an
+% appropriate macro call to set the flag.
+%
+% \begin{macros}{\xweb_TmpFile,\xweb_HasEntries}
+% \begin{macrocode}
+%<*main>
+\newread\xweb_TmpFile
+\def\xweb_HasEntries#1{%
+ \openin\xweb_TmpFile \xwebJobname.#1\relax
+ \ifeof \xweb_TmpFile
+ \let\next\@defpar
+ \message{No #1 file present for \xwebJobname !}
+ \else
+ \read\xweb_TmpFile to \next
+ \fi
+ \csname xweb_#1Entries%
+ \ifx \next\@defpar false%
+ \else true%
+ \fi
+ \endcsname
+ \closein\xweb_TmpFile
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+%
+% \sect Every web document can have its own table of contents.
+% It is stored in a file that has the web name as basename, and
+% extension \texttt{.con}.
+% The control sequence |\ZZ| is used to tag the entries.
+% |\xwebContents| typesets the table of contents.
+% |\xwebSetModuleNumber| is used here to typeset the section
+% number and possibly create a hyperlink.
+%
+% \begin{macros}{\ZZ,\xweb_contentsline,\xweb_cont,\xweb_consetup}
+% \begin{macrocode}
+%<*main>
+\newwrite\xweb_cont
+\let\ZZ=\let % now you can \write the control sequence \ZZ
+\def\xweb_contentsline#1#2#3#4{%
+ \ifnum#2=0 \smallbreak\fi
+ \hbox to \textwidth{\xweb_consetup{#2}#1
+ \rm\leaders\hbox to .5em{.\hfil}\hfil\ %
+ \xwebSetModuleNumber{#3}
+ \hbox to3em{\hss#4}}}
+\def\xweb_consetup#1{\ifcase#1 \bf % depth -1 (@**)
+ \or % depth 0 (@*)
+ \or \hskip2em % depth 1 (@*1)
+ \or \hskip4em % depth 2 (@*2)
+ \or \hskip6em % depth 3 (@*3)
+ \or \hskip8em % depth 4 (@*4)
+ \or \hskip10em % depth 5 (@*5)
+ \else \hskip12em \fi} % depth 6 or more
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect PDF\TeX\ will add an outline entry referring to the table
+% of contents.
+%
+% \begin{macros}{\xwebContents,\xwebSectionName,\xwebPageName}
+% \begin{macrocode}
+%<*main>
+\def\xwebContents#1{
+ \def\readcontents{\IfFileExists{#1.con}{\input #1.con}{}}
+ \begingroup
+ \xwebContentsTop
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{#1:contents} fith
+ \pdfoutline goto name{#1:contents}{#1}
+ \fi
+ \hbox to \textwidth{\hfil
+ \xwebSectionName\hbox to3em{\hss \xwebPageName}}
+ \let\ZZ=\xweb_contentsline
+ \readcontents\relax % read the contents info
+ \xwebContentsBot % print the contents page(s) and terminate
+ \endgroup
+}
+\def\xwebSectionName{Section}
+\def\xwebPageName{Page}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The |\xweb_InputWebfile| macro disables |\inx| etc., adds a
+% List Of Programs entry, inputs the web document and finishes it
+% with some code that was stolen from |\cweb@end_document| and
+% |\cweb@finish|. We don't need these macros themselves as there
+% should be no |\end{document}| in the web file.
+%
+% Note that there are two `jobnames': the |\jobname| of the main
+% document and the |\xwebJobname| of the included web document.
+%
+% To get the jobname, we strip off the optional filename extension
+% with |\setname|, using its special parameter syntax. |##1| will
+% be the basename of the file; |##2| will be the extension, if
+% present. |##3| will only be set if the extension has mutltiple
+% parts; it also makes it possible to eat up the second dot, that
+% must be there to delimit the parameter text in case there is no
+% extension. We assume that there are no forward slashes in the
+% filename, so the forward slash can be used to delimit the third
+% parameter.
+%
+% The flag |\xweb_FirstModule| is made true so we can find out
+% later if we are typesetting the first module (the table of
+% contents is set then).
+%
+% \begin{macros}{\xwebContentsTop,\xwebContentsBot,\xweb_InputWebfile}
+% \begin{macrocode}
+%<*main>
+\def\xwebContentsTop{\vskip.2in}
+\def\xwebContentsBot{\par\bigskip}
+\def\xweb_InputWebfile#1{
+ \def\setname##1.##2.##3/{\gdef\xwebJobname{##1}}
+ \setname #1../
+ \ifnum\c@xwebLopDepth > -10 % entry to the list of programs:
+ \addcontentsline{lop}{program}{\xwebJobname}
+ \fi
+ \def\xwebContentsTop{\centerline{\textbf{\xwebJobname}}\vskip.2in}
+ \def\xwebContentsBot{\par\bigskip}
+ \global\xweb_FirstModuletrue
+ \begingroup
+ \let\inx\relax
+ \let\fin\relax
+ \let\con\relax
+ \let\ch\xwebCRChanged
+ \input{#1}
+ \ifon \end{xwebModule} \fi % end the last module (if it is on).
+ \endgroup
+ % process the index and list of refinements ...
+ \ifxwebIndex\xweb_HasEntries{idx}%
+ \ifxweb_idxEntries \xwebIdIndex{\xwebJobname.idx}\fi\fi
+ \ifxwebRef\xweb_HasEntries{scn}%
+ \ifxweb_scnEntries \xwebRefList{\xwebJobname.scn}\fi\fi
+ % clean up:
+ \closeout\xweb_cont
+ \onfalse % don't end the last section when starting the first section of
+ % the next web.
+ \xweb_UserBindings % back to the main document
+}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect |\xwebIdIndex| and |\xwebRefList| have a
+% filename argument, so that they can also be employed by the user
+% to create an index or refinement list for any web document in
+% any place, or to combine the indexes of several documents by
+% processing them with the |sort| program an including the result.
+% This can be particularly worthwile for authors of large,
+% multi-file software packages who want to have a global index of
+% their global variables, but they should almost certainly hack
+% the faked index file with a perl script or something alike to
+% mention also the filenames, because section numbers are not
+% unique through a set of web documents.
+%
+% We add two special macros for this purpose, however, to take care
+% of things that are necessary to handle an index or reflist outside
+% the context of a web document.
+%
+% \begin{macros}{\xwebInputIndex,\xwebInputReflist}
+% \begin{macrocode}
+%<*main>
+\def\xwebInputIndex#1{{
+ \def\setname##1.##2\\{%
+ \edef\xwebJobname{##1}
+ \ifx\\##2\\%
+ \edef\ext{idx}
+ \else
+ \edef\ext{\chop##2\\}%
+ \fi}
+ \def\chop##1.\\{##1}
+ \expandafter\setname#1.\\
+ \xwebIdIndex{\xwebJobname.\ext}
+}}
+\def\xwebInputReflist#1{{
+ \def\setname##1.##2\\{%
+ \edef\xwebJobname{##1}
+ \ifx\\##2\\%
+ \edef\ext{scn}
+ \else
+ \edef\ext{\chop##2\\}%
+ \fi}
+ \def\chop##1.\\{##1}
+ \expandafter\setname#1.\\
+ \xwebRefList{\xwebJobname.\ext}
+}}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The |\ifstr| macro compares its first and second
+% arguments; if
+% they are equal it executes the third argument. It is necessary
+% that |\edef| is used here to expand the arguments!
+%
+% \begin{macro}{\ifstr}
+% \begin{macrocode}
+%<*main>
+\def\ifstr#1#2#3{%
+ \edef\xweb_tempa{#1}%
+ \edef\xweb_tempb{#2}%
+ \ifx\xweb_tempa\xweb_tempb #3\fi
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The |\webfile| macro has an optional argument, that may
+% contain
+% a comma-separated list of options. |\webfile| expands into
+% |\xweb_file|, with the optional argument always present, but
+% possibly empty.
+%
+% \begin{macro}{\webfile}
+% \begin{macrocode}
+%<*main>
+\def\webfile{\@ifnextchar[%
+ {\xweb_file}{\xweb_file[]}}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The square-braced argument is mandatory for |\xweb_file|.
+% The comma-separated list of options is processed using a
+% |\@for| loop.
+% The macro will complain if an unknown option is
+% encountered.
+% After that, |\xweb_InputWebfile| is called to do the real work.
+% Default values for all options will be copied from their global
+% equivalents (specified with the |\usepackage| command).
+%
+% \begin{macros}{\xweb_off,\xweb_on,\xweb_file,\cwebfile}
+% \begin{macrocode}
+%<*main>
+\newif\if@opt
+\def\xweb_off{\let\maybe=\iffalse}
+\def\xweb_on{\let\maybe=\iftrue}
+\def\xweb_file[#1]#2{
+ \ifxweb_GlobalIndex\xwebIndextrue\else\xwebIndexfalse\fi
+ \ifxweb_GlobalRef\xwebReftrue\else\xwebReffalse\fi
+ \ifxweb_GlobalRagged\xwebRaggedtrue\else\xwebRaggedfalse\fi
+ \ifxweb_GlobalOC\xweb_off\else\xweb_on\fi
+ \ifxweb_GlobalCon\xwebContrue\else\xwebConfalse\fi
+ \ifxweb_GlobalHideFormats\xwebHideFormatstrue\else
+ \xwebHideFormatsfalse\fi
+ \xweb_hypertype=\xweb_GlobalHypertype
+ \@for\xweb_opt:=#1\do{
+ \typeout{webfiles option: \xweb_opt}
+ \@optfalse
+ \ifstr{\xweb_opt}{index}{\xwebIndextrue\@opttrue}
+ \ifstr{\xweb_opt}{noindex}{\xwebIndexfalse\@opttrue}
+ \ifstr{\xweb_opt}{reflist}{\xwebReftrue\@opttrue}
+ \ifstr{\xweb_opt}{noreflist}{\xwebReffalse\@opttrue}
+ \ifstr{\xweb_opt}{raggedbottom}{\xwebRaggedtrue\@opttrue}
+ \ifstr{\xweb_opt}{flushbottom}{\xwebRaggedfalse\@opttrue}
+ \ifstr{\xweb_opt}{onlychanges}{\xweb_off\@opttrue}
+ \ifstr{\xweb_opt}{allsections}{\xweb_on\@opttrue}
+ \ifstr{\xweb_opt}{nocon}{\xwebConfalse\@opttrue}
+ \ifstr{\xweb_opt}{contents}{\xwebContrue\@opttrue}
+ \ifstr{\xweb_opt}{hideformats}{\xwebHideFormatstrue\@opttrue}
+ \ifstr{\xweb_opt}{showformats}{\xwebHideFormatsfalse\@opttrue}
+ \ifstr{\xweb_opt}{hyperref}{\xweb_hypertype=1\@opttrue}
+ \ifstr{\xweb_opt}{pdftex}{\xweb_hypertype=2\@opttrue}
+ \ifstr{\xweb_opt}{nohype}{\xweb_hypertype=0\@opttrue}
+ \if@opt\else\PackageError{webfiles}{%
+ Unknown option for the \protect\webfile\space command
+ }{Possible options are: index, noindex,
+ reflist, noreflist, \MessageBreak
+ raggedbottom, flushbottom, onlychanges,
+ allsections,\MessageBreak
+ nocon, contents, hideformats, showformats,
+ hyperref, pdftex, nohype}
+ \fi
+ }
+ \xweb_SetupHrefs
+ \xweb_InputWebfile{#2}}
+\let\cwebfile\webfile
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The list of changed sections is a cross reference list, (nearly)
+% like all others at the end of a section. The only difference is that
+% we do not show changeflags any more---each section number in this list
+% carries a change flag by definition.
+%
+% \TeX{}nical note: The redefinition of |\*| is part of the second
+% argument of |\xwebCrossRef|. It is {\it not\/} a global redefinition.
+%
+% \begin{macro}{\xwebCRChanged}
+% \begin{macrocode}
+%<*main>
+\def\xwebCRChanged{%
+ \xwebCrossRef{The following sections were changed by the change file:}%
+ \let\*\relax
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The identifier index is available in the file
+% |\xwebJobname.idx|.
+% The setup for the index is a mixture of the |theindex| environment
+% of the |article| style and DEK's index macros. It's typeset in two
+% columns; the user may specify an introductionary text for the index
+% by |\xwebIndexIntro|. If there is any introductionary text we add a
+% medium skip below.
+%
+% The paragraph layout is taken from the plain version: Each index
+% entry is a paragraph, nearly no skip between the paragraphs (just a
+% bit to prevent underfull vboxes), no paragraph indentation, ragged
+% right---but the |\parfillskip| set in such a way that almost empty
+% lines are avoided. Overfull hboxes in the index doesn't make
+% sense, so we prevent them. And we don't allow hyphenation in the
+% index, it's an identifier index after all.
+%
+% Before we read in this file, we have to bind the special cseqs used
+% therein.
+%
+% \begin{macros}{\xwebIndexIntro,\xwebIndexName}
+% \begin{macrocode}
+%<*main>
+\newtoks\xwebIndexIntro
+ \xwebIndexIntro={}
+\def\xwebIndexName{Index of \texttt{\xwebJobname}}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The following text is set as the header of the index.
+%
+% \begin{macro}{\xweb_IndexTop}
+% \begin{macrocode}
+%<*main>
+\def\xweb_IndexTop{
+ \xweb_tex
+ \par\vskip 1cm plus 10mm minus 5mm\noindent
+ {\bf \xwebIndexName}%\nopagebreak\par\medskip\nopagebreak
+ %% skip already inserted by xweb_twocolumn env.
+ \edef\intro{\the\xwebIndexIntro}% % is a local def
+ \ifx \intro\empty
+ \else
+ \noindent\the\xwebIndexIntro\unskip
+ \par\medskip
+ \fi
+}
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect If the |multicol| package is available, it will be used
+% to typeset the identifier index. The |\RequirePackage| command
+% must however be placed after |\ProcessOptions|, at the end
+% of the package file.
+%
+% If the twocolumn class option is in effect, multicols cannot be
+% used; in particular, the title (ieee.cls) would be set in one
+% column. It isn't necessary too, we are in two columns already.
+%
+% \begin{macro}{\ifxweb_multicol}
+% \begin{macrocode}
+%<*main>
+\newif\ifxweb_multicol \xweb_multicolfalse
+\IfFileExists{multicol.sty}{
+ \if@twocolumn\else\xweb_multicoltrue\fi
+}{}
+\ifxweb_multicol
+ \newenvironment{xweb_twocolumn}{\begin{multicols}{2}}{\end{multicols}}
+\else
+ \newenvironment{xweb_twocolumn}{
+ \if@twocolumn\else
+ \columnseprule\z@
+ \columnsep 35\p@ % value is from article.sty
+ \fi
+ \twocolumn%
+ }{
+ \onecolumn}
+\fi
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Now |\xwebIdIndex| itself. PDF\TeX\ will add an outline
+% entry for the index.
+%
+% \begin{fixme}
+% |vfil| before |\xweb_IndexTop| is still not strong enough!
+% A pagebreak can occur just after it.
+% \end{fixme}
+%
+% \begin{macros}{\xwebJobName,\xweb_SetupIndex,\xweb_FinishIndex,
+% \xwebIdIndex}
+% \begin{macrocode}
+%<*main>
+\def\xwebJobName{noname}
+\def\xweb_SetupIndex{%
+ \begin{xweb_twocolumn}[\xweb_IndexTop]
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{\xwebJobname:index} fith
+ \pdfoutline goto name{\xwebJobname:index}{Index}
+ \fi
+ % go to CR mode
+ \xweb_CR
+ \message{*index: }% % tell the user what we're doing
+ % paragraph layout
+ \begingroup
+ \parskip \z@ plus .5\p@
+ \parindent\z@
+ \rightskip \z@ plus 2.5em
+ \parfillskip \z@ plus .6\hsize
+ \tolerance\@M \hyphenpenalty\@M
+ % bindings
+ \let\I\xwebIndexEntry
+ \let\[\xwebIndexDeclared
+ \let\*\xwebLapStar
+}
+\def\xweb_FinishIndex{
+ \endgroup
+ \end{xweb_twocolumn}
+}
+\def\xwebIdIndex#1{%
+ \xweb_SetupIndex
+ \@input{#1}
+ \xweb_FinishIndex
+}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect An index entry is typeset with the same hanging indentation as`
+% a cross reference list.
+%
+% The entry is tagged with |\.|, if it was entered by the \cweb{}
+% operator~`|@.|'. Then it shall be typeset as a string. But an indexed
+% name may also want to use |\.| as an accent. This is the same
+% situation we had at the refinement names (see
+% section~\ref{sec:refname-dot}), where we introduced |\xweb_CheckDot|
+% to handle this case. The same minor restriction as there holds here,
+% a refinement name may not consist of a single dot-accented
+% expression. (|@:|~helps in this singular case.)
+%
+% \begin{macro}{\xwebIndexEntry}
+% \begin{macrocode}
+%<*main>
+\def\xwebIndexEntry#1,#2.{%
+ \par
+ \hangindent\xwebNumberListHangindent
+ \leavevmode
+ \xweb_CheckDot{#1}:\quad\xwebSetModNrList #2.
+ }
+%</main>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The sections where identifiers are declared are noted with
+% underlined numbers. We also must not forget the default declaration of
+% |\9|, the tag for the user definable index layout.
+%
+% \begin{macros}{\xwebIndexDeclared,\9}
+% \begin{macrocode}
+%<*main>
+\def\xwebIndexDeclared#1]{\underline{#1}}
+\def\9#1{}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The list of the refinement names is available in the file
+% |\xwebJobname.scn|. The layout is taken from the plain version: ragged
+% right, each entry is a paragraph, the different cross reference
+% categories are separated by a quad.
+%
+% We must restore |\parfillskip| and |\*| since it was changed in the
+% index.
+%
+% \begin{macros}{\xwebJobname,\xwebReflistName,\xwebRLCite,
+% \xwebRLsCite,\xwebRLUse,\xwebRLsUse}
+% \begin{macrocode}
+%<*main>
+\def\xwebReflistName{List of Refinements in \texttt{\xwebJobname}}
+\def\xwebRLCite{\xwebCrossRef{Cited in section}}
+\def\xwebRLsCite{\xwebCrossRef{Cited in sections}}
+\def\xwebRLUse{\xwebCrossRef{Used in section}}
+\def\xwebRLsUse{\xwebCrossRef{Used in sections}}
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \begin{macros}{\xwebRefList,\xweb_SetupReflist}
+% \begin{macrocode}
+%<*main>
+\def\xweb_SetupReflist{%
+ \vskip 3ex plus 7ex minus 1ex
+ \xweb_tex
+ \noindent
+ {\bf \xwebReflistName}\nopagebreak\par\bigskip\nopagebreak
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{\xwebJobname:reflist} fith
+ \pdfoutline goto name{\xwebJobname:reflist} {Refs}
+ \fi
+ \xweb_CR
+ \message{*list of refinements: }%
+ % paragraph layout: like in index, but
+ \parfillskip\@flushglue
+ \begingroup % different bindings...
+ \def\I{\par \hangindent\xwebNumberListHangindent}%
+ \def\xwebCrossRef##1##2.{\quad {\reset@font\footnotesize
+ ##1~\xwebSetModNrList ##2..}}%
+ \def\Q {\xwebRLCite}%
+ \def\Qs{\xwebRLsCite}%
+ \def\U {\xwebRLUse}%
+ \def\Us{\xwebRLsUse}%
+ \let\*\xwebChangeFlag
+}
+\def\xwebRefList#1{%
+ \xweb_SetupReflist
+ \@input{#1}
+ \endgroup
+ }
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \noindent The redefinition of |\xwebCrossRef| etc.~must be done locally
+% to prevent troubles with trailing web files: Crossref info in these
+% files would be indented!
+%
+%
+%
+% \chap Bells and whistles.
+%
+% \begin{fixme}
+% Just copied from the plain version. It doesn't work
+% anyhow---|\char"|{\it xy\/} usually doesn't typeset the correct
+% character. That's because this character is most probably an active
+% character; at least that's typical for the way \TeX{} systems are
+% used in Europe. I have to think about the implementation.
+% \end{fixme}
+%
+% \begin{macros}{\ATL,\postATL,\noATL,\noatl}
+% \begin{macrocode}
+%<*main>
+\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
+%</main>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Option processing will be done at the end of the package
+% file. We must restore our catcode and are finished.
+%
+% \begin{macrocode}
+%<*main>
+\ProcessOptions
+\ifxweb_multicol
+ \RequirePackage{multicol}
+\fi
+\catcode`\_=\xwebCatUsCode
+%\endinput
+%</main>
+% \end{macrocode}
+%
+%
+% \chap Spidery Webs.
+%
+% The file |swebbind.sty| redefines some macros to let the above
+% things work with web systems generated with Spider.
+% This file is input by |webkernel.tex|, as provided with the
+% webfiles distribution.
+% As it is eventually input by the |\webfile| command, it is
+% inside a group that encloses the entire web document, so the
+% scope of these redefinements is automatically limited to a single
+% web: we need no ``|cwebbind.sty|'' or such.
+%
+%
+% \sect First, make the underscore usable in private control
+% sequences, as in |webfiles.sty|:
+%
+% \begin{macrocode}
+%<*spider>
+\catcode`\_=\xwebCatLetter
+\catcode`\@=\xwebCatLetter
+%</spider>
+% \end{macrocode}
+%
+%
+% \sect Some miscellaneous\ldots
+%
+% \begin{macros}{\amp,\SS,\PP}
+% \begin{macrocode}
+%<*spider>
+\let\amp\& % ampersand
+\let\SS\S % section sign
+\let\PP\P % paragraph sign
+%</spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The main section tag will be a mixture of |webfiles| and
+% |webkernel.tex|:
+%
+% |#1| = number
+%
+% |#2| = (level and) title
+%
+% \begin{macro}{\N}
+% \begin{macrocode}
+%<*spider>
+\def\N#1.#2.{%
+ \ifon\end{xwebModule}\fi % webfiles
+ \global\xwebGroupLevel 0% default value for group level
+ \xweb_headcheck#2\xweb_headcheck % spider: get group level and title
+ {\let\*=\empty%
+ \xdef\xweb_secno{#1}% webfiles: get the section number
+ }%
+ \message \expandafter{*\xweb_secno}%
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}{\bf\xweb_ModTitle.}%
+ % \xweb_ModTitle is generated by \xweb_headcheck.
+ %\hskip 1em plus.1em minus.1em%
+ \xweb_SpiderLopEntry{\xwebGroupLevel}%
+}
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The entries in the list of programs and the web's own
+% table of
+% contents are handled by |\xweb_SpiderLopEntry|. We have to use
+% |\@unexpandable@protect|; else there will be trouble with
+% insertion of |\xweb_ModTitle| in the contents file.
+%
+% \begin{macro}{\xweb_SpiderLopEntry}
+% \begin{macrocode}
+%<*spider>
+\def\xweb_SpiderLopEntry#1{%
+ \ifnum\c@xwebLopDepth > \xwebGroupLevel
+ \addcontentsline{lop}{starred}{%
+ \protect\global\xwebGroupLevel #1 \thexwebModule.~\xweb_ModTitle}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{\xweb_ModTitle}{\the\xwebGroupLevel}%
+ {\xweb_secno}{\noexpand\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ \ifnum\c@xwebOutlineDepth > \xwebGroupLevel
+ \xwebPDFOutline{\xweb_secno}{\xweb_ModTitle}% args: nr, title
+ \fi}
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The following is from |webkernel|, with small additions for
+% |webfiles|.
+% This stuff is to allow inital |=|, |1|, |2|, |3|, |4| in starred
+% modules.
+% |=| means ``part'', don't skip page.
+% Normal starred module is |1|. 2--4 are submodules, and are
+% indented.
+%
+% \begin{tabular}{ll}
+% |@*=| & bold name in table of contents\\
+% & causes page eject\\
+% & suppresses page eject following\\
+% |@*1,2| & first level of indentation\\
+% |@*3,4| & second level of indentation\\
+% |@*1,3| & cause page eject\\
+% |@*2,4| & don't cause page eject
+% \end{tabular}
+%
+% \begin{macros}{\ifxweb_cancel,\xweb_ifnextchar,\xweb_ifnch,
+% \xweb_makethechar,\xweb_headcheck}
+% \begin{macrocode}
+%<*spider>
+\newif\ifxweb_cancel\xweb_canceltrue
+\def\xweb_ifnextchar#1#2#3{\let\@tempe=#1\def\@tempa{#2}\def\@tempb{#3}%
+ \xweb_ifnch}
+\def\xweb_ifnch{%
+ \ifx \@tempc \@tempe\let\@tempd\@tempa
+ \else\let\@tempd\@tempb\fi
+ \@tempd}
+\def\xweb_makethechar#1{\let\@tempc=#1}
+
+\def\xweb_headcheck#1#2\xweb_headcheck{%
+ \xweb_makethechar{#1}%
+ \def\theskipper{\vskip 3pt}%
+ % extra skip before new starred module
+ \def\xweb_ModTitle{{#2}}%
+ \xweb_ifnextchar={% % @*= title.
+ \global\xwebGroupLevel 0% webfiles
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ \xweb_canceltrue
+ }{\xweb_ifnextchar1{% % @*1 title.
+ \global\xwebGroupLevel 1% webfiles
+ \xweb_cancelfalse
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ }{\xweb_ifnextchar2{% % @*2 title.
+ \global\xwebGroupLevel 2% webfiles
+ \xweb_cancelfalse
+ }{\xweb_ifnextchar3{% % @*3 title.
+ \global\xwebGroupLevel 3% webfiles
+ \xweb_cancelfalse
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ }{\xweb_ifnextchar4{% % @*4 title.
+ \global\xwebGroupLevel 4% webfiles
+ \xweb_cancelfalse
+ }{% else % @* title.
+ \global\xwebGroupLevel 0% webfiles
+ \ifxweb_cancel\else
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \def\theskipper{\xwebMainSecSkip}%
+ \fi
+ \fi
+ \xweb_cancelfalse
+ \def\xweb_ModTitle{#1{#2}}%
+ }}}}}%
+ \theskipper
+}
+%</spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Surround text in vertical bars: (already tagged with |\PB|
+% in Spider 3.0)
+%
+% \begin{macro}{\CD}
+% \begin{macrocode}
+%<*spider>
+\def\CD#1\DC{#1}
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Go into program mode:
+% this is |\P| in spider and |\B| in cweb.
+%
+% \begin{macro}{\P}
+% \begin{macrocode}
+%<*spider>
+\def\P{\B}
+%\let\P\B
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Spidery WEAVE Bindings:
+% these are a little different from the CWEAVE bindings.
+%
+% \begin{macros}{\xweb_CweaveBindings,\0,\1,\2,\3,\4,\5,\6,\7,\8,
+% \?,\AND,\CM,\DC,\S,\G,\GG,\I,\K,\LL,\MOD,\NULL,\R,\OR,\PA,
+% \this,\V,\W,\XOR,\L,\MG,\MGA,\MM,\PP,\.,\),\O,\MRL,
+% \C,\SHC,\X,\XF,\ATH,\D,\F,\J,\=,\*,\A,\As,\Q,\Qs,\U,\Us,
+% \ET,\ETs,\xweb_UserBindings}
+% \begin{macro}{\\}
+% \begingroup\catcode`\&=12 \catcode`\|=12
+% \begin{macro}{\&}
+% \begin{macro}{\|}
+% \endgroup
+% \begin{macrocode}
+%<*spider>
+\def\xweb_CweaveBindings{%
+ \ifx \xweb_UserBindings\relax
+ \xweb_rebind
+ % indentation and paragraph layout
+ \xweb_break \0% % SPIDER
+ \xweb_IncrIndent \1%
+ \xweb_DecrIndent \2%
+ \xweb_ExprBreak \3%
+ \xweb_backup \4%
+ \xweb_OptBreak \5%
+ \xweb_break \6%
+ \xweb_BigBreak \7%
+ \xweb_noindent \8%
+ % C/C++ tokens
+ \xwebRel \?%
+ \xwebAddress \AND
+ \xwebComplement \CM
+ \xwebScope \DC
+ \xwebEquiv \S % SPIDER
+ \xwebGe \G
+ \xwebRightShift \GG
+ \xwebNe \I
+ \xwebAssign \K
+ \xwebLeftShift \LL
+ \xwebMod \MOD
+ \xwebNull \NULL
+ \xwebNot \R
+ \xwebBinOr \OR
+ \xwebMemberRef \PA
+ \xwebThis \this
+ \xwebOr \V
+ \xwebAnd \W
+ \xwebXor \XOR
+ \xwebLE \L % SPIDER
+ \xwebPointer \MG
+ \xwebPointerMemberRef \MGA
+ \xwebDecr \MM
+ \xwebIncr \PP
+ % more tokens
+ \xwebId \\%
+ \xwebIdLetter \|%
+ \xwebRes \&%
+ \xwebString \.% %% ( ...Emacs...
+ \xwebStringBreak \)%
+ \xwebNumber \O % SPIDER
+ \xwebCombinedOp \MRL
+ % goes to TeX state
+ \xwebComment \C
+ \xwebCxxComment \SHC
+ \xwebRefName \X
+ \xwebSpiderOutputFileName \XF
+ % CWEB tokens
+ \xwebMacrosHere \ATH
+ \xwebDefine \D
+ \xwebFormat \F
+ \xwebIdCat \J
+ \xwebVerbString \= % SPIDER
+ % cross reference tags
+ \xwebChangeFlag \*%
+ \xwebCRAlso \A
+ \xwebCRsAlso \As
+ \xwebCRCite \Q
+ \xwebCRsCite \Qs
+ \xwebCRUse \U
+ \xwebCRsUse \Us
+ \xwebCREt \ET
+ \xwebCRsEt \ETs
+ % finish the list
+ \stop\stop
+ \def\xweb_UserBindings{%
+ \xweb_RestoreBindings
+ \let\xweb_UserBindings\relax
+ }%
+ \fi
+ }
+%</spider>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macros}
+%
+%
+% \sect |\B| in spider is Begin controlled comment.
+% But there are no controlled comments in Spider, so
+% we can leave it out.
+%
+% |\def\B{\mathopen{\.{@\commentbegin}}}|
+%
+%
+% \sect In spider, the argument of |\M| is ended by a period.
+% The meaning of the tag is the same.
+%
+% \begin{macro}{\M}
+% \begin{macrocode}
+%<*spider>
+\def\M#1.{%
+ \ifon\end{xwebModule}\fi
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}
+ \ifnum\c@xwebLopDepth>9
+ \addcontentsline{lop}{xwebsection}{%
+ \protect\global\xwebGroupLevel 4 \thexwebModule.}%
+ \edef\next{\write\xweb_cont{\ZZ{}{4}{\xweb_secno}%
+ {\thepage}}}\next % \ZZ{title}{depth}{sec}{page}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{}{4}{\xweb_secno}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ }
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect The index and the list of refinements are not given in |.inx|
+% and |.scn| files,
+% but in the |.tex| file itself.
+% Furthermore, they are tagged a little differently:
+% \begin{quote}
+% \verb"\inx"\\
+% \meta{index}\\
+% \verb"\fin"\\
+% \meta{reflist}\\
+% \verb"\con"
+% \end{quote}
+%
+% \begin{macros}{\inx,\fin,\con}
+% \begin{macrocode}
+%<*spider>
+\def\inx{
+ \ifxwebIndex
+ \xweb_SetupIndex
+ \def\:{\I}
+ \else
+ \def\:##1.{} % gobble \:\\{foo} 1, 2, 3.
+ \fi
+}
+\def\fin{
+ \ifxwebIndex
+ \xweb_FinishIndex
+ \fi
+ \ifxwebRef
+ \xweb_SetupReflist
+ \def\:{\I}
+ \else
+ \def\:{}
+ \def\XF##1\XF{}
+ \def\X##1\X{}
+ \def\U##1.{}
+ \def\Us##1.{}
+ \def\ET##1.{}
+ \def\ETs##1.{}
+ \fi
+}
+\def\con{
+ \ifxwebRef
+ \endgroup
+ \fi
+}
+%</spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Comments in Spider are not fixed; rather, the cseqs
+% |\commentbegin| and |\commentend| are set in |xweb.tex|.
+%
+% \begin{macros}{\xwebComment,\xwebCommentHook,\xwebCxxComment}
+% \begin{macrocode}
+%<*spider>
+\def\xwebComment#1{%
+ \5% % 0.5em will be discarded on line break
+ \hskip 1.5em
+ \commentbegin%
+ {\xweb_tex
+ \xwebCommentHook
+ #1%
+ }%
+ \commentend%
+ }
+\let\xwebCommentHook\relax
+\let\xwebCxxComment\xwebComment
+%</spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect Macro definitions are not translated into preprocessor
+% directives; Spidery
+% webs expand these themselves. Therefore they should not look like
+% preprocessor directives: the `|#|' must be left out.
+%
+% \begin{macros}{\xwebDefine,\xwebFormat}
+% \begin{macrocode}
+%<*spider>
+\def\xwebDefine{\xweb_macro{define}}
+%\def\xwebFormat{\4\xweb_macro{format}}
+\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
+ \4\xweb_macro{format}\\{#1} \\{#2}\par\fi}
+%</spider>
+% \end{macrocode}
+% \end{macros}
+%
+%
+% \sect The sequence |\XF#1:#2\XF| tags output files, instead of
+% |\X#1:\.{#2}\X|.
+% (|\XF| is bound to |\xwebSpiderOutputFileName| )
+%
+% \begin{macro}{\xwebSpiderOutputFilename}
+% \begin{macrocode}
+%<*spider>
+\def\xwebSpiderOutputFileName#1:#2\XF{\xwebRefName{#1}:\.{#2}\X}
+%</spider>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \sect Restore catcodes:
+%
+% \begin{macrocode}
+%<*spider>
+\catcode`\_=\xwebCatUsCode
+\catcode`\@=\xwebCatOther
+%</spider>
+% \end{macrocode}
+%
+%
+% \Finale
+%
+\endinput
+%
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
diff --git a/web/webfiles/webfiles.ins b/web/webfiles/webfiles.ins
new file mode 100644
index 0000000000..312cbf60fb
--- /dev/null
+++ b/web/webfiles/webfiles.ins
@@ -0,0 +1,9 @@
+\def\batchfile{webfiles.ins}
+\input docstrip.tex
+\preamble
+ Package for inclusion of CWEB and Spidery WEB programs in
+ LaTeX Documents.
+\endpreamble
+\batchmode
+\generateFile{webfiles.sty}{f}{\from{webfiles.dtx}{main}}
+\generateFile{swebbind.sty}{f}{\from{webfiles.dtx}{spider}}
diff --git a/web/webfiles/webfiles.pdf b/web/webfiles/webfiles.pdf
new file mode 100644
index 0000000000..b007dc4e0a
--- /dev/null
+++ b/web/webfiles/webfiles.pdf
Binary files differ
diff --git a/web/webfiles/webfiles.sty b/web/webfiles/webfiles.sty
new file mode 100644
index 0000000000..b39a8a2d33
--- /dev/null
+++ b/web/webfiles/webfiles.sty
@@ -0,0 +1,1002 @@
+%%
+%% This is file `webfiles.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% webfiles.dtx (with options: `main')
+%% Package for inclusion of CWEB and Spidery WEB programs in
+%% LaTeX Documents.
+
+%%
+%% $Id: webfiles.dtx,v 2.1 2002/03/05 10:38:14 potse Exp $
+%%
+
+\begingroup
+ \catcode`\$=9 % ignore $
+ \gdef\xwebMajorNr{1.0.}
+ \def\setversion#1:#2.#3:{\xdef\xwebVersion{\xwebMajorNr #3}}
+ \setversion $Revision: 2.1 $:
+ \def\setdate#1: #2/#3/#4#5#6:#7:#8;{\gdef\xwebDate{#2/#3/#4#5}}
+ \setdate $Date: 2002/03/05 10:38:14 $;
+ \newwrite\vf \immediate\openout\vf=version.tex
+ \immediate\write\vf{\xwebVersion}\immediate\closeout\vf
+\endgroup
+\catcode`\@=11
+\chardef\xwebCatUsCode=\catcode`\_ % top level macro file!
+\catcode`\_=11 % Catcode letter
+\chardef\xwebCatEscape=0
+\chardef\xwebCatOpen=1
+\chardef\xwebCatClose=2
+\chardef\xwebCatIgnore=9
+\chardef\xwebCatLetter=11
+\chardef\xwebCatOther=12
+\chardef\xwebCatActive=13
+\ProvidesPackage{webfiles}
+\begingroup
+ \typeout{LaTeX package `webfiles', version \xwebVersion, \xwebDate}
+\endgroup
+\ifx \section\undefined
+ \PackageError{webfiles}{`webfiles' is a package, not a class}{%
+ webfiles is not a document class, but only a package.
+ Please adapt your documentclass tag appropriately.
+ I.e., write \MessageBreak
+ \protect\usepackage{webfiles} instead of
+ \protect\documentclass{webfiles}.}
+\fi
+\newif\ifxweb_GlobalIndex \newif\ifxwebIndex
+\newif\ifxweb_GlobalRef \newif\ifxwebRef
+\newif\ifxweb_GlobalRagged \newif\ifxwebRagged
+\newif\ifxweb_GlobalOC
+\newif\ifxweb_GlobalHideFormats \newif\ifxwebHideFormats
+\newif\ifxweb_GlobalCon \newif\ifxwebCon
+\DeclareOption{index}{\xweb_GlobalIndextrue}
+\DeclareOption{noindex}{\xweb_GlobalIndexfalse}
+\DeclareOption{reflist}{\xweb_GlobalReftrue}
+\DeclareOption{noreflist}{\xweb_GlobalReffalse}
+\DeclareOption{raggedbottom}{\xweb_GlobalRaggedtrue}
+\DeclareOption{flushbottom}{\xweb_GlobalRaggedfalse}
+\DeclareOption{onlychanges}{\xweb_GlobalOCtrue}
+\DeclareOption{allsections}{\xweb_GlobalOCfalse}
+\DeclareOption{nocon}{\xweb_GlobalConfalse}
+\DeclareOption{contents}{\xweb_GlobalContrue}
+\DeclareOption{hideformats}{\xweb_GlobalHideFormatstrue}
+\DeclareOption{showformats}{\xweb_GlobalHideFormatsfalse}
+
+\newcount\xweb_hypertype
+\newcount\xweb_GlobalHypertype
+\DeclareOption{hyperref}{\xweb_GlobalHypertype=1}
+\DeclareOption{pdftex}{\xweb_GlobalHypertype=2 \input pdfcolor}
+\DeclareOption{nohype}{\xweb_GlobalHypertype=0}
+
+\newcounter{xwebLopDepth} \setcounter{xwebLopDepth}{9}
+\newcounter{xwebOutlineDepth} \setcounter{xwebOutlineDepth}{9}
+\DeclareOption{nofiles}{\c@xwebLopDepth=-9}
+\DeclareOption{writefiles}{\c@xwebLopDepth=9}
+\ExecuteOptions{index,reflist,raggedbottom,allsections,%
+ contents,showformats,nohype,writefiles}
+\let\xweb_UserBindings=\relax
+\let\xweb_DocLayout=\relax
+\def\xweb_documentation{%
+ \xweb_UserBindings
+ \xweb_DocLayout}
+\def\xweb_Rprogram{%
+ \xweb_CweaveBindings}
+\def\xweb_program{%
+ \xweb_CweaveBindings
+ \xweb_ProgramLayout}
+\def\xweb_tex{%
+ \xweb_UserBindings}
+\def\xweb_CR{%
+ \xweb_CweaveBindings
+ \xweb_DocLayout}
+\newtoks\xweb_undefined
+\newtoks\xweb_ToRestore
+\def\xweb_rebind{%
+ \xweb_undefined{}%
+ \xweb_ToRestore{}%
+ \xweb_DoRebind
+ }
+\def\xweb_DoRebind#1#2{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \xweb_SaveBinding #2%
+ \let #2=#1%
+ \let\next\xweb_DoRebind
+ \fi
+ \next
+ }
+\def\xweb_SaveBinding#1{%
+ \ifx #1\undefined
+ \xweb_undefined \expandafter{\the\xweb_undefined #1}%
+ \else
+ \expandafter\let \csname xweb_s_\string#1\endcsname =#1%
+ \xweb_ToRestore \expandafter{\the\xweb_ToRestore #1}%
+ \fi
+ }
+\def\xweb_RestoreBindings{%
+ \expandafter\xweb_undefine \the\xweb_undefined \stop
+ \xweb_undefined{}%
+ \expandafter\xweb_RestoreBinding \the\xweb_ToRestore \stop
+ \xweb_ToRestore{}%
+ }
+\def\xweb_undefine#1{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \let#1\undefined
+ \let\next\xweb_undefine
+ \fi
+ \next
+ }
+\def\xweb_RestoreBinding#1{%
+ \ifx #1\stop
+ \let\next\relax
+ \else
+ \expandafter\let \expandafter#1\csname xweb\string#1\endcsname
+ \expandafter\let \csname xweb_s_\string#1\endcsname \undefined
+ \let\next\xweb_RestoreBinding
+ \fi
+ \next
+ }
+\def\xweb_anchor{xwebmod:\xwebJobname:\arabic{xwebModule}}
+\def\xweb_SetupHrefs{
+ \ifnum\xweb_hypertype=0
+ \def\xweb_hlink##1{##1}
+ \def\xweb_htarget##1{##1}
+ \else\ifnum\xweb_hypertype=1
+ \def\xweb_hlink##1{\hyperlink{\xweb_anchor}{##1}}
+ \def\xweb_htarget##1{\hypertarget{\xweb_anchor}{##1}}
+ \else\ifnum\xweb_hypertype=2
+ \def\xweb_hlink##1{\xweb_pdflink{\xweb_anchor}{##1}}
+ \def\xweb_htarget##1{\xweb_pdftarget{\xweb_anchor}{##1}}
+ \else\PackageError{webfiles}{This can't happen.}{%
+ this may be a bug in the webfiles package}
+ \fi\fi\fi}
+\xweb_SetupHrefs
+\def\xwebPDFOutline#1#2{{%
+ \edef\tmpnr{#1}%
+ \edef\name{#2}%
+ \c@xwebModule=\tmpnr\relax
+ \ifnum\xweb_hypertype=2
+ \edef\anchor{\xweb_anchor}
+ \pdfoutline goto name{\anchor}{#1 \name}
+ \fi}}
+ \def\xweb_pdflink#1#2{%
+ \pdfannotlink
+ attr{/Border [0 0 0]}
+ goto name{#1}
+ \Blue #2\Black
+ \pdfendlink}
+ \def\xweb_pdftarget#1#2{
+ \smash{\raise\baselineskip\hbox to 0pt{\pdfdest name{#1} fith}}
+ #2}
+\def\xwebLapStar{\rlap{*}}
+\newcount\xwebGroupLevel
+\newcounter{xwebSecNoEject}
+ \setcounter{xwebSecNoEject}{3}
+\newcounter{xwebModule}
+\newif\ifon % determines if the section is `on'
+\def\onmaybe{\let\ifon=\maybe} % analogous to \ontrue
+\let\maybe=\iftrue % initial meaning; the user can say "\let\maybe=\iffalse"
+\def\xweb_PrepareSection#1{%
+ {\xdef\secstar{#1}%
+ \let\*=\empty% remove \* from the number
+ \xdef\xweb_secno{#1}}
+ \ifx\xweb_secno\secstar % if they are the same; i.e.:
+ \onmaybe % if there was no star in #1
+ \xdef\xweb_star{}%
+ \else
+ \ontrue
+ \xdef\xweb_star{*}%
+ \fi
+ \setcounter{xwebModule}{#1}% global set!
+ \xweb_documentation
+}
+\def\thexwebModule{\arabic{xwebModule}}
+\newbox\xweb_ModBox
+\newif\ifxweb_FirstModule \xweb_FirstModulefalse
+\newenvironment{xwebModule}{%
+ \ifxweb_FirstModule
+ \ifxwebCon\xwebContents{\xwebJobname}\fi
+ \global\xweb_FirstModulefalse
+ \openout\xweb_cont=\xwebJobname.con
+ \write\xweb_cont{\catcode `\noexpand\@=11\relax}%
+ \fi
+ \ifxwebRagged\vfil\penalty-200\vfilneg% (TeXbook p.353)
+ % (this is a \filbreak without a \par)
+ \else\penalty-200\fi
+ %\setbox\xweb_ModBox=\vbox\bgroup
+ \edef\@currentlabel{\thexwebModule}
+ \par\bigskip
+ \everypar{%
+ \if@noskipsec%
+ \global\@noskipsecfalse%
+ \everypar{\penalty-100}%
+ \fi}
+ \@noskipsectrue
+ \mbox{}\hspace{-\parindent}%
+ \xwebModuleHook
+ \xweb_htarget{\textbf{\thexwebModule.}\xweb_star}% typeset module number
+ \hskip 1em plus0.1em minus 0.1em%
+ }{%\egroup\unvbox\xweb_ModBox
+ }
+\def\xwebModuleHook{}
+\def\xwebMainSecSkip{\clearpage}
+\def\N#1#2#3.{%
+ \ifon\end{xwebModule}\fi
+ \global\xwebGroupLevel #1 % <-- space!!
+ { \let\*=\empty%
+ \xdef\xweb_secno{#2}% get the section number
+ }%
+ \ifnum\xweb_secno>1
+ \ifnum \xwebGroupLevel<\c@xwebSecNoEject
+ \xwebMainSecSkip
+ \fi
+ \fi
+ \message \expandafter{*\xweb_secno}%
+ \xweb_PrepareSection{#2}
+ \ifon
+ \def\xweb_ModTitle{#3}%
+ \begin{xwebModule}{\textbf{#3.}}% title
+ \hskip 1em plus.1em minus.1em%
+ \ifnum\c@xwebLopDepth > #1%
+ \addcontentsline{lop}{starred}{%
+ \protect\global\xwebGroupLevel #1 % space after #1 !
+ {\thexwebModule.}~{#3}}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{#3}{#1}{\xweb_secno}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ \ifnum\c@xwebOutlineDepth > #1%
+ \xwebPDFOutline{\xweb_secno}{#3}% args: nr, title
+ \fi
+}
+\def\M#1{%
+ \ifon\end{xwebModule}\fi
+ \xweb_PrepareSection{#1}%
+ \ifon\begin{xwebModule}%
+ \ifnum\c@xwebLopDepth>9%
+ \addcontentsline{lop}{xwebsection}{%
+ \protect\global\xwebGroupLevel 4 \thexwebModule.}%
+ { \let\protect\@unexpandable@protect
+ \edef\next{\write\xweb_cont{%
+ \ZZ{}{4}{#1}{\thepage}}}%
+ \next
+ }% write "\ZZ{title}{depth}{sec}{page}" to .con file
+ \fi
+ }
+\def\xwebTocName{Contents of \xwebJobname}
+\def\xwebLopName{List of Programs}
+\ifx\listofprograms\undefined
+ \ifx \chapter\undefined
+ \def\listofprograms{\section*{\xwebLopName\@mkboth
+ {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
+ \else
+ \newcommand{\listofprograms}{\chapter*{\xwebLopName\@mkboth
+ {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
+ \fi
+\fi
+\def\l@program#1{%
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \xweb_TTLopLine{#1}%
+}
+\def\l@xwebSection#1{
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \xweb_NormalTocLine{#1}%
+ }
+\newdimen\xwebLopIndent
+ \xwebLopIndent=2em
+\newcount\xwebLopIndentMaxLevel
+ \xwebLopIndentMaxLevel=4 % group level <= max level
+ \def\l@starred#1{% % page will be processed later
+ \xwebGroupLevel\z@ % default value of group level
+ \begingroup
+ \let\numberline\@gobble % width not known yet
+ \setbox\z@ \hbox{#1}%
+ \endgroup
+ \ifnum \xwebGroupLevel=\z@
+ \let\next\xweb_BoldTocLine
+ \else
+ \let\next\xweb_NormalTocLine
+ \fi
+ \next{#1}}
+\def\xweb_NormalTocLine#1{% % page will be processed later
+ \ifnum \xwebGroupLevel>\xwebLopIndentMaxLevel
+ \xwebGroupLevel\xwebLopIndentMaxLevel
+ \fi
+ \advance\xwebGroupLevel\m@ne % group level -= 1
+ \@dottedtocline
+ % \xwebGroupLevel % level (old)
+ 1 % level
+ {\xwebGroupLevel\xwebLopIndent}% % basic indent
+ \xwebLopIndent % numwidth
+ {#1}% % entry
+ }
+\def\xweb_BoldTocLine#1{%
+ \@dottedtocline
+ 1 % level
+ {\xwebGroupLevel\xwebLopIndent}% % basic indent
+ \xwebLopIndent % numwidth
+ {{\bf #1}}% % entry
+ }
+\def\xweb_TTLopLine#1#2{%
+ \addpenalty{\@secpenalty}%
+ \addvspace{2em plus\p@}%
+ \begingroup
+ \noindent
+ \hangindent\xwebLopIndent
+ \rightskip\@tocrmarg \parfillskip -\rightskip
+ \interlinepenalty\@M
+ \@tempdima\xwebLopIndent % for \numberline
+ {\large\bf\tt #1}\nobreak\hfill \hbox to\@pnumwidth{\hss #2}%
+ \par
+ \endgroup
+ \addvspace{.5em plus\p@}%
+ }
+\def\PB#1{%
+ \begingroup
+ \xweb_Rprogram
+ \leavevmode
+ #1%
+ \endgroup}
+\newcount\xwebProgPenalty
+ \xwebProgPenalty=\@secpenalty
+ \divide\xwebProgPenalty by 2
+\def\Y{%
+ \if@noskipsec
+ \else
+ \par
+ \penalty\xwebProgPenalty
+ \smallskip
+ \fi}
+\def\xweb_CweaveBindings{%
+ \ifx \xweb_UserBindings\relax
+ \xweb_rebind
+ % indentation and paragraph layout
+ \xweb_IncrIndent \1%
+ \xweb_DecrIndent \2%
+ \xweb_ExprBreak \3%
+ \xweb_backup \4%
+ \xweb_OptBreak \5%
+ \xweb_break \6%
+ \xweb_BigBreak \7%
+ \xweb_noindent \8%
+ % C/C++ tokens
+ \xwebRel \?%
+ \xwebAddress \AND
+ \xwebComplement \CM
+ \xwebScope \DC
+ \xwebEquiv \E
+ \xwebGe \G
+ \xwebRightShift \GG
+ \xwebNe \I
+ \xwebAssign \K
+ \xwebLeftShift \LL
+ \xwebMod \MOD
+ \xwebNull \NULL
+ \xwebNot \R
+ \xwebBinOr \OR
+ \xwebMemberRef \PA
+ \xwebThis \this
+ \xwebOr \V
+ \xwebAnd \W
+ \xwebXor \XOR
+ \xwebLE \Z
+ \xwebPointer \MG
+ \xwebPointerMemberRef \MGA
+ \xwebDecr \MM
+ \xwebIncr \PP
+ % more tokens
+ \xwebId \\%
+ \xwebIdLetter \|%
+ \xwebRes \&%
+ \xwebString \.% %% ( ...Emacs...
+ \xwebStringBreak \)%
+ \xwebNumber \T
+ \xwebCombinedOp \MRL
+ % goes to TeX state
+ \xwebComment \C
+ \xwebCxxComment \SHC
+ \xwebRefName \X
+ % CWEB tokens
+ \xwebMacrosHere \ATH
+ \xwebDefine \D
+ \xwebFormat \F
+ \xwebIdCat \J
+ \xwebVerbString \vb
+ % cross reference tags
+ \xwebChangeFlag \*%
+ \xwebCRAlso \A
+ \xwebCRsAlso \As
+ \xwebCRCite \Q
+ \xwebCRsCite \Qs
+ \xwebCRUse \U
+ \xwebCRsUse \Us
+ \xwebCREt \ET
+ \xwebCRsEt \ETs
+ % finish the list
+ \stop\stop
+ \def\xweb_UserBindings{%
+ \xweb_RestoreBindings
+ \let\xweb_UserBindings\relax
+ }%
+ \fi
+ }
+\newskip\xweb_SaveParskip
+\newskip\xweb_SaveRightskip
+\newcount\xweb_SaveSemSFCode
+\newcount\xweb_SavePretolerance
+\newcount\xweb_SaveHyphenpenalty
+\newcount\xweb_SaveExhyphenpenalty
+
+\def\xweb_SaveDocLayout{%
+ \xweb_SaveParskip\parskip
+ \xweb_SaveRightskip\rightskip
+ \xweb_SaveSemSFCode\sfcode`; % changed by \xweb_ProgramLayout
+ \xweb_SavePretolerance\pretolerance
+ \xweb_SaveHyphenpenalty\hyphenpenalty
+ \xweb_SaveExhyphenpenalty\exhyphenpenalty
+ }
+\def\xweb_RestoreDocLayout{%
+ \parskip\xweb_SaveParskip
+ \rightskip\xweb_SaveRightskip
+ \sfcode`;=\xweb_SaveSemSFCode
+ \pretolerance\xweb_SavePretolerance
+ \hyphenpenalty\xweb_SaveHyphenpenalty
+ \exhyphenpenalty\xweb_SaveExhyphenpenalty
+ }
+\def\xweb_ProgramLayout{%
+ \ifx \xweb_DocLayout\relax
+ \xweb_LayoutInit
+ \xweb_SaveDocLayout
+ \def\xweb_DocLayout{%
+ \xweb_RestoreDocLayout
+ \let\xweb_DocLayout\relax
+ }%
+ % set new values
+ \parskip\z@skip
+ \rightskip\z@ plus 100\p@ minus 10\p@
+ \sfcode`;=3000 % same stretch factor as period.
+ \pretolerance\@M
+ \hyphenpenalty 9999 % strings can be broken this way
+ \exhyphenpenalty\@M
+ \fi
+ }
+\newdimen\xwebIndentUnit \xwebIndentUnit=1em
+\newdimen\xweb_indent
+\newbox\xweb_bak % backspace one unit
+\newbox\xweb_bakk % backspace two units
+\def\xweb_LayoutInit{%
+ \global\setbox\xweb_bak \hbox to -1\xwebIndentUnit{}%
+ \global\setbox\xweb_bakk \hbox to -2\xwebIndentUnit{}%
+ \global\let\xweb_LayoutInit\relax
+ }
+\def\B{%
+ \if@noskipsec \hskip 1em \fi
+ \xweb_program
+ \xweb_indent 3\xwebIndentUnit \hangindent\xweb_indent
+ \ifvmode
+ \if@noskipsec
+ \indent % add an empty documentation part
+ \else
+ \noindent \kern\xwebIndentUnit
+ \fi
+ \fi
+}
+\def\xweb_break{% % forced break, between statements
+ \ifmmode\else
+ \endgraf % in LaTeX it isn't sure what \par is really...
+ \noindent
+ \hangindent\xweb_indent \kern\xweb_indent
+ \copy\xweb_bakk % go back to basic indentation
+ \ignorespaces
+ \fi
+ }
+\def\xweb_OptBreak{% % optional break between statements
+ \hfil \penalty\m@ne
+ \hfilneg \kern .5em \kern 2\xwebIndentUnit % discarded on line break
+ \copy\xweb_bakk
+ \ignorespaces
+ }
+\def\xweb_BigBreak{% % forced break and a little extra space
+ \Y
+ \xweb_break
+ }
+\def\xweb_ExprBreak#1{% % break with penalty #1 * 10
+ \hfil \penalty#10
+ \hfilneg % discarded on line break
+ }
+\def\xweb_IncrIndent{%
+ \global\advance\xweb_indent\xwebIndentUnit
+ \hangindent\xweb_indent
+ }
+\def\xweb_DecrIndent{\global\advance\xweb_indent -\xwebIndentUnit}
+\def\xweb_backup{\copy\xweb_bak}
+\def\xweb_noindent{% % no indentation
+ \hskip -\xweb_indent \hskip 2\xwebIndentUnit
+ }
+\let\xwebAnd=\land % logical and, &&
+\let\xwebEquiv=\equiv % equiv sign, for ==
+\let\xwebGe=\ge % greater or equal
+\let\xwebLE=\le % less or equal
+\let\xwebNe=\ne % unequal, !=
+\let\xwebNull=\Lambda % NULL pointer
+\let\xwebNot=\lnot % logical not, !
+\let\xwebOr=\lor % logical or, ||
+\let\xwebXor=\oplus % bitwise exclusive or, ^
+\font\teni=cmmi10
+\font\sevensy=cmsy7
+
+\newbox\xweb_pointer % pointer to struct component, ->
+\setbox\xweb_pointer=\hbox{\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
+
+\newbox\xweb_decr % decrement, --
+\setbox\xweb_decr=\hbox{%
+ \kern .5pt
+ \raise 1pt \hbox{\sevensy\char0 \kern-1pt\char0}%
+ \kern .5pt
+ }
+\newbox\xweb_incr % increment, ++
+\setbox\xweb_incr=\hbox{%
+ \kern .05em
+ \raise .1em \hbox{$\scriptstyle {+}\kern -.1em{+}$}%
+ \kern .05em
+ }
+\mathchardef\xwebAddress="2026 % `&', as binary op
+\let\xwebAssign== % assignment
+\let\xwebBinOr=\mid % binary or
+\def\xwebComplement{{\sim}} % `~', as ordinary symbol
+\def\xwebDecr{\copy\xweb_decr} % decrement
+\def\xwebIncr{\copy\xweb_incr} % increment
+\let\xwebLeftShift=\ll % left shift, <<
+\def\xwebMod{\mathbin{\hbox{\footnotesize\rm\%}}} % modulo/remainder, %
+\def\xwebMemberRef{\mathbin{.*}} % ptr to member (on object)
+\def\xwebPointer{\copy\xweb_pointer}
+\def\xwebPointerMemberRef{\mathbin{\xwebPointer*}} % ptr to member (on ptr)
+\def\xwebRel{\mathrel?} % relation operator
+\let\xwebRightShift=\gg % right shift, >>
+\def\xwebScope{\kern.1em{::}\kern.1em} % scope resolution
+
+\def\xwebThis{\xwebRes{this}} % reserved identifier `this'
+\def\xwebCombinedOp#1{\mathrel{\let\K==#1}} % eg, += operator
+\def\xwebId#1{\hbox{\it#1\/\kern.05em}} % identifier, more than one char
+\def\xwebIdLetter#1{\hbox{$#1$}} % identifier, one letter
+\def\xwebRes#1{% % reserverd words and type names
+ \hbox{\bf
+ \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
+ #1\/\kern .05em
+ }%
+ }
+\def\xwebString#1{%
+ \hbox{\tt
+ \xweb_StringSetup
+ #1\kern .05em
+ }%
+ }
+\def\xweb_StringSetup{%
+ \chardef\ =`\ % % <-- two spaces !
+ \chardef\&=`\&
+ \chardef\\=`\\
+ \chardef\^=`\^
+ \chardef\_=`\_
+ \chardef\{=`\{
+ \chardef\}=`\}
+ \chardef\~=`\~
+ \def\`{`}%
+ }
+\def\xwebStringBreak{\discretionary{\hbox{\tt\char`\\}}{}{}}
+\def\xweb_oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
+\def\xweb_hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}
+
+\def\xwebNumber#1{% % octal, hex, or decimal constant
+ \hbox{%
+ $%
+ \def\?{\kern.2em}%
+ \def\$##1{\egroup\sb{\,\rm##1}\bgroup}% suffix to constant
+ \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
+ \let\~\xweb_oct \let\^\xweb_hex
+ {#1}%
+ $}%
+ }
+\def\xwebComment#1{%
+ \5% % 0.5em will be discarded on line break
+ \hskip 1.5em
+ $/\ast\,$%
+ {\xweb_tex
+ \xwebCommentHook
+ #1%
+ }%
+ $\,\ast/$%
+ }
+\let\xwebCommentHook\relax
+\let\xwebCxxComment\xwebComment
+\def\xwebIdCat{\xwebString{@\&}}
+\def\xwebMacrosHere{%
+ \begingroup
+ \def\xwebRefNumber##1{}%
+ \xwebRefName :\xwebRefMacrosHere\X
+ \endgroup
+ }
+\def\xwebRefMacrosHere{Preprocessor Definitions}
+\def\xwebVerbString#1{{\fboxsep\tw@\p@ \fbox{\xwebString{#1}}}}
+\def\xwebRefName#1:#2\X{%
+ \ifmmode \gdef\xweb_ToggleText{\null$\null}%
+ \else \let\xweb_ToggleText\relax
+ \fi
+ \xweb_ToggleText
+ $\langle\,${\xweb_tex \xweb_CheckDot{#2}\xwebRefNumber{#1}}$\,\rangle$%
+ \xweb_ToggleText
+ }
+\def\xwebRefNumber#1{%
+ {\reset@font \footnotesize \kern .5em%
+ \xwebSetModNrList#1.}}
+\def\xwebSetModuleNumber#1{{\edef\tmpnr{#1}%
+ \c@xwebModule=\tmpnr\relax
+ \xweb_hlink{\thexwebModule}}}
+\newtoks\xweb_toksA
+\newtoks\xweb_toksB
+\newtoks\xweb_toksC
+\newtoks\xweb_toksD
+\newcount\xweb_countA
+\xweb_countA=0
+\def\xweb_AddTokens#1#2{%
+ \edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\xweb_adn#1{\xweb_AddTokens{\xweb_toksC}{#1}%
+ \global\xweb_countA=1\let\next=\maketoks}
+\def\xweb_poptoks#1#2|ENDTOKS|{%
+ \let\first=#1\xweb_toksD={#1}\xweb_toksA={#2}}
+\def\maketoks{%
+ \expandafter\xweb_poptoks\the\xweb_toksA|ENDTOKS|
+ \ifx\first0\xweb_adn0
+ \else\ifx\first1\xweb_adn1 \else\ifx\first2\xweb_adn2
+ \else\ifx\first3\xweb_adn3 \else\ifx\first4\xweb_adn4
+ \else\ifx\first5\xweb_adn5 \else\ifx\first6\xweb_adn6
+ \else\ifx\first7\xweb_adn7 \else\ifx\first8\xweb_adn8
+ \else\ifx\first9\xweb_adn9
+ \else
+ \ifnum0=\xweb_countA\else\xweb_makenote\fi
+ \ifx\first.\let\next=\xweb_tdone\else
+ \let\next=\maketoks
+ \xweb_AddTokens{\xweb_toksB}{\the\xweb_toksD}
+ \ifx\first,\xweb_AddTokens{\xweb_toksB}{\space}\fi
+ \fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next
+}
+\def\xweb_makenote{\xweb_AddTokens{\xweb_toksB}%
+ {\noexpand\xweb_TagSec{\the\xweb_toksC}}%
+ \xweb_toksC={}\global\xweb_countA=0}
+\def\xweb_tdone{\edef\st{\global\noexpand\xweb_toksA={\the\xweb_toksB}}\st}
+\def\xweb_TagSec#1{\xwebSetModuleNumber{#1}}
+\def\xwebSetModNrList#1.{%
+ \setbox0=\hbox{\xweb_toksA={#1.}\xweb_toksB={}\maketoks}%
+ \the\xweb_toksA}
+\def\xweb_CheckDot#1{%
+ \begingroup
+ \let\.\@gobble
+ \let\PB\relax
+ \expandafter\def \expandafter\next \expandafter{#1}%
+ \ifx \next\empty
+ \gdef\next##1{\xwebString}%
+ \else
+ \global\let\next\relax
+ \fi
+ \endgroup
+ \next #1
+ }
+\def\xwebDefine{\xweb_macro{\#define}}
+\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
+ \xweb_macro{format}\\{#1} \\{#2}\par\fi}
+\def\xweb_macro#1{%
+ \global\advance\xweb_indent \tw@\xwebIndentUnit
+ \xweb_IncrIndent
+ \xwebRes{#1 }% % <-- blank!
+ }
+\def\xwebNumberListHangindent{2em}
+\def\xwebCrossRef#1#2.{%
+ \par\smallskip% (= \Y)
+ \xweb_CR%
+ \begingroup%
+ \reset@font \footnotesize%
+ \noindent \hangindent\xwebNumberListHangindent%
+ #1~\xwebSetModNrList #2..\par%
+ \endgroup%
+ }%
+\def\xwebCRAlso{\xwebCrossRef{See also section}}
+\def\xwebCRsAlso{\xwebCrossRef{See also sections}}
+
+\def\xwebCRCite{\xwebCrossRef{This code is cited in section}}
+\def\xwebCRsCite{\xwebCrossRef{This code is cited in sections}}
+
+\def\xwebCRUse{\xwebCrossRef{This code is used in section}}
+\def\xwebCRsUse{\xwebCrossRef{This code is used in sections}}
+\let\xwebChangeFlag=*
+\def\xwebCREt{ and~}
+\def\xwebCRsEt{, and~}
+\newif\ifxweb_idxEntries
+\newif\ifxweb_scnEntries
+\newread\xweb_TmpFile
+\def\xweb_HasEntries#1{%
+ \openin\xweb_TmpFile \xwebJobname.#1\relax
+ \ifeof \xweb_TmpFile
+ \let\next\@defpar
+ \message{No #1 file present for \xwebJobname !}
+ \else
+ \read\xweb_TmpFile to \next
+ \fi
+ \csname xweb_#1Entries%
+ \ifx \next\@defpar false%
+ \else true%
+ \fi
+ \endcsname
+ \closein\xweb_TmpFile
+ }
+\newwrite\xweb_cont
+\let\ZZ=\let % now you can \write the control sequence \ZZ
+\def\xweb_contentsline#1#2#3#4{%
+ \ifnum#2=0 \smallbreak\fi
+ \hbox to \textwidth{\xweb_consetup{#2}#1
+ \rm\leaders\hbox to .5em{.\hfil}\hfil\ %
+ \xwebSetModuleNumber{#3}
+ \hbox to3em{\hss#4}}}
+\def\xweb_consetup#1{\ifcase#1 \bf % depth -1 (@**)
+ \or % depth 0 (@*)
+ \or \hskip2em % depth 1 (@*1)
+ \or \hskip4em % depth 2 (@*2)
+ \or \hskip6em % depth 3 (@*3)
+ \or \hskip8em % depth 4 (@*4)
+ \or \hskip10em % depth 5 (@*5)
+ \else \hskip12em \fi} % depth 6 or more
+\def\xwebContents#1{
+ \def\readcontents{\IfFileExists{#1.con}{\input #1.con}{}}
+ \begingroup
+ \xwebContentsTop
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{#1:contents} fith
+ \pdfoutline goto name{#1:contents}{#1}
+ \fi
+ \hbox to \textwidth{\hfil
+ \xwebSectionName\hbox to3em{\hss \xwebPageName}}
+ \let\ZZ=\xweb_contentsline
+ \readcontents\relax % read the contents info
+ \xwebContentsBot % print the contents page(s) and terminate
+ \endgroup
+}
+\def\xwebSectionName{Section}
+\def\xwebPageName{Page}
+\def\xwebContentsTop{\vskip.2in}
+\def\xwebContentsBot{\par\bigskip}
+\def\xweb_InputWebfile#1{
+ \def\setname##1.##2.##3/{\gdef\xwebJobname{##1}}
+ \setname #1../
+ \ifnum\c@xwebLopDepth > -10 % entry to the list of programs:
+ \addcontentsline{lop}{program}{\xwebJobname}
+ \fi
+ \def\xwebContentsTop{\centerline{\textbf{\xwebJobname}}\vskip.2in}
+ \def\xwebContentsBot{\par\bigskip}
+ \global\xweb_FirstModuletrue
+ \begingroup
+ \let\inx\relax
+ \let\fin\relax
+ \let\con\relax
+ \let\ch\xwebCRChanged
+ \input{#1}
+ \ifon \end{xwebModule} \fi % end the last module (if it is on).
+ \endgroup
+ % process the index and list of refinements ...
+ \ifxwebIndex\xweb_HasEntries{idx}%
+ \ifxweb_idxEntries \xwebIdIndex{\xwebJobname.idx}\fi\fi
+ \ifxwebRef\xweb_HasEntries{scn}%
+ \ifxweb_scnEntries \xwebRefList{\xwebJobname.scn}\fi\fi
+ % clean up:
+ \closeout\xweb_cont
+ \onfalse % don't end the last section when starting the first section of
+ % the next web.
+ \xweb_UserBindings % back to the main document
+}
+\def\xwebInputIndex#1{{
+ \def\setname##1.##2\\{%
+ \edef\xwebJobname{##1}
+ \ifx\\##2\\%
+ \edef\ext{idx}
+ \else
+ \edef\ext{\chop##2\\}%
+ \fi}
+ \def\chop##1.\\{##1}
+ \expandafter\setname#1.\\
+ \xwebIdIndex{\xwebJobname.\ext}
+}}
+\def\xwebInputReflist#1{{
+ \def\setname##1.##2\\{%
+ \edef\xwebJobname{##1}
+ \ifx\\##2\\%
+ \edef\ext{scn}
+ \else
+ \edef\ext{\chop##2\\}%
+ \fi}
+ \def\chop##1.\\{##1}
+ \expandafter\setname#1.\\
+ \xwebRefList{\xwebJobname.\ext}
+}}
+\def\ifstr#1#2#3{%
+ \edef\xweb_tempa{#1}%
+ \edef\xweb_tempb{#2}%
+ \ifx\xweb_tempa\xweb_tempb #3\fi
+ }
+\def\webfile{\@ifnextchar[%
+ {\xweb_file}{\xweb_file[]}}
+\newif\if@opt
+\def\xweb_off{\let\maybe=\iffalse}
+\def\xweb_on{\let\maybe=\iftrue}
+\def\xweb_file[#1]#2{
+ \ifxweb_GlobalIndex\xwebIndextrue\else\xwebIndexfalse\fi
+ \ifxweb_GlobalRef\xwebReftrue\else\xwebReffalse\fi
+ \ifxweb_GlobalRagged\xwebRaggedtrue\else\xwebRaggedfalse\fi
+ \ifxweb_GlobalOC\xweb_off\else\xweb_on\fi
+ \ifxweb_GlobalCon\xwebContrue\else\xwebConfalse\fi
+ \ifxweb_GlobalHideFormats\xwebHideFormatstrue\else
+ \xwebHideFormatsfalse\fi
+ \xweb_hypertype=\xweb_GlobalHypertype
+ \@for\xweb_opt:=#1\do{
+ \typeout{webfiles option: \xweb_opt}
+ \@optfalse
+ \ifstr{\xweb_opt}{index}{\xwebIndextrue\@opttrue}
+ \ifstr{\xweb_opt}{noindex}{\xwebIndexfalse\@opttrue}
+ \ifstr{\xweb_opt}{reflist}{\xwebReftrue\@opttrue}
+ \ifstr{\xweb_opt}{noreflist}{\xwebReffalse\@opttrue}
+ \ifstr{\xweb_opt}{raggedbottom}{\xwebRaggedtrue\@opttrue}
+ \ifstr{\xweb_opt}{flushbottom}{\xwebRaggedfalse\@opttrue}
+ \ifstr{\xweb_opt}{onlychanges}{\xweb_off\@opttrue}
+ \ifstr{\xweb_opt}{allsections}{\xweb_on\@opttrue}
+ \ifstr{\xweb_opt}{nocon}{\xwebConfalse\@opttrue}
+ \ifstr{\xweb_opt}{contents}{\xwebContrue\@opttrue}
+ \ifstr{\xweb_opt}{hideformats}{\xwebHideFormatstrue\@opttrue}
+ \ifstr{\xweb_opt}{showformats}{\xwebHideFormatsfalse\@opttrue}
+ \ifstr{\xweb_opt}{hyperref}{\xweb_hypertype=1\@opttrue}
+ \ifstr{\xweb_opt}{pdftex}{\xweb_hypertype=2\@opttrue}
+ \ifstr{\xweb_opt}{nohype}{\xweb_hypertype=0\@opttrue}
+ \if@opt\else\PackageError{webfiles}{%
+ Unknown option for the \protect\webfile\space command
+ }{Possible options are: index, noindex,
+ reflist, noreflist, \MessageBreak
+ raggedbottom, flushbottom, onlychanges,
+ allsections,\MessageBreak
+ nocon, contents, hideformats, showformats,
+ hyperref, pdftex, nohype}
+ \fi
+ }
+ \xweb_SetupHrefs
+ \xweb_InputWebfile{#2}}
+\let\cwebfile\webfile
+\def\xwebCRChanged{%
+ \xwebCrossRef{The following sections were changed by the change file:}%
+ \let\*\relax
+ }
+\newtoks\xwebIndexIntro
+ \xwebIndexIntro={}
+\def\xwebIndexName{Index of \texttt{\xwebJobname}}
+\def\xweb_IndexTop{
+ \xweb_tex
+ \par\vskip 1cm plus 10mm minus 5mm\noindent
+ {\bf \xwebIndexName}%\nopagebreak\par\medskip\nopagebreak
+ %% skip already inserted by xweb_twocolumn env.
+ \edef\intro{\the\xwebIndexIntro}% % is a local def
+ \ifx \intro\empty
+ \else
+ \noindent\the\xwebIndexIntro\unskip
+ \par\medskip
+ \fi
+}
+\newif\ifxweb_multicol \xweb_multicolfalse
+\IfFileExists{multicol.sty}{
+ \if@twocolumn\else\xweb_multicoltrue\fi
+}{}
+\ifxweb_multicol
+ \newenvironment{xweb_twocolumn}{\begin{multicols}{2}}{\end{multicols}}
+\else
+ \newenvironment{xweb_twocolumn}{
+ \if@twocolumn\else
+ \columnseprule\z@
+ \columnsep 35\p@ % value is from article.sty
+ \fi
+ \twocolumn%
+ }{
+ \onecolumn}
+\fi
+\def\xwebJobName{noname}
+\def\xweb_SetupIndex{%
+ \begin{xweb_twocolumn}[\xweb_IndexTop]
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{\xwebJobname:index} fith
+ \pdfoutline goto name{\xwebJobname:index}{Index}
+ \fi
+ % go to CR mode
+ \xweb_CR
+ \message{*index: }% % tell the user what we're doing
+ % paragraph layout
+ \begingroup
+ \parskip \z@ plus .5\p@
+ \parindent\z@
+ \rightskip \z@ plus 2.5em
+ \parfillskip \z@ plus .6\hsize
+ \tolerance\@M \hyphenpenalty\@M
+ % bindings
+ \let\I\xwebIndexEntry
+ \let\[\xwebIndexDeclared
+ \let\*\xwebLapStar
+}
+\def\xweb_FinishIndex{
+ \endgroup
+ \end{xweb_twocolumn}
+}
+\def\xwebIdIndex#1{%
+ \xweb_SetupIndex
+ \@input{#1}
+ \xweb_FinishIndex
+}
+\def\xwebIndexEntry#1,#2.{%
+ \par
+ \hangindent\xwebNumberListHangindent
+ \leavevmode
+ \xweb_CheckDot{#1}:\quad\xwebSetModNrList #2.
+ }
+\def\xwebIndexDeclared#1]{\underline{#1}}
+\def\9#1{}
+\def\xwebReflistName{List of Refinements in \texttt{\xwebJobname}}
+\def\xwebRLCite{\xwebCrossRef{Cited in section}}
+\def\xwebRLsCite{\xwebCrossRef{Cited in sections}}
+\def\xwebRLUse{\xwebCrossRef{Used in section}}
+\def\xwebRLsUse{\xwebCrossRef{Used in sections}}
+\def\xweb_SetupReflist{%
+ \vskip 3ex plus 7ex minus 1ex
+ \xweb_tex
+ \noindent
+ {\bf \xwebReflistName}\nopagebreak\par\bigskip\nopagebreak
+ \ifnum\xweb_hypertype=2
+ \pdfdest name{\xwebJobname:reflist} fith
+ \pdfoutline goto name{\xwebJobname:reflist} {Refs}
+ \fi
+ \xweb_CR
+ \message{*list of refinements: }%
+ % paragraph layout: like in index, but
+ \parfillskip\@flushglue
+ \begingroup % different bindings...
+ \def\I{\par \hangindent\xwebNumberListHangindent}%
+ \def\xwebCrossRef##1##2.{\quad {\reset@font\footnotesize
+ ##1~\xwebSetModNrList ##2..}}%
+ \def\Q {\xwebRLCite}%
+ \def\Qs{\xwebRLsCite}%
+ \def\U {\xwebRLUse}%
+ \def\Us{\xwebRLsUse}%
+ \let\*\xwebChangeFlag
+}
+\def\xwebRefList#1{%
+ \xweb_SetupReflist
+ \@input{#1}
+ \endgroup
+ }
+\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
+\ProcessOptions
+\ifxweb_multicol
+ \RequirePackage{multicol}
+\fi
+\catcode`\_=\xwebCatUsCode
+\endinput
+%%
+%% End of file `webfiles.sty'.
diff --git a/web/webfiles/xwebdoc.sty b/web/webfiles/xwebdoc.sty
new file mode 100644
index 0000000000..9d4bd4566b
--- /dev/null
+++ b/web/webfiles/xwebdoc.sty
@@ -0,0 +1,300 @@
+%
+% LaTeX style option xwebdoc for documentation of webfiles package
+%
+%
+% (customized version of progltx.doc and cwebdoc.sty, combined
+% with webdoc.sty)
+%
+
+\chardef\uscode=\catcode`\_
+\catcode`\_=11 % letter
+
+
+%%% In addition to the normal \LaTeX{} structuring markups we will
+%%% provide a markup for a layout of the document that is like in
+%%% \WEB{}. This can be done easily. All sections are numbered, the
+%%% number of the next section is stored in the counter |section|. We
+%%% distinguish between main sections which start a group of sections
+%%% and between normal sections within a group.
+
+%%% The main sections are started with the macro |\chap|. It has one
+%%% parameter, the title of the section group. This parameter must be
+%%% terminated by a dot. We start a new page, typeset the title in
+%%% bold face and separate it from the section text with a |\medskip|.
+%%% This text, the documentation part of the section, is formatted
+%%% without paragraph indentation.
+
+%%% If the \WEB{}-like macros are used every section number should be
+%%% output with a following dot. We want to establish this when we use the
+%%% |\chap| or the |\sect| macro the first time. Furthermore the new page
+%%% at the begin of a main section should not be started at the first
+%%% |\chap| because a title may precede it (and the title should not
+%%% be on a seperate page unless explicitely requested). Instead a
+%%% skip of (approximately) 2~pica should be set. To achieve
+%%% both goals a macro |\chap_intro| is defined that defines |\thesection|
+%%% appropriately, skips the 2~pica, and redefines itself to
+%%% |\newpage|---we then just have to call |\chap_intro| at the beginning
+%%% of |\chap|. The same applies to |\sect_intro|.
+
+\newskip\pre_sect_skip \pre_sect_skip=2pc plus 1pc minus 6pt
+
+\def\chap_intro{%
+ \gdef\thesection{\arabic{section}.}%
+ \gdef\chap_intro{\newpage}%
+ \addvspace{\pre_sect_skip}%
+ }
+
+\def\sect_intro{%
+ \gdef\thesection{\arabic{section}}%
+ \global\let\sect_intro\relax
+ }
+
+
+%%% \sect Now we will have a look at the {\it wonderful\/} internal
+%%% interface of \LaTeX{}\@. With ``wonderful'' I mean that I'm always
+%%% full of wonder why it was designed in this way. E.g., if anybody
+%%% can explain to me why the coding of the non-indentation of the first
+%%% line in the following paragraph was combined with the coding of
+%%% the skip which will come in front of the section---I will be thankful
+%%% for the rest of my life. Such different things should be kept
+%%% different, i.e., the suppression of the indentation should not be
+%%% hidden in the sign of a skip! The same comment applies to the combined
+%%% coding of the skip below the section heading resp.\ to the right
+%%% of a run-in heading.
+
+%%% \begin{quote} \it
+%%% I want the following layout: no indentation in the following
+%%% paragraph\/ {\rm but no} space in front of the section heading.
+%%% How do I code a value of\/ $\sl -0 pt$?
+%%% \end{quote}
+%%% %
+%%% Well, a work-around is to use a value of $\rm -1\,sp$ because the
+%%% reader will not see this distance---but in my opinions this is no
+%%% good programming style. In this special case I have luck, too:
+%%% the skip is not set anyway, either it is discarded by the preceding
+%%% |\newpage| or it is not added by |\addvspace| because of the preceding
+%%% |\pre_sect_skip|.
+
+\def\chap#1.{%
+ \chap_intro
+ \@startsection{section}{1}%
+ {\z@}%
+ {\m@ne sp}%
+ {\medskipamount}%
+ {\normalsize\bf}%
+ {#1.}%
+ }
+
+
+%%% \sect Normal sections are started with |\sect|. This macro has no
+%%% parameter. Between two paragraphs we skip |\pre_sect_skip|.
+%%% Between the section number and the text one quad of space is set.
+%%% We have to take care for empty documentation parts where the
+%%% program part (i.e.\ |\beginprog|) will follow immediately. Then
+%%% the program part should begin on a new line and not behind the
+%%% section number. So we provide |\null| as an empty documentation
+%%% part in every case.
+
+%%% Now again the design of |\@startsection| comes in hand: \LaTeX{}
+%%% always leaves a quad after the section number (by the way,
+%%% this is not mentioned in the documentation---you have to look
+%%% in the macros to figure this out). Because our section header
+%%% consists only of the number we have to code a value of $\rm
+%%% -0\,pt$\,\dots
+
+\def\sect{%
+ \sect_intro
+ \@startsection{subsection}{2}%
+ {\z@}%
+ {\pre_sect_skip}%
+ {\m@ne sp}%
+ {\normalsize\bf}%
+ {\null}%
+ }
+
+
+%%% \sect We are finished and just have to restore the category code.
+\catcode`\_=\uscode
+
+
+
+
+
+%
+% logos
+%
+\def\cweb{{\tt CWEB\/}}
+\def\ctangle{{\tt CTANGLE\/}}
+\def\cweave{{\tt CWEAVE\/}}
+\def\C++{C\raise .4ex\hbox{$\scriptstyle +\!+$}}
+
+
+%
+% new elements
+%
+\font\manfnt=manfnt % with the dangerous bend sign
+\chardef\bend="7F % I like the non-S curve ;-)
+\newenvironment{fixme}{%
+ \trivlist
+ \hangindent 2em
+ \hangafter -2
+ \item[\hbox to 0pt{\hss \manfnt \bend}]%
+ \ignorespaces
+ }{%
+ \endtrivlist
+ }
+
+
+\newenvironment{cseqtab}{%
+ \quote
+ \obeycr
+ \tabular{lrl}%
+ \@gobblecr % eat following newline
+ }{%
+ \endtabular
+ \endquote
+ }
+
+
+%
+% new tags
+%
+\def\arg#1{{\sl Arg.~#1\/}:}
+
+
+%
+% change of LaTeX parameters, for layout etc.
+%
+
+% figure
+\def\textfraction{0.1} % must be at least 10% text on page
+\def\topfraction{0.9} % rest may be top insertion
+\def\floatpagefraction{0.8} % float pages only if the float is larger than 80%
+
+
+%
+% from webdoc.sty:
+%
+\oddsidemargin=10mm
+\evensidemargin=0mm
+\textwidth=16cm
+\textheight=24cm
+\topmargin=-4mm
+\headsep=8mm
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \let\@evenfoot\@empty
+ \def\@evenhead{{\textup{\thepage}\hfil\footnotesize\leftmark}}%
+ \def\@oddhead{{\footnotesize\rightmark}\hfil\textup{\thepage}}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markboth%
+ {\uppercase{\ifnum \c@secnumdepth >\z@
+ \S\thesection\hskip 1em\relax\fi ##1}}%
+ {\uppercase{\ifnum \c@secnumdepth >\z@
+ \S\thesection\hskip 1em\relax\fi ##1}}
+ }
+ \def\subsectionmark##1{}%
+ }
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{{\footnotesize\rightmark}\hfil\textbf{\thepage}}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markright{\uppercase{\ifnum \c@secnumdepth >\m@ne
+ \S\thesection\hskip 1em\relax \fi
+ ##1}}}
+ \def\subsectionmark##1{}%
+ }
+\fi
+
+
+%
+% from logos.sty:
+%
+\font\bigfatrm=cmbx10 scaled\magstep5
+\let\bfitself\bf
+\newif\ifboldface
+\def\bf{\boldfacetrue\bfitself}
+\font\ninerm=cmr9
+\font\ninebold=cmbx9
+\font\mflogofont=logo10
+
+%
+% MATLAB:
+%
+\newcommand{\matlab}{%
+ \mbox{M{\ifboldface\ninebold\else\ninerm\fi%
+ \kern-.05emA\kern-.15emT\kern-.05emL\kern-.05emA\kern-.05emB%
+ \spacefactor1000}}}
+
+%
+% Maplab en Maplib:
+%
+% maplab in ems (evenredig met de fontgrootte) --> werkt in alle
+% fontgroottes.
+%
+\def\Maplab{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
+ \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{A}\kern-.1emB}
+\def\MAPLAB{{\bigfatrm\Maplab}}
+\def\maplab{%
+ {\ifboldface\ninebold\else\ninerm\fi\Maplab}%
+ \index{Maplab@ {\ninerm\protect\Maplab}}}
+%
+% idem voor MapLib:
+%
+\def\Maplib{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
+ \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{i}\kern0emB}
+\def\MAPLIB{{\bigfatrm\Maplib}}
+\def\maplib{%
+ {\ifboldface\ninebold\else\ninerm\fi\Maplib}%
+ \index{Maplib@ {\ninerm\protect\Maplib}}}
+
+
+%
+% Computertalen:
+%
+\def\cee{{\ninerm C\spacefactor1000}}
+\def\fortran{{\ninerm FORTRAN}}
+%%\def\cee{{C}}
+
+%
+% WEB's, WEAVEs en TANGLEs:
+%
+\def\web{{\tt WEB}}
+\def\cweb{{\tt CWEB}}
+\def\mweb{{\tt MWEB}}
+\def\nuweb{{\tt nuweb}}
+\def\ceeweb{{\tt ceeweb}}
+
+\def\weave{{\tt weave}}
+\def\cweave{{\tt cweave}}
+\def\ceeweave{{\tt ceeweave}}
+\def\mweave{{\tt mweave}}
+
+\def\tangle{{\tt tangle}}
+\def\ctangle{{\tt ctangle}}
+\def\ceetangle{{\tt ceetangle}}
+\def\mtangle{{\tt mtangle}}
+
+\def\spider{{\rm Spider}}
+
+
+%
+% Tools
+%
+\def\MakeIndex{{\it MakeIndex\/{}}}
+
+%
+% diversen
+%
+\def\C++{\cee\raise .4ex\hbox{$\scriptstyle +\!+$}}
+\def\unix{{\ninerm U\kern-.05emNIX\spacefactor1000}}
+\def\uvalogo{\center\parbox{0mm}{\input{UvA}\box\graph\hss\vss}}
+\def\metafont{{\mflogofont METAFONT}}
+\def\metapost{{\mflogofont METAPOST}}
+\def\BibTeX{{\sc Bib}{\rm\TeX}}
+\def\MakeIndex{{\it MakeIndex}}
+