6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
13 #pragma warning(disable:4131) // old style declarator
14 #pragma warning(disable:4135) // conversion between different integral types
15 #pragma warning(disable:4127) // conditional expression is constant
23 #pragma warning(disable:4244) /* 96/Jan/10 */
25 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
27 void build_page (void)
28 {/* 10 30 31 22 80 90 */
33 /* unsigned char n; */
34 unsigned int n; /* 95/Jan/7 */
37 /* begin if (link(contrib_head)=null)or output_active then return; l.19351 */
38 if((mem[mem_top - 1].hh.v.RH == 0)|| output_active)
41 lab22: p = mem[mem_top - 1].hh.v.RH;
42 /* if(last_glue != 262143L) */
43 if(last_glue != empty_flag)
44 delete_glue_ref(last_glue);
47 if(mem[p].hh.b0 == 10)
49 last_glue = mem[p + 1].hh.v.LH;
50 incr(mem[last_glue].hh.v.RH);
54 /* last_glue = 262143L; */
55 last_glue = empty_flag;
56 if(mem[p].hh.b0 == 12)
57 last_penalty = mem[p + 1].cint;
58 else if(mem[p].hh.b0 == 11)
59 last_kern = mem[p + 1].cint;
67 if(page_contents == 0)
69 else page_contents = 2;
70 q = new_skip_param(9);
71 if(mem[temp_ptr + 1].cint > mem[p + 3].cint)
72 mem[temp_ptr + 1].cint = mem[temp_ptr + 1].cint - mem[p + 3]
74 else mem[temp_ptr + 1].cint = 0;
76 mem[mem_top - 1].hh.v.RH = q;
81 page_so_far[1]= page_so_far[1]+ page_so_far[7]+ mem[p + 3]
83 page_so_far[7]= mem[p + 2].cint;
93 else if((mem[page_tail].hh.b0 < 9))
100 else if(mem[p].hh.v.RH == 0)
102 else if(mem[mem[p].hh.v.RH].hh.b0 == 10)
107 if(page_contents < 2)
109 else pi = mem[p + 1].cint;
116 if(page_contents == 0)
117 freeze_page_specs(1);
120 while(n >= mem[mem[r].hh.v.RH].hh.b1)r = mem[r].hh
123 if(mem[r].hh.b1 != n)
126 mem[q].hh.v.RH = mem[r].hh.v.RH;
132 if(eqtb[(hash_size + 1578) + n].hh.v.RH == 0)
134 else mem[r + 3].cint = mem[eqtb[(hash_size + 1578) + n].hh.v.RH + 3]
135 .cint + mem[eqtb[(hash_size + 1578) + n].hh.v.RH + 2].cint;
136 mem[r + 2].hh.v.LH = 0;
137 q = eqtb[(hash_size + 800) + n].hh.v.RH;
138 if(eqtb[(hash_size + 3218) + n].cint == 1000)
140 else h = x_over_n(mem[r + 3].cint, 1000)* eqtb[(hash_size + 3218) + n]
142 page_so_far[0]= page_so_far[0]- h - mem[q + 1].cint;
143 page_so_far[2 + mem[q].hh.b0]= page_so_far[2 + mem[q]
144 .hh.b0]+ mem[q + 2].cint;
145 page_so_far[6]= page_so_far[6]+ mem[q + 3].cint;
146 if((mem[q].hh.b1 != 0)&&(mem[q + 3].cint != 0))
151 print_nl(262); /* ! */
152 print(992); /* Infinite glue shrinkage inserted from */
154 print_esc(392); /* skip*/
158 help_line[2]= 993; /* The correction glue for page breaking with insertions */
159 help_line[1]= 994; /* must have finite shrinkability. But you may proceed, */
160 help_line[0]= 916; /* since the offensive shrinkability has been made finite. */
165 if(mem[r].hh.b0 == 1)
166 insert_penalties = insert_penalties + mem[p + 1].cint;
169 mem[r + 2].hh.v.RH = p;
170 delta = page_so_far[0]- page_so_far[1]- page_so_far[7]+
172 if(eqtb[(hash_size + 3218) + n].cint == 1000)
174 else h = x_over_n(mem[p + 3].cint, 1000)* eqtb[(hash_size + 3218) + n]
176 if(((h <= 0)||(h <= delta)) &&(mem[p + 3].cint + mem
177 [r + 3].cint <= eqtb[(hash_size + 3751) + n].cint))
179 page_so_far[0]= page_so_far[0]- h;
180 mem[r + 3].cint = mem[r + 3].cint + mem[p + 3].cint;
184 if(eqtb[(hash_size + 3218) + n].cint <= 0)
185 w = 1073741823L; /* 2^30 - 1 */
188 w = page_so_far[0]- page_so_far[1]- page_so_far[7];
189 if(eqtb[(hash_size + 3218) + n].cint != 1000)
190 w = x_over_n(w, eqtb[(hash_size + 3218) + n].cint)* 1000;
192 if(w > eqtb[(hash_size + 3751) + n].cint - mem[r + 3].cint)
193 w = eqtb[(hash_size + 3751) + n].cint - mem[r + 3].cint;
194 q = vert_break(mem[p + 4].hh.v.LH, w, mem[p + 2].cint);
195 mem[r + 3].cint = mem[r + 3].cint + best_height_plus_depth;
198 if(eqtb[(hash_size + 3196)].cint > 0)
201 print_nl(995); /* % split */
205 print_char(44); /*, */
206 print_scaled(best_height_plus_depth);
208 if(q == 0) /* if q=null l.19614 */
210 else if(mem[q].hh.b0 == 12)
211 print_int(mem[q + 1].cint);
212 else print_char(48); /* 0 */
213 end_diagnostic(false);
216 if(eqtb[(hash_size + 3218) + n].cint != 1000)
217 best_height_plus_depth = x_over_n(best_height_plus_depth, 1000)*
218 eqtb[(hash_size + 3218) + n].cint;
219 page_so_far[0]= page_so_far[0]- best_height_plus_depth;
221 mem[r + 1].hh.v.RH = q;
222 mem[r + 1].hh.v.LH = p;
224 insert_penalties = insert_penalties - 10000;
225 else if(mem[q].hh.b0 == 12)
226 insert_penalties = insert_penalties + mem[q + 1].cint;
234 confusion(987); /* page */
235 return; // abort_flag set
239 if(pi < 10000)/* pi may be used ... */
241 if(page_so_far[1]< page_so_far[0])
242 if((page_so_far[3]!= 0)||(page_so_far[4]!= 0)||(page_so_far
245 else b = badness(page_so_far[0]- page_so_far[1], page_so_far[2])
247 else if(page_so_far[1]- page_so_far[0]> page_so_far[6])
248 b = 1073741823L; /* 2^30 - 1 */
249 else b = badness(page_so_far[1]- page_so_far[0], page_so_far[6])
251 if(b < 1073741823L) /* 2^30 - 1 */
255 c = b + pi + insert_penalties;
258 if(insert_penalties >= 10000)
259 c = 1073741823L; /* 2^30 - 1 */
262 if(eqtb[(hash_size + 3196)].cint > 0)
265 print_nl(37); /* % */
269 print_scaled(page_so_far[0]);
271 if(b == 1073741823L) /* 2^30 - 1 */
272 print_char(42); /* * */
277 if(c == 1073741823L) /* 2^30 - 1 */
278 print_char(42); /* * */
280 if(c <= least_page_cost)
281 print_char(35); /* # */
282 end_diagnostic(false);
285 if(c <= least_page_cost)
288 best_size = page_so_far[0];
290 r = mem[mem_top].hh.v.RH;
293 mem[r + 2].hh.v.LH = mem[r + 2].hh.v.RH;
297 if((c == 1073741823L)||(pi <= -10000)) /* 2^30 - 1 */
300 if(output_active)return;
304 if((mem[p].hh.b0 < 10)||(mem[p].hh.b0 > 11))
306 lab90: if(mem[p].hh.b0 == 11)
310 q = mem[p + 1].hh.v.LH;
311 page_so_far[2 + mem[q].hh.b0]= page_so_far[2 + mem[q].hh.b0]
313 page_so_far[6]= page_so_far[6]+ mem[q + 3].cint;
314 if((mem[q].hh.b1 != 0)&&(mem[q + 3].cint != 0))
319 print_nl(262); /* ! */
320 print(988); /* Infinite glue shrinkage found on current page */
324 help_line[3]= 989; /* The page about to be output contains some infinitely */
325 help_line[2]= 957; /* shrinkable glue, e.g., `\vss' or `\vskip 0pt minus 1fil'. */
326 help_line[1]= 958; /* Such glue doesn't belong there; but you can safely proceed, */
327 help_line[0]= 916; /* since the offensive shrinkability has been made finite. */
333 mem[p + 1].hh.v.LH = r;
337 page_so_far[1]= page_so_far[1]+ page_so_far[7]+ mem[q + 1].cint
340 lab80: if(page_so_far[7]> page_max_depth)
342 page_so_far[1]= page_so_far[1]+ page_so_far[7]- page_max_depth;
343 page_so_far[7]= page_max_depth;
345 mem[page_tail].hh.v.RH = p;
347 mem[mem_top - 1].hh.v.RH = mem[p].hh.v.RH;
350 lab31: mem[mem_top - 1].hh.v.RH = mem[p].hh.v.RH;
354 } while(!(mem[mem_top - 1].hh.v.RH == 0));
357 else nest[0].tail_field = mem_top - 1;
360 void app_space (void)
363 if((space_factor >= 2000)&&
364 (eqtb[(hash_size + 795)].hh.v.RH != 0))
365 q = new_param_glue(13);
368 if(eqtb[(hash_size + 794)].hh.v.RH != 0)
369 main_p = eqtb[(hash_size + 794)].hh.v.RH;
372 main_p = font_glue[eqtb[(hash_size + 1834)].hh.v.RH];
375 main_p = new_spec(0);
376 main_k = param_base[eqtb[(hash_size + 1834)].hh.v.RH]+ 2;
377 mem[main_p + 1].cint = font_info[main_k].cint;
378 mem[main_p + 2].cint = font_info[main_k + 1].cint;
379 mem[main_p + 3].cint = font_info[main_k + 2].cint;
380 font_glue[eqtb[(hash_size + 1834)].hh.v.RH]= main_p;
383 main_p = new_spec(main_p);
384 if(space_factor >= 2000)
385 mem[main_p + 1].cint = mem[main_p + 1].cint + font_info[7 +
386 param_base[eqtb[(hash_size + 1834)].hh.v.RH]].cint;
387 mem[main_p + 2].cint = xn_over_d(mem[main_p + 2].cint, cur_list
388 .aux_field.hh.v.LH, 1000);
389 mem[main_p + 3].cint = xn_over_d(mem[main_p + 3].cint, 1000,
391 q = new_glue(main_p);
392 mem[main_p].hh.v.RH = 0;
394 mem[tail].hh.v.RH = q;
397 /* called from tex8.c only */
399 void insert_dollar_sign (void)
406 print_nl(262); /* ! */
407 print(1011); /* Proceed; I'll discard its present contents. */
411 help_line[1]= 1012; /* I've inserted a begin-math/end-math symbol since I think */
412 help_line[0]= 1013; /* you left one out. Proceed, with fingers crossed. */
422 print_nl(262); /* ! */
423 print(682); /* You can't use ` */
425 print_cmd_chr(cur_cmd, cur_chr);
426 print(1014); /* ' in */
430 void report_illegal_case (void)
435 help_line[3]= 1015; /* Sorry, but I'm not programmed to handle this case; */
436 help_line[2]= 1016; /* I'll just pretend that you didn't ask for it. */
437 help_line[1]= 1017; /* If you're in the wrong mode, you might be able to */
438 help_line[0]= 1018; /* return to the right one by typing `I}' or `I$' or `I\par'. */
443 bool privileged (void)
444 {register bool Result;
445 if(mode > 0)Result = true;
447 report_illegal_case ();
453 bool its_all_over (void)
454 {/* 10 */ register bool Result;
457 if((mem_top - 2 == page_tail)&&(head == cur_list
458 .tail_field)&&(dead_cycles == 0))
465 mem[tail].hh.v.RH = new_null_box ();
466 tail = mem[tail].hh.v.RH;
468 mem[tail + 1].cint = eqtb[(hash_size + 3733)].cint;
470 mem[tail].hh.v.RH = new_glue(8);
471 tail = mem[tail].hh.v.RH;
474 mem[tail].hh.v.RH = new_penalty(-1073741824L);
476 tail = mem[tail].hh.v.RH;
484 void append_glue (void)
509 mem[tail].hh.v.RH = new_glue(cur_val);
510 tail = mem[tail].hh.v.RH;
514 decr(mem[cur_val].hh.v.RH);
516 mem[tail].hh.b1 = 99;
520 void append_kern (void)
524 scan_dimen(s == 99, false, false);
526 mem[tail].hh.v.RH = new_kern(cur_val);
527 tail = mem[tail].hh.v.RH;
540 print_nl(262); /* ! */
541 print(773); /* Extra */
543 print_cmd_chr(cur_cmd, cur_chr);
546 help_line[0]= 1037; /* Things are pretty mixed up, but I think the worst is over. */
554 mem[mem_top - 3].hh.v.RH = p;
558 print_nl(262); /* ! */
559 print(622); /* Missing */
564 /* mem[p].hh.v.LH = (hash_size + 4611); */
565 /* mem[p].hh.v.LH = (hash_size + 4095 + 516); */
566 mem[p].hh.v.LH = (hash_size + hash_extra + 4095 + 516); /* 96/Jan/10 */
567 print_esc(513); /* endgroup */
572 mem[p].hh.v.LH = 804;
578 /* mem[p].hh.v.LH = (hash_size + 4612); */
579 /* mem[p].hh.v.LH = (hash_size + 4095 + 517); */
580 mem[p].hh.v.LH = (hash_size + hash_extra + 4095 + 517); /* 96/Jan/10 */
581 mem[p].hh.v.RH = get_avail ();
583 mem[p].hh.v.LH = 3118;
584 print_esc(1036); /* right. */
589 mem[p].hh.v.LH = 637;
590 print_char(125); /* } */
594 print(623); /* inserted */
595 begin_token_list(mem[mem_top - 3].hh.v.RH, 4);
598 help_line[4]= 1031; /* I've inserted something that you may have forgotten. */
599 help_line[3]= 1032; /* (See the <inserted text> above.) */
600 help_line[2]= 1033; /* With luck, this will get me unwedged. But if you */
601 help_line[1]= 1034; /* really didn't forget anything, try typing `2' now; then */
602 help_line[0]= 1035; /* my insertion and my current dilemma will both disappear. */
607 /* only called from tex8.c */
609 void extra_right_brace (void)
614 print_nl(262); /* ! */
615 print(1042); /* Extra }, or forgotten */
619 print_esc(513); /* endgroup */
622 print_char(36); /* $ */
625 print_esc(871); /* right */
630 help_line[4]= 1043; /* I've deleted a group-closing symbol because it seems to be */
631 help_line[3]= 1044; /* spurious, as in `$x}$'. But perhaps the } is legitimate and */
632 help_line[2]= 1045; /* you forgot something else, as in `\hbox{$x}'. In such cases */
633 help_line[1]= 1046; /* the way to recover is to insert both the forgotten and the */
634 help_line[0]= 1047; /* deleted material, e.g., by typing `I$}'. */
640 void normal_paragraph (void)
642 /* if looseness<>0 then eq_word_define(int_base+looseness_code,0); */
643 if(eqtb[(hash_size + 3182)].cint != 0)
644 eq_word_define((hash_size + 3182), 0);
645 if(eqtb[(hash_size + 3747)].cint != 0)
646 eq_word_define((hash_size + 3747), 0);
647 if(eqtb[(hash_size + 3204)].cint != 1)
648 eq_word_define((hash_size + 3204), 1);
649 if(eqtb[(hash_size + 1312)].hh.v.RH != 0)
650 eq_define((hash_size + 1312), 118, 0);
653 void box_end_(integer boxcontext)
656 /* if box_context<box_flag then ... 1073741824 2^30 */
657 if(boxcontext < 1073741824L)
661 mem[cur_box + 4].cint = boxcontext;
664 append_to_vlist(cur_box);
667 if(mem_top - 5 != adjust_tail)
669 mem[tail].hh.v.RH = mem[mem_top - 5].hh
686 mem[p + 1].hh.v.RH = 2;
687 mem[p + 1].hh.v.LH = cur_box;
690 mem[tail].hh.v.RH = cur_box;
696 /* following fixed 1994/Apr/5 1 day anno Yang --- moby sigh ... */
698 /* else if box_context<box_flag+512 then ... */
699 /* else if(boxcontext < 1073742336L)*/ /* 2^30 + 512 */
700 else if(boxcontext < (1073741824L + 512)) /* 2^30 + 512 */
701 /* else if box_context<box_flag+256 then ... */
702 /* if(boxcontext < 1073742080L)*/ /* 2^30 + 256 */
703 if(boxcontext < (1073741824L + 256))/* 2^30 + 256 */
704 /* eq_define(box_base-box_flag+box_context,box_ref,cur_box) */
705 /* eq_define((hash_size - 1073740246L) + boxcontext, 119, cur_box); */
706 eq_define((hash_size + 1578 - 1073741824L) + boxcontext, 119, cur_box);
707 /* else geq_define(box_base-box_flag-256+box_context,box_ref,cur_box) */
708 /* else geq_define((hash_size - 1073740502L) + boxcontext, 119, cur_box); */
709 else geq_define((hash_size + 1322 - 1073741824L) + boxcontext, 119, cur_box);
710 else if(cur_box != 0)
711 /* if(boxcontext > 1073742336L)*/ /* 2^30 + 512 */
712 if(boxcontext > (1073741824L + 512)) /* 2^30 + 512 */
716 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
717 if(((cur_cmd == 26)&&(abs(mode)!= 1)) ||((
718 cur_cmd == 27)&&(abs(mode)== 1)) ||((cur_cmd ==
719 28)&&(abs(mode)== 203)))
721 /* begin append_glue; subtype(tail):=box_context-(leader_flag-a_leaders); */
723 /* -(2^30 + 513 - 100) */
724 mem[tail].hh.b1 = boxcontext -(1073742237L);
725 mem[tail + 1].hh.v.RH = cur_box;
732 print_nl(262); /* ! */
733 print(1060); /* Leaders not followed by proper glue */
737 help_line[2]= 1061; /* You should say `\leaders <box or rule><hskip or vskip>'. */
738 help_line[1]= 1062; /* I found the <box or rule>, but there's no suitable */
739 help_line[0]= 1063; /* <hskip or vskip>, so I'm ignoring these leaders. */
742 flush_node_list(cur_box);
745 else ship_out(cur_box);
747 /* called only from tex8.c */
749 void begin_box_(integer boxcontext)
758 scan_eight_bit_int ();
759 cur_box = eqtb[(hash_size + 1578) + cur_val].hh.v.RH;
760 eqtb[(hash_size + 1578) + cur_val].hh.v.RH = 0;
765 scan_eight_bit_int ();
766 cur_box = copy_node_list(eqtb[(hash_size + 1578) + cur_val].hh.v.RH);
777 help_line[0]= 1064; /* Sorry; this \lastbox will be void. */
781 else if((mode == 1)&&(head == cur_list
787 help_line[1]= 1065; /* Sorry...I usually can't take things from the current page. */
788 help_line[0]= 1066; /* This \lastbox will therefore be void. */
793 if(!(tail >= hi_mem_min))
794 if((mem[tail].hh.b0 == 0)||(mem[cur_list
795 .tail_field].hh.b0 == 1))
800 if(!(q >= hi_mem_min))
801 if(mem[q].hh.b0 == 7)
804 register integer for_end;
806 for_end = mem[q].hh.b1;
809 while(m++ < for_end);
815 } while(!(q == tail));
817 mem[cur_box + 4].cint = 0;
827 scan_eight_bit_int ();
829 if(! scan_keyword(836)) /* to */
834 print_nl(262); /* ! */
835 print(1067); /* Missing `to' inserted */
839 help_line[1]= 1068; /* I'm working on `\vsplit<box number> to <dimen>'; */
840 help_line[0]= 1069; /* will look for the <dimen> next. */
844 scan_dimen(false, false, false);
845 cur_box = vsplit(n, cur_val);
851 save_stack[save_ptr + 0].cint = boxcontext;
853 if((boxcontext < 1073741824L)&& /* 2^30 */
857 else scan_spec(2, true);
870 mode = - (integer) k;
873 cur_list.aux_field.cint = ignore_depth;
874 if(eqtb[(hash_size + 1318)].hh.v.RH != 0)/* everyhbox */
875 begin_token_list(eqtb[(hash_size + 1318)].hh.v.RH, 11);
880 if(eqtb[(hash_size + 1317)].hh.v.RH != 0)/* everyhbox */
881 begin_token_list(eqtb[(hash_size + 1317)].hh.v.RH, 10);
890 void scan_box_(integer boxcontext)
894 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
896 begin_box(boxcontext);
898 else if((boxcontext >= 1073742337L)&& /* (2^30 + 512 + 1) */
899 ((cur_cmd == 36)||(cur_cmd == 35)))
901 cur_box = scan_rule_spec ();
909 print_nl(262); /* ! */
910 print(1070); /* A <box> was supposed to be here */
914 help_line[2]= 1071; /* I was expecting to see \hbox or \vbox or \copy or \box or */
915 help_line[1]= 1072; /* something like that. So you might find something missing in */
916 help_line[0]= 1073; /* your output. But keep trying; you can fix this later. */
921 /****************************************************************************/
922 void package_ (small_number);
923 /****************************************************************************/
925 small_number norm_min_ (integer h)
927 /* small_number Result; */
928 int Result; /* 95/Jan/7 */
937 void new_graf_(bool indented)
940 if((mode == 1)||(head != cur_list
943 mem[tail].hh.v.RH = new_param_glue(2);
944 tail = mem[tail].hh.v.RH;
946 /* used to be followingin 3.141 */
947 /* cur_list .lhmfield = norm_min(eqtb[(hash_size + 3214)].cint); */
948 /* cur_list .rhmfield = norm_min(eqtb[(hash_size + 3215)].cint); */
952 /* changes here since 3.141 */
953 if(eqtb[(hash_size + 3213)].cint <= 0)
955 else if(eqtb[(hash_size + 3213)].cint > 255)
957 else cur_lang = eqtb[(hash_size + 3213)].cint;
959 prev_graf =(norm_min(eqtb[(hash_size + 3214)].cint)* 64 +
960 norm_min(eqtb[(hash_size + 3215)].cint)) * 65536L + cur_lang;
961 /* eqtb ??? hash_size ? hash_size + hash_extra ? norm_min etc */
962 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
965 tail = new_null_box ();
966 mem[head].hh.v.RH = tail;
967 mem[tail + 1].cint = eqtb[(hash_size + 3730)].cint;
969 if(eqtb[(hash_size + 1314)].hh.v.RH != 0) /* everypar */
970 begin_token_list(eqtb[(hash_size + 1314)].hh.v.RH, 7);
975 /* procedure indent_in_hmode; l.21058 */
977 void indent_in_hmode (void)
983 mem[p + 1].cint = eqtb[(hash_size + 3730)].cint;
989 mem[q + 1].hh.v.RH = 2;
990 mem[q + 1].hh.v.LH = p;
994 mem[tail].hh.v.RH = p;
995 tail = mem[tail].hh.v.RH;
999 /* only called from tex8.c */
1001 void head_for_vmode (void)
1009 if(interaction == 3)
1011 print_nl(262); /* ! */
1012 print(682); /* You can't use ` */
1014 print_esc(518); /* hrule */
1015 print(1076); /* ' here except with leaders */
1018 help_line[1]= 1077; /* To put a horizontal rule in an hbox or an alignment, */
1019 help_line[0]= 1078; /* you should use \leaders or \hrulefill (see The TeXbook). */
1026 cur_tok = par_token;
1028 cur_input.index_field = 4;
1032 void end_graf (void)
1038 else line_break(eqtb[(hash_size + 3169)].cint);
1039 normal_paragraph ();
1043 /* only called form tex8.c */
1045 void begin_insert_or_adjust (void)
1051 scan_eight_bit_int ();
1055 if(interaction == 3)
1057 print_nl(262); /* ! */
1058 print(1079); /* You can't */
1060 print_esc(327); /* insert */
1064 help_line[0]= 1080; /* I'm changing to \insert0; box 255 is special. */
1070 save_stack[save_ptr + 0].cint = cur_val;
1074 normal_paragraph ();
1077 cur_list.aux_field.cint = ignore_depth;
1080 void make_mark (void)
1083 p = scan_toks(false, true);
1087 mem[p + 1].cint = def_ref;
1088 mem[tail].hh.v.RH = p;
1092 void append_penalty (void)
1096 mem[tail].hh.v.RH = new_penalty(cur_val);
1097 tail = mem[tail].hh.v.RH;
1103 /* only called from tex8.c */
1105 void delete_last (void)
1109 if((mode == 1)&&(tail == cur_list
1112 /* if((cur_chr != 10)||(last_glue != 262143L)) */
1113 if((cur_chr != 10)||(last_glue != empty_flag))
1118 help_line[1]= 1065; /* Sorry...I usually can't take things from the current page. */
1119 help_line[0]= 1081; /* Try `I\vskip-\lastskip' instead. */
1122 help_line[0]=(1082); /* Try `I\kern-\last_kern' instead. */
1123 else if(cur_chr != 10)
1124 help_line[0]=(1083); /* Perhaps you can make the output routine do it. */
1130 if(!(tail >= hi_mem_min))
1131 if(mem[tail].hh.b0 == cur_chr)
1136 if(!(q >= hi_mem_min))
1137 if(mem[q].hh.b0 == 7)
1140 register integer for_end;
1142 for_end = mem[q].hh.b1;
1145 while(m++ < for_end);
1151 } while(!(q == tail));
1153 flush_node_list(tail);
1158 /* only called from tex8.c */
1159 /* procedure unpackage; l.21256 */
1161 void unpackage (void)
1166 scan_eight_bit_int ();
1167 p = eqtb[(hash_size + 1578) + cur_val].hh.v.RH;
1168 if(p == 0)/* if p=null then return; l.21261 */
1170 if((abs(mode)== 203)||((abs(mode)
1171 == 1)&&(mem[p].hh.b0 != 1)) ||((abs(mode)==
1172 102)&&(mem[p].hh.b0 != 0)))
1175 if(interaction == 3)
1177 print_nl(262); /* ! */
1178 print(1091); /* Incompatible list can't be unboxed */
1182 help_line[2]= 1092; /* Sorry, Pandora. (You sneaky devil.) */
1183 help_line[1]= 1093; /* I refuse to unbox an \hbox in vertical mode or vice versa. */
1184 help_line[0]= 1094; /* And I can't open any boxes in math mode. */
1190 mem[tail].hh.v.RH = copy_node_list(mem[p + 5].hh
1194 mem[tail].hh.v.RH = mem[p + 5].hh.v.RH;
1195 eqtb[(hash_size + 1578) + cur_val].hh.v.RH = 0;
1198 while(mem[tail].hh.v.RH != 0)tail = mem
1202 void append_italic_correction (void)
1205 internal_font_number f;
1208 if((tail >= hi_mem_min))
1210 else if(mem[tail].hh.b0 == 6)
1215 mem[tail].hh.v.RH = new_kern(font_info[italic_base[
1216 f]+(font_info[char_base[f]+ mem[p].hh.b1].qqqq.b2)/ 4]
1218 tail = mem[tail].hh.v.RH;
1220 mem[tail].hh.b1 = 1;
1224 void append_discretionary (void)
1228 mem[tail].hh.v.RH = new_disc ();
1229 tail = mem[tail].hh.v.RH;
1233 c = hyphen_char[eqtb[(hash_size + 1834)].hh.v.RH];
1236 mem[tail + 1].hh.v.LH = new_character(eqtb[(hash_size + 1834)]
1242 save_stack[save_ptr - 1].cint = 0;
1247 space_factor = 1000;
1250 /* only called form tex8.c */
1252 void build_discretionary (void)
1262 if(!(p >= hi_mem_min))
1263 if(mem[p].hh.b0 > 2)
1264 if(mem[p].hh.b0 != 11)
1265 if(mem[p].hh.b0 != 6)
1268 if(interaction == 3)
1270 print_nl(262); /* ! */
1271 print(1101); /* Improper discretionary list */
1275 help_line[0]= 1102; /* Discretionary lists must contain only boxes and kerns. */
1278 begin_diagnostic ();
1279 print_nl(1103); /* The following discretionary sublist has been deleted: */
1281 end_diagnostic(true);
1291 p = mem[head].hh.v.RH;
1293 switch(save_stack[save_ptr - 1].cint)
1295 mem[tail + 1].hh.v.LH = p;
1298 mem[tail + 1].hh.v.RH = p;
1302 if((n > 0)&&(abs(mode)== 203))
1305 if(interaction == 3)
1307 print_nl(262); /* ! */
1308 print(1095); /* Illegal math */
1310 print_esc(346); /* discretionary */
1313 help_line[1]= 1096; /* Sorry: The third part of a discretionary break must be */
1314 help_line[0]= 1097; /* empty, in math formulas. I had to delete your third part. */
1320 else mem[tail].hh.v.RH = p;
1321 /* if n <= max_quarterword then replace_count(tail) <- n; p.1120 */
1322 /* if(n <= 255) */ /* 94/Apr/4 ? */
1323 if(n <= max_quarterword) /* 96/Oct/12 ??? */
1324 mem[tail].hh.b1 = n;
1328 if(interaction == 3)
1330 print_nl(262); /* ! */
1331 print(1098); /* Discretionary list is too long */
1335 help_line[1]= 1099; /* Wow---I never thought anybody would tweak me here. */
1336 help_line[0]= 1100; /* You can't seriously need such a huge discretionary list? */
1347 incr(save_stack[save_ptr - 1].cint);
1352 space_factor = 1000;
1354 /* called only from tex8.c */
1356 void make_accent (void)
1360 internal_font_number f;
1361 scaled a, h, x, w, delta;
1364 f = eqtb[(hash_size + 1834)].hh.v.RH;
1365 p = new_character(f, cur_val);
1368 x = font_info[5 + param_base[f]].cint;
1369 s = font_info[1 + param_base[f]].cint / ((double) 65536.0);
1370 a = font_info[width_base[f]+ font_info[char_base[f]+ mem[p]
1371 .hh.b1].qqqq.b0].cint;
1374 f = eqtb[(hash_size + 1834)].hh.v.RH;
1375 if((cur_cmd == 11)||(cur_cmd == 12)||(cur_cmd == 68))
1376 q = new_character(f, cur_chr);
1377 else if(cur_cmd == 16)
1380 q = new_character(f, cur_val);
1385 t = font_info[1 + param_base[f]].cint / ((double) 65536.0);
1386 i = font_info[char_base[f]+ mem[q].hh.b1].qqqq;
1387 w = font_info[width_base[f]+ i.b0].cint;
1388 h = font_info[height_base[f]+(i.b1)/ 16].cint;
1392 mem[p + 4].cint = x - h;
1394 delta = round((w - a)/ ((double) 2.0)+ h * t - x * s);
1395 r = new_kern(delta);
1397 mem[tail].hh.v.RH = r;
1399 tail = new_kern(- (integer) a - delta);
1400 mem[tail].hh.b1 = 2;
1401 mem[p].hh.v.RH = tail;
1404 mem[tail].hh.v.RH = p;
1406 space_factor = 1000;
1410 void align_error (void)
1412 if(abs(align_state)> 2){
1414 if(interaction == 3)
1416 print_nl(262); /* ! */
1417 print(1108); /* Misplaced */
1419 print_cmd_chr(cur_cmd, cur_chr);
1420 if(cur_tok == 1062) {
1423 help_line[5]= 1109; /* I can't figure out why you would want to use a tab mark */
1424 help_line[4]= 1110; /* here. If you just want an ampersand, the remedy is */
1425 help_line[3]= 1111; /* simple: Just type `I\&' now. But if some right brace */
1426 help_line[2]= 1112; /* up above has ended a previous alignment prematurely, */
1427 help_line[1]= 1113; /* you're probably due for more error messages, and you */
1428 help_line[0]= 1114; /* might try typing `S' now just to see what is salvageable. */
1434 help_line[4]= 1109; /* I can't figure out why you would want to use a tab mark */
1435 help_line[3]= 1115; /* or \cr or \span just now. If something like a right brace */
1436 help_line[2]= 1112; /* up above has ended a previous alignment prematurely, */
1437 help_line[1]= 1113; /* you're probably due for more error messages, and you */
1438 help_line[0]= 1114; /* might try typing `S' now just to see what is salvageable. */
1445 if(align_state < 0) {
1447 if(interaction == 3)
1449 print_nl(262); /* ! */
1450 print(654); /* Missing { inserted */
1453 cur_tok = 379; /* belowdisplayshortskip ? */
1457 if(interaction == 3)
1459 print_nl(262); /* ! */
1460 print(1104); /* Missing } inserted */
1467 help_line[2]= 1105; /* I've put in what seems to be necessary to fix */
1468 help_line[1]= 1106; /* the current column of the current alignment. */
1469 help_line[0]= 1107; /* Try to go on, since this might almost work. */
1475 void noalign_error (void)
1478 if(interaction == 3)
1480 print_nl(262); /* ! */
1481 print(1108); /* Misplaced */
1483 print_esc(524); /* noalign */
1486 help_line[1]= 1116; /* I expect to see \noalign only after the \cr of */
1487 help_line[0]= 1117; /* an alignment. Proceed, and I'll ignore this case. */
1491 /* only called from tex8.c */
1493 void omit_error (void)
1496 if(interaction == 3)
1498 print_nl(262); /* ! */
1499 print(1108); /* Misplaced */
1501 print_esc(527); /* omit */
1504 help_line[1]= 1118; /* I expect to see \omit only after tab marks or the \cr of */
1505 help_line[0]= 1117; /* an alignment. Proceed, and I'll ignore this case. */
1512 if(cur_group == 6) {
1514 if(fin_col ())fin_row ();
1518 /* only called form tex8.c */
1520 void cs_error (void)
1523 if(interaction == 3)
1525 print_nl(262); /* ! */
1526 print(773); /* Extra */
1528 print_esc(502); /* endcsname */
1531 help_line[0]= 1120; /* I'm ignoring this, since I wasn't doing a \csname. */
1536 void push_math_(group_code c)
1540 cur_list.aux_field.cint = 0;
1544 void init_math (void)
1551 internal_font_number f;
1556 if((cur_cmd == 3)&&(mode > 0))
1561 w = -1073741823L; /* - (2^30 - 1) */
1565 line_break(eqtb[(hash_size + 3170)].cint);
1566 v = mem[just_box + 4].cint + 2 * font_info[6 +
1567 param_base[eqtb[(hash_size + 1834)].hh.v.RH]].cint;
1568 w = -1073741823L; /* - (2^30 - 1) */
1569 p = mem[just_box + 5].hh.v.RH;
1572 lab21: if((p >= hi_mem_min))
1575 d = font_info[width_base[f]+ font_info[char_base[f]+ mem[p
1576 ].hh.b1].qqqq.b0].cint;
1579 switch(mem[p].hh.b0)
1584 d = mem[p + 1].cint;
1590 mem[mem_top - 12]= mem[p + 1];
1591 mem[mem_top - 12].hh.v.RH = mem[p].hh.v.RH;
1598 d = mem[p + 1].cint;
1602 q = mem[p + 1].hh.v.LH;
1603 d = mem[q + 1].cint;
1604 if(mem[just_box + 5].hh.b0 == 1)
1606 if((mem[just_box + 5].hh.b1 == mem[q].hh.b0)&&(mem
1608 v = 1073741823L; /* - (2^30 - 1) */
1610 else if(mem[just_box + 5].hh.b0 == 2)
1612 if((mem[just_box + 5].hh.b1 == mem[q].hh.b1)&&(mem
1614 v = 1073741823L; /* - (2^30 - 1) */
1616 if(mem[p].hh.b1 >= 100)
1627 if(v < 1073741823L) /* - (2^30 - 1) */
1630 lab40: if(v < 1073741823L) /* - (2^30 - 1) */
1637 w = 1073741823L; /* - (2^30 - 1) */
1640 lab45: p = mem[p].hh.v.RH;
1644 if(eqtb[(hash_size + 1312)].hh.v.RH == 0)
1645 if((eqtb[(hash_size + 3747)].cint != 0)&&(((eqtb[(hash_size + 3204)].cint >= 0)&&
1646 (prev_graf + 2 > eqtb[(hash_size + 3204)].cint)) ||(prev_graf +
1647 1 < - (integer) eqtb[(hash_size + 3204)].cint)))
1649 l = eqtb[(hash_size + 3733)].cint - abs(eqtb[(hash_size + 3747)].cint);
1650 if(eqtb[(hash_size + 3747)].cint > 0)
1651 s = eqtb[(hash_size + 3747)].cint;
1656 l = eqtb[(hash_size + 3733)].cint;
1661 n = mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH;
1662 if(prev_graf + 2 >= n)
1663 p = eqtb[(hash_size + 1312)].hh.v.RH + 2 * n;
1664 else p = eqtb[(hash_size + 1312)].hh.v.RH + 2 *(prev_graf + 2);
1665 s = mem[p - 1].cint;
1670 eq_word_define((hash_size + 3207), -1);
1671 eq_word_define((hash_size + 3743), w);
1672 eq_word_define((hash_size + 3744), l);
1673 eq_word_define((hash_size + 3745), s);
1674 if(eqtb[(hash_size + 1316)].hh.v.RH != 0)/* everydisplay */
1675 begin_token_list(eqtb[(hash_size + 1316)].hh.v.RH, 9);
1685 eq_word_define((hash_size + 3207), -1);
1686 if(eqtb[(hash_size + 1315)].hh.v.RH != 0)/* everymath */
1687 begin_token_list(eqtb[(hash_size + 1315)].hh.v.RH, 8);
1692 void start_eq_no (void)
1694 save_stack[save_ptr + 0].cint = cur_chr;
1698 eq_word_define((hash_size + 3207), -1);
1699 if(eqtb[(hash_size + 1315)].hh.v.RH != 0)/* everymath */
1700 begin_token_list(eqtb[(hash_size + 1315)].hh.v.RH, 8);
1704 void scan_math_(halfword p)
1709 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1710 lab21: switch(cur_cmd)
1715 c = eqtb[(hash_size + 2907) + cur_chr].hh.v.RH;
1719 cur_cs = cur_chr + 1;
1720 cur_cmd = eqtb[cur_cs].hh.b0;
1721 cur_chr = eqtb[cur_cs].hh.v.RH;
1739 scan_fifteen_bit_int ();
1748 scan_twenty_seven_bit_int ();
1750 /* c = cur_val >> 12; */
1757 save_stack[save_ptr + 0].cint = p;
1765 mem[p].hh.b1 = c % 256;
1766 /* mem[p].hh.b1 = c & 255; */ /* last 8 bits */
1767 if((c >= 28672)&& /* 32768 - 4096 ??? if (c>=var_code) and ... */
1768 ((eqtb[(hash_size + 3207)].cint >= 0)&&
1769 (eqtb[(hash_size + 3207)].cint < 16)))
1770 mem[p].hh.b0 = eqtb[(hash_size + 3207)].cint;
1771 else mem[p].hh.b0 =(c / 256)% 16;
1772 /* else mem[p].hh.b0 =(c >> 8)& 15; */ /* 4 bits to left */
1775 void set_math_char_(integer c)
1780 cur_cs = cur_chr + 1; /* ??? */
1781 /* cur_cmd = eqtb[eqtbextra + cur_cs].hh.b0; */ /* was wrong ??? */
1782 cur_cmd = eqtb[cur_cs].hh.b0;
1783 /* cur_chr = eqtb[cur_cs].hh.v.RH; */ /* should have been eqtbextra ? */
1784 cur_chr = eqtb[cur_cs].hh.v.RH;
1791 mem[p + 1].hh.v.RH = 1;
1792 mem[p + 1].hh.b1 = c % 256;
1793 /* mem[p + 1].hh.b1 = c & 255; */ /* last 8 bits */
1794 mem[p + 1].hh.b0 =(c / 256)% 16;
1795 /* mem[p + 1].hh.b0 =(c >> 8)& 15; */ /* 4 bits to left */
1796 if(c >= 28672) /* 32768 - 4096 ? */
1798 if(((eqtb[(hash_size + 3207)].cint >= 0)&&(eqtb[(hash_size + 3207)].cint < 16))
1800 mem[p + 1].hh.b0 = eqtb[(hash_size + 3207)].cint;
1803 else mem[p].hh.b0 = 16 +(c / 4096);
1804 /* else mem[p].hh.b0 = 16 +(c >> 12); */
1805 mem[tail].hh.v.RH = p;
1810 void math_limit_switch (void)
1813 if(mem[tail].hh.b0 == 17)
1815 mem[tail].hh.b1 = cur_chr;
1819 if(interaction == 3)
1821 print_nl(262); /* ! */
1822 print(1124); /* Limit controls must follow a math operator */
1826 help_line[0]= 1125; /* I'm ignoring this misplaced \limits or \nolimits command. */
1831 void scan_delimiter_(halfword p, bool r)
1834 scan_twenty_seven_bit_int ();
1840 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1844 cur_val = eqtb[(hash_size + 3474) + cur_chr].cint;
1847 scan_twenty_seven_bit_int ();
1857 if(interaction == 3)
1859 print_nl(262); /* ! */
1860 print(1126); /* Missing delimiter (. inserted) */
1864 help_line[5]= 1127; /* I was expecting to see something like `(' or `\{' or */
1865 help_line[4]= 1128; /* `\}' here. If you typed, e.g., `{' instead of `\{', you */
1866 help_line[3]= 1129; /* should probably delete the `{' by typing `1' now, so that */
1867 help_line[2]= 1130; /* braces don't get unbalanced. Otherwise just proceed. */
1868 help_line[1]= 1131; /* Acceptable delimiters are characters whose \delcode is */
1869 help_line[0]= 1132; /* nonnegative, or you can use `\delimiter <delimiter code>'. */
1874 /* attempt to speed up - bkph */ /* is compiler smart enough already ? */
1875 mem[p].qqqq.b0 =(cur_val / 1048576L)% 16; /* 2^20 */
1876 /* mem[p].qqqq.b0 =(cur_val >> 20)& 15; */
1877 mem[p].qqqq.b1 =(cur_val / 4096)% 256;
1878 /* mem[p].qqqq.b1 =(cur_val >> 12)& 255; */
1879 mem[p].qqqq.b2 =(cur_val / 256)% 16;
1880 /* mem[p].qqqq.b2 =(cur_val >> 8)& 15; */
1881 mem[p].qqqq.b3 = cur_val % 256;
1882 /* mem[p].qqqq.b3 = cur_val & 255; */
1885 void math_radical (void)
1888 mem[tail].hh.v.RH = get_node(5);
1889 tail = mem[tail].hh.v.RH;
1891 mem[tail].hh.b0 = 24;
1892 mem[tail].hh.b1 = 0;
1893 mem[tail + 1].hh = empty_field;
1894 mem[tail + 3].hh = empty_field;
1895 mem[tail + 2].hh = empty_field;
1896 scan_delimiter(tail + 4, true);
1897 scan_math(tail + 1);
1905 if(interaction == 3)
1907 print_nl(262); /* ! */
1908 print(1133); /* Please use */
1910 print_esc(520); /* mathaccent */
1911 print(1134); /* for accents in math mode */
1914 help_line[1]= 1135; /* I'm changing \accent to \mathaccent here; wish me luck. */
1915 help_line[0]= 1136; /* (Accents are not the same in formulas as they are in text.) */
1920 mem[tail].hh.v.RH = get_node(5);
1921 tail = mem[tail].hh.v.RH;
1923 mem[tail].hh.b0 = 28;
1924 mem[tail].hh.b1 = 0;
1925 mem[tail + 1].hh = empty_field;
1926 mem[tail + 3].hh = empty_field;
1927 mem[tail + 2].hh = empty_field;
1928 mem[tail + 4].hh.v.RH = 1;
1929 scan_fifteen_bit_int ();
1930 mem[tail + 4].hh.b1 = cur_val % 256;
1931 /* mem[tail + 4].hh.b1 = cur_val & 255; */
1932 if((cur_val >= 28672)&& /* 32768 - 4096 ? */
1933 ((eqtb[(hash_size + 3207)].cint >= 0)&&
1934 (eqtb[(hash_size + 3207)].cint < 16)))
1935 mem[tail + 4].hh.b0 = eqtb[(hash_size + 3207)].cint;
1936 else mem[tail + 4].hh.b0 =(cur_val / 256)% 16;
1937 /* else mem[tail + 4].hh.b0 =(cur_val >> 8)& 15; */
1938 scan_math(tail + 1);
1941 void append_choices (void)
1944 mem[tail].hh.v.RH = new_choice ();
1945 tail = mem[tail].hh.v.RH;
1948 save_stack[save_ptr - 1].cint = 0;
1953 halfword fin_mlist_(halfword p)
1954 {register halfword Result;
1956 if(cur_list.aux_field.cint != 0)
1958 mem[cur_list.aux_field.cint + 3].hh.v.RH = 3;
1959 mem[cur_list.aux_field.cint + 3].hh.v.LH = mem[head]
1962 q = cur_list.aux_field.cint;
1965 q = mem[cur_list.aux_field.cint + 2].hh.v.LH;
1966 if(mem[q].hh.b0 != 30){
1967 confusion(871); /* right */
1968 return 0; // abort_flag set
1970 mem[cur_list.aux_field.cint + 2].hh.v.LH = mem[q].hh.v.RH;
1971 mem[q].hh.v.RH = cur_list.aux_field.cint;
1972 mem[cur_list.aux_field.cint].hh.v.RH = p;
1977 mem[tail].hh.v.RH = p;
1978 q = mem[head].hh.v.RH;
1985 void build_choices (void)
1990 switch(save_stack[save_ptr - 1].cint)
1992 mem[tail + 1].hh.v.LH = p;
1995 mem[tail + 1].hh.v.RH = p;
1998 mem[tail + 2].hh.v.LH = p;
2002 mem[tail + 2].hh.v.RH = p;
2008 incr(save_stack[save_ptr - 1].cint);
2015 /* small_number t; */
2016 int t; /* 95/Jan/7 */
2021 if((mem[tail].hh.b0 >= 16)&&
2022 (mem[tail].hh.b0 < 30))
2024 p = tail + 2 + cur_cmd - 7;
2027 if((p == 0)||(t != 0))
2030 mem[tail].hh.v.RH = new_noad ();
2031 tail = mem[tail].hh.v.RH;
2033 p = tail + 2 + cur_cmd - 7;
2039 if(interaction == 3)
2041 print_nl(262); /* ! */
2042 print(1137); /* Double superscript */
2046 help_line[0]= 1138; /* I treat `x^1^2' essentially like `x^1{}^2'. */
2052 if(interaction == 3)
2054 print_nl(262); /* ! */
2055 print(1139); /* Double subscript */
2059 help_line[0]= 1140; /* I treat `x_1_2' essentially like `x_1{}_2'. */
2067 /* used to continue here with math_fraction etc in tex7.c */
2068 /*****************************************************************************/
2069 /* moved down here to avoid pragma optimize questions 96/Sep/12 */
2070 /* #pragma optimize("g", off) */ /* for MC VS compiler */
2071 /* #pragma optimize("a", off) */ /* for MC VS compiler */
2073 void package_(small_number c)
2078 d = eqtb[(hash_size + 3737)].cint;
2080 save_ptr = save_ptr - 3;
2082 cur_box = hpack(mem[head].hh.v.RH, save_stack[save_ptr
2083 + 2].cint, save_stack[save_ptr + 1].cint);
2086 cur_box = vpackage(mem[head].hh.v.RH, save_stack[
2087 save_ptr + 2].cint, save_stack[save_ptr + 1].cint, d);
2091 p = mem[cur_box + 5].hh.v.RH;
2093 if(mem[p].hh.b0 <= 2)
2094 h = mem[p + 3].cint;
2095 mem[cur_box + 2].cint = mem[cur_box + 2].cint - h + mem[cur_box +
2097 mem[cur_box + 3].cint = h;
2101 box_end(save_stack[save_ptr + 0].cint);
2103 /* #pragma optimize("g", on) */ /* for MC VS compiler */
2104 /* #pragma optimize("a", on) */ /* for MC VS compiler */
2105 /* #pragma optimize("a",) */ /* 94/Jan/25 */
2106 #pragma optimize ("", on) /* 96/Sep/12 */
2107 /****************************************************************************/