1 /* Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 void show_box_(pointer p)
25 depth_threshold = show_box_depth;
26 breadth_max = show_box_breadth;
32 if (pool_ptr + depth_threshold >= current_pool_size)
33 str_pool = realloc_str_pool(increment_pool_size);
35 if (pool_ptr + depth_threshold >= current_pool_size)
36 depth_threshold = current_pool_size - pool_ptr - 1;
38 if (pool_ptr + depth_threshold >= pool_size)
39 depth_threshold = pool_size - pool_ptr - 1;
46 void delete_token_ref_(pointer p)
48 if (token_ref_count(p) == 0)
51 decr(token_ref_count(p));
54 void delete_glue_ref_(pointer p)
56 if (glue_ref_count(p) == 0)
57 free_node(p, glue_spec_size);
59 decr(glue_ref_count(p));
62 void flush_node_list_(pointer p)
66 while (is_char_node(p))
80 flush_node_list(list_ptr(p));
81 free_node(p, box_node_size);
87 free_node(p, rule_node_size);
93 flush_node_list(ins_ptr(p));
94 delete_glue_ref(split_top_ptr(p));
95 free_node(p, ins_node_size);
104 free_node(p, open_node_size);
109 delete_token_ref(write_tokens(p));
110 free_node(p, write_node_size);
115 case set_language_code:
116 free_node(p, small_node_size);
121 return; // abort_flag set
130 if (mem[mem[p + 1].hh.v.LH].hh.v.RH == 0)
131 free_node(mem[p + 1].hh.v.LH, 4);
133 decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
136 if (leader_ptr(p) != 0)
137 flush_node_list(leader_ptr(p));
144 flush_node_list(lig_ptr(p));
147 delete_token_ref(mark_ptr(p));
150 flush_node_list(pre_break(p));
151 flush_node_list(post_break(p));
154 flush_node_list(adjust_ptr(p));
158 free_node(p, style_node_size);
164 flush_node_list(display_mlist(p));
165 flush_node_list(text_mlist(p));
166 flush_node_list(script_mlist(p));
167 flush_node_list(script_script_mlist(p));
168 free_node(p, style_node_size);
186 if (math_type(nucleus(p)) >= sub_box)
187 flush_node_list(info(nucleus(p)));
189 if (math_type(supscr(p)) >= sub_box)
190 flush_node_list(info(supscr(p)));
192 if (math_type(subscr(p)) >= sub_box)
193 flush_node_list(info(subscr(p)));
195 if (type(p) == radical_noad)
196 free_node(p, radical_noad_size);
199 if (type(p) == accent_noad)
200 free_node(p, accent_noad_size);
202 free_node(p, noad_size);
210 free_node(p, noad_size);
216 flush_node_list(info(numerator(p)));
217 flush_node_list(info(denominator(p)));
218 free_node(p, fraction_noad_size);
224 confusion("flushing");
225 return; // abort_flag set
230 free_node(p, small_node_size);
238 pointer copy_node_list_(pointer p)
252 if ((p >= hi_mem_min))
254 else switch (type(p))
260 r = get_node(box_node_size);
261 mem[r + 6] = mem[p + 6];
262 mem[r + 5] = mem[p + 5];
263 list_ptr(r) = copy_node_list(list_ptr(p));
269 r = get_node(rule_node_size);
270 words = rule_node_size;
275 r = get_node(ins_node_size);
276 mem[r + 4] = mem[p + 4];
277 add_glue_ref(split_top_ptr(p));
278 ins_ptr(r) = copy_node_list(ins_ptr(p));
279 words = ins_node_size - 1;
287 r = get_node(open_node_size);
288 words = open_node_size;
295 r = get_node(write_node_size);
296 add_token_ref(write_tokens(p));
297 words = write_node_size;
304 r = get_node(small_node_size);
305 words = small_node_size;
312 return 0; // abort_flag set
320 r = get_node(small_node_size);
321 add_glue_ref(glue_ptr(p));
322 glue_ptr(r) = glue_ptr(p);
323 leader_ptr(r) = copy_node_list(leader_ptr(p));
331 r = get_node(small_node_size);
332 words = small_node_size;
338 r = get_node(small_node_size);
339 mem[lig_char(r)] = mem[lig_char(p)];
340 lig_ptr(r) = copy_node_list(lig_ptr(p));
346 r = get_node(small_node_size);
347 pre_break(r) = copy_node_list(pre_break(p));
348 post_break(r) = copy_node_list(pre_break(p));
354 r = get_node(small_node_size);
355 add_token_ref(mark_ptr(p));
356 words = small_node_size;
362 r = get_node(small_node_size);
363 adjust_ptr(r) = copy_node_list(adjust_ptr(p));
369 confusion("copying");
370 return 0; // abort_flag set
378 mem[r + words] = mem[p + words]; /* r may be used without having ... */
393 void print_mode_(integer m)
397 switch (m / (max_command + 1))
400 print_string("vertical");
403 print_string("horizontal");
406 print_string("display math");
418 switch ((- (integer) m) / (max_command + 1))
421 print_string("internal vertical");
424 print_string("restricted horizontal");
427 print_string("math");
433 print_string(" mode");
436 void push_nest (void)
438 if (nest_ptr > max_nest_stack)
440 max_nest_stack = nest_ptr;
442 #ifdef ALLOCATEINPUTSTACK
443 if (nest_ptr == current_nest_size)
444 nest = realloc_nest_stack(increment_nest_size);
446 if (nest_ptr == current_nest_size)
448 overflow("semantic nest size", current_nest_size);
449 return; // abort_flag set
452 if (nest_ptr == nest_size)
454 overflow("semantic nest size", nest_size);
455 return; // abort_flag set
460 nest[nest_ptr]= cur_list;
472 cur_list = nest[nest_ptr];
475 void show_activities (void)
483 nest[nest_ptr] = cur_list;
487 for (p = nest_ptr; p >= 0; p--)
489 m = nest[p].mode_field;
490 a = nest[p].aux_field;
493 print_string(" entered at line ");
494 print_int(abs(nest[p].ml_field));
498 if (nest[p].pg_field != 040600000)
500 print_string(" (language");
501 print_int(nest[p].pg_field % 65536L);
502 print_string(":hyphenmin");
503 print_int(nest[p].pg_field / 4194304L);
505 print_int((nest[p].pg_field / 65536L) % 64);
510 if (nest[p].ml_field < 0)
512 print_string(" (\\output routine)");
517 if (page_head != page_tail)
519 print_nl("### current page:");
523 print_string(" (held over for next output)");
526 show_box(link(page_head));
528 if (page_contents > 0)
530 print_nl("total height ");
532 print_nl(" goal height ");
533 print_scaled(page_so_far[0]);
534 r = link(page_ins_head);
542 print_string(" adds ");
544 if (count(t) == 1000)
547 t = x_over_n(height(r), 1000) * count(t);
551 if (type(r) == split_up)
560 if ((type(q) == ins_node) && (subtype(q) == subtype(r)))
563 while (!(q == broken_ins(r)));
567 print_string(" might split");
574 if (link(contrib_head) != 0)
575 print_nl("### recent contributions:");
578 show_box(link(nest[p].head_field));
580 switch (abs(m) / (max_command + 1))
584 print_nl("prevdepth ");
586 if (a.cint <= ignore_depth)
587 print_string("ignored");
589 print_scaled(a.cint);
591 if (nest[p].pg_field != 0)
593 print_string(", prevgraf ");
594 print_int(nest[p].pg_field);
595 print_string(" line");
597 if (nest[p].pg_field != 1)
605 print_nl("spacefactor ");
606 print_int(a.hh.v.LH);
612 print_string(", current language ");
613 print_int(a.hh.v.RH);
622 print_string("this will be denominator of:");
630 void print_param_(integer n)
634 case pretolerance_code:
635 print_esc("pretolerance");
639 print_esc("tolerance");
642 case line_penalty_code:
643 print_esc("linepenalty");
646 case hyphen_penalty_code:
647 print_esc("hyphenpenalty");
650 case ex_hyphen_penalty_code:
651 print_esc("exhyphenpenalty");
654 case club_penalty_code:
655 print_esc("clubpenalty");
658 case widow_penalty_code:
659 print_esc("widowpenalty");
662 case display_widow_penalty_code:
663 print_esc("displaywidowpenalty");
666 case broken_penalty_code:
667 print_esc("brokenpenalty");
670 case bin_op_penalty_code:
671 print_esc("binoppenalty");
674 case rel_penalty_code:
675 print_esc("relpenalty");
678 case pre_display_penalty_code:
679 print_esc("predisplaypenalty");
682 case post_display_penalty_code:
683 print_esc("postdisplaypenalty");
686 case inter_line_penalty_code:
687 print_esc("interlinepenalty");
690 case double_hyphen_demerits_code:
691 print_esc("doublehyphendemerits");
694 case final_hyphen_demerits_code:
695 print_esc("finalhyphendemerits");
698 case adj_demerits_code:
699 print_esc("adjdemerits");
706 case delimiter_factor_code:
707 print_esc("delimiterfactor");
711 print_esc("looseness");
730 case show_box_breadth_code:
731 print_esc("showboxbreadth");
734 case show_box_depth_code:
735 print_esc("showboxdepth");
739 print_esc("hbadness");
743 print_esc("vbadness");
747 print_esc("pausing");
750 case tracing_online_code:
751 print_esc("tracingonline");
754 case tracing_macros_code:
755 print_esc("tracingmacros");
758 case tracing_stats_code:
759 print_esc("tracingstats");
762 case tracing_paragraphs_code:
763 print_esc("tracingparagraphs");
766 case tracing_pages_code:
767 print_esc("tracingpages");
770 case tracing_output_code:
771 print_esc("tracingoutput");
774 case tracing_lost_chars_code:
775 print_esc("tracinglostchars");
778 case tracing_commands_code:
779 print_esc("tracingcommands");
782 case tracing_restores_code:
783 print_esc("tracingrestores");
790 case output_penalty_code:
791 print_esc("outputpenalty");
794 case max_dead_cycles_code:
795 print_esc("maxdeadcycles");
798 case hang_after_code:
799 print_esc("hangafter");
802 case floating_penalty_code:
803 print_esc("floatingpenalty");
806 case global_defs_code:
807 print_esc("globaldefs");
814 case escape_char_code:
815 print_esc("escapechar");
818 case default_hyphen_char_code:
819 print_esc("defaulthyphenchar");
822 case default_skew_char_code:
823 print_esc("defaultskewchar");
826 case end_line_char_code:
827 print_esc("endlinechar");
830 case new_line_char_code:
831 print_esc("newlinechar");
835 print_esc("language");
838 case left_hyphen_min_code:
839 print_esc("lefthyphenmin");
842 case right_hyphen_min_code:
843 print_esc("righthyphenmin");
846 case holding_inserts_code:
847 print_esc("holdinginserts");
850 case error_context_lines_code:
851 print_esc("errorcontextlines");
855 print_string("[unknown integer parameter!]");
860 void begin_diagnostic (void)
862 old_setting = selector;
864 if ((tracing_online <= 0) && (selector == term_and_log))
868 if (history == spotless)
869 history = warning_issued;
873 void end_diagnostic_(bool blankline)
880 selector = old_setting;
883 void print_length_param_ (integer n)
887 case par_indent_code:
888 print_esc("parindent");
891 case math_surround_code:
892 print_esc("mathsurround");
895 case line_skip_limit_code:
896 print_esc("lineskiplimit");
908 print_esc("maxdepth");
911 case split_max_depth_code:
912 print_esc("splitmaxdepth");
915 case box_max_depth_code:
916 print_esc("boxmaxdepth");
927 case delimiter_shortfall_code:
928 print_esc("delimitershortfall");
931 case null_delimiter_space_code:
932 print_esc("nulldelimiterspace");
935 case script_space_code:
936 print_esc("scriptspace");
939 case pre_display_size_code:
940 print_esc("predisplaysize");
943 case display_width_code:
944 print_esc("displaywidth");
947 case display_indent_code:
948 print_esc("displayindent");
951 case overfull_rule_code:
952 print_esc("overfullrule");
955 case hang_indent_code:
956 print_esc("hangindent");
960 print_esc("hoffset");
964 print_esc("voffset");
967 case emergency_stretch_code:
968 print_esc("emergencystretch");
972 print_string("[unknown dimen parameter!]");
977 void print_cmd_chr_ (quarterword cmd, halfword chr_code)
982 print_string("begin-group character ");
987 print_string("end-group character ");
992 print_string("math shift character ");
997 print_string("macro parameter character ");
1002 print_string("superscript character ");
1007 print_string("subscript character ");
1012 print_string("end of alignment template");
1016 print_string("blank space ");
1021 print_string("the letter ");
1026 print_string("the character ");
1031 case assign_mu_glue:
1032 if (chr_code < skip_base)
1034 print_skip_param(chr_code - glue_base);
1038 if (chr_code < mu_skip_base)
1041 print_int(chr_code - skip_base);
1045 print_esc("muskip");
1046 print_int(chr_code - mu_skip_base);
1052 if (chr_code >= toks_base)
1055 print_int(chr_code - toks_base);
1061 case output_routine_loc:
1062 print_esc("output");
1066 print_esc("everypar");
1069 case every_math_loc:
1070 print_esc("everymath");
1073 case every_display_loc:
1074 print_esc("everydisplay");
1077 case every_hbox_loc:
1078 print_esc("everyhbox");
1081 case every_vbox_loc:
1082 print_esc("everyvbox");
1086 print_esc("everyjob");
1090 print_esc("everycr");
1094 print_esc("errhelp");
1101 if (chr_code < count_base)
1103 print_param(chr_code - int_base);
1108 print_int(chr_code - count_base);
1113 if (chr_code < scaled_base)
1115 print_length_param(chr_code - dimen_base);
1120 print_int(chr_code - scaled_base);
1125 print_esc("accent");
1129 print_esc("advance");
1132 case after_assignment:
1133 print_esc("afterassignment");
1137 print_esc("aftergroup");
1140 case assign_font_dimen:
1141 print_esc("fontdimen");
1145 print_esc("begingroup");
1149 print_esc("penalty");
1157 print_esc("csname");
1165 print_esc("delimiter");
1169 print_esc("divide");
1173 print_esc("endcsname");
1177 print_esc("endgroup");
1185 print_esc("expandafter");
1189 print_esc("halign");
1197 print_esc("ignorespaces");
1201 print_esc("insert");
1213 print_esc("mathaccent");
1217 print_esc("mathchar");
1221 print_esc("mathchoice");
1225 print_esc("multiply");
1229 print_esc("noalign");
1233 print_esc("noboundary");
1237 print_esc("noexpand");
1241 print_esc("nonscript");
1249 print_esc("radical");
1261 print_esc("setbox");
1265 print_esc("prevgraf");
1269 print_esc("parshape");
1281 print_esc("vadjust");
1285 print_esc("valign");
1289 print_esc("vcenter");
1304 print_esc("endinput");
1310 case first_mark_code:
1311 print_esc("firstmark");
1315 print_esc("botmark");
1318 case split_first_mark_code:
1319 print_esc("splitfirstmark");
1322 case split_bot_mark_code:
1323 print_esc("splitbotmark");
1327 print_esc("topmark");
1333 if (chr_code == int_val)
1335 else if (chr_code == dimen_val)
1337 else if (chr_code == glue_val)
1340 print_esc("muskip");
1344 if (chr_code == vmode)
1345 print_esc("prevdepth");
1347 print_esc("spacefactor");
1352 print_esc("deadcycles");
1354 print_esc("insertpenalties");
1358 if (chr_code == width_offset)
1360 else if (chr_code == height_offset)
1370 print_esc("lastpenalty");
1374 print_esc("lastkern");
1378 print_esc("lastskip");
1381 case input_line_no_code:
1382 print_esc("inputlineno");
1386 print_esc("badness");
1395 print_esc("number");
1398 case roman_numeral_code:
1399 print_esc("romannumeral");
1403 print_esc("string");
1407 print_esc("meaning");
1410 case font_name_code:
1411 print_esc("fontname");
1415 print_esc("jobname");
1440 print_esc("ifvmode");
1444 print_esc("ifhmode");
1448 print_esc("ifmmode");
1452 print_esc("ifinner");
1456 print_esc("ifvoid");
1460 print_esc("ifhbox");
1464 print_esc("ifvbox");
1476 print_esc("iftrue");
1480 print_esc("iffalse");
1484 print_esc("ifcase");
1494 if (chr_code == fi_code)
1496 else if (chr_code == or_code)
1503 if (chr_code == span_code)
1507 print_string("alignment tab character ");
1513 if (chr_code == cr_code)
1519 case set_page_dimen:
1523 print_esc("pagegoal");
1527 print_esc("pagetotal");
1531 print_esc("pagestretch");
1535 print_esc("pagefilstretch");
1539 print_esc("pagefillstretch");
1543 print_esc("pagefilllstretch");
1547 print_esc("pageshrink");
1551 print_esc("pagedepth");
1583 print_esc("hfilneg");
1608 print_esc("vfilneg");
1627 print_esc("moveleft");
1629 print_esc("moveright");
1651 print_esc("lastbox");
1655 print_esc("vsplit");
1662 case vtop_code + vmode:
1673 if (chr_code == a_leaders)
1674 print_esc("leaders");
1675 else if (chr_code == c_leaders)
1676 print_esc("cleaders");
1677 else if (chr_code == x_leaders)
1678 print_esc("xleaders");
1680 print_esc("shipout");
1685 print_esc("noindent");
1687 print_esc("indent");
1691 if (chr_code == glue_node)
1692 print_esc("unskip");
1693 else if (chr_code == kern_node)
1694 print_esc("unkern");
1696 print_esc("unpenalty");
1700 if (chr_code == copy_code)
1701 print_esc("unhcopy");
1703 print_esc("unhbox");
1707 if (chr_code == copy_code)
1708 print_esc("unvcopy");
1710 print_esc("unvbox");
1717 print_esc("discretionary");
1731 print_esc("mathord");
1735 print_esc("mathop");
1739 print_esc("mathbin");
1743 print_esc("mathrel");
1747 print_esc("mathopen");
1751 print_esc("mathclose");
1755 print_esc("mathpunct");
1759 print_esc("mathinner");
1763 print_esc("underline");
1767 print_esc("overline");
1773 if (chr_code == limits)
1774 print_esc("limits");
1775 else if (chr_code == no_limits)
1776 print_esc("nolimits");
1778 print_esc("displaylimits");
1782 print_style(chr_code);
1796 case delimited_code + above_code:
1797 print_esc("abovewithdelims");
1800 case delimited_code + over_code:
1801 print_esc("overwithdelims");
1804 case delimited_code + atop_code:
1805 print_esc("atopwithdelims");
1815 if (chr_code == left_noad)
1824 else if (chr_code == 2)
1827 print_esc("global");
1833 else if (chr_code == 1)
1835 else if (chr_code == 2)
1842 if (chr_code != normal)
1843 print_esc("futurelet");
1852 print_esc("chardef");
1855 case math_char_def_code:
1856 print_esc("mathchardef");
1859 case count_def_code:
1860 print_esc("countdef");
1863 case dimen_def_code:
1864 print_esc("dimendef");
1868 print_esc("skipdef");
1871 case mu_skip_def_code:
1872 print_esc("muskipdef");
1876 print_esc("toksdef");
1883 print_hex(chr_code);
1887 print_esc("mathchar");
1888 print_hex(chr_code);
1892 if (chr_code == cat_code_base)
1893 print_esc("catcode");
1894 else if (chr_code == math_code_base)
1895 print_esc("mathcode");
1896 else if (chr_code == lc_code_base)
1897 print_esc("lccode");
1898 else if (chr_code == uc_code_base)
1899 print_esc("uccode");
1900 else if (chr_code == sf_code_base)
1901 print_esc("sfcode");
1903 print_esc("delcode");
1907 print_size(chr_code - math_font_base);
1912 print_esc("patterns");
1914 print_esc("hyphenation");
1917 case assign_font_int:
1919 print_esc("hyphenchar");
1921 print_esc("skewchar");
1925 print_string("select font ");
1926 slow_print(font_name[chr_code]);
1928 if (font_size[chr_code] != font_dsize[chr_code])
1930 print_string(" at ");
1931 print_scaled(font_size[chr_code]);
1936 case set_interaction:
1940 print_esc("batchmode");
1944 print_esc("nonstopmode");
1948 print_esc("scrollmode");
1952 print_esc("errorstopmode");
1959 print_esc("closein");
1961 print_esc("openin");
1966 print_esc("message");
1968 print_esc("errmessage");
1972 if (chr_code == lc_code_base)
1973 print_esc("lowercase");
1975 print_esc("uppercase");
1982 print_esc("showbox");
1986 print_esc("showthe");
1990 print_esc("showlists");
2000 print_string("undefined");
2004 print_string("macro");
2008 print_esc("long macro");
2012 print_esc("outer macro");
2015 case long_outer_call:
2017 print_esc("outer macro");
2021 print_esc("outer endtemplate");
2028 print_esc("openout");
2036 print_esc("closeout");
2040 print_esc("special");
2043 case immediate_code:
2044 print_esc("immediate");
2047 case set_language_code:
2048 print_esc("setlanguage");
2052 print_string("[unknown extension!]");
2058 print_string("[unknown command code!]");
2064 void show_eqtb_(halfword n)
2066 if (n < active_base)
2073 print_cmd_chr(eq_type(n), equiv(n));
2075 if (eq_type(n) >= call)
2078 show_token_list(link(equiv(n)), 0, 32);
2085 print_skip_param(n - glue_base);
2088 if (n < glue_base + thin_mu_skip_code)
2089 print_spec(equiv(n), "pt");
2091 print_spec(equiv(n), "mu");
2094 if (n < mu_skip_base)
2097 print_int(n - skip_base);
2099 print_spec(equiv(n), "pt");
2103 print_esc("muskip");
2104 print_int(n - mu_skip_base);
2106 print_spec(equiv(n), "mu");
2110 if (n == par_shape_loc)
2112 print_esc("parshape");
2115 if (par_shape_ptr == 0)
2118 print_int(info(par_shape_ptr));
2123 print_cmd_chr(assign_toks, n);
2127 show_token_list(link(equiv(n)), 0, 32);
2133 print_int(n - toks_base);
2137 show_token_list(link(equiv(n)), 0, 32);
2140 if (n < cur_font_loc)
2143 print_int(n - box_base);
2147 print_string("void");
2150 depth_threshold = 0;
2152 show_node_list(equiv(n));
2156 if (n < cat_code_base)
2158 if (n == cur_font_loc)
2159 print_string("current font");
2161 if (n < math_font_base + 16)
2163 print_esc("textfont");
2164 print_int(n - math_font_base);
2167 if (n < math_font_base + 32)
2169 print_esc("scriptfont");
2170 print_int(n - math_font_base - 16);
2174 print_esc("scriptscriptfont");
2175 print_int(n - math_font_base - 32);
2180 print(hash[font_id_base + equiv(n)].v.RH);
2183 if (n < math_code_base)
2185 if (n < lc_code_base)
2187 print_esc("catcode");
2188 print_int(n - cat_code_base);
2191 if (n < uc_code_base)
2193 print_esc("lccode");
2194 print_int(n - lc_code_base);
2197 if (n < sf_code_base)
2199 print_esc("uccode");
2200 print_int(n - uc_code_base);
2204 print_esc("sfcode");
2205 print_int(n - sf_code_base);
2209 print_int(equiv(n));
2213 print_esc("mathcode");
2214 print_int(n - math_code_base);
2216 print_int(equiv(n));
2222 print_param(n - int_base);
2224 if (n < del_code_base)
2227 print_int(n - count_base);
2231 print_esc("delcode");
2232 print_int(n - del_code_base);
2236 print_int(eqtb[n].cint);
2241 if (n < scaled_base)
2242 print_length_param(n - dimen_base);
2246 print_int(n - scaled_base);
2250 print_scaled(eqtb[n].cint);
2258 halfword id_lookup_(integer j, integer l)
2267 for (k = j + 1; k <= j + l - 1; k++)
2269 h = h + h + buffer[k];
2271 while (h >= hash_prime)
2280 if (length(text(p)) == l)
2281 if (str_eq_buf(text(p), j))
2286 if (no_new_control_sequence)
2288 p = undefined_control_sequence;
2298 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
2299 return 0; // abort_flag set
2304 while (!(text(hash_used) == 0));
2307 if (hash_used > 65535L) /* debugging only 1996/Jan/20 */
2309 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
2310 show_line(log_line, 1);
2314 next(p) = hash_used;
2321 while (pool_ptr > str_start[str_ptr])
2324 str_pool[pool_ptr + l] = str_pool[pool_ptr];
2327 for (k = j; k <= j + l - 1; k++)
2328 append_char(buffer[k]);
2332 pool_pointer tempstring = make_string();
2334 if (tempstring > 65535L) /* cannot happen */
2336 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
2337 show_line(log_line, 1);
2339 text(p) = tempstring;
2342 text(p) = make_string();
2345 pool_ptr = pool_ptr + d;
2352 str_pool[pool_ptr] = '\0';
2353 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr - l - d]);
2354 show_line(log_line, 0); /* debugging */
2368 void new_save_level_(group_code c)
2370 if (save_ptr > max_save_stack)
2372 max_save_stack = save_ptr;
2374 #ifdef ALLOCATESAVESTACK
2375 if (max_save_stack > current_save_size - 6)
2376 save_stack = realloc_save_stack(increment_save_size);
2378 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2380 overflow("save size", current_save_size);
2381 return; // abort_flag set
2384 if (max_save_stack > save_size - 6) /* save size - not dynamic */
2386 overflow("save size", save_size);
2387 return; // abort_flag set
2392 save_type(save_ptr) = level_boundary;
2393 save_level(save_ptr) = (quarterword) cur_group;
2394 save_index(save_ptr) = cur_boundary;
2396 if (cur_level == max_quarterword)
2398 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2399 return; // abort_flag set
2402 cur_boundary = save_ptr;
2408 void eq_destroy_(memory_word w)
2412 switch (eq_type_field(w))
2417 case long_outer_call:
2418 delete_token_ref(equiv_field(w));
2422 delete_glue_ref(equiv_field(w));
2429 free_node(q, info(q) + info(q) + 1);
2433 flush_node_list(equiv_field(w));
2441 void eq_save_(halfword p, quarterword l)
2443 if (save_ptr > max_save_stack)
2445 max_save_stack = save_ptr;
2447 #ifdef ALLOCATESAVESTACK
2448 if (max_save_stack > current_save_size - 6)
2449 save_stack = realloc_save_stack (increment_save_size);
2451 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2453 overflow("save size", current_save_size);
2454 return; // abort_flag set
2457 if (max_save_stack > save_size - 6) /* save size not dynamic */
2459 overflow("save size", save_size);
2460 return; // abort_flag set
2465 if (l == level_zero)
2466 save_type(save_ptr) = restore_zero;
2469 save_stack[save_ptr] = eqtb[p];
2471 save_type(save_ptr) = restore_old_value;
2474 save_level(save_ptr) = l;
2475 save_index(save_ptr) = p;
2479 void eq_define_(halfword p, quarterword t, halfword e)
2481 if (eq_level(p) == cur_level)
2482 eq_destroy(eqtb[p]);
2483 else if (cur_level > level_one)
2484 eq_save(p, eq_level(p));
2486 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2491 void eq_word_define_(halfword p, integer w)
2493 if (xeq_level[p] != cur_level)
2495 eq_save(p, xeq_level[p]);
2496 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2502 void geq_define_(halfword p, quarterword t, halfword e)
2504 eq_destroy(eqtb[p]);
2505 eq_level(p) = level_one;
2510 void geq_word_define_(halfword p, integer w)
2516 void save_for_after_(halfword t)
2520 if (save_ptr > max_save_stack)
2522 max_save_stack = save_ptr;
2524 #ifdef ALLOCATESAVESTACK
2525 if (max_save_stack > current_save_size - 6)
2526 save_stack = realloc_save_stack (increment_save_size);
2528 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2530 overflow("save size", current_save_size);
2531 return; // abort_flag set
2534 if (max_save_stack > save_size - 6) /* save satck - not dynamic */
2536 overflow("save size", save_size);
2537 return; // abort_flag set
2542 save_type(save_ptr) = insert_token;
2543 save_level(save_ptr) = level_zero;
2544 save_index(save_ptr) = t;
2548 /* restore_trace_, unsave followed in the old tex1.c */