Debian Codegraph @

texmf-dist/doc/latex/cweb-latex/src/cwebbase.doc

raw
1 % $StyleId: cwebbase.doc,v 1.4 1995/11/07 17:55:19 schrod Exp $
2 %----------------------------------------------------------------------
3 % Written by Joachim Schrod <[email protected]>.
4 % Copyright conditions see below (GPL).
5
6 %
7 % LaTeX macros cwebbase
8 % support for incorporation of CWEAVE markup in LaTeX documents
9 %
10 % [LaTeX in MAKEPROG]
11 % (history at end)
12
13
14
15
16 \documentclass{progltx}
17
18 \usepackage{cweb-doc} % document-specific markup
19 \usepackage{fullpage}
20
21
22 \RCS $StyleRevision: 1.4 $
23 \RCS $StyleDate: 1995/11/07 17:55:19 $
24
25
26 \begin{document}
27
28
29 \title{Typesetting \cweave{} Output}
30 \author{% % LaTeX does not discard unnecessary glue...
31 Joachim Schrod%
32 \thanks{%
33 \protect\raggedright
34 TU~Darmstadt, Computer Science Department, WG Systems Programming,
35 Alexanderstr.~10, D-64283~Darmstadt, Germany.
36 Email: \texttt{[email protected]}.%
37 }%
38 }
39 \date{%
40 Revision \RCSStyleRevision\\
41 (as of \RCSStyleDate)%
42 }
43
44 \maketitle
45
46
47 % doesn't work with progltx yet
48 %\tableofcontents
49
50
51
52
53 \chap Introduction.
54
55 This code shall interpret and render the tag set output by \cweave{}.
56 That's realized in this module as it's needed in multiple places --
57 when we want to use \LaTeX{} markup in \cweb{}, when we want to
58 incorporate \cweb{} pieces in \LaTeX{} documents (as examples, or in
59 textbooks), and when we want to incorporate whole \cweb{} documents in
60 a \LaTeX{} document. (That's by far the most difficult task.)
61
62 As \cweb{} operates in modes, for obvious reasons our implementation
63 is based on a finite state automaton (FSA). The whole tag set is
64 separated into subsets that are valid in certain states.
65
66 The complete set of tags does not obey any name conventions, some tags
67 are even in conflict with standard \LaTeX{} tags (e.g.\ |\\|). Most
68 tags are used to render code pieces. With the introduction of states
69 we can restrict the visibilities of these tags to those states where
70 we typeset program parts. The needed functionality will be available
71 in cseqs of our namespace, we'll map that to \cweave{}'s names in a
72 group.
73
74 Then we have to implement the rendering of chunks and sections, that's
75 (more or less) a straight-forward task. Actually, we only set up the
76 basic code pieces, the integration of section divisions in the actual
77 \LaTeX{} document is a task of higher-level code; that integration
78 depends heavily on the type of document. That also implies that we
79 won't implement front or back matter material (document markup, table
80 of contents, index, list of refinements, etc.)\ in this module.
81
82
83 \sect Let's identify this module.
84
85 \noindent The code below is explained in the implementation
86 documentation of the \pkg{rcs} package.
87
88 \beginprog
89 \begingroup
90 \def\RCSFile#1#2 $#3: #4 #5\endRCS $#6: #7 #8\endRCS{%
91 \def\date{#4}\def\id{v#7}%
92 \ProvidesFile{#1}[\date\space\id\space #2]%
93 }
94
95 \RCSFile{cwebbase.tex}{CWEAVE tags for LaTeX markup}
96 $StyleDate: 1995/11/07 17:55:19 $: 9999/00/00 \endRCS
97 $StyleRevision: 1.4 $: 0.0 \endRCS
98 \endgroup
99 \endprog
100
101
102 \sect This module is part of the supported \textsl{cweb-sty} bundle.
103 Send bug reports, comments and repairs.
104
105 It assumes that the canonical setup of my modules has happened and can
106 be used herein. (In particular, the underscore is a letter.)
107
108
109 \sect This module reserves the namespace |cwbb|. It assumes that
110 |\cweb_warning| is bound either to |\PackageWarningNoLine| or
111 |\ClassWarningNoLine|, depending on the environment.
112
113 \beginprog
114 \ifx \cwbb@loaded\undefined
115 \def\cwbb@loaded{$StyleRevision: 1.4 $}
116 \else
117 \cweb_warning{cwebbase}%
118 {Some other package already uses namespace `cwbb'}
119 \fi
120 \endprog
121
122
123 \sect This is freely distributable software; you can redistribute it
124 and/or modify it under the terms of the GNU General Public License as
125 published by the Free Software Foundation; either version~2 of the
126 License, or (at your option) any later version.
127
128 This software is distributed in the hope that it will be useful, but
129 \textbf{without any warranty}; without even the implied warranty of
130 \textbf{merchantability} or \textbf{fitness for a particular purpose}.
131 See the GNU General Public License for more details.
132
133 You should have received a copy of the GNU General Public License in
134 the file |License| along with this package; if not, write to the Free
135 Software Foundation, Inc., 675~Mass Ave, Cambridge, MA~02139,~USA.
136
137
138
139
140 % ------------------------------------------------------------
141 %
142 % subdocument: The interface between CWEAVE and TeX
143 %
144
145 \input{cweave-spec}
146
147 %
148 % ------------------------------------------------------------
149
150
151
152
153 \chap Interface of \pkg{cwebbase} module.
154
155 \pkg{cwebbase} implements most of \cweave{} tags. It sets up tons of
156 redefinable cseqs, all of them start with |Cweb|.
157 %
158 \begin{fixme}
159 How do I document them? We need a configuration document anyhow. Do
160 I present here just a list of those cseqs realized in this module
161 and refer to the config docs? Need to wait until I have it, then
162 we'll see how the stuff here will be added.
163 \end{fixme}
164
165
166 \sect This module supports both hierarchic and flat section
167 structuring. You have to bind |\cweb@structure| to 0 (hierarchic) or 1
168 (flat) before importing it, to show which structure is wanted.
169
170
171 \sect This module supports suppression of different document parts.
172 You have to define flags |@cweb@suppress@|\<foo>|@| with
173 $\mbox{\<foo>} \in \{ |changehints|, |unchanged|, |format| \}$ to
174 denote if suppression shall happen.
175
176
177 \sect The counter |secnumdepth| must be~11 if chunks shall be
178 numbered. That counter doesn't need to be set when this module is
179 imported, it can be set locally during typesetting \cweb{} code.
180
181 The definitions for flat structure assume that |secnumdepth| is~11
182 during typesetting.
183
184
185 \sect |\part|, |\chapter| (if available), and |\section| are used for
186 \cweb{} section divisions (those with the lowest ranks). These
187 commands will change the respective counters globally and will
188 add toc lines and marks. You might want to prevent that by redefining
189 |\addcontentsline| and |\mark|.
190
191 Table of contents macros are not defined for the section divisions
192 introduced by this module. You must either prevent that they are
193 written to the |AUX| file at all; or you must define them.
194 %
195 \begin{fixme}
196 Add explanation of introduced section divisions.
197 \end{fixme}
198
199 For flat structure, all section divisions are of type `|chunk|', like
200 chunks. The section names start with `|\cwbbRank{|\<rank>|}|'. By
201 default, |\cwbbRank| takes one argument and expands to the empty list
202 -- this can be redefined for the table of contents.
203
204
205 \sect The document end, as explained in the \cweave{} interface specs
206 (chunk~\ref{spec:sec:docend}), is not implemented. That must be done
207 by the user of this module -- if the back matter is to be processed at
208 all.
209
210
211
212
213 \chap Processing states.
214
215 We have to typeset five different categories of material:
216 Documentation, program pieces---embedded within the documentation and
217 as large chunks, \TeX{} material within program pieces (i.e., comments
218 and refinement names), and cross reference information. Since we need
219 a complete other environment for the program pieces than for the rest
220 we design ``states'' where we switch to appropriately.
221 %
222 \begin{enumerate}
223
224 \item A chunk starts in the \textsl{documentation state}.
225
226 \item |\B| switches to \textsl{program state}. This can happen in
227 documentation and program state.
228
229 \item While we process the argument of |\PB| we're in \textsl{restricted
230 program state}; |\PB| may appear in documentation and in \TeX{}
231 state. Since \TeX{} state can be switched on within restricted
232 program state, |\PB| can appear within the argument of itself.
233
234 \item In the arguments of |\C|, |\SHC|, and |\X| we switch to
235 \textsl{\TeX{} state}. All these cseqs appear only in (restricted)
236 program state, their official names are actually different. I.e., only
237 in (restricted) program state these cseq are bound to the meaning
238 described here.
239
240 \item Cross reference information are attached to most chunks with
241 refinements. This information is processed in \textsl{CR state}.
242 After CR state material
243 comes always the next chunk or the document end, i.e., material in
244 documentation state.
245
246 \end{enumerate}
247 %
248 This FSA is illustrated by the diagram in figure~\ref{fig:fsa}.
249
250 \begin{figure}
251
252 \begin{center}
253 \chardef\\=`\\
254 \input{cweb-fsa.latex}
255 \end{center}
256
257 \caption{The processing state's FSA. The automaton starts and ends in
258 the ``documentation'' state.}
259 \label{fig:fsa}
260
261 \end{figure}
262
263 |\cwbb@documentation| will switch to documentation state,
264 |\cwbb@program| to program state, |\cwbb@Rprogram| to restricted
265 program state, |\cwbb@tex| to \TeX{} state, and |\cwbb@CR| to CR state.
266 If we're already in a state, the switch to this state shall be a
267 permissible null operation.
268
269
270 \sect The basic difference between these states can be named with
271 two parameters: (1)~The cseq bindings in effect and (2)~the layout
272 parameters used for paragraph makeup.
273
274 In (restricted) program state and in CR state the text is output
275 under the control of \cweave{}, and tagged by \cweave{}. The used
276 tags are from a global namespace and should only be in effect during
277 these states. We call this tag set the \textsl{\cweave{} bindings}. In the
278 other two states the tags are largely defined by the user, the tag
279 set is called the \textsl{user bindings}. The switch to another binding
280 is always done locally, i.e., if we switch from documentation to
281 restricted program state within a group we don't have to bother about
282 the restauration of the user binding; it will be done automatically
283 by \TeX{} at the end of the group. Nevertheless we must be able to
284 switch from the \cweave{} bindings back to the user bindings which
285 were in effect when we activated the \cweave{} bindings. This is
286 needed for the \TeX{} state which is always activated within
287 (restricted) program state.
288
289 The parameters for \textsl{program layout} are really special ones
290 since they need to support the indentation which shows the program
291 structure. These parameters are used in program and in \TeX{} state.
292 The \textsl{document layout} parameters established by the user are
293 used in the other three states.
294
295 The following table shall summarize this. $C$~denotes \cweave{}
296 bindings, $U$~user bindings, $P$~program layout, and $D$~document
297 layout. If an entry is empty, its value is not changed on entry in
298 this state.
299 %
300 \begin{center}
301 \DeleteShortVerb\|
302 \begin{tabular}{r|c|c}
303 \multicolumn1{c|}{\textsc{State}} & \textsc{Binding} & \textsc{Layout} \\[1pt]
304 \hline
305 documentation & $U$ & $D$ \\
306 program & $C$ & $P$ \\
307 restricted program & $C$ & \\
308 \TeX{} & $U$ & \\
309 CR & $C$ & $D$ \\
310 \end{tabular}
311 \MakeShortVerb\|
312 \end{center}
313
314
315 \sect Since the user bindings and the document layout is defined
316 initially, we don't have to do anything if it's requested. Only if we
317 change it, i.e., within |\cwbb@cweave_bindings| and
318 |\cwbb@program_layout|, we redefine |\cwbb@user_bindings| and
319 |\cwbb@doc_layout|. If they are eventually executed, they shall
320 rebind themselves back to |\relax|. This way we can switch to
321 documentation state as often as we want.
322
323 \beginprog
324 \let\cwbb@user_bindings=\relax
325 \let\cwbb@doc_layout=\relax
326
327 \def\cwbb@documentation{%
328 \cwbb@user_bindings
329 \cwbb@doc_layout
330 }
331 \def\cwbb@Rprogram{\cwbb@cweave_bindings}
332
333 \def\cwbb@program{%
334 \cwbb@cweave_bindings
335 \cwbb@program_layout
336 }
337 \def\cwbb@tex{\cwbb@user_bindings}
338
339 \def\cwbb@CR{%
340 \cwbb@cweave_bindings
341 \cwbb@doc_layout
342 }
343 \endprog
344
345
346
347
348 \chap Saving and restoring control sequences.
349
350 We have a lot of cseqs which are defined within the namespace of this
351 module and which will be used with other names. This usage is in a
352 controlled environment, namely neither in documentation nor in \TeX{}
353 state. (I.e., the text processed is tagged by \cweave{}, not by humans;
354 therefore we have a precise specification of the cseqs we have to
355 accept.) We cannot work with groups where a cseq is just redefined
356 and \TeX{} takes care for establishing the old binding again; when we
357 switch from program state to \TeX{} state all the bindings which were
358 in effect before the program state get active, i.e., in the
359 documentation state, must be in effect again. We cannot simply
360 consider the \TeX{} state as something parallel to program state, it
361 must be a hierarchical relationship: In the program state values are
362 set up which must be available after switching back from \TeX{} to
363 program state.
364
365 We save the current binding of a cseq in another cseq, but only if
366 there exists a binding currently. This is done to save valuable
367 \TeX{} main memory. (Why don't all those people who talk about
368 extending \TeX{} not just implement dynamic memory management for the
369 existing \TeX{}? It would still be \TeX{} and would \emph{really} be
370 a worthy activity. But not enough fun, I assume\,\dots) Actually, one
371 can assume that nearly no cseq bindings must be saved at all---the
372 used names are strange enough. The bindings of |\foo|, i.e., of the
373 cseq with the name \fbox{\ttfamily foo}, is saved as the cseq with the
374 name \fbox{\ttfamily cweb\char `\\ foo}, i.e., as
375 |\csname cweb\string\foo \endcsname|.
376
377
378 \sect The save process is not done statically, but by the macro
379 |\cwbb@rebind| which interprets a list of tuples $({\it old\_name},
380 {\it new\_name})$, terminated by the tuple $(|\stop|, |\stop|)$.
381 Eventually it constructs two new lists, |\cwbb@to_restore| with the
382 cseqs which had a binding, and |\cwbb@undefined| with the names which
383 didn't have one.
384
385 The saving is actually done by |\cwbb@save_binding|, |\cwbb@rebind|
386 is responsible for the initialization, |\cwbb@do_rebind| for the
387 effective rebinding and the tail recursion on the list.
388
389 \begin{fixme}
390 We could pull the |\next| assignment in the |\else| branch out of
391 the loop to get a better performance. Should measure if this is of
392 interest.
393 \end{fixme}
394
395 \beginprog
396 \newtoks\cwbb@undefined
397 \newtoks\cwbb@to_restore
398
399 \def\cwbb@rebind{%
400 \cwbb@undefined{}%
401 \cwbb@to_restore{}%
402 \cwbb@do_rebind
403 }
404 \def\cwbb@do_rebind#1#2{%
405 \ifx #1\stop
406 \let\next\relax
407 \else
408 \cwbb@save_binding #2%
409 \let #2=#1%
410 \let\next\cwbb@do_rebind
411 \fi
412 \next
413 }
414 \endprog
415
416
417 \sect If the cseq to be saved is undefined, it may just be added to
418 the ``undefined list.'' Otherwise its binding is saved and it's added
419 to the ``to-be-restored list.''
420
421 \TeX{}nical note: The cseq-name for the saved binding must be created
422 before the |\let| is executed.
423
424 \beginprog
425 \def\cwbb@save_binding#1{%
426 \ifx #1\undefined
427 \cwbb@undefined \expandafter{\the\cwbb@undefined #1}%
428 \else
429 \expandafter\let \csname cweb\string#1\endcsname =#1%
430 \cwbb@to_restore \expandafter{\the\cwbb@to_restore #1}%
431 \fi
432 }
433 \endprog
434
435
436 \sect The restoration of rebound cseqs is a two-tied activity: All
437 previously undefined cseqs must be made undefined again, and all saved
438 cseqs must be restored. Actually, we don't need to reset the two token
439 lists, but we do it to save space.
440
441 Both |\cwbb@undefine| and |\cwbb@restore_binding| iterate over a list
442 of cseqs terminated by |\stop|.
443
444 \begin{fixme}
445 And here the |\next| assignment could be prepended to the loop as
446 well.
447 \end{fixme}
448
449 \beginprog
450 \def\cwbb@restore_bindings{%
451 \expandafter\cwbb@undefine \the\cwbb@undefined \stop
452 \cwbb@undefined{}%
453 \expandafter\cwbb@restore_binding \the\cwbb@to_restore \stop
454 \cwbb@to_restore{}%
455 }
456
457 \def\cwbb@undefine#1{%
458 \ifx #1\stop
459 \let\next\relax
460 \else
461 \let#1\undefined
462 \let\next\cwbb@undefine
463 \fi
464 \next
465 }
466 \endprog
467
468
469 \sect \TeX{}nical note: As in |\cwbb@save_binding|, the cseq-name for
470 the saved binding must be created before the |\let|s are executed.
471
472 \begin{fixme}
473 Another |\next| assignment.
474 \end{fixme}
475
476 \beginprog
477 \def\cwbb@restore_binding#1{%
478 \ifx #1\stop
479 \let\next\relax
480 \else
481 \expandafter\let \expandafter#1\csname cweb\string#1\endcsname
482 \expandafter\let \csname cweb\string#1\endcsname \undefined
483 \let\next\cwbb@restore_binding
484 \fi
485 \next
486 }
487 \endprog
488
489
490
491
492 \chap Chunks.
493
494 All chunks are numbered subsequently. The chunk number is supplied as
495 part of the markup. In addition, the `changed' tag |\*| may be
496 appended to the chunk number.
497
498 By default, chunks have approximately two picas vertical space in
499 front.
500
501 If we use an hierarchic structure, we output the chunk number at the
502 refinement. (It's only needed to identify the refinement for cross
503 references.) But chunks are important structural units and thus should
504 be marked by typographic means that's more visible than the space
505 mentioned above, we add a `chunk start marker'.
506
507 For a flat structure, we output the chunk number as the chunk start
508 marker, that is the traditional \WEB{} layout.
509
510 In any case, the documentation part shall be run in after the chunk
511 start marker.
512
513 \beginprog
514 \newskip\CwebChunkPreSkip
515 \CwebChunkPreSkip=2pc plus 1pc minus 6pt
516 \endprog
517
518
519 \sect In \LaTeX{}, structural divisions are best realized by
520 |\@startsection|, we'll use it also for chunk starts. The chunk start
521 marker is the section heading. For hierarchic structure, we use a
522 traditional paragraph sign, used since medieval times to tag new text
523 units. Our first test showed that the paragraph sign has typically an
524 underlength, that doesn't look good at the start of a chunk. We raise
525 the sign by its depth.
526
527 For flat structure, we don't have text as the section heading,
528 but we have to cope for a deficiency of \LaTeX{}: It always leaves a
529 quad after the section number (by the way, this is not mentioned in
530 the documentation---you have to look in the macros to figure this
531 out). So we use a backskip of $\rm -1\,em$ as the chunk start marker
532 then.
533
534 Changed chunks are marked by a changeflag, by default a star lapping
535 to the right. We need the information if that chunk is changed to
536 decide if we shall output the changeflag. We demand from the chunk
537 macros that they record that info in the flag |@cwbb_changed_chunk@|.
538
539 Each structural division must be categorized, it belongs to a
540 \textsl{type}. This type determines also the name of the counter, the
541 mark handling for this category, and how this section tag is
542 represented in the table of contents. The type of chunks is `|chunk|'
543 (trivial, isn't it?).
544
545 Furthermore, a structural division in \LaTeX{} has an associated
546 \textsl{level}. That level is used to determine if that division get
547 numbered in text or table of contents. For sections, we'll compute the
548 level from the rank, it will not be larger than the rank.%
549 \footnote{Check the next section for a more precise definition of
550 `rank' and `level'.}
551 Since the highest section rank is~10, we may use 11 as chunk level.
552
553 For flat structure, we output the number for all section headings,
554 including chunks. For hierarchic structure we use the default maximum
555 level as supplied by our document class (e.g., 3~for \cls{article},
556 and 2~for \cls{report} or \cls{book}).
557
558 As a last point, we have to care already for sections in flat
559 structure. They will use the |chunk| category as well, we have to
560 distinguish them in the table of contents. For that, we'll record the
561 level in the text, it will get written to the table of contents.
562
563 \beginprog
564 \newif\if@cwbb_changed_chunk@
565 \let\CwebChangeFlag=*
566 \if@cweb@suppress@changehints@
567 \let\cwbb@change_flag=\relax
568 \else
569 \let\cwbb@change_flag=\CwebChangeFlag
570 \fi
571 \def\cwbb@lap_change_flag{\rlap{\cwbb@change_flag}}
572
573 \ifcase \cweb@structure
574 %% hierarchic
575 \let\CwebChunkHeadingStyle\relax
576 \newbox\cweb@chunk_marker
577 \setbox\cweb@chunk_marker=\hbox{\P} % tradition from medivial times
578 \setbox\cweb@chunk_marker=\hbox{%
579 \raise\dp\cweb@chunk_marker \box\cweb@chunk_marker
580 }
581 \def\CwebChunkHeadingMarker{\copy\cweb@chunk_marker}
582 \def\CwebChunkHeading#1{%
583 \CwebChunkHeadingMarker
584 \if@cwbb_changed_chunk@ \cwbb@lap_change_flag \fi
585 }
586 \or
587 %% flat
588 \def\cwbbRank#1{}
589 \def\CwebChunkHeadingStyle{\bfseries}
590 \def\CwebChunkHeading#1{%
591 \protect\cwbbRank{#1}%
592 \kern -1em
593 \if@cwbb_changed_chunk@ \cwbb@lap_change_flag \fi
594 }
595 \fi
596 \endprog
597
598
599 \sect Chunks are tagged with |\M| and get passed the chunk number as
600 argument. Before we evaluate |\@startsection|, we'll start the chunk.
601 That's common code to be used by sections as well, as they also
602 implicitely start a chunk.
603
604 \beginprog
605 \def\M#1{%
606 \cwbb@start_chunk{#1}%
607 \@startsection
608 {chunk}% % category, == counter etc.
609 {11}% % level
610 {\z@}% % no indentation for heading
611 {\CwebChunkPreSkip}% % skip above heading
612 {\m@ne em}% % run-in heading, 1em distance to text
613 {\normalfont\CwebChunkHeadingStyle}% % layout
614 {\CwebChunkHeading{11}}% % text, level might go to toc file
615 }
616 \endprog
617
618
619 \sect But let's first declare how a chunk number is represented. The
620 principle rendering is controlled by |\thechunk|, namely, we get
621 arabic numbers. This rendering is used both for creation of the
622 section header (if in flat mode) and for cross references. I.e.,
623 |\ref| expands into it.
624
625 But for flat structure we need different expansions: In the section
626 header a period shall be appended, a cross reference shall appear
627 without such a period. We use two different macros: |\thechunk|
628 creates the number with the period, |\cwbb@refchunk| only the number.
629 The latter is used for a redefinition of |\@currentlabel|. Of course,
630 for hierarchic structure, both are the same.
631
632 \beginprog
633 \newcounter{chunk}
634
635 \def\cwbb@refchunk{\arabic{chunk}}
636
637 \ifcase \cweb@structure
638 %% hierarchic
639 \let\thechunk=\cwbb@refchunk
640 \or
641 %% flat
642 \def\thechunk{\arabic{chunk}.}
643 \fi
644 \endprog
645
646
647 \sect Each chunk is started by |\cwbb@start_chunk|, which does the
648 common actions. First of all, we switch to documentation state.
649
650 Then we store the chunk number in the |chunk| counter. That implies
651 that the chunk start must not step this counter! We'll take care for
652 that later by redefining |\refstepcounter|. The actual number is
653 passed as the argument, including an optional |\*| used to denote
654 changed chunks. We'll redefine that cseq to update the flag
655 |@cwbb_changed_chunk@|.
656
657 Each chunk must be typeset with an open |\if| since it is finished by
658 |\fi|. If we shall suppress the output of unchanged chunks, we have
659 to use |\iffalse| if not |@cwbb_changed_chunk@|, otherwise |\iftrue|.
660 The flag |@cwbb_print_chunk@| is set up to provide an appropriate
661 test.
662
663 When we typeset a chunk, we evaluate |\cwbb@init_print_chunk|. For
664 hierarchic structure, that cseq will be used to initialize the
665 typesetting of the chunk number at program parts.
666
667 \beginprog
668 \if@cweb@suppress@unchanged@
669 \def\if@cwbb_print_chunk@{\if@cwbb_changed_chunk@}
670 \@gobble\fi % close \if in case it's skipped
671 \else
672 \let\if@cwbb_print_chunk@=\iftrue
673 \@gobble\fi % same here
674 \fi
675
676 \def\cwbb@start_chunk#1{%
677 \cwbb@documentation
678 \begingroup
679 \def\*{\global\@cwbb_changed_chunk@true}%
680 \global\@cwbb_changed_chunk@false
681 \global \c@chunk #1\relax % might expand \*
682 \endgroup
683 \if@cwbb_print_chunk@
684 \cwbb@init_print_chunk
685 }
686 \endprog
687
688
689 \sect |\@startsection| will step the section counter (i.e., |chunk|).
690 Since we just assigned it in |\cwbb@start_chunk|, that would leave us
691 with a counter that's one too high. And our output in cross references
692 may be wrong, as a period is appended in flat structure.
693
694 That damage all comes from one macro, |\refstepcounter|; let's
695 advice it to do the Right Thing for |chunk| counters.
696
697 \beginprog
698 \let\cwbb@refstepcounter=\refstepcounter
699
700 \def\cwbb@string@chunk{chunk}
701 \def\refstepcounter#1{%
702 \def\@tempa{#1}%
703 \ifx \@tempa\cwbb@string@chunk
704 \protected@edef\@currentlabel{\cwbb@refchunk}%
705 \else
706 \cwbb@refstepcounter{#1}%
707 \fi
708 }
709 \endprog
710
711
712
713
714 \chap Sections.
715
716 Important sections are started on a new page, normal sections have the
717 same space as chunks in front. The very first section does not
718 automatically start on a new page since a title may be in front of it.
719
720 Each section division has a \textsl{rank}, that denotes the section
721 depth as seen by \cweave{}.
722
723 For this depth we compute a \textsl{level}, used to denote the section
724 depth for \LaTeX{}. This section depth is used to decide where
725 numbering shall stop, or if that entry shall be presented in the table
726 of contents, etc.
727
728 These two numbers are not the same, due to the support of document
729 classes with chapters.
730
731 We consider a section as important if it's rank is smaller than~3,
732 i.e., then we'll start a new page. This limit is controlled by the
733 number |\CwebRankNoEject|. The rank is used as the section level
734 and is therefore available to configure depth of typeset numbering and
735 appearance in table of contents.
736
737 \beginprog
738 \def\CwebRankNoEject{3}
739 \endprog
740
741
742 \sect Sections are started with the macro |\N|. It's first parameter
743 is the section's rank. The second parameter is the chunk number, the
744 third the title of the section. This last parameter must be terminated
745 by a dot.
746
747 Each section implicitly starts a chunk. As explained above, major
748 sections may eject the page, and we add our actual section heading
749 with |\CwebSection|.
750
751 We also tell the user that we have reached the next section by telling
752 him about the current chunk number. The message is output after the
753 section header is set, it shall be on the correct page. Since the
754 token list to be output is expanded at shipout time, we must take care
755 for the immediate expansion ourselves.
756
757 \beginprog
758 \def\N#1#2#3.{%
759 \cwbb@start_chunk{#2}%
760 \CwebEjectSection{#1}%
761 \CwebSection{#1}{#3}%
762 \begingroup
763 \def\*{}%
764 \edef\tmp{*#2}%
765 \message \expandafter{\tmp}%
766 \endgroup
767 }
768 \endprog
769
770
771 \sect At the start of a section we usually eject the page if our rank
772 is not too low. But if the user had a title above the first section,
773 he won't want this page break. So we try to guess it. If we guess
774 wrong, the user may either add |\newpage| himself or he may redefine
775 |\CwebEjectSection| in a package.
776
777 \beginprog
778 \def\CwebEjectSection#1{% % #1 == rank
779 \gdef\CwebEjectSection##1{%
780 \relax
781 \ifnum ##1<\CwebRankNoEject\relax
782 \newpage
783 \fi
784 }%
785 }
786
787 \if@titlepage
788 \CwebEjectSection{}
789 \fi
790 \endprog
791
792
793 \sect Now comes a heary piece. We have 11~section ranks, and need 11
794 different section categories, section counters, etc. For flat
795 structure, they shall all do the same; for hierarchic structure, they
796 shall be really different.
797
798 \noindent Let's have a look at the hierarchic structure first, it's
799 more complex.
800 %
801 \begin{itemize}
802
803 \item We associate section rank~0 (that's `|@**|') with document
804 parts, i.e., map it to |\part|. Many smaller programs won't use it.
805
806 \item If we are used in a class that has a bound cseq |\chapter|, we
807 associate rank~1 (`|@*0|') with it and rank~2 (`|@*1|') with
808 |\section|. Otherwise we associate rank~1 with |\section|. These
809 tags (|\chapter| and/or |\section|) must be defined because many
810 macros that want to create section divisions will use them.
811
812 \item All other section ranks are placed below |\section|.
813 |\subsection| and other \LaTeX{} style markup is not supported.
814
815 For hierarchic structure, we identify these sections with category
816 names `|section|$l$', where $l$ is the respective level, computed
817 from the rank. Those section names do not exist yet, we have to
818 create them.
819
820 \end{itemize}
821
822 Now we come to the point why we can't use the rank as the section
823 level passed to \LaTeX{}: When we assume the level usage of \LaTeX{}'s
824 standard classes, |\section| is \emph{always} on level~1, independent
825 of the existence of |\chapter|. The latter is placed on level~0, its
826 existence only influences the section level of |\part|, which is
827 either $-1$ or~0.
828
829 This implies that |\subsection| in a standard class is always on
830 level~2, but our equivalent section division is either `|@*0|'
831 (rank~1) or `|@*1|' (rank~2). I.e., when we have chapters, we use a
832 level that's one lower than the rank, otherwise we use the rank.
833
834 For flat structure, we use type |chunk|. This way we'll use the chunk
835 numbers, they are already set up.
836
837 For flat structure, we will map all ranks to the same section markup.
838 This markup will also be accessible by |\section| or |\chapter|. They
839 will be declared to be on a level that is the same as the rank.
840
841
842 \sect The printed representation of a section divison number is simply
843 the presentation from the next upper level, a full stop, and an arabic
844 section number. When we compute the name of the previous level we must
845 pay attention to our first section division created this way. This
846 division must be placed below |section|, without any following number.
847
848 Since registers are a valuable resource in \TeX{}, we have to take
849 care not to allocate a superfluous one.
850
851 \beginprog
852 \ifcase \cweb@structure
853 %% hierarchic
854 \newcounter{section2}[section]
855 \@namedef{thesection2}{\@nameuse{thesection}.\arabic{section2}}
856 \newcounter{section3}[section2]
857 \@namedef{thesection3}{\@nameuse{thesection2}.\arabic{section3}}
858 \newcounter{section4}[section3]
859 \@namedef{thesection4}{\@nameuse{thesection3}.\arabic{section4}}
860 \newcounter{section5}[section4]
861 \@namedef{thesection5}{\@nameuse{thesection4}.\arabic{section5}}
862 \newcounter{section6}[section5]
863 \@namedef{thesection6}{\@nameuse{thesection5}.\arabic{section6}}
864 \newcounter{section7}[section6]
865 \@namedef{thesection7}{\@nameuse{thesection6}.\arabic{section7}}
866 \newcounter{section8}[section7]
867 \@namedef{thesection8}{\@nameuse{thesection7}.\arabic{section8}}
868 \newcounter{section9}[section8]
869 \@namedef{thesection9}{\@nameuse{thesection8}.\arabic{section9}}
870 \ifx \chapter\undefined
871 \newcounter{section10}[section9]
872 \@namedef{thesection10}{\@nameuse{thesection9}.\arabic{section10}}
873 \fi
874 \fi
875 \endprog
876
877
878 \sect Sections are typeset by |\CwebSection|; rank and title are the
879 arguments.
880
881 For hierarchic structure, we select the proper cseq according to rank:
882 |\part|, |\chapter| if this is a structure with chapters, |\section|,
883 and |\cwbb@section{|\<rank>|}| for other ranks. For the last cseq we
884 also have to supply the section category, it's `|section|$l$' where
885 $l$ is the rank~$r$ if we don't have chapters, $r-1$ otherwise.
886
887 That category cannot be computed by |\cwbb@section| itself since we
888 want to use that macro also for flat structure. But there all sections
889 are basically chunks, we have to use the |chunk| category there. Since
890 we want to differentiate them in the table of contents nevertheless,
891 we record the current rank in the title.
892
893 \beginprog
894 \ifcase \cweb@structure
895 %% hierarchic
896 \ifx \chapter\undefined
897 \def\CwebSection#1#2{%
898 \ifcase #1
899 %% 0
900 \let\next\part
901 \or %% 1
902 \let\next\section
903 \else %% level = rank
904 \def\cwbb@sect_name{section#1}%
905 \def\next{\cwbb@section{#1}}%
906 \fi
907 \next{#2}%
908 }
909 \else
910 \def\CwebSection#1#2{%
911 \ifcase #1
912 %% 0
913 \let\next\part
914 \or %% 1
915 \let\next\chapter
916 \or %% 2
917 \let\next\section
918 \else %% level = rank - 1
919 \count@=#1 \advance \count@\m@ne
920 \edef\cwbb@sect_name{section\number\count@}%
921 \edef\next{\noexpand\cwbb@section{\number\count@}}%
922 \fi
923 \next{#2}%
924 }
925 \fi
926 \or
927 %% flat
928 \def\CwebSection#1#2{%
929 \def\cwbb@sect_name{chunk}%
930 \cwbb@section{#1}{\protect\cwbbRank{#1}#2}%
931 }
932 \def\section{%
933 \def\cwbb@sect_name{chunk}%
934 \cwbb@section{1}%
935 }
936 \fi
937 \endprog
938
939
940 \sect We use the same layout for all minor sections. That layout can
941 be changed by ammended by defining |\CwebSect|$r$|Hook| to redefine
942 |\CwebSectPreSkip| and/or |\CwebSectLayout| locally. (Of couse, it may
943 be redefined once globally, too.) These are the values to be used for
944 arguments 4 and~5 of |\@startsection|, pay attention to the skip sign,
945 telling about indentation of the first paragraph. And don't forget
946 that the skip is only used for sections on ranks below
947 |\CwebRankNoEject|, the others start on a new page anyhow.
948
949 The default definition sets the section title in bold and leaves the
950 same space as before chunks. The first paragraph of the following
951 documentation has no indentation.
952
953 Other layout changes (indentation for heading, etc.)\ must be made by
954 redefining |\cwbb@section|. Or---email me, if you want to do it. Then
955 I might be enclined to introduce further possibilities.
956
957 \beginprog
958 \newskip\CwebSectPreSkip
959 \CwebSectPreSkip = -\CwebChunkPreSkip
960 \def\CwebSectLayout{\normalfont\bfseries}
961
962 \def\cwbb@section#1{% % #2 (next token) is title
963 \csname CwebSect#1Hook\endcsname % \relax if undefined
964 \expandafter\@startsection
965 \expandafter{\cwbb@sect_name}% % category; for counter, etc.
966 {#1}% % level is rank
967 \z@ % no indentation for heading
968 \CwebSectPreSkip % skip above, maybe no next par indent
969 \medskipamount % skip below heading
970 \CwebSectLayout
971 }
972 \endprog
973
974
975
976
977 \chap Marks.
978
979 \begin{fixme}
980 Since I don't know yet how to handle marks I ignore most of them for
981 the time being.
982
983 Have to change this later.
984 \end{fixme}
985
986 \beginprog
987 \let\chunkmark\@gobble
988
989 \count@=2
990 \@whilenum \count@<11 \do {
991 \expandafter\let \csname section\number\count@ mark\endcsname \@gobble
992 \advance \count@ by 1
993 }
994 \endprog
995
996
997
998
999 \chap Typesetting programs.
1000
1001 Program pieces come in two flavours: as argument of |\PB|, or as
1002 material after |\B|. In the former case we can use a group for the
1003 switch to the restricted program state, the group end will restore the
1004 previous state again. In the latter case we use |\B| for the switch to
1005 program state, the cross reference list or the next chunk will go to
1006 another state. Since we have to do more for the material after |\B|,
1007 we define this cseq later.
1008
1009 \beginprog
1010 \def\PB#1{%
1011 \begingroup
1012 \cwbb@Rprogram
1013 \leavevmode
1014 #1%
1015 \endgroup
1016 }
1017 \endprog
1018
1019
1020 \sect Note, that |\Y| cannot just be |\smallskip|, as in Plain
1021 \cweb{}. We must assert that the current paragraph is ended before the
1022 vertical glue is inserted, and that's not done by the \LaTeX{}
1023 definition of |\smallskip|. In addition we add some negative penalty,
1024 here is a good place for a page break. As the penalty value we use
1025 half the chunk break penalty---of course a chunk start is an even
1026 better place for a page break\,\dots
1027
1028 It might be that |\Y| is the very first token in a chunk. Then the
1029 chunk start marker isn't set already since it is regarded as a run-in
1030 section heading. In that case we don't set the vertical skip but
1031 simply start the chunk with the program part.
1032
1033 \TeX{}nical note: The flag |@noskipsec| may be used to test if we're
1034 immediately after a run-in section heading.
1035
1036 \beginprog
1037 \newcount\CwebProgPenalty
1038 \CwebProgPenalty=\@secpenalty
1039 \divide\CwebProgPenalty by 2
1040 \def\Y{%
1041 \if@noskipsec
1042 \else
1043 \par
1044 \penalty\CwebProgPenalty
1045 \smallskip
1046 \fi
1047 }
1048 \endprog
1049
1050
1051 \sect Yep, let's unfold the ``official'' names of the cseqs used in
1052 program state.
1053
1054 If we turn on the \cweave{} bindings, they might be in effect already,
1055 we don't need to establish them again. We can test
1056 |\cwbb@user_bindings| for this case, it will be redefined then.
1057
1058 \beginprog
1059 \def\cwbb@cweave_bindings{%
1060 \ifx \cwbb@user_bindings\relax
1061 \cwbb@rebind
1062 % indentation and paragraph layout
1063 \cwbb@incr_indent \1%
1064 \cwbb@decr_indent \2%
1065 \cwbb@expr_break \3%
1066 \cwbb@backup \4%
1067 \cwbb@opt_break \5%
1068 \cwbb@break \6%
1069 \cwbb@big_break \7%
1070 \cwbb@noindent \8%
1071 % C/C++ tokens
1072 \CwebRel \?%
1073 \CwebAddress \AND
1074 \CwebComplement \CM
1075 \CwebScope \DC
1076 \CwebEquiv \E
1077 \CwebGe \G
1078 \CwebRightShift \GG
1079 \CwebNe \I
1080 \CwebAssign \K
1081 \CwebLeftShift \LL
1082 \CwebMod \MOD
1083 \CwebNull \NULL
1084 \CwebNot \R
1085 \CwebBinOr \OR
1086 \CwebMemberRef \PA
1087 \CwebThis \this
1088 \CwebOr \V
1089 \CwebAnd \W
1090 \CwebXor \XOR
1091 \CwebLe \Z
1092 \CwebPointer \MG
1093 \CwebPointerMemberRef \MGA
1094 \CwebDecr \MM
1095 \CwebIncr \PP
1096 % more tokens
1097 \CwebId \\%
1098 \CwebIdLetter \|%
1099 \CwebRes \&%
1100 \CwebString \.% %% ( ...Emacs...
1101 \CwebStringBreak \)%
1102 \CwebNumber \T
1103 \CwebCombinedOp \MRL
1104 % goes to TeX state
1105 \CwebComment \C
1106 \CwebCxxComment \SHC
1107 \CwebRefName \X
1108 % CWEB tokens
1109 \CwebMacrosHere \ATH
1110 \CwebDefine \D
1111 \cwbb@format \F
1112 \CwebIdCat \J
1113 \CwebVerbString \vb
1114 % cross reference tags
1115 \cwbb@change_flag \*%
1116 \CwebCRAlso \A
1117 \CwebCRsAlso \As
1118 \CwebCRCite \Q
1119 \CwebCRsCite \Qs
1120 \CwebCRUse \U
1121 \CwebCRsUse \Us
1122 \CwebCREt \ET
1123 \CwebCRsEt \ETs
1124 % finish the list
1125 \stop\stop
1126 \def\cwbb@user_bindings{%
1127 \cwbb@restore_bindings
1128 \let\cwbb@user_bindings\relax
1129 }%
1130 \fi
1131 }
1132 \endprog
1133
1134
1135 \sect Since most of the \cweave{} bindings are simple and tedious
1136 coding, we'll have a look at the program layout next. Between two
1137 paragraphs there must not be any skip, the skip used in document
1138 layout is saved in |\cwbb@save@parskip|. A few other layout
1139 parameters from the document layout must be saved as well.
1140
1141 \beginprog
1142 \newskip\cwbb@save@parskip
1143 \newskip\cwbb@save@rightskip
1144 \newcount\cwbb@save@sem_sfcode
1145 \newcount\cwbb@save@pretolerance
1146 \newcount\cwbb@save@hyphenpenalty
1147 \newcount\cwbb@save@exhyphenpenalty
1148
1149 \def\cwbb@save_doc_layout{%
1150 \cwbb@save@parskip\parskip
1151 \cwbb@save@rightskip\rightskip
1152 \cwbb@save@sem_sfcode\sfcode`\;
1153 \cwbb@save@pretolerance\pretolerance
1154 \cwbb@save@hyphenpenalty\hyphenpenalty
1155 \cwbb@save@exhyphenpenalty\exhyphenpenalty
1156 }
1157 \def\cwbb@restore_doc_layout{%
1158 \parskip\cwbb@save@parskip
1159 \rightskip\cwbb@save@rightskip
1160 \sfcode`\;=\cwbb@save@sem_sfcode
1161 \pretolerance\cwbb@save@pretolerance
1162 \hyphenpenalty\cwbb@save@hyphenpenalty
1163 \exhyphenpenalty\cwbb@save@exhyphenpenalty
1164 }
1165 \endprog
1166
1167
1168 \sect When |\cwbb@program_layout| is called for the very first time
1169 we have to set up some variables. This cannot be done in advance
1170 since they depend on values which might be changed by the user in the
1171 preamble. This setup is done in |\cwbb@layout_init|.
1172
1173 If the program layout is already active, we must not switch it on
1174 another time. This can be tested by the current binding of
1175 |\cwbb@doc_layout|.
1176
1177 \beginprog
1178 \def\cwbb@program_layout{%
1179 \ifx \cwbb@doc_layout\relax
1180 \cwbb@layout_init
1181 \cwbb@save_doc_layout
1182 \def\cwbb@doc_layout{%
1183 \cwbb@restore_doc_layout
1184 \let\cwbb@doc_layout\relax
1185 }%
1186 % set new values
1187 \parskip\z@skip
1188 \rightskip\z@ plus 100\p@ minus 10\p@
1189 \sfcode`\;=3000
1190 \pretolerance\@M
1191 \hyphenpenalty 1000 % strings can be broken this way
1192 \exhyphenpenalty\@M
1193 \fi
1194 }
1195 \endprog
1196
1197
1198 \sect The unit of the basic indentation is stored in
1199 |\CwebIndentUnit|. Continuation lines are indented two units further,
1200 i.e., the initial hanging indentation is 3~units. The current hanging
1201 indentation is kept in |\cwbb@indent|.
1202
1203 We need undiscardable items which can be used as backspaces, of one
1204 and two units, respectively. This is done best by boxes. The
1205 initialization of the boxes must be postponed until the user had the
1206 chance to change |\CwebIndentUnit|, it's done in the program state
1207 initialization.
1208
1209 \beginprog
1210 \newdimen\CwebIndentUnit
1211 \CwebIndentUnit=1em
1212 \newdimen\cwbb@indent
1213
1214 \newbox\cwbb@bak % backspace one unit
1215 \newbox\cwbb@bakk % backspace two units
1216
1217 \def\cwbb@layout_init{%
1218 \global\setbox\cwbb@bak \hbox to -1\CwebIndentUnit{}%
1219 \global\setbox\cwbb@bakk \hbox to -2\CwebIndentUnit{}%
1220 \global\let\cwbb@layout_init\relax
1221 }
1222 \endprog
1223
1224
1225 \sect Now we can formulate how to start typesetting program pieces: We
1226 switch to program state, set the initial indentation, and add the
1227 basic indentation of the first code line. Then we might add a marker
1228 to this program part; for hierarchic structure we want to typeset the
1229 chunk number in the margin of the chunk's program part. That's not
1230 really possible, 'though: definitions and format requests are also
1231 introduced with |\B|, so the chunk number will happen to be at the
1232 start of the definition part if one exists.
1233
1234 If the code line is the very first text to be typeset in this chunk,
1235 we don't add the basic indentation---we're already indented from the
1236 run-in chunk start marker. But we must not start our chunk with
1237 |\noindent|, the marker would be typeset in the left margin then. (I
1238 consider this as a \LaTeX{} error.) So we just emulate an empty
1239 documentation part, the marker is now set correctly. |\B| can test for
1240 this case: |@noskipsec| is still true then.
1241
1242 \beginprog
1243 \def\B{%
1244 \cwbb@program
1245 \cwbb@indent 3\CwebIndentUnit \hangindent\cwbb@indent
1246 \ifvmode
1247 \if@noskipsec
1248 \indent % add an empty documentation part
1249 \else
1250 \noindent \kern\CwebIndentUnit
1251 \fi
1252 \fi
1253 \CwebNumberProgramPart
1254 }
1255 \endprog
1256
1257
1258 \sect The chunk number shall be added at the first program part. We
1259 have a hook in the chunk start where we can set up
1260 |\CwebNumberProgramPart|. It will redefine itself at first call, to
1261 disable further output on more |\B| occurences in a chunk.
1262
1263 The chunk number should always be in the left margin. If it's in the
1264 right margin, there would be too much horizontal space between the
1265 code start and the actual number. (The first code line is typically
1266 not very long.) \LaTeX{} does not allow to select the margin for
1267 marginpars, therefore we have to typeset the marginal note `by hand'.
1268 As we know that we're in horizontal mode when we're called, |\vadjust|
1269 is used to create the note. The standard \LaTeX{} dimen register for
1270 the distance between marginal notes and text matter is used, of
1271 course.
1272
1273 Note that marginal notes may overwrite the chunk number. As it's very
1274 unlikely that somebody issues marginal notes in program mode (that's
1275 quite difficult and involves ingenious usage of the implementation of
1276 this macros), I won't care for that case.
1277
1278 \begin{fixme}
1279 The baseline of the marginal note shall be aligned to the baseline
1280 of the preceding line. That does not happen by default. Currently, I
1281 assume that the preceding line has a depth of appropriately the
1282 depth of a~`g'. Experiments showed that this gives good results for
1283 most \cweb{} documents. But nevertheless one should determine the
1284 exact depth of the preceding line, to know how much |box0| should be
1285 raised. If anybody knows how this can be done, please tell me. (I
1286 know about the route over the output routine, implementing an own
1287 marginal note category, but this seems too much effort.)
1288 \end{fixme}
1289
1290 For flat structure, we don't add any program part marker and we
1291 don't need to initialize it.
1292
1293 \beginprog
1294 \ifcase \cweb@structure
1295 %% hierarchic
1296 \def\cwbb@marginal_chunkno{%
1297 \vadjust{%
1298 \setbox\z@ \hbox to \z@{%
1299 \hss \vphantom{g}%
1300 \small \thechunk
1301 \hskip \marginparsep
1302 }%
1303 \vbox to \z@{%
1304 \hsize\z@
1305 \vss
1306 \noindent \raise \dp\z@ \box\z@
1307 }%
1308 }%
1309 }
1310 \def\cwbb@init_print_chunk{%
1311 \def\CwebNumberProgramPart{%
1312 \cwbb@marginal_chunkno
1313 \let\CwebNumberProgramPart\relax
1314 }%
1315 }
1316 \or
1317 %% flat
1318 \let\cwbb@init_print_chunk\relax
1319 \let\CwebNumberProgramPart\relax
1320 \fi
1321 \endprog
1322
1323
1324 \sect If a statement is finished, a new paragraph with the basic
1325 indentation has to be started.
1326
1327 An optional statement break is implemented by a low penalty which
1328 will be selected if the line has to be broken. We assume that the
1329 hanging indentation of the new line is already set correctly, and
1330 have to backup two units to get the basic indentation. It might be
1331 that the line break is not chosen by \TeX{}, we compensate the
1332 backspace for this case. This compensation is discarded at the start
1333 of a new line.
1334
1335 \beginprog
1336 \def\cwbb@break{% % forced break, between statements
1337 \ifmmode\else
1338 \endgraf % in LaTeX it isn't sure what \par is really...
1339 \noindent
1340 \hangindent\cwbb@indent \kern\cwbb@indent
1341 \copy\cwbb@bakk % go back to basic indentation
1342 \ignorespaces
1343 \fi
1344 }
1345 \def\cwbb@opt_break{% % optional break between statements
1346 \hfil \penalty\m@ne
1347 \hfilneg \kern .5em \kern 2\CwebIndentUnit % discarded on line break
1348 \copy\cwbb@bakk
1349 \ignorespaces
1350 }
1351 \def\cwbb@big_break{% % forced break and a little extra space
1352 \Y
1353 \cwbb@break
1354 }
1355 \def\cwbb@expr_break#1{% % break with penalty #1 * 10
1356 \hfil \penalty#10
1357 \hfilneg % discarded on line break
1358 }
1359 \endprog
1360
1361
1362 \sect When we increment the indentation, we must not forget to set
1363 the hanging indentation immediately since |\cwbb@opt_break| relies on
1364 the new value. If a continuation line is needed it will also be
1365 indented one unit more, which is ok since it should be distinguishable
1366 from the next line.
1367 %
1368 \begin{fixme}
1369 Shouldn't the hanging indentation be set anew at the end of
1370 |\cwbb@decr_indent| as well?
1371 \end{fixme}
1372
1373 \beginprog
1374 \def\cwbb@incr_indent{%
1375 \global\advance\cwbb@indent\CwebIndentUnit
1376 \hangindent\cwbb@indent
1377 }
1378 \def\cwbb@decr_indent{\global\advance\cwbb@indent -\CwebIndentUnit}
1379 \def\cwbb@backup{\copy\cwbb@bak}
1380 \def\cwbb@noindent{% % no indentation
1381 \hskip -\cwbb@indent \hskip 2\CwebIndentUnit
1382 }
1383 \endprog
1384
1385
1386
1387
1388 \chap Program (C or \C++) tokens.
1389
1390 Since the user might want to change the (somewhat unusual) way some
1391 of the operators are typeset, we supply names for them.
1392
1393 \beginprog
1394 \let\CwebAnd=\land % logical and, &&
1395 \let\CwebEquiv=\equiv % equiv sign, for ==
1396 \let\CwebGe=\ge % greater or equal
1397 \let\CwebLe=\le % less or equal
1398 \let\CwebNe=\ne % unequal, !=
1399 \let\CwebNull=\Lambda % NULL pointer
1400 \let\CwebNot=\lnot % logical not, !
1401 \let\CwebOr=\lor % logical or, ||
1402 \let\CwebXor=\oplus % bitwise exclusive or, ^
1403 \endprog
1404
1405
1406 \sect Some symbols have to be shifted around, to save computation time
1407 we put them in boxes.
1408
1409 \begin{fixme}
1410 It's not sure if the following symbols still look good in other font
1411 families than Computer Modern. The movements might need to get
1412 adapted when more experience is available. They were chosen from
1413 Plain \cweb{}, where these were explicit movements measured in
1414 points. I changed the dimension to quads, to achieve at least the
1415 support for different sizes in the Computer Modern family.
1416 \end{fixme}
1417
1418 \TeX{}nical note: The pointer symbol must not be declared as a math
1419 symbol (e.g., with |\DeclareMathSymbol|). Then \TeX{} would insert an
1420 italic correction behind it, according to rule~17 from appendix~G.
1421 (Please send email if you know of an easy way to prevent that
1422 addition.) So I use the symbol as an accent, but then I have to supply
1423 a nucleus for this math list. That nucleus also determines the total
1424 width of this construct. As the vector accent has a width of
1425 approximately 5\,pt in |cmmi10|, I'm going to use 0.5\,em. (That
1426 heuristic is as good as any other I can think of.)
1427
1428 \beginprog
1429 %% pointer to struct component (`->'), use symbol of \vec accent
1430 \newbox\cwbb@pointer
1431 \setbox\cwbb@pointer=\hbox{%
1432 \kern -.2em
1433 \lower .3em \hbox{$\vec{\kern .5em}$}%
1434 \kern .1em
1435 }
1436
1437 \newbox\cwbb@decr % decrement, --
1438 \setbox\cwbb@decr=\hbox{%
1439 \kern .05em
1440 \raise .1em \hbox{$\scriptstyle {-}\kern -.1em{-}$}%
1441 \kern .05em
1442 }
1443 \newbox\cwbb@incr % increment, ++
1444 \setbox\cwbb@incr=\hbox{%
1445 \kern .05em
1446 \raise .1em \hbox{$\scriptstyle {+}\kern -.1em{+}$}%
1447 \kern .05em
1448 }
1449 \endprog
1450
1451
1452 \sect Although the following symbols are typeset like an ``ordinary
1453 \C++ programmer'' would expect them, we provide own module names
1454 nevertheless. They can now be changed as well, i.e., orthogonality is
1455 enhanced. (And we can use |\cwbb@rebind| for assigning them to their
1456 names while we switch to program state\,\dots).
1457
1458 Note: The comment at |\CwebMod| says ``modulo/remainder'', as this is
1459 not defined by the C standard, i.e., implementation-dependent.
1460
1461 \beginprog
1462 \mathchardef\CwebAddress="2026 % `&', as binary op
1463 \let\CwebAssign== % assignment
1464 \let\CwebBinOr=\mid % binary or
1465 \def\CwebComplement{{\sim}} % `~', as ordinary symbol
1466 \def\CwebDecr{\copy\cwbb@decr} % decrement
1467 \def\CwebIncr{\copy\cwbb@incr} % increment
1468 \let\CwebLeftShift=\ll % left shift, <<
1469 \def\CwebMod{\mathbin{\hbox{\footnotesize\rm\%}}} % modulo/remainder, %
1470 \def\CwebMemberRef{\mathbin{.*}} % ptr to member (on object)
1471 \def\CwebPointer{\copy\cwbb@pointer}
1472 \def\CwebPointerMemberRef{\mathbin{\CwebPointer*}} % ptr to member (on ptr)
1473 \def\CwebRel{\mathrel?} % relation operator
1474 \let\CwebRightShift=\gg % right shift, >>
1475 \def\CwebScope{\kern.1em{::}\kern.1em} % scope resolution
1476
1477 \def\CwebThis{\CwebRes{this}} % reserved identifier `this'
1478 \endprog
1479
1480
1481 \sect The special identifier |\TeX| remains. In math mode it shall be
1482 the identifier, in other modes the usual logo. We use the definition
1483 supplied by DEK (or \textsc{Silvio Levy}?)\ from Plain \cweb{}.
1484
1485 \beginprog
1486 \def\TeX{%
1487 {%
1488 \ifmmode\it\fi
1489 \mbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125emX}%
1490 }}
1491 \endprog
1492
1493
1494 \sect Some tokens don't have constant names, the name is supplied as
1495 the argument.
1496
1497 Identifiers are typeset in italics, reserved words and type names in
1498 boldface, and strings in typewriter. For an underscore in the bold
1499 words we use a line that's 50\,\% thicker as the usual line thickness.
1500 -- But what is the usual line thickness. As Knuth uses 0.4\,pt for a
1501 10\,pt Computer Modern font, we'll use 0.06\,em for a CM font in an
1502 arbitrary size. If that line thickness is still OK for other fonts is
1503 doubtful, as it should fit to the stem width. (CM is a rather light
1504 font, after all.) But since there is no font dimension that gives a
1505 hint to an appropriate line thickness, it's our best try.
1506
1507 \beginprog
1508 \def\CwebCombinedOp#1{\mathrel{\let\K==#1}} % e.g., += operator
1509 \def\CwebId#1{\hbox{\it#1\/\kern.05em}} % identifier, more than one char
1510 \def\CwebIdLetter#1{\hbox{$#1$}} % identifier, one letter
1511 \def\CwebRes#1{% % reserverd words and type names
1512 \hbox{\bf
1513 \def\_{\kern.04em\vbox{\hrule width.3em height.06em}\kern.08em}%
1514 #1\/\kern .05em
1515 }%
1516 }
1517 \endprog
1518
1519
1520 \sect In Plain \cweb{} strings are typeset in the font |cmtex10|,
1521 which is a typewriter font with extended ASCII characters. This font
1522 does not have the usual accents and can therefore not used for
1523 typesetting national characters. (Very often they are input in some
1524 8-bit encoding, the respective character code is made active and is
1525 substituted by a cseq which expands to the correct glyph. Of course,
1526 there are better ways, but that's the reality we have to cope with.)
1527 Instead of this special font we use the standard typewriter font.
1528 This has the further advantage that |cmtex10| may not be introduced
1529 to NFSS\@.
1530
1531 \beginprog
1532 \def\CwebString{%
1533 \hbox \bgroup
1534 \tt
1535 \cwbb@string_setup
1536 \cwbb@string
1537 }
1538 \def\cwbb@string#1{%
1539 #1\kern .05em
1540 \egroup
1541 }
1542 \endprog
1543
1544
1545 \sect Within strings certain cseqs have a special meaning; this is
1546 introduced by |\cwbb@string_setup|. The cseqs within strings are
1547 mostly special \TeX{} characters that are to be typeset by cseqs with
1548 the same name.
1549
1550 But a problem remains: active characters. They will still expand, and
1551 will mess up the string visualization. This is a particular problem
1552 with |german.sty| where the double quote is active. (Of course, that's
1553 a problem -- I'm German. :--) When one typesets strings, a double
1554 quote shall be typeset as double quotes, and must not expand to the
1555 special meaning. Remember that double quotes happen to appear quite
1556 often in strings. As the string argument is already tokenized, one has
1557 to redefine the binding of $(\textit{\textup{symbol}}\ \textbf{.}\
1558 |#\"|)$.
1559
1560 \begin{fixme}
1561 Perhaps one might use a loop over all characters except the braces,
1562 and set their catcode to other. That would give us enough security.
1563
1564 For now, we handle only the double quote.
1565 \end{fixme}
1566
1567 Every once in a while we have discretionary breaks in a string,
1568 denoted by |\CwebStringBreak|. This break is shown with the C
1569 convention of escaped newlines.
1570
1571 \beginprog
1572 \def\cwbb@string_setup{%
1573 \chardef\ =`\ % % <-- two spaces !
1574 \chardef\&=`\&
1575 \chardef\\=`\\
1576 \chardef\^=`\^
1577 \chardef\_=`\_
1578 \chardef\{=`\{
1579 \chardef\}=`\}
1580 \chardef\~=`\~
1581 \catcode`\"=\CatOther
1582 }
1583
1584 \def\CwebStringBreak{\discretionary{\hbox{\tt\char`\\}}{}{}}
1585 \endprog
1586
1587
1588 \sect Numbers are typeset in different ways. We use the definition of
1589 Plain \cweb{}.
1590 %
1591 \begin{fixme}
1592 Should add a specification of the possible input and an explanation
1593 of the macros below. In particular, that the closing brace after
1594 |\aftergroup| is used much later is probably not grokked by most
1595 \TeX{} programmers.
1596 \end{fixme}
1597
1598 \beginprog
1599 \def\cwbb@oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
1600 \def\cwbb@hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}
1601
1602 \def\CwebNumber#1{% % octal, hex, or decimal constant
1603 \hbox{%
1604 $%
1605 \def\?{\kern.2em}%
1606 \def\$##1{\egroup\sb{\,\rm##1}\bgroup}% suffix to constant
1607 \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
1608 \let\~\cwbb@oct \let\^\cwbb@hex
1609 {#1}%
1610 $}%
1611 }
1612 \endprog
1613
1614
1615 \sect Comments are typeset in \TeX{} state. We add a hook, the user
1616 shall be able to change the layout (e.g., he might want another font).
1617 %
1618 \begin{fixme}
1619 Currently \C++ comments are typeset like C comments. This is
1620 horrible in usual circumstances, i.e., when complete blocks of text
1621 are prefixed with |//|. We should simply catenate all these text and
1622 typeset it as one paragraph, each line prefixed by |//|. But then we
1623 have to implement an |\everyline| first, and since that's not so
1624 easy we postpone it\,\dots
1625 \end{fixme}
1626 %
1627 In front of a C comment there is an optional stmt break, with 2\,quad
1628 in front if the line is not broken and 1.5\,quad if the line is broken.
1629
1630 \beginprog
1631 \def\CwebComment#1{%
1632 \5% % 0.5em will be discarded on line break
1633 \hskip 1.5em
1634 $/\ast\,$%
1635 {\cwbb@tex
1636 \CwebCommentHook
1637 #1%
1638 }%
1639 $\,\ast/$%
1640 }
1641 \let\CwebCommentHook\relax
1642 \let\CwebCxxComment\CwebComment
1643 \endprog
1644
1645
1646
1647
1648
1649 \chap \cweb{} tokens.
1650
1651 We distinguish three categories of \cweb{} tokens: (1) Those which
1652 output constant text, (2) those which have attributes to be displayed
1653 in a special way, and (3) those which start a new structure element,
1654 namely |@d| and~|@f|. Let's consider them in this order.
1655
1656
1657 \sect \cweb{} tokens which expand in a constant string are the
1658 identifier catenation operator~(`|@&|') and the macro placement
1659 directive~(`|@h|').
1660
1661 \beginprog
1662 \def\CwebIdCat{\CwebString{@\&}}
1663 \def\CwebMacrosHere{%
1664 \begingroup
1665 \def\CwebRefNumber##1{}%
1666 \CwebRefName :Preprocessor definitions\X
1667 \endgroup
1668 }
1669 \endprog
1670
1671
1672 \sect Verbatim program strings, i.e., strings passed verbatim by
1673 \ctangle{}~(`|@=|') are typeset like normal strings, but within a box.
1674 We use 2\,pt as the separating distance, this is set locally.
1675
1676 \beginprog
1677 \def\CwebVerbString#1{{\fboxsep\tw@\p@ \fbox{\CwebString{#1}}}}
1678 \endprog
1679
1680
1681 \sect The refinement names are typeset in angles, this has a long
1682 tradition. We burry the typesetting of the chunk number (which is
1683 the first parameter) in a macro call; the user may change this to
1684 achieve special effects.
1685 %
1686 \begin{fixme}
1687 One could think about handling special values of the chunk numbers
1688 differently. E.g., an empty argument is not typeset at all, a~0
1689 triggers a marginal note about a missing definition, etc.
1690 \end{fixme}
1691
1692 A refinement name may be typeset both in math and horizontal mode.
1693 The name itself is typeset in horizontal mode, of course; for the
1694 angles we need math mode. Therefore we assert at the start of the
1695 macro that we're not in math mode any more. At the end we switch back
1696 to math mode if we've started in it. This conditional switch from and
1697 back to math mode is done by |\cwbb@toggle_text|.
1698
1699 \TeX{}nical note: If we're in math mode |\cwbb@toggle_text| must be
1700 defined globally, as it will turn off math mode and the definition
1701 would be un-made then. The second invocation of |\cwbb@toggle_text|
1702 would be undefined then.
1703
1704 A refinement may also consist of the file name the expansion of this
1705 refinement shall be written to.
1706 %
1707 \label{sec:refname-dot}
1708 %
1709 This file name is tagged with |\.|, it shall be typeset like a string.
1710 But the user shall be able to use the dot accent in the refinement
1711 name as well. We check if the text consists solely of the tag and its
1712 argument; in this case we substitute |\.| with |\CwebString|.
1713 Otherwise we leave it as it is. Then a refinement name may not
1714 consist of a single dot-accented expression---well, that's highly
1715 unlikely. (Nevertheless I'll document it in the user's manual\,\dots)
1716
1717 \begin{fixme}
1718 One should be able to use |\EnsureMath| here. But the refinement
1719 name must not be set in math mode and must not be set in an hbox;
1720 the latter would prevent line breaks.
1721 \end{fixme}
1722
1723 \beginprog
1724 \def\CwebRefName#1:#2\X{%
1725 \ifmmode \gdef\cwbb@toggle_text{\null$\null}%
1726 \else \let\cwbb@toggle_text\relax
1727 \fi
1728 \cwbb@toggle_text
1729 $\langle\,${\cwbb@tex \cwbb@check_dot{#2}\CwebRefNumber{#1}}$\,\rangle$%
1730 \cwbb@toggle_text
1731 }
1732 \def\CwebRefNumber#1{%
1733 {\reset@font \footnotesize \kern .5em#1}%
1734 }
1735 \endprog
1736
1737
1738 \sect The next macro, |\cwbb@check_dot| is a hassle to implement. We
1739 must check if it's argument consists solely of a `|\.|'~tag, together
1740 with the argument to this tag. Then the `|\.|'-argument shall be
1741 typeset like a string, |\.| itself must be ignored.
1742
1743 The check for |\.| must not evaluate the parameter. Especially |\PB|
1744 must not be evaluated within, it would lead to havoc with the
1745 redefinition of all bindings, etc. (At least that's the empirical
1746 result---it happened; although I don't know where the problems are.
1747 Anyhow, it wasn't in the specs of the rebinding process.) All other
1748 cseqs which shouldn't be used in moving arguments may cause problems
1749 here, too. Note that |\protect| is no solution here, the user often is
1750 not aware of the presence of \cweave{}-generated tags. As an example,
1751 consider the refinement \verb"@< local variables of |foo| @>|" which
1752 will lead to a call with the argument `|local variables of \PB{\\{foo}}|'.
1753 |\\| must not be evaluated here.
1754
1755 I use an approach where I hope that it will work---but to be honest,
1756 I'm not sure. I want to define a macro |\next| which shall have an
1757 empty expansion iff |#1| was a `|\.|'~tag with its argument. Empty
1758 refinement names are not allowed so we can assume that |#1| consists
1759 of at least one token. I evaluate the first token of |#1| before the
1760 |\def| is done. With an appropriate binding a |\.| will disappear,
1761 perhaps leaving an empty token list. I also take care that |\PB| is
1762 not evaluated then, by temporary rebinding it to |\relax|. Thereby I
1763 have taken care for all cseqs \cweave{} might have introduced at the
1764 very front of |#1|. Other cseqs are user-tags. If they cause
1765 problems, the user might circumstance them by adding |\protect|.
1766
1767 \beginprog
1768 \def\cwbb@check_dot#1{%
1769 \begingroup
1770 \let\.\@gobble
1771 \let\PB\relax
1772 \expandafter\def \expandafter\next \expandafter{#1}%
1773 \ifx \next\empty
1774 \gdef\next##1{\CwebString}%
1775 \else
1776 \global\let\next\relax
1777 \fi
1778 \endgroup
1779 \next #1%
1780 }
1781 \endprog
1782
1783
1784 \sect \cweb{} macro definitions (done by~|@d|) and format directives are
1785 basically program text. When they are started we are already in
1786 program state, i.e., |\B| has appeared in front of it. But since we have
1787 an introductionary identifier (either |#define| or |format|) to set at
1788 the very front we increase the indentation by three units.
1789
1790 The output of format directives may be suppressed. Then we have to
1791 gather both identifiers that will appear after |\F|. Both of them
1792 consist of one group-token (a cseq and the identifier name), after
1793 each identifier one other token separates them. I.e., we have to
1794 gobble six group-tokens. As the very last token is |\par| if a format
1795 directive follows directly on another one, the definition must be
1796 long.
1797
1798 \TeX{}nical note: |\cwbb@format| must expand to |\CwebFormat|, not to
1799 its expansion. Otherwise a redefinition of |\CwebFormat| in a package
1800 would not be used.
1801
1802 \beginprog
1803 \def\CwebDefine{\cwbb@macro{\#define}}
1804 \def\CwebFormat{\cwbb@macro{format}}
1805 \if@cweb@suppress@format@
1806 \long\def\cwbb@format#1#2#3#4#5#6{}
1807 \else
1808 \def\cwbb@format{\CwebFormat}
1809 \fi
1810
1811 \def\cwbb@macro#1{%
1812 \global\advance\cwbb@indent \tw@\CwebIndentUnit
1813 \cwbb@incr_indent
1814 \CwebRes{#1 }% % <-- blank!
1815 }
1816 \endprog
1817
1818
1819
1820
1821 \chap Refinement cross references and changes.
1822
1823 At the end of chunks with refinements, \cweave{} may output cross
1824 reference information: In which chunks additional definitions for
1825 this refinement are found, where this refinement is used, and where it
1826 is cited. This cross reference information is always introduced by a
1827 tag followed by a non-empty list of chunk numbers. Different tags
1828 are used for lists with only one element and for lists with more than
1829 one element, this way the introductionary text may be adapted.
1830
1831 Within a list of $n$~chunk numbers the first $n-1$~numbers are
1832 separated by commas with one following blank. The last two numbers
1833 are separated by |\ET| if~$n=2$, and by |\ETs| if~$n>2$. If a chunk
1834 is changed by the changefile, a changeflag~(`|\*|') is appended to
1835 its number. The list is eventually terminated by a full stop.
1836
1837
1838 \sect We separate the cross reference information by a smallskip from
1839 the refinement or from a previous cross reference information. The
1840 information itself is typeset in a smaller font, as it is auxilliary,
1841 inserted stuff. The number list has a hanging indentation of
1842 |\CwebNumberListHangindent|. But beware: This isn't a dimension
1843 register, it's a macro. This way one can use ems as dimensions.
1844
1845 The actual size change is represented by a macro. We will redefine it
1846 when we need an other size, e.g., in the lists at the end of the
1847 document.
1848
1849 We must assert that we're in CR state while we set a cross reference.
1850
1851 The first parameter of a cross reference information unit is the
1852 introductionary text, the second is the number list. The parameters
1853 must be evaluated in a group---local parameter changes therein must
1854 not influence the environment.
1855
1856 \beginprog
1857 \def\CwebNumberListHangindent{2em}
1858 \let\CwebCRSize\footnotesize
1859 \def\CwebCrossRef#1#2.{%
1860 \par\smallskip
1861 \cwbb@CR
1862 \begingroup
1863 \reset@font \CwebCRSize
1864 \noindent \hangindent\CwebNumberListHangindent\relax
1865 #1~#2.\par
1866 \endgroup
1867 }
1868 \endprog
1869
1870
1871 \sect Well, let's define all introducing tags, which in fact start the
1872 cross reference information unit. The number list is gathered by
1873 |\CwebCrossRef|.
1874
1875 \beginprog
1876 \def\CwebCRAlso{\CwebCrossRef{See also chunk}}
1877 \def\CwebCRsAlso{\CwebCrossRef{See also chunks}}
1878
1879 \def\CwebCRCite{\CwebCrossRef{This code is cited in chunk}}
1880 \def\CwebCRsCite{\CwebCrossRef{This code is cited in chunks}}
1881
1882 \def\CwebCRUse{\CwebCrossRef{This code is used in chunk}}
1883 \def\CwebCRsUse{\CwebCrossRef{This code is used in chunks}}
1884
1885 \def\CwebCREt{ and~}
1886 \def\CwebCRsEt{, and~}
1887 \endprog
1888
1889
1890
1891
1892 \chap Bells and whistles.
1893
1894 \begin{fixme}
1895 Just copied from Plain \cweb{}. It doesn't work
1896 anyhow---|\char"|\<xy> usually doesn't typeset the correct
1897 character. That's because this character is most probably an active
1898 character; at least that's typical for the way \TeX{} systems are
1899 used in Europe. I have to think about the implementation.
1900 \end{fixme}
1901
1902 \beginprog
1903 \def\ATL{\par\noindent\bgroup\catcode`\_=12 \postATL} % print @l in limbo
1904 \def\postATL#1 #2 {\bf letter \\{\uppercase{\char"#1}}
1905 tangles as \tentex "#2"\egroup\par}
1906 \def\noATL#1 #2 {}
1907 \def\noatl{\let\ATL=\noATL} % suppress output from @l
1908 \endprog
1909
1910
1911
1912 \chap The end.
1913
1914 Well, after all we're finished with this module
1915
1916 \beginprog
1917 \endinput
1918 \endprog
1919
1920
1921
1922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1923
1924 \vskip \PltxPreSectSkip
1925
1926 \rcsLogIntro{After the actual revision log of this module, we give an
1927 extract of log messages of the \cls{cweb} class. This module was
1928 extracted from revision~2.8 of that class, we present to you the
1929 log entries that concern the code of the new module.}
1930
1931 \begin{rcslog}
1932 $StyleLog: cwebbase.doc,v $
1933 \Revision 1.4 1995/11/07 17:55:19 schrod
1934 \LaTeX{} \cweb{} should work at least with the last two \LaTeX{}
1935 versions; make it work with the previous-to-last one, version
1936 \mbox{$\langle$1994/12/01$\rangle$}. For that, one has to install the
1937 \mbox{$\langle$1995/06/01$\rangle$} (non-outer) definition of
1938 |\newif|, and |\hb@xt@| must not be used.\\
1939 Problem reported by Laurent Desnogues
1940 \path|<[email protected]>| and somebody else (XXX
1941 -- add name).
1942
1943 \Revision 1.3 1995/11/07 14:13:12 schrod
1944 Reset section numbers when higher-level section begins.\\
1945 Error reported by Bronne Louis \path|<[email protected]>|.
1946
1947 \Revision 1.2 1995/11/06 10:58:47 schrod
1948 Support active double quotes in strings. That happens when
1949 |german.sty| is used. Problems with other active characters may still
1950 appear.
1951
1952 \Revision 1.1 1995/09/12 23:02:22 schrod
1953 Moved all code that does the actual typesetting of \cweave{} tags and
1954 is therefore also needed for a |cweb| environment. It's now an own
1955 module named \pkg{cwebbase}.
1956
1957 Chunk markers and chunk marginal numbers don't hang below the
1958 baseline any more.
1959
1960
1961 \item[] \noindent\hrulefill\break
1962 \textbf{Extract of the revision log for |cweb.doc|:}
1963
1964 \vskip 2ex
1965
1966 \Revision 2.5 1995/08/29 02:07:26 schrod
1967 Discard dependencies on 10\,pt fonts.
1968
1969 Support suppression of format directives.
1970
1971 \Revision 2.4 1995/08/27 19:31:43 schrod
1972 Make configuration of change flag easier.
1973
1974 Put section title of changed chunks list in marks, and tell the user
1975 that it got typeset.
1976
1977 \Revision 2.3 1995/08/27 17:24:46 schrod
1978 Make usage of baseclass with chapters work.
1979
1980 \Revision 2.2 1995/08/27 13:26:22 schrod
1981 Add possibility to suppress change hints.
1982
1983 \Revision 2.1 1995/08/25 19:11:18 schrod
1984 Hierarchic structures are supported now, in addition to the flat
1985 structure of the beta-test version. One can choose with an option. For
1986 that step, the terminology was cleaned up, too: Chunks are not named
1987 sections any more. (That change involved reimplementation of almost
1988 all the structure and toc stuff.)
1989
1990 The chunk number supplied by \cweave{} is used now, not some computed
1991 number. Change flags are printed, too.
1992
1993 One can suppress output of unchanged sections.
1994
1995 \Revision 1.12 1993/08/10 14:15:43 schrod
1996 New page on main section only if group level $<$ |\cwebSecNoEject|.
1997 Default for the latter is 3.
1998
1999 \Revision 1.11 1993/08/10 11:21:07 schrod
2000 Reference to section number does not render a period after the
2001 number any more.
2002
2003 \Revision 1.10 1993/08/09 20:08:20 schrod
2004 |\cweb@cweave_bindings| is now a no-op if \cweave{} bindings are in
2005 effect already.\\
2006 (Problem reported by Michael M\"uller \path|<[email protected]>|.)
2007
2008 \Revision 1.9 1993/08/09 18:05:28 schrod
2009 Left shift operator wasn't defined correctly.\\
2010 (Problem reported by Michael M\"uller \path|<[email protected]>|.)
2011
2012 \Revision 1.6 1993/06/15 08:49:23 schrod
2013 |\cweb@check_dot| must not evaluate its argument in an |\edef|, this
2014 causes problems if a |\PB| is within. Now I try hard not to evaluate any
2015 tokens outside of my control.
2016
2017 Can use |\@defpar| for an empty line in |\cweb@has_entries|, don't
2018 need an own macro.
2019
2020 \Revision 1.4 1993/06/14 15:54:18 schrod
2021 Add FSA diagram about processing states. CR state is also switched
2022 to from \TeX{} state (that happens with |\ch| at the document end).
2023
2024 \Revision 1.3 1993/05/13 17:51:21 schrod
2025 Refinements may also be filenames (`|@(|'). Then the complete name
2026 consists of a |\.| macro call, which is handled now.\\
2027 (Problem reported by Michael M\"uller \path|<[email protected]>|.)
2028
2029 Made the detection of `|@.|' index entries more robust.
2030
2031 \Revision 1.2 1993/05/12 18:28:59 schrod
2032 Adapted to recent changes of \cweave{} (of April 93):
2033
2034 Main sections have a group level, represented in the table of
2035 contents. This changed the complete implementation of section tags.
2036
2037 New C token cseqs: |\Z| and |\MRL|, implemented as |\CwebLe| and
2038 |\CwebCombinedOp|.
2039
2040 \Revision 1.1 1993/04/09 15:00:37 schrod
2041 Initial revision
2042
2043 \end{rcslog}
2044
2045
2046
2047 \end{document}
2048
2049
2050
2051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2052 Local Variables:
2053 mode: LaTeX
2054 TeX-brace-indent-level: 4
2055 indent-tabs-mode: t
2056 TeX-auto-untabify: nil
2057 TeX-auto-regexp-list: LaTeX-auto-regexp-list
2058 compile-command: "make cwebbase.tex"
2059 End: