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) &&
973 /* *** some changes in above file name handling *** */
974 (!extensionirrelevantp(name_of_file, name_length, "tex")))
976 name_of_file[name_length + 1] = '.';
977 name_of_file[name_length + 2] = 't';
978 name_of_file[name_length + 3] = 'e';
979 name_of_file[name_length + 4] = 'x';
980 name_of_file[name_length + 5] = ' ';
981 name_length = name_length + 4;
983 if (a_open_in(read_file[n], TEXINPUTPATH))
984 read_open[n] = just_open;
987 name_length = name_length - 4; /* remove ".tex" again */
988 name_of_file[name_length + 1] = ' ';
990 if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
992 else if (maketextex() && a_open_in(read_file[n], TEXINPUTPATH))
999 void issue_message (void)
1006 link(garbage) = scan_toks(false, true);
1007 old_setting = selector;
1008 selector = new_string;
1009 token_show(def_ref);
1010 selector = old_setting;
1011 flush_list(def_ref);
1017 if (term_offset + length(s) > max_print_line - 2)
1019 else if ((term_offset > 0) || (file_offset > 0))
1034 use_err_help = true;
1035 else if (long_help_seen)
1036 help1("(That was another \\errmessage.)");
1039 if (interaction < error_stop_mode)
1040 long_help_seen = true;
1042 help4("This error message was generated by an \\errmessage",
1043 "command, so I can't give any explicit help.",
1044 "Pretend that you're Hercule Poirot: Examine all clues,",
1045 "and deduce the truth by order and method.");
1049 use_err_help = false;
1055 void shift_case (void)
1063 p = scan_toks(false, false);
1070 if (t < cs_token_flag + single_base)
1074 if (equiv(b + c) != 0)
1075 info(p) = t - c + equiv(b + c);
1081 begin_token_list(link(def_ref), 3);
1082 free_avail(def_ref);
1085 void show_whatever (void)
1100 scan_eight_bit_int();
1102 print_nl("> \\box");
1106 if (box(cur_val) == 0)
1107 print_string("void");
1109 show_box(box(cur_val));
1117 if (interaction == error_stop_mode)
1137 if (interaction == error_stop_mode)
1141 token_show(temp_head);
1142 flush_list(link(temp_head));
1148 end_diagnostic(true);
1151 if (selector == term_and_log)
1152 if (tracing_online <= 0)
1154 selector = term_only;
1155 print_string(" (see the transcript file)");
1156 selector = term_and_log;
1161 if (interaction < error_stop_mode)
1166 else if (tracing_online > 0)
1168 help3("This isn't an error message; I'm just \\showing something.",
1169 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1170 "\\showthe\\count10, \\showbox255, \\showlists).");
1174 help5("This isn't an error message; I'm just \\showing something.",
1175 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1176 "\\showthe\\count10, \\showbox255, \\showlists).",
1177 "And type `I\\tracingonline=1\\show...' to show boxes and",
1178 "lists on your terminal as well as in the transcript file.");
1183 void new_whatsit_(small_number s, small_number w)
1188 type(p) = whatsit_node;
1194 void new_write_whatsit_(small_number w)
1196 new_whatsit(cur_chr, w);
1198 if (w != write_node_size)
1200 scan_four_bit_int();
1208 else if (cur_val > 15)
1212 write_stream(tail) = cur_val;
1215 void do_extension (void)
1217 /* integer i, j, k; */
1219 /* halfword p, q, r; */
1226 new_write_whatsit(open_node_size);
1227 scan_optional_equals();
1229 open_name(tail) = cur_name;
1230 open_area(tail) = cur_area;
1231 open_ext(tail) = cur_ext;
1238 new_write_whatsit(write_node_size);
1240 p = scan_toks(false, false);
1241 write_tokens(tail) = def_ref;
1247 new_write_whatsit(write_node_size);
1248 write_tokens(tail) = 0;
1254 new_whatsit(special_node, write_node_size);
1255 write_stream(tail) = 0;
1256 p = scan_toks(false, true);
1257 write_tokens(tail) = def_ref;
1261 case immediate_code:
1265 if ((cur_cmd == extension) && (cur_chr <= close_node))
1270 flush_node_list(tail);
1279 case set_language_code:
1280 if (abs(mode) != hmode)
1282 report_illegal_case();
1286 new_whatsit(language_node, small_node_size);
1291 else if (cur_val > 255)
1296 what_lang(tail) = clang;
1297 what_lhm(tail) = norm_min(left_hyphen_min);
1298 what_rhm(tail) = norm_min(right_hyphen_min);
1305 return; // abort_flag set
1311 void fix_language (void)
1314 int l; /* 95/Jan/7 */
1318 else if (language > 255)
1325 new_whatsit(language_node, small_node_size);
1326 what_lang(tail) = l;
1328 what_lhm(tail) = norm_min(left_hyphen_min);
1329 what_rhm(tail) = norm_min(right_hyphen_min);
1333 void handle_right_brace (void)
1347 print_err("Too many }'s");
1348 help2("You've closed more groups than you opened.",
1349 "Such booboos are generally harmless, so keep going.");
1354 case semi_simple_group:
1355 case math_shift_group:
1356 case math_left_group:
1357 extra_right_brace();
1364 case adjust_hbox_group:
1366 adjust_tail = adjust_head;
1390 d = split_max_depth;
1391 f = floating_penalty;
1394 p = vpackage(link(head), 0, 1, 1073741823L); /* 2^30 - 1 */
1399 tail_append(get_node(ins_node_size));
1400 type(tail) = ins_node;
1401 subtype(tail) = saved(0);
1402 height(tail) = height(p) + depth(p);
1403 ins_ptr(tail) = list_ptr(p);
1404 split_top_ptr(tail) = q;
1406 float_cost(tail) = f;
1410 tail_append(get_node(small_node_size));
1411 type(tail) = adjust_node;
1413 adjust_ptr(tail) = list_ptr(p);
1416 free_node(p, box_node_size);
1426 if ((cur_input.loc_field != 0) || ((token_type != output_text) && (token_type != backed_up)))
1428 print_err("Unbalanced output routine");
1429 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1430 "I can't handle that very well; good luck.");
1437 while (!(cur_input.loc_field == 0));
1443 output_active = false;
1444 insert_penalties = 0;
1448 print_err("Output routine didn't use all of ");
1451 help3("Your \\output commands should empty \\box255,",
1452 "e.g., by saying `\\shipout\\box255'.",
1453 "Proceed; I'll discard its present contents.");
1459 link(page_tail) = link(head);
1463 if (link(page_head) != 0)
1465 if (link(contrib_head) == 0)
1466 nest[0].tail_field = page_tail;
1468 link(page_tail) = link(contrib_head);
1469 link(contrib_head) = link(page_head);
1470 link(page_head) = 0;
1471 page_tail = page_head;
1479 build_discretionary();
1485 cur_tok = cs_token_flag + frozen_cr;
1486 print_err("Missing ");
1488 print_string("inserted");
1489 help1("I'm guessing that you meant to end an alignment here.");
1494 case no_align_group:
1506 save_ptr = save_ptr - 2;
1507 p = vpackage(link(head), saved(1), saved(0), 1073741823L); /* 2^30 - 1 */
1509 tail_append(new_noad());
1510 type(tail) = vcenter_noad;
1511 math_type(nucleus(tail)) = sub_box;
1512 info(nucleus(tail)) = p;
1516 case math_choice_group:
1524 math_type(saved(0)) = sub_mlist;
1530 if (type(p) == ord_noad)
1532 if (math_type(subscr(p)) == 0)
1533 if (math_type(supscr(p)) == 0)
1535 mem[saved(0)].hh = mem[nucleus(p)].hh;
1536 free_node(p, noad_size);
1539 else if (type(p) == accent_noad)
1540 if (saved(0) == nucleus(tail))
1541 if (type(tail) == ord_noad)
1545 while(link(q) != tail)
1549 free_node(tail, noad_size);
1556 confusion("rightbrace");
1557 return; // abort_flag set
1563 void main_control (void)
1566 integer bSuppress; /* 199/Jan/5 */
1569 begin_token_list(every_job, every_job_text);
1572 get_x_token(); /* big_switch */
1576 if (OK_to_interrupt)
1582 pause_for_instructions();
1593 if (tracing_commands > 0)
1596 /* the big switch --- don't bother to test abort_flag ??? */
1597 switch(abs(mode) + cur_cmd)
1599 case hmode + letter:
1600 case hmode + other_char:
1601 case hmode + char_given:
1605 case hmode + char_num:
1613 case hmode + no_boundary:
1617 if ((cur_cmd == letter) || (cur_cmd == other_char) ||
1618 (cur_cmd == char_given) || (cur_cmd == char_num))
1619 cancel_boundary = true;
1624 case hmode + spacer:
1625 if (space_factor == 1000)
1631 case hmode + ex_space:
1632 case mmode + ex_space:
1636 case any_mode(relax):
1637 case vmode + spacer:
1638 case mmode + spacer:
1639 case mmode + no_boundary:
1643 case any_mode(ignore_spaces):
1649 while(!(cur_cmd != spacer));
1662 case any_mode(last_item):
1663 case vmode + vadjust:
1664 case vmode + ital_corr:
1665 case non_math(eq_no):
1666 case any_mode(mac_param):
1667 report_illegal_case();
1670 case non_math(sup_mark):
1671 case non_math(sub_mark):
1672 case non_math(math_char_num):
1673 case non_math(math_given):
1674 case non_math(math_comp):
1675 case non_math(delim_num):
1676 case non_math(left_right):
1677 case non_math(above):
1678 case non_math(radical):
1679 case non_math(math_style):
1680 case non_math(math_choice):
1681 case non_math(vcenter):
1682 case non_math(non_script):
1683 case non_math(mkern):
1684 case non_math(limit_switch):
1685 case non_math(mskip):
1686 case non_math(math_accent):
1688 case mmode + par_end:
1691 case mmode + un_vbox:
1692 case mmode + valign:
1694 insert_dollar_sign();
1701 tail_append(scan_rule_spec());
1703 if (abs(mode) == vmode)
1704 prev_depth = ignore_depth;
1705 else if (abs(mode) == hmode)
1706 space_factor = 1000;
1717 case any_mode(kern):
1722 case non_math(left_brace):
1723 new_save_level(simple_group);
1726 case any_mode(begin_group):
1727 new_save_level(semi_simple_group);
1730 case any_mode(end_group):
1731 if (cur_group == semi_simple_group)
1737 case any_mode(right_brace):
1738 handle_right_brace();
1746 scan_dimen(false, false, false);
1751 scan_box(- (integer) cur_val);
1755 case any_mode(leader_ship):
1756 scan_box(leader_flag - a_leaders + cur_chr);
1759 case any_mode(make_box):
1763 case vmode + start_par:
1764 new_graf(cur_chr > 0);
1767 case vmode + letter:
1768 case vmode + other_char:
1769 case vmode + char_num:
1770 case vmode + char_given:
1771 case vmode + math_shift:
1772 case vmode + un_hbox:
1774 case vmode + accent:
1775 case vmode + discretionary:
1777 case vmode + valign:
1778 case vmode + ex_space:
1779 case vmode + no_boundary:
1786 case hmode + start_par:
1787 case mmode + start_par:
1791 case vmode + par_end:
1800 case hmode + par_end:
1802 if (align_state < 0)
1815 case hmode + un_vbox:
1816 case hmode + halign:
1820 case any_mode(insert):
1821 case hmode + vadjust:
1822 case mmode + vadjust:
1823 begin_insert_or_adjust();
1826 case any_mode(mark):
1830 case any_mode(break_penalty):
1834 case any_mode(remove_item):
1838 case vmode + un_vbox:
1839 case hmode + un_hbox:
1840 case mmode + un_hbox:
1844 case hmode + ital_corr:
1845 append_italic_correction();
1848 case mmode + ital_corr:
1849 tail_append(new_kern(0));
1852 case hmode + discretionary:
1853 case mmode + discretionary:
1854 append_discretionary();
1857 case hmode + accent:
1861 case any_mode(car_ret):
1862 case any_mode(tab_mark):
1866 case any_mode(no_align):
1870 case any_mode(omit):
1874 case vmode + halign:
1875 case hmode + valign:
1879 case mmode + halign:
1881 if (cur_group == math_shift_group)
1892 case any_mode(end_cs_name):
1896 case hmode + math_shift:
1902 if (cur_group == math_shift_group)
1908 case mmode + left_brace:
1910 tail_append(new_noad());
1912 scan_math(nucleus(tail));
1916 case mmode + letter:
1917 case mmode + other_char:
1918 case mmode + char_given:
1919 set_math_char(math_code(cur_chr));
1922 case mmode + char_num:
1926 set_math_char(math_code(cur_chr));
1930 case mmode + math_char_num:
1932 scan_fifteen_bit_int();
1933 set_math_char(cur_val);
1937 case mmode + math_given:
1938 set_math_char(cur_chr);
1941 case mmode + delim_num:
1943 scan_twenty_seven_bit_int();
1944 set_math_char(cur_val / 4096);
1948 case mmode + math_comp:
1950 tail_append(new_noad());
1951 type(tail) = cur_chr;
1952 scan_math(nucleus(tail));
1956 case mmode + limit_switch:
1957 math_limit_switch();
1960 case mmode + radical:
1964 case mmode + accent:
1965 case mmode + math_accent:
1969 case mmode + vcenter:
1971 scan_spec(vcenter_group, false);
1975 prev_depth = ignore_depth;
1977 if (every_vbox != 0)
1978 begin_token_list(every_vbox, every_vbox_text);
1982 case mmode + math_style:
1983 tail_append(new_style(cur_chr));
1986 case mmode + non_script:
1988 tail_append(new_glue(0));
1989 subtype(tail) = cond_math_glue;
1993 case mmode + math_choice:
1997 case mmode + sub_mark:
1998 case mmode + sup_mark:
2006 case mmode + left_right:
2010 case mmode + math_shift:
2011 if (cur_group == math_shift_group)
2017 case any_mode(toks_register):
2018 case any_mode(assign_toks):
2019 case any_mode(assign_int):
2020 case any_mode(assign_dimen):
2021 case any_mode(assign_glue):
2022 case any_mode(assign_mu_glue):
2023 case any_mode(assign_font_dimen):
2024 case any_mode(assign_font_int):
2025 case any_mode(set_aux):
2026 case any_mode(set_prev_graf):
2027 case any_mode(set_page_dimen):
2028 case any_mode(set_page_int):
2029 case any_mode(set_box_dimen):
2030 case any_mode(set_shape):
2031 case any_mode(def_code):
2032 case any_mode(def_family):
2033 case any_mode(set_font):
2034 case any_mode(def_font):
2035 case any_mode(tex_register):
2036 case any_mode(advance):
2037 case any_mode(multiply):
2038 case any_mode(divide):
2039 case any_mode(prefix):
2041 case any_mode(shorthand_def):
2042 case any_mode(read_to_cs):
2044 case any_mode(set_box):
2045 case any_mode(hyph_data):
2046 case any_mode(set_interaction):
2050 case any_mode(after_assignment):
2053 after_token = cur_tok;
2057 case any_mode(after_group):
2060 save_for_after(cur_tok);
2064 case any_mode(in_stream):
2068 case any_mode(message):
2072 case any_mode(case_shift):
2076 case any_mode(xray):
2080 case any_mode(extension):
2083 } /* end of big switch */
2084 goto lab60; /* main_loop */
2087 adjust_space_factor();
2089 bchar = font_bchar[main_f];
2090 false_bchar = font_false_bchar[main_f];
2093 if (language != clang)
2099 lig_stack = get_avail();
2102 avail = mem[lig_stack].hh.v.RH;
2103 mem[lig_stack].hh.v.RH = 0;
2110 font(lig_stack) = main_f;
2112 character(lig_stack) = cur_l;
2115 if (cancel_boundary)
2117 cancel_boundary = false;
2118 main_k = non_address;
2121 main_k = bchar_label[main_f];
2123 if (main_k == non_address)
2133 /* main_loop_move */
2139 cur_l = character(lig_stack);
2142 if (!(lig_stack >= hi_mem_min))
2146 if ((cur_chr < font_bc[main_f]) || (cur_chr > font_ec[main_f]))
2148 char_warning(main_f, cur_chr);
2149 free_avail(lig_stack);
2153 main_i = char_info(main_f, cur_l);
2155 if (!(main_i.b0 > 0))
2157 char_warning(main_f, cur_chr);
2158 free_avail(lig_stack);
2162 link(tail) = lig_stack;
2166 /* main_loop_lookahead */
2170 if (cur_cmd == letter)
2172 if (cur_cmd == other_char)
2174 if (cur_cmd == char_given)
2179 if (cur_cmd == letter)
2181 if (cur_cmd == other_char)
2183 if (cur_cmd == char_given)
2186 if (cur_cmd == char_num)
2193 if (cur_cmd == no_boundary)
2201 adjust_space_factor();
2207 lig_stack = get_avail();
2210 avail = mem[lig_stack].hh.v.RH;
2211 mem[lig_stack].hh.v.RH = 0;
2218 font(lig_stack) = main_f;
2220 character(lig_stack) = cur_r;
2222 if (cur_r == false_bchar)
2225 // main_lig_loop:@<If there's a ligature/kern command relevant to |cur_l| and
2226 // |cur_r|, adjust the text appropriately; exit to |main_loop_wrapup|@>;
2229 if (char_tag(main_i) != lig_tag)
2232 if (cur_r == non_char)
2235 main_k = lig_kern_start(main_f, main_i);
2236 main_j = font_info[main_k].qqqq;
2238 if (skip_byte(main_j) <= stop_flag)
2241 main_k = lig_kern_restart(main_f, main_j);
2243 /* main_lig_loop+1:main_j:=font_info[main_k].qqqq; */
2245 main_j = font_info[main_k].qqqq;
2248 /* provide for suppression of f-ligatures 99/Jan/5 */
2251 if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
2257 if (next_char(main_j) == cur_r && bSuppress == 0) /* 99/Jan/5 */
2258 if (skip_byte(main_j) <= stop_flag)
2260 if (op_byte(main_j) >= kern_flag)
2263 tail_append(new_kern(char_kern(main_f, main_j)));
2267 if (cur_l == non_char)
2269 else if (lig_stack == 0)
2275 pause_for_instructions();
2279 switch (op_byte(main_j))
2284 cur_l = rem_byte(main_j);
2285 main_i = char_info(main_f, cur_l);
2286 ligature_present = true;
2292 cur_r = rem_byte(main_j);
2296 lig_stack = new_lig_item(cur_r);
2299 else if ((lig_stack >= hi_mem_min))
2302 lig_stack = new_lig_item(cur_r);
2303 lig_ptr(lig_stack) = main_p;
2306 character(lig_stack) = cur_r;
2311 cur_r = rem_byte(main_j);
2313 lig_stack = new_lig_item(cur_r);
2314 link(lig_stack) = main_p;
2322 cur_l = rem_byte(main_j);
2323 main_i = char_info(main_f, cur_l);
2324 ligature_present = true;
2329 cur_l = rem_byte(main_j);
2330 ligature_present = true;
2340 if (op_byte(main_j) > 4)
2341 if (op_byte(main_j) != 7)
2344 if (cur_l < non_char)
2347 main_k = bchar_label[main_f];
2351 if (skip_byte(main_j) == 0)
2355 if (skip_byte(main_j) >= stop_flag)
2358 main_k = main_k + skip_byte(main_j) + 1;
2365 main_p = lig_ptr(lig_stack);
2367 if (main_p != 0) /* BUG FIX */
2368 tail_append(main_p);
2370 temp_ptr = lig_stack;
2371 lig_stack = link(temp_ptr);
2372 free_node(temp_ptr, small_node_size);
2373 main_i = char_info(main_f, cur_l);
2374 ligature_present = true;
2377 if (main_p != 0) /* BUG FIX */
2382 cur_r = character(lig_stack);
2386 /* append_normal_space */
2388 if (space_skip == 0)
2391 main_p = font_glue[cur_font];
2395 main_p = new_spec(zero_glue);
2396 main_k = param_base[cur_font] + space_code;
2397 width(main_p) = font_info[main_k].cint;
2398 stretch(main_p) = font_info[main_k + 1].cint;
2399 shrink(main_p) = font_info[main_k + 2].cint;
2400 font_glue[cur_font] = main_p;
2403 temp_ptr = new_glue(main_p);
2406 temp_ptr = new_param_glue(space_skip_code);
2408 link(tail) = temp_ptr;
2412 /* give_err_help etc followed here in the old tex8.c */