Debian Codegraph @

texk/web2c/alephdir/comsrcspec.ch

raw
1 @x
2 @!quoted_filename:boolean; {current filename is quoted}
3 @y
4 @!quoted_filename:boolean; {current filename is quoted}
5 @!special_loc:pointer;
6 @!special_token:halfword;
7
8 @!parse_first_line_p:cinttype; {parse the first line for options}
9 @!file_line_error_style_p:cinttype; {format messages as file:line:error}
10 @!halt_on_error_p:boolean; {allow only on error.}
11 @!halting_on_error_p:boolean; {already trying to halt?}
12
13 @!src_specials_p : boolean;
14 @!insert_src_special_auto : boolean;
15 @!insert_src_special_every_par : boolean;
16 @!insert_src_special_every_parend : boolean;
17 @!insert_src_special_every_cr : boolean;
18 @!insert_src_special_every_math : boolean;
19 @!insert_src_special_every_hbox : boolean;
20 @!insert_src_special_every_vbox : boolean;
21 @!insert_src_special_every_display : boolean;
22 @z
23
24 @x
25 wterm(eTeX_banner);
26 wterm(version_string);
27 if format_ident=0 then wterm_ln(' (preloaded format=',dump_name,')')
28 else begin slow_print(format_ident); print_ln;
29 end;
30 @y
31 if src_specials_p or file_line_error_style_p or parse_first_line_p then
32 wterm(banner_k)
33 else
34 wterm(eTeX_banner);
35 wterm(version_string);
36 if format_ident=0 then wterm_ln(' (preloaded format=',dump_name,')')
37 else begin slow_print(format_ident); print_ln;
38 end;
39 if shellenabledp then begin
40 wterm(' ');
41 if restrictedshell then begin
42 wterm('restricted ');
43 end;
44 wterm_ln('\write18 enabled.');
45 end;
46 if src_specials_p then begin
47 wterm_ln(' Source specials enabled.')
48 end;
49 @z
50
51 @x
52 print_nl("! "); print(#);
53 @y
54 if file_line_error_style_p then print_file_line
55 else print_nl("! ");
56 print(#);
57 @z
58
59 @x
60 print_char("."); show_context;
61 @y
62 print_char("."); show_context;
63 if (halt_on_error_p) then begin
64 {If |close_files_and_terminate| generates an error, we'll end up back
65 here; just give up in that case. If files are truncated, too bad.}
66 if (halting_on_error_p) then do_final_end; {quit immediately}
67 halting_on_error_p:=true;
68 history:=fatal_error_stop;
69 jump_out;
70 end;
71 @z
72
73 @x
74 @!in_open : 0..max_in_open; {the number of lines in the buffer, less one}
75 @!open_parens : 0..max_in_open; {the number of open text files}
76 @!input_file : ^alpha_file;
77 @!input_file_mode : ^halfword;
78 @!input_file_translation : ^halfword;
79 @!line : integer; {current line number in the current source file}
80 @!line_stack : ^integer;
81 @y
82 @!in_open : 0..max_in_open; {the number of lines in the buffer, less one}
83 @!open_parens : 0..max_in_open; {the number of open text files}
84 @!input_file : ^alpha_file;
85 @!input_file_mode : ^halfword;
86 @!input_file_translation : ^halfword;
87 @!line : integer; {current line number in the current source file}
88 @!line_stack : ^integer;
89 @!source_filename_stack : ^str_number;
90 @!full_source_filename_stack : ^str_number;
91 @z
92
93 @x
94 begin wlog(eTeX_banner);
95 wlog(version_string);
96 @y
97 begin if src_specials_p or file_line_error_style_p or parse_first_line_p
98 then
99 wlog(banner_k)
100 else
101 wlog(eTeX_banner);
102 wlog(version_string);
103 if shellenabledp then begin
104 wlog_cr;
105 wlog(' ');
106 if restrictedshell then begin
107 wlog('restricted ');
108 end;
109 wlog('\write18 enabled.')
110 end;
111 if src_specials_p then begin
112 wlog_cr;
113 wlog(' Source specials enabled.')
114 end;
115 if file_line_error_style_p then begin
116 wlog_cr;
117 wlog(' file:line:error style messages enabled.')
118 end;
119 if parse_first_line_p then begin
120 wlog_cr;
121 wlog(' %&-line parsing enabled.');
122 end;
123 @z
124
125 %% ** 537 ******************************************************************
126
127 @x
128 done: name:=a_make_name_string(cur_file);
129 if name=str_ptr-1 then {we can try to conserve string pool space now}
130 begin temp_str:=search_string(name);
131 if temp_str>0 then
132 begin name:=temp_str; flush_string;
133 end;
134 end;
135 @y
136 done: name:=a_make_name_string(cur_file);
137 source_filename_stack[in_open]:=name;
138 full_source_filename_stack[in_open]:=make_full_name_string;
139 if name=str_ptr-1 then {we can try to conserve string pool space now}
140 begin temp_str:=search_string(name);
141 if temp_str>0 then
142 begin name:=temp_str; flush_string;
143 end;
144 end;
145 @z
146
147 %%@x
148 %%if term_offset+length(name)>max_print_line-2 then print_ln
149 %%else if (term_offset>0)or(file_offset>0) then print_char(" ");
150 %%print_char("("); incr(open_parens); slow_print(name); update_terminal;
151 %%@y
152 %%if term_offset+length(full_source_filename_stack[in_open])>max_print_line-2 then print_ln
153 %%else if (term_offset>0)or(file_offset>0) then print_char(" ");
154 %%print_char("("); incr(open_parens); slow_print(full_source_filename_stack[in_open]); update_terminal;
155 %%@z
156
157 %% ** 774 ******************************************************************
158
159 @x
160 if every_cr<>null then begin_token_list(every_cr,every_cr_text);
161 @y
162 if (insert_src_special_every_cr and head<>tail) then insert_src_special;
163 if every_cr<>null then begin_token_list(every_cr,every_cr_text);
164 @z
165
166 %% ** 799 ******************************************************************
167
168 @x
169 if every_cr<>null then begin_token_list(every_cr,every_cr_text);
170 @y
171 if (insert_src_special_every_cr) then insert_src_special;
172 if every_cr<>null then begin_token_list(every_cr,every_cr_text);
173 @z
174
175 %% ** 1034 ******************************************************************
176
177 @x
178 @<Append character |cur_chr|...@>=
179 adjust_space_factor;@/
180 @y
181 @<Append character |cur_chr|...@>=
182 if ((head=tail) and (mode>0)) then begin
183 if (insert_src_special_auto) then append_src_special;
184 end;
185 adjust_space_factor;@/
186 @z
187
188 %% ** 1083 ******************************************************************
189
190 @x
191 if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
192 @y
193 if (insert_src_special_every_vbox) then insert_src_special;
194 if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
195 @z
196
197 @x
198 if every_hbox<>null then begin_token_list(every_hbox,every_hbox_text);
199 @y
200 if (insert_src_special_every_hbox) then insert_src_special;
201 if every_hbox<>null then begin_token_list(every_hbox,every_hbox_text);
202 @z
203
204 %% ** 1091 ******************************************************************
205 % Disabled, prevents merge with web2c's tex.ch.
206 @x
207 if indented then begin
208 p:=new_null_box; box_dir(p):=par_direction;
209 width(p):=par_indent;@+
210 tail_append(p);
211 end;
212 @y
213 if indented then begin
214 p:=new_null_box; box_dir(p):=par_direction;
215 width(p):=par_indent;@+
216 tail_append(p);
217 if (insert_src_special_every_par) then insert_src_special;@+
218 end;
219 @z
220
221 %% insert source special at par because this is disabled above
222 @x
223 if indented then begin
224 p:=new_null_box; box_dir(p):=par_direction;
225 width(p):=par_indent;@+
226 tail_append(p);
227 end;
228 @y
229 if indented then begin
230 p:=new_null_box; box_dir(p):=par_direction;
231 width(p):=par_indent;@+
232 tail_append(p);
233 if (insert_src_special_every_par) then insert_src_special;@+
234 end;
235 @z
236
237 %% ** 1096 ******************************************************************
238
239 @x fixme: etex conflict
240 else line_break(widow_penalty);
241 @y
242 else begin
243 if (insert_src_special_every_parend) then insert_src_special;
244 line_break(widow_penalty);
245 end;
246 @z
247
248 %% ** 1139 ******************************************************************
249
250 @x
251 if every_math<>null then begin_token_list(every_math,every_math_text);
252 @y
253 if (insert_src_special_every_math) then insert_src_special;
254 if every_math<>null then begin_token_list(every_math,every_math_text);
255 @z
256
257 %% ** 1145 ******************************************************************
258
259 @x
260 if every_display<>null then begin_token_list(every_display,every_display_text);
261 @y
262 if (insert_src_special_every_display) then append_src_special;
263 if every_display<>null then begin_token_list(every_display,every_display_text);
264 @z
265
266 %% ** 1167 ******************************************************************
267
268 @x
269 if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
270 @y
271 if (insert_src_special_every_vbox) then insert_src_special;
272 if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
273 @z
274
275 %% ** 1313 ******************************************************************
276
277 @x
278 dump_int(par_loc); dump_int(write_loc);@/
279 @y
280 dump_int(par_loc); dump_int(write_loc); dump_int(special_loc);@/
281 @z
282
283 %% ** 1314 ******************************************************************
284
285 @x
286 undump(hash_base)(frozen_control_sequence)(write_loc);@/
287 @y
288 undump(hash_base)(frozen_control_sequence)(write_loc);@/
289 undump(hash_base)(frozen_control_sequence)(special_loc);
290 special_token:=cs_token_flag+special_loc;@/
291 @z
292
293 @x
294 line_stack:=xmalloc_array (integer, max_in_open);
295 @y
296 line_stack:=xmalloc_array (integer, max_in_open);
297 source_filename_stack:=xmalloc_array (str_number, max_in_open);
298 full_source_filename_stack:=xmalloc_array (str_number, max_in_open);
299 @z
300
301 %% ** 1344 ******************************************************************
302
303 @x
304 primitive("special",extension,special_node);@/
305 @y
306 primitive("special",extension,special_node);@/
307 special_loc:=cur_val; special_token:=cs_token_flag+special_loc;@/
308 @z
309
310 %% ** 1379 ******************************************************************
311
312 @x
313 @* \[55] Index.
314 @y
315
316 @ @<Declare action procedures for use by |main_control|@>=
317
318 procedure insert_src_special;
319 var toklist, p, q : pointer;
320 begin
321 if (source_filename_stack[in_open] > 0 and is_new_source (source_filename_stack[in_open], line)) then begin
322 toklist := get_avail;
323 p := toklist;
324 info(p) := special_token;
325 link(p) := get_avail; p := link(p);
326 info(p) := left_brace_token+"{";
327 q := str_toks (make_src_special (source_filename_stack[in_open], line));
328 link(p) := link(temp_head);
329 p := q;
330 link(p) := get_avail; p := link(p);
331 info(p) := right_brace_token+"}";
332 ins_list (toklist);
333 remember_source_info (source_filename_stack[in_open], line);
334 end;
335 end;
336
337 procedure append_src_special;
338 var q : pointer;
339 begin
340 if (source_filename_stack[in_open] > 0 and is_new_source (source_filename_stack[in_open], line)) then begin
341 new_whatsit (special_node, write_node_size);
342 write_stream(tail) := null;
343 def_ref := get_avail;
344 token_ref_count(def_ref) := null;
345 q := str_toks (make_src_special (source_filename_stack[in_open], line));
346 link(def_ref) := link(temp_head);
347 write_tokens(tail) := def_ref;
348 remember_source_info (source_filename_stack[in_open], line);
349 end;
350 end;
351
352 @* \[55] Index.
353 @z