modernc.org/knuth@v0.0.4/tex/tex.ch (about) 1 @x tex.web:193: 2 @d banner=='This is TeX, Version 3.141592653' {printed when \TeX\ starts} 3 @y 4 @d banner=='This is TeX, Version 3.141592653 (gotex v0.0-prerelease)' {printed when \TeX\ starts} 5 @z 6 7 @x tex.web:287: 8 start_of_TEX@t\hskip-2pt@>, end_of_TEX@t\hskip-2pt@>,@,final_end; 9 @y 10 start_of_TEX; 11 @z 12 13 @x tex.web:378: 14 @d othercases == others: {default for cases not listed explicitly} 15 @y 16 @d othercases == else {default for cases not listed explicitly} 17 @d write_ln(#)==writeln(#) 18 @d read_ln(#)==readln(#) 19 @z 20 21 @x tex.web:948: 22 @p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean; 23 {inputs the next line or returns |false|} 24 var last_nonblank:0..buf_size; {|last| with trailing blanks removed} 25 begin if bypass_eoln then if not eof(f) then get(f); 26 @y 27 @p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean; 28 {inputs the next line or returns |false|} 29 var last_nonblank:0..buf_size; {|last| with trailing blanks removed} 30 begin if bypass_eoln then if not eof(f) and eoln(f) then get(f); 31 @z 32 33 @x tex.web:1002: 34 @d update_terminal == break(term_out) {empty the terminal output buffer} 35 @d clear_terminal == break_in(term_in,true) {clear the terminal input buffer} 36 @d wake_up_terminal == do_nothing {cancel the user's cancellation of output} 37 @y 38 @d update_terminal == {empty the terminal output buffer} 39 @d clear_terminal == {clear the terminal input buffer} 40 @d wake_up_terminal == do_nothing {cancel the user's cancellation of output} 41 @z 42 43 @x tex.web:1035: 44 if format_ident=0 then 45 begin write_ln(term_out,'Buffer size exceeded!'); goto final_end; 46 @y 47 if format_ident=0 then 48 begin write_ln(term_out,'Buffer size exceeded!'); panic(final_end); 49 @z 50 51 @x tex.web:1078: 52 @p function init_terminal:boolean; {gets the terminal input started} 53 label exit; 54 begin t_open_in; 55 loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal; 56 @.**@> 57 if not input_ln(term_in,true) then {this shouldn't happen} 58 begin write_ln(term_out); 59 write(term_out,'! End of file on the terminal... why?'); 60 @y 61 @p function init_terminal:boolean; {gets the terminal input started} 62 label exit; 63 begin t_open_in; 64 loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal; 65 @.**@> 66 if not input_ln(term_in,true) then {this shouldn't happen} 67 begin write_ln(term_out); 68 write_ln(term_out,'! End of file on the terminal... why?'); 69 @z 70 71 @x tex.web:1255: 72 @p @!init function get_strings_started:boolean; {initializes the string pool, 73 but returns |false| if something goes wrong} 74 label done,exit; 75 var k,@!l:0..255; {small indices or counters} 76 @!m,@!n:text_char; {characters input from |pool_file|} 77 @!g:str_number; {garbage} 78 @!a:integer; {accumulator for check sum} 79 @!c:boolean; {check sum has been checked} 80 begin pool_ptr:=0; str_ptr:=0; str_start[0]:=0; 81 @y 82 @p @!init function get_strings_started:boolean; {initializes the string pool, 83 but returns |false| if something goes wrong} 84 label done,exit; 85 var k,@!l:0..255; {small indices or counters} 86 @!m,@!n:text_char; {characters input from |pool_file|} 87 @!g:str_number; {garbage} 88 @!a:integer; {accumulator for check sum} 89 @!c:boolean; {check sum has been checked} 90 begin 91 if g=0 then; 92 pool_ptr:=0; str_ptr:=0; str_start[0]:=0; 93 @z 94 95 @x tex.web:1871: 96 procedure jump_out; 97 begin goto end_of_TEX; 98 end; 99 @y 100 procedure jump_out; 101 begin panic(end_of_TEX); 102 end; 103 @z 104 105 @x tex.web:10431: 106 @!tfm_file:byte_file; 107 @y 108 @!tfm_file:byte_file; 109 buf:eight_bits; 110 @z 111 112 @x tex.web:16389: 113 @ @<Other local variables for |try_break|@>= 114 @!prev_prev_r:pointer; {a step behind |prev_r|, if |type(prev_r)=delta_node|} 115 @!s:pointer; {runs through nodes ahead of |cur_p|} 116 @!q:pointer; {points to a new node being created} 117 @!v:pointer; {points to a glue specification or a node ahead of |cur_p|} 118 @!t:integer; {node count, if |cur_p| is a discretionary node} 119 @!f:internal_font_number; {used in character width calculation} 120 @!l:halfword; {line number of current active node} 121 @!node_r_stays_active:boolean; {should node |r| remain in the active list?} 122 @!line_width:scaled; {the current line will be justified to this width} 123 @!fit_class:very_loose_fit..tight_fit; {possible fitness class of test line} 124 @!b:halfword; {badness of test line} 125 @!d:integer; {demerits of test line} 126 @!artificial_demerits:boolean; {has |d| been forced to zero?} 127 @!save_link:pointer; {temporarily holds value of |link(cur_p)|} 128 @!shortfall:scaled; {used in badness calculations} 129 @y 130 @ @<Other local variables for |try_break|@>= 131 @!prev_prev_r:pointer; {a step behind |prev_r|, if |type(prev_r)=delta_node|} 132 @!s:pointer; {runs through nodes ahead of |cur_p|} 133 @!q:pointer; {points to a new node being created} 134 @!v:pointer; {points to a glue specification or a node ahead of |cur_p|} 135 @!t:integer; {node count, if |cur_p| is a discretionary node} 136 @!f:internal_font_number; {used in character width calculation} 137 @!l:halfword; {line number of current active node} 138 @!node_r_stays_active:boolean; {should node |r| remain in the active list?} 139 @!line_width:scaled; {the current line will be justified to this width} 140 @!fit_class:very_loose_fit..tight_fit; {possible fitness class of test line} 141 @!b:halfword; {badness of test line} 142 @!d:integer; {demerits of test line} 143 @!artificial_demerits:boolean; {has |d| been forced to zero?} 144 @!shortfall:scaled; {used in badness calculations} 145 @z 146 147 148 @x tex.web:23664: 149 procedure show_whatever; 150 label common_ending; 151 var p:pointer; {tail of a token list to show} 152 begin case cur_chr of 153 @y 154 procedure show_whatever; 155 label common_ending; 156 var p:pointer; {tail of a token list to show} 157 begin 158 if p=0 then; 159 case cur_chr of 160 @z 161 162 @x tex.web:24303: 163 main_control; {come to life} 164 final_cleanup; {prepare for death} 165 end_of_TEX: close_files_and_terminate; 166 final_end: ready_already:=0; 167 end. 168 @y 169 main_control; {come to life} 170 final_cleanup; {prepare for death} 171 close_files_and_terminate; 172 final_end: ready_already:=0; 173 end. 174 @z 175 176 @x tex.web:24324: 177 procedure close_files_and_terminate; 178 var k:integer; {all-purpose index} 179 begin @<Finish the extensions@>; new_line_char:=-1; 180 @!stat if tracing_stats>0 then @<Output statistics about this job@>;@;@+tats@/ 181 wake_up_terminal; @<Finish the \.{DVI} file@>; 182 if log_opened then 183 begin wlog_cr; a_close(log_file); selector:=selector-2; 184 if selector=term_only then 185 begin print_nl("Transcript written on "); 186 @.Transcript written...@> 187 slow_print(log_name); print_char("."); 188 end; 189 end; 190 end; 191 @y 192 procedure close_files_and_terminate; 193 var k:integer; {all-purpose index} 194 begin @<Finish the extensions@>; new_line_char:=-1; 195 @!stat if tracing_stats>0 then @<Output statistics about this job@>;@;@+tats@/ 196 wake_up_terminal; @<Finish the \.{DVI} file@>; 197 if log_opened then 198 begin wlog_cr; a_close(log_file); selector:=selector-2; 199 if selector=term_only then 200 begin print_nl("Transcript written on "); 201 @.Transcript written...@> 202 slow_print(log_name); print_char("."); 203 end; 204 end; 205 write_ln(term_out); 206 end; 207 @z 208 209 @x tex.web:24656: 210 procedure do_extension; 211 var i,@!j,@!k:integer; {all-purpose integers} 212 @!p,@!q,@!r:pointer; {all-purpose pointers} 213 begin case cur_chr of 214 @y 215 procedure do_extension; 216 var k:integer; {all-purpose integers} 217 @!p:pointer; {all-purpose pointers} 218 begin case cur_chr of 219 @z