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 /* #pragma optimize("a", off) */ /* 98/Dec/10 experiment */
28 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
30 void show_box_(halfword p)
32 depth_threshold = eqtb[(hash_size + 3188)].cint;
33 breadth_max = eqtb[(hash_size + 3187)].cint;
36 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
38 if(pool_ptr + depth_threshold >= current_pool_size) /* ??? 93/Nov/28 */
39 str_pool = realloc_str_pool (increment_pool_size); /* ??? 94/Jan/24 */
40 if(pool_ptr + depth_threshold >= current_pool_size) /* in case it failed */
41 depth_threshold = current_pool_size - pool_ptr - 1;
43 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
44 if(pool_ptr + depth_threshold >= pool_size)
45 depth_threshold = pool_size - pool_ptr - 1;
50 void delete_token_ref_(halfword p)
52 if(mem[p].hh.v.LH == 0)
54 else decr(mem[p].hh.v.LH);
56 void delete_glue_ref_(halfword p)
58 if(mem[p].hh.v.RH == 0)
60 else decr(mem[p].hh.v.RH);
62 void flush_node_list_(halfword p)
65 while(p != 0){ /* while p<>null */
70 mem[p].hh.v.RH = avail;
84 flush_node_list(mem[p + 5].hh.v.RH);
97 flush_node_list(mem[p + 4].hh.v.LH);
98 delete_glue_ref(mem[p + 4].hh.v.RH);
112 delete_token_ref(mem[p + 1].hh.v.RH);
123 confusion(1289); /* ext3 */
124 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);
136 else decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
138 /* if leader_ptr(p)<>null then flush_node_list(leader_ptr(p)); */
139 if(mem[p + 1].hh.v.RH != 0)
140 flush_node_list(mem[p + 1].hh.v.RH);
149 flush_node_list(mem[p + 1].hh.v.RH);
152 delete_token_ref(mem[p + 1].cint);
156 flush_node_list(mem[p + 1].hh.v.LH);
157 flush_node_list(mem[p + 1].hh.v.RH);
161 flush_node_list(mem[p + 1].cint);
171 flush_node_list(mem[p + 1].hh.v.LH);
172 flush_node_list(mem[p + 1].hh.v.RH);
173 flush_node_list(mem[p + 2].hh.v.LH);
174 flush_node_list(mem[p + 2].hh.v.RH);
193 if(mem[p + 1].hh.v.RH >= 2)
194 flush_node_list(mem[p + 1].hh.v.LH);
195 if(mem[p + 2].hh.v.RH >= 2)
196 flush_node_list(mem[p + 2].hh.v.LH);
197 if(mem[p + 3].hh.v.RH >= 2)
198 flush_node_list(mem[p + 3].hh.v.LH);
199 if(mem[p].hh.b0 == 24)
201 else if(mem[p].hh.b0 == 28)
203 else free_node(p, 4);
216 flush_node_list(mem[p + 2].hh.v.LH);
217 flush_node_list(mem[p + 3].hh.v.LH);
224 confusion(350); /* flushing */
225 return; // abort_flag set
235 halfword copy_node_list_(halfword p)
236 {register halfword Result;
243 while(p != 0){ /* while p<>null do l.3969 */
246 if((p >= hi_mem_min))
248 else switch(mem[p].hh.b0)
254 mem[r + 6]= mem[p + 6];
255 mem[r + 5]= mem[p + 5];
256 mem[r + 5].hh.v.RH = copy_node_list(mem[p + 5].hh.v.RH);
269 mem[r + 4]= mem[p + 4];
270 incr(mem[mem[p + 4].hh.v.RH].hh.v.RH);
271 mem[r + 4].hh.v.LH = copy_node_list(mem[p + 4].hh.v.LH);
287 incr(mem[mem[p + 1].hh.v.RH].hh.v.LH);
300 confusion(1288); /* ext2 */
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(351); /* 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;
377 void print_mode_(integer m)
382 print_string("vertical");
385 print_string("horizontal");
388 print_string("display math");
393 else switch((- (integer) m)/(101))
395 print_string("internal vertical");
398 print_string("restricted horizontal");
401 print_string("math");
404 print_string(" mode");
406 void push_nest (void)
408 if(nest_ptr > max_nest_stack)
410 max_nest_stack = nest_ptr;
411 #ifdef ALLOCATEINPUTSTACK
412 if(nest_ptr == current_nest_size)
413 nest = realloc_nest_stack (increment_nest_size);
414 if(nest_ptr == current_nest_size){ /* check again after allocation */
415 overflow(359, current_nest_size);
416 return; // abort_flag set
419 if(nest_ptr == nest_size){
420 overflow(359, nest_size); /* semantic next size - not dynamic */
421 return; // abort_flag set
425 nest[nest_ptr]= cur_list;
435 mem[head].hh.v.RH = avail;
443 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 */
480 print_char(44); /*, */
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 /* ********************************************************************* */
485 print_char(41); /*)*/
487 if(nest[p].ml_field < 0)
488 print_string(" (\\output routine)");
491 if(mem_top - 2 != page_tail)
493 print_nl("### current page:");
495 print_string(" (held over for next output)");
496 show_box(mem[mem_top - 2].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;
509 print_string(" adds ");
510 t = x_over_n(mem[r + 3].cint, 1000)*
511 eqtb[(hash_size + 3218) + t].cint;
513 if(mem[r].hh.b0 == 1)
519 if((mem[q].hh.b0 == 3)&&(mem[q].hh.b1 == mem
522 } while(!(q == mem[r + 1].hh.v.LH));
525 print_string(" might split");
531 /* if link(contrib_head)<>null then l.4393 */
532 if(mem[mem_top - 1].hh.v.RH != 0)
533 print_nl(" (\\output routine)");
535 show_box(mem[nest[p].head_field].hh.v.RH);
539 print_nl("### recent contributions:");
540 if(a.cint <= ignore_depth)
541 print_string("ignored");
542 else print_scaled(a.cint);
543 if(nest[p].pg_field != 0)
545 print_string(", prevgraf ");
546 print_int(nest[p].pg_field);
547 print_string(" line");
548 if(nest[p].pg_field != 1)
549 print_char(115); /* s */
555 print_nl("spacefactor "); /* */
556 print_int(a.hh.v.LH);
560 print_string(", current language ");
561 print_int(a.hh.v.RH);
568 print_string("this will be denominator of:");
574 while(p-- > for_end); }
577 void print_param_(integer n)
581 case pretolerance_code:
582 print_esc("pretolerance");
585 print_esc("tolerance");
587 case line_penalty_code:
588 print_esc("linepenalty");
590 case hyphen_penalty_code:
591 print_esc("hyphenpenalty");
593 case ex_hyphen_penalty_code:
594 print_esc("exhyphenpenalty");
596 case club_penalty_code:
597 print_esc("clubpenalty");
599 case widow_penalty_code:
600 print_esc("widowpenalty");
602 case display_widow_penalty_code:
603 print_esc("displaywidowpenalty");
605 case broken_penalty_code:
606 print_esc("brokenpenalty");
608 case bin_op_penalty_code:
609 print_esc("binoppenalty");
611 case rel_penalty_code:
612 print_esc("relpenalty");
614 case pre_display_penalty_code:
615 print_esc("predisplaypenalty");
617 case post_display_penalty_code:
618 print_esc("postdisplaypenalty");
620 case inter_line_penalty_code:
621 print_esc("interlinepenalty");
623 case double_hyphen_demerits_code:
624 print_esc("doublehyphendemerits");
626 case final_hyphen_demerits_code:
627 print_esc("finalhyphendemerits");
629 case adj_demerits_code:
630 print_esc("adjdemerits");
635 case delimiter_factor_code:
636 print_esc("delimiterfactor");
639 print_esc("looseness");
653 case show_box_breadth_code:
654 print_esc("showboxbreadth");
656 case show_box_depth_code:
657 print_esc("showboxdepth");
660 print_esc("hbadness");
663 print_esc("vbadness");
666 print_esc("pausing");
668 case tracing_online_code:
669 print_esc("tracingonline");
671 case tracing_macros_code:
672 print_esc("tracingmacros");
674 case tracing_stats_code:
675 print_esc("tracingstats");
677 case tracing_paragraphs_code:
678 print_esc("tracingparagraphs");
680 case tracing_pages_code:
681 print_esc("tracingpages");
683 case tracing_output_code:
684 print_esc("tracingoutput");
686 case tracing_lost_chars_code:
687 print_esc("tracinglostchars");
689 case tracing_commands_code:
690 print_esc("tracingcommands");
692 case tracing_restores_code:
693 print_esc("tracingrestores");
698 case output_penalty_code:
699 print_esc("outputpenalty");
701 case max_dead_cycles_code:
702 print_esc("maxdeadcycles");
704 case hang_after_code:
705 print_esc("hangafter");
707 case floating_penalty_code:
708 print_esc("floatingpenalty");
710 case global_defs_code:
711 print_esc("globaldefs");
716 case escape_char_code:
717 print_esc("escapechar");
719 case default_hyphen_char_code:
720 print_esc("defaulthyphenchar");
722 case default_skew_char_code:
723 print_esc("defaultskewchar");
725 case end_line_char_code:
726 print_esc("endlinechar");
728 case new_line_char_code:
729 print_esc("newlinechar");
732 print_esc("language");
734 case left_hyphen_min_code:
735 print_esc("lefthyphenmin");
737 case right_hyphen_min_code:
738 print_esc("righthyphenmin");
740 case holding_inserts_code:
741 print_esc("holdinginserts");
743 case error_context_lines_code:
744 print_esc("errorcontextlines");
747 print_string("[unknown integer parameter!]");
751 void begin_diagnostic (void)
753 old_setting = selector;
754 if((eqtb[(hash_size + 3192)].cint <= 0)&&(selector == 19)) {
756 if(history == 0)history = 1;
759 void end_diagnostic_(bool blankline)
762 if(blankline)print_ln ();
763 selector = old_setting;
765 void print_length_param_ (integer n)
769 case par_indent_code:
770 print_esc("parindent");
772 case math_surround_code:
773 print_esc("mathsurround");
775 case line_skip_limit_code:
776 print_esc("lineskiplimit");
785 print_esc("maxdepth");
787 case split_max_depth_code:
788 print_esc("splitmaxdepth");
790 case box_max_depth_code:
791 print_esc("boxmaxdepth");
799 case delimiter_shortfall_code:
800 print_esc("delimitershortfall");
802 case null_delimiter_space_code:
803 print_esc("nulldelimiterspace");
805 case script_space_code:
806 print_esc("scriptspace");
808 case pre_display_size_code:
809 print_esc("predisplaysize");
811 case display_width_code:
812 print_esc("displaywidth");
814 case display_indent_code:
815 print_esc("displayindent");
817 case overfull_rule_code:
818 print_esc("overfullrule");
820 case hang_indent_code:
821 print_esc("hangindent");
824 print_esc("hoffset");
827 print_esc("voffset");
829 case emergency_stretch_code:
830 print_esc("emergencystretch");
833 print_string("[unknown dimen parameter!]");
837 void print_cmd_chr_ (quarterword cmd, halfword chrcode)
842 print_string("begin-group character ");
848 print_string("end-group character ");
854 print_string("math shift character ");
860 print_string("macro parameter character ");
866 print_string("superscript character ");
872 print_string("subscript character ");
877 print_string("end of alignment template");
881 print_string("blank space ");
887 print_string("the letter ");
893 print_string("the character ");
899 /* if chr_code<skip_base then print_skip_param(chr_code-glue_base) */
900 if(chrcode < (hash_size + 800))
901 print_skip_param(chrcode - (hash_size + 782)); /* lineskip */
902 /* else if chr_code<mu_skip_base then
903 begin print_esc("skip"); print_int(chr_code-skip_base); */
904 else if(chrcode < (hash_size + 1056))
907 print_int(chrcode - (hash_size + 800));
910 /* else begin print_esc("muskip"); print_int(chr_code-mu_skip_base); */
912 print_int(chrcode - (hash_size + 1056));
916 if(chrcode >= (hash_size + 1322))
919 print_int(chrcode - (hash_size + 1322));
923 case (hash_size + 1313) :
926 case (hash_size + 1314) :
927 print_esc("everypar");
929 case (hash_size + 1315) :
930 print_esc("everymath");
932 case (hash_size + 1316) :
933 print_esc("everydisplay");
935 case (hash_size + 1317) :
936 print_esc("everyhbox");
938 case (hash_size + 1318) :
939 print_esc("everyvbox");
941 case (hash_size + 1319) :
942 print_esc("everyjob");
944 case (hash_size + 1320) :
945 print_esc("everycr");
948 print_esc("errhelp");
953 if(chrcode < (hash_size + 3218))
954 print_param(chrcode - (hash_size + 3163));
957 print_int(chrcode - (hash_size + 3218));
961 if(chrcode < (hash_size + 3751))
962 print_length_param(chrcode - (hash_size + 3730));
966 print_int(chrcode - (hash_size + 3751));
973 print_esc("advance");
976 print_esc("afterassignment");
979 print_esc("aftergroup");
982 print_esc("fontdimen");
985 print_esc("begingroup");
988 print_esc("penalty");
1000 print_esc("delimiter");
1003 print_esc("divide");
1006 print_esc("endcsname");
1009 print_esc("endgroup");
1015 print_esc("expandafter");
1018 print_esc("halign");
1024 print_esc("ignorespaces");
1027 print_esc("insert");
1036 print_esc("mathaccent");
1039 print_esc("mathchar");
1042 print_esc("mathchoice");
1045 print_esc("multiply");
1048 print_esc("noalign");
1051 print_esc("noboundary");
1054 print_esc("noexpand");
1057 print_esc("nonscript");
1063 print_esc("radical");
1072 print_esc("setbox");
1075 print_esc("prevgraf");
1078 print_esc("parshape");
1087 print_esc("vadjust");
1090 print_esc("valign");
1093 print_esc("vcenter");
1104 else print_esc("endinput");
1109 print_esc("firstmark");
1112 print_esc("botmark");
1115 print_esc("splitfirstmark");
1118 print_esc("splitbotmark");
1121 print_esc("topmark");
1128 else if(chrcode == 1)
1130 else if(chrcode == 2)
1132 else print_esc("muskip");
1136 print_esc("prevdepth");
1137 else print_esc("spacefactor");
1141 print_esc("deadcycles");
1142 else print_esc("insertpenalties");
1147 else if(chrcode == 3)
1149 else print_esc("dp");
1154 print_esc("lastpenalty");
1157 print_esc("lastkern");
1160 print_esc("lastskip");
1163 print_esc("inputlineno");
1166 print_esc("badness");
1173 print_esc("number");
1176 print_esc("romannumeral");
1179 print_esc("string");
1182 print_esc("meaning");
1185 print_esc("fontname");
1188 print_esc("jobname");
1207 print_esc("ifvmode");
1210 print_esc("ifhmode");
1213 print_esc("ifmmode");
1216 print_esc("ifinner");
1219 print_esc("ifvoid");
1222 print_esc("ifhbox");
1225 print_esc("ifvbox");
1234 print_esc("iftrue");
1237 print_esc("iffalse");
1240 print_esc("ifcase");
1250 else if(chrcode == 4)
1252 else print_esc("else");
1255 if(chrcode == 256) /* pool size */ /* max_quarterword + 1 ? */
1258 print_string("alignment tab character ");
1263 if(chrcode == 257) /* cr_code */
1265 else print_esc("crcr");
1270 print_esc("pagegoal");
1273 print_esc("pagetotal");
1276 print_esc("pagestretch");
1279 print_esc("pagefilstretch");
1282 print_esc("pagefillstretch");
1285 print_esc("pagefilllstretch");
1288 print_esc("pageshrink");
1291 print_esc("pagedepth");
1298 else print_esc("end");
1315 print_esc("hfilneg");
1334 print_esc("vfilneg");
1349 print_esc("moveleft");
1350 else print_esc("moveright");
1355 else print_esc("lower");
1366 print_esc("lastbox");
1369 print_esc("vsplit");
1384 print_esc("leaders");
1385 else if(chrcode == 101)
1386 print_esc("cleaders");
1387 else if(chrcode == 102)
1388 print_esc("xleaders");
1389 else print_esc("shipout");
1393 print_esc("noindent");
1394 else print_esc("indent");
1398 print_esc("unskip");
1399 else if(chrcode == 11)
1400 print_esc("unkern");
1401 else print_esc("unpenalty");
1405 print_esc("unhcopy");
1406 else print_esc("unhbox");
1410 print_esc("unvcopy");
1411 else print_esc("unvbox");
1416 else print_esc("discretionary");
1421 else print_esc("eqno");
1426 print_esc("mathord");
1429 print_esc("mathop");
1432 print_esc("mathbin");
1435 print_esc("mathrel");
1438 print_esc("mathopen");
1441 print_esc("mathclose");
1444 print_esc("mathpunct");
1447 print_esc("mathinner");
1450 print_esc("underline");
1453 print_esc("overline");
1459 print_esc("limits");
1460 else if(chrcode == 2)
1461 print_esc("nolimits");
1462 else print_esc("displaylimits");
1465 print_style(chrcode);
1476 print_esc("abovewithdelims");
1479 print_esc("overwithdelims");
1482 print_esc("atopwithdelims");
1492 else print_esc("right");
1497 else if(chrcode == 2)
1499 else print_esc("global");
1504 else if(chrcode == 1)
1506 else if(chrcode == 2)
1508 else print_esc("xdef");
1512 print_esc("futurelet");
1513 else print_esc("let");
1518 print_esc("chardef");
1521 print_esc("mathchardef");
1524 print_esc("countdef");
1527 print_esc("dimendef");
1530 print_esc("skipdef");
1533 print_esc("muskipdef");
1536 print_esc("toksdef");
1548 print_esc("mathchar");
1553 if(chrcode == (hash_size + 1883))
1554 print_esc("catcode");
1555 else if(chrcode == (hash_size + 2907))
1556 print_esc("mathcode");
1557 else if(chrcode == (hash_size + 2139))
1558 print_esc("lccode");
1559 else if(chrcode == (hash_size + 2395))
1560 print_esc("uccode");
1561 else if(chrcode == (hash_size + 2651))
1562 print_esc("sfcode");
1563 else print_esc("delcode");
1566 print_size(chrcode - (hash_size + 1835)); /* chr - math_font_base */
1570 print_esc("patterns");
1571 else print_esc("hyphenation");
1575 print_esc("hyphenchar");
1576 else print_esc("skewchar");
1580 print_string("select font ");
1581 slow_print(font_name[chrcode]);
1582 if(font_size[chrcode]!= font_dsize[chrcode])
1584 print_string(" at ");
1585 print_scaled(font_size[chrcode]);
1593 print_esc("batchmode");
1596 print_esc("nonstopmode");
1599 print_esc("scrollmode");
1602 print_esc("errorstopmode");
1608 print_esc("closein");
1609 else print_esc("openin");
1613 print_esc("message");
1614 else print_esc("errmessage");
1617 if(chrcode == (hash_size + 2139))
1618 print_esc("lowercase");
1619 else print_esc("uppercase");
1624 print_esc("showbox");
1627 print_esc("showthe");
1630 print_esc("showlists");
1638 print_string("undefined");
1641 print_string("macro");
1644 print_esc("long macro");
1647 print_esc("outer macro");
1652 print_esc("outer macro");
1656 print_esc("outer endtemplate");
1661 print_esc("openout");
1667 print_esc("closeout");
1670 print_esc("special");
1673 print_esc("immediate");
1676 print_esc("setlanguage");
1679 print_string("[unknown extension!]");
1684 print_string("[unknown command code!]");
1690 void show_eqtb_(halfword n)
1693 print_char(63); /* ? */
1694 else if(n < (hash_size + 782)) /* lineskip */
1697 print_char(61); /* = */
1698 print_cmd_chr(eqtb[n].hh.b0, eqtb[n].hh.v.RH);
1699 if(eqtb[n].hh.b0 >= 111)
1701 print_char(58); /* : */
1702 show_token_list(mem[eqtb[n].hh.v.RH].hh.v.RH, 0, 32);
1705 else if(n < (hash_size + 1312))
1706 if(n < (hash_size + 800))
1708 print_skip_param(n - (hash_size + 782)); /* lineskip */
1709 print_char(61); /* = */
1710 if(n < (hash_size + 797))
1711 print_spec(eqtb[n].hh.v.RH, 394); /* pt */
1712 else print_spec(eqtb[n].hh.v.RH, 334); /* mu */
1714 else if(n < (hash_size + 1056))
1717 print_int(n - (hash_size + 800));
1718 print_char(61); /* = */
1719 print_spec(eqtb[n].hh.v.RH, 394); /* pt */
1722 print_esc("muskip");
1723 print_int(n - (hash_size + 1056));
1724 print_char(61); /* = */
1725 print_spec(eqtb[n].hh.v.RH, 334); /* mu */
1727 else if(n < (hash_size + 3163))
1728 if(n == (hash_size + 1312))
1730 print_esc("parshape");
1731 print_char(61); /* = */
1732 if(eqtb[(hash_size + 1312)].hh.v.RH == 0)
1733 print_char(48); /* 0 */
1734 else print_int(mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH);
1736 else if(n < (hash_size + 1322))
1738 print_cmd_chr(72, n); /* H */
1739 print_char(61); /* = */
1740 if(eqtb[n].hh.v.RH != 0)
1741 show_token_list(mem[eqtb[n].hh.v.RH].hh.v.RH, 0, 32);
1743 else if(n < (hash_size + 1578))
1746 print_int(n - (hash_size + 1322));
1747 print_char(61); /* = */
1748 if(eqtb[n].hh.v.RH != 0)
1749 show_token_list(mem[eqtb[n].hh.v.RH].hh.v.RH, 0, 32);
1751 else if(n < (hash_size + 1834))
1754 print_int(n - (hash_size + 1578));
1755 print_char(61); /* = */
1756 if(eqtb[n].hh.v.RH == 0)
1757 print_string("void");
1760 depth_threshold = 0;
1762 show_node_list(eqtb[n].hh.v.RH);
1765 else if(n < (hash_size + 1883)) /* cat_code_base ... */
1767 if(n == (hash_size + 1834))
1768 print_string("current font");
1769 else if(n < (hash_size + 1851))
1771 print_esc("textfont");
1772 print_int(n - (hash_size + 1835));
1774 else if(n < (hash_size + 1867))
1776 print_esc("scriptfont");
1777 print_int(n - (hash_size + 1851));
1780 print_esc("scriptscriptfont");
1781 print_int(n - (hash_size + 1867));
1783 print_char(61); /* = */
1784 /* print_esc(hash[(hash_size + 524) + eqtb[n].hh.v.RH].v.RH); */
1785 //print_esc(hash[(hash_size + hash_extra + 524) + eqtb[n].hh.v.RH].v.RH);
1786 print_esc("");print(hash[(hash_size + hash_extra + 524) + eqtb[n].hh.v.RH].v.RH);
1789 else if(n < (hash_size + 2907))
1791 if(n < (hash_size + 2139))
1793 print_esc("catcode");
1794 print_int(n - (hash_size + 1883));
1796 else if(n < (hash_size + 2395))
1798 print_esc("lccode");
1799 print_int(n - (hash_size + 2139));
1801 else if(n < (hash_size + 2651))
1803 print_esc("uccode");
1804 print_int(n - (hash_size + 2395));
1808 print_esc("sfcode");
1809 print_int(n - (hash_size + 2651));
1811 print_char(61); /* = */
1812 print_int(eqtb[n].hh.v.RH);
1815 print_esc("mathcode");
1816 print_int(n - (hash_size + 2907));
1817 print_char(61); /* = */
1818 print_int(eqtb[n].hh.v.RH);
1820 else if(n < (hash_size + 3730))
1822 if(n < (hash_size + 3218))
1823 print_param(n - (hash_size + 3163));
1824 else if(n < (hash_size + 3474))
1827 print_int(n - (hash_size + 3218));
1830 print_esc("delcode");
1831 print_int(n - (hash_size + 3474));
1833 print_char(61); /* = */
1834 print_int(eqtb[n].cint);
1836 else if(n <= (hash_size + 4006))
1838 if(n < (hash_size + 3751))
1839 print_length_param(n - (hash_size + 3730));
1842 print_int(n - (hash_size + 3751));
1844 print_char(61); /* = */
1845 print_scaled(eqtb[n].cint);
1848 else print_char(63); /* = */
1852 halfword id_lookup_(integer j, integer l)
1853 {/* 40 */ register halfword Result;
1860 register integer for_end;
1862 for_end = j + l - 1;
1863 if(k <= for_end) do {
1864 h = h + h + buffer[k];
1865 while(h >= hash_prime)h = h - hash_prime; /* buffer size hash prime */
1867 while(k++ < for_end);
1869 p = h + 514; /* h + hash_base */
1871 if(hash[p].v.RH > 0)
1872 if((str_start[hash[p].v.RH + 1]- str_start[hash[p].v.RH])
1874 if(str_eq_buf(hash[p].v.RH, j))
1876 if(hash[p].v.LH == 0){
1877 if(no_new_control_sequence)
1878 p = (hash_size + 781); /* undefine_control_sequence */
1880 if(hash[p].v.RH > 0){
1882 if((hash_used == 514)) { /* if hash_used = hashbase ... */
1883 /* we can't expand the hash table ... */
1884 /* overflow(500, hash_size); */ /* hash size - NOT DYNAMIC */
1885 overflow(500, hash_size + hash_extra); /* 96/Jan/10 */
1886 return 0; // abort_flag set
1889 } while(!(hash[hash_used].v.RH == 0));
1891 if (hash_used > 65535L) { /* debugging only 1996/Jan/20 */
1892 sprintf(log_line, "ERROR: %s too large %d\n",
1893 "hash entry", hash_used);
1894 show_line(log_line, 1);
1897 hash[p].v.LH = hash_used;
1901 if (checkpool(NULL)) show_line("after hash_used\n", 0);
1904 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1905 #ifdef ALLOCATESTRING
1906 if(pool_ptr + l > current_pool_size)
1907 /* str_pool = realloc_str_pool (increment_pool_size); */
1908 str_pool = realloc_str_pool (increment_pool_size + 1);
1909 if(pool_ptr + l > current_pool_size){ /* in case it failed 97/Mar/7 */
1910 overflow(257, current_pool_size - init_pool_ptr); /* pool size */
1911 return 0; // abort_flag set
1914 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1915 if(pool_ptr + l > pool_size){
1916 overflow(257, pool_size - init_pool_ptr); /* pool size - not dynamic */
1917 return; // abort_flag set
1921 d =(pool_ptr - str_start[str_ptr]);
1922 while(pool_ptr > str_start[str_ptr]){
1924 str_pool[pool_ptr + l]= str_pool[pool_ptr];
1927 if (checkpool(NULL)) show_line("after pool_ptr\n", 0);
1930 register integer for_end;
1932 for_end = j + l - 1;
1933 if(k <= for_end) do {
1934 str_pool[pool_ptr]= buffer[k];
1937 while(k++ < for_end);
1941 pool_pointer tempstring = make_string ();
1942 if (tempstring > 65535L) { /* cannot happen */
1943 sprintf(log_line, "ERROR: %s too large %d\n",
1944 "string ptr", tempstring);
1945 show_line(log_line, 1);
1947 hash[p].v.RH = tempstring;
1950 hash[p].v.RH = make_string ();
1953 if (checkpool(NULL)) show_line("after make_string\n", 0);
1955 pool_ptr = pool_ptr + d;
1960 str_pool[pool_ptr] = '\0';
1961 sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
1962 show_line(log_line, 0); /* debugging */
1967 if (checkpool(NULL)) show_line("after cs_count++\n", 0);
1974 if (checkpool(NULL)) show_line("before return\n", 0);
1980 void new_save_level_(group_code c)
1982 if(save_ptr > max_save_stack) /* check_full_save_stack; p.274 */
1984 max_save_stack = save_ptr;
1985 #ifdef ALLOCATESAVESTACK
1986 if(max_save_stack > current_save_size - 6)
1987 save_stack = realloc_save_stack (increment_save_size);
1988 if(max_save_stack > current_save_size - 6){ /* check again after allocation */
1989 overflow(538, current_save_size);
1990 return; // abort_flag set
1993 if(max_save_stack > save_size - 6){ /* save size - not dynamic */
1994 overflow(538, 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) {
2008 /* { quit if (cur_level + 1) is too large to store in eqtb } */
2009 /* overflow("grouping levels", max_quarterword - min_quarterword); */
2010 /* overflow(539, 255); */ /* grouping levels - not dynamic */
2011 overflow(539, max_quarterword - min_quarterword); /* 96/Oct/12 ??? */
2012 return; // abort_flag set
2014 /* cur_boundary <- save_ptr */
2015 cur_boundary = save_ptr;
2020 void eq_destroy_(memory_word w)
2028 delete_token_ref(w.hh.v.RH);
2031 delete_glue_ref(w.hh.v.RH);
2036 if(q != 0) /* if q<>null then free_node(... l.5937 */
2037 free_node(q, mem[q].hh.v.LH + mem[q].hh.v.LH + 1);
2041 flush_node_list(w.hh.v.RH);
2048 void eq_save_(halfword p, quarterword l)
2050 if(save_ptr > max_save_stack)
2052 max_save_stack = save_ptr;
2053 #ifdef ALLOCATESAVESTACK
2054 if(max_save_stack > current_save_size - 6)
2055 save_stack = realloc_save_stack (increment_save_size);
2056 if(max_save_stack > current_save_size - 6){ /* check again after allocation */
2057 overflow(538, current_save_size);
2058 return; // abort_flag set
2061 if(max_save_stack > save_size - 6){ /* save size not dynamic */
2062 overflow(538, save_size);
2063 return; // abort_flag set
2068 save_stack[save_ptr].hh.b0 = 1;
2071 save_stack[save_ptr]= eqtb[p];
2073 save_stack[save_ptr].hh.b0 = 0;
2075 save_stack[save_ptr].hh.b1 = l;
2076 save_stack[save_ptr].hh.v.RH = p;
2079 void eq_define_(halfword p, quarterword t, halfword e)
2081 if(eqtb[p].hh.b1 == cur_level)
2082 eq_destroy(eqtb[p]);
2083 else if(cur_level > 1)
2084 eq_save(p, eqtb[p].hh.b1);
2085 /* eqtb[p].hh.b1 = cur_level; */
2086 eqtb[p].hh.b1 = (quarterword) cur_level; /* because cur_level padded out */
2088 eqtb[p].hh.v.RH = e;
2090 void eq_word_define_(halfword p, integer w)
2092 if(xeq_level[p]!= cur_level)
2094 eq_save(p, xeq_level[p]);
2095 /* xeq_level[p]= cur_level; */
2096 xeq_level[p]= (quarterword) cur_level; /* because cur_level padded out */
2100 void geq_define_(halfword p, quarterword t, halfword e)
2102 eq_destroy(eqtb[p]);
2105 eqtb[p].hh.v.RH = e;
2107 void geq_word_define_(halfword p, integer w)
2112 void save_for_after_(halfword t)
2116 if(save_ptr > max_save_stack)
2118 max_save_stack = save_ptr;
2119 #ifdef ALLOCATESAVESTACK
2120 if(max_save_stack > current_save_size - 6)
2121 save_stack = realloc_save_stack (increment_save_size);
2122 if(max_save_stack > current_save_size - 6){ /* check again after allocation */
2123 overflow(538, current_save_size);
2124 return; // abort_flag set
2127 if(max_save_stack > save_size - 6){ /* save satck - not dynamic */
2128 overflow(538, save_size);
2129 return; // abort_flag set
2133 save_stack[save_ptr].hh.b0 = 2;
2134 save_stack[save_ptr].hh.b1 = 0;
2135 save_stack[save_ptr].hh.v.RH = t;
2139 /* restore_trace_, unsave followed in the old tex1.c */