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 /* math_fraction etc used to be in tex7.c */
30 void math_fraction (void)
34 if(cur_list.aux_field.cint != 0)
38 scan_delimiter(mem_top - 12, false);
39 scan_delimiter(mem_top - 12, false);
42 scan_dimen(false, false, false);
43 print_err("Ambiguous; you need another { and }");
44 help3("I'm ignoring this fraction specification, since I don't",
45 "know whether a construction like `x \\over y \\over z'",
46 "means `{x \\over y} \\over z' or `x \\over {y \\over z}'.");
51 cur_list.aux_field.cint = get_node(6);
52 mem[cur_list.aux_field.cint].hh.b0 = 25;
53 mem[cur_list.aux_field.cint].hh.b1 = 0;
54 mem[cur_list.aux_field.cint + 2].hh.v.RH = 3;
55 mem[cur_list.aux_field.cint + 2].hh.v.LH = mem[head]
57 mem[cur_list.aux_field.cint + 3].hh = empty_field;
58 mem[cur_list.aux_field.cint + 4].qqqq = null_delimiter;
59 mem[cur_list.aux_field.cint + 5].qqqq = null_delimiter;
60 mem[head].hh.v.RH = 0;
64 scan_delimiter(cur_list.aux_field.cint + 4, false);
65 scan_delimiter(cur_list.aux_field.cint + 5, false);
70 scan_dimen(false, false, false);
71 mem[cur_list.aux_field.cint + 1].cint = cur_val;
75 mem[cur_list.aux_field.cint + 1].cint = 1073741824L; /* 2^30 */
78 mem[cur_list.aux_field.cint + 1].cint = 0;
84 void math_left_right (void)
89 if((t == 31)&&(cur_group != 16))
93 scan_delimiter(mem_top - 12, false);
96 help1("I'm ignoring a \\right that had no matching \\left.");
107 scan_delimiter(p + 1, false);
111 mem[head].hh.v.RH = p;
119 mem[tail].hh.v.RH = new_noad ();
120 tail = mem[tail].hh.v.RH;
122 mem[tail].hh.b0 = 23;
123 mem[tail + 1].hh.v.RH = 3;
124 mem[tail + 1].hh.v.LH = p;
129 void after_math (void)
147 if((font_params[eqtb[(hash_size + 1837)].hh.v.RH]< 22)||
148 (font_params[eqtb[(hash_size + 1853)].hh.v.RH]< 22)||
149 (font_params[eqtb[(hash_size + 1869)].hh.v.RH]< 22))
151 print_err("Math formula deleted: Insufficient symbol fonts");
152 help3("Sorry, but I can't typeset math unless \\textfont Sorry, but I can't typeset math unless \\textfont 2",
153 "and \\scriptfont 2 and \\scriptscriptfont 2 have and \\scriptfont 2 and \\scriptscriptfont 2 have all",
154 "the \\fontdimen values needed in math symbol the \\fontdimen values needed in math symbol fonts..");
159 else if((font_params[eqtb[(hash_size + 1838)].hh.v.RH]< 13)||
160 (font_params[eqtb[(hash_size + 1854)].hh.v.RH]< 13)||
161 (font_params[eqtb[(hash_size + 1870)].hh.v.RH]< 13))
163 print_err("Math formula deleted: Insufficient extension fonts");
164 help3("Sorry, but I can't typeset math unless \\textfont 3",
165 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
166 "the \\fontdimen values needed in math extension fonts.");
174 if(mode == - (integer) m)
180 print_err("Display math should end with $$");
181 help2("The `$' that I just saw supposedly matches a previous `$$'.",
182 "So I shall assume that you typed `$$' both times.");
188 mlist_penalties = false;
190 a = hpack(mem[mem_top - 3].hh.v.RH, 0, 1);
193 if(save_stack[save_ptr + 0].cint == 1)
196 if((font_params[eqtb[(hash_size + 1837)].hh.v.RH]< 22)||
197 (font_params[eqtb[(hash_size + 1853)].hh.v.RH]< 22)||
198 (font_params[eqtb[(hash_size + 1869)].hh.v.RH]< 22))
200 print_err("Math formula deleted: Insufficient symbol fonts");
201 help3("Sorry, but I can't typeset math unless \\textfont 2",
202 "and \\scriptfont 2 and \\scriptscriptfont 2 have all",
203 "the \\fontdimen values needed in math symbol fonts.");
208 else if((font_params[eqtb[(hash_size + 1838)].hh.v.RH]< 13)||
209 (font_params[eqtb[(hash_size + 1854)].hh.v.RH]< 13)||
210 (font_params[eqtb[(hash_size + 1870)].hh.v.RH]< 13))
212 print_err("Math formula deleted: Insufficient extension fonts");
213 help3("Sorry, but I can't typeset math unless \\textfont 3",
214 "and \\scriptfont 3 and \\scriptscriptfont 3 have all",
215 "the \\fontdimen values needed in math extension fonts.");
227 mem[tail].hh.v.RH = new_math(eqtb[(hash_size + 3731)].cint,
229 tail = mem[tail].hh.v.RH;
233 mlist_penalties =(mode > 0);
235 mem[tail].hh.v.RH = mem[mem_top - 3].hh.v.RH;
236 while(mem[tail].hh.v.RH != 0)tail =
239 mem[tail].hh.v.RH = new_math(eqtb[(hash_size + 3731)].cint,
241 tail = mem[tail].hh.v.RH;
252 print_err("Display math should end with $$");
253 help2("The `$' that I just saw supposedly matches a previous `$$'.",
254 "So I shall assume that you typed `$$' both times.");
260 mlist_penalties = false;
262 p = mem[mem_top - 3].hh.v.RH;
263 adjust_tail = mem_top - 5;
265 p = mem[b + 5].hh.v.RH;
269 z = eqtb[(hash_size + 3744)].cint;
270 s = eqtb[(hash_size + 3745)].cint;
271 if((a == 0)|| danger)
279 q = e + font_info[6 + param_base[eqtb[(hash_size + 1837)].hh.v.RH]].cint;
283 if((e != 0)&&((w - totalshrink[0]+ q <= z)||(totalshrink
284 [1]!= 0)||(totalshrink[2]!= 0)||(totalshrink[3]!= 0)
288 b = hpack(p, z - q, 0);
302 if((e > 0)&&(d < 2 * e))
306 if(!(p >= hi_mem_min))
307 if(mem[p].hh.b0 == 10)
311 mem[tail].hh.v.RH = new_penalty(eqtb[(hash_size + 3174)].cint
313 tail = mem[tail].hh.v.RH;
315 if((d + s <= eqtb[(hash_size + 3743)].cint)|| l)
330 mem[tail].hh.v.RH = new_penalty(10000);
331 tail = mem[tail].hh.v.RH;
336 mem[tail].hh.v.RH = new_param_glue(g1);
337 tail = mem[tail].hh.v.RH;
341 r = new_kern(z - w - e - d);
356 mem[b + 4].cint = s + d;
358 if((a != 0)&&(e == 0)&& ! l)
361 mem[tail].hh.v.RH = new_penalty(10000);
362 tail = mem[tail].hh.v.RH;
364 mem[a + 4].cint = s + z - mem[a + 1].cint;
370 mem[tail].hh.v.RH = mem[mem_top - 5].hh.v.RH;
374 mem[tail].hh.v.RH = new_penalty(eqtb[(hash_size + 3175)].cint
376 tail = mem[tail].hh.v.RH;
380 mem[tail].hh.v.RH = new_param_glue(g2);
381 tail = mem[tail].hh.v.RH;
383 resume_after_display ();
387 void resume_after_display (void)
391 confusion(1163); /* display */
392 return; // abort_flag set
395 prev_graf = prev_graf + 3;
399 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
400 /* was clang = 0; etc in 3.141 new stuff follows */
401 if(eqtb[(hash_size + 3213)].cint <= 0)
403 else if(eqtb[(hash_size + 3213)].cint > 255)
405 else cur_lang = eqtb[(hash_size + 3213)].cint;
407 prev_graf =(norm_min(eqtb[(hash_size + 3214)].cint)* 64 +
408 norm_min(eqtb[(hash_size + 3215)].cint)) * 65536L + cur_lang;
409 /* eqtb ??? hash_size ? hash_size + hash_extra ? norm_min etc */
410 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
413 if(cur_cmd != 10) back_input ();
420 void get_r_token (void)
425 } while(!(cur_tok != 2592));
426 /* if((cur_cs == 0)||(cur_cs > (hash_size + 514))) */ /* 95/Jan/10 */
427 if((cur_cs == 0)||(cur_cs > (hash_size + hash_extra + 514))) {
428 print_err("Missing control sequence inserted");
429 help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.",
430 "I've inserted an inaccessible control sequence so that your",
431 "definition will be completed without mixing me up too badly.",
432 "You can recover graciously from this error, if you're",
433 "careful; see exercise 27.2 in The TeXbook.");
436 /* cur_tok = (hash_size + 4609); */
437 /* cur_tok = (hash_size + 4095 + 514); */
438 cur_tok = (hash_size + hash_extra + 4095 + 514); /* 96/Jan/10 */
444 void trap_zero_glue (void)
446 if((mem[cur_val + 1].cint == 0)&&(mem[cur_val + 2].cint == 0)
447 &&(mem[cur_val + 3].cint == 0))
449 incr(mem[0].hh.v.RH); /* mem[mem_bot]? */ /* mem[null]? */
450 delete_glue_ref(cur_val);
455 void do_register_command_ (small_number a)
464 if((cur_cmd >= 73)&&(cur_cmd <= 76))
472 print_err("You can't use `");
473 print_cmd_chr(cur_cmd, cur_chr);
474 print(683); /* ' after */
476 help1("I'm forgetting what you said and not changing anything.");
482 scan_eight_bit_int ();
485 l = cur_val + (hash_size + 3218);
488 l = cur_val + (hash_size + 3751);
491 l = cur_val + (hash_size + 800);
494 l = cur_val + (hash_size + 1056);
500 scan_optional_equals ();
501 else if(scan_keyword(1200)) /* by */
511 scan_dimen(false, false, false);
514 cur_val = cur_val + eqtb[l].cint;
520 q = new_spec(cur_val);
522 delete_glue_ref(cur_val);
523 mem[q + 1].cint = mem[q + 1].cint + mem[r + 1].cint;
524 if(mem[q + 2].cint == 0)
526 if(mem[q].hh.b0 == mem[r].hh.b0)
527 mem[q + 2].cint = mem[q + 2].cint + mem[r + 2].cint;
528 else if((mem[q].hh.b0 < mem[r].hh.b0)&&(mem[r + 2]
531 mem[q + 2].cint = mem[r + 2].cint;
532 mem[q].hh.b0 = mem[r].hh.b0;
534 if(mem[q + 3].cint == 0)
536 if(mem[q].hh.b1 == mem[r].hh.b1)
537 mem[q + 3].cint = mem[q + 3].cint + mem[r + 3].cint;
538 else if((mem[q].hh.b1 < mem[r].hh.b1)&&(mem[r + 3]
541 mem[q + 3].cint = mem[r + 3].cint;
542 mem[q].hh.b1 = mem[r].hh.b1;
552 cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 2147483647L);
554 else cur_val = mult_and_add(eqtb[l].cint, cur_val, 0, 1073741823L);
556 else cur_val = x_over_n(eqtb[l].cint, cur_val);
558 s = eqtb[l].hh.v.RH; /* l may be used ... */
562 mem[r + 1].cint = mult_and_add(mem[s + 1].cint, cur_val, 0,
563 1073741823L); /* 2^30 - 1 */
564 mem[r + 2].cint = mult_and_add(mem[s + 2].cint, cur_val, 0,
565 1073741823L); /* 2^30 - 1 */
566 mem[r + 3].cint = mult_and_add(mem[s + 3].cint, cur_val, 0,
567 1073741823L); /* 2^30 - 1 */
570 mem[r + 1].cint = x_over_n(mem[s + 1].cint, cur_val);
571 mem[r + 2].cint = x_over_n(mem[s + 2].cint, cur_val);
572 mem[r + 3].cint = x_over_n(mem[s + 3].cint, cur_val);
578 print_err("Arithmetic overflow");
579 help2("I can't carry out that multiplication or division,",
580 "since the result is out of range.");
586 geq_word_define(l, cur_val);
587 else eq_word_define(l, cur_val);
592 geq_define(l, 117, cur_val);
593 else eq_define(l, 117, cur_val);
596 /* called only from itex.c */
598 void alter_aux (void)
601 if(cur_chr != abs(mode)) {
602 report_illegal_case ();
606 scan_optional_equals ();
609 scan_dimen(false, false, false);
610 cur_list.aux_field.cint = cur_val;
614 if((cur_val <= 0)||(cur_val > 32767))
616 print_err("Bad space factor");
617 help1("I allow only values in the range 1..32767 here.");
620 else space_factor = cur_val;
625 void alter_prev_graf (void)
628 nest[nest_ptr]= cur_list;
630 while(abs(nest[p].mode_field)!= 1)decr(p);
631 scan_optional_equals ();
636 print_esc("prevgraf");
637 help1("I allow only nonnegative values here.");
642 nest[p].pg_field = cur_val;
643 cur_list = nest[nest_ptr];
647 void alter_page_so_far (void)
651 scan_optional_equals ();
652 scan_dimen(false, false, false);
653 page_so_far[c]= cur_val;
656 void alter_integer (void)
660 scan_optional_equals ();
662 if(c == 0)dead_cycles = cur_val;
663 else insert_penalties = cur_val;
666 void alter_box_dimen (void)
671 scan_eight_bit_int ();
673 scan_optional_equals ();
674 scan_dimen(false, false, false);
675 if(eqtb[(hash_size + 1578) + b].hh.v.RH != 0)
676 mem[eqtb[(hash_size + 1578) + b].hh.v.RH + c].cint = cur_val;
679 void new_font_(small_number a)
683 internal_font_number f;
686 str_number flushablestring;
687 if(job_name == 0)open_log_file ();
690 if(u >= 514) /* if u >= hash_base then t <- text(u); p.1257 */
692 else if(u >= 257) /* if u >= single_base then ... */
693 /* if u=null_cs then t:="FONT"@+else t:=u-single_base */
696 else t = u - 257; /* else t <- u - single_base */
698 old_setting = selector;
700 print(1213); /* FONT */
702 selector = old_setting;
704 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
705 #ifdef ALLOCATESTRING
706 if(pool_ptr + 1 > current_pool_size)
707 str_pool = realloc_str_pool (increment_pool_size);
708 if(pool_ptr + 1 > current_pool_size){ /* 94/Jan/24 */
709 overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/9 */
710 return; // abort_flag set
713 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
714 if(pool_ptr + 1 > pool_size){
715 overflow(257, pool_size - init_pool_ptr); /* pool size */
716 return; // abort_flag set
722 if((a >= 4)) geq_define(u, 87, 0);
723 else eq_define(u, 87, 0);
724 scan_optional_equals ();
728 name_in_progress = true;
729 if(scan_keyword(1214)) /* at */
731 scan_dimen(false, false, false);
733 if((s <= 0)||(s >= 134217728L)) /* 2^27 */
735 print_err("Improper `at' size(");
737 print(1217); /* pt), replaced by 10pt */
738 help2("I can only handle fonts at positive sizes that are",
739 "less than 2048pt, so I've changed what you said to 10pt.");
741 s = 10 * 65536L; /* 10pt */
744 else if(scan_keyword(1215)) /* scaled */
747 s = - (integer) cur_val;
748 if((cur_val <= 0)||(cur_val > 32768L)) {
749 print_err("Illegal magnification has been changed to 1000");
750 help1("The magnification ratio must be between 1 and 32768.");
756 name_in_progress = false;
758 flushablestring = str_ptr - 1;
759 if (trace_flag) { /* debugging stuff only 98/Oct/5 */
760 int i, k1, k2, l1, l2;
762 k1 = str_start[cur_area];
763 k2 = str_start[cur_name];
764 l1 = str_start[cur_area + 1] - str_start[cur_area];
765 l2 = str_start[cur_name + 1] - str_start[cur_name];
767 show_line("FONT ", 0);
768 for (i = 0; i < l1; i++) {
769 *sch++ = str_pool[i+k1];
771 for (i = 0; i < l2; i++) {
772 *sch++ = str_pool[i+k2];
776 show_line(log_line, 0);
778 /* if (ignore_frozen) goto lab69; */ /* 98/Oct/5 */
780 /* paragraph 1260 for f <- fontbase+1 to font_ptr do */
782 register integer for_end;
787 /* if str_eq_str(font_name[f],cur_name) ^ str_eq_str(font_area[f],cur_area) */
788 if(str_eq_str(font_name[f], cur_name)&&
789 str_eq_str(font_area[f], cur_area)) {
790 if(cur_name == flushablestring){
793 pool_ptr = str_start[str_ptr];
795 cur_name = font_name[f];
797 /* if (ignore_frozen) continue; */ /* 98/Oct/5 */
798 if(s > 0) { /* if pt size was specified */
799 if(s == font_size[f]){
800 /* if (ignore_frozen == 0) */
801 if (ignore_frozen == 0 || f > frozenfontptr) { /* 99/Mar/26 */
803 sprintf(log_line, "SKIPPING %ld ", s);
804 show_line(log_line, 0);
810 /* else if font_size[f] = xn_over_d(font_dsize[f],-s,1000) then goto common_ending */
811 else if(font_size[f]== xn_over_d(font_dsize[f],
812 - (integer) s, 1000)) { /* if using design size */
813 /* if (ignore_frozen == 0) */
814 if (ignore_frozen == 0 || f > frozenfontptr) { /* 99/Mar/26 */
816 sprintf(log_line, "SKIPPING %ld ", s);
817 show_line(log_line, 0);
823 while(f++ < for_end);
826 /* lab69: */ /* 98/Oct/5 */
827 /* end of paragraph 1257 */
828 if (trace_flag) show_line("READING ", 0); /* debugging only */
829 f = read_font_info(u, cur_name, cur_area, s);
831 /* common_ending: equiv[u] <- f; */ /* use existing font info */
834 sprintf(log_line, "NEW FONT %d ", f); /* debugging only */
835 show_line(log_line, 0);
838 /* eqtb[(hash_size + 524) + f]= eqtb[u];*/ /* eqtb[frozen_null+font+f] */
839 eqtb[(hash_size + hash_extra + 524) + f]= eqtb[u]; /* 96/Jan/10 */
840 #ifdef SHORTHASH /* debugging only 1996/Jan/20 */
842 sprintf(log_line, "ERROR: %s too large %d\n", "hash_used", t);
843 show_line(log_line, 1);
846 /* hash[(hash_size + 524) + f].v.RH = t; */
847 hash[(hash_size + hash_extra + 524) + f].v.RH = t; /* 96/Jan/10 */
850 void new_interaction (void)
853 interaction = cur_chr;
854 if(interaction == 0) selector = 16;
856 if(log_opened) selector = selector + 2;
859 void do_assignments (void)
864 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
867 set_box_allowed = false;
869 set_box_allowed = true;
873 void open_or_close_in (void)
878 scan_four_bit_int ();
882 (void) a_close(read_file[n]);
887 scan_optional_equals ();
889 pack_file_name(cur_name, cur_area, cur_ext);
890 /* *** some changes in following in 3.14159 *** */
891 /* if current extension is *not* empty, try to open using name as is */
892 /* string 335 is "" the empty string */
893 if((cur_ext != 335)&& a_open_in(read_file[n], TEXINPUTPATH))
895 /* we get here if extension is "", or file with extension failed to open */
896 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
897 /* string 785 is .tex */
898 else if((cur_ext != 785)&&(name_length + 5 < PATHMAX)&&
899 /* *** some changes in above file name handling *** */
900 /* (! extensionirrelevantp(name_of_file, "tex"))) */
901 (! extensionirrelevantp(name_of_file, name_length, "tex")))
903 name_of_file[name_length + 1]= 46; /* .tex */
904 name_of_file[name_length + 2]= 116;
905 name_of_file[name_length + 3]= 101;
906 name_of_file[name_length + 4]= 120;
907 name_of_file[name_length + 5]= 32;
908 name_length = name_length + 4;
909 if(a_open_in(read_file[n], TEXINPUTPATH))
912 /* more changes here in 3.14159 *** */
913 name_length = name_length - 4; /* remove ".tex" again */
914 name_of_file[name_length + 1]= 32; /* ' ' */
915 /* string 335 is "" the empty string */
916 if((cur_ext == 335)&& a_open_in(read_file[n], TEXINPUTPATH))
918 else if(maketextex () && a_open_in(read_file[n], TEXINPUTPATH))
925 void issue_message (void)
931 mem[mem_top - 12].hh.v.RH = scan_toks(false, true);
932 old_setting = selector;
935 selector = old_setting;
938 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
939 #ifdef ALLOCATESTRING
940 if(pool_ptr + 1 > current_pool_size)
941 str_pool = realloc_str_pool (increment_pool_size);
942 if(pool_ptr + 1 > current_pool_size){ /* in case it failed 94/Jan/24 */
943 overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */
944 return; // abort_flag set
947 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
948 if(pool_ptr + 1 > pool_size){
949 overflow(257, pool_size - init_pool_ptr); /* pool size */
950 return; // abort_flag set
957 if(term_offset +(str_start[s + 1]- str_start[s])> max_print_line -
960 else if((term_offset > 0)||(file_offset > 0))
961 print_char(32); /* */
970 if(eqtb[(hash_size + 1321)].hh.v.RH != 0)
972 else if(long_help_seen)
973 help1("(That was another \\errmessage.)");
977 long_help_seen = true;
978 help4("This error message was generated by an \\errmessage",
979 "command, so I can't give any explicit help.",
980 "Pretend that you're Hercule Poirot: Examine all clues,",
981 "and deduce the truth by order and method.");
984 use_err_help = false;
988 pool_ptr = str_start[str_ptr];
992 void shift_case (void)
999 p = scan_toks(false, false);
1000 p = mem[def_ref].hh.v.RH;
1001 while(p != 0){ /* while p <> null ... p.1288 */
1002 t = mem[p].hh.v.LH; /* t <- info(p) p.1289 */
1004 if(t < 4095 + 257) /* 4095 + 257 = cs_tokenflag + single_base */
1007 if(eqtb[b + c].hh.v.RH != 0)
1008 mem[p].hh.v.LH = t - c + eqtb[b + c].hh.v.RH;
1012 begin_token_list(mem[def_ref].hh.v.RH, 3);
1014 mem[def_ref].hh.v.RH = avail;
1023 void show_whatever (void)
1029 begin_diagnostic ();
1035 scan_eight_bit_int ();
1036 begin_diagnostic ();
1037 print_nl("> \box"); /* */
1039 print_char(61); /* = */
1040 if(eqtb[(hash_size + 1578) + cur_val].hh.v.RH == 0)
1041 print(407); /* void */
1042 else show_box(eqtb[(hash_size + 1578) + cur_val].hh.v.RH);
1048 if(interaction == 3)
1050 print_nl("> "); /* */
1054 print_char(61); /* = */
1063 if(interaction == 3)
1065 print_nl(" > "); /* */
1066 token_show(mem_top - 3);
1067 flush_list(mem[mem_top - 3].hh.v.RH);
1072 end_diagnostic(true);
1075 if(eqtb[(hash_size + 3192)].cint <= 0)
1078 print(1250); /* (see the transcript file) */
1081 lab50: if(interaction < 3)
1086 else if(eqtb[(hash_size + 3192)].cint > 0)
1088 help3("This isn't an error message; I'm just \\showing something.",
1089 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1090 "\\showthe\\count10, \\showbox255, \\showlists).");
1093 help5("This isn't an error message; I'm just \\showing something.",
1094 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1095 "\\showthe\\count10, \\showbox255, \\showlists).",
1096 "And type `I\\tracingonline=1\\show...' to show boxes and",
1097 "lists on your terminal as well as in the transcript file.");
1102 void new_whatsit_(small_number s, small_number w)
1108 mem[tail].hh.v.RH = p;
1112 void new_write_whatsit_(small_number w)
1114 new_whatsit(cur_chr, w);
1116 scan_four_bit_int ();
1120 if(cur_val < 0)cur_val = 17;
1121 else if(cur_val > 15)cur_val = 16;
1123 mem[tail + 1].hh.v.LH = cur_val;
1126 void do_extension (void)
1128 /* integer i, j, k; */
1130 /* halfword p, q, r; */
1135 new_write_whatsit(3);
1136 scan_optional_equals ();
1138 mem[tail + 1].hh.v.RH = cur_name;
1139 mem[tail + 2].hh.v.LH = cur_area;
1140 mem[tail + 2].hh.v.RH = cur_ext;
1146 new_write_whatsit(2);
1148 p = scan_toks(false, false);
1149 mem[tail + 1].hh.v.RH = def_ref;
1154 new_write_whatsit(2);
1155 mem[tail + 1].hh.v.RH = 0;
1161 mem[tail + 1].hh.v.LH = 0;
1162 p = scan_toks(false, true);
1163 mem[tail + 1].hh.v.RH = def_ref;
1169 if((cur_cmd == 59)&&(cur_chr <= 2))
1174 flush_node_list(tail);
1182 if(abs(mode)!= 102){
1183 report_illegal_case ();
1189 if(cur_val <= 0) clang = 0;
1190 else if(cur_val > 255)
1192 else clang = cur_val;
1193 mem[tail + 1].hh.v.RH = clang;
1194 mem[tail + 1].hh.b0 = norm_min(eqtb[(hash_size + 3214)].cint)
1196 mem[tail + 1].hh.b1 = norm_min(eqtb[(hash_size + 3215)].cint)
1202 confusion(1285); /* display */
1203 return; // abort_flag set
1209 void fix_language (void)
1212 int l; /* 95/Jan/7 */
1213 if(eqtb[(hash_size + 3213)].cint <= 0)
1215 else if(eqtb[(hash_size + 3213)].cint > 255)
1217 else l = eqtb[(hash_size + 3213)].cint;
1221 mem[tail + 1].hh.v.RH = l;
1223 mem[tail + 1].hh.b0 = norm_min(eqtb[(hash_size + 3214)].cint);
1224 mem[tail + 1].hh.b1 = norm_min(eqtb[(hash_size + 3215)].cint);
1228 void handle_right_brace (void)
1240 print_err("Too many }'s");
1241 help2("You've closed more groups than you opened.",
1242 "Such booboos are generally harmless, so keep going.");
1249 extra_right_brace ();
1256 adjust_tail = mem_top - 5;
1275 q = eqtb[(hash_size + 792)].hh.v.RH;
1276 incr(mem[q].hh.v.RH);
1277 d = eqtb[(hash_size + 3736)].cint;
1278 f = eqtb[(hash_size + 3205)].cint;
1281 p = vpackage(mem[head].hh.v.RH, 0, 1,
1282 1073741823L); /* 2^30 - 1 */
1284 if(save_stack[save_ptr + 0].cint < 255)
1287 mem[tail].hh.v.RH = get_node(5);
1288 tail = mem[tail].hh.v.RH;
1290 mem[tail].hh.b0 = 3;
1291 mem[tail].hh.b1 = save_stack[save_ptr + 0].cint;
1292 mem[tail + 3].cint = mem[p + 3].cint + mem[p +
1294 mem[tail + 4].hh.v.LH = mem[p + 5].hh.v.RH;
1295 mem[tail + 4].hh.v.RH = q;
1296 mem[tail + 2].cint = d;
1297 mem[tail + 1].cint = f;
1302 mem[tail].hh.v.RH = get_node(2);
1303 tail = mem[tail].hh.v.RH;
1305 mem[tail].hh.b0 = 5;
1306 mem[tail].hh.b1 = 0;
1307 mem[tail + 1].cint = mem[p + 5].hh.v.RH;
1318 if((cur_input.loc_field != 0)||((cur_input.index_field != 6)&&(
1319 cur_input.index_field != 3)))
1321 print_err("Unbalanced output routine");
1322 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1323 "I can't handle that very well; good luck.");
1327 } while(!(cur_input.loc_field == 0));
1332 output_active = false;
1333 insert_penalties = 0;
1334 if(eqtb[(hash_size + 1833)].hh.v.RH != 0)
1336 print_err("Output routine didn't use all of ");
1339 help3("Your \\output commands should empty \\box255,",
1340 "e.g., by saying `\\ship_out\\box255'.",
1341 "Proceed; I'll discard its present contents.");
1346 mem[page_tail].hh.v.RH = mem[head].hh.v.RH;
1349 if(mem[mem_top - 2].hh.v.RH != 0)
1351 if(mem[mem_top - 1].hh.v.RH == 0)
1352 nest[0].tail_field = page_tail;
1353 mem[page_tail].hh.v.RH = mem[mem_top - 1].hh.v.RH;
1354 mem[mem_top - 1].hh.v.RH = mem[mem_top - 2].hh.v.RH;
1355 mem[mem_top - 2].hh.v.RH = 0;
1356 page_tail = mem_top - 2;
1363 build_discretionary ();
1366 /* align_group: begin back_input; cur_tok:=cs_token_flag+frozen_cr; */
1369 /* cur_tok = (hash_size + 4610); */
1370 /* cur_tok = (hash_size + 4095 + 515); */
1371 cur_tok = (hash_size + hash_extra + 4095 + 515);
1372 print_err("Missing ");
1374 print(623); /* inserted */
1375 help1("I'm guessing that you meant to end an alignment here.");
1390 save_ptr = save_ptr - 2;
1391 p = vpackage(mem[head].hh.v.RH, save_stack[
1392 save_ptr + 1].cint, save_stack[save_ptr + 0].cint,
1393 1073741823L); /* 2^30 - 1 */
1396 mem[tail].hh.v.RH = new_noad ();
1397 tail = mem[tail].hh.v.RH;
1399 mem[tail].hh.b0 = 29;
1400 mem[tail + 1].hh.v.RH = 2;
1401 mem[tail + 1].hh.v.LH = p;
1411 mem[save_stack[save_ptr + 0].cint].hh.v.RH = 3;
1413 mem[save_stack[save_ptr + 0].cint].hh.v.LH = p;
1415 if(mem[p].hh.v.RH == 0)
1416 if(mem[p].hh.b0 == 16)
1418 if(mem[p + 3].hh.v.RH == 0)
1419 if(mem[p + 2].hh.v.RH == 0)
1421 mem[save_stack[save_ptr + 0].cint].hh = mem[p + 1].hh;
1425 else if(mem[p].hh.b0 == 28)
1426 if(save_stack[save_ptr + 0].cint == tail + 1)
1427 if(mem[tail].hh.b0 == 16)
1430 while(mem[q].hh.v.RH != tail)q = mem[q].hh
1440 confusion(1041); /* rightbrace */
1441 return; // abort_flag set
1447 /* main control loop */
1448 void main_control (void)
1449 {/* 60 21 70 80 90 91 92 95 100 101 110 111 112 120 10 */
1451 integer bSuppress; /* 199/Jan/5 */
1453 if(eqtb[(hash_size + 1319)].hh.v.RH != 0)/* everyjob */
1454 begin_token_list(eqtb[(hash_size + 1319)].hh.v.RH, 12);
1457 get_x_token (); /* big_switch */
1460 if(OK_to_interrupt){
1464 pause_for_instructions ();
1471 if(panicking)check_mem(false);
1473 if(eqtb[(hash_size + 3199)].cint > 0)
1474 show_cur_cmd_chr ();
1476 /* the big switch --- don't bother to test abort_flag ??? */
1477 switch(abs(mode)+ cur_cmd){
1493 if((cur_cmd == 11)||(cur_cmd == 12)||(cur_cmd == 68)||(
1495 cancel_boundary = true;
1500 if(space_factor == 1000)goto lab120;
1523 } while(!(cur_cmd != 10));
1528 if(its_all_over ())return;
1543 report_illegal_case ();
1586 insert_dollar_sign ();
1593 mem[tail].hh.v.RH = scan_rule_spec ();
1594 tail = mem[tail].hh.v.RH;
1597 cur_list.aux_field.cint = ignore_depth;
1598 else if(abs(mode)== 102)
1599 space_factor = 1000;
1626 if(cur_group == 14) unsave ();
1632 handle_right_brace ();
1639 scan_dimen(false, false, false);
1640 if(t == 0)scan_box(cur_val);
1641 else scan_box(- (integer) cur_val);
1647 /* scan_box(leader_flag-a_leaders+cur_chr); */
1648 scan_box(1073742237L + cur_chr); /* 2^30 + 513 - 100 ? */
1656 new_graf(cur_chr > 0);
1682 normal_paragraph ();
1690 if(align_state < 0){
1711 begin_insert_or_adjust ();
1734 append_italic_correction ();
1738 mem[tail].hh.v.RH = new_kern(0);
1739 tail = mem[tail].hh.v.RH;
1744 append_discretionary ();
1773 if(cur_group == 15)init_align ();
1791 if(cur_group == 15) start_eq_no ();
1797 mem[tail].hh.v.RH = new_noad ();
1798 tail = mem[tail].hh.v.RH;
1801 scan_math(tail + 1);
1807 set_math_char(eqtb[(hash_size + 2907) + cur_chr].hh.v.RH);
1813 set_math_char(eqtb[(hash_size + 2907) + cur_chr].hh.v.RH);
1818 scan_fifteen_bit_int ();
1819 set_math_char(cur_val);
1823 set_math_char(cur_chr);
1827 scan_twenty_seven_bit_int ();
1828 set_math_char(cur_val / 4096);
1829 /* set_math_char(cur_val >> 12); */
1835 mem[tail].hh.v.RH = new_noad ();
1836 tail = mem[tail].hh.v.RH;
1838 mem[tail].hh.b0 = cur_chr;
1839 scan_math(tail + 1);
1843 math_limit_switch ();
1854 scan_spec(12, false);
1855 normal_paragraph ();
1858 cur_list.aux_field.cint = ignore_depth;
1859 if(eqtb[(hash_size + 1318)].hh.v.RH != 0)/* everyvbox */
1860 begin_token_list(eqtb[(hash_size + 1318)].hh.v.RH, 11);
1865 mem[tail].hh.v.RH = new_style(cur_chr);
1866 tail = mem[tail].hh.v.RH;
1872 mem[tail].hh.v.RH = new_glue(0);
1873 tail = mem[tail].hh.v.RH;
1875 mem[tail].hh.b1 = 98;
1892 if(cur_group == 15)after_math ();
1985 prefixed_command ();
1992 after_token = cur_tok;
2000 save_for_after(cur_tok);
2006 open_or_close_in ();
2028 } /* end of big switch */
2029 goto lab60; /* main_loop */
2032 main_s = eqtb[(hash_size + 2651) + cur_chr].hh.v.RH;
2034 space_factor = 1000;
2035 else if(main_s < 1000)
2038 space_factor = main_s;
2040 else if(space_factor < 1000)
2041 space_factor = 1000;
2042 else space_factor = main_s;
2043 main_f = eqtb[(hash_size + 1834)].hh.v.RH;
2044 bchar = font_bchar[main_f];
2045 false_bchar = font_false_bchar[main_f];
2047 if(eqtb[(hash_size + 3213)].cint != clang)
2052 lig_stack = get_avail ();
2054 avail = mem[lig_stack].hh.v.RH;
2055 mem[lig_stack].hh.v.RH = 0;
2062 mem[lig_stack].hh.b0 = main_f;
2064 mem[lig_stack].hh.b1 = cur_l;
2068 /* begin cancel_boundary:=false; main_k:=non_address; l.20093 */
2069 cancel_boundary = false;
2070 /* main_k:=non_address 3.14159 */
2071 /* main_k = font_mem_size; */ /* OK ? 1993/Nov/29 */
2072 main_k = non_address; /* i.e. --- 1995/Jan/15 3.14159 */
2074 else main_k = bchar_label[main_f];
2075 /* if main_k=non_address then goto main_loop_move+2; l.20096 */
2076 /* if(main_k == font_mem_size) */
2077 if(main_k == non_address) /* i.e. 0 --- 1995/Jan/15 */
2078 /* cur_r:=cur_l; cur_l:=non_char; */
2081 cur_l = 256; /* cur_l:=non_char; */
2082 /* goto main_lig_loop+1; l.20071 */
2085 /* main_loop_wrapup:@<Make a ligature node, if |ligature_present|;
2086 insert a null discretionary, if appropriate@>; */
2087 /* @d wrapup(#)==if cur_l<non_char then */
2088 /* main_loop_wrapup */
2089 lab80: if(cur_l < 256)
2091 /* begin if character(tail)=qi(hyphen_char[main_f]) then
2092 if link(cur_q)>null then ... l.20107 */
2093 if(mem[tail].hh.b1 == hyphen_char[main_f])
2094 /* if(mem[cur_q].hh.v.RH > 0) */ /* NO! */
2095 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX l.20107 */
2097 if(ligature_present)
2099 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2102 mem[main_p].hh.b1 = 2;
2108 incr(mem[main_p].hh.b1);
2111 mem[cur_q].hh.v.RH = main_p;
2113 ligature_present = false;
2115 /* if ins_disc then l.20110 */
2119 /* if mode>0 then tail_append(new_disc); l.20112 */
2122 mem[tail].hh.v.RH = new_disc ();
2123 tail = mem[tail].hh.v.RH;
2128 /* main_loop_move */
2130 if(lig_stack == 0) goto lab21;
2132 cur_l = mem[lig_stack].hh.b1;
2135 if(!(lig_stack >= hi_mem_min)) goto lab95;
2137 lab92: if((cur_chr < font_bc[main_f])||(cur_chr > font_ec[main_f]))
2139 char_warning(main_f, cur_chr);
2141 mem[lig_stack].hh.v.RH = avail;
2150 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2151 if(!(main_i.b0 > 0))
2153 char_warning(main_f, cur_chr);
2155 mem[lig_stack].hh.v.RH = avail;
2165 mem[tail].hh.v.RH = lig_stack;
2166 tail = mem[tail].hh.v.RH;
2169 /* main_loop_lookahead */
2172 if(cur_cmd == 11) goto lab101;
2173 if(cur_cmd == 12) goto lab101;
2174 if(cur_cmd == 68) goto lab101;
2176 if(cur_cmd == 11) goto lab101;
2177 if(cur_cmd == 12) goto lab101;
2178 if(cur_cmd == 68) goto lab101;
2184 if(cur_cmd == 65) bchar = 256;
2189 lab101: main_s = eqtb[(hash_size + 2651) + cur_chr].hh.v.RH;
2191 space_factor = 1000;
2192 else if(main_s < 1000)
2195 space_factor = main_s;
2197 else if(space_factor < 1000)
2198 space_factor = 1000;
2199 else space_factor = main_s;
2203 lig_stack = get_avail ();
2205 avail = mem[lig_stack].hh.v.RH;
2206 mem[lig_stack].hh.v.RH = 0;
2213 mem[lig_stack].hh.b0 = main_f;
2215 mem[lig_stack].hh.b1 = cur_r;
2216 if(cur_r == false_bchar)
2219 // main_lig_loop:@<If there's a ligature/kern command relevant to |cur_l| and
2220 // |cur_r|, adjust the text appropriately; exit to |main_loop_wrapup|@>;
2222 /* if char_tag(main_i)<>lig_tag then goto main_loop_wrapup; */
2223 if(((main_i.b2)% 4)!= 1)
2225 /* main_k:=lig_kern_start(main_f)(main_i); */
2226 main_k = lig_kern_base[main_f]+ main_i.b3;
2227 /* main_j:=font_info[main_k].qqqq; */
2228 main_j = font_info[main_k].qqqq;
2229 /* if skip_byte(main_j)<=stop_flag then goto main_lig_loop+2; */
2230 if(main_j.b0 <= 128)goto lab112;
2231 /* main_k:=lig_kern_restart(main_f)(main_j); */
2232 main_k = lig_kern_base[main_f]+ 256 * main_j.b2 + main_j.b3 + 32768L - 256 *
2235 /* main_lig_loop+1:main_j:=font_info[main_k].qqqq; */
2236 lab111: main_j = font_info[main_k].qqqq;
2238 /* main_lig_loop+2:if next_char(main_j)=cur_r then l.20184 */
2240 /* provide for suppression of f-ligatures 99/Jan/5 */
2242 if(suppress_f_ligs && main_j.b1 == cur_r && main_j.b2 == 0) {
2247 /* if(main_j.b1 == cur_r)*/
2248 if(main_j.b1 == cur_r && bSuppress == 0) /* 99/Jan/5 */
2249 /* if skip_byte(main_j)<=stop_flag then l.20185 */
2250 // @<Do ligature or kern command, returning to |main_lig_loop|
2251 // or |main_loop_wrapup| or |main_loop_move|@>;
2252 if(main_j.b0 <= 128)
2254 /* begin if op_byte(main_j)>=kern_flag then l.20225 */
2255 if(main_j.b2 >= 128)
2257 /* @d wrapup(#)==if cur_l<non_char then */
2260 /* if character(tail)=qi(hyphen_char[main_f]) then if link(cur_q)>null */
2261 if(mem[tail].hh.b1 == hyphen_char[main_f])
2262 /* if(mem[cur_q].hh.v.RH > 0) */ /* 94/Mar/22 ?????????????? */
2263 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX l.20107l.20186 */
2265 /* if ligature_present then pack_lig(#); */
2266 if(ligature_present)
2268 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2271 mem[main_p].hh.b1 = 2;
2277 incr(mem[main_p].hh.b1);
2280 mem[cur_q].hh.v.RH = main_p;
2282 ligature_present = false;
2289 mem[tail].hh.v.RH = new_disc ();
2290 tail = mem[tail].hh.v.RH;
2295 mem[tail].hh.v.RH = new_kern(font_info[kern_base[
2296 main_f]+ 256 * main_j.b2 + main_j.b3].cint);
2297 tail = mem[tail].hh.v.RH;
2301 /* begin if cur_l=non_char then lft_hit:=true; */
2304 else if(lig_stack == 0)
2308 pause_for_instructions ();
2316 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2317 ligature_present = true;
2326 lig_stack = new_lig_item(cur_r);
2329 else if((lig_stack >= hi_mem_min))
2332 lig_stack = new_lig_item(cur_r);
2333 mem[lig_stack + 1].hh.v.RH = main_p;
2335 else mem[lig_stack].hh.b1 = cur_r;
2342 lig_stack = new_lig_item(cur_r);
2343 mem[lig_stack].hh.v.RH = main_p;
2349 if(cur_l < 256) /* if cur_l<non_char then */
2350 /* begin if character(tail)=qi(hyphen_char[main_f]) then if link(cur_q)>null
2353 if(mem[tail].hh.b1 == hyphen_char[main_f])
2354 /* if(mem[cur_q].hh.v.RH > 0) */ /* 94/Mar/22 */
2355 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX ???????????? */
2357 if(ligature_present)
2359 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2362 mem[main_p].hh.b1 = 2;
2367 incr(mem[main_p].hh.b1);
2369 } */ /* removed 99/Jan/6 */
2370 mem[cur_q].hh.v.RH = main_p;
2372 ligature_present = false;
2379 mem[tail].hh.v.RH = new_disc ();
2380 tail = mem[tail].hh.v.RH;
2386 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2387 ligature_present = true;
2393 ligature_present = true;
2405 main_k = bchar_label[main_f];
2411 if(main_j.b0 >= 128)
2413 main_k = main_k + main_j.b0 + 1;
2418 lab95: main_p = mem[lig_stack + 1].hh.v.RH;
2419 /* if main_p>null then tail_append(main_p); l.20137 */
2420 /* if(main_p > 0) */ /* 92/Mar/22 */
2421 if(main_p != 0) /* BUG FIX */
2423 mem[tail].hh.v.RH = main_p;
2424 tail = mem[tail].hh.v.RH;
2426 temp_ptr = lig_stack;
2427 lig_stack = mem[temp_ptr].hh.v.RH;
2428 free_node(temp_ptr, 2);
2429 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2430 ligature_present = true;
2432 /* if main_p>null then goto main_loop_lookahead l.20142 */
2433 /* if(main_p > 0) */ /* 94/Mar/2 */
2434 if(main_p != 0) /* BUG FIX */
2437 else cur_r = mem[lig_stack].hh.b1;
2440 /* append_normal_space */
2441 lab120: if(eqtb[(hash_size + 794)].hh.v.RH == 0)
2444 main_p = font_glue[eqtb[(hash_size + 1834)].hh.v.RH];
2447 main_p = new_spec(0);
2448 main_k = param_base[eqtb[(hash_size + 1834)].hh.v.RH]+ 2;
2449 mem[main_p + 1].cint = font_info[main_k].cint;
2450 mem[main_p + 2].cint = font_info[main_k + 1].cint;
2451 mem[main_p + 3].cint = font_info[main_k + 2].cint;
2452 font_glue[eqtb[(hash_size + 1834)].hh.v.RH]= main_p;
2455 temp_ptr = new_glue(main_p);
2457 else temp_ptr = new_param_glue(12);
2458 mem[tail].hh.v.RH = temp_ptr;
2461 } /* end of main_control */
2462 /* give_err_help etc followed here in the old tex8.c */