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);
110 delete_token_ref(mem[p + 1].hh.v.RH);
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));
165 flush_node_list(mem[p + 1].hh.v.LH);
166 flush_node_list(mem[p + 1].hh.v.RH);
167 flush_node_list(mem[p + 2].hh.v.LH);
168 flush_node_list(mem[p + 2].hh.v.RH);
187 if (mem[p + 1].hh.v.RH >= 2)
188 flush_node_list(mem[p + 1].hh.v.LH);
189 if (mem[p + 2].hh.v.RH >= 2)
190 flush_node_list(mem[p + 2].hh.v.LH);
191 if (mem[p + 3].hh.v.RH >= 2)
192 flush_node_list(mem[p + 3].hh.v.LH);
193 if (mem[p].hh.b0 == 24)
195 else if (mem[p].hh.b0 == 28)
211 flush_node_list(mem[p + 2].hh.v.LH);
212 flush_node_list(mem[p + 3].hh.v.LH);
219 confusion("flushing");
220 return; // abort_flag set
231 halfword copy_node_list_(halfword p)
233 register halfword Result;
241 while (p != 0) { /* while p<>null do l.3969 */
243 if ((p >= hi_mem_min))
245 else switch (mem[p].hh.b0)
251 r = get_node(box_node_size);
252 mem[r + 6]= mem[p + 6];
253 mem[r + 5]= mem[p + 5];
254 mem[r + 5].hh.v.RH = copy_node_list(mem[p + 5].hh.v.RH);
267 mem[r + 4]= mem[p + 4];
268 incr(mem[mem[p + 4].hh.v.RH].hh.v.RH);
269 mem[r + 4].hh.v.LH = copy_node_list(mem[p + 4].hh.v.LH);
274 switch (mem[p].hh.b1)
286 incr(mem[mem[p + 1].hh.v.RH].hh.v.LH);
300 return 0; // abort_flag set
308 incr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
309 mem[r + 1].hh.v.LH = mem[p + 1].hh.v.LH;
310 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
324 mem[r + 1]= mem[p + 1];
325 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
331 mem[r + 1].hh.v.LH = copy_node_list(mem[p + 1].hh.v.LH);
332 mem[r + 1].hh.v.RH = copy_node_list(mem[p + 1].hh.v.RH);
338 incr(mem[mem[p + 1].cint].hh.v.LH);
345 mem[r + 1].cint = copy_node_list(mem[p + 1].cint);
350 confusion("copying");
351 return 0; // abort_flag set
357 mem[r + words]= mem[p + words]; /* r may be used without having ... */
366 mem[h].hh.v.RH = avail;
377 void print_mode_(integer m)
383 print_string("vertical");
386 print_string("horizontal");
389 print_string("display math");
396 switch ((- (integer) m)/(101))
399 print_string("internal vertical");
402 print_string("restricted horizontal");
405 print_string("math");
408 print_string(" mode");
411 void push_nest (void)
413 if (nest_ptr > max_nest_stack)
415 max_nest_stack = nest_ptr;
416 #ifdef ALLOCATEINPUTSTACK
417 if (nest_ptr == current_nest_size)
418 nest = realloc_nest_stack(increment_nest_size);
419 if (nest_ptr == current_nest_size) { /* check again after allocation */
420 overflow("semantic nest size", current_nest_size);
421 return; // abort_flag set
424 if (nest_ptr == nest_size) {
425 overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */
426 return; // abort_flag set
430 nest[nest_ptr]= cur_list;
442 cur_list = nest[nest_ptr];
445 void show_activities (void)
452 nest[nest_ptr]= cur_list;
456 register integer for_end;
461 m = nest[p].mode_field;
462 a = nest[p].aux_field;
465 print_string(" entered at line ");
466 print_int(abs(nest[p].ml_field));
468 /* ************************************************************************ */
469 /* major change from 3.141 -> 3.14159 in following */
470 /*.pg_field instead of .lhmfield and .rhmfield */
471 /* WAS if ((nest[p].lhmfield != 2)||(nest[p].rhmfield != 3)) */
472 if (nest[p].pg_field != 8585216L) /* 830000 hex ??? */
474 print_string(" (language");
475 print_int(nest[p].pg_field % 65536L); /* last 16 bits */
476 /* print_int(nest[p].pg_field & 65535L); */
477 print_string(":hyphenmin");
478 print_int(nest[p].pg_field / 4194304L); /* 400000 hex ??? */
479 /* print_int(nest[p].pg_field >> 22); */ /* top 10 bits */
481 print_int((nest[p].pg_field / 65536L)% 64);
482 /* print_int((nest[p].pg_field >> 16)& 63); */ /* next 8 bits */
483 /* this used to refer to .lhmfield and .rhmfield ... */
484 /* ********************************************************************* */
487 if (nest[p].ml_field < 0)
488 print_string(" (\\output routine)");
491 if (page_head != page_tail)
493 print_nl("### current page:");
495 print_string(" (held over for next output)");
496 show_box(mem[page_head].hh.v.RH);
497 if (page_contents > 0)
499 print_nl("total height ");
501 print_nl("goal height ");
502 print_scaled(page_so_far[0]);
503 r = mem[mem_top].hh.v.RH;
504 while (r != mem_top) {
509 print_string(" adds ");
510 /* 427. Tell more precisely the effective size of 1:1 insertions (DEK, 27 Feb 08) */
511 if (eqtb[(hash_size + 3218) + t].cint == 1000)
514 t = x_over_n(mem[r + 3].cint, 1000) * eqtb[(hash_size + 3218) + t].cint;
516 if (mem[r].hh.b0 == 1)
522 if ((mem[q].hh.b0 == 3) && (mem[q].hh.b1 == mem[r].hh.b1))
524 } while (!(q == mem[r + 1].hh.v.LH));
527 print_string(" might split");
533 /* if link(contrib_head)<>null then l.4393 */
534 if (mem[contrib_head].hh.v.RH != 0)
535 print_nl(" (\\output routine)");
537 show_box(mem[nest[p].head_field].hh.v.RH);
538 switch (abs(m)/(101))
542 print_nl("### recent contributions:");
543 if (a.cint <= ignore_depth)
544 print_string("ignored");
546 print_scaled(a.cint);
547 if (nest[p].pg_field != 0)
549 print_string(", prevgraf ");
550 print_int(nest[p].pg_field);
551 print_string(" line");
552 if (nest[p].pg_field != 1)
559 print_nl("spacefactor ");
560 print_int(a.hh.v.LH);
564 print_string(", current language ");
565 print_int(a.hh.v.RH);
572 print_string("this will be denominator of:");
577 } while(p-- > for_end); }
580 void print_param_(integer n)
584 case pretolerance_code:
585 print_esc("pretolerance");
588 print_esc("tolerance");
590 case line_penalty_code:
591 print_esc("linepenalty");
593 case hyphen_penalty_code:
594 print_esc("hyphenpenalty");
596 case ex_hyphen_penalty_code:
597 print_esc("exhyphenpenalty");
599 case club_penalty_code:
600 print_esc("clubpenalty");
602 case widow_penalty_code:
603 print_esc("widowpenalty");
605 case display_widow_penalty_code:
606 print_esc("displaywidowpenalty");
608 case broken_penalty_code:
609 print_esc("brokenpenalty");
611 case bin_op_penalty_code:
612 print_esc("binoppenalty");
614 case rel_penalty_code:
615 print_esc("relpenalty");
617 case pre_display_penalty_code:
618 print_esc("predisplaypenalty");
620 case post_display_penalty_code:
621 print_esc("postdisplaypenalty");
623 case inter_line_penalty_code:
624 print_esc("interlinepenalty");
626 case double_hyphen_demerits_code:
627 print_esc("doublehyphendemerits");
629 case final_hyphen_demerits_code:
630 print_esc("finalhyphendemerits");
632 case adj_demerits_code:
633 print_esc("adjdemerits");
638 case delimiter_factor_code:
639 print_esc("delimiterfactor");
642 print_esc("looseness");
656 case show_box_breadth_code:
657 print_esc("showboxbreadth");
659 case show_box_depth_code:
660 print_esc("showboxdepth");
663 print_esc("hbadness");
666 print_esc("vbadness");
669 print_esc("pausing");
671 case tracing_online_code:
672 print_esc("tracingonline");
674 case tracing_macros_code:
675 print_esc("tracingmacros");
677 case tracing_stats_code:
678 print_esc("tracingstats");
680 case tracing_paragraphs_code:
681 print_esc("tracingparagraphs");
683 case tracing_pages_code:
684 print_esc("tracingpages");
686 case tracing_output_code:
687 print_esc("tracingoutput");
689 case tracing_lost_chars_code:
690 print_esc("tracinglostchars");
692 case tracing_commands_code:
693 print_esc("tracingcommands");
695 case tracing_restores_code:
696 print_esc("tracingrestores");
701 case output_penalty_code:
702 print_esc("outputpenalty");
704 case max_dead_cycles_code:
705 print_esc("maxdeadcycles");
707 case hang_after_code:
708 print_esc("hangafter");
710 case floating_penalty_code:
711 print_esc("floatingpenalty");
713 case global_defs_code:
714 print_esc("globaldefs");
719 case escape_char_code:
720 print_esc("escapechar");
722 case default_hyphen_char_code:
723 print_esc("defaulthyphenchar");
725 case default_skew_char_code:
726 print_esc("defaultskewchar");
728 case end_line_char_code:
729 print_esc("endlinechar");
731 case new_line_char_code:
732 print_esc("newlinechar");
735 print_esc("language");
737 case left_hyphen_min_code:
738 print_esc("lefthyphenmin");
740 case right_hyphen_min_code:
741 print_esc("righthyphenmin");
743 case holding_inserts_code:
744 print_esc("holdinginserts");
746 case error_context_lines_code:
747 print_esc("errorcontextlines");
750 print_string("[unknown integer parameter!]");
755 void begin_diagnostic (void)
757 old_setting = selector;
758 if ((tracing_online <= 0) && (selector == term_and_log))
761 if (history == spotless)
762 history = warning_issued;
766 void end_diagnostic_(bool blankline)
771 selector = old_setting;
774 void print_length_param_ (integer n)
778 case par_indent_code:
779 print_esc("parindent");
781 case math_surround_code:
782 print_esc("mathsurround");
784 case line_skip_limit_code:
785 print_esc("lineskiplimit");
794 print_esc("maxdepth");
796 case split_max_depth_code:
797 print_esc("splitmaxdepth");
799 case box_max_depth_code:
800 print_esc("boxmaxdepth");
808 case delimiter_shortfall_code:
809 print_esc("delimitershortfall");
811 case null_delimiter_space_code:
812 print_esc("nulldelimiterspace");
814 case script_space_code:
815 print_esc("scriptspace");
817 case pre_display_size_code:
818 print_esc("predisplaysize");
820 case display_width_code:
821 print_esc("displaywidth");
823 case display_indent_code:
824 print_esc("displayindent");
826 case overfull_rule_code:
827 print_esc("overfullrule");
829 case hang_indent_code:
830 print_esc("hangindent");
833 print_esc("hoffset");
836 print_esc("voffset");
838 case emergency_stretch_code:
839 print_esc("emergencystretch");
842 print_string("[unknown dimen parameter!]");
847 void print_cmd_chr_ (quarterword cmd, halfword chrcode)
852 print_string("begin-group character ");
856 print_string("end-group character ");
860 print_string("math shift character ");
864 print_string("macro parameter character ");
868 print_string("superscript character ");
872 print_string("subscript character ");
876 print_string("end of alignment template");
879 print_string("blank space ");
883 print_string("the letter ");
887 print_string("the character ");
892 if (chrcode < skip_base)
893 print_skip_param(chrcode - glue_base);
894 else if (chrcode < mu_skip_base)
897 print_int(chrcode - skip_base);
902 print_int(chrcode - mu_skip_base);
906 if (chrcode >= toks_base)
909 print_int(chrcode - toks_base);
911 else switch (chrcode)
913 case output_routine_loc:
917 print_esc("everypar");
920 print_esc("everymath");
922 case every_display_loc:
923 print_esc("everydisplay");
926 print_esc("everyhbox");
929 print_esc("everyvbox");
932 print_esc("everyjob");
935 print_esc("everycr");
938 print_esc("errhelp");
943 if (chrcode < count_base)
944 print_param(chrcode - int_base);
947 print_int(chrcode - count_base);
951 if (chrcode < scaled_base)
952 print_length_param(chrcode - dimen_base);
955 print_int(chrcode - scaled_base);
962 print_esc("advance");
965 print_esc("afterassignment");
968 print_esc("aftergroup");
971 print_esc("fontdimen");
974 print_esc("begingroup");
977 print_esc("penalty");
989 print_esc("delimiter");
995 print_esc("endcsname");
998 print_esc("endgroup");
1004 print_esc("expandafter");
1007 print_esc("halign");
1013 print_esc("ignorespaces");
1016 print_esc("insert");
1025 print_esc("mathaccent");
1028 print_esc("mathchar");
1031 print_esc("mathchoice");
1034 print_esc("multiply");
1037 print_esc("noalign");
1040 print_esc("noboundary");
1043 print_esc("noexpand");
1046 print_esc("nonscript");
1052 print_esc("radical");
1061 print_esc("setbox");
1064 print_esc("prevgraf");
1067 print_esc("parshape");
1076 print_esc("vadjust");
1079 print_esc("valign");
1082 print_esc("vcenter");
1094 print_esc("endinput");
1100 print_esc("firstmark");
1103 print_esc("botmark");
1106 print_esc("splitfirstmark");
1109 print_esc("splitbotmark");
1112 print_esc("topmark");
1119 else if (chrcode == 1)
1121 else if (chrcode == 2)
1124 print_esc("muskip");
1128 print_esc("prevdepth");
1130 print_esc("spacefactor");
1134 print_esc("deadcycles");
1136 print_esc("insertpenalties");
1141 else if (chrcode == 3)
1150 print_esc("lastpenalty");
1153 print_esc("lastkern");
1156 print_esc("lastskip");
1159 print_esc("inputlineno");
1162 print_esc("badness");
1170 print_esc("number");
1173 print_esc("romannumeral");
1176 print_esc("string");
1179 print_esc("meaning");
1182 print_esc("fontname");
1185 print_esc("jobname");
1205 print_esc("ifvmode");
1208 print_esc("ifhmode");
1211 print_esc("ifmmode");
1214 print_esc("ifinner");
1217 print_esc("ifvoid");
1220 print_esc("ifhbox");
1223 print_esc("ifvbox");
1232 print_esc("iftrue");
1235 print_esc("iffalse");
1238 print_esc("ifcase");
1248 else if (chrcode == 4)
1250 else print_esc("else");
1253 if (chrcode == 256) /* pool size */ /* max_quarterword + 1 ? */
1256 print_string("alignment tab character ");
1261 if (chrcode == 257) /* cr_code */
1263 else print_esc("crcr");
1269 print_esc("pagegoal");
1272 print_esc("pagetotal");
1275 print_esc("pagestretch");
1278 print_esc("pagefilstretch");
1281 print_esc("pagefillstretch");
1284 print_esc("pagefilllstretch");
1287 print_esc("pageshrink");
1290 print_esc("pagedepth");
1297 else print_esc("end");
1315 print_esc("hfilneg");
1335 print_esc("vfilneg");
1350 print_esc("moveleft");
1351 else print_esc("moveright");
1356 else print_esc("lower");
1368 print_esc("lastbox");
1371 print_esc("vsplit");
1386 print_esc("leaders");
1387 else if (chrcode == 101)
1388 print_esc("cleaders");
1389 else if (chrcode == 102)
1390 print_esc("xleaders");
1391 else print_esc("shipout");
1395 print_esc("noindent");
1396 else print_esc("indent");
1400 print_esc("unskip");
1401 else if (chrcode == 11)
1402 print_esc("unkern");
1403 else print_esc("unpenalty");
1407 print_esc("unhcopy");
1408 else print_esc("unhbox");
1412 print_esc("unvcopy");
1413 else print_esc("unvbox");
1419 print_esc("discretionary");
1424 else print_esc("eqno");
1430 print_esc("mathord");
1433 print_esc("mathop");
1436 print_esc("mathbin");
1439 print_esc("mathrel");
1442 print_esc("mathopen");
1445 print_esc("mathclose");
1448 print_esc("mathpunct");
1451 print_esc("mathinner");
1454 print_esc("underline");
1457 print_esc("overline");
1463 print_esc("limits");
1464 else if (chrcode == 2)
1465 print_esc("nolimits");
1466 else print_esc("displaylimits");
1469 print_style(chrcode);
1481 print_esc("abovewithdelims");
1484 print_esc("overwithdelims");
1487 print_esc("atopwithdelims");
1497 else print_esc("right");
1502 else if (chrcode == 2)
1504 else print_esc("global");
1509 else if (chrcode == 1)
1511 else if (chrcode == 2)
1513 else print_esc("xdef");
1517 print_esc("futurelet");
1518 else print_esc("let");
1524 print_esc("chardef");
1527 print_esc("mathchardef");
1530 print_esc("countdef");
1533 print_esc("dimendef");
1536 print_esc("skipdef");
1539 print_esc("muskipdef");
1542 print_esc("toksdef");
1551 print_esc("mathchar");
1555 if (chrcode == cat_code_base)
1556 print_esc("catcode");
1557 else if (chrcode == math_code_base)
1558 print_esc("mathcode");
1559 else if (chrcode == lc_code_base)
1560 print_esc("lccode");
1561 else if (chrcode == uc_code_base)
1562 print_esc("uccode");
1563 else if (chrcode == sf_code_base)
1564 print_esc("sfcode");
1565 else print_esc("delcode");
1568 print_size(chrcode - math_font_base);
1572 print_esc("patterns");
1573 else print_esc("hyphenation");
1577 print_esc("hyphenchar");
1578 else print_esc("skewchar");
1581 print_string("select font ");
1582 slow_print(font_name[chrcode]);
1583 if (font_size[chrcode] != font_dsize[chrcode])
1585 print_string(" at ");
1586 print_scaled(font_size[chrcode]);
1594 print_esc("batchmode");
1597 print_esc("nonstopmode");
1600 print_esc("scrollmode");
1603 print_esc("errorstopmode");
1609 print_esc("closein");
1610 else print_esc("openin");
1614 print_esc("message");
1615 else print_esc("errmessage");
1618 if (chrcode == lc_code_base)
1619 print_esc("lowercase");
1620 else print_esc("uppercase");
1626 print_esc("showbox");
1629 print_esc("showthe");
1632 print_esc("showlists");
1640 print_string("undefined");
1643 print_string("macro");
1646 print_esc("long macro");
1649 print_esc("outer macro");
1653 print_esc("outer macro");
1656 print_esc("outer endtemplate");
1662 print_esc("openout");
1668 print_esc("closeout");
1671 print_esc("special");
1674 print_esc("immediate");
1677 print_esc("setlanguage");
1680 print_string("[unknown extension!]");
1685 print_string("[unknown command code!]");
1691 void show_eqtb_(halfword n)
1693 if (n < active_base)
1695 else if (n < glue_base)
1699 print_cmd_chr(eq_type(n), equiv(n));
1700 if (eqtb[n].hh.b0 >= call)
1703 show_token_list(link(equiv(n)), 0, 32);
1706 else if (n < local_base)
1709 print_skip_param(n - glue_base);
1711 if (n < glue_base + thin_mu_skip_code)
1712 print_spec(equiv(n), "pt");
1714 print_spec(equiv(n), "mu");
1716 else if (n < mu_skip_base)
1719 print_int(n - skip_base);
1721 print_spec(equiv(n), "pt");
1725 print_esc("muskip");
1726 print_int(n - mu_skip_base);
1728 print_spec(equiv(n), "mu");
1730 else if (n < int_base)
1731 if (n == par_shape_loc)
1733 print_esc("parshape");
1735 if (par_shape_ptr == 0)
1738 print_int(info(par_shape_ptr));
1740 else if (n < toks_base)
1742 print_cmd_chr(assign_toks, n);
1745 show_token_list(link(equiv(n)), 0, 32);
1747 else if (n < box_base)
1750 print_int(n - toks_base);
1753 show_token_list(link(equiv(n)), 0, 32);
1755 else if (n < cur_font_loc)
1758 print_int(n - box_base);
1761 print_string("void");
1764 depth_threshold = 0;
1766 show_node_list(equiv(n));
1769 else if (n < cat_code_base)
1771 if (n == cur_font_loc)
1772 print_string("current font");
1773 else if (n < math_font_base + 16)
1775 print_esc("textfont");
1776 print_int(n - math_font_base);
1778 else if (n < math_font_base + 32)
1780 print_esc("scriptfont");
1781 print_int(n - math_font_base - 16);
1785 print_esc("scriptscriptfont");
1786 print_int(n - math_font_base - 32);
1789 print_esc(""); print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH);
1791 else if (n < math_code_base)
1793 if (n < lc_code_base)
1795 print_esc("catcode");
1796 print_int(n - cat_code_base);
1798 else if (n < uc_code_base)
1800 print_esc("lccode");
1801 print_int(n - lc_code_base);
1803 else if (n < sf_code_base)
1805 print_esc("uccode");
1806 print_int(n - uc_code_base);
1810 print_esc("sfcode");
1811 print_int(n - sf_code_base);
1814 print_int(equiv(n));
1818 print_esc("mathcode");
1819 print_int(n - math_code_base);
1821 print_int(equiv(n));
1823 else if (n < dimen_base)
1826 print_param(n - int_base);
1827 else if (n < del_code_base)
1830 print_int(n - count_base);
1834 print_esc("delcode");
1835 print_int(n - del_code_base);
1838 print_int(eqtb[n].cint);
1840 else if (n <= eqtb_size)
1842 if (n < scaled_base)
1843 print_length_param(n - dimen_base);
1847 print_int(n - scaled_base);
1850 print_scaled(eqtb[n].cint);
1853 else print_char('?');
1857 halfword id_lookup_(integer j, integer l)
1859 register halfword Result;
1866 for (k = j + 1; k <= j + l - 1; k++)
1868 h = h + h + buffer[k];
1869 while (h >= hash_prime)
1875 if (length(text(p)) == l)
1876 if (str_eq_buf(text(p), j))
1878 if (hash[p].v.LH == 0) {
1879 if (no_new_control_sequence)
1880 p = undefined_control_sequence;
1888 /* we can't expand the hash table ... */
1889 /* overflow("hash size", hash_size); */ /* hash size - NOT DYNAMIC */
1890 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
1891 return 0; // abort_flag set
1894 } while (!(text(hash_used) == 0));
1896 if (hash_used > 65535L)
1897 { /* debugging only 1996/Jan/20 */
1898 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
1899 show_line(log_line, 1);
1902 hash[p].v.LH = hash_used;
1906 if (checkpool(NULL)) show_line("after hash_used\n", 0);
1909 #ifdef ALLOCATESTRING
1910 if (pool_ptr + l > current_pool_size)
1911 str_pool = realloc_str_pool(increment_pool_size + 1);
1912 if (pool_ptr + l > current_pool_size)
1913 { /* in case it failed 97/Mar/7 */
1914 overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */
1915 return 0; // abort_flag set
1918 if (pool_ptr + l > pool_size)
1920 overflow("pool size", pool_size - init_pool_ptr); /* pool size - not dynamic */
1921 return; // abort_flag set
1926 while (pool_ptr > str_start[str_ptr]) {
1928 str_pool[pool_ptr + l] = str_pool[pool_ptr];
1931 if (checkpool(NULL)) show_line("after pool_ptr\n", 0);
1933 for (k = j; k <= j + l - 1; k++) append_char(buffer[k]);
1936 pool_pointer tempstring = make_string();
1937 if (tempstring > 65535L)
1938 { /* cannot happen */
1939 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
1940 show_line(log_line, 1);
1942 text(p) = tempstring;
1945 text(p) = make_string();
1948 if (checkpool(NULL))
1949 show_line("after make_string\n", 0);
1951 pool_ptr = pool_ptr + d;
1956 str_pool[pool_ptr] = '\0';
1957 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
1958 show_line(log_line, 0); /* debugging */
1963 if (checkpool(NULL))
1964 show_line("after cs_count++\n", 0);
1971 if (checkpool(NULL)) show_line("before return\n", 0);
1978 void new_save_level_(group_code c)
1980 if (save_ptr > max_save_stack)
1982 max_save_stack = save_ptr;
1983 #ifdef ALLOCATESAVESTACK
1984 if (max_save_stack > current_save_size - 6)
1985 save_stack = realloc_save_stack(increment_save_size);
1986 if (max_save_stack > current_save_size - 6)
1987 { /* check again after allocation */
1988 overflow("save size", current_save_size);
1989 return; // abort_flag set
1992 if (max_save_stack > save_size - 6)
1993 { /* save size - not dynamic */
1994 overflow("save size", save_size);
1995 return; // abort_flag set
1999 /* save_type(save_ptr) <- level_boundary; */
2000 save_stack[save_ptr].hh.b0 = 3;
2001 /* save_stack[save_ptr].hh.b1 = cur_group; *//* keep compiler happy */
2002 save_stack[save_ptr].hh.b1 = (quarterword) cur_group;
2003 /* save_index(save_ptr):=cur_boundary; */
2004 save_stack[save_ptr].hh.v.RH = cur_boundary;
2005 /* if cur_level = max_quarterword then ... p.274 */
2006 /* if (cur_level == 255)*/ /* 94/Apr/4 */
2007 if (cur_level == max_quarterword)
2009 /* { quit if (cur_level + 1) is too large to store in eqtb } */
2010 /* overflow("grouping levels", max_quarterword - min_quarterword); */
2011 /* overflow("grouping levels", 255); */ /* grouping levels - not dynamic */
2012 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2013 return; // abort_flag set
2015 /* cur_boundary <- save_ptr */
2016 cur_boundary = save_ptr;
2022 void eq_destroy_(memory_word w)
2025 switch (eq_type_field(w))
2030 case long_outer_call:
2031 delete_token_ref(equiv_field(w));
2034 delete_glue_ref(equiv_field(w));
2039 free_node(q, info(q) + info(q) + 1);
2042 flush_node_list(equiv_field(w));
2049 void eq_save_(halfword p, quarterword l)
2051 if (save_ptr > max_save_stack)
2053 max_save_stack = save_ptr;
2054 #ifdef ALLOCATESAVESTACK
2055 if (max_save_stack > current_save_size - 6)
2056 save_stack = realloc_save_stack (increment_save_size);
2057 if (max_save_stack > current_save_size - 6)
2058 { /* check again after allocation */
2059 overflow("save size", current_save_size);
2060 return; // abort_flag set
2063 if (max_save_stack > save_size - 6)
2064 { /* save size not dynamic */
2065 overflow("save size", save_size);
2066 return; // abort_flag set
2070 if (l == level_zero)
2071 save_type(save_ptr) = restore_zero;
2074 save_stack[save_ptr] = eqtb[p];
2076 save_type(save_ptr) = restore_old_value;
2078 save_level(save_ptr) = l;
2079 save_index(save_ptr) = p;
2083 void eq_define_(halfword p, quarterword t, halfword e)
2085 if (eq_level(p) == cur_level)
2086 eq_destroy(eqtb[p]);
2087 else if (cur_level > level_one)
2088 eq_save(p, eq_level(p));
2089 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2094 void eq_word_define_(halfword p, integer w)
2096 if (xeq_level[p] != cur_level)
2098 eq_save(p, xeq_level[p]);
2099 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2104 void geq_define_(halfword p, quarterword t, halfword e)
2106 eq_destroy(eqtb[p]);
2107 eq_level(p) = level_one;
2112 void geq_word_define_(halfword p, integer w)
2118 void save_for_after_(halfword t)
2122 if (save_ptr > max_save_stack)
2124 max_save_stack = save_ptr;
2125 #ifdef ALLOCATESAVESTACK
2126 if (max_save_stack > current_save_size - 6)
2127 save_stack = realloc_save_stack (increment_save_size);
2128 if (max_save_stack > current_save_size - 6)
2129 { /* check again after allocation */
2130 overflow("save size", current_save_size);
2131 return; // abort_flag set
2134 if (max_save_stack > save_size - 6)
2135 { /* save satck - not dynamic */
2136 overflow("save size", save_size);
2137 return; // abort_flag set
2141 save_type(save_ptr) = insert_token;
2142 save_level(save_ptr) = level_zero;
2143 save_index(save_ptr) = t;
2147 /* restore_trace_, unsave followed in the old tex1.c */