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 */
127 if (trace_flag != 0) {
128 for (k = 0; k < 256; k++) /* entries in xord / xchr */
133 if (flag) { /* 127 here means mapping undefined */
134 show_line("Inverted mapping xord[] pairs:\n", 0);
135 for (k = 0; k < 256; k++) {/* entries in xord / xchr */
136 if (xord[k] != 127) {
137 sprintf(log_line, "%d => %d\n", k, xord[k]);
138 show_line(log_line, 0);
143 if (interaction < 0) /* may now set in local.c bkph */
144 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
145 interaction = error_stop_mode;
146 deletions_allowed = true;
147 set_box_allowed = true;
150 use_err_help = false;
152 OK_to_interrupt = true;
154 /* darn, need to know mem_top, mem_max etc for the following ... */
156 was_mem_end = mem_min;
157 /* was_lo_max = mem_min; */
158 was_lo_max = mem_bot;
159 /* was_hi_min = mem_max; */
160 was_hi_min = mem_top;
168 cur_list.aux_field.cint = ignore_depth;
173 page_tail = page_head;
175 if (is_initex) /* in iniTeX we did already allocate mem [] */
177 mem[page_head].hh.v.RH = 0;
178 /* last_glue = 262143L; */ /* NO! */
179 last_glue = empty_flag;
184 for (k = int_base; k <= eqtb_size; k++) xeq_level[k] = 1;
185 no_new_control_sequence = true;
186 hash[514].v.LH = 0; /* next(hash_base):= 0 */
187 hash[514].v.RH = 0; /* text(hash_base):= 0 */
188 /* 514 + hash_size + 266 = hashbase + hashsize + 10 + font_max */
189 /* for k <- hashbase+1 to undefined_control_sequence - 1 do ... p.257 */
190 for (k = hash_base + 1; k <= undefined_control_sequence - 1; k++) hash[k] = hash[hash_base];
206 for (k = 0; k <= 16; k++) read_open[k] = 2;
211 for (k = 0; k <= font_max; k++) font_used[k] = false;
212 null_character.b0 = 0;
213 null_character.b1 = 0;
214 null_character.b2 = 0;
215 null_character.b3 = 0;
221 doing_leaders = false;
224 half_buf = dvi_buf_size / 2;
225 dvi_limit = dvi_buf_size;
229 /* down_ptr:=null; right_ptr:=null; l.12027 */
235 empty_field.v.RH = 0;
236 empty_field.v.LH = 0;
237 null_delimiter.b0 = 0;
238 null_delimiter.b1 = 0;
239 null_delimiter.b2 = 0;
240 null_delimiter.b3 = 0;
247 /* *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
248 #ifndef ALLOCATEHYPHEN
249 /* {register integer for_end; z = 0; for_end = 607; if (z <= for_end) do */
250 for (z = 0; z <= hyphen_prime; z++) {
256 output_active = false;
257 insert_penalties = 0;
258 ligature_present = false;
259 cancel_boundary = false;
264 long_help_seen = false;
266 for (k = 0; k <= 17; k++) write_open[k]= false;
270 /* initex stuff split off for convenience of optimization adjustments */
271 if (is_initex) do_initex();
273 /* trap the -i on command line situation if INITEX was NOT defined */
275 show_line("Sorry, somebody forgot to make an INITEX!\n", 1);
277 #endif /* not INITEX */
280 /* do the part of initialize() that requires mem_top, mem_max or mem[] */
281 /* do this part after allocating main memory */
284 void initialize_aux (void)
287 was_mem_end = mem_min;
288 /* was_lo_max = mem_min; */
289 was_lo_max = mem_bot;
290 /* was_hi_min = mem_max; */
291 was_hi_min = mem_top;
295 /* max_nest_stack = 0; */
299 cur_list.aux_field.cint = ignore_depth;
302 /* shown_mode = 0; */
303 /* page_contents = 0; */
304 page_tail = page_head;
305 //mem[mem_top - 2].hh.v.RH = 0;
308 #endif // end of ifdef ALLOCATEMAIN
310 void line_break_ (integer finalwidowpenalty)
314 halfword q, r, s, prevs;
315 internal_font_number f;
316 /* small_number j; */
317 int j; /* 95/Jan/7 */
318 /* unsigned char c; */
319 unsigned int c; /* 95/Jan/7 */
321 /* savedbadness = 0; */ /* 96/Feb/9 */
322 pack_begin_line = mode_line;
323 mem[temp_head].hh.v.RH = link(head);
324 if ((tail >= hi_mem_min))
326 link(tail) = new_penalty(10000);
329 else if (mem[tail].hh.b0 != 10)
331 link(tail) = new_penalty(10000);
336 delete_glue_ref(mem[tail + 1].hh.v.LH);
337 flush_node_list(mem[tail + 1].hh.v.RH);
338 mem[tail + 1].cint = 10000;
340 link(tail) = new_param_glue(par_fill_skip_code);
341 /* *********************************************************************** */
342 /* following is new in 3.14159 */
343 init_cur_lang = prev_graf % 65536L;
344 init_l_hyf = prev_graf / 4194304L; /* 2^22 */
345 init_r_hyf = (prev_graf / 65536L)% 64;
346 /* *********************************************************************** */
348 noshrinkerroryet = true;
349 if ((mem[eqtb[(hash_size + 789)].hh.v.RH].hh.b1 != 0) &&
350 (mem[eqtb[(hash_size + 789)].hh.v.RH + 3].cint != 0))
352 eqtb[(hash_size + 789)].hh.v.RH = finite_shrink(eqtb[(hash_size + 789)].hh.v.RH);
354 if ((mem[eqtb[(hash_size + 790)].hh.v.RH].hh.b1 != 0) &&
355 (mem[eqtb[(hash_size + 790)].hh.v.RH + 3].cint != 0))
357 eqtb[(hash_size + 790)].hh.v.RH = finite_shrink(eqtb[(hash_size + 790)].hh.v.RH);
359 q = eqtb[(hash_size + 789)].hh.v.RH;
360 r = eqtb[(hash_size + 790)].hh.v.RH;
361 background[1] = mem[q + 1].cint + mem[r + 1].cint;
366 background[2 + mem[q].hh.b0] = mem[q + 2].cint;
367 background[2 + mem[r].hh.b0] = background[2 + mem[r].hh.b0] + mem[r + 2].cint;
368 background[6] = mem[q + 3].cint + mem[r + 3].cint;
369 minimum_demerits = 1073741823L; /* 2^30 - 1 *//* 40000000 hex - 1 */
370 minimal_demerits[3] = 1073741823L;
371 minimal_demerits[2] = 1073741823L;
372 minimal_demerits[1] = 1073741823L;
373 minimal_demerits[0] = 1073741823L;
374 if (par_shape_ptr == 0)
375 if (hang_indent == 0)
377 last_special_line = 0;
378 second_width = hsize;
382 last_special_line = abs(hang_after);
385 first_width = hsize -
387 if (hang_indent >= 0)
388 first_indent = hang_indent;
389 else first_indent = 0;
390 second_width = hsize;
395 second_width = hsize -
397 if (hang_indent >= 0)
398 second_indent = hang_indent;
399 else second_indent = 0;
403 last_special_line = mem[par_shape_ptr].hh.v.LH - 1;
404 second_width = mem[par_shape_ptr + 2 *(last_special_line + 1)].cint;
405 second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].cint;
407 /* if looseness=0 then easy_line:=last_special_line */
409 easyline = last_special_line;
410 /* else easyline = 262143L; */ /* NO! */
411 else easyline = empty_flag;
412 /* threshold:=pretolerance; */
413 threshold = pretolerance;
418 /* if tracing_paragraphs>0 then */
419 if (tracing_paragraphs > 0)
422 print_nl("@firstpass");
427 first_pass_count++; /* 96 Feb 9 */
430 /* threshold:=tolerance; second_pass:=true; */
431 threshold = tolerance;
433 /* final_pass:=(emergency_stretch<=0); */
434 final_pass =(emergency_stretch <= 0);
437 if (tracing_paragraphs > 0)
442 /* if threshold>inf_bad then threshold:=inf_bad; */
443 if (threshold > 10000)
449 if (is_initex) { /* bkph */
450 if (trie_not_ready)init_trie();
453 /* ********************************************************************* */
454 /* following has changed in 3.14159 */
456 cur_lang = init_cur_lang;
457 /* lhyf = cur_list .lhmfield; */
459 /* rhyf = cur_list .rhmfield; */
461 /* ********************************************************************* */
466 mem[q].hh.v.RH = active;
467 mem[q + 1].hh.v.RH = 0;
468 mem[q + 1].hh.v.LH = prev_graf + 1;
470 mem[active].hh.v.RH = q;
471 active_width[1] = background[1];
472 active_width[2] = background[2];
473 active_width[3] = background[3];
474 active_width[4] = background[4];
475 active_width[5] = background[5];
476 active_width[6] = background[6];
477 /* passive:=null; printed_node:=temp_head; pass_number:=0; */
479 printed_node = temp_head;
481 font_in_short_display = 0;
482 cur_p = mem[temp_head].hh.v.RH;
485 /* while (cur_p<>null)and(link(active)<>last_active) do */
486 while((cur_p != 0)&&(mem[active].hh.v.RH != active))
488 if ((cur_p >= hi_mem_min))
492 f = mem[cur_p].hh.b0;
493 active_width[1]= active_width[1]+ font_info[width_base[f]+
494 font_info[char_base[f]+ mem[cur_p].hh.b1].qqqq.b0].cint
496 cur_p = mem[cur_p].hh.v.RH;
497 } while(!(!(cur_p >= hi_mem_min)));
499 switch(mem[cur_p].hh.b0)
503 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
506 if (mem[cur_p].hh.b1 == 4)
508 cur_lang = mem[cur_p + 1].hh.v.RH; /* ASCII_code */
509 lhyf = mem[cur_p + 1].hh.b0;
510 rhyf = mem[cur_p + 1].hh.b1;
517 if ((prevp >= hi_mem_min))
519 else if ((mem[prevp].hh.b0 < 9))
521 /* *********************************************************************** */
522 /* following is new in 3.14159 */
523 else if ((mem[prevp].hh.b0 == 11)&&(mem[prevp].hh.b1
526 /* *********************************************************************** */
528 if ((mem[mem[cur_p + 1].hh.v.LH].hh.b1 != 0)&&(mem[
529 mem[cur_p + 1].hh.v.LH + 3].cint != 0))
531 mem[cur_p + 1].hh.v.LH = finite_shrink(mem[cur_p + 1].hh.v.LH);
533 q = mem[cur_p + 1].hh.v.LH;
534 active_width[1]= active_width[1]+ mem[q + 1].cint;
535 active_width[2 + mem[q].hh.b0]= active_width[2 + mem[q]
536 .hh.b0]+ mem[q + 2].cint;
537 active_width[6]= active_width[6]+ mem[q + 3].cint;
538 if (second_pass && autobreaking)
541 s = mem[prevs].hh.v.RH;
545 if ((s >= hi_mem_min))
550 else if (mem[s].hh.b0 == 6)
551 if (mem[s + 1].hh.v.RH == 0)
555 q = mem[s + 1].hh.v.RH;
559 else if ((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
562 else if (mem[s].hh.b0 == 8)
564 if (mem[s].hh.b1 == 4)
566 cur_lang = mem[s + 1].hh.v.RH; /* ASCII_code */
567 lhyf = mem[s + 1].hh.b0;
568 rhyf = mem[s + 1].hh.b1;
573 if (eqtb[(hash_size + 2139) + c].hh.v.RH != 0)
574 /* signed unsigned mismatch ? (c is unsigned) */
575 if ((eqtb[(hash_size + 2139) + c].hh.v.RH == c)||
580 s = mem[prevs].hh.v.RH;
582 lab32: hyf_char = hyphen_char[hf];
583 /* if hyf_char<0 then goto done1; */
584 if (hyf_char < 0) goto lab31;
585 /* if hyf_char>255 then goto done1; */
586 if (hyf_char > 255) goto lab31; /* ? */
588 if (lhyf + rhyf > 63) goto lab31;
591 if ((s >= hi_mem_min)) {
592 if (mem[s].hh.b0 != hf)
594 hyfbchar = mem[s].hh.b1;
595 c = hyfbchar; /* unsigned char c; */
596 if (eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
603 /* long to short ... */
604 hc[hn]= eqtb[(hash_size + 2139) + c].hh.v.RH;
605 hyfbchar = 256; /* special mark */
607 else if (mem[s].hh.b0 == 6)
609 if (mem[s + 1].hh.b0 != hf)
611 /* j:=hn; q:=lig_ptr(s); l.17554 */
613 q = mem[s + 1].hh.v.RH;
614 /* if q>null then hyf_bchar:=character(q); l.17554 BUG ??? */
616 if (q != 0) /* 94/Mar/23 BUG FIX */
617 hyfbchar = mem[q].hh.b1;
618 /* while q>null do l.17555 BUG ??? */
620 while(q != 0){ /* 94/Mar/23 BUG FIX */
622 if (eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
628 /* long to short ... */
629 hc[j]= eqtb[(hash_size + 2139) + c].hh.v.RH;
634 if (odd(mem[s].hh.b1))
635 hyfbchar = font_bchar[hf];
636 else hyfbchar = 256; /* special mark */
638 else if ((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
642 /* ******************************************************************** */
643 hyfbchar = font_bchar[hf]; /* new code in 3.14159 */
644 /* ******************************************************************** */
650 if (hn < lhyf + rhyf)
653 if (!((s >= hi_mem_min)))
659 if (mem[s].hh.b1 != 0)
684 /* ******************************************************************* */
685 if (mem[cur_p].hh.b1 == 1)/* change in 3.14159 */
686 /* ******************************************************************* */
688 if (!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
689 if (mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
691 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
693 /* ******************************************************************* */
694 /* change in 3.14159 */
695 else active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
696 /* ******************************************************************* */
700 f = mem[cur_p + 1].hh.b0;
701 active_width[1]= active_width[1]+ font_info[width_base[f]+
702 font_info[char_base[f]+ mem[cur_p + 1].hh.b1].qqqq.b0]
708 s = mem[cur_p + 1].hh.v.LH;
711 try_break(ex_hyphen_penalty, 1);
714 if ((s >= hi_mem_min))
717 disc_width = disc_width + font_info[width_base[f]+ font_info
718 [ char_base[f]+ mem[s].hh.b1].qqqq.b0].cint;
720 else switch(mem[s].hh.b0)
723 f = mem[s + 1].hh.b0;
724 disc_width = disc_width + font_info[width_base[f]+
725 font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0
733 disc_width = disc_width + mem[s + 1].cint;
738 return; // abort_flag set
744 active_width[1]= active_width[1]+ disc_width;
745 try_break(hyphen_penalty, 1);
746 active_width[1]= active_width[1]- disc_width;
748 r = mem[cur_p].hh.b1;
749 s = mem[cur_p].hh.v.RH;
751 if ((s >= hi_mem_min))
754 active_width[1]= active_width[1]+ font_info[width_base[f
755 ]+ font_info[char_base[f]+ mem[s].hh.b1].qqqq.b0]
758 else switch(mem[s].hh.b0)
761 f = mem[s + 1].hh.b0;
762 active_width[1]= active_width[1]+ font_info[width_base[
763 f]+ font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq
771 active_width[1]= active_width[1]+ mem[s + 1].cint;
776 return; // abort_flag set
790 autobreaking =(mem[cur_p].hh.b1 == 1);
792 if (!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
793 if (mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
795 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
800 try_break(mem[cur_p + 1].cint, 0);
809 confusion("paragraph");
810 return; // abort_flag set
815 cur_p = mem[cur_p].hh.v.RH;
820 try_break(-10000, 1);
821 if (mem[active].hh.v.RH != active)
823 r = mem[active].hh.v.RH;
824 fewest_demerits = 1073741823L; /* 2^30 - 1 */
826 if (mem[r].hh.b0 != 2)
827 if (mem[r + 2].cint < fewest_demerits)
829 fewest_demerits = mem[r + 2].cint;
833 } while(!(r == active));
834 best_line = mem[best_bet + 1].hh.v.LH;
835 /* if looseness=0 then goto done; */
837 /* if (final_pass && eqtb[(hash_size + 3750)].cint > 0){ */
838 /* paragraph_failed++; */
840 goto lab30; /* normal exit */
843 /* r:=link(active); actual_looseness:=0; */
844 r = mem[active].hh.v.RH;
845 actual_looseness = 0;
847 if (mem[r].hh.b0 != 2)
849 /* line_diff:=line_number(r)-best_line; */
850 line_diff = toint(mem[r + 1].hh.v.LH)- toint(best_line
852 /* if ((line_diff<actual_looseness)and(looseness<=line_diff))or@|
853 ((line_diff>actual_looseness)and(looseness>=line_diff)) then */
854 if (((line_diff < actual_looseness) && (looseness <= line_diff)) ||
855 ((line_diff > actual_looseness) && (looseness >= line_diff)))
858 actual_looseness = line_diff;
859 fewest_demerits = mem[r + 2].cint;
861 else if ((line_diff == actual_looseness)&&(mem[r + 2]
862 .cint < fewest_demerits))
865 fewest_demerits = mem[r + 2].cint;
869 } while(!(r == active));
870 best_line = mem[best_bet + 1].hh.v.LH;
872 /* if (actual_looseness=looseness)or final_pass then goto done; */
873 /* if ((actual_looseness == eqtb[(hash_size + 3182)].cint)|| final_pass)*/
874 if ((actual_looseness == looseness)) {
882 q = mem[active].hh.v.RH;
884 cur_p = mem[q].hh.v.RH;
885 if (mem[q].hh.b0 == 2)
887 else free_node(q, 3);
892 cur_p = mem[q].hh.v.RH;
900 if (tracing_paragraphs > 0)
901 print_nl("@secondpass"); /* */
903 /* threshold:=tolerance; */
904 threshold = tolerance;
906 second_pass_count++; /* 96 Feb 9 */
907 /* final_pass:=(emergency_stretch<=0); */
908 final_pass =(emergency_stretch <= 0);
914 if (tracing_paragraphs > 0)
915 print_nl("@emergencypass"); /* */
917 /* can only get here is \emergencystretch has been set positive */
918 /* background[2]:=background[2]+emergency_stretch; final_pass:=true; */
919 background[2]= background[2]+ emergency_stretch;
921 final_pass_count++; /* 96 Feb 9 */
922 } /* end of if second_pass */
923 } /* end of while(true)do */
924 /* cannot drop through from above loop */
925 lab30: /* common exit point */
926 /* if (badness > (pre)tolerance) */
927 /* if (last_badness > threshold){ */
928 /* if (savedbadness > threshold){ */ /* do we believe this ??? */
929 /* paragraph_failed++; */ /* 96/Feb/9 */
931 /* if (prevgraf == 1) singleline++; */
932 /* if (nest[nest_ptr].pg_field == 1) singleline++; */
933 /* At this point best_line is number of lines in paragraph + 1 */
934 if (best_line == 2) singleline++;
937 if (tracing_paragraphs > 0)
939 end_diagnostic(true);
940 normalize_selector();
943 post_line_break(finalwidowpenalty);
944 q = mem[active].hh.v.RH;
946 cur_p = mem[q].hh.v.RH;
947 if (mem[q].hh.b0 == 2)
949 else free_node(q, 3);
953 while(q != 0){ /* while q<>null do l.16979 */
954 cur_p = mem[q].hh.v.RH;
961 void prefixed_command (void)
964 internal_font_number f;
971 while (cur_cmd == prefix) {
972 if (!odd(a / cur_chr))
973 a = a + cur_chr; /* small_number a; */
976 } while(!((cur_cmd != spacer) && (cur_cmd != relax)));
977 if (cur_cmd <= max_non_prefixed_command) {
978 print_err("You can't use a prefix with `");
979 print_cmd_chr(cur_cmd, cur_chr);
981 help1("I'll pretend you didn't say \\long or \\outer or \\global.");
986 if ((cur_cmd != 97) && (a % 4 != 0)) {
987 print_err("You can't use `");
989 print_string("' or `");
991 print_string("' with `");
992 print_cmd_chr(cur_cmd, cur_chr);
993 print_char(39); /* ' */
994 help1("I'll pretend you didn't say \\long or \\outer here.");
997 if (global_defs != 0)
1009 /* set_font: define(cur_font_loc,data,cur_chr); */
1011 geq_define((hash_size + 1834), 120, cur_chr);
1012 else eq_define((hash_size + 1834), 120, cur_chr);
1016 if (odd(cur_chr) && !(a >= 4) && (global_defs >= 0))
1021 q = scan_toks(true, e);
1022 if ((a >= 4)) geq_define(p, 111 +(a % 4), def_ref);
1023 else eq_define(p, 111 +(a % 4), def_ref);
1034 } while (!(cur_cmd != 10));
1035 if (cur_tok == 3133) {
1049 incr(mem[cur_chr].hh.v.LH);
1051 geq_define(p, cur_cmd, cur_chr);
1053 eq_define(p, cur_cmd, cur_chr);
1062 geq_define(p, 0, 256);
1064 eq_define(p, 0, 256);
1065 scan_optional_equals();
1071 geq_define(p, 68, cur_val);
1072 else eq_define(p, 68, cur_val);
1077 scan_fifteen_bit_int();
1079 geq_define(p, 69, cur_val);
1081 eq_define(p, 69, cur_val);
1086 scan_eight_bit_int();
1090 geq_define(p, 73, (hash_size + 3218) + cur_val);
1091 else eq_define(p, 73, (hash_size + 3218) + cur_val);
1095 geq_define(p, 74, (hash_size + 3751) + cur_val);
1096 else eq_define(p, 74, (hash_size + 3751) + cur_val);
1100 geq_define(p, 75, (hash_size + 800) + cur_val);
1101 else eq_define(p, 75, (hash_size + 800) + cur_val);
1105 geq_define(p, 76, (hash_size + 1056) + cur_val);
1106 else eq_define(p, 76, (hash_size + 1056) + cur_val);
1110 geq_define(p, 72, toks_base + cur_val);
1111 else eq_define(p, 72, toks_base + cur_val);
1123 if (! scan_keyword("to")) /* to */
1125 print_err("Missing `to' inserted");
1126 help2("You should have said `\\read<number> to \\cs'.",
1127 "I'm going to look for the \\cs now.");
1133 if ((a >= 4)) geq_define(p, 111, cur_val);
1134 else eq_define(p, 111, cur_val);
1143 scan_eight_bit_int();
1144 p = toks_base + cur_val;
1147 scan_optional_equals();
1150 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1155 scan_eight_bit_int();
1157 cur_chr = toks_base + cur_val;
1161 q = eqtb[cur_chr].hh.v.RH;
1164 geq_define(p, 101, 0);
1165 else eq_define(p, 101, 0);
1168 incr(mem[q].hh.v.LH);
1170 geq_define(p, 111, q);
1171 else eq_define(p, 111, q);
1178 q = scan_toks(false, false);
1179 if (mem[def_ref].hh.v.RH == 0){
1181 geq_define(p, 101, 0);
1182 else eq_define(p, 101, 0);
1184 mem[def_ref].hh.v.RH = avail;
1194 if (p == (hash_size + 1313)) /* output ? */
1196 mem[q].hh.v.RH = get_avail();
1198 mem[q].hh.v.LH = 637;
1200 mem[q].hh.v.LH = 379;
1201 mem[q].hh.v.RH = mem[def_ref].hh.v.RH;
1202 mem[def_ref].hh.v.RH = q;
1205 geq_define(p, 111, def_ref);
1206 else eq_define(p, 111, def_ref);
1213 scan_optional_equals();
1216 geq_word_define(p, cur_val);
1217 else eq_word_define(p, cur_val);
1223 scan_optional_equals();
1224 scan_dimen(false, false, false);
1226 geq_word_define(p, cur_val);
1227 else eq_word_define(p, cur_val);
1235 scan_optional_equals();
1236 if (n == 76) scan_glue(3);
1240 geq_define(p, 117, cur_val);
1241 else eq_define(p, 117, cur_val);
1246 if (cur_chr == (hash_size + 1883))
1248 else if (cur_chr == (hash_size + 2907))
1249 n = 32768L; /* 2^15 */
1250 else if (cur_chr == (hash_size + 2651))
1251 n = 32767; /* 2^15 - 1*/
1252 else if (cur_chr == (hash_size + 3474))
1253 n = 16777215L; /* 2^24 - 1 */
1254 else n = 255; /* 2^8 - 1 */
1258 scan_optional_equals();
1260 if (((cur_val < 0)&&(p < (hash_size + 3474))) ||(cur_val > n))
1262 print_err("Invalid code(");
1264 if (p < (hash_size + 3474))
1265 print_string("), should be in the range 0..");
1267 print_string("), should be at most ");
1269 help1("I'm going to use 0 instead of that illegal code value.");
1273 if (p < (hash_size + 2907))
1275 geq_define(p, 120, cur_val);
1276 else eq_define(p, 120, cur_val);
1277 else if (p < (hash_size + 3474))
1279 geq_define(p, 120, cur_val);
1280 else eq_define(p, 120, cur_val);
1282 geq_word_define(p, cur_val);
1283 else eq_word_define(p, cur_val);
1289 scan_four_bit_int();
1291 scan_optional_equals();
1294 geq_define(p, 120, cur_val);
1295 else eq_define(p, 120, cur_val);
1302 do_register_command(a);
1306 scan_eight_bit_int();
1310 scan_optional_equals();
1311 if (set_box_allowed){
1312 scan_box(1073741824L + n); /* 2^30 + n */ /* box_flag + n */
1315 print_err("Improper ");
1316 print_esc("setbox"); /* */
1317 help2("Sorry, \\setbox is not allowed after \\halign in a display,",
1318 "or between \\accent and an accented character.");
1330 alter_page_so_far();
1340 scan_optional_equals();
1347 p = get_node(2 * n + 1);
1350 register integer for_end;
1353 if (j <= for_end) do
1355 scan_dimen(false, false, false);
1356 mem[p + 2 * j - 1].cint = cur_val;
1357 scan_dimen(false, false, false);
1358 mem[p + 2 * j].cint = cur_val;
1360 while(j++ < for_end);
1364 geq_define((hash_size + 1312), 118, p);
1365 else eq_define((hash_size + 1312), 118, p);
1373 if (is_initex) { /* bkph */
1378 print_err("Patterns can be loaded only by INITEX");
1383 } while(!(cur_cmd == 2));
1388 new_hyph_exceptions();
1394 find_font_dimen(true);
1396 scan_optional_equals();
1397 scan_dimen(false, false, false);
1398 font_info[k].cint = cur_val;
1406 scan_optional_equals();
1408 if (n == 0)hyphen_char[f]= cur_val;
1409 else skew_char[f]= cur_val;
1420 confusion("prefix");
1421 return; // abort_flag set
1424 } /* end of cur_cmd switch */
1428 if (after_token != 0) {
1429 cur_tok = after_token;
1435 /* added following explanations 96/Jan/10 */
1437 void bad_formator_pool (char *name, char *defaultname, char *envvar)
1439 if (name == NULL) name = defaultname;
1440 sprintf(log_line, "(Perhaps %s is for an older version of TeX)\n", name);
1441 show_line(log_line, 0);
1442 name_of_file[name_length + 1] = '\0';
1443 sprintf(log_line, "(Alternatively, %s may have been corrupted)\n", name_of_file+1);
1444 show_line(log_line, 0);
1445 name_of_file[name_length + 1] = ' ';
1447 "(Perhaps your %s environment variable is not set correctly)\n", envvar);
1448 show_line(log_line, 0);
1450 char *s; /* extra info 99/April/28 */
1451 if ((s = grabenv(envvar)) != NULL) {
1452 sprintf(log_line, "(%s=%s)\n", envvar, s);
1453 show_line(log_line, 0);
1456 sprintf(log_line, "%s environment variable not set\n", envvar);
1457 show_line(log_line, 0);
1465 bool load_fmt_file (void)
1467 register bool Result;
1473 undump_int(x); /* CHECKSUM */
1474 if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
1477 undump_int(x); /* mem_bot */
1481 undump_int(x); /* mem_top */
1484 /* we already read this once earlier to grab mem_top */
1486 sprintf(log_line, "Read from fmt file mem_top = %d TeX words\n", x);
1487 show_line(log_line, 0);
1489 mem = allocate_main_memory(x); /* allocate main memory at this point */
1490 if (mem == NULL) exit(1); /* redundant sanity test ! */
1491 initialize_aux(); /* do `mem' part of initialize */
1492 /* mem = zmem; */ /* update pointer to main memory */
1498 undump_int(x); /* eqtbsize */
1499 if (x != (hash_size + 4006)) /* eqtbsize */
1501 undump_int(x); /* hash_prime */
1502 if (x != hash_prime)
1504 undump_int(x); /* hyphen_prime */
1506 #ifdef ALLOCATEHYPHEN
1507 /* allow format files dumped with arbitrary (prime) hyphenation exceptions */
1508 realloc_hyphen (x); /* reset_hyphen(); */
1512 if (x != hyphen_prime)
1515 undump_int(x); /* pool_size */
1519 #ifdef ALLOCATESTRING
1520 if (x > current_pool_size) {
1522 sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size);
1523 show_line(log_line, 0);
1525 str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
1527 if (x > current_pool_size) /* 94/Jan/24 */
1533 sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size");
1534 show_line(log_line, 0);
1536 } else pool_ptr = x;
1539 undump_int(x); /* max_strings */
1543 #ifdef ALLOCATESTRING
1544 if (x > current_max_strings) {
1546 sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
1547 show_line(log_line, 0);
1549 str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
1551 if (x > current_max_strings) /* 94/Jan/24 */
1553 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1554 if (x > max_strings)
1558 sprintf(log_line, "%s%s\n", "---! Must increase the ", "max strings");
1559 show_line(log_line, 0);
1565 if (undumpthings(str_start[0], str_ptr + 1)) return -1; /* undump string ptrs */
1566 if (undumpthings(str_pool[0], pool_ptr)) return -1; /* undump string pool */
1568 init_str_ptr = str_ptr;
1569 init_pool_ptr = pool_ptr;
1570 /* undump the dynamic memory - paragraph 1312 in the book */
1573 if ((x < 1019)||(x > mem_top - 14))
1575 else lo_mem_max = x;
1579 if ((x < 20)||(x > lo_mem_max))
1583 p = 0; /* mem_bot */
1586 if (undumpthings(mem[p], q + 2 - p)
1588 p = q + mem[q].hh.v.LH;
1589 if ((p > lo_mem_max)||((q >= mem[q + 1].hh.v.RH)&&(mem[q +
1590 1].hh.v.RH != rover)))
1592 q = mem[q + 1].hh.v.RH;
1593 } while(!(q == rover));
1594 if (undumpthings(mem[p], lo_mem_max + 1 - p)
1596 /* if (mem_min < -2) */
1597 if (mem_min < mem_bot - 2) /* ? splice in block below */
1599 /* or call add_variable_space(mem_bot - (mem_min + 1)) */
1601 if (trace_flag) show_line("Splicing in mem_min space in undump!\n", 0);
1603 p = mem[rover + 1].hh.v.LH;
1605 mem[mem_min].hh.v.RH = 0; /* null */
1606 mem[mem_min].hh.v.LH = 0; /* null */
1607 mem[p + 1].hh.v.RH = q;
1608 mem[rover + 1].hh.v.LH = q;
1609 mem[q + 1].hh.v.RH = rover;
1610 mem[q + 1].hh.v.LH = p;
1611 /* mem[q].hh.v.RH = 262143L; */ /* NO! */
1612 mem[q].hh.v.RH = empty_flag;
1613 /* mem[q].hh.v.LH = -0 - q; */
1614 mem[q].hh.v.LH = mem_bot - q; /* ? size of block */
1618 if ((x < lo_mem_max + 1)||(x > mem_top - 13))
1620 else hi_mem_min = x;
1624 /* if ((x < 0)||(x > mem_top)) */
1625 if ((x < mem_bot)||(x > mem_top))
1630 if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)
1632 undump_int(var_used);
1633 undump_int(dyn_used);
1637 if ((x < 1)||(k + x > (hash_size + 4007)))
1639 if (undumpthings(eqtb[k], x)
1643 if ((x < 0)||(k + x > (hash_size + 4007)))
1646 register integer for_end;
1648 for_end = k + x - 1;
1649 if (j <= for_end) do
1650 eqtb[j]= eqtb[k - 1];
1651 while(j++ < for_end);
1654 } while(!(k > (hash_size + 4006)));
1657 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1658 /* if ((x < 514)||(x > (hash_size + 514))) */
1659 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1663 par_token = 4095 + par_loc;
1666 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1667 /* if ((x < 514)||(x > (hash_size + 514))) */
1668 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1675 /* if ((x < hashbase)||(x > hashbase + hashsize)) */
1676 /* if ((x < 514)||(x > (hash_size + 514))) */
1677 if ((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1685 if ((x < p + 1)||(x > hash_used))
1690 } while(!(p == hash_used));
1691 if (undumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)
1694 undump_int(cs_count); /* cs_count */
1696 sprintf(log_line, "itex undump cs_count %d ", cs_count); /* debugging */
1697 show_line(log_line, 0);
1700 undump_int(x); /* font_mem_size */
1703 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1706 sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
1707 show_line(log_line, 0);
1709 if (x > current_font_mem_size) { /* 93/Nov/28 dynamic allocate font_info */
1711 sprintf(log_line, "Undump realloc font_info (%d > %d)\n",
1712 x, current_font_mem_size);
1713 show_line(log_line, 0);
1715 font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
1717 if (x > current_font_mem_size) /* in case allocation failed 94/Jan/24 */
1719 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1720 if (x > font_mem_size)
1724 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font mem size");
1725 show_line(log_line, 0);
1727 } else fmem_ptr = x;
1730 if (undumpthings(font_info[0], fmem_ptr)) return -1;
1732 undump_int(x); /* font_max */
1738 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font max");
1739 show_line(log_line, 0);
1744 frozenfontptr = font_ptr; /* remember number of fonts frozen into format */
1745 if (undumpthings(font_check[0], font_ptr + 1)) return -1;
1746 if (undumpthings(font_size[0], font_ptr + 1)) return -1;
1747 if (undumpthings(font_dsize[0], font_ptr + 1)) return -1;
1748 if (undumpthings(font_params[0], font_ptr + 1)) return -1;
1749 if (undumpthings(hyphen_char[0], font_ptr + 1)) return -1;
1750 if (undumpthings(skew_char[0], font_ptr + 1)) return -1;
1751 if (undumpthings(font_name[0], font_ptr + 1)) return -1;
1752 if (undumpthings(font_area[0], font_ptr + 1)) return -1;
1753 if (undumpthings(font_bc[0], font_ptr + 1)) return -1;
1754 if (undumpthings(font_ec[0], font_ptr + 1)) return -1;
1755 if (undumpthings(char_base[0], font_ptr + 1)) return -1;
1756 if (undumpthings(width_base[0], font_ptr + 1)) return -1;
1757 if (undumpthings(height_base[0], font_ptr + 1)) return -1;
1758 if (undumpthings(depth_base[0], font_ptr + 1)) return -1;
1759 if (undumpthings(italic_base[0], font_ptr + 1)) return -1;
1760 if (undumpthings(lig_kern_base[0], font_ptr + 1)) return -1;
1761 if (undumpthings(kern_base[0], font_ptr + 1)) return -1;
1762 if (undumpthings(exten_base[0], font_ptr + 1)) return -1;
1763 if (undumpthings(param_base[0], font_ptr + 1)) return -1;
1764 if (undumpthings(font_glue[0], font_ptr + 1)) return -1;
1765 if (undumpthings(bchar_label[0], font_ptr + 1)) return -1;
1766 if (undumpthings(font_bchar[0], font_ptr + 1)) return -1;
1767 if (undumpthings(font_false_bchar[0], font_ptr + 1)) return -1;
1770 /* log not opened yet, so can't show fonts frozen into format */
1772 /* May be able to avoid the following since we switched to */
1773 /* non_address from font_mem_size to 0 96/Jan/15 ??? */
1774 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1776 /* deal with fmt files dumped with *different* font_mem_size 93/Nov/29 */
1777 { int count = 0, oldfont_mem_size = 0;
1778 for (x = 0; x <= font_ptr; x++) {
1779 if (bchar_label[x] > oldfont_mem_size) oldfont_mem_size = bchar_label[x];
1782 /* somewhat arbitrary sanity check ... */
1783 /* if (oldfont_mem_size != font_mem_size && oldfont_mem_size > font_max) { */
1784 if (oldfont_mem_size != non_address && oldfont_mem_size > font_max) { /* 96/Jan/16 */
1785 for (x = 0; x <= font_ptr; x++) {
1786 if (bchar_label[x] == oldfont_mem_size) {
1787 /* bchar_label[x] = font_mem_size; */
1788 bchar_label[x] = non_address; /* 96/Jan/16 */
1794 "oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
1795 oldfont_mem_size, count, non_address);
1796 show_line(log_line, 0);
1801 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1802 /* undump(0)(hyph_size)(hyph_count); */
1805 /* if ((x < 0)||(x > 607)) */
1806 if ((x < 0)||(x > hyphen_prime))
1811 /* undump hypenation exception tables p.1325 */
1813 register integer for_end;
1815 for_end = hyph_count;
1821 /* if ((x < 0)||(x > 607)) */
1822 if ((x < 0)||(x > hyphen_prime))
1827 /* undump(0)(str_ptr)(hyph_word[j]); */
1830 if ((x < 0)||(x > str_ptr))
1835 /* undump(min_halfword)(max_halfword)(hyph_list[j]); */
1838 /* if ((x < 0)||(x > 262143L)) */
1839 if ((x < 0)||(x > max_halfword)) /* mem_top ? no p.1325 */
1844 } while(k++ < for_end);
1846 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1847 #ifdef ALLOCATEHYPHEN
1848 /* if user specified new hyphen prime - flush existing exception patterns ! */
1849 /* but, we can reclaim the string storage wasted ... */
1851 if (new_hyphen_prime != 0) {
1852 realloc_hyphen(new_hyphen_prime); /* reset_hyphen(); */
1853 hyphen_prime = new_hyphen_prime;
1857 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1862 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1863 #ifdef ALLOCATETRIES
1865 allocate_tries(x); /* allocate only as much as is needed */
1866 /* trie_size = x; */ /* ??? */
1869 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1873 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie size");
1874 show_line(log_line, 0);
1880 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1881 if (is_initex) /* bkph */
1882 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1885 if (undumpthings(trie_trl[0], j + 1)) return -1;
1886 if (undumpthings(trie_tro[0], j + 1)) return -1;
1887 if (undumpthings(trie_trc[0], j + 1)) return -1;
1892 if (x > trie_op_size)
1895 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie op size");
1896 show_line(log_line, 0);
1902 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1903 if (is_initex) /* bkph */
1904 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1908 begin undump(0)(63)(hyf_distance[k]); {a |small_number|}
1909 undump(0)(63)(hyf_num[k]);
1910 undump(min_quarterword)(max_quarterword)(hyf_next[k]); end; */
1912 if (undumpthings(hyf_distance[1], j)) return -1;
1913 if (undumpthings(hyf_num[1], j)) return -1;
1914 if (undumpthings(hyf_next[1], j)) return -1;
1917 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1918 if (is_initex) { /* bkph */
1919 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1921 register integer for_end;
1924 if (k <= for_end) do
1926 while(k++ < for_end);
1932 /* undump(0)(k-1)(k) */
1935 if ((x < 0)||(x > k - 1))
1939 /* undump(1)(j)(x) */
1942 if ((x < 1)||(x > j))
1948 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1949 if (is_initex) /* bkph */
1950 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1953 /* j:=j-x; op_start[k]:=qo(j); */
1959 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1960 if (is_initex) /* bkph */
1961 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1962 trie_not_ready = false
1967 if ((x < 0)||(x > 3))
1969 /* else interaction = x; */
1970 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1971 if (interaction < 0) /* may now set in local.c bkph 94/Jan/8 */
1972 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1977 if ((x < 0)||(x > str_ptr))
1979 else format_ident = x;
1982 /* test_eof(fmt_file)? */
1984 if ((x != ENDFMTCHECKSUM)|| feof(fmt_file)) /* magic checksum --- change ? */
1991 sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
1992 show_line(log_line, 1);
1993 /* added following bit of explanation 96/Jan/10 */
1995 bad_formator_pool(format_file, "the format file", "TEXFORMATS");
2000 void final_cleanup (void)
2004 if (job_name == 0) open_log_file();
2005 while (input_ptr > 0) {
2006 if (cur_input.state_field == 0) {
2008 } else end_file_reading();
2010 while (open_parens > 0) {
2014 if (cur_level > level_one) {
2016 print_esc("end occurred ");
2017 print_string("inside a group at level ");
2018 print_int(cur_level - 1);
2021 while (cond_ptr != 0) {
2023 print_esc("end occurred ");
2024 print_string("when ");
2025 print_cmd_chr(105, cur_if); /* i */
2027 print_string("on line ");
2030 print_string(" was incomplete)");
2031 if_line = mem[cond_ptr + 1].cint;
2032 cur_if = mem[cond_ptr].hh.b1;
2033 temp_ptr = cond_ptr;
2034 cond_ptr = mem[cond_ptr].hh.v.RH;
2035 free_node(temp_ptr, 2);
2038 if (((history == 1) || (interaction < 3)))
2042 print_nl(" (see the transcript file for additional information)");
2048 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2049 if (is_initex) { /* bkph */
2050 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2051 /* *************************** new in 3.14159 ***************************** */
2053 register integer for_end;
2056 if (c <= for_end) do
2057 if (cur_mark[c]!= 0)
2058 delete_token_ref(cur_mark[c]);
2059 while(c++ < for_end);
2061 /* *********************************************************************** */
2062 /* 422. Amendment to bugfix 414 (reported by David Fuchs, September 2007) */
2063 if (last_glue != max_halfword) delete_glue_ref(last_glue);
2064 store_fmt_file(); // returns a value ?
2067 if (!is_initex) /* 2000/March/3 */
2068 print_nl(" (\\dump is performed only by INITEX)"); /* */
2072 // debugging code for checking the string pool
2074 int checkpool (char *task)
2076 int c, i, k, n, st, flag, bad=0;
2079 sprintf(log_line, "Check on string pool start (%s)\n", task);
2080 show_line(log_line, 0);
2082 for (k = 0; k < 32; k++) {
2083 if (str_start[k] != 3 * k) {
2084 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2085 show_line(log_line, 0);
2088 for (k = 32; k < 128; k++) {
2089 if (str_start[k] != 96 + (k - 32)) {
2090 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2091 show_line(log_line, 0);
2094 for (k = 128; k < 256; k++) {
2095 if (str_start[k] != 194 + 4 * (k - 128)){
2096 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2097 show_line(log_line, 0);
2101 sprintf(log_line, "Check on string pool (%s)\n", task);
2102 show_line(log_line, 0);
2104 for (k = 0; k < str_ptr; k++) {
2105 if (str_start[k+1] == 0) break;
2110 for (i = 0; i < n; i++) {
2111 if (str_pool[st + i] == 0) {
2114 if (str_pool[st + i] > 255) {
2120 sprintf(log_line, "BAD %d (start at %d): ", k, st);
2121 show_line(log_line, 0);
2123 for (i = 0; i < n; i++) {
2124 c = str_pool[st + i];
2126 sprintf(s, "%d ", c);
2145 show_line(log_line, stdout);
2148 sprintf(log_line, "end of check (%s)\n", bad ? "BAD" : "OK");
2149 show_line(log_line, 0);
2151 if (task == NULL) return bad;
2155 } /* DEBUGGING ONLY */
2158 void show_frozen (void)
2161 fprintf(log_file, "\n");
2162 fprintf(log_file, "(%d fonts frozen in format file:\n", font_ptr);
2163 /* ignore font 0 which is nullfont */
2164 /* for (i = 1; i < font_ptr+1; i++) */
2165 for (i = 1; i <= font_ptr; i++) {
2166 if (i > 1) fprintf(log_file, ", ");
2167 if ((i % 8) == 0) fprintf(log_file, "\n");
2168 n = str_start[font_name[i]+1]-str_start[font_name[i]];
2169 for (j = 0; j < n; j++) {
2170 putc(str_pool[str_start[font_name[i]]+j], log_file);
2171 /* str_pool[str_start[font_name[i]]+j] = '?'; */
2174 fprintf(log_file, ") ");
2177 /* Main entry point called from texmf.c int main(int ac, char *av[]) */
2178 /* call from main_program in texmf.c */
2179 /* This in turn calls initialize() */
2181 #pragma warning(disable:4127) // conditional expression is constant
2183 /* void texbody() */
2184 int texbody (void) /* now returns a value --- bkph */
2188 set_paths(TEXFORMATPATHBIT + TEXINPUTPATHBIT + TEXPOOLPATHBIT + TFMFILEPATHBIT);
2190 if (ready_already == 314159L) goto lab1; /* magic number */
2191 /* These tests are almost all compile time tests and so could be eliminated */
2193 if ((half_error_line < 30) || (half_error_line > error_line - 15)) bad = 1;
2194 if (max_print_line < 60) bad = 2;
2195 if (dvi_buf_size % 8 != 0) bad = 3;
2196 if (1100 > mem_top)bad = 4; /* not compile time */
2197 /* if (hash_prime > hash_size) */
2198 if (hash_prime > (hash_size + hash_extra)) bad = 5;
2199 if (max_in_open >= 128)bad = 6; /* p.14 */
2200 if (mem_top < 267)bad = 7; /* where from ? *//* not compile time */
2203 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2204 if (is_initex) { /* bkph */
2205 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2206 if ((mem_min != 0)||(mem_max != mem_top)) bad = 10;
2209 /* if ((mem_min > 0)||(mem_max < mem_top)) */
2210 if ((mem_min > mem_bot)||(mem_max < mem_top)) bad = 10;
2211 /* if ((0 > 0)||(255 < 127)) */
2212 if ((min_quarterword > 0)||(max_quarterword < 255)) bad = 11;
2213 /* if ((0 > 0)||(262143L < 32767)) */
2214 if ((min_halfword > 0)||(max_halfword < 32767)) bad = 12;
2215 /* if ((0 < 0)||(255 > 262143L)) */
2216 if ((min_quarterword < min_halfword)||(max_quarterword > max_halfword))
2218 /* if ((mem_min < 0)||(mem_max >= 262143L)||(-0 - mem_min > 262144L)) */
2219 if ((mem_min < min_halfword)||(mem_max >= max_halfword)||(mem_bot - mem_min >= max_halfword))
2221 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2222 if (mem_max > mem_top + mem_extra_high) /* not compile time */
2223 bad = 14; /* ha ha */
2224 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2225 /* if ((0 < 0)||(font_max > 255)) */
2226 if ((0 < min_quarterword)||(font_max > max_quarterword)) /* 93/Dec/3 */
2228 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2229 #ifdef INCREASEFONTS
2230 /* if (font_max > 512)*/ /* 93/Dec/3 */
2231 if (font_max > 1024) /* 96/Jan/17 */
2233 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2237 /* if ((save_size > 262143L)||(max_strings > 262143L)) */
2238 if ((save_size > max_halfword)||(max_strings > max_halfword))
2240 /* if (buf_size > 262143L)*/
2241 if (buf_size > max_halfword)bad = 18;
2242 /* if (255 < 255) */
2243 if (max_quarterword - min_quarterword < 255) bad = 19;
2244 /* if cs_token_flag + undefined_control_sequence > max_halfword then bad <- 21;*/
2245 /* if ((hash_size + 4876) > 262143L)*/
2246 /* if ((hash_size + 4876) > max_halfword) */
2247 if ((hash_size + 4095 + 781) > max_halfword) bad = 21;
2248 if (format_default_length > PATHMAX) bad = 31;
2249 /* if (2 * 262143L < mem_top - mem_min) */
2250 if (max_halfword < (mem_top - mem_min) / 2) bad = 41;
2252 sprintf(log_line, "%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
2253 "---case ", (long) bad);
2254 show_line(log_line, 1);
2256 bad_formator_pool(format_file, "the format file", "TEXFORMATS"); /* 96/Jan/17 */
2257 goto lab9999; // abort
2262 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2264 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2265 if (!get_strings_started ())
2266 goto lab9999; // abort
2268 init_str_ptr = str_ptr;
2269 init_pool_ptr = pool_ptr;
2270 dateandtime(tex_time, day, month, year);
2273 ready_already = 314159L; /* magic number */
2275 lab1: /* get here directly if ready_already already set ... */
2280 show_line(tex_version, 0);
2281 sprintf(log_line, " (%s %s)", application, yandyversion);
2282 show_line(log_line, 0);
2283 if (format_ident > 0)slow_print(format_ident);
2289 name_in_progress = false;
2291 output_file_name = 0;
2297 high_in_open = 0; /* max_in_open name already used 1999 Jan 17 */
2299 max_open_parens = 0; /* max_open_parens */
2302 max_param_stack = 0;
2303 #ifdef ALLOCATEBUFFER
2304 /* first = current_buf_size; */
2305 memset (buffer, 0, current_buf_size); /* redundant */
2307 /* first = buf_size; */
2308 memset (buffer, 0, buf_size); /* redundant ? */
2313 } while(!(first == 0)); */
2314 first = 0; /* 1999/Jan/22 */
2317 warning_index = 0; /* warning_index:=null; l.7068 */
2319 cur_input.state_field = 33;
2320 cur_input.start_field = 1;
2321 cur_input.index_field = 0;
2323 cur_input.name_field = 0;
2325 align_state = 1000000L;
2326 if (!init_terminal ())
2327 goto lab9999; // abort
2328 cur_input.limit_field = last;
2331 /* if ((format_ident == 0)||(buffer[cur_input.loc_field]== 38)) */
2332 /* For Windows NT, lets allow + instead of & for format specification */
2333 if ((format_ident == 0) ||
2334 (buffer[cur_input.loc_field] == '&') ||
2335 (buffer[cur_input.loc_field] == '+'))
2337 if (format_ident != 0)
2339 if (!open_fmt_file ())
2340 goto lab9999; // abort
2341 if (!load_fmt_file ())
2344 goto lab9999; // abort
2347 while((cur_input.loc_field < cur_input.limit_field) &&
2348 (buffer[cur_input.loc_field] == 32))
2349 incr(cur_input.loc_field);
2352 if (debug_flag) check_eqtb("after format"); /* debugging 94/Apr/5 */
2354 if ((end_line_char < 0) || (end_line_char > 255))
2355 decr(cur_input.limit_field);
2357 buffer[cur_input.limit_field] = end_line_char;
2358 dateandtime(tex_time, day, month, year);
2359 magic_offset = str_start[886]- 9 * 16; /* following: */
2360 /* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
2361 if (interaction == 0)
2365 if ((cur_input.loc_field < cur_input.limit_field) &&
2366 (eqtb[(hash_size + 1883) + buffer[cur_input.loc_field]].hh.v.RH != 0))
2370 /* show font TFMs frozen into format file */
2371 /* moved here after start_input to ensure the log file is open */
2372 if (show_tfm_flag && log_opened && font_ptr > 0) /* 98/Sep/28 */
2376 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2377 main_time = clock();
2378 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2382 print_cs_names(stdout, 0); /* 98/Mar/31 */
2384 main_control(); /* read-eval-print loop :-) in tex8.c */
2386 // what if abort_flag is set now ?
2389 print_cs_names(stdout, 1); /* 98/Mar/31 */
2391 // what if abort_flag is set now ?
2395 // if (abort_flag) return -1;
2397 close_files_and_terminate();
2406 if ((history != 0) && (history != 1))
2409 // now return instead of exit to allow cleanup in local.c
2413 } /* end of texbody */
2416 /* add a block of variable size node space below mem_bot */
2417 void add_variable_space(int size)
2418 { /* used in tex0.c, local.c, itex.c */
2424 if (mem_min == 0) t = mem_min; /* bottom of present block */
2425 else t = mem_min + 1;
2426 mem_min = t - (size + 1); /* first word in new block - 1 */
2427 /* mem_min = mem_start; */ /* allocate all of it at once */
2428 if (mem_min < mem_start) { /* sanity test */
2429 if (trace_flag) show_line("WARNING: mem_min < mem_start!\n", 0);
2430 mem_min = mem_start;
2432 p = mem[rover + 1].hh.v.LH;
2434 mem[mem_min].hh.v.RH = 0; /* insert blank word below ??? */
2435 mem[mem_min].hh.v.LH = 0; /* insert blank word below ??? */
2436 mem[p + 1].hh.v.RH = q;
2437 mem[rover + 1].hh.v.LH = q;
2438 mem[q + 1].hh.v.RH = rover;
2439 mem[q + 1].hh.v.LH = p;
2440 mem[q].hh.v.RH = empty_flag;
2441 mem[q].hh.v.LH = t - q; /* block size */
2446 /*************************************************************************/
2448 /* All ini TeX code is here at end so can use same pragma optimize for it */
2450 /* Ini-TeX code is rarely needed/used so make it small rather than fast */
2452 #pragma optimize("t", off)
2453 /* #pragma optimize("2", off) */
2454 #pragma optimize("s", on)
2455 /* #pragma optimize("1", on) */
2458 /* split out to allow sharing of code from do_initex and newpattern */
2459 void reset_trie (void)
2462 for (k = - (integer) trie_op_size; k <= trie_op_size; k++)
2463 trie_op_hash[k] = 0;
2464 for (k = 0; k <= 255; k++)
2465 trie_used[k] = min_trie_op;
2466 max_op_used = min_trie_op;
2468 trie_not_ready = true;
2472 trie_not_ready = true;
2474 /* borrowed code from initialize() */
2475 void reset_hyphen (void)
2478 for (z = 0; z <= hyphen_prime; z++)
2481 hyph_list[z] = 0; /* hyph_list[z]:=null; l.18131 */
2486 /* split out to allow optimize for space, not time */
2487 void do_initex (void)
2491 /* hyph_pointer z; */
2494 for (k = mem_bot + 1; k <= lo_mem_stat_max; k++)
2497 while(k <= lo_mem_stat_max)
2499 glue_ref_count(k) = 1;
2500 stretch_order(k) = normal;
2501 shrink_order(k) = normal;
2502 k = k + glue_spec_size;
2504 stretch(fil_glue) = 65535L;
2505 stretch_order(fil_glue) = fil;
2506 stretch(fill_glue) = 65535L;
2507 stretch_order(fill_glue) = fill;
2508 stretch(ss_glue) = 65535L;
2509 stretch_order(ss_glue) = fil;
2510 shrink(ss_glue) = 65535L;
2511 shrink_order(ss_glue) = fil;
2512 stretch(fil_neg_glue) = -65536L;
2513 stretch_order(fil_neg_glue) = fil;
2514 rover = lo_mem_stat_max + 1;
2515 link(rover) = empty_flag;
2516 node_size(rover) = block_size;
2517 llink(rover) = rover;
2518 rlink(rover) = rover;
2519 lo_mem_max = rover + block_size;
2520 link(lo_mem_max) = 0;
2521 info(lo_mem_max) = 0;
2522 for (k = hi_mem_stat_min; k <= mem_top; k++)
2523 mem[k] = mem[lo_mem_max];
2524 /* info(omit_template) <- end_template_token; p.790 */
2525 /* @d end_template_token==cs_token_flag+frozen_end_template */
2526 /* mem[omit_template].hh.v.LH = 14114; */
2527 /* mem[omit_template].hh.v.LH = 10019 + 4095; */ /* + eqtbextra ? NO */
2528 /* mem[omit_template].hh.v.LH = (hash_size + 4614); */
2529 /* mem[omit_template].hh.v.LH = (hash_size + 4095 + 519); */
2530 mem[omit_template].hh.v.LH = (hash_size + hash_extra + 4095 + 519);
2531 /* link(end_span) <- max_quarterword + 1 p.797 */
2532 /* mem[end_span].hh.v.RH = 256; */ /* 94/Apr/4 ? */
2533 mem[end_span].hh.v.RH = max_quarterword + 1; /* 96/Oct/12 ??? */
2534 /* info(end_span) <- null p.797 */
2535 mem[end_span].hh.v.LH = 0;
2536 /* type(last_active) <- hyphenated; p.820 */
2537 mem[active].hh.b0 = 1;
2538 /* line_number(last_active) <- max_halfword; p.820 */
2539 /* mem[mem_top - 6].hh.v.LH = 262143L; */
2540 mem[mem_top - 6].hh.v.LH = empty_flag; /* max_halfword ? */
2541 /* subtype(last_active) <- 0; p.820 */
2542 mem[active].hh.b1 = 0;
2543 /* subtype(page_ins_head) <- 255; p.981 */
2544 mem[mem_top].hh.b1 = 255; /* subtype(page_ins_head) = qi(255) p.981 */
2545 /* type(page_ins_head) <- split_up; p.981 */
2546 mem[mem_top].hh.b0 = 1;
2547 /* link(page_ins_head) <- page_ins_head; p.981 */
2548 mem[mem_top].hh.v.RH = mem_top;
2549 /* type(page_head) <- glue_node; p. 988 */
2550 mem[page_head].hh.b0 = 10;
2551 /* subtype(page_head) <- normal; p. 988 */
2552 mem[page_head].hh.b1 = 0;
2553 avail = 0; /* avail <- null p.164 */
2554 mem_end = mem_top; /* mem_end <- mem_top */
2555 hi_mem_min = mem_top - 13; /* hi_mem_min <- hi_mem_stat_min */
2556 var_used = 20; /* var_used <- lo_mem_stat_max */
2557 dyn_used = 14; /* dyn_used <- hi_mem_stat_usage */
2558 eq_type(undefined_control_sequence) = undefined_cs;
2559 equiv(undefined_control_sequence) = 0;
2560 eq_level(undefined_control_sequence) = level_zero;
2561 for (k = active_base; k <= undefined_control_sequence - 1; k++) eqtb[k]= eqtb[undefined_control_sequence];
2562 eqtb[(hash_size + 782)].hh.v.RH = 0; /* glue_base (hash_size + 782) */
2563 eq_level(glue_base) = level_one;
2564 eqtb[(hash_size + 782)].hh.b0 = 117;
2565 for (k = glue_base + 1; k <= local_base - 1; k++) eqtb[k]= eqtb[glue_base];
2566 /* glue_ref_count(zero_glue):=glue_ref_count(zero_glue)+local_base-glue_base; */
2567 /* local_base - glue_base = 530 = 17 glue_pars + 256 skip + 256 mu_skip */
2568 mem[0].hh.v.RH = mem[0].hh.v.RH + 530; /* mem[mem_bot]? */
2569 /* box(0):=null; eq_type(box_base):=box_ref; eq_level(box_base):=level_one; */
2570 eqtb[(hash_size + 1312)].hh.v.RH = 0;
2571 eqtb[(hash_size + 1312)].hh.b0 = 118;
2572 eqtb[(hash_size + 1312)].hh.b1 = 1;
2573 for (k = output_routine_loc; k <= toks_base + 255; k++) eqtb[k]= eqtb[undefined_control_sequence];
2574 eqtb[(hash_size + 1578)].hh.v.RH = 0;
2575 eqtb[(hash_size + 1578)].hh.b0 = 119;
2576 eqtb[(hash_size + 1578)].hh.b1 = 1;
2577 for (k = box_base + 1; k <= box_base + 255; k++) eqtb[k]= eqtb[box_base];
2578 eqtb[(hash_size + 1834)].hh.v.RH = 0;
2579 eqtb[(hash_size + 1834)].hh.b0 = 120;
2580 eqtb[(hash_size + 1834)].hh.b1 = 1;
2581 for (k = math_font_base; k <= math_font_base + 47; k++) eqtb[k]= eqtb[cur_font_loc];
2582 eqtb[(hash_size + 1883)].hh.v.RH = 0;
2583 eqtb[(hash_size + 1883)].hh.b0 = 120;
2584 eqtb[(hash_size + 1883)].hh.b1 = 1;
2585 for (k = cat_code_base; k <= int_base - 1; k++) eqtb[k]= eqtb[cat_code_base];
2586 for (k = 0; k <= 255; k++) {
2587 eqtb[(hash_size + 1883) + k].hh.v.RH = 12;
2588 eqtb[(hash_size + 2907) + k].hh.v.RH = k;
2589 eqtb[(hash_size + 2651) + k].hh.v.RH = 1000;
2591 /* cat_base == 11383 */
2592 eqtb[(hash_size + 1896)].hh.v.RH = car_ret;
2593 eqtb[(hash_size + 1915)].hh.v.RH = spacer;
2594 eqtb[(hash_size + 1975)].hh.v.RH = escape;
2595 eqtb[(hash_size + 1920)].hh.v.RH = comment;
2596 eqtb[(hash_size + 2010)].hh.v.RH = invalid_char;
2597 eqtb[(hash_size + 1883)].hh.v.RH = ignore;
2598 /* for k:="0" to "9" do math_code(k):=hi(k+var_code); */
2599 for (k = '0'; k <= '9'; k++) eqtb[(hash_size + 2907) + k].hh.v.RH = k + 28672;
2600 /* cat_code of uppercase and lowercase letters ... */
2601 for (k = 'A'; k <= 'Z'; k++)
2604 eqtb[(hash_size + 1883) + k].hh.v.RH = 11;
2605 eqtb[(hash_size + 1883) + k + 32].hh.v.RH = 11;
2606 /* mathcode(k) = hi(k + var_code + "100); */ /* '70000 + 256 */
2607 eqtb[(hash_size + 2907) + k].hh.v.RH = k + 28928; /* '70000 + 256 */
2608 /* mathcode(k + "a" - "A") = hi(k + "a" - "A" + var_code + "100); */
2609 eqtb[(hash_size + 2907) + k + 32].hh.v.RH = k + 28960; /* '70000 + 256 + 32 */
2611 eqtb[(hash_size + 2139) + k].hh.v.RH = k + 32;
2612 eqtb[(hash_size + 2139) + k + 32].hh.v.RH = k + 32;
2614 eqtb[(hash_size + 2395) + k].hh.v.RH = k;
2615 eqtb[(hash_size + 2395) + k + 32].hh.v.RH = k;
2617 eqtb[(hash_size + 2651) + k].hh.v.RH = 999;
2619 for (k = int_base; k <= del_code_base - 1; k++) eqtb[k].cint = 0;
2623 max_dead_cycles = 25;
2626 for (k = 0; k <= 255; k++) eqtb[(hash_size + 3474) + k].cint = -1;
2627 eqtb[(hash_size + 3520)].cint = 0;
2628 for (k = dimen_base; k <= eqtb_size; k++) eqtb[k].cint = 0;
2629 /* hash_used = 10014; */ /* hash_used = frozen_control_sequence */
2630 /* frozen_control_sequence = hashsize + hashbase p.222 */
2631 /* hash_used = (hash_size + 514); */
2632 hash_used = (hash_size + hash_extra + 514); /* 96/Jan/10 */
2634 if (trace_flag) show_line("itex cs_count = 0 ", 0); /* debugging */
2635 /* eq_type(frozen_dont_expand) <- dont_expand; */
2636 /* eqtb[10023].hh.b0 = 116; */
2637 /* eqtb[(hash_size + 523)].hh.b0 = 116; */
2638 eqtb[(hash_size + hash_extra + 523)].hh.b0 = dont_expand;
2639 /* hash[(hash_size + 523)].v.RH = 499; */
2640 hash[(hash_size + hash_extra + 523)].v.RH = 499; /* notexpanded */
2641 /* @<Initialize table...@>= l.10750 */
2642 font_ptr = 0; /* font_ptr:=null_font; */
2643 fmem_ptr = 7; /* fmem_ptr:=7; */
2644 font_name[0] = 795; /* nullfont */
2645 font_area[0] = 335; /* "" */
2646 hyphen_char[0] = 45; /* - */
2648 /* ************************************************************************ */
2649 /* bchar_label[null_font]:=non_address; */ /* 3.14159 */
2650 /* bchar_label[0]= font_mem_size; */ /* OK ? 93/Nov/26 */
2651 bchar_label[0]= non_address; /* i.e. 0 --- 96/Jan/16 */
2652 /* ************************************************************************ */
2653 font_bchar[0] = 256; /* font_bchar[null_font]:=non_char; */
2654 font_false_bchar[0] = 256; /* font_false_bchar[null_font]:=non_char; */
2664 lig_kern_base[0] = 0;
2670 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2671 reset_trie(); /* shared 93/Nov/26 */
2672 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2673 /* {register integer for_end; k = 0; for_end = 6; if (k <= for_end) do
2674 font_info[k].cint = 0;
2675 while(k++ < for_end); }
2676 {register integer for_end; k = - (integer) trie_op_size; for_end =
2677 trie_op_size; if (k <= for_end) do
2679 while(k++ < for_end); }
2680 {register integer for_end; k = 0; for_end = 255; if (k <= for_end) do
2681 trie_used[k]= min_trie_op;
2682 while(k++ < for_end); }
2683 max_op_used = min_trie_op;
2685 trie_not_ready = true;
2689 /* text(frozen_protection):="inaccessible"; */
2690 /* hash[10014].v.RH = 1183; */
2691 /* hash[(hash_size + 514)].v.RH = 1184; */
2692 hash[(hash_size + hash_extra + 514)].v.RH = 1184; /* 1183 */
2693 format_ident = 1251; /* 1250 */
2694 /* hash[(hash_size + 522)].v.RH = 1290; */ /* 1288 */
2695 hash[(hash_size + hash_extra + 522)].v.RH = 1290; /* 1288 */
2696 /* eqtb[(hash_size + 522)].hh.b1 = 1; */
2697 eqtb[(hash_size + hash_extra + 522)].hh.b1 = 1;
2698 /* eqtb[(hash_size + 522)].hh.b0 = 113; */
2699 eqtb[(hash_size + hash_extra + 522)].hh.b0 = 113;
2700 /* eqtb[(hash_size + 522)].hh.v.RH = 0; */
2701 eqtb[(hash_size + hash_extra + 522)].hh.v.RH = 0;
2706 /* starts string pool with strings for 256 chars and then reads tex.pool */
2707 /* adjusted to try both "tex.pool" and "tex.poo" 95/Feb/19 */
2708 /* I have added a texpool file, but I need merge the pool to the binary */
2709 /* lots of things updates the kpathsea sources -- Clerk Ma */
2710 bool get_strings_started (void)
2712 register bool Result;
2718 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2719 int flag; /* 95/Feb/19 */
2720 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2725 register integer for_end;
2730 if (((k < 32)||(k > 126))) {
2734 append_char(k + 64);
2736 append_char(k - 64);
2740 str_pool[pool_ptr] = l + 48; /* '0' */
2743 str_pool[pool_ptr] = l + 87; /* 'a' - 10 */
2748 str_pool[pool_ptr] = l + 48; /* '0' */
2751 str_pool[pool_ptr] = l + 87; /* 'a' - 10 */
2755 } else append_char(k);
2757 } while(k++ < for_end);
2759 vstrcpy((char *) name_of_file + 1, pool_name);
2760 name_of_file[0] = ' ';
2761 name_of_file[strlen(pool_name) + 1] = ' ';
2762 name_length = strlen(pool_name);
2763 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2764 /* if (a_open_in(pool_file, TEXPOOLPATH)) */
2765 flag = a_open_in(pool_file, TEXPOOLPATH);
2766 if (flag == 0) { /* 95/Feb/19 */
2767 pool_name [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */
2768 vstrcpy((char *) name_of_file + 1, pool_name);
2769 name_of_file[0]= ' ';
2770 name_of_file[strlen(pool_name)+ 1]= ' ';
2771 name_length = strlen(pool_name);
2772 flag = a_open_in(pool_file, TEXPOOLPATH);
2778 /* if (eof(pool_file)) */ /* feof(pool_file)??? */
2779 if (test_eof(pool_file)) {
2781 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2782 show_line("! string pool file has no check sum.\n", 1);
2783 /* added following bit of explanation 96/Jan/16 */
2785 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2786 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2787 (void) a_close(pool_file);
2793 if (m == '*') /* last line starts with * */
2798 if ((xord[n]< 48)||(xord[n]> 57)) {
2800 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2801 show_line("! string pool file check sum doesn't have nine digits.\n", 1);
2802 /* added following bit of explanation 96/Jan/16 */
2804 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2805 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2806 (void) a_close(pool_file);
2810 a = 10 * a + xord[n]- 48;
2816 /* tex.pool file check sum *367403084 */
2818 if (a != BEGINFMTCHECKSUM) {
2820 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2821 show_line("! string pool check sum doesn't match; tangle me again.\n", 1);
2822 /* added following bit of explanation 96/Jan/16 */
2824 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2825 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2826 (void) a_close(pool_file);
2832 if ((xord[m] < 48)||(xord[m] > 57)||(xord[n] < 48)||(xord[n] > 57))
2835 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2836 show_line("! string pool line doesn't begin with two digits.\n", 1);
2837 /* added following bit of explanation 96/Jan/16 */
2839 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2840 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2841 (void) a_close(pool_file);
2845 l = xord[m]* 10 + xord[n]- 48 * 11;
2846 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2847 #ifdef ALLOCATESTRING
2848 /* can freely extend memory, so we need not be paranoid - stringvacancies */
2849 /* if (pool_ptr + l + stringvacancies > current_pool_size)*/
2850 if (pool_ptr + l + stringmargin > current_pool_size) {
2852 show_line("String margin reallocation\n", 0);
2853 /* str_pool = realloc_str_pool (pool_ptr + l + stringvacancies */
2854 str_pool = realloc_str_pool (pool_ptr + l + stringmargin - current_pool_size + increment_pool_size);
2856 if (pool_ptr + l + stringmargin > current_pool_size) /* 94/Jan/24 */
2858 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2859 if (pool_ptr + l + stringvacancies > pool_size)
2863 show_line("! You have to increase POOLSIZE.\n", 1);
2864 (void) a_close(pool_file);
2869 register integer for_end;
2874 if (eoln(pool_file))
2876 else read(pool_file, m);
2878 str_pool[pool_ptr] = xord[m];
2881 } while(k++ < for_end);
2883 readln(pool_file); /* flush rest to end of file / end of line */
2888 (void) a_close(pool_file);
2892 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2893 sprintf(log_line, "! I can't read %s.\n", pool_name);
2894 show_line(log_line, 1);
2896 show_line(" (Was unable to find tex.poo or tex.pool)\n", 0); /* extra explain */
2897 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2906 void sort_avail (void)
2910 p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */
2912 rlink(rover) = empty_flag;
2914 while (p != old_rover)
2922 while (rlink(q) < p)
2925 rlink(p) = rlink(q);
2930 while (rlink(p) != empty_flag) {
2931 llink(rlink(p)) = p;
2934 mem[p + 1].hh.v.RH = rover;
2940 /*****************APTEX********************/
2942 str_number make_string_pool (char *s)
2944 while (*s != '\0') {
2945 append_char(*s); incr(s);
2947 return (make_string());
2949 void primitive_s (char * s, quarterword c, halfword o)
2953 str_number prim_str;
2955 cur_val = s[0] + single_base;
2957 prim_str = make_string_pool(s);
2958 k = str_start[prim_str]; l = str_start[prim_str] - k;
2959 for (j = 0; j < l; incr(j)) buffer[j] = str_pool[k + j];
2960 cur_val = id_lookup(0, l);
2962 hash[cur_val].v.RH = prim_str;
2964 eq_level(cur_val) = level_one; eq_type(cur_val) = c; equiv(cur_val) = o;
2967 /*****************APTEX********************/
2968 void primitive_ (str_number s, quarterword c, halfword o)
2972 /* small_number l; */
2973 int l; /* 95/Jan/7 */
2975 cur_val = s + 257; /* cur_val <- s + single_base; p.264 */
2978 l = str_start[s + 1] - k; /* small_number l */
2980 register integer for_end;
2984 do buffer[j]= str_pool[k + j];
2985 while(j++ < for_end);
2987 cur_val = id_lookup(0, l);
2989 /* ********************** debugging only 96/Jan/20 should not happen */
2992 show_line("ERROR: hash entry too large\n", 1);
2994 hash[cur_val].v.RH = s;
2996 eqtb[cur_val].hh.b1 = 1;
2997 eqtb[cur_val].hh.b0 = c;
2998 eqtb[cur_val].hh.v.RH = o;
3002 /* more weird constants ? page 394 */
3005 trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
3007 register trie_op_code Result;
3011 /* the 313, 361 and 1009 are hard-wired constants here p.944 */
3012 /* begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) */
3013 h = abs(toint(n) + 313 * toint(d) + 361 * toint(v) + 1009 *
3014 toint(cur_lang)) % (trie_op_size - neg_trie_op_size) + neg_trie_op_size;
3016 /* if l=0 then {empty position found for a new op} */
3017 l = trie_op_hash[h];
3019 if (trie_op_ptr == trie_op_size) {
3020 overflow("pattern memory ops", trie_op_size); /* pattern memory ops - NOT DYNAMIC */
3021 return 0; // abort_flag set
3023 u = trie_used[cur_lang];
3024 /* if u=max_quarterword then ??? */
3025 if (u == max_trie_op) {
3026 /* overflow("pattern memory ops per language", max_quarterword-min_quarterword); ??? */
3027 overflow("pattern memory ops per language", max_trie_op - min_trie_op); /* pattern memory ops per language */
3028 return 0; // abort_flag set
3032 trie_used[cur_lang] = u;
3033 if (u > max_op_used)
3035 hyf_distance[trie_op_ptr] = d;
3036 hyf_num[trie_op_ptr] = n;
3037 hyf_next[trie_op_ptr] = v;
3038 trie_op_lang[trie_op_ptr] = cur_lang;
3039 trie_op_hash[h] = trie_op_ptr;
3040 trie_op_val[trie_op_ptr] = u;
3044 if ((hyf_distance[l]== d) && (hyf_num[l]== n) &&
3045 (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang)) {
3046 Result = trie_op_val[l];
3049 if (h > - (integer) trie_op_size)
3051 else h = trie_op_size;
3053 /* return Result; */ /* unreachable code */
3055 /* what are those horrible constants there ? page 395 */
3056 trie_pointer trie_node_ (trie_pointer p)
3058 register trie_pointer Result;
3061 /* the 1009, 2718, 3142 are hard-wired constants here (not hyphen_prime) */
3062 h = abs(toint(trie_c[p]) + 1009 * toint(trie_o[p]) + 2718 *
3063 toint(trie_l[p]) + 3142 * toint(trie_r[p])) % trie_size;
3071 if ((trie_c[q] == trie_c[p]) && (trie_o[q] == trie_o[p]) &&
3072 (trie_l[q]== trie_l[p]) && (trie_r[q]== trie_r[p])) {
3080 /* return Result; */ /* unreachable code */
3082 trie_pointer compress_trie_ (trie_pointer p)
3084 register trie_pointer Result;
3088 trie_l[p] = compress_trie(trie_l[p]);
3089 trie_r[p] = compress_trie(trie_r[p]);
3090 Result = trie_node(p);
3094 void first_fit_ (trie_pointer p)
3106 if (trie_max < h + 256) {
3107 if (trie_size <= h + 256) {
3108 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3109 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3110 return; // abort_flag set
3114 trie_taken[trie_max]= false;
3115 trie_trl[trie_max]= trie_max + 1;
3116 trie_tro[trie_max]= trie_max - 1;
3117 } while (!(trie_max == h + 256));
3123 if (trie_trl[h + trie_c[q]] == 0)
3132 trie_taken[h] = true; /* h may be used without ... */
3144 ll = z; /* short ll */
3150 } while (!(l == ll));
3153 } while (!(q == 0));
3155 void trie_pack_ (trie_pointer p)
3160 if ((q > 0)&&(trie_hash[q]== 0))
3168 void trie_fix_ (trie_pointer p)
3177 trie_trl[z + c]= trie_hash[q];
3179 trie_tro[z + c]= trie_o[p];
3185 void new_patterns (void)
3187 /* ******************************************************************* */
3188 /* was small_number k, l; in 3.141 */
3190 /* ******************************************************************* */
3196 int c; /* 95/Jan/7 */
3197 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3198 if (!trie_not_ready) { /* new stuff */
3199 if (allow_patterns) {
3200 if (trace_flag) show_line("Resetting patterns\n", 0);
3201 reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
3202 if (reset_exceptions) {
3203 if (trace_flag) show_line("Resetting exceptions\n", 0);
3204 reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
3208 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3209 if (trie_not_ready) {
3212 else if (language > 255)
3214 else cur_lang = language;
3218 digitsensed = false;
3224 if (digitsensed || (cur_chr < 48) || (cur_chr > 57)) {
3228 cur_chr = eqtb[(hash_size + 2139) + cur_chr].hh.v.RH;
3230 print_err("Nonletter");
3231 help1("(See Appendix H.)");
3239 digitsensed = false;
3241 } else if (k < 63) {
3242 hyf[k] = cur_chr - 48;
3258 v = new_trie_op(k - l, hyf[l], v);
3272 while ((p > 0) && (c > trie_c[p])) {
3277 if ((p == 0) || (c < trie_c[p])) {
3278 if (trie_ptr == trie_size) {
3279 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3280 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3281 return; // abort_flag set
3284 trie_r[trie_ptr] = p;
3291 trie_o[p] = min_trie_op;
3295 if (trie_o[q]!= min_trie_op) {
3296 print_err("Duplicate pattern");
3297 help1("(See Appendix H.)");
3306 digitsensed = false;
3312 print_esc("patterns");
3313 help1("(See Appendix H.)");
3321 print_err("Too late for ");
3322 print_esc("patterns");
3323 help1("All patterns must be given before typesetting begins.");
3325 mem[lig_trick].hh.v.RH = scan_toks(false, false);
3326 flush_list(def_ref);
3329 void init_trie (void)
3332 /* integer j, k, t; */
3334 int t; /* 95/Jan/7 */
3336 op_start[0]= - (integer) min_trie_op;
3338 register integer for_end;
3341 if (j <= for_end) do
3342 op_start[j]= op_start[j - 1]+ trie_used[j - 1];
3343 while(j++ < for_end);
3346 register integer for_end;
3348 for_end = trie_op_ptr;
3351 trie_op_hash[j]= op_start[trie_op_lang[j]] + trie_op_val[j];
3352 while(j++ < for_end);
3355 register integer for_end;
3357 for_end = trie_op_ptr;
3360 while(trie_op_hash[j]> j){
3361 k = trie_op_hash[j];
3362 t = hyf_distance[k];
3363 hyf_distance[k]= hyf_distance[j];
3366 hyf_num[k]= hyf_num[j];
3369 hyf_next[k]= hyf_next[j];
3371 trie_op_hash[j]= trie_op_hash[k];
3374 while(j++ < for_end);
3377 register integer for_end;
3379 for_end = trie_size;
3382 while(p++ < for_end);
3384 trie_l[0]= compress_trie(trie_l[0]);
3386 register integer for_end;
3391 while(p++ < for_end);
3394 register integer for_end;
3397 if (p <= for_end) do
3399 while(p++ < for_end);
3405 first_fit(trie_l[0]);
3406 trie_pack(trie_l[0]);
3411 register integer for_end;
3414 if (r <= for_end) do
3417 trie_tro[r]= min_trie_op;
3420 while(r++ < for_end);
3425 trie_fix(trie_l[0]);
3431 trie_tro[r]= min_trie_op;
3435 } while(!(r > trie_max));
3438 trie_not_ready = false;
3443 void store_fmt_file (void)
3448 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3449 if (!is_initex) { /* redundant check 94/Feb/14 */
3450 show_line("! \\dump is performed only by INITEX\n", 1);
3452 show_line(" (Use -i on the command line)\n", 0);
3456 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3457 if (save_ptr != 0) {
3458 print_err("You can't dump inside a group");
3459 help1("`{...\\dump}' is a no-no..");
3461 } /* end of if save_ptr != 0 */
3464 print_string(" (format=");
3473 if (interaction == 0) selector = 18;
3476 #ifdef ALLOCATESTRING
3477 if (pool_ptr + 1 > current_pool_size)
3478 str_pool = realloc_str_pool (increment_pool_size);
3479 if (pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */
3480 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */
3481 return; // abort_flag set
3484 if (pool_ptr + 1 > pool_size) {
3485 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
3486 return; // abort_flag set
3490 format_ident = make_string();
3491 pack_job_name(780); /* .fmt */
3492 while(! w_open_out(fmt_file)) {
3493 prompt_file_name(1267, 780); /* format file name .fmt */
3495 print_nl(" Beginning to dump on file ");
3496 slow_print(w_make_name_string(fmt_file));
3499 slow_print(format_ident);
3500 dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
3504 dump_int((hash_size + 4006)); /* eqtbsize */
3505 dump_int(hash_prime);
3506 /* dump_int(607); */
3507 dump_int(hyphen_prime); /* bkph */
3510 if (dumpthings(str_start[0], str_ptr + 1)) return;
3511 if (dumpthings(str_pool[0], pool_ptr)) return;
3514 print_string(" strings of total length ");
3515 print_int(pool_ptr);
3518 dump_int(lo_mem_max);
3524 if (dumpthings(mem[p], q + 2 - p))
3527 var_used = var_used + q - p;
3528 p = q + mem[q].hh.v.LH;
3529 q = mem[q + 1].hh.v.RH;
3530 } while (!(q == rover));
3531 var_used = var_used + lo_mem_max - p;
3532 dyn_used = mem_end + 1 - hi_mem_min;
3533 if (dumpthings(mem[p], lo_mem_max + 1 - p)) return;
3534 x = x + lo_mem_max + 1 - p;
3535 dump_int(hi_mem_min);
3537 if (dumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)) return;
3538 x = x + mem_end + 1 - hi_mem_min;
3548 print_string(" memory locations dumped; current usage is ");
3549 print_int(var_used);
3551 print_int(dyn_used);
3555 while(j < (hash_size + 3162)) {
3556 if ((eqtb[j].hh.v.RH == eqtb[j + 1].hh.v.RH) &&
3557 (eqtb[j].hh.b0 == eqtb[j + 1].hh.b0) &&
3558 (eqtb[j].hh.b1 == eqtb[j + 1].hh.b1))
3562 l = (hash_size + 3163);
3567 while (j < (hash_size + 3162)) {
3568 if ((eqtb[j].hh.v.RH != eqtb[j + 1].hh.v.RH) ||
3569 (eqtb[j].hh.b0 != eqtb[j + 1].hh.b0) ||
3570 (eqtb[j].hh.b1 != eqtb[j + 1].hh.b1))
3576 if (dumpthings(eqtb[k], l - k)) return;
3579 } while (!(k == (hash_size + 3163)));
3582 while (j < (hash_size + 4006)) {
3583 if (eqtb[j].cint == eqtb[j + 1].cint)
3587 l = (hash_size + 4007);
3592 while (j < (hash_size + 4006)) {
3593 if (eqtb[j].cint != eqtb[j + 1].cint)
3599 if (dumpthings(eqtb[k], l - k)) return;
3602 } while (!(k > (hash_size + 4006)));
3604 dump_int(write_loc);
3605 dump_int(hash_used);
3606 /* cs_count:=frozen_control_sequence-1-hash_used; */
3607 /* cs_count = (hash_size + 513) - hash_used; */
3608 cs_count = (hash_size + hash_extra + 513) - hash_used;
3609 /* cs_count = (hash_size + 780) - hash_used; */ /* ??? */
3611 sprintf(log_line, "itex cs_count %d hash_size %d hash_extra %d hash_used %d",
3612 cs_count, hash_size, hash_extra, hash_used); /* debugging */
3613 show_line(log_line, 0);
3615 /* for p <- hash_base to hash_used do */
3617 register integer for_end;
3619 for_end = hash_used;
3620 if (p <= for_end) do
3621 if (hash[p].v.RH != 0) {
3626 sprintf(log_line, "itex cs_count++ ");
3627 show_line(log_line, 0); /* debugging */
3629 } while (p++ < for_end);
3632 /* for p <- hash_used+1 to undefined_control_sequence-1 do dump_hh(hash[p]) */
3633 if (dumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)) return;
3636 print_int(cs_count);
3637 print_string(" multiletter control sequences");
3640 if (dumpthings(font_info[0], fmem_ptr)) return;
3641 /* frozenfontptr = font_ptr; */ /* number of fonts frozen into format */
3643 if (dumpthings(font_check[0], font_ptr + 1)) return;
3644 if (dumpthings(font_size[0], font_ptr + 1)) return;
3645 if (dumpthings(font_dsize[0], font_ptr + 1)) return;
3646 if (dumpthings(font_params[0], font_ptr + 1)) return;
3647 if (dumpthings(hyphen_char[0], font_ptr + 1)) return;
3648 if (dumpthings(skew_char[0], font_ptr + 1)) return;
3649 if (dumpthings(font_name[0], font_ptr + 1)) return;
3650 if (dumpthings(font_area[0], font_ptr + 1)) return;
3651 if (dumpthings(font_bc[0], font_ptr + 1)) return;
3652 if (dumpthings(font_ec[0], font_ptr + 1)) return;
3653 if (dumpthings(char_base[0], font_ptr + 1)) return;
3654 if (dumpthings(width_base[0], font_ptr + 1)) return;
3655 if (dumpthings(height_base[0], font_ptr + 1)) return;
3656 if (dumpthings(depth_base[0], font_ptr + 1)) return;
3657 if (dumpthings(italic_base[0], font_ptr + 1)) return;
3658 if (dumpthings(lig_kern_base[0], font_ptr + 1)) return;
3659 if (dumpthings(kern_base[0], font_ptr + 1)) return;
3660 if (dumpthings(exten_base[0], font_ptr + 1)) return;
3661 if (dumpthings(param_base[0], font_ptr + 1)) return;
3662 if (dumpthings(font_glue[0], font_ptr + 1)) return;
3663 if (dumpthings(bchar_label[0], font_ptr + 1)) return;
3664 if (dumpthings(font_bchar[0], font_ptr + 1)) return;
3665 if (dumpthings(font_false_bchar[0], font_ptr + 1)) return;
3667 register integer for_end;
3673 /* print_esc(hash[(hash_size + 524) + k].v.RH); */
3674 //print_esc(hash[(hash_size + hash_extra + 524) + k].v.RH);
3675 print_esc("");print(hash[(hash_size + hash_extra + 524) + k].v.RH);
3677 print_file_name(font_name[k], font_area[k], 335);
3678 if (font_size[k]!= font_dsize[k]) {
3679 print_string(" at ");
3680 print_scaled(font_size[k]);
3683 } while (k++ < for_end);
3687 print_int(fmem_ptr - 7);
3688 print_string(" words of font info for ");
3689 print_int(font_ptr - 0);
3690 print_string(" preloaded font");
3693 dump_int(hyph_count);
3694 /* {register integer for_end; k = 0; for_end = 607; if (k <= for_end) do */
3696 register integer for_end;
3698 for_end = hyphen_prime;
3699 if (k <= for_end) do
3700 if (hyph_word[k]!= 0)
3703 dump_int(hyph_word[k]);
3704 dump_int(hyph_list[k]);
3705 } while(k++ < for_end);
3708 print_int(hyph_count);
3709 print_string(" hyphenation exception");
3710 if (hyph_count != 1)
3715 if (dumpthings(trie_trl[0], trie_max + 1)) return;
3716 if (dumpthings(trie_tro[0], trie_max + 1)) return;
3717 if (dumpthings(trie_trc[0], trie_max + 1)) return;
3718 dump_int(trie_op_ptr);
3719 if (dumpthings(hyf_distance[1], trie_op_ptr)) return;
3720 if (dumpthings(hyf_num[1], trie_op_ptr)) return;
3721 if (dumpthings(hyf_next[1], trie_op_ptr)) return;
3722 print_nl("Hyphenation trie of length ");
3723 print_int(trie_max);
3724 print_string(" has ");
3725 print_int(trie_op_ptr);
3726 print_string(" op");
3727 if (trie_op_ptr != 1)
3729 print_string(" out of ");
3730 print_int(trie_op_size);
3732 register integer for_end;
3735 if (k >= for_end) do
3736 if (trie_used[k]> 0)
3739 print_int(trie_used[k]);
3740 print_string(" for language ");
3743 dump_int(trie_used[k]);
3744 } while(k-- > for_end);
3746 dump_int(interaction);
3747 dump_int(format_ident);
3748 dump_int(ENDFMTCHECKSUM); /* magic checksum end of FMT file --- change ??? */
3752 } /* end of store_fmt_file */
3756 void init_prim (void)
3758 no_new_control_sequence = false;
3759 //primitive_s("lineskip", assign_glue, glue_base + line_skip_code);
3760 primitive(373, assign_glue, glue_base + line_skip_code); /* lineskip */
3761 primitive(374, assign_glue, glue_base + baseline_skip_code); /* baselineskip */
3762 primitive(375, assign_glue, glue_base + par_skip_code); /* parskip */
3763 primitive(376, assign_glue, glue_base + above_display_skip_code); /* abovedisplayskip */
3764 primitive(377, assign_glue, glue_base + below_display_skip_code); /* belowdisplayskip */
3765 primitive(378, assign_glue, glue_base + above_display_short_skip_code); /* abovedisplayshortskip */
3766 primitive(379, assign_glue, glue_base + below_display_short_skip_code); /* belowdisplayshortskip */
3767 primitive(380, assign_glue, glue_base + left_skip_code); /* leftskip */
3768 primitive(381, assign_glue, glue_base + right_skip_code); /* rightskip */
3769 primitive(382, assign_glue, glue_base + top_skip_code); /* topskip */
3770 primitive(383, assign_glue, glue_base + split_top_skip_code); /* splittopskip */
3771 primitive(384, assign_glue, glue_base + tab_skip_code); /* tabskip */
3772 primitive(385, assign_glue, glue_base + space_skip_code); /* spaceskip */
3773 primitive(386, assign_glue, glue_base + xspace_skip_code); /* xspaceskip */
3774 primitive(387, assign_glue, glue_base + par_fill_skip_code); /* parfillskip */
3775 primitive(388, assign_mu_glue, glue_base + thin_mu_skip_code); /* thinmuskip */
3776 primitive(389, assign_mu_glue, glue_base + med_mu_skip_code); /* medmuskip */
3777 primitive(390, assign_mu_glue, glue_base + thick_mu_skip_code); /* thickmuskip */
3778 primitive(395, assign_toks, output_routine_loc); /* output */
3779 primitive(396, assign_toks, every_par_loc); /* everypar */
3780 primitive(397, assign_toks, every_math_loc); /* everymath */
3781 primitive(398, assign_toks, every_display_loc); /* everydisplay */
3782 primitive(399, assign_toks, every_hbox_loc); /* everyhbox */
3783 primitive(400, assign_toks, every_vbox_loc); /* everyvbox */
3784 primitive(401, assign_toks, every_job_loc); /* everyjob */
3785 primitive(402, assign_toks, every_cr_loc); /* everycr */
3786 primitive(403, assign_toks, err_help_loc); /* errhelp */
3787 primitive(417, assign_int, int_base + pretolerance_code); /* pretolerance */
3788 primitive(418, assign_int, int_base + tolerance_code); /* tolerance */
3789 primitive(419, assign_int, int_base + line_penalty_code); /* linepenalty */
3790 primitive(420, assign_int, int_base + hyphen_penalty_code); /* hyphenpenalty */
3791 primitive(421, assign_int, int_base + ex_hyphen_penalty_code); /* exhyphenpenalty */
3792 primitive(422, assign_int, int_base + club_penalty_code); /* clubpenalty */
3793 primitive(423, assign_int, int_base + widow_penalty_code); /* widowpenalty */
3794 primitive(424, assign_int, int_base + display_widow_penalty_code); /* displaywidowpenalty */
3795 primitive(425, assign_int, int_base + broken_penalty_code); /* brokenpenalty */
3796 primitive(426, assign_int, int_base + bin_op_penalty_code); /* binoppenalty */
3797 primitive(427, assign_int, int_base + rel_penalty_code); /* relpenalty */
3798 primitive(428, assign_int, int_base + pre_display_penalty_code); /* predisplaypenalty */
3799 primitive(429, assign_int, int_base + post_display_penalty_code); /* postdisplaypenalty */
3800 primitive(430, assign_int, int_base + inter_line_penalty_code); /* interlinepenalty */
3801 primitive(431, assign_int, int_base + double_hyphen_demerits_code); /* doublehyphendemerits */
3802 primitive(432, assign_int, int_base + final_hyphen_demerits_code); /* finalhyphendemerits */
3803 primitive(433, assign_int, int_base + adj_demerits_code); /* adjdemerits */
3804 primitive(434, assign_int, int_base + mag_code); /* mag */
3805 primitive(435, assign_int, int_base + delimiter_factor_code); /* delimiterfactor */
3806 primitive(436, assign_int, int_base + looseness_code); /* looseness */
3807 primitive(437, assign_int, int_base + time_code); /* time */
3808 primitive(438, assign_int, int_base + day_code); /* day */
3809 primitive(439, assign_int, int_base + month_code); /* month */
3810 primitive(440, assign_int, int_base + year_code); /* year */
3811 primitive(441, assign_int, int_base + show_box_breadth_code); /* showboxbreadth */
3812 primitive(442, assign_int, int_base + show_box_depth_code); /* showboxdepth */
3813 primitive(443, assign_int, int_base + hbadness_code); /* hbadness */
3814 primitive(444, assign_int, int_base + vbadness_code); /* vbadness */
3815 primitive(445, assign_int, int_base + pausing_code); /* pausing */
3816 primitive(446, assign_int, int_base + tracing_online_code); /* tracingonline */
3817 primitive(447, assign_int, int_base + tracing_macros_code); /* tracingmacros */
3818 primitive(448, assign_int, int_base + tracing_stats_code); /* tracingstats */
3819 primitive(449, assign_int, int_base + tracing_paragraphs_code); /* tracingparagraphs */
3820 primitive(450, assign_int, int_base + tracing_pages_code); /* tracingpages */
3821 primitive(451, assign_int, int_base + tracing_output_code); /* tracingoutput */
3822 primitive(452, assign_int, int_base + tracing_lost_chars_code); /* tracinglostchars */
3823 primitive(453, assign_int, int_base + tracing_commands_code); /* tracingcommands */
3824 primitive(454, assign_int, int_base + tracing_restores_code); /* tracingrestores */
3825 primitive(455, assign_int, int_base + uc_hyph_code); /* uchyph */
3826 primitive(456, assign_int, int_base + output_penalty_code); /* outputpenalty */
3827 primitive(457, assign_int, int_base + max_dead_cycles_code); /* maxdeadcycles */
3828 primitive(458, assign_int, int_base + hang_after_code); /* hangafter */
3829 primitive(459, assign_int, int_base + floating_penalty_code); /* floatingpenalty */
3830 primitive(460, assign_int, int_base + global_defs_code); /* globaldefs */
3831 primitive(461, assign_int, int_base + cur_fam_code); /* fam */
3832 primitive(462, assign_int, int_base + escape_char_code); /* escapechar */
3833 primitive(463, assign_int, int_base + default_hyphen_char_code); /* defaulthyphenchar */
3834 primitive(464, assign_int, int_base + default_skew_char_code); /* defaultskewchar */
3835 primitive(465, assign_int, int_base + end_line_char_code); /* endlinechar */
3836 primitive(466, assign_int, int_base + new_line_char_code); /* newlinechar */
3837 primitive(467, assign_int, int_base + language_code); /* language */
3838 primitive(468, assign_int, int_base + left_hyphen_min_code); /* lefthyphenmin */
3839 primitive(469, assign_int, int_base + right_hyphen_min_code); /* righthyphenmin */
3840 primitive(470, assign_int, int_base + holding_inserts_code); /* holdinginserts */
3841 primitive(471, assign_int, int_base + error_context_lines_code); /* errorcontextlines */
3842 primitive(475, assign_dimen, dimen_base + par_indent_code); /* parindent */
3843 primitive(476, assign_dimen, dimen_base + math_surround_code); /* mathsurround */
3844 primitive(477, assign_dimen, dimen_base + line_skip_limit_code); /* lineskiplimit */
3845 primitive(478, assign_dimen, dimen_base + hsize_code); /* hsize */
3846 primitive(479, assign_dimen, dimen_base + vsize_code); /* vsize */
3847 primitive(480, assign_dimen, dimen_base + max_depth_code); /* maxdepth */
3848 primitive(481, assign_dimen, dimen_base + split_max_depth_code); /* splitmaxdepth */
3849 primitive(482, assign_dimen, dimen_base + box_max_depth_code); /* boxmaxdepth */
3850 primitive(483, assign_dimen, dimen_base + hfuzz_code); /* hfuzz */
3851 primitive(484, assign_dimen, dimen_base + vfuzz_code); /* vfuzz */
3852 primitive(485, assign_dimen, dimen_base + delimiter_shortfall_code); /* delimitershortfall */
3853 primitive(486, assign_dimen, dimen_base + null_delimiter_space_code); /* nulldelimiterspace */
3854 primitive(487, assign_dimen, dimen_base + script_space_code); /* scriptspace */
3855 primitive(488, assign_dimen, dimen_base + pre_display_size_code); /* predisplaysize */
3856 primitive(489, assign_dimen, dimen_base + display_width_code); /* displaywidth */
3857 primitive(490, assign_dimen, dimen_base + display_indent_code); /* displayindent */
3858 primitive(491, assign_dimen, dimen_base + overfull_rule_code); /* overfullrule */
3859 primitive(492, assign_dimen, dimen_base + hang_indent_code); /* hangindent */
3860 primitive(493, assign_dimen, dimen_base + h_offset_code); /* hoffset */
3861 primitive(494, assign_dimen, dimen_base + v_offset_code); /* voffset */
3862 primitive(495, assign_dimen, dimen_base + emergency_stretch_code); /* emergencystretch */
3863 primitive(32, ex_space, 0); /* */
3864 primitive(47, ital_corr, 0); /* / */
3865 primitive(505, accent, 0); /* accent */
3866 primitive(506, advance, 0); /* advance */
3867 primitive(507, after_assignment, 0); /* afterassignment */
3868 primitive(508, after_group, 0); /* aftergroup */
3869 primitive(509, begin_group, 0); /* begingroup */
3870 primitive(510, char_num, 0); /* char */
3871 primitive(501, cs_name, 0); /* csname */
3872 primitive(511, delim_num, 0); /* delimiter */
3873 primitive(512, divide, 0); /* divide */
3874 primitive(502, end_cs_name, 0); /* endcsname */
3875 primitive(513, end_group, 0); /* endgroup */
3876 /* hash[(hash_size + 516)].v.RH = 513; */
3877 hash[(hash_size + hash_extra + 516)].v.RH = 513; /* endgroup */
3878 /* eqtb[(hash_size + 516)]= eqtb[cur_val]; */
3879 eqtb[(hash_size + hash_extra + 516)]= eqtb[cur_val];
3880 primitive(514, expand_after, 0); /* expandafter */
3881 primitive(515, def_font, 0); /* font */
3882 primitive(516, assign_font_dimen, 0); /* fontdimen */
3883 primitive(517, halign, 0); /* halign */
3884 primitive(518, hrule, 0); /* hrule */
3885 primitive(519, ignore_spaces, 0); /* ignorespaces */
3886 primitive(327, insert, 0); /* insert */
3887 primitive(348, mark, 0); /* mark */
3888 primitive(520, math_accent, 0); /* mathaccent */
3889 primitive(521, math_char_num, 0); /* mathchar */
3890 primitive(522, math_choice, 0); /* mathchoice */
3891 primitive(523, multiply, 0); /* multiply */
3892 primitive(524, no_align, 0); /* noalign */
3893 primitive(525, no_boundary, 0); /* noboundary */
3894 primitive(526, no_expand, 0); /* noexpand */
3895 primitive(332, non_script, 0); /* nonscript */
3896 primitive(527, omit, 0); /* omit */
3897 primitive(405, set_shape, 0); /* parshape */
3898 primitive(528, break_penalty, 0); /* penalty */
3899 primitive(529, set_prev_graf, 0); /* prevgraf */
3900 primitive(530, radical, 0); /* radical */
3901 primitive(531, read_to_cs, 0); /* read */
3902 primitive(532, relax, 256); /* primitive("relax",relax,256); */
3903 /* hash[(hash_size + 521)].v.RH = 532; */
3904 hash[(hash_size + hash_extra + 521)].v.RH = 532; /* read */
3905 /* eqtb[(hash_size + 521)]= eqtb[cur_val]; */
3906 eqtb[(hash_size + hash_extra + 521)]= eqtb[cur_val];
3907 primitive(533, set_box, 0); /* setbox */
3908 primitive(534, the, 0); /* the */
3909 primitive(404, toks_register, 0); /* toks */
3910 primitive(349, vadjust, 0); /* vadjust */
3911 primitive(535, valign, 0); /* valign */
3912 primitive(536, vcenter, 0); /* vcenter */
3913 primitive(537, vrule, 0); /* vrule */
3914 primitive(594, par_end, 256); /* par */
3916 par_token = 4095 + par_loc;
3917 primitive(626, input, 0); /* input */
3918 primitive(627, input, 1); /* endinput */
3919 primitive(628, top_bot_mark, 0); /* topmark */
3920 primitive(629, top_bot_mark, 1); /* firstmark */
3921 primitive(630, top_bot_mark, 2); /* botmark */
3922 primitive(631, top_bot_mark, 3); /* splitfirstmark */
3923 primitive(632, top_bot_mark, 4); /* splitbotmark */
3924 primitive(473, tex_register, 0); /* count */
3925 primitive(497, tex_register, 1); /* dimen */
3926 primitive(392, tex_register, 2); /* skip */
3927 primitive(393, tex_register, 3); /* muskip */
3928 primitive(665, set_aux, 102); /* spacefactor */
3929 primitive(666, set_aux, 1); /* prevdepth */
3930 primitive(667, set_page_int, 0); /* dead_cycles */
3931 primitive(668, set_page_int, 1); /* insert_penalties */
3932 primitive(669, set_box_dimen, 1); /* wd */
3933 primitive(670, set_box_dimen, 3); /* ht */
3934 primitive(671, set_box_dimen, 2); /* dp */
3935 primitive(672, last_item, 0); /* last_penalty */
3936 primitive(673, last_item, 1); /* last_kern */
3937 primitive(674, last_item, 2); /* lastskip */
3938 primitive(675, last_item, 3); /* inputlineno */
3939 primitive(676, last_item, 4); /* badness */
3940 primitive(732, convert, 0); /* number */
3941 primitive(733, convert, 1); /* romannumeral */
3942 primitive(734, convert, 2); /* string */
3943 primitive(735, convert, 3); /* meaning */
3944 primitive(736, convert, 4); /* font_name */
3945 primitive(737, convert, 5); /* job_name */
3946 primitive(753, if_test, 0); /* if */
3947 primitive(754, if_test, 1); /* ifcat */
3948 primitive(755, if_test, 2); /* ifnum */
3949 primitive(756, if_test, 3); /* ifdim */
3950 primitive(757, if_test, 4); /* ifodd */
3951 primitive(758, if_test, 5); /* ifvmode */
3952 primitive(759, if_test, 6); /* ifhmode */
3953 primitive(760, if_test, 7); /* ifmmode */
3954 primitive(761, if_test, 8); /* ifinner */
3955 primitive(762, if_test, 9); /* ifvoid */
3956 primitive(763, if_test, 10); /* ifhbox */
3957 primitive(764, if_test, 11); /* ifvbox */
3958 primitive(765, if_test, 12); /* ifx */
3959 primitive(766, if_test, 13); /* ifeof */
3960 primitive(767, if_test, 14); /* iftrue */
3961 primitive(768, if_test, 15); /* iffalse */
3962 primitive(769, if_test, 16); /* ifcase */
3963 primitive(770, fi_or_else, 2); /* fi */
3964 /* hash[(hash_size + 518)].v.RH = 770; */
3965 hash[(hash_size + hash_extra + 518)].v.RH = 770; /* fi */
3966 /* eqtb[(hash_size + 518)]= eqtb[cur_val]; */
3967 eqtb[(hash_size + hash_extra + 518)]= eqtb[cur_val];
3968 primitive(771, fi_or_else, 4); /* or */
3969 primitive(772, fi_or_else, 3); /* else */
3970 primitive(795, set_font, 0); /* nullfont */
3971 /* hash[(hash_size + 524)].v.RH = 795; */ /* hash[frozen_null_font] */
3972 hash[(hash_size + hash_extra + 524)].v.RH = 795; /* nullfont */
3973 /* eqtb[(hash_size + 524)]= eqtb[cur_val]; */
3974 eqtb[(hash_size + hash_extra + 524)]= eqtb[cur_val];
3975 primitive(892, tab_mark, 256); /* span */
3976 /* primitive("span",tab_mark,span_code); */
3977 primitive(893, car_ret, 257); /* cr */
3978 /* primitive("cr",car_ret,cr_code); */
3979 /* hash[(hash_size + 515)].v.RH = 893; */
3980 hash[(hash_size + hash_extra + 515)].v.RH = 893; /* cr */
3981 /* eqtb[(hash_size + 515)]= eqtb[cur_val]; */
3982 eqtb[(hash_size + hash_extra + 515)]= eqtb[cur_val];
3983 primitive(894, car_ret, 258); /* cr cr */
3984 /* hash[(hash_size + 519)].v.RH = 895; */
3985 hash[(hash_size + hash_extra + 519)].v.RH = 895; /* endtemplate */
3986 /* hash[(hash_size + 520)].v.RH = 895; */
3987 hash[(hash_size + hash_extra + 520)].v.RH = 895; /* endtemplate */
3988 /* eqtb[(hash_size + 520)].hh.b0 = 9; */
3989 eqtb[(hash_size + hash_extra + 520)].hh.b0 = 9;
3990 /* eqtb[(hash_size + 520)].hh.v.RH = null_list; */
3991 eqtb[(hash_size + hash_extra + 520)].hh.v.RH = null_list;
3992 /* eqtb[(hash_size + 520)].hh.b1 = 1; */
3993 eqtb[(hash_size + hash_extra + 520)].hh.b1 = 1;
3994 /* eqtb[(hash_size + 519)]= eqtb[(hash_size + 520)]; */
3995 eqtb[(hash_size + hash_extra + 519)]=
3996 eqtb[(hash_size + hash_extra + 520)];
3997 /* eqtb[(hash_size + 519)].hh.b0 = 115; */
3998 eqtb[(hash_size + hash_extra + 519)].hh.b0 = 115;
3999 primitive(964, set_page_dimen, 0); /* pagegoal */
4000 primitive(965, set_page_dimen, 1); /* pagetotal */
4001 primitive(966, set_page_dimen, 2); /* pagestretch */
4002 primitive(967, set_page_dimen, 3); /* pagefilstretch */
4003 primitive(968, set_page_dimen, 4); /* pagefillstretch */
4004 primitive(969, set_page_dimen, 5); /* pagefilllstretch */
4005 primitive(970, set_page_dimen, 6); /* pageshrink */
4006 primitive(971, set_page_dimen, 7); /* pagedepth */
4007 primitive(1019, end_match, 0); /* end */
4008 primitive(1020, stop, 1); /* dump */
4009 primitive(1021, hskip, 4); /* hskip */
4010 primitive(1022, hskip, 0); /* hfil */
4011 primitive(1023, hskip, 1); /* hfill */
4012 primitive(1024, hskip, 2); /* hss */
4013 primitive(1025, hskip, 3); /* hfilneg */
4014 primitive(1026, vskip, 4); /* vskip */
4015 primitive(1027, vskip, 0); /* vfil */
4016 primitive(1028, vskip, 1); /* vfill */
4017 primitive(1029, vskip, 2); /* vss */
4018 primitive(1030, vskip, 3); /* vfilneg */
4019 primitive(333, mskip, 5); /* mskip */
4020 primitive(337, kern, 1); /* kern */
4021 primitive(339, mkern, 99); /* mkern */
4022 primitive(1048, hmove, 1); /* moveleft */
4023 primitive(1049, hmove, 0); /* moveright */
4024 primitive(1050, vmove, 1); /* raise */
4025 primitive(1051, vmove, 0); /* lower */
4026 primitive(406, make_box, 0); /* box */
4027 primitive(1052, make_box, 1); /* copy */
4028 primitive(1053, make_box, 2); /* lastbox */
4029 primitive(959, make_box, 3); /* vsplit */
4030 primitive(1054, make_box, 4); /* vtop */
4031 primitive(961, make_box, 5); /* vbox */
4032 primitive(1055, make_box, 106); /* hbox */
4033 primitive(1056, leader_ship, 99); /* ship_out */
4034 primitive(1057, leader_ship, 100); /* leaders */
4035 primitive(1058, leader_ship, 101); /* cleaders */
4036 primitive(1059, leader_ship, 102); /* xleaders */
4037 primitive(1074, start_par, 1); /* indent */
4038 primitive(1075, start_par, 0); /* noindent */
4039 primitive(1084, remove_item, 12); /* unpenalty */
4040 primitive(1085, remove_item, 11); /* unkern */
4041 primitive(1086, remove_item, 10); /* unskip */
4042 primitive(1087, un_hbox, 0); /* unhbox */
4043 primitive(1088, un_hbox, 1); /* unhcopy */
4044 primitive(1089, un_vbox, 0); /* unvbox */
4045 primitive(1090, un_vbox, 1); /* unvcopy */
4046 primitive(45, discretionary, 1); /* - */
4047 primitive(346, discretionary, 0); /* discretionary */
4048 primitive(1121, eq_no, 0); /* eqno */
4049 primitive(1122, eq_no, 1); /* leqno */
4050 primitive(860, math_comp, 16); /* mathord */
4051 primitive(861, math_comp, 17); /* mathop */
4052 primitive(862, math_comp, 18); /* mathbin */
4053 primitive(863, math_comp, 19); /* mathrel */
4054 primitive(864, math_comp, 20); /* mathopen */
4055 primitive(865, math_comp, 21); /* mathclose */
4056 primitive(866, math_comp, 22); /* mathpunct */
4057 primitive(867, math_comp, 23); /* mathinner */
4058 primitive(869, math_comp, 26); /* underline */
4059 primitive(868, math_comp, 27); /* overline */
4060 primitive(1123, limit_switch, 0); /* displaylimits */
4061 primitive(872, limit_switch, 1); /* limits */
4062 primitive(873, limit_switch, 2); /* nolimits */
4063 primitive(855, math_style, 0); /* displaystyle */
4064 primitive(856, math_style, 2); /* textstyle */
4065 primitive(857, math_style, 4); /* scriptstyle */
4066 primitive(858, math_style, 6); /* scriptscriptstyle */
4067 primitive(1141, above, 0); /* above */
4068 primitive(1142, above, 1); /* over */
4069 primitive(1143, above, 2); /* atop */
4070 primitive(1144, above, 3); /* abovewithdelims */
4071 primitive(1145, above, 4); /* overwithdelims */
4072 primitive(1146, above, 5); /* atopwithdelims */
4073 primitive(870, left_right, 30); /* left */
4074 primitive(871, left_right, 31); /* right */
4075 /* hash[(hash_size + 517)].v.RH = 871; */
4076 hash[(hash_size + hash_extra + 517)].v.RH = 871; /* right */
4077 /* eqtb[(hash_size + 517)]= eqtb[cur_val]; */
4078 eqtb[(hash_size + hash_extra + 517)]= eqtb[cur_val];
4079 primitive(1165, prefix, 1); /* long */
4080 primitive(1166, prefix, 2); /* outer */
4081 primitive(1167, prefix, 4); /* global */
4082 primitive(1168, def, 0); /* def */
4083 primitive(1169, def, 1); /* gdef */
4084 primitive(1170, def, 2); /* edef */
4085 primitive(1171, def, 3); /* xdef */
4086 primitive(1185, let, 0); /* let */
4087 primitive(1186, let, 1); /* futurelet */
4088 primitive(1187, shorthand_def, 0); /* chardef */
4089 primitive(1188, shorthand_def, 1); /* mathchardef */
4090 primitive(1189, shorthand_def, 2); /* countdef */
4091 primitive(1190, shorthand_def, 3); /* dimendef */
4092 primitive(1191, shorthand_def, 4); /* skipdef */
4093 primitive(1192, shorthand_def, 5); /* muskipdef */
4094 primitive(1193, shorthand_def, 6); /* toksdef */
4095 primitive(412, def_code, (hash_size + 1883)); /* catcode */
4096 primitive(416, def_code, (hash_size + 2907)); /* mathcode */
4097 primitive(413, def_code, (hash_size + 2139)); /* lccode */
4098 primitive(414, def_code, (hash_size + 2395)); /* uccode */
4099 primitive(415, def_code, (hash_size + 2651)); /* sfcode */
4100 primitive(474, def_code, (hash_size + 3474)); /* delcode */
4101 primitive(409, def_family, (hash_size + 1835)); /* textfont */
4102 primitive(410, def_family, (hash_size + 1851)); /* scriptfont */
4103 primitive(411, def_family, (hash_size + 1867)); /* scriptscriptfont */
4104 primitive(935, hyph_data, 0); /* hyphenation */
4105 primitive(947, hyph_data, 1); /* patterns */
4106 primitive(1211, assign_font_int, 0); /* hyphen_char */
4107 primitive(1212, assign_font_int, 1); /* skew_char */
4108 primitive(272, set_interaction, 0); /* batchmode */
4109 primitive(273, set_interaction, 1); /* nonstopmode */
4110 primitive(274, set_interaction, 2); /* scrollmode */
4111 primitive(1221, set_interaction, 3); /* errorstopmode */
4112 primitive(1222, in_stream, 1); /* openin */
4113 primitive(1223, in_stream, 0); /* closein */
4114 primitive(1224, message, 0); /* message */
4115 primitive(1225, message, 1); /* errmessage */
4116 primitive(1231, case_shift, (hash_size + 2139)); /* lowercase */
4117 primitive(1232, case_shift, (hash_size + 2395)); /* uppercase */
4118 primitive(1233, xray, 0); /* show */
4119 primitive(1234, xray, 1); /* show_box */
4120 primitive(1235, xray, 2); /* showthe */
4121 primitive(1236, xray, 3); /* showlists */
4122 primitive(1279, extension, 0); /* openout */
4123 primitive(591, extension, 1); /* write */
4124 write_loc = cur_val;
4125 primitive(1280, extension, 2); /* closeout */
4126 primitive(1281, extension, 3); /* special */
4127 primitive(1282, extension, 4); /* immediate */
4128 primitive(1283, extension, 5); /* setlanguage */
4129 no_new_control_sequence = true;
4133 #pragma optimize("s", off) /* 96/Sep/12 */
4134 /* #pragma optimize("1", off) */
4135 #pragma optimize("t", on) /* 96/Sep/12 */
4136 /* #pragma optimize("2", on) */