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 void show_box_(halfword p)
28 depth_threshold = show_box_depth;
29 breadth_max = show_box_breadth;
35 if (pool_ptr + depth_threshold >= current_pool_size)
36 str_pool = realloc_str_pool(increment_pool_size);
38 if (pool_ptr + depth_threshold >= current_pool_size)
39 depth_threshold = current_pool_size - pool_ptr - 1;
41 if (pool_ptr + depth_threshold >= pool_size)
42 depth_threshold = pool_size - pool_ptr - 1;
49 void delete_token_ref_(halfword p)
51 if (token_ref_count(p) == 0)
54 decr(token_ref_count(p));
57 void delete_glue_ref_(halfword p)
59 if (glue_ref_count(p) == 0)
60 free_node(p, glue_spec_size);
62 decr(glue_ref_count(p));
65 void flush_node_list_(halfword p)
69 while (p != 0) { /* while p<>null */
82 flush_node_list(list_ptr(p));
83 free_node(p, box_node_size);
89 free_node(p, rule_node_size);
95 flush_node_list(ins_ptr(p));
96 delete_glue_ref(split_top_ptr(p));
97 free_node(p, ins_node_size);
106 free_node(p, open_node_size);
111 delete_token_ref(write_tokens(p));
112 free_node(p, write_node_size);
117 case set_language_code:
118 free_node(p, small_node_size);
123 return; // abort_flag set
132 if (mem[mem[p + 1].hh.v.LH].hh.v.RH == 0)
133 free_node(mem[p + 1].hh.v.LH, 4);
135 decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
138 if (leader_ptr(p) != 0)
139 flush_node_list(leader_ptr(p));
146 flush_node_list(lig_ptr(p));
149 delete_token_ref(mark_ptr(p));
152 flush_node_list(pre_break(p));
153 flush_node_list(post_break(p));
156 flush_node_list(adjust_ptr(p));
160 free_node(p, style_node_size);
166 flush_node_list(display_mlist(p));
167 flush_node_list(text_mlist(p));
168 flush_node_list(script_mlist(p));
169 flush_node_list(script_script_mlist(p));
170 free_node(p, style_node_size);
188 if (math_type(nucleus(p)) >= sub_box)
189 flush_node_list(info(nucleus(p)));
191 if (math_type(supscr(p)) >= sub_box)
192 flush_node_list(info(supscr(p)));
194 if (math_type(subscr(p)) >= sub_box)
195 flush_node_list(info(subscr(p)));
197 if (type(p) == radical_noad)
198 free_node(p, radical_noad_size);
201 if (type(p) == accent_noad)
202 free_node(p, accent_noad_size);
204 free_node(p, noad_size);
212 free_node(p, noad_size);
218 flush_node_list(info(numerator(p)));
219 flush_node_list(info(denominator(p)));
220 free_node(p, fraction_noad_size);
226 confusion("flushing");
227 return; // abort_flag set
231 free_node(p, small_node_size);
238 halfword copy_node_list_(halfword p)
240 register halfword Result;
249 while (p != 0) { /* while p<>null do l.3969 */
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 ... */
394 void print_mode_(integer m)
398 switch (m / (max_command + 1))
401 print_string("vertical");
404 print_string("horizontal");
407 print_string("display math");
419 switch ((- (integer) m) / (max_command + 1))
422 print_string("internal vertical");
425 print_string("restricted horizontal");
428 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) /* check again after allocation */
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); /* semantic next size - not dynamic */
455 return; // abort_flag set
459 nest[nest_ptr]= cur_list;
471 cur_list = nest[nest_ptr];
474 void show_activities (void)
482 nest[nest_ptr] = cur_list;
486 for (p = nest_ptr; p >= 0; p--)
488 m = nest[p].mode_field;
489 a = nest[p].aux_field;
492 print_string(" entered at line ");
493 print_int(abs(nest[p].ml_field));
497 if (nest[p].pg_field != 040600000)
499 print_string(" (language");
500 print_int(nest[p].pg_field % 65536L);
501 print_string(":hyphenmin");
502 print_int(nest[p].pg_field / 4194304L);
504 print_int((nest[p].pg_field / 65536L) % 64);
509 if (nest[p].ml_field < 0)
511 print_string(" (\\output routine)");
516 if (page_head != page_tail)
518 print_nl("### current page:");
522 print_string(" (held over for next output)");
525 show_box(link(page_head));
527 if (page_contents > 0)
529 print_nl("total height ");
531 print_nl(" goal height ");
532 print_scaled(page_so_far[0]);
533 r = link(page_ins_head);
541 print_string(" adds ");
543 if (count(t) == 1000)
546 t = x_over_n(height(r), 1000) * count(t);
550 if (type(r) == split_up)
559 if ((type(q) == ins_node) && (subtype(q) == subtype(r)))
562 while (!(q == broken_ins(r)));
566 print_string(" might split");
573 if (link(contrib_head) != 0)
574 print_nl("### recent contributions:");
577 show_box(link(nest[p].head_field));
579 switch (abs(m) / (max_command + 1))
583 print_nl("prevdepth ");
585 if (a.cint <= ignore_depth)
586 print_string("ignored");
588 print_scaled(a.cint);
590 if (nest[p].pg_field != 0)
592 print_string(", prevgraf ");
593 print_int(nest[p].pg_field);
594 print_string(" line");
596 if (nest[p].pg_field != 1)
604 print_nl("spacefactor ");
605 print_int(a.hh.v.LH);
611 print_string(", current language ");
612 print_int(a.hh.v.RH);
621 print_string("this will be denominator of:");
629 void print_param_(integer n)
633 case pretolerance_code:
634 print_esc("pretolerance");
638 print_esc("tolerance");
641 case line_penalty_code:
642 print_esc("linepenalty");
645 case hyphen_penalty_code:
646 print_esc("hyphenpenalty");
649 case ex_hyphen_penalty_code:
650 print_esc("exhyphenpenalty");
653 case club_penalty_code:
654 print_esc("clubpenalty");
657 case widow_penalty_code:
658 print_esc("widowpenalty");
661 case display_widow_penalty_code:
662 print_esc("displaywidowpenalty");
665 case broken_penalty_code:
666 print_esc("brokenpenalty");
669 case bin_op_penalty_code:
670 print_esc("binoppenalty");
673 case rel_penalty_code:
674 print_esc("relpenalty");
677 case pre_display_penalty_code:
678 print_esc("predisplaypenalty");
681 case post_display_penalty_code:
682 print_esc("postdisplaypenalty");
685 case inter_line_penalty_code:
686 print_esc("interlinepenalty");
689 case double_hyphen_demerits_code:
690 print_esc("doublehyphendemerits");
693 case final_hyphen_demerits_code:
694 print_esc("finalhyphendemerits");
697 case adj_demerits_code:
698 print_esc("adjdemerits");
705 case delimiter_factor_code:
706 print_esc("delimiterfactor");
710 print_esc("looseness");
729 case show_box_breadth_code:
730 print_esc("showboxbreadth");
733 case show_box_depth_code:
734 print_esc("showboxdepth");
738 print_esc("hbadness");
742 print_esc("vbadness");
746 print_esc("pausing");
749 case tracing_online_code:
750 print_esc("tracingonline");
753 case tracing_macros_code:
754 print_esc("tracingmacros");
757 case tracing_stats_code:
758 print_esc("tracingstats");
761 case tracing_paragraphs_code:
762 print_esc("tracingparagraphs");
765 case tracing_pages_code:
766 print_esc("tracingpages");
769 case tracing_output_code:
770 print_esc("tracingoutput");
773 case tracing_lost_chars_code:
774 print_esc("tracinglostchars");
777 case tracing_commands_code:
778 print_esc("tracingcommands");
781 case tracing_restores_code:
782 print_esc("tracingrestores");
789 case output_penalty_code:
790 print_esc("outputpenalty");
793 case max_dead_cycles_code:
794 print_esc("maxdeadcycles");
797 case hang_after_code:
798 print_esc("hangafter");
801 case floating_penalty_code:
802 print_esc("floatingpenalty");
805 case global_defs_code:
806 print_esc("globaldefs");
813 case escape_char_code:
814 print_esc("escapechar");
817 case default_hyphen_char_code:
818 print_esc("defaulthyphenchar");
821 case default_skew_char_code:
822 print_esc("defaultskewchar");
825 case end_line_char_code:
826 print_esc("endlinechar");
829 case new_line_char_code:
830 print_esc("newlinechar");
834 print_esc("language");
837 case left_hyphen_min_code:
838 print_esc("lefthyphenmin");
841 case right_hyphen_min_code:
842 print_esc("righthyphenmin");
845 case holding_inserts_code:
846 print_esc("holdinginserts");
849 case error_context_lines_code:
850 print_esc("errorcontextlines");
854 print_string("[unknown integer parameter!]");
859 void begin_diagnostic (void)
861 old_setting = selector;
863 if ((tracing_online <= 0) && (selector == term_and_log))
867 if (history == spotless)
868 history = warning_issued;
872 void end_diagnostic_(bool blankline)
879 selector = old_setting;
882 void print_length_param_ (integer n)
886 case par_indent_code:
887 print_esc("parindent");
890 case math_surround_code:
891 print_esc("mathsurround");
894 case line_skip_limit_code:
895 print_esc("lineskiplimit");
907 print_esc("maxdepth");
910 case split_max_depth_code:
911 print_esc("splitmaxdepth");
914 case box_max_depth_code:
915 print_esc("boxmaxdepth");
926 case delimiter_shortfall_code:
927 print_esc("delimitershortfall");
930 case null_delimiter_space_code:
931 print_esc("nulldelimiterspace");
934 case script_space_code:
935 print_esc("scriptspace");
938 case pre_display_size_code:
939 print_esc("predisplaysize");
942 case display_width_code:
943 print_esc("displaywidth");
946 case display_indent_code:
947 print_esc("displayindent");
950 case overfull_rule_code:
951 print_esc("overfullrule");
954 case hang_indent_code:
955 print_esc("hangindent");
959 print_esc("hoffset");
963 print_esc("voffset");
966 case emergency_stretch_code:
967 print_esc("emergencystretch");
971 print_string("[unknown dimen parameter!]");
976 void print_cmd_chr_ (quarterword cmd, halfword chr_code)
981 print_string("begin-group character ");
986 print_string("end-group character ");
991 print_string("math shift character ");
996 print_string("macro parameter character ");
1001 print_string("superscript character ");
1006 print_string("subscript character ");
1011 print_string("end of alignment template");
1015 print_string("blank space ");
1020 print_string("the letter ");
1025 print_string("the character ");
1030 case assign_mu_glue:
1031 if (chr_code < skip_base)
1033 print_skip_param(chr_code - glue_base);
1037 if (chr_code < mu_skip_base)
1040 print_int(chr_code - skip_base);
1044 print_esc("muskip");
1045 print_int(chr_code - mu_skip_base);
1051 if (chr_code >= toks_base)
1054 print_int(chr_code - toks_base);
1060 case output_routine_loc:
1061 print_esc("output");
1065 print_esc("everypar");
1068 case every_math_loc:
1069 print_esc("everymath");
1072 case every_display_loc:
1073 print_esc("everydisplay");
1076 case every_hbox_loc:
1077 print_esc("everyhbox");
1080 case every_vbox_loc:
1081 print_esc("everyvbox");
1085 print_esc("everyjob");
1089 print_esc("everycr");
1093 print_esc("errhelp");
1100 if (chr_code < count_base)
1102 print_param(chr_code - int_base);
1107 print_int(chr_code - count_base);
1112 if (chr_code < scaled_base)
1114 print_length_param(chr_code - dimen_base);
1119 print_int(chr_code - scaled_base);
1124 print_esc("accent");
1128 print_esc("advance");
1131 case after_assignment:
1132 print_esc("afterassignment");
1136 print_esc("aftergroup");
1139 case assign_font_dimen:
1140 print_esc("fontdimen");
1144 print_esc("begingroup");
1148 print_esc("penalty");
1156 print_esc("csname");
1164 print_esc("delimiter");
1168 print_esc("divide");
1172 print_esc("endcsname");
1176 print_esc("endgroup");
1184 print_esc("expandafter");
1188 print_esc("halign");
1196 print_esc("ignorespaces");
1200 print_esc("insert");
1212 print_esc("mathaccent");
1216 print_esc("mathchar");
1220 print_esc("mathchoice");
1224 print_esc("multiply");
1228 print_esc("noalign");
1232 print_esc("noboundary");
1236 print_esc("noexpand");
1240 print_esc("nonscript");
1248 print_esc("radical");
1260 print_esc("setbox");
1264 print_esc("prevgraf");
1268 print_esc("parshape");
1280 print_esc("vadjust");
1284 print_esc("valign");
1288 print_esc("vcenter");
1303 print_esc("endinput");
1309 case first_mark_code:
1310 print_esc("firstmark");
1314 print_esc("botmark");
1317 case split_first_mark_code:
1318 print_esc("splitfirstmark");
1321 case split_bot_mark_code:
1322 print_esc("splitbotmark");
1326 print_esc("topmark");
1332 if (chr_code == int_val)
1334 else if (chr_code == dimen_val)
1336 else if (chr_code == glue_val)
1339 print_esc("muskip");
1343 if (chr_code == vmode)
1344 print_esc("prevdepth");
1346 print_esc("spacefactor");
1351 print_esc("deadcycles");
1353 print_esc("insertpenalties");
1357 if (chr_code == width_offset)
1359 else if (chr_code == height_offset)
1369 print_esc("lastpenalty");
1373 print_esc("lastkern");
1377 print_esc("lastskip");
1380 case input_line_no_code:
1381 print_esc("inputlineno");
1385 print_esc("badness");
1394 print_esc("number");
1397 case roman_numeral_code:
1398 print_esc("romannumeral");
1402 print_esc("string");
1406 print_esc("meaning");
1409 case font_name_code:
1410 print_esc("fontname");
1414 print_esc("jobname");
1439 print_esc("ifvmode");
1443 print_esc("ifhmode");
1447 print_esc("ifmmode");
1451 print_esc("ifinner");
1455 print_esc("ifvoid");
1459 print_esc("ifhbox");
1463 print_esc("ifvbox");
1475 print_esc("iftrue");
1479 print_esc("iffalse");
1483 print_esc("ifcase");
1493 if (chr_code == fi_code)
1495 else if (chr_code == or_code)
1502 if (chr_code == span_code)
1506 print_string("alignment tab character ");
1512 if (chr_code == cr_code)
1518 case set_page_dimen:
1522 print_esc("pagegoal");
1526 print_esc("pagetotal");
1530 print_esc("pagestretch");
1534 print_esc("pagefilstretch");
1538 print_esc("pagefillstretch");
1542 print_esc("pagefilllstretch");
1546 print_esc("pageshrink");
1550 print_esc("pagedepth");
1582 print_esc("hfilneg");
1607 print_esc("vfilneg");
1626 print_esc("moveleft");
1628 print_esc("moveright");
1650 print_esc("lastbox");
1654 print_esc("vsplit");
1661 case vtop_code + vmode:
1672 if (chr_code == a_leaders)
1673 print_esc("leaders");
1674 else if (chr_code == c_leaders)
1675 print_esc("cleaders");
1676 else if (chr_code == x_leaders)
1677 print_esc("xleaders");
1679 print_esc("shipout");
1684 print_esc("noindent");
1686 print_esc("indent");
1690 if (chr_code == glue_node)
1691 print_esc("unskip");
1692 else if (chr_code == kern_node)
1693 print_esc("unkern");
1695 print_esc("unpenalty");
1699 if (chr_code == copy_code)
1700 print_esc("unhcopy");
1702 print_esc("unhbox");
1706 if (chr_code == copy_code)
1707 print_esc("unvcopy");
1709 print_esc("unvbox");
1716 print_esc("discretionary");
1730 print_esc("mathord");
1734 print_esc("mathop");
1738 print_esc("mathbin");
1742 print_esc("mathrel");
1746 print_esc("mathopen");
1750 print_esc("mathclose");
1754 print_esc("mathpunct");
1758 print_esc("mathinner");
1762 print_esc("underline");
1766 print_esc("overline");
1772 if (chr_code == limits)
1773 print_esc("limits");
1774 else if (chr_code == no_limits)
1775 print_esc("nolimits");
1777 print_esc("displaylimits");
1781 print_style(chr_code);
1795 case delimited_code + above_code:
1796 print_esc("abovewithdelims");
1799 case delimited_code + over_code:
1800 print_esc("overwithdelims");
1803 case delimited_code + atop_code:
1804 print_esc("atopwithdelims");
1814 if (chr_code == left_noad)
1823 else if (chr_code == 2)
1826 print_esc("global");
1832 else if (chr_code == 1)
1834 else if (chr_code == 2)
1841 if (chr_code != normal)
1842 print_esc("futurelet");
1851 print_esc("chardef");
1854 case math_char_def_code:
1855 print_esc("mathchardef");
1858 case count_def_code:
1859 print_esc("countdef");
1862 case dimen_def_code:
1863 print_esc("dimendef");
1867 print_esc("skipdef");
1870 case mu_skip_def_code:
1871 print_esc("muskipdef");
1875 print_esc("toksdef");
1882 print_hex(chr_code);
1886 print_esc("mathchar");
1887 print_hex(chr_code);
1891 if (chr_code == cat_code_base)
1892 print_esc("catcode");
1893 else if (chr_code == math_code_base)
1894 print_esc("mathcode");
1895 else if (chr_code == lc_code_base)
1896 print_esc("lccode");
1897 else if (chr_code == uc_code_base)
1898 print_esc("uccode");
1899 else if (chr_code == sf_code_base)
1900 print_esc("sfcode");
1902 print_esc("delcode");
1906 print_size(chr_code - math_font_base);
1911 print_esc("patterns");
1913 print_esc("hyphenation");
1916 case assign_font_int:
1918 print_esc("hyphenchar");
1920 print_esc("skewchar");
1924 print_string("select font ");
1925 slow_print(font_name[chr_code]);
1927 if (font_size[chr_code] != font_dsize[chr_code])
1929 print_string(" at ");
1930 print_scaled(font_size[chr_code]);
1935 case set_interaction:
1939 print_esc("batchmode");
1943 print_esc("nonstopmode");
1947 print_esc("scrollmode");
1951 print_esc("errorstopmode");
1958 print_esc("closein");
1960 print_esc("openin");
1965 print_esc("message");
1967 print_esc("errmessage");
1971 if (chr_code == lc_code_base)
1972 print_esc("lowercase");
1974 print_esc("uppercase");
1981 print_esc("showbox");
1985 print_esc("showthe");
1989 print_esc("showlists");
1999 print_string("undefined");
2003 print_string("macro");
2007 print_esc("long macro");
2011 print_esc("outer macro");
2014 case long_outer_call:
2016 print_esc("outer macro");
2020 print_esc("outer endtemplate");
2027 print_esc("openout");
2035 print_esc("closeout");
2039 print_esc("special");
2042 case immediate_code:
2043 print_esc("immediate");
2046 case set_language_code:
2047 print_esc("setlanguage");
2051 print_string("[unknown extension!]");
2057 print_string("[unknown command code!]");
2063 void show_eqtb_(halfword n)
2065 if (n < active_base)
2072 print_cmd_chr(eq_type(n), equiv(n));
2074 if (eq_type(n) >= call)
2077 show_token_list(link(equiv(n)), 0, 32);
2084 print_skip_param(n - glue_base);
2087 if (n < glue_base + thin_mu_skip_code)
2088 print_spec(equiv(n), "pt");
2090 print_spec(equiv(n), "mu");
2093 if (n < mu_skip_base)
2096 print_int(n - skip_base);
2098 print_spec(equiv(n), "pt");
2102 print_esc("muskip");
2103 print_int(n - mu_skip_base);
2105 print_spec(equiv(n), "mu");
2109 if (n == par_shape_loc)
2111 print_esc("parshape");
2114 if (par_shape_ptr == 0)
2117 print_int(info(par_shape_ptr));
2122 print_cmd_chr(assign_toks, n);
2126 show_token_list(link(equiv(n)), 0, 32);
2132 print_int(n - toks_base);
2136 show_token_list(link(equiv(n)), 0, 32);
2139 if (n < cur_font_loc)
2142 print_int(n - box_base);
2146 print_string("void");
2149 depth_threshold = 0;
2151 show_node_list(equiv(n));
2155 if (n < cat_code_base)
2157 if (n == cur_font_loc)
2158 print_string("current font");
2160 if (n < math_font_base + 16)
2162 print_esc("textfont");
2163 print_int(n - math_font_base);
2166 if (n < math_font_base + 32)
2168 print_esc("scriptfont");
2169 print_int(n - math_font_base - 16);
2173 print_esc("scriptscriptfont");
2174 print_int(n - math_font_base - 32);
2179 print(hash[font_id_base + equiv(n)].v.RH);
2182 if (n < math_code_base)
2184 if (n < lc_code_base)
2186 print_esc("catcode");
2187 print_int(n - cat_code_base);
2190 if (n < uc_code_base)
2192 print_esc("lccode");
2193 print_int(n - lc_code_base);
2196 if (n < sf_code_base)
2198 print_esc("uccode");
2199 print_int(n - uc_code_base);
2203 print_esc("sfcode");
2204 print_int(n - sf_code_base);
2208 print_int(equiv(n));
2212 print_esc("mathcode");
2213 print_int(n - math_code_base);
2215 print_int(equiv(n));
2221 print_param(n - int_base);
2223 if (n < del_code_base)
2226 print_int(n - count_base);
2230 print_esc("delcode");
2231 print_int(n - del_code_base);
2235 print_int(eqtb[n].cint);
2240 if (n < scaled_base)
2241 print_length_param(n - dimen_base);
2245 print_int(n - scaled_base);
2249 print_scaled(eqtb[n].cint);
2257 halfword id_lookup_(integer j, integer l)
2266 for (k = j + 1; k <= j + l - 1; k++)
2268 h = h + h + buffer[k];
2270 while (h >= hash_prime)
2279 if (length(text(p)) == l)
2280 if (str_eq_buf(text(p), j))
2285 if (no_new_control_sequence)
2287 p = undefined_control_sequence;
2297 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
2298 return 0; // abort_flag set
2303 while (!(text(hash_used) == 0));
2306 if (hash_used > 65535L) /* debugging only 1996/Jan/20 */
2308 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
2309 show_line(log_line, 1);
2313 next(p) = hash_used;
2320 while (pool_ptr > str_start[str_ptr])
2323 str_pool[pool_ptr + l] = str_pool[pool_ptr];
2326 for (k = j; k <= j + l - 1; k++)
2327 append_char(buffer[k]);
2331 pool_pointer tempstring = make_string();
2333 if (tempstring > 65535L) /* cannot happen */
2335 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
2336 show_line(log_line, 1);
2338 text(p) = tempstring;
2341 text(p) = make_string();
2344 pool_ptr = pool_ptr + d;
2351 str_pool[pool_ptr] = '\0';
2352 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
2353 show_line(log_line, 0); /* debugging */
2367 void new_save_level_(group_code c)
2369 if (save_ptr > max_save_stack)
2371 max_save_stack = save_ptr;
2373 #ifdef ALLOCATESAVESTACK
2374 if (max_save_stack > current_save_size - 6)
2375 save_stack = realloc_save_stack(increment_save_size);
2377 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2379 overflow("save size", current_save_size);
2380 return; // abort_flag set
2383 if (max_save_stack > save_size - 6) /* save size - not dynamic */
2385 overflow("save size", save_size);
2386 return; // abort_flag set
2390 save_type(save_ptr) = level_boundary;
2391 save_level(save_ptr) = (quarterword) cur_group;
2392 save_index(save_ptr) = cur_boundary;
2394 if (cur_level == max_quarterword)
2396 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2397 return; // abort_flag set
2400 cur_boundary = save_ptr;
2406 void eq_destroy_(memory_word w)
2410 switch (eq_type_field(w))
2415 case long_outer_call:
2416 delete_token_ref(equiv_field(w));
2420 delete_glue_ref(equiv_field(w));
2427 free_node(q, info(q) + info(q) + 1);
2431 flush_node_list(equiv_field(w));
2439 void eq_save_(halfword p, quarterword l)
2441 if (save_ptr > max_save_stack)
2443 max_save_stack = save_ptr;
2445 #ifdef ALLOCATESAVESTACK
2446 if (max_save_stack > current_save_size - 6)
2447 save_stack = realloc_save_stack (increment_save_size);
2449 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2451 overflow("save size", current_save_size);
2452 return; // abort_flag set
2455 if (max_save_stack > save_size - 6) /* save size not dynamic */
2457 overflow("save size", save_size);
2458 return; // abort_flag set
2463 if (l == level_zero)
2464 save_type(save_ptr) = restore_zero;
2467 save_stack[save_ptr] = eqtb[p];
2469 save_type(save_ptr) = restore_old_value;
2472 save_level(save_ptr) = l;
2473 save_index(save_ptr) = p;
2477 void eq_define_(halfword p, quarterword t, halfword e)
2479 if (eq_level(p) == cur_level)
2480 eq_destroy(eqtb[p]);
2481 else if (cur_level > level_one)
2482 eq_save(p, eq_level(p));
2484 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2489 void eq_word_define_(halfword p, integer w)
2491 if (xeq_level[p] != cur_level)
2493 eq_save(p, xeq_level[p]);
2494 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2500 void geq_define_(halfword p, quarterword t, halfword e)
2502 eq_destroy(eqtb[p]);
2503 eq_level(p) = level_one;
2508 void geq_word_define_(halfword p, integer w)
2514 void save_for_after_(halfword t)
2518 if (save_ptr > max_save_stack)
2520 max_save_stack = save_ptr;
2522 #ifdef ALLOCATESAVESTACK
2523 if (max_save_stack > current_save_size - 6)
2524 save_stack = realloc_save_stack (increment_save_size);
2526 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2528 overflow("save size", current_save_size);
2529 return; // abort_flag set
2532 if (max_save_stack > save_size - 6) /* save satck - not dynamic */
2534 overflow("save size", save_size);
2535 return; // abort_flag set
2540 save_type(save_ptr) = insert_token;
2541 save_level(save_ptr) = level_zero;
2542 save_index(save_ptr) = t;
2546 /* restore_trace_, unsave followed in the old tex1.c */