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 void show_box_(halfword p)
30 depth_threshold = show_box_depth;
31 breadth_max = show_box_breadth;
37 if (pool_ptr + depth_threshold >= current_pool_size)
38 str_pool = realloc_str_pool(increment_pool_size);
40 if (pool_ptr + depth_threshold >= current_pool_size)
41 depth_threshold = current_pool_size - pool_ptr - 1;
43 if (pool_ptr + depth_threshold >= pool_size)
44 depth_threshold = pool_size - pool_ptr - 1;
51 void delete_token_ref_(halfword p)
53 if (token_ref_count(p) == 0)
56 decr(token_ref_count(p));
59 void delete_glue_ref_(halfword p)
61 if (glue_ref_count(p) == 0)
62 free_node(p, glue_spec_size);
64 decr(glue_ref_count(p));
67 void flush_node_list_(halfword p)
71 while (p != 0) { /* while p<>null */
84 flush_node_list(list_ptr(p));
85 free_node(p, box_node_size);
91 free_node(p, rule_node_size);
97 flush_node_list(ins_ptr(p));
98 delete_glue_ref(split_top_ptr(p));
99 free_node(p, ins_node_size);
108 free_node(p, open_node_size);
113 delete_token_ref(write_tokens(p));
114 free_node(p, write_node_size);
119 case set_language_code:
120 free_node(p, small_node_size);
125 return; // abort_flag set
134 if (mem[mem[p + 1].hh.v.LH].hh.v.RH == 0)
135 free_node(mem[p + 1].hh.v.LH, 4);
137 decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
140 if (leader_ptr(p) != 0)
141 flush_node_list(leader_ptr(p));
148 flush_node_list(lig_ptr(p));
151 delete_token_ref(mark_ptr(p));
154 flush_node_list(pre_break(p));
155 flush_node_list(post_break(p));
158 flush_node_list(adjust_ptr(p));
162 free_node(p, style_node_size);
168 flush_node_list(display_mlist(p));
169 flush_node_list(text_mlist(p));
170 flush_node_list(script_mlist(p));
171 flush_node_list(script_script_mlist(p));
172 free_node(p, style_node_size);
190 if (math_type(nucleus(p)) >= sub_box)
191 flush_node_list(info(nucleus(p)));
193 if (math_type(supscr(p)) >= sub_box)
194 flush_node_list(info(supscr(p)));
196 if (math_type(subscr(p)) >= sub_box)
197 flush_node_list(info(subscr(p)));
199 if (type(p) == radical_noad)
200 free_node(p, radical_noad_size);
203 if (type(p) == accent_noad)
204 free_node(p, accent_noad_size);
206 free_node(p, noad_size);
214 free_node(p, noad_size);
220 flush_node_list(info(numerator(p)));
221 flush_node_list(info(denominator(p)));
222 free_node(p, fraction_noad_size);
228 confusion("flushing");
229 return; // abort_flag set
233 free_node(p, small_node_size);
240 halfword copy_node_list_(halfword p)
242 register halfword Result;
250 while (p != 0) { /* while p<>null do l.3969 */
252 if ((p >= hi_mem_min))
254 else switch (mem[p].hh.b0)
260 r = get_node(box_node_size);
261 mem[r + 6]= mem[p + 6];
262 mem[r + 5]= mem[p + 5];
263 mem[r + 5].hh.v.RH = copy_node_list(mem[p + 5].hh.v.RH);
276 mem[r + 4]= mem[p + 4];
277 incr(mem[mem[p + 4].hh.v.RH].hh.v.RH);
278 mem[r + 4].hh.v.LH = copy_node_list(mem[p + 4].hh.v.LH);
283 switch (mem[p].hh.b1)
295 incr(mem[mem[p + 1].hh.v.RH].hh.v.LH);
309 return 0; // abort_flag set
317 incr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
318 mem[r + 1].hh.v.LH = mem[p + 1].hh.v.LH;
319 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
333 mem[r + 1]= mem[p + 1];
334 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
340 mem[r + 1].hh.v.LH = copy_node_list(mem[p + 1].hh.v.LH);
341 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
347 incr(mem[mem[p + 1].cint].hh.v.LH);
354 mem[r + 1].cint = copy_node_list(mem[p + 1].cint);
359 confusion("copying");
360 return 0; // abort_flag set
367 mem[r + words] = mem[p + words]; /* r may be used without having ... */
380 void print_mode_(integer m)
387 print_string("vertical");
390 print_string("horizontal");
393 print_string("display math");
405 switch ((- (integer) m) / (101))
408 print_string("internal vertical");
411 print_string("restricted horizontal");
414 print_string("math");
419 print_string(" mode");
422 void push_nest (void)
424 if (nest_ptr > max_nest_stack)
426 max_nest_stack = nest_ptr;
428 #ifdef ALLOCATEINPUTSTACK
429 if (nest_ptr == current_nest_size)
430 nest = realloc_nest_stack(increment_nest_size);
432 if (nest_ptr == current_nest_size) /* check again after allocation */
434 overflow("semantic nest size", current_nest_size);
435 return; // abort_flag set
438 if (nest_ptr == nest_size)
440 overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */
441 return; // abort_flag set
445 nest[nest_ptr]= cur_list;
457 cur_list = nest[nest_ptr];
460 void show_activities (void)
468 nest[nest_ptr]= cur_list;
472 for (p = nest_ptr; p >= 0; p--)
474 m = nest[p].mode_field;
475 a = nest[p].aux_field;
478 print_string(" entered at line ");
479 print_int(abs(nest[p].ml_field));
483 if (nest[p].pg_field != 8585216L) /* 830000 hex ??? */
485 print_string(" (language");
486 print_int(nest[p].pg_field % 65536L);
487 print_string(":hyphenmin");
488 print_int(nest[p].pg_field / 4194304L);
490 print_int((nest[p].pg_field / 65536L)% 64);
495 if (nest[p].ml_field < 0)
497 print_string(" (\\output routine)");
502 if (page_head != page_tail)
504 print_nl("### current page:");
508 print_string(" (held over for next output)");
511 show_box(link(page_head));
513 if (page_contents > 0)
515 print_nl("total height ");
517 print_nl(" goal height ");
518 print_scaled(page_so_far[0]);
519 r = link(page_ins_head);
521 while (r != mem_top) {
526 print_string(" adds ");
528 if (count(t) == 1000)
531 t = x_over_n(height(r), 1000) * count(t);
543 if ((type(q) == ins_node) && (subtype(q) == subtype(r)))
546 while (!(q == mem[r + 1].hh.v.LH));
549 print_string(" might split");
556 if (link(contrib_head) != 0)
557 print_nl(" (\\output routine)");
560 show_box(link(nest[p].head_field));
562 switch (abs(m) / (101))
566 print_nl("### recent contributions:");
568 if (a.cint <= ignore_depth)
569 print_string("ignored");
571 print_scaled(a.cint);
573 if (nest[p].pg_field != 0)
575 print_string(", prevgraf ");
576 print_int(nest[p].pg_field);
577 print_string(" line");
579 if (nest[p].pg_field != 1)
586 print_nl("spacefactor ");
587 print_int(a.hh.v.LH);
593 print_string(", current language ");
594 print_int(a.hh.v.RH);
602 print_string("this will be denominator of:");
610 void print_param_(integer n)
614 case pretolerance_code:
615 print_esc("pretolerance");
618 print_esc("tolerance");
620 case line_penalty_code:
621 print_esc("linepenalty");
623 case hyphen_penalty_code:
624 print_esc("hyphenpenalty");
626 case ex_hyphen_penalty_code:
627 print_esc("exhyphenpenalty");
629 case club_penalty_code:
630 print_esc("clubpenalty");
632 case widow_penalty_code:
633 print_esc("widowpenalty");
635 case display_widow_penalty_code:
636 print_esc("displaywidowpenalty");
638 case broken_penalty_code:
639 print_esc("brokenpenalty");
641 case bin_op_penalty_code:
642 print_esc("binoppenalty");
644 case rel_penalty_code:
645 print_esc("relpenalty");
647 case pre_display_penalty_code:
648 print_esc("predisplaypenalty");
650 case post_display_penalty_code:
651 print_esc("postdisplaypenalty");
653 case inter_line_penalty_code:
654 print_esc("interlinepenalty");
656 case double_hyphen_demerits_code:
657 print_esc("doublehyphendemerits");
659 case final_hyphen_demerits_code:
660 print_esc("finalhyphendemerits");
662 case adj_demerits_code:
663 print_esc("adjdemerits");
668 case delimiter_factor_code:
669 print_esc("delimiterfactor");
672 print_esc("looseness");
686 case show_box_breadth_code:
687 print_esc("showboxbreadth");
689 case show_box_depth_code:
690 print_esc("showboxdepth");
693 print_esc("hbadness");
696 print_esc("vbadness");
699 print_esc("pausing");
701 case tracing_online_code:
702 print_esc("tracingonline");
704 case tracing_macros_code:
705 print_esc("tracingmacros");
707 case tracing_stats_code:
708 print_esc("tracingstats");
710 case tracing_paragraphs_code:
711 print_esc("tracingparagraphs");
713 case tracing_pages_code:
714 print_esc("tracingpages");
716 case tracing_output_code:
717 print_esc("tracingoutput");
719 case tracing_lost_chars_code:
720 print_esc("tracinglostchars");
722 case tracing_commands_code:
723 print_esc("tracingcommands");
725 case tracing_restores_code:
726 print_esc("tracingrestores");
731 case output_penalty_code:
732 print_esc("outputpenalty");
734 case max_dead_cycles_code:
735 print_esc("maxdeadcycles");
737 case hang_after_code:
738 print_esc("hangafter");
740 case floating_penalty_code:
741 print_esc("floatingpenalty");
743 case global_defs_code:
744 print_esc("globaldefs");
749 case escape_char_code:
750 print_esc("escapechar");
752 case default_hyphen_char_code:
753 print_esc("defaulthyphenchar");
755 case default_skew_char_code:
756 print_esc("defaultskewchar");
758 case end_line_char_code:
759 print_esc("endlinechar");
761 case new_line_char_code:
762 print_esc("newlinechar");
765 print_esc("language");
767 case left_hyphen_min_code:
768 print_esc("lefthyphenmin");
770 case right_hyphen_min_code:
771 print_esc("righthyphenmin");
773 case holding_inserts_code:
774 print_esc("holdinginserts");
776 case error_context_lines_code:
777 print_esc("errorcontextlines");
780 print_string("[unknown integer parameter!]");
785 void begin_diagnostic (void)
787 old_setting = selector;
789 if ((tracing_online <= 0) && (selector == term_and_log))
792 if (history == spotless)
794 history = warning_issued;
799 void end_diagnostic_(bool blankline)
808 selector = old_setting;
811 void print_length_param_ (integer n)
815 case par_indent_code:
816 print_esc("parindent");
818 case math_surround_code:
819 print_esc("mathsurround");
821 case line_skip_limit_code:
822 print_esc("lineskiplimit");
831 print_esc("maxdepth");
833 case split_max_depth_code:
834 print_esc("splitmaxdepth");
836 case box_max_depth_code:
837 print_esc("boxmaxdepth");
845 case delimiter_shortfall_code:
846 print_esc("delimitershortfall");
848 case null_delimiter_space_code:
849 print_esc("nulldelimiterspace");
851 case script_space_code:
852 print_esc("scriptspace");
854 case pre_display_size_code:
855 print_esc("predisplaysize");
857 case display_width_code:
858 print_esc("displaywidth");
860 case display_indent_code:
861 print_esc("displayindent");
863 case overfull_rule_code:
864 print_esc("overfullrule");
866 case hang_indent_code:
867 print_esc("hangindent");
870 print_esc("hoffset");
873 print_esc("voffset");
875 case emergency_stretch_code:
876 print_esc("emergencystretch");
879 print_string("[unknown dimen parameter!]");
884 void print_cmd_chr_ (quarterword cmd, halfword chrcode)
889 print_string("begin-group character ");
893 print_string("end-group character ");
897 print_string("math shift character ");
901 print_string("macro parameter character ");
905 print_string("superscript character ");
909 print_string("subscript character ");
913 print_string("end of alignment template");
916 print_string("blank space ");
920 print_string("the letter ");
924 print_string("the character ");
929 if (chrcode < skip_base)
931 print_skip_param(chrcode - glue_base);
935 if (chrcode < mu_skip_base)
938 print_int(chrcode - skip_base);
943 print_int(chrcode - mu_skip_base);
948 if (chrcode >= toks_base)
951 print_int(chrcode - toks_base);
957 case output_routine_loc:
961 print_esc("everypar");
964 print_esc("everymath");
966 case every_display_loc:
967 print_esc("everydisplay");
970 print_esc("everyhbox");
973 print_esc("everyvbox");
976 print_esc("everyjob");
979 print_esc("everycr");
982 print_esc("errhelp");
988 if (chrcode < count_base)
990 print_param(chrcode - int_base);
995 print_int(chrcode - count_base);
999 if (chrcode < scaled_base)
1001 print_length_param(chrcode - dimen_base);
1006 print_int(chrcode - scaled_base);
1010 print_esc("accent");
1013 print_esc("advance");
1015 case after_assignment:
1016 print_esc("afterassignment");
1019 print_esc("aftergroup");
1021 case assign_font_dimen:
1022 print_esc("fontdimen");
1025 print_esc("begingroup");
1028 print_esc("penalty");
1034 print_esc("csname");
1040 print_esc("delimiter");
1043 print_esc("divide");
1046 print_esc("endcsname");
1049 print_esc("endgroup");
1055 print_esc("expandafter");
1058 print_esc("halign");
1064 print_esc("ignorespaces");
1067 print_esc("insert");
1076 print_esc("mathaccent");
1079 print_esc("mathchar");
1082 print_esc("mathchoice");
1085 print_esc("multiply");
1088 print_esc("noalign");
1091 print_esc("noboundary");
1094 print_esc("noexpand");
1097 print_esc("nonscript");
1103 print_esc("radical");
1112 print_esc("setbox");
1115 print_esc("prevgraf");
1118 print_esc("parshape");
1127 print_esc("vadjust");
1130 print_esc("valign");
1133 print_esc("vcenter");
1145 print_esc("endinput");
1150 case first_mark_code:
1151 print_esc("firstmark");
1154 print_esc("botmark");
1156 case split_first_mark_code:
1157 print_esc("splitfirstmark");
1159 case split_bot_mark_code:
1160 print_esc("splitbotmark");
1163 print_esc("topmark");
1168 if (chrcode == int_val)
1170 else if (chrcode == dimen_val)
1172 else if (chrcode == glue_val)
1175 print_esc("muskip");
1179 print_esc("prevdepth");
1181 print_esc("spacefactor");
1185 print_esc("deadcycles");
1187 print_esc("insertpenalties");
1190 if (chrcode == width_offset)
1192 else if (chrcode == height_offset)
1201 print_esc("lastpenalty");
1204 print_esc("lastkern");
1207 print_esc("lastskip");
1209 case input_line_no_code:
1210 print_esc("inputlineno");
1213 print_esc("badness");
1221 print_esc("number");
1223 case roman_numeral_code:
1224 print_esc("romannumeral");
1227 print_esc("string");
1230 print_esc("meaning");
1232 case font_name_code:
1233 print_esc("fontname");
1236 print_esc("jobname");
1256 print_esc("ifvmode");
1259 print_esc("ifhmode");
1262 print_esc("ifmmode");
1265 print_esc("ifinner");
1268 print_esc("ifvoid");
1271 print_esc("ifhbox");
1274 print_esc("ifvbox");
1283 print_esc("iftrue");
1286 print_esc("iffalse");
1289 print_esc("ifcase");
1297 if (chrcode == fi_code)
1299 else if (chrcode == or_code)
1305 if (chrcode == span_code) /* pool size */ /* max_quarterword + 1 ? */
1309 print_string("alignment tab character ");
1314 if (chrcode == cr_code)
1319 case set_page_dimen:
1323 print_esc("pagegoal");
1326 print_esc("pagetotal");
1329 print_esc("pagestretch");
1332 print_esc("pagefilstretch");
1335 print_esc("pagefillstretch");
1338 print_esc("pagefilllstretch");
1341 print_esc("pageshrink");
1344 print_esc("pagedepth");
1370 print_esc("hfilneg");
1390 print_esc("vfilneg");
1405 print_esc("moveleft");
1407 print_esc("moveright");
1425 print_esc("lastbox");
1428 print_esc("vsplit");
1433 case vtop_code + vmode:
1442 if (chrcode == a_leaders)
1443 print_esc("leaders");
1444 else if (chrcode == c_leaders)
1445 print_esc("cleaders");
1446 else if (chrcode == x_leaders)
1447 print_esc("xleaders");
1449 print_esc("shipout");
1453 print_esc("noindent");
1455 print_esc("indent");
1458 if (chrcode == glue_node)
1459 print_esc("unskip");
1460 else if (chrcode == kern_node)
1461 print_esc("unkern");
1463 print_esc("unpenalty");
1466 if (chrcode == copy_code)
1467 print_esc("unhcopy");
1469 print_esc("unhbox");
1472 if (chrcode == copy_code)
1473 print_esc("unvcopy");
1475 print_esc("unvbox");
1481 print_esc("discretionary");
1493 print_esc("mathord");
1496 print_esc("mathop");
1499 print_esc("mathbin");
1502 print_esc("mathrel");
1505 print_esc("mathopen");
1508 print_esc("mathclose");
1511 print_esc("mathpunct");
1514 print_esc("mathinner");
1517 print_esc("underline");
1520 print_esc("overline");
1525 if (chrcode == limits)
1526 print_esc("limits");
1527 else if (chrcode == no_limits)
1528 print_esc("nolimits");
1530 print_esc("displaylimits");
1533 print_style(chrcode);
1544 case delimited_code + above_code:
1545 print_esc("abovewithdelims");
1547 case delimited_code + over_code:
1548 print_esc("overwithdelims");
1550 case delimited_code + atop_code:
1551 print_esc("atopwithdelims");
1559 if (chrcode == left_noad)
1567 else if (chrcode == 2)
1570 print_esc("global");
1575 else if (chrcode == 1)
1577 else if (chrcode == 2)
1583 if (chrcode != normal)
1584 print_esc("futurelet");
1592 print_esc("chardef");
1594 case math_char_def_code:
1595 print_esc("mathchardef");
1597 case count_def_code:
1598 print_esc("countdef");
1600 case dimen_def_code:
1601 print_esc("dimendef");
1604 print_esc("skipdef");
1606 case mu_skip_def_code:
1607 print_esc("muskipdef");
1610 print_esc("toksdef");
1619 print_esc("mathchar");
1623 if (chrcode == cat_code_base)
1624 print_esc("catcode");
1625 else if (chrcode == math_code_base)
1626 print_esc("mathcode");
1627 else if (chrcode == lc_code_base)
1628 print_esc("lccode");
1629 else if (chrcode == uc_code_base)
1630 print_esc("uccode");
1631 else if (chrcode == sf_code_base)
1632 print_esc("sfcode");
1634 print_esc("delcode");
1637 print_size(chrcode - math_font_base);
1641 print_esc("patterns");
1643 print_esc("hyphenation");
1645 case assign_font_int:
1647 print_esc("hyphenchar");
1649 print_esc("skewchar");
1652 print_string("select font ");
1653 slow_print(font_name[chrcode]);
1654 if (font_size[chrcode] != font_dsize[chrcode])
1656 print_string(" at ");
1657 print_scaled(font_size[chrcode]);
1661 case set_interaction:
1665 print_esc("batchmode");
1668 print_esc("nonstopmode");
1671 print_esc("scrollmode");
1674 print_esc("errorstopmode");
1680 print_esc("closein");
1682 print_esc("openin");
1686 print_esc("message");
1688 print_esc("errmessage");
1691 if (chrcode == lc_code_base)
1692 print_esc("lowercase");
1694 print_esc("uppercase");
1700 print_esc("showbox");
1703 print_esc("showthe");
1706 print_esc("showlists");
1714 print_string("undefined");
1717 print_string("macro");
1720 print_esc("long macro");
1723 print_esc("outer macro");
1725 case long_outer_call:
1727 print_esc("outer macro");
1730 print_esc("outer endtemplate");
1736 print_esc("openout");
1742 print_esc("closeout");
1745 print_esc("special");
1747 case immediate_code:
1748 print_esc("immediate");
1750 case set_language_code:
1751 print_esc("setlanguage");
1754 print_string("[unknown extension!]");
1759 print_string("[unknown command code!]");
1765 void show_eqtb_(halfword n)
1767 if (n < active_base)
1774 print_cmd_chr(eq_type(n), equiv(n));
1775 if (eqtb[n].hh.b0 >= call)
1778 show_token_list(link(equiv(n)), 0, 32);
1785 print_skip_param(n - glue_base);
1787 if (n < glue_base + thin_mu_skip_code)
1788 print_spec(equiv(n), "pt");
1790 print_spec(equiv(n), "mu");
1793 if (n < mu_skip_base)
1796 print_int(n - skip_base);
1798 print_spec(equiv(n), "pt");
1802 print_esc("muskip");
1803 print_int(n - mu_skip_base);
1805 print_spec(equiv(n), "mu");
1809 if (n == par_shape_loc)
1811 print_esc("parshape");
1813 if (par_shape_ptr == 0)
1816 print_int(info(par_shape_ptr));
1821 print_cmd_chr(assign_toks, n);
1824 show_token_list(link(equiv(n)), 0, 32);
1830 print_int(n - toks_base);
1833 show_token_list(link(equiv(n)), 0, 32);
1836 if (n < cur_font_loc)
1839 print_int(n - box_base);
1842 print_string("void");
1845 depth_threshold = 0;
1847 show_node_list(equiv(n));
1851 if (n < cat_code_base)
1853 if (n == cur_font_loc)
1854 print_string("current font");
1856 if (n < math_font_base + 16)
1858 print_esc("textfont");
1859 print_int(n - math_font_base);
1862 if (n < math_font_base + 32)
1864 print_esc("scriptfont");
1865 print_int(n - math_font_base - 16);
1869 print_esc("scriptscriptfont");
1870 print_int(n - math_font_base - 32);
1874 print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH);
1877 if (n < math_code_base)
1879 if (n < lc_code_base)
1881 print_esc("catcode");
1882 print_int(n - cat_code_base);
1885 if (n < uc_code_base)
1887 print_esc("lccode");
1888 print_int(n - lc_code_base);
1891 if (n < sf_code_base)
1893 print_esc("uccode");
1894 print_int(n - uc_code_base);
1898 print_esc("sfcode");
1899 print_int(n - sf_code_base);
1902 print_int(equiv(n));
1906 print_esc("mathcode");
1907 print_int(n - math_code_base);
1909 print_int(equiv(n));
1915 print_param(n - int_base);
1917 if (n < del_code_base)
1920 print_int(n - count_base);
1924 print_esc("delcode");
1925 print_int(n - del_code_base);
1928 print_int(eqtb[n].cint);
1933 if (n < scaled_base)
1934 print_length_param(n - dimen_base);
1938 print_int(n - scaled_base);
1941 print_scaled(eqtb[n].cint);
1949 halfword id_lookup_(integer j, integer l)
1951 register halfword Result;
1958 for (k = j + 1; k <= j + l - 1; k++)
1960 h = h + h + buffer[k];
1961 while (h >= hash_prime)
1969 if (length(text(p)) == l)
1970 if (str_eq_buf(text(p), j))
1973 if (hash[p].v.LH == 0)
1975 if (no_new_control_sequence)
1977 p = undefined_control_sequence;
1986 /* we can't expand the hash table ... */
1987 /* overflow("hash size", hash_size); */ /* hash size - NOT DYNAMIC */
1988 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
1989 return 0; // abort_flag set
1992 } while (!(text(hash_used) == 0));
1994 if (hash_used > 65535L) /* debugging only 1996/Jan/20 */
1996 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
1997 show_line(log_line, 1);
2000 hash[p].v.LH = hash_used;
2004 if (checkpool(NULL))
2005 show_line("after hash_used\n", 0);
2008 #ifdef ALLOCATESTRING
2009 if (pool_ptr + l > current_pool_size)
2010 str_pool = realloc_str_pool(increment_pool_size + 1);
2011 if (pool_ptr + l > current_pool_size) /* in case it failed 97/Mar/7 */
2013 overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */
2014 return 0; // abort_flag set
2017 if (pool_ptr + l > pool_size)
2019 overflow("pool size", pool_size - init_pool_ptr); /* pool size - not dynamic */
2020 return; // abort_flag set
2025 while (pool_ptr > str_start[str_ptr]) {
2027 str_pool[pool_ptr + l] = str_pool[pool_ptr];
2030 if (checkpool(NULL)) show_line("after pool_ptr\n", 0);
2032 for (k = j; k <= j + l - 1; k++)
2033 append_char(buffer[k]);
2036 pool_pointer tempstring = make_string();
2037 if (tempstring > 65535L) /* cannot happen */
2039 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
2040 show_line(log_line, 1);
2042 text(p) = tempstring;
2045 text(p) = make_string();
2048 if (checkpool(NULL))
2049 show_line("after make_string\n", 0);
2051 pool_ptr = pool_ptr + d;
2056 str_pool[pool_ptr] = '\0';
2057 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
2058 show_line(log_line, 0); /* debugging */
2063 if (checkpool(NULL))
2064 show_line("after cs_count++\n", 0);
2071 if (checkpool(NULL))
2072 show_line("before return\n", 0);
2079 void new_save_level_(group_code c)
2081 if (save_ptr > max_save_stack)
2083 max_save_stack = save_ptr;
2084 #ifdef ALLOCATESAVESTACK
2085 if (max_save_stack > current_save_size - 6)
2086 save_stack = realloc_save_stack(increment_save_size);
2087 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2089 overflow("save size", current_save_size);
2090 return; // abort_flag set
2093 if (max_save_stack > save_size - 6) /* save size - not dynamic */
2095 overflow("save size", save_size);
2096 return; // abort_flag set
2100 /* save_type(save_ptr) <- level_boundary; */
2101 save_stack[save_ptr].hh.b0 = 3;
2102 /* save_stack[save_ptr].hh.b1 = cur_group; *//* keep compiler happy */
2103 save_stack[save_ptr].hh.b1 = (quarterword) cur_group;
2104 /* save_index(save_ptr):=cur_boundary; */
2105 save_stack[save_ptr].hh.v.RH = cur_boundary;
2106 /* if cur_level = max_quarterword then ... p.274 */
2107 /* if (cur_level == 255)*/ /* 94/Apr/4 */
2108 if (cur_level == max_quarterword)
2110 /* { quit if (cur_level + 1) is too large to store in eqtb } */
2111 /* overflow("grouping levels", max_quarterword - min_quarterword); */
2112 /* overflow("grouping levels", 255); */ /* grouping levels - not dynamic */
2113 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2114 return; // abort_flag set
2117 cur_boundary = save_ptr;
2123 void eq_destroy_(memory_word w)
2126 switch (eq_type_field(w))
2131 case long_outer_call:
2132 delete_token_ref(equiv_field(w));
2135 delete_glue_ref(equiv_field(w));
2140 free_node(q, info(q) + info(q) + 1);
2143 flush_node_list(equiv_field(w));
2150 void eq_save_(halfword p, quarterword l)
2152 if (save_ptr > max_save_stack)
2154 max_save_stack = save_ptr;
2155 #ifdef ALLOCATESAVESTACK
2156 if (max_save_stack > current_save_size - 6)
2157 save_stack = realloc_save_stack (increment_save_size);
2158 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2160 overflow("save size", current_save_size);
2161 return; // abort_flag set
2164 if (max_save_stack > save_size - 6) /* save size not dynamic */
2166 overflow("save size", save_size);
2167 return; // abort_flag set
2171 if (l == level_zero)
2172 save_type(save_ptr) = restore_zero;
2175 save_stack[save_ptr] = eqtb[p];
2177 save_type(save_ptr) = restore_old_value;
2179 save_level(save_ptr) = l;
2180 save_index(save_ptr) = p;
2184 void eq_define_(halfword p, quarterword t, halfword e)
2186 if (eq_level(p) == cur_level)
2187 eq_destroy(eqtb[p]);
2188 else if (cur_level > level_one)
2189 eq_save(p, eq_level(p));
2190 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2195 void eq_word_define_(halfword p, integer w)
2197 if (xeq_level[p] != cur_level)
2199 eq_save(p, xeq_level[p]);
2200 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2205 void geq_define_(halfword p, quarterword t, halfword e)
2207 eq_destroy(eqtb[p]);
2208 eq_level(p) = level_one;
2213 void geq_word_define_(halfword p, integer w)
2219 void save_for_after_(halfword t)
2223 if (save_ptr > max_save_stack)
2225 max_save_stack = save_ptr;
2226 #ifdef ALLOCATESAVESTACK
2227 if (max_save_stack > current_save_size - 6)
2228 save_stack = realloc_save_stack (increment_save_size);
2229 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2231 overflow("save size", current_save_size);
2232 return; // abort_flag set
2235 if (max_save_stack > save_size - 6) /* save satck - not dynamic */
2237 overflow("save size", save_size);
2238 return; // abort_flag set
2242 save_type(save_ptr) = insert_token;
2243 save_level(save_ptr) = level_zero;
2244 save_index(save_ptr) = t;
2248 /* restore_trace_, unsave followed in the old tex1.c */