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);
581 void print_param_(integer n)
585 case pretolerance_code:
586 print_esc("pretolerance");
589 print_esc("tolerance");
591 case line_penalty_code:
592 print_esc("linepenalty");
594 case hyphen_penalty_code:
595 print_esc("hyphenpenalty");
597 case ex_hyphen_penalty_code:
598 print_esc("exhyphenpenalty");
600 case club_penalty_code:
601 print_esc("clubpenalty");
603 case widow_penalty_code:
604 print_esc("widowpenalty");
606 case display_widow_penalty_code:
607 print_esc("displaywidowpenalty");
609 case broken_penalty_code:
610 print_esc("brokenpenalty");
612 case bin_op_penalty_code:
613 print_esc("binoppenalty");
615 case rel_penalty_code:
616 print_esc("relpenalty");
618 case pre_display_penalty_code:
619 print_esc("predisplaypenalty");
621 case post_display_penalty_code:
622 print_esc("postdisplaypenalty");
624 case inter_line_penalty_code:
625 print_esc("interlinepenalty");
627 case double_hyphen_demerits_code:
628 print_esc("doublehyphendemerits");
630 case final_hyphen_demerits_code:
631 print_esc("finalhyphendemerits");
633 case adj_demerits_code:
634 print_esc("adjdemerits");
639 case delimiter_factor_code:
640 print_esc("delimiterfactor");
643 print_esc("looseness");
657 case show_box_breadth_code:
658 print_esc("showboxbreadth");
660 case show_box_depth_code:
661 print_esc("showboxdepth");
664 print_esc("hbadness");
667 print_esc("vbadness");
670 print_esc("pausing");
672 case tracing_online_code:
673 print_esc("tracingonline");
675 case tracing_macros_code:
676 print_esc("tracingmacros");
678 case tracing_stats_code:
679 print_esc("tracingstats");
681 case tracing_paragraphs_code:
682 print_esc("tracingparagraphs");
684 case tracing_pages_code:
685 print_esc("tracingpages");
687 case tracing_output_code:
688 print_esc("tracingoutput");
690 case tracing_lost_chars_code:
691 print_esc("tracinglostchars");
693 case tracing_commands_code:
694 print_esc("tracingcommands");
696 case tracing_restores_code:
697 print_esc("tracingrestores");
702 case output_penalty_code:
703 print_esc("outputpenalty");
705 case max_dead_cycles_code:
706 print_esc("maxdeadcycles");
708 case hang_after_code:
709 print_esc("hangafter");
711 case floating_penalty_code:
712 print_esc("floatingpenalty");
714 case global_defs_code:
715 print_esc("globaldefs");
720 case escape_char_code:
721 print_esc("escapechar");
723 case default_hyphen_char_code:
724 print_esc("defaulthyphenchar");
726 case default_skew_char_code:
727 print_esc("defaultskewchar");
729 case end_line_char_code:
730 print_esc("endlinechar");
732 case new_line_char_code:
733 print_esc("newlinechar");
736 print_esc("language");
738 case left_hyphen_min_code:
739 print_esc("lefthyphenmin");
741 case right_hyphen_min_code:
742 print_esc("righthyphenmin");
744 case holding_inserts_code:
745 print_esc("holdinginserts");
747 case error_context_lines_code:
748 print_esc("errorcontextlines");
751 print_string("[unknown integer parameter!]");
756 void begin_diagnostic (void)
758 old_setting = selector;
759 if ((tracing_online <= 0) && (selector == term_and_log))
762 if (history == spotless)
763 history = warning_issued;
767 void end_diagnostic_(bool blankline)
772 selector = old_setting;
775 void print_length_param_ (integer n)
779 case par_indent_code:
780 print_esc("parindent");
782 case math_surround_code:
783 print_esc("mathsurround");
785 case line_skip_limit_code:
786 print_esc("lineskiplimit");
795 print_esc("maxdepth");
797 case split_max_depth_code:
798 print_esc("splitmaxdepth");
800 case box_max_depth_code:
801 print_esc("boxmaxdepth");
809 case delimiter_shortfall_code:
810 print_esc("delimitershortfall");
812 case null_delimiter_space_code:
813 print_esc("nulldelimiterspace");
815 case script_space_code:
816 print_esc("scriptspace");
818 case pre_display_size_code:
819 print_esc("predisplaysize");
821 case display_width_code:
822 print_esc("displaywidth");
824 case display_indent_code:
825 print_esc("displayindent");
827 case overfull_rule_code:
828 print_esc("overfullrule");
830 case hang_indent_code:
831 print_esc("hangindent");
834 print_esc("hoffset");
837 print_esc("voffset");
839 case emergency_stretch_code:
840 print_esc("emergencystretch");
843 print_string("[unknown dimen parameter!]");
848 void print_cmd_chr_ (quarterword cmd, halfword chrcode)
853 print_string("begin-group character ");
857 print_string("end-group character ");
861 print_string("math shift character ");
865 print_string("macro parameter character ");
869 print_string("superscript character ");
873 print_string("subscript character ");
877 print_string("end of alignment template");
880 print_string("blank space ");
884 print_string("the letter ");
888 print_string("the character ");
893 if (chrcode < skip_base)
894 print_skip_param(chrcode - glue_base);
896 if (chrcode < mu_skip_base)
899 print_int(chrcode - skip_base);
904 print_int(chrcode - mu_skip_base);
908 if (chrcode >= toks_base)
911 print_int(chrcode - toks_base);
913 else switch (chrcode)
915 case output_routine_loc:
919 print_esc("everypar");
922 print_esc("everymath");
924 case every_display_loc:
925 print_esc("everydisplay");
928 print_esc("everyhbox");
931 print_esc("everyvbox");
934 print_esc("everyjob");
937 print_esc("everycr");
940 print_esc("errhelp");
945 if (chrcode < count_base)
946 print_param(chrcode - int_base);
950 print_int(chrcode - count_base);
954 if (chrcode < scaled_base)
955 print_length_param(chrcode - dimen_base);
959 print_int(chrcode - scaled_base);
966 print_esc("advance");
968 case after_assignment:
969 print_esc("afterassignment");
972 print_esc("aftergroup");
974 case assign_font_dimen:
975 print_esc("fontdimen");
978 print_esc("begingroup");
981 print_esc("penalty");
993 print_esc("delimiter");
999 print_esc("endcsname");
1002 print_esc("endgroup");
1008 print_esc("expandafter");
1011 print_esc("halign");
1017 print_esc("ignorespaces");
1020 print_esc("insert");
1029 print_esc("mathaccent");
1032 print_esc("mathchar");
1035 print_esc("mathchoice");
1038 print_esc("multiply");
1041 print_esc("noalign");
1044 print_esc("noboundary");
1047 print_esc("noexpand");
1050 print_esc("nonscript");
1056 print_esc("radical");
1065 print_esc("setbox");
1068 print_esc("prevgraf");
1071 print_esc("parshape");
1080 print_esc("vadjust");
1083 print_esc("valign");
1086 print_esc("vcenter");
1098 print_esc("endinput");
1103 case first_mark_code:
1104 print_esc("firstmark");
1107 print_esc("botmark");
1109 case split_first_mark_code:
1110 print_esc("splitfirstmark");
1112 case split_bot_mark_code:
1113 print_esc("splitbotmark");
1116 print_esc("topmark");
1121 if (chrcode == int_val)
1123 else if (chrcode == dimen_val)
1125 else if (chrcode == glue_val)
1128 print_esc("muskip");
1132 print_esc("prevdepth");
1134 print_esc("spacefactor");
1138 print_esc("deadcycles");
1140 print_esc("insertpenalties");
1143 if (chrcode == width_offset)
1145 else if (chrcode == height_offset)
1154 print_esc("lastpenalty");
1157 print_esc("lastkern");
1160 print_esc("lastskip");
1162 case input_line_no_code:
1163 print_esc("inputlineno");
1166 print_esc("badness");
1174 print_esc("number");
1176 case roman_numeral_code:
1177 print_esc("romannumeral");
1180 print_esc("string");
1183 print_esc("meaning");
1185 case font_name_code:
1186 print_esc("fontname");
1189 print_esc("jobname");
1209 print_esc("ifvmode");
1212 print_esc("ifhmode");
1215 print_esc("ifmmode");
1218 print_esc("ifinner");
1221 print_esc("ifvoid");
1224 print_esc("ifhbox");
1227 print_esc("ifvbox");
1236 print_esc("iftrue");
1239 print_esc("iffalse");
1242 print_esc("ifcase");
1250 if (chrcode == fi_code)
1252 else if (chrcode == or_code)
1258 if (chrcode == 256) /* pool size */ /* max_quarterword + 1 ? */
1261 print_string("alignment tab character ");
1266 if (chrcode == 257) /* cr_code */
1268 else print_esc("crcr");
1274 print_esc("pagegoal");
1277 print_esc("pagetotal");
1280 print_esc("pagestretch");
1283 print_esc("pagefilstretch");
1286 print_esc("pagefillstretch");
1289 print_esc("pagefilllstretch");
1292 print_esc("pageshrink");
1295 print_esc("pagedepth");
1302 else print_esc("end");
1320 print_esc("hfilneg");
1340 print_esc("vfilneg");
1355 print_esc("moveleft");
1356 else print_esc("moveright");
1361 else print_esc("lower");
1373 print_esc("lastbox");
1376 print_esc("vsplit");
1391 print_esc("leaders");
1392 else if (chrcode == 101)
1393 print_esc("cleaders");
1394 else if (chrcode == 102)
1395 print_esc("xleaders");
1396 else print_esc("shipout");
1400 print_esc("noindent");
1401 else print_esc("indent");
1405 print_esc("unskip");
1406 else if (chrcode == 11)
1407 print_esc("unkern");
1408 else print_esc("unpenalty");
1412 print_esc("unhcopy");
1413 else print_esc("unhbox");
1417 print_esc("unvcopy");
1418 else print_esc("unvbox");
1424 print_esc("discretionary");
1429 else print_esc("eqno");
1435 print_esc("mathord");
1438 print_esc("mathop");
1441 print_esc("mathbin");
1444 print_esc("mathrel");
1447 print_esc("mathopen");
1450 print_esc("mathclose");
1453 print_esc("mathpunct");
1456 print_esc("mathinner");
1459 print_esc("underline");
1462 print_esc("overline");
1468 print_esc("limits");
1469 else if (chrcode == 2)
1470 print_esc("nolimits");
1471 else print_esc("displaylimits");
1474 print_style(chrcode);
1486 print_esc("abovewithdelims");
1489 print_esc("overwithdelims");
1492 print_esc("atopwithdelims");
1502 else print_esc("right");
1507 else if (chrcode == 2)
1509 else print_esc("global");
1514 else if (chrcode == 1)
1516 else if (chrcode == 2)
1518 else print_esc("xdef");
1522 print_esc("futurelet");
1523 else print_esc("let");
1529 print_esc("chardef");
1532 print_esc("mathchardef");
1535 print_esc("countdef");
1538 print_esc("dimendef");
1541 print_esc("skipdef");
1544 print_esc("muskipdef");
1547 print_esc("toksdef");
1556 print_esc("mathchar");
1560 if (chrcode == cat_code_base)
1561 print_esc("catcode");
1562 else if (chrcode == math_code_base)
1563 print_esc("mathcode");
1564 else if (chrcode == lc_code_base)
1565 print_esc("lccode");
1566 else if (chrcode == uc_code_base)
1567 print_esc("uccode");
1568 else if (chrcode == sf_code_base)
1569 print_esc("sfcode");
1570 else print_esc("delcode");
1573 print_size(chrcode - math_font_base);
1577 print_esc("patterns");
1578 else print_esc("hyphenation");
1582 print_esc("hyphenchar");
1583 else print_esc("skewchar");
1586 print_string("select font ");
1587 slow_print(font_name[chrcode]);
1588 if (font_size[chrcode] != font_dsize[chrcode])
1590 print_string(" at ");
1591 print_scaled(font_size[chrcode]);
1599 print_esc("batchmode");
1602 print_esc("nonstopmode");
1605 print_esc("scrollmode");
1608 print_esc("errorstopmode");
1614 print_esc("closein");
1615 else print_esc("openin");
1619 print_esc("message");
1620 else print_esc("errmessage");
1623 if (chrcode == lc_code_base)
1624 print_esc("lowercase");
1625 else print_esc("uppercase");
1631 print_esc("showbox");
1634 print_esc("showthe");
1637 print_esc("showlists");
1645 print_string("undefined");
1648 print_string("macro");
1651 print_esc("long macro");
1654 print_esc("outer macro");
1658 print_esc("outer macro");
1661 print_esc("outer endtemplate");
1667 print_esc("openout");
1673 print_esc("closeout");
1676 print_esc("special");
1679 print_esc("immediate");
1682 print_esc("setlanguage");
1685 print_string("[unknown extension!]");
1690 print_string("[unknown command code!]");
1696 void show_eqtb_(halfword n)
1698 if (n < active_base)
1700 else if (n < glue_base)
1704 print_cmd_chr(eq_type(n), equiv(n));
1705 if (eqtb[n].hh.b0 >= call)
1708 show_token_list(link(equiv(n)), 0, 32);
1711 else if (n < local_base)
1714 print_skip_param(n - glue_base);
1716 if (n < glue_base + thin_mu_skip_code)
1717 print_spec(equiv(n), "pt");
1719 print_spec(equiv(n), "mu");
1721 else if (n < mu_skip_base)
1724 print_int(n - skip_base);
1726 print_spec(equiv(n), "pt");
1730 print_esc("muskip");
1731 print_int(n - mu_skip_base);
1733 print_spec(equiv(n), "mu");
1735 else if (n < int_base)
1736 if (n == par_shape_loc)
1738 print_esc("parshape");
1740 if (par_shape_ptr == 0)
1743 print_int(info(par_shape_ptr));
1745 else if (n < toks_base)
1747 print_cmd_chr(assign_toks, n);
1750 show_token_list(link(equiv(n)), 0, 32);
1752 else if (n < box_base)
1755 print_int(n - toks_base);
1758 show_token_list(link(equiv(n)), 0, 32);
1760 else if (n < cur_font_loc)
1763 print_int(n - box_base);
1766 print_string("void");
1769 depth_threshold = 0;
1771 show_node_list(equiv(n));
1774 else if (n < cat_code_base)
1776 if (n == cur_font_loc)
1777 print_string("current font");
1778 else if (n < math_font_base + 16)
1780 print_esc("textfont");
1781 print_int(n - math_font_base);
1783 else if (n < math_font_base + 32)
1785 print_esc("scriptfont");
1786 print_int(n - math_font_base - 16);
1790 print_esc("scriptscriptfont");
1791 print_int(n - math_font_base - 32);
1794 print_esc(""); print(hash[(hash_size + hash_extra + 524) + equiv(n)].v.RH);
1796 else if (n < math_code_base)
1798 if (n < lc_code_base)
1800 print_esc("catcode");
1801 print_int(n - cat_code_base);
1803 else if (n < uc_code_base)
1805 print_esc("lccode");
1806 print_int(n - lc_code_base);
1808 else if (n < sf_code_base)
1810 print_esc("uccode");
1811 print_int(n - uc_code_base);
1815 print_esc("sfcode");
1816 print_int(n - sf_code_base);
1819 print_int(equiv(n));
1823 print_esc("mathcode");
1824 print_int(n - math_code_base);
1826 print_int(equiv(n));
1828 else if (n < dimen_base)
1831 print_param(n - int_base);
1832 else if (n < del_code_base)
1835 print_int(n - count_base);
1839 print_esc("delcode");
1840 print_int(n - del_code_base);
1843 print_int(eqtb[n].cint);
1845 else if (n <= eqtb_size)
1847 if (n < scaled_base)
1848 print_length_param(n - dimen_base);
1852 print_int(n - scaled_base);
1855 print_scaled(eqtb[n].cint);
1858 else print_char('?');
1862 halfword id_lookup_(integer j, integer l)
1864 register halfword Result;
1871 for (k = j + 1; k <= j + l - 1; k++)
1873 h = h + h + buffer[k];
1874 while (h >= hash_prime)
1880 if (length(text(p)) == l)
1881 if (str_eq_buf(text(p), j))
1883 if (hash[p].v.LH == 0) {
1884 if (no_new_control_sequence)
1885 p = undefined_control_sequence;
1893 /* we can't expand the hash table ... */
1894 /* overflow("hash size", hash_size); */ /* hash size - NOT DYNAMIC */
1895 overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */
1896 return 0; // abort_flag set
1899 } while (!(text(hash_used) == 0));
1901 if (hash_used > 65535L)
1902 { /* debugging only 1996/Jan/20 */
1903 sprintf(log_line, "ERROR: %s too large %d\n", "hash entry", hash_used);
1904 show_line(log_line, 1);
1907 hash[p].v.LH = hash_used;
1911 if (checkpool(NULL)) show_line("after hash_used\n", 0);
1914 #ifdef ALLOCATESTRING
1915 if (pool_ptr + l > current_pool_size)
1916 str_pool = realloc_str_pool(increment_pool_size + 1);
1917 if (pool_ptr + l > current_pool_size)
1918 { /* in case it failed 97/Mar/7 */
1919 overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */
1920 return 0; // abort_flag set
1923 if (pool_ptr + l > pool_size)
1925 overflow("pool size", pool_size - init_pool_ptr); /* pool size - not dynamic */
1926 return; // abort_flag set
1931 while (pool_ptr > str_start[str_ptr]) {
1933 str_pool[pool_ptr + l] = str_pool[pool_ptr];
1936 if (checkpool(NULL)) show_line("after pool_ptr\n", 0);
1938 for (k = j; k <= j + l - 1; k++) append_char(buffer[k]);
1941 pool_pointer tempstring = make_string();
1942 if (tempstring > 65535L)
1943 { /* cannot happen */
1944 sprintf(log_line, "ERROR: %s too large %d\n", "string ptr", tempstring);
1945 show_line(log_line, 1);
1947 text(p) = tempstring;
1950 text(p) = make_string();
1953 if (checkpool(NULL))
1954 show_line("after make_string\n", 0);
1956 pool_ptr = pool_ptr + d;
1961 str_pool[pool_ptr] = '\0';
1962 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
1963 show_line(log_line, 0); /* debugging */
1968 if (checkpool(NULL))
1969 show_line("after cs_count++\n", 0);
1976 if (checkpool(NULL)) show_line("before return\n", 0);
1983 void new_save_level_(group_code c)
1985 if (save_ptr > max_save_stack)
1987 max_save_stack = save_ptr;
1988 #ifdef ALLOCATESAVESTACK
1989 if (max_save_stack > current_save_size - 6)
1990 save_stack = realloc_save_stack(increment_save_size);
1991 if (max_save_stack > current_save_size - 6)
1992 { /* check again after allocation */
1993 overflow("save size", current_save_size);
1994 return; // abort_flag set
1997 if (max_save_stack > save_size - 6)
1998 { /* save size - not dynamic */
1999 overflow("save size", save_size);
2000 return; // abort_flag set
2004 /* save_type(save_ptr) <- level_boundary; */
2005 save_stack[save_ptr].hh.b0 = 3;
2006 /* save_stack[save_ptr].hh.b1 = cur_group; *//* keep compiler happy */
2007 save_stack[save_ptr].hh.b1 = (quarterword) cur_group;
2008 /* save_index(save_ptr):=cur_boundary; */
2009 save_stack[save_ptr].hh.v.RH = cur_boundary;
2010 /* if cur_level = max_quarterword then ... p.274 */
2011 /* if (cur_level == 255)*/ /* 94/Apr/4 */
2012 if (cur_level == max_quarterword)
2014 /* { quit if (cur_level + 1) is too large to store in eqtb } */
2015 /* overflow("grouping levels", max_quarterword - min_quarterword); */
2016 /* overflow("grouping levels", 255); */ /* grouping levels - not dynamic */
2017 overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2018 return; // abort_flag set
2020 /* cur_boundary <- save_ptr */
2021 cur_boundary = save_ptr;
2027 void eq_destroy_(memory_word w)
2030 switch (eq_type_field(w))
2035 case long_outer_call:
2036 delete_token_ref(equiv_field(w));
2039 delete_glue_ref(equiv_field(w));
2044 free_node(q, info(q) + info(q) + 1);
2047 flush_node_list(equiv_field(w));
2054 void eq_save_(halfword p, quarterword l)
2056 if (save_ptr > max_save_stack)
2058 max_save_stack = save_ptr;
2059 #ifdef ALLOCATESAVESTACK
2060 if (max_save_stack > current_save_size - 6)
2061 save_stack = realloc_save_stack (increment_save_size);
2062 if (max_save_stack > current_save_size - 6)
2063 { /* check again after allocation */
2064 overflow("save size", current_save_size);
2065 return; // abort_flag set
2068 if (max_save_stack > save_size - 6)
2069 { /* save size not dynamic */
2070 overflow("save size", save_size);
2071 return; // abort_flag set
2075 if (l == level_zero)
2076 save_type(save_ptr) = restore_zero;
2079 save_stack[save_ptr] = eqtb[p];
2081 save_type(save_ptr) = restore_old_value;
2083 save_level(save_ptr) = l;
2084 save_index(save_ptr) = p;
2088 void eq_define_(halfword p, quarterword t, halfword e)
2090 if (eq_level(p) == cur_level)
2091 eq_destroy(eqtb[p]);
2092 else if (cur_level > level_one)
2093 eq_save(p, eq_level(p));
2094 eq_level(p) = (quarterword) cur_level; /* because cur_level padded out */
2099 void eq_word_define_(halfword p, integer w)
2101 if (xeq_level[p] != cur_level)
2103 eq_save(p, xeq_level[p]);
2104 xeq_level[p] = (quarterword) cur_level; /* because cur_level padded out */
2109 void geq_define_(halfword p, quarterword t, halfword e)
2111 eq_destroy(eqtb[p]);
2112 eq_level(p) = level_one;
2117 void geq_word_define_(halfword p, integer w)
2123 void save_for_after_(halfword t)
2127 if (save_ptr > max_save_stack)
2129 max_save_stack = save_ptr;
2130 #ifdef ALLOCATESAVESTACK
2131 if (max_save_stack > current_save_size - 6)
2132 save_stack = realloc_save_stack (increment_save_size);
2133 if (max_save_stack > current_save_size - 6)
2134 { /* check again after allocation */
2135 overflow("save size", current_save_size);
2136 return; // abort_flag set
2139 if (max_save_stack > save_size - 6)
2140 { /* save satck - not dynamic */
2141 overflow("save size", save_size);
2142 return; // abort_flag set
2146 save_type(save_ptr) = insert_token;
2147 save_level(save_ptr) = level_zero;
2148 save_index(save_ptr) = t;
2152 /* restore_trace_, unsave followed in the old tex1.c */