Debian Codegraph @

texk/web2c/pdftexdir/pdftex.ch

raw
1 % Copyright 1996-2026 Han The Thanh, <[email protected]>
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 tex.ch l.60 - tell weave we want the whole file
19 \let\maybe=\iffalse
20 @y 83
21 \let\maybe=\iftrue
22 @z
23
24 @x tex.ch l.76 - pdftex banner
25 @d banner==TeX_banner
26 @d banner_k==TeX_banner_k
27 @y
28 @d banner==pdfTeX_banner
29 @d banner_k==pdfTeX_banner
30 @z
31
32 % See also tex.ch l.1204, etex.ch l.2226. Not sure what's going on here.
33 @x pdftex.web l.28025 - restore e-TeX last_node_type removed in tex.ch
34 last_glue:=max_halfword; last_penalty:=0; last_kern:=0;
35 @y
36 last_glue:=max_halfword; last_penalty:=0; last_kern:=0;
37 last_node_type:=-1;
38 @z
39
40 @x tex.ch l.1228 - table sizes [see also pdftex.web l.5194]
41 @d frozen_null_font=frozen_control_sequence+11
42 {permanent `\.{\\nullfont}'}
43 @y
44 @d frozen_null_font=frozen_control_sequence+12+prim_size
45 {permanent `\.{\\nullfont}'}
46 @z
47
48 @x tex.ch l.1274 - web2c, then e-TeX, then pdftex 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
72 function get_charwidth(f: internal_font_number; c: eight_bits): scaled;
73 begin
74 if is_valid_char(c) then
75 get_charwidth := char_width(f)(char_info(f)(c))
76 else
77 get_charwidth := 0;
78 end;
79
80 function get_charheight(f: internal_font_number; c: eight_bits): scaled;
81 begin
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;
86 end;
87
88 function get_chardepth(f: internal_font_number; c: eight_bits): scaled;
89 begin
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;
94 end;
95 @y
96 function get_charwidth(f: internal_font_number; c: eight_bits): scaled;
97 begin
98 if is_valid_char(c) then
99 get_charwidth := char_width(f)(orig_char_info(f)(c))
100 else
101 get_charwidth := 0;
102 end;
103
104 function get_charheight(f: internal_font_number; c: eight_bits): scaled;
105 begin
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;
110 end;
111
112 function get_chardepth(f: internal_font_number; c: eight_bits): scaled;
113 begin
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;
118 end;
119 @z
120
121
122 @x (MLTeX) l.17413
123 label reswitch, move_past, fin_rule, next_p;
124 @y
125 label 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@>;
142 continue:
143 @z
144
145 % this @x code is modified from tex.web by tex.ch.
146 @x tex.ch l.3447 - omit block if pdf_font_step[f] nonzero; preserve indentation
147 begin if s>0 then
148 begin if s=font_size[f] then goto common_ending;
149 end
150 else begin arith_error:=false;
151 if font_size[f]=xn_over_d(font_dsize[f],-s,1000)
152 then if not arith_error
153 then goto common_ending;
154 end;
155 end
156 @y
157 begin {preserved}
158 if pdf_font_step[f] = 0 then begin
159 if s>0 then
160 begin if s=font_size[f] then goto common_ending;
161 end
162 else begin arith_error:=false;
163 if font_size[f]=xn_over_d(font_dsize[f],-s,1000)
164 then if not arith_error
165 then goto common_ending;
166 end;
167 end
168 end
169 @z
170
171 @x tex.ch l.3989 - more things to dump
172 param_base:=xmalloc_array(integer, font_max);
173
174 undump_things(font_check[null_font], font_ptr+1-null_font);
175 @y
176 param_base:=xmalloc_array(integer, font_max);
177
178 pdf_char_used:=xmalloc_array(char_used_array, font_max);
179 pdf_font_size:=xmalloc_array(scaled, font_max);
180 pdf_font_num:=xmalloc_array(integer, font_max);
181 pdf_font_map:=xmalloc_array(fm_entry_ptr, font_max);
182 pdf_font_type:=xmalloc_array(eight_bits, font_max);
183 pdf_font_attr:=xmalloc_array(str_number, font_max);
184 pdf_font_blink:=xmalloc_array(internal_font_number, font_max);
185 pdf_font_elink:=xmalloc_array(internal_font_number, font_max);
186 pdf_font_has_space_char:=xmalloc_array(boolean, font_max);
187 pdf_font_stretch:=xmalloc_array(integer, font_max);
188 pdf_font_shrink:=xmalloc_array(integer, font_max);
189 pdf_font_step:=xmalloc_array(integer, font_max);
190 pdf_font_expand_ratio:=xmalloc_array(integer, font_max);
191 pdf_font_auto_expand:=xmalloc_array(boolean, font_max);
192 pdf_font_lp_base:=xmalloc_array(integer, font_max);
193 pdf_font_rp_base:=xmalloc_array(integer, font_max);
194 pdf_font_ef_base:=xmalloc_array(integer, font_max);
195 pdf_font_kn_bs_base:=xmalloc_array(integer, font_max);
196 pdf_font_st_bs_base:=xmalloc_array(integer, font_max);
197 pdf_font_sh_bs_base:=xmalloc_array(integer, font_max);
198 pdf_font_kn_bc_base:=xmalloc_array(integer, font_max);
199 pdf_font_kn_ac_base:=xmalloc_array(integer, font_max);
200 vf_packet_base:=xmalloc_array(integer, font_max);
201 vf_default_font:=xmalloc_array(internal_font_number, font_max);
202 vf_local_font_num:=xmalloc_array(internal_font_number, font_max);
203 vf_e_fnts:=xmalloc_array(integer, font_max);
204 vf_i_fnts:=xmalloc_array(internal_font_number, font_max);
205 pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean, font_max);
206
207 for font_k := font_base to font_max do begin
208 for k := 0 to 31 do
209 pdf_char_used[font_k, k] := 0;
210 pdf_font_size[font_k] := 0;
211 pdf_font_num[font_k] := 0;
212 pdf_font_map[font_k] := 0;
213 pdf_font_type[font_k] := new_font_type;
214 pdf_font_attr[font_k] := "";
215 pdf_font_blink[font_k] := null_font;
216 pdf_font_elink[font_k] := null_font;
217 pdf_font_has_space_char[font_k] := false;
218 pdf_font_stretch[font_k] := null_font;
219 pdf_font_shrink[font_k] := null_font;
220 pdf_font_step[font_k] := 0;
221 pdf_font_expand_ratio[font_k] := 0;
222 pdf_font_auto_expand[font_k] := false;
223 pdf_font_lp_base[font_k] := 0;
224 pdf_font_rp_base[font_k] := 0;
225 pdf_font_ef_base[font_k] := 0;
226 pdf_font_kn_bs_base[font_k] := 0;
227 pdf_font_st_bs_base[font_k] := 0;
228 pdf_font_sh_bs_base[font_k] := 0;
229 pdf_font_kn_bc_base[font_k] := 0;
230 pdf_font_kn_ac_base[font_k] := 0;
231 pdf_font_nobuiltin_tounicode[font_k] := false;
232 end;
233
234 make_pdftex_banner;
235 undump_things(font_check[null_font], font_ptr+1-null_font);
236 @z
237
238 @x tex.ch l.4196 - more bounds to set
239 setup_bound_var (0)('hash_extra')(hash_extra);
240 setup_bound_var (10000)('expand_depth')(expand_depth);
241
242 @y
243 setup_bound_var (0)('hash_extra')(hash_extra);
244 setup_bound_var (10000)('expand_depth')(expand_depth);
245 setup_bound_var (72)('pk_dpi')(pk_dpi);
246 @z
247
248 @x tex.ch l.4229 - more constants to check
249 const_chk (hash_extra);
250 if error_line > ssup_error_line then error_line := ssup_error_line;
251 @y
252 const_chk (hash_extra);
253 const_chk (obj_tab_size);
254 const_chk (pdf_mem_size);
255 const_chk (dest_names_size);
256 const_chk (pk_dpi);
257 if error_line > ssup_error_line then error_line := ssup_error_line;
258 @z
259
260 @x tex.ch l.4238 - more arrays to xmalloc
261 line_stack:=xmalloc_array (integer, max_in_open);
262 @y
263 line_stack:=xmalloc_array (integer, max_in_open);
264 eof_seen:=xmalloc_array (boolean, max_in_open);
265 grp_stack:=xmalloc_array (save_pointer, max_in_open);
266 if_stack:=xmalloc_array (pointer, max_in_open);
267 @z
268
269 @x tex.ch l.4245 - still more arrays to xmalloc
270 hyph_link :=xmalloc_array (hyph_pointer, hyph_size);
271 @y
272 hyph_link :=xmalloc_array (hyph_pointer, hyph_size);
273 obj_tab:=xmalloc_array (obj_entry, inf_obj_tab_size); {will grow dynamically}
274 pdf_mem:=xmalloc_array (integer, inf_pdf_mem_size); {will grow dynamically}
275 dest_names:=xmalloc_array (dest_name_entry, inf_dest_names_size); {will grow dynamically}
276 pdf_op_buf:=xmalloc_array (eight_bits, pdf_op_buf_size);
277 pdf_os_buf:=xmalloc_array (eight_bits, inf_pdf_os_buf_size); {will grow dynamically}
278 pdf_os_objnum:=xmalloc_array (integer, pdf_os_max_objs);
279 pdf_os_objoff:=xmalloc_array (integer, pdf_os_max_objs);
280 @z
281
282 @x tex.ch l.4356 - more hyphenation initializations
283 trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0;
284 @y
285 trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0;
286 hyph_root:=0; hyph_start:=0;
287 @z
288
289
290 @x tex.ch l.4381 - more arrays to xmallox
291 param_base:=xmalloc_array(integer, font_max);
292
293 font_ptr:=null_font; fmem_ptr:=7;
294 @y
295 param_base:=xmalloc_array(integer, font_max);
296
297 pdf_char_used:=xmalloc_array(char_used_array,font_max);
298 pdf_font_size:=xmalloc_array(scaled,font_max);
299 pdf_font_num:=xmalloc_array(integer,font_max);
300 pdf_font_map:=xmalloc_array(fm_entry_ptr,font_max);
301 pdf_font_type:=xmalloc_array(eight_bits,font_max);
302 pdf_font_attr:=xmalloc_array(str_number,font_max);
303 pdf_font_blink:=xmalloc_array(internal_font_number,font_max);
304 pdf_font_elink:=xmalloc_array(internal_font_number,font_max);
305 pdf_font_has_space_char:=xmalloc_array(boolean,font_max);
306 pdf_font_stretch:=xmalloc_array(integer,font_max);
307 pdf_font_shrink:=xmalloc_array(integer,font_max);
308 pdf_font_step:=xmalloc_array(integer,font_max);
309 pdf_font_expand_ratio:=xmalloc_array(integer,font_max);
310 pdf_font_auto_expand:=xmalloc_array(boolean,font_max);
311 pdf_font_lp_base:=xmalloc_array(integer,font_max);
312 pdf_font_rp_base:=xmalloc_array(integer,font_max);
313 pdf_font_ef_base:=xmalloc_array(integer,font_max);
314 pdf_font_kn_bs_base:=xmalloc_array(integer, font_max);
315 pdf_font_st_bs_base:=xmalloc_array(integer, font_max);
316 pdf_font_sh_bs_base:=xmalloc_array(integer, font_max);
317 pdf_font_kn_bc_base:=xmalloc_array(integer, font_max);
318 pdf_font_kn_ac_base:=xmalloc_array(integer, font_max);
319 vf_packet_base:=xmalloc_array(integer,font_max);
320 vf_default_font:=xmalloc_array(internal_font_number,font_max);
321 vf_local_font_num:=xmalloc_array(internal_font_number,font_max);
322 vf_e_fnts:=xmalloc_array(integer,font_max);
323 vf_i_fnts:=xmalloc_array(internal_font_number,font_max);
324 pdf_font_nobuiltin_tounicode:=xmalloc_array(boolean,font_max);
325
326 for font_k := font_base to font_max do begin
327 for k := 0 to 31 do
328 pdf_char_used[font_k, k] := 0;
329 pdf_font_size[font_k] := 0;
330 pdf_font_num[font_k] := 0;
331 pdf_font_map[font_k] := 0;
332 pdf_font_type[font_k] := new_font_type;
333 pdf_font_attr[font_k] := "";
334 pdf_font_blink[font_k] := null_font;
335 pdf_font_elink[font_k] := null_font;
336 pdf_font_has_space_char[font_k] := false;
337 pdf_font_stretch[font_k] := null_font;
338 pdf_font_shrink[font_k] := null_font;
339 pdf_font_step[font_k] := 0;
340 pdf_font_expand_ratio[font_k] := 0;
341 pdf_font_auto_expand[font_k] := false;
342 pdf_font_lp_base[font_k] := 0;
343 pdf_font_rp_base[font_k] := 0;
344 pdf_font_ef_base[font_k] := 0;
345 pdf_font_kn_bs_base[font_k] := 0;
346 pdf_font_st_bs_base[font_k] := 0;
347 pdf_font_sh_bs_base[font_k] := 0;
348 pdf_font_kn_bc_base[font_k] := 0;
349 pdf_font_kn_ac_base[font_k] := 0;
350 pdf_font_nobuiltin_tounicode[font_k] := false;
351 end;
352
353 font_ptr:=null_font; fmem_ptr:=7;
354 make_pdftex_banner;
355 @z
356
357 @x tex.ch l.4438 (do_extension) - i, j, q, r unused by TeX, needed by pdfTeX
358 var k:integer; {all-purpose integers}
359 @!p:pointer; {all-purpose pointers}
360 @y
361 var i,@!j,@!k:integer; {all-purpose integers}
362 @!p,@!q,@!r:pointer; {all-purpose pointers}
363 @z
364
365 @x etex.ch l.3182 -etex command line xswitch
366 @!init if (buffer[loc]="*")and(format_ident=" (INITEX)") then
367 @y
368 @!init if (etex_p or(buffer[loc]="*"))and(format_ident=" (INITEX)") then
369 @z
370
371 @x etex.ch l.3185 -etex command line switch
372 incr(loc); eTeX_mode:=1; {enter extended mode}
373 @y
374 if (buffer[loc]="*") then incr(loc);
375 eTeX_mode:=1; {enter extended mode}
376 @z
377
378 @x etex.ch l.3224 -etex command line switch
379 @!eTeX_mode: 0..1; {identifies compatibility and extended mode}
380 @y
381 @!eTeX_mode: 0..1; {identifies compatibility and extended mode}
382 @!etex_p: boolean; {was the -etex option specified}
383 @z
384
385 @x etex.ch l.3302 - use pointer for array
386 @!eof_seen : array[1..max_in_open] of boolean; {has eof been seen?}
387 @y
388 @!eof_seen : ^boolean; {has eof been seen?}
389 @z
390
391 @x etex.ch l.4842 - use pointers for arrays
392 @!grp_stack : array[0..max_in_open] of save_pointer; {initial |cur_boundary|}
393 @!if_stack : array[0..max_in_open] of pointer; {initial |cond_ptr|}
394 @y
395 @!grp_stack : ^save_pointer; {initial |cur_boundary|}
396 @!if_stack : ^pointer; {initial |cond_ptr|}
397 @z
398
399 @x etex.ch l.6244 - hyphenation initializations done elsewhere
400 hyph_root:=0; hyph_start:=0;
401 @y
402 @z
403
404 @x tex.ch l.4858 - effective_char function needed earlier
405 replacement, but always existing character |font_bc[f]|.
406 @^inner loop@>
407
408 @<Declare additional functions for ML\TeX@>=
409 function effective_char(@!err_p:boolean;
410 @y
411 replacement, but always existing character |font_bc[f]|.
412 @^inner loop@>
413
414 @<Declare \eTeX\ procedures for sc...@>=
415 function effective_char(@!err_p:boolean;
416 @z
417
418 @x tex.ch l.4958 - pdftex character substitutions
419 @ The global variables for the code to substitute a virtual character
420 @y
421 @ \pdfTeX's |pdf_hlist_out| uses a similar, but slightly modified code
422 section of the (almost) same name.
423
424 @<(\pdfTeX) Output a substitution, |goto continue| if not possible@>=
425 begin
426 @<Get substitution information, check it, goto |found|
427 if all is ok, otherwise goto |continue|@>;
428 found: @<Print character substitution tracing log@>;
429 @<(\pdfTeX) Rebuild character using substitution information@>;
430 end
431
432 @ The global variables for the code to substitute a virtual character
433 @z
434
435 @x tex.ch l.5071 - more pdftex substitution
436 @ Dumping ML\TeX-related material. This is just the flag in the
437 @y
438 @ \pdfTeX's |pdf_hlist_out| uses a similar, but slightly modified code
439 section of the (almost) same name.
440
441 @<(\pdfTeX) Rebuild character using substitution information@>=
442 base_x_height:=x_height(f);
443 base_slant:=slant(f)/float_constant(65536);
444 @^real division@>
445 accent_slant:=base_slant; {slant of accent character font}
446 base_width:=char_width(f)(ib_c);
447 base_height:=char_height(f)(height_depth(ib_c));
448 accent_width:=char_width(f)(ia_c);
449 accent_height:=char_height(f)(height_depth(ia_c));
450 @/{compute necessary horizontal shift (don't forget slant)}@/
451 delta:=round((base_width-accent_width)/float_constant(2)+
452 base_height*base_slant-base_x_height*accent_slant);
453 @^real multiplication@>
454 @^real addition@>
455 @/{1. For centering/horizontal shifting insert a kern node.}@/
456 cur_h:=cur_h+delta;
457 @/{2. Then insert the accent character possibly shifted up or down.}@/
458 if ((base_height<>base_x_height) and (accent_height>0)) then
459 begin {the accent must be shifted up or down}
460 cur_v:=base_line+(base_x_height-base_height);
461 output_one_char(accent_c);
462 cur_v:=base_line;
463 end
464 else begin
465 output_one_char(accent_c);
466 end;
467 cur_h:=cur_h+accent_width;
468 @/{3. For centering/horizontal shifting insert another kern node.}@/
469 cur_h:=cur_h+(-accent_width-delta);
470 @/{4. Output the base character.}@/
471 output_one_char(base_c);
472 cur_h:=cur_h+base_width;
473
474 @ Dumping ML\TeX-related material. This is just the flag in the
475 @z