1 /* Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 void math_fraction (void)
29 if (incompleat_noad != 0)
31 if (c >= delimited_code)
33 scan_delimiter(garbage, false);
34 scan_delimiter(garbage, false);
37 if (c % delimited_code == 0)
38 scan_dimen(false, false, false);
40 print_err("Ambiguous; you need another { and }");
41 help3("I'm ignoring this fraction specification, since I don't",
42 "know whether a construction like `x \\over y \\over z'",
43 "means `{x \\over y} \\over z' or `x \\over {y \\over z}'.");
48 incompleat_noad = get_node(fraction_noad_size);
49 type(incompleat_noad) = fraction_noad;
50 subtype(incompleat_noad) = normal;
51 math_type(numerator(incompleat_noad)) = sub_mlist;
52 info(numerator(incompleat_noad)) = link(head);
53 mem[denominator(incompleat_noad)].hh = empty_field;
54 mem[left_delimiter(incompleat_noad)].qqqq = null_delimiter;
55 mem[right_delimiter(incompleat_noad)].qqqq = null_delimiter;
59 if (c >= delimited_code)
61 scan_delimiter(left_delimiter(incompleat_noad), false);
62 scan_delimiter(right_delimiter(incompleat_noad), false);
65 switch (c % delimited_code)
68 scan_dimen(false, false, false);
69 thickness(incompleat_noad) = cur_val;
73 thickness(incompleat_noad) = default_code;
77 thickness(incompleat_noad) = 0;
83 void math_left_right (void)
90 if ((t == right_noad) && (cur_group != math_left_group))
92 if (cur_group == math_shift_group)
94 scan_delimiter(garbage, false);
97 help1("I'm ignoring a \\right that had no matching \\left.");
107 scan_delimiter(delimiter(p), false);
111 push_math(math_left_group);
119 tail_append(new_noad());
120 type(tail) = inner_noad;
121 math_type(nucleus(tail)) = sub_mlist;
122 info(nucleus(tail)) = p;
127 void after_math (void)
147 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
148 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
149 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
151 print_err("Math formula deleted: Insufficient symbol fonts");
152 help3("Sorry, but I can't typeset math unless \\textfont 2",
153 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
154 "the \\fontdimen values needed in math symbol fonts.");
159 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
160 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
161 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
163 print_err("Math formula deleted: Insufficient extension fonts");
164 help3("Sorry, but I can't typeset math unless \\textfont 3",
165 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
166 "the \\fontdimen values needed in math extension fonts.");
181 if (cur_cmd != math_shift)
183 print_err("Display math should end with $$");
184 help2("The `$' that I just saw supposedly matches a previous `$$'.",
185 "So I shall assume that you typed `$$' both times.");
191 cur_style = text_style;
192 mlist_penalties = false;
194 a = hpack(link(temp_head), 0, 1);
203 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
204 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
205 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
207 print_err("Math formula deleted: Insufficient symbol fonts");
208 help3("Sorry, but I can't typeset math unless \\textfont 2",
209 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
210 "the \\fontdimen values needed in math symbol fonts.");
215 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
216 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
217 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
219 print_err("Math formula deleted: Insufficient extension fonts");
220 help3("Sorry, but I can't typeset math unless \\textfont 3",
221 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
222 "the \\fontdimen values needed in math extension fonts.");
236 tail_append(new_math(math_surround, 0));
238 cur_style = text_style;
239 mlist_penalties = (mode > 0);
241 link(tail) = link(temp_head);
243 while (link(tail) != 0)
246 tail_append(new_math(math_surround, 1));
256 if (cur_cmd != math_shift)
258 print_err("Display math should end with $$");
259 help2("The `$' that I just saw supposedly matches a previous `$$'.",
260 "So I shall assume that you typed `$$' both times.");
266 cur_style = display_style;
267 mlist_penalties = false;
270 adjust_tail = adjust_head;
279 if ((a == 0) || danger)
287 q = e + math_quad(text_size);
292 if ((e != 0) && ((w - total_shrink[normal] + q <= z) || (total_shrink[fil] != 0) ||
293 (total_shrink[fill] != 0) || (total_shrink[filll] != 0)))
295 free_node(b, box_node_size);
296 b = hpack(p, z - q, 0);
304 free_node(b, box_node_size);
313 if ((e > 0) && (d < 2 * e))
318 if (!is_char_node(p))
319 if (type(p) == glue_node)
323 tail_append(new_penalty(pre_display_penalty));
325 if ((d + s <= pre_display_size) || l)
327 g1 = above_display_skip_code;
328 g2 = below_display_skip_code;
332 g1 = above_display_short_skip_code;
333 g2 = below_display_short_skip_code;
339 tail_append(new_penalty(10000));
343 tail_append(new_param_glue(g1));
348 r = new_kern(z - w - e - d);
365 shift_amount(b) = s + d;
368 if ((a != 0) && (e == 0) && !l)
370 tail_append(new_penalty(10000));
371 shift_amount(a) = s + z - width(a);
376 if (t != adjust_head)
378 link(tail) = link(adjust_head);
382 tail_append(new_penalty(post_display_penalty));
386 tail_append(new_param_glue(g2));
389 resume_after_display();
393 void resume_after_display (void)
395 if (cur_group != math_shift_group)
397 confusion("display");
402 prev_graf = prev_graf + 3;
408 prev_graf =(norm_min(left_hyphen_min) * 64 + norm_min(right_hyphen_min)) * 65536L + cur_lang;
413 if (cur_cmd != spacer)
421 void get_r_token (void)
428 while (!(cur_tok != space_token));
430 if ((cur_cs == 0) || (cur_cs > frozen_control_sequence))
432 print_err("Missing control sequence inserted");
433 help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
434 "I've inserted an inaccessible control sequence so that your",
435 "definition will be completed without mixing me up too badly.",
436 "You can recover graciously from this error, if you're",
437 "careful; see exercise 27.2 in The TeXbook.");
442 cur_tok = cs_token_flag + frozen_protection;
448 void trap_zero_glue (void)
450 if ((width(cur_val) == 0) && (stretch(cur_val) == 0) && (shrink(cur_val) == 0))
452 add_glue_ref(zero_glue);
453 delete_glue_ref(cur_val);
458 void do_register_command_ (small_number a)
466 if (q != tex_register)
470 if ((cur_cmd >= assign_int) && (cur_cmd <= assign_mu_glue))
473 p = cur_cmd - assign_int;
477 if (cur_cmd != tex_register)
479 print_err("You can't use `");
480 print_cmd_chr(cur_cmd, cur_chr);
483 help1("I'm forgetting what you said and not changing anything.");
490 scan_eight_bit_int();
495 l = cur_val + count_base;
499 l = cur_val + scaled_base;
503 l = cur_val + skip_base;
507 l = cur_val + mu_skip_base;
513 if (q == tex_register)
514 scan_optional_equals();
516 if (scan_keyword("by"));
526 scan_dimen(false, false, false);
529 cur_val = cur_val + eqtb[l].cint;
537 q = new_spec(cur_val);
539 delete_glue_ref(cur_val);
540 width(q) = width(q) + width(r);
543 stretch_order(q) = normal;
545 if (stretch_order(q) == stretch_order(r))
546 stretch(q) = stretch(q) + stretch(r);
547 else if ((stretch_order(q) < stretch_order(r)) && (stretch(r) != 0))
549 stretch(q) = stretch(r);
550 stretch_order(q) = stretch_order(r);
554 shrink_order(q) = normal;
556 if (shrink_order(q) == shrink_order(r))
557 shrink(q) = shrink(q) + shrink(r);
558 else if ((shrink_order(q) < shrink_order(r)) && (shrink(r) != 0))
560 shrink(q) = shrink(r);
561 shrink_order(q) = shrink_order(r);
573 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 2147483647L); /* 2^31 - 1 */
575 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 1073741823L); /* 2^30 - 1 */
577 cur_val = x_over_n(eqtb[l].cint, cur_val);
585 width(r) = mult_and_add(width(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
586 stretch(r) = mult_and_add(stretch(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
587 shrink(r) = mult_and_add(shrink(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
591 width(r) = x_over_n(width(s), cur_val);
592 stretch(r) = x_over_n(stretch(s), cur_val);
593 shrink(r) = x_over_n(shrink(s), cur_val);
601 print_err("Arithmetic overflow");
602 help2("I can't carry out that multiplication or division,",
603 "since the result is out of range.");
606 delete_glue_ref(cur_val);
613 word_define(l, cur_val);
617 define(l, glue_ref, cur_val);
621 void alter_aux (void)
625 if (cur_chr != abs(mode))
626 report_illegal_case();
630 scan_optional_equals();
634 scan_dimen(false, false, false);
635 prev_depth = cur_val;
641 if ((cur_val <= 0) || (cur_val > 32767))
643 print_err("Bad space factor");
644 help1("I allow only values in the range 1..32767 here.");
648 space_factor = cur_val;
653 void alter_prev_graf (void)
657 nest[nest_ptr] = cur_list;
660 while (abs(nest[p].mode_field) != vmode)
663 scan_optional_equals();
669 print_esc("prevgraf");
670 help1("I allow only nonnegative values here.");
675 nest[p].pg_field = cur_val;
676 cur_list = nest[nest_ptr];
680 void alter_page_so_far (void)
685 scan_optional_equals();
686 scan_dimen(false, false, false);
687 page_so_far[c] = cur_val;
690 void alter_integer (void)
695 scan_optional_equals();
699 dead_cycles = cur_val;
701 insert_penalties = cur_val;
704 void alter_box_dimen (void)
710 scan_eight_bit_int();
712 scan_optional_equals();
713 scan_dimen(false, false, false);
716 mem[box(b) + c].cint = cur_val;
719 void new_font_(small_number a)
723 internal_font_number f;
726 str_number flushable_string;
736 else if (u >= single_base)
743 old_setting = selector;
744 selector = new_string;
746 print(u - active_base);
747 selector = old_setting;
752 define(u, set_font, null_font);
753 scan_optional_equals();
756 name_in_progress = true;
758 if (scan_keyword("at"))
760 scan_dimen(false, false, false);
763 if ((s <= 0) || (s >= 134217728L)) /* 2^27 */
765 print_err("Improper `at' size (");
767 prints("pt), replaced by 10pt");
768 help2("I can only handle fonts at positive sizes that are",
769 "less than 2048pt, so I've changed what you said to 10pt.");
774 else if (scan_keyword("scaled"))
779 if ((cur_val <= 0) || (cur_val > 32768L))
781 print_err("Illegal magnification has been changed to 1000");
782 help1("The magnification ratio must be between 1 and 32768.");
790 name_in_progress = false;
792 flushable_string = str_ptr - 1;
796 int i, k1, k2, l1, l2;
797 char *sch = log_line;
798 k1 = str_start[cur_area];
799 k2 = str_start[cur_name];
800 l1 = length(cur_area);
801 l2 = length(cur_name);
805 for (i = 0; i < l1; i++)
807 *sch++ = str_pool[i + k1];
810 for (i = 0; i < l2; i++)
812 *sch++ = str_pool[i + k2];
817 show_line(log_line, 0);
820 for (f = font_base + 1; f < font_ptr; f++)
822 if (str_eq_str(font_name[f], cur_name) && str_eq_str(font_area[f], cur_area))
824 if (cur_name == flushable_string)
827 cur_name = font_name[f];
832 if (s == font_size[f])
834 if (ignore_frozen == 0 || f > frozen_font_ptr)
838 sprintf(log_line, "SKIPPING %ld ", s);
839 show_line(log_line, 0);
845 else if (font_size[f] == xn_over_d(font_dsize[f], - (integer) s, 1000))
847 if (ignore_frozen == 0 || f > frozen_font_ptr)
851 sprintf(log_line, "SKIPPING %ld ", s);
852 show_line(log_line, 0);
861 show_line("READING ", 0);
863 f = read_font_info(u, cur_name, cur_area, s);
868 sprintf(log_line, "NEW FONT %d ", f);
869 show_line(log_line, 0);
873 eqtb[font_id_base + f] = eqtb[u];
877 void new_interaction (void)
880 interaction = cur_chr;
882 if (interaction == batch_mode)
885 selector = term_only;
888 selector = selector + 2;
891 void do_assignments (void)
899 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
901 if (cur_cmd <= max_non_prefixed_command)
904 set_box_allowed = false;
906 set_box_allowed = true;
910 void open_or_close_in (void)
919 if (read_open[n] != closed)
921 a_close(read_file[n]);
922 read_open[n] = closed;
927 scan_optional_equals();
929 pack_file_name(cur_name, cur_area, cur_ext);
931 if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
933 else if ((cur_ext != 785) && (name_length + 5 < file_name_size))
935 strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
936 name_length = name_length + 4;
938 if (a_open_in(read_file[n], TEXINPUTPATH))
939 read_open[n] = just_open;
942 name_length = name_length - 4;
943 name_of_file[name_length + 1] = ' ';
945 if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
952 void issue_message (void)
959 link(garbage) = scan_toks(false, true);
960 old_setting = selector;
961 selector = new_string;
963 selector = old_setting;
970 if (term_offset + length(s) > max_print_line - 2)
972 else if ((term_offset > 0) || (file_offset > 0))
985 else if (long_help_seen)
986 help1("(That was another \\errmessage.)");
989 if (interaction < error_stop_mode)
990 long_help_seen = true;
992 help4("This error message was generated by an \\errmessage",
993 "command, so I can't give any explicit help.",
994 "Pretend that you're Hercule Poirot: Examine all clues,",
995 "and deduce the truth by order and method.");
999 use_err_help = false;
1005 void shift_case (void)
1013 p = scan_toks(false, false);
1020 if (t < cs_token_flag + single_base)
1024 if (equiv(b + c) != 0)
1025 info(p) = t - c + equiv(b + c);
1031 begin_token_list(link(def_ref), 3);
1032 free_avail(def_ref);
1035 void show_whatever (void)
1050 scan_eight_bit_int();
1052 print_nl("> \\box");
1056 if (box(cur_val) == 0)
1059 show_box(box(cur_val));
1067 if (interaction == error_stop_mode)
1087 if (interaction == error_stop_mode)
1091 token_show(temp_head);
1092 flush_list(link(temp_head));
1098 end_diagnostic(true);
1101 if (selector == term_and_log)
1102 if (tracing_online <= 0)
1104 selector = term_only;
1105 prints(" (see the transcript file)");
1106 selector = term_and_log;
1111 if (interaction < error_stop_mode)
1116 else if (tracing_online > 0)
1117 help3("This isn't an error message; I'm just \\showing something.",
1118 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1119 "\\showthe\\count10, \\showbox255, \\showlists).");
1121 help5("This isn't an error message; I'm just \\showing something.",
1122 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1123 "\\showthe\\count10, \\showbox255, \\showlists).",
1124 "And type `I\\tracingonline=1\\show...' to show boxes and",
1125 "lists on your terminal as well as in the transcript file.");
1130 void new_whatsit_(small_number s, small_number w)
1135 type(p) = whatsit_node;
1141 void new_write_whatsit_(small_number w)
1143 new_whatsit(cur_chr, w);
1145 if (w != write_node_size)
1147 scan_four_bit_int();
1155 else if (cur_val > 15)
1159 write_stream(tail) = cur_val;
1162 void do_extension (void)
1171 new_write_whatsit(open_node_size);
1172 scan_optional_equals();
1174 open_name(tail) = cur_name;
1175 open_area(tail) = cur_area;
1176 open_ext(tail) = cur_ext;
1183 new_write_whatsit(write_node_size);
1185 p = scan_toks(false, false);
1186 write_tokens(tail) = def_ref;
1192 new_write_whatsit(write_node_size);
1193 write_tokens(tail) = 0;
1199 new_whatsit(special_node, write_node_size);
1200 write_stream(tail) = 0;
1201 p = scan_toks(false, true);
1202 write_tokens(tail) = def_ref;
1206 case immediate_code:
1210 if ((cur_cmd == extension) && (cur_chr <= close_node))
1215 flush_node_list(tail);
1224 case set_language_code:
1225 if (abs(mode) != hmode)
1227 report_illegal_case();
1231 new_whatsit(language_node, small_node_size);
1236 else if (cur_val > 255)
1241 what_lang(tail) = clang;
1242 what_lhm(tail) = norm_min(left_hyphen_min);
1243 what_rhm(tail) = norm_min(right_hyphen_min);
1256 void fix_language (void)
1263 else if (language > 255)
1270 new_whatsit(language_node, small_node_size);
1271 what_lang(tail) = l;
1273 what_lhm(tail) = norm_min(left_hyphen_min);
1274 what_rhm(tail) = norm_min(right_hyphen_min);
1278 void handle_right_brace (void)
1292 print_err("Too many }'s");
1293 help2("You've closed more groups than you opened.",
1294 "Such booboos are generally harmless, so keep going.");
1299 case semi_simple_group:
1300 case math_shift_group:
1301 case math_left_group:
1302 extra_right_brace();
1309 case adjust_hbox_group:
1311 adjust_tail = adjust_head;
1335 d = split_max_depth;
1336 f = floating_penalty;
1339 p = vpackage(link(head), 0, 1, 1073741823L); /* 2^30 - 1 */
1344 tail_append(get_node(ins_node_size));
1345 type(tail) = ins_node;
1346 subtype(tail) = saved(0);
1347 height(tail) = height(p) + depth(p);
1348 ins_ptr(tail) = list_ptr(p);
1349 split_top_ptr(tail) = q;
1351 float_cost(tail) = f;
1355 tail_append(get_node(small_node_size));
1356 type(tail) = adjust_node;
1358 adjust_ptr(tail) = list_ptr(p);
1361 free_node(p, box_node_size);
1370 if ((loc != 0) || ((token_type != output_text) && (token_type != backed_up)))
1372 print_err("Unbalanced output routine");
1373 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1374 "I can't handle that very well; good luck.");
1381 while (!(loc == 0));
1387 output_active = false;
1388 insert_penalties = 0;
1392 print_err("Output routine didn't use all of ");
1395 help3("Your \\output commands should empty \\box255,",
1396 "e.g., by saying `\\shipout\\box255'.",
1397 "Proceed; I'll discard its present contents.");
1403 link(page_tail) = link(head);
1407 if (link(page_head) != 0)
1409 if (link(contrib_head) == 0)
1410 nest[0].tail_field = page_tail;
1412 link(page_tail) = link(contrib_head);
1413 link(contrib_head) = link(page_head);
1414 link(page_head) = 0;
1415 page_tail = page_head;
1424 build_discretionary();
1430 cur_tok = cs_token_flag + frozen_cr;
1431 print_err("Missing ");
1434 help1("I'm guessing that you meant to end an alignment here.");
1439 case no_align_group:
1451 save_ptr = save_ptr - 2;
1452 p = vpackage(link(head), saved(1), saved(0), 1073741823L); /* 2^30 - 1 */
1454 tail_append(new_noad());
1455 type(tail) = vcenter_noad;
1456 math_type(nucleus(tail)) = sub_box;
1457 info(nucleus(tail)) = p;
1461 case math_choice_group:
1469 math_type(saved(0)) = sub_mlist;
1475 if (type(p) == ord_noad)
1477 if (math_type(subscr(p)) == 0)
1478 if (math_type(supscr(p)) == 0)
1480 mem[saved(0)].hh = mem[nucleus(p)].hh;
1481 free_node(p, noad_size);
1484 else if (type(p) == accent_noad)
1485 if (saved(0) == nucleus(tail))
1486 if (type(tail) == ord_noad)
1490 while (link(q) != tail)
1494 free_node(tail, noad_size);
1501 confusion("rightbrace");
1508 void main_control (void)
1511 integer bSuppress; /* 199/Jan/5 */
1514 begin_token_list(every_job, every_job_text);
1517 get_x_token(); /* big_switch */
1521 if (OK_to_interrupt)
1533 if (tracing_commands > 0)
1536 switch(abs(mode) + cur_cmd)
1538 case hmode + letter:
1539 case hmode + other_char:
1540 case hmode + char_given:
1544 case hmode + char_num:
1552 case hmode + no_boundary:
1556 if ((cur_cmd == letter) || (cur_cmd == other_char) ||
1557 (cur_cmd == char_given) || (cur_cmd == char_num))
1558 cancel_boundary = true;
1563 case hmode + spacer:
1564 if (space_factor == 1000)
1565 goto append_normal_space;
1570 case hmode + ex_space:
1571 case mmode + ex_space:
1572 goto append_normal_space;
1575 case any_mode(relax):
1576 case vmode + spacer:
1577 case mmode + spacer:
1578 case mmode + no_boundary:
1582 case any_mode(ignore_spaces):
1588 while (!(cur_cmd != spacer));
1601 case any_mode(last_item):
1602 case vmode + vadjust:
1603 case vmode + ital_corr:
1604 case non_math(eq_no):
1605 case any_mode(mac_param):
1606 report_illegal_case();
1609 case non_math(sup_mark):
1610 case non_math(sub_mark):
1611 case non_math(math_char_num):
1612 case non_math(math_given):
1613 case non_math(math_comp):
1614 case non_math(delim_num):
1615 case non_math(left_right):
1616 case non_math(above):
1617 case non_math(radical):
1618 case non_math(math_style):
1619 case non_math(math_choice):
1620 case non_math(vcenter):
1621 case non_math(non_script):
1622 case non_math(mkern):
1623 case non_math(limit_switch):
1624 case non_math(mskip):
1625 case non_math(math_accent):
1627 case mmode + par_end:
1630 case mmode + un_vbox:
1631 case mmode + valign:
1633 insert_dollar_sign();
1640 tail_append(scan_rule_spec());
1642 if (abs(mode) == vmode)
1643 prev_depth = ignore_depth;
1644 else if (abs(mode) == hmode)
1645 space_factor = 1000;
1656 case any_mode(kern):
1661 case non_math(left_brace):
1662 new_save_level(simple_group);
1665 case any_mode(begin_group):
1666 new_save_level(semi_simple_group);
1669 case any_mode(end_group):
1670 if (cur_group == semi_simple_group)
1676 case any_mode(right_brace):
1677 handle_right_brace();
1685 scan_dimen(false, false, false);
1690 scan_box(- (integer) cur_val);
1694 case any_mode(leader_ship):
1695 scan_box(leader_flag - a_leaders + cur_chr);
1698 case any_mode(make_box):
1702 case vmode + start_par:
1703 new_graf(cur_chr > 0);
1706 case vmode + letter:
1707 case vmode + other_char:
1708 case vmode + char_num:
1709 case vmode + char_given:
1710 case vmode + math_shift:
1711 case vmode + un_hbox:
1713 case vmode + accent:
1714 case vmode + discretionary:
1716 case vmode + valign:
1717 case vmode + ex_space:
1718 case vmode + no_boundary:
1725 case hmode + start_par:
1726 case mmode + start_par:
1730 case vmode + par_end:
1739 case hmode + par_end:
1741 if (align_state < 0)
1754 case hmode + un_vbox:
1755 case hmode + halign:
1759 case any_mode(insert):
1760 case hmode + vadjust:
1761 case mmode + vadjust:
1762 begin_insert_or_adjust();
1765 case any_mode(mark):
1769 case any_mode(break_penalty):
1773 case any_mode(remove_item):
1777 case vmode + un_vbox:
1778 case hmode + un_hbox:
1779 case mmode + un_hbox:
1783 case hmode + ital_corr:
1784 append_italic_correction();
1787 case mmode + ital_corr:
1788 tail_append(new_kern(0));
1791 case hmode + discretionary:
1792 case mmode + discretionary:
1793 append_discretionary();
1796 case hmode + accent:
1800 case any_mode(car_ret):
1801 case any_mode(tab_mark):
1805 case any_mode(no_align):
1809 case any_mode(omit):
1813 case vmode + halign:
1814 case hmode + valign:
1818 case mmode + halign:
1820 if (cur_group == math_shift_group)
1831 case any_mode(end_cs_name):
1835 case hmode + math_shift:
1841 if (cur_group == math_shift_group)
1847 case mmode + left_brace:
1849 tail_append(new_noad());
1851 scan_math(nucleus(tail));
1855 case mmode + letter:
1856 case mmode + other_char:
1857 case mmode + char_given:
1858 set_math_char(math_code(cur_chr));
1861 case mmode + char_num:
1865 set_math_char(math_code(cur_chr));
1869 case mmode + math_char_num:
1871 scan_fifteen_bit_int();
1872 set_math_char(cur_val);
1876 case mmode + math_given:
1877 set_math_char(cur_chr);
1880 case mmode + delim_num:
1882 scan_twenty_seven_bit_int();
1883 set_math_char(cur_val / 4096);
1887 case mmode + math_comp:
1889 tail_append(new_noad());
1890 type(tail) = cur_chr;
1891 scan_math(nucleus(tail));
1895 case mmode + limit_switch:
1896 math_limit_switch();
1899 case mmode + radical:
1903 case mmode + accent:
1904 case mmode + math_accent:
1908 case mmode + vcenter:
1910 scan_spec(vcenter_group, false);
1914 prev_depth = ignore_depth;
1916 if (every_vbox != 0)
1917 begin_token_list(every_vbox, every_vbox_text);
1921 case mmode + math_style:
1922 tail_append(new_style(cur_chr));
1925 case mmode + non_script:
1927 tail_append(new_glue(0));
1928 subtype(tail) = cond_math_glue;
1932 case mmode + math_choice:
1936 case mmode + sub_mark:
1937 case mmode + sup_mark:
1945 case mmode + left_right:
1949 case mmode + math_shift:
1950 if (cur_group == math_shift_group)
1956 case any_mode(toks_register):
1957 case any_mode(assign_toks):
1958 case any_mode(assign_int):
1959 case any_mode(assign_dimen):
1960 case any_mode(assign_glue):
1961 case any_mode(assign_mu_glue):
1962 case any_mode(assign_font_dimen):
1963 case any_mode(assign_font_int):
1964 case any_mode(set_aux):
1965 case any_mode(set_prev_graf):
1966 case any_mode(set_page_dimen):
1967 case any_mode(set_page_int):
1968 case any_mode(set_box_dimen):
1969 case any_mode(set_shape):
1970 case any_mode(def_code):
1971 case any_mode(def_family):
1972 case any_mode(set_font):
1973 case any_mode(def_font):
1974 case any_mode(tex_register):
1975 case any_mode(advance):
1976 case any_mode(multiply):
1977 case any_mode(divide):
1978 case any_mode(prefix):
1980 case any_mode(shorthand_def):
1981 case any_mode(read_to_cs):
1983 case any_mode(set_box):
1984 case any_mode(hyph_data):
1985 case any_mode(set_interaction):
1989 case any_mode(after_assignment):
1992 after_token = cur_tok;
1996 case any_mode(after_group):
1999 save_for_after(cur_tok);
2003 case any_mode(in_stream):
2007 case any_mode(message):
2011 case any_mode(case_shift):
2015 case any_mode(xray):
2019 case any_mode(extension):
2027 adjust_space_factor();
2029 bchar = font_bchar[main_f];
2030 false_bchar = font_false_bchar[main_f];
2033 if (language != clang)
2036 fast_get_avail(lig_stack);
2037 font(lig_stack) = main_f;
2039 character(lig_stack) = cur_l;
2042 if (cancel_boundary)
2044 cancel_boundary = false;
2045 main_k = non_address;
2048 main_k = bchar_label[main_f];
2050 if (main_k == non_address)
2051 goto main_loop_move_2;
2055 goto main_lig_loop_1;
2065 cur_l = character(lig_stack);
2068 if (!is_char_node(lig_stack))
2069 goto main_loop_move_lig;
2072 if ((cur_chr < font_bc[main_f]) || (cur_chr > font_ec[main_f]))
2074 char_warning(main_f, cur_chr);
2075 free_avail(lig_stack);
2079 main_i = char_info(main_f, cur_l);
2081 if (!(main_i.b0 > 0))
2083 char_warning(main_f, cur_chr);
2084 free_avail(lig_stack);
2088 link(tail) = lig_stack;
2092 main_loop_lookahead:
2095 if (cur_cmd == letter)
2096 goto main_loop_lookahead_1;
2097 if (cur_cmd == other_char)
2098 goto main_loop_lookahead_1;
2099 if (cur_cmd == char_given)
2100 goto main_loop_lookahead_1;
2104 if (cur_cmd == letter)
2105 goto main_loop_lookahead_1;
2106 if (cur_cmd == other_char)
2107 goto main_loop_lookahead_1;
2108 if (cur_cmd == char_given)
2109 goto main_loop_lookahead_1;
2111 if (cur_cmd == char_num)
2115 goto main_loop_lookahead_1;
2118 if (cur_cmd == no_boundary)
2125 main_loop_lookahead_1:
2126 adjust_space_factor();
2127 fast_get_avail(lig_stack);
2128 font(lig_stack) = main_f;
2130 character(lig_stack) = cur_r;
2132 if (cur_r == false_bchar)
2136 if (char_tag(main_i) != lig_tag)
2137 goto main_loop_wrapup;
2139 if (cur_r == non_char)
2140 goto main_loop_wrapup;
2142 main_k = lig_kern_start(main_f, main_i);
2143 main_j = font_info[main_k].qqqq;
2145 if (skip_byte(main_j) <= stop_flag)
2146 goto main_lig_loop_2;
2148 main_k = lig_kern_restart(main_f, main_j);
2151 main_j = font_info[main_k].qqqq;
2156 if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
2162 if (next_char(main_j) == cur_r && bSuppress == 0) /* 99/Jan/5 */
2163 if (skip_byte(main_j) <= stop_flag)
2165 if (op_byte(main_j) >= kern_flag)
2168 tail_append(new_kern(char_kern(main_f, main_j)));
2169 goto main_loop_move;
2172 if (cur_l == non_char)
2174 else if (lig_stack == 0)
2179 switch (op_byte(main_j))
2184 cur_l = rem_byte(main_j);
2185 main_i = char_info(main_f, cur_l);
2186 ligature_present = true;
2192 cur_r = rem_byte(main_j);
2196 lig_stack = new_lig_item(cur_r);
2199 else if (is_char_node(lig_stack))
2202 lig_stack = new_lig_item(cur_r);
2203 lig_ptr(lig_stack) = main_p;
2206 character(lig_stack) = cur_r;
2211 cur_r = rem_byte(main_j);
2213 lig_stack = new_lig_item(cur_r);
2214 link(lig_stack) = main_p;
2222 cur_l = rem_byte(main_j);
2223 main_i = char_info(main_f, cur_l);
2224 ligature_present = true;
2229 cur_l = rem_byte(main_j);
2230 ligature_present = true;
2233 goto main_loop_wrapup;
2235 goto main_loop_move_1;
2240 if (op_byte(main_j) > 4)
2241 if (op_byte(main_j) != 7)
2242 goto main_loop_wrapup;
2244 if (cur_l < non_char)
2247 main_k = bchar_label[main_f];
2248 goto main_lig_loop_1;
2251 if (skip_byte(main_j) == 0)
2255 if (skip_byte(main_j) >= stop_flag)
2256 goto main_loop_wrapup;
2258 main_k = main_k + skip_byte(main_j) + 1;
2261 goto main_lig_loop_1;
2264 main_p = lig_ptr(lig_stack);
2266 if (main_p != 0) /* BUG FIX */
2267 tail_append(main_p);
2269 temp_ptr = lig_stack;
2270 lig_stack = link(temp_ptr);
2271 free_node(temp_ptr, small_node_size);
2272 main_i = char_info(main_f, cur_l);
2273 ligature_present = true;
2276 if (main_p != 0) /* BUG FIX */
2277 goto main_loop_lookahead;
2281 cur_r = character(lig_stack);
2285 append_normal_space:
2286 if (space_skip == 0)
2289 main_p = font_glue[cur_font];
2293 main_p = new_spec(zero_glue);
2294 main_k = param_base[cur_font] + space_code;
2295 width(main_p) = font_info[main_k].cint;
2296 stretch(main_p) = font_info[main_k + 1].cint;
2297 shrink(main_p) = font_info[main_k + 2].cint;
2298 font_glue[cur_font] = main_p;
2301 temp_ptr = new_glue(main_p);
2304 temp_ptr = new_param_glue(space_skip_code);
2306 link(tail) = temp_ptr;