diff options
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctwill-mini.ch')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-mini.ch | 1302 |
1 files changed, 1021 insertions, 281 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index a3569f3442d..fba2f191f46 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -14,111 +14,110 @@ Section 1. @z @x -@d banner "This is CTWILL, Version 4.2" +A kind of ``user manual'' for \.{CTWILL} can be found in the appendix +{\bf 272.~Mogrify \.{CWEAVE} into \.{CTWILL}} and beyond, together +with additional material specific to \.{CTWILL}. % FIXME +Until then, \.{CWEAVE}'s sequence of sections will be preserved. + +The ``banner line'' defined here should be changed whenever \.{CTWILL} is @y +A kind of ``user manual'' for \.{CTWILL} can be found in section~\&{293} +and beyond, together with additional material specific to \.{CTWILL}. % FIXME \bigskip {\font\itt=cmitt10 \font\bit=cmbxti10 -\noindent \bit Editor's Note: \it Although {\itt CTWILL} is based on -{\itt cweave.w}, new and modified material is incorporated all over the place, -without taking special care to keep the original section numbering intact. -\smallskip -\noindent Moreover, this heavily redacted version of {\itt ctwill.pdf} had to -meddle with the section numbering even more, spreading tabular material over -several sections and splitting long sections into smaller chunks in order to -fix overful pages---both horizontally and vertically---, to make the overall -appearance of the {\itt CTWILL} documentation most pleasing to the -readers'~eyes. +\noindent \bit Editor's Note: \it This heavily redacted version of +{\itt ctwill.pdf} had to meddle with the section numbering of +{\itt cweave.w}, spreading tabular material over several sections +and splitting long sections into smaller chunks in order to +fix overful pages---both horizontally and vertically---, to make +the overall appearance of the {\itt CTWILL} documentation most +pleasing to the readers'~eyes. \smallskip \noindent Please do not try to compare this {\itt ctwill.pdf} to the one created by {\itt CWEAVE} instead of {\itt CTWILL}; the section numbering will -be even more ``off'' from {\itt cweave.w}. Care has been taken to give a +be quite ``off'' from {\itt cweave.w}. Care has been taken to give a faithful overall rendering of {\itt CTWILL}'s code, though. \hfill ----Enjoy!\bigskip} - -@d banner "This is CTWILL, Version 4.2" +---Enjoy!\par} +\bigskip +The ``banner line'' defined here should be changed whenever \.{CTWILL} is +@-banner@> +@$banner {CTWILL}1 =\.{"This\ is\ CTWILL"}@> @z Section 2. @x -@ Here is a sort of user manual for \.{CTWILL}---which is exactly like -@y -@* \.{CTWILL} user manual. -Here is a sort of user manual for \.{CTWILL}---which is exactly like -@z - -@x -give it the necessary hints in other places via your change file. +@ \.{CWEAVE} has a fairly straightforward outline. It operates in @y -give it the necessary hints in other places via your change file. -@-f@> -@-x@> +@r @ \.{CWEAVE} has a fairly straightforward outline. It operates in +@% +@$show_banner {CTWILL}14 =\\{flags}[\.{'b'}]@> +@$show_progress {CTWILL}14 =\\{flags}[\.{'p'}]@> @z -Section 3. +Section 4. @x -The current meaning of every identifier is initially `\.{\\uninitialized}'. -@y -@ The current meaning of every identifier is initially `\.{\\uninitialized}'. -@z +@d _(S) gettext(S) -@x -must have fewer than 50 characters. If the \TeX\ part starts +@<Include files@>= @y -must have fewer than 50 characters. - -@d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ - -@ If the \TeX\ part starts -@z - -Section 4. +@d _(S) gettext(S) +@-S@> -@x -@d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ -@y +@<Include files@>= +@-A@> +@-HAVE_GETTEXT@> @z Section 5. @x -@ \.{CWEAVE} has a fairly straightforward outline. It operates in +@d compress(c) if (loc++<=limit) return c @y -@* Introduction (continued). \.{CWEAVE} has a fairly straightforward outline. -It operates in +@d compress(c) if (loc++<=limit) return c +@-c@> @z -Section 7. +Section 6. @x -internationalization. +@ Code related to input routines: @y -internationalization. -@-A@> -@-HAVE_GETTEXT@> -@-S@> +@r @ Code related to input routines: +@-c@> @z -Section 9. +Section 7. @x -@ Code related to input routines: +@d cur_line line[include_depth] /* number of current line in current file */ @y -@ Code related to input routines: -@-c@> +@d cur_line line[include_depth] /* number of current line in current file */ +@-cur_file@> +@-cur_file_name@> +@-cur_line@> +@$cur_file {CTWILL}7 =\\{file}[\\{include\_depth}]@> +@$cur_file_name {CTWILL}7 =\hfil\break\\{file\_name}[\\{include\_depth}]@> +@$cur_line {CTWILL}7 =\\{line}[\\{include\_depth}]@> @z -Section 13. +Section 10. @x @ Code related to identifier and section name storage: @y @ Code related to identifier and section name storage: @-c@> +@-llink@> +@-rlink@> +@-root@> +@$llink {CTWILL}10 =\\{link}@> +@$rlink {CTWILL}10 =\\{dummy}.\\{Rlink}@> +@$root {CTWILL}10 =\\{name\_dir}$\MG$\\{rlink}@> @z -Section 15. +Section 12. @x @ Code related to error handling: @@ -127,15 +126,27 @@ Section 15. @-s@> @z -Section 17. +Section 14. @x extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ @y extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */ +@-show_banner@> +@-show_progress@> +@-show_happiness@> +@-show_stats@> +@-make_xrefs@> +@-check_for_change@> +@$show_banner {CTWILL}14 =\\{flags}[\.{'b'}]@> +@$show_progress {CTWILL}14 =\\{flags}[\.{'p'}]@> +@$show_happiness {CTWILL}14 =\\{flags}[\.{'h'}]@> +@$show_stats {CTWILL}14 =\\{flags}[\.{'s'}]@> +@$make_xrefs {CTWILL}14 =\\{flags}[\.{'x'}]@> +@$check_for_change {CTWILL}14 =\\{flags}[\.{'c'}]@> @z -Section 18. +Section 15. @x @ Code related to output: @@ -144,44 +155,74 @@ Section 18. @-a@> @-b@> @-c@> +@-update_terminal@> +@-new_line@> +@$update_terminal {CTWILL}15 =\\{fflush}(\\{stdout})@> +@$new_line {CTWILL}15 =\\{putchar}(\.{'\\n'})@> +@z + +Section 16. + +@x +@ The procedure that gets everything rolling: +@y +@r @ The procedure that gets everything rolling: @z -Section 23. +Section 17. + +@x +@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ +@y +@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ +@-long_buf_size@> +@$long_buf_size {CTWILL}17 =$\\{buf\_size}+\\{longest\_name}$@> +@z + +Section 20. @x @* Data structures exclusive to {\tt CWEAVE}. @y @* Data structures exclusive to {\tt CWEAVE}. @-a@> +@-ilk@> +@$ilk {CTWILL}20 =\\{dummy}.\\{Ilk}@> @z -Section 25. +Section 21. @x -@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. +@ We keep track of the current section number in |section_count|, which @y -@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. -@-p@> -@-x@> +@r @ We keep track of the current section number in |section_count|, which @z -Section 27. +Section 22. @x -@ \.{CTWILL} also has special data structures to keep track of current +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. @y -@r @ \.{CTWILL} also has special data structures to keep track of current +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. +@-p@> +@-x@> @z -Section 32. +Section 24. @x -@ The |new_meaning| routine changes the current ``permanent meaning'' +@d file_flag (3*cite_flag) @y -@r @ The |new_meaning| routine changes the current ``permanent meaning'' +@-file_flag@> +@-def_flag@> +@-xref@> +@$file_flag {CTWILL}24 =$\T{3}*\\{cite\_flag}{}$@> +@$def_flag {CTWILL}24 =$\T{2}*\\{cite\_flag}{}$@> +@$xref {CTWILL}24 =\\{equiv\_or\_xref}@> +@d file_flag (3*cite_flag) @z -Section 35. +Section 25. @x @ A new cross-reference for an identifier is formed by calling |new_xref|, @@ -189,34 +230,41 @@ Section 35. @ A new cross-reference for an identifier is formed by calling |new_xref|, @-a@> @-c@> +@-p@> +@-no_xref@> +@$no_xref {CTWILL}25 =$\R\\{make\_xrefs}$@> @z -Section 44. +Section 36. @x -@ We have to get \CEE/'s +@d underline '\n' /* this code will be intercepted without confusion */ @y -@r @ We have to get \CEE/'s +@d underline '\n' /* this code will be intercepted without confusion */ +@-begin_comment@> +@-underline@> +@$begin_comment {CTWILL}36 =\.{'\\t'}@> +@$underline {CTWILL}36 =\.{'\\n'}@> @z -Section 45. +Section 37. @x -id_lookup("goto",NULL,case_like); +@ Control codes are converted to \.{CWEAVE}'s internal @y -@ @<Store all...@>= -id_lookup("goto",NULL,case_like); +@r @ Control codes are converted to \.{CWEAVE}'s internal @z -Section 49. +Section 41. @x -@ Control codes are converted to \.{CWEAVE}'s internal + if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; @y -@r @ Control codes are converted to \.{CWEAVE}'s internal + if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; +@-c@> @z -Section 55. +Section 43. @x \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, @@ -241,50 +289,129 @@ The value of |cur_section_char| will be |'('| if the section name was preceded by \.{@@(} instead of \.{@@<}.\par} @z -Section 56. +Section 44. @x @ As one might expect, |get_next| consists mostly of a big switch @y @ As one might expect, |get_next| consists mostly of a big switch @-c@> +@$c {CTWILL}44 \&{eight\_bits}@> @z -Section 63. +Section 46. @x -@ The following code assigns values to the combinations \.{++}, +@d left_preproc ord /* begins a preprocessor command */ @y -@ The following code assigns values to the combinations \.{++}, -@-c@> +@-left_preproc@> +@$left_preproc {CTWILL}46 =\\{ord}@> +@d left_preproc ord /* begins a preprocessor command */ @z -Section 66. +Section 51. @x -@<Get a string@>= { + if (*(loc+1)=='*') {loc++;@+compress(minus_gt_ast);} @y -@<Get a string@>= {@+ + if (*(loc+1)=='*') {@+loc++;@+compress(minus_gt_ast);@+} @z -Section 70. +@x + else if (*loc=='.' && *(loc+1)=='.') { + loc++;@+compress(dot_dot_dot); + } break; +@y + else if (*loc=='.' && *(loc+1)=='.') {@+ + loc++;@+compress(dot_dot_dot);@+ + } break; +@z + +Section 52. @x -@ @<Put section name...@>= + id_first=--loc; + do + ++loc; + while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| + || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc)); + id_loc=loc; return identifier; +} @y -@r @ @<Put section name...@>= + id_first=--loc;@/ + do + ++loc; + while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| + || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));@/ + id_loc=loc;@/ + return identifier; +} @z -Section 84. +Section 53. @x +@d gather_digits_while(t) while (t || *loc=='\'') +@y +@d gather_digits_while(t) while (t || *loc=='\'') +@-t@> +@z + +Section 55. + +@x +@ @<Get a bin...@>={ +@y +@r @ @<Get a bin...@>={ +@z + +Section 58. + +@x +@ @<Get a wide...@>={ +@y +@r @ @<Get a wide...@>={ +@z + +Section 63. + +@x +@ @<If end of name...@>= +@y +@r @ @<If end of name...@>= +@z + +Section 72. + +@x +C_xref( /* makes cross-references for \CEE/ identifiers */ + eight_bits spec_ctrl) +@y +C_xref(eight_bits spec_ctrl) + /* makes cross-references for \CEE/ identifiers */ +@z + +@x + if (next_control=='|' || next_control==begin_comment || + next_control==begin_short_comment) return; +@y + if (next_control=='|' || next_control==begin_comment @| || + next_control==begin_short_comment) return; +@z + +Section 73. + +@x +@ The |outer_xref| subroutine is like |C_xref| except that it begins with |next_control!='|'| and ends with |next_control>=format_code|. Thus, it +handles \CEE/ text with embedded comments. @y +@ The |outer_xref| subroutine is like |C_xref| except that it begins with |next_control| |!='|'| and ends with |next_control>=format_code|. -Thus, it +Thus, it handles \CEE/ text with embedded comments. @z -Section 91. +Section 80. @x @ Finally, when the \TEX/ and definition parts have been treated, we have @@ -294,16 +421,19 @@ Section 91. \hfil\break|next_control>=begin_C|. @z -Section 97. +Section 86. @x @ The |flush_buffer| routine empties the buffer up to a given breakpoint, @y @ The |flush_buffer| routine empties the buffer up to a given breakpoint, +@-b@> @-c@> +@-tex_new_line@> +@$tex_new_line {CTWILL}86 =$\\{putc}(\.{'\\n'},\39\\{active\_file})$@> @z -Section 99. +Section 88. @x @ When we are copying \TEX/ source material, we retain line breaks @@ -311,24 +441,27 @@ Section 99. @r @ When we are copying \TEX/ source material, we retain line breaks @z -Section 101. +Section 89. @x -@ When we wish to append one character |c| to the output buffer, we write +@d proofing flags['P'] @y -@ When we wish to append one character |c| to the output buffer, we write -@-c@> +@d proofing flags['P'] +@-proofing@> +@$proofing {CTWILL}89 =\\{flags}[\.{'P'}]@> @z -Section 105. +Section 90. @x -@ We get to this section only in the unusual case that the entire output line +@ When we wish to append one character |c| to the output buffer, we write @y -@r @ We get to this section only in the unusual case that the entire output line +@ When we wish to append one character |c| to the output buffer, we write +@-c@> +@-s@> @z -Section 111. +Section 100. @x @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @@ -336,17 +469,7 @@ Section 111. @r @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @z -@x -static eight_bits -copy_TeX(void) -{ -@y -static eight_bits -copy_TeX(void) -{@+ -@z - -Section 112. +Section 101. @x @ The |copy_comment| function issues a warning if more braces are opened than @@ -356,16 +479,12 @@ Section 112. @z @x -int bal@t\2\2@>) /* brace balance */ -{ - char c; /* current character being copied */ + } else { @y -int bal@t\2\2@>) /* brace balance */ -{@+ - char c; /* current character being copied */ + } @+ else { @z -Section 117. +Section 106. @x @ Here is a list of the category codes that scraps can have. @@ -373,7 +492,7 @@ Section 117. @r @ Here is a list of the category codes that scraps can have. @z -Section 121. +Section 110--111. @x @ The token lists for translated \TEX/ output contain some special control @@ -382,8 +501,6 @@ Section 121. @-n@> @z -Section 122. - @x \yskip\noindent All of these tokens are removed from the \TEX/ output that @y @@ -391,7 +508,7 @@ Section 122. @-n@> @z -Section 123. +Section 112--117. @x @ The raw input is converted into scraps according to the following table, @@ -409,60 +526,63 @@ The raw input is converted into scraps according to the following table, \yskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr @z -Section 124. - @x -\.>&|prerangle|: \.{\\rangle}&yes\cr +\./&|binop|: \./&yes\cr @y -\.>&|prerangle|: \.{\\rangle}&yes\cr} +\./&|binop|: \./&yes\cr} @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 125. - @x -\.{continue}&|case_like|: \stars&maybe\cr +\.{complex}&|int_like|: \stars&yes\cr @y -\.{continue}&|case_like|: \stars&maybe\cr} +\.{complex}&|int_like|: \stars&yes\cr} -@r @ Cont. +@ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 126. - @x -\.{long}&|raw_int|: \stars&maybe\cr +\.{friend}&|int_like|: \stars&maybe\cr @y -\.{long}&|raw_int|: \stars&maybe\cr} +\.{friend}&|int_like|: \stars&maybe\cr} @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 127. +@x +\.{static\_cast}&|raw_int|: \stars&maybe\cr +@y +\.{static\_cast}&|raw_int|: \stars&maybe\cr} + +@ Cont. + +\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr +@z @x -\.{try}&|else_like|: \stars&maybe\cr +\.{xor\_eq}&|alfop|: \stars&yes\cr @y -\.{try}&|else_like|: \stars&maybe\cr} +\.{xor\_eq}&|alfop|: \stars&yes\cr} -@r @ Cont. +@ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Sections 128--135. +Sections 118--126. @x l.7 line numbers refer to 'prod.w' @ Here is a table of all the productions. Each production that @y @* Table of all productions. Each production that +@-time@> @z TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @@ -473,6 +593,8 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \newcount\prodno \newdimen\midcol \let\+\relax @z +Section 119. + @x l.78 \+& |lpar| |rpar| & |exp| \hfill $L\.{\\,}R$ & functions, declarations\cr @y @@ -489,9 +611,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-in@>@-x@>@-y@> \prodno=13 \midcol=2.5in @@ -504,6 +626,8 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z +Section 120. + @x l.45 |int_like| \alt|raw_int| |struct_like| & |extern "Ada" int|\cr @y @@ -519,9 +643,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-in@> \prodno=27 \midcol=2.5in @@ -534,13 +658,15 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z +Section 121. + @x l.75 \&{struct} \&{name\_info} $\{$\cr @y \&{struct} \&{name\_info} $\{$\cr \endgroup -@r @ Cont.@-z@>@-in@> +@r @ Cont.@-z@>@-in@>@-x@> \begingroup \lineskip=4pt \def\alt #1 #2 {$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr @@ -549,11 +675,11 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} -\yskip@-in@> +\yskip@-in@>@-x@> \prodno=47 \midcol=2.5in \def\theprodno{\number\prodno \global\advance\prodno by1\enspace} \def\dagit{\dag\theprodno} @@ -564,10 +690,12 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z +Section 122. + @x l.164 - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & |else x=0;|\cr + $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr @y - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & |else x=0;|\cr + $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr \endgroup @ Cont. @@ -579,9 +707,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any@>@-z@>@-g@>@-a@>@-x@>@-y@>@-f@> \prodno=61 \midcol=2.5in @@ -595,6 +723,8 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \advance\midcol20pt @z +Section 123. + @x l.211 \+& |prerangle| & |binop| \hfill \.> & $>$ not in template\cr @y @@ -610,9 +740,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any@>@-z@>@-g@>@-a@> \prodno=86 \midcol=2.5in @@ -625,6 +755,8 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z +Section 124. + @x l.232 \+\dagit& |new_exp| & |exp| & |new int;|\cr @y @@ -632,6 +764,12 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \endgroup @ Cont. +@-deprecated@> +@-fallthrough@> +@-likely@> +@-nodiscard@> +@-unlikely@> +@-s@> \begingroup \lineskip=4pt \def\alt #1 #2 {$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr @@ -640,9 +778,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any_other@>@-z@>@-f@>@-x@>@-p@> \prodno=100 \midcol=2.5in @@ -669,15 +807,61 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @y @z -@x l.272 -\+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr +Section 125. + +@x l.291 +\+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr +@y +\+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr +\endgroup + +@ Cont. +@-deprecated@> +@-fallthrough@> +@-likely@> +@-nodiscard@> +@-unlikely@> +@-y@> +\begingroup \lineskip=4pt +\def\alt #1 #2 +{$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr + \strut\hbox{#2}\cr}\!\Bigr\}$ } +\def\altt #1 #2 #3 +{$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr + \strut\hbox{#3}\cr}\!\Biggr\}$ } +\def\malt #1 #2 +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +\def\maltt #1 #2 #3 +{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr + \strut\hbox{#3}\hfill\cr}$} +\yskip@-any_other@>@-z@>@-f@>@-x@>@-p@> +\prodno=143 \midcol=2.5in +\def\theprodno{\number\prodno \global\advance\prodno by1\enspace} +\def\dagit{\dag\theprodno} +\def\+#1\cr{\def\next{#1}% + \line{\hbox to 2em{\hss + \ifx\next\empty\theprodno\else\next\fi}\strut + \ignorespaces#2\hfil\hbox to\midcol{$\RA$ + \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} +\advance\midcol20pt +@z + +Section 126. + +@x l.326 +\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr +\yskip +\yskip +\yskip +\yskip +\yskip \yskip \yskip \yskip \parindent=0pt \dag{\bf Notes} @y -\+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr +\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr \advance\midcol-3pt \+\dag200\enspace& |typedef_like| |decl_head| \alt|exp| |int_like| & |typedef_like| |decl_head| \hfill $D=D$\alt $E^{**}$ $I^{**}$ \unskip & @@ -689,15 +873,18 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \&{typedef} \&{int} \&{foo}\cr \endgroup -@r @-any_other@>@-z@>@ \begingroup\dag{\bf Notes} +@-any_other@>@-z@>@ \begingroup\dag{\bf Notes} +\advance \hsize by -4cm +\parindent=0pt +\everypar={\hangindent=2em} @z -Section 136. +Section 127. @x @* Implementing the productions. @y -@* Implementing the productions. \advance \hsize by -4cm +@* Implementing the productions.\advance \hsize by -4cm \ifx\undefined\pdfpagewidth \else \advance \pdfpagewidth by -4cm \fi @z @@ -707,24 +894,44 @@ the category codes |pp->cat,@,@,(pp+1)->cat|$,\,\,\ldots\,$ the category codes |pp->cat|, |(pp+1)->cat|, $\,\ldots\,$ @z -Section 139. +Section 128. @x -@ Token lists in |@!tok_mem| are composed of the following kinds of +@ @d trans trans_plus.Trans /* translation texts of scraps */ @y -@ Token lists in |@!tok_mem| are composed of the following kinds of -@-p@> +@ @d trans trans_plus.Trans /* translation texts of scraps */ +@-trans@> +@$trans {CTWILL}128 =\\{trans\_plus}.\\{Trans}@> @z -Section 141. +Section 129. @x -@ @<Print token |r|...@>= +null_scrap.trans=&tok_start[0]; +scrap_base=scrap_info+1; @y -@r @ @<Print token |r|...@>= +null_scrap.trans=&tok_start[0];@/ +scrap_base=scrap_info+1;@/ @z -Section 142. +Section 130. + +@x +@ Token lists in |@!tok_mem| are composed of the following kinds of +@y +@ Token lists in |@!tok_mem| are composed of the following kinds of +@-p@> +@-res_flag@> +@-section_flag@> +@-tok_flag@> +@-inner_tok_flag@> +@$res_flag {CTWILL}130 =$\T{2}*\\{id\_flag}$@> +@$section_flag {CTWILL}130 =$\T{3}*\\{id\_flag}$@> +@$tok_flag {CTWILL}130 =$\T{3}*\\{id\_flag}$@> +@$inner_tok_flag {CTWILL}130 =$\T{4}*\\{id\_flag}$@> +@z + +Section 133. @x @ The production rules listed above are embedded directly into \.{CWEAVE}, @@ -739,24 +946,44 @@ Section 142. @-pp@> @z -Section 143. +Section 134. @x The code below is an exact translation of the production rules into @y @r @ The code below is an exact translation of the production rules into @-a@> +@-c@> +@-p@> @z -Section 146. +Section 137--138. @x @ Let us consider the big switch for productions now, before looking @y @r @ Let us consider the big switch for productions now, before looking +@-cat1@> +@-cat2@> +@-cat3@> +@$cat1 {CTWILL}137 =$(\\{pp}+\T{1})\MG\\{cat}$@> +@$cat2 {CTWILL}137 =$(\\{pp}+\T{2})\MG\\{cat}$@> +@$cat3 {CTWILL}137 =$(\\{pp}+\T{3})\MG\\{cat}$@> @z -Section 147. +@x + && pp->cat!=new_exp + && pp->cat!=ftemplate @| +@y + && pp->cat!=new_exp @| + && pp->cat!=ftemplate +@z + +@x + && pp->cat!=const_like +@y + && pp->cat!=const_like @| +@z @x switch (pp->cat) { @@ -807,6 +1034,11 @@ Section 147. case typedef_like: @<Cases for |typedef_like|@>@; @+break; case delete_like: @<Cases for |delete_like|@>@; @+break; case question: @<Cases for |question|@>@; @+break; + case alignas_like: @<Cases for |alignas_like|@>@; @+break; + case lbrack: @<Cases for |lbrack|@>@; @+break; + case attr_head: @<Cases for |attr_head|@>@; @+break; + case attr: @<Cases for |attr|@>@; @+break; + case default_like: @<Cases for |default_like|@>@; @+break; } pp++; /* if no match was found, we move to the right */ } @@ -817,7 +1049,7 @@ Section 147. pp++; /* if no match was found, we move to the right */ } -@ @<Cases for |pp->cat|@>= +@ @<Cases for |pp->cat|@>=@t\1\5\5@> case exp: @<Cases for |exp|@>@; @+break; case lpar: @<Cases for |lpar|@>@; @+break; case unop: @<Cases for |unop|@>@; @+break; @@ -865,99 +1097,147 @@ Section 147. case typedef_like: @<Cases for |typedef_like|@>@; @+break; case delete_like: @<Cases for |delete_like|@>@; @+break; case question: @<Cases for |question|@>@; @+break; + case alignas_like: @<Cases for |alignas_like|@>@; @+break; + case lbrack: @<Cases for |lbrack|@>@; @+break; + case attr_head: @<Cases for |attr_head|@>@; @+break; + case attr: @<Cases for |attr|@>@; @+break; + case default_like: @<Cases for |default_like|@>@; @+break; @z -Section 148. +Section 139. @x -of identifiers in case labels. +should say, for example, `\.{@@!@@\^\\\&\{operator\} \$+\{=\}\$@@>}' (or, +more properly alpha\-betized, +`\.{@@!@@:operator+=\}\{\\\&\{operator\} \$+\{=\}\$@@>}'). +@y +should say, for example, `\.{@@!@@\^\\\&\{operator\}} \.{\$+\{=\}\$@@>}' +(or, properly alpha\-betized, +`\.{@@!@@:operator+=\}\{\\\&\{operator\}} \.{\$+\{=\}\$@@>}'). +@-no_ident_found@> +@-case_found@> +@-operator_found@> +@$no_ident_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 0@> +@$case_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 1@> +@$operator_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 2@> +@z -If the first identifier is the keyword `\&{operator}', we give up; +Section 141. + +@x +the |for| loop below. + +We use the fact that |make_underlined| has been called immediately preceding +|make_reserved|, hence |tok_loc| has been set. @y -of identifiers in case labels. -If the first identifier is the keyword `\&{operator}', we give up; +the |for| loop below. +We use the fact that |make_underlined| has been called immediately preceding +|make_reserved|, hence |tok_loc| has been set. @z -Section 150. +@x +make_reserved( /* make the first identifier in |p->trans| like |int| */ +scrap_pointer p) +@y +make_reserved(scrap_pointer p) + /* make the first identifier in |p->trans| like |int| */ +@z + +Section 142. @x -@ The scraps currently being parsed must be inspected for any +@ In the following situations we want to mark the occurrence of @y -@r @ The scraps currently being parsed must be inspected for any +@r @ In the following situations we want to mark the occurrence of @z @x -|make_reserved|, hence |tok_loc| has been set. +make_underlined( +/* underline the entry for the first identifier in |p->trans| */ +scrap_pointer p) @y -\hfil\break|make_reserved|, hence |tok_loc| has been set. +make_underlined( +scrap_pointer p) +/* underline the entry for the first identifier in |p->trans| */ @z -Section 154. +Section 151. @x -@ \.{CTWILL} needs the following procedure, which appends tokens of a +@ @<Cases for |sizeof_like|@>= @y -@r @ \.{CTWILL} needs the following procedure, which appends tokens of a +@r @ @<Cases for |sizeof_like|@>= @z -Section 155. +Section 158. @x -@ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, +@ @<Cases for |struct_like|@>= @y -@ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, -@-b@> +@r @ @<Cases for |struct_like|@>= @z +Section 172. + @x - int l) /* 0, 1, or 2 */ -{ +@d force_lines flags['f'] /* should each statement be on its own line? */ @y - int l) /* 0, 1, or 2 */ -{@+ +@d force_lines flags['f'] /* should each statement be on its own line? */ +@-force_lines@> +@$force_lines {CTWILL}172 =\\{flags}[\.{'f'}]@> @z -Section 159. +Section 180. @x -@ @<Cases for |lpar|@>= +@ @d reserve_typenames flags['t'] @y -@r @ @<Cases for |lpar|@>= +@r @ @d reserve_typenames flags['t'] @z -Section 168. +Section 195. @x -@ @<Cases for |decl_head|@>= + reduce(pp,4,attr_head,0,133); +} +else if (cat1==comma) squash(pp,2,attr_head,0,145); @y -@r @ @<Cases for |decl_head|@>= + reduce(pp,4,attr_head,0,133); +}@+ +else if (cat1==comma) squash(pp,2,attr_head,0,145); @z -Section 173. +Section 204. @x -@ @<Cases for |fn_decl|@>= +@ @<Print a snapsh...@>= @y -@r @ @<Cases for |fn_decl|@>= +@ @<Print a snapsh...@>= +@-n@> +@% +@$n {CTWILL}199 \&{short}@> +@$n {CTWILL}200 \&{short}@> @z -Section 208. +Section 207. @x -@ Here's the |squash| procedure, which +@ If the initial sequence of scraps does not reduce to a single scrap, @y -@r @ Here's the |squash| procedure, which +@r @ If the initial sequence of scraps does not reduce to a single scrap, @z -Section 212. +Section 210. @x -@ @<Print a snapsh...@>= + if (next_control=='|' || next_control==begin_comment || + next_control==begin_short_comment) return; @y -@r @ @<Print a snapsh...@>= + if (next_control=='|' || next_control==begin_comment @| || + next_control==begin_short_comment) return; @z -Section 220. +Section 212. @x @ The following macro is used to append a scrap whose tokens have just @@ -967,71 +1247,290 @@ Section 220. @-c@> @z -Section 229. +Section 213. @x -@ The |outer_parse| routine is to |C_parse| as |outer_xref| +@ @<Append the scr...@>= +@<Make sure that there is room for the new scraps, tokens, and texts@>@; @y -@r @ The |outer_parse| routine is to |C_parse| as |outer_xref| +@r @ @<Append the scr...@>= +@# +@<Make sure that there is room for the new scraps, tokens, and texts@>@; +@# @z -Section 235. +@x + case '/': case '.': + app(next_control);@+app_scrap(binop,yes_math);@+break; + case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break; +@.\\langle@> + case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break; +@.\\rangle@> + case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break; +@.\\K@> + case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break; +@.\\OR@> + case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break; +@.\\XOR@> + case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break; +@.\\MOD@> + case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break; +@.\\R@> + case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break; +@.\\CM@> + case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break; + case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break; + case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break; +@.\\AND@> + case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break; +@.\\?@> + case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break; +@.\\\#@> +@y +@# + @t\4@> @<Cases for operators@>@; +@# +@z @x -@ To insert token-list |p| into the output, the |push_level| subroutine + case ignore: case xref_roman: case xref_wildcard: + case meaning: case suppress: @y -@r @ To insert token-list |p| into the output, the |push_level| subroutine + case ignore: case xref_roman: case xref_wildcard:@/ + case meaning: case suppress:@/ @z -Section 237. +@x + case '(': app(next_control);@+app_scrap(lpar,maybe_math);@+break; + case ')': app(next_control);@+app_scrap(rpar,maybe_math);@+break; + case '[': app(next_control);@+app_scrap(lbrack,maybe_math);@+break; + case ']': app(next_control);@+app_scrap(rbrack,maybe_math);@+break; + case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break; +@.\\\{@>@q}@> + case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break; +@q{@>@.\\\}@> + case ',': app(',');@+app_scrap(comma,yes_math);@+break; + case ';': app(';');@+app_scrap(semi,maybe_math);@+break; + case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ +@y +@# + @t\4@> @<Cases for syntax markers@>@; +@z @x -called when |stack_ptr==1|. + @t\4@> @<Cases involving nonstandard characters@>@; @y -called when |stack_ptr| |==1|. + @t\4@> @<Cases involving nonstandard characters@>@; +@# @z -Section 241. +@x + overflow(_("scrap/token/text")); +} +@y + overflow(_("scrap/token/text")); +} + +@ @<Cases for operators@>=@t\1\5\5@> + case '/': case '.': + app(next_control);@+app_scrap(binop,yes_math);@+break; + case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break; +@.\\langle@> + case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break; +@.\\rangle@> + case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break; +@.\\K@> + case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break; +@.\\OR@> + case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break; +@.\\XOR@> + case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break; +@.\\MOD@> + case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break; +@.\\R@> + case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break; +@.\\CM@> + case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break; + case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break; + case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break; +@.\\AND@> + case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break; +@.\\?@> + case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break; +@.\\\#@> + +@ @<Cases for syntax markers@>=@t\1\5\5@> + case '(': app(next_control);@+app_scrap(lpar,maybe_math);@+break; + case ')': app(next_control);@+app_scrap(rpar,maybe_math);@+break; + case '[': app(next_control);@+app_scrap(lbrack,maybe_math);@+break; + case ']': app(next_control);@+app_scrap(rbrack,maybe_math);@+break; + case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break; +@.\\\{@>@q}@> + case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break; +@q{@>@.\\\}@> + case ',': app(',');@+app_scrap(comma,yes_math);@+break; + case ';': app(';');@+app_scrap(semi,maybe_math);@+break; + case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ +@z + +Section 217. + +@x +@ Some nonstandard characters may have entered \.{CWEAVE} by means of +@y +@r @ Some nonstandard characters may have entered \.{CWEAVE} by means of +@z + +Section 220. @x - text_pointer save_text_ptr; - sixteen_bits save_next_control; /* values to be restored */ - text_pointer p; /* translation of the \CEE/ text */ +@<Append a \TEX/ string, without forming a scrap@>= @y - text_pointer save_text_ptr, p; /* translation of the \CEE/ text */ - sixteen_bits save_next_control; /* values to be restored */ +@r @ @<Append a \TEX/ string, without forming a scrap@>= @z -Section 244. +Section 224. + +@x +@d make_pb flags['e'] +@y +@d make_pb flags['e'] +@-make_pb@> +@$make_pb {CTWILL}224 =\\{flags}[\.{'e'}]@> +@z + +Section 225. @x -else @<Look ahead for strongest line break, |goto reswitch|@> +make_pb=true; + +@ @c @y -else {@<Look ahead for strongest line break, |goto reswitch|@>} +make_pb=true; + +@r @ @c @z -Section 245. +Section 228. @x -@<Look ahead for st...@>= { +@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ @y -@<Look ahead for st...@>= +@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ +@-cur_end@> +@-cur_tok@> +@-cur_mode@> +@$cur_end {CTWILL}228 =\\{cur\_state}.\\{end\_field}]@> +@$cur_tok {CTWILL}228 =\\{cur\_state}.\\{tok\_field}]@> +@$cur_mode {CTWILL}228 =\\{cur\_state}.\\{mode\_field}]@> @z +Section 229. + @x +@<Private...@>= +@y +@r @ @<Private...@>= +@z + +Section 233. + +@x +called when |stack_ptr==1|. +@y +called when |stack_ptr| |==1|. +@z + +Section 237. + +@x +@ The real work associated with token output is done by |make_output|. +@y +@r @ The real work associated with token output is done by |make_output|. +@z + +Section 238--239. + +@x + reswitch: switch(a) { + case end_translation: return; + case identifier: case res_word: @<Output an identifier@>@; break; + case section_code: @<Output a section name@>@; break; + case math_rel: out_str("\\MRL{"@q}@>); +@.\\MRL@> + case noop: case inserted: break; + case cancel: case big_cancel: c=0; b=a; + while (true) { + a=get_output(); + if (a==inserted) continue; + if ((a<indent && !(b==big_cancel&&a==' ')) || a>big_force) break; + if (a==indent) c++; + else if (a==outdent) c--; + else if (a==opt) a=get_output(); + } + @<Output saved |indent| or |outdent| tokens@>@; + goto reswitch; + case dindent: a=get_output(); + if (a!=big_force) { + out_str("\\1\\1"); goto reswitch; + } + else dindent_pending=true; /* fall through */ + case indent: case outdent: case opt: case backup: case break_space: + case force: case big_force: case preproc_line: @<Output a control, + look ahead in case of line breaks, possibly |goto reswitch|@>@; break; + case quoted_char: out(*(cur_tok++)); + case qualifier: break; + default: out(a); /* otherwise |a| is an ordinary character */ + } + } } @y + reswitch: @/@<The output |switch|@>@; + } +} + +@r @ @<The output |switch|@>= + switch(a) { + case end_translation: return; + case identifier: case res_word: @<Output an identifier@>@; break; + case section_code: @<Output a section name@>@; break; + case math_rel: out_str("\\MRL{"@q}@>); +@.\\MRL@> + case noop: case inserted: break; + case cancel: case big_cancel: c=0; b=a; + while (true) { + a=get_output(); + if (a==inserted) continue; + if ((a<indent && !(b==big_cancel&&a==' ')) || a>big_force) break; + if (a==indent) c++; + else if (a==outdent) c--; + else if (a==opt) a=get_output(); + } + @<Output saved |indent| or |outdent| tokens@>@; + goto reswitch; + case dindent: a=get_output(); + if (a!=big_force) { + out_str("\\1\\1"); goto reswitch; + } + else dindent_pending=true; /* fall through */ + case indent: case outdent: case opt: case backup: case break_space: + case force: case big_force: case preproc_line: @<Output a control, + look ahead in case of line breaks, possibly |goto reswitch|@>@; break; + case quoted_char: out(*(cur_tok++)); + case qualifier: break; + default: out(a); /* otherwise |a| is an ordinary character */ + } @z -Section 246. +Section 244. @x -@ @<Output saved...@>= +@ The remaining part of |make_output| is somewhat more complicated. When we @y -@r @ @<Output saved...@>= +@r @ The remaining part of |make_output| is somewhat more complicated. When we @z -Section 250. +Section 247. @x @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @@ -1039,47 +1538,80 @@ Section 250. @r @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @z -Section 256. +Section 251. @x -@ The output file will contain the control sequence \.{\\Y} between non-null + space_checked=true; +@.\\Y@> @y -@r @ The output file will contain the control sequence \.{\\Y} between non-null + space_checked=true; +@.\\Y@> +@d usage_sentinel (struct perm_meaning *)1 +@-usage_sentinel@> +@$usage_sentinel {CTWILL}251 =(\&{struct} \\{perm\_meaning} ${}{*}{}$) \T{1}@> @z -Section 259. +Section 252. @x -@<Translate the \T...@>= do { +@ @d usage_sentinel (struct perm_meaning *)1 @y -@<Translate the \T...@>= do {@+ +@r @ @z -Section 267. +Section 253. @x -|next_control>=begin_C|. We will make the global variable |this_section| + if (right_start_switch) { + out_str("\\shortpage\n"); right_start_switch=false; +@.\\shortpage@> + } @y -\hfil\break|next_control>=begin_C|. We will make the global variable |this_section| + if (right_start_switch) {@+ + out_str("\\shortpage\n"); right_start_switch=false;@+ +@.\\shortpage@> + } @z -Section 268. +@x + else { + for (sec_depth=0; xisdigit(*loc);loc++) + sec_depth = sec_depth*10 + (*loc) -'0'; + } +@y + else @+ + for (sec_depth=0; xisdigit(*loc);loc++) + sec_depth = sec_depth*10 + (*loc) -'0'; +@z + +Section 256. @x -@ @<Translate the \CEE/...@>= +@ The |finish_C| procedure outputs the translation of the current @y -@r @ @<Translate the \CEE/...@>= +@r @ The |finish_C| procedure outputs the translation of the current @z -Section 272. +Section 259. @x -@ The |footnote| procedure gives cross-reference information about +@ @<Start a format...@>= { @y -@r @ The |footnote| procedure gives cross-reference information about +@r @ @<Start a format...@>= { @z -Section 284. +Section 260. + +@x +|next_control>=begin_C|. We will make the global variable |this_section| +point to the current section name, if it has a name. +@y +\hfil\break|next_control>=begin_C|. +We will make the global variable |this_section| point to +\hfil\break the current section name, if it has a name. +@z + +Section 273. @x @ A left-to-right radix sorting method is used, since this makes it easy to @@ -1088,54 +1620,262 @@ Section 284. @-c@> @z -Section 286. +Section 275. @x -@ During the sorting phase we shall use the |cat| and |trans| arrays from +@<Rest of |trans_plus| union@>= @y -@ During the sorting phase we shall use the |cat| and |trans| arrays from +@<Rest of |trans_plus| union@>= @-j@> @-k@> @z -Section 289. +Section 276. + +@x +@ @d depth cat /* reclaims memory that is no longer needed for parsing */ +@y +@ @d depth cat /* reclaims memory that is no longer needed for parsing */ +@-depth@> +@-head@> +@-sort_ptr@> +@-max_sorts@> +@$depth {CTWILL}276 =\\{cat}@> +@$head {CTWILL}276 =\\{trans\_plus}.\\{Head}@> +@$sort_ptr {CTWILL}276 =\\{scrap\_ptr}@> +@$max_sorts {CTWILL}276 =\\{max_scraps}@> +@z + +Section 278. @x $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. @y -|collate[0]| $<$|collate[1]|$<\cdots<$|collate[100]|. +|collate[0]| ${}<{}$|collate[1]|${}<\cdots<{}$|collate[100]|. +@z + +Section 280. + +@x +@ Procedure |unbucket| goes through the buckets and adds nonempty lists +@y +@r @ Procedure |unbucket| goes through the buckets and adds nonempty lists @z -Section 296. +Section 283. @x - else {char *j; + next_name=sort_ptr->head; @y - else {@+char *j; + next_name=sort_ptr->head;@/ @z -Section 303. +Section 284. @x -@ Because on some systems the difference between two pointers is a |ptrdiff_t| -rather than an |int|, we use \.{\%ld} to print these quantities. + cur_name=sort_ptr->head; +@y + cur_name=sort_ptr->head;@/ +@z + +Section 285. + +@x +switch (cur_name->ilk) {@+char *j; +@y +switch (cur_name->ilk) { char *j; +@z + +Section 292. + +@x + puts(_("\nMemory usage statistics:")); +@.Memory usage statistics:@> + printf(_("%ld names (out of %ld)\n"), + (ptrdiff_t)(name_ptr-name_dir),(long)max_names); + printf(_("%ld cross-references (out of %ld)\n"), + (ptrdiff_t)(xref_ptr-xmem),(long)max_refs); + printf(_("%ld bytes (out of %ld)\n"), + (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); + printf(_("%ld temp meanings (out of %ld)\n"), + (ptrdiff_t)(max_temp_meaning_ptr-temp_meaning_stack), + (long)max_meanings); + printf(_("%ld titles (out of %ld)\n"), + (ptrdiff_t)(title_code_ptr-title_code),(long)max_titles); + puts(_("Parsing:")); + printf(_("%ld scraps (out of %ld)\n"), + (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps); + printf(_("%ld texts (out of %ld)\n"), + (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts); + printf(_("%ld tokens (out of %ld)\n"), + (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks); + printf(_("%ld levels (out of %ld)\n"), + (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size); + puts(_("Sorting:")); + printf(_("%ld levels (out of %ld)\n"), + (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); +@y + puts(_("\nMemory usage statistics:"));@/ +@.Memory usage statistics:@> + printf(_("%ld names (out of %ld)\n"), + (ptrdiff_t)(name_ptr-name_dir),@/ + @t\5\5\5\5@>(long)max_names);@/ + printf(_("%ld cross-references (out of %ld)\n"), + (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);@/ + printf(_("%ld bytes (out of %ld)\n"), + (ptrdiff_t)(byte_ptr-byte_mem),@/ + @t\5\5\5\5@>(long)max_bytes);@/ + printf(_("%ld temp meanings (out of %ld)\n"), + (ptrdiff_t)(max_temp_meaning_ptr-temp_meaning_stack),@/ + @t\5\5\5\5@>(long)max_meanings);@/ + printf(_("%ld titles (out of %ld)\n"), + (ptrdiff_t)(title_code_ptr-title_code),@/ + @t\5\5\5\5@>(long)max_titles);@/ + puts(_("Parsing:"));@/ + printf(_("%ld scraps (out of %ld)\n"), + (ptrdiff_t)(max_scr_ptr-scrap_info),@/ + @t\5\5\5\5@>(long)max_scraps);@/ + printf(_("%ld texts (out of %ld)\n"), + (ptrdiff_t)(max_text_ptr-tok_start),@/ + @t\5\5\5\5@>(long)max_texts);@/ + printf(_("%ld tokens (out of %ld)\n"), + (ptrdiff_t)(max_tok_ptr-tok_mem),@/ + @t\5\5\5\5@>(long)max_toks);@/ + printf(_("%ld levels (out of %ld)\n"), + (ptrdiff_t)(max_stack_ptr-stack),@/ + @t\5\5\5\5@>(long)stack_size);@/ + puts(_("Sorting:"));@/ + printf(_("%ld levels (out of %ld)\n"), + (ptrdiff_t)(max_sort_ptr-scrap_info),@/ + @t\5\5\5\5@>(long)max_scraps); +@z + +Section 293. + +@x +@** Mogrify {\tentex CWEAVE} into {\tentex CTWILL}. The following sections +introduce material that is specific to \.{CTWILL}. + +Care has been taken to keep the original section numbering of \.{CWEAVE} +up to this point intact, so this new material should nicely integrate +with the original ``\&{272.~Index}.'' + +@q Section 2->273. @> +@* {\tentex CTWILL} user manual. +@y +@** Mogrify {\tentex CWEAVE} into {\tentex CTWILL}. +@z + +@x +give it the necessary hints in other places via your change file. @y -@r @ Because on some systems the difference between two pointers is a -|ptrdiff_t| rather than an |int|, we use \.{\%ld} to print these quantities. +give it the necessary hints in other places via your change file. +@-f@> +@-x@> @z -Section 304. +Section 294--295. @x -\bigskip -\font\itt=cmitt10 -{\noindent \it Although \.{\itt CTWILL} is based on \.{\itt cweave.w}, new and -modified material is incorporated all over the place, without taking special -care for keeping the original section numbering intact.} +The current meaning of every identifier is initially `\.{\\uninitialized}'. +@y +@r @ The current meaning of every identifier is initially `\.{\\uninitialized}'. +@-printf@> +@z + +@x +must have fewer than 50 characters. If the \TeX\ part starts +@y +must have fewer than 50 characters. + +@d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ +@-s@> + +@ If the \TeX\ part starts +@z + +@x +@d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ +@y +@z + +Section 307. + +@x +@ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, +@y +@r @ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, +@-a@> +@-b@> +@-c@> +@z + +Section 311. + +@x +@ @<Append tokens for type |q|@>= +@y +@r @ @<Append tokens for type |q|@>= +@z + +@x + && *(*r+1)=='{') app(**q); /* |struct_like| identifier */ +@y + @|&& *(*r+1)=='{') app(**q); /* |struct_like| identifier */ +@z + +Section 316. + +@x +@ @<Write the new meaning to the \.{.aux} file@>= +@y +@ @<Write the new meaning to the \.{.aux} file@>= +@% +@$p {CTWILL}300 \&{name\_pointer}@> +@$q {CTWILL}300 \&{struct perm\_meaning} ${}{*}{}$@> +@z + +Section 317. + +@x +@<Flag the usage of this identifier, for the mini-index@>= +@y +@<Flag the usage of this identifier, for the mini-index@>= +@% +@$p {CTWILL}222 \&{name\_pointer}@> +@z + +Section 321. + +@x +@ Compare this code with section |@<Output the name...@>|. + +@<Mini-output...@>= +@y +@ @<Mini-output...@>= +@z + +Section 326. + +@x +@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ +@y +@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ +@-indent_param_decl@> +@$indent_param_decl {CTWILL}326 =\\{flags}[\.{'i'}]@> +@z + +Section 327. + +@x +@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */ @y +@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */ +@-order_decl_stmt@> +@$order_decl_stmt {CTWILL}327 =\\{flags}[\.{'o'}]@> @z -Section 312. +Section 333. @x @** Index. |