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();
515 else 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_integers(eqtb[l].cint, cur_val);
575 cur_val = nx_plus_y(eqtb[l].cint, cur_val, 0);
577 cur_val = x_over_n(eqtb[l].cint, cur_val);
585 width(r) = nx_plus_y(width(s), cur_val, 0);
586 stretch(r) = nx_plus_y(stretch(s), cur_val, 0);
587 shrink(r) = nx_plus_y(shrink(s), cur_val, 0);
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)
837 printf("SKIPPING %lld ", s);
842 else if (font_size[f] == xn_over_d(font_dsize[f], - (integer) s, 1000))
844 if (ignore_frozen == 0 || f > frozen_font_ptr)
847 printf("SKIPPING %lld ", s);
855 show_line("READING ", 0);
857 f = read_font_info(u, cur_name, cur_area, s);
861 printf("NEW FONT %lld ", f);
864 eqtb[font_id_base + f] = eqtb[u];
868 void new_interaction (void)
871 interaction = cur_chr;
873 if (interaction == batch_mode)
876 selector = term_only;
879 selector = selector + 2;
882 void do_assignments (void)
890 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
892 if (cur_cmd <= max_non_prefixed_command)
895 set_box_allowed = false;
897 set_box_allowed = true;
901 void open_or_close_in (void)
910 if (read_open[n] != closed)
912 a_close(read_file[n]);
913 read_open[n] = closed;
918 scan_optional_equals();
920 pack_file_name(cur_name, cur_area, cur_ext);
922 if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
924 else if ((cur_ext != 785) && (name_length + 5 < file_name_size))
926 strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
927 name_length = name_length + 4;
929 if (a_open_in(read_file[n], TEXINPUTPATH))
930 read_open[n] = just_open;
933 name_length = name_length - 4;
934 name_of_file[name_length + 1] = ' ';
936 if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
943 void issue_message (void)
950 link(garbage) = scan_toks(false, true);
951 old_setting = selector;
952 selector = new_string;
954 selector = old_setting;
961 if (term_offset + length(s) > max_print_line - 2)
963 else if ((term_offset > 0) || (file_offset > 0))
976 else if (long_help_seen)
977 help1("(That was another \\errmessage.)");
980 if (interaction < error_stop_mode)
981 long_help_seen = true;
983 help4("This error message was generated by an \\errmessage",
984 "command, so I can't give any explicit help.",
985 "Pretend that you're Hercule Poirot: Examine all clues,",
986 "and deduce the truth by order and method.");
990 use_err_help = false;
996 void shift_case (void)
1004 p = scan_toks(false, false);
1011 if (t < cs_token_flag + single_base)
1015 if (equiv(b + c) != 0)
1016 info(p) = t - c + equiv(b + c);
1022 begin_token_list(link(def_ref), 3);
1023 free_avail(def_ref);
1026 void show_whatever (void)
1041 scan_eight_bit_int();
1043 print_nl("> \\box");
1047 if (box(cur_val) == 0)
1050 show_box(box(cur_val));
1058 if (interaction == error_stop_mode)
1078 if (interaction == error_stop_mode)
1082 token_show(temp_head);
1083 flush_list(link(temp_head));
1089 end_diagnostic(true);
1092 if (selector == term_and_log)
1093 if (tracing_online <= 0)
1095 selector = term_only;
1096 prints(" (see the transcript file)");
1097 selector = term_and_log;
1102 if (interaction < error_stop_mode)
1107 else if (tracing_online > 0)
1108 help3("This isn't an error message; I'm just \\showing something.",
1109 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1110 "\\showthe\\count10, \\showbox255, \\showlists).");
1112 help5("This isn't an error message; I'm just \\showing something.",
1113 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1114 "\\showthe\\count10, \\showbox255, \\showlists).",
1115 "And type `I\\tracingonline=1\\show...' to show boxes and",
1116 "lists on your terminal as well as in the transcript file.");
1121 void new_whatsit_(small_number s, small_number w)
1126 type(p) = whatsit_node;
1132 void new_write_whatsit_(small_number w)
1134 new_whatsit(cur_chr, w);
1136 if (w != write_node_size)
1138 scan_four_bit_int();
1146 else if (cur_val > 15)
1150 write_stream(tail) = cur_val;
1153 void do_extension (void)
1162 new_write_whatsit(open_node_size);
1163 scan_optional_equals();
1165 open_name(tail) = cur_name;
1166 open_area(tail) = cur_area;
1167 open_ext(tail) = cur_ext;
1174 new_write_whatsit(write_node_size);
1176 p = scan_toks(false, false);
1177 write_tokens(tail) = def_ref;
1183 new_write_whatsit(write_node_size);
1184 write_tokens(tail) = 0;
1190 new_whatsit(special_node, write_node_size);
1191 write_stream(tail) = 0;
1192 p = scan_toks(false, true);
1193 write_tokens(tail) = def_ref;
1197 case immediate_code:
1201 if ((cur_cmd == extension) && (cur_chr <= close_node))
1206 flush_node_list(tail);
1215 case set_language_code:
1216 if (abs(mode) != hmode)
1218 report_illegal_case();
1222 new_whatsit(language_node, small_node_size);
1227 else if (cur_val > 255)
1232 what_lang(tail) = clang;
1233 what_lhm(tail) = norm_min(left_hyphen_min);
1234 what_rhm(tail) = norm_min(right_hyphen_min);
1247 void fix_language (void)
1254 else if (language > 255)
1261 new_whatsit(language_node, small_node_size);
1262 what_lang(tail) = l;
1264 what_lhm(tail) = norm_min(left_hyphen_min);
1265 what_rhm(tail) = norm_min(right_hyphen_min);
1269 void handle_right_brace (void)
1283 print_err("Too many }'s");
1284 help2("You've closed more groups than you opened.",
1285 "Such booboos are generally harmless, so keep going.");
1290 case semi_simple_group:
1291 case math_shift_group:
1292 case math_left_group:
1293 extra_right_brace();
1300 case adjust_hbox_group:
1302 adjust_tail = adjust_head;
1326 d = split_max_depth;
1327 f = floating_penalty;
1330 p = vpackage(link(head), 0, 1, max_dimen);
1335 tail_append(get_node(ins_node_size));
1336 type(tail) = ins_node;
1337 subtype(tail) = saved(0);
1338 height(tail) = height(p) + depth(p);
1339 ins_ptr(tail) = list_ptr(p);
1340 split_top_ptr(tail) = q;
1342 float_cost(tail) = f;
1346 tail_append(get_node(small_node_size));
1347 type(tail) = adjust_node;
1349 adjust_ptr(tail) = list_ptr(p);
1352 free_node(p, box_node_size);
1361 if ((loc != 0) || ((token_type != output_text) && (token_type != backed_up)))
1363 print_err("Unbalanced output routine");
1364 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1365 "I can't handle that very well; good luck.");
1372 while (!(loc == 0));
1378 output_active = false;
1379 insert_penalties = 0;
1383 print_err("Output routine didn't use all of ");
1386 help3("Your \\output commands should empty \\box255,",
1387 "e.g., by saying `\\shipout\\box255'.",
1388 "Proceed; I'll discard its present contents.");
1394 link(page_tail) = link(head);
1398 if (link(page_head) != 0)
1400 if (link(contrib_head) == 0)
1401 nest[0].tail_field = page_tail;
1403 link(page_tail) = link(contrib_head);
1404 link(contrib_head) = link(page_head);
1405 link(page_head) = 0;
1406 page_tail = page_head;
1415 build_discretionary();
1421 cur_tok = cs_token_flag + frozen_cr;
1422 print_err("Missing ");
1425 help1("I'm guessing that you meant to end an alignment here.");
1430 case no_align_group:
1442 save_ptr = save_ptr - 2;
1443 p = vpackage(link(head), saved(1), saved(0), max_dimen);
1445 tail_append(new_noad());
1446 type(tail) = vcenter_noad;
1447 math_type(nucleus(tail)) = sub_box;
1448 info(nucleus(tail)) = p;
1452 case math_choice_group:
1460 math_type(saved(0)) = sub_mlist;
1466 if (type(p) == ord_noad)
1468 if (math_type(subscr(p)) == 0)
1469 if (math_type(supscr(p)) == 0)
1471 mem[saved(0)].hh = mem[nucleus(p)].hh;
1472 free_node(p, noad_size);
1475 else if (type(p) == accent_noad)
1476 if (saved(0) == nucleus(tail))
1477 if (type(tail) == ord_noad)
1481 while (link(q) != tail)
1485 free_node(tail, noad_size);
1492 confusion("rightbrace");
1499 void main_control (void)
1502 integer bSuppress; /* 199/Jan/5 */
1505 begin_token_list(every_job, every_job_text);
1512 if (OK_to_interrupt)
1524 if (tracing_commands > 0)
1527 switch (abs(mode) + cur_cmd)
1529 case hmode + letter:
1530 case hmode + other_char:
1531 case hmode + char_given:
1535 case hmode + char_num:
1543 case hmode + no_boundary:
1547 if ((cur_cmd == letter) || (cur_cmd == other_char) ||
1548 (cur_cmd == char_given) || (cur_cmd == char_num))
1549 cancel_boundary = true;
1554 case hmode + spacer:
1555 if (space_factor == 1000)
1556 goto append_normal_space;
1561 case hmode + ex_space:
1562 case mmode + ex_space:
1563 goto append_normal_space;
1566 case any_mode(relax):
1567 case vmode + spacer:
1568 case mmode + spacer:
1569 case mmode + no_boundary:
1573 case any_mode(ignore_spaces):
1579 while (!(cur_cmd != spacer));
1592 case any_mode(last_item):
1593 case vmode + vadjust:
1594 case vmode + ital_corr:
1595 case non_math(eq_no):
1596 case any_mode(mac_param):
1597 report_illegal_case();
1600 case non_math(sup_mark):
1601 case non_math(sub_mark):
1602 case non_math(math_char_num):
1603 case non_math(math_given):
1604 case non_math(math_comp):
1605 case non_math(delim_num):
1606 case non_math(left_right):
1607 case non_math(above):
1608 case non_math(radical):
1609 case non_math(math_style):
1610 case non_math(math_choice):
1611 case non_math(vcenter):
1612 case non_math(non_script):
1613 case non_math(mkern):
1614 case non_math(limit_switch):
1615 case non_math(mskip):
1616 case non_math(math_accent):
1618 case mmode + par_end:
1621 case mmode + un_vbox:
1622 case mmode + valign:
1624 insert_dollar_sign();
1631 tail_append(scan_rule_spec());
1633 if (abs(mode) == vmode)
1634 prev_depth = ignore_depth;
1635 else if (abs(mode) == hmode)
1636 space_factor = 1000;
1647 case any_mode(kern):
1652 case non_math(left_brace):
1653 new_save_level(simple_group);
1656 case any_mode(begin_group):
1657 new_save_level(semi_simple_group);
1660 case any_mode(end_group):
1661 if (cur_group == semi_simple_group)
1667 case any_mode(right_brace):
1668 handle_right_brace();
1676 scan_dimen(false, false, false);
1681 scan_box(- (integer) cur_val);
1685 case any_mode(leader_ship):
1686 scan_box(leader_flag - a_leaders + cur_chr);
1689 case any_mode(make_box):
1693 case vmode + start_par:
1694 new_graf(cur_chr > 0);
1697 case vmode + letter:
1698 case vmode + other_char:
1699 case vmode + char_num:
1700 case vmode + char_given:
1701 case vmode + math_shift:
1702 case vmode + un_hbox:
1704 case vmode + accent:
1705 case vmode + discretionary:
1707 case vmode + valign:
1708 case vmode + ex_space:
1709 case vmode + no_boundary:
1716 case hmode + start_par:
1717 case mmode + start_par:
1721 case vmode + par_end:
1730 case hmode + par_end:
1732 if (align_state < 0)
1745 case hmode + un_vbox:
1746 case hmode + halign:
1750 case any_mode(insert):
1751 case hmode + vadjust:
1752 case mmode + vadjust:
1753 begin_insert_or_adjust();
1756 case any_mode(mark):
1760 case any_mode(break_penalty):
1764 case any_mode(remove_item):
1768 case vmode + un_vbox:
1769 case hmode + un_hbox:
1770 case mmode + un_hbox:
1774 case hmode + ital_corr:
1775 append_italic_correction();
1778 case mmode + ital_corr:
1779 tail_append(new_kern(0));
1782 case hmode + discretionary:
1783 case mmode + discretionary:
1784 append_discretionary();
1787 case hmode + accent:
1791 case any_mode(car_ret):
1792 case any_mode(tab_mark):
1796 case any_mode(no_align):
1800 case any_mode(omit):
1804 case vmode + halign:
1805 case hmode + valign:
1809 case mmode + halign:
1811 if (cur_group == math_shift_group)
1822 case any_mode(end_cs_name):
1826 case hmode + math_shift:
1832 if (cur_group == math_shift_group)
1838 case mmode + left_brace:
1840 tail_append(new_noad());
1842 scan_math(nucleus(tail));
1846 case mmode + letter:
1847 case mmode + other_char:
1848 case mmode + char_given:
1849 set_math_char(math_code(cur_chr));
1852 case mmode + char_num:
1856 set_math_char(math_code(cur_chr));
1860 case mmode + math_char_num:
1862 scan_fifteen_bit_int();
1863 set_math_char(cur_val);
1867 case mmode + math_given:
1868 set_math_char(cur_chr);
1871 case mmode + delim_num:
1873 scan_twenty_seven_bit_int();
1874 set_math_char(cur_val / 4096);
1878 case mmode + math_comp:
1880 tail_append(new_noad());
1881 type(tail) = cur_chr;
1882 scan_math(nucleus(tail));
1886 case mmode + limit_switch:
1887 math_limit_switch();
1890 case mmode + radical:
1894 case mmode + accent:
1895 case mmode + math_accent:
1899 case mmode + vcenter:
1901 scan_spec(vcenter_group, false);
1905 prev_depth = ignore_depth;
1907 if (every_vbox != 0)
1908 begin_token_list(every_vbox, every_vbox_text);
1912 case mmode + math_style:
1913 tail_append(new_style(cur_chr));
1916 case mmode + non_script:
1918 tail_append(new_glue(0));
1919 subtype(tail) = cond_math_glue;
1923 case mmode + math_choice:
1927 case mmode + sub_mark:
1928 case mmode + sup_mark:
1936 case mmode + left_right:
1940 case mmode + math_shift:
1941 if (cur_group == math_shift_group)
1947 case any_mode(toks_register):
1948 case any_mode(assign_toks):
1949 case any_mode(assign_int):
1950 case any_mode(assign_dimen):
1951 case any_mode(assign_glue):
1952 case any_mode(assign_mu_glue):
1953 case any_mode(assign_font_dimen):
1954 case any_mode(assign_font_int):
1955 case any_mode(set_aux):
1956 case any_mode(set_prev_graf):
1957 case any_mode(set_page_dimen):
1958 case any_mode(set_page_int):
1959 case any_mode(set_box_dimen):
1960 case any_mode(set_shape):
1961 case any_mode(def_code):
1962 case any_mode(def_family):
1963 case any_mode(set_font):
1964 case any_mode(def_font):
1965 case any_mode(tex_register):
1966 case any_mode(advance):
1967 case any_mode(multiply):
1968 case any_mode(divide):
1969 case any_mode(prefix):
1971 case any_mode(shorthand_def):
1972 case any_mode(read_to_cs):
1974 case any_mode(set_box):
1975 case any_mode(hyph_data):
1976 case any_mode(set_interaction):
1980 case any_mode(after_assignment):
1983 after_token = cur_tok;
1987 case any_mode(after_group):
1990 save_for_after(cur_tok);
1994 case any_mode(in_stream):
1998 case any_mode(message):
2002 case any_mode(case_shift):
2006 case any_mode(xray):
2010 case any_mode(extension):
2018 adjust_space_factor();
2020 bchar = font_bchar[main_f];
2021 false_bchar = font_false_bchar[main_f];
2024 if (language != clang)
2027 fast_get_avail(lig_stack);
2028 font(lig_stack) = main_f;
2030 character(lig_stack) = cur_l;
2033 if (cancel_boundary)
2035 cancel_boundary = false;
2036 main_k = non_address;
2039 main_k = bchar_label[main_f];
2041 if (main_k == non_address)
2042 goto main_loop_move_2;
2046 goto main_lig_loop_1;
2056 cur_l = character(lig_stack);
2059 if (!is_char_node(lig_stack))
2060 goto main_loop_move_lig;
2063 if ((cur_chr < font_bc[main_f]) || (cur_chr > font_ec[main_f]))
2065 char_warning(main_f, cur_chr);
2066 free_avail(lig_stack);
2070 main_i = char_info(main_f, cur_l);
2072 if (!char_exists(main_i))
2074 char_warning(main_f, cur_chr);
2075 free_avail(lig_stack);
2079 link(tail) = lig_stack;
2082 main_loop_lookahead:
2085 if (cur_cmd == letter)
2086 goto main_loop_lookahead_1;
2088 if (cur_cmd == other_char)
2089 goto main_loop_lookahead_1;
2091 if (cur_cmd == char_given)
2092 goto main_loop_lookahead_1;
2096 if (cur_cmd == letter)
2097 goto main_loop_lookahead_1;
2099 if (cur_cmd == other_char)
2100 goto main_loop_lookahead_1;
2102 if (cur_cmd == char_given)
2103 goto main_loop_lookahead_1;
2105 if (cur_cmd == char_num)
2109 goto main_loop_lookahead_1;
2112 if (cur_cmd == no_boundary)
2119 main_loop_lookahead_1:
2120 adjust_space_factor();
2121 fast_get_avail(lig_stack);
2122 font(lig_stack) = main_f;
2124 character(lig_stack) = cur_r;
2126 if (cur_r == false_bchar)
2130 if (char_tag(main_i) != lig_tag)
2131 goto main_loop_wrapup;
2133 if (cur_r == non_char)
2134 goto main_loop_wrapup;
2136 main_k = lig_kern_start(main_f, main_i);
2137 main_j = font_info[main_k].qqqq;
2139 if (skip_byte(main_j) <= stop_flag)
2140 goto main_lig_loop_2;
2142 main_k = lig_kern_restart(main_f, main_j);
2145 main_j = font_info[main_k].qqqq;
2150 if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
2156 if (next_char(main_j) == cur_r && bSuppress == 0)
2157 if (skip_byte(main_j) <= stop_flag)
2159 if (op_byte(main_j) >= kern_flag)
2162 tail_append(new_kern(char_kern(main_f, main_j)));
2163 goto main_loop_move;
2166 if (cur_l == non_char)
2168 else if (lig_stack == 0)
2173 switch (op_byte(main_j))
2178 cur_l = rem_byte(main_j);
2179 main_i = char_info(main_f, cur_l);
2180 ligature_present = true;
2186 cur_r = rem_byte(main_j);
2190 lig_stack = new_lig_item(cur_r);
2193 else if (is_char_node(lig_stack))
2196 lig_stack = new_lig_item(cur_r);
2197 lig_ptr(lig_stack) = main_p;
2200 character(lig_stack) = cur_r;
2205 cur_r = rem_byte(main_j);
2207 lig_stack = new_lig_item(cur_r);
2208 link(lig_stack) = main_p;
2216 cur_l = rem_byte(main_j);
2217 main_i = char_info(main_f, cur_l);
2218 ligature_present = true;
2223 cur_l = rem_byte(main_j);
2224 ligature_present = true;
2227 goto main_loop_wrapup;
2229 goto main_loop_move_1;
2234 if (op_byte(main_j) > 4)
2235 if (op_byte(main_j) != 7)
2236 goto main_loop_wrapup;
2238 if (cur_l < non_char)
2241 main_k = bchar_label[main_f];
2242 goto main_lig_loop_1;
2245 if (skip_byte(main_j) == 0)
2249 if (skip_byte(main_j) >= stop_flag)
2250 goto main_loop_wrapup;
2252 main_k = main_k + skip_byte(main_j) + 1;
2255 goto main_lig_loop_1;
2258 main_p = lig_ptr(lig_stack);
2261 tail_append(main_p);
2263 temp_ptr = lig_stack;
2264 lig_stack = link(temp_ptr);
2265 free_node(temp_ptr, small_node_size);
2266 main_i = char_info(main_f, cur_l);
2267 ligature_present = true;
2271 goto main_loop_lookahead;
2275 cur_r = character(lig_stack);
2279 append_normal_space:
2280 if (space_skip == 0)
2283 main_p = font_glue[cur_font];
2287 main_p = new_spec(zero_glue);
2288 main_k = param_base[cur_font] + space_code;
2289 width(main_p) = font_info[main_k].cint;
2290 stretch(main_p) = font_info[main_k + 1].cint;
2291 shrink(main_p) = font_info[main_k + 2].cint;
2292 font_glue[cur_font] = main_p;
2296 temp_ptr = new_glue(main_p);
2299 temp_ptr = new_param_glue(space_skip_code);
2301 link(tail) = temp_ptr;