1 /* Copyright 1992 Karl Berry
2 Copyright 2007 TeX Users Group
3 Copyright 2014 Clerk Ma
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #pragma warning(disable:4115) // kill rpcasync.h complaint
27 #define MYLIBAPI __declspec(dllexport)
32 #pragma warning(disable:4996)
33 #pragma warning(disable:4131) // old style declarator
34 #pragma warning(disable:4135) // conversion between different integral types
35 #pragma warning(disable:4127) // conditional expression is constant
43 #pragma warning(disable:4244) /* 96/Jan/10 */
45 #include <time.h> // needed for clock_t
47 /* #define CHECKPOOL */ /* debugging only */
49 #define BEGINFMTCHECKSUM 367403084L
50 #define ENDFMTCHECKSUM 69069L
52 extern clock_t start_time, main_time, finish_time; /* in local.c */
54 /* imported from pascal.h */
55 /* localized here to avoid conflict with io.h in other code */
57 #define read(f, b) ((b) = getc (f))
58 #define readln(f) { register int c; while ((c = getc (f)) != '\n' && c != EOF); }
59 /* #define readln(f) { while (getc (f) >= ' '); } ? use fgets ? */
62 void do_initex (void); /* later in this file */
65 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
67 void initialize (void)
71 integer flag; /* bkph */
72 #ifndef ALLOCATEHYPHEN
76 /* We already initialized xchr if we are using non_ascii setup */
80 /* Normally, there is no translation of character code numbers */
83 register integer for_end;
88 xchr[i]= (char) i; /* 95/Jan/7 */
92 /* This is a kind of joke, since the characters are given as numeric codes ! */
192 register integer for_end;
197 while(i++ < for_end);
201 register integer for_end;
206 while(i++ < for_end);
208 #endif /* end of JOKE */
209 } /* end of plain ASCII case (otherwise have read in xchr vector before) */
211 /* Fill in background of `delete' for inverse mapping */
214 register integer for_end;
218 do xord[chr(i)] = 127;
219 while(i++ < for_end);
224 register integer for_end;
228 do xord[xchr[i]] = i;
229 while(i++ < for_end);
233 register integer for_end;
237 do xord[xchr[i]] = i;
238 while(i++ < for_end);
242 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
243 /* Now invert the xchr mapping to get xord mapping */
246 register integer for_end;
250 do xord[xchr[i]] = (char) i;
251 while(i++ < for_end);
254 xord[127]= 127; /* hmm, a fixed point ? why ? */
256 flag = 0; /* 93/Dec/28 - bkph */
257 if (trace_flag != 0) {
258 for (k = 0; k < 256; k++) /* entries in xord / xchr */
263 if (flag) { /* 127 here means mapping undefined */
264 show_line("Inverted mapping xord[] pairs:\n", 0);
265 for (k = 0; k < 256; k++) { /* entries in xord / xchr */
267 sprintf(log_line, "%d => %d\n", k, xord[k]);
268 show_line(log_line, 0);
273 if (interaction < 0) /* may now set in local.c bkph */
274 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
276 deletions_allowed = true;
277 set_box_allowed = true;
280 use_err_help = false;
282 OK_to_interrupt = true;
284 /* darn, need to know mem_top, mem_max etc for the following ... */
286 was_mem_end = mem_min;
287 /* was_lo_max = mem_min; */
288 was_lo_max = mem_bot;
289 /* was_hi_min = mem_max; */
290 was_hi_min = mem_top;
298 cur_list.aux_field.cint = ignore_depth;
303 page_tail = page_head;
305 if (is_initex) /* in iniTeX we did already allocate mem [] */
307 mem[page_head].hh.v.RH = 0;
308 /* last_glue = 262143L; */ /* NO! */
309 last_glue = empty_flag;
314 /* from int_base to eqtb_size */
316 register integer for_end;
317 k = (hash_size + 3163);
318 for_end = (hash_size + 4006);
321 while(k++ < for_end);
323 no_new_control_sequence = true;
324 hash[514].v.LH = 0; /* next(hash_base):= 0 */
325 hash[514].v.RH = 0; /* text(hash_base):= 0 */
326 /* 514 + hash_size + 266 = hashbase + hashsize + 10 + font_max */
327 /* for k <- hashbase+1 to undefined_control_sequence - 1 do ... p.257 */
329 register integer for_end;
331 for_end = (hash_size + 780);
333 do hash[k]= hash[514];
334 while(k++ < for_end);
352 register integer for_end;
357 while(k++ < for_end);
364 register integer for_end;
368 do font_used[k]= false;
369 while(k++ < for_end);
371 null_character.b0 = 0;
372 null_character.b1 = 0;
373 null_character.b2 = 0;
374 null_character.b3 = 0;
380 doing_leaders = false;
383 half_buf = dvi_buf_size / 2;
384 dvi_limit = dvi_buf_size;
388 /* down_ptr:=null; right_ptr:=null; l.12027 */
394 empty_field.v.RH = 0;
395 empty_field.v.LH = 0;
396 null_delimiter.b0 = 0;
397 null_delimiter.b1 = 0;
398 null_delimiter.b2 = 0;
399 null_delimiter.b3 = 0;
406 /* *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
407 #ifndef ALLOCATEHYPHEN
408 /* {register integer for_end; z = 0; for_end = 607; if(z <= for_end) do */
410 register integer for_end;
412 for_end = hyphen_prime;
418 while(z++ < for_end);
422 output_active = false;
423 insert_penalties = 0;
424 ligature_present = false;
425 cancel_boundary = false;
430 long_help_seen = false;
433 register integer for_end;
437 do write_open[k]= false;
438 while(k++ < for_end);
443 /* initex stuff split off for convenience of optimization adjustments */
444 if (is_initex) do_initex ();
446 /* trap the -i on command line situation if INITEX was NOT defined */
448 show_line("Sorry, somebody forgot to make an INITEX!\n", 1);
450 #endif /* not INITEX */
453 /* do the part of initialize() that requires mem_top, mem_max or mem[] */
454 /* do this part after allocating main memory */
457 void initialize_aux (void)
460 was_mem_end = mem_min;
461 /* was_lo_max = mem_min; */
462 was_lo_max = mem_bot;
463 /* was_hi_min = mem_max; */
464 was_hi_min = mem_top;
468 /* max_nest_stack = 0; */
472 cur_list.aux_field.cint = ignore_depth;
475 /* shown_mode = 0; */
476 /* page_contents = 0; */
477 page_tail = page_head;
478 //mem[mem_top - 2].hh.v.RH = 0;
481 #endif // end of ifdef ALLOCATEMAIN
483 void line_break_ (integer finalwidowpenalty)
484 {/* 30 31 32 33 34 35 22 */
487 halfword q, r, s, prevs;
488 internal_font_number f;
489 /* small_number j; */
490 int j; /* 95/Jan/7 */
491 /* unsigned char c; */
492 unsigned int c; /* 95/Jan/7 */
494 /* savedbadness = 0; */ /* 96/Feb/9 */
495 pack_begin_line = mode_line;
496 mem[temp_head].hh.v.RH = link(head);
497 if((tail >= hi_mem_min))
499 link(tail) = new_penalty(10000);
502 else if(mem[tail].hh.b0 != 10)
504 link(tail) = new_penalty(10000);
509 delete_glue_ref(mem[tail + 1].hh.v.LH);
510 flush_node_list(mem[tail + 1].hh.v.RH);
511 mem[tail + 1].cint = 10000;
513 link(tail) = new_param_glue(par_fill_skip_code);
514 /* *********************************************************************** */
515 /* following is new in 3.14159 */
516 init_cur_lang = prev_graf % 65536L;
517 init_l_hyf = prev_graf / 4194304L; /* 2^22 */
518 init_r_hyf =(prev_graf / 65536L)% 64;
519 /* *********************************************************************** */
521 noshrinkerroryet = true;
522 if((mem[eqtb[(hash_size + 789)].hh.v.RH].hh.b1 != 0)&&
523 (mem[eqtb[(hash_size + 789)].hh.v.RH + 3].cint != 0))
525 eqtb[(hash_size + 789)].hh.v.RH =
526 finite_shrink(eqtb[(hash_size + 789)].hh.v.RH);
528 if((mem[eqtb[(hash_size + 790)].hh.v.RH].hh.b1 != 0)&&
529 (mem[eqtb[(hash_size + 790)].hh.v.RH + 3].cint != 0))
531 eqtb[(hash_size + 790)].hh.v.RH =
532 finite_shrink(eqtb[(hash_size + 790)].hh.v.RH);
534 q = eqtb[(hash_size + 789)].hh.v.RH;
535 r = eqtb[(hash_size + 790)].hh.v.RH;
536 background[1]= mem[q + 1].cint + mem[r + 1].cint;
541 background[2 + mem[q].hh.b0]= mem[q + 2].cint;
542 background[2 + mem[r].hh.b0]= background[2 + mem[r].hh.b0]+
544 background[6]= mem[q + 3].cint + mem[r + 3].cint;
545 minimum_demerits = 1073741823L; /* 2^30 - 1 */ /* 40000000 hex - 1 */
546 minimal_demerits[3]= 1073741823L;
547 minimal_demerits[2]= 1073741823L;
548 minimal_demerits[1]= 1073741823L;
549 minimal_demerits[0]= 1073741823L;
550 if(eqtb[(hash_size + 1312)].hh.v.RH == 0)
551 if(eqtb[(hash_size + 3747)].cint == 0)
553 last_special_line = 0;
554 second_width = eqtb[(hash_size + 3733)].cint;
558 last_special_line = abs(eqtb[(hash_size + 3204)].cint);
559 if(eqtb[(hash_size + 3204)].cint < 0)
561 first_width = eqtb[(hash_size + 3733)].cint -
562 abs(eqtb[(hash_size + 3747)].cint);
563 if(eqtb[(hash_size + 3747)].cint >= 0)
564 first_indent = eqtb[(hash_size + 3747)].cint;
565 else first_indent = 0;
566 second_width = eqtb[(hash_size + 3733)].cint;
569 first_width = eqtb[(hash_size + 3733)].cint;
571 second_width = eqtb[(hash_size + 3733)].cint -
572 abs(eqtb[(hash_size + 3747)].cint);
573 if(eqtb[(hash_size + 3747)].cint >= 0)
574 second_indent = eqtb[(hash_size + 3747)].cint;
575 else second_indent = 0;
579 last_special_line = mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH - 1;
580 second_width = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 *(last_special_line + 1)].cint;
581 second_indent = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * last_special_line + 1].cint;
583 /* if looseness=0 then easy_line:=last_special_line */
584 if(eqtb[(hash_size + 3182)].cint == 0)
585 easyline = last_special_line;
586 /* else easyline = 262143L; */ /* NO! */
587 else easyline = empty_flag;
588 /* threshold:=pretolerance; */
589 threshold = eqtb[(hash_size + 3163)].cint;
594 /* if tracing_paragraphs>0 then */
595 if(eqtb[(hash_size + 3195)].cint > 0)
598 print_nl("@firstpass");
603 first_pass_count++; /* 96 Feb 9 */
606 /* threshold:=tolerance; second_pass:=true; */
607 threshold = eqtb[(hash_size + 3164)].cint;
609 /* final_pass:=(emergency_stretch<=0); */
610 final_pass =(eqtb[(hash_size + 3750)].cint <= 0);
613 if(eqtb[(hash_size + 3195)].cint > 0)
618 /* if threshold>inf_bad then threshold:=inf_bad; */
619 if(threshold > 10000)
625 if (is_initex) { /* bkph */
626 if(trie_not_ready)init_trie ();
629 /* ********************************************************************* */
630 /* following has changed in 3.14159 */
632 cur_lang = init_cur_lang;
633 /* lhyf = cur_list .lhmfield; */
635 /* rhyf = cur_list .rhmfield; */
637 /* ********************************************************************* */
642 mem[q].hh.v.RH = active;
643 mem[q + 1].hh.v.RH = 0;
644 mem[q + 1].hh.v.LH = prev_graf + 1;
646 mem[active].hh.v.RH = q;
647 active_width[1] = background[1];
648 active_width[2] = background[2];
649 active_width[3] = background[3];
650 active_width[4] = background[4];
651 active_width[5] = background[5];
652 active_width[6] = background[6];
653 /* passive:=null; printed_node:=temp_head; pass_number:=0; */
655 printed_node = temp_head;
657 font_in_short_display = 0;
658 cur_p = mem[temp_head].hh.v.RH;
661 /* while (cur_p<>null)and(link(active)<>last_active) do */
662 while((cur_p != 0)&&(mem[active].hh.v.RH != active))
664 if((cur_p >= hi_mem_min))
668 f = mem[cur_p].hh.b0;
669 active_width[1]= active_width[1]+ font_info[width_base[f]+
670 font_info[char_base[f]+ mem[cur_p].hh.b1].qqqq.b0].cint
672 cur_p = mem[cur_p].hh.v.RH;
673 } while(!(!(cur_p >= hi_mem_min)));
675 switch(mem[cur_p].hh.b0)
679 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
682 if(mem[cur_p].hh.b1 == 4)
684 cur_lang = mem[cur_p + 1].hh.v.RH; /* ASCII_code */
685 lhyf = mem[cur_p + 1].hh.b0;
686 rhyf = mem[cur_p + 1].hh.b1;
693 if((prevp >= hi_mem_min))
695 else if((mem[prevp].hh.b0 < 9))
697 /* *********************************************************************** */
698 /* following is new in 3.14159 */
699 else if((mem[prevp].hh.b0 == 11)&&(mem[prevp].hh.b1
702 /* *********************************************************************** */
704 if((mem[mem[cur_p + 1].hh.v.LH].hh.b1 != 0)&&(mem[
705 mem[cur_p + 1].hh.v.LH + 3].cint != 0))
707 mem[cur_p + 1].hh.v.LH = finite_shrink(mem[cur_p + 1].hh.v.LH);
709 q = mem[cur_p + 1].hh.v.LH;
710 active_width[1]= active_width[1]+ mem[q + 1].cint;
711 active_width[2 + mem[q].hh.b0]= active_width[2 + mem[q]
712 .hh.b0]+ mem[q + 2].cint;
713 active_width[6]= active_width[6]+ mem[q + 3].cint;
714 if(second_pass && autobreaking)
717 s = mem[prevs].hh.v.RH;
721 if((s >= hi_mem_min))
726 else if(mem[s].hh.b0 == 6)
727 if(mem[s + 1].hh.v.RH == 0)
731 q = mem[s + 1].hh.v.RH;
735 else if((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
738 else if(mem[s].hh.b0 == 8)
740 if(mem[s].hh.b1 == 4)
742 cur_lang = mem[s + 1].hh.v.RH; /* ASCII_code */
743 lhyf = mem[s + 1].hh.b0;
744 rhyf = mem[s + 1].hh.b1;
749 if(eqtb[(hash_size + 2139) + c].hh.v.RH != 0)
750 /* signed unsigned mismatch ? (c is unsigned) */
751 if((eqtb[(hash_size + 2139) + c].hh.v.RH == c)||
752 (eqtb[(hash_size + 3201)].cint > 0))
756 s = mem[prevs].hh.v.RH;
758 lab32: hyf_char = hyphen_char[hf];
759 /* if hyf_char<0 then goto done1; */
760 if(hyf_char < 0) goto lab31;
761 /* if hyf_char>255 then goto done1; */
762 if(hyf_char > 255) goto lab31; /* ? */
764 if(lhyf + rhyf > 63) goto lab31;
767 if((s >= hi_mem_min)) {
768 if(mem[s].hh.b0 != hf)
770 hyfbchar = mem[s].hh.b1;
771 c = hyfbchar; /* unsigned char c; */
772 if(eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
779 /* long to short ... */
780 hc[hn]= eqtb[(hash_size + 2139) + c].hh.v.RH;
781 hyfbchar = 256; /* special mark */
783 else if(mem[s].hh.b0 == 6)
785 if(mem[s + 1].hh.b0 != hf)
787 /* j:=hn; q:=lig_ptr(s); l.17554 */
789 q = mem[s + 1].hh.v.RH;
790 /* if q>null then hyf_bchar:=character(q); l.17554 BUG ??? */
792 if(q != 0) /* 94/Mar/23 BUG FIX */
793 hyfbchar = mem[q].hh.b1;
794 /* while q>null do l.17555 BUG ??? */
796 while(q != 0){ /* 94/Mar/23 BUG FIX */
798 if(eqtb[(hash_size + 2139) + c].hh.v.RH == 0)
804 /* long to short ... */
805 hc[j]= eqtb[(hash_size + 2139) + c].hh.v.RH;
810 if(odd(mem[s].hh.b1))
811 hyfbchar = font_bchar[hf];
812 else hyfbchar = 256; /* special mark */
814 else if((mem[s].hh.b0 == 11)&&(mem[s].hh.b1 ==
818 /* ******************************************************************** */
819 hyfbchar = font_bchar[hf]; /* new code in 3.14159 */
820 /* ******************************************************************** */
829 if(!((s >= hi_mem_min)))
835 if(mem[s].hh.b1 != 0)
860 /* ******************************************************************* */
861 if(mem[cur_p].hh.b1 == 1)/* change in 3.14159 */
862 /* ******************************************************************* */
864 if(!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
865 if(mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
867 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
869 /* ******************************************************************* */
870 /* change in 3.14159 */
871 else active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
872 /* ******************************************************************* */
876 f = mem[cur_p + 1].hh.b0;
877 active_width[1]= active_width[1]+ font_info[width_base[f]+
878 font_info[char_base[f]+ mem[cur_p + 1].hh.b1].qqqq.b0]
884 s = mem[cur_p + 1].hh.v.LH;
887 try_break(eqtb[(hash_size + 3167)].cint, 1);
891 if((s >= hi_mem_min))
894 disc_width = disc_width + font_info[width_base[f]+ font_info
895 [ char_base[f]+ mem[s].hh.b1].qqqq.b0].cint;
897 else switch(mem[s].hh.b0)
900 f = mem[s + 1].hh.b0;
901 disc_width = disc_width + font_info[width_base[f]+
902 font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0
910 disc_width = disc_width + mem[s + 1].cint;
914 confusion(931); /* disc3 */
915 return; // abort_flag set
921 active_width[1]= active_width[1]+ disc_width;
922 try_break(eqtb[(hash_size + 3166)].cint, 1);
923 active_width[1]= active_width[1]- disc_width;
925 r = mem[cur_p].hh.b1;
926 s = mem[cur_p].hh.v.RH;
928 if((s >= hi_mem_min))
931 active_width[1]= active_width[1]+ font_info[width_base[f
932 ]+ font_info[char_base[f]+ mem[s].hh.b1].qqqq.b0]
935 else switch(mem[s].hh.b0)
938 f = mem[s + 1].hh.b0;
939 active_width[1]= active_width[1]+ font_info[width_base[
940 f]+ font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq
948 active_width[1]= active_width[1]+ mem[s + 1].cint;
952 confusion(932); /* disc4 */
953 return; // abort_flag set
967 autobreaking =(mem[cur_p].hh.b1 == 1);
969 if(!(mem[cur_p].hh.v.RH >= hi_mem_min)&& autobreaking)
970 if(mem[mem[cur_p].hh.v.RH].hh.b0 == 10)
972 active_width[1]= active_width[1]+ mem[cur_p + 1].cint;
977 try_break(mem[cur_p + 1].cint, 0);
986 confusion(930); /* paragraph */
987 return; // abort_flag set
992 cur_p = mem[cur_p].hh.v.RH;
997 try_break(-10000, 1);
998 if(mem[active].hh.v.RH != active)
1000 r = mem[active].hh.v.RH;
1001 fewest_demerits = 1073741823L; /* 2^30 - 1 */
1003 if(mem[r].hh.b0 != 2)
1004 if(mem[r + 2].cint < fewest_demerits)
1006 fewest_demerits = mem[r + 2].cint;
1010 } while(!(r == active));
1011 best_line = mem[best_bet + 1].hh.v.LH;
1012 /* if looseness=0 then goto done; */
1013 if(eqtb[(hash_size + 3182)].cint == 0){
1014 /* if (final_pass && eqtb[(hash_size + 3750)].cint > 0){ */
1015 /* paragraph_failed++; */
1017 goto lab30; /* normal exit */
1020 /* r:=link(active); actual_looseness:=0; */
1021 r = mem[active].hh.v.RH;
1022 actual_looseness = 0;
1024 if(mem[r].hh.b0 != 2)
1026 /* line_diff:=line_number(r)-best_line; */
1027 line_diff = toint(mem[r + 1].hh.v.LH)- toint(best_line
1029 /* if ((line_diff<actual_looseness)and(looseness<=line_diff))or@|
1030 ((line_diff>actual_looseness)and(looseness>=line_diff)) then */
1031 if(((line_diff < actual_looseness)&&
1032 (eqtb[(hash_size + 3182)].cint
1033 <= line_diff)) ||((line_diff > actual_looseness)&&
1034 (eqtb[(hash_size + 3182)].cint >= line_diff)))
1037 actual_looseness = line_diff;
1038 fewest_demerits = mem[r + 2].cint;
1040 else if((line_diff == actual_looseness)&&(mem[r + 2]
1041 .cint < fewest_demerits))
1044 fewest_demerits = mem[r + 2].cint;
1048 } while(!(r == active));
1049 best_line = mem[best_bet + 1].hh.v.LH;
1051 /* if (actual_looseness=looseness)or final_pass then goto done; */
1052 /* if((actual_looseness == eqtb[(hash_size + 3182)].cint)|| final_pass)*/
1053 if((actual_looseness == eqtb[(hash_size + 3182)].cint)) {
1061 q = mem[active].hh.v.RH;
1063 cur_p = mem[q].hh.v.RH;
1064 if(mem[q].hh.b0 == 2)
1066 else free_node(q, 3);
1071 cur_p = mem[q].hh.v.RH;
1079 if(eqtb[(hash_size + 3195)].cint > 0)
1080 print_nl("@second_pass"); /* */
1082 /* threshold:=tolerance; */
1083 threshold = eqtb[(hash_size + 3164)].cint;
1085 second_pass_count++; /* 96 Feb 9 */
1086 /* final_pass:=(emergency_stretch<=0); */
1087 final_pass =(eqtb[(hash_size + 3750)].cint <= 0);
1093 if(eqtb[(hash_size + 3195)].cint > 0) /* tracing_paragraphs */
1094 print_nl("@emergencypass"); /* */
1096 /* can only get here is \emergencystretch has been set positive */
1097 /* background[2]:=background[2]+emergency_stretch; final_pass:=true; */
1098 background[2]= background[2]+ eqtb[(hash_size + 3750)].cint;
1100 final_pass_count++; /* 96 Feb 9 */
1101 } /* end of if second_pass */
1102 } /* end of while(true)do */
1103 /* cannot drop through from above loop */
1104 lab30: /* common exit point */
1105 /* if (badness > (pre)tolerance) */
1106 /* if(last_badness > threshold){ */
1107 /* if(savedbadness > threshold){ */ /* do we believe this ??? */
1108 /* paragraph_failed++; */ /* 96/Feb/9 */
1110 /* if (prevgraf == 1) singleline++; */
1111 /* if (nest[nest_ptr].pg_field == 1) singleline++; */
1112 /* At this point best_line is number of lines in paragraph + 1 */
1113 if (best_line == 2) singleline++;
1116 if(eqtb[(hash_size + 3195)].cint > 0)
1118 end_diagnostic(true);
1119 normalize_selector ();
1122 post_line_break(finalwidowpenalty);
1123 q = mem[active].hh.v.RH;
1125 cur_p = mem[q].hh.v.RH;
1126 if(mem[q].hh.b0 == 2)
1128 else free_node(q, 3);
1132 while(q != 0){ /* while q<>null do l.16979 */
1133 cur_p = mem[q].hh.v.RH;
1137 pack_begin_line = 0;
1140 void prefixed_command (void)
1143 internal_font_number f;
1150 while(cur_cmd == 93){
1151 if(! odd(a / cur_chr))
1152 a = a + cur_chr; /* small_number a; */
1155 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1158 print_err("You can't use a prefix with `");
1159 print_cmd_chr(cur_cmd, cur_chr);
1160 print_char(39); /* ' */
1161 help1("I'll pretend you didn't say \\long or \\outer or \\global.");
1166 if((cur_cmd != 97)&&(a % 4 != 0)) {
1167 print_err("You can't use `");
1169 print_string("' or `");
1171 print_string("' with `");
1172 print_cmd_chr(cur_cmd, cur_chr);
1173 print_char(39); /* ' */
1174 help1("I'll pretend you didn't say \\long or \\outer here.");
1177 if(eqtb[(hash_size + 3206)].cint != 0)
1178 if(eqtb[(hash_size + 3206)].cint < 0)
1191 /* set_font: define(cur_font_loc,data,cur_chr); */
1193 geq_define((hash_size + 1834), 120, cur_chr);
1194 else eq_define((hash_size + 1834), 120, cur_chr);
1198 if(odd(cur_chr)&& !(a >= 4)&&
1199 (eqtb[(hash_size + 3206)].cint >= 0))
1204 q = scan_toks(true, e);
1205 if((a >= 4)) geq_define(p, 111 +(a % 4), def_ref);
1206 else eq_define(p, 111 +(a % 4), def_ref);
1218 } while(!(cur_cmd != 10));
1236 incr(mem[cur_chr].hh.v.LH);
1238 geq_define(p, cur_cmd, cur_chr);
1239 else eq_define(p, cur_cmd, cur_chr);
1247 if((a >= 4)) geq_define(p, 0, 256);
1248 else eq_define(p, 0, 256);
1249 scan_optional_equals ();
1255 geq_define(p, 68, cur_val);
1256 else eq_define(p, 68, cur_val);
1261 scan_fifteen_bit_int ();
1263 geq_define(p, 69, cur_val);
1264 else eq_define(p, 69, cur_val);
1269 scan_eight_bit_int ();
1273 geq_define(p, 73, (hash_size + 3218) + cur_val);
1274 else eq_define(p, 73, (hash_size + 3218) + cur_val);
1278 geq_define(p, 74, (hash_size + 3751) + cur_val);
1279 else eq_define(p, 74, (hash_size + 3751) + cur_val);
1283 geq_define(p, 75, (hash_size + 800) + cur_val);
1284 else eq_define(p, 75, (hash_size + 800) + cur_val);
1288 geq_define(p, 76, (hash_size + 1056) + cur_val);
1289 else eq_define(p, 76, (hash_size + 1056) + cur_val);
1293 geq_define(p, 72, (hash_size + 1322) + cur_val);
1294 else eq_define(p, 72, (hash_size + 1322) + cur_val);
1306 if(! scan_keyword(836)) /* to */
1308 print_err("Missing `to' inserted");
1309 help2("You should have said `\\read<number> to \\cs'.",
1310 "I'm going to look for the \\cs now.");
1316 if((a >= 4)) geq_define(p, 111, cur_val);
1317 else eq_define(p, 111, cur_val);
1326 scan_eight_bit_int ();
1327 p = (hash_size + 1322) + cur_val;
1330 scan_optional_equals ();
1333 } while(!((cur_cmd != 10)&&(cur_cmd != 0)));
1338 scan_eight_bit_int ();
1340 cur_chr = (hash_size + 1322) + cur_val;
1344 q = eqtb[cur_chr].hh.v.RH;
1347 geq_define(p, 101, 0);
1348 else eq_define(p, 101, 0);
1351 incr(mem[q].hh.v.LH);
1353 geq_define(p, 111, q);
1354 else eq_define(p, 111, q);
1361 q = scan_toks(false, false);
1362 if(mem[def_ref].hh.v.RH == 0){
1364 geq_define(p, 101, 0);
1365 else eq_define(p, 101, 0);
1367 mem[def_ref].hh.v.RH = avail;
1377 if(p == (hash_size + 1313)) /* output ? */
1379 mem[q].hh.v.RH = get_avail ();
1381 mem[q].hh.v.LH = 637;
1383 mem[q].hh.v.LH = 379;
1384 mem[q].hh.v.RH = mem[def_ref].hh.v.RH;
1385 mem[def_ref].hh.v.RH = q;
1388 geq_define(p, 111, def_ref);
1389 else eq_define(p, 111, def_ref);
1396 scan_optional_equals ();
1399 geq_word_define(p, cur_val);
1400 else eq_word_define(p, cur_val);
1406 scan_optional_equals ();
1407 scan_dimen(false, false, false);
1409 geq_word_define(p, cur_val);
1410 else eq_word_define(p, cur_val);
1418 scan_optional_equals ();
1419 if(n == 76) scan_glue(3);
1423 geq_define(p, 117, cur_val);
1424 else eq_define(p, 117, cur_val);
1429 if(cur_chr == (hash_size + 1883))
1431 else if(cur_chr == (hash_size + 2907))
1432 n = 32768L; /* 2^15 */
1433 else if(cur_chr == (hash_size + 2651))
1434 n = 32767; /* 2^15 - 1*/
1435 else if(cur_chr == (hash_size + 3474))
1436 n = 16777215L; /* 2^24 - 1 */
1437 else n = 255; /* 2^8 - 1 */
1441 scan_optional_equals ();
1443 if(((cur_val < 0)&&(p < (hash_size + 3474))) ||(cur_val > n))
1445 print_err("Invalid code(");
1447 if(p < (hash_size + 3474))
1448 print_string("), should be in the range 0..");
1450 print_string("), should be at most ");
1452 help1("I'm going to use 0 instead of that illegal code value.");
1456 if(p < (hash_size + 2907))
1458 geq_define(p, 120, cur_val);
1459 else eq_define(p, 120, cur_val);
1460 else if(p < (hash_size + 3474))
1462 geq_define(p, 120, cur_val);
1463 else eq_define(p, 120, cur_val);
1465 geq_word_define(p, cur_val);
1466 else eq_word_define(p, cur_val);
1472 scan_four_bit_int ();
1474 scan_optional_equals ();
1477 geq_define(p, 120, cur_val);
1478 else eq_define(p, 120, cur_val);
1485 do_register_command(a);
1489 scan_eight_bit_int ();
1493 scan_optional_equals ();
1494 if(set_box_allowed){
1495 scan_box(1073741824L + n); /* 2^30 + n */ /* box_flag + n */
1498 print_err("Improper ");
1499 print_esc("setbox"); /* */
1500 help2("Sorry, \\setbox is not allowed after \\halign in a display,",
1501 "or between \\accent and an accented character.");
1513 alter_page_so_far ();
1523 scan_optional_equals ();
1530 p = get_node(2 * n + 1);
1533 register integer for_end;
1538 scan_dimen(false, false, false);
1539 mem[p + 2 * j - 1].cint = cur_val;
1540 scan_dimen(false, false, false);
1541 mem[p + 2 * j].cint = cur_val;
1543 while(j++ < for_end);
1547 geq_define((hash_size + 1312), 118, p);
1548 else eq_define((hash_size + 1312), 118, p);
1556 if (is_initex) { /* bkph */
1561 print_err("Patterns can be loaded only by INITEX");
1566 } while(!(cur_cmd == 2));
1571 new_hyph_exceptions ();
1577 find_font_dimen(true);
1579 scan_optional_equals ();
1580 scan_dimen(false, false, false);
1581 font_info[k].cint = cur_val;
1589 scan_optional_equals ();
1591 if(n == 0)hyphen_char[f]= cur_val;
1592 else skew_char[f]= cur_val;
1603 confusion(1172); /* prefix */
1604 return; // abort_flag set
1607 } /* end of cur_cmd switch */
1611 if(after_token != 0) {
1612 cur_tok = after_token;
1618 /* added following explanations 96/Jan/10 */
1620 void bad_formator_pool (char *name, char *defaultname, char *envvar)
1622 if (name == NULL) name = defaultname;
1623 sprintf(log_line, "(Perhaps %s is for an older version of TeX)\n", name);
1624 show_line(log_line, 0);
1625 name_of_file[name_length + 1] = '\0'; /* null terminate */
1626 sprintf(log_line, "(Alternatively, %s may have been corrupted)\n", name_of_file+1);
1627 show_line(log_line, 0);
1628 name_of_file[name_length + 1] = ' '; /* space terminate */
1630 "(Perhaps your %s environment variable is not set correctly)\n", envvar);
1631 show_line(log_line, 0);
1633 char *s; /* extra info 99/April/28 */
1634 if ((s = grabenv(envvar)) != NULL) {
1635 sprintf(log_line, "(%s=%s)\n", envvar, s);
1636 show_line(log_line, 0);
1639 sprintf(log_line, "%s environment variable not set\n", envvar);
1640 show_line(log_line, 0);
1648 bool load_fmt_file (void)
1650 register bool Result;
1656 undump_int(x); /* CHECKSUM */
1657 if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
1660 undump_int(x); /* mem_bot */
1664 undump_int(x); /* mem_top */
1667 /* we already read this once earlier to grab mem_top */
1669 sprintf(log_line, "Read from fmt file mem_top = %d TeX words\n", x);
1670 show_line(log_line, 0);
1672 mem = allocate_main_memory(x); /* allocate main memory at this point */
1673 if (mem == NULL) exit(1); /* redundant sanity test ! */
1674 initialize_aux(); /* do `mem' part of initialize */
1675 /* mem = zmem; */ /* update pointer to main memory */
1681 undump_int(x); /* eqtbsize */
1682 if(x != (hash_size + 4006)) /* eqtbsize */
1684 undump_int(x); /* hash_prime */
1687 undump_int(x); /* hyphen_prime */
1689 #ifdef ALLOCATEHYPHEN
1690 /* allow format files dumped with arbitrary (prime) hyphenation exceptions */
1691 realloc_hyphen (x); /* reset_hyphen(); */
1695 if(x != hyphen_prime)
1698 undump_int(x); /* pool_size */
1702 #ifdef ALLOCATESTRING
1703 if (x > current_pool_size) {
1705 sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size);
1706 show_line(log_line, 0);
1708 str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
1710 if(x > current_pool_size) /* 94/Jan/24 */
1716 sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size");
1717 show_line(log_line, 0);
1719 } else pool_ptr = x;
1722 undump_int(x); /* max_strings */
1726 #ifdef ALLOCATESTRING
1727 if (x > current_max_strings) {
1729 sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
1730 show_line(log_line, 0);
1732 str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
1734 if(x > current_max_strings) /* 94/Jan/24 */
1736 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1741 sprintf(log_line, "%s%s\n", "---! Must increase the ", "max strings");
1742 show_line(log_line, 0);
1748 if (undumpthings(str_start[0], str_ptr + 1)) return -1; /* undump string ptrs */
1749 if (undumpthings(str_pool[0], pool_ptr)) return -1; /* undump string pool */
1751 init_str_ptr = str_ptr;
1752 init_pool_ptr = pool_ptr;
1753 /* undump the dynamic memory - paragraph 1312 in the book */
1756 if((x < 1019)||(x > mem_top - 14))
1758 else lo_mem_max = x;
1762 if((x < 20)||(x > lo_mem_max))
1766 p = 0; /* mem_bot */
1769 if (undumpthings(mem[p], q + 2 - p)
1771 p = q + mem[q].hh.v.LH;
1772 if((p > lo_mem_max)||((q >= mem[q + 1].hh.v.RH)&&(mem[q +
1773 1].hh.v.RH != rover)))
1775 q = mem[q + 1].hh.v.RH;
1776 } while(!(q == rover));
1777 if (undumpthings(mem[p], lo_mem_max + 1 - p)
1779 /* if(mem_min < -2) */
1780 if(mem_min < mem_bot - 2) /* ? splice in block below */
1782 /* or call add_variable_space(mem_bot - (mem_min + 1)) */
1784 if (trace_flag) show_line("Splicing in mem_min space in undump!\n", 0);
1786 p = mem[rover + 1].hh.v.LH;
1788 mem[mem_min].hh.v.RH = 0; /* null */
1789 mem[mem_min].hh.v.LH = 0; /* null */
1790 mem[p + 1].hh.v.RH = q;
1791 mem[rover + 1].hh.v.LH = q;
1792 mem[q + 1].hh.v.RH = rover;
1793 mem[q + 1].hh.v.LH = p;
1794 /* mem[q].hh.v.RH = 262143L; */ /* NO! */
1795 mem[q].hh.v.RH = empty_flag;
1796 /* mem[q].hh.v.LH = -0 - q; */
1797 mem[q].hh.v.LH = mem_bot - q; /* ? size of block */
1801 if((x < lo_mem_max + 1)||(x > mem_top - 13))
1803 else hi_mem_min = x;
1807 /* if((x < 0)||(x > mem_top)) */
1808 if((x < mem_bot)||(x > mem_top))
1813 if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)
1815 undump_int(var_used);
1816 undump_int(dyn_used);
1820 if((x < 1)||(k + x > (hash_size + 4007)))
1822 if (undumpthings(eqtb[k], x)
1826 if((x < 0)||(k + x > (hash_size + 4007)))
1829 register integer for_end;
1831 for_end = k + x - 1;
1833 eqtb[j]= eqtb[k - 1];
1834 while(j++ < for_end);
1837 } while(!(k > (hash_size + 4006)));
1840 /* if((x < hashbase)||(x > hashbase + hashsize)) */
1841 /* if((x < 514)||(x > (hash_size + 514))) */
1842 if((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1846 par_token = 4095 + par_loc;
1849 /* if((x < hashbase)||(x > hashbase + hashsize)) */
1850 /* if((x < 514)||(x > (hash_size + 514))) */
1851 if((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1858 /* if((x < hashbase)||(x > hashbase + hashsize)) */
1859 /* if((x < 514)||(x > (hash_size + 514))) */
1860 if((x < 514)||(x > (hash_size + hash_extra + 514))) /*96/Jan/10*/
1868 if((x < p + 1)||(x > hash_used))
1873 } while(!(p == hash_used));
1874 if (undumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)
1877 undump_int(cs_count); /* cs_count */
1879 sprintf(log_line, "itex undump cs_count %d ", cs_count); /* debugging */
1880 show_line(log_line, 0);
1883 undump_int(x); /* font_mem_size */
1886 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1889 sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
1890 show_line(log_line, 0);
1892 if(x > current_font_mem_size) { /* 93/Nov/28 dynamic allocate font_info */
1894 sprintf(log_line, "Undump realloc font_info (%d > %d)\n",
1895 x, current_font_mem_size);
1896 show_line(log_line, 0);
1898 font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
1900 if(x > current_font_mem_size) /* in case allocation failed 94/Jan/24 */
1902 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1903 if(x > font_mem_size)
1907 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font mem size");
1908 show_line(log_line, 0);
1910 } else fmem_ptr = x;
1913 if (undumpthings(font_info[0], fmem_ptr)) return -1;
1915 undump_int(x); /* font_max */
1921 sprintf(log_line, "%s%s\n", "---! Must increase the ", "font max");
1922 show_line(log_line, 0);
1927 frozenfontptr = font_ptr; /* remember number of fonts frozen into format */
1928 if (undumpthings(font_check[0], font_ptr + 1)) return -1;
1929 if (undumpthings(font_size[0], font_ptr + 1)) return -1;
1930 if (undumpthings(font_dsize[0], font_ptr + 1)) return -1;
1931 if (undumpthings(font_params[0], font_ptr + 1)) return -1;
1932 if (undumpthings(hyphen_char[0], font_ptr + 1)) return -1;
1933 if (undumpthings(skew_char[0], font_ptr + 1)) return -1;
1934 if (undumpthings(font_name[0], font_ptr + 1)) return -1;
1935 if (undumpthings(font_area[0], font_ptr + 1)) return -1;
1936 if (undumpthings(font_bc[0], font_ptr + 1)) return -1;
1937 if (undumpthings(font_ec[0], font_ptr + 1)) return -1;
1938 if (undumpthings(char_base[0], font_ptr + 1)) return -1;
1939 if (undumpthings(width_base[0], font_ptr + 1)) return -1;
1940 if (undumpthings(height_base[0], font_ptr + 1)) return -1;
1941 if (undumpthings(depth_base[0], font_ptr + 1)) return -1;
1942 if (undumpthings(italic_base[0], font_ptr + 1)) return -1;
1943 if (undumpthings(lig_kern_base[0], font_ptr + 1)) return -1;
1944 if (undumpthings(kern_base[0], font_ptr + 1)) return -1;
1945 if (undumpthings(exten_base[0], font_ptr + 1)) return -1;
1946 if (undumpthings(param_base[0], font_ptr + 1)) return -1;
1947 if (undumpthings(font_glue[0], font_ptr + 1)) return -1;
1948 if (undumpthings(bchar_label[0], font_ptr + 1)) return -1;
1949 if (undumpthings(font_bchar[0], font_ptr + 1)) return -1;
1950 if (undumpthings(font_false_bchar[0], font_ptr + 1)) return -1;
1953 /* log not opened yet, so can't show fonts frozen into format */
1955 /* May be able to avoid the following since we switched to */
1956 /* non_address from font_mem_size to 0 96/Jan/15 ??? */
1957 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1959 /* deal with fmt files dumped with *different* font_mem_size 93/Nov/29 */
1960 { int count = 0, oldfont_mem_size = 0;
1961 for (x = 0; x <= font_ptr; x++) {
1962 if(bchar_label[x] > oldfont_mem_size) oldfont_mem_size = bchar_label[x];
1965 /* somewhat arbitrary sanity check ... */
1966 /* if (oldfont_mem_size != font_mem_size && oldfont_mem_size > font_max) { */
1967 if (oldfont_mem_size != non_address && oldfont_mem_size > font_max) { /* 96/Jan/16 */
1968 for (x = 0; x <= font_ptr; x++) {
1969 if(bchar_label[x] == oldfont_mem_size) {
1970 /* bchar_label[x] = font_mem_size; */
1971 bchar_label[x] = non_address; /* 96/Jan/16 */
1977 "oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
1978 oldfont_mem_size, count, non_address);
1979 show_line(log_line, 0);
1984 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
1985 /* undump(0)(hyph_size)(hyph_count); */
1988 /* if((x < 0)||(x > 607)) */
1989 if((x < 0)||(x > hyphen_prime))
1994 /* undump hypenation exception tables p.1325 */
1996 register integer for_end;
1998 for_end = hyph_count;
2004 /* if((x < 0)||(x > 607)) */
2005 if((x < 0)||(x > hyphen_prime))
2010 /* undump(0)(str_ptr)(hyph_word[j]); */
2013 if((x < 0)||(x > str_ptr))
2018 /* undump(min_halfword)(max_halfword)(hyph_list[j]); */
2021 /* if((x < 0)||(x > 262143L)) */
2022 if((x < 0)||(x > max_halfword)) /* mem_top ? no p.1325 */
2027 } while(k++ < for_end);
2029 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2030 #ifdef ALLOCATEHYPHEN
2031 /* if user specified new hyphen prime - flush existing exception patterns ! */
2032 /* but, we can reclaim the string storage wasted ... */
2034 if (new_hyphen_prime != 0) {
2035 realloc_hyphen(new_hyphen_prime); /* reset_hyphen(); */
2036 hyphen_prime = new_hyphen_prime;
2040 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2045 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2046 #ifdef ALLOCATETRIES
2048 allocate_tries(x); /* allocate only as much as is needed */
2049 /* trie_size = x; */ /* ??? */
2052 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2056 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie size");
2057 show_line(log_line, 0);
2063 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2064 if (is_initex) /* bkph */
2065 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2068 if (undumpthings(trie_trl[0], j + 1)) return -1;
2069 if (undumpthings(trie_tro[0], j + 1)) return -1;
2070 if (undumpthings(trie_trc[0], j + 1)) return -1;
2075 if(x > trie_op_size)
2078 sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie op size");
2079 show_line(log_line, 0);
2085 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2086 if (is_initex) /* bkph */
2087 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2091 begin undump(0)(63)(hyf_distance[k]); {a |small_number|}
2092 undump(0)(63)(hyf_num[k]);
2093 undump(min_quarterword)(max_quarterword)(hyf_next[k]); end; */
2095 if (undumpthings(hyf_distance[1], j)) return -1;
2096 if (undumpthings(hyf_num[1], j)) return -1;
2097 if (undumpthings(hyf_next[1], j)) return -1;
2100 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2101 if (is_initex) { /* bkph */
2102 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2104 register integer for_end;
2109 while(k++ < for_end);
2115 /* undump(0)(k-1)(k) */
2118 if((x < 0)||(x > k - 1))
2122 /* undump(1)(j)(x) */
2125 if((x < 1)||(x > j))
2131 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2132 if (is_initex) /* bkph */
2133 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2136 /* j:=j-x; op_start[k]:=qo(j); */
2142 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2143 if (is_initex) /* bkph */
2144 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2145 trie_not_ready = false
2150 if((x < 0)||(x > 3))
2152 /* else interaction = x; */
2153 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2154 if (interaction < 0) /* may now set in local.c bkph 94/Jan/8 */
2155 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2160 if((x < 0)||(x > str_ptr))
2162 else format_ident = x;
2165 /* test_eof(fmt_file)? */
2167 if((x != ENDFMTCHECKSUM)|| feof(fmt_file)) /* magic checksum --- change ? */
2174 sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
2175 show_line(log_line, 1);
2176 /* added following bit of explanation 96/Jan/10 */
2178 bad_formator_pool(format_file, "the format file", "TEXFORMATS");
2183 void final_cleanup (void)
2186 c = cur_chr; /* small_number c */
2187 if (job_name == 0) open_log_file ();
2188 while (input_ptr > 0) {
2189 if (cur_input.state_field == 0) {
2191 } else end_file_reading ();
2193 while (open_parens > 0) {
2197 if(cur_level > level_one) {
2199 print_esc("end occurred ");
2200 print_string("inside a group at level ");
2201 print_int(cur_level - 1);
2204 while (cond_ptr != 0) {
2206 print_esc("end occurred ");
2207 print_string("when ");
2208 print_cmd_chr(105, cur_if); /* i */
2211 print_string("on line ");
2214 print_string(" was incomplete)");
2215 if_line = mem[cond_ptr + 1].cint;
2216 cur_if = mem[cond_ptr].hh.b1;
2217 /* *********************************************************************** */
2218 temp_ptr = cond_ptr; /* new in 3.14159 */
2219 cond_ptr = mem[cond_ptr].hh.v.RH;
2220 free_node(temp_ptr, 2); /* new in 3.14159 */
2221 /* *********************************************************************** */
2224 if(((history == 1)||(interaction < 3)))
2228 print_nl(" (see the transcript file for additional information)");
2234 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2235 if (is_initex) { /* bkph */
2236 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2237 /* *************************** new in 3.14159 ***************************** */
2239 register integer for_end;
2244 delete_token_ref(cur_mark[c]);
2245 while(c++ < for_end);
2247 /* *********************************************************************** */
2248 /* 422. Amendment to bugfix 414 (reported by David Fuchs, September 2007) */
2249 if (last_glue != max_halfword) delete_glue_ref(last_glue);
2250 store_fmt_file (); // returns a value ?
2253 if (!is_initex) /* 2000/March/3 */
2254 print_nl(" (\\dump is performed only by INITEX)"); /* */
2258 // debugging code for checking the string pool
2261 int checkpool (char *task)
2263 int c, i, k, n, st, flag, bad=0;
2266 sprintf(log_line, "Check on string pool start (%s)\n", task);
2267 show_line(log_line, 0);
2269 for (k = 0; k < 32; k++) {
2270 if (str_start[k] != 3 * k) {
2271 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2272 show_line(log_line, 0);
2275 for (k = 32; k < 128; k++) {
2276 if (str_start[k] != 96 + (k - 32)) {
2277 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2278 show_line(log_line, 0);
2281 for (k = 128; k < 256; k++) {
2282 if (str_start[k] != 194 + 4 * (k - 128)){
2283 sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2284 show_line(log_line, 0);
2288 sprintf(log_line, "Check on string pool (%s)\n", task);
2289 show_line(log_line, 0);
2291 for (k = 0; k < str_ptr; k++) {
2292 if (str_start[k+1] == 0) break;
2293 n = str_start[k+1] - str_start[k];
2297 for (i = 0; i < n; i++) {
2298 if (str_pool[st + i] == 0) {
2301 if (str_pool[st + i] > 255) {
2307 sprintf(log_line, "BAD %d (start at %d): ", k, st);
2308 show_line(log_line, 0);
2310 for (i = 0; i < n; i++) {
2311 c = str_pool[st + i];
2313 sprintf(s, "%d ", c);
2332 show_line(log_line, stdout);
2335 sprintf(log_line, "end of check (%s)\n", bad ? "BAD" : "OK");
2336 show_line(log_line, 0);
2338 if (task == NULL) return bad;
2342 } /* DEBUGGING ONLY */
2345 void show_frozen (void)
2348 fprintf(log_file, "\n");
2349 fprintf(log_file, "(%d fonts frozen in format file:\n", font_ptr);
2350 /* ignore font 0 which is nullfont */
2351 /* for (i = 1; i < font_ptr+1; i++) */
2352 for (i = 1; i <= font_ptr; i++) {
2353 if (i > 1) fprintf(log_file, ", ");
2354 if ((i % 8) == 0) fprintf(log_file, "\n");
2355 n = str_start[font_name[i]+1]-str_start[font_name[i]];
2356 for (j = 0; j < n; j++) {
2357 putc(str_pool[str_start[font_name[i]]+j], log_file);
2358 /* str_pool[str_start[font_name[i]]+j] = '?'; */
2361 fprintf(log_file, ") ");
2364 /* Main entry point called from texmf.c int main(int ac, char *av[]) */
2365 /* call from main_program in texmf.c */
2366 /* This in turn calls initialize() */
2368 #pragma warning(disable:4127) // conditional expression is constant
2370 /* void texbody() */
2371 int texbody (void) /* now returns a value --- bkph */
2375 set_paths(TEXFORMATPATHBIT + TEXINPUTPATHBIT + TEXPOOLPATHBIT + TFMFILEPATHBIT);
2377 if(ready_already == 314159L)goto lab1; /* magic number */
2378 /* These tests are almost all compile time tests and so could be eliminated */
2380 if((half_error_line < 30)||(half_error_line > error_line - 15))
2382 if(max_print_line < 60) bad = 2;
2383 if(dvi_buf_size % 8 != 0) bad = 3;
2384 if(1100 > mem_top)bad = 4; /* not compile time */
2385 /* if(hash_prime > hash_size) */
2386 if(hash_prime > (hash_size + hash_extra)) bad = 5;
2387 if(max_in_open >= 128)bad = 6; /* p.14 */
2388 if(mem_top < 267)bad = 7; /* where from ? *//* not compile time */
2391 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2392 if (is_initex) { /* bkph */
2393 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2394 if((mem_min != 0)||(mem_max != mem_top)) bad = 10;
2397 /* if((mem_min > 0)||(mem_max < mem_top)) */
2398 if((mem_min > mem_bot)||(mem_max < mem_top)) bad = 10;
2399 /* if((0 > 0)||(255 < 127)) */
2400 if((min_quarterword > 0)||(max_quarterword < 255)) bad = 11;
2401 /* if((0 > 0)||(262143L < 32767)) */
2402 if((min_halfword > 0)||(max_halfword < 32767)) bad = 12;
2403 /* if((0 < 0)||(255 > 262143L)) */
2404 if((min_quarterword < min_halfword)||(max_quarterword > max_halfword))
2406 /* if((mem_min < 0)||(mem_max >= 262143L)||(-0 - mem_min > 262144L)) */
2407 if((mem_min < min_halfword)||(mem_max >= max_halfword)||(mem_bot - mem_min >= max_halfword))
2409 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2410 if(mem_max > mem_top + mem_extra_high) /* not compile time */
2411 bad = 14; /* ha ha */
2412 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2413 /* if((0 < 0)||(font_max > 255)) */
2414 if((0 < min_quarterword)||(font_max > max_quarterword)) /* 93/Dec/3 */
2416 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2417 #ifdef INCREASEFONTS
2418 /* if(font_max > 512)*/ /* 93/Dec/3 */
2419 if(font_max > 1024) /* 96/Jan/17 */
2421 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2425 /* if((save_size > 262143L)||(max_strings > 262143L)) */
2426 if((save_size > max_halfword)||(max_strings > max_halfword))
2428 /* if(buf_size > 262143L)*/
2429 if(buf_size > max_halfword)bad = 18;
2431 if(max_quarterword - min_quarterword < 255) bad = 19;
2432 /* if cs_token_flag + undefined_control_sequence > max_halfword then bad <- 21;*/
2433 /* if((hash_size + 4876) > 262143L)*/
2434 /* if((hash_size + 4876) > max_halfword) */
2435 if((hash_size + 4095 + 781) > max_halfword) bad = 21;
2436 if(format_default_length > PATHMAX) bad = 31;
2437 /* if(2 * 262143L < mem_top - mem_min) */
2438 if(max_halfword < (mem_top - mem_min) / 2) bad = 41;
2440 sprintf(log_line, "%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
2441 "---case ", (long) bad);
2442 show_line(log_line, 1);
2444 bad_formator_pool(format_file, "the format file", "TEXFORMATS"); /* 96/Jan/17 */
2445 goto lab9999; // abort
2450 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2452 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2453 if(! get_strings_started ()) goto lab9999; // abort
2455 init_str_ptr = str_ptr;
2456 init_pool_ptr = pool_ptr;
2457 dateandtime(eqtb[(hash_size + 3183)].cint,
2458 eqtb[(hash_size + 3184)].cint,
2459 eqtb[(hash_size + 3185)].cint,
2460 eqtb[(hash_size + 3186)].cint);
2463 ready_already = 314159L; /* magic number */
2465 lab1: /* get here directly if ready_already already set ... */
2470 show_line(tex_version, 0);
2471 sprintf(log_line, " (%s %s)", application, yandyversion);
2472 show_line(log_line, 0);
2473 if(format_ident > 0)slow_print(format_ident);
2479 name_in_progress = false;
2481 output_file_name = 0;
2487 high_in_open = 0; /* max_in_open name already used 1999 Jan 17 */
2489 max_open_parens = 0; /* max_open_parens */
2492 max_param_stack = 0;
2493 #ifdef ALLOCATEBUFFER
2494 /* first = current_buf_size; */
2495 memset (buffer, 0, current_buf_size); /* redundant */
2497 /* first = buf_size; */
2498 memset (buffer, 0, buf_size); /* redundant ? */
2503 } while(!(first == 0)); */
2504 first = 0; /* 1999/Jan/22 */
2507 warning_index = 0; /* warning_index:=null; l.7068 */
2509 cur_input.state_field = 33;
2510 cur_input.start_field = 1;
2511 cur_input.index_field = 0;
2513 cur_input.name_field = 0;
2515 align_state = 1000000L;
2516 if(! init_terminal ())goto lab9999; // abort
2517 cur_input.limit_field = last;
2520 /* if((format_ident == 0)||(buffer[cur_input.loc_field]== 38)) */
2521 /* For Windows NT, lets allow + instead of & for format specification */
2522 if((format_ident == 0)||
2523 (buffer[cur_input.loc_field]== '&')||
2524 (buffer[cur_input.loc_field]== '+'))
2526 if(format_ident != 0)initialize ();
2527 if(! open_fmt_file ())goto lab9999; // abort
2528 if(! load_fmt_file ()){
2530 goto lab9999; // abort
2533 while((cur_input.loc_field < cur_input.limit_field)&&
2534 (buffer[cur_input.loc_field]== 32))
2535 incr(cur_input.loc_field);
2538 if (debug_flag) check_eqtb("after format"); /* debugging 94/Apr/5 */
2540 if((eqtb[(hash_size + 3211)].cint < 0)||
2541 (eqtb[(hash_size + 3211)].cint > 255))
2542 decr(cur_input.limit_field);
2543 /* long to unsigned char ... */
2544 else buffer[cur_input.limit_field]= eqtb[(hash_size + 3211)].cint;
2545 dateandtime(eqtb[(hash_size + 3183)].cint,
2546 eqtb[(hash_size + 3184)].cint,
2547 eqtb[(hash_size + 3185)].cint,
2548 eqtb[(hash_size + 3186)].cint);
2549 magic_offset = str_start[886]- 9 * 16; /* following: */
2550 /* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
2551 if(interaction == 0) selector = 16;
2553 if((cur_input.loc_field < cur_input.limit_field)&&
2554 (eqtb[(hash_size + 1883) +
2555 buffer[cur_input.loc_field]].hh.v.RH != 0))
2559 /* show font TFMs frozen into format file */
2560 /* moved here after start_input to ensure the log file is open */
2561 if (show_tfm_flag && log_opened && font_ptr > 0) /* 98/Sep/28 */
2565 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2566 main_time = clock();
2567 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2570 if (show_cs_names) print_cs_names(stdout, 0); /* 98/Mar/31 */
2572 main_control(); /* read-eval-print loop :-) in tex8.c */
2574 // what if abort_flag is set now ?
2576 if (show_cs_names) print_cs_names(stdout, 1); /* 98/Mar/31 */
2578 // what if abort_flag is set now ?
2582 // if (abort_flag) return -1;
2584 close_files_and_terminate();
2593 if((history != 0)&&(history != 1)) code = 1;
2595 // now return instead of exit to allow cleanup in local.c
2599 } /* end of texbody */
2602 /* add a block of variable size node space below mem_bot */
2603 void add_variable_space(int size)
2604 { /* used in tex0.c, local.c, itex.c */
2610 if (mem_min == 0) t = mem_min; /* bottom of present block */
2611 else t = mem_min + 1;
2612 mem_min = t - (size + 1); /* first word in new block - 1 */
2613 /* mem_min = mem_start; */ /* allocate all of it at once */
2614 if (mem_min < mem_start) { /* sanity test */
2615 if (trace_flag) show_line("WARNING: mem_min < mem_start!\n", 0);
2616 mem_min = mem_start;
2618 p = mem[rover + 1].hh.v.LH;
2620 mem[mem_min].hh.v.RH = 0; /* insert blank word below ??? */
2621 mem[mem_min].hh.v.LH = 0; /* insert blank word below ??? */
2622 mem[p + 1].hh.v.RH = q;
2623 mem[rover + 1].hh.v.LH = q;
2624 mem[q + 1].hh.v.RH = rover;
2625 mem[q + 1].hh.v.LH = p;
2626 mem[q].hh.v.RH = empty_flag;
2627 mem[q].hh.v.LH = t - q; /* block size */
2632 /*************************************************************************/
2634 /* All ini TeX code is here at end so can use same pragma optimize for it */
2636 /* Ini-TeX code is rarely needed/used so make it small rather than fast */
2638 #pragma optimize("t", off)
2639 /* #pragma optimize("2", off) */
2640 #pragma optimize("s", on)
2641 /* #pragma optimize("1", on) */
2644 /* split out to allow sharing of code from do_initex and newpattern */
2645 void reset_trie (void)
2649 register integer for_end;
2650 k = - (integer) trie_op_size;
2651 for_end = trie_op_size;
2653 do trie_op_hash[k]= 0;
2654 while(k++ < for_end);
2657 register integer for_end;
2658 k = 0; for_end = 255;
2660 do trie_used[k]= min_trie_op;
2661 while(k++ < for_end);
2663 max_op_used = min_trie_op;
2665 trie_not_ready = true;
2669 trie_not_ready = true;
2672 void reset_hyphen (void)
2673 { /* borrowed code from initialize() */
2676 register integer for_end;
2678 for_end = hyphen_prime;
2682 hyph_list[z]= 0; /* hyph_list[z]:=null; l.18131 */
2684 while(z++ < for_end);
2689 /* split out to allow optimize for space, not time */
2690 void do_initex (void)
2694 /* hyph_pointer z; */
2696 /* for k:=mem_bot+1 to lo_mem_stat_max do mem[k].sc:=0; p.164 */
2698 register integer for_end;
2703 while(k++ < for_end);
2706 while(k <= 19){ /* while k <= lo_mem_stat-max ... */
2707 /* glue_ref_count(k):=null+1; */
2713 mem[6].cint = 65536L;
2715 mem[10].cint = 65536L;
2717 mem[14].cint = 65536L;
2719 mem[15].cint = 65536L;
2721 mem[18].cint = -65536L;
2723 rover = 20; /* rover = lo_mem_stat-max + 1 ... */
2724 /* mem[rover].hh.v.RH = 262143L; */
2725 mem[rover].hh.v.RH = empty_flag;
2726 /* mem[rover].hh.v.LH = 1000; */
2727 mem[rover].hh.v.LH = block_size;
2728 mem[rover + 1].hh.v.LH = rover;
2729 mem[rover + 1].hh.v.RH = rover;
2730 /* lo_mem_max = rover + 1000; */
2731 lo_mem_max = rover + block_size;
2732 mem[lo_mem_max].hh.v.RH = 0;
2733 mem[lo_mem_max].hh.v.LH = 0;
2734 /* for k <- hi_mem_stat_min to mem_top do mem[k] = mem[lo_mem_max]; */
2736 register integer for_end;
2740 do mem[k]= mem[lo_mem_max];
2741 while(k++ < for_end);
2743 /* info(omit_template) <- end_template_token; p.790 */
2744 /* @d end_template_token==cs_token_flag+frozen_end_template */
2745 /* mem[omit_template].hh.v.LH = 14114; */
2746 /* mem[omit_template].hh.v.LH = 10019 + 4095; */ /* + eqtbextra ? NO */
2747 /* mem[omit_template].hh.v.LH = (hash_size + 4614); */
2748 /* mem[omit_template].hh.v.LH = (hash_size + 4095 + 519); */
2749 mem[omit_template].hh.v.LH = (hash_size + hash_extra + 4095 + 519);
2750 /* link(end_span) <- max_quarterword + 1 p.797 */
2751 /* mem[end_span].hh.v.RH = 256; */ /* 94/Apr/4 ? */
2752 mem[end_span].hh.v.RH = max_quarterword + 1; /* 96/Oct/12 ??? */
2753 /* info(end_span) <- null p.797 */
2754 mem[end_span].hh.v.LH = 0;
2755 /* type(last_active) <- hyphenated; p.820 */
2756 mem[active].hh.b0 = 1;
2757 /* line_number(last_active) <- max_halfword; p.820 */
2758 /* mem[mem_top - 6].hh.v.LH = 262143L; */
2759 mem[mem_top - 6].hh.v.LH = empty_flag; /* max_halfword ? */
2760 /* subtype(last_active) <- 0; p.820 */
2761 mem[active].hh.b1 = 0;
2762 /* subtype(page_ins_head) <- 255; p.981 */
2763 mem[mem_top].hh.b1 = 255; /* subtype(page_ins_head) = qi(255) p.981 */
2764 /* type(page_ins_head) <- split_up; p.981 */
2765 mem[mem_top].hh.b0 = 1;
2766 /* link(page_ins_head) <- page_ins_head; p.981 */
2767 mem[mem_top].hh.v.RH = mem_top;
2768 /* type(page_head) <- glue_node; p. 988 */
2769 mem[page_head].hh.b0 = 10;
2770 /* subtype(page_head) <- normal; p. 988 */
2771 mem[page_head].hh.b1 = 0;
2772 avail = 0; /* avail <- null p.164 */
2773 mem_end = mem_top; /* mem_end <- mem_top */
2774 hi_mem_min = mem_top - 13; /* hi_mem_min <- hi_mem_stat_min */
2775 var_used = 20; /* var_used <- lo_mem_stat_max */
2776 dyn_used = 14; /* dyn_used <- hi_mem_stat_usage */
2777 /* eq_type(undefined_control_sequence) <- undefined_cs; */
2778 /* equiv(undefined_control_sequence) <- null; */
2779 /* eq_level(undefined_control_sequence) <- level_zero; */
2780 eqtb[(hash_size + 781)].hh.b0 = 101;
2781 eqtb[(hash_size + 781)].hh.v.RH = 0;
2782 eqtb[(hash_size + 781)].hh.b1 = 0;
2783 /* for k <- active_base to undefined_control_sequence -1 do */
2784 /* eqtb[k] <- eqtb(undefined_control_sequence); */
2785 /* {register integer for_end; k = 1; for_end = 10280; if(k <= for_end) do */
2787 register integer for_end;
2789 for_end = (hash_size + 780);
2791 eqtb[k]= eqtb[(hash_size + 781)];
2792 while(k++ < for_end);
2794 eqtb[(hash_size + 782)].hh.v.RH = 0; /* glue_base (hash_size + 782) */
2795 eqtb[(hash_size + 782)].hh.b1 = 1;
2796 eqtb[(hash_size + 782)].hh.b0 = 117;
2797 /* equiv(glue_base):=zero_glue; eq_level(glue_base):=level_one; */
2798 /* eq_type(glue_base):=glue_ref; */
2799 /* {register integer for_end; k = 10283; for_end = 10811; if(k <= for_end) */
2801 register integer for_end;
2802 k = (hash_size + 783);
2803 for_end = (hash_size + 1311);
2805 do eqtb[k]= eqtb[(hash_size + 782)];
2806 while(k++ < for_end);
2808 /* glue_ref_count(zero_glue):=glue_ref_count(zero_glue)+local_base-glue_base; */
2809 /* local_base - glue_base = 530 = 17 glue_pars + 256 skip + 256 mu_skip */
2810 mem[0].hh.v.RH = mem[0].hh.v.RH + 530; /* mem[mem_bot]? */
2811 /* box(0):=null; eq_type(box_base):=box_ref; eq_level(box_base):=level_one; */
2812 eqtb[(hash_size + 1312)].hh.v.RH = 0;
2813 eqtb[(hash_size + 1312)].hh.b0 = 118;
2814 eqtb[(hash_size + 1312)].hh.b1 = 1;
2815 /* for k:=box_base+1 to box_base+255 do eqtb[k]:=eqtb[box_base]; */
2816 /* {register integer for_end; k = 10813; for_end = 11077; if(k <= for_end) */
2818 register integer for_end;
2819 k = (hash_size + 1313);
2820 for_end = (hash_size + 1577);
2822 do eqtb[k]= eqtb[(hash_size + 781)];
2823 while(k++ < for_end);
2825 eqtb[(hash_size + 1578)].hh.v.RH = 0;
2826 eqtb[(hash_size + 1578)].hh.b0 = 119;
2827 eqtb[(hash_size + 1578)].hh.b1 = 1;
2828 /* {register integer for_end; k = 11079; for_end = 11333; if(k <= for_end) */
2830 register integer for_end;
2831 k = (hash_size + 1579);
2832 for_end = (hash_size + 1833);
2834 do eqtb[k]= eqtb[(hash_size + 1578)];
2835 while(k++ < for_end);
2837 eqtb[(hash_size + 1834)].hh.v.RH = 0;
2838 eqtb[(hash_size + 1834)].hh.b0 = 120;
2839 eqtb[(hash_size + 1834)].hh.b1 = 1;
2840 /* {register integer for_end; k = 11335; for_end = 11382; if(k <= for_end) */
2842 register integer for_end;
2843 k = (hash_size + 1835);
2844 for_end = (hash_size + 1882);
2846 do eqtb[k]= eqtb[(hash_size + 1834)];
2847 while(k++ < for_end);
2849 eqtb[(hash_size + 1883)].hh.v.RH = 0;
2850 eqtb[(hash_size + 1883)].hh.b0 = 120;
2851 eqtb[(hash_size + 1883)].hh.b1 = 1;
2852 /* initialize cat_code, lc_code, uc_code, sf_code, math_code 256 * 5 */
2853 /* {register integer for_end; k = 11384; for_end = 12662; if(k <= for_end) */
2855 register integer for_end;
2856 k = (hash_size + 1884);
2857 for_end = (hash_size + 3162);
2859 do eqtb[k]= eqtb[(hash_size + 1883)];
2860 while(k++ < for_end);
2862 /* cat_code(k) <- other_char; math_code(k) <- hi(k); sf_code(k) = 1000; */
2864 register integer for_end;
2869 eqtb[(hash_size + 1883) + k].hh.v.RH = 12;
2870 eqtb[(hash_size + 2907) + k].hh.v.RH = k;
2871 eqtb[(hash_size + 2651) + k].hh.v.RH = 1000;
2873 while(k++ < for_end);
2875 /* cat_base == 11383 */
2876 /* cat_code(carriage_return) <- car_ret; cat_code(" ") <- space */
2877 /* cat_code("\") <- escape; cat_code("%") <- comment; ... */
2878 eqtb[(hash_size + 1896)].hh.v.RH = 5;
2879 eqtb[(hash_size + 1915)].hh.v.RH = 10;
2880 eqtb[(hash_size + 1975)].hh.v.RH = 0;
2881 eqtb[(hash_size + 1920)].hh.v.RH = 14;
2882 eqtb[(hash_size + 2010)].hh.v.RH = 15;
2883 eqtb[(hash_size + 1883)].hh.v.RH = 9;
2884 /* for k:="0" to "9" do math_code(k):=hi(k+var_code); */
2886 register integer for_end;
2890 eqtb[(hash_size + 2907) + k].hh.v.RH = k + 28672; /* '70000 */
2891 while(k++ < for_end);
2893 /* cat_code of uppercase and lowercase letters ... */
2895 register integer for_end;
2901 eqtb[(hash_size + 1883) + k].hh.v.RH = 11;
2902 eqtb[(hash_size + 1883) + k + 32].hh.v.RH = 11;
2903 /* mathcode(k) = hi(k + var_code + "100); */ /* '70000 + 256 */
2904 eqtb[(hash_size + 2907) + k].hh.v.RH =
2905 k + 28928; /* '70000 + 256 */
2906 /* mathcode(k + "a" - "A") = hi(k + "a" - "A" + var_code + "100); */
2907 eqtb[(hash_size + 2907) + k + 32].hh.v.RH =
2908 k + 28960; /* '70000 + 256 + 32 */
2910 eqtb[(hash_size + 2139) + k].hh.v.RH = k + 32;
2911 eqtb[(hash_size + 2139) + k + 32].hh.v.RH = k + 32;
2913 eqtb[(hash_size + 2395) + k].hh.v.RH = k;
2914 eqtb[(hash_size + 2395) + k + 32].hh.v.RH = k;
2916 eqtb[(hash_size + 2651) + k].hh.v.RH = 999;
2918 while(k++ < for_end);
2920 /* {register integer for_end; k = 12663; for_end = 12973; if(k <= for_end) */
2922 register integer for_end;
2923 k = (hash_size + 3163);
2924 for_end = (hash_size + 3473);
2928 while(k++ < for_end);
2930 eqtb[(hash_size + 3180)].cint = 1000;
2931 eqtb[(hash_size + 3164)].cint = 10000;
2932 eqtb[(hash_size + 3204)].cint = 1;
2933 eqtb[(hash_size + 3203)].cint = 25;
2934 eqtb[(hash_size + 3208)].cint = 92;
2935 eqtb[(hash_size + 3211)].cint = 13;
2936 /* {register integer for_end; k = 13230; for_end = 13506; if(k <= for_end) */
2938 register integer for_end;
2942 eqtb[(hash_size + 3474) + k].cint = -1;
2943 while(k++ < for_end);
2945 eqtb[(hash_size + 3520)].cint = 0;
2946 /* {register integer for_end; k = 13230; for_end = 13506; if(k <= for_end) */
2948 register integer for_end;
2949 k = (hash_size + 3730);
2950 for_end = (hash_size + 4006);
2952 do eqtb[k].cint = 0;
2953 while(k++ < for_end);
2955 /* hash_used = 10014; */ /* hash_used = frozen_control_sequence */
2956 /* frozen_control_sequence = hashsize + hashbase p.222 */
2957 /* hash_used = (hash_size + 514); */
2958 hash_used = (hash_size + hash_extra + 514); /* 96/Jan/10 */
2960 if (trace_flag) show_line("itex cs_count = 0 ", 0); /* debugging */
2961 /* eq_type(frozen_dont_expand) <- dont_expand; */
2962 /* eqtb[10023].hh.b0 = 116; */
2963 /* eqtb[(hash_size + 523)].hh.b0 = 116; */
2964 eqtb[(hash_size + hash_extra + 523)].hh.b0 = 116;
2965 /* hash[(hash_size + 523)].v.RH = 499; */
2966 hash[(hash_size + hash_extra + 523)].v.RH = 499; /* notexpanded */
2967 /* @<Initialize table...@>= l.10750 */
2968 font_ptr = 0; /* font_ptr:=null_font; */
2969 fmem_ptr = 7; /* fmem_ptr:=7; */
2970 font_name[0]= 795; /* nullfont */
2971 font_area[0]= 335; /* "" */
2972 hyphen_char[0]= 45; /* - */
2974 /* ************************************************************************ */
2975 /* bchar_label[null_font]:=non_address; */ /* 3.14159 */
2976 /* bchar_label[0]= font_mem_size; */ /* OK ? 93/Nov/26 */
2977 bchar_label[0]= non_address; /* i.e. 0 --- 96/Jan/16 */
2978 /* ************************************************************************ */
2979 font_bchar[0] = 256; /* font_bchar[null_font]:=non_char; */
2980 font_false_bchar[0] = 256; /* font_false_bchar[null_font]:=non_char; */
2990 lig_kern_base[0] = 0;
2996 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2997 reset_trie (); /* shared 93/Nov/26 */
2998 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2999 /* {register integer for_end; k = 0; for_end = 6; if(k <= for_end) do
3000 font_info[k].cint = 0;
3001 while(k++ < for_end); }
3002 {register integer for_end; k = - (integer) trie_op_size; for_end =
3003 trie_op_size; if(k <= for_end) do
3005 while(k++ < for_end); }
3006 {register integer for_end; k = 0; for_end = 255; if(k <= for_end) do
3007 trie_used[k]= min_trie_op;
3008 while(k++ < for_end); }
3009 max_op_used = min_trie_op;
3011 trie_not_ready = true;
3015 /* text(frozen_protection):="inaccessible"; */
3016 /* hash[10014].v.RH = 1183; */
3017 /* hash[(hash_size + 514)].v.RH = 1184; */
3018 hash[(hash_size + hash_extra + 514)].v.RH = 1184; /* 1183 */
3019 format_ident = 1251; /* 1250 */
3020 /* hash[(hash_size + 522)].v.RH = 1290; */ /* 1288 */
3021 hash[(hash_size + hash_extra + 522)].v.RH = 1290; /* 1288 */
3022 /* eqtb[(hash_size + 522)].hh.b1 = 1; */
3023 eqtb[(hash_size + hash_extra + 522)].hh.b1 = 1;
3024 /* eqtb[(hash_size + 522)].hh.b0 = 113; */
3025 eqtb[(hash_size + hash_extra + 522)].hh.b0 = 113;
3026 /* eqtb[(hash_size + 522)].hh.v.RH = 0; */
3027 eqtb[(hash_size + hash_extra + 522)].hh.v.RH = 0;
3032 /* starts string pool with strings for 256 chars and then reads tex.pool */
3033 /* adjusted to try both "tex.pool" and "tex.poo" 95/Feb/19 */
3034 /* I have added a texpool file, but I need merge the pool to the binary */
3035 /* lots of things updates the kpathsea sources -- Clerk Ma */
3036 bool get_strings_started (void)
3038 register bool Result;
3044 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3045 int flag; /* 95/Feb/19 */
3046 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3051 register integer for_end;
3056 if(((k < 32)||(k > 126)))
3059 str_pool[pool_ptr]= 94; /* ^ */
3063 str_pool[pool_ptr]= 94; /* ^ */
3068 str_pool[pool_ptr]= k + 64;
3073 str_pool[pool_ptr]= k - 64;
3079 str_pool[pool_ptr]= l + 48; /* '0' */
3082 str_pool[pool_ptr]= l + 87; /* 'a' - 10 */
3089 str_pool[pool_ptr]= l + 48; /* '0' */
3092 str_pool[pool_ptr]= l + 87; /* 'a' - 10 */
3097 str_pool[pool_ptr]= k;
3102 while(k++ < for_end);
3104 vstrcpy((char *) name_of_file + 1, pool_name);
3105 name_of_file[0]= ' ';
3106 name_of_file[strlen(pool_name) + 1]= ' ';
3107 name_length = strlen(pool_name);
3108 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3109 /* if(a_open_in(pool_file, TEXPOOLPATH)) */
3110 flag = a_open_in(pool_file, TEXPOOLPATH);
3111 if (flag == 0) { /* 95/Feb/19 */
3112 pool_name [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */
3113 vstrcpy((char *) name_of_file + 1, pool_name);
3114 name_of_file[0]= ' ';
3115 name_of_file[strlen(pool_name)+ 1]= ' ';
3116 name_length = strlen(pool_name);
3117 flag = a_open_in(pool_file, TEXPOOLPATH);
3123 /* if(eof(pool_file)) */ /* feof(pool_file)??? */
3124 if(test_eof(pool_file))
3127 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3128 show_line("! string pool file has no check sum.\n", 1);
3129 /* added following bit of explanation 96/Jan/16 */
3131 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3132 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3133 (void) a_close(pool_file);
3139 if(m == '*') /* last line starts with * */
3144 if((xord[n]< 48)||(xord[n]> 57))
3147 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3148 show_line("! string pool file check sum doesn't have nine digits.\n", 1);
3149 /* added following bit of explanation 96/Jan/16 */
3151 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3152 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3153 (void) a_close(pool_file);
3157 a = 10 * a + xord[n]- 48;
3163 /* tex.pool file check sum *367403084 */
3165 if(a != BEGINFMTCHECKSUM) {
3167 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3168 show_line("! string pool check sum doesn't match; tangle me again.\n", 1);
3169 /* added following bit of explanation 96/Jan/16 */
3171 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3172 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3173 (void) a_close(pool_file);
3179 if((xord[m] < 48)||(xord[m] > 57)||(xord[n] < 48)||(xord[n] > 57))
3182 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3183 show_line("! string pool line doesn't begin with two digits.\n", 1);
3184 /* added following bit of explanation 96/Jan/16 */
3186 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3187 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3188 (void) a_close(pool_file);
3192 l = xord[m]* 10 + xord[n]- 48 * 11;
3193 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3194 #ifdef ALLOCATESTRING
3195 /* can freely extend memory, so we need not be paranoid - stringvacancies */
3196 /* if(pool_ptr + l + stringvacancies > current_pool_size)*/
3197 if(pool_ptr + l + stringmargin > current_pool_size){
3198 if (trace_flag) show_line("String margin reallocation\n", 0);
3199 /* str_pool = realloc_str_pool (pool_ptr + l + stringvacancies */
3200 str_pool = realloc_str_pool (pool_ptr + l + stringmargin - current_pool_size + increment_pool_size);
3202 if(pool_ptr + l + stringmargin > current_pool_size) /* 94/Jan/24 */
3204 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3205 if(pool_ptr + l + stringvacancies > pool_size)
3209 show_line("! You have to increase POOLSIZE.\n", 1);
3210 (void) a_close(pool_file);
3215 register integer for_end;
3222 else read(pool_file, m);
3224 str_pool[pool_ptr]= xord[m];
3227 } while(k++ < for_end);
3229 readln(pool_file); /* flush rest to end of file / end of line */
3234 (void) a_close(pool_file);
3239 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3240 sprintf(log_line, "! I can't read %s.\n", pool_name);
3241 show_line(log_line, 1);
3243 show_line(" (Was unable to find tex.poo or tex.pool)\n", 0); /* extra explain */
3244 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3253 void sort_avail (void)
3257 p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */
3258 p = mem[rover + 1].hh.v.RH;
3259 /* mem[rover + 1].hh.v.RH = 262143L; */ /* NO! */
3260 mem[rover + 1].hh.v.RH = empty_flag;
3262 while(p != oldrover)if(p < rover)
3265 p = mem[q + 1].hh.v.RH;
3266 mem[q + 1].hh.v.RH = rover;
3270 while(mem[q + 1].hh.v.RH < p)q = mem[q + 1].hh.v.RH;
3271 r = mem[p + 1].hh.v.RH;
3272 mem[p + 1].hh.v.RH = mem[q + 1].hh.v.RH;
3273 mem[q + 1].hh.v.RH = p;
3277 /* while(mem[p + 1].hh.v.RH != 262143L){ */ /* NO! */
3278 while (mem[p + 1].hh.v.RH != empty_flag) {
3279 mem[mem[p + 1].hh.v.RH + 1].hh.v.LH = p;
3280 p = mem[p + 1].hh.v.RH;
3282 mem[p + 1].hh.v.RH = rover;
3283 mem[rover + 1].hh.v.LH = p;
3288 void primitive_ (str_number s, quarterword c, halfword o)
3292 /* small_number l; */
3293 int l; /* 95/Jan/7 */
3295 cur_val = s + 257; /* cur_val <- s + single_base; p.264 */
3298 l = str_start[s + 1]- k; /* small_number l */
3300 register integer for_end;
3304 do buffer[j]= str_pool[k + j];
3305 while(j++ < for_end);
3307 cur_val = id_lookup(0, l);
3310 pool_ptr = str_start[str_ptr];
3312 /* ********************** debugging only 96/Jan/20 should not happen */
3314 if (s > 65535L) show_line("ERROR: hash entry too large\n", 1);
3316 hash[cur_val].v.RH = s;
3318 eqtb[cur_val].hh.b1 = 1;
3319 eqtb[cur_val].hh.b0 = c;
3320 eqtb[cur_val].hh.v.RH = o;
3324 /* more weird constants ? page 394 */
3327 trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
3329 register trie_op_code Result;
3333 /* the 313, 361 and 1009 are hard-wired constants here p.944 */
3334 /* begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) */
3335 h = abs(toint(n)+ 313 * toint(d)+ 361 * toint(v)+ 1009 *
3336 toint(cur_lang)) %(trie_op_size - neg_trie_op_size)+ neg_trie_op_size;
3338 /* if l=0 then {empty position found for a new op} */
3339 l = trie_op_hash[h];
3342 if(trie_op_ptr == trie_op_size){
3343 overflow("pattern memory ops", trie_op_size); /* pattern memory ops - NOT DYNAMIC */
3344 return 0; // abort_flag set
3346 u = trie_used[cur_lang];
3347 /* if u=max_quarterword then ??? */
3348 if(u == max_trie_op){
3349 /* overflow("pattern memory ops per language",
3350 max_quarterword-min_quarterword); ??? */
3351 overflow("pattern memory ops per language", max_trie_op - min_trie_op); /* pattern memory ops per language */
3352 return 0; // abort_flag set
3356 trie_used[cur_lang]= u;
3359 hyf_distance[trie_op_ptr]= d;
3360 hyf_num[trie_op_ptr]= n;
3361 hyf_next[trie_op_ptr]= v;
3362 trie_op_lang[trie_op_ptr]= cur_lang;
3363 trie_op_hash[h]= trie_op_ptr;
3364 trie_op_val[trie_op_ptr]= u;
3368 if((hyf_distance[l]== d)&&(hyf_num[l]== n)&&(hyf_next[l
3369 ]== v)&&(trie_op_lang[l]== cur_lang))
3371 Result = trie_op_val[l];
3374 if(h > - (integer) trie_op_size)
3376 else h = trie_op_size;
3378 /* return Result; */ /* unreachable code */
3380 /* what are those horrible constants there ? page 395 */
3381 trie_pointer trie_node_ (trie_pointer p)
3382 {/* 10 */ register trie_pointer Result;
3385 /* the 1009, 2718, 3142 are hard-wired constants here (not hyphen_prime) */
3386 h = abs(toint(trie_c[p])+ 1009 * toint(trie_o[p])+ 2718 *
3387 toint(trie_l[p])+ 3142 * toint(trie_r[p])) % trie_size;
3396 if((trie_c[q]== trie_c[p])&&(trie_o[q]== trie_o[p])&&(
3397 trie_l[q]== trie_l[p])&&(trie_r[q]== trie_r[p]))
3406 /* return Result; */ /* unreachable code */
3408 trie_pointer compress_trie_ (trie_pointer p)
3409 {register trie_pointer Result;
3413 trie_l[p]= compress_trie(trie_l[p]);
3414 trie_r[p]= compress_trie(trie_r[p]);
3415 Result = trie_node(p);
3419 void first_fit_ (trie_pointer p)
3431 if(trie_max < h + 256)
3433 if(trie_size <= h + 256){
3434 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3435 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3436 return; // abort_flag set
3440 trie_taken[trie_max]= false;
3441 trie_trl[trie_max]= trie_max + 1;
3442 trie_tro[trie_max]= trie_max - 1;
3443 } while(!(trie_max == h + 256));
3449 if(trie_trl[h + trie_c[q]] == 0)
3454 lab45: z = trie_trl[z];
3457 trie_taken[h]= true; /* h may be used without ... */
3470 ll = z; /* short ll */
3475 } while(!(l == ll));
3480 void trie_pack_ (trie_pointer p)
3485 if((q > 0)&&(trie_hash[q]== 0))
3493 void trie_fix_ (trie_pointer p)
3502 trie_trl[z + c]= trie_hash[q];
3504 trie_tro[z + c]= trie_o[p];
3510 void new_patterns (void)
3512 /* ******************************************************************* */
3513 /* was small_number k, l; in 3.141 */
3515 /* ******************************************************************* */
3521 int c; /* 95/Jan/7 */
3522 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3523 if (! trie_not_ready) { /* new stuff */
3524 if (allow_patterns) {
3525 if (trace_flag) show_line("Resetting patterns\n", 0);
3526 reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
3527 if (reset_exceptions) {
3528 if (trace_flag) show_line("Resetting exceptions\n", 0);
3529 reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
3533 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3536 if(eqtb[(hash_size + 3213)].cint <= 0)
3538 else if(eqtb[(hash_size + 3213)].cint > 255)
3540 else cur_lang = eqtb[(hash_size + 3213)].cint;
3544 digitsensed = false;
3550 if(digitsensed ||(cur_chr < 48)||(cur_chr > 57))
3552 if(cur_chr == 46) /* . */
3556 cur_chr = eqtb[(hash_size + 2139) + cur_chr].hh.v.RH;
3559 print_err("Nonletter");
3560 help1("(See Appendix H.)");
3569 digitsensed = false;
3574 hyf[k]= cur_chr - 48;
3591 v = new_trie_op(k - l, hyf[l], v);
3604 while((p > 0)&&(c > trie_c[p])) {
3609 if((p == 0)||(c < trie_c[p]))
3611 if(trie_ptr == trie_size){
3612 overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */
3613 /* not dynamic ---- but can be set -h=... from command line in ini-TeX */
3614 return; // abort_flag set
3617 trie_r[trie_ptr]= p;
3624 trie_o[p]= min_trie_op;
3628 if(trie_o[q]!= min_trie_op)
3630 print_err("Duplicate pattern");
3631 help1("(See Appendix H.)");
3640 digitsensed = false;
3646 print_esc("patterns");
3647 help1("(See Appendix H.)");
3656 print_err("Too late for ");
3657 print_esc("patterns");
3658 help1("All patterns must be given before typesetting begins.");
3660 mem[lig_trick].hh.v.RH = scan_toks(false, false);
3661 flush_list(def_ref);
3664 void init_trie (void)
3667 /* integer j, k, t; */
3669 int t; /* 95/Jan/7 */
3671 op_start[0]= - (integer) min_trie_op;
3673 register integer for_end;
3677 op_start[j]= op_start[j - 1]+ trie_used[j - 1];
3678 while(j++ < for_end);
3681 register integer for_end;
3683 for_end = trie_op_ptr;
3686 trie_op_hash[j]= op_start[trie_op_lang[j]] + trie_op_val[j];
3687 while(j++ < for_end);
3690 register integer for_end;
3692 for_end = trie_op_ptr;
3695 while(trie_op_hash[j]> j){
3696 k = trie_op_hash[j];
3697 t = hyf_distance[k];
3698 hyf_distance[k]= hyf_distance[j];
3701 hyf_num[k]= hyf_num[j];
3704 hyf_next[k]= hyf_next[j];
3706 trie_op_hash[j]= trie_op_hash[k];
3709 while(j++ < for_end);
3712 register integer for_end;
3714 for_end = trie_size;
3717 while(p++ < for_end);
3719 trie_l[0]= compress_trie(trie_l[0]);
3721 register integer for_end;
3726 while(p++ < for_end);
3729 register integer for_end;
3734 while(p++ < for_end);
3740 first_fit(trie_l[0]);
3741 trie_pack(trie_l[0]);
3746 register integer for_end;
3752 trie_tro[r]= min_trie_op;
3755 while(r++ < for_end);
3760 trie_fix(trie_l[0]);
3766 trie_tro[r]= min_trie_op;
3770 } while(!(r > trie_max));
3773 trie_not_ready = false;
3778 void store_fmt_file (void)
3783 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3784 if (!is_initex) { /* redundant check 94/Feb/14 */
3785 show_line("! \\dump is performed only by INITEX\n", 1);
3787 show_line(" (Use -i on the command line)\n", 0);
3791 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3793 print_err("You can't dump inside a group");
3794 help1("`{...\\dump}' is a no-no..");
3796 if(interaction == 3) interaction = 2;
3802 if(interaction > 0) debug_help ();
3805 jump_out (); // trying to \dump inside a group
3806 // return; // drops through now
3808 } /* end of if save_ptr != 0 */
3811 print_string(" (format=");
3813 print_char(32); /* */
3814 /* print_int(eqtb[(hash_size + 3186)].cint % 100); */ /* Y2K */
3815 print_int(eqtb[(hash_size + 3186)].cint); /* 98/Oct/12 */
3817 int n= eqtb[(hash_size + 3186)].cint;
3818 sprintf(log_line, "YEAR: %ld\n", n);
3819 show_line(log_line, 0);
3821 print_char(46); /* . */
3822 print_int(eqtb[(hash_size + 3185)].cint);
3823 print_char(46); /* . */
3824 print_int(eqtb[(hash_size + 3184)].cint);
3825 print_char(41); /*)*/
3826 if(interaction == 0)selector = 18;
3829 #ifdef ALLOCATESTRING
3830 if(pool_ptr + 1 > current_pool_size)
3831 str_pool = realloc_str_pool (increment_pool_size);
3832 if(pool_ptr + 1 > current_pool_size){ /* in case it failed 94/Jan/24 */
3833 overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */
3834 return; // abort_flag set
3837 if(pool_ptr + 1 > pool_size){
3838 overflow("pool size", pool_size - init_pool_ptr); /* pool size */
3839 return; // abort_flag set
3843 format_ident = make_string ();
3844 pack_job_name(780); /* .fmt */
3845 while(! w_open_out(fmt_file)) {
3846 prompt_file_name(1267, 780); /* format file name .fmt */
3848 print_nl(" Beginning to dump on file "); /* */
3849 slow_print(w_make_name_string(fmt_file));
3852 pool_ptr = str_start[str_ptr];
3855 slow_print(format_ident);
3856 dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
3860 dump_int((hash_size + 4006)); /* eqtbsize */
3861 dump_int(hash_prime);
3862 /* dump_int(607); */
3863 dump_int(hyphen_prime); /* bkph */
3866 if (dumpthings(str_start[0], str_ptr + 1)
3868 if (dumpthings(str_pool[0], pool_ptr)
3872 print_string("strings of total length ");
3873 print_int(pool_ptr);
3876 dump_int(lo_mem_max);
3882 if (dumpthings(mem[p], q + 2 - p)
3885 var_used = var_used + q - p;
3886 p = q + mem[q].hh.v.LH;
3887 q = mem[q + 1].hh.v.RH;
3888 } while(!(q == rover));
3889 var_used = var_used + lo_mem_max - p;
3890 dyn_used = mem_end + 1 - hi_mem_min;
3891 if (dumpthings(mem[p], lo_mem_max + 1 - p)
3893 x = x + lo_mem_max + 1 - p;
3894 dump_int(hi_mem_min);
3896 if (dumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min)
3898 x = x + mem_end + 1 - hi_mem_min;
3908 print_string("memory locations dumped; current usage is ");
3909 print_int(var_used);
3910 print_char(38); /* & */
3911 print_int(dyn_used);
3915 while(j < (hash_size + 3162)){
3916 if((eqtb[j].hh.v.RH == eqtb[j + 1].hh.v.RH)&&(eqtb[j
3917 ].hh.b0 == eqtb[j + 1].hh.b0)&&(eqtb[j].hh.b1 == eqtb[j +
3922 l = (hash_size + 3163);
3926 while(j < (hash_size + 3162)){
3927 if((eqtb[j].hh.v.RH != eqtb[j + 1].hh.v.RH)||(eqtb[j
3928 ].hh.b0 != eqtb[j + 1].hh.b0)||(eqtb[j].hh.b1 != eqtb[j +
3933 lab31: dump_int(l - k);
3934 if (dumpthings(eqtb[k], l - k)
3938 } while(!(k == (hash_size + 3163)));
3941 while(j < (hash_size + 4006)){
3942 if(eqtb[j].cint == eqtb[j + 1].cint)
3946 l = (hash_size + 4007);
3950 while(j < (hash_size + 4006)){
3951 if(eqtb[j].cint != eqtb[j + 1].cint)
3955 lab32: dump_int(l - k);
3956 if (dumpthings(eqtb[k], l - k)
3960 } while(!(k > (hash_size + 4006)));
3962 dump_int(write_loc);
3963 dump_int(hash_used);
3964 /* cs_count:=frozen_control_sequence-1-hash_used; */
3965 /* cs_count = (hash_size + 513) - hash_used; */
3966 cs_count = (hash_size + hash_extra + 513) - hash_used;
3967 /* cs_count = (hash_size + 780) - hash_used; */ /* ??? */
3969 sprintf(log_line, "itex cs_count %d hash_size %d hash_extra %d hash_used %d",
3970 cs_count, hash_size, hash_extra, hash_used); /* debugging */
3971 show_line(log_line, 0);
3973 /* for p <- hash_base to hash_used do */
3975 register integer for_end;
3977 for_end = hash_used;
3979 if(hash[p].v.RH != 0){
3984 sprintf(log_line, "itex cs_count++ ");
3985 show_line(log_line, 0); /* debugging */
3988 while(p++ < for_end);
3991 /* for p <- hash_used+1 to undefined_control_sequence-1 do dump_hh(hash[p]) */
3992 if (dumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used)
3996 print_int(cs_count);
3997 print_string(" multiletter control sequences");
4000 if (dumpthings(font_info[0], fmem_ptr)) return;
4001 /* frozenfontptr = font_ptr; */ /* number of fonts frozen into format */
4003 if (dumpthings(font_check[0], font_ptr + 1))return;
4004 if (dumpthings(font_size[0], font_ptr + 1))return;
4005 if (dumpthings(font_dsize[0], font_ptr + 1))return;
4006 if (dumpthings(font_params[0], font_ptr + 1))return;
4007 if (dumpthings(hyphen_char[0], font_ptr + 1))return;
4008 if (dumpthings(skew_char[0], font_ptr + 1))return;
4009 if (dumpthings(font_name[0], font_ptr + 1))return;
4010 if (dumpthings(font_area[0], font_ptr + 1))return;
4011 if (dumpthings(font_bc[0], font_ptr + 1))return;
4012 if (dumpthings(font_ec[0], font_ptr + 1))return;
4013 if (dumpthings(char_base[0], font_ptr + 1))return;
4014 if (dumpthings(width_base[0], font_ptr + 1))return;
4015 if (dumpthings(height_base[0], font_ptr + 1))return;
4016 if (dumpthings(depth_base[0], font_ptr + 1))return;
4017 if (dumpthings(italic_base[0], font_ptr + 1))return;
4018 if (dumpthings(lig_kern_base[0], font_ptr + 1))return;
4019 if (dumpthings(kern_base[0], font_ptr + 1))return;
4020 if (dumpthings(exten_base[0], font_ptr + 1))return;
4021 if (dumpthings(param_base[0], font_ptr + 1))return;
4022 if (dumpthings(font_glue[0], font_ptr + 1))return;
4023 if (dumpthings(bchar_label[0], font_ptr + 1))return;
4024 if (dumpthings(font_bchar[0], font_ptr + 1))return;
4025 if (dumpthings(font_false_bchar[0], font_ptr + 1))return;
4027 register integer for_end;
4034 /* print_esc(hash[(hash_size + 524) + k].v.RH); */
4035 //print_esc(hash[(hash_size + hash_extra + 524) + k].v.RH);
4036 print_esc("");print(hash[(hash_size + hash_extra + 524) + k].v.RH);
4037 print_char(61); /* = */
4038 print_file_name(font_name[k], font_area[k], 335);
4039 if(font_size[k]!= font_dsize[k])
4041 print_string(" at ");
4042 print_scaled(font_size[k]);
4046 while(k++ < for_end);
4050 print_int(fmem_ptr - 7);
4051 print_string("words of font info for");
4052 print_int(font_ptr - 0);
4053 print_string(" preloaded font");
4055 print_char(115); /* s */
4056 dump_int(hyph_count);
4057 /* {register integer for_end; k = 0; for_end = 607; if(k <= for_end) do */
4059 register integer for_end;
4061 for_end = hyphen_prime;
4063 if(hyph_word[k]!= 0)
4066 dump_int(hyph_word[k]);
4067 dump_int(hyph_list[k]);
4069 while(k++ < for_end);
4072 print_int(hyph_count);
4073 print_string(" hyphenation exception");
4075 print_char(115); /* s */
4079 if (dumpthings(trie_trl[0], trie_max + 1)
4081 if (dumpthings(trie_tro[0], trie_max + 1)
4083 if (dumpthings(trie_trc[0], trie_max + 1)
4085 dump_int(trie_op_ptr);
4086 if (dumpthings(hyf_distance[1], trie_op_ptr)
4088 if (dumpthings(hyf_num[1], trie_op_ptr)
4090 if (dumpthings(hyf_next[1], trie_op_ptr)
4092 print_nl("Hyphenation trie of length "); /* */
4093 print_int(trie_max);
4094 print_string("has");
4095 print_int(trie_op_ptr);
4097 if(trie_op_ptr != 1)
4098 print_char(115); /* s */
4099 print_string("out of");
4100 print_int(trie_op_size);
4102 register integer for_end;
4109 print_int(trie_used[k]);
4110 print_string("for language");
4113 dump_int(trie_used[k]);
4115 while(k-- > for_end);
4117 dump_int(interaction);
4118 dump_int(format_ident);
4119 dump_int(ENDFMTCHECKSUM); /* magic checksum end of FMT file --- change ??? */
4120 eqtb[(hash_size + 3194)].cint = 0; /* tracingstats */
4123 } /* end of store_fmt_file */
4127 void init_prim (void)
4129 no_new_control_sequence = false;
4130 primitive(373, assign_glue, (hash_size + 782)); /* lineskip */
4131 primitive(374, assign_glue, (hash_size + 783)); /* baselineskip */
4132 primitive(375, assign_glue, (hash_size + 784)); /* parskip */
4133 primitive(376, assign_glue, (hash_size + 785)); /* abovedisplayskip */
4134 primitive(377, assign_glue, (hash_size + 786)); /* belowdisplayskip */
4135 primitive(378, assign_glue, (hash_size + 787)); /* abovedisplayshortskip */
4136 primitive(379, assign_glue, (hash_size + 788)); /* belowdisplayshortskip */
4137 primitive(380, assign_glue, (hash_size + 789)); /* leftskip */
4138 primitive(381, assign_glue, (hash_size + 790)); /* rightskip */
4139 primitive(382, assign_glue, (hash_size + 791)); /* topskip */
4140 primitive(383, assign_glue, (hash_size + 792)); /* splittopskip */
4141 primitive(384, assign_glue, (hash_size + 793)); /* tabskip */
4142 primitive(385, assign_glue, (hash_size + 794)); /* spaceskip */
4143 primitive(386, assign_glue, (hash_size + 795)); /* xspaceskip */
4144 primitive(387, assign_glue, (hash_size + 796)); /* parfillskip */
4145 primitive(388, assign_mu_glue, (hash_size + 797)); /* thinmuskip */
4146 primitive(389, assign_mu_glue, (hash_size + 798)); /* medmuskip */
4147 primitive(390, assign_mu_glue, (hash_size + 799)); /* thickmuskip */
4148 primitive(395, assign_toks, (hash_size + 1313)); /* output */
4149 primitive(396, assign_toks, (hash_size + 1314)); /* everypar */
4150 primitive(397, assign_toks, (hash_size + 1315)); /* everymath */
4151 primitive(398, assign_toks, (hash_size + 1316)); /* everydisplay */
4152 primitive(399, assign_toks, (hash_size + 1317)); /* everyhbox */
4153 primitive(400, assign_toks, (hash_size + 1318)); /* everyvbox */
4154 primitive(401, assign_toks, (hash_size + 1319)); /* everyjob */
4155 primitive(402, assign_toks, (hash_size + 1320)); /* everycr */
4156 primitive(403, assign_toks, (hash_size + 1321)); /* errhelp */
4157 primitive(417, assign_int, (hash_size + 3163)); /* pretolerance */
4158 primitive(418, assign_int, (hash_size + 3164)); /* tolerance */
4159 primitive(419, assign_int, (hash_size + 3165)); /* linepenalty */
4160 primitive(420, assign_int, (hash_size + 3166)); /* hyphenpenalty */
4161 primitive(421, assign_int, (hash_size + 3167)); /* exhyphenpenalty */
4162 primitive(422, assign_int, (hash_size + 3168)); /* clubpenalty */
4163 primitive(423, assign_int, (hash_size + 3169)); /* widowpenalty */
4164 primitive(424, assign_int, (hash_size + 3170)); /* displaywidowpenalty */
4165 primitive(425, assign_int, (hash_size + 3171)); /* brokenpenalty */
4166 primitive(426, assign_int, (hash_size + 3172)); /* binoppenalty */
4167 primitive(427, assign_int, (hash_size + 3173)); /* relpenalty */
4168 primitive(428, assign_int, (hash_size + 3174)); /* predisplaypenalty */
4169 primitive(429, assign_int, (hash_size + 3175)); /* postdisplaypenalty */
4170 primitive(430, assign_int, (hash_size + 3176)); /* interlinepenalty */
4171 primitive(431, assign_int, (hash_size + 3177)); /* doublehyphendemerits */
4172 primitive(432, assign_int, (hash_size + 3178)); /* finalhyphendemerits */
4173 primitive(433, assign_int, (hash_size + 3179)); /* adjdemerits */
4174 primitive(434, assign_int, (hash_size + 3180)); /* mag */
4175 primitive(435, assign_int, (hash_size + 3181)); /* delimiterfactor */
4176 primitive(436, assign_int, (hash_size + 3182)); /* looseness */
4177 primitive(437, assign_int, (hash_size + 3183)); /* time */
4178 primitive(438, assign_int, (hash_size + 3184)); /* day */
4179 primitive(439, assign_int, (hash_size + 3185)); /* month */
4180 primitive(440, assign_int, (hash_size + 3186)); /* year */
4181 primitive(441, assign_int, (hash_size + 3187)); /* showboxbreadth */
4182 primitive(442, assign_int, (hash_size + 3188)); /* showboxdepth */
4183 primitive(443, assign_int, (hash_size + 3189)); /* hbadness */
4184 primitive(444, assign_int, (hash_size + 3190)); /* vbadness */
4185 primitive(445, assign_int, (hash_size + 3191)); /* pausing */
4186 primitive(446, assign_int, (hash_size + 3192)); /* tracingonline */
4187 primitive(447, assign_int, (hash_size + 3193)); /* tracingmacros */
4188 primitive(448, assign_int, (hash_size + 3194)); /* tracingstats */
4189 primitive(449, assign_int, (hash_size + 3195)); /* tracingparagraphs */
4190 primitive(450, assign_int, (hash_size + 3196)); /* tracingpages */
4191 primitive(451, assign_int, (hash_size + 3197)); /* tracingoutput */
4192 primitive(452, assign_int, (hash_size + 3198)); /* tracinglostchars */
4193 primitive(453, assign_int, (hash_size + 3199)); /* tracingcommands */
4194 primitive(454, assign_int, (hash_size + 3200)); /* tracingrestores */
4195 primitive(455, assign_int, (hash_size + 3201)); /* uchyph */
4196 primitive(456, assign_int, (hash_size + 3202)); /* outputpenalty */
4197 primitive(457, assign_int, (hash_size + 3203)); /* maxdeadcycles */
4198 primitive(458, assign_int, (hash_size + 3204)); /* hangafter */
4199 primitive(459, assign_int, (hash_size + 3205)); /* floatingpenalty */
4200 primitive(460, assign_int, (hash_size + 3206)); /* globaldefs */
4201 primitive(461, assign_int, (hash_size + 3207)); /* fam */
4202 primitive(462, assign_int, (hash_size + 3208)); /* escapechar */
4203 primitive(463, assign_int, (hash_size + 3209)); /* defaulthyphenchar */
4204 primitive(464, assign_int, (hash_size + 3210)); /* defaultskewchar */
4205 primitive(465, assign_int, (hash_size + 3211)); /* endlinechar */
4206 primitive(466, assign_int, (hash_size + 3212)); /* newlinechar */
4207 primitive(467, assign_int, (hash_size + 3213)); /* language */
4208 primitive(468, assign_int, (hash_size + 3214)); /* lefthyphenmin */
4209 primitive(469, assign_int, (hash_size + 3215)); /* righthyphenmin */
4210 primitive(470, assign_int, (hash_size + 3216)); /* holdinginserts */
4211 primitive(471, assign_int, (hash_size + 3217)); /* errorcontextlines */
4212 primitive(475, assign_dimen, (hash_size + 3730)); /* parindent */
4213 primitive(476, assign_dimen, (hash_size + 3731)); /* mathsurround */
4214 primitive(477, assign_dimen, (hash_size + 3732)); /* lineskiplimit */
4215 primitive(478, assign_dimen, (hash_size + 3733)); /* hsize */
4216 primitive(479, assign_dimen, (hash_size + 3734)); /* vsize */
4217 primitive(480, assign_dimen, (hash_size + 3735)); /* maxdepth */
4218 primitive(481, assign_dimen, (hash_size + 3736)); /* splitmaxdepth */
4219 primitive(482, assign_dimen, (hash_size + 3737)); /* boxmaxdepth */
4220 primitive(483, assign_dimen, (hash_size + 3738)); /* hfuzz */
4221 primitive(484, assign_dimen, (hash_size + 3739)); /* vfuzz */
4222 primitive(485, assign_dimen, (hash_size + 3740)); /* delimitershortfall */
4223 primitive(486, assign_dimen, (hash_size + 3741)); /* nulldelimiterspace */
4224 primitive(487, assign_dimen, (hash_size + 3742)); /* scriptspace */
4225 primitive(488, assign_dimen, (hash_size + 3743)); /* predisplaysize */
4226 primitive(489, assign_dimen, (hash_size + 3744)); /* displaywidth */
4227 primitive(490, assign_dimen, (hash_size + 3745)); /* displayindent */
4228 primitive(491, assign_dimen, (hash_size + 3746)); /* overfullrule */
4229 primitive(492, assign_dimen, (hash_size + 3747)); /* hangindent */
4230 primitive(493, assign_dimen, (hash_size + 3748)); /* hoffset */
4231 primitive(494, assign_dimen, (hash_size + 3749)); /* voffset */
4232 primitive(495, assign_dimen, (hash_size + 3750)); /* emergencystretch */
4233 primitive(32, ex_space, 0); /* */
4234 primitive(47, ital_corr, 0); /* / */
4235 primitive(505, accent, 0); /* accent */
4236 primitive(506, advance, 0); /* advance */
4237 primitive(507, after_assignment, 0); /* afterassignment */
4238 primitive(508, after_group, 0); /* aftergroup */
4239 primitive(509, begin_group, 0); /* begingroup */
4240 primitive(510, char_num, 0); /* char */
4241 primitive(501, cs_name, 0); /* csname */
4242 primitive(511, delim_num, 0); /* delimiter */
4243 primitive(512, divide, 0); /* divide */
4244 primitive(502, end_cs_name, 0); /* endcsname */
4245 primitive(513, end_group, 0); /* endgroup */
4246 /* hash[(hash_size + 516)].v.RH = 513; */
4247 hash[(hash_size + hash_extra + 516)].v.RH = 513; /* endgroup */
4248 /* eqtb[(hash_size + 516)]= eqtb[cur_val]; */
4249 eqtb[(hash_size + hash_extra + 516)]= eqtb[cur_val];
4250 primitive(514, expand_after, 0); /* expandafter */
4251 primitive(515, def_font, 0); /* font */
4252 primitive(516, assign_font_dimen, 0); /* fontdimen */
4253 primitive(517, halign, 0); /* halign */
4254 primitive(518, hrule, 0); /* hrule */
4255 primitive(519, ignore_spaces, 0); /* ignorespaces */
4256 primitive(327, insert, 0); /* insert */
4257 primitive(348, mark, 0); /* mark */
4258 primitive(520, math_accent, 0); /* mathaccent */
4259 primitive(521, math_char_num, 0); /* mathchar */
4260 primitive(522, math_choice, 0); /* mathchoice */
4261 primitive(523, multiply, 0); /* multiply */
4262 primitive(524, no_align, 0); /* noalign */
4263 primitive(525, no_boundary, 0); /* noboundary */
4264 primitive(526, no_expand, 0); /* noexpand */
4265 primitive(332, non_script, 0); /* nonscript */
4266 primitive(527, omit, 0); /* omit */
4267 primitive(405, set_shape, 0); /* parshape */
4268 primitive(528, break_penalty, 0); /* penalty */
4269 primitive(529, set_prev_graf, 0); /* prevgraf */
4270 primitive(530, radical, 0); /* radical */
4271 primitive(531, read_to_cs, 0); /* read */
4272 primitive(532, relax, 256); /* primitive("relax",relax,256); */
4273 /* hash[(hash_size + 521)].v.RH = 532; */
4274 hash[(hash_size + hash_extra + 521)].v.RH = 532; /* read */
4275 /* eqtb[(hash_size + 521)]= eqtb[cur_val]; */
4276 eqtb[(hash_size + hash_extra + 521)]= eqtb[cur_val];
4277 primitive(533, set_box, 0); /* setbox */
4278 primitive(534, the, 0); /* the */
4279 primitive(404, toks_register, 0); /* toks */
4280 primitive(349, vadjust, 0); /* vadjust */
4281 primitive(535, valign, 0); /* valign */
4282 primitive(536, vcenter, 0); /* vcenter */
4283 primitive(537, vrule, 0); /* vrule */
4284 primitive(594, par_end, 256); /* par */
4286 par_token = 4095 + par_loc;
4287 primitive(626, input, 0); /* input */
4288 primitive(627, input, 1); /* endinput */
4289 primitive(628, top_bot_mark, 0); /* topmark */
4290 primitive(629, top_bot_mark, 1); /* firstmark */
4291 primitive(630, top_bot_mark, 2); /* botmark */
4292 primitive(631, top_bot_mark, 3); /* splitfirstmark */
4293 primitive(632, top_bot_mark, 4); /* splitbotmark */
4294 primitive(473, tex_register, 0); /* count */
4295 primitive(497, tex_register, 1); /* dimen */
4296 primitive(392, tex_register, 2); /* skip */
4297 primitive(393, tex_register, 3); /* muskip */
4298 primitive(665, set_aux, 102); /* spacefactor */
4299 primitive(666, set_aux, 1); /* prevdepth */
4300 primitive(667, set_page_int, 0); /* dead_cycles */
4301 primitive(668, set_page_int, 1); /* insert_penalties */
4302 primitive(669, set_box_dimen, 1); /* wd */
4303 primitive(670, set_box_dimen, 3); /* ht */
4304 primitive(671, set_box_dimen, 2); /* dp */
4305 primitive(672, last_item, 0); /* last_penalty */
4306 primitive(673, last_item, 1); /* last_kern */
4307 primitive(674, last_item, 2); /* lastskip */
4308 primitive(675, last_item, 3); /* inputlineno */
4309 primitive(676, last_item, 4); /* badness */
4310 primitive(732, convert, 0); /* number */
4311 primitive(733, convert, 1); /* romannumeral */
4312 primitive(734, convert, 2); /* string */
4313 primitive(735, convert, 3); /* meaning */
4314 primitive(736, convert, 4); /* font_name */
4315 primitive(737, convert, 5); /* job_name */
4316 primitive(753, if_test, 0); /* if */
4317 primitive(754, if_test, 1); /* ifcat */
4318 primitive(755, if_test, 2); /* ifnum */
4319 primitive(756, if_test, 3); /* ifdim */
4320 primitive(757, if_test, 4); /* ifodd */
4321 primitive(758, if_test, 5); /* ifvmode */
4322 primitive(759, if_test, 6); /* ifhmode */
4323 primitive(760, if_test, 7); /* ifmmode */
4324 primitive(761, if_test, 8); /* ifinner */
4325 primitive(762, if_test, 9); /* ifvoid */
4326 primitive(763, if_test, 10); /* ifhbox */
4327 primitive(764, if_test, 11); /* ifvbox */
4328 primitive(765, if_test, 12); /* ifx */
4329 primitive(766, if_test, 13); /* ifeof */
4330 primitive(767, if_test, 14); /* iftrue */
4331 primitive(768, if_test, 15); /* iffalse */
4332 primitive(769, if_test, 16); /* ifcase */
4333 primitive(770, fi_or_else, 2); /* fi */
4334 /* hash[(hash_size + 518)].v.RH = 770; */
4335 hash[(hash_size + hash_extra + 518)].v.RH = 770; /* fi */
4336 /* eqtb[(hash_size + 518)]= eqtb[cur_val]; */
4337 eqtb[(hash_size + hash_extra + 518)]= eqtb[cur_val];
4338 primitive(771, fi_or_else, 4); /* or */
4339 primitive(772, fi_or_else, 3); /* else */
4340 primitive(795, set_font, 0); /* nullfont */
4341 /* hash[(hash_size + 524)].v.RH = 795; */ /* hash[frozen_null_font] */
4342 hash[(hash_size + hash_extra + 524)].v.RH = 795; /* nullfont */
4343 /* eqtb[(hash_size + 524)]= eqtb[cur_val]; */
4344 eqtb[(hash_size + hash_extra + 524)]= eqtb[cur_val];
4345 primitive(892, tab_mark, 256); /* span */
4346 /* primitive("span",tab_mark,span_code); */
4347 primitive(893, car_ret, 257); /* cr */
4348 /* primitive("cr",car_ret,cr_code); */
4349 /* hash[(hash_size + 515)].v.RH = 893; */
4350 hash[(hash_size + hash_extra + 515)].v.RH = 893; /* cr */
4351 /* eqtb[(hash_size + 515)]= eqtb[cur_val]; */
4352 eqtb[(hash_size + hash_extra + 515)]= eqtb[cur_val];
4353 primitive(894, car_ret, 258); /* cr cr */
4354 /* hash[(hash_size + 519)].v.RH = 895; */
4355 hash[(hash_size + hash_extra + 519)].v.RH = 895; /* endtemplate */
4356 /* hash[(hash_size + 520)].v.RH = 895; */
4357 hash[(hash_size + hash_extra + 520)].v.RH = 895; /* endtemplate */
4358 /* eqtb[(hash_size + 520)].hh.b0 = 9; */
4359 eqtb[(hash_size + hash_extra + 520)].hh.b0 = 9;
4360 /* eqtb[(hash_size + 520)].hh.v.RH = null_list; */
4361 eqtb[(hash_size + hash_extra + 520)].hh.v.RH = null_list;
4362 /* eqtb[(hash_size + 520)].hh.b1 = 1; */
4363 eqtb[(hash_size + hash_extra + 520)].hh.b1 = 1;
4364 /* eqtb[(hash_size + 519)]= eqtb[(hash_size + 520)]; */
4365 eqtb[(hash_size + hash_extra + 519)]=
4366 eqtb[(hash_size + hash_extra + 520)];
4367 /* eqtb[(hash_size + 519)].hh.b0 = 115; */
4368 eqtb[(hash_size + hash_extra + 519)].hh.b0 = 115;
4369 primitive(964, set_page_dimen, 0); /* pagegoal */
4370 primitive(965, set_page_dimen, 1); /* pagetotal */
4371 primitive(966, set_page_dimen, 2); /* pagestretch */
4372 primitive(967, set_page_dimen, 3); /* pagefilstretch */
4373 primitive(968, set_page_dimen, 4); /* pagefillstretch */
4374 primitive(969, set_page_dimen, 5); /* pagefilllstretch */
4375 primitive(970, set_page_dimen, 6); /* pageshrink */
4376 primitive(971, set_page_dimen, 7); /* pagedepth */
4377 primitive(1019, end_match, 0); /* end */
4378 primitive(1020, stop, 1); /* dump */
4379 primitive(1021, hskip, 4); /* hskip */
4380 primitive(1022, hskip, 0); /* hfil */
4381 primitive(1023, hskip, 1); /* hfill */
4382 primitive(1024, hskip, 2); /* hss */
4383 primitive(1025, hskip, 3); /* hfilneg */
4384 primitive(1026, vskip, 4); /* vskip */
4385 primitive(1027, vskip, 0); /* vfil */
4386 primitive(1028, vskip, 1); /* vfill */
4387 primitive(1029, vskip, 2); /* vss */
4388 primitive(1030, vskip, 3); /* vfilneg */
4389 primitive(333, mskip, 5); /* mskip */
4390 primitive(337, kern, 1); /* kern */
4391 primitive(339, mkern, 99); /* mkern */
4392 primitive(1048, hmove, 1); /* moveleft */
4393 primitive(1049, hmove, 0); /* moveright */
4394 primitive(1050, vmove, 1); /* raise */
4395 primitive(1051, vmove, 0); /* lower */
4396 primitive(406, make_box, 0); /* box */
4397 primitive(1052, make_box, 1); /* copy */
4398 primitive(1053, make_box, 2); /* lastbox */
4399 primitive(959, make_box, 3); /* vsplit */
4400 primitive(1054, make_box, 4); /* vtop */
4401 primitive(961, make_box, 5); /* vbox */
4402 primitive(1055, make_box, 106); /* hbox */
4403 primitive(1056, leader_ship, 99); /* ship_out */
4404 primitive(1057, leader_ship, 100); /* leaders */
4405 primitive(1058, leader_ship, 101); /* cleaders */
4406 primitive(1059, leader_ship, 102); /* xleaders */
4407 primitive(1074, start_par, 1); /* indent */
4408 primitive(1075, start_par, 0); /* noindent */
4409 primitive(1084, remove_item, 12); /* unpenalty */
4410 primitive(1085, remove_item, 11); /* unkern */
4411 primitive(1086, remove_item, 10); /* unskip */
4412 primitive(1087, un_hbox, 0); /* unhbox */
4413 primitive(1088, un_hbox, 1); /* unhcopy */
4414 primitive(1089, un_vbox, 0); /* unvbox */
4415 primitive(1090, un_vbox, 1); /* unvcopy */
4416 primitive(45, discretionary, 1); /* - */
4417 primitive(346, discretionary, 0); /* discretionary */
4418 primitive(1121, eq_no, 0); /* eqno */
4419 primitive(1122, eq_no, 1); /* leqno */
4420 primitive(860, math_comp, 16); /* mathord */
4421 primitive(861, math_comp, 17); /* mathop */
4422 primitive(862, math_comp, 18); /* mathbin */
4423 primitive(863, math_comp, 19); /* mathrel */
4424 primitive(864, math_comp, 20); /* mathopen */
4425 primitive(865, math_comp, 21); /* mathclose */
4426 primitive(866, math_comp, 22); /* mathpunct */
4427 primitive(867, math_comp, 23); /* mathinner */
4428 primitive(869, math_comp, 26); /* underline */
4429 primitive(868, math_comp, 27); /* overline */
4430 primitive(1123, limit_switch, 0); /* displaylimits */
4431 primitive(872, limit_switch, 1); /* limits */
4432 primitive(873, limit_switch, 2); /* nolimits */
4433 primitive(855, math_style, 0); /* displaystyle */
4434 primitive(856, math_style, 2); /* textstyle */
4435 primitive(857, math_style, 4); /* scriptstyle */
4436 primitive(858, math_style, 6); /* scriptscriptstyle */
4437 primitive(1141, above, 0); /* above */
4438 primitive(1142, above, 1); /* over */
4439 primitive(1143, above, 2); /* atop */
4440 primitive(1144, above, 3); /* abovewithdelims */
4441 primitive(1145, above, 4); /* overwithdelims */
4442 primitive(1146, above, 5); /* atopwithdelims */
4443 primitive(870, left_right, 30); /* left */
4444 primitive(871, left_right, 31); /* right */
4445 /* hash[(hash_size + 517)].v.RH = 871; */
4446 hash[(hash_size + hash_extra + 517)].v.RH = 871; /* right */
4447 /* eqtb[(hash_size + 517)]= eqtb[cur_val]; */
4448 eqtb[(hash_size + hash_extra + 517)]= eqtb[cur_val];
4449 primitive(1165, prefix, 1); /* long */
4450 primitive(1166, prefix, 2); /* outer */
4451 primitive(1167, prefix, 4); /* global */
4452 primitive(1168, def, 0); /* def */
4453 primitive(1169, def, 1); /* gdef */
4454 primitive(1170, def, 2); /* edef */
4455 primitive(1171, def, 3); /* xdef */
4456 primitive(1185, let, 0); /* let */
4457 primitive(1186, let, 1); /* futurelet */
4458 primitive(1187, shorthand_def, 0); /* chardef */
4459 primitive(1188, shorthand_def, 1); /* mathchardef */
4460 primitive(1189, shorthand_def, 2); /* countdef */
4461 primitive(1190, shorthand_def, 3); /* dimendef */
4462 primitive(1191, shorthand_def, 4); /* skipdef */
4463 primitive(1192, shorthand_def, 5); /* muskipdef */
4464 primitive(1193, shorthand_def, 6); /* toksdef */
4465 primitive(412, def_code, (hash_size + 1883)); /* catcode */
4466 primitive(416, def_code, (hash_size + 2907)); /* mathcode */
4467 primitive(413, def_code, (hash_size + 2139)); /* lccode */
4468 primitive(414, def_code, (hash_size + 2395)); /* uccode */
4469 primitive(415, def_code, (hash_size + 2651)); /* sfcode */
4470 primitive(474, def_code, (hash_size + 3474)); /* delcode */
4471 primitive(409, def_family, (hash_size + 1835)); /* textfont */
4472 primitive(410, def_family, (hash_size + 1851)); /* scriptfont */
4473 primitive(411, def_family, (hash_size + 1867)); /* scriptscriptfont */
4474 primitive(935, hyph_data, 0); /* hyphenation */
4475 primitive(947, hyph_data, 1); /* patterns */
4476 primitive(1211, assign_font_int, 0); /* hyphen_char */
4477 primitive(1212, assign_font_int, 1); /* skew_char */
4478 primitive(272, set_interaction, 0); /* batchmode */
4479 primitive(273, set_interaction, 1); /* nonstopmode */
4480 primitive(274, set_interaction, 2); /* scrollmode */
4481 primitive(1221, set_interaction, 3); /* errorstopmode */
4482 primitive(1222, in_stream, 1); /* openin */
4483 primitive(1223, in_stream, 0); /* closein */
4484 primitive(1224, message, 0); /* message */
4485 primitive(1225, message, 1); /* errmessage */
4486 primitive(1231, case_shift, (hash_size + 2139)); /* lowercase */
4487 primitive(1232, case_shift, (hash_size + 2395)); /* uppercase */
4488 primitive(1233, xray, 0); /* show */
4489 primitive(1234, xray, 1); /* show_box */
4490 primitive(1235, xray, 2); /* showthe */
4491 primitive(1236, xray, 3); /* showlists */
4492 primitive(1279, extension, 0); /* openout */
4493 primitive(591, extension, 1); /* write */
4494 write_loc = cur_val;
4495 primitive(1280, extension, 2); /* closeout */
4496 primitive(1281, extension, 3); /* special */
4497 primitive(1282, extension, 4); /* immediate */
4498 primitive(1283, extension, 5); /* setlanguage */
4499 no_new_control_sequence = true;
4503 #pragma optimize("s", off) /* 96/Sep/12 */
4504 /* #pragma optimize("1", off) */
4505 #pragma optimize("t", on) /* 96/Sep/12 */
4506 /* #pragma optimize("2", on) */