1% Copyright 1996-2014 Han The Thanh, <thanh@pdftex.org>
2%
3% This file is part of pdfTeX.
4%
5% pdfTeX is free software; you can redistribute it and/or modify
6% it under the terms of the GNU General Public License as published by
7% the Free Software Foundation; either version 2 of the License, or
8% (at your option) any later version.
9%
10% pdfTeX is distributed in the hope that it will be useful,
11% but WITHOUT ANY WARRANTY; without even the implied warranty of
12% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13% GNU General Public License for more details.
14%
15% You should have received a copy of the GNU General Public License along with
16% this program.  If not, see <http://www.gnu.org/licenses/>.
17%
18@x [0.0] l.83 - WEAVE: we want the whole file
19  \def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }}
20  }
21\let\maybe=\iffalse
22@y 83
23  \def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }}
24  }
25\let\maybe=\iftrue
26@z
27
28% Change file to assist in creating the web2c-specific change file.
29% This one resolves inconsistencies between tex.ch and tex.ech.
30% Public domain.
31
32@x [1] m.2 l.188 - banner
33@d banner==TeX_banner
34@d banner_k==TeX_banner_k
35@y
36@d banner==pdfTeX_banner
37@d banner_k==pdfTeX_banner
38@z
39
40@x
41@d frozen_null_font=frozen_control_sequence+11
42  {permanent `\.{\\nullfont}'}
43@y
44@d frozen_null_font=frozen_control_sequence+12
45  {permanent `\.{\\nullfont}'}
46@z
47
48@x [17.236] l.4960 - first web2c, then e-TeX additional integer parameters
49@d int_pars=web2c_int_pars {total number of integer parameters}
50@#
51@d etex_int_base=tex_int_pars {base for \eTeX's integer parameters}
52@y
53@d pdftex_first_integer_code = web2c_int_pars {base for \pdfTeX's integer parameters}
54@z
55
56% start of tex.pch
57@x (MLTeX) l. 12945
58      begin i := char_tag(char_info(f)(c));
59@y
60      begin i := char_tag(orig_char_info(f)(c));
61@z
62
63@x (MLTeX) l. 14640
64@d is_valid_char(#)==((font_bc[f] <= #) and (# <= font_ec[f]) and
65                      char_exists(char_info(f)(#)))
66@y
67@d is_valid_char(#)==((font_bc[f] <= #) and (# <= font_ec[f]) and
68                      char_exists(orig_char_info(f)(#)))
69@z
70
71@x (MLTeX) l. 14678
72function get_charwidth(f: internal_font_number; c: eight_bits): scaled;
73begin
74    if is_valid_char(c) then
75        get_charwidth := char_width(f)(char_info(f)(c))
76    else
77        get_charwidth := 0;
78end;
79
80function get_charheight(f: internal_font_number; c: eight_bits): scaled;
81begin
82    if is_valid_char(c) then
83        get_charheight := char_height(f)(height_depth(char_info(f)(c)))
84    else
85        get_charheight := 0;
86end;
87
88function get_chardepth(f: internal_font_number; c: eight_bits): scaled;
89begin
90    if is_valid_char(c) then
91        get_chardepth := char_depth(f)(height_depth(char_info(f)(c)))
92    else
93        get_chardepth := 0;
94end;
95@y
96function get_charwidth(f: internal_font_number; c: eight_bits): scaled;
97begin
98    if is_valid_char(c) then
99        get_charwidth := char_width(f)(orig_char_info(f)(c))
100    else
101        get_charwidth := 0;
102end;
103
104function get_charheight(f: internal_font_number; c: eight_bits): scaled;
105begin
106    if is_valid_char(c) then
107        get_charheight := char_height(f)(height_depth(orig_char_info(f)(c)))
108    else
109        get_charheight := 0;
110end;
111
112function get_chardepth(f: internal_font_number; c: eight_bits): scaled;
113begin
114    if is_valid_char(c) then
115        get_chardepth := char_depth(f)(height_depth(orig_char_info(f)(c)))
116    else
117        get_chardepth := 0;
118end;
119@z
120
121
122@x (MLTeX) l. 17413
123label reswitch, move_past, fin_rule, next_p;
124@y
125label reswitch, move_past, fin_rule, next_p, found, continue;
126@z
127
128@x (MLTeX) l. 17462
129  if is_valid_char(c) then
130      output_one_char(c)
131  else
132      char_warning(f, c);
133  cur_h:=cur_h+char_width(f)(char_info(f)(c));
134@y
135  if is_valid_char(c) then begin
136      output_one_char(c);
137      cur_h:=cur_h+char_width(f)(char_info(f)(c));
138      goto continue;
139  end;
140  if mltex_enabled_p then
141    @<(\pdfTeX) Output a substitution, |goto continue| if not possible@>;
142continue:
143@z
144
145@x
146@ The |pdf_vlist_out| routine is similar to |pdf_hlist_out|, but a bit simpler.
147@y
148@ @<(\pdfTeX) Output a substitution, |goto continue| if not possible@>=
149  begin
150  @<Get substitution information, check it, goto |found|
151  if all is ok, otherwise goto |continue|@>;
152found: @<Print character substition tracing log@>;
153  @<(\pdfTeX) Rebuild character using substitution information@>;
154  end
155
156@ @<(\pdfTeX) Rebuild character using substitution information@>=
157  base_x_height:=x_height(f);
158  base_slant:=slant(f)/float_constant(65536);
159@^real division@>
160  accent_slant:=base_slant; {slant of accent character font}
161  base_width:=char_width(f)(ib_c);
162  base_height:=char_height(f)(height_depth(ib_c));
163  accent_width:=char_width(f)(ia_c);
164  accent_height:=char_height(f)(height_depth(ia_c));
165  @/{compute necessary horizontal shift (don't forget slant)}@/
166  delta:=round((base_width-accent_width)/float_constant(2)+
167            base_height*base_slant-base_x_height*accent_slant);
168@^real multiplication@>
169@^real addition@>
170  @/{1. For centering/horizontal shifting insert a kern node.}@/
171  cur_h:=cur_h+delta;
172  @/{2. Then insert the accent character possibly shifted up or down.}@/
173  if ((base_height<>base_x_height) and (accent_height>0)) then
174    begin {the accent must be shifted up or down}
175    cur_v:=base_line+(base_x_height-base_height);
176    output_one_char(accent_c);
177    cur_v:=base_line;
178    end
179  else begin
180    output_one_char(accent_c);
181    end;
182  cur_h:=cur_h+accent_width;
183  @/{3. For centering/horizontal shifting insert another kern node.}@/
184  cur_h:=cur_h+(-accent_width-delta);
185  @/{4. Output the base character.}@/
186  output_one_char(base_c);
187  cur_h:=cur_h+base_width;
188
189@ The |pdf_vlist_out| routine is similar to |pdf_hlist_out|, but a bit simpler.
190@z
191
192@x [49.1259]
193    begin if s>0 then
194      begin if s=font_size[f] then goto common_ending;
195      end
196    else if font_size[f]=xn_over_d(font_dsize[f],-s,1000) then
197      goto common_ending;
198    end
199@y
200    begin
201    if pdf_font_step[f] = 0 then begin
202       if s>0 then
203         begin if s=font_size[f] then goto common_ending;
204         end
205       else if font_size[f]=xn_over_d(font_dsize[f],-s,1000) then
206         goto common_ending;
207       end
208    end
209@z
210
211@x (WEB2C!)
212param_base:=xmalloc_array(integer, font_max);
213
214undump_things(font_check[null_font], font_ptr+1-null_font);
215@y
216param_base:=xmalloc_array(integer, font_max);
217
218pdf_char_used:=xmalloc_array(char_used_array, font_max);
219pdf_font_size:=xmalloc_array(scaled, font_max);
220pdf_font_num:=xmalloc_array(integer, font_max);
221pdf_font_map:=xmalloc_array(fm_entry_ptr, font_max);
222pdf_font_type:=xmalloc_array(eight_bits, font_max);
223pdf_font_attr:=xmalloc_array(str_number, font_max);
224pdf_font_blink:=xmalloc_array(internal_font_number, font_max);
225pdf_font_elink:=xmalloc_array(internal_font_number, font_max);
226pdf_font_stretch:=xmalloc_array(integer, font_max);
227pdf_font_shrink:=xmalloc_array(integer, font_max);
228pdf_font_step:=xmalloc_array(integer, font_max);
229pdf_font_expand_ratio:=xmalloc_array(integer, font_max);
230pdf_font_auto_expand:=xmalloc_array(boolean, font_max);
231pdf_font_lp_base:=xmalloc_array(integer, font_max);
232pdf_font_rp_base:=xmalloc_array(integer, font_max);
233pdf_font_ef_base:=xmalloc_array(integer, font_max);
234pdf_font_kn_bs_base:=xmalloc_array(integer, font_max);
235pdf_font_st_bs_base:=xmalloc_array(integer, font_max);
236pdf_font_sh_bs_base:=xmalloc_array(integer, font_max);
237pdf_font_kn_bc_base:=xmalloc_array(integer, font_max);
238pdf_font_kn_ac_base:=xmalloc_array(integer, font_max);
239vf_packet_base:=xmalloc_array(integer, font_max);
240vf_default_font:=xmalloc_array(internal_font_number, font_max);
241vf_local_font_num:=xmalloc_array(internal_font_number, font_max);
242vf_e_fnts:=xmalloc_array(integer, font_max);
243vf_i_fnts:=xmalloc_array(internal_font_number, font_max);
244pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean, font_max);
245
246for font_k := font_base to font_max do begin
247    for k := 0 to 31 do
248        pdf_char_used[font_k, k] := 0;
249    pdf_font_size[font_k] := 0;
250    pdf_font_num[font_k] := 0;
251    pdf_font_map[font_k] := 0;
252    pdf_font_type[font_k] := new_font_type;
253    pdf_font_attr[font_k] := "";
254    pdf_font_blink[font_k] := null_font;
255    pdf_font_elink[font_k] := null_font;
256    pdf_font_stretch[font_k] := null_font;
257    pdf_font_shrink[font_k] := null_font;
258    pdf_font_step[font_k] := 0;
259    pdf_font_expand_ratio[font_k] := 0;
260    pdf_font_auto_expand[font_k] := false;
261    pdf_font_lp_base[font_k] := 0;
262    pdf_font_rp_base[font_k] := 0;
263    pdf_font_ef_base[font_k] := 0;
264    pdf_font_kn_bs_base[font_k] := 0;
265    pdf_font_st_bs_base[font_k] := 0;
266    pdf_font_sh_bs_base[font_k] := 0;
267    pdf_font_kn_bc_base[font_k] := 0;
268    pdf_font_kn_ac_base[font_k] := 0;
269    pdf_font_nobuiltin_tounicode[font_k] := false;
270end;
271
272make_pdftex_banner;
273undump_things(font_check[null_font], font_ptr+1-null_font);
274@z
275
276@x [51.1]
277  setup_bound_var (0)('hash_extra')(hash_extra);
278  setup_bound_var (10000)('expand_depth')(expand_depth);
279
280@y
281  setup_bound_var (0)('hash_extra')(hash_extra);
282  setup_bound_var (10000)('expand_depth')(expand_depth);
283  setup_bound_var (72)('pk_dpi')(pk_dpi);
284@z
285
286@x [51.2]
287  const_chk (hash_extra);
288  if error_line > ssup_error_line then error_line := ssup_error_line;
289@y
290  const_chk (hash_extra);
291  const_chk (obj_tab_size);
292  const_chk (pdf_mem_size);
293  const_chk (dest_names_size);
294  const_chk (pk_dpi);
295  if error_line > ssup_error_line then error_line := ssup_error_line;
296@z
297
298@x [51.1332] l.24203 (ca.) texarray
299  line_stack:=xmalloc_array (integer, max_in_open);
300@y
301  line_stack:=xmalloc_array (integer, max_in_open);
302  eof_seen:=xmalloc_array (boolean, max_in_open);
303  grp_stack:=xmalloc_array (save_pointer, max_in_open);
304  if_stack:=xmalloc_array (pointer, max_in_open);
305@z
306
307@x [51.3]
308  hyph_link :=xmalloc_array (hyph_pointer, hyph_size);
309@y
310  hyph_link :=xmalloc_array (hyph_pointer, hyph_size);
311  obj_tab:=xmalloc_array (obj_entry, inf_obj_tab_size); {will grow dynamically}
312  pdf_mem:=xmalloc_array (integer, inf_pdf_mem_size); {will grow dynamically}
313  dest_names:=xmalloc_array (dest_name_entry, inf_dest_names_size); {will grow dynamically}
314  pdf_op_buf:=xmalloc_array (eight_bits, pdf_op_buf_size);
315  pdf_os_buf:=xmalloc_array (eight_bits, inf_pdf_os_buf_size); {will grow dynamically}
316  pdf_os_objnum:=xmalloc_array (integer, pdf_os_max_objs);
317  pdf_os_objoff:=xmalloc_array (integer, pdf_os_max_objs);
318@z
319
320@x [51.1337] l.24371 (ca.) texarray
321  trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0;
322@y
323  trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0;
324  hyph_root:=0; hyph_start:=0;
325@z
326
327
328@x (WEB2C!)
329  param_base:=xmalloc_array(integer, font_max);
330
331  font_ptr:=null_font; fmem_ptr:=7;
332@y
333param_base:=xmalloc_array(integer, font_max);
334
335pdf_char_used:=xmalloc_array(char_used_array,font_max);
336pdf_font_size:=xmalloc_array(scaled,font_max);
337pdf_font_num:=xmalloc_array(integer,font_max);
338pdf_font_map:=xmalloc_array(fm_entry_ptr,font_max);
339pdf_font_type:=xmalloc_array(eight_bits,font_max);
340pdf_font_attr:=xmalloc_array(str_number,font_max);
341pdf_font_blink:=xmalloc_array(internal_font_number,font_max);
342pdf_font_elink:=xmalloc_array(internal_font_number,font_max);
343pdf_font_stretch:=xmalloc_array(integer,font_max);
344pdf_font_shrink:=xmalloc_array(integer,font_max);
345pdf_font_step:=xmalloc_array(integer,font_max);
346pdf_font_expand_ratio:=xmalloc_array(integer,font_max);
347pdf_font_auto_expand:=xmalloc_array(boolean,font_max);
348pdf_font_lp_base:=xmalloc_array(integer,font_max);
349pdf_font_rp_base:=xmalloc_array(integer,font_max);
350pdf_font_ef_base:=xmalloc_array(integer,font_max);
351pdf_font_kn_bs_base:=xmalloc_array(integer, font_max);
352pdf_font_st_bs_base:=xmalloc_array(integer, font_max);
353pdf_font_sh_bs_base:=xmalloc_array(integer, font_max);
354pdf_font_kn_bc_base:=xmalloc_array(integer, font_max);
355pdf_font_kn_ac_base:=xmalloc_array(integer, font_max);
356vf_packet_base:=xmalloc_array(integer,font_max);
357vf_default_font:=xmalloc_array(internal_font_number,font_max);
358vf_local_font_num:=xmalloc_array(internal_font_number,font_max);
359vf_e_fnts:=xmalloc_array(integer,font_max);
360vf_i_fnts:=xmalloc_array(internal_font_number,font_max);
361pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean,font_max);
362
363for font_k := font_base to font_max do begin
364    for k := 0 to 31 do
365        pdf_char_used[font_k, k] := 0;
366    pdf_font_size[font_k] := 0;
367    pdf_font_num[font_k] := 0;
368    pdf_font_map[font_k] := 0;
369    pdf_font_type[font_k] := new_font_type;
370    pdf_font_attr[font_k] := "";
371    pdf_font_blink[font_k] := null_font;
372    pdf_font_elink[font_k] := null_font;
373    pdf_font_stretch[font_k] := null_font;
374    pdf_font_shrink[font_k] := null_font;
375    pdf_font_step[font_k] := 0;
376    pdf_font_expand_ratio[font_k] := 0;
377    pdf_font_auto_expand[font_k] := false;
378    pdf_font_lp_base[font_k] := 0;
379    pdf_font_rp_base[font_k] := 0;
380    pdf_font_ef_base[font_k] := 0;
381    pdf_font_kn_bs_base[font_k] := 0;
382    pdf_font_st_bs_base[font_k] := 0;
383    pdf_font_sh_bs_base[font_k] := 0;
384    pdf_font_kn_bc_base[font_k] := 0;
385    pdf_font_kn_ac_base[font_k] := 0;
386    pdf_font_nobuiltin_tounicode[font_k] := false;
387end;
388
389font_ptr:=null_font; fmem_ptr:=7;
390make_pdftex_banner;
391@z
392
393% i, j, q, and r are unused by TeX but required for pdfTeX
394@x [53.1348] (do_extension)
395var k:integer; {all-purpose integers}
396@!p:pointer; {all-purpose pointers}
397@y
398var i,@!j,@!k:integer; {all-purpose integers}
399@!p,@!q,@!r:pointer; {all-purpose pointers}
400@z
401
402@x [53a.1379] l.??? -etex command line switch
403@!init if (buffer[loc]="*")and(format_ident=" (INITEX)") then
404@y
405@!init if (etex_p or(buffer[loc]="*"))and(format_ident=" (INITEX)") then
406@z
407
408@x [53a.1379] l.??? -etex command line switch
409  incr(loc); eTeX_mode:=1; {enter extended mode}
410@y
411  if (buffer[loc]="*") then incr(loc);
412  eTeX_mode:=1; {enter extended mode}
413@z
414
415@x [53a.1383] l.??? -etex command line switch
416@!eTeX_mode: 0..1; {identifies compatibility and extended mode}
417@y
418@!eTeX_mode: 0..1; {identifies compatibility and extended mode}
419@!etex_p: boolean; {was the -etex option specified}
420@z
421
422@x [53a.1391] l.??? texarray
423@!eof_seen : array[1..max_in_open] of boolean; {has eof been seen?}
424@y
425@!eof_seen : ^boolean; {has eof been seen?}
426@z
427
428@x [53a.1506] l.??? texarray
429@!grp_stack : array[0..max_in_open] of save_pointer; {initial |cur_boundary|}
430@!if_stack : array[0..max_in_open] of pointer; {initial |cond_ptr|}
431@y
432@!grp_stack : ^save_pointer; {initial |cur_boundary|}
433@!if_stack : ^pointer; {initial |cond_ptr|}
434@z
435
436@x [53a.1587] l.??? texarray
437hyph_root:=0; hyph_start:=0;
438@y
439@z
440
441@x [54/web2c.???] l.??? needed earlier
442replacement, but always existing character |font_bc[f]|.
443@^inner loop@>
444
445@<Declare additional functions for ML\TeX@>=
446function effective_char(@!err_p:boolean;
447@y
448replacement, but always existing character |font_bc[f]|.
449@^inner loop@>
450
451@<Declare \eTeX\ procedures for sc...@>=
452function effective_char(@!err_p:boolean;
453@z
454
455