1 /* Copyright 1992 Karl Berry
2 Copyright 2007 TeX Users Group
3 Copyright 2014 Clerk Ma
5 This program 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.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #pragma warning(disable:4115) // kill rpcasync.h complaint
27 #define MYLIBAPI __declspec(dllexport)
32 #pragma warning(disable:4996)
33 #pragma warning(disable:4131) // old style declarator
34 #pragma warning(disable:4135) // conversion between different integral types
35 #pragma warning(disable:4127) // conditional expression is constant
43 #pragma warning(disable:4244) /* 96/Jan/10 */
47 #define BEGINFMTCHECKSUM 367403084L
48 #define ENDFMTCHECKSUM 69069L
50 extern clock_t start_time, main_time, finish_time; /* in local.c */
52 /* imported from pascal.h */
53 /* localized here to avoid conflict with io.h in other code */
55 #define read(f, b) ((b) = getc (f))
56 #define readln(f) { register int c; while ((c = getc (f)) != '\n' && c != EOF); }
59 void do_initex (void); /* later in this file */
62 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
64 void initialize (void)
68 integer flag; /* bkph */
69 #ifndef ALLOCATEHYPHEN
73 /* We already initialized xchr if we are using non_ascii setup */
76 /* Normally, there is no translation of character code numbers */
77 for (i = 0; i <= 255; i++) xchr[i] = (char) i;
78 /* This is a kind of joke, since the characters are given as numeric codes ! */
80 xchr[32] = ' '; xchr[33] = '!'; xchr[34] = '"'; xchr[35] = '#';
81 xchr[36] = '$'; xchr[37] = '%'; xchr[38] = '&'; xchr[39] = '\'';
82 xchr[40] = '('; xchr[41] = ')'; xchr[42] = '*'; xchr[43] = '+';
83 xchr[44] = ','; xchr[45] = '-'; xchr[46] = '.'; xchr[47] = '/';
84 xchr[48] = '0'; xchr[49] = '1'; xchr[50] = '2'; xchr[51] = '3';
85 xchr[52] = '4'; xchr[53] = '5'; xchr[54] = '6'; xchr[55] = '7';
86 xchr[56] = '8'; xchr[57] = '9'; xchr[58] = ':'; xchr[59] = ';';
87 xchr[60] = '<'; xchr[61] = '='; xchr[62] = '>'; xchr[63] = '?';
88 xchr[64] = '@'; xchr[65] = 'A'; xchr[66] = 'B'; xchr[67] = 'C';
89 xchr[68] = 'D'; xchr[69] = 'E'; xchr[70] = 'F'; xchr[71] = 'G';
90 xchr[72] = 'H'; xchr[73] = 'I'; xchr[74] = 'J'; xchr[75] = 'K';
91 xchr[76] = 'L'; xchr[77] = 'M'; xchr[78] = 'N'; xchr[79] = 'O';
92 xchr[80] = 'P'; xchr[81] = 'Q'; xchr[82] = 'R'; xchr[83] = 'S';
93 xchr[84] = 'T'; xchr[85] = 'U'; xchr[86] = 'V'; xchr[87] = 'W';
94 xchr[88] = 'X'; xchr[89] = 'Y'; xchr[90] = 'Z'; xchr[91] = '[';
95 xchr[92] = '\\'; xchr[93] = ']'; xchr[94] = '^'; xchr[95] = '_';
96 xchr[96] = '`'; xchr[97] = 'a'; xchr[98] = 'b'; xchr[99] = 'c';
97 xchr[100] = 'd'; xchr[101] = 'e'; xchr[102] = 'f'; xchr[103] = 'g';
98 xchr[104] = 'h'; xchr[105] = 'i'; xchr[106] = 'j'; xchr[107] = 'k';
99 xchr[108] = 'l'; xchr[109] = 'm'; xchr[110] = 'n'; xchr[111] = 'o';
100 xchr[112] = 'p'; xchr[113] = 'q'; xchr[114] = 'r'; xchr[115] = 's';
101 xchr[116] = 't'; xchr[117] = 'u'; xchr[118] = 'v'; xchr[119] = 'w';
102 xchr[120] = 'x'; xchr[121] = 'y'; xchr[122] = 'z'; xchr[123] = '{';
103 xchr[124] = '|'; xchr[125] = '}'; xchr[126] = '~';
105 for (i = 0; i <= 31; i++) xchr[i] = chr(i);
107 for (i = 127; i <= 255; i++) xchr[i]= chr(i);
108 #endif /* end of JOKE */
110 /* end of plain ASCII case (otherwise have read in xchr vector before) */
111 /* Fill in background of `delete' for inverse mapping */
112 for (i = 0; i <= 255; i++) xord[chr(i)] = 127;
114 for (i = 128; i <= 255 ; i++) xord[xchr[i]] = i;
116 for (i = 0; i <= 126; i++) xord[xchr[i]] = i;
119 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
120 /* Now invert the xchr mapping to get xord mapping */
121 for (i = 0; i <= 255; i++) xord[xchr[i]] = (char) i;
123 xord[127] = 127; /* hmm, a fixed point ? why ? */
125 flag = 0; /* 93/Dec/28 - bkph */
129 for (k = 0; k < 256; k++) /* entries in xord / xchr */
136 { /* 127 here means mapping undefined */
137 show_line("Inverted mapping xord[] pairs:\n", 0);
138 for (k = 0; k < 256; k++)
139 {/* entries in xord / xchr */
142 sprintf(log_line, "%d => %d\n", k, xord[k]);
143 show_line(log_line, 0);
148 if (interaction < 0) /* may now set in local.c bkph */
149 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
150 interaction = error_stop_mode;
151 deletions_allowed = true;
152 set_box_allowed = true;
155 use_err_help = false;
157 OK_to_interrupt = true;
159 /* darn, need to know mem_top, mem_max etc for the following ... */
161 was_mem_end = mem_min;
162 /* was_lo_max = mem_min; */
163 was_lo_max = mem_bot;
164 /* was_hi_min = mem_max; */
165 was_hi_min = mem_top;
173 cur_list.aux_field.cint = ignore_depth;
178 page_tail = page_head;
180 if (is_initex) /* in iniTeX we did already allocate mem [] */
182 mem[page_head].hh.v.RH = 0;
183 /* last_glue = 262143L; */ /* NO! */
184 last_glue = empty_flag;
189 for (k = int_base; k <= eqtb_size; k++) xeq_level[k] = 1;
190 no_new_control_sequence = true;
191 hash[514].v.LH = 0; /* next(hash_base):= 0 */
192 hash[514].v.RH = 0; /* text(hash_base):= 0 */
193 /* 514 + hash_size + 266 = hashbase + hashsize + 10 + font_max */
194 /* for k <- hashbase+1 to undefined_control_sequence - 1 do ... p.257 */
195 for (k = hash_base + 1; k <= undefined_control_sequence - 1; k++) hash[k] = hash[hash_base];
211 for (k = 0; k <= 16; k++) read_open[k] = 2;
216 for (k = 0; k <= font_max; k++) font_used[k] = false;
217 null_character.b0 = 0;
218 null_character.b1 = 0;
219 null_character.b2 = 0;
220 null_character.b3 = 0;
226 doing_leaders = false;
229 half_buf = dvi_buf_size / 2;
230 dvi_limit = dvi_buf_size;
234 /* down_ptr:=null; right_ptr:=null; l.12027 */
240 empty_field.v.RH = 0;
241 empty_field.v.LH = 0;
242 null_delimiter.b0 = 0;
243 null_delimiter.b1 = 0;
244 null_delimiter.b2 = 0;
245 null_delimiter.b3 = 0;
252 /* *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
253 #ifndef ALLOCATEHYPHEN
254 /* {register integer for_end; z = 0; for_end = 607; if (z <= for_end) do */
255 for (z = 0; z <= hyphen_prime; z++)
262 output_active = false;
263 insert_penalties = 0;
264 ligature_present = false;
265 cancel_boundary = false;
270 long_help_seen = false;
272 for (k = 0; k <= 17; k++)
273 write_open[k] = false;
277 /* initex stuff split off for convenience of optimization adjustments */
283 /* trap the -i on command line situation if INITEX was NOT defined */
286 show_line("Sorry, somebody forgot to make an INITEX!\n", 1);
288 #endif /* not INITEX */
291 /* do the part of initialize() that requires mem_top, mem_max or mem[] */
292 /* do this part after allocating main memory */
295 void initialize_aux (void)
298 was_mem_end = mem_min;
299 /* was_lo_max = mem_min; */
300 was_lo_max = mem_bot;
301 /* was_hi_min = mem_max; */
302 was_hi_min = mem_top;
306 /* max_nest_stack = 0; */
310 cur_list.aux_field.cint = ignore_depth;
313 /* shown_mode = 0; */
314 /* page_contents = 0; */
315 page_tail = page_head;
316 //mem[mem_top - 2].hh.v.RH = 0;
319 #endif // end of ifdef ALLOCATEMAIN
321 void line_break_ (integer finalwidowpenalty)
325 halfword q, r, s, prevs;
326 internal_font_number f;
327 /* small_number j; */
328 int j; /* 95/Jan/7 */
329 /* unsigned char c; */
330 unsigned int c; /* 95/Jan/7 */
331 /* savedbadness = 0; */ /* 96/Feb/9 */
332 pack_begin_line = mode_line;
333 mem[temp_head].hh.v.RH = link(head);
334 if ((tail >= hi_mem_min))
336 link(tail) = new_penalty(10000);
339 else if (mem[tail].hh.b0 != 10)
341 link(tail) = new_penalty(10000);
347 delete_glue_ref(mem[tail + 1].hh.v.LH);
348 flush_node_list(mem[tail + 1].hh.v.RH);
349 mem[tail + 1].cint = 10000;
351 link(tail) = new_param_glue(par_fill_skip_code);
352 /* *********************************************************************** */
353 /* following is new in 3.14159 */
354 init_cur_lang = prev_graf % 65536L;
355 init_l_hyf = prev_graf / 4194304L; /* 2^22 */
356 init_r_hyf = (prev_graf / 65536L)% 64;
357 /* *********************************************************************** */
359 noshrinkerroryet = true;
360 if ((mem[eqtb[(hash_size + 789)].hh.v.RH].hh.b1 != 0) &&
361 (mem[eqtb[(hash_size + 789)].hh.v.RH + 3].cint != 0))
363 eqtb[(hash_size + 789)].hh.v.RH = finite_shrink(eqtb[(hash_size + 789)].hh.v.RH);
365 if ((mem[eqtb[(hash_size + 790)].hh.v.RH].hh.b1 != 0) &&
366 (mem[eqtb[(hash_size + 790)].hh.v.RH + 3].cint != 0))
368 eqtb[(hash_size + 790)].hh.v.RH = finite_shrink(eqtb[(hash_size + 790)].hh.v.RH);
370 q = eqtb[(hash_size + 789)].hh.v.RH;
371 r = eqtb[(hash_size + 790)].hh.v.RH;
372 background[1] = mem[q + 1].cint + mem[r + 1].cint;
377 background[2 + mem[q].hh.b0] = mem[q + 2].cint;
378 background[2 + mem[r].hh.b0] = background[2 + mem[r].hh.b0] + mem[r + 2].cint;
379 background[6] = mem[q + 3].cint + mem[r + 3].cint;
380 minimum_demerits = 1073741823L; /* 2^30 - 1 *//* 40000000 hex - 1 */
381 minimal_demerits[3] = 1073741823L;
382 minimal_demerits[2] = 1073741823L;
383 minimal_demerits[1] = 1073741823L;
384 minimal_demerits[0] = 1073741823L;
385 if (par_shape_ptr == 0)
386 if (hang_indent == 0)
388 last_special_line = 0;
389 second_width = hsize;
394 last_special_line = abs(hang_after);
397 first_width = hsize - abs(hang_indent);
398 if (hang_indent >= 0)
399 first_indent = hang_indent;
400 else first_indent = 0;
401 second_width = hsize;
406 second_width = hsize - abs(hang_indent);
407 if (hang_indent >= 0)
408 second_indent = hang_indent;
409 else second_indent = 0;
413 last_special_line = mem[par_shape_ptr].hh.v.LH - 1;
414 second_width = mem[par_shape_ptr + 2 *(last_special_line + 1)].cint;
415 second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].cint;
417 /* if looseness=0 then easy_line:=last_special_line */
419 easyline = last_special_line;
420 /* else easyline = 262143L; */ /* NO! */
421 else easyline = empty_flag;
422 /* threshold:=pretolerance; */
423 threshold = pretolerance;
428 /* if tracing_paragraphs>0 then */
429 if (tracing_paragraphs > 0)
432 print_nl("@firstpass");
437 first_pass_count++; /* 96 Feb 9 */
440 /* threshold:=tolerance; second_pass:=true; */
441 threshold = tolerance;
443 /* final_pass:=(emergency_stretch<=0); */
444 final_pass =(emergency_stretch <= 0);
447 if (tracing_paragraphs > 0)
452 /* if threshold>inf_bad then threshold:=inf_bad; */
453 if (threshold > 10000)
459 if (is_initex) { /* bkph */
460 if (trie_not_ready)init_trie();
463 /* ********************************************************************* */
464 /* following has changed in 3.14159 */
466 cur_lang = init_cur_lang;
467 /* lhyf = cur_list .lhmfield; */
469 /* rhyf = cur_list .rhmfield; */
471 /* ********************************************************************* */
476 mem[q].hh.v.RH = active;
477 mem[q + 1].hh.v.RH = 0;
478 mem[q + 1].hh.v.LH = prev_graf + 1;
480 mem[active].hh.v.RH = q;
481 active_width[1] = background[1];
482 active_width[2] = background[2];
483 active_width[3] = background[3];
484 active_width[4] = background[4];
485 active_width[5] = background[5];
486 active_width[6] = background[6];
487 /* passive:=null; printed_node:=temp_head; pass_number:=0; */
489 printed_node = temp_head;
491 font_in_short_display = 0;
492 cur_p = mem[temp_head].hh.v.RH;
495 /* while (cur_p<>null)and(link(active)<>last_active) do */
496 while((cur_p != 0)&&(mem[active].hh.v.RH != active))
498 if ((cur_p >= hi_mem_min))
502 f = mem[cur_p].hh.b0;
503 active_width[1]= active_width[1]+ font_info[width_base[f]+
504 font_info[char_base[f]+ mem[cur_p].hh.b1].qqqq.b0].cint
506 cur_p = mem[cur_p].hh.v.RH;
507 } while(!(!(cur_p >= hi_mem_min)));
509 switch(mem[cur_p].hh.b0)
513 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
516 if (mem[cur_p].hh.b1 == 4)
518 cur_lang = mem[cur_p + 1].hh.v.RH; /* ASCII_code */
519 lhyf = mem[cur_p + 1].hh.b0;
520 rhyf = mem[cur_p + 1].hh.b1;
527 if ((prevp >= hi_mem_min))
529 else if ((mem[prevp].hh.b0 < 9))
531 /* *********************************************************************** */
532 /* following is new in 3.14159 */
533 else if ((mem[prevp].hh.b0 == 11)&&(mem[prevp].hh.b1
536 /* *********************************************************************** */
538 if ((mem[mem[cur_p + 1].hh.v.LH].hh.b1 != 0)&&(mem[
539 mem[cur_p + 1].hh.v.LH + 3].cint != 0))
541 mem[cur_p + 1].hh.v.LH = finite_shrink(mem[cur_p + 1].hh.v.LH);
543 q = mem[cur_p + 1].hh.v.LH;
544 active_width[1]= active_width[1]+ mem[q + 1].cint;
545 active_width[2 + mem[q].hh.b0]= active_width[2 + mem[q]
546 .hh.b0]+ mem[q + 2].cint;
547 active_width[6]= active_width[6]+ mem[q + 3].cint;
548 if (second_pass && autobreaking)
551 s = mem[prevs].hh.v.RH;
555 if ((s >= hi_mem_min))
560 else if (mem[s].hh.b0 == 6)
561 if (mem[s + 1].hh.v.RH == 0)
565 q = mem[s + 1].hh.v.RH;
569 else if ((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
572 else if (mem[s].hh.b0 == 8)
574 if (mem[s].hh.b1 == 4)
576 cur_lang = mem[s + 1].hh.v.RH; /* ASCII_code */
577 lhyf = mem[s + 1].hh.b0;
578 rhyf = mem[s + 1].hh.b1;
583 if (eqtb[(hash_size + 2139) + c].hh.v.RH != 0)
584 /* signed unsigned mismatch ? (c is unsigned) */
585 if ((eqtb[(hash_size + 2139) + c].hh.v.RH == c)||
590 s = mem[prevs].hh.v.RH;
592 lab32: hyf_char = hyphen_char[hf];
593 /* if hyf_char<0 then goto done1; */
594 if (hyf_char < 0) goto lab31;
595 /* if hyf_char>255 then goto done1; */
596 if (hyf_char > 255) goto lab31; /* ? */
598 if (lhyf + rhyf > 63) goto lab31;
601 if ((s >= hi_mem_min)) {
602 if (mem[s].hh.b0 != hf)
604 hyfbchar = mem[s].hh.b1;
605 c = hyfbchar; /* unsigned char c; */
606 if (eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
613 /* long to short ... */
614 hc[hn]= eqtb[(hash_size + 2139) + c].hh.v.RH;
615 hyfbchar = 256; /* special mark */
617 else if (mem[s].hh.b0 == 6)
619 if (mem[s + 1].hh.b0 != hf)
621 /* j:=hn; q:=lig_ptr(s); l.17554 */
623 q = mem[s + 1].hh.v.RH;
624 /* if q>null then hyf_bchar:=character(q); l.17554 BUG ??? */
626 if (q != 0) /* 94/Mar/23 BUG FIX */
627 hyfbchar = mem[q].hh.b1;
628 /* while q>null do l.17555 BUG ??? */
630 while(q != 0){ /* 94/Mar/23 BUG FIX */
632 if (eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
638 /* long to short ... */
639 hc[j]= eqtb[(hash_size + 2139) + c].hh.v.RH;
644 if (odd(mem[s].hh.b1))
645 hyfbchar = font_bchar[hf];
646 else hyfbchar = 256; /* special mark */
648 else if ((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
652 /* ******************************************************************** */
653 hyfbchar = font_bchar[hf]; /* new code in 3.14159 */
654 /* ******************************************************************** */
660 if (hn < lhyf + rhyf)
663 if (!((s >= hi_mem_min)))
669 if (mem[s].hh.b1 != 0)
694 /* ******************************************************************* */
695 if (mem[cur_p].hh.b1 == 1)/* change in 3.14159 */
696 /* ******************************************************************* */
698 if (!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
699 if (mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
701 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
703 /* ******************************************************************* */
704 /* change in 3.14159 */
705 else active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
706 /* ******************************************************************* */
710 f = mem[cur_p + 1].hh.b0;
711 active_width[1]= active_width[1]+ font_info[width_base[f]+
712 font_info[char_base[f]+ mem[cur_p + 1].hh.b1].qqqq.b0]
718 s = mem[cur_p + 1].hh.v.LH;
721 try_break(ex_hyphen_penalty, 1);
724 if ((s >= hi_mem_min))
727 disc_width = disc_width + font_info[width_base[f]+ font_info
728 [ char_base[f]+ mem[s].hh.b1].qqqq.b0].cint;
730 else switch(mem[s].hh.b0)
733 f = mem[s + 1].hh.b0;
734 disc_width = disc_width + font_info[width_base[f]+
735 font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0
743 disc_width = disc_width + mem[s + 1].cint;
748 return; // abort_flag set
754 active_width[1]= active_width[1]+ disc_width;
755 try_break(hyphen_penalty, 1);
756 active_width[1]= active_width[1]- disc_width;
758 r = mem[cur_p].hh.b1;
759 s = mem[cur_p].hh.v.RH;
761 if ((s >= hi_mem_min))
764 active_width[1]= active_width[1]+ font_info[width_base[f
765 ]+ font_info[char_base[f]+ mem[s].hh.b1].qqqq.b0]
768 else switch(mem[s].hh.b0)
771 f = mem[s + 1].hh.b0;
772 active_width[1]= active_width[1]+ font_info[width_base[
773 f]+ font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq
781 active_width[1]= active_width[1]+ mem[s + 1].cint;
786 return; // abort_flag set
800 autobreaking =(mem[cur_p].hh.b1 == 1);
802 if (!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
803 if (mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
805 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
810 try_break(mem[cur_p + 1].cint, 0);
819 confusion("paragraph");
820 return; // abort_flag set
825 cur_p = mem[cur_p].hh.v.RH;
830 try_break(-10000, 1);
831 if (mem[active].hh.v.RH != active)
833 r = mem[active].hh.v.RH;
834 fewest_demerits = 1073741823L; /* 2^30 - 1 */
836 if (mem[r].hh.b0 != 2)
837 if (mem[r + 2].cint < fewest_demerits)
839 fewest_demerits = mem[r + 2].cint;
843 } while(!(r == active));
844 best_line = mem[best_bet + 1].hh.v.LH;
845 /* if looseness=0 then goto done; */
847 /* if (final_pass && eqtb[(hash_size + 3750)].cint > 0){ */
848 /* paragraph_failed++; */
850 goto lab30; /* normal exit */
853 /* r:=link(active); actual_looseness:=0; */
854 r = mem[active].hh.v.RH;
855 actual_looseness = 0;
857 if (mem[r].hh.b0 != 2)
859 /* line_diff:=line_number(r)-best_line; */
860 line_diff = toint(mem[r + 1].hh.v.LH)- toint(best_line
862 /* if ((line_diff<actual_looseness)and(looseness<=line_diff))or@|
863 ((line_diff>actual_looseness)and(looseness>=line_diff)) then */
864 if (((line_diff < actual_looseness) && (looseness <= line_diff)) ||
865 ((line_diff > actual_looseness) && (looseness >= line_diff)))
868 actual_looseness = line_diff;
869 fewest_demerits = mem[r + 2].cint;
871 else if ((line_diff == actual_looseness)&&(mem[r + 2]
872 .cint < fewest_demerits))
875 fewest_demerits = mem[r + 2].cint;
879 } while(!(r == active));
880 best_line = mem[best_bet + 1].hh.v.LH;
882 /* if (actual_looseness=looseness)or final_pass then goto done; */
883 /* if ((actual_looseness == eqtb[(hash_size + 3182)].cint)|| final_pass)*/
884 if ((actual_looseness == looseness)) {
892 q = mem[active].hh.v.RH;
894 cur_p = mem[q].hh.v.RH;
895 if (mem[q].hh.b0 == 2)
897 else free_node(q, 3);
902 cur_p = mem[q].hh.v.RH;
910 if (tracing_paragraphs > 0)
911 print_nl("@secondpass"); /* */
913 /* threshold:=tolerance; */
914 threshold = tolerance;
916 second_pass_count++; /* 96 Feb 9 */
917 /* final_pass:=(emergency_stretch<=0); */
918 final_pass =(emergency_stretch <= 0);
924 if (tracing_paragraphs > 0)
925 print_nl("@emergencypass"); /* */
927 /* can only get here is \emergencystretch has been set positive */
928 /* background[2]:=background[2]+emergency_stretch; final_pass:=true; */
929 background[2]= background[2]+ emergency_stretch;
931 final_pass_count++; /* 96 Feb 9 */
932 } /* end of if second_pass */
933 } /* end of while(true)do */
934 /* cannot drop through from above loop */
935 lab30: /* common exit point */
936 /* if (badness > (pre)tolerance) */
937 /* if (last_badness > threshold){ */
938 /* if (savedbadness > threshold){ */ /* do we believe this ??? */
939 /* paragraph_failed++; */ /* 96/Feb/9 */
941 /* if (prevgraf == 1) singleline++; */
942 /* if (nest[nest_ptr].pg_field == 1) singleline++; */
943 /* At this point best_line is number of lines in paragraph + 1 */
944 if (best_line == 2) singleline++;
947 if (tracing_paragraphs > 0)
949 end_diagnostic(true);
950 normalize_selector();
953 post_line_break(finalwidowpenalty);
954 q = mem[active].hh.v.RH;
956 cur_p = mem[q].hh.v.RH;
957 if (mem[q].hh.b0 == 2)
959 else free_node(q, 3);
963 while(q != 0){ /* while q<>null do l.16979 */
964 cur_p = mem[q].hh.v.RH;
971 void prefixed_command (void)
974 internal_font_number f;
981 while (cur_cmd == prefix) {
982 if (!odd(a / cur_chr))
983 a = a + cur_chr; /* small_number a; */
986 } while(!((cur_cmd != spacer) && (cur_cmd != relax)));
987 if (cur_cmd <= max_non_prefixed_command) {
988 print_err("You can't use a prefix with `");
989 print_cmd_chr(cur_cmd, cur_chr);
991 help1("I'll pretend you didn't say \\long or \\outer or \\global.");
996 if ((cur_cmd != 97) && (a % 4 != 0)) {
997 print_err("You can't use `");
999 print_string("' or `");
1001 print_string("' with `");
1002 print_cmd_chr(cur_cmd, cur_chr);
1003 print_char(39); /* ' */
1004 help1("I'll pretend you didn't say \\long or \\outer here.");
1007 if (global_defs != 0)
1008 if (global_defs < 0)
1019 /* set_font: define(cur_font_loc,data,cur_chr); */
1021 geq_define((hash_size + 1834), 120, cur_chr);
1022 else eq_define((hash_size + 1834), 120, cur_chr);
1026 if (odd(cur_chr) && !(a >= 4) && (global_defs >= 0))
1031 q = scan_toks(true, e);
1032 if ((a >= 4)) geq_define(p, 111 +(a % 4), def_ref);
1033 else eq_define(p, 111 +(a % 4), def_ref);
1044 } while (!(cur_cmd != 10));
1045 if (cur_tok == 3133) {
1059 incr(mem[cur_chr].hh.v.LH);
1061 geq_define(p, cur_cmd, cur_chr);
1063 eq_define(p, cur_cmd, cur_chr);
1072 geq_define(p, 0, 256);
1074 eq_define(p, 0, 256);
1075 scan_optional_equals();
1081 geq_define(p, 68, cur_val);
1082 else eq_define(p, 68, cur_val);
1087 scan_fifteen_bit_int();
1089 geq_define(p, 69, cur_val);
1091 eq_define(p, 69, cur_val);
1096 scan_eight_bit_int();
1100 geq_define(p, 73, (hash_size + 3218) + cur_val);
1101 else eq_define(p, 73, (hash_size + 3218) + cur_val);
1105 geq_define(p, 74, (hash_size + 3751) + cur_val);
1106 else eq_define(p, 74, (hash_size + 3751) + cur_val);
1110 geq_define(p, 75, (hash_size + 800) + cur_val);
1111 else eq_define(p, 75, (hash_size + 800) + cur_val);
1115 geq_define(p, 76, (hash_size + 1056) + cur_val);
1116 else eq_define(p, 76, (hash_size + 1056) + cur_val);
1120 geq_define(p, 72, toks_base + cur_val);
1121 else eq_define(p, 72, toks_base + cur_val);
1133 if (! scan_keyword("to")) /* to */
1135 print_err("Missing `to' inserted");
1136 help2("You should have said `\\read<number> to \\cs'.",
1137 "I'm going to look for the \\cs now.");
1143 if ((a >= 4)) geq_define(p, 111, cur_val);
1144 else eq_define(p, 111, cur_val);
1153 scan_eight_bit_int();
1154 p = toks_base + cur_val;
1157 scan_optional_equals();
1160 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1165 scan_eight_bit_int();
1167 cur_chr = toks_base + cur_val;
1171 q = eqtb[cur_chr].hh.v.RH;
1174 geq_define(p, 101, 0);
1175 else eq_define(p, 101, 0);
1178 incr(mem[q].hh.v.LH);
1180 geq_define(p, 111, q);
1181 else eq_define(p, 111, q);
1188 q = scan_toks(false, false);
1189 if (mem[def_ref].hh.v.RH == 0){
1191 geq_define(p, 101, 0);
1192 else eq_define(p, 101, 0);
1194 mem[def_ref].hh.v.RH = avail;
1204 if (p == (hash_size + 1313)) /* output ? */
1206 mem[q].hh.v.RH = get_avail();
1208 mem[q].hh.v.LH = 637;
1210 mem[q].hh.v.LH = 379;
1211 mem[q].hh.v.RH = mem[def_ref].hh.v.RH;
1212 mem[def_ref].hh.v.RH = q;
1215 geq_define(p, 111, def_ref);
1216 else eq_define(p, 111, def_ref);
1223 scan_optional_equals();
1226 geq_word_define(p, cur_val);
1227 else eq_word_define(p, cur_val);
1233 scan_optional_equals();
1234 scan_dimen(false, false, false);
1236 geq_word_define(p, cur_val);
1237 else eq_word_define(p, cur_val);
1245 scan_optional_equals();
1246 if (n == 76) scan_glue(3);
1250 geq_define(p, 117, cur_val);
1251 else eq_define(p, 117, cur_val);
1256 if (cur_chr == (hash_size + 1883))
1258 else if (cur_chr == (hash_size + 2907))
1259 n = 32768L; /* 2^15 */
1260 else if (cur_chr == (hash_size + 2651))
1261 n = 32767; /* 2^15 - 1*/
1262 else if (cur_chr == (hash_size + 3474))
1263 n = 16777215L; /* 2^24 - 1 */
1264 else n = 255; /* 2^8 - 1 */
1268 scan_optional_equals();
1270 if (((cur_val < 0)&&(p < (hash_size + 3474))) ||(cur_val > n))
1272 print_err("Invalid code(");
1274 if (p < (hash_size + 3474))
1275 print_string("), should be in the range 0..");
1277 print_string("), should be at most ");
1279 help1("I'm going to use 0 instead of that illegal code value.");
1283 if (p < (hash_size + 2907))
1285 geq_define(p, 120, cur_val);
1286 else eq_define(p, 120, cur_val);
1287 else if (p < (hash_size + 3474))
1289 geq_define(p, 120, cur_val);
1290 else eq_define(p, 120, cur_val);
1292 geq_word_define(p, cur_val);
1293 else eq_word_define(p, cur_val);
1299 scan_four_bit_int();
1301 scan_optional_equals();
1304 geq_define(p, 120, cur_val);
1305 else eq_define(p, 120, cur_val);
1312 do_register_command(a);
1316 scan_eight_bit_int();
1320 scan_optional_equals();
1321 if (set_box_allowed){
1322 scan_box(1073741824L + n); /* 2^30 + n */ /* box_flag + n */
1325 print_err("Improper ");
1326 print_esc("setbox"); /* */
1327 help2("Sorry, \\setbox is not allowed after \\halign in a display,",
1328 "or between \\accent and an accented character.");
1340 alter_page_so_far();
1350 scan_optional_equals();
1357 p = get_node(2 * n + 1);
1360 register integer for_end;
1363 if (j <= for_end) do
1365 scan_dimen(false, false, false);
1366 mem[p + 2 * j - 1].cint = cur_val;
1367 scan_dimen(false, false, false);
1368 mem[p + 2 * j].cint = cur_val;
1370 while(j++ < for_end);
1374 geq_define((hash_size + 1312), 118, p);
1375 else eq_define((hash_size + 1312), 118, p);
1383 if (is_initex) { /* bkph */
1388 print_err("Patterns can be loaded only by INITEX");
1393 } while(!(cur_cmd == 2));
1398 new_hyph_exceptions();
1404 find_font_dimen(true);
1406 scan_optional_equals();
1407 scan_dimen(false, false, false);
1408 font_info[k].cint = cur_val;
1416 scan_optional_equals();
1418 if (n == 0)hyphen_char[f]= cur_val;
1419 else skew_char[f]= cur_val;
1430 confusion("prefix");
1431 return; // abort_flag set
1434 } /* end of cur_cmd switch */
1438 if (after_token != 0) {
1439 cur_tok = after_token;
1445 /* added following explanations 96/Jan/10 */
1447 void bad_formator_pool (char *name, char *defaultname, char *envvar)
1449 if (name == NULL) name = defaultname;
1450 sprintf(log_line, "(Perhaps %s is for an older version of TeX)\n", name);
1451 show_line(log_line, 0);
1452 name_of_file[name_length + 1] = '\0';
1453 sprintf(log_line, "(Alternatively, %s may have been corrupted)\n", name_of_file+1);
1454 show_line(log_line, 0);
1455 name_of_file[name_length + 1] = ' ';
1457 "(Perhaps your %s environment variable is not set correctly)\n", envvar);
1458 show_line(log_line, 0);
1460 char *s; /* extra info 99/April/28 */
1461 if ((s = grabenv(envvar)) != NULL) {
1462 sprintf(log_line, "(%s=%s)\n", envvar, s);
1463 show_line(log_line, 0);
1466 sprintf(log_line, "%s environment variable not set\n", envvar);
1467 show_line(log_line, 0);
1475 bool load_fmt_file (void)
1477 register bool Result;
1483 undump_int(x); /* CHECKSUM */
1484 if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
1487 undump_int(x); /* mem_bot */
1491 undump_int(x); /* mem_top */
1494 /* we already read this once earlier to grab mem_top */
1496 sprintf(log_line, "Read from fmt file mem_top = %d TeX words\n", x);
1497 show_line(log_line, 0);
1499 mem = allocate_main_memory(x); /* allocate main memory at this point */
1500 if (mem == NULL) exit(1); /* redundant sanity test ! */
1501 initialize_aux(); /* do `mem' part of initialize */
1502 /* mem = zmem; */ /* update pointer to main memory */
1508 undump_int(x); /* eqtbsize */
1509 if (x != (hash_size + 4006)) /* eqtbsize */
1511 undump_int(x); /* hash_prime */
1512 if (x != hash_prime)
1514 undump_int(x); /* hyphen_prime */
1516 #ifdef ALLOCATEHYPHEN
1517 /* allow format files dumped with arbitrary (prime) hyphenation exceptions */
1518 realloc_hyphen (x); /* reset_hyphen(); */
1522 if (x != hyphen_prime)
1525 undump_int(x); /* pool_size */
1529 #ifdef ALLOCATESTRING
1530 if (x > current_pool_size) {
1532 sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size);
1533 show_line(log_line, 0);
1535 str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
1537 if (x > current_pool_size) /* 94/Jan/24 */
1543 sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size");
1544 show_line(log_line, 0);
1546 } else pool_ptr = x;
1549 undump_int(x); /* max_strings */
1553 #ifdef ALLOCATESTRING
1554 if (x > current_max_strings) {
1556 sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
1557 show_line(log_line, 0);
1559 str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
1561 if (x > current_max_strings) /* 94/Jan/24 */
1563 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1564 if (x > max_strings)
1568 sprintf(log_line, "%s%s\n", "---! Must increase the ", "max strings");
1569 show_line(log_line, 0);
1575 if (undumpthings(str_start[0], str_ptr + 1)) return -1; /* undump string ptrs */
1576 if (undumpthings(str_pool[0], pool_ptr)) return -1; /* undump string pool */
1578 init_str_ptr = str_ptr;
1579 init_pool_ptr = pool_ptr;
1580 /* undump the dynamic memory - paragraph 1312 in the book */
1583 if ((x < 1019)||(x > mem_top - 14))
1585 else lo_mem_max = x;
1589 if ((x < 20)||(x > lo_mem_max))
1593 p = 0; /* mem_bot */
1596 if (undumpthings(mem[p], q + 2 - p)
1598 p = q + mem[q].hh.v.LH;
1599 if ((p > lo_mem_max)||((q >= mem[q + 1].hh.v.RH)&&(mem[q +
1600 1].hh.v.RH != rover)))
1602 q = mem[q + 1].hh.v.RH;
1603 } while(!(q == rover));
1604 if (undumpthings(mem[p], lo_mem_max + 1 - p)
1606 /* if (mem_min < -2) */
1607 if (mem_min < mem_bot - 2) /* ? splice in block below */
1609 /* or call add_variable_space(mem_bot - (mem_min + 1)) */
1611 if (trace_flag) show_line("Splicing in mem_min space in undump!\n", 0);
1613 p = mem[rover + 1].hh.v.LH;
1615 mem[mem_min].hh.v.RH = 0; /* null */
1616 mem[mem_min].hh.v.LH = 0; /* null */
1617 mem[p + 1].hh.v.RH = q;
1618 mem[rover + 1].hh.v.LH = q;
1619 mem[q + 1].hh.v.RH = rover;
1620 mem[q + 1].hh.v.LH = p;
1621 /* mem[q].hh.v.RH = 262143L; */ /* NO! */
1622 mem[q].hh.v.RH = empty_flag;
1623 /* mem[q].hh.v.LH = -0 - q; */
1624 mem[q].hh.v.LH = mem_bot - q; /* ? size of block */
1628 if ((x < lo_mem_max + 1)||(x > mem_top - 13))
1630 else hi_mem_min = x;
1634 /* if ((x < 0)||(x > mem_top)) */
1635 if ((x < mem_bot)||(x > mem_top))
1640 if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)
1642 undump_int(var_used);
1643 undump_int(dyn_used);
1647 if ((x < 1)||(k + x > (hash_size + 4007)))
1649 if (undumpthings(eqtb[k], x)
1653 if ((x < 0)||(k + x > (hash_size + 4007)))
1656 register integer for_end;
1658 for_end = k + x - 1;
1659 if (j <= for_end) do
1660 eqtb[j]= eqtb[k - 1];
1661 while(j++ < for_end);
1664 } while(!(k > (hash_size + 4006)));
1667 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1668 /* if ((x < 514)||(x > (hash_size + 514))) */
1669 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1673 par_token = 4095 + par_loc;
1676 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1677 /* if ((x < 514)||(x > (hash_size + 514))) */
1678 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1685 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1686 /* if ((x < 514)||(x > (hash_size + 514))) */
1687 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1695 if ((x < p + 1)||(x > hash_used))
1700 } while(!(p == hash_used));
1701 if (undumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)
1704 undump_int(cs_count); /* cs_count */
1706 sprintf(log_line, "itex undump cs_count %d ", cs_count); /* debugging */
1707 show_line(log_line, 0);
1710 undump_int(x); /* font_mem_size */
1713 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1716 sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
1717 show_line(log_line, 0);
1719 if (x > current_font_mem_size) { /* 93/Nov/28 dynamic allocate font_info */
1721 sprintf(log_line, "Undump realloc font_info (%d > %d)\n",
1722 x, current_font_mem_size);
1723 show_line(log_line, 0);
1725 font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
1727 if (x > current_font_mem_size) /* in case allocation failed 94/Jan/24 */
1729 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1730 if (x > font_mem_size)
1734 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font mem size");
1735 show_line(log_line, 0);
1737 } else fmem_ptr = x;
1740 if (undumpthings(font_info[0], fmem_ptr)) return -1;
1742 undump_int(x); /* font_max */
1748 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font max");
1749 show_line(log_line, 0);
1754 frozenfontptr = font_ptr; /* remember number of fonts frozen into format */
1755 if (undumpthings(font_check[0], font_ptr + 1)) return -1;
1756 if (undumpthings(font_size[0], font_ptr + 1)) return -1;
1757 if (undumpthings(font_dsize[0], font_ptr + 1)) return -1;
1758 if (undumpthings(font_params[0], font_ptr + 1)) return -1;
1759 if (undumpthings(hyphen_char[0], font_ptr + 1)) return -1;
1760 if (undumpthings(skew_char[0], font_ptr + 1)) return -1;
1761 if (undumpthings(font_name[0], font_ptr + 1)) return -1;
1762 if (undumpthings(font_area[0], font_ptr + 1)) return -1;
1763 if (undumpthings(font_bc[0], font_ptr + 1)) return -1;
1764 if (undumpthings(font_ec[0], font_ptr + 1)) return -1;
1765 if (undumpthings(char_base[0], font_ptr + 1)) return -1;
1766 if (undumpthings(width_base[0], font_ptr + 1)) return -1;
1767 if (undumpthings(height_base[0], font_ptr + 1)) return -1;
1768 if (undumpthings(depth_base[0], font_ptr + 1)) return -1;
1769 if (undumpthings(italic_base[0], font_ptr + 1)) return -1;
1770 if (undumpthings(lig_kern_base[0], font_ptr + 1)) return -1;
1771 if (undumpthings(kern_base[0], font_ptr + 1)) return -1;
1772 if (undumpthings(exten_base[0], font_ptr + 1)) return -1;
1773 if (undumpthings(param_base[0], font_ptr + 1)) return -1;
1774 if (undumpthings(font_glue[0], font_ptr + 1)) return -1;
1775 if (undumpthings(bchar_label[0], font_ptr + 1)) return -1;
1776 if (undumpthings(font_bchar[0], font_ptr + 1)) return -1;
1777 if (undumpthings(font_false_bchar[0], font_ptr + 1)) return -1;
1780 /* log not opened yet, so can't show fonts frozen into format */
1782 /* May be able to avoid the following since we switched to */
1783 /* non_address from font_mem_size to 0 96/Jan/15 ??? */
1784 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1786 /* deal with fmt files dumped with *different* font_mem_size 93/Nov/29 */
1787 { int count = 0, oldfont_mem_size = 0;
1788 for (x = 0; x <= font_ptr; x++) {
1789 if (bchar_label[x] > oldfont_mem_size) oldfont_mem_size = bchar_label[x];
1792 /* somewhat arbitrary sanity check ... */
1793 /* if (oldfont_mem_size != font_mem_size && oldfont_mem_size > font_max) { */
1794 if (oldfont_mem_size != non_address && oldfont_mem_size > font_max) { /* 96/Jan/16 */
1795 for (x = 0; x <= font_ptr; x++) {
1796 if (bchar_label[x] == oldfont_mem_size) {
1797 /* bchar_label[x] = font_mem_size; */
1798 bchar_label[x] = non_address; /* 96/Jan/16 */
1804 "oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
1805 oldfont_mem_size, count, non_address);
1806 show_line(log_line, 0);
1811 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1812 /* undump(0)(hyph_size)(hyph_count); */
1815 /* if ((x < 0)||(x > 607)) */
1816 if ((x < 0)||(x > hyphen_prime))
1821 /* undump hypenation exception tables p.1325 */
1823 register integer for_end;
1825 for_end = hyph_count;
1831 /* if ((x < 0)||(x > 607)) */
1832 if ((x < 0)||(x > hyphen_prime))
1837 /* undump(0)(str_ptr)(hyph_word[j]); */
1840 if ((x < 0)||(x > str_ptr))
1845 /* undump(min_halfword)(max_halfword)(hyph_list[j]); */
1848 /* if ((x < 0)||(x > 262143L)) */
1849 if ((x < 0)||(x > max_halfword)) /* mem_top ? no p.1325 */
1854 } while(k++ < for_end);
1856 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1857 #ifdef ALLOCATEHYPHEN
1858 /* if user specified new hyphen prime - flush existing exception patterns ! */
1859 /* but, we can reclaim the string storage wasted ... */
1861 if (new_hyphen_prime != 0) {
1862 realloc_hyphen(new_hyphen_prime); /* reset_hyphen(); */
1863 hyphen_prime = new_hyphen_prime;
1867 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1872 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1873 #ifdef ALLOCATETRIES
1875 allocate_tries(x); /* allocate only as much as is needed */
1876 /* trie_size = x; */ /* ??? */
1879 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1883 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie size");
1884 show_line(log_line, 0);
1890 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1891 if (is_initex) /* bkph */
1892 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1895 if (undumpthings(trie_trl[0], j + 1)) return -1;
1896 if (undumpthings(trie_tro[0], j + 1)) return -1;
1897 if (undumpthings(trie_trc[0], j + 1)) return -1;
1902 if (x > trie_op_size)
1905 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie op size");
1906 show_line(log_line, 0);
1912 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1913 if (is_initex) /* bkph */
1914 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1918 begin undump(0)(63)(hyf_distance[k]); {a |small_number|}
1919 undump(0)(63)(hyf_num[k]);
1920 undump(min_quarterword)(max_quarterword)(hyf_next[k]); end; */
1922 if (undumpthings(hyf_distance[1], j)) return -1;
1923 if (undumpthings(hyf_num[1], j)) return -1;
1924 if (undumpthings(hyf_next[1], j)) return -1;
1927 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1928 if (is_initex) { /* bkph */
1929 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1931 register integer for_end;
1934 if (k <= for_end) do
1936 while(k++ < for_end);
1942 /* undump(0)(k-1)(k) */
1945 if ((x < 0)||(x > k - 1))
1949 /* undump(1)(j)(x) */
1952 if ((x < 1)||(x > j))
1958 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1959 if (is_initex) /* bkph */
1960 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1963 /* j:=j-x; op_start[k]:=qo(j); */
1969 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1970 if (is_initex) /* bkph */
1971 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1972 trie_not_ready = false
1977 if ((x < 0)||(x > 3))
1979 /* else interaction = x; */
1980 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1981 if (interaction < 0) /* may now set in local.c bkph 94/Jan/8 */
1982 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1987 if ((x < 0)||(x > str_ptr))
1989 else format_ident = x;
1992 /* test_eof(fmt_file)? */
1994 if ((x != ENDFMTCHECKSUM)|| feof(fmt_file)) /* magic checksum --- change ? */
2001 sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
2002 show_line(log_line, 1);
2003 /* added following bit of explanation 96/Jan/10 */
2005 bad_formator_pool(format_file, "the format file", "TEXFORMATS");
2010 void final_cleanup (void)
2014 if (job_name == 0) open_log_file();
2015 while (input_ptr > 0) {
2016 if (cur_input.state_field == 0) {
2018 } else end_file_reading();
2020 while (open_parens > 0) {
2024 if (cur_level > level_one) {
2026 print_esc("end occurred ");
2027 print_string("inside a group at level ");
2028 print_int(cur_level - 1);
2031 while (cond_ptr != 0) {
2033 print_esc("end occurred ");
2034 print_string("when ");
2035 print_cmd_chr(105, cur_if); /* i */
2037 print_string("on line ");
2040 print_string(" was incomplete)");
2041 if_line = mem[cond_ptr + 1].cint;
2042 cur_if = mem[cond_ptr].hh.b1;
2043 temp_ptr = cond_ptr;
2044 cond_ptr = mem[cond_ptr].hh.v.RH;
2045 free_node(temp_ptr, 2);
2048 if (((history == 1) || (interaction < 3)))
2052 print_nl(" (see the transcript file for additional information)");
2058 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2059 if (is_initex) { /* bkph */
2060 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2061 /* *************************** new in 3.14159 ***************************** */
2063 register integer for_end;
2066 if (c <= for_end) do
2067 if (cur_mark[c]!= 0)
2068 delete_token_ref(cur_mark[c]);
2069 while(c++ < for_end);
2071 /* *********************************************************************** */
2072 /* 422. Amendment to bugfix 414 (reported by David Fuchs, September 2007) */
2073 if (last_glue != max_halfword) delete_glue_ref(last_glue);
2074 store_fmt_file(); // returns a value ?
2077 if (!is_initex) /* 2000/March/3 */
2078 print_nl(" (\\dump is performed only by INITEX)"); /* */
2082 // debugging code for checking the string pool
2084 int checkpool (char *task)
2086 int c, i, k, n, st, flag, bad=0;
2089 sprintf(log_line, "Check on string pool start (%s)\n", task);
2090 show_line(log_line, 0);
2092 for (k = 0; k < 32; k++) {
2093 if (str_start[k] != 3 * k) {
2094 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2095 show_line(log_line, 0);
2098 for (k = 32; k < 128; k++) {
2099 if (str_start[k] != 96 + (k - 32)) {
2100 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2101 show_line(log_line, 0);
2104 for (k = 128; k < 256; k++) {
2105 if (str_start[k] != 194 + 4 * (k - 128)){
2106 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2107 show_line(log_line, 0);
2111 sprintf(log_line, "Check on string pool (%s)\n", task);
2112 show_line(log_line, 0);
2114 for (k = 0; k < str_ptr; k++) {
2115 if (str_start[k+1] == 0) break;
2120 for (i = 0; i < n; i++) {
2121 if (str_pool[st + i] == 0) {
2124 if (str_pool[st + i] > 255) {
2130 sprintf(log_line, "BAD %d (start at %d): ", k, st);
2131 show_line(log_line, 0);
2133 for (i = 0; i < n; i++) {
2134 c = str_pool[st + i];
2136 sprintf(s, "%d ", c);
2155 show_line(log_line, stdout);
2158 sprintf(log_line, "end of check (%s)\n", bad ? "BAD" : "OK");
2159 show_line(log_line, 0);
2161 if (task == NULL) return bad;
2165 } /* DEBUGGING ONLY */
2168 void show_frozen (void)
2171 fprintf(log_file, "\n");
2172 fprintf(log_file, "(%d fonts frozen in format file:\n", font_ptr);
2173 /* ignore font 0 which is nullfont */
2174 /* for (i = 1; i < font_ptr+1; i++) */
2175 for (i = 1; i <= font_ptr; i++) {
2176 if (i > 1) fprintf(log_file, ", ");
2177 if ((i % 8) == 0) fprintf(log_file, "\n");
2178 n = str_start[font_name[i]+1]-str_start[font_name[i]];
2179 for (j = 0; j < n; j++) {
2180 putc(str_pool[str_start[font_name[i]]+j], log_file);
2181 /* str_pool[str_start[font_name[i]]+j] = '?'; */
2184 fprintf(log_file, ") ");
2187 /* Main entry point called from texmf.c int main(int ac, char *av[]) */
2188 /* call from main_program in texmf.c */
2189 /* This in turn calls initialize() */
2191 #pragma warning(disable:4127) // conditional expression is constant
2193 /* void texbody() */
2194 int texbody (void) /* now returns a value --- bkph */
2198 set_paths(TEXFORMATPATHBIT + TEXINPUTPATHBIT + TEXPOOLPATHBIT + TFMFILEPATHBIT);
2200 if (ready_already == 314159L) goto lab1; /* magic number */
2201 /* These tests are almost all compile time tests and so could be eliminated */
2203 if ((half_error_line < 30) || (half_error_line > error_line - 15)) bad = 1;
2204 if (max_print_line < 60) bad = 2;
2205 if (dvi_buf_size % 8 != 0) bad = 3;
2206 if (1100 > mem_top)bad = 4; /* not compile time */
2207 /* if (hash_prime > hash_size) */
2208 if (hash_prime > (hash_size + hash_extra)) bad = 5;
2209 if (max_in_open >= 128)bad = 6; /* p.14 */
2210 if (mem_top < 267)bad = 7; /* where from ? *//* not compile time */
2213 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2214 if (is_initex) { /* bkph */
2215 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2216 if ((mem_min != 0)||(mem_max != mem_top)) bad = 10;
2219 /* if ((mem_min > 0)||(mem_max < mem_top)) */
2220 if ((mem_min > mem_bot)||(mem_max < mem_top)) bad = 10;
2221 /* if ((0 > 0)||(255 < 127)) */
2222 if ((min_quarterword > 0)||(max_quarterword < 255)) bad = 11;
2223 /* if ((0 > 0)||(262143L < 32767)) */
2224 if ((min_halfword > 0)||(max_halfword < 32767)) bad = 12;
2225 /* if ((0 < 0)||(255 > 262143L)) */
2226 if ((min_quarterword < min_halfword)||(max_quarterword > max_halfword))
2228 /* if ((mem_min < 0)||(mem_max >= 262143L)||(-0 - mem_min > 262144L)) */
2229 if ((mem_min < min_halfword)||(mem_max >= max_halfword)||(mem_bot - mem_min >= max_halfword))
2231 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2232 if (mem_max > mem_top + mem_extra_high) /* not compile time */
2233 bad = 14; /* ha ha */
2234 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2235 /* if ((0 < 0)||(font_max > 255)) */
2236 if ((0 < min_quarterword)||(font_max > max_quarterword)) /* 93/Dec/3 */
2238 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2239 #ifdef INCREASEFONTS
2240 /* if (font_max > 512)*/ /* 93/Dec/3 */
2241 if (font_max > 1024) /* 96/Jan/17 */
2243 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2247 /* if ((save_size > 262143L)||(max_strings > 262143L)) */
2248 if ((save_size > max_halfword)||(max_strings > max_halfword))
2250 /* if (buf_size > 262143L)*/
2251 if (buf_size > max_halfword)bad = 18;
2252 /* if (255 < 255) */
2253 if (max_quarterword - min_quarterword < 255) bad = 19;
2254 /* if cs_token_flag + undefined_control_sequence > max_halfword then bad <- 21;*/
2255 /* if ((hash_size + 4876) > 262143L)*/
2256 /* if ((hash_size + 4876) > max_halfword) */
2257 if ((hash_size + 4095 + 781) > max_halfword) bad = 21;
2258 if (format_default_length > PATHMAX) bad = 31;
2259 /* if (2 * 262143L < mem_top - mem_min) */
2260 if (max_halfword < (mem_top - mem_min) / 2) bad = 41;
2262 sprintf(log_line, "%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
2263 "---case ", (long) bad);
2264 show_line(log_line, 1);
2266 bad_formator_pool(format_file, "the format file", "TEXFORMATS"); /* 96/Jan/17 */
2267 goto lab9999; // abort
2272 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2274 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2275 if (!get_strings_started ())
2276 goto lab9999; // abort
2278 init_str_ptr = str_ptr;
2279 init_pool_ptr = pool_ptr;
2280 dateandtime(tex_time, day, month, year);
2283 ready_already = 314159L; /* magic number */
2285 lab1: /* get here directly if ready_already already set ... */
2290 show_line(tex_version, 0);
2291 sprintf(log_line, " (%s %s)", application, yandyversion);
2292 show_line(log_line, 0);
2293 if (format_ident > 0)slow_print(format_ident);
2299 name_in_progress = false;
2301 output_file_name = 0;
2307 high_in_open = 0; /* max_in_open name already used 1999 Jan 17 */
2309 max_open_parens = 0; /* max_open_parens */
2312 max_param_stack = 0;
2313 #ifdef ALLOCATEBUFFER
2314 /* first = current_buf_size; */
2315 memset (buffer, 0, current_buf_size); /* redundant */
2317 /* first = buf_size; */
2318 memset (buffer, 0, buf_size); /* redundant ? */
2323 } while(!(first == 0)); */
2324 first = 0; /* 1999/Jan/22 */
2327 warning_index = 0; /* warning_index:=null; l.7068 */
2329 cur_input.state_field = 33;
2330 cur_input.start_field = 1;
2331 cur_input.index_field = 0;
2333 cur_input.name_field = 0;
2335 align_state = 1000000L;
2336 if (!init_terminal ())
2337 goto lab9999; // abort
2338 cur_input.limit_field = last;
2341 /* if ((format_ident == 0)||(buffer[cur_input.loc_field]== 38)) */
2342 /* For Windows NT, lets allow + instead of & for format specification */
2343 if ((format_ident == 0) ||
2344 (buffer[cur_input.loc_field] == '&') ||
2345 (buffer[cur_input.loc_field] == '+'))
2347 if (format_ident != 0)
2349 if (!open_fmt_file ())
2350 goto lab9999; // abort
2351 if (!load_fmt_file ())
2354 goto lab9999; // abort
2357 while((cur_input.loc_field < cur_input.limit_field) &&
2358 (buffer[cur_input.loc_field] == 32))
2359 incr(cur_input.loc_field);
2362 if (debug_flag) check_eqtb("after format"); /* debugging 94/Apr/5 */
2364 if ((end_line_char < 0) || (end_line_char > 255))
2365 decr(cur_input.limit_field);
2367 buffer[cur_input.limit_field] = end_line_char;
2368 dateandtime(tex_time, day, month, year);
2369 magic_offset = str_start[886]- 9 * 16; /* following: */
2370 /* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
2371 if (interaction == 0)
2375 if ((cur_input.loc_field < cur_input.limit_field) &&
2376 (eqtb[(hash_size + 1883) + buffer[cur_input.loc_field]].hh.v.RH != 0))
2380 /* show font TFMs frozen into format file */
2381 /* moved here after start_input to ensure the log file is open */
2382 if (show_tfm_flag && log_opened && font_ptr > 0) /* 98/Sep/28 */
2386 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2387 main_time = clock();
2388 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2392 print_cs_names(stdout, 0); /* 98/Mar/31 */
2394 main_control(); /* read-eval-print loop :-) in tex8.c */
2396 // what if abort_flag is set now ?
2399 print_cs_names(stdout, 1); /* 98/Mar/31 */
2401 // what if abort_flag is set now ?
2405 // if (abort_flag) return -1;
2407 close_files_and_terminate();
2416 if ((history != 0) && (history != 1))
2419 // now return instead of exit to allow cleanup in local.c
2423 } /* end of texbody */
2426 /* add a block of variable size node space below mem_bot */
2427 /* used in tex0.c, local.c, itex.c */
2428 void add_variable_space(int size)
2435 t = mem_min; /* bottom of present block */
2439 mem_min = t - (size + 1); /* first word in new block - 1 */
2440 /* mem_min = mem_start; */ /* allocate all of it at once */
2441 if (mem_min < mem_start) /* sanity test */
2444 show_line("WARNING: mem_min < mem_start!\n", 0);
2445 mem_min = mem_start;
2447 p = mem[rover + 1].hh.v.LH;
2449 mem[mem_min].hh.v.RH = 0; /* insert blank word below ??? */
2450 mem[mem_min].hh.v.LH = 0; /* insert blank word below ??? */
2451 mem[p + 1].hh.v.RH = q;
2452 mem[rover + 1].hh.v.LH = q;
2453 mem[q + 1].hh.v.RH = rover;
2454 mem[q + 1].hh.v.LH = p;
2455 mem[q].hh.v.RH = empty_flag;
2456 mem[q].hh.v.LH = t - q; /* block size */
2461 /*************************************************************************/
2462 /* All ini TeX code is here at end so can use same pragma optimize for it */
2463 /* Ini-TeX code is rarely needed/used so make it small rather than fast */
2465 #pragma optimize("t", off)
2466 #pragma optimize("s", on)
2469 /* split out to allow sharing of code from do_initex and newpattern */
2470 void reset_trie (void)
2473 for (k = - (integer) trie_op_size; k <= trie_op_size; k++)
2474 trie_op_hash[k] = 0;
2475 for (k = 0; k <= 255; k++)
2476 trie_used[k] = min_trie_op;
2477 max_op_used = min_trie_op;
2479 trie_not_ready = true;
2483 trie_not_ready = true;
2485 /* borrowed code from initialize() */
2486 void reset_hyphen (void)
2490 for (z = 0; z <= hyphen_prime; z++)
2493 hyph_list[z] = 0; /* hyph_list[z]:=null; l.18131 */
2497 /* split out to allow optimize for space, not time */
2498 void do_initex (void)
2502 /* hyph_pointer z; */
2505 for (k = mem_bot + 1; k <= lo_mem_stat_max; k++)
2508 while(k <= lo_mem_stat_max)
2510 glue_ref_count(k) = 1;
2511 stretch_order(k) = normal;
2512 shrink_order(k) = normal;
2513 k = k + glue_spec_size;
2515 stretch(fil_glue) = 65535L;
2516 stretch_order(fil_glue) = fil;
2517 stretch(fill_glue) = 65535L;
2518 stretch_order(fill_glue) = fill;
2519 stretch(ss_glue) = 65535L;
2520 stretch_order(ss_glue) = fil;
2521 shrink(ss_glue) = 65535L;
2522 shrink_order(ss_glue) = fil;
2523 stretch(fil_neg_glue) = -65536L;
2524 stretch_order(fil_neg_glue) = fil;
2525 rover = lo_mem_stat_max + 1;
2526 link(rover) = empty_flag;
2527 node_size(rover) = block_size;
2528 llink(rover) = rover;
2529 rlink(rover) = rover;
2530 lo_mem_max = rover + block_size;
2531 link(lo_mem_max) = 0;
2532 info(lo_mem_max) = 0;
2533 for (k = hi_mem_stat_min; k <= mem_top; k++)
2534 mem[k] = mem[lo_mem_max];
2535 info(omit_template) = end_template_token;
2536 link(end_span) = max_quarterword + 1;
2538 type(last_active) = hyphenated;
2539 line_number(last_active) = max_halfword;
2540 subtype(last_active) = 0;
2541 subtype(page_ins_head) = 255;
2542 type(page_ins_head) = split_up;
2543 link(mem_top) = page_ins_head;
2544 type(page_head) = glue_node;
2545 subtype(page_head) = normal;
2546 avail = 0; /* avail <- null p.164 */
2547 mem_end = mem_top; /* mem_end <- mem_top */
2548 hi_mem_min = hi_mem_stat_min;
2549 var_used = 20; /* var_used <- lo_mem_stat_max */
2550 dyn_used = 14; /* dyn_used <- hi_mem_stat_usage */
2551 eq_type(undefined_control_sequence) = undefined_cs;
2552 equiv(undefined_control_sequence) = 0;
2553 eq_level(undefined_control_sequence) = level_zero;
2554 for (k = active_base; k <= undefined_control_sequence - 1; k++)
2555 eqtb[k]= eqtb[undefined_control_sequence];
2556 eqtb[(hash_size + 782)].hh.v.RH = 0; /* glue_base (hash_size + 782) */
2557 eq_level(glue_base) = level_one;
2558 eqtb[(hash_size + 782)].hh.b0 = 117;
2559 for (k = glue_base + 1; k <= local_base - 1; k++) eqtb[k]= eqtb[glue_base];
2560 /* glue_ref_count(zero_glue):=glue_ref_count(zero_glue)+local_base-glue_base; */
2561 /* local_base - glue_base = 530 = 17 glue_pars + 256 skip + 256 mu_skip */
2562 mem[0].hh.v.RH = mem[0].hh.v.RH + 530; /* mem[mem_bot]? */
2563 /* box(0):=null; eq_type(box_base):=box_ref; eq_level(box_base):=level_one; */
2564 eqtb[(hash_size + 1312)].hh.v.RH = 0;
2565 eqtb[(hash_size + 1312)].hh.b0 = 118;
2566 eqtb[(hash_size + 1312)].hh.b1 = 1;
2567 for (k = output_routine_loc; k <= toks_base + 255; k++) eqtb[k]= eqtb[undefined_control_sequence];
2568 eqtb[(hash_size + 1578)].hh.v.RH = 0;
2569 eqtb[(hash_size + 1578)].hh.b0 = 119;
2570 eqtb[(hash_size + 1578)].hh.b1 = 1;
2571 for (k = box_base + 1; k <= box_base + 255; k++) eqtb[k]= eqtb[box_base];
2572 eqtb[(hash_size + 1834)].hh.v.RH = 0;
2573 eqtb[(hash_size + 1834)].hh.b0 = 120;
2574 eqtb[(hash_size + 1834)].hh.b1 = 1;
2575 for (k = math_font_base; k <= math_font_base + 47; k++) eqtb[k]= eqtb[cur_font_loc];
2576 eqtb[(hash_size + 1883)].hh.v.RH = 0;
2577 eqtb[(hash_size + 1883)].hh.b0 = 120;
2578 eqtb[(hash_size + 1883)].hh.b1 = 1;
2579 for (k = cat_code_base; k <= int_base - 1; k++) eqtb[k]= eqtb[cat_code_base];
2580 for (k = 0; k <= 255; k++) {
2581 eqtb[(hash_size + 1883) + k].hh.v.RH = 12;
2582 eqtb[(hash_size + 2907) + k].hh.v.RH = k;
2583 eqtb[(hash_size + 2651) + k].hh.v.RH = 1000;
2585 /* cat_base == 11383 */
2586 eqtb[(hash_size + 1896)].hh.v.RH = car_ret;
2587 eqtb[(hash_size + 1915)].hh.v.RH = spacer;
2588 eqtb[(hash_size + 1975)].hh.v.RH = escape;
2589 eqtb[(hash_size + 1920)].hh.v.RH = comment;
2590 eqtb[(hash_size + 2010)].hh.v.RH = invalid_char;
2591 eqtb[(hash_size + 1883)].hh.v.RH = ignore;
2592 /* for k:="0" to "9" do math_code(k):=hi(k+var_code); */
2593 for (k = '0'; k <= '9'; k++) eqtb[(hash_size + 2907) + k].hh.v.RH = k + 28672;
2594 /* cat_code of uppercase and lowercase letters ... */
2595 for (k = 'A'; k <= 'Z'; k++)
2598 eqtb[(hash_size + 1883) + k].hh.v.RH = 11;
2599 eqtb[(hash_size + 1883) + k + 32].hh.v.RH = 11;
2600 /* mathcode(k) = hi(k + var_code + "100); */ /* '70000 + 256 */
2601 eqtb[(hash_size + 2907) + k].hh.v.RH = k + 28928; /* '70000 + 256 */
2602 /* mathcode(k + "a" - "A") = hi(k + "a" - "A" + var_code + "100); */
2603 eqtb[(hash_size + 2907) + k + 32].hh.v.RH = k + 28960; /* '70000 + 256 + 32 */
2605 eqtb[(hash_size + 2139) + k].hh.v.RH = k + 32;
2606 eqtb[(hash_size + 2139) + k + 32].hh.v.RH = k + 32;
2608 eqtb[(hash_size + 2395) + k].hh.v.RH = k;
2609 eqtb[(hash_size + 2395) + k + 32].hh.v.RH = k;
2611 eqtb[(hash_size + 2651) + k].hh.v.RH = 999;
2613 for (k = int_base; k <= del_code_base - 1; k++) eqtb[k].cint = 0;
2617 max_dead_cycles = 25;
2620 for (k = 0; k <= 255; k++)
2621 eqtb[(hash_size + 3474) + k].cint = -1;
2622 eqtb[(hash_size + 3520)].cint = 0;
2623 for (k = dimen_base; k <= eqtb_size; k++)
2625 /* hash_used = 10014; */ /* hash_used = frozen_control_sequence */
2626 /* frozen_control_sequence = hashsize + hashbase p.222 */
2627 /* hash_used = (hash_size + 514); */
2628 hash_used = (hash_size + hash_extra + 514); /* 96/Jan/10 */
2630 if (trace_flag) show_line("itex cs_count = 0 ", 0); /* debugging */
2631 /* eq_type(frozen_dont_expand) <- dont_expand; */
2632 /* eqtb[10023].hh.b0 = 116; */
2633 /* eqtb[(hash_size + 523)].hh.b0 = 116; */
2634 eqtb[(hash_size + hash_extra + 523)].hh.b0 = dont_expand;
2635 /* hash[(hash_size + 523)].v.RH = 499; */
2636 hash[(hash_size + hash_extra + 523)].v.RH = 499; /* notexpanded */
2637 /* @<Initialize table...@>= l.10750 */
2638 font_ptr = 0; /* font_ptr:=null_font; */
2639 fmem_ptr = 7; /* fmem_ptr:=7; */
2640 font_name[0] = 795; /* nullfont */
2641 font_area[0] = 335; /* "" */
2642 hyphen_char[0] = 45; /* - */
2644 /* ************************************************************************ */
2645 /* bchar_label[null_font]:=non_address; */ /* 3.14159 */
2646 /* bchar_label[0]= font_mem_size; */ /* OK ? 93/Nov/26 */
2647 bchar_label[0]= non_address; /* i.e. 0 --- 96/Jan/16 */
2648 /* ************************************************************************ */
2649 font_bchar[0] = 256; /* font_bchar[null_font]:=non_char; */
2650 font_false_bchar[0] = 256; /* font_false_bchar[null_font]:=non_char; */
2660 lig_kern_base[0] = 0;
2666 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2667 reset_trie(); /* shared 93/Nov/26 */
2668 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2669 /* {register integer for_end; k = 0; for_end = 6; if (k <= for_end) do
2670 font_info[k].cint = 0;
2671 while(k++ < for_end); }
2672 {register integer for_end; k = - (integer) trie_op_size; for_end =
2673 trie_op_size; if (k <= for_end) do
2675 while(k++ < for_end); }
2676 {register integer for_end; k = 0; for_end = 255; if (k <= for_end) do
2677 trie_used[k]= min_trie_op;
2678 while(k++ < for_end); }
2679 max_op_used = min_trie_op;
2681 trie_not_ready = true;
2685 /* text(frozen_protection):="inaccessible"; */
2686 /* hash[10014].v.RH = 1183; */
2687 /* hash[(hash_size + 514)].v.RH = 1184; */
2688 hash[(hash_size + hash_extra + 514)].v.RH = 1184; /* 1183 */
2689 format_ident = 1251; /* 1250 */
2690 /* hash[(hash_size + 522)].v.RH = 1290; */ /* 1288 */
2691 hash[(hash_size + hash_extra + 522)].v.RH = 1290; /* 1288 */
2692 /* eqtb[(hash_size + 522)].hh.b1 = 1; */
2693 eqtb[(hash_size + hash_extra + 522)].hh.b1 = 1;
2694 /* eqtb[(hash_size + 522)].hh.b0 = 113; */
2695 eqtb[(hash_size + hash_extra + 522)].hh.b0 = 113;
2696 /* eqtb[(hash_size + 522)].hh.v.RH = 0; */
2697 eqtb[(hash_size + hash_extra + 522)].hh.v.RH = 0;
2702 /* starts string pool with strings for 256 chars and then reads tex.pool */
2703 /* adjusted to try both "tex.pool" and "tex.poo" 95/Feb/19 */
2704 /* I have added a texpool file, but I need merge the pool to the binary */
2705 /* lots of things updates the kpathsea sources -- Clerk Ma */
2706 bool get_strings_started (void)
2708 register bool Result;
2714 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2715 int flag; /* 95/Feb/19 */
2716 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2721 register integer for_end;
2726 if (((k < 32) || (k > 126))) {
2730 append_char(k + 64);
2732 append_char(k - 64);
2736 str_pool[pool_ptr] = l + 48; /* '0' */
2739 str_pool[pool_ptr] = l + 87; /* 'a' - 10 */
2744 str_pool[pool_ptr] = l + 48; /* '0' */
2747 str_pool[pool_ptr] = l + 87; /* 'a' - 10 */
2751 } else append_char(k);
2753 } while(k++ < for_end);
2755 vstrcpy((char *) name_of_file + 1, pool_name);
2756 name_of_file[0] = ' ';
2757 name_of_file[strlen(pool_name) + 1] = ' ';
2758 name_length = strlen(pool_name);
2759 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2760 /* if (a_open_in(pool_file, TEXPOOLPATH)) */
2761 flag = a_open_in(pool_file, TEXPOOLPATH);
2762 if (flag == 0) /* 95/Feb/19 */
2764 pool_name [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */
2765 vstrcpy((char *) name_of_file + 1, pool_name);
2766 name_of_file[0]= ' ';
2767 name_of_file[strlen(pool_name) + 1]= ' ';
2768 name_length = strlen(pool_name);
2769 flag = a_open_in(pool_file, TEXPOOLPATH);
2775 /* if (eof(pool_file)) */ /* feof(pool_file)??? */
2776 if (test_eof(pool_file)) {
2778 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2779 show_line("! string pool file has no check sum.\n", 1);
2780 /* added following bit of explanation 96/Jan/16 */
2782 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2783 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2784 (void) a_close(pool_file);
2790 if (m == '*') /* last line starts with * */
2795 if ((xord[n]< 48)||(xord[n]> 57)) {
2797 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2798 show_line("! string pool file check sum doesn't have nine digits.\n", 1);
2799 /* added following bit of explanation 96/Jan/16 */
2801 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2802 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2803 (void) a_close(pool_file);
2807 a = 10 * a + xord[n]- 48;
2813 /* tex.pool file check sum *367403084 */
2815 if (a != BEGINFMTCHECKSUM) {
2817 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2818 show_line("! string pool check sum doesn't match; tangle me again.\n", 1);
2819 /* added following bit of explanation 96/Jan/16 */
2821 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2822 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2823 (void) a_close(pool_file);
2829 if ((xord[m] < 48)||(xord[m] > 57)||(xord[n] < 48)||(xord[n] > 57))
2832 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2833 show_line("! string pool line doesn't begin with two digits.\n", 1);
2834 /* added following bit of explanation 96/Jan/16 */
2836 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2837 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2838 (void) a_close(pool_file);
2842 l = xord[m]* 10 + xord[n]- 48 * 11;
2843 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2844 #ifdef ALLOCATESTRING
2845 /* can freely extend memory, so we need not be paranoid - stringvacancies */
2846 /* if (pool_ptr + l + stringvacancies > current_pool_size)*/
2847 if (pool_ptr + l + stringmargin > current_pool_size) {
2849 show_line("String margin reallocation\n", 0);
2850 /* str_pool = realloc_str_pool (pool_ptr + l + stringvacancies */
2851 str_pool = realloc_str_pool (pool_ptr + l + stringmargin - current_pool_size + increment_pool_size);
2853 if (pool_ptr + l + stringmargin > current_pool_size) /* 94/Jan/24 */
2855 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2856 if (pool_ptr + l + stringvacancies > pool_size)
2860 show_line("! You have to increase POOLSIZE.\n", 1);
2861 (void) a_close(pool_file);
2866 register integer for_end;
2871 if (eoln(pool_file))
2873 else read(pool_file, m);
2875 str_pool[pool_ptr] = xord[m];
2878 } while(k++ < for_end);
2880 readln(pool_file); /* flush rest to end of file / end of line */
2885 (void) a_close(pool_file);
2889 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2890 sprintf(log_line, "! I can't read %s.\n", pool_name);
2891 show_line(log_line, 1);
2893 show_line(" (Was unable to find tex.poo or tex.pool)\n", 0); /* extra explain */
2894 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2903 void sort_avail (void)
2907 p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */
2909 rlink(rover) = empty_flag;
2911 while (p != old_rover)
2919 while (rlink(q) < p)
2922 rlink(p) = rlink(q);
2927 while (rlink(p) != empty_flag) {
2928 llink(rlink(p)) = p;
2931 mem[p + 1].hh.v.RH = rover;
2937 /*****************APTEX********************/
2939 str_number make_string_pool (char *s)
2941 while (*s != '\0') {
2942 append_char(*s); incr(s);
2944 return (make_string());
2946 void primitive_s (char * s, quarterword c, halfword o)
2950 str_number prim_str;
2952 cur_val = s[0] + single_base;
2954 prim_str = make_string_pool(s);
2955 k = str_start[prim_str]; l = str_start[prim_str] - k;
2956 for (j = 0; j < l; incr(j)) buffer[j] = str_pool[k + j];
2957 cur_val = id_lookup(0, l);
2959 hash[cur_val].v.RH = prim_str;
2961 eq_level(cur_val) = level_one; eq_type(cur_val) = c; equiv(cur_val) = o;
2964 /*****************APTEX********************/
2965 void primitive_ (str_number s, quarterword c, halfword o)
2969 /* small_number l; */
2970 int l; /* 95/Jan/7 */
2972 cur_val = s + 257; /* cur_val <- s + single_base; p.264 */
2975 l = str_start[s + 1] - k; /* small_number l */
2977 register integer for_end;
2981 do buffer[j]= str_pool[k + j];
2982 while(j++ < for_end);
2984 cur_val = id_lookup(0, l);
2986 /* ********************** debugging only 96/Jan/20 should not happen */
2989 show_line("ERROR: hash entry too large\n", 1);
2991 hash[cur_val].v.RH = s;
2993 eqtb[cur_val].hh.b1 = 1;
2994 eqtb[cur_val].hh.b0 = c;
2995 eqtb[cur_val].hh.v.RH = o;
2999 /* more weird constants ? page 394 */
3002 trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
3004 register trie_op_code Result;
3008 /* the 313, 361 and 1009 are hard-wired constants here p.944 */
3009 /* begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) */
3010 h = abs(toint(n) + 313 * toint(d) + 361 * toint(v) + 1009 *
3011 toint(cur_lang)) % (trie_op_size - neg_trie_op_size) + neg_trie_op_size;
3013 /* if l=0 then {empty position found for a new op} */
3014 l = trie_op_hash[h];
3016 if (trie_op_ptr == trie_op_size) {
3017 overflow("pattern memory ops", trie_op_size); /* pattern memory ops - NOT DYNAMIC */
3018 return 0; // abort_flag set
3020 u = trie_used[cur_lang];
3021 /* if u=max_quarterword then ??? */
3022 if (u == max_trie_op) {
3023 /* overflow("pattern memory ops per language", max_quarterword-min_quarterword); ??? */
3024 overflow("pattern memory ops per language", max_trie_op - min_trie_op); /* pattern memory ops per language */
3025 return 0; // abort_flag set
3029 trie_used[cur_lang] = u;
3030 if (u > max_op_used)
3032 hyf_distance[trie_op_ptr] = d;
3033 hyf_num[trie_op_ptr] = n;
3034 hyf_next[trie_op_ptr] = v;
3035 trie_op_lang[trie_op_ptr] = cur_lang;
3036 trie_op_hash[h] = trie_op_ptr;
3037 trie_op_val[trie_op_ptr] = u;
3041 if ((hyf_distance[l]== d) && (hyf_num[l]== n) &&
3042 (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang)) {
3043 Result = trie_op_val[l];
3046 if (h > - (integer) trie_op_size)
3048 else h = trie_op_size;
3050 /* return Result; */ /* unreachable code */
3052 /* what are those horrible constants there ? page 395 */
3053 trie_pointer trie_node_ (trie_pointer p)
3055 register trie_pointer Result;
3058 /* the 1009, 2718, 3142 are hard-wired constants here (not hyphen_prime) */
3059 h = abs(toint(trie_c[p]) + 1009 * toint(trie_o[p]) + 2718 *
3060 toint(trie_l[p]) + 3142 * toint(trie_r[p])) % trie_size;
3068 if ((trie_c[q] == trie_c[p]) && (trie_o[q] == trie_o[p]) &&
3069 (trie_l[q]== trie_l[p]) && (trie_r[q]== trie_r[p])) {
3077 /* return Result; */ /* unreachable code */
3079 trie_pointer compress_trie_ (trie_pointer p)
3081 register trie_pointer Result;
3085 trie_l[p] = compress_trie(trie_l[p]);
3086 trie_r[p] = compress_trie(trie_r[p]);
3087 Result = trie_node(p);
3091 void first_fit_ (trie_pointer p)
3103 if (trie_max < h + 256) {
3104 if (trie_size <= h + 256) {
3105 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3106 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3107 return; // abort_flag set
3111 trie_taken[trie_max]= false;
3112 trie_trl[trie_max]= trie_max + 1;
3113 trie_tro[trie_max]= trie_max - 1;
3114 } while (!(trie_max == h + 256));
3120 if (trie_trl[h + trie_c[q]] == 0)
3129 trie_taken[h] = true; /* h may be used without ... */
3141 ll = z; /* short ll */
3147 } while (!(l == ll));
3150 } while (!(q == 0));
3152 void trie_pack_ (trie_pointer p)
3157 if ((q > 0)&&(trie_hash[q]== 0))
3165 void trie_fix_ (trie_pointer p)
3174 trie_trl[z + c]= trie_hash[q];
3176 trie_tro[z + c]= trie_o[p];
3182 void new_patterns (void)
3184 /* ******************************************************************* */
3185 /* was small_number k, l; in 3.141 */
3187 /* ******************************************************************* */
3193 int c; /* 95/Jan/7 */
3194 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3195 if (!trie_not_ready)
3200 show_line("Resetting patterns\n", 0);
3201 reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
3202 if (reset_exceptions)
3205 show_line("Resetting exceptions\n", 0);
3206 reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
3210 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3211 if (trie_not_ready) {
3214 else if (language > 255)
3216 else cur_lang = language;
3220 digitsensed = false;
3226 if (digitsensed || (cur_chr < 48) || (cur_chr > 57)) {
3230 cur_chr = eqtb[(hash_size + 2139) + cur_chr].hh.v.RH;
3232 print_err("Nonletter");
3233 help1("(See Appendix H.)");
3241 digitsensed = false;
3243 } else if (k < 63) {
3244 hyf[k] = cur_chr - 48;
3260 v = new_trie_op(k - l, hyf[l], v);
3274 while ((p > 0) && (c > trie_c[p])) {
3279 if ((p == 0) || (c < trie_c[p])) {
3280 if (trie_ptr == trie_size) {
3281 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3282 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3283 return; // abort_flag set
3286 trie_r[trie_ptr] = p;
3293 trie_o[p] = min_trie_op;
3297 if (trie_o[q]!= min_trie_op) {
3298 print_err("Duplicate pattern");
3299 help1("(See Appendix H.)");
3308 digitsensed = false;
3314 print_esc("patterns");
3315 help1("(See Appendix H.)");
3323 print_err("Too late for ");
3324 print_esc("patterns");
3325 help1("All patterns must be given before typesetting begins.");
3327 mem[lig_trick].hh.v.RH = scan_toks(false, false);
3328 flush_list(def_ref);
3331 void init_trie (void)
3334 /* integer j, k, t; */
3336 int t; /* 95/Jan/7 */
3338 op_start[0]= - (integer) min_trie_op;
3340 register integer for_end;
3343 if (j <= for_end) do
3344 op_start[j]= op_start[j - 1]+ trie_used[j - 1];
3345 while(j++ < for_end);
3348 register integer for_end;
3350 for_end = trie_op_ptr;
3353 trie_op_hash[j]= op_start[trie_op_lang[j]] + trie_op_val[j];
3354 while(j++ < for_end);
3357 register integer for_end;
3359 for_end = trie_op_ptr;
3362 while(trie_op_hash[j]> j){
3363 k = trie_op_hash[j];
3364 t = hyf_distance[k];
3365 hyf_distance[k]= hyf_distance[j];
3368 hyf_num[k]= hyf_num[j];
3371 hyf_next[k]= hyf_next[j];
3373 trie_op_hash[j]= trie_op_hash[k];
3376 while(j++ < for_end);
3379 register integer for_end;
3381 for_end = trie_size;
3384 while(p++ < for_end);
3386 trie_l[0]= compress_trie(trie_l[0]);
3388 register integer for_end;
3393 while(p++ < for_end);
3396 register integer for_end;
3399 if (p <= for_end) do
3401 while(p++ < for_end);
3407 first_fit(trie_l[0]);
3408 trie_pack(trie_l[0]);
3413 register integer for_end;
3416 if (r <= for_end) do
3419 trie_tro[r]= min_trie_op;
3422 while(r++ < for_end);
3427 trie_fix(trie_l[0]);
3433 trie_tro[r]= min_trie_op;
3437 } while(!(r > trie_max));
3440 trie_not_ready = false;
3445 void store_fmt_file (void)
3450 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3451 if (!is_initex) { /* redundant check 94/Feb/14 */
3452 show_line("! \\dump is performed only by INITEX\n", 1);
3454 show_line(" (Use -i on the command line)\n", 0);
3458 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3459 if (save_ptr != 0) {
3460 print_err("You can't dump inside a group");
3461 help1("`{...\\dump}' is a no-no..");
3463 } /* end of if save_ptr != 0 */
3466 print_string(" (format=");
3475 if (interaction == 0) selector = 18;
3478 #ifdef ALLOCATESTRING
3479 if (pool_ptr + 1 > current_pool_size)
3480 str_pool = realloc_str_pool (increment_pool_size);
3481 if (pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */
3482 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */
3483 return; // abort_flag set
3486 if (pool_ptr + 1 > pool_size) {
3487 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
3488 return; // abort_flag set
3492 format_ident = make_string();
3493 pack_job_name(780); /* .fmt */
3494 while(! w_open_out(fmt_file)) {
3495 prompt_file_name(1267, 780); /* format file name .fmt */
3497 print_nl(" Beginning to dump on file ");
3498 slow_print(w_make_name_string(fmt_file));
3501 slow_print(format_ident);
3502 dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
3506 dump_int((hash_size + 4006)); /* eqtbsize */
3507 dump_int(hash_prime);
3508 /* dump_int(607); */
3509 dump_int(hyphen_prime); /* bkph */
3512 if (dumpthings(str_start[0], str_ptr + 1)) return;
3513 if (dumpthings(str_pool[0], pool_ptr)) return;
3516 print_string(" strings of total length ");
3517 print_int(pool_ptr);
3520 dump_int(lo_mem_max);
3526 if (dumpthings(mem[p], q + 2 - p))
3529 var_used = var_used + q - p;
3530 p = q + mem[q].hh.v.LH;
3531 q = mem[q + 1].hh.v.RH;
3532 } while (!(q == rover));
3533 var_used = var_used + lo_mem_max - p;
3534 dyn_used = mem_end + 1 - hi_mem_min;
3535 if (dumpthings(mem[p], lo_mem_max + 1 - p)) return;
3536 x = x + lo_mem_max + 1 - p;
3537 dump_int(hi_mem_min);
3539 if (dumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)) return;
3540 x = x + mem_end + 1 - hi_mem_min;
3550 print_string(" memory locations dumped; current usage is ");
3551 print_int(var_used);
3553 print_int(dyn_used);
3557 while(j < (hash_size + 3162)) {
3558 if ((eqtb[j].hh.v.RH == eqtb[j + 1].hh.v.RH) &&
3559 (eqtb[j].hh.b0 == eqtb[j + 1].hh.b0) &&
3560 (eqtb[j].hh.b1 == eqtb[j + 1].hh.b1))
3564 l = (hash_size + 3163);
3569 while (j < (hash_size + 3162)) {
3570 if ((eqtb[j].hh.v.RH != eqtb[j + 1].hh.v.RH) ||
3571 (eqtb[j].hh.b0 != eqtb[j + 1].hh.b0) ||
3572 (eqtb[j].hh.b1 != eqtb[j + 1].hh.b1))
3578 if (dumpthings(eqtb[k], l - k)) return;
3581 } while (!(k == (hash_size + 3163)));
3584 while (j < (hash_size + 4006)) {
3585 if (eqtb[j].cint == eqtb[j + 1].cint)
3589 l = (hash_size + 4007);
3594 while (j < (hash_size + 4006)) {
3595 if (eqtb[j].cint != eqtb[j + 1].cint)
3601 if (dumpthings(eqtb[k], l - k)) return;
3604 } while (!(k > (hash_size + 4006)));
3606 dump_int(write_loc);
3607 dump_int(hash_used);
3608 /* cs_count:=frozen_control_sequence-1-hash_used; */
3609 /* cs_count = (hash_size + 513) - hash_used; */
3610 cs_count = (hash_size + hash_extra + 513) - hash_used;
3611 /* cs_count = (hash_size + 780) - hash_used; */ /* ??? */
3613 sprintf(log_line, "itex cs_count %d hash_size %d hash_extra %d hash_used %d",
3614 cs_count, hash_size, hash_extra, hash_used); /* debugging */
3615 show_line(log_line, 0);
3617 /* for p <- hash_base to hash_used do */
3619 register integer for_end;
3621 for_end = hash_used;
3622 if (p <= for_end) do
3623 if (hash[p].v.RH != 0) {
3628 sprintf(log_line, "itex cs_count++ ");
3629 show_line(log_line, 0); /* debugging */
3631 } while (p++ < for_end);
3634 /* for p <- hash_used+1 to undefined_control_sequence-1 do dump_hh(hash[p]) */
3635 if (dumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)) return;
3638 print_int(cs_count);
3639 print_string(" multiletter control sequences");
3642 if (dumpthings(font_info[0], fmem_ptr)) return;
3643 /* frozenfontptr = font_ptr; */ /* number of fonts frozen into format */
3645 if (dumpthings(font_check[0], font_ptr + 1)) return;
3646 if (dumpthings(font_size[0], font_ptr + 1)) return;
3647 if (dumpthings(font_dsize[0], font_ptr + 1)) return;
3648 if (dumpthings(font_params[0], font_ptr + 1)) return;
3649 if (dumpthings(hyphen_char[0], font_ptr + 1)) return;
3650 if (dumpthings(skew_char[0], font_ptr + 1)) return;
3651 if (dumpthings(font_name[0], font_ptr + 1)) return;
3652 if (dumpthings(font_area[0], font_ptr + 1)) return;
3653 if (dumpthings(font_bc[0], font_ptr + 1)) return;
3654 if (dumpthings(font_ec[0], font_ptr + 1)) return;
3655 if (dumpthings(char_base[0], font_ptr + 1)) return;
3656 if (dumpthings(width_base[0], font_ptr + 1)) return;
3657 if (dumpthings(height_base[0], font_ptr + 1)) return;
3658 if (dumpthings(depth_base[0], font_ptr + 1)) return;
3659 if (dumpthings(italic_base[0], font_ptr + 1)) return;
3660 if (dumpthings(lig_kern_base[0], font_ptr + 1)) return;
3661 if (dumpthings(kern_base[0], font_ptr + 1)) return;
3662 if (dumpthings(exten_base[0], font_ptr + 1)) return;
3663 if (dumpthings(param_base[0], font_ptr + 1)) return;
3664 if (dumpthings(font_glue[0], font_ptr + 1)) return;
3665 if (dumpthings(bchar_label[0], font_ptr + 1)) return;
3666 if (dumpthings(font_bchar[0], font_ptr + 1)) return;
3667 if (dumpthings(font_false_bchar[0], font_ptr + 1)) return;
3669 register integer for_end;
3675 /* print_esc(hash[(hash_size + 524) + k].v.RH); */
3676 //print_esc(hash[(hash_size + hash_extra + 524) + k].v.RH);
3677 print_esc("");print(hash[(hash_size + hash_extra + 524) + k].v.RH);
3679 print_file_name(font_name[k], font_area[k], 335);
3680 if (font_size[k]!= font_dsize[k]) {
3681 print_string(" at ");
3682 print_scaled(font_size[k]);
3685 } while (k++ < for_end);
3689 print_int(fmem_ptr - 7);
3690 print_string(" words of font info for ");
3691 print_int(font_ptr - 0);
3692 print_string(" preloaded font");
3695 dump_int(hyph_count);
3696 /* {register integer for_end; k = 0; for_end = 607; if (k <= for_end) do */
3698 register integer for_end;
3700 for_end = hyphen_prime;
3701 if (k <= for_end) do
3702 if (hyph_word[k]!= 0)
3705 dump_int(hyph_word[k]);
3706 dump_int(hyph_list[k]);
3707 } while(k++ < for_end);
3710 print_int(hyph_count);
3711 print_string(" hyphenation exception");
3712 if (hyph_count != 1)
3717 if (dumpthings(trie_trl[0], trie_max + 1)) return;
3718 if (dumpthings(trie_tro[0], trie_max + 1)) return;
3719 if (dumpthings(trie_trc[0], trie_max + 1)) return;
3720 dump_int(trie_op_ptr);
3721 if (dumpthings(hyf_distance[1], trie_op_ptr)) return;
3722 if (dumpthings(hyf_num[1], trie_op_ptr)) return;
3723 if (dumpthings(hyf_next[1], trie_op_ptr)) return;
3724 print_nl("Hyphenation trie of length ");
3725 print_int(trie_max);
3726 print_string(" has ");
3727 print_int(trie_op_ptr);
3728 print_string(" op");
3729 if (trie_op_ptr != 1)
3731 print_string(" out of ");
3732 print_int(trie_op_size);
3734 register integer for_end;
3737 if (k >= for_end) do
3738 if (trie_used[k]> 0)
3741 print_int(trie_used[k]);
3742 print_string(" for language ");
3745 dump_int(trie_used[k]);
3746 } while(k-- > for_end);
3748 dump_int(interaction);
3749 dump_int(format_ident);
3750 dump_int(ENDFMTCHECKSUM); /* magic checksum end of FMT file --- change ??? */
3754 } /* end of store_fmt_file */
3758 void init_prim (void)
3760 no_new_control_sequence = false;
3761 //primitive_s("lineskip", assign_glue, glue_base + line_skip_code);
3762 primitive(373, assign_glue, glue_base + line_skip_code); /* lineskip */
3763 primitive(374, assign_glue, glue_base + baseline_skip_code); /* baselineskip */
3764 primitive(375, assign_glue, glue_base + par_skip_code); /* parskip */
3765 primitive(376, assign_glue, glue_base + above_display_skip_code); /* abovedisplayskip */
3766 primitive(377, assign_glue, glue_base + below_display_skip_code); /* belowdisplayskip */
3767 primitive(378, assign_glue, glue_base + above_display_short_skip_code); /* abovedisplayshortskip */
3768 primitive(379, assign_glue, glue_base + below_display_short_skip_code); /* belowdisplayshortskip */
3769 primitive(380, assign_glue, glue_base + left_skip_code); /* leftskip */
3770 primitive(381, assign_glue, glue_base + right_skip_code); /* rightskip */
3771 primitive(382, assign_glue, glue_base + top_skip_code); /* topskip */
3772 primitive(383, assign_glue, glue_base + split_top_skip_code); /* splittopskip */
3773 primitive(384, assign_glue, glue_base + tab_skip_code); /* tabskip */
3774 primitive(385, assign_glue, glue_base + space_skip_code); /* spaceskip */
3775 primitive(386, assign_glue, glue_base + xspace_skip_code); /* xspaceskip */
3776 primitive(387, assign_glue, glue_base + par_fill_skip_code); /* parfillskip */
3777 primitive(388, assign_mu_glue, glue_base + thin_mu_skip_code); /* thinmuskip */
3778 primitive(389, assign_mu_glue, glue_base + med_mu_skip_code); /* medmuskip */
3779 primitive(390, assign_mu_glue, glue_base + thick_mu_skip_code); /* thickmuskip */
3780 primitive(395, assign_toks, output_routine_loc); /* output */
3781 primitive(396, assign_toks, every_par_loc); /* everypar */
3782 primitive(397, assign_toks, every_math_loc); /* everymath */
3783 primitive(398, assign_toks, every_display_loc); /* everydisplay */
3784 primitive(399, assign_toks, every_hbox_loc); /* everyhbox */
3785 primitive(400, assign_toks, every_vbox_loc); /* everyvbox */
3786 primitive(401, assign_toks, every_job_loc); /* everyjob */
3787 primitive(402, assign_toks, every_cr_loc); /* everycr */
3788 primitive(403, assign_toks, err_help_loc); /* errhelp */
3789 primitive(417, assign_int, int_base + pretolerance_code); /* pretolerance */
3790 primitive(418, assign_int, int_base + tolerance_code); /* tolerance */
3791 primitive(419, assign_int, int_base + line_penalty_code); /* linepenalty */
3792 primitive(420, assign_int, int_base + hyphen_penalty_code); /* hyphenpenalty */
3793 primitive(421, assign_int, int_base + ex_hyphen_penalty_code); /* exhyphenpenalty */
3794 primitive(422, assign_int, int_base + club_penalty_code); /* clubpenalty */
3795 primitive(423, assign_int, int_base + widow_penalty_code); /* widowpenalty */
3796 primitive(424, assign_int, int_base + display_widow_penalty_code); /* displaywidowpenalty */
3797 primitive(425, assign_int, int_base + broken_penalty_code); /* brokenpenalty */
3798 primitive(426, assign_int, int_base + bin_op_penalty_code); /* binoppenalty */
3799 primitive(427, assign_int, int_base + rel_penalty_code); /* relpenalty */
3800 primitive(428, assign_int, int_base + pre_display_penalty_code); /* predisplaypenalty */
3801 primitive(429, assign_int, int_base + post_display_penalty_code); /* postdisplaypenalty */
3802 primitive(430, assign_int, int_base + inter_line_penalty_code); /* interlinepenalty */
3803 primitive(431, assign_int, int_base + double_hyphen_demerits_code); /* doublehyphendemerits */
3804 primitive(432, assign_int, int_base + final_hyphen_demerits_code); /* finalhyphendemerits */
3805 primitive(433, assign_int, int_base + adj_demerits_code); /* adjdemerits */
3806 primitive(434, assign_int, int_base + mag_code); /* mag */
3807 primitive(435, assign_int, int_base + delimiter_factor_code); /* delimiterfactor */
3808 primitive(436, assign_int, int_base + looseness_code); /* looseness */
3809 primitive(437, assign_int, int_base + time_code); /* time */
3810 primitive(438, assign_int, int_base + day_code); /* day */
3811 primitive(439, assign_int, int_base + month_code); /* month */
3812 primitive(440, assign_int, int_base + year_code); /* year */
3813 primitive(441, assign_int, int_base + show_box_breadth_code); /* showboxbreadth */
3814 primitive(442, assign_int, int_base + show_box_depth_code); /* showboxdepth */
3815 primitive(443, assign_int, int_base + hbadness_code); /* hbadness */
3816 primitive(444, assign_int, int_base + vbadness_code); /* vbadness */
3817 primitive(445, assign_int, int_base + pausing_code); /* pausing */
3818 primitive(446, assign_int, int_base + tracing_online_code); /* tracingonline */
3819 primitive(447, assign_int, int_base + tracing_macros_code); /* tracingmacros */
3820 primitive(448, assign_int, int_base + tracing_stats_code); /* tracingstats */
3821 primitive(449, assign_int, int_base + tracing_paragraphs_code); /* tracingparagraphs */
3822 primitive(450, assign_int, int_base + tracing_pages_code); /* tracingpages */
3823 primitive(451, assign_int, int_base + tracing_output_code); /* tracingoutput */
3824 primitive(452, assign_int, int_base + tracing_lost_chars_code); /* tracinglostchars */
3825 primitive(453, assign_int, int_base + tracing_commands_code); /* tracingcommands */
3826 primitive(454, assign_int, int_base + tracing_restores_code); /* tracingrestores */
3827 primitive(455, assign_int, int_base + uc_hyph_code); /* uchyph */
3828 primitive(456, assign_int, int_base + output_penalty_code); /* outputpenalty */
3829 primitive(457, assign_int, int_base + max_dead_cycles_code); /* maxdeadcycles */
3830 primitive(458, assign_int, int_base + hang_after_code); /* hangafter */
3831 primitive(459, assign_int, int_base + floating_penalty_code); /* floatingpenalty */
3832 primitive(460, assign_int, int_base + global_defs_code); /* globaldefs */
3833 primitive(461, assign_int, int_base + cur_fam_code); /* fam */
3834 primitive(462, assign_int, int_base + escape_char_code); /* escapechar */
3835 primitive(463, assign_int, int_base + default_hyphen_char_code); /* defaulthyphenchar */
3836 primitive(464, assign_int, int_base + default_skew_char_code); /* defaultskewchar */
3837 primitive(465, assign_int, int_base + end_line_char_code); /* endlinechar */
3838 primitive(466, assign_int, int_base + new_line_char_code); /* newlinechar */
3839 primitive(467, assign_int, int_base + language_code); /* language */
3840 primitive(468, assign_int, int_base + left_hyphen_min_code); /* lefthyphenmin */
3841 primitive(469, assign_int, int_base + right_hyphen_min_code); /* righthyphenmin */
3842 primitive(470, assign_int, int_base + holding_inserts_code); /* holdinginserts */
3843 primitive(471, assign_int, int_base + error_context_lines_code); /* errorcontextlines */
3844 primitive(475, assign_dimen, dimen_base + par_indent_code); /* parindent */
3845 primitive(476, assign_dimen, dimen_base + math_surround_code); /* mathsurround */
3846 primitive(477, assign_dimen, dimen_base + line_skip_limit_code); /* lineskiplimit */
3847 primitive(478, assign_dimen, dimen_base + hsize_code); /* hsize */
3848 primitive(479, assign_dimen, dimen_base + vsize_code); /* vsize */
3849 primitive(480, assign_dimen, dimen_base + max_depth_code); /* maxdepth */
3850 primitive(481, assign_dimen, dimen_base + split_max_depth_code); /* splitmaxdepth */
3851 primitive(482, assign_dimen, dimen_base + box_max_depth_code); /* boxmaxdepth */
3852 primitive(483, assign_dimen, dimen_base + hfuzz_code); /* hfuzz */
3853 primitive(484, assign_dimen, dimen_base + vfuzz_code); /* vfuzz */
3854 primitive(485, assign_dimen, dimen_base + delimiter_shortfall_code); /* delimitershortfall */
3855 primitive(486, assign_dimen, dimen_base + null_delimiter_space_code); /* nulldelimiterspace */
3856 primitive(487, assign_dimen, dimen_base + script_space_code); /* scriptspace */
3857 primitive(488, assign_dimen, dimen_base + pre_display_size_code); /* predisplaysize */
3858 primitive(489, assign_dimen, dimen_base + display_width_code); /* displaywidth */
3859 primitive(490, assign_dimen, dimen_base + display_indent_code); /* displayindent */
3860 primitive(491, assign_dimen, dimen_base + overfull_rule_code); /* overfullrule */
3861 primitive(492, assign_dimen, dimen_base + hang_indent_code); /* hangindent */
3862 primitive(493, assign_dimen, dimen_base + h_offset_code); /* hoffset */
3863 primitive(494, assign_dimen, dimen_base + v_offset_code); /* voffset */
3864 primitive(495, assign_dimen, dimen_base + emergency_stretch_code); /* emergencystretch */
3865 primitive(32, ex_space, 0); /* */
3866 primitive(47, ital_corr, 0); /* / */
3867 primitive(505, accent, 0); /* accent */
3868 primitive(506, advance, 0); /* advance */
3869 primitive(507, after_assignment, 0); /* afterassignment */
3870 primitive(508, after_group, 0); /* aftergroup */
3871 primitive(509, begin_group, 0); /* begingroup */
3872 primitive(510, char_num, 0); /* char */
3873 primitive(501, cs_name, 0); /* csname */
3874 primitive(511, delim_num, 0); /* delimiter */
3875 primitive(512, divide, 0); /* divide */
3876 primitive(502, end_cs_name, 0); /* endcsname */
3877 primitive(513, end_group, 0); /* endgroup */
3878 /* hash[(hash_size + 516)].v.RH = 513; */
3879 hash[(hash_size + hash_extra + 516)].v.RH = 513; /* endgroup */
3880 /* eqtb[(hash_size + 516)]= eqtb[cur_val]; */
3881 eqtb[(hash_size + hash_extra + 516)]= eqtb[cur_val];
3882 primitive(514, expand_after, 0); /* expandafter */
3883 primitive(515, def_font, 0); /* font */
3884 primitive(516, assign_font_dimen, 0); /* fontdimen */
3885 primitive(517, halign, 0); /* halign */
3886 primitive(518, hrule, 0); /* hrule */
3887 primitive(519, ignore_spaces, 0); /* ignorespaces */
3888 primitive(327, insert, 0); /* insert */
3889 primitive(348, mark, 0); /* mark */
3890 primitive(520, math_accent, 0); /* mathaccent */
3891 primitive(521, math_char_num, 0); /* mathchar */
3892 primitive(522, math_choice, 0); /* mathchoice */
3893 primitive(523, multiply, 0); /* multiply */
3894 primitive(524, no_align, 0); /* noalign */
3895 primitive(525, no_boundary, 0); /* noboundary */
3896 primitive(526, no_expand, 0); /* noexpand */
3897 primitive(332, non_script, 0); /* nonscript */
3898 primitive(527, omit, 0); /* omit */
3899 primitive(405, set_shape, 0); /* parshape */
3900 primitive(528, break_penalty, 0); /* penalty */
3901 primitive(529, set_prev_graf, 0); /* prevgraf */
3902 primitive(530, radical, 0); /* radical */
3903 primitive(531, read_to_cs, 0); /* read */
3904 primitive(532, relax, 256); /* primitive("relax",relax,256); */
3905 /* hash[(hash_size + 521)].v.RH = 532; */
3906 hash[(hash_size + hash_extra + 521)].v.RH = 532; /* read */
3907 /* eqtb[(hash_size + 521)]= eqtb[cur_val]; */
3908 eqtb[(hash_size + hash_extra + 521)]= eqtb[cur_val];
3909 primitive(533, set_box, 0); /* setbox */
3910 primitive(534, the, 0); /* the */
3911 primitive(404, toks_register, 0); /* toks */
3912 primitive(349, vadjust, 0); /* vadjust */
3913 primitive(535, valign, 0); /* valign */
3914 primitive(536, vcenter, 0); /* vcenter */
3915 primitive(537, vrule, 0); /* vrule */
3916 primitive(594, par_end, 256); /* par */
3918 par_token = 4095 + par_loc;
3919 primitive(626, input, 0); /* input */
3920 primitive(627, input, 1); /* endinput */
3921 primitive(628, top_bot_mark, 0); /* topmark */
3922 primitive(629, top_bot_mark, 1); /* firstmark */
3923 primitive(630, top_bot_mark, 2); /* botmark */
3924 primitive(631, top_bot_mark, 3); /* splitfirstmark */
3925 primitive(632, top_bot_mark, 4); /* splitbotmark */
3926 primitive(473, tex_register, 0); /* count */
3927 primitive(497, tex_register, 1); /* dimen */
3928 primitive(392, tex_register, 2); /* skip */
3929 primitive(393, tex_register, 3); /* muskip */
3930 primitive(665, set_aux, 102); /* spacefactor */
3931 primitive(666, set_aux, 1); /* prevdepth */
3932 primitive(667, set_page_int, 0); /* dead_cycles */
3933 primitive(668, set_page_int, 1); /* insert_penalties */
3934 primitive(669, set_box_dimen, 1); /* wd */
3935 primitive(670, set_box_dimen, 3); /* ht */
3936 primitive(671, set_box_dimen, 2); /* dp */
3937 primitive(672, last_item, 0); /* last_penalty */
3938 primitive(673, last_item, 1); /* last_kern */
3939 primitive(674, last_item, 2); /* lastskip */
3940 primitive(675, last_item, 3); /* inputlineno */
3941 primitive(676, last_item, 4); /* badness */
3942 primitive(732, convert, 0); /* number */
3943 primitive(733, convert, 1); /* romannumeral */
3944 primitive(734, convert, 2); /* string */
3945 primitive(735, convert, 3); /* meaning */
3946 primitive(736, convert, 4); /* font_name */
3947 primitive(737, convert, 5); /* job_name */
3948 primitive(753, if_test, 0); /* if */
3949 primitive(754, if_test, 1); /* ifcat */
3950 primitive(755, if_test, 2); /* ifnum */
3951 primitive(756, if_test, 3); /* ifdim */
3952 primitive(757, if_test, 4); /* ifodd */
3953 primitive(758, if_test, 5); /* ifvmode */
3954 primitive(759, if_test, 6); /* ifhmode */
3955 primitive(760, if_test, 7); /* ifmmode */
3956 primitive(761, if_test, 8); /* ifinner */
3957 primitive(762, if_test, 9); /* ifvoid */
3958 primitive(763, if_test, 10); /* ifhbox */
3959 primitive(764, if_test, 11); /* ifvbox */
3960 primitive(765, if_test, 12); /* ifx */
3961 primitive(766, if_test, 13); /* ifeof */
3962 primitive(767, if_test, 14); /* iftrue */
3963 primitive(768, if_test, 15); /* iffalse */
3964 primitive(769, if_test, 16); /* ifcase */
3965 primitive(770, fi_or_else, 2); /* fi */
3966 /* hash[(hash_size + 518)].v.RH = 770; */
3967 hash[(hash_size + hash_extra + 518)].v.RH = 770; /* fi */
3968 /* eqtb[(hash_size + 518)]= eqtb[cur_val]; */
3969 eqtb[(hash_size + hash_extra + 518)]= eqtb[cur_val];
3970 primitive(771, fi_or_else, 4); /* or */
3971 primitive(772, fi_or_else, 3); /* else */
3972 primitive(795, set_font, 0); /* nullfont */
3973 /* hash[(hash_size + 524)].v.RH = 795; */ /* hash[frozen_null_font] */
3974 hash[(hash_size + hash_extra + 524)].v.RH = 795; /* nullfont */
3975 /* eqtb[(hash_size + 524)]= eqtb[cur_val]; */
3976 eqtb[(hash_size + hash_extra + 524)]= eqtb[cur_val];
3977 primitive(892, tab_mark, 256); /* span */
3978 /* primitive("span",tab_mark,span_code); */
3979 primitive(893, car_ret, 257); /* cr */
3980 /* primitive("cr",car_ret,cr_code); */
3981 /* hash[(hash_size + 515)].v.RH = 893; */
3982 hash[(hash_size + hash_extra + 515)].v.RH = 893; /* cr */
3983 /* eqtb[(hash_size + 515)]= eqtb[cur_val]; */
3984 eqtb[(hash_size + hash_extra + 515)]= eqtb[cur_val];
3985 primitive(894, car_ret, 258); /* cr cr */
3986 /* hash[(hash_size + 519)].v.RH = 895; */
3987 hash[(hash_size + hash_extra + 519)].v.RH = 895; /* endtemplate */
3988 /* hash[(hash_size + 520)].v.RH = 895; */
3989 hash[(hash_size + hash_extra + 520)].v.RH = 895; /* endtemplate */
3990 /* eqtb[(hash_size + 520)].hh.b0 = 9; */
3991 eqtb[(hash_size + hash_extra + 520)].hh.b0 = 9;
3992 /* eqtb[(hash_size + 520)].hh.v.RH = null_list; */
3993 eqtb[(hash_size + hash_extra + 520)].hh.v.RH = null_list;
3994 /* eqtb[(hash_size + 520)].hh.b1 = 1; */
3995 eqtb[(hash_size + hash_extra + 520)].hh.b1 = 1;
3996 /* eqtb[(hash_size + 519)]= eqtb[(hash_size + 520)]; */
3997 eqtb[(hash_size + hash_extra + 519)]=
3998 eqtb[(hash_size + hash_extra + 520)];
3999 /* eqtb[(hash_size + 519)].hh.b0 = 115; */
4000 eqtb[(hash_size + hash_extra + 519)].hh.b0 = 115;
4001 primitive(964, set_page_dimen, 0); /* pagegoal */
4002 primitive(965, set_page_dimen, 1); /* pagetotal */
4003 primitive(966, set_page_dimen, 2); /* pagestretch */
4004 primitive(967, set_page_dimen, 3); /* pagefilstretch */
4005 primitive(968, set_page_dimen, 4); /* pagefillstretch */
4006 primitive(969, set_page_dimen, 5); /* pagefilllstretch */
4007 primitive(970, set_page_dimen, 6); /* pageshrink */
4008 primitive(971, set_page_dimen, 7); /* pagedepth */
4009 primitive(1019, end_match, 0); /* end */
4010 primitive(1020, stop, 1); /* dump */
4011 primitive(1021, hskip, 4); /* hskip */
4012 primitive(1022, hskip, 0); /* hfil */
4013 primitive(1023, hskip, 1); /* hfill */
4014 primitive(1024, hskip, 2); /* hss */
4015 primitive(1025, hskip, 3); /* hfilneg */
4016 primitive(1026, vskip, 4); /* vskip */
4017 primitive(1027, vskip, 0); /* vfil */
4018 primitive(1028, vskip, 1); /* vfill */
4019 primitive(1029, vskip, 2); /* vss */
4020 primitive(1030, vskip, 3); /* vfilneg */
4021 primitive(333, mskip, 5); /* mskip */
4022 primitive(337, kern, 1); /* kern */
4023 primitive(339, mkern, 99); /* mkern */
4024 primitive(1048, hmove, 1); /* moveleft */
4025 primitive(1049, hmove, 0); /* moveright */
4026 primitive(1050, vmove, 1); /* raise */
4027 primitive(1051, vmove, 0); /* lower */
4028 primitive(406, make_box, 0); /* box */
4029 primitive(1052, make_box, 1); /* copy */
4030 primitive(1053, make_box, 2); /* lastbox */
4031 primitive(959, make_box, 3); /* vsplit */
4032 primitive(1054, make_box, 4); /* vtop */
4033 primitive(961, make_box, 5); /* vbox */
4034 primitive(1055, make_box, 106); /* hbox */
4035 primitive(1056, leader_ship, 99); /* ship_out */
4036 primitive(1057, leader_ship, 100); /* leaders */
4037 primitive(1058, leader_ship, 101); /* cleaders */
4038 primitive(1059, leader_ship, 102); /* xleaders */
4039 primitive(1074, start_par, 1); /* indent */
4040 primitive(1075, start_par, 0); /* noindent */
4041 primitive(1084, remove_item, 12); /* unpenalty */
4042 primitive(1085, remove_item, 11); /* unkern */
4043 primitive(1086, remove_item, 10); /* unskip */
4044 primitive(1087, un_hbox, 0); /* unhbox */
4045 primitive(1088, un_hbox, 1); /* unhcopy */
4046 primitive(1089, un_vbox, 0); /* unvbox */
4047 primitive(1090, un_vbox, 1); /* unvcopy */
4048 primitive(45, discretionary, 1); /* - */
4049 primitive(346, discretionary, 0); /* discretionary */
4050 primitive(1121, eq_no, 0); /* eqno */
4051 primitive(1122, eq_no, 1); /* leqno */
4052 primitive(860, math_comp, 16); /* mathord */
4053 primitive(861, math_comp, 17); /* mathop */
4054 primitive(862, math_comp, 18); /* mathbin */
4055 primitive(863, math_comp, 19); /* mathrel */
4056 primitive(864, math_comp, 20); /* mathopen */
4057 primitive(865, math_comp, 21); /* mathclose */
4058 primitive(866, math_comp, 22); /* mathpunct */
4059 primitive(867, math_comp, 23); /* mathinner */
4060 primitive(869, math_comp, 26); /* underline */
4061 primitive(868, math_comp, 27); /* overline */
4062 primitive(1123, limit_switch, 0); /* displaylimits */
4063 primitive(872, limit_switch, 1); /* limits */
4064 primitive(873, limit_switch, 2); /* nolimits */
4065 primitive(855, math_style, 0); /* displaystyle */
4066 primitive(856, math_style, 2); /* textstyle */
4067 primitive(857, math_style, 4); /* scriptstyle */
4068 primitive(858, math_style, 6); /* scriptscriptstyle */
4069 primitive(1141, above, 0); /* above */
4070 primitive(1142, above, 1); /* over */
4071 primitive(1143, above, 2); /* atop */
4072 primitive(1144, above, 3); /* abovewithdelims */
4073 primitive(1145, above, 4); /* overwithdelims */
4074 primitive(1146, above, 5); /* atopwithdelims */
4075 primitive(870, left_right, 30); /* left */
4076 primitive(871, left_right, 31); /* right */
4077 /* hash[(hash_size + 517)].v.RH = 871; */
4078 hash[(hash_size + hash_extra + 517)].v.RH = 871; /* right */
4079 /* eqtb[(hash_size + 517)]= eqtb[cur_val]; */
4080 eqtb[(hash_size + hash_extra + 517)]= eqtb[cur_val];
4081 primitive(1165, prefix, 1); /* long */
4082 primitive(1166, prefix, 2); /* outer */
4083 primitive(1167, prefix, 4); /* global */
4084 primitive(1168, def, 0); /* def */
4085 primitive(1169, def, 1); /* gdef */
4086 primitive(1170, def, 2); /* edef */
4087 primitive(1171, def, 3); /* xdef */
4088 primitive(1185, let, 0); /* let */
4089 primitive(1186, let, 1); /* futurelet */
4090 primitive(1187, shorthand_def, 0); /* chardef */
4091 primitive(1188, shorthand_def, 1); /* mathchardef */
4092 primitive(1189, shorthand_def, 2); /* countdef */
4093 primitive(1190, shorthand_def, 3); /* dimendef */
4094 primitive(1191, shorthand_def, 4); /* skipdef */
4095 primitive(1192, shorthand_def, 5); /* muskipdef */
4096 primitive(1193, shorthand_def, 6); /* toksdef */
4097 primitive(412, def_code, (hash_size + 1883)); /* catcode */
4098 primitive(416, def_code, (hash_size + 2907)); /* mathcode */
4099 primitive(413, def_code, (hash_size + 2139)); /* lccode */
4100 primitive(414, def_code, (hash_size + 2395)); /* uccode */
4101 primitive(415, def_code, (hash_size + 2651)); /* sfcode */
4102 primitive(474, def_code, (hash_size + 3474)); /* delcode */
4103 primitive(409, def_family, (hash_size + 1835)); /* textfont */
4104 primitive(410, def_family, (hash_size + 1851)); /* scriptfont */
4105 primitive(411, def_family, (hash_size + 1867)); /* scriptscriptfont */
4106 primitive(935, hyph_data, 0); /* hyphenation */
4107 primitive(947, hyph_data, 1); /* patterns */
4108 primitive(1211, assign_font_int, 0); /* hyphen_char */
4109 primitive(1212, assign_font_int, 1); /* skew_char */
4110 primitive(272, set_interaction, 0); /* batchmode */
4111 primitive(273, set_interaction, 1); /* nonstopmode */
4112 primitive(274, set_interaction, 2); /* scrollmode */
4113 primitive(1221, set_interaction, 3); /* errorstopmode */
4114 primitive(1222, in_stream, 1); /* openin */
4115 primitive(1223, in_stream, 0); /* closein */
4116 primitive(1224, message, 0); /* message */
4117 primitive(1225, message, 1); /* errmessage */
4118 primitive(1231, case_shift, (hash_size + 2139)); /* lowercase */
4119 primitive(1232, case_shift, (hash_size + 2395)); /* uppercase */
4120 primitive(1233, xray, 0); /* show */
4121 primitive(1234, xray, 1); /* show_box */
4122 primitive(1235, xray, 2); /* showthe */
4123 primitive(1236, xray, 3); /* showlists */
4124 primitive(1279, extension, 0); /* openout */
4125 primitive(591, extension, 1); /* write */
4126 write_loc = cur_val;
4127 primitive(1280, extension, 2); /* closeout */
4128 primitive(1281, extension, 3); /* special */
4129 primitive(1282, extension, 4); /* immediate */
4130 primitive(1283, extension, 5); /* setlanguage */
4131 no_new_control_sequence = true;
4135 #pragma optimize("s", off) /* 96/Sep/12 */
4136 /* #pragma optimize("1", off) */
4137 #pragma optimize("t", on) /* 96/Sep/12 */
4138 /* #pragma optimize("2", on) */