diff options
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctwill-mini.ch')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-mini.ch | 874 |
1 files changed, 682 insertions, 192 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index a3569f3442d..1310d0bc042 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -14,7 +14,7 @@ Section 1. @z @x -@d banner "This is CTWILL, Version 4.2" +@d banner "This is CTWILL, Version 4.3" @y \bigskip {\font\itt=cmitt10 \font\bit=cmbxti10 @@ -35,7 +35,7 @@ be even more ``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" +@d banner "This is CTWILL, Version 4.3" @z Section 2. @@ -43,7 +43,7 @@ Section 2. @x @ Here is a sort of user manual for \.{CTWILL}---which is exactly like @y -@* \.{CTWILL} user manual. +@* {\tentex CTWILL} user manual. Here is a sort of user manual for \.{CTWILL}---which is exactly like @z @@ -93,14 +93,29 @@ Section 7. @x internationalization. + +@d _(S) gettext(S) + +@<Include files@>= +#ifndef HAVE_GETTEXT +#define HAVE_GETTEXT 0 +#endif +@# @y internationalization. + +@d _(S) gettext(S) +@-S@> + +@r @ @<Include files@>= @-A@> @-HAVE_GETTEXT@> -@-S@> +#ifndef HAVE_GETTEXT +#define HAVE_GETTEXT 0 +#endif @z -Section 9. +Section 10. @x @ Code related to input routines: @@ -109,7 +124,7 @@ Section 9. @-c@> @z -Section 13. +Section 14. @x @ Code related to identifier and section name storage: @@ -118,7 +133,7 @@ Section 13. @-c@> @z -Section 15. +Section 16. @x @ Code related to error handling: @@ -127,7 +142,7 @@ Section 15. @-s@> @z -Section 17. +Section 18. @x extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ @@ -135,7 +150,7 @@ extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */ @z -Section 18. +Section 19. @x @ Code related to output: @@ -146,7 +161,7 @@ Section 18. @-c@> @z -Section 23. +Section 24. @x @* Data structures exclusive to {\tt CWEAVE}. @@ -158,30 +173,22 @@ Section 23. Section 25. @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 26. @x -@ \.{CTWILL} also has special data structures to keep track of current -@y -@r @ \.{CTWILL} also has special data structures to keep track of current -@z - -Section 32. - -@x -@ The |new_meaning| routine changes the current ``permanent meaning'' +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. @y -@r @ The |new_meaning| routine changes the current ``permanent meaning'' +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. +@-p@> +@-x@> @z -Section 35. +Section 36. @x @ A new cross-reference for an identifier is formed by calling |new_xref|, @@ -191,23 +198,6 @@ Section 35. @-c@> @z -Section 44. - -@x -@ We have to get \CEE/'s -@y -@r @ We have to get \CEE/'s -@z - -Section 45. - -@x -id_lookup("goto",NULL,case_like); -@y -@ @<Store all...@>= -id_lookup("goto",NULL,case_like); -@z - Section 49. @x @@ -259,42 +249,133 @@ Section 63. @-c@> @z -Section 66. +@x + if (*(loc+1)=='*') {loc++;@+compress(minus_gt_ast);} +@y + if (*(loc+1)=='*') {@+loc++;@+compress(minus_gt_ast);@+} +@z + +@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 64. @x -@<Get a string@>= { + 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 + 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 67. + +@x +@ @<Get a bin...@>={ @y -@<Get a string@>= {@+ +@r @ @<Get a bin...@>={ @z Section 70. @x +@ @<Get a wide...@>={ +@y +@r @ @<Get a wide...@>={ +@z + +Section 74. + +@x @ @<Put section name...@>= @y -@r @ @<Put section name...@>= +@ @<Put section name...@>= +@z + +Section 75. + +@x +@ @<If end of name...@>= +@y +@r @ @<If end of name...@>= +@z + +Section 87. + +@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 -Section 84. +Section 88--89. @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. + +@c +static void +outer_xref(void) /* extension of |C_xref| */ +{ + int bal; /* brace level in comment */ @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 +handles \CEE/ text with embedded comments. + +@ @c +static void +outer_xref(void) /* extension of |C_xref| */ +{@+ + int bal; /* brace level in comment */ @z Section 91. @x +@ @<Replace |"@@@@"| by |"@@"| @>= +{ + char *src=id_first,*dst=id_first; +@y +@ @<Replace |"@@@@"| by |"@@"| @>= +{@+ + char *src=id_first,*dst=id_first; +@z + +Section 96. + +@x @ Finally, when the \TEX/ and definition parts have been treated, we have |next_control>=begin_C|. @y -@ Finally, when the \TEX/ and definition parts have been treated, we have +@r @ Finally, when the \TEX/ and definition parts have been treated, we have \hfil\break|next_control>=begin_C|. @z -Section 97. +Section 102. @x @ The |flush_buffer| routine empties the buffer up to a given breakpoint, @@ -303,15 +384,7 @@ Section 97. @-c@> @z -Section 99. - -@x -@ When we are copying \TEX/ source material, we retain line breaks -@y -@r @ When we are copying \TEX/ source material, we retain line breaks -@z - -Section 101. +Section 106. @x @ When we wish to append one character |c| to the output buffer, we write @@ -320,33 +393,33 @@ Section 101. @-c@> @z -Section 105. +Section 107. @x -@ We get to this section only in the unusual case that the entire output line +out_str( /* output characters from |s| to end of string */ +const char*s) @y -@r @ We get to this section only in the unusual case that the entire output line +out_str(const char*s) + /* output characters from |s| to end of string */ @z -Section 111. +Section 113. @x -@ The |copy_TeX| routine processes the \TEX/ code at the beginning of a +@ The |out_name| procedure is used to output an identifier or index @y -@r @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a +@r @ The |out_name| procedure is used to output an identifier or index @z +Section 116. + @x -static eight_bits -copy_TeX(void) -{ +@ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @y -static eight_bits -copy_TeX(void) -{@+ +@r @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @z -Section 112. +Section 117. @x @ The |copy_comment| function issues a warning if more braces are opened than @@ -356,16 +429,22 @@ Section 112. @z @x -int bal@t\2\2@>) /* brace balance */ -{ - char c; /* current character being copied */ +static int copy_comment( /* copies \TeX\ code in comments */ +boolean is_long_comment, /* is this a traditional \CEE/ comment? */ +int bal) /* brace balance */ @y -int bal@t\2\2@>) /* brace balance */ -{@+ - char c; /* current character being copied */ +static int copy_comment( +boolean is_long_comment, /* is this a traditional \CEE/ comment? */ +int bal) /* brace balance */ @z -Section 117. +@x + } else { +@y + } @+ else { +@z + +Section 122. @x @ Here is a list of the category codes that scraps can have. @@ -373,7 +452,7 @@ Section 117. @r @ Here is a list of the category codes that scraps can have. @z -Section 121. +Section 126. @x @ The token lists for translated \TEX/ output contain some special control @@ -382,7 +461,7 @@ Section 121. @-n@> @z -Section 122. +Section 127. @x \yskip\noindent All of these tokens are removed from the \TEX/ output that @@ -391,7 +470,7 @@ Section 122. @-n@> @z -Section 123. +Section 128. @x @ The raw input is converted into scraps according to the following table, @@ -409,55 +488,67 @@ 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. +Section 129. @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. +Section 130. @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. +Section 131. @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. +Section 132. @x -\.{try}&|else_like|: \stars&maybe\cr +\.{static\_cast}&|raw_int|: \stars&maybe\cr @y -\.{try}&|else_like|: \stars&maybe\cr} +\.{static\_cast}&|raw_int|: \stars&maybe\cr} -@r @ Cont. +@ Cont. + +\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr +@z + +Section 133. + +@x +\.{xor\_eq}&|alfop|: \stars&yes\cr +@y +\.{xor\_eq}&|alfop|: \stars&yes\cr} + +@ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Sections 128--135. +Sections 134--142. @x l.7 line numbers refer to 'prod.w' @ Here is a table of all the productions. Each production that @@ -489,9 +580,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 @@ -519,9 +610,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 @@ -549,9 +640,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=47 \midcol=2.5in @@ -565,9 +656,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @z @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 +670,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 @@ -610,9 +701,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 @@ -632,6 +723,11 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \endgroup @ Cont. +@-deprecated@> +@-fallthrough@> +@-likely@> +@-nodiscard@> +@-unlikely@> \begingroup \lineskip=4pt \def\alt #1 #2 {$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr @@ -640,9 +736,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 +765,56 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @y @z -@x l.272 -\+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr +@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@> +\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 + +@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 +826,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 143. @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,7 +847,7 @@ the category codes |pp->cat,@,@,(pp+1)->cat|$,\,\,\ldots\,$ the category codes |pp->cat|, |(pp+1)->cat|, $\,\ldots\,$ @z -Section 139. +Section 146. @x @ Token lists in |@!tok_mem| are composed of the following kinds of @@ -716,15 +856,7 @@ Section 139. @-p@> @z -Section 141. - -@x -@ @<Print token |r|...@>= -@y -@r @ @<Print token |r|...@>= -@z - -Section 142. +Section 149. @x @ The production rules listed above are embedded directly into \.{CWEAVE}, @@ -739,7 +871,7 @@ Section 142. @-pp@> @z -Section 143. +Section 150. @x The code below is an exact translation of the production rules into @@ -748,7 +880,7 @@ The code below is an exact translation of the production rules into @-a@> @z -Section 146. +Section 153. @x @ Let us consider the big switch for productions now, before looking @@ -756,7 +888,21 @@ Section 146. @r @ Let us consider the big switch for productions now, before looking @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 + +Section 154. @x switch (pp->cat) { @@ -807,6 +953,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 +968,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,9 +1016,14 @@ 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 155. @x of identifiers in case labels. @@ -878,7 +1034,7 @@ of identifiers in case labels. If the first identifier is the keyword `\&{operator}', we give up; @z -Section 150. +Section 157. @x @ The scraps currently being parsed must be inspected for any @@ -892,7 +1048,26 @@ Section 150. \hfil\break|make_reserved|, hence |tok_loc| has been set. @z -Section 154. +@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 158. + +@x +make_underlined( +/* underline the entry for the first identifier in |p->trans| */ +scrap_pointer p) +@y +make_underlined(scrap_pointer p) + /* underline the entry for the first identifier in |p->trans| */ +@z + +Section 161. @x @ \.{CTWILL} needs the following procedure, which appends tokens of a @@ -900,7 +1075,7 @@ Section 154. @r @ \.{CTWILL} needs the following procedure, which appends tokens of a @z -Section 155. +Section 162. @x @ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, @@ -917,7 +1092,23 @@ Section 155. {@+ @z -Section 159. +Section 163. + +@x +if (l==0) { app(int_loc+res_flag); app(' '); cur_mathness=no_math; } +@y +if (l==0) { app(int_loc+res_flag); app(' '); cur_mathness=no_math; }@+ +@z + +Section 164. + +@x + && *(*r+1)=='{') app(**q); /* |struct_like| identifier */ +@y + @|&& *(*r+1)=='{') app(**q); /* |struct_like| identifier */ +@z + +Section 166. @x @ @<Cases for |lpar|@>= @@ -925,39 +1116,51 @@ Section 159. @r @ @<Cases for |lpar|@>= @z -Section 168. +Section 180. + +@x + if (indent_param_decl) { + app(outdent); app(outdent); + } +@y + if (indent_param_decl) {@+app(outdent); app(outdent);@+} +@z + +Section 189. @x -@ @<Cases for |decl_head|@>= +@ @<Cases for |case_like|@>= @y -@r @ @<Cases for |decl_head|@>= +@r @ @<Cases for |case_like|@>= @z -Section 173. +Section 206. @x -@ @<Cases for |fn_decl|@>= +@ @<Cases for |raw_ubin|@>= @y -@r @ @<Cases for |fn_decl|@>= +@r @ @<Cases for |raw_ubin|@>= @z -Section 208. +Section 221. @x -@ Here's the |squash| procedure, which +@ And here now is the code that applies productions as long as possible. @y -@r @ Here's the |squash| procedure, which +@r @ And here now is the code that applies productions as long as possible. @z -Section 212. +Section 230. @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 232. @x @ The following macro is used to append a scrap whose tokens have just @@ -967,71 +1170,280 @@ Section 220. @-c@> @z -Section 229. +Section 233. @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 237. @x - text_pointer save_text_ptr; - sixteen_bits save_next_control; /* values to be restored */ - text_pointer p; /* translation of the \CEE/ text */ +@ Some nonstandard characters may have entered \.{CWEAVE} by means of @y - text_pointer save_text_ptr, p; /* translation of the \CEE/ text */ - sixteen_bits save_next_control; /* values to be restored */ +@r @ Some nonstandard characters may have entered \.{CWEAVE} by means of @z -Section 244. +Section 239. @x -else @<Look ahead for strongest line break, |goto reswitch|@> +@<Append a \TEX/ string, without forming a scrap@>= @y -else {@<Look ahead for strongest line break, |goto reswitch|@>} +@r @ @<Append a \TEX/ string, without forming a scrap@>= @z Section 245. @x -@<Look ahead for st...@>= { +make_pb=true; + +@ @c @y -@<Look ahead for st...@>= +make_pb=true; + +@r @ @c @z +Section 249. + @x -} +@<Private...@>= @y +@r @ @<Private...@>= @z -Section 246. +Section 252. @x -@ @<Output saved...@>= +@ @c +static void +push_level( /* suspends the current level */ +text_pointer p) @y -@r @ @<Output saved...@>= +@ Suspend the current level. +@c +static void +push_level(text_pointer p)@/ @z -Section 250. +Section 253. + +@x +called when |stack_ptr==1|. +@y +called when |stack_ptr| |==1|. +@z + +Section 257. + +@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 258. + +@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 264. + +@x +@ The remaining part of |make_output| is somewhat more complicated. When we +@y +@r @ The remaining part of |make_output| is somewhat more complicated. When we +@z + +Section 267. @x @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @@ -1039,7 +1451,7 @@ Section 250. @r @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @z -Section 256. +Section 273. @x @ The output file will contain the control sequence \.{\\Y} between non-null @@ -1047,7 +1459,7 @@ Section 256. @r @ The output file will contain the control sequence \.{\\Y} between non-null @z -Section 259. +Section 276. @x @<Translate the \T...@>= do { @@ -1055,7 +1467,21 @@ Section 259. @<Translate the \T...@>= do {@+ @z -Section 267. +Section 282. + +@x +@<Start a macro...@>= { +@y +@r @ @<Start a macro...@>= { +@z + +@x + if(!space_checked){emit_space_if_needed;save_position;} +@y + if(!space_checked){@+emit_space_if_needed;save_position;@+} +@z + +Section 285. @x |next_control>=begin_C|. We will make the global variable |this_section| @@ -1063,7 +1489,7 @@ Section 267. \hfil\break|next_control>=begin_C|. We will make the global variable |this_section| @z -Section 268. +Section 286. @x @ @<Translate the \CEE/...@>= @@ -1071,7 +1497,7 @@ Section 268. @r @ @<Translate the \CEE/...@>= @z -Section 272. +Section 290. @x @ The |footnote| procedure gives cross-reference information about @@ -1079,26 +1505,26 @@ Section 272. @r @ The |footnote| procedure gives cross-reference information about @z -Section 284. +Section 302. @x @ A left-to-right radix sorting method is used, since this makes it easy to @y -@ A left-to-right radix sorting method is used, since this makes it easy to +@r @ A left-to-right radix sorting method is used, since this makes it easy to @-c@> @z -Section 286. +Section 304. @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 308. @x $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. @@ -1106,15 +1532,17 @@ $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. |collate[0]| $<$|collate[1]|$<\cdots<$|collate[100]|. @z -Section 296. +Section 310. @x - else {char *j; +unbucket( /* empties buckets having depth |d| */ +eight_bits d) @y - else {@+char *j; +unbucket(eight_bits d) + /* empties buckets having depth |d| */ @z -Section 303. +Section 322. @x @ Because on some systems the difference between two pointers is a |ptrdiff_t| @@ -1124,18 +1552,80 @@ rather than an |int|, we use \.{\%ld} to print these quantities. |ptrdiff_t| rather than an |int|, we use \.{\%ld} to print these quantities. @z -Section 304. +@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 323. @x \bigskip \font\itt=cmitt10 -{\noindent \it Although \.{\itt CTWILL} is based on \.{\itt cweave.w}, new and +{\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.} @y @z -Section 312. +Section 331. @x @** Index. |