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_string("' 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.");
581 /* 423 in tex82.bug */
582 if (p >= 2) delete_glue_ref(cur_val);
588 geq_word_define(l, cur_val);
589 else eq_word_define(l, cur_val);
594 geq_define(l, 117, cur_val);
595 else eq_define(l, 117, cur_val);
598 /* called only from itex.c */
600 void alter_aux (void)
603 if(cur_chr != abs(mode)) {
604 report_illegal_case ();
608 scan_optional_equals ();
611 scan_dimen(false, false, false);
612 cur_list.aux_field.cint = cur_val;
616 if((cur_val <= 0)||(cur_val > 32767))
618 print_err("Bad space factor");
619 help1("I allow only values in the range 1..32767 here.");
622 else space_factor = cur_val;
627 void alter_prev_graf (void)
630 nest[nest_ptr]= cur_list;
632 while(abs(nest[p].mode_field)!= 1)decr(p);
633 scan_optional_equals ();
638 print_esc("prevgraf");
639 help1("I allow only nonnegative values here.");
644 nest[p].pg_field = cur_val;
645 cur_list = nest[nest_ptr];
649 void alter_page_so_far (void)
653 scan_optional_equals ();
654 scan_dimen(false, false, false);
655 page_so_far[c]= cur_val;
658 void alter_integer (void)
662 scan_optional_equals ();
664 if(c == 0)dead_cycles = cur_val;
665 else insert_penalties = cur_val;
668 void alter_box_dimen (void)
673 scan_eight_bit_int ();
675 scan_optional_equals ();
676 scan_dimen(false, false, false);
677 if(eqtb[(hash_size + 1578) + b].hh.v.RH != 0)
678 mem[eqtb[(hash_size + 1578) + b].hh.v.RH + c].cint = cur_val;
681 void new_font_(small_number a)
685 internal_font_number f;
688 str_number flushablestring;
689 if(job_name == 0)open_log_file ();
692 if(u >= 514) /* if u >= hash_base then t <- text(u); p.1257 */
694 else if(u >= 257) /* if u >= single_base then ... */
695 /* if u=null_cs then t:="FONT"@+else t:=u-single_base */
698 else t = u - 257; /* else t <- u - single_base */
700 old_setting = selector;
702 print_string("FONT");
704 selector = old_setting;
706 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
707 #ifdef ALLOCATESTRING
708 if(pool_ptr + 1 > current_pool_size)
709 str_pool = realloc_str_pool (increment_pool_size);
710 if(pool_ptr + 1 > current_pool_size){ /* 94/Jan/24 */
711 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */
712 return; // abort_flag set
715 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
716 if(pool_ptr + 1 > pool_size){
717 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
718 return; // abort_flag set
724 if((a >= 4)) geq_define(u, 87, 0);
725 else eq_define(u, 87, 0);
726 scan_optional_equals ();
730 name_in_progress = true;
731 if(scan_keyword(1214)) /* at */
733 scan_dimen(false, false, false);
735 if((s <= 0)||(s >= 134217728L)) /* 2^27 */
737 print_err("Improper `at' size(");
739 print_string("pt), replaced by 10pt");
740 help2("I can only handle fonts at positive sizes that are",
741 "less than 2048pt, so I've changed what you said to 10pt.");
743 s = 10 * 65536L; /* 10pt */
746 else if(scan_keyword(1215)) /* scaled */
749 s = - (integer) cur_val;
750 if((cur_val <= 0)||(cur_val > 32768L)) {
751 print_err("Illegal magnification has been changed to 1000");
752 help1("The magnification ratio must be between 1 and 32768.");
758 name_in_progress = false;
760 flushablestring = str_ptr - 1;
761 if (trace_flag) { /* debugging stuff only 98/Oct/5 */
762 int i, k1, k2, l1, l2;
764 k1 = str_start[cur_area];
765 k2 = str_start[cur_name];
766 l1 = str_start[cur_area + 1] - str_start[cur_area];
767 l2 = str_start[cur_name + 1] - str_start[cur_name];
769 show_line("FONT ", 0);
770 for (i = 0; i < l1; i++) {
771 *sch++ = str_pool[i+k1];
773 for (i = 0; i < l2; i++) {
774 *sch++ = str_pool[i+k2];
778 show_line(log_line, 0);
780 /* if (ignore_frozen) goto lab69; */ /* 98/Oct/5 */
782 /* paragraph 1260 for f <- fontbase+1 to font_ptr do */
784 register integer for_end;
789 /* if str_eq_str(font_name[f],cur_name) ^ str_eq_str(font_area[f],cur_area) */
790 if(str_eq_str(font_name[f], cur_name)&&
791 str_eq_str(font_area[f], cur_area)) {
792 if(cur_name == flushablestring){
795 pool_ptr = str_start[str_ptr];
797 cur_name = font_name[f];
799 /* if (ignore_frozen) continue; */ /* 98/Oct/5 */
800 if(s > 0) { /* if pt size was specified */
801 if(s == font_size[f]){
802 /* if (ignore_frozen == 0) */
803 if (ignore_frozen == 0 || f > frozenfontptr) { /* 99/Mar/26 */
805 sprintf(log_line, "SKIPPING %ld ", s);
806 show_line(log_line, 0);
812 /* else if font_size[f] = xn_over_d(font_dsize[f],-s,1000) then goto common_ending */
813 else if(font_size[f]== xn_over_d(font_dsize[f],
814 - (integer) s, 1000)) { /* if using design size */
815 /* if (ignore_frozen == 0) */
816 if (ignore_frozen == 0 || f > frozenfontptr) { /* 99/Mar/26 */
818 sprintf(log_line, "SKIPPING %ld ", s);
819 show_line(log_line, 0);
825 while(f++ < for_end);
828 /* lab69: */ /* 98/Oct/5 */
829 /* end of paragraph 1257 */
830 if (trace_flag) show_line("READING ", 0); /* debugging only */
831 f = read_font_info(u, cur_name, cur_area, s);
833 /* common_ending: equiv[u] <- f; */ /* use existing font info */
836 sprintf(log_line, "NEW FONT %d ", f); /* debugging only */
837 show_line(log_line, 0);
840 /* eqtb[(hash_size + 524) + f]= eqtb[u];*/ /* eqtb[frozen_null+font+f] */
841 eqtb[(hash_size + hash_extra + 524) + f]= eqtb[u]; /* 96/Jan/10 */
842 #ifdef SHORTHASH /* debugging only 1996/Jan/20 */
844 sprintf(log_line, "ERROR: %s too large %d\n", "hash_used", t);
845 show_line(log_line, 1);
848 /* hash[(hash_size + 524) + f].v.RH = t; */
849 hash[(hash_size + hash_extra + 524) + f].v.RH = t; /* 96/Jan/10 */
852 void new_interaction (void)
855 interaction = cur_chr;
856 if(interaction == 0) selector = 16;
858 if(log_opened) selector = selector + 2;
861 void do_assignments (void)
866 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
869 set_box_allowed = false;
871 set_box_allowed = true;
875 void open_or_close_in (void)
880 scan_four_bit_int ();
884 (void) a_close(read_file[n]);
889 scan_optional_equals ();
891 pack_file_name(cur_name, cur_area, cur_ext);
892 /* *** some changes in following in 3.14159 *** */
893 /* if current extension is *not* empty, try to open using name as is */
894 /* string 335 is "" the empty string */
895 if((cur_ext != 335)&& a_open_in(read_file[n], TEXINPUTPATH))
897 /* we get here if extension is "", or file with extension failed to open */
898 /* if current extension is not `tex,' and `tex' is not irrelevant, try it */
899 /* string 785 is .tex */
900 else if((cur_ext != 785)&&(name_length + 5 < PATHMAX)&&
901 /* *** some changes in above file name handling *** */
902 /* (! extensionirrelevantp(name_of_file, "tex"))) */
903 (! extensionirrelevantp(name_of_file, name_length, "tex")))
905 name_of_file[name_length + 1]= 46; /* .tex */
906 name_of_file[name_length + 2]= 116;
907 name_of_file[name_length + 3]= 101;
908 name_of_file[name_length + 4]= 120;
909 name_of_file[name_length + 5]= 32;
910 name_length = name_length + 4;
911 if(a_open_in(read_file[n], TEXINPUTPATH))
914 /* more changes here in 3.14159 *** */
915 name_length = name_length - 4; /* remove ".tex" again */
916 name_of_file[name_length + 1]= 32; /* ' ' */
917 /* string 335 is "" the empty string */
918 if((cur_ext == 335)&& a_open_in(read_file[n], TEXINPUTPATH))
920 else if(maketextex () && a_open_in(read_file[n], TEXINPUTPATH))
927 void issue_message (void)
933 mem[mem_top - 12].hh.v.RH = scan_toks(false, true);
934 old_setting = selector;
937 selector = old_setting;
940 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
941 #ifdef ALLOCATESTRING
942 if(pool_ptr + 1 > current_pool_size)
943 str_pool = realloc_str_pool (increment_pool_size);
944 if(pool_ptr + 1 > current_pool_size){ /* in case it failed 94/Jan/24 */
945 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
946 return; // abort_flag set
949 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
950 if(pool_ptr + 1 > pool_size){
951 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
952 return; // abort_flag set
959 if(term_offset +(str_start[s + 1]- str_start[s])> max_print_line -
962 else if((term_offset > 0)||(file_offset > 0))
963 print_char(32); /* */
972 if(eqtb[(hash_size + 1321)].hh.v.RH != 0)
974 else if(long_help_seen)
975 help1("(That was another \\errmessage.)");
979 long_help_seen = true;
980 help4("This error message was generated by an \\errmessage",
981 "command, so I can't give any explicit help.",
982 "Pretend that you're Hercule Poirot: Examine all clues,",
983 "and deduce the truth by order and method.");
986 use_err_help = false;
990 pool_ptr = str_start[str_ptr];
994 void shift_case (void)
1001 p = scan_toks(false, false);
1002 p = mem[def_ref].hh.v.RH;
1003 while(p != 0){ /* while p <> null ... p.1288 */
1004 t = mem[p].hh.v.LH; /* t <- info(p) p.1289 */
1006 if(t < 4095 + 257) /* 4095 + 257 = cs_tokenflag + single_base */
1009 if(eqtb[b + c].hh.v.RH != 0)
1010 mem[p].hh.v.LH = t - c + eqtb[b + c].hh.v.RH;
1014 begin_token_list(mem[def_ref].hh.v.RH, 3);
1016 mem[def_ref].hh.v.RH = avail;
1025 void show_whatever (void)
1031 begin_diagnostic ();
1037 scan_eight_bit_int ();
1038 begin_diagnostic ();
1039 print_nl("> \box"); /* */
1041 print_char(61); /* = */
1042 if(eqtb[(hash_size + 1578) + cur_val].hh.v.RH == 0)
1043 print_string("void");
1044 else show_box(eqtb[(hash_size + 1578) + cur_val].hh.v.RH);
1050 if(interaction == 3)
1052 print_nl("> "); /* */
1056 print_char(61); /* = */
1065 if(interaction == 3)
1067 print_nl(" > "); /* */
1068 token_show(mem_top - 3);
1069 flush_list(mem[mem_top - 3].hh.v.RH);
1074 end_diagnostic(true);
1077 if(eqtb[(hash_size + 3192)].cint <= 0)
1080 print_string(" (see the transcript file)");
1083 lab50: if(interaction < 3)
1088 else if(eqtb[(hash_size + 3192)].cint > 0)
1090 help3("This isn't an error message; I'm just \\showing something.",
1091 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1092 "\\showthe\\count10, \\showbox255, \\showlists).");
1095 help5("This isn't an error message; I'm just \\showing something.",
1096 "Type `I\\show...' to show more (e.g., \\show\\cs,",
1097 "\\showthe\\count10, \\showbox255, \\showlists).",
1098 "And type `I\\tracingonline=1\\show...' to show boxes and",
1099 "lists on your terminal as well as in the transcript file.");
1104 void new_whatsit_(small_number s, small_number w)
1110 mem[tail].hh.v.RH = p;
1114 void new_write_whatsit_(small_number w)
1116 new_whatsit(cur_chr, w);
1118 scan_four_bit_int ();
1122 if(cur_val < 0)cur_val = 17;
1123 else if(cur_val > 15)cur_val = 16;
1125 mem[tail + 1].hh.v.LH = cur_val;
1128 void do_extension (void)
1130 /* integer i, j, k; */
1132 /* halfword p, q, r; */
1137 new_write_whatsit(3);
1138 scan_optional_equals ();
1140 mem[tail + 1].hh.v.RH = cur_name;
1141 mem[tail + 2].hh.v.LH = cur_area;
1142 mem[tail + 2].hh.v.RH = cur_ext;
1148 new_write_whatsit(2);
1150 p = scan_toks(false, false);
1151 mem[tail + 1].hh.v.RH = def_ref;
1156 new_write_whatsit(2);
1157 mem[tail + 1].hh.v.RH = 0;
1163 mem[tail + 1].hh.v.LH = 0;
1164 p = scan_toks(false, true);
1165 mem[tail + 1].hh.v.RH = def_ref;
1171 if((cur_cmd == 59)&&(cur_chr <= 2))
1176 flush_node_list(tail);
1184 if(abs(mode)!= 102){
1185 report_illegal_case ();
1191 if(cur_val <= 0) clang = 0;
1192 else if(cur_val > 255)
1194 else clang = cur_val;
1195 mem[tail + 1].hh.v.RH = clang;
1196 mem[tail + 1].hh.b0 = norm_min(eqtb[(hash_size + 3214)].cint)
1198 mem[tail + 1].hh.b1 = norm_min(eqtb[(hash_size + 3215)].cint)
1204 confusion(1285); /* display */
1205 return; // abort_flag set
1211 void fix_language (void)
1214 int l; /* 95/Jan/7 */
1215 if(eqtb[(hash_size + 3213)].cint <= 0)
1217 else if(eqtb[(hash_size + 3213)].cint > 255)
1219 else l = eqtb[(hash_size + 3213)].cint;
1223 mem[tail + 1].hh.v.RH = l;
1225 mem[tail + 1].hh.b0 = norm_min(eqtb[(hash_size + 3214)].cint);
1226 mem[tail + 1].hh.b1 = norm_min(eqtb[(hash_size + 3215)].cint);
1230 void handle_right_brace (void)
1242 print_err("Too many }'s");
1243 help2("You've closed more groups than you opened.",
1244 "Such booboos are generally harmless, so keep going.");
1251 extra_right_brace ();
1258 adjust_tail = mem_top - 5;
1277 q = eqtb[(hash_size + 792)].hh.v.RH;
1278 incr(mem[q].hh.v.RH);
1279 d = eqtb[(hash_size + 3736)].cint;
1280 f = eqtb[(hash_size + 3205)].cint;
1283 p = vpackage(mem[head].hh.v.RH, 0, 1,
1284 1073741823L); /* 2^30 - 1 */
1286 if(save_stack[save_ptr + 0].cint < 255)
1289 mem[tail].hh.v.RH = get_node(5);
1290 tail = mem[tail].hh.v.RH;
1292 mem[tail].hh.b0 = 3;
1293 mem[tail].hh.b1 = save_stack[save_ptr + 0].cint;
1294 mem[tail + 3].cint = mem[p + 3].cint + mem[p +
1296 mem[tail + 4].hh.v.LH = mem[p + 5].hh.v.RH;
1297 mem[tail + 4].hh.v.RH = q;
1298 mem[tail + 2].cint = d;
1299 mem[tail + 1].cint = f;
1304 mem[tail].hh.v.RH = get_node(2);
1305 tail = mem[tail].hh.v.RH;
1307 mem[tail].hh.b0 = 5;
1308 mem[tail].hh.b1 = 0;
1309 mem[tail + 1].cint = mem[p + 5].hh.v.RH;
1320 if((cur_input.loc_field != 0)||((cur_input.index_field != 6)&&(
1321 cur_input.index_field != 3)))
1323 print_err("Unbalanced output routine");
1324 help2("Your sneaky output routine has problematic {'s and/or }'s.",
1325 "I can't handle that very well; good luck.");
1329 } while(!(cur_input.loc_field == 0));
1334 output_active = false;
1335 insert_penalties = 0;
1336 if(eqtb[(hash_size + 1833)].hh.v.RH != 0)
1338 print_err("Output routine didn't use all of ");
1341 help3("Your \\output commands should empty \\box255,",
1342 "e.g., by saying `\\ship_out\\box255'.",
1343 "Proceed; I'll discard its present contents.");
1348 mem[page_tail].hh.v.RH = mem[head].hh.v.RH;
1351 if(mem[mem_top - 2].hh.v.RH != 0)
1353 if(mem[mem_top - 1].hh.v.RH == 0)
1354 nest[0].tail_field = page_tail;
1355 mem[page_tail].hh.v.RH = mem[mem_top - 1].hh.v.RH;
1356 mem[mem_top - 1].hh.v.RH = mem[mem_top - 2].hh.v.RH;
1357 mem[mem_top - 2].hh.v.RH = 0;
1358 page_tail = mem_top - 2;
1365 build_discretionary ();
1368 /* align_group: begin back_input; cur_tok:=cs_token_flag+frozen_cr; */
1371 /* cur_tok = (hash_size + 4610); */
1372 /* cur_tok = (hash_size + 4095 + 515); */
1373 cur_tok = (hash_size + hash_extra + 4095 + 515);
1374 print_err("Missing ");
1376 print_string("inserted");
1377 help1("I'm guessing that you meant to end an alignment here.");
1392 save_ptr = save_ptr - 2;
1393 p = vpackage(mem[head].hh.v.RH, save_stack[
1394 save_ptr + 1].cint, save_stack[save_ptr + 0].cint,
1395 1073741823L); /* 2^30 - 1 */
1398 mem[tail].hh.v.RH = new_noad ();
1399 tail = mem[tail].hh.v.RH;
1401 mem[tail].hh.b0 = 29;
1402 mem[tail + 1].hh.v.RH = 2;
1403 mem[tail + 1].hh.v.LH = p;
1413 mem[save_stack[save_ptr + 0].cint].hh.v.RH = 3;
1415 mem[save_stack[save_ptr + 0].cint].hh.v.LH = p;
1417 if(mem[p].hh.v.RH == 0)
1418 if(mem[p].hh.b0 == 16)
1420 if(mem[p + 3].hh.v.RH == 0)
1421 if(mem[p + 2].hh.v.RH == 0)
1423 mem[save_stack[save_ptr + 0].cint].hh = mem[p + 1].hh;
1427 else if(mem[p].hh.b0 == 28)
1428 if(save_stack[save_ptr + 0].cint == tail + 1)
1429 if(mem[tail].hh.b0 == 16)
1432 while(mem[q].hh.v.RH != tail)q = mem[q].hh
1442 confusion(1041); /* rightbrace */
1443 return; // abort_flag set
1449 /* main control loop */
1450 void main_control (void)
1451 {/* 60 21 70 80 90 91 92 95 100 101 110 111 112 120 10 */
1453 integer bSuppress; /* 199/Jan/5 */
1455 if(eqtb[(hash_size + 1319)].hh.v.RH != 0)/* everyjob */
1456 begin_token_list(eqtb[(hash_size + 1319)].hh.v.RH, 12);
1459 get_x_token (); /* big_switch */
1462 if(OK_to_interrupt){
1466 pause_for_instructions ();
1473 if(panicking)check_mem(false);
1475 if(eqtb[(hash_size + 3199)].cint > 0)
1476 show_cur_cmd_chr ();
1478 /* the big switch --- don't bother to test abort_flag ??? */
1479 switch(abs(mode)+ cur_cmd){
1495 if((cur_cmd == 11)||(cur_cmd == 12)||(cur_cmd == 68)||(
1497 cancel_boundary = true;
1502 if(space_factor == 1000)goto lab120;
1525 } while(!(cur_cmd != 10));
1530 if(its_all_over ())return;
1545 report_illegal_case ();
1588 insert_dollar_sign ();
1595 mem[tail].hh.v.RH = scan_rule_spec ();
1596 tail = mem[tail].hh.v.RH;
1599 cur_list.aux_field.cint = ignore_depth;
1600 else if(abs(mode)== 102)
1601 space_factor = 1000;
1628 if(cur_group == 14) unsave ();
1634 handle_right_brace ();
1641 scan_dimen(false, false, false);
1642 if(t == 0)scan_box(cur_val);
1643 else scan_box(- (integer) cur_val);
1649 /* scan_box(leader_flag-a_leaders+cur_chr); */
1650 scan_box(1073742237L + cur_chr); /* 2^30 + 513 - 100 ? */
1658 new_graf(cur_chr > 0);
1684 normal_paragraph ();
1692 if(align_state < 0){
1713 begin_insert_or_adjust ();
1736 append_italic_correction ();
1740 mem[tail].hh.v.RH = new_kern(0);
1741 tail = mem[tail].hh.v.RH;
1746 append_discretionary ();
1775 if(cur_group == 15)init_align ();
1793 if(cur_group == 15) start_eq_no ();
1799 mem[tail].hh.v.RH = new_noad ();
1800 tail = mem[tail].hh.v.RH;
1803 scan_math(tail + 1);
1809 set_math_char(eqtb[(hash_size + 2907) + cur_chr].hh.v.RH);
1815 set_math_char(eqtb[(hash_size + 2907) + cur_chr].hh.v.RH);
1820 scan_fifteen_bit_int ();
1821 set_math_char(cur_val);
1825 set_math_char(cur_chr);
1829 scan_twenty_seven_bit_int ();
1830 set_math_char(cur_val / 4096);
1831 /* set_math_char(cur_val >> 12); */
1837 mem[tail].hh.v.RH = new_noad ();
1838 tail = mem[tail].hh.v.RH;
1840 mem[tail].hh.b0 = cur_chr;
1841 scan_math(tail + 1);
1845 math_limit_switch ();
1856 scan_spec(12, false);
1857 normal_paragraph ();
1860 cur_list.aux_field.cint = ignore_depth;
1861 if(eqtb[(hash_size + 1318)].hh.v.RH != 0)/* everyvbox */
1862 begin_token_list(eqtb[(hash_size + 1318)].hh.v.RH, 11);
1867 mem[tail].hh.v.RH = new_style(cur_chr);
1868 tail = mem[tail].hh.v.RH;
1874 mem[tail].hh.v.RH = new_glue(0);
1875 tail = mem[tail].hh.v.RH;
1877 mem[tail].hh.b1 = 98;
1894 if(cur_group == 15)after_math ();
1987 prefixed_command ();
1994 after_token = cur_tok;
2002 save_for_after(cur_tok);
2008 open_or_close_in ();
2030 } /* end of big switch */
2031 goto lab60; /* main_loop */
2034 main_s = eqtb[(hash_size + 2651) + cur_chr].hh.v.RH;
2036 space_factor = 1000;
2037 else if(main_s < 1000)
2040 space_factor = main_s;
2042 else if(space_factor < 1000)
2043 space_factor = 1000;
2044 else space_factor = main_s;
2045 main_f = eqtb[(hash_size + 1834)].hh.v.RH;
2046 bchar = font_bchar[main_f];
2047 false_bchar = font_false_bchar[main_f];
2049 if(eqtb[(hash_size + 3213)].cint != clang)
2054 lig_stack = get_avail ();
2056 avail = mem[lig_stack].hh.v.RH;
2057 mem[lig_stack].hh.v.RH = 0;
2064 mem[lig_stack].hh.b0 = main_f;
2066 mem[lig_stack].hh.b1 = cur_l;
2070 /* begin cancel_boundary:=false; main_k:=non_address; l.20093 */
2071 cancel_boundary = false;
2072 /* main_k:=non_address 3.14159 */
2073 /* main_k = font_mem_size; */ /* OK ? 1993/Nov/29 */
2074 main_k = non_address; /* i.e. --- 1995/Jan/15 3.14159 */
2076 else main_k = bchar_label[main_f];
2077 /* if main_k=non_address then goto main_loop_move+2; l.20096 */
2078 /* if(main_k == font_mem_size) */
2079 if(main_k == non_address) /* i.e. 0 --- 1995/Jan/15 */
2080 /* cur_r:=cur_l; cur_l:=non_char; */
2083 cur_l = 256; /* cur_l:=non_char; */
2084 /* goto main_lig_loop+1; l.20071 */
2087 /* main_loop_wrapup:@<Make a ligature node, if |ligature_present|;
2088 insert a null discretionary, if appropriate@>; */
2089 /* @d wrapup(#)==if cur_l<non_char then */
2090 /* main_loop_wrapup */
2091 lab80: if(cur_l < 256)
2093 /* begin if character(tail)=qi(hyphen_char[main_f]) then
2094 if link(cur_q)>null then ... l.20107 */
2095 if(mem[tail].hh.b1 == hyphen_char[main_f])
2096 /* if(mem[cur_q].hh.v.RH > 0) */ /* NO! */
2097 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX l.20107 */
2099 if(ligature_present)
2101 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2104 mem[main_p].hh.b1 = 2;
2110 incr(mem[main_p].hh.b1);
2113 mem[cur_q].hh.v.RH = main_p;
2115 ligature_present = false;
2117 /* if ins_disc then l.20110 */
2121 /* if mode>0 then tail_append(new_disc); l.20112 */
2124 mem[tail].hh.v.RH = new_disc ();
2125 tail = mem[tail].hh.v.RH;
2130 /* main_loop_move */
2132 if(lig_stack == 0) goto lab21;
2134 cur_l = mem[lig_stack].hh.b1;
2137 if(!(lig_stack >= hi_mem_min)) goto lab95;
2139 lab92: if((cur_chr < font_bc[main_f])||(cur_chr > font_ec[main_f]))
2141 char_warning(main_f, cur_chr);
2143 mem[lig_stack].hh.v.RH = avail;
2152 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2153 if(!(main_i.b0 > 0))
2155 char_warning(main_f, cur_chr);
2157 mem[lig_stack].hh.v.RH = avail;
2167 link(tail) = lig_stack;
2171 /* main_loop_lookahead */
2174 if(cur_cmd == 11) goto lab101;
2175 if(cur_cmd == 12) goto lab101;
2176 if(cur_cmd == 68) goto lab101;
2178 if(cur_cmd == 11) goto lab101;
2179 if(cur_cmd == 12) goto lab101;
2180 if(cur_cmd == 68) goto lab101;
2186 if(cur_cmd == 65) bchar = 256;
2191 lab101: main_s = eqtb[(hash_size + 2651) + cur_chr].hh.v.RH;
2193 space_factor = 1000;
2194 else if(main_s < 1000)
2197 space_factor = main_s;
2199 else if(space_factor < 1000)
2200 space_factor = 1000;
2201 else space_factor = main_s;
2205 lig_stack = get_avail ();
2207 avail = mem[lig_stack].hh.v.RH;
2208 mem[lig_stack].hh.v.RH = 0;
2215 mem[lig_stack].hh.b0 = main_f;
2217 mem[lig_stack].hh.b1 = cur_r;
2218 if(cur_r == false_bchar)
2221 // main_lig_loop:@<If there's a ligature/kern command relevant to |cur_l| and
2222 // |cur_r|, adjust the text appropriately; exit to |main_loop_wrapup|@>;
2224 /* if char_tag(main_i)<>lig_tag then goto main_loop_wrapup; */
2225 if(((main_i.b2) % 4)!= 1)
2227 /* 425 in tex82.bug */
2230 /* main_k:=lig_kern_start(main_f)(main_i); */
2231 main_k = lig_kern_base[main_f]+ main_i.b3;
2232 /* main_j:=font_info[main_k].qqqq; */
2233 main_j = font_info[main_k].qqqq;
2234 /* if skip_byte(main_j)<=stop_flag then goto main_lig_loop+2; */
2235 if(main_j.b0 <= 128)goto lab112;
2236 /* main_k:=lig_kern_restart(main_f)(main_j); */
2237 main_k = lig_kern_base[main_f]+ 256 * main_j.b2 + main_j.b3 + 32768L - 256 *
2240 /* main_lig_loop+1:main_j:=font_info[main_k].qqqq; */
2241 lab111: main_j = font_info[main_k].qqqq;
2243 /* main_lig_loop+2:if next_char(main_j)=cur_r then l.20184 */
2245 /* provide for suppression of f-ligatures 99/Jan/5 */
2247 if(suppress_f_ligs && main_j.b1 == cur_r && main_j.b2 == 0) {
2252 /* if(main_j.b1 == cur_r)*/
2253 if(main_j.b1 == cur_r && bSuppress == 0) /* 99/Jan/5 */
2254 /* if skip_byte(main_j)<=stop_flag then l.20185 */
2255 // @<Do ligature or kern command, returning to |main_lig_loop|
2256 // or |main_loop_wrapup| or |main_loop_move|@>;
2257 if(main_j.b0 <= 128)
2259 /* begin if op_byte(main_j)>=kern_flag then l.20225 */
2260 if(main_j.b2 >= 128)
2262 /* @d wrapup(#)==if cur_l<non_char then */
2265 /* if character(tail)=qi(hyphen_char[main_f]) then if link(cur_q)>null */
2266 if(mem[tail].hh.b1 == hyphen_char[main_f])
2267 /* if(mem[cur_q].hh.v.RH > 0) */ /* 94/Mar/22 ?????????????? */
2268 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX l.20107l.20186 */
2270 /* if ligature_present then pack_lig(#); */
2271 if(ligature_present)
2273 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2276 mem[main_p].hh.b1 = 2;
2282 incr(mem[main_p].hh.b1);
2285 mem[cur_q].hh.v.RH = main_p;
2287 ligature_present = false;
2294 mem[tail].hh.v.RH = new_disc ();
2295 tail = mem[tail].hh.v.RH;
2300 mem[tail].hh.v.RH = new_kern(font_info[kern_base[
2301 main_f]+ 256 * main_j.b2 + main_j.b3].cint);
2302 tail = mem[tail].hh.v.RH;
2306 /* begin if cur_l=non_char then lft_hit:=true; */
2309 else if(lig_stack == 0)
2313 pause_for_instructions ();
2321 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2322 ligature_present = true;
2331 lig_stack = new_lig_item(cur_r);
2334 else if((lig_stack >= hi_mem_min))
2337 lig_stack = new_lig_item(cur_r);
2338 mem[lig_stack + 1].hh.v.RH = main_p;
2340 else mem[lig_stack].hh.b1 = cur_r;
2347 lig_stack = new_lig_item(cur_r);
2348 mem[lig_stack].hh.v.RH = main_p;
2354 if(cur_l < 256) /* if cur_l<non_char then */
2355 /* begin if character(tail)=qi(hyphen_char[main_f]) then if link(cur_q)>null
2358 if(mem[tail].hh.b1 == hyphen_char[main_f])
2359 /* if(mem[cur_q].hh.v.RH > 0) */ /* 94/Mar/22 */
2360 if(mem[cur_q].hh.v.RH != 0) /* BUG FIX ???????????? */
2362 if(ligature_present)
2364 main_p = new_ligature(main_f, cur_l, mem[cur_q].hh.v.RH);
2367 mem[main_p].hh.b1 = 2;
2372 incr(mem[main_p].hh.b1);
2374 } */ /* removed 99/Jan/6 */
2375 mem[cur_q].hh.v.RH = main_p;
2377 ligature_present = false;
2384 mem[tail].hh.v.RH = new_disc ();
2385 tail = mem[tail].hh.v.RH;
2391 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2392 ligature_present = true;
2398 ligature_present = true;
2410 main_k = bchar_label[main_f];
2416 if(main_j.b0 >= 128)
2418 main_k = main_k + main_j.b0 + 1;
2423 lab95: main_p = mem[lig_stack + 1].hh.v.RH;
2424 /* if main_p>null then tail_append(main_p); l.20137 */
2425 /* if(main_p > 0) */ /* 92/Mar/22 */
2426 if(main_p != 0) /* BUG FIX */
2428 mem[tail].hh.v.RH = main_p;
2429 tail = mem[tail].hh.v.RH;
2431 temp_ptr = lig_stack;
2432 lig_stack = mem[temp_ptr].hh.v.RH;
2433 free_node(temp_ptr, 2);
2434 main_i = font_info[char_base[main_f]+ cur_l].qqqq;
2435 ligature_present = true;
2437 /* if main_p>null then goto main_loop_lookahead l.20142 */
2438 /* if(main_p > 0) */ /* 94/Mar/2 */
2439 if(main_p != 0) /* BUG FIX */
2442 else cur_r = mem[lig_stack].hh.b1;
2445 /* append_normal_space */
2446 lab120: if(eqtb[(hash_size + 794)].hh.v.RH == 0)
2449 main_p = font_glue[eqtb[(hash_size + 1834)].hh.v.RH];
2452 main_p = new_spec(0);
2453 main_k = param_base[eqtb[(hash_size + 1834)].hh.v.RH]+ 2;
2454 mem[main_p + 1].cint = font_info[main_k].cint;
2455 mem[main_p + 2].cint = font_info[main_k + 1].cint;
2456 mem[main_p + 3].cint = font_info[main_k + 2].cint;
2457 font_glue[eqtb[(hash_size + 1834)].hh.v.RH]= main_p;
2460 temp_ptr = new_glue(main_p);
2462 else temp_ptr = new_param_glue(12);
2463 mem[tail].hh.v.RH = temp_ptr;
2466 } /* end of main_control */
2467 /* give_err_help etc followed here in the old tex8.c */