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
24 #define BEGINFMTCHECKSUM 367403084L
25 #define ENDFMTCHECKSUM 69069L
27 extern clock_t start_time, main_time, finish_time;
30 void do_initex (void);
34 void initialize (void)
38 integer flag; /* bkph */
40 #ifndef ALLOCATEHYPHEN
46 for (i = 0; i <= 255; i++)
50 xchr[32] = ' '; xchr[33] = '!'; xchr[34] = '"'; xchr[35] = '#';
51 xchr[36] = '$'; xchr[37] = '%'; xchr[38] = '&'; xchr[39] = '\'';
52 xchr[40] = '('; xchr[41] = ')'; xchr[42] = '*'; xchr[43] = '+';
53 xchr[44] = ','; xchr[45] = '-'; xchr[46] = '.'; xchr[47] = '/';
54 xchr[48] = '0'; xchr[49] = '1'; xchr[50] = '2'; xchr[51] = '3';
55 xchr[52] = '4'; xchr[53] = '5'; xchr[54] = '6'; xchr[55] = '7';
56 xchr[56] = '8'; xchr[57] = '9'; xchr[58] = ':'; xchr[59] = ';';
57 xchr[60] = '<'; xchr[61] = '='; xchr[62] = '>'; xchr[63] = '?';
58 xchr[64] = '@'; xchr[65] = 'A'; xchr[66] = 'B'; xchr[67] = 'C';
59 xchr[68] = 'D'; xchr[69] = 'E'; xchr[70] = 'F'; xchr[71] = 'G';
60 xchr[72] = 'H'; xchr[73] = 'I'; xchr[74] = 'J'; xchr[75] = 'K';
61 xchr[76] = 'L'; xchr[77] = 'M'; xchr[78] = 'N'; xchr[79] = 'O';
62 xchr[80] = 'P'; xchr[81] = 'Q'; xchr[82] = 'R'; xchr[83] = 'S';
63 xchr[84] = 'T'; xchr[85] = 'U'; xchr[86] = 'V'; xchr[87] = 'W';
64 xchr[88] = 'X'; xchr[89] = 'Y'; xchr[90] = 'Z'; xchr[91] = '[';
65 xchr[92] = '\\'; xchr[93] = ']'; xchr[94] = '^'; xchr[95] = '_';
66 xchr[96] = '`'; xchr[97] = 'a'; xchr[98] = 'b'; xchr[99] = 'c';
67 xchr[100] = 'd'; xchr[101] = 'e'; xchr[102] = 'f'; xchr[103] = 'g';
68 xchr[104] = 'h'; xchr[105] = 'i'; xchr[106] = 'j'; xchr[107] = 'k';
69 xchr[108] = 'l'; xchr[109] = 'm'; xchr[110] = 'n'; xchr[111] = 'o';
70 xchr[112] = 'p'; xchr[113] = 'q'; xchr[114] = 'r'; xchr[115] = 's';
71 xchr[116] = 't'; xchr[117] = 'u'; xchr[118] = 'v'; xchr[119] = 'w';
72 xchr[120] = 'x'; xchr[121] = 'y'; xchr[122] = 'z'; xchr[123] = '{';
73 xchr[124] = '|'; xchr[125] = '}'; xchr[126] = '~';
75 for (i = 0; i <= 31; i++)
78 for (i = 127; i <= 255; i++)
83 for (i = 0; i <= 255; i++)
87 for (i = 128; i <= 255 ; i++)
90 for (i = 0; i <= 126; i++)
94 for (i = 0; i <= 255; i++)
95 xord[xchr[i]] = (char) i;
103 for (k = 0; k < 256; k++)
112 puts("Inverted mapping xord[] pairs:\n");
114 for (k = 0; k < 256; k++)
117 printf("%d => %d\n", k, xord[k]);
122 if (interaction < batch_mode)
123 interaction = error_stop_mode;
125 deletions_allowed = true;
126 set_box_allowed = true;
129 use_err_help = false;
131 OK_to_interrupt = true;
134 was_mem_end = mem_min;
135 was_lo_max = mem_bot; // mem_min
136 was_hi_min = mem_top; // mem_max
145 cur_list.aux_field.cint = ignore_depth;
150 page_tail = page_head;
157 last_glue = empty_flag;
163 for (k = int_base; k <= eqtb_size; k++)
164 xeq_level[k] = level_one;
166 no_new_control_sequence = true;
170 for (k = hash_base + 1; k <= undefined_control_sequence - 1; k++)
171 hash[k] = hash[hash_base];
189 for (k = 0; k <= 16; k++)
197 for (k = 0; k <= font_max; k++)
198 font_used[k] = false;
200 null_character.b0 = 0;
201 null_character.b1 = 0;
202 null_character.b2 = 0;
203 null_character.b3 = 0;
209 doing_leaders = false;
212 half_buf = dvi_buf_size / 2;
213 dvi_limit = dvi_buf_size;
224 null_delimiter.b0 = 0;
225 null_delimiter.b1 = 0;
226 null_delimiter.b2 = 0;
227 null_delimiter.b3 = 0;
235 /* *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
236 #ifndef ALLOCATEHYPHEN
237 for (z = 0; z <= hyphen_prime; z++)
245 output_active = false;
246 insert_penalties = 0;
247 ligature_present = false;
248 cancel_boundary = false;
253 long_help_seen = false;
256 for (k = 0; k <= 17; k++)
257 write_open[k] = false;
269 /* do the part of initialize() that requires mem_top, mem_max or mem[] */
270 /* do this part after allocating main memory */
273 void initialize_aux (void)
276 was_mem_end = mem_min;
277 was_lo_max = mem_bot; // mem_min
278 was_hi_min = mem_top; // mem_max
283 /* max_nest_stack = 0; */
287 prev_depth = ignore_depth;
290 /* shown_mode = 0; */
291 /* page_contents = 0; */
292 page_tail = page_head;
295 #endif // end of ifdef ALLOCATEMAIN
297 void line_break_ (integer final_widow_penalty)
299 boolean auto_breaking;
301 halfword q, r, s, prevs;
302 internal_font_number f;
303 /* small_number j; */
304 int j; /* 95/Jan/7 */
305 /* unsigned char c; */
306 unsigned int c; /* 95/Jan/7 */
308 pack_begin_line = mode_line;
309 link(temp_head) = link(head);
311 if (is_char_node(tail))
312 tail_append(new_penalty(inf_penalty));
313 else if (type(tail) != glue_node)
314 tail_append(new_penalty(inf_penalty));
317 type(tail) = penalty_node;
318 delete_glue_ref(glue_ptr(tail));
319 flush_node_list(leader_ptr(tail));
320 penalty(tail) = inf_penalty;
323 link(tail) = new_param_glue(par_fill_skip_code);
324 init_cur_lang = prev_graf % 65536L;
325 init_l_hyf = prev_graf / 4194304L; /* 2^22 */
326 init_r_hyf = (prev_graf / 65536L) % 64;
328 no_shrink_error_yet = true;
330 if ((shrink_order(left_skip) != normal) && (shrink(left_skip) != 0))
331 left_skip = finite_shrink(left_skip);
333 if ((shrink_order(right_skip) != normal) && (shrink(right_skip) != 0))
334 right_skip = finite_shrink(right_skip);
338 background[1] = width(q) + width(r);
343 background[2 + stretch_order(q)] = stretch(q);
344 background[2 + stretch_order(r)] = background[2 + stretch_order(r)] + stretch(r);
345 background[6] = shrink(q) + shrink(r);
346 minimum_demerits = 1073741823L; /* 2^30 - 1 *//* 40000000 hex - 1 */
347 minimal_demerits[tight_fit] = 1073741823L;
348 minimal_demerits[decent_fit] = 1073741823L;
349 minimal_demerits[loose_fit] = 1073741823L;
350 minimal_demerits[very_loose_fit] = 1073741823L;
352 if (par_shape_ptr == 0)
353 if (hang_indent == 0)
355 last_special_line = 0;
356 second_width = hsize;
361 last_special_line = abs(hang_after);
365 first_width = hsize - abs(hang_indent);
367 if (hang_indent >= 0)
368 first_indent = hang_indent;
372 second_width = hsize;
379 second_width = hsize - abs(hang_indent);
381 if (hang_indent >= 0)
382 second_indent = hang_indent;
389 last_special_line = info(par_shape_ptr) - 1;
390 second_width = mem[par_shape_ptr + 2 * (last_special_line + 1)].cint;
391 second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].cint;
395 easyline = last_special_line;
397 easyline = empty_flag;
399 threshold = pretolerance;
404 if (tracing_paragraphs > 0)
407 print_nl("@firstpass");
413 first_pass_count++; /* 96 Feb 9 */
417 threshold = tolerance;
419 final_pass = (emergency_stretch <= 0);
422 if (tracing_paragraphs > 0)
429 if (threshold > inf_bad)
442 cur_lang = init_cur_lang;
448 type(q) = unhyphenated;
449 fitness(q) = decent_fit;
452 line_number(q) = prev_graf + 1;
453 total_demerits(q) = 0;
455 active_width[1] = background[1];
456 active_width[2] = background[2];
457 active_width[3] = background[3];
458 active_width[4] = background[4];
459 active_width[5] = background[5];
460 active_width[6] = background[6];
463 printed_node = temp_head;
465 font_in_short_display = 0;
467 cur_p = link(temp_head);
468 auto_breaking = true;
471 while ((cur_p != 0) && (link(active) != active))
473 if (is_char_node(cur_p))
480 active_width[1] = active_width[1] + char_width(f, char_info(f, character(cur_p)));
483 while (!(!is_char_node(cur_p)));
491 active_width[1] = active_width[1] + width(cur_p);
495 if (subtype(cur_p) == language_node)
497 cur_lang = what_lang(cur_p);
498 lhyf = what_lhm(cur_p);
499 rhyf = what_rhm(cur_p);
507 if (is_char_node(prevp))
508 try_break(0, unhyphenated);
509 else if ((mem[prevp].hh.b0 < 9))
510 try_break(0, unhyphenated);
511 else if ((type(prevp) == kern_node) && (subtype(prevp) != explicit))
512 try_break(0, unhyphenated);
515 if ((mem[glue_ptr(cur_p)].hh.b1 != 0) && (mem[glue_ptr(cur_p) + 3].cint != 0))
517 glue_ptr(cur_p) = finite_shrink(glue_ptr(cur_p));
521 active_width[1] = active_width[1]+ width(q);
522 active_width[2 + stretch_order(q)] = active_width[2 + stretch_order(q)] + stretch(q);
523 active_width[6] = active_width[6] + shrink(q);
525 if (second_pass && auto_breaking)
539 else if (type(s) == ligature_node)
548 else if ((type(s) == kern_node) && (subtype(s) == normal))
550 else if (type(s) == whatsit_node)
552 if (subtype(s) == language_node)
554 cur_lang = what_lang(s);
564 if ((lc_code(c) == (halfword) c) || (uc_hyph > 0)) /* fixed signed tyoe */
573 hyf_char = hyphen_char[hf];
583 if (lhyf + rhyf > 63)
595 hyfbchar = character(s);
597 c = hyfbchar; /* unsigned char c; */
611 else if (type(s) == ligature_node)
613 if (font(lig_char(s)) != hf)
619 if (q != 0) /* 94/Mar/23 BUG FIX */
620 hyfbchar = character(q);
622 while (q != 0) /* 94/Mar/23 BUG FIX */
642 hyfbchar = font_bchar[hf];
646 else if ((type(s) == kern_node) && (subtype(s) == normal))
649 hyfbchar = font_bchar[hf];
657 if (hn < lhyf + rhyf)
662 if (!(is_char_node(s)))
668 if (subtype(s) != normal)
693 if (subtype(cur_p) == explicit)
695 if (!is_char_node(link(cur_p)) && auto_breaking)
696 if (type(link(cur_p)) == glue_node)
697 try_break(0, unhyphenated);
699 active_width[1] = active_width[1] + width(cur_p);
702 active_width[1] = active_width[1] + width(cur_p);
706 f = font(lig_char(cur_p));
707 active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(cur_p))));
712 s = pre_break(cur_p);
716 try_break(ex_hyphen_penalty, hyphenated);
724 disc_width = disc_width + char_width(f, char_info(f, character(s)));
730 f = font(lig_char(s));
731 disc_width = disc_width + font_info[width_base[f] + font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0].cint;
738 disc_width = disc_width + width(s);
743 return; // abort_flag set
751 active_width[1] = active_width[1] + disc_width;
752 try_break(hyphen_penalty, hyphenated);
753 active_width[1] = active_width[1] - disc_width;
755 r = replace_count(cur_p);
763 active_width[1] = active_width[1] + char_width(f, char_info(f, character(s)));
769 f = font(lig_char(s));
770 active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(s))));
778 active_width[1] = active_width[1] + width(s);
784 return; // abort_flag set
801 auto_breaking = (subtype(cur_p) == 1);
803 if (!is_char_node(link(cur_p)) && auto_breaking)
804 if (type(link(cur_p)) == glue_node)
805 try_break(0, unhyphenated);
807 active_width[1] = active_width[1] + width(cur_p);
813 try_break(penalty(cur_p), unhyphenated);
823 confusion("paragraph");
824 return; // abort_flag set
836 try_break(eject_penalty, hyphenated);
838 if (link(active) != active)
841 fewest_demerits = 1073741823L; /* 2^30 - 1 */
846 if (total_demerits(r) < fewest_demerits)
848 fewest_demerits = total_demerits(r);
854 while (!(r == active));
856 best_line = line_number(best_bet);
860 goto lab30; /* normal exit */
865 actual_looseness = 0;
871 line_diff = toint(line_number(r)) - toint(best_line);
873 if (((line_diff < actual_looseness) && (looseness <= line_diff)) ||
874 ((line_diff > actual_looseness) && (looseness >= line_diff)))
877 actual_looseness = line_diff;
878 fewest_demerits = total_demerits(r);
880 else if ((line_diff == actual_looseness) && (total_demerits(r) < fewest_demerits))
883 fewest_demerits = total_demerits(r);
889 while (!(r == active));
891 best_line = line_number(best_bet);
894 if ((actual_looseness == looseness) || final_pass)
927 if (tracing_paragraphs > 0)
928 print_nl("@secondpass");
930 threshold = tolerance;
932 second_pass_count++; /* 96 Feb 9 */
933 final_pass = (emergency_stretch <= 0);
938 if (tracing_paragraphs > 0)
939 print_nl("@emergencypass");
942 background[2] = background[2] + emergency_stretch;
944 ++final_pass_count; /* 96 Feb 9 */
953 if (tracing_paragraphs > 0)
955 end_diagnostic(true);
956 normalize_selector();
960 post_line_break(final_widow_penalty);
987 void prefixed_command (void)
990 internal_font_number f;
999 while (cur_cmd == prefix)
1001 if (!odd(a / cur_chr))
1008 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
1010 if (cur_cmd <= max_non_prefixed_command)
1012 print_err("You can't use a prefix with `");
1013 print_cmd_chr(cur_cmd, cur_chr);
1015 help1("I'll pretend you didn't say \\long or \\outer or \\global.");
1021 if ((cur_cmd != def) && (a % 4 != 0))
1023 print_err("You can't use `");
1025 print_string("' or `");
1027 print_string("' with `");
1028 print_cmd_chr(cur_cmd, cur_chr);
1030 help1("I'll pretend you didn't say \\long or \\outer here.");
1034 if (global_defs != 0)
1035 if (global_defs < 0)
1049 define(cur_font_loc, data, cur_chr);
1054 if (odd(cur_chr) && !(a >= 4) && (global_defs >= 0))
1060 q = scan_toks(true, e);
1061 define(p, call + (a % 4), def_ref);
1077 while (!(cur_cmd != spacer));
1079 if (cur_tok == other_token + '=')
1083 if (cur_cmd == spacer)
1097 if (cur_cmd >= call)
1098 add_token_ref(cur_chr);
1100 define(p, cur_cmd, cur_chr);
1109 define(p, relax, 256);
1110 scan_optional_equals();
1117 define(p, char_given, cur_val);
1121 case math_char_def_code:
1123 scan_fifteen_bit_int();
1124 define(p, math_given, cur_val);
1130 scan_eight_bit_int();
1134 case count_def_code:
1135 define(p, assign_int, count_base + cur_val);
1138 case dimen_def_code:
1139 define(p, assign_dimen, scaled_base + cur_val);
1143 define(p, assign_glue, skip_base + cur_val);
1146 case mu_skip_def_code:
1147 define(p, assign_mu_glue, mu_skip_base + cur_val);
1151 define(p, assign_toks, toks_base + cur_val);
1165 if (!scan_keyword("to"))
1167 print_err("Missing `to' inserted");
1168 help2("You should have said `\\read<number> to \\cs'.",
1169 "I'm going to look for the \\cs now.");
1176 define(p, call, cur_val);
1185 if (cur_cmd == toks_register)
1187 scan_eight_bit_int();
1188 p = toks_base + cur_val;
1193 scan_optional_equals();
1199 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
1201 if (cur_cmd != left_brace)
1203 if (cur_cmd == toks_register)
1205 scan_eight_bit_int();
1206 cur_cmd = assign_toks;
1207 cur_chr = toks_base + cur_val;
1210 if (cur_cmd == assign_toks)
1215 define(p, undefined_cs, 0);
1227 q = scan_toks(false, false);
1229 if (link(def_ref) == 0)
1231 define(p, undefined_cs, 0);
1232 free_avail(def_ref);
1236 if (p == output_routine_loc)
1238 link(q) = get_avail();
1240 info(q) = right_brace_token + '}';
1242 info(q) = left_brace_token + '{';
1243 link(q) = link(def_ref);
1247 define(p, call, def_ref);
1255 scan_optional_equals();
1257 word_define(p, cur_val);
1264 scan_optional_equals();
1265 scan_dimen(false, false, false);
1266 word_define(p, cur_val);
1271 case assign_mu_glue:
1275 scan_optional_equals();
1277 if (n == assign_mu_glue)
1280 scan_glue(glue_val);
1283 define(p, glue_ref, cur_val);
1289 if (cur_chr == cat_code_base)
1291 else if (cur_chr == math_code_base)
1292 n = 32768L; /* 2^15 */
1293 else if (cur_chr == sf_code_base)
1294 n = 32767; /* 2^15 - 1*/
1295 else if (cur_chr == del_code_base)
1296 n = 16777215L; /* 2^24 - 1 */
1303 scan_optional_equals();
1306 if (((cur_val < 0) && (p < del_code_base)) ||(cur_val > n))
1308 print_err("Invalid code(");
1311 if (p < del_code_base)
1312 print_string("), should be in the range 0..");
1314 print_string("), should be at most ");
1317 help1("I'm going to use 0 instead of that illegal code value.");
1322 if (p < math_code_base)
1323 define(p, data, cur_val);
1324 else if (p < del_code_base)
1325 define(p, data, cur_val);
1327 word_define(p, cur_val);
1334 scan_four_bit_int();
1336 scan_optional_equals();
1338 define(p, data, cur_val);
1346 do_register_command(a);
1351 scan_eight_bit_int();
1358 scan_optional_equals();
1360 if (set_box_allowed)
1361 scan_box(box_flag + n);
1364 print_err("Improper ");
1365 print_esc("setbox");
1366 help2("Sorry, \\setbox is not allowed after \\halign in a display,",
1367 "or between \\accent and an accented character.");
1381 case set_page_dimen:
1382 alter_page_so_far();
1395 scan_optional_equals();
1403 p = get_node(2 * n + 1);
1406 for (j = 1; j <= n; j++)
1408 scan_dimen(false, false, false);
1409 mem[p + 2 * j - 1].cint = cur_val;
1410 scan_dimen(false, false, false);
1411 mem[p + 2 * j].cint = cur_val;
1415 define(par_shape_loc, shape_ref, p);
1429 print_err("Patterns can be loaded only by INITEX");
1437 while (!(cur_cmd == right_brace));
1443 new_hyph_exceptions();
1448 case assign_font_dimen:
1450 find_font_dimen(true);
1452 scan_optional_equals();
1453 scan_dimen(false, false, false);
1454 font_info[k].cint = cur_val;
1458 case assign_font_int:
1463 scan_optional_equals();
1467 hyphen_char[f] = cur_val;
1469 skew_char[f] = cur_val;
1477 case set_interaction:
1483 confusion("prefix");
1484 return; // abort_flag set
1490 if (after_token != 0)
1492 cur_tok = after_token;
1498 boolean load_fmt_file (void)
1506 if (x != BEGINFMTCHECKSUM)
1509 undump_int(x); /* mem_bot */
1514 undump_int(x); /* mem_top */
1517 /* we already read this once earlier to grab mem_top */
1519 printf("Read from fmt file mem_top = %d TeX words\n", x);
1521 mem = allocate_main_memory(x); /* allocate main memory at this point */
1524 exit(1); /* redundant sanity test ! */
1526 initialize_aux(); /* do `mem' part of initialize */
1532 undump_int(x); /* eqtb_size */
1537 undump_int(x); /* hash_prime */
1539 if (x != hash_prime)
1542 undump_int(x); /* hyphen_prime */
1544 #ifdef ALLOCATEHYPHEN
1545 /* allow format files dumped with arbitrary (prime) hyphenation exceptions */
1550 if (x != hyphen_prime)
1554 undump_int(x); /* pool_size */
1559 #ifdef ALLOCATESTRING
1560 if (x > current_pool_size)
1563 printf("undump string pool reallocation (%d > %d)\n", x, current_pool_size);
1565 str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
1568 if (x > current_pool_size)
1573 printf("%s%s\n", "---! Must increase the ", "string pool size");
1581 undump_int(x); /* max_strings */
1586 #ifdef ALLOCATESTRING
1587 if (x > current_max_strings)
1590 printf("undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
1592 str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
1595 if (x > current_max_strings) /* 94/Jan/24 */
1597 if (x > max_strings)
1600 printf("%s%s\n", "---! Must increase the ", "max strings");
1607 if (undumpthings(str_start[0], str_ptr + 1)) /* undump string ptrs */
1610 if (undumpthings(str_pool[0], pool_ptr)) /* undump string pool */
1613 init_str_ptr = str_ptr;
1614 init_pool_ptr = pool_ptr;
1615 undump(lo_mem_stat_max + 1000, hi_mem_stat_min - 1, lo_mem_max);
1616 undump(lo_mem_stat_max + 1, lo_mem_max, rover);
1622 if (undumpthings(mem[p], q + 2 - p))
1625 p = q + node_size(q);
1627 if ((p > lo_mem_max) || ((q >= rlink(q)) && (rlink(q) != rover)))
1632 while (!(q == rover));
1634 if (undumpthings(mem[p], lo_mem_max + 1 - p))
1637 if (mem_min < mem_bot - 2) /* ? splice in block below */
1639 /* or call add_variable_space(mem_bot - (mem_min + 1)) */
1641 puts("Splicing in mem_min space in undump!\n");
1645 link(mem_min) = 0; /* null */
1646 info(mem_min) = 0; /* null */
1651 link(q) = empty_flag;
1652 node_size(q) = mem_bot - q;
1655 undump(lo_mem_max + 1, hi_mem_stat_min, hi_mem_min);
1656 undump(mem_bot, mem_top, avail);
1659 if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
1662 undump_int(var_used);
1663 undump_int(dyn_used);
1671 if ((x < 1) || (k + x > (eqtb_size + 1)))
1674 if (undumpthings(eqtb[k], x))
1680 if ((x < 0) || (k + x > (eqtb_size + 1)))
1683 for (j = k; j <= k + x - 1; j++)
1684 eqtb[j] = eqtb[k - 1];
1688 while (!(k > eqtb_size));
1690 undump(hash_base, frozen_control_sequence, par_loc);
1691 par_token = cs_token_flag + par_loc;
1692 undump(hash_base, frozen_control_sequence, write_loc);
1693 undump(hash_base, frozen_control_sequence, hash_used);
1699 undump(p + 1, hash_used, p);
1702 while (!(p == hash_used));
1704 if (undumpthings(hash[hash_used + 1], undefined_control_sequence - 1 - hash_used))
1707 undump_int(cs_count);
1710 printf("itex undump cs_count %d ", cs_count);
1713 undump_int(x); /* font_mem_size */
1720 printf("Read from fmt fmem_ptr = %d\n", x);
1722 if (x > current_font_mem_size)
1725 printf("Undump realloc font_info (%d > %d)\n", x, current_font_mem_size);
1727 font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
1730 if (x > current_font_mem_size)
1732 if (x > font_mem_size)
1735 puts("---! Must increase the font mem size\n");
1743 if (undumpthings(font_info[0], fmem_ptr))
1747 undump_int(x); /* font_max */
1754 puts("---! Must increase the font max\n");
1761 frozen_font_ptr = font_ptr;
1763 if (undumpthings(font_check[0], font_ptr + 1))
1766 if (undumpthings(font_size[0], font_ptr + 1))
1769 if (undumpthings(font_dsize[0], font_ptr + 1))
1772 if (undumpthings(font_params[0], font_ptr + 1))
1775 if (undumpthings(hyphen_char[0], font_ptr + 1))
1778 if (undumpthings(skew_char[0], font_ptr + 1))
1781 if (undumpthings(font_name[0], font_ptr + 1))
1784 if (undumpthings(font_area[0], font_ptr + 1))
1787 if (undumpthings(font_bc[0], font_ptr + 1))
1790 if (undumpthings(font_ec[0], font_ptr + 1))
1793 if (undumpthings(char_base[0], font_ptr + 1))
1796 if (undumpthings(width_base[0], font_ptr + 1))
1799 if (undumpthings(height_base[0], font_ptr + 1))
1802 if (undumpthings(depth_base[0], font_ptr + 1))
1805 if (undumpthings(italic_base[0], font_ptr + 1))
1808 if (undumpthings(lig_kern_base[0], font_ptr + 1))
1811 if (undumpthings(kern_base[0], font_ptr + 1))
1814 if (undumpthings(exten_base[0], font_ptr + 1))
1817 if (undumpthings(param_base[0], font_ptr + 1))
1820 if (undumpthings(font_glue[0], font_ptr + 1))
1823 if (undumpthings(bchar_label[0], font_ptr + 1))
1826 if (undumpthings(font_bchar[0], font_ptr + 1))
1829 if (undumpthings(font_false_bchar[0], font_ptr + 1))
1833 /* log not opened yet, so can't show fonts frozen into format */
1834 /* May be able to avoid the following since we switched to */
1835 /* non_address from font_mem_size to 0 96/Jan/15 ??? */
1839 int count = 0, oldfont_mem_size = 0;
1841 for (x = 0; x <= font_ptr; x++)
1843 if (bchar_label[x] > oldfont_mem_size)
1844 oldfont_mem_size = bchar_label[x];
1847 if (oldfont_mem_size != non_address && oldfont_mem_size > font_max)
1849 for (x = 0; x <= font_ptr; x++)
1851 if (bchar_label[x] == oldfont_mem_size)
1853 bchar_label[x] = non_address;
1859 printf("oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
1860 oldfont_mem_size, count, non_address);
1865 undump(0, hyphen_prime, hyph_count);
1867 for (k = 1; k <= hyph_count; k++)
1869 undump(0, hyphen_prime, j);
1870 undump(0, str_ptr, hyph_word[j]);
1871 undump(0, max_halfword, hyph_list[j]);
1874 #ifdef ALLOCATEHYPHEN
1875 /* if user specified new hyphen prime - flush existing exception patterns ! */
1876 /* but, we can reclaim the string storage wasted ... */
1879 if (new_hyphen_prime != 0)
1881 realloc_hyphen(new_hyphen_prime); /* reset_hyphen(); */
1882 hyphen_prime = new_hyphen_prime;
1893 #ifdef ALLOCATETRIES
1896 allocate_tries(x); /* allocate only as much as is needed */
1897 /* trie_size = x; */ /* ??? */
1903 puts("---! Must increase the trie size\n");
1915 if (undumpthings(trie_trl[0], j + 1))
1918 if (undumpthings(trie_tro[0], j + 1))
1921 if (undumpthings(trie_trc[0], j + 1))
1930 if (x > trie_op_size)
1932 puts("---! Must increase the trie op size\n");
1944 if (undumpthings(hyf_distance[1], j))
1947 if (undumpthings(hyf_num[1], j))
1950 if (undumpthings(hyf_next[1], j))
1956 for (k = 0; k <= 255; k++)
1957 trie_used[k] = min_quarterword;
1965 undump(0, k - 1, k);
1979 trie_not_ready = false;
1982 undump(batch_mode, error_stop_mode, interaction);
1983 undump(0, str_ptr, format_ident);
1986 if ((x != ENDFMTCHECKSUM) || feof(fmt_file))
1992 puts("(Fatal format file error; I'm stymied)\n");
1997 void final_cleanup (void)
2006 while (input_ptr > 0)
2016 while (open_parens > 0)
2022 if (cur_level > level_one)
2025 print_esc("end occurred ");
2026 print_string("inside a group at level ");
2027 print_int(cur_level - 1);
2031 while (cond_ptr != 0)
2034 print_esc("end occurred ");
2035 print_string("when ");
2036 print_cmd_chr('i', cur_if);
2040 print_string("on line ");
2044 print_string(" was incomplete)");
2045 if_line = mem[cond_ptr + 1].cint;
2046 cur_if = mem[cond_ptr].hh.b1;
2047 temp_ptr = cond_ptr;
2048 cond_ptr = mem[cond_ptr].hh.rh;
2049 free_node(temp_ptr, 2);
2052 if (history != spotless)
2053 if (((history == warning_issued) || (interaction < error_stop_mode)))
2054 if (selector == term_and_log)
2056 selector = term_only;
2057 print_nl("(see the transcript file for additional information)");
2058 selector = term_and_log;
2066 for (c = 0; c <= 4; c++)
2068 if (cur_mark[c] != 0)
2069 delete_token_ref(cur_mark[c]);
2072 if (last_glue != max_halfword)
2073 delete_glue_ref(last_glue);
2074 store_fmt_file(); // returns a value ?
2079 print_nl("(\\dump is performed only by INITEX)");
2083 void show_frozen (void)
2087 fprintf(log_file, "\n");
2088 fprintf(log_file, "(%d fonts frozen in format file:\n", font_ptr);
2090 for (i = 1; i <= font_ptr; i++)
2093 fprintf(log_file, ", ");
2096 fprintf(log_file, "\n");
2098 n = str_start[font_name[i] + 1] - str_start[font_name[i]];
2100 for (j = 0; j < n; j++)
2102 putc(str_pool[str_start[font_name[i]] + j], log_file);
2106 fprintf(log_file, ") ");
2109 int main_program (void)
2111 history = fatal_error_stop;
2113 if (ready_already == 314159L)
2118 if ((half_error_line < 30) || (half_error_line > error_line - 15))
2121 if (max_print_line < 60)
2124 if (dvi_buf_size % 8 != 0)
2127 if (mem_bot + 1100 > mem_top)
2130 if (hash_prime > (hash_size + hash_extra))
2133 if (max_in_open >= 128)
2136 if (mem_top < 256 + 11)
2142 if ((mem_min != 0) || (mem_max != mem_top))
2147 if ((mem_min > mem_bot) || (mem_max < mem_top))
2150 if ((min_quarterword > 0) || (max_quarterword < 255))
2153 if ((min_halfword > 0) || (max_halfword < 32767))
2156 if ((min_quarterword < min_halfword) || (max_quarterword > max_halfword))
2159 if ((mem_min < min_halfword) || (mem_max >= max_halfword) || (mem_bot - mem_min >= max_halfword))
2162 if (mem_max > mem_top + mem_extra_high)
2165 if ((0 < min_quarterword) || (font_max > max_quarterword))
2168 #ifdef INCREASEFONTS
2169 if (font_max > 1024)
2175 if ((save_size > max_halfword) || (max_strings > max_halfword))
2178 if (buf_size > max_halfword)
2181 if (max_quarterword - min_quarterword < 255)
2184 if (cs_token_flag + undefined_control_sequence > max_halfword)
2187 if (format_default_length > file_name_size)
2190 if (max_halfword < (mem_top - mem_min) / 2)
2195 printf("%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
2196 "---case ", (long) bad);
2206 if (!get_strings_started())
2210 init_str_ptr = str_ptr;
2211 init_pool_ptr = pool_ptr;
2212 fix_date_and_time();
2216 ready_already = 314159L;
2219 selector = term_only;
2223 show_line(tex_version, 0);
2227 printf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
2229 printf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
2232 printf(log_line, " (%s %s/Linux)", application, yandyversion);
2235 if (format_ident > 0)
2236 slow_print(format_ident);
2245 name_in_progress = false;
2247 output_file_name = 0;
2256 max_open_parens = 0;
2259 max_param_stack = 0;
2261 #ifdef ALLOCATEBUFFER
2262 memset (buffer, 0, current_buf_size);
2264 memset (buffer, 0, buf_size);
2275 cur_input.name_field = 0;
2277 align_state = 1000000L;
2279 if (!init_terminal())
2286 if ((format_ident == 0) ||
2287 (buffer[loc] == '&') ||
2288 (buffer[loc] == '+'))
2290 if (format_ident != 0)
2293 if (!open_fmt_file ())
2296 if (!load_fmt_file ())
2298 #ifdef COMPACTFORMAT
2299 gzclose(gz_fmt_file);
2306 #ifdef COMPACTFORMAT
2307 gzclose(gz_fmt_file);
2312 while ((loc < limit) &&
2313 (buffer[loc] == ' '))
2317 if ((end_line_char < 0) || (end_line_char > 255))
2320 buffer[limit] = end_line_char;
2322 fix_date_and_time();
2323 magic_offset = str_start[886] - 9 * ord_noad;
2325 if (interaction == batch_mode)
2326 selector = no_print;
2328 selector = term_only;
2330 if ((loc < limit) &&
2331 (cat_code(buffer[loc]) != escape))
2335 if (show_tfm_flag && log_opened && font_ptr > 0)
2338 main_time = clock();
2342 print_cs_names(stdout, 0);
2347 print_cs_names(stdout, 1);
2350 close_files_and_terminate();
2362 if ((history != 0) && (history != 1))
2372 /* add a block of variable size node space below mem_bot */
2373 void add_variable_space(int size)
2384 mem_min = t - (size + 1); /* first word in new block - 1 */
2386 if (mem_min < mem_start) /* sanity test */
2389 puts("WARNING: mem_min < mem_start!\n");
2391 mem_min = mem_start;
2396 link(mem_min) = 0; /* insert blank word below ??? */
2397 info(mem_min) = 0; /* insert blank word below ??? */
2402 link(q) = empty_flag;
2403 info(q) = t - q; /* block size */
2408 /**************************************************************************/
2411 /* split out to allow sharing of code from do_initex and newpattern */
2412 void reset_trie (void)
2416 for (k = - (integer) trie_op_size; k <= trie_op_size; k++)
2417 trie_op_hash[k] = 0;
2419 for (k = 0; k <= 255; k++)
2420 trie_used[k] = min_trie_op;
2422 max_op_used = min_trie_op;
2424 trie_not_ready = true;
2428 trie_not_ready = true;
2430 /* borrowed code from initialize() */
2431 void reset_hyphen (void)
2435 for (z = 0; z <= hyphen_prime; z++)
2443 /* split out to allow optimize for space, not time */
2444 void do_initex (void)
2448 /* hyph_pointer z; */
2450 for (k = mem_bot + 1; k <= lo_mem_stat_max; k++)
2455 while (k <= lo_mem_stat_max)
2457 glue_ref_count(k) = 1;
2458 stretch_order(k) = normal;
2459 shrink_order(k) = normal;
2460 k = k + glue_spec_size;
2463 stretch(fil_glue) = 65535L;
2464 stretch_order(fil_glue) = fil;
2465 stretch(fill_glue) = 65535L;
2466 stretch_order(fill_glue) = fill;
2467 stretch(ss_glue) = 65535L;
2468 stretch_order(ss_glue) = fil;
2469 shrink(ss_glue) = 65535L;
2470 shrink_order(ss_glue) = fil;
2471 stretch(fil_neg_glue) = -65536L;
2472 stretch_order(fil_neg_glue) = fil;
2473 rover = lo_mem_stat_max + 1;
2474 link(rover) = empty_flag;
2475 node_size(rover) = block_size;
2476 llink(rover) = rover;
2477 rlink(rover) = rover;
2478 lo_mem_max = rover + block_size;
2479 link(lo_mem_max) = 0;
2480 info(lo_mem_max) = 0;
2482 for (k = hi_mem_stat_min; k <= mem_top; k++)
2483 mem[k] = mem[lo_mem_max];
2485 info(omit_template) = end_template_token;
2486 link(end_span) = max_quarterword + 1;
2488 type(last_active) = hyphenated;
2489 line_number(last_active) = max_halfword;
2490 subtype(last_active) = 0;
2491 subtype(page_ins_head) = 255;
2492 type(page_ins_head) = split_up;
2493 link(mem_top) = page_ins_head;
2494 type(page_head) = glue_node;
2495 subtype(page_head) = normal;
2496 avail = 0; /* avail <- null p.164 */
2498 hi_mem_min = hi_mem_stat_min;
2499 var_used = lo_mem_stat_max + 1 - mem_bot;
2500 dyn_used = hi_mem_stat_usage;
2501 eq_type(undefined_control_sequence) = undefined_cs;
2502 equiv(undefined_control_sequence) = 0;
2503 eq_level(undefined_control_sequence) = level_zero;
2505 for (k = active_base; k <= undefined_control_sequence - 1; k++)
2506 eqtb[k] = eqtb[undefined_control_sequence];
2508 equiv(glue_base) = zero_glue;
2509 eq_level(glue_base) = level_one;
2510 eq_type(glue_base) = glue_ref;
2512 for (k = glue_base + 1; k <= local_base - 1; k++)
2513 eqtb[k] = eqtb[glue_base];
2515 glue_ref_count(zero_glue) = glue_ref_count(zero_glue) + local_base - glue_base;
2518 eq_type(par_shape_loc) = shape_ref;
2519 eq_level(par_shape_loc) = level_one;
2521 for (k = output_routine_loc; k <= toks_base + 255; k++)
2522 eqtb[k] = eqtb[undefined_control_sequence];
2525 eq_type(box_base) = box_ref;
2526 eq_level(box_base) = level_one;
2528 for (k = box_base + 1; k <= box_base + 255; k++)
2529 eqtb[k] = eqtb[box_base];
2531 cur_font = null_font;
2532 eq_type(cur_font_loc) = data;
2533 eq_level(cur_font_loc) = level_one;
2535 for (k = math_font_base; k <= math_font_base + 47; k++)
2536 eqtb[k] = eqtb[cur_font_loc];
2538 equiv(cat_code_base) = 0;
2539 eq_type(cat_code_base) = data;
2540 eq_level(cat_code_base) = level_one;
2542 for (k = cat_code_base; k <= int_base - 1; k++)
2543 eqtb[k] = eqtb[cat_code_base];
2545 for (k = 0; k <= 255; k++)
2547 cat_code(k) = other_char;
2552 cat_code(carriage_return) = car_ret;
2553 cat_code(' ') = spacer;
2554 cat_code('\\') = escape;
2555 cat_code('%') = comment;
2556 cat_code(invalid_code) = invalid_char;
2557 cat_code(null_code) = ignore;
2559 for (k = '0'; k <= '9'; k++)
2560 math_code(k) = k + var_code;
2562 for (k = 'A'; k <= 'Z'; k++)
2564 cat_code(k) = letter;
2565 cat_code(k + 'a' - 'A') = letter;
2566 math_code(k) = k + var_code + 0x100;
2567 math_code(k + 'a' - 'A') = k + 'a' - 'A' + var_code + 0x100;
2568 lc_code(k) = k + 'a' - 'A';
2569 lc_code(k + 'a' - 'A') = k + 'a' - 'A';
2571 uc_code(k + 'a' - 'A') = k;
2575 for (k = int_base; k <= del_code_base - 1; k++)
2581 max_dead_cycles = 25;
2583 end_line_char = carriage_return;
2585 for (k = 0; k <= 255; k++)
2590 for (k = dimen_base; k <= eqtb_size; k++)
2593 hash_used = frozen_control_sequence;
2597 puts("initex cs_count = 0 ");
2599 eq_type(frozen_dont_expand) = dont_expand;
2600 text(frozen_dont_expand) = 499; /* notexpanded */
2602 font_ptr = null_font;
2604 font_name[null_font] = 795; /* nullfont */
2605 font_area[null_font] = 335; /* "" */
2606 hyphen_char[null_font] = '-';
2607 skew_char[null_font] = -1;
2608 bchar_label[null_font] = non_address;
2609 font_bchar[null_font] = non_char;
2610 font_false_bchar[null_font] = non_char;
2611 font_bc[null_font] = 1;
2612 font_ec[null_font] = 0;
2613 font_size[null_font] = 0;
2614 font_dsize[null_font] = 0;
2615 char_base[null_font] = 0;
2616 width_base[null_font] = 0;
2617 height_base[null_font] = 0;
2618 depth_base[null_font] = 0;
2619 italic_base[null_font] = 0;
2620 lig_kern_base[null_font] = 0;
2621 kern_base[null_font] = 0;
2622 exten_base[null_font] = 0;
2623 font_glue[null_font] = 0;
2624 font_params[null_font] = 7;
2625 param_base[null_font] = -1;
2627 for (k = 0; k <= 6; k++)
2628 font_info[k].cint = 0;
2631 text(frozen_protection) = 1184; /* "inaccessible" */
2632 format_ident = 1251;
2633 text(end_write) = 1290;
2634 eq_level(end_write) = level_one;
2635 eq_type(end_write) = outer_call;
2636 equiv(end_write) = 0;
2642 boolean get_strings_started (void)
2651 for (k = 0; k <= 255; k++)
2653 if (((k < ' ') || (k > '~')))
2659 append_char(k + 64);
2662 append_char(k - 64);
2665 append_lc_hex(k / 16);
2666 append_lc_hex(k % 16);
2675 g = load_pool_strings(pool_size - string_vacancies);
2679 fprintf(stdout , "%s\n", "! You have to increase POOLSIZE." );
2689 void sort_avail (void)
2694 p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */
2696 rlink(rover) = empty_flag;
2699 while (p != old_rover)
2712 while (rlink(q) < p)
2716 rlink(p) = rlink(q);
2724 while (rlink(p) != empty_flag)
2726 llink(rlink(p)) = p;
2737 void primitive_ (str_number s, quarterword c, halfword o)
2741 /* small_number l; */
2742 int l; /* 95/Jan/7 */
2745 cur_val = s + single_base;
2749 l = str_start[s + 1] - k; /* small_number l */
2751 for (j = 0; j <= l - 1; j++)
2752 buffer[j] = str_pool[k + j];
2754 cur_val = id_lookup(0, l);
2759 puts("ERROR: hash entry too large\n");
2765 eq_level(cur_val) = level_one;
2766 eq_type(cur_val) = c;
2773 trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
2779 h = abs(n + 313 * d + 361 * v + 1009 * cur_lang) % (trie_op_size + trie_op_size) + neg_trie_op_size;
2783 l = trie_op_hash[h];
2787 if (trie_op_ptr == trie_op_size)
2789 overflow("pattern memory ops", trie_op_size);
2790 return 0; // abort_flag set
2793 u = trie_used[cur_lang];
2795 if (u == max_trie_op)
2797 overflow("pattern memory ops per language", max_trie_op - min_trie_op);
2798 return 0; // abort_flag set
2803 trie_used[cur_lang] = u;
2805 if (u > max_op_used)
2808 hyf_distance[trie_op_ptr] = d;
2809 hyf_num[trie_op_ptr] = n;
2810 hyf_next[trie_op_ptr] = v;
2811 trie_op_lang[trie_op_ptr] = cur_lang;
2812 trie_op_hash[h] = trie_op_ptr;
2813 trie_op_val[trie_op_ptr] = u;
2817 if ((hyf_distance[l]== d) && (hyf_num[l]== n) && (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang))
2819 return trie_op_val[l];
2822 if (h > - (integer) trie_op_size)
2829 trie_pointer trie_node_ (trie_pointer p)
2834 /* the 1009, 2718, 3142 are hard-wired constants here (not hyphen_prime) */
2835 /* compute hash value */
2836 h = abs(trie_c[p] + 1009 * trie_o[p] + 2718 * trie_l[p] + 3142 * trie_r[p]) % trie_size;
2848 if ((trie_c[q] == trie_c[p]) && (trie_o[q] == trie_o[p]) &&
2849 (trie_l[q] == trie_l[p]) && (trie_r[q] == trie_r[p]))
2861 trie_pointer compress_trie_ (trie_pointer p)
2867 trie_l[p] = compress_trie(trie_l[p]);
2868 trie_r[p] = compress_trie(trie_r[p]);
2869 return trie_node(p);
2873 void first_fit_ (trie_pointer p)
2889 if (trie_max < h + 256)
2891 if (trie_size <= h + 256)
2893 overflow("pattern memory", trie_size);
2894 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
2895 return; // abort_flag set
2901 trie_taken[trie_max] = false;
2902 trie_trl[trie_max] = trie_max + 1;
2903 trie_tro[trie_max] = trie_max - 1;
2905 while (!(trie_max == h + 256));
2915 if (trie_trl[h + trie_c[q]] == 0)
2926 trie_taken[h] = true; /* h may be used without ... */
2942 ll = z; /* short ll */
2959 void trie_pack_ (trie_pointer p)
2967 if ((q > 0) && (trie_hash[q]== 0))
2978 void trie_fix_ (trie_pointer p)
2990 trie_trl[z + c] = trie_hash[q];
2991 trie_trc[z + c] = c;
2992 trie_tro[z + c] = trie_o[p];
3002 void new_patterns (void)
3004 /* ******************************************************************* */
3005 /* was small_number k, l; in 3.141 */
3007 /* ******************************************************************* */
3008 boolean digitsensed;
3013 int c; /* 95/Jan/7 */
3015 if (!trie_not_ready) /* new stuff */
3020 puts("Resetting patterns\n");
3022 reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
3024 if (reset_exceptions)
3027 puts("Resetting exceptions\n");
3029 reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
3033 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3040 digitsensed = false;
3050 if (digitsensed || (cur_chr < '0') || (cur_chr > '9'))
3056 cur_chr = lc_code(cur_chr);
3060 print_err("Nonletter");
3061 help1("(See Appendix H.)");
3071 digitsensed = false;
3076 hyf[k] = cur_chr - '0';
3096 v = new_trie_op(k - l, hyf[l], v);
3113 while ((p > 0) && (c > trie_c[p])) {
3119 if ((p == 0) || (c < trie_c[p]))
3121 if (trie_ptr == trie_size)
3123 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3124 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3125 return; // abort_flag set
3129 trie_r[trie_ptr] = p;
3139 trie_o[p] = min_trie_op;
3144 if (trie_o[q]!= min_trie_op)
3146 print_err("Duplicate pattern");
3147 help1("(See Appendix H.)");
3154 if (cur_cmd == right_brace)
3159 digitsensed = false;
3165 print_esc("patterns");
3166 help1("(See Appendix H.)");
3176 print_err("Too late for ");
3177 print_esc("patterns");
3178 help1("All patterns must be given before typesetting begins.");
3180 link(garbage) = scan_toks(false, false);
3181 flush_list(def_ref);
3185 void init_trie (void)
3188 /* integer j, k, t; */
3190 int t; /* 95/Jan/7 */
3193 op_start[0] = - (integer) min_trie_op;
3195 for (j = 1; j <= 255; j++)
3197 op_start[j] = op_start[j - 1] + trie_used[j - 1];
3200 for (j = 1; j <= trie_op_ptr; j++)
3202 trie_op_hash[j] = op_start[trie_op_lang[j]] + trie_op_val[j];
3205 for (j = 1; j <= trie_op_ptr; j++)
3207 while (trie_op_hash[j] > j)
3209 k = trie_op_hash[j];
3210 t = hyf_distance[k];
3211 hyf_distance[k] = hyf_distance[j];
3212 hyf_distance[j] = t;
3214 hyf_num[k] = hyf_num[j];
3217 hyf_next[k] = hyf_next[j];
3219 trie_op_hash[j] = trie_op_hash[k];
3220 trie_op_hash[k] = k;
3224 for (p = 0; p <= trie_size; p++)
3229 trie_l[0] = compress_trie(trie_l[0]);
3231 for (p = 0; p <= trie_ptr; p++)
3236 for (p = 0; p <= 255; p++)
3238 trie_min[p] = p + 1;
3246 first_fit(trie_l[0]);
3247 trie_pack(trie_l[0]);
3252 for (r = 0; r <= 256; r++)
3255 trie_tro[r] = min_trie_op;
3262 trie_fix(trie_l[0]);
3270 trie_tro[r] = min_trie_op;
3276 while (!(r > trie_max));
3280 trie_not_ready = false;
3286 void store_fmt_file (void)
3294 puts("! \\dump is performed only by INITEX\n");
3297 puts(" (Use -i on the command line)\n");
3305 print_err("You can't dump inside a group");
3306 help1("`{...\\dump}' is a no-no.");
3310 selector = new_string;
3311 print_string(" (format=");
3321 if (interaction == 0)
3322 selector = log_only;
3324 selector = term_and_log;
3327 format_ident = make_string();
3328 pack_job_name(".fmt");
3330 while (!w_open_out(fmt_file))
3332 prompt_file_name("format file name", ".fmt");
3335 print_nl("Beginning to dump on file ");
3336 slow_print(w_make_name_string(fmt_file));
3339 slow_print(format_ident);
3341 dump_int(BEGINFMTCHECKSUM);
3344 dump_int(eqtb_size);
3345 dump_int(hash_prime);
3346 dump_int(hyphen_prime);
3350 if (dumpthings(str_start[0], str_ptr + 1))
3353 if (dumpthings(str_pool[0], pool_ptr))
3358 print_string(" strings of total length ");
3359 print_int(pool_ptr);
3363 dump_int(lo_mem_max);
3371 if (dumpthings(mem[p], q + 2 - p))
3375 var_used = var_used + q - p;
3376 p = q + node_size(q);
3379 while (!(q == rover));
3381 var_used = var_used + lo_mem_max - p;
3382 dyn_used = mem_end + 1 - hi_mem_min;
3384 if (dumpthings(mem[p], lo_mem_max + 1 - p))
3387 x = x + lo_mem_max + 1 - p;
3388 dump_int(hi_mem_min);
3391 if (dumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
3394 x = x + mem_end + 1 - hi_mem_min;
3407 print_string(" memory locations dumped; current usage is ");
3408 print_int(var_used);
3410 print_int(dyn_used);
3418 while (j < (int_base - 1))
3420 if ((equiv(j) == equiv(j + 1)) &&
3421 (eq_type(j) == eq_type(j + 1)) &&
3422 (eq_level(j) == eq_level(j + 1)))
3432 while (j < (int_base - 1))
3434 if ((equiv(j) != equiv(j + 1)) ||
3435 (eq_type(j) != eq_type(j + 1)) ||
3436 (eq_level(j) != eq_level(j + 1)))
3443 if (dumpthings(eqtb[k], l - k))
3449 while (!(k == (int_base)));
3455 while (j < (eqtb_size))
3457 if (eqtb[j].cint == eqtb[j + 1].cint)
3462 l = (eqtb_size + 1);
3468 while (j < (eqtb_size))
3470 if (eqtb[j].cint != eqtb[j + 1].cint)
3477 if (dumpthings(eqtb[k], l - k))
3483 while (!(k > (eqtb_size)));
3486 dump_int(write_loc);
3488 dump_int(hash_used);
3489 cs_count = frozen_control_sequence - 1 - hash_used;
3492 printf("itex cs_count %d hash_size %d hash_extra %d hash_used %d",
3493 cs_count, hash_size, hash_extra, hash_used);
3495 for (p = hash_base; p <= hash_used; p++)
3504 puts("itex cs_count++ ");
3508 if (dumpthings(hash[hash_used + 1], undefined_control_sequence - 1 - hash_used))
3513 print_int(cs_count);
3514 print_string(" multiletter control sequences");
3519 if (dumpthings(font_info[0], fmem_ptr))
3524 if (dumpthings(font_check[0], font_ptr + 1))
3527 if (dumpthings(font_size[0], font_ptr + 1))
3530 if (dumpthings(font_dsize[0], font_ptr + 1))
3533 if (dumpthings(font_params[0], font_ptr + 1))
3536 if (dumpthings(hyphen_char[0], font_ptr + 1))
3539 if (dumpthings(skew_char[0], font_ptr + 1))
3542 if (dumpthings(font_name[0], font_ptr + 1))
3545 if (dumpthings(font_area[0], font_ptr + 1))
3548 if (dumpthings(font_bc[0], font_ptr + 1))
3551 if (dumpthings(font_ec[0], font_ptr + 1))
3554 if (dumpthings(char_base[0], font_ptr + 1))
3557 if (dumpthings(width_base[0], font_ptr + 1))
3560 if (dumpthings(height_base[0], font_ptr + 1))
3563 if (dumpthings(depth_base[0], font_ptr + 1))
3566 if (dumpthings(italic_base[0], font_ptr + 1))
3569 if (dumpthings(lig_kern_base[0], font_ptr + 1))
3572 if (dumpthings(kern_base[0], font_ptr + 1))
3575 if (dumpthings(exten_base[0], font_ptr + 1))
3578 if (dumpthings(param_base[0], font_ptr + 1))
3581 if (dumpthings(font_glue[0], font_ptr + 1))
3584 if (dumpthings(bchar_label[0], font_ptr + 1))
3587 if (dumpthings(font_bchar[0], font_ptr + 1))
3590 if (dumpthings(font_false_bchar[0], font_ptr + 1))
3593 for (k = 0; k <= font_ptr; k++)
3597 print(font_id_text(k));
3599 print_file_name(font_name[k], font_area[k], 335);
3601 if (font_size[k] != font_dsize[k])
3603 print_string(" at ");
3604 print_scaled(font_size[k]);
3611 print_int(fmem_ptr - 7);
3612 print_string(" words of font info for ");
3613 print_int(font_ptr - 0);
3614 print_string(" preloaded font");
3619 dump_int(hyph_count);
3621 for (k = 0; k <= hyphen_prime; k++)
3623 if (hyph_word[k]!= 0)
3626 dump_int(hyph_word[k]);
3627 dump_int(hyph_list[k]);
3632 print_int(hyph_count);
3633 print_string(" hyphenation exception");
3635 if (hyph_count != 1)
3643 if (dumpthings(trie_trl[0], trie_max + 1))
3646 if (dumpthings(trie_tro[0], trie_max + 1))
3649 if (dumpthings(trie_trc[0], trie_max + 1))
3652 dump_int(trie_op_ptr);
3654 if (dumpthings(hyf_distance[1], trie_op_ptr))
3657 if (dumpthings(hyf_num[1], trie_op_ptr))
3660 if (dumpthings(hyf_next[1], trie_op_ptr))
3663 print_nl("Hyphenation trie of length ");
3664 print_int(trie_max);
3665 print_string(" has ");
3666 print_int(trie_op_ptr);
3667 print_string(" op");
3669 if (trie_op_ptr != 1)
3672 print_string(" out of ");
3673 print_int(trie_op_size);
3675 for (k = 255; k >= 0; k--)
3677 if (trie_used[k] > 0)
3680 print_int(trie_used[k]);
3681 print_string(" for language ");
3684 dump_int(trie_used[k]);
3688 dump_int(interaction);
3689 dump_int(format_ident);
3690 dump_int(ENDFMTCHECKSUM);
3693 #ifdef COMPACTFORMAT
3694 gzclose(gz_fmt_file);
3703 void init_prim (void)
3705 no_new_control_sequence = false;
3706 primitive("lineskip", assign_glue, glue_base + line_skip_code);
3707 primitive("baselineskip", assign_glue, glue_base + baseline_skip_code);
3708 primitive("parskip", assign_glue, glue_base + par_skip_code);
3709 primitive("abovedisplayskip", assign_glue, glue_base + above_display_skip_code);
3710 primitive("belowdisplayskip", assign_glue, glue_base + below_display_skip_code);
3711 primitive("abovedisplayshortskip", assign_glue, glue_base + above_display_short_skip_code);
3712 primitive("belowdisplayshortskip", assign_glue, glue_base + below_display_short_skip_code);
3713 primitive("leftskip", assign_glue, glue_base + left_skip_code);
3714 primitive("rightskip", assign_glue, glue_base + right_skip_code);
3715 primitive("topskip", assign_glue, glue_base + top_skip_code);
3716 primitive("splittopskip", assign_glue, glue_base + split_top_skip_code);
3717 primitive("tabskip", assign_glue, glue_base + tab_skip_code);
3718 primitive("spaceskip", assign_glue, glue_base + space_skip_code);
3719 primitive("xspaceskip", assign_glue, glue_base + xspace_skip_code);
3720 primitive("parfillskip", assign_glue, glue_base + par_fill_skip_code);
3721 primitive("thinmuskip", assign_mu_glue, glue_base + thin_mu_skip_code);
3722 primitive("medmuskip", assign_mu_glue, glue_base + med_mu_skip_code);
3723 primitive("thickmuskip", assign_mu_glue, glue_base + thick_mu_skip_code);
3724 primitive("output", assign_toks, output_routine_loc);
3725 primitive("everypar", assign_toks, every_par_loc);
3726 primitive("everymath", assign_toks, every_math_loc);
3727 primitive("everydisplay", assign_toks, every_display_loc);
3728 primitive("everyhbox", assign_toks, every_hbox_loc);
3729 primitive("everyvbox", assign_toks, every_vbox_loc);
3730 primitive("everyjob", assign_toks, every_job_loc);
3731 primitive("everycr", assign_toks, every_cr_loc);
3732 primitive("errhelp", assign_toks, err_help_loc);
3733 primitive("pretolerance", assign_int, int_base + pretolerance_code);
3734 primitive("tolerance", assign_int, int_base + tolerance_code);
3735 primitive("linepenalty", assign_int, int_base + line_penalty_code);
3736 primitive("hyphenpenalty", assign_int, int_base + hyphen_penalty_code);
3737 primitive("exhyphenpenalty", assign_int, int_base + ex_hyphen_penalty_code);
3738 primitive("clubpenalty", assign_int, int_base + club_penalty_code);
3739 primitive("widowpenalty", assign_int, int_base + widow_penalty_code);
3740 primitive("displaywidowpenalty", assign_int, int_base + display_widow_penalty_code);
3741 primitive("brokenpenalty", assign_int, int_base + broken_penalty_code);
3742 primitive("binoppenalty", assign_int, int_base + bin_op_penalty_code);
3743 primitive("relpenalty", assign_int, int_base + rel_penalty_code);
3744 primitive("predisplaypenalty", assign_int, int_base + pre_display_penalty_code);
3745 primitive("postdisplaypenalty", assign_int, int_base + post_display_penalty_code);
3746 primitive("interlinepenalty", assign_int, int_base + inter_line_penalty_code);
3747 primitive("doublehyphendemerits", assign_int, int_base + double_hyphen_demerits_code);
3748 primitive("finalhyphendemerits", assign_int, int_base + final_hyphen_demerits_code);
3749 primitive("adjdemerits", assign_int, int_base + adj_demerits_code);
3750 primitive("mag", assign_int, int_base + mag_code);
3751 primitive("delimiterfactor", assign_int, int_base + delimiter_factor_code);
3752 primitive("looseness", assign_int, int_base + looseness_code);
3753 primitive("time", assign_int, int_base + time_code);
3754 primitive("day", assign_int, int_base + day_code);
3755 primitive("month", assign_int, int_base + month_code);
3756 primitive("year", assign_int, int_base + year_code);
3757 primitive("showboxbreadth", assign_int, int_base + show_box_breadth_code);
3758 primitive("showboxdepth", assign_int, int_base + show_box_depth_code);
3759 primitive("hbadness", assign_int, int_base + hbadness_code);
3760 primitive("vbadness", assign_int, int_base + vbadness_code);
3761 primitive("pausing", assign_int, int_base + pausing_code);
3762 primitive("tracingonline", assign_int, int_base + tracing_online_code);
3763 primitive("tracingmacros", assign_int, int_base + tracing_macros_code);
3764 primitive("tracingstats", assign_int, int_base + tracing_stats_code);
3765 primitive("tracingparagraphs", assign_int, int_base + tracing_paragraphs_code);
3766 primitive("tracingpages", assign_int, int_base + tracing_pages_code);
3767 primitive("tracingoutput", assign_int, int_base + tracing_output_code);
3768 primitive("tracinglostchars", assign_int, int_base + tracing_lost_chars_code);
3769 primitive("tracingcommands", assign_int, int_base + tracing_commands_code);
3770 primitive("tracingrestores", assign_int, int_base + tracing_restores_code);
3771 primitive("uchyph", assign_int, int_base + uc_hyph_code);
3772 primitive("outputpenalty", assign_int, int_base + output_penalty_code);
3773 primitive("maxdeadcycles", assign_int, int_base + max_dead_cycles_code);
3774 primitive("hangafter", assign_int, int_base + hang_after_code);
3775 primitive("floatingpenalty", assign_int, int_base + floating_penalty_code);
3776 primitive("globaldefs", assign_int, int_base + global_defs_code);
3777 primitive("fam", assign_int, int_base + cur_fam_code);
3778 primitive("escapechar", assign_int, int_base + escape_char_code);
3779 primitive("defaulthyphenchar", assign_int, int_base + default_hyphen_char_code);
3780 primitive("defaultskewchar", assign_int, int_base + default_skew_char_code);
3781 primitive("endlinechar", assign_int, int_base + end_line_char_code);
3782 primitive("newlinechar", assign_int, int_base + new_line_char_code);
3783 primitive("language", assign_int, int_base + language_code);
3784 primitive("lefthyphenmin", assign_int, int_base + left_hyphen_min_code);
3785 primitive("righthyphenmin", assign_int, int_base + right_hyphen_min_code);
3786 primitive("holdinginserts", assign_int, int_base + holding_inserts_code);
3787 primitive("errorcontextlines", assign_int, int_base + error_context_lines_code);
3788 primitive("parindent", assign_dimen, dimen_base + par_indent_code);
3789 primitive("mathsurround", assign_dimen, dimen_base + math_surround_code);
3790 primitive("lineskiplimit", assign_dimen, dimen_base + line_skip_limit_code);
3791 primitive("hsize", assign_dimen, dimen_base + hsize_code);
3792 primitive("vsize", assign_dimen, dimen_base + vsize_code);
3793 primitive("maxdepth", assign_dimen, dimen_base + max_depth_code);
3794 primitive("splitmaxdepth", assign_dimen, dimen_base + split_max_depth_code);
3795 primitive("boxmaxdepth", assign_dimen, dimen_base + box_max_depth_code);
3796 primitive("hfuzz", assign_dimen, dimen_base + hfuzz_code);
3797 primitive("vfuzz", assign_dimen, dimen_base + vfuzz_code);
3798 primitive("delimitershortfall", assign_dimen, dimen_base + delimiter_shortfall_code);
3799 primitive("nulldelimiterspace", assign_dimen, dimen_base + null_delimiter_space_code);
3800 primitive("scriptspace", assign_dimen, dimen_base + script_space_code);
3801 primitive("predisplaysize", assign_dimen, dimen_base + pre_display_size_code);
3802 primitive("displaywidth", assign_dimen, dimen_base + display_width_code);
3803 primitive("displayindent", assign_dimen, dimen_base + display_indent_code);
3804 primitive("overfullrule", assign_dimen, dimen_base + overfull_rule_code);
3805 primitive("hangindent", assign_dimen, dimen_base + hang_indent_code);
3806 primitive("hoffset", assign_dimen, dimen_base + h_offset_code);
3807 primitive("voffset", assign_dimen, dimen_base + v_offset_code);
3808 primitive("emergencystretch", assign_dimen, dimen_base + emergency_stretch_code);
3809 primitive(" ", ex_space, 0);
3810 primitive("/", ital_corr, 0);
3811 primitive("accent", accent, 0);
3812 primitive("advance", advance, 0);
3813 primitive("afterassignment", after_assignment, 0);
3814 primitive("aftergroup", after_group, 0);
3815 primitive("begingroup", begin_group, 0);
3816 primitive("char", char_num, 0);
3817 primitive("csname", cs_name, 0);
3818 primitive("delimiter", delim_num, 0);
3819 primitive("divide", divide, 0);
3820 primitive("endcsname", end_cs_name, 0);
3821 primitive("endgroup", end_group, 0);
3822 text(frozen_end_group) = make_string_pool("endgroup");
3823 eqtb[frozen_end_group] = eqtb[cur_val];
3824 primitive("expandafter", expand_after, 0);
3825 primitive("font", def_font, 0);
3826 primitive("fontdimen", assign_font_dimen, 0);
3827 primitive("halign", halign, 0);
3828 primitive("hrule", hrule, 0);
3829 primitive("ignorespaces", ignore_spaces, 0);
3830 primitive("insert", insert, 0);
3831 primitive("mark", mark, 0);
3832 primitive("mathaccent", math_accent, 0);
3833 primitive("mathchar", math_char_num, 0);
3834 primitive("mathchoice", math_choice, 0);
3835 primitive("multiply", multiply, 0);
3836 primitive("noalign", no_align, 0);
3837 primitive("noboundary", no_boundary, 0);
3838 primitive("noexpand", no_expand, 0);
3839 primitive("nonscript", non_script, 0);
3840 primitive("omit", omit, 0);
3841 primitive("parshape", set_shape, 0);
3842 primitive("penalty", break_penalty, 0);
3843 primitive("prevgraf", set_prev_graf, 0);
3844 primitive("radical", radical, 0);
3845 primitive("read", read_to_cs, 0);
3846 primitive("relax", relax, 256);
3847 text(frozen_relax) = make_string_pool("relax");
3848 eqtb[frozen_relax] = eqtb[cur_val];
3849 primitive("setbox", set_box, 0);
3850 primitive("the", the, 0);
3851 primitive("toks", toks_register, 0);
3852 primitive("vadjust", vadjust, 0);
3853 primitive("valign", valign, 0);
3854 primitive("vcenter", vcenter, 0);
3855 primitive("vrule", vrule, 0);
3856 primitive("par", par_end, 256);
3858 par_token = cs_token_flag + par_loc;
3859 primitive("input", input, 0);
3860 primitive("endinput", input, 1);
3861 primitive("topmark", top_bot_mark, 0);
3862 primitive("firstmark", top_bot_mark, 1);
3863 primitive("botmark", top_bot_mark, 2);
3864 primitive("splitfirstmark", top_bot_mark, 3);
3865 primitive("splitbotmark", top_bot_mark, 4);
3866 primitive("count", tex_register, 0);
3867 primitive("dimen", tex_register, 1);
3868 primitive("skip", tex_register, 2);
3869 primitive("muskip", tex_register, 3);
3870 primitive("spacefactor", set_aux, 102);
3871 primitive("prevdepth", set_aux, 1);
3872 primitive("deadcycles", set_page_int, 0);
3873 primitive("insertpenalties", set_page_int, 1);
3874 primitive("wd", set_box_dimen, 1);
3875 primitive("ht", set_box_dimen, 3);
3876 primitive("dp", set_box_dimen, 2);
3877 primitive("lastpenalty", last_item, 0);
3878 primitive("lastkern", last_item, 1);
3879 primitive("lastskip", last_item, 2);
3880 primitive("inputlineno", last_item, 3);
3881 primitive("badness", last_item, 4);
3882 primitive("number", convert, 0);
3883 primitive("romannumeral", convert, 1);
3884 primitive("string", convert, 2);
3885 primitive("meaning", convert, 3);
3886 primitive("fontname", convert, 4);
3887 primitive("jobname", convert, 5);
3888 primitive("if", if_test, 0);
3889 primitive("ifcat", if_test, 1);
3890 primitive("ifnum", if_test, 2);
3891 primitive("ifdim", if_test, 3);
3892 primitive("ifodd", if_test, 4);
3893 primitive("ifvmode", if_test, 5);
3894 primitive("ifhmode", if_test, 6);
3895 primitive("ifmmode", if_test, 7);
3896 primitive("ifinner", if_test, 8);
3897 primitive("ifvoid", if_test, 9);
3898 primitive("ifhbox", if_test, 10);
3899 primitive("ifvbox", if_test, 11);
3900 primitive("ifx", if_test, 12);
3901 primitive("ifeof", if_test, 13);
3902 primitive("iftrue", if_test, 14);
3903 primitive("iffalse", if_test, 15);
3904 primitive("ifcase", if_test, 16);
3905 primitive("fi", fi_or_else, 2);
3906 text(frozen_fi) = make_string_pool("fi");
3907 eqtb[frozen_fi] = eqtb[cur_val];
3908 primitive("or", fi_or_else, 4);
3909 primitive("else", fi_or_else, 3);
3910 primitive("nullfont", set_font, 0);
3911 text(frozen_null_font) = 795;
3912 eqtb[frozen_null_font] = eqtb[cur_val];
3913 primitive("span", tab_mark, 256);
3914 primitive("cr", car_ret, 257);
3915 text(frozen_cr) = make_string_pool("cr");
3916 eqtb[frozen_cr] = eqtb[cur_val];
3917 primitive("crcr", car_ret, 258);
3918 text(frozen_end_template) = make_string_pool("endtemplate");
3919 text(frozen_endv) = make_string_pool("endtemplate");
3920 eq_type(frozen_endv) = endv;
3921 equiv(frozen_endv) = null_list;
3922 eq_level(frozen_endv) = level_one;
3923 eqtb[frozen_end_template] = eqtb[frozen_endv];
3924 eq_type(frozen_end_template) = end_template;
3925 primitive("pagegoal", set_page_dimen, 0);
3926 primitive("pagetotal", set_page_dimen, 1);
3927 primitive("pagestretch", set_page_dimen, 2);
3928 primitive("pagefilstretch", set_page_dimen, 3);
3929 primitive("pagefillstretch", set_page_dimen, 4);
3930 primitive("pagefilllstretch", set_page_dimen, 5);
3931 primitive("pageshrink", set_page_dimen, 6);
3932 primitive("pagedepth", set_page_dimen, 7);
3933 primitive("end", end_match, 0);
3934 primitive("dump", stop, 1);
3935 primitive("hskip", hskip, 4);
3936 primitive("hfil", hskip, 0);
3937 primitive("hfill", hskip, 1);
3938 primitive("hss", hskip, 2);
3939 primitive("hfilneg", hskip, 3);
3940 primitive("vskip", vskip, 4);
3941 primitive("vfil", vskip, 0);
3942 primitive("vfill", vskip, 1);
3943 primitive("vss", vskip, 2);
3944 primitive("vfilneg", vskip, 3);
3945 primitive("mskip", mskip, 5);
3946 primitive("kern", kern, 1);
3947 primitive("mkern", mkern, 99);
3948 primitive("moveleft", hmove, 1);
3949 primitive("moveright", hmove, 0);
3950 primitive("raise", vmove, 1);
3951 primitive("lower", vmove, 0);
3952 primitive("box", make_box, 0);
3953 primitive("copy", make_box, 1);
3954 primitive("lastbox", make_box, 2);
3955 primitive("vsplit", make_box, 3);
3956 primitive("vtop", make_box, 4);
3957 primitive("vbox", make_box, 5);
3958 primitive("hbox", make_box, 106);
3959 primitive("shipout", leader_ship, 99);
3960 primitive("leaders", leader_ship, 100);
3961 primitive("cleaders", leader_ship, 101);
3962 primitive("xleaders", leader_ship, 102);
3963 primitive("indent", start_par, 1);
3964 primitive("noindent", start_par, 0);
3965 primitive("unpenalty", remove_item, 12);
3966 primitive("unkern", remove_item, 11);
3967 primitive("unskip", remove_item, 10);
3968 primitive("unhbox", un_hbox, 0);
3969 primitive("unhcopy", un_hbox, 1);
3970 primitive("unvbox", un_vbox, 0);
3971 primitive("unvcopy", un_vbox, 1);
3972 primitive("-", discretionary, 1);
3973 primitive("discretionary", discretionary, 0);
3974 primitive("eqno", eq_no, 0);
3975 primitive("leqno", eq_no, 1);
3976 primitive("mathord", math_comp, 16);
3977 primitive("mathop", math_comp, 17);
3978 primitive("mathbin", math_comp, 18);
3979 primitive("mathrel", math_comp, 19);
3980 primitive("mathopen", math_comp, 20);
3981 primitive("mathclose", math_comp, 21);
3982 primitive("mathpunct", math_comp, 22);
3983 primitive("mathinner", math_comp, 23);
3984 primitive("underline", math_comp, 26);
3985 primitive("overline", math_comp, 27);
3986 primitive("displaylimits", limit_switch, 0);
3987 primitive("limits", limit_switch, 1);
3988 primitive("nolimits", limit_switch, 2);
3989 primitive("displaystyle", math_style, 0);
3990 primitive("textstyle", math_style, 2);
3991 primitive("scriptstyle", math_style, 4);
3992 primitive("scriptscriptstyle", math_style, 6);
3993 primitive("above", above, 0);
3994 primitive("over", above, 1);
3995 primitive("atop", above, 2);
3996 primitive("abovewithdelims", above, 3);
3997 primitive("overwithdelims", above, 4);
3998 primitive("atopwithdelims", above, 5);
3999 primitive("left", left_right, 30);
4000 primitive("right", left_right, 31);
4001 text(frozen_right) = make_string_pool("right");
4002 eqtb[frozen_right] = eqtb[cur_val];
4003 primitive("long", prefix, 1);
4004 primitive("outer", prefix, 2);
4005 primitive("global", prefix, 4);
4006 primitive("def", def, 0);
4007 primitive("gdef", def, 1);
4008 primitive("edef", def, 2);
4009 primitive("xdef", def, 3);
4010 primitive("let", let, 0);
4011 primitive("futurelet", let, 1);
4012 primitive("chardef", shorthand_def, 0);
4013 primitive("mathchardef", shorthand_def, 1);
4014 primitive("countdef", shorthand_def, 2);
4015 primitive("dimendef", shorthand_def, 3);
4016 primitive("skipdef", shorthand_def, 4);
4017 primitive("muskipdef", shorthand_def, 5);
4018 primitive("toksdef", shorthand_def, 6);
4019 primitive("catcode", def_code, cat_code_base);
4020 primitive("mathcode", def_code, math_code_base);
4021 primitive("lccode", def_code, lc_code_base);
4022 primitive("uccode", def_code, uc_code_base);
4023 primitive("sfcode", def_code, sf_code_base);
4024 primitive("delcode", def_code, (hash_size + 3474));
4025 primitive("textfont", def_family, (hash_size + 1835));
4026 primitive("scriptfont", def_family, (hash_size + 1851));
4027 primitive("scriptscriptfont", def_family, (hash_size + 1867));
4028 primitive("hyphenation", hyph_data, 0);
4029 primitive("patterns", hyph_data, 1);
4030 primitive("hyphenchar", assign_font_int, 0);
4031 primitive("skewchar", assign_font_int, 1);
4032 primitive("batchmode", set_interaction, 0);
4033 primitive("nonstopmode", set_interaction, 1);
4034 primitive("scrollmode", set_interaction, 2);
4035 primitive("errorstopmode", set_interaction, 3);
4036 primitive("openin", in_stream, 1);
4037 primitive("closein", in_stream, 0);
4038 primitive("message", message, 0);
4039 primitive("errmessage", message, 1);
4040 primitive("lowercase", case_shift, (hash_size + 2139));
4041 primitive("uppercase", case_shift, (hash_size + 2395));
4042 primitive("show", xray, 0);
4043 primitive("showbox", xray, 1);
4044 primitive("showthe", xray, 2);
4045 primitive("showlists", xray, 3);
4046 primitive("openout", extension, 0);
4047 primitive("write", extension, 1);
4048 write_loc = cur_val;
4049 primitive("closeout", extension, 2);
4050 primitive("special", extension, 3);
4051 primitive("immediate", extension, 4);
4052 primitive("setlanguage", extension, 5);
4053 no_new_control_sequence = true;