6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
13 #pragma warning(disable:4996)
14 #pragma warning(disable:4131) // old style declarator
15 #pragma warning(disable:4135) // conversion between different integral types
16 #pragma warning(disable:4127) // conditional expression is constant
24 #pragma warning(disable:4244) /* 96/Jan/10 */
26 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
28 /* math_fraction etc used to be in tex7.c */
30 void math_fraction (void)
36 if (incompleat_noad != 0)
38 if (c >= delimited_code)
40 scan_delimiter(garbage, false);
41 scan_delimiter(garbage, false);
44 if (c % delimited_code == 0)
45 scan_dimen(false, false, false);
47 print_err("Ambiguous; you need another { and }");
48 help3("I'm ignoring this fraction specification, since I don't",
49 "know whether a construction like `x \\over y \\over z'",
50 "means `{x \\over y} \\over z' or `x \\over {y \\over z}'.");
55 incompleat_noad = get_node(fraction_noad_size);
56 type(incompleat_noad) = fraction_noad;
57 subtype(incompleat_noad) = normal;
58 math_type(numerator(incompleat_noad)) = sub_mlist;
59 info(numerator(incompleat_noad)) = link(head);
60 mem[denominator(incompleat_noad)].hh = empty_field;
61 mem[left_delimiter(incompleat_noad)].qqqq = null_delimiter;
62 mem[right_delimiter(incompleat_noad)].qqqq = null_delimiter;
66 if (c >= delimited_code)
68 scan_delimiter(left_delimiter(incompleat_noad), false);
69 scan_delimiter(right_delimiter(incompleat_noad), false);
72 switch(c % delimited_code)
75 scan_dimen(false, false, false);
76 thickness(incompleat_noad) = cur_val;
80 thickness(incompleat_noad) = default_code;
84 thickness(incompleat_noad) = 0;
90 void math_left_right (void)
97 if ((t == right_noad) && (cur_group != math_left_group))
99 if (cur_group == math_shift_group)
101 scan_delimiter(garbage, false);
104 help1("I'm ignoring a \\right that had no matching \\left.");
116 scan_delimiter(delimiter(p), false);
120 push_math(math_left_group);
128 tail_append(new_noad());
129 type(tail) = inner_noad;
130 math_type(nucleus(tail)) = sub_mlist;
131 info(nucleus(tail)) = p;
136 void after_math (void)
156 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
157 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
158 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
160 print_err("Math formula deleted: Insufficient symbol fonts");
161 help3("Sorry, but I can't typeset math unless \\textfont 2",
162 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
163 "the \\fontdimen values needed in math symbol fonts.");
168 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
169 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
170 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
172 print_err("Math formula deleted: Insufficient extension fonts");
173 help3("Sorry, but I can't typeset math unless \\textfont 3",
174 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
175 "the \\fontdimen values needed in math extension fonts.");
185 if (mode == - (integer) m)
190 if (cur_cmd != math_shift)
192 print_err("Display math should end with $$");
193 help2("The `$' that I just saw supposedly matches a previous `$$'.",
194 "So I shall assume that you typed `$$' both times.");
200 cur_style = text_style;
201 mlist_penalties = false;
203 a = hpack(link(temp_head), 0, 1);
212 if ((font_params[fam_fnt(2 + text_size)] < total_mathsy_params) ||
213 (font_params[fam_fnt(2 + script_size)] < total_mathsy_params) ||
214 (font_params[fam_fnt(2 + script_script_size)] < total_mathsy_params))
216 print_err("Math formula deleted: Insufficient symbol fonts");
217 help3("Sorry, but I can't typeset math unless \\textfont 2",
218 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
219 "the \\fontdimen values needed in math symbol fonts.");
224 else if ((font_params[fam_fnt(3 + text_size)] < total_mathex_params) ||
225 (font_params[fam_fnt(3 + script_size)] < total_mathex_params) ||
226 (font_params[fam_fnt(3 + script_script_size)] < total_mathex_params))
228 print_err("Math formula deleted: Insufficient extension fonts");
229 help3("Sorry, but I can't typeset math unless \\textfont 3",
230 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
231 "the \\fontdimen values needed in math extension fonts.");
245 tail_append(new_math(math_surround, 0));
247 cur_style = text_style;
248 mlist_penalties = (mode > 0);
250 link(tail) = link(temp_head);
252 while(link(tail) != 0)
255 tail_append(new_math(math_surround, 1));
265 if (cur_cmd != math_shift)
267 print_err("Display math should end with $$");
268 help2("The `$' that I just saw supposedly matches a previous `$$'.",
269 "So I shall assume that you typed `$$' both times.");
274 cur_style = display_style;
275 mlist_penalties = false;
278 adjust_tail = adjust_head;
287 if ((a == 0) || danger)
295 q = e + math_quad(text_size);
300 if ((e != 0) && ((w - total_shrink[normal] + q <= z) || (total_shrink[fil] != 0) || (total_shrink[fill] != 0) || (total_shrink[filll] != 0)))
302 free_node(b, box_node_size);
303 b = hpack(p, z - q, 0);
311 free_node(b, box_node_size);
320 if ((e > 0) && (d < 2 * e))
325 if (!(p >= hi_mem_min))
326 if (type(p) == glue_node)
330 tail_append(new_penalty(pre_display_penalty));
332 if ((d + s <= pre_display_size) || l)
334 g1 = above_display_skip_code;
335 g2 = below_display_skip_code;
339 g1 = above_display_short_skip_code;
340 g2 = below_display_short_skip_code;
346 tail_append(new_penalty(10000));
350 tail_append(new_param_glue(g1));
355 r = new_kern(z - w - e - d);
372 shift_amount(b) = s + d;
375 if ((a != 0) && (e == 0) && !l)
377 tail_append(new_penalty(10000));
378 shift_amount(a) = s + z - width(a);
383 if (t != adjust_head)
385 link(tail) = link(adjust_head);
389 tail_append(new_penalty(post_display_penalty));
393 tail_append(new_param_glue(g2));
396 resume_after_display();
400 void resume_after_display (void)
402 if (cur_group != math_shift_group)
404 confusion("display");
405 return; // abort_flag set
409 prev_graf = prev_graf + 3;
415 prev_graf =(norm_min(left_hyphen_min) * 64 + norm_min(right_hyphen_min)) * 65536L + cur_lang;
420 if (cur_cmd != spacer)
430 void get_r_token (void)
437 while (!(cur_tok != 2592));
439 if ((cur_cs == 0) || (cur_cs > frozen_control_sequence))
441 print_err("Missing control sequence inserted");
442 help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
443 "I've inserted an inaccessible control sequence so that your",
444 "definition will be completed without mixing me up too badly.",
445 "You can recover graciously from this error, if you're",
446 "careful; see exercise 27.2 in The TeXbook.");
451 cur_tok = cs_token_flag + frozen_protection;
457 void trap_zero_glue (void)
459 if ((width(cur_val) == 0) && (stretch(cur_val) == 0) && (shrink(cur_val) == 0))
461 add_glue_ref(zero_glue);
462 delete_glue_ref(cur_val);
467 void do_register_command_ (small_number a)
475 if (q != tex_register)
479 if ((cur_cmd >= assign_int) && (cur_cmd <= assign_mu_glue))
482 p = cur_cmd - assign_int;
486 if (cur_cmd != tex_register)
488 print_err("You can't use `");
489 print_cmd_chr(cur_cmd, cur_chr);
490 print_string("' after ");
492 help1("I'm forgetting what you said and not changing anything.");
499 scan_eight_bit_int();
504 l = cur_val + count_base;
508 l = cur_val + scaled_base;
512 l = cur_val + skip_base;
516 l = cur_val + mu_skip_base;
522 if (q == tex_register)
523 scan_optional_equals();
525 if (scan_keyword("by"));
535 scan_dimen(false, false, false);
538 cur_val = cur_val + eqtb[l].cint;
546 q = new_spec(cur_val);
548 delete_glue_ref(cur_val);
549 width(q) = width(q) + width(r);
552 stretch_order(q) = normal;
554 if (stretch_order(q) == stretch_order(r))
555 stretch(q) = stretch(q) + stretch(r);
556 else if ((stretch_order(q) < stretch_order(r)) && (stretch(r) != 0))
558 stretch(q) = stretch(r);
559 stretch_order(q) = stretch_order(r);
563 shrink_order(q) = normal;
565 if (shrink_order(q) == shrink_order(r))
566 shrink(q) = shrink(q) + shrink(r);
567 else if ((shrink_order(q) < shrink_order(r)) && (shrink(r) != 0))
569 shrink(q) = shrink(r);
570 shrink_order(q) = shrink_order(r);
582 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 2147483647L); /* 2^31 - 1 */
584 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 1073741823L); /* 2^30 - 1 */
586 cur_val = x_over_n(eqtb[l].cint, cur_val);
594 width(r) = mult_and_add(width(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
595 stretch(r) = mult_and_add(stretch(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
596 shrink(r) = mult_and_add(shrink(s), cur_val, 0, 1073741823L); /* 2^30 - 1 */
600 width(r) = x_over_n(width(s), cur_val);
601 stretch(r) = x_over_n(stretch(s), cur_val);
602 shrink(r) = x_over_n(shrink(s), cur_val);
610 print_err("Arithmetic overflow");
611 help2("I can't carry out that multiplication or division,",
612 "since the result is out of range.");
615 delete_glue_ref(cur_val);
624 geq_word_define(l, cur_val);
626 eq_word_define(l, cur_val);
633 geq_define(l, glue_ref, cur_val);
635 eq_define(l, glue_ref, cur_val);
638 /* called only from itex.c */
640 void alter_aux (void)
644 if (cur_chr != abs(mode))
646 report_illegal_case();
651 scan_optional_equals();
655 scan_dimen(false, false, false);
656 prev_depth = cur_val;
662 if ((cur_val <= 0) || (cur_val > 32767))
664 print_err("Bad space factor");
665 help1("I allow only values in the range 1..32767 here.");
669 space_factor = cur_val;
674 void alter_prev_graf (void)
678 nest[nest_ptr] = cur_list;
681 while(abs(nest[p].mode_field) != vmode)
684 scan_optional_equals();
690 print_esc("prevgraf");
691 help1("I allow only nonnegative values here.");
696 nest[p].pg_field = cur_val;
697 cur_list = nest[nest_ptr];
701 void alter_page_so_far (void)
706 scan_optional_equals();
707 scan_dimen(false, false, false);
708 page_so_far[c] = cur_val;
711 void alter_integer (void)
716 scan_optional_equals();
720 dead_cycles = cur_val;
722 insert_penalties = cur_val;
725 void alter_box_dimen (void)
731 scan_eight_bit_int();
733 scan_optional_equals();
734 scan_dimen(false, false, false);
737 mem[box(b) + c].cint = cur_val;
740 void new_font_(small_number a)
744 internal_font_number f;
747 str_number flushable_string;
757 else if (u >= single_base)
764 old_setting = selector;
766 print_string("FONT");
767 print(u - active_base);
768 selector = old_setting;
774 geq_define(u, set_font, 0);
776 eq_define(u, set_font, 0);
778 scan_optional_equals();
781 name_in_progress = true;
783 if (scan_keyword("at"))
785 scan_dimen(false, false, false);
788 if ((s <= 0) || (s >= 134217728L)) /* 2^27 */
790 print_err("Improper `at' size (");
792 print_string("pt), replaced by 10pt");
793 help2("I can only handle fonts at positive sizes that are",
794 "less than 2048pt, so I've changed what you said to 10pt.");
796 s = 10 * 65536L; /* 10pt */
799 else if (scan_keyword("scaled"))
802 s = - (integer) cur_val;
804 if ((cur_val <= 0) || (cur_val > 32768L))
806 print_err("Illegal magnification has been changed to 1000");
807 help1("The magnification ratio must be between 1 and 32768.");
815 name_in_progress = false;
817 flushable_string = str_ptr - 1;
819 if (trace_flag) /* debugging stuff only 98/Oct/5 */
821 int i, k1, k2, l1, l2;
822 char *sch = log_line;
823 k1 = str_start[cur_area];
824 k2 = str_start[cur_name];
825 l1 = length(cur_area);
826 l2 = length(cur_name);
828 show_line("FONT ", 0);
830 for (i = 0; i < l1; i++)
832 *sch++ = str_pool[i + k1];
835 for (i = 0; i < l2; i++)
837 *sch++ = str_pool[i + k2];
842 show_line(log_line, 0);
845 for (f = font_base + 1; f < font_ptr; f++)
847 if (str_eq_str(font_name[f], cur_name) && str_eq_str(font_area[f], cur_area))
849 if (cur_name == flushable_string)
852 cur_name = font_name[f];
857 if (s == font_size[f])
859 if (ignore_frozen == 0 || f > frozenfontptr)
863 sprintf(log_line, "SKIPPING %ld ", s);
864 show_line(log_line, 0);
870 else if (font_size[f] == xn_over_d(font_dsize[f], - (integer) s, 1000))
872 if (ignore_frozen == 0 || f > frozenfontptr) /* 99/Mar/26 */
876 sprintf(log_line, "SKIPPING %ld ", s);
877 show_line(log_line, 0);
886 show_line("READING ", 0);
888 f = read_font_info(u, cur_name, cur_area, s);
893 sprintf(log_line, "NEW FONT %d ", f);
894 show_line(log_line, 0);
898 eqtb[font_id_base + f] = eqtb[u];
903 sprintf(log_line, "ERROR: %s too large %d\n", "hash_used", t);
904 show_line(log_line, 1);
910 void new_interaction (void)
913 interaction = cur_chr;
915 if (interaction == batch_mode)
918 selector = term_only;
921 selector = selector + 2;
924 void do_assignments (void)
932 while (!((cur_cmd != spacer) && (cur_cmd != relax)));
934 if (cur_cmd <= max_non_prefixed_command)
937 set_box_allowed = false;
939 set_box_allowed = true;
943 void open_or_close_in (void)
952 if (read_open[n] != closed)
954 (void) a_close(read_file[n]);
955 read_open[n] = closed;
960 scan_optional_equals();
962 pack_file_name(cur_name, cur_area, cur_ext);
964 /* *** some changes in following in 3.14159 *** */
965 /* if current extension is *not* empty, try to open using name as is */
966 /* string 335 is "" the empty string */
967 if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
969 /* we get here if extension is "", or file with extension failed to open */
970 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
971 /* string 785 is .tex */
972 else if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
974 name_of_file[name_length + 1] = '.';
975 name_of_file[name_length + 2] = 't';
976 name_of_file[name_length + 3] = 'e';
977 name_of_file[name_length + 4] = 'x';
978 name_of_file[name_length + 5] = ' ';
979 name_length = name_length + 4;
981 if (a_open_in(read_file[n], TEXINPUTPATH))
982 read_open[n] = just_open;
985 name_length = name_length - 4; /* remove ".tex" again */
986 name_of_file[name_length + 1] = ' ';
988 if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
995 void issue_message (void)
1002 link(garbage) = scan_toks(false, true);
1003 old_setting = selector;
1004 selector = new_string;
1005 token_show(def_ref);
1006 selector = old_setting;
1007 flush_list(def_ref);
1013 if (term_offset + length(s) > max_print_line - 2)
1015 else if ((term_offset > 0) || (file_offset > 0))
1030 use_err_help = true;
1031 else if (long_help_seen)
1032 help1("(That was another \\errmessage.)");
1035 if (interaction < error_stop_mode)
1036 long_help_seen = true;
1038 help4("This error message was generated by an \\errmessage",
1039 "command, so I can't give any explicit help.",
1040 "Pretend that you're Hercule Poirot: Examine all clues,",
1041 "and deduce the truth by order and method.");
1045 use_err_help = false;
1051 void shift_case (void)
1059 p = scan_toks(false, false);
1066 if (t < cs_token_flag + single_base)
1070 if (equiv(b + c) != 0)
1071 info(p) = t - c + equiv(b + c);
1077 begin_token_list(link(def_ref), 3);
1078 free_avail(def_ref);
1081 void show_whatever (void)
1096 scan_eight_bit_int();
1098 print_nl("> \\box");
1102 if (box(cur_val) == 0)
1103 print_string("void");
1105 show_box(box(cur_val));
1113 if (interaction == error_stop_mode)
1133 if (interaction == error_stop_mode)
1137 token_show(temp_head);
1138 flush_list(link(temp_head));
1144 end_diagnostic(true);
1147 if (selector == term_and_log)
1148 if (tracing_online <= 0)
1150 selector = term_only;
1151 print_string(" (see the transcript file)");
1152 selector = term_and_log;
1157 if (interaction < error_stop_mode)
1162 else if (tracing_online > 0)
1164 help3("This isn't an error message; I'm just \\showing something.",
1165 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1166 "\\showthe\\count10, \\showbox255, \\showlists).");
1170 help5("This isn't an error message; I'm just \\showing something.",
1171 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1172 "\\showthe\\count10, \\showbox255, \\showlists).",
1173 "And type `I\\tracingonline=1\\show...' to show boxes and",
1174 "lists on your terminal as well as in the transcript file.");
1179 void new_whatsit_(small_number s, small_number w)
1184 type(p) = whatsit_node;
1190 void new_write_whatsit_(small_number w)
1192 new_whatsit(cur_chr, w);
1194 if (w != write_node_size)
1196 scan_four_bit_int();
1204 else if (cur_val > 15)
1208 write_stream(tail) = cur_val;
1211 void do_extension (void)
1213 /* integer i, j, k; */
1215 /* halfword p, q, r; */
1222 new_write_whatsit(open_node_size);
1223 scan_optional_equals();
1225 open_name(tail) = cur_name;
1226 open_area(tail) = cur_area;
1227 open_ext(tail) = cur_ext;
1234 new_write_whatsit(write_node_size);
1236 p = scan_toks(false, false);
1237 write_tokens(tail) = def_ref;
1243 new_write_whatsit(write_node_size);
1244 write_tokens(tail) = 0;
1250 new_whatsit(special_node, write_node_size);
1251 write_stream(tail) = 0;
1252 p = scan_toks(false, true);
1253 write_tokens(tail) = def_ref;
1257 case immediate_code:
1261 if ((cur_cmd == extension) && (cur_chr <= close_node))
1266 flush_node_list(tail);
1275 case set_language_code:
1276 if (abs(mode) != hmode)
1278 report_illegal_case();
1282 new_whatsit(language_node, small_node_size);
1287 else if (cur_val > 255)
1292 what_lang(tail) = clang;
1293 what_lhm(tail) = norm_min(left_hyphen_min);
1294 what_rhm(tail) = norm_min(right_hyphen_min);
1301 return; // abort_flag set
1307 void fix_language (void)
1310 int l; /* 95/Jan/7 */
1314 else if (language > 255)
1321 new_whatsit(language_node, small_node_size);
1322 what_lang(tail) = l;
1324 what_lhm(tail) = norm_min(left_hyphen_min);
1325 what_rhm(tail) = norm_min(right_hyphen_min);
1329 void handle_right_brace (void)
1343 print_err("Too many }'s");
1344 help2("You've closed more groups than you opened.",
1345 "Such booboos are generally harmless, so keep going.");
1350 case semi_simple_group:
1351 case math_shift_group:
1352 case math_left_group:
1353 extra_right_brace();
1360 case adjust_hbox_group:
1362 adjust_tail = adjust_head;
1386 d = split_max_depth;
1387 f = floating_penalty;
1390 p = vpackage(link(head), 0, 1, 1073741823L); /* 2^30 - 1 */
1395 tail_append(get_node(ins_node_size));
1396 type(tail) = ins_node;
1397 subtype(tail) = saved(0);
1398 height(tail) = height(p) + depth(p);
1399 ins_ptr(tail) = list_ptr(p);
1400 split_top_ptr(tail) = q;
1402 float_cost(tail) = f;
1406 tail_append(get_node(small_node_size));
1407 type(tail) = adjust_node;
1409 adjust_ptr(tail) = list_ptr(p);
1412 free_node(p, box_node_size);
1422 if ((cur_input.loc_field != 0) || ((token_type != output_text) && (token_type != backed_up)))
1424 print_err("Unbalanced output routine");
1425 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1426 "I can't handle that very well; good luck.");
1433 while (!(cur_input.loc_field == 0));
1439 output_active = false;
1440 insert_penalties = 0;
1444 print_err("Output routine didn't use all of ");
1447 help3("Your \\output commands should empty \\box255,",
1448 "e.g., by saying `\\shipout\\box255'.",
1449 "Proceed; I'll discard its present contents.");
1455 link(page_tail) = link(head);
1459 if (link(page_head) != 0)
1461 if (link(contrib_head) == 0)
1462 nest[0].tail_field = page_tail;
1464 link(page_tail) = link(contrib_head);
1465 link(contrib_head) = link(page_head);
1466 link(page_head) = 0;
1467 page_tail = page_head;
1475 build_discretionary();
1481 cur_tok = cs_token_flag + frozen_cr;
1482 print_err("Missing ");
1484 print_string("inserted");
1485 help1("I'm guessing that you meant to end an alignment here.");
1490 case no_align_group:
1502 save_ptr = save_ptr - 2;
1503 p = vpackage(link(head), saved(1), saved(0), 1073741823L); /* 2^30 - 1 */
1505 tail_append(new_noad());
1506 type(tail) = vcenter_noad;
1507 math_type(nucleus(tail)) = sub_box;
1508 info(nucleus(tail)) = p;
1512 case math_choice_group:
1520 math_type(saved(0)) = sub_mlist;
1526 if (type(p) == ord_noad)
1528 if (math_type(subscr(p)) == 0)
1529 if (math_type(supscr(p)) == 0)
1531 mem[saved(0)].hh = mem[nucleus(p)].hh;
1532 free_node(p, noad_size);
1535 else if (type(p) == accent_noad)
1536 if (saved(0) == nucleus(tail))
1537 if (type(tail) == ord_noad)
1541 while(link(q) != tail)
1545 free_node(tail, noad_size);
1552 confusion("rightbrace");
1553 return; // abort_flag set
1559 void main_control (void)
1562 integer bSuppress; /* 199/Jan/5 */
1565 begin_token_list(every_job, every_job_text);
1568 get_x_token(); /* big_switch */
1572 if (OK_to_interrupt)
1578 pause_for_instructions();
1589 if (tracing_commands > 0)
1592 /* the big switch --- don't bother to test abort_flag ??? */
1593 switch(abs(mode) + cur_cmd)
1595 case hmode + letter:
1596 case hmode + other_char:
1597 case hmode + char_given:
1601 case hmode + char_num:
1609 case hmode + no_boundary:
1613 if ((cur_cmd == letter) || (cur_cmd == other_char) ||
1614 (cur_cmd == char_given) || (cur_cmd == char_num))
1615 cancel_boundary = true;
1620 case hmode + spacer:
1621 if (space_factor == 1000)
1627 case hmode + ex_space:
1628 case mmode + ex_space:
1632 case any_mode(relax):
1633 case vmode + spacer:
1634 case mmode + spacer:
1635 case mmode + no_boundary:
1639 case any_mode(ignore_spaces):
1645 while(!(cur_cmd != spacer));
1658 case any_mode(last_item):
1659 case vmode + vadjust:
1660 case vmode + ital_corr:
1661 case non_math(eq_no):
1662 case any_mode(mac_param):
1663 report_illegal_case();
1666 case non_math(sup_mark):
1667 case non_math(sub_mark):
1668 case non_math(math_char_num):
1669 case non_math(math_given):
1670 case non_math(math_comp):
1671 case non_math(delim_num):
1672 case non_math(left_right):
1673 case non_math(above):
1674 case non_math(radical):
1675 case non_math(math_style):
1676 case non_math(math_choice):
1677 case non_math(vcenter):
1678 case non_math(non_script):
1679 case non_math(mkern):
1680 case non_math(limit_switch):
1681 case non_math(mskip):
1682 case non_math(math_accent):
1684 case mmode + par_end:
1687 case mmode + un_vbox:
1688 case mmode + valign:
1690 insert_dollar_sign();
1697 tail_append(scan_rule_spec());
1699 if (abs(mode) == vmode)
1700 prev_depth = ignore_depth;
1701 else if (abs(mode) == hmode)
1702 space_factor = 1000;
1713 case any_mode(kern):
1718 case non_math(left_brace):
1719 new_save_level(simple_group);
1722 case any_mode(begin_group):
1723 new_save_level(semi_simple_group);
1726 case any_mode(end_group):
1727 if (cur_group == semi_simple_group)
1733 case any_mode(right_brace):
1734 handle_right_brace();
1742 scan_dimen(false, false, false);
1747 scan_box(- (integer) cur_val);
1751 case any_mode(leader_ship):
1752 scan_box(leader_flag - a_leaders + cur_chr);
1755 case any_mode(make_box):
1759 case vmode + start_par:
1760 new_graf(cur_chr > 0);
1763 case vmode + letter:
1764 case vmode + other_char:
1765 case vmode + char_num:
1766 case vmode + char_given:
1767 case vmode + math_shift:
1768 case vmode + un_hbox:
1770 case vmode + accent:
1771 case vmode + discretionary:
1773 case vmode + valign:
1774 case vmode + ex_space:
1775 case vmode + no_boundary:
1782 case hmode + start_par:
1783 case mmode + start_par:
1787 case vmode + par_end:
1796 case hmode + par_end:
1798 if (align_state < 0)
1811 case hmode + un_vbox:
1812 case hmode + halign:
1816 case any_mode(insert):
1817 case hmode + vadjust:
1818 case mmode + vadjust:
1819 begin_insert_or_adjust();
1822 case any_mode(mark):
1826 case any_mode(break_penalty):
1830 case any_mode(remove_item):
1834 case vmode + un_vbox:
1835 case hmode + un_hbox:
1836 case mmode + un_hbox:
1840 case hmode + ital_corr:
1841 append_italic_correction();
1844 case mmode + ital_corr:
1845 tail_append(new_kern(0));
1848 case hmode + discretionary:
1849 case mmode + discretionary:
1850 append_discretionary();
1853 case hmode + accent:
1857 case any_mode(car_ret):
1858 case any_mode(tab_mark):
1862 case any_mode(no_align):
1866 case any_mode(omit):
1870 case vmode + halign:
1871 case hmode + valign:
1875 case mmode + halign:
1877 if (cur_group == math_shift_group)
1888 case any_mode(end_cs_name):
1892 case hmode + math_shift:
1898 if (cur_group == math_shift_group)
1904 case mmode + left_brace:
1906 tail_append(new_noad());
1908 scan_math(nucleus(tail));
1912 case mmode + letter:
1913 case mmode + other_char:
1914 case mmode + char_given:
1915 set_math_char(math_code(cur_chr));
1918 case mmode + char_num:
1922 set_math_char(math_code(cur_chr));
1926 case mmode + math_char_num:
1928 scan_fifteen_bit_int();
1929 set_math_char(cur_val);
1933 case mmode + math_given:
1934 set_math_char(cur_chr);
1937 case mmode + delim_num:
1939 scan_twenty_seven_bit_int();
1940 set_math_char(cur_val / 4096);
1944 case mmode + math_comp:
1946 tail_append(new_noad());
1947 type(tail) = cur_chr;
1948 scan_math(nucleus(tail));
1952 case mmode + limit_switch:
1953 math_limit_switch();
1956 case mmode + radical:
1960 case mmode + accent:
1961 case mmode + math_accent:
1965 case mmode + vcenter:
1967 scan_spec(vcenter_group, false);
1971 prev_depth = ignore_depth;
1973 if (every_vbox != 0)
1974 begin_token_list(every_vbox, every_vbox_text);
1978 case mmode + math_style:
1979 tail_append(new_style(cur_chr));
1982 case mmode + non_script:
1984 tail_append(new_glue(0));
1985 subtype(tail) = cond_math_glue;
1989 case mmode + math_choice:
1993 case mmode + sub_mark:
1994 case mmode + sup_mark:
2002 case mmode + left_right:
2006 case mmode + math_shift:
2007 if (cur_group == math_shift_group)
2013 case any_mode(toks_register):
2014 case any_mode(assign_toks):
2015 case any_mode(assign_int):
2016 case any_mode(assign_dimen):
2017 case any_mode(assign_glue):
2018 case any_mode(assign_mu_glue):
2019 case any_mode(assign_font_dimen):
2020 case any_mode(assign_font_int):
2021 case any_mode(set_aux):
2022 case any_mode(set_prev_graf):
2023 case any_mode(set_page_dimen):
2024 case any_mode(set_page_int):
2025 case any_mode(set_box_dimen):
2026 case any_mode(set_shape):
2027 case any_mode(def_code):
2028 case any_mode(def_family):
2029 case any_mode(set_font):
2030 case any_mode(def_font):
2031 case any_mode(tex_register):
2032 case any_mode(advance):
2033 case any_mode(multiply):
2034 case any_mode(divide):
2035 case any_mode(prefix):
2037 case any_mode(shorthand_def):
2038 case any_mode(read_to_cs):
2040 case any_mode(set_box):
2041 case any_mode(hyph_data):
2042 case any_mode(set_interaction):
2046 case any_mode(after_assignment):
2049 after_token = cur_tok;
2053 case any_mode(after_group):
2056 save_for_after(cur_tok);
2060 case any_mode(in_stream):
2064 case any_mode(message):
2068 case any_mode(case_shift):
2072 case any_mode(xray):
2076 case any_mode(extension):
2079 } /* end of big switch */
2080 goto lab60; /* main_loop */
2083 adjust_space_factor();
2085 bchar = font_bchar[main_f];
2086 false_bchar = font_false_bchar[main_f];
2089 if (language != clang)
2095 lig_stack = get_avail();
2098 avail = mem[lig_stack].hh.v.RH;
2099 mem[lig_stack].hh.v.RH = 0;
2106 font(lig_stack) = main_f;
2108 character(lig_stack) = cur_l;
2111 if (cancel_boundary)
2113 cancel_boundary = false;
2114 main_k = non_address;
2117 main_k = bchar_label[main_f];
2119 if (main_k == non_address)
2129 /* main_loop_move */
2135 cur_l = character(lig_stack);
2138 if (!(lig_stack >= hi_mem_min))
2142 if ((cur_chr < font_bc[main_f]) || (cur_chr > font_ec[main_f]))
2144 char_warning(main_f, cur_chr);
2145 free_avail(lig_stack);
2149 main_i = char_info(main_f, cur_l);
2151 if (!(main_i.b0 > 0))
2153 char_warning(main_f, cur_chr);
2154 free_avail(lig_stack);
2158 link(tail) = lig_stack;
2162 /* main_loop_lookahead */
2166 if (cur_cmd == letter)
2168 if (cur_cmd == other_char)
2170 if (cur_cmd == char_given)
2175 if (cur_cmd == letter)
2177 if (cur_cmd == other_char)
2179 if (cur_cmd == char_given)
2182 if (cur_cmd == char_num)
2189 if (cur_cmd == no_boundary)
2197 adjust_space_factor();
2203 lig_stack = get_avail();
2206 avail = mem[lig_stack].hh.v.RH;
2207 mem[lig_stack].hh.v.RH = 0;
2214 font(lig_stack) = main_f;
2216 character(lig_stack) = cur_r;
2218 if (cur_r == false_bchar)
2221 // main_lig_loop:@<If there's a ligature/kern command relevant to |cur_l| and
2222 // |cur_r|, adjust the text appropriately; exit to |main_loop_wrapup|@>;
2225 if (char_tag(main_i) != lig_tag)
2228 if (cur_r == non_char)
2231 main_k = lig_kern_start(main_f, main_i);
2232 main_j = font_info[main_k].qqqq;
2234 if (skip_byte(main_j) <= stop_flag)
2237 main_k = lig_kern_restart(main_f, main_j);
2239 /* main_lig_loop+1:main_j:=font_info[main_k].qqqq; */
2241 main_j = font_info[main_k].qqqq;
2244 /* provide for suppression of f-ligatures 99/Jan/5 */
2247 if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
2253 if (next_char(main_j) == cur_r && bSuppress == 0) /* 99/Jan/5 */
2254 if (skip_byte(main_j) <= stop_flag)
2256 if (op_byte(main_j) >= kern_flag)
2259 tail_append(new_kern(char_kern(main_f, main_j)));
2263 if (cur_l == non_char)
2265 else if (lig_stack == 0)
2271 pause_for_instructions();
2275 switch (op_byte(main_j))
2280 cur_l = rem_byte(main_j);
2281 main_i = char_info(main_f, cur_l);
2282 ligature_present = true;
2288 cur_r = rem_byte(main_j);
2292 lig_stack = new_lig_item(cur_r);
2295 else if ((lig_stack >= hi_mem_min))
2298 lig_stack = new_lig_item(cur_r);
2299 lig_ptr(lig_stack) = main_p;
2302 character(lig_stack) = cur_r;
2307 cur_r = rem_byte(main_j);
2309 lig_stack = new_lig_item(cur_r);
2310 link(lig_stack) = main_p;
2318 cur_l = rem_byte(main_j);
2319 main_i = char_info(main_f, cur_l);
2320 ligature_present = true;
2325 cur_l = rem_byte(main_j);
2326 ligature_present = true;
2336 if (op_byte(main_j) > 4)
2337 if (op_byte(main_j) != 7)
2340 if (cur_l < non_char)
2343 main_k = bchar_label[main_f];
2347 if (skip_byte(main_j) == 0)
2351 if (skip_byte(main_j) >= stop_flag)
2354 main_k = main_k + skip_byte(main_j) + 1;
2361 main_p = lig_ptr(lig_stack);
2363 if (main_p != 0) /* BUG FIX */
2364 tail_append(main_p);
2366 temp_ptr = lig_stack;
2367 lig_stack = link(temp_ptr);
2368 free_node(temp_ptr, small_node_size);
2369 main_i = char_info(main_f, cur_l);
2370 ligature_present = true;
2373 if (main_p != 0) /* BUG FIX */
2378 cur_r = character(lig_stack);
2382 /* append_normal_space */
2384 if (space_skip == 0)
2387 main_p = font_glue[cur_font];
2391 main_p = new_spec(zero_glue);
2392 main_k = param_base[cur_font] + space_code;
2393 width(main_p) = font_info[main_k].cint;
2394 stretch(main_p) = font_info[main_k + 1].cint;
2395 shrink(main_p) = font_info[main_k + 2].cint;
2396 font_glue[cur_font] = main_p;
2399 temp_ptr = new_glue(main_p);
2402 temp_ptr = new_param_glue(space_skip_code);
2404 link(tail) = temp_ptr;
2408 /* give_err_help etc followed here in the old tex8.c */