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