6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
11 #pragma warning(disable:4996)
12 #pragma warning(disable:4131) // old style declarator
13 #pragma warning(disable:4135) // conversion between different integral types
14 #pragma warning(disable:4127) // conditional expression is constant
22 #pragma warning(disable:4244) /* 96/Jan/10 */
24 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
26 /* math_fraction etc used to be in tex7.c */
28 void math_fraction (void)
34 if (incompleat_noad != 0)
36 if (c >= delimited_code)
38 scan_delimiter(garbage, false);
39 scan_delimiter(garbage, false);
42 if (c % delimited_code == 0)
43 scan_dimen(false, false, false);
45 print_err("Ambiguous; you need another { and }");
46 help3("I'm ignoring this fraction specification, since I don't",
47 "know whether a construction like `x \\over y \\over z'",
48 "means `{x \\over y} \\over z' or `x \\over {y \\over z}'.");
53 incompleat_noad = get_node(fraction_noad_size);
54 type(incompleat_noad) = fraction_noad;
55 subtype(incompleat_noad) = normal;
56 math_type(numerator(incompleat_noad)) = sub_mlist;
57 info(numerator(incompleat_noad)) = link(head);
58 mem[denominator(incompleat_noad)].hh = empty_field;
59 mem[left_delimiter(incompleat_noad)].qqqq = null_delimiter;
60 mem[right_delimiter(incompleat_noad)].qqqq = null_delimiter;
64 if (c >= delimited_code)
66 scan_delimiter(left_delimiter(incompleat_noad), false);
67 scan_delimiter(right_delimiter(incompleat_noad), false);
70 switch(c % delimited_code)
73 scan_dimen(false, false, false);
74 thickness(incompleat_noad) = cur_val;
78 thickness(incompleat_noad) = default_code;
82 thickness(incompleat_noad) = 0;
88 void math_left_right (void)
95 if ((t == right_noad) && (cur_group != math_left_group))
97 if (cur_group == math_shift_group)
99 scan_delimiter(garbage, false);
102 help1("I'm ignoring a \\right that had no matching \\left.");
114 scan_delimiter(delimiter(p), false);
118 push_math(math_left_group);
126 tail_append(new_noad());
127 type(tail) = inner_noad;
128 math_type(nucleus(tail)) = sub_mlist;
129 info(nucleus(tail)) = p;
134 void after_math (void)
154 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
155 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
156 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
158 print_err("Math formula deleted: Insufficient symbol fonts");
159 help3("Sorry, but I can't typeset math unless \\textfont 2",
160 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
161 "the \\fontdimen values needed in math symbol fonts.");
166 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
167 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
168 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
170 print_err("Math formula deleted: Insufficient extension fonts");
171 help3("Sorry, but I can't typeset math unless \\textfont 3",
172 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
173 "the \\fontdimen values needed in math extension fonts.");
183 if (mode == - (integer) m)
188 if (cur_cmd != math_shift)
190 print_err("Display math should end with $$");
191 help2("The `$' that I just saw supposedly matches a previous `$$'.",
192 "So I shall assume that you typed `$$' both times.");
198 cur_style = text_style;
199 mlist_penalties = false;
201 a = hpack(link(temp_head), 0, 1);
210 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
211 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
212 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
214 print_err("Math formula deleted: Insufficient symbol fonts");
215 help3("Sorry, but I can't typeset math unless \\textfont 2",
216 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
217 "the \\fontdimen values needed in math symbol fonts.");
222 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
223 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
224 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
226 print_err("Math formula deleted: Insufficient extension fonts");
227 help3("Sorry, but I can't typeset math unless \\textfont 3",
228 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
229 "the \\fontdimen values needed in math extension fonts.");
243 tail_append(new_math(math_surround, 0));
245 cur_style = text_style;
246 mlist_penalties = (mode > 0);
248 link(tail) = link(temp_head);
250 while(link(tail) != 0)
253 tail_append(new_math(math_surround, 1));
263 if (cur_cmd != math_shift)
265 print_err("Display math should end with $$");
266 help2("The `$' that I just saw supposedly matches a previous `$$'.",
267 "So I shall assume that you typed `$$' both times.");
273 cur_style = display_style;
274 mlist_penalties = false;
277 adjust_tail = adjust_head;
286 if ((a == 0) || danger)
294 q = e + math_quad(text_size);
299 if ((e != 0) && ((w - total_shrink[normal] + q <= z) || (total_shrink[fil] != 0) || (total_shrink[fill] != 0) || (total_shrink[filll] != 0)))
301 free_node(b, box_node_size);
302 b = hpack(p, z - q, 0);
310 free_node(b, box_node_size);
319 if ((e > 0) && (d < 2 * e))
324 if (!(p >= hi_mem_min))
325 if (type(p) == glue_node)
329 tail_append(new_penalty(pre_display_penalty));
331 if ((d + s <= pre_display_size) || l)
333 g1 = above_display_skip_code;
334 g2 = below_display_skip_code;
338 g1 = above_display_short_skip_code;
339 g2 = below_display_short_skip_code;
345 tail_append(new_penalty(10000));
349 tail_append(new_param_glue(g1));
354 r = new_kern(z - w - e - d);
371 shift_amount(b) = s + d;
374 if ((a != 0) && (e == 0) && !l)
376 tail_append(new_penalty(10000));
377 shift_amount(a) = s + z - width(a);
382 if (t != adjust_head)
384 link(tail) = link(adjust_head);
388 tail_append(new_penalty(post_display_penalty));
392 tail_append(new_param_glue(g2));
395 resume_after_display();
399 void resume_after_display (void)
401 if (cur_group != math_shift_group)
403 confusion("display");
404 return; // abort_flag set
408 prev_graf = prev_graf + 3;
414 prev_graf =(norm_min(left_hyphen_min) * 64 + norm_min(right_hyphen_min)) * 65536L + cur_lang;
419 if (cur_cmd != spacer)
429 void get_r_token (void)
436 while (!(cur_tok != space_token));
438 if ((cur_cs == 0) || (cur_cs > frozen_control_sequence))
440 print_err("Missing control sequence inserted");
441 help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
442 "I've inserted an inaccessible control sequence so that your",
443 "definition will be completed without mixing me up too badly.",
444 "You can recover graciously from this error, if you're",
445 "careful; see exercise 27.2 in The TeXbook.");
450 cur_tok = cs_token_flag + frozen_protection;
456 void trap_zero_glue (void)
458 if ((width(cur_val) == 0) && (stretch(cur_val) == 0) && (shrink(cur_val) == 0))
460 add_glue_ref(zero_glue);
461 delete_glue_ref(cur_val);
466 void do_register_command_ (small_number a)
474 if (q != tex_register)
478 if ((cur_cmd >= assign_int) && (cur_cmd <= assign_mu_glue))
481 p = cur_cmd - assign_int;
485 if (cur_cmd != tex_register)
487 print_err("You can't use `");
488 print_cmd_chr(cur_cmd, cur_chr);
489 print_string("' after ");
491 help1("I'm forgetting what you said and not changing anything.");
498 scan_eight_bit_int();
503 l = cur_val + count_base;
507 l = cur_val + scaled_base;
511 l = cur_val + skip_base;
515 l = cur_val + mu_skip_base;
521 if (q == tex_register)
522 scan_optional_equals();
524 if (scan_keyword("by"));
534 scan_dimen(false, false, false);
537 cur_val = cur_val + eqtb[l].cint;
545 q = new_spec(cur_val);
547 delete_glue_ref(cur_val);
548 width(q) = width(q) + width(r);
551 stretch_order(q) = normal;
553 if (stretch_order(q) == stretch_order(r))
554 stretch(q) = stretch(q) + stretch(r);
555 else if ((stretch_order(q) < stretch_order(r)) && (stretch(r) != 0))
557 stretch(q) = stretch(r);
558 stretch_order(q) = stretch_order(r);
562 shrink_order(q) = normal;
564 if (shrink_order(q) == shrink_order(r))
565 shrink(q) = shrink(q) + shrink(r);
566 else if ((shrink_order(q) < shrink_order(r)) && (shrink(r) != 0))
568 shrink(q) = shrink(r);
569 shrink_order(q) = shrink_order(r);
581 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 2147483647L); /* 2^31 - 1 */
583 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 1073741823L); /* 2^30 - 1 */
585 cur_val = x_over_n(eqtb[l].cint, cur_val);
593 width(r) = mult_and_add(width(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
594 stretch(r) = mult_and_add(stretch(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
595 shrink(r) = mult_and_add(shrink(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
599 width(r) = x_over_n(width(s), cur_val);
600 stretch(r) = x_over_n(stretch(s), cur_val);
601 shrink(r) = x_over_n(shrink(s), cur_val);
609 print_err("Arithmetic overflow");
610 help2("I can't carry out that multiplication or division,",
611 "since the result is out of range.");
614 delete_glue_ref(cur_val);
623 geq_word_define(l, cur_val);
625 eq_word_define(l, cur_val);
632 geq_define(l, glue_ref, cur_val);
634 eq_define(l, glue_ref, cur_val);
637 /* called only from itex.c */
639 void alter_aux (void)
643 if (cur_chr != abs(mode))
645 report_illegal_case();
650 scan_optional_equals();
654 scan_dimen(false, false, false);
655 prev_depth = cur_val;
661 if ((cur_val <= 0) || (cur_val > 32767))
663 print_err("Bad space factor");
664 help1("I allow only values in the range 1..32767 here.");
668 space_factor = cur_val;
673 void alter_prev_graf (void)
677 nest[nest_ptr] = cur_list;
680 while(abs(nest[p].mode_field) != vmode)
683 scan_optional_equals();
689 print_esc("prevgraf");
690 help1("I allow only nonnegative values here.");
695 nest[p].pg_field = cur_val;
696 cur_list = nest[nest_ptr];
700 void alter_page_so_far (void)
705 scan_optional_equals();
706 scan_dimen(false, false, false);
707 page_so_far[c] = cur_val;
710 void alter_integer (void)
715 scan_optional_equals();
719 dead_cycles = cur_val;
721 insert_penalties = cur_val;
724 void alter_box_dimen (void)
730 scan_eight_bit_int();
732 scan_optional_equals();
733 scan_dimen(false, false, false);
736 mem[box(b) + c].cint = cur_val;
739 void new_font_(small_number a)
743 internal_font_number f;
746 str_number flushable_string;
756 else if (u >= single_base)
763 old_setting = selector;
765 print_string("FONT");
766 print(u - active_base);
767 selector = old_setting;
773 geq_define(u, set_font, 0);
775 eq_define(u, set_font, 0);
777 scan_optional_equals();
780 name_in_progress = true;
782 if (scan_keyword("at"))
784 scan_dimen(false, false, false);
787 if ((s <= 0) || (s >= 134217728L)) /* 2^27 */
789 print_err("Improper `at' size (");
791 print_string("pt), replaced by 10pt");
792 help2("I can only handle fonts at positive sizes that are",
793 "less than 2048pt, so I've changed what you said to 10pt.");
795 s = 10 * 65536L; /* 10pt */
798 else if (scan_keyword("scaled"))
801 s = - (integer) cur_val;
803 if ((cur_val <= 0) || (cur_val > 32768L))
805 print_err("Illegal magnification has been changed to 1000");
806 help1("The magnification ratio must be between 1 and 32768.");
814 name_in_progress = false;
816 flushable_string = str_ptr - 1;
818 if (trace_flag) /* debugging stuff only 98/Oct/5 */
820 int i, k1, k2, l1, l2;
821 char *sch = log_line;
822 k1 = str_start[cur_area];
823 k2 = str_start[cur_name];
824 l1 = length(cur_area);
825 l2 = length(cur_name);
827 show_line("FONT ", 0);
829 for (i = 0; i < l1; i++)
831 *sch++ = str_pool[i + k1];
834 for (i = 0; i < l2; i++)
836 *sch++ = str_pool[i + k2];
841 show_line(log_line, 0);
844 for (f = font_base + 1; f < font_ptr; f++)
846 if (str_eq_str(font_name[f], cur_name) && str_eq_str(font_area[f], cur_area))
848 if (cur_name == flushable_string)
851 cur_name = font_name[f];
856 if (s == font_size[f])
858 if (ignore_frozen == 0 || f > frozenfontptr)
862 sprintf(log_line, "SKIPPING %ld ", s);
863 show_line(log_line, 0);
869 else if (font_size[f] == xn_over_d(font_dsize[f], - (integer) s, 1000))
871 if (ignore_frozen == 0 || f > frozenfontptr) /* 99/Mar/26 */
875 sprintf(log_line, "SKIPPING %ld ", s);
876 show_line(log_line, 0);
885 show_line("READING ", 0);
887 f = read_font_info(u, cur_name, cur_area, s);
892 sprintf(log_line, "NEW FONT %d ", f);
893 show_line(log_line, 0);
897 eqtb[font_id_base + f] = eqtb[u];
902 sprintf(log_line, "ERROR: %s too large %d\n", "hash_used", t);
903 show_line(log_line, 1);
909 void new_interaction (void)
912 interaction = cur_chr;
914 if (interaction == batch_mode)
917 selector = term_only;
920 selector = selector + 2;
923 void do_assignments (void)
931 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
933 if (cur_cmd <= max_non_prefixed_command)
936 set_box_allowed = false;
938 set_box_allowed = true;
942 void open_or_close_in (void)
951 if (read_open[n] != closed)
953 (void) a_close(read_file[n]);
954 read_open[n] = closed;
959 scan_optional_equals();
961 pack_file_name(cur_name, cur_area, cur_ext);
963 /* *** some changes in following in 3.14159 *** */
964 /* if current extension is *not* empty, try to open using name as is */
965 /* string 335 is "" the empty string */
966 if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
968 /* we get here if extension is "", or file with extension failed to open */
969 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
970 /* string 785 is .tex */
971 else if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
973 name_of_file[name_length + 1] = '.';
974 name_of_file[name_length + 2] = 't';
975 name_of_file[name_length + 3] = 'e';
976 name_of_file[name_length + 4] = 'x';
977 name_of_file[name_length + 5] = ' ';
978 name_length = name_length + 4;
980 if (a_open_in(read_file[n], TEXINPUTPATH))
981 read_open[n] = just_open;
984 name_length = name_length - 4; /* remove ".tex" again */
985 name_of_file[name_length + 1] = ' ';
987 if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
994 void issue_message (void)
1001 link(garbage) = scan_toks(false, true);
1002 old_setting = selector;
1003 selector = new_string;
1004 token_show(def_ref);
1005 selector = old_setting;
1006 flush_list(def_ref);
1012 if (term_offset + length(s) > max_print_line - 2)
1014 else if ((term_offset > 0) || (file_offset > 0))
1029 use_err_help = true;
1030 else if (long_help_seen)
1031 help1("(That was another \\errmessage.)");
1034 if (interaction < error_stop_mode)
1035 long_help_seen = true;
1037 help4("This error message was generated by an \\errmessage",
1038 "command, so I can't give any explicit help.",
1039 "Pretend that you're Hercule Poirot: Examine all clues,",
1040 "and deduce the truth by order and method.");
1044 use_err_help = false;
1050 void shift_case (void)
1058 p = scan_toks(false, false);
1065 if (t < cs_token_flag + single_base)
1069 if (equiv(b + c) != 0)
1070 info(p) = t - c + equiv(b + c);
1076 begin_token_list(link(def_ref), 3);
1077 free_avail(def_ref);
1080 void show_whatever (void)
1095 scan_eight_bit_int();
1097 print_nl("> \\box");
1101 if (box(cur_val) == 0)
1102 print_string("void");
1104 show_box(box(cur_val));
1112 if (interaction == error_stop_mode)
1132 if (interaction == error_stop_mode)
1136 token_show(temp_head);
1137 flush_list(link(temp_head));
1143 end_diagnostic(true);
1146 if (selector == term_and_log)
1147 if (tracing_online <= 0)
1149 selector = term_only;
1150 print_string(" (see the transcript file)");
1151 selector = term_and_log;
1156 if (interaction < error_stop_mode)
1161 else if (tracing_online > 0)
1163 help3("This isn't an error message; I'm just \\showing something.",
1164 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1165 "\\showthe\\count10, \\showbox255, \\showlists).");
1169 help5("This isn't an error message; I'm just \\showing something.",
1170 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1171 "\\showthe\\count10, \\showbox255, \\showlists).",
1172 "And type `I\\tracingonline=1\\show...' to show boxes and",
1173 "lists on your terminal as well as in the transcript file.");
1178 void new_whatsit_(small_number s, small_number w)
1183 type(p) = whatsit_node;
1189 void new_write_whatsit_(small_number w)
1191 new_whatsit(cur_chr, w);
1193 if (w != write_node_size)
1195 scan_four_bit_int();
1203 else if (cur_val > 15)
1207 write_stream(tail) = cur_val;
1210 void do_extension (void)
1212 /* integer i, j, k; */
1214 /* halfword p, q, r; */
1221 new_write_whatsit(open_node_size);
1222 scan_optional_equals();
1224 open_name(tail) = cur_name;
1225 open_area(tail) = cur_area;
1226 open_ext(tail) = cur_ext;
1233 new_write_whatsit(write_node_size);
1235 p = scan_toks(false, false);
1236 write_tokens(tail) = def_ref;
1242 new_write_whatsit(write_node_size);
1243 write_tokens(tail) = 0;
1249 new_whatsit(special_node, write_node_size);
1250 write_stream(tail) = 0;
1251 p = scan_toks(false, true);
1252 write_tokens(tail) = def_ref;
1256 case immediate_code:
1260 if ((cur_cmd == extension) && (cur_chr <= close_node))
1265 flush_node_list(tail);
1274 case set_language_code:
1275 if (abs(mode) != hmode)
1277 report_illegal_case();
1281 new_whatsit(language_node, small_node_size);
1286 else if (cur_val > 255)
1291 what_lang(tail) = clang;
1292 what_lhm(tail) = norm_min(left_hyphen_min);
1293 what_rhm(tail) = norm_min(right_hyphen_min);
1300 return; // abort_flag set
1306 void fix_language (void)
1309 int l; /* 95/Jan/7 */
1313 else if (language > 255)
1320 new_whatsit(language_node, small_node_size);
1321 what_lang(tail) = l;
1323 what_lhm(tail) = norm_min(left_hyphen_min);
1324 what_rhm(tail) = norm_min(right_hyphen_min);
1328 void handle_right_brace (void)
1342 print_err("Too many }'s");
1343 help2("You've closed more groups than you opened.",
1344 "Such booboos are generally harmless, so keep going.");
1349 case semi_simple_group:
1350 case math_shift_group:
1351 case math_left_group:
1352 extra_right_brace();
1359 case adjust_hbox_group:
1361 adjust_tail = adjust_head;
1385 d = split_max_depth;
1386 f = floating_penalty;
1389 p = vpackage(link(head), 0, 1, 1073741823L); /* 2^30 - 1 */
1394 tail_append(get_node(ins_node_size));
1395 type(tail) = ins_node;
1396 subtype(tail) = saved(0);
1397 height(tail) = height(p) + depth(p);
1398 ins_ptr(tail) = list_ptr(p);
1399 split_top_ptr(tail) = q;
1401 float_cost(tail) = f;
1405 tail_append(get_node(small_node_size));
1406 type(tail) = adjust_node;
1408 adjust_ptr(tail) = list_ptr(p);
1411 free_node(p, box_node_size);
1421 if ((cur_input.loc_field != 0) || ((token_type != output_text) && (token_type != backed_up)))
1423 print_err("Unbalanced output routine");
1424 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1425 "I can't handle that very well; good luck.");
1432 while (!(cur_input.loc_field == 0));
1438 output_active = false;
1439 insert_penalties = 0;
1443 print_err("Output routine didn't use all of ");
1446 help3("Your \\output commands should empty \\box255,",
1447 "e.g., by saying `\\shipout\\box255'.",
1448 "Proceed; I'll discard its present contents.");
1454 link(page_tail) = link(head);
1458 if (link(page_head) != 0)
1460 if (link(contrib_head) == 0)
1461 nest[0].tail_field = page_tail;
1463 link(page_tail) = link(contrib_head);
1464 link(contrib_head) = link(page_head);
1465 link(page_head) = 0;
1466 page_tail = page_head;
1474 build_discretionary();
1480 cur_tok = cs_token_flag + frozen_cr;
1481 print_err("Missing ");
1483 print_string("inserted");
1484 help1("I'm guessing that you meant to end an alignment here.");
1489 case no_align_group:
1501 save_ptr = save_ptr - 2;
1502 p = vpackage(link(head), saved(1), saved(0), 1073741823L); /* 2^30 - 1 */
1504 tail_append(new_noad());
1505 type(tail) = vcenter_noad;
1506 math_type(nucleus(tail)) = sub_box;
1507 info(nucleus(tail)) = p;
1511 case math_choice_group:
1519 math_type(saved(0)) = sub_mlist;
1525 if (type(p) == ord_noad)
1527 if (math_type(subscr(p)) == 0)
1528 if (math_type(supscr(p)) == 0)
1530 mem[saved(0)].hh = mem[nucleus(p)].hh;
1531 free_node(p, noad_size);
1534 else if (type(p) == accent_noad)
1535 if (saved(0) == nucleus(tail))
1536 if (type(tail) == ord_noad)
1540 while(link(q) != tail)
1544 free_node(tail, noad_size);
1551 confusion("rightbrace");
1552 return; // abort_flag set
1558 void main_control (void)
1561 integer bSuppress; /* 199/Jan/5 */
1564 begin_token_list(every_job, every_job_text);
1567 get_x_token(); /* big_switch */
1571 if (OK_to_interrupt)
1577 pause_for_instructions();
1588 if (tracing_commands > 0)
1591 /* the big switch --- don't bother to test abort_flag ??? */
1592 switch(abs(mode) + cur_cmd)
1594 case hmode + letter:
1595 case hmode + other_char:
1596 case hmode + char_given:
1600 case hmode + char_num:
1608 case hmode + no_boundary:
1612 if ((cur_cmd == letter) || (cur_cmd == other_char) ||
1613 (cur_cmd == char_given) || (cur_cmd == char_num))
1614 cancel_boundary = true;
1619 case hmode + spacer:
1620 if (space_factor == 1000)
1626 case hmode + ex_space:
1627 case mmode + ex_space:
1631 case any_mode(relax):
1632 case vmode + spacer:
1633 case mmode + spacer:
1634 case mmode + no_boundary:
1638 case any_mode(ignore_spaces):
1644 while(!(cur_cmd != spacer));
1657 case any_mode(last_item):
1658 case vmode + vadjust:
1659 case vmode + ital_corr:
1660 case non_math(eq_no):
1661 case any_mode(mac_param):
1662 report_illegal_case();
1665 case non_math(sup_mark):
1666 case non_math(sub_mark):
1667 case non_math(math_char_num):
1668 case non_math(math_given):
1669 case non_math(math_comp):
1670 case non_math(delim_num):
1671 case non_math(left_right):
1672 case non_math(above):
1673 case non_math(radical):
1674 case non_math(math_style):
1675 case non_math(math_choice):
1676 case non_math(vcenter):
1677 case non_math(non_script):
1678 case non_math(mkern):
1679 case non_math(limit_switch):
1680 case non_math(mskip):
1681 case non_math(math_accent):
1683 case mmode + par_end:
1686 case mmode + un_vbox:
1687 case mmode + valign:
1689 insert_dollar_sign();
1696 tail_append(scan_rule_spec());
1698 if (abs(mode) == vmode)
1699 prev_depth = ignore_depth;
1700 else if (abs(mode) == hmode)
1701 space_factor = 1000;
1712 case any_mode(kern):
1717 case non_math(left_brace):
1718 new_save_level(simple_group);
1721 case any_mode(begin_group):
1722 new_save_level(semi_simple_group);
1725 case any_mode(end_group):
1726 if (cur_group == semi_simple_group)
1732 case any_mode(right_brace):
1733 handle_right_brace();
1741 scan_dimen(false, false, false);
1746 scan_box(- (integer) cur_val);
1750 case any_mode(leader_ship):
1751 scan_box(leader_flag - a_leaders + cur_chr);
1754 case any_mode(make_box):
1758 case vmode + start_par:
1759 new_graf(cur_chr > 0);
1762 case vmode + letter:
1763 case vmode + other_char:
1764 case vmode + char_num:
1765 case vmode + char_given:
1766 case vmode + math_shift:
1767 case vmode + un_hbox:
1769 case vmode + accent:
1770 case vmode + discretionary:
1772 case vmode + valign:
1773 case vmode + ex_space:
1774 case vmode + no_boundary:
1781 case hmode + start_par:
1782 case mmode + start_par:
1786 case vmode + par_end:
1795 case hmode + par_end:
1797 if (align_state < 0)
1810 case hmode + un_vbox:
1811 case hmode + halign:
1815 case any_mode(insert):
1816 case hmode + vadjust:
1817 case mmode + vadjust:
1818 begin_insert_or_adjust();
1821 case any_mode(mark):
1825 case any_mode(break_penalty):
1829 case any_mode(remove_item):
1833 case vmode + un_vbox:
1834 case hmode + un_hbox:
1835 case mmode + un_hbox:
1839 case hmode + ital_corr:
1840 append_italic_correction();
1843 case mmode + ital_corr:
1844 tail_append(new_kern(0));
1847 case hmode + discretionary:
1848 case mmode + discretionary:
1849 append_discretionary();
1852 case hmode + accent:
1856 case any_mode(car_ret):
1857 case any_mode(tab_mark):
1861 case any_mode(no_align):
1865 case any_mode(omit):
1869 case vmode + halign:
1870 case hmode + valign:
1874 case mmode + halign:
1876 if (cur_group == math_shift_group)
1887 case any_mode(end_cs_name):
1891 case hmode + math_shift:
1897 if (cur_group == math_shift_group)
1903 case mmode + left_brace:
1905 tail_append(new_noad());
1907 scan_math(nucleus(tail));
1911 case mmode + letter:
1912 case mmode + other_char:
1913 case mmode + char_given:
1914 set_math_char(math_code(cur_chr));
1917 case mmode + char_num:
1921 set_math_char(math_code(cur_chr));
1925 case mmode + math_char_num:
1927 scan_fifteen_bit_int();
1928 set_math_char(cur_val);
1932 case mmode + math_given:
1933 set_math_char(cur_chr);
1936 case mmode + delim_num:
1938 scan_twenty_seven_bit_int();
1939 set_math_char(cur_val / 4096);
1943 case mmode + math_comp:
1945 tail_append(new_noad());
1946 type(tail) = cur_chr;
1947 scan_math(nucleus(tail));
1951 case mmode + limit_switch:
1952 math_limit_switch();
1955 case mmode + radical:
1959 case mmode + accent:
1960 case mmode + math_accent:
1964 case mmode + vcenter:
1966 scan_spec(vcenter_group, false);
1970 prev_depth = ignore_depth;
1972 if (every_vbox != 0)
1973 begin_token_list(every_vbox, every_vbox_text);
1977 case mmode + math_style:
1978 tail_append(new_style(cur_chr));
1981 case mmode + non_script:
1983 tail_append(new_glue(0));
1984 subtype(tail) = cond_math_glue;
1988 case mmode + math_choice:
1992 case mmode + sub_mark:
1993 case mmode + sup_mark:
2001 case mmode + left_right:
2005 case mmode + math_shift:
2006 if (cur_group == math_shift_group)
2012 case any_mode(toks_register):
2013 case any_mode(assign_toks):
2014 case any_mode(assign_int):
2015 case any_mode(assign_dimen):
2016 case any_mode(assign_glue):
2017 case any_mode(assign_mu_glue):
2018 case any_mode(assign_font_dimen):
2019 case any_mode(assign_font_int):
2020 case any_mode(set_aux):
2021 case any_mode(set_prev_graf):
2022 case any_mode(set_page_dimen):
2023 case any_mode(set_page_int):
2024 case any_mode(set_box_dimen):
2025 case any_mode(set_shape):
2026 case any_mode(def_code):
2027 case any_mode(def_family):
2028 case any_mode(set_font):
2029 case any_mode(def_font):
2030 case any_mode(tex_register):
2031 case any_mode(advance):
2032 case any_mode(multiply):
2033 case any_mode(divide):
2034 case any_mode(prefix):
2036 case any_mode(shorthand_def):
2037 case any_mode(read_to_cs):
2039 case any_mode(set_box):
2040 case any_mode(hyph_data):
2041 case any_mode(set_interaction):
2045 case any_mode(after_assignment):
2048 after_token = cur_tok;
2052 case any_mode(after_group):
2055 save_for_after(cur_tok);
2059 case any_mode(in_stream):
2063 case any_mode(message):
2067 case any_mode(case_shift):
2071 case any_mode(xray):
2075 case any_mode(extension):
2078 } /* end of big switch */
2079 goto lab60; /* main_loop */
2082 adjust_space_factor();
2084 bchar = font_bchar[main_f];
2085 false_bchar = font_false_bchar[main_f];
2088 if (language != clang)
2094 lig_stack = get_avail();
2097 avail = mem[lig_stack].hh.v.RH;
2098 mem[lig_stack].hh.v.RH = 0;
2105 font(lig_stack) = main_f;
2107 character(lig_stack) = cur_l;
2110 if (cancel_boundary)
2112 cancel_boundary = false;
2113 main_k = non_address;
2116 main_k = bchar_label[main_f];
2118 if (main_k == non_address)
2128 /* main_loop_move */
2134 cur_l = character(lig_stack);
2137 if (!(lig_stack >= hi_mem_min))
2141 if ((cur_chr < font_bc[main_f]) || (cur_chr > font_ec[main_f]))
2143 char_warning(main_f, cur_chr);
2144 free_avail(lig_stack);
2148 main_i = char_info(main_f, cur_l);
2150 if (!(main_i.b0 > 0))
2152 char_warning(main_f, cur_chr);
2153 free_avail(lig_stack);
2157 link(tail) = lig_stack;
2161 /* main_loop_lookahead */
2165 if (cur_cmd == letter)
2167 if (cur_cmd == other_char)
2169 if (cur_cmd == char_given)
2174 if (cur_cmd == letter)
2176 if (cur_cmd == other_char)
2178 if (cur_cmd == char_given)
2181 if (cur_cmd == char_num)
2188 if (cur_cmd == no_boundary)
2196 adjust_space_factor();
2202 lig_stack = get_avail();
2205 avail = mem[lig_stack].hh.v.RH;
2206 mem[lig_stack].hh.v.RH = 0;
2213 font(lig_stack) = main_f;
2215 character(lig_stack) = cur_r;
2217 if (cur_r == false_bchar)
2220 // main_lig_loop:@<If there's a ligature/kern command relevant to |cur_l| and
2221 // |cur_r|, adjust the text appropriately; exit to |main_loop_wrapup|@>;
2224 if (char_tag(main_i) != lig_tag)
2227 if (cur_r == non_char)
2230 main_k = lig_kern_start(main_f, main_i);
2231 main_j = font_info[main_k].qqqq;
2233 if (skip_byte(main_j) <= stop_flag)
2236 main_k = lig_kern_restart(main_f, main_j);
2238 /* main_lig_loop+1:main_j:=font_info[main_k].qqqq; */
2240 main_j = font_info[main_k].qqqq;
2243 /* provide for suppression of f-ligatures 99/Jan/5 */
2246 if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
2252 if (next_char(main_j) == cur_r && bSuppress == 0) /* 99/Jan/5 */
2253 if (skip_byte(main_j) <= stop_flag)
2255 if (op_byte(main_j) >= kern_flag)
2258 tail_append(new_kern(char_kern(main_f, main_j)));
2262 if (cur_l == non_char)
2264 else if (lig_stack == 0)
2270 pause_for_instructions();
2274 switch (op_byte(main_j))
2279 cur_l = rem_byte(main_j);
2280 main_i = char_info(main_f, cur_l);
2281 ligature_present = true;
2287 cur_r = rem_byte(main_j);
2291 lig_stack = new_lig_item(cur_r);
2294 else if ((lig_stack >= hi_mem_min))
2297 lig_stack = new_lig_item(cur_r);
2298 lig_ptr(lig_stack) = main_p;
2301 character(lig_stack) = cur_r;
2306 cur_r = rem_byte(main_j);
2308 lig_stack = new_lig_item(cur_r);
2309 link(lig_stack) = main_p;
2317 cur_l = rem_byte(main_j);
2318 main_i = char_info(main_f, cur_l);
2319 ligature_present = true;
2324 cur_l = rem_byte(main_j);
2325 ligature_present = true;
2335 if (op_byte(main_j) > 4)
2336 if (op_byte(main_j) != 7)
2339 if (cur_l < non_char)
2342 main_k = bchar_label[main_f];
2346 if (skip_byte(main_j) == 0)
2350 if (skip_byte(main_j) >= stop_flag)
2353 main_k = main_k + skip_byte(main_j) + 1;
2360 main_p = lig_ptr(lig_stack);
2362 if (main_p != 0) /* BUG FIX */
2363 tail_append(main_p);
2365 temp_ptr = lig_stack;
2366 lig_stack = link(temp_ptr);
2367 free_node(temp_ptr, small_node_size);
2368 main_i = char_info(main_f, cur_l);
2369 ligature_present = true;
2372 if (main_p != 0) /* BUG FIX */
2377 cur_r = character(lig_stack);
2381 /* append_normal_space */
2383 if (space_skip == 0)
2386 main_p = font_glue[cur_font];
2390 main_p = new_spec(zero_glue);
2391 main_k = param_base[cur_font] + space_code;
2392 width(main_p) = font_info[main_k].cint;
2393 stretch(main_p) = font_info[main_k + 1].cint;
2394 shrink(main_p) = font_info[main_k + 2].cint;
2395 font_glue[cur_font] = main_p;
2398 temp_ptr = new_glue(main_p);
2401 temp_ptr = new_param_glue(space_skip_code);
2403 link(tail) = temp_ptr;
2407 /* give_err_help etc followed here in the old tex8.c */