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);
39 if (pool_ptr + depth_threshold >= current_pool_size)
40 depth_threshold = current_pool_size - pool_ptr - 1;
42 if (pool_ptr + depth_threshold >= pool_size)
43 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)
68 while (p != 0) { /* while p<>null */
81 flush_node_list(list_ptr(p));
82 free_node(p, box_node_size);
88 free_node(p, rule_node_size);
94 flush_node_list(ins_ptr(p));
95 delete_glue_ref(split_top_ptr(p));
96 free_node(p, ins_node_size);
105 free_node(p, open_node_size);
110 delete_token_ref(write_tokens(p));
111 free_node(p, write_node_size);
116 case set_language_code:
117 free_node(p, small_node_size);
122 return; // abort_flag set
131 if (mem[mem[p + 1].hh.v.LH].hh.v.RH == 0)
132 free_node(mem[p + 1].hh.v.LH, 4);
134 decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
137 if (leader_ptr(p) != 0)
138 flush_node_list(leader_ptr(p));
145 flush_node_list(lig_ptr(p));
148 delete_token_ref(mark_ptr(p));
151 flush_node_list(pre_break(p));
152 flush_node_list(post_break(p));
155 flush_node_list(adjust_ptr(p));
159 free_node(p, style_node_size);
165 flush_node_list(display_mlist(p));
166 flush_node_list(text_mlist(p));
167 flush_node_list(script_mlist(p));
168 flush_node_list(script_script_mlist(p));
169 free_node(p, style_node_size);
187 if (math_type(nucleus(p)) >= sub_box)
188 flush_node_list(info(nucleus(p)));
189 if (math_type(supscr(p)) >= sub_box)
190 flush_node_list(info(supscr(p)));
191 if (math_type(subscr(p)) >= sub_box)
192 flush_node_list(info(subscr(p)));
193 if (type(p) == radical_noad)
194 free_node(p, radical_noad_size);
196 if (type(p) == accent_noad)
197 free_node(p, accent_noad_size);
199 free_node(p, noad_size);
206 free_node(p, noad_size);
212 flush_node_list(info(numerator(p)));
213 flush_node_list(info(denominator(p)));
214 free_node(p, fraction_noad_size);
220 confusion("flushing");
221 return; // abort_flag set
225 free_node(p, small_node_size);
232 halfword copy_node_list_(halfword p)
234 register halfword Result;
242 while (p != 0) { /* while p<>null do l.3969 */
244 if ((p >= hi_mem_min))
246 else switch (mem[p].hh.b0)
252 r = get_node(box_node_size);
253 mem[r + 6]= mem[p + 6];
254 mem[r + 5]= mem[p + 5];
255 mem[r + 5].hh.v.RH = copy_node_list(mem[p + 5].hh.v.RH);
268 mem[r + 4]= mem[p + 4];
269 incr(mem[mem[p + 4].hh.v.RH].hh.v.RH);
270 mem[r + 4].hh.v.LH = copy_node_list(mem[p + 4].hh.v.LH);
275 switch (mem[p].hh.b1)
287 incr(mem[mem[p + 1].hh.v.RH].hh.v.LH);
301 return 0; // abort_flag set
309 incr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
310 mem[r + 1].hh.v.LH = mem[p + 1].hh.v.LH;
311 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
325 mem[r + 1]= mem[p + 1];
326 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
332 mem[r + 1].hh.v.LH = copy_node_list(mem[p + 1].hh.v.LH);
333 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
339 incr(mem[mem[p + 1].cint].hh.v.LH);
346 mem[r + 1].cint = copy_node_list(mem[p + 1].cint);
351 confusion("copying");
352 return 0; // abort_flag set
358 mem[r + words] = mem[p + words]; /* r may be used without having ... */
367 mem[h].hh.v.RH = avail;
378 void print_mode_(integer m)
385 print_string("vertical");
388 print_string("horizontal");
391 print_string("display math");
401 switch ((- (integer) m)/(101))
404 print_string("internal vertical");
407 print_string("restricted horizontal");
410 print_string("math");
415 print_string(" mode");
418 void push_nest (void)
420 if (nest_ptr > max_nest_stack)
422 max_nest_stack = nest_ptr;
423 #ifdef ALLOCATEINPUTSTACK
424 if (nest_ptr == current_nest_size)
425 nest = realloc_nest_stack(increment_nest_size);
426 if (nest_ptr == current_nest_size) /* check again after allocation */
428 overflow("semantic nest size", current_nest_size);
429 return; // abort_flag set
432 if (nest_ptr == nest_size)
434 overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */
435 return; // abort_flag set
439 nest[nest_ptr]= cur_list;
451 cur_list = nest[nest_ptr];
454 void show_activities (void)
462 nest[nest_ptr]= cur_list;
466 register integer for_end;
471 m = nest[p].mode_field;
472 a = nest[p].aux_field;
475 print_string(" entered at line ");
476 print_int(abs(nest[p].ml_field));
478 /* ************************************************************************ */
479 /* major change from 3.141 -> 3.14159 in following */
480 /*.pg_field instead of .lhmfield and .rhmfield */
481 /* WAS if ((nest[p].lhmfield != 2)||(nest[p].rhmfield != 3)) */
482 if (nest[p].pg_field != 8585216L) /* 830000 hex ??? */
484 print_string(" (language");
485 print_int(nest[p].pg_field % 65536L); /* last 16 bits */
486 /* print_int(nest[p].pg_field & 65535L); */
487 print_string(":hyphenmin");
488 print_int(nest[p].pg_field / 4194304L); /* 400000 hex ??? */
489 /* print_int(nest[p].pg_field >> 22); */ /* top 10 bits */
491 print_int((nest[p].pg_field / 65536L)% 64);
492 /* print_int((nest[p].pg_field >> 16)& 63); */ /* next 8 bits */
493 /* this used to refer to .lhmfield and .rhmfield ... */
494 /* ********************************************************************* */
497 if (nest[p].ml_field < 0)
498 print_string(" (\\output routine)");
501 if (page_head != page_tail)
503 print_nl("### current page:");
505 print_string(" (held over for next output)");
506 show_box(mem[page_head].hh.v.RH);
507 if (page_contents > 0)
509 print_nl("total height ");
511 print_nl("goal height ");
512 print_scaled(page_so_far[0]);
513 r = mem[mem_top].hh.v.RH;
514 while (r != mem_top) {
519 print_string(" adds ");
520 /* 427. Tell more precisely the effective size of 1:1 insertions (DEK, 27 Feb 08) */
521 if (eqtb[(hash_size + 3218) + t].cint == 1000)
524 t = x_over_n(mem[r + 3].cint, 1000) * eqtb[(hash_size + 3218) + t].cint;
526 if (mem[r].hh.b0 == 1)
532 if ((mem[q].hh.b0 == 3) && (mem[q].hh.b1 == mem[r].hh.b1))
534 } while (!(q == mem[r + 1].hh.v.LH));
537 print_string(" might split");
543 /* if link(contrib_head)<>null then l.4393 */
544 if (mem[contrib_head].hh.v.RH != 0)
545 print_nl(" (\\output routine)");
547 show_box(mem[nest[p].head_field].hh.v.RH);
548 switch (abs(m)/(101))
552 print_nl("### recent contributions:");
553 if (a.cint <= ignore_depth)
554 print_string("ignored");
556 print_scaled(a.cint);
557 if (nest[p].pg_field != 0)
559 print_string(", prevgraf ");
560 print_int(nest[p].pg_field);
561 print_string(" line");
562 if (nest[p].pg_field != 1)
569 print_nl("spacefactor ");
570 print_int(a.hh.v.LH);
574 print_string(", current language ");
575 print_int(a.hh.v.RH);
582 print_string("this will be denominator of:");
587 } while(p-- > for_end);
591 void print_param_(integer n)
595 case pretolerance_code:
596 print_esc("pretolerance");
599 print_esc("tolerance");
601 case line_penalty_code:
602 print_esc("linepenalty");
604 case hyphen_penalty_code:
605 print_esc("hyphenpenalty");
607 case ex_hyphen_penalty_code:
608 print_esc("exhyphenpenalty");
610 case club_penalty_code:
611 print_esc("clubpenalty");
613 case widow_penalty_code:
614 print_esc("widowpenalty");
616 case display_widow_penalty_code:
617 print_esc("displaywidowpenalty");
619 case broken_penalty_code:
620 print_esc("brokenpenalty");
622 case bin_op_penalty_code:
623 print_esc("binoppenalty");
625 case rel_penalty_code:
626 print_esc("relpenalty");
628 case pre_display_penalty_code:
629 print_esc("predisplaypenalty");
631 case post_display_penalty_code:
632 print_esc("postdisplaypenalty");
634 case inter_line_penalty_code:
635 print_esc("interlinepenalty");
637 case double_hyphen_demerits_code:
638 print_esc("doublehyphendemerits");
640 case final_hyphen_demerits_code:
641 print_esc("finalhyphendemerits");
643 case adj_demerits_code:
644 print_esc("adjdemerits");
649 case delimiter_factor_code:
650 print_esc("delimiterfactor");
653 print_esc("looseness");
667 case show_box_breadth_code:
668 print_esc("showboxbreadth");
670 case show_box_depth_code:
671 print_esc("showboxdepth");
674 print_esc("hbadness");
677 print_esc("vbadness");
680 print_esc("pausing");
682 case tracing_online_code:
683 print_esc("tracingonline");
685 case tracing_macros_code:
686 print_esc("tracingmacros");
688 case tracing_stats_code:
689 print_esc("tracingstats");
691 case tracing_paragraphs_code:
692 print_esc("tracingparagraphs");
694 case tracing_pages_code:
695 print_esc("tracingpages");
697 case tracing_output_code:
698 print_esc("tracingoutput");
700 case tracing_lost_chars_code:
701 print_esc("tracinglostchars");
703 case tracing_commands_code:
704 print_esc("tracingcommands");
706 case tracing_restores_code:
707 print_esc("tracingrestores");
712 case output_penalty_code:
713 print_esc("outputpenalty");
715 case max_dead_cycles_code:
716 print_esc("maxdeadcycles");
718 case hang_after_code:
719 print_esc("hangafter");
721 case floating_penalty_code:
722 print_esc("floatingpenalty");
724 case global_defs_code:
725 print_esc("globaldefs");
730 case escape_char_code:
731 print_esc("escapechar");
733 case default_hyphen_char_code:
734 print_esc("defaulthyphenchar");
736 case default_skew_char_code:
737 print_esc("defaultskewchar");
739 case end_line_char_code:
740 print_esc("endlinechar");
742 case new_line_char_code:
743 print_esc("newlinechar");
746 print_esc("language");
748 case left_hyphen_min_code:
749 print_esc("lefthyphenmin");
751 case right_hyphen_min_code:
752 print_esc("righthyphenmin");
754 case holding_inserts_code:
755 print_esc("holdinginserts");
757 case error_context_lines_code:
758 print_esc("errorcontextlines");
761 print_string("[unknown integer parameter!]");
766 void begin_diagnostic (void)
768 old_setting = selector;
769 if ((tracing_online <= 0) && (selector == term_and_log))
772 if (history == spotless)
773 history = warning_issued;
777 void end_diagnostic_(bool blankline)
782 selector = old_setting;
785 void print_length_param_ (integer n)
789 case par_indent_code:
790 print_esc("parindent");
792 case math_surround_code:
793 print_esc("mathsurround");
795 case line_skip_limit_code:
796 print_esc("lineskiplimit");
805 print_esc("maxdepth");
807 case split_max_depth_code:
808 print_esc("splitmaxdepth");
810 case box_max_depth_code:
811 print_esc("boxmaxdepth");
819 case delimiter_shortfall_code:
820 print_esc("delimitershortfall");
822 case null_delimiter_space_code:
823 print_esc("nulldelimiterspace");
825 case script_space_code:
826 print_esc("scriptspace");
828 case pre_display_size_code:
829 print_esc("predisplaysize");
831 case display_width_code:
832 print_esc("displaywidth");
834 case display_indent_code:
835 print_esc("displayindent");
837 case overfull_rule_code:
838 print_esc("overfullrule");
840 case hang_indent_code:
841 print_esc("hangindent");
844 print_esc("hoffset");
847 print_esc("voffset");
849 case emergency_stretch_code:
850 print_esc("emergencystretch");
853 print_string("[unknown dimen parameter!]");
858 void print_cmd_chr_ (quarterword cmd, halfword chrcode)
863 print_string("begin-group character ");
867 print_string("end-group character ");
871 print_string("math shift character ");
875 print_string("macro parameter character ");
879 print_string("superscript character ");
883 print_string("subscript character ");
887 print_string("end of alignment template");
890 print_string("blank space ");
894 print_string("the letter ");
898 print_string("the character ");
903 if (chrcode < skip_base)
904 print_skip_param(chrcode - glue_base);
906 if (chrcode < mu_skip_base)
909 print_int(chrcode - skip_base);
914 print_int(chrcode - mu_skip_base);
918 if (chrcode >= toks_base)
921 print_int(chrcode - toks_base);
923 else switch (chrcode)
925 case output_routine_loc:
929 print_esc("everypar");
932 print_esc("everymath");
934 case every_display_loc:
935 print_esc("everydisplay");
938 print_esc("everyhbox");
941 print_esc("everyvbox");
944 print_esc("everyjob");
947 print_esc("everycr");
950 print_esc("errhelp");
955 if (chrcode < count_base)
956 print_param(chrcode - int_base);
960 print_int(chrcode - count_base);
964 if (chrcode < scaled_base)
965 print_length_param(chrcode - dimen_base);
969 print_int(chrcode - scaled_base);
976 print_esc("advance");
978 case after_assignment:
979 print_esc("afterassignment");
982 print_esc("aftergroup");
984 case assign_font_dimen:
985 print_esc("fontdimen");
988 print_esc("begingroup");
991 print_esc("penalty");
1003 print_esc("delimiter");
1006 print_esc("divide");
1009 print_esc("endcsname");
1012 print_esc("endgroup");
1018 print_esc("expandafter");
1021 print_esc("halign");
1027 print_esc("ignorespaces");
1030 print_esc("insert");
1039 print_esc("mathaccent");
1042 print_esc("mathchar");
1045 print_esc("mathchoice");
1048 print_esc("multiply");
1051 print_esc("noalign");
1054 print_esc("noboundary");
1057 print_esc("noexpand");
1060 print_esc("nonscript");
1066 print_esc("radical");
1075 print_esc("setbox");
1078 print_esc("prevgraf");
1081 print_esc("parshape");
1090 print_esc("vadjust");
1093 print_esc("valign");
1096 print_esc("vcenter");
1108 print_esc("endinput");
1113 case first_mark_code:
1114 print_esc("firstmark");
1117 print_esc("botmark");
1119 case split_first_mark_code:
1120 print_esc("splitfirstmark");
1122 case split_bot_mark_code:
1123 print_esc("splitbotmark");
1126 print_esc("topmark");
1131 if (chrcode == int_val)
1133 else if (chrcode == dimen_val)
1135 else if (chrcode == glue_val)
1138 print_esc("muskip");
1142 print_esc("prevdepth");
1144 print_esc("spacefactor");
1148 print_esc("deadcycles");
1150 print_esc("insertpenalties");
1153 if (chrcode == width_offset)
1155 else if (chrcode == height_offset)
1164 print_esc("lastpenalty");
1167 print_esc("lastkern");
1170 print_esc("lastskip");
1172 case input_line_no_code:
1173 print_esc("inputlineno");
1176 print_esc("badness");
1184 print_esc("number");
1186 case roman_numeral_code:
1187 print_esc("romannumeral");
1190 print_esc("string");
1193 print_esc("meaning");
1195 case font_name_code:
1196 print_esc("fontname");
1199 print_esc("jobname");
1219 print_esc("ifvmode");
1222 print_esc("ifhmode");
1225 print_esc("ifmmode");
1228 print_esc("ifinner");
1231 print_esc("ifvoid");
1234 print_esc("ifhbox");
1237 print_esc("ifvbox");
1246 print_esc("iftrue");
1249 print_esc("iffalse");
1252 print_esc("ifcase");
1260 if (chrcode == fi_code)
1262 else if (chrcode == or_code)
1268 if (chrcode == span_code) /* pool size */ /* max_quarterword + 1 ? */
1272 print_string("alignment tab character ");
1277 if (chrcode == cr_code)
1282 case set_page_dimen:
1286 print_esc("pagegoal");
1289 print_esc("pagetotal");
1292 print_esc("pagestretch");
1295 print_esc("pagefilstretch");
1298 print_esc("pagefillstretch");
1301 print_esc("pagefilllstretch");
1304 print_esc("pageshrink");
1307 print_esc("pagedepth");
1333 print_esc("hfilneg");
1353 print_esc("vfilneg");
1368 print_esc("moveleft");
1370 print_esc("moveright");
1388 print_esc("lastbox");
1391 print_esc("vsplit");
1396 case vtop_code + vmode:
1405 if (chrcode == a_leaders)
1406 print_esc("leaders");
1407 else if (chrcode == c_leaders)
1408 print_esc("cleaders");
1409 else if (chrcode == x_leaders)
1410 print_esc("xleaders");
1412 print_esc("shipout");
1416 print_esc("noindent");
1418 print_esc("indent");
1421 if (chrcode == glue_node)
1422 print_esc("unskip");
1423 else if (chrcode == kern_node)
1424 print_esc("unkern");
1426 print_esc("unpenalty");
1429 if (chrcode == copy_code)
1430 print_esc("unhcopy");
1432 print_esc("unhbox");
1435 if (chrcode == copy_code)
1436 print_esc("unvcopy");
1438 print_esc("unvbox");
1444 print_esc("discretionary");
1456 print_esc("mathord");
1459 print_esc("mathop");
1462 print_esc("mathbin");
1465 print_esc("mathrel");
1468 print_esc("mathopen");
1471 print_esc("mathclose");
1474 print_esc("mathpunct");
1477 print_esc("mathinner");
1480 print_esc("underline");
1483 print_esc("overline");
1488 if (chrcode == limits)
1489 print_esc("limits");
1490 else if (chrcode == no_limits)
1491 print_esc("nolimits");
1493 print_esc("displaylimits");
1496 print_style(chrcode);
1507 case delimited_code + above_code:
1508 print_esc("abovewithdelims");
1510 case delimited_code + over_code:
1511 print_esc("overwithdelims");
1513 case delimited_code + atop_code:
1514 print_esc("atopwithdelims");
1522 if (chrcode == left_noad)
1530 else if (chrcode == 2)
1533 print_esc("global");
1538 else if (chrcode == 1)
1540 else if (chrcode == 2)
1546 if (chrcode != normal)
1547 print_esc("futurelet");
1555 print_esc("chardef");
1557 case math_char_def_code:
1558 print_esc("mathchardef");
1560 case count_def_code:
1561 print_esc("countdef");
1563 case dimen_def_code:
1564 print_esc("dimendef");
1567 print_esc("skipdef");
1569 case mu_skip_def_code:
1570 print_esc("muskipdef");
1573 print_esc("toksdef");
1582 print_esc("mathchar");
1586 if (chrcode == cat_code_base)
1587 print_esc("catcode");
1588 else if (chrcode == math_code_base)
1589 print_esc("mathcode");
1590 else if (chrcode == lc_code_base)
1591 print_esc("lccode");
1592 else if (chrcode == uc_code_base)
1593 print_esc("uccode");
1594 else if (chrcode == sf_code_base)
1595 print_esc("sfcode");
1597 print_esc("delcode");
1600 print_size(chrcode - math_font_base);
1604 print_esc("patterns");
1606 print_esc("hyphenation");
1608 case assign_font_int:
1610 print_esc("hyphenchar");
1612 print_esc("skewchar");
1615 print_string("select font ");
1616 slow_print(font_name[chrcode]);
1617 if (font_size[chrcode] != font_dsize[chrcode])
1619 print_string(" at ");
1620 print_scaled(font_size[chrcode]);
1624 case set_interaction:
1628 print_esc("batchmode");
1631 print_esc("nonstopmode");
1634 print_esc("scrollmode");
1637 print_esc("errorstopmode");
1643 print_esc("closein");
1645 print_esc("openin");
1649 print_esc("message");
1651 print_esc("errmessage");
1654 if (chrcode == lc_code_base)
1655 print_esc("lowercase");
1657 print_esc("uppercase");
1663 print_esc("showbox");
1666 print_esc("showthe");
1669 print_esc("showlists");
1677 print_string("undefined");
1680 print_string("macro");
1683 print_esc("long macro");
1686 print_esc("outer macro");
1688 case long_outer_call:
1690 print_esc("outer macro");
1693 print_esc("outer endtemplate");
1699 print_esc("openout");
1705 print_esc("closeout");
1708 print_esc("special");
1710 case immediate_code:
1711 print_esc("immediate");
1713 case set_language_code:
1714 print_esc("setlanguage");
1717 print_string("[unknown extension!]");
1722 print_string("[unknown command code!]");
1728 void show_eqtb_(halfword n)
1730 if (n < active_base)
1737 print_cmd_chr(eq_type(n), equiv(n));
1738 if (eqtb[n].hh.b0 >= call)
1741 show_token_list(link(equiv(n)), 0, 32);
1748 print_skip_param(n - glue_base);
1750 if (n < glue_base + thin_mu_skip_code)
1751 print_spec(equiv(n), "pt");
1753 print_spec(equiv(n), "mu");
1756 if (n < mu_skip_base)
1759 print_int(n - skip_base);
1761 print_spec(equiv(n), "pt");
1765 print_esc("muskip");
1766 print_int(n - mu_skip_base);
1768 print_spec(equiv(n), "mu");
1772 if (n == par_shape_loc)
1774 print_esc("parshape");
1776 if (par_shape_ptr == 0)
1779 print_int(info(par_shape_ptr));
1784 print_cmd_chr(assign_toks, n);
1787 show_token_list(link(equiv(n)), 0, 32);
1793 print_int(n - toks_base);
1796 show_token_list(link(equiv(n)), 0, 32);
1799 if (n < cur_font_loc)
1802 print_int(n - box_base);
1805 print_string("void");
1808 depth_threshold = 0;
1810 show_node_list(equiv(n));
1814 if (n < cat_code_base)
1816 if (n == cur_font_loc)
1817 print_string("current font");
1819 if (n < math_font_base + 16)
1821 print_esc("textfont");
1822 print_int(n - math_font_base);
1825 if (n < math_font_base + 32)
1827 print_esc("scriptfont");
1828 print_int(n - math_font_base - 16);
1832 print_esc("scriptscriptfont");
1833 print_int(n - math_font_base - 32);
1837 print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH);
1840 if (n < math_code_base)
1842 if (n < lc_code_base)
1844 print_esc("catcode");
1845 print_int(n - cat_code_base);
1848 if (n < uc_code_base)
1850 print_esc("lccode");
1851 print_int(n - lc_code_base);
1854 if (n < sf_code_base)
1856 print_esc("uccode");
1857 print_int(n - uc_code_base);
1861 print_esc("sfcode");
1862 print_int(n - sf_code_base);
1865 print_int(equiv(n));
1869 print_esc("mathcode");
1870 print_int(n - math_code_base);
1872 print_int(equiv(n));
1878 print_param(n - int_base);
1880 if (n < del_code_base)
1883 print_int(n - count_base);
1887 print_esc("delcode");
1888 print_int(n - del_code_base);
1891 print_int(eqtb[n].cint);
1896 if (n < scaled_base)
1897 print_length_param(n - dimen_base);
1901 print_int(n - scaled_base);
1904 print_scaled(eqtb[n].cint);
1912 halfword id_lookup_(integer j, integer l)
1914 register halfword Result;
1921 for (k = j + 1; k <= j + l - 1; k++)
1923 h = h + h + buffer[k];
1924 while (h >= hash_prime)
1930 if (length(text(p)) == l)
1931 if (str_eq_buf(text(p), j))
1933 if (hash[p].v.LH == 0)
1935 if (no_new_control_sequence)
1936 p = undefined_control_sequence;
1944 /* we can't expand the hash table ... */
1945 /* overflow("hash size", hash_size); */ /* hash size - NOT DYNAMIC */
1946 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
1947 return 0; // abort_flag set
1950 } while (!(text(hash_used) == 0));
1952 if (hash_used > 65535L) /* debugging only 1996/Jan/20 */
1954 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
1955 show_line(log_line, 1);
1958 hash[p].v.LH = hash_used;
1962 if (checkpool(NULL))
1963 show_line("after hash_used\n", 0);
1966 #ifdef ALLOCATESTRING
1967 if (pool_ptr + l > current_pool_size)
1968 str_pool = realloc_str_pool(increment_pool_size + 1);
1969 if (pool_ptr + l > current_pool_size) /* in case it failed 97/Mar/7 */
1971 overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */
1972 return 0; // abort_flag set
1975 if (pool_ptr + l > pool_size)
1977 overflow("pool size", pool_size - init_pool_ptr); /* pool size - not dynamic */
1978 return; // abort_flag set
1983 while (pool_ptr > str_start[str_ptr]) {
1985 str_pool[pool_ptr + l] = str_pool[pool_ptr];
1988 if (checkpool(NULL)) show_line("after pool_ptr\n", 0);
1990 for (k = j; k <= j + l - 1; k++)
1991 append_char(buffer[k]);
1994 pool_pointer tempstring = make_string();
1995 if (tempstring > 65535L) /* cannot happen */
1997 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
1998 show_line(log_line, 1);
2000 text(p) = tempstring;
2003 text(p) = make_string();
2006 if (checkpool(NULL))
2007 show_line("after make_string\n", 0);
2009 pool_ptr = pool_ptr + d;
2014 str_pool[pool_ptr] = '\0';
2015 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
2016 show_line(log_line, 0); /* debugging */
2021 if (checkpool(NULL))
2022 show_line("after cs_count++\n", 0);
2029 if (checkpool(NULL))
2030 show_line("before return\n", 0);
2037 void new_save_level_(group_code c)
2039 if (save_ptr > max_save_stack)
2041 max_save_stack = save_ptr;
2042 #ifdef ALLOCATESAVESTACK
2043 if (max_save_stack > current_save_size - 6)
2044 save_stack = realloc_save_stack(increment_save_size);
2045 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2047 overflow("save size", current_save_size);
2048 return; // abort_flag set
2051 if (max_save_stack > save_size - 6) /* save size - not dynamic */
2053 overflow("save size", save_size);
2054 return; // abort_flag set
2058 /* save_type(save_ptr) <- level_boundary; */
2059 save_stack[save_ptr].hh.b0 = 3;
2060 /* save_stack[save_ptr].hh.b1 = cur_group; *//* keep compiler happy */
2061 save_stack[save_ptr].hh.b1 = (quarterword) cur_group;
2062 /* save_index(save_ptr):=cur_boundary; */
2063 save_stack[save_ptr].hh.v.RH = cur_boundary;
2064 /* if cur_level = max_quarterword then ... p.274 */
2065 /* if (cur_level == 255)*/ /* 94/Apr/4 */
2066 if (cur_level == max_quarterword)
2068 /* { quit if (cur_level + 1) is too large to store in eqtb } */
2069 /* overflow("grouping levels", max_quarterword - min_quarterword); */
2070 /* overflow("grouping levels", 255); */ /* grouping levels - not dynamic */
2071 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2072 return; // abort_flag set
2075 cur_boundary = save_ptr;
2081 void eq_destroy_(memory_word w)
2084 switch (eq_type_field(w))
2089 case long_outer_call:
2090 delete_token_ref(equiv_field(w));
2093 delete_glue_ref(equiv_field(w));
2098 free_node(q, info(q) + info(q) + 1);
2101 flush_node_list(equiv_field(w));
2108 void eq_save_(halfword p, quarterword l)
2110 if (save_ptr > max_save_stack)
2112 max_save_stack = save_ptr;
2113 #ifdef ALLOCATESAVESTACK
2114 if (max_save_stack > current_save_size - 6)
2115 save_stack = realloc_save_stack (increment_save_size);
2116 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2118 overflow("save size", current_save_size);
2119 return; // abort_flag set
2122 if (max_save_stack > save_size - 6) /* save size not dynamic */
2124 overflow("save size", save_size);
2125 return; // abort_flag set
2129 if (l == level_zero)
2130 save_type(save_ptr) = restore_zero;
2133 save_stack[save_ptr] = eqtb[p];
2135 save_type(save_ptr) = restore_old_value;
2137 save_level(save_ptr) = l;
2138 save_index(save_ptr) = p;
2142 void eq_define_(halfword p, quarterword t, halfword e)
2144 if (eq_level(p) == cur_level)
2145 eq_destroy(eqtb[p]);
2146 else if (cur_level > level_one)
2147 eq_save(p, eq_level(p));
2148 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2153 void eq_word_define_(halfword p, integer w)
2155 if (xeq_level[p] != cur_level)
2157 eq_save(p, xeq_level[p]);
2158 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2163 void geq_define_(halfword p, quarterword t, halfword e)
2165 eq_destroy(eqtb[p]);
2166 eq_level(p) = level_one;
2171 void geq_word_define_(halfword p, integer w)
2177 void save_for_after_(halfword t)
2181 if (save_ptr > max_save_stack)
2183 max_save_stack = save_ptr;
2184 #ifdef ALLOCATESAVESTACK
2185 if (max_save_stack > current_save_size - 6)
2186 save_stack = realloc_save_stack (increment_save_size);
2187 if (max_save_stack > current_save_size - 6) /* check again after allocation */
2189 overflow("save size", current_save_size);
2190 return; // abort_flag set
2193 if (max_save_stack > save_size - 6) /* save satck - not dynamic */
2195 overflow("save size", save_size);
2196 return; // abort_flag set
2200 save_type(save_ptr) = insert_token;
2201 save_level(save_ptr) = level_zero;
2202 save_index(save_ptr) = t;
2206 /* restore_trace_, unsave followed in the old tex1.c */