OSDN Git Service

string pool clean.
[putex/putex.git] / src / texsourc / itex.c
1 /* Copyright 1992 Karl Berry
2    Copyright 2007 TeX Users Group
3    Copyright 2014 Clerk Ma
4
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.
9
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.
14
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
18    02110-1301 USA.  */
19
20 #ifdef _WINDOWS
21   #define NOCOMM
22   #define NOSOUND
23   #define NODRIVERS
24   #define STRICT
25   #pragma warning(disable:4115) // kill rpcasync.h complaint
26   #include <windows.h>
27   #define MYLIBAPI __declspec(dllexport)
28 #endif
29
30 #include "texwin.h"
31
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
36
37 #include <setjmp.h>
38
39 #define EXTERN extern
40
41 #include "texd.h"
42
43 #pragma warning(disable:4244) /* 96/Jan/10 */
44
45 #include <time.h>
46
47 #define BEGINFMTCHECKSUM 367403084L
48 #define ENDFMTCHECKSUM   69069L
49
50 extern clock_t start_time, main_time, finish_time; /* in local.c */
51
52 /* imported from pascal.h */
53 /* localized here to avoid conflict with io.h in other code */
54
55 #define read(f, b) ((b) = getc (f))
56 #define readln(f) { register int c; while ((c = getc (f)) != '\n' && c != EOF); }
57
58 #ifdef INITEX
59   void do_initex (void); /* later in this file */
60 #endif
61
62 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
63
64 void initialize (void)
65 {
66   integer i; 
67   integer k; 
68   integer flag; /* bkph */
69 #ifndef ALLOCATEHYPHEN
70   hyph_pointer z;
71 #endif
72
73 /* We already initialized xchr if we are using non_ascii setup */
74 /* Normally, there is no translation of character code numbers */
75   if (!non_ascii)
76   {
77     for (i = 0; i <= 255; i++)
78       xchr[i] = (char) i;
79 /* This is a kind of joke, since the characters are given as numeric codes ! */
80 #ifdef JOKE
81     xchr[32] = ' ';  xchr[33] = '!';  xchr[34] = '"';  xchr[35] = '#';
82     xchr[36] = '$';  xchr[37] = '%';  xchr[38] = '&';  xchr[39] = '\'';
83     xchr[40] = '(';  xchr[41] = ')';  xchr[42] = '*';  xchr[43] = '+';
84     xchr[44] = ',';  xchr[45] = '-';  xchr[46] = '.';  xchr[47] = '/';
85     xchr[48] = '0';  xchr[49] = '1';  xchr[50] = '2';  xchr[51] = '3';
86     xchr[52] = '4';  xchr[53] = '5';  xchr[54] = '6';  xchr[55] = '7';
87     xchr[56] = '8';  xchr[57] = '9';  xchr[58] = ':';  xchr[59] = ';';
88     xchr[60] = '<';  xchr[61] = '=';  xchr[62] = '>';  xchr[63] = '?';
89     xchr[64] = '@';  xchr[65] = 'A';  xchr[66] = 'B';  xchr[67] = 'C';
90     xchr[68] = 'D';  xchr[69] = 'E';  xchr[70] = 'F';  xchr[71] = 'G';
91     xchr[72] = 'H';  xchr[73] = 'I';  xchr[74] = 'J';  xchr[75] = 'K';
92     xchr[76] = 'L';  xchr[77] = 'M';  xchr[78] = 'N';  xchr[79] = 'O';
93     xchr[80] = 'P';  xchr[81] = 'Q';  xchr[82] = 'R';  xchr[83] = 'S';
94     xchr[84] = 'T';  xchr[85] = 'U';  xchr[86] = 'V';  xchr[87] = 'W';
95     xchr[88] = 'X';  xchr[89] = 'Y';  xchr[90] = 'Z';  xchr[91] = '[';
96     xchr[92] = '\\'; xchr[93] = ']';  xchr[94] = '^';  xchr[95] = '_';
97     xchr[96] = '`';  xchr[97] = 'a';  xchr[98] = 'b';  xchr[99] = 'c';
98     xchr[100] = 'd'; xchr[101] = 'e'; xchr[102] = 'f'; xchr[103] = 'g';
99     xchr[104] = 'h'; xchr[105] = 'i'; xchr[106] = 'j'; xchr[107] = 'k';
100     xchr[108] = 'l'; xchr[109] = 'm'; xchr[110] = 'n'; xchr[111] = 'o';
101     xchr[112] = 'p'; xchr[113] = 'q'; xchr[114] = 'r'; xchr[115] = 's';
102     xchr[116] = 't'; xchr[117] = 'u'; xchr[118] = 'v'; xchr[119] = 'w';
103     xchr[120] = 'x'; xchr[121] = 'y'; xchr[122] = 'z'; xchr[123] = '{';
104     xchr[124] = '|'; xchr[125] = '}'; xchr[126] = '~';
105
106     for (i = 0; i <= 31; i++)
107       xchr[i] = chr(i);
108
109     for (i = 127; i <= 255; i++)
110       xchr[i]= chr(i);
111 #endif /* end of JOKE */
112   }
113 /* end of plain ASCII case (otherwise have read in xchr vector before) */
114 /* Fill in background of `delete' for inverse mapping                  */
115   for (i = 0; i <= 255; i++)
116     xord[chr(i)] = 127;
117 #ifdef JOKE
118   for (i = 128; i <= 255 ; i++)
119     xord[xchr[i]] = i;
120
121   for (i = 0; i <= 126; i++)
122     xord[xchr[i]] = i;
123 #endif
124   
125 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
126 /* Now invert the xchr mapping to get xord mapping */
127   for (i = 0; i <= 255; i++)
128     xord[xchr[i]] = (char) i;
129
130   xord[127] = 127; /* hmm, a fixed point ? why ? */
131
132   flag = 0; /* 93/Dec/28 - bkph */
133
134   if (trace_flag != 0)
135   {
136 /*  entries in xord / xchr */
137     for (k = 0; k < 256; k++)
138       if (xord[k] != k)
139       {
140         flag = 1;
141         break;
142       }
143 /* 127 here means mapping undefined */
144     if (flag)
145     {
146       show_line("Inverted mapping xord[] pairs:\n", 0);
147
148       for (k = 0; k < 256; k++)
149       {
150 /*  entries in xord / xchr */
151         if (xord[k] != 127)
152         {
153           sprintf(log_line, "%d => %d\n", k, xord[k]);
154           show_line(log_line, 0);
155         }
156       }
157     }
158   }
159 /* may now set in local.c bkph */
160   if (interaction < 0)
161     interaction = error_stop_mode;
162
163   deletions_allowed = true;
164   set_box_allowed = true;
165   error_count = 0;
166   help_ptr = 0;
167   use_err_help = false;
168   interrupt = 0;
169   OK_to_interrupt = true;
170 /* darn, need to know mem_top, mem_max etc for the following ... */
171 #ifdef DEBUG
172   was_mem_end = mem_min;
173 /*  was_lo_max = mem_min; */
174   was_lo_max = mem_bot;
175 /*  was_hi_min = mem_max; */
176   was_hi_min = mem_top;
177   panicking = false;
178 #endif /* DEBUG */
179   nest_ptr = 0;
180   max_nest_stack = 0;
181   mode = 1;
182   head = contrib_head;
183   tail = contrib_head;
184   cur_list.aux_field.cint = ignore_depth;
185   mode_line = 0;
186   prev_graf = 0;
187   shown_mode = 0;
188   page_contents = 0;
189   page_tail = page_head;
190 #ifdef ALLOCATEMAIN
191   if (is_initex) /* in iniTeX we did already allocate mem [] */
192 #endif
193     mem[page_head].hh.v.RH = 0;
194 /*  last_glue = 262143L;  */ /* NO! */
195   last_glue = empty_flag;
196   last_penalty = 0;
197   last_kern = 0;
198   page_so_far[7] = 0;
199   page_max_depth = 0;
200
201   for (k = int_base; k <= eqtb_size; k++)
202     xeq_level[k] = level_one;
203
204   no_new_control_sequence = true;
205   hash[hash_base].v.LH = 0; /* next(hash_base):= 0 */
206   hash[hash_base].v.RH = 0; /* text(hash_base):= 0 */
207 /* 514 + hash_size + 266 = hashbase + hashsize + 10 + font_max  */
208 /* for k <- hashbase+1 to undefined_control_sequence - 1 do ... p.257 */
209   for (k = hash_base + 1; k <= undefined_control_sequence - 1; k++)
210     hash[k] = hash[hash_base];
211
212   save_ptr = 0;
213   cur_level = 1;
214   cur_group = 0;
215   cur_boundary = 0;
216   max_save_stack = 0;
217   mag_set = 0;
218   cur_mark[0] = 0;
219   cur_mark[1] = 0;
220   cur_mark[2] = 0;
221   cur_mark[3] = 0;
222   cur_mark[4] = 0;
223   cur_val = 0;
224   cur_val_level = 0;
225   radix = 0;
226   cur_order = 0;
227
228   for (k = 0; k <= 16; k++)
229     read_open[k] = 2;
230
231   cond_ptr = 0;
232   if_limit = 0;
233   cur_if = 0;
234   if_line = 0;
235
236   for (k = 0; k <= font_max; k++)
237     font_used[k] = false;
238
239   null_character.b0 = 0;
240   null_character.b1 = 0;
241   null_character.b2 = 0;
242   null_character.b3 = 0;
243   total_pages = 0;
244   max_v = 0;
245   max_h = 0;
246   max_push = 0;
247   last_bop = -1;
248   doing_leaders = false;
249   dead_cycles = 0;
250   cur_s = -1;
251   half_buf = dvi_buf_size / 2;
252   dvi_limit = dvi_buf_size;
253   dvi_ptr = 0;
254   dvi_offset = 0;
255   dvi_gone = 0;
256   down_ptr = 0;
257   right_ptr = 0;
258   adjust_tail = 0;
259   last_badness = 0;
260   pack_begin_line = 0;
261   empty_field.v.RH = 0;
262   empty_field.v.LH = 0;
263   null_delimiter.b0 = 0;
264   null_delimiter.b1 = 0;
265   null_delimiter.b2 = 0;
266   null_delimiter.b3 = 0;
267   align_ptr = 0;
268   cur_align = 0;
269   cur_span = 0;
270   cur_loop = 0;
271   cur_head = 0;
272   cur_tail = 0;
273 /*  *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
274 #ifndef ALLOCATEHYPHEN
275   for (z = 0; z <= hyphen_prime; z++)
276   {
277     hyph_word[z]= 0;
278     hyph_list[z]= 0;
279   }
280 #endif
281   hyph_count = 0;
282   output_active = false;
283   insert_penalties = 0;
284   ligature_present = false;
285   cancel_boundary = false;
286   lft_hit = false;
287   rt_hit = false;
288   ins_disc = false;
289   after_token = 0;
290   long_help_seen = false;
291   format_ident = 0;
292
293   for (k = 0; k <= 17; k++)
294     write_open[k] = false;
295
296   edit_name_start = 0;
297 #ifdef INITEX
298 /* initex stuff split off for convenience of optimization adjustments */
299   if (is_initex)
300   {
301     do_initex();
302   }
303 #else
304 /* trap the -i on command line situation if INITEX was NOT defined */
305   if (is_initex)
306   {
307     show_line("Sorry, somebody forgot to make an INITEX!\n", 1);
308   }
309 #endif /* not INITEX */
310 }
311
312 /* do the part of initialize() that requires mem_top, mem_max or mem[] */
313 /* do this part after allocating main memory */
314
315 #ifdef ALLOCATEMAIN
316 void initialize_aux (void)
317 {
318 #ifdef DEBUG
319   was_mem_end = mem_min;
320 /*  was_lo_max = mem_min; */
321   was_lo_max = mem_bot;
322 /*  was_hi_min = mem_max; */
323   was_hi_min = mem_top;
324   panicking = false;
325 #endif /* DEBUG */
326 /*  nest_ptr = 0; */
327 /*  max_nest_stack = 0; */
328   mode = 1;
329   head = contrib_head;
330   tail = contrib_head;
331   cur_list.aux_field.cint = ignore_depth;
332   mode_line = 0;
333   prev_graf = 0;
334 /*  shown_mode = 0; */
335 /*  page_contents = 0; */
336   page_tail = page_head;
337   //mem[mem_top - 2].hh.v.RH = 0;
338   link(page_head) = 0;
339 }
340 #endif  // end of ifdef ALLOCATEMAIN
341 /* sec 0815 */
342 void line_break_ (integer final_widow_penalty)
343 {
344   bool auto_breaking;
345   halfword prevp;
346   halfword q, r, s, prevs;
347   internal_font_number f;
348 /*  small_number j;  */
349   int j;                /* 95/Jan/7 */
350 /*  unsigned char c;  */
351   unsigned int c;           /* 95/Jan/7 */
352 /*  savedbadness = 0; */    /* 96/Feb/9 */
353
354   pack_begin_line = mode_line;
355   link(temp_head) = link(head);
356
357   if ((tail >= hi_mem_min))
358   {
359     tail_append(new_penalty(inf_penalty));
360   } 
361   else if (type(tail) != glue_node)
362   {
363     tail_append(new_penalty(inf_penalty));
364   }
365   else
366   {
367     type(tail) = penalty_node;
368     delete_glue_ref(glue_ptr(tail));
369     flush_node_list(leader_ptr(tail));
370     penalty(tail) = inf_penalty;
371   }
372
373   link(tail) = new_param_glue(par_fill_skip_code);
374   init_cur_lang = prev_graf % 65536L;
375   init_l_hyf = prev_graf / 4194304L; /* 2^22 */
376   init_r_hyf = (prev_graf / 65536L) % 64;
377   pop_nest();
378   no_shrink_error_yet = true;
379
380   if ((shrink_order(left_skip) != normal) && (shrink(left_skip) != 0))
381   {
382     left_skip = finite_shrink(left_skip);
383   }
384
385   if ((shrink_order(right_skip) != normal) && (shrink(right_skip) != 0))
386   {
387     right_skip = finite_shrink(right_skip);
388   }
389   q = left_skip;
390   r = right_skip;
391   background[1] = width(q) + width(r);
392   background[2] = 0;
393   background[3] = 0;
394   background[4] = 0;
395   background[5] = 0;
396   background[2 + stretch_order(q)] = stretch(q);
397   background[2 + stretch_order(r)] = background[2 + stretch_order(r)] + stretch(r);
398   background[6] = shrink(q) + shrink(r);
399
400   minimum_demerits = 1073741823L; /* 2^30 - 1 *//* 40000000 hex - 1 */
401   minimal_demerits[tight_fit] = 1073741823L;
402   minimal_demerits[decent_fit] = 1073741823L;
403   minimal_demerits[loose_fit] = 1073741823L;
404   minimal_demerits[very_loose_fit] = 1073741823L;
405
406   if (par_shape_ptr == 0)
407     if (hang_indent == 0)
408     {
409       last_special_line = 0;
410       second_width = hsize;
411       second_indent = 0;
412     }
413     else
414     {
415       last_special_line = abs(hang_after);
416
417       if (hang_after < 0)
418       {
419         first_width = hsize - abs(hang_indent);
420
421         if (hang_indent >= 0)
422           first_indent = hang_indent;
423         else
424           first_indent = 0;
425
426         second_width = hsize;
427         second_indent = 0;
428       }
429       else
430       {
431         first_width = hsize;
432         first_indent = 0;
433         second_width = hsize - abs(hang_indent);
434
435         if (hang_indent >= 0)
436           second_indent = hang_indent;
437         else
438           second_indent = 0;
439       }
440     }
441   else
442   {
443     last_special_line = info(par_shape_ptr) - 1;
444     second_width = mem[par_shape_ptr + 2 * (last_special_line + 1)].cint;
445     second_indent = mem[par_shape_ptr + 2 * last_special_line + 1].cint;
446   }
447
448   if (looseness == 0)
449     easyline = last_special_line;
450   else
451     easyline = empty_flag;
452
453   threshold = pretolerance;
454
455   if (threshold >= 0)
456   {
457 #ifdef STAT
458     if (tracing_paragraphs > 0)
459     {
460       begin_diagnostic();
461       print_nl("@firstpass");
462     }
463 #endif /* STAT */
464     second_pass = false;
465     final_pass = false;
466     first_pass_count++; /* 96 Feb 9 */
467   }
468   else
469   {
470     threshold = tolerance;
471     second_pass = true;
472     final_pass = (emergency_stretch <= 0);
473 #ifdef STAT
474     if (tracing_paragraphs > 0)
475       begin_diagnostic();
476 #endif /* STAT */
477   }
478
479   while (true)
480   {
481     if (threshold > inf_bad)
482       threshold = inf_bad;
483
484     if (second_pass)
485     {
486 #ifdef INITEX
487       if (is_initex)
488       {
489         if (trie_not_ready)
490           init_trie();
491       } /* bkph */
492 #endif /* INITEX */
493
494       cur_lang = init_cur_lang;
495       lhyf = init_l_hyf;
496       rhyf = init_r_hyf;
497     }
498
499     q = get_node(3);
500     type(q) = unhyphenated;
501     fitness(q) = decent_fit;
502     link(q) = active;
503     break_node(q) = 0;
504     line_number(q) = prev_graf + 1;
505     total_demerits(q) = 0;
506     link(active) = q;
507     active_width[1] = background[1];
508     active_width[2] = background[2];
509     active_width[3] = background[3];
510     active_width[4] = background[4];
511     active_width[5] = background[5];
512     active_width[6] = background[6];
513
514     passive = 0;
515     printed_node = temp_head;
516     pass_number = 0;
517     font_in_short_display = 0;
518
519     cur_p = link(temp_head);
520     auto_breaking = true;
521     prevp = cur_p;
522
523     while((cur_p != 0) && (link(active) != active))
524     {
525       if ((cur_p >= hi_mem_min))
526       {
527         prevp = cur_p;
528
529         do
530           {
531             f = font(cur_p);
532             active_width[1] = active_width[1] + char_width(f, char_info(f, character(cur_p)));
533             cur_p = link(cur_p);
534           }
535         while(!(!(cur_p >= hi_mem_min)));
536       }
537
538       switch(type(cur_p))
539       {
540         case hlist_node:
541         case vlist_node:
542         case rule_node:
543           active_width[1] = active_width[1] + width(cur_p);
544           break;
545         case whatsit_node:
546           if (subtype(cur_p) == language_node)
547           {
548             cur_lang = what_lang(cur_p);
549             lhyf = what_lhm(cur_p);
550             rhyf = what_rhm(cur_p);
551           }
552           break;
553         case glue_node:
554           {
555             if (auto_breaking)
556             {
557               if ((prevp >= hi_mem_min))
558                 try_break(0, unhyphenated);
559               else if ((mem[prevp].hh.b0 < 9))
560                 try_break(0, unhyphenated);
561               else if ((type(prevp) == kern_node) && (subtype(prevp) != explicit))
562                 try_break(0, unhyphenated);
563             }
564
565             if ((mem[glue_ptr(cur_p)].hh.b1 != 0) && (mem[glue_ptr(cur_p) + 3].cint != 0))
566             {
567               glue_ptr(cur_p) = finite_shrink(glue_ptr(cur_p));
568             }
569
570             q = glue_ptr(cur_p);
571             active_width[1] = active_width[1]+ width(q);
572             active_width[2 + stretch_order(q)] = active_width[2 + stretch_order(q)] + stretch(q);
573             active_width[6] = active_width[6] + shrink(q);
574
575             if (second_pass && auto_breaking)
576             {
577               prevs = cur_p;
578               s = link(prevs);
579
580               if (s != 0)
581               {
582                 while (true)
583                 {
584                   if ((s >= hi_mem_min))
585                   {
586                     c = character(s);
587                     hf = font(s);
588                   }
589                   else if (type(s) == ligature_node)
590                     if (lig_ptr(s) == 0)
591                       goto lab22;
592                     else
593                     {
594                       q = lig_ptr(s);
595                       c = character(q);
596                       hf = font(q);
597                     }
598                   else if ((type(s) == kern_node) && (subtype(s) == normal))
599                     goto lab22;
600                   else if (type(s) == whatsit_node)
601                   {
602                     if (subtype(s) == language_node)
603                     {
604                       cur_lang = what_lang(s);
605                       lhyf = what_lhm(s);
606                       rhyf = what_rhm(s);
607                     }
608                     goto lab22;
609                   }
610                   else
611                     goto lab31;
612
613                   if (lc_code(c) != 0)
614                     if ((lc_code(c) == (halfword) c) || (uc_hyph > 0)) /* fixed signed tyoe */
615                       goto lab32;
616                     else
617                       goto lab31;
618 lab22:
619                   prevs = s;
620                   s = link(prevs);
621                 }
622 lab32:
623                 hyf_char = hyphen_char[hf];
624
625                 if (hyf_char < 0)
626                   goto lab31; 
627
628                 if (hyf_char > 255)
629                   goto lab31; /* ? */
630
631                 ha = prevs;
632
633                 if (lhyf + rhyf > 63)
634                   goto lab31;
635
636                 hn = 0;
637
638                 while (true)
639                 {
640                   if ((s >= hi_mem_min))
641                   {
642                     if (font(s) != hf)
643                       goto lab33;
644
645                     hyfbchar = character(s);
646
647                     c = hyfbchar;     /*  unsigned char c;  */
648
649                     if (lc_code(c) == 0)
650                       goto lab33;
651
652                     if (hn == 63)
653                       goto lab33;
654
655                     hb = s;
656                     incr(hn);
657                     hu[hn] = c;
658                     hc[hn]= lc_code(c);
659                     hyfbchar = non_char;
660                   }
661                   else if (type(s) == ligature_node)
662                   {
663                     if (font(lig_char(s)) != hf)
664                       goto lab33;
665
666                     j = hn;
667                     q = lig_ptr(s);
668
669                     if (q != 0) /* 94/Mar/23 BUG FIX */
670                       hyfbchar = character(q);
671
672                     while (q != 0) /* 94/Mar/23 BUG FIX */
673                     {
674                       c = character(q);
675
676                       if (lc_code(c) == 0)
677                         goto lab33;
678
679                       if (j == 63)
680                         goto lab33;
681
682                       incr(j);
683                       hu[j] = c;
684                       hc[j] = lc_code(c);
685                       q = link(q);
686                     }
687
688                     hb = s;
689                     hn = j;
690
691                     if (odd(subtype(s)))
692                       hyfbchar = font_bchar[hf];
693                     else
694                       hyfbchar = non_char;
695                   }
696                   else if ((type(s) == kern_node) && (subtype(s) == normal))
697                   {
698                     hb = s;
699                     hyfbchar = font_bchar[hf];
700                   }
701                   else
702                     goto lab33;
703
704                   s = link(s);
705                 }
706 lab33:;
707                 if (hn < lhyf + rhyf)
708                   goto lab31;
709
710                 while (true)
711                 {
712                   if (!((s >= hi_mem_min)))
713                     switch(type(s))
714                     {
715                       case ligature_node:
716                         break;
717                       case kern_node:
718                         if (subtype(s) != normal)
719                           goto lab34;
720                         break;
721                       case whatsit_node:
722                       case glue_node:
723                       case penalty_node:
724                       case ins_node:
725                       case adjust_node:
726                       case mark_node:
727                         goto lab34;
728                         break;
729                       default:
730                         goto lab31;
731                         break;
732                     }
733                   s = link(s);
734                 }
735 lab34:;
736                 hyphenate();
737               }
738 lab31:;
739             }
740           }
741           break;
742         case kern_node:
743           if (subtype(cur_p) == explicit)
744           {
745             if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
746               if (type(link(cur_p)) == glue_node)
747                 try_break(0, unhyphenated);
748
749             active_width[1] = active_width[1] + width(cur_p);
750           }
751           else
752             active_width[1] = active_width[1] + width(cur_p);
753           break;
754         case ligature_node:
755           {
756             f = font(lig_char(cur_p));
757             active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(cur_p))));
758           }
759           break;
760         case disc_node:
761           {
762             s = pre_break(cur_p);
763             disc_width = 0;
764
765             if (s == 0)
766               try_break(ex_hyphen_penalty, hyphenated);
767             else
768             {
769               do
770               {
771                 if ((s >= hi_mem_min))
772                 {
773                   f = font(s);
774                   disc_width = disc_width + char_width(f, char_info(f, character(s)));
775                 }
776                 else switch(type(s))
777                 {
778                   case ligature_node:
779                     {
780                       f = font(lig_char(s));
781                       disc_width = disc_width + font_info[width_base[f] + font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0].cint;
782                     }
783                     break;
784                   case hlist_node:
785                   case vlist_node:
786                   case rule_node:
787                   case kern_node:
788                     disc_width = disc_width + width(s);
789                     break;
790                   default:
791                     {
792                       confusion("disc3");
793                       return;       // abort_flag set
794                     }
795                     break;
796                 }
797                 s = link(s);
798               }
799               while(!(s == 0));
800
801               active_width[1] = active_width[1] + disc_width;
802               try_break(hyphen_penalty, hyphenated);
803               active_width[1] = active_width[1] - disc_width;
804             }
805             r = replace_count(cur_p);
806             s = link(cur_p);
807
808             while (r > 0)
809             {
810               if ((s >= hi_mem_min))
811               {
812                 f = font(s);
813                 active_width[1] = active_width[1] + char_width(f, char_info(f, character(s)));
814               }
815               else switch(type(s))
816               {
817                 case ligature_node:
818                   {
819                     f = font(lig_char(s));
820                     active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(s))));
821                   }
822                   break;
823                 case hlist_node:
824                 case vlist_node:
825                 case rule_node:
826                 case kern_node:
827                   active_width[1] = active_width[1] + width(s);
828                   break;
829                 default:
830                   {
831                     confusion("disc4");
832                     return;       // abort_flag set
833                   }
834                   break;
835               }
836               decr(r);
837               s = link(s);
838             }
839             prevp = cur_p;
840             cur_p = s;
841             goto lab35;
842           }
843           break;
844         case math_node:
845           {
846             auto_breaking = (subtype(cur_p) == 1);
847             {
848               if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
849                 if (type(link(cur_p)) == glue_node)
850                   try_break(0, unhyphenated);
851
852               active_width[1] = active_width[1] + width(cur_p);
853             }
854           }
855           break;
856         case penalty_node:
857           try_break(penalty(cur_p), unhyphenated);
858           break;
859         case mark_node:
860         case ins_node:
861         case adjust_node:
862           break;
863         default:
864           {
865             confusion("paragraph");
866             return;       // abort_flag set
867           }
868           break;
869       }
870       prevp = cur_p;
871       cur_p = link(cur_p);
872 lab35:;
873     }
874
875     if (cur_p == 0)
876     {
877       try_break(eject_penalty, hyphenated);
878
879       if (link(active) != active)
880       {
881         r = link(active);
882         fewest_demerits = 1073741823L; /* 2^30 - 1 */
883
884         do
885         {
886           if (type(r) != 2)
887             if (total_demerits(r) < fewest_demerits)
888             {
889               fewest_demerits = total_demerits(r);
890               best_bet = r;
891             }
892           r = link(r);
893         }
894         while (!(r == active));
895         best_line = line_number(best_bet);
896
897         if (looseness == 0)
898         {
899           goto lab30;           /* normal exit */
900         }
901
902         {
903           r = link(active);
904           actual_looseness = 0;
905           do
906           {
907             if (type(r) != 2)
908             {
909               line_diff = toint(line_number(r)) - toint(best_line);
910
911               if (((line_diff < actual_looseness) && (looseness <= line_diff)) ||
912                   ((line_diff > actual_looseness) && (looseness >= line_diff)))
913               {
914                 best_bet = r;
915                 actual_looseness = line_diff;
916                 fewest_demerits = total_demerits(r);
917               }
918               else if ((line_diff == actual_looseness) && (total_demerits(r) < fewest_demerits))
919               {
920                 best_bet = r;
921                 fewest_demerits = total_demerits(r);
922               }
923             }
924             r = link(r);
925           }
926           while (!(r == active));
927           best_line = line_number(best_bet);
928         }
929
930         if ((actual_looseness == looseness) || final_pass)
931         {
932           goto lab30;
933         }
934       }
935     }
936
937     q = link(active);
938
939     while (q != active)
940     {
941       cur_p = link(q);
942
943       if (type(q) == 2)
944         free_node(q, 7);
945       else
946         free_node(q, 3);
947
948       q = cur_p;
949     }
950
951     q = passive;
952
953     while (q != 0)
954     {
955       cur_p = link(q);
956       free_node(q, 2);
957       q = cur_p;
958     }
959
960     if (! second_pass)
961     {
962 #ifdef STAT
963       if (tracing_paragraphs > 0)
964         print_nl("@secondpass");
965 #endif /* STAT */
966       threshold = tolerance;
967       second_pass = true;
968       second_pass_count++;          /* 96 Feb 9 */
969       final_pass = (emergency_stretch <= 0);
970     }
971     else
972     {
973 #ifdef STAT
974       if (tracing_paragraphs > 0)
975         print_nl("@emergencypass");
976 #endif /* STAT */
977 /*     can only get here is \emergencystretch has been set positive */
978       background[2] = background[2] + emergency_stretch;
979       final_pass = true;
980       final_pass_count++;         /* 96 Feb 9 */
981     } /* end of if second_pass */
982   } /* end of while(true)do */
983 /* cannot drop through from above loop */
984 lab30:                /* common exit point */
985   if (best_line == 2)
986     single_line++;
987 #ifdef STAT
988   if (tracing_paragraphs > 0)
989   {
990     end_diagnostic(true);
991     normalize_selector();
992   }
993 #endif /* STAT */
994   post_line_break(final_widow_penalty);
995   q = link(active);
996
997   while (q != active)
998   {
999     cur_p = link(q);
1000
1001     if (type(q) == 2)
1002       free_node(q, 7);
1003     else
1004       free_node(q, 3);
1005
1006     q = cur_p;
1007   }
1008
1009   q = passive;
1010
1011   while (q != 0) /* while q<>null do l.16979 */
1012   {
1013     cur_p = link(q);
1014     free_node(q, 2);
1015     q = cur_p;
1016   }
1017
1018   pack_begin_line = 0;
1019 }
1020 /* sec 1211 */
1021 void prefixed_command (void)
1022 {
1023   small_number a;
1024   internal_font_number f;
1025   halfword j;
1026   font_index k;
1027   halfword p, q;
1028   integer n;
1029   bool e;
1030
1031   a = 0;
1032
1033   while (cur_cmd == prefix)
1034   {
1035     if (!odd(a / cur_chr))
1036       a = a + cur_chr;      /*   small_number a;  */
1037
1038     do
1039       {
1040         get_x_token();
1041       }
1042     while(!((cur_cmd != spacer) && (cur_cmd != relax)));
1043
1044     if (cur_cmd <= max_non_prefixed_command)
1045     {
1046       print_err("You can't use a prefix with `");
1047       print_cmd_chr(cur_cmd, cur_chr);
1048       print_char('\'');
1049       help1("I'll pretend you didn't say \\long or \\outer or \\global.");
1050       back_error();
1051       return;
1052     }
1053   }
1054
1055   if ((cur_cmd != def) && (a % 4 != 0))
1056   {
1057     print_err("You can't use `");
1058     print_esc("long");
1059     print_string("' or `");
1060     print_esc("outer");
1061     print_string("' with `");
1062     print_cmd_chr(cur_cmd, cur_chr); 
1063     print_char('\'');
1064     help1("I'll pretend you didn't say \\long or \\outer here.");
1065     error();
1066   }
1067
1068   if (global_defs != 0)
1069     if (global_defs < 0)
1070     {
1071       if ((a >= 4))
1072         a = a - 4;
1073     }
1074     else
1075     {
1076       if (!(a >= 4))
1077         a = a + 4;
1078     }
1079
1080   switch (cur_cmd)
1081   {
1082     case set_font:
1083       if ((a >= 4))
1084         geq_define(cur_font_loc, data, cur_chr);
1085       else
1086         eq_define(cur_font_loc, data, cur_chr);
1087       break;
1088     case def:
1089       {
1090         if (odd(cur_chr) && !(a >= 4) && (global_defs >= 0))
1091           a = a + 4;
1092
1093         e = (cur_chr >= 2);
1094         get_r_token();
1095         p = cur_cs;
1096         q = scan_toks(true, e);
1097
1098         if ((a >= 4))
1099           geq_define(p, call + (a % 4), def_ref);
1100         else
1101           eq_define(p, call + (a % 4), def_ref);
1102       }
1103       break;
1104     case let:
1105       {
1106         n = cur_chr;
1107         get_r_token();
1108         p = cur_cs;
1109
1110         if (n == 0)
1111         {
1112           do
1113             {
1114               get_token();
1115             }
1116           while (!(cur_cmd != spacer));
1117
1118           if (cur_tok == other_token + '=')
1119           {
1120             get_token();
1121
1122             if (cur_cmd == spacer)
1123               get_token();
1124           }
1125         }
1126         else
1127         {
1128           get_token();
1129           q = cur_tok;
1130           get_token();
1131           back_input();
1132           cur_tok = q;
1133           back_input();
1134         }
1135
1136         if (cur_cmd >= call)
1137           incr(mem[cur_chr].hh.v.LH);
1138
1139         if ((a >= 4))
1140           geq_define(p, cur_cmd, cur_chr);
1141         else
1142           eq_define(p, cur_cmd, cur_chr);
1143       }
1144       break;
1145     case shorthand_def:
1146       {
1147         n = cur_chr;
1148         get_r_token();
1149         p = cur_cs;
1150
1151         if ((a >= 4))
1152           geq_define(p, relax, 256);
1153         else
1154           eq_define(p, relax, 256);
1155
1156         scan_optional_equals();
1157
1158         switch (n)
1159         {
1160           case char_def_code:
1161             {
1162               scan_char_num();
1163
1164               if ((a >= 4))
1165                 geq_define(p, char_given, cur_val);
1166               else
1167                 eq_define(p, char_given, cur_val);
1168             }
1169             break;
1170           case math_char_def_code:
1171             {
1172               scan_fifteen_bit_int();
1173
1174               if ((a >= 4))
1175                 geq_define(p, math_given, cur_val);
1176               else
1177                 eq_define(p, math_given, cur_val);
1178             }
1179             break;
1180           default:
1181             {
1182               scan_eight_bit_int();
1183
1184               switch (n)
1185               {
1186                 case count_def_code:
1187                   if ((a >= 4))
1188                     geq_define(p, assign_int, count_base + cur_val);
1189                   else
1190                     eq_define(p, assign_int, count_base + cur_val);
1191                   break;
1192                 case dimen_def_code:
1193                   if ((a >= 4))
1194                     geq_define(p, assign_dimen, scaled_base + cur_val);
1195                   else
1196                     eq_define(p, assign_dimen, scaled_base + cur_val);
1197                   break;
1198                 case skip_def_code:
1199                   if ((a >= 4)) 
1200                     geq_define(p, assign_glue, skip_base + cur_val);
1201                   else
1202                     eq_define(p, assign_glue, skip_base + cur_val);
1203                   break;
1204                 case mu_skip_def_code:
1205                   if ((a >= 4))
1206                     geq_define(p, assign_mu_glue, mu_skip_base + cur_val);
1207                   else
1208                     eq_define(p, assign_mu_glue, mu_skip_base + cur_val);
1209                   break;
1210                 case toks_def_code:
1211                   if ((a >= 4))
1212                     geq_define(p, assign_toks, toks_base + cur_val);
1213                   else
1214                     eq_define(p, assign_toks, toks_base + cur_val);
1215                   break;
1216               }
1217             }
1218             break;
1219         }
1220       }
1221       break;
1222     case read_to_cs:
1223       {
1224         scan_int();
1225         n = cur_val;
1226
1227         if (! scan_keyword("to"))
1228         {
1229           print_err("Missing `to' inserted");
1230           help2("You should have said `\\read<number> to \\cs'.",
1231               "I'm going to look for the \\cs now.");
1232           error();
1233         }
1234
1235         get_r_token();
1236         p = cur_cs;
1237         read_toks(n, p);
1238
1239         if ((a >= 4))
1240           geq_define(p, call, cur_val);
1241         else
1242           eq_define(p, call, cur_val);
1243       }
1244       break;
1245     case toks_register:
1246     case assign_toks:
1247       {
1248         q = cur_cs;
1249
1250         if (cur_cmd == toks_register)
1251         {
1252           scan_eight_bit_int();
1253           p = toks_base + cur_val;
1254         }
1255         else
1256           p = cur_chr;
1257
1258         scan_optional_equals();
1259
1260         do
1261           {
1262             get_x_token();
1263           }
1264         while(!((cur_cmd != spacer) && (cur_cmd != relax)));
1265
1266         if (cur_cmd != left_brace)
1267         {
1268           if (cur_cmd == toks_register)
1269           {
1270             scan_eight_bit_int();
1271             cur_cmd = assign_toks;
1272             cur_chr = toks_base + cur_val;
1273           }
1274
1275           if (cur_cmd == assign_toks)
1276           {
1277             q = equiv(cur_chr);
1278
1279             if (q == 0)
1280               if ((a >= 4))
1281                 geq_define(p, undefined_cs, 0);
1282               else
1283                 eq_define(p, undefined_cs, 0);
1284             else
1285             {
1286               incr(mem[q].hh.v.LH);
1287
1288               if ((a >= 4))
1289                 geq_define(p, call, q);
1290               else
1291                 eq_define(p, call, q);
1292             }
1293             goto lab30;
1294           }
1295         }
1296
1297         back_input();
1298         cur_cs = q;
1299         q = scan_toks(false, false);
1300
1301         if (link(def_ref) == 0)
1302         {
1303           if ((a >= 4))
1304             geq_define(p, undefined_cs, 0);
1305           else
1306             eq_define(p, undefined_cs, 0);
1307
1308           free_avail(def_ref);
1309         }
1310         else
1311         {
1312           if (p == output_routine_loc)
1313           {
1314             link(q) = get_avail();
1315             q = link(q);
1316             info(q) = right_brace_token + '}';
1317             q = get_avail();
1318             info(q) = left_brace_token + '{';
1319             link(q) = link(def_ref);
1320             link(def_ref) = q;
1321           }
1322
1323           if ((a >= 4))
1324             geq_define(p, call, def_ref);
1325           else
1326             eq_define(p, call, def_ref);
1327         }
1328       }
1329       break;
1330     case assign_int:
1331       {
1332         p = cur_chr;
1333         scan_optional_equals();
1334         scan_int();
1335
1336         if ((a >= 4))
1337           geq_word_define(p, cur_val);
1338         else
1339           eq_word_define(p, cur_val);
1340       }
1341       break;
1342     case assign_dimen:
1343       {
1344         p = cur_chr;
1345         scan_optional_equals();
1346         scan_dimen(false, false, false);
1347
1348         if ((a >= 4))
1349           geq_word_define(p, cur_val);
1350         else
1351           eq_word_define(p, cur_val);
1352       }
1353       break;
1354     case assign_glue:
1355     case assign_mu_glue:
1356       {
1357         p = cur_chr;
1358         n = cur_cmd;
1359         scan_optional_equals();
1360
1361         if (n == assign_mu_glue)
1362           scan_glue(mu_val);
1363         else
1364           scan_glue(glue_val);
1365
1366         trap_zero_glue();
1367
1368         if ((a >= 4))
1369           geq_define(p, glue_ref, cur_val);
1370         else
1371           eq_define(p, glue_ref, cur_val);
1372       }
1373       break;
1374     case def_code:
1375       {
1376         if (cur_chr == cat_code_base)
1377           n = max_char_code;
1378         else if (cur_chr == math_code_base)
1379           n = 32768L;                 /* 2^15 */
1380         else if (cur_chr == sf_code_base)
1381           n = 32767;                /* 2^15 - 1*/
1382         else if (cur_chr == del_code_base)
1383           n = 16777215L;              /* 2^24 - 1 */
1384         else
1385           n = 255;             /* 2^8 - 1 */
1386
1387         p = cur_chr;
1388         scan_char_num();
1389         p = p + cur_val;
1390         scan_optional_equals();
1391         scan_int();
1392
1393         if (((cur_val < 0) && (p < del_code_base)) ||(cur_val > n))
1394         {
1395           print_err("Invalid code(");
1396           print_int(cur_val);
1397
1398           if (p < del_code_base)
1399             print_string("), should be in the range 0..");
1400           else
1401             print_string("), should be at most ");
1402
1403           print_int(n);
1404           help1("I'm going to use 0 instead of that illegal code value.");
1405           error();
1406           cur_val = 0;
1407         }
1408
1409         if (p < math_code_base)
1410           if ((a >= 4))
1411             geq_define(p, data, cur_val);
1412           else
1413             eq_define(p, data, cur_val);
1414         else if (p < del_code_base)
1415           if ((a >= 4))
1416             geq_define(p, data, cur_val);
1417           else
1418             eq_define(p, data, cur_val);
1419         else 
1420           if ((a >= 4))
1421             geq_word_define(p, cur_val);
1422           else
1423             eq_word_define(p, cur_val);
1424       }
1425       break;
1426     case def_family:
1427       {
1428         p = cur_chr;
1429         scan_four_bit_int();
1430         p = p + cur_val;
1431         scan_optional_equals();
1432         scan_font_ident();
1433
1434         if ((a >= 4))
1435           geq_define(p, data, cur_val);
1436         else
1437           eq_define(p, data, cur_val);
1438       }
1439       break;
1440     case tex_register:
1441     case advance:
1442     case multiply:
1443     case divide:
1444       do_register_command(a);
1445       break;
1446     case set_box:
1447       {
1448         scan_eight_bit_int();
1449
1450         if ((a >= 4))
1451           n = 256 + cur_val;
1452         else
1453           n = cur_val;
1454
1455         scan_optional_equals();
1456
1457         if (set_box_allowed)
1458         {
1459           scan_box(box_flag + n);
1460         }
1461         else
1462         {
1463           print_err("Improper ");
1464           print_esc("setbox");
1465           help2("Sorry, \\setbox is not allowed after \\halign in a display,",
1466               "or between \\accent and an accented character.");
1467           error();
1468         }
1469       }
1470       break;
1471     case set_aux:
1472       alter_aux();
1473       break;
1474     case set_prev_graf:
1475       alter_prev_graf();
1476       break;
1477     case set_page_dimen:
1478       alter_page_so_far();
1479       break;
1480     case set_page_int:
1481       alter_integer();
1482       break;
1483     case set_box_dimen:
1484       alter_box_dimen();
1485       break;
1486     case set_shape:
1487       {
1488         scan_optional_equals();
1489         scan_int();
1490         n = cur_val;
1491
1492         if (n <= 0)
1493           p = 0;
1494         else
1495         {
1496           p = get_node(2 * n + 1);
1497           info(p) = n;
1498
1499           for (j = 1; j <= n; j++)
1500           {
1501             scan_dimen(false, false, false);
1502             mem[p + 2 * j - 1].cint = cur_val;
1503             scan_dimen(false, false, false);
1504             mem[p + 2 * j].cint = cur_val;
1505           }
1506         }
1507
1508         if ((a >= 4))
1509           geq_define(par_shape_loc, shape_ref, p);
1510         else
1511           eq_define(par_shape_loc, shape_ref, p);
1512       }
1513       break;
1514     case hyph_data:
1515       if (cur_chr == 1)
1516       {
1517 #ifdef INITEX
1518         if (is_initex)
1519         {
1520           new_patterns();
1521           goto lab30;
1522         }
1523 #endif /* INITEX */
1524         print_err("Patterns can be loaded only by INITEX");
1525         help_ptr = 0;
1526         error();
1527
1528         do
1529           {
1530             get_token();
1531           }
1532         while(!(cur_cmd == right_brace));
1533
1534         return;
1535       }
1536       else
1537       {
1538         new_hyph_exceptions();
1539         goto lab30;
1540       }
1541       break;
1542     case assign_font_dimen:
1543       {
1544         find_font_dimen(true);
1545         k = cur_val;
1546         scan_optional_equals();
1547         scan_dimen(false, false, false);
1548         font_info[k].cint = cur_val;
1549       }
1550       break;
1551     case assign_font_int:
1552       {
1553         n = cur_chr;
1554         scan_font_ident();
1555         f = cur_val;
1556         scan_optional_equals();
1557         scan_int();
1558
1559         if (n == 0)
1560           hyphen_char[f] = cur_val;
1561         else
1562           skew_char[f] = cur_val;
1563       }
1564       break;
1565     case def_font:
1566       new_font(a);
1567       break;
1568     case set_interaction:
1569       new_interaction();
1570       break;
1571     default:
1572       {
1573         confusion("prefix");
1574         return;       // abort_flag set
1575       }
1576       break;
1577   } /* end of cur_cmd switch */
1578
1579 lab30:
1580   if (after_token != 0)
1581   {
1582     cur_tok = after_token;
1583     back_input();
1584     after_token = 0;
1585   }
1586 }
1587
1588 /* added following explanations 96/Jan/10 */
1589
1590 void bad_formator_pool (char *name, char *defaultname, char *envvar)
1591 {
1592   if (name == NULL)
1593     name = defaultname;
1594
1595   sprintf(log_line, "(Perhaps %s is for an older version of TeX)\n", name);
1596   show_line(log_line, 0);
1597   name_of_file[name_length + 1] = '\0';
1598   sprintf(log_line, "(Alternatively, %s may have been corrupted)\n", name_of_file + 1);
1599   show_line(log_line, 0);
1600   name_of_file[name_length + 1] = ' ';
1601   sprintf(log_line, "(Perhaps your %s environment variable is not set correctly)\n", envvar);
1602   show_line(log_line, 0);
1603   {
1604     char *s;            /* extra info 99/April/28 */
1605
1606     if ((s = grabenv(envvar)) != NULL)
1607     {
1608       sprintf(log_line, "(%s=%s)\n", envvar, s);
1609       show_line(log_line, 0);
1610     }
1611     else
1612     {
1613       sprintf(log_line, "%s environment variable not set\n", envvar);
1614       show_line(log_line, 0);
1615     }
1616   }
1617 #ifndef _WINDOWS
1618   fflush(stdout);
1619 #endif
1620 }
1621 /* sec 1303 */
1622 bool load_fmt_file (void)
1623 {
1624   register bool Result;
1625   integer j, k;
1626   halfword p, q;
1627   integer x;
1628
1629   undump_int(x);
1630
1631   if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
1632     goto lab6666;
1633
1634   undump_int(x); /* mem_bot */
1635
1636   if (x != mem_bot)
1637     goto lab6666;
1638
1639   undump_int(x); /* mem_top */
1640
1641 #ifdef ALLOCATEMAIN
1642 /* we already read this once earlier to grab mem_top */
1643   if (trace_flag)
1644   {
1645     sprintf(log_line, "Read from fmt file mem_top = %d TeX words\n", x);
1646     show_line(log_line, 0);
1647   }
1648
1649   mem = allocate_main_memory(x); /* allocate main memory at this point */
1650
1651   if (mem == NULL)
1652     exit(1);                     /* redundant sanity test ! */
1653
1654   initialize_aux();              /* do `mem' part of initialize */
1655 /*  mem = zmem; */               /* update pointer to main memory */
1656 #endif
1657
1658   if (x != mem_top)
1659     goto lab6666;
1660
1661   undump_int(x); /* eqtbsize */
1662
1663   if (x != (eqtb_size))
1664     goto lab6666;
1665
1666   undump_int(x); /* hash_prime */
1667
1668   if (x != hash_prime)
1669     goto lab6666;
1670
1671   undump_int(x); /* hyphen_prime */
1672
1673 #ifdef ALLOCATEHYPHEN
1674 /* allow format files dumped with arbitrary (prime) hyphenation exceptions */
1675   realloc_hyphen(x); /* reset_hyphen(); */
1676   hyphen_prime = x;
1677 #endif
1678
1679   if (x != hyphen_prime)
1680     goto lab6666;
1681
1682   {
1683     undump_int(x); /* pool_size */
1684
1685     if (x < 0)
1686       goto lab6666; 
1687
1688 #ifdef ALLOCATESTRING
1689     if (x > current_pool_size)
1690     {
1691       if (trace_flag)
1692       {
1693         sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size);
1694         show_line(log_line, 0);
1695       }
1696       str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
1697     }
1698     if (x > current_pool_size)   /* 94/Jan/24 */
1699 #else
1700     if (x > pool_size)
1701 #endif
1702     {
1703       sprintf(log_line, "%s%s\n",  "---! Must increase the ", "string pool size");
1704       show_line(log_line, 0);
1705       goto lab6666;
1706     }
1707     else
1708       pool_ptr = x;
1709   }
1710   {
1711     undump_int(x);  /* max_strings */
1712     if (x < 0)
1713       goto lab6666;
1714
1715 #ifdef ALLOCATESTRING
1716     if (x > current_max_strings)
1717     {
1718       if (trace_flag)
1719       {
1720         sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings);
1721         show_line(log_line, 0);
1722       }
1723       str_start = realloc_str_start(x - current_max_strings + increment_max_strings);
1724     }
1725     if (x > current_max_strings) /* 94/Jan/24 */
1726 #else
1727     if (x > max_strings)
1728 #endif
1729     {
1730       sprintf(log_line,  "%s%s\n",  "---! Must increase the ", "max strings");
1731       show_line(log_line, 0);
1732       goto lab6666;
1733     }
1734     else
1735       str_ptr = x;
1736   }
1737
1738   if (undumpthings(str_start[0], str_ptr + 1)) /* undump string ptrs */
1739     return -1;
1740   if (undumpthings(str_pool[0], pool_ptr)) /*  undump string pool */
1741     return -1;
1742
1743   init_str_ptr = str_ptr;
1744   init_pool_ptr = pool_ptr;
1745 /*  undump the dynamic memory - paragraph 1312 in the book */
1746   {
1747     undump_int(x);
1748     if ((x < lo_mem_stat_max + 1000) || (x > hi_mem_stat_min - 1))
1749       goto lab6666;
1750     else
1751       lo_mem_max = x;
1752   }
1753   {
1754     undump_int(x);
1755     if ((x < lo_mem_stat_max + 1) || (x > lo_mem_max))
1756       goto lab6666;
1757     else
1758       rover = x;
1759   }
1760   p = 0;                  /* mem_bot */
1761   q = rover;
1762   do {
1763     if (undumpthings(mem[p], q + 2 - p))
1764       return -1;
1765
1766     p = q + node_size(q);
1767
1768     if ((p > lo_mem_max) || ((q >= rlink(q)) && (rlink(q) != rover)))
1769       goto lab6666;
1770
1771     q = rlink(q);
1772   } while (!(q == rover));
1773
1774   if (undumpthings(mem[p], lo_mem_max + 1 - p))
1775     return -1;
1776
1777   if (mem_min < mem_bot - 2)          /*  ? splice in block below */
1778   {
1779 /*  or call add_variable_space(mem_bot - (mem_min + 1)) */
1780     if (trace_flag)
1781       show_line("Splicing in mem_min space in undump!\n", 0);
1782
1783     p = llink(rover);
1784     q = mem_min + 1;
1785     link(mem_min) = 0;       /* null */
1786     info(mem_min) = 0;       /* null */
1787     rlink(p) = q;
1788     llink(rover) = q;
1789     rlink(q) = rover;
1790     llink(q) = p;
1791     link(q) = empty_flag;
1792     node_size(q) = mem_bot - q;     /* ? size of block  */
1793   }
1794   {
1795     undump_int(x);
1796     if ((x < lo_mem_max + 1) || (x > hi_mem_stat_min))
1797       goto lab6666;
1798     else
1799       hi_mem_min = x;
1800   }
1801   {
1802     undump_int(x);
1803
1804     if ((x < mem_bot) || (x > mem_top))
1805       goto lab6666;
1806     else
1807       avail = x;
1808   }
1809   mem_end = mem_top;
1810
1811   if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
1812     return -1;
1813
1814   undump_int(var_used);
1815   undump_int(dyn_used);
1816
1817   k = active_base;
1818   do {
1819     undump_int(x);
1820     if ((x < 1) || (k + x > (eqtb_size + 1)))
1821       goto lab6666;
1822
1823     if (undumpthings(eqtb[k], x))
1824       return -1;
1825
1826     k = k + x;
1827     undump_int(x);
1828
1829     if ((x < 0) || (k + x > (eqtb_size + 1)))
1830       goto lab6666;
1831
1832     for (j = k; j <= k + x - 1; j++)
1833     {
1834       eqtb[j] = eqtb[k - 1];
1835     }
1836     k = k + x;
1837   } while(!(k > (eqtb_size)));
1838   {
1839     undump_int(x);
1840     if ((x < hash_base) || (x > (frozen_control_sequence)))  /*96/Jan/10*/
1841       goto lab6666;
1842     else
1843       par_loc = x;
1844   }
1845   par_token = 4095 + par_loc;
1846   {
1847     undump_int(x);
1848     if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
1849       goto lab6666;
1850     else
1851       write_loc = x;
1852   }
1853   {
1854     undump_int(x);
1855     if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
1856       goto lab6666;
1857     else
1858       hash_used = x;
1859   }
1860   p = hash_base - 1;
1861   do {
1862     {
1863       undump_int(x);
1864       if ((x < p + 1) || (x > hash_used))
1865         goto lab6666;
1866       else
1867         p = x;
1868     }
1869     undump_hh(hash[p]);
1870   } while (!(p == hash_used));
1871
1872   if (undumpthings(hash[hash_used + 1], (undefined_control_sequence - 1) - hash_used))
1873     return -1;
1874
1875   undump_int(cs_count);     /* cs_count */
1876   if (trace_flag)
1877   {
1878     sprintf(log_line, "itex undump cs_count %d ", cs_count); /* debugging */
1879     show_line(log_line, 0);
1880   }
1881   {
1882     undump_int(x);        /* font_mem_size */
1883     if (x < 7)
1884       goto lab6666;
1885 #ifdef ALLOCATEFONT
1886     if (trace_flag)
1887     {
1888       sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
1889       show_line(log_line, 0);
1890     }
1891     if (x > current_font_mem_size) /* 93/Nov/28 dynamic allocate font_info */
1892     {
1893       if (trace_flag)
1894       {
1895         sprintf(log_line, "Undump realloc font_info (%d > %d)\n", x, current_font_mem_size);
1896         show_line(log_line, 0);
1897       }
1898       font_info = realloc_font_info (x - current_font_mem_size + increment_font_mem_size);
1899     }
1900     if (x > current_font_mem_size)  /* in case allocation failed 94/Jan/24 */
1901 #else
1902     if (x > font_mem_size)
1903 #endif
1904     {
1905       sprintf(log_line, "%s%s\n",  "---! Must increase the ", "font mem size");
1906       show_line(log_line, 0);
1907       goto lab6666;
1908     }
1909     else
1910       fmem_ptr = x;
1911   }
1912   {
1913     if (undumpthings(font_info[0], fmem_ptr))
1914       return -1;
1915     {
1916       undump_int(x); /* font_max */
1917       if (x < 0)
1918         goto lab6666;
1919       if (x > font_max)
1920       {
1921         sprintf(log_line, "%s%s\n",  "---! Must increase the ", "font max"); 
1922         show_line(log_line, 0);
1923         goto lab6666;
1924       }
1925       else
1926         font_ptr = x;
1927     }
1928     frozenfontptr = font_ptr; /* remember number of fonts frozen into format */
1929     if (undumpthings(font_check[0], font_ptr + 1))
1930       return -1;
1931     if (undumpthings(font_size[0], font_ptr + 1))
1932       return -1;
1933     if (undumpthings(font_dsize[0], font_ptr + 1))
1934       return -1;
1935     if (undumpthings(font_params[0], font_ptr + 1))
1936       return -1;
1937     if (undumpthings(hyphen_char[0], font_ptr + 1))
1938       return -1;
1939     if (undumpthings(skew_char[0], font_ptr + 1))
1940       return -1;
1941     if (undumpthings(font_name[0], font_ptr + 1))
1942       return -1;
1943     if (undumpthings(font_area[0], font_ptr + 1))
1944       return -1;
1945     if (undumpthings(font_bc[0], font_ptr + 1))
1946       return -1;
1947     if (undumpthings(font_ec[0], font_ptr + 1))
1948       return -1;
1949     if (undumpthings(char_base[0], font_ptr + 1))
1950       return -1;
1951     if (undumpthings(width_base[0], font_ptr + 1))
1952       return -1;
1953     if (undumpthings(height_base[0], font_ptr + 1))
1954       return -1;
1955     if (undumpthings(depth_base[0], font_ptr + 1))
1956       return -1;
1957     if (undumpthings(italic_base[0], font_ptr + 1))
1958       return -1;
1959     if (undumpthings(lig_kern_base[0], font_ptr + 1))
1960       return -1;
1961     if (undumpthings(kern_base[0], font_ptr + 1))
1962       return -1;
1963     if (undumpthings(exten_base[0], font_ptr + 1))
1964       return -1;
1965     if (undumpthings(param_base[0], font_ptr + 1))
1966       return -1;
1967     if (undumpthings(font_glue[0], font_ptr + 1))
1968       return -1;
1969     if (undumpthings(bchar_label[0], font_ptr + 1))
1970       return -1;
1971     if (undumpthings(font_bchar[0], font_ptr + 1))
1972       return -1;
1973     if (undumpthings(font_false_bchar[0], font_ptr + 1))
1974       return -1;
1975   }
1976
1977 /* log not opened yet, so can't show fonts frozen into format */
1978 /* May be able to avoid the following since we switched to */
1979 /* non_address from font_mem_size to 0 96/Jan/15 ??? */
1980
1981 #ifdef ALLOCATEFONT
1982 /* deal with fmt files dumped with *different* font_mem_size 93/Nov/29 */
1983  {
1984    int count = 0, oldfont_mem_size = 0;
1985
1986    for (x = 0; x <= font_ptr; x++)
1987    {
1988      if (bchar_label[x] > oldfont_mem_size)
1989        oldfont_mem_size = bchar_label[x];
1990    }
1991
1992 /* somewhat arbitrary sanity check ... */
1993 /* if (oldfont_mem_size != font_mem_size && oldfont_mem_size > font_max) { */
1994    if (oldfont_mem_size != non_address && oldfont_mem_size > font_max) /* 96/Jan/16 */
1995    {
1996      for (x = 0; x <= font_ptr; x++)
1997      {
1998        if (bchar_label[x] == oldfont_mem_size)
1999        {
2000          /* bchar_label[x] = font_mem_size; */
2001          bchar_label[x] = non_address;  /* 96/Jan/16 */
2002          count++;
2003        }
2004      }
2005      if (trace_flag)
2006      {
2007        sprintf(log_line, "oldfont_mem_size is %d --- hit %d times. Using non_address %d\n",
2008            oldfont_mem_size, count, non_address);
2009        show_line(log_line, 0);
2010      }
2011    }
2012  }
2013 #endif
2014 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2015 /* undump(0)(hyph_size)(hyph_count); */
2016   {
2017     undump_int(x);
2018
2019     if ((x < 0) || (x > hyphen_prime))
2020       goto lab6666;
2021     else
2022       hyph_count = x;
2023   }
2024 /* undump hypenation exception tables p.1325 */
2025   for (k = 1; k <= hyph_count; k++)
2026   {
2027     {
2028       undump_int(x);
2029       if ((x < 0) || (x > hyphen_prime))
2030         goto lab6666;
2031       else
2032         j = x;
2033     }
2034     {
2035       undump_int(x);
2036       if ((x < 0) || (x > str_ptr))
2037         goto lab6666;
2038       else
2039         hyph_word[j] = x;
2040     }
2041     {
2042       undump_int(x);
2043       if ((x < 0) || (x > max_halfword)) /* mem_top ? no p.1325 */
2044         goto lab6666;
2045       else
2046         hyph_list[j] = x;
2047     }
2048   }
2049
2050 #ifdef ALLOCATEHYPHEN
2051 /* if user specified new hyphen prime - flush existing exception patterns ! */
2052 /* but, we can reclaim the string storage wasted ... */
2053   if (is_initex)
2054   {
2055     if (new_hyphen_prime != 0)
2056     {
2057       realloc_hyphen(new_hyphen_prime); /* reset_hyphen(); */
2058       hyphen_prime = new_hyphen_prime;
2059     }
2060   }
2061 #endif
2062
2063   {
2064     undump_int(x);
2065     if (x < 0)
2066       goto lab6666;
2067
2068 #ifdef ALLOCATETRIES
2069     if (!is_initex)
2070     {
2071       allocate_tries(x); /* allocate only as much as is needed */
2072 /* trie_size = x; */ /* ??? */
2073     }
2074 #endif
2075
2076     if (x > trie_size)
2077     {
2078       sprintf(log_line, "%s%s\n",  "---! Must increase the ", "trie size");
2079       show_line(log_line, 0);
2080       goto lab6666;
2081     }
2082     else
2083       j = x;
2084   }
2085 #ifdef INITEX
2086   if (is_initex) /* bkph */
2087     trie_max = j;
2088 #endif /* INITEX */
2089   if (undumpthings(trie_trl[0], j + 1))
2090     return -1;
2091   if (undumpthings(trie_tro[0], j + 1))
2092     return -1;
2093   if (undumpthings(trie_trc[0], j + 1))
2094     return -1;
2095   {
2096     undump_int(x);
2097     if (x < 0)
2098       goto lab6666;
2099     if (x > trie_op_size)
2100     {
2101       sprintf(log_line, "%s%s\n",  "---! Must increase the ", "trie op size");
2102       show_line(log_line, 0);
2103       goto lab6666;
2104     }
2105     else
2106       j = x;
2107   }
2108
2109 #ifdef INITEX
2110   if (is_initex)   /* bkph */
2111     trie_op_ptr = j;
2112 #endif /* INITEX */
2113   
2114   if (undumpthings(hyf_distance[1], j))
2115     return -1;
2116   if (undumpthings(hyf_num[1], j))
2117     return -1;
2118   if (undumpthings(hyf_next[1], j))
2119     return -1;
2120
2121 #ifdef INITEX
2122   if (is_initex)    /* bkph */
2123   {
2124     for (k = 0; k <= 255; k++)
2125     {
2126         trie_used[k] = 0;
2127     }
2128   }
2129 #endif /* INITEX */
2130   k = 256;
2131   while (j > 0) {
2132     {
2133       undump_int(x);
2134       if ((x < 0) || (x > k - 1))
2135         goto lab6666;
2136       else
2137         k = x;
2138     }
2139     {
2140       undump_int(x);
2141       if ((x < 1) || (x > j))
2142         goto lab6666;
2143       else
2144         x = x;
2145     }
2146 #ifdef INITEX
2147     if (is_initex)          /* bkph */
2148       trie_used[k] = x;
2149 #endif /* INITEX */
2150 /*   j:=j-x; op_start[k]:=qo(j); */
2151     j = j - x;
2152     op_start[k] = j;
2153   }
2154 #ifdef INITEX
2155   if (is_initex)          /* bkph */
2156     trie_not_ready = false;
2157 #endif /* INITEX */
2158   {
2159     undump_int(x);
2160     if ((x < batch_mode) || (x > error_stop_mode))
2161       goto lab6666;
2162 /*    else interaction = x;  */
2163     if (interaction < batch_mode)    /* may now set in local.c bkph 94/Jan/8 */
2164       interaction = x;
2165   }
2166   {
2167     undump_int(x);
2168     if ((x < 0) || (x > str_ptr))
2169       goto lab6666;
2170     else
2171       format_ident = x;
2172   }
2173   undump_int(x);
2174 /*  test_eof(fmt_file)? */
2175   
2176   if ((x != ENDFMTCHECKSUM) || feof(fmt_file)) /* magic checksum --- change ? */
2177     goto lab6666;
2178
2179   Result = true;
2180   return(Result);
2181
2182 lab6666:;
2183   sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
2184   show_line(log_line, 1);
2185 /* added following bit of explanation 96/Jan/10 */
2186   if (!knuth_flag)
2187     bad_formator_pool(format_file, "the format file", "TEXFORMATS");
2188   Result = false;
2189   return Result;
2190 }
2191 /* sec 1335 */
2192 void final_cleanup (void)
2193 {
2194   small_number c;
2195   c = cur_chr;
2196   if (job_name == 0)
2197     open_log_file();
2198
2199   while (input_ptr > 0)
2200   {
2201     if (cur_input.state_field == 0)
2202     {
2203       end_token_list();
2204     }
2205     else
2206       end_file_reading();
2207   }
2208
2209   while (open_parens > 0)
2210   {
2211     print_string(" )");
2212     decr(open_parens);
2213   }
2214
2215   if (cur_level > level_one)
2216   {
2217     print_nl("(");
2218     print_esc("end occurred ");
2219     print_string("inside a group at level ");
2220     print_int(cur_level - 1);
2221     print_char(')');
2222   }
2223
2224   while (cond_ptr != 0)
2225   {
2226     print_nl("(");
2227     print_esc("end occurred ");
2228     print_string("when ");
2229     print_cmd_chr('i', cur_if);
2230
2231     if (if_line != 0)
2232     {
2233       print_string("on line ");
2234       print_int(if_line);
2235     }
2236
2237     print_string(" was incomplete)");
2238     if_line = mem[cond_ptr + 1].cint;
2239     cur_if = mem[cond_ptr].hh.b1;
2240     temp_ptr = cond_ptr;
2241     cond_ptr = mem[cond_ptr].hh.v.RH;
2242     free_node(temp_ptr, 2);
2243   }
2244
2245   if (history != spotless)
2246     if (((history == warning_issued) || (interaction < error_stop_mode)))
2247       if (selector == term_and_log)
2248       {
2249         selector = term_only;
2250         print_nl("(see the transcript file for additional information)");
2251         selector = term_and_log;
2252       }
2253
2254   if (c == 1)
2255   {
2256 #ifdef INITEX
2257     if (is_initex)
2258     {
2259       for (c = 0; c <= 4; c++)
2260       {
2261         if (cur_mark[c] != 0)
2262           delete_token_ref(cur_mark[c]);
2263       }
2264
2265       if (last_glue != max_halfword)
2266         delete_glue_ref(last_glue);
2267       store_fmt_file(); // returns a value ?
2268     }
2269 #endif /* INITEX */
2270     if (!is_initex)       /* 2000/March/3 */
2271       print_nl("(\\dump is performed only by INITEX)");
2272   }
2273 }
2274 // debugging code for checking the string pool
2275 #ifdef CHECKPOOL
2276 int checkpool (char *task)
2277
2278   int c, i, k, n, st, flag, bad = 0;
2279
2280   if (task != NULL)
2281   {
2282     sprintf(log_line, "Check on string pool start (%s)\n", task);
2283     show_line(log_line, 0);
2284   }
2285   for (k = 0; k < 32; k++)
2286   {
2287     if (str_start[k] != 3 * k)
2288     {
2289       sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2290       show_line(log_line, 0);
2291     }
2292   }
2293   for (k = 32; k < 128; k++)
2294   {
2295     if (str_start[k] != 96 + (k - 32))
2296     {
2297       sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2298       show_line(log_line, 0);
2299     }
2300   }
2301   for (k = 128; k < 256; k++)
2302   {
2303     if (str_start[k] != 194 + 4 * (k - 128))
2304     {
2305       sprintf(log_line, "k %d str_start[k] %d\n", k, str_start[k]);
2306       show_line(log_line, 0);
2307     }
2308   }
2309   if (task != NULL)
2310   {
2311     sprintf(log_line, "Check on string pool (%s)\n", task);
2312     show_line(log_line, 0);
2313   }
2314   for (k = 0; k < str_ptr; k++)
2315   {
2316     if (str_start[k + 1] == 0)
2317       break;
2318     n = length(k);
2319     if (n < 0)
2320       break;
2321     st = str_start[k];
2322     flag = 0;
2323     for (i = 0; i < n; i++)
2324     {
2325       if (str_pool[st + i] == 0)
2326       {
2327         flag = 1; break;
2328       }
2329       if (str_pool[st + i] > 255)
2330       {
2331         flag = 1; break;
2332       }
2333     }
2334     if (flag)
2335     {
2336       bad++;
2337       sprintf(log_line, "BAD %d (start at %d): ", k, st);
2338       show_line(log_line, 0);
2339       s = log_line;
2340       for (i = 0; i < n; i++)
2341       {
2342         c = str_pool[st + i];
2343         if (c > 255)
2344         {
2345           sprintf(s, "%d ", c);
2346           s += strlen(s);
2347           continue;
2348         }
2349         if (c >= 128)
2350         {
2351           c -= 128;
2352           sprintf(s, "M-");
2353           s += strlen(s);
2354         }
2355         if (c < 32)
2356         {
2357           c += 64;
2358           sprintf(s, "C-");
2359           s += strlen(s);
2360         }
2361 //        putc(c, stdout);
2362         *s++ = c;   // ???
2363       }
2364       *s++ = '\n';
2365       *s++ = '\0';
2366       show_line(log_line, stdout);
2367     }
2368   }
2369   sprintf(log_line, "end of check (%s)\n", bad ? "BAD" : "OK");
2370   show_line(log_line, 0);
2371   if (bad)
2372   {
2373     if (task == NULL)
2374       return bad;
2375     else
2376       exit(1);
2377   }
2378   return bad;
2379 }  /* DEBUGGING ONLY */
2380 #endif
2381
2382 void show_frozen (void)
2383 {
2384   int i, j, n;
2385
2386   fprintf(log_file, "\n");
2387   fprintf(log_file, "(%d fonts frozen in format file:\n", font_ptr);
2388
2389   for (i = 1; i <= font_ptr; i++)
2390   {
2391     if (i > 1)
2392       fprintf(log_file, ", ");
2393
2394     if ((i % 8) == 0)
2395       fprintf(log_file, "\n");
2396
2397     n = str_start[font_name[i] + 1] - str_start[font_name[i]];
2398
2399     for (j = 0; j < n; j++)
2400     {
2401       putc(str_pool[str_start[font_name[i]] + j], log_file);
2402     }
2403   }
2404
2405   fprintf(log_file, ") ");
2406 }
2407
2408 /* Main entry point called from texmf.c int main(int ac, char *av[]) */
2409 /* call from main_program in texmf.c */
2410 /* This in turn calls initialize() */
2411
2412 #pragma warning(disable:4127)   // conditional expression is constant
2413
2414 /* void texbody()  */
2415 int texbody (void)          /* now returns a value --- bkph */
2416 {
2417   history = 3;
2418
2419   set_paths(TEXFORMATPATHBIT + TEXINPUTPATHBIT + TEXPOOLPATHBIT + TFMFILEPATHBIT);
2420 /* magic number */
2421   if (ready_already == 314159L)
2422     goto lab1;
2423 /*  These tests are almost all compile time tests and so could be eliminated */
2424   bad = 0;
2425   if ((half_error_line < 30) || (half_error_line > error_line - 15))
2426     bad = 1;
2427   if (max_print_line < 60)
2428     bad = 2;
2429   if (dvi_buf_size % 8 != 0)
2430     bad = 3;
2431   if (1100 > mem_top)
2432     bad = 4;   /* not compile time */
2433 /*  if (hash_prime > hash_size) */
2434   if (hash_prime > (hash_size + hash_extra))
2435     bad = 5;
2436   if (max_in_open >= 128)
2437     bad = 6;   /* p.14 */
2438   if (mem_top < 267)
2439     bad = 7;    /* where from ? *//* not compile time */
2440 #ifdef INITEX
2441 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2442   if (is_initex)
2443   {
2444     if ((mem_min != 0) || (mem_max != mem_top))
2445       bad = 10;
2446   }
2447 #endif /* INITEX */
2448 /*  if ((mem_min > 0)||(mem_max < mem_top))  */
2449   if ((mem_min > mem_bot) || (mem_max < mem_top))
2450     bad = 10;
2451   if ((min_quarterword > 0) || (max_quarterword < 255))
2452     bad = 11;
2453 /*  if ((0 > 0)||(262143L < 32767))  */
2454   if ((min_halfword > 0) || (max_halfword < 32767))
2455     bad = 12;
2456 /*  if ((0 < 0)||(255 > 262143L))  */
2457   if ((min_quarterword < min_halfword) || (max_quarterword > max_halfword))
2458     bad = 13;
2459 /*  if ((mem_min < 0)||(mem_max >= 262143L)||(-0 - mem_min > 262144L))  */
2460   if ((mem_min < min_halfword) || (mem_max >= max_halfword) || (mem_bot - mem_min >= max_halfword))
2461     bad = 14;
2462 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2463   if (mem_max > mem_top + mem_extra_high)     /* not compile time */
2464     bad = 14;       /* ha ha */
2465 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2466 /*  if ((0 < 0)||(font_max > 255)) */
2467   if ((0 < min_quarterword) || (font_max > max_quarterword))  /* 93/Dec/3 */
2468     bad = 15;
2469 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2470 #ifdef INCREASEFONTS
2471   if (font_max > 1024)                /* 96/Jan/17 */
2472 #else
2473   if (font_max > 256)
2474 #endif
2475     bad = 16;
2476 /*  if ((save_size > 262143L)||(max_strings > 262143L)) */
2477   if ((save_size > max_halfword) || (max_strings > max_halfword))
2478     bad = 17;
2479   if (buf_size > max_halfword)
2480     bad = 18;
2481   if (max_quarterword - min_quarterword < 255)
2482     bad = 19;
2483 /* if cs_token_flag + undefined_control_sequence > max_halfword then bad <- 21;*/
2484 /*  if ((hash_size + 4876) > 262143L)*/
2485 /*  if ((hash_size + 4876) > max_halfword) */
2486   if ((hash_size + 4095 + 781) > max_halfword)
2487     bad = 21;
2488   if (format_default_length > PATHMAX)
2489     bad = 31;
2490 /*  if (2 * 262143L < mem_top - mem_min) */
2491   if (max_halfword < (mem_top - mem_min) / 2)
2492     bad = 41;
2493   if (bad > 0)
2494   {
2495     sprintf(log_line, "%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
2496         "---case ", (long) bad);
2497     show_line(log_line, 1);
2498     if (! knuth_flag)
2499       bad_formator_pool(format_file, "the format file", "TEXFORMATS");  /* 96/Jan/17 */
2500     goto lab9999;     // abort
2501   }
2502   initialize();
2503 #ifdef INITEX
2504   if (is_initex)
2505   {
2506     if (!get_strings_started())
2507       goto lab9999;   // abort
2508     init_prim();
2509     init_str_ptr = str_ptr;
2510     init_pool_ptr = pool_ptr;
2511     dateandtime(tex_time, day, month, year);
2512   }
2513 #endif /* INITEX */
2514   ready_already = 314159L;      /* magic number */
2515
2516 lab1:     /* get here directly if ready_already already set ... */
2517   selector = term_only;
2518   tally = 0;
2519   term_offset = 0;
2520   file_offset = 0;
2521   show_line(tex_version, 0);
2522   sprintf(log_line, " (%s %s)", application, yandyversion);
2523   show_line(log_line, 0);
2524   if (format_ident > 0)
2525     slow_print(format_ident);
2526   print_ln();
2527 #ifndef _WINDOWS
2528   fflush(stdout);
2529 #endif
2530   job_name = 0;
2531   name_in_progress = false;
2532   log_opened = false;
2533   output_file_name = 0;
2534   {
2535     {
2536       input_ptr = 0;
2537       max_in_stack = 0;
2538       in_open = 0;
2539       high_in_open = 0; /* max_in_open name already used 1999 Jan 17 */
2540       open_parens = 0;
2541       max_open_parens = 0;  /* max_open_parens */
2542       max_buf_stack = 0;
2543       param_ptr = 0;
2544       max_param_stack = 0;
2545 #ifdef ALLOCATEBUFFER
2546 /*    first = current_buf_size; */
2547       memset (buffer, 0, current_buf_size); /* redundant */
2548 #else
2549 /*    first = buf_size; */
2550       memset (buffer, 0, buf_size);     /* redundant ? */
2551 #endif
2552 /*    do {
2553         buffer[first]= 0;
2554         decr(first);
2555       } while(!(first == 0)); */
2556       first = 0;              /* 1999/Jan/22 */
2557
2558       scanner_status = 0;
2559       warning_index = 0; /* warning_index:=null; l.7068 */
2560       first = 1;
2561       cur_input.state_field = 33;
2562       cur_input.start_field = 1;
2563       cur_input.index_field = 0;
2564       line = 0;
2565       cur_input.name_field = 0;
2566       force_eof = false;
2567       align_state = 1000000L;
2568       if (!init_terminal())
2569         goto lab9999; // abort
2570       cur_input.limit_field = last;
2571       first = last + 1;
2572     }
2573 /*    if ((format_ident == 0)||(buffer[cur_input.loc_field]== 38)) */
2574 /*    For Windows NT, lets allow + instead of & for format specification */
2575     if ((format_ident == 0) ||
2576         (buffer[cur_input.loc_field] == '&') ||
2577         (buffer[cur_input.loc_field] == '+'))
2578     {
2579       if (format_ident != 0)
2580         initialize();
2581       if (!open_fmt_file ())
2582         goto lab9999; // abort
2583       if (!load_fmt_file ())
2584       {
2585         w_close(fmt_file);
2586         goto lab9999; // abort
2587       }
2588       w_close(fmt_file);
2589       while ((cur_input.loc_field < cur_input.limit_field) &&
2590           (buffer[cur_input.loc_field] == 32))
2591         incr(cur_input.loc_field);
2592     }
2593 #ifdef CHECKEQTB
2594     if (debug_flag)
2595       check_eqtb("after format"); /* debugging 94/Apr/5 */
2596 #endif
2597     if ((end_line_char < 0) || (end_line_char > 255))
2598       decr(cur_input.limit_field);
2599     else
2600       buffer[cur_input.limit_field] = end_line_char;
2601     dateandtime(tex_time, day, month, year);
2602     magic_offset = str_start[886] - 9 * 16;  /* following: */
2603 /*  "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
2604     if (interaction == batch_mode)
2605       selector = no_print;
2606     else
2607       selector = term_only;
2608
2609     if ((cur_input.loc_field < cur_input.limit_field) &&
2610       (eqtb[(hash_size + 1883) + buffer[cur_input.loc_field]].hh.v.RH != 0))
2611       start_input();
2612   }
2613
2614 /*  show font TFMs frozen into format file */
2615 /*  moved here after start_input to ensure the log file is open */
2616   if (show_tfm_flag && log_opened && font_ptr > 0)    /* 98/Sep/28 */
2617     show_frozen();
2618
2619   main_time = clock();
2620   history = 0;
2621
2622   if (show_cs_names)
2623     print_cs_names(stdout, 0);    /* 98/Mar/31 */
2624
2625   main_control();     /* read-eval-print loop :-) in tex8.c */
2626
2627 //  what if abort_flag is set now ?
2628
2629   if (show_cs_names)
2630     print_cs_names(stdout, 1);    /* 98/Mar/31 */
2631
2632 //  what if abort_flag is set now ?
2633
2634   final_cleanup();
2635
2636 //  if (abort_flag) return -1;
2637
2638   close_files_and_terminate();
2639
2640 lab9999:
2641   {
2642     int code;
2643 #ifndef _WINDOWS
2644     fflush(stdout);
2645 #endif
2646     ready_already = 0;
2647     if ((history != 0) && (history != 1))
2648       code = 1;
2649     else
2650       code = 0;
2651 //    now return instead of exit to allow cleanup in local.c
2652     return code;
2653 //    uexit(code);
2654   }
2655 } /* end of texbody */
2656
2657 #ifdef ALLOCATEMAIN
2658 /* add a block of variable size node space below mem_bot */
2659 /* used in tex0.c, local.c, itex.c */
2660 void add_variable_space(int size)
2661 {
2662   halfword p;
2663   halfword q;
2664   integer t;
2665
2666   if (mem_min == 0)
2667     t = mem_min;  /* bottom of present block */
2668   else
2669     t = mem_min + 1;
2670
2671   mem_min = t - (size + 1);     /* first word in new block - 1 */
2672 /*  mem_min = mem_start; */     /* allocate all of it at once */
2673   if (mem_min < mem_start)      /* sanity test */
2674   {
2675     if (trace_flag)
2676       show_line("WARNING: mem_min < mem_start!\n", 0);
2677     mem_min = mem_start;
2678   }
2679   p = mem[rover + 1].hh.v.LH;
2680   q = mem_min + 1;
2681   mem[mem_min].hh.v.RH = 0; /* insert blank word below ??? */
2682   mem[mem_min].hh.v.LH = 0; /* insert blank word below ??? */
2683   mem[p + 1].hh.v.RH = q;
2684   mem[rover + 1].hh.v.LH = q;
2685   mem[q + 1].hh.v.RH = rover;
2686   mem[q + 1].hh.v.LH = p;
2687   mem[q].hh.v.RH = empty_flag;
2688   mem[q].hh.v.LH = t - q; /* block size */
2689   rover = q;
2690 }
2691 #endif
2692
2693 /**************************************************************************/
2694 /* All ini TeX code is here at end so can use same pragma optimize for it */
2695 /* Ini-TeX code is rarely needed/used so make it small rather than fast   */
2696
2697 #pragma optimize("t", off)
2698 #pragma optimize("s", on)
2699
2700 #ifdef INITEX
2701 /* split out to allow sharing of code from do_initex and newpattern */
2702 void reset_trie (void)
2703 {
2704   integer k;
2705   for (k = - (integer) trie_op_size; k <= trie_op_size; k++)
2706     trie_op_hash[k] = 0;
2707   for (k = 0; k <= 255; k++)
2708     trie_used[k] = min_trie_op;
2709   max_op_used = min_trie_op;
2710   trie_op_ptr = 0;
2711   trie_not_ready = true;
2712   trie_l[0] = 0;
2713   trie_c[0] = 0;
2714   trie_ptr = 0;
2715   trie_not_ready = true;
2716 }
2717 /* borrowed code from initialize() */
2718 void reset_hyphen (void)
2719 {
2720   hyph_pointer z;
2721
2722   for (z = 0; z <= hyphen_prime; z++)
2723   {
2724     hyph_word[z] = 0;
2725     hyph_list[z] = 0; /* hyph_list[z]:=null; l.18131 */
2726   }
2727   hyph_count = 0;
2728 }
2729 /* split out to allow optimize for space, not time */
2730 void do_initex (void)
2731 {
2732 /*  integer i; */
2733   integer k;
2734 /*  hyph_pointer z; */
2735
2736 /* -> 0164 */
2737   for (k = mem_bot + 1; k <= lo_mem_stat_max; k++)
2738     mem[k].cint = 0;
2739
2740   k = mem_bot;
2741
2742   while(k <= lo_mem_stat_max)
2743   {
2744     glue_ref_count(k) = 1;
2745     stretch_order(k) = normal;
2746     shrink_order(k) = normal;
2747     k = k + glue_spec_size;
2748   }
2749
2750   stretch(fil_glue) = 65535L;
2751   stretch_order(fil_glue) = fil;
2752   stretch(fill_glue) = 65535L;
2753   stretch_order(fill_glue) = fill;
2754   stretch(ss_glue) = 65535L;
2755   stretch_order(ss_glue) = fil;
2756   shrink(ss_glue) = 65535L;
2757   shrink_order(ss_glue) = fil;
2758   stretch(fil_neg_glue) = -65536L;
2759   stretch_order(fil_neg_glue) = fil;
2760   rover = lo_mem_stat_max + 1;
2761   link(rover) = empty_flag;
2762   node_size(rover) = block_size;
2763   llink(rover) = rover;
2764   rlink(rover) = rover;
2765   lo_mem_max = rover + block_size;
2766   link(lo_mem_max) = 0;
2767   info(lo_mem_max) = 0;
2768
2769   for (k = hi_mem_stat_min; k <= mem_top; k++)
2770     mem[k] = mem[lo_mem_max];
2771
2772   info(omit_template) = end_template_token;
2773   link(end_span) = max_quarterword + 1;
2774   info(end_span) = 0;
2775   type(last_active) = hyphenated;
2776   line_number(last_active) = max_halfword;
2777   subtype(last_active) = 0;
2778   subtype(page_ins_head) = 255;
2779   type(page_ins_head) = split_up;
2780   link(mem_top) = page_ins_head;
2781   type(page_head) = glue_node;
2782   subtype(page_head) = normal;
2783   avail = 0;                   /* avail <- null p.164 */
2784   mem_end = mem_top;           /* mem_end <- mem_top */
2785   hi_mem_min = hi_mem_stat_min;
2786   var_used = 20;               /* var_used <- lo_mem_stat_max */
2787   dyn_used = 14;               /* dyn_used <- hi_mem_stat_usage */
2788   eq_type(undefined_control_sequence) = undefined_cs;
2789   equiv(undefined_control_sequence) = 0;
2790   eq_level(undefined_control_sequence) = level_zero;
2791
2792   for (k = active_base; k <= undefined_control_sequence - 1; k++)
2793     eqtb[k] = eqtb[undefined_control_sequence];
2794
2795   equiv(glue_base) = zero_glue;
2796   eq_level(glue_base) = level_one;
2797   eq_type(glue_base) = glue_ref;
2798
2799   for (k = glue_base + 1; k <= local_base - 1; k++)
2800     eqtb[k] = eqtb[glue_base];
2801
2802   glue_ref_count(zero_glue) = glue_ref_count(zero_glue) + local_base - glue_base;
2803
2804   par_shape_ptr = 0;
2805   eq_type(par_shape_loc) = shape_ref;
2806   eq_level(par_shape_loc) = level_one;
2807
2808   for (k = output_routine_loc; k <= toks_base + 255; k++)
2809     eqtb[k] = eqtb[undefined_control_sequence];
2810
2811   box(0) = 0;
2812   eq_type(box_base) = box_ref;
2813   eq_level(box_base) = level_one;
2814
2815   for (k = box_base + 1; k <= box_base + 255; k++)
2816     eqtb[k] = eqtb[box_base];
2817
2818   cur_font = null_font;
2819   eq_type(cur_font_loc) = data;
2820   eq_level(cur_font_loc) = level_one;
2821
2822   for (k = math_font_base; k <= math_font_base + 47; k++)
2823     eqtb[k] = eqtb[cur_font_loc];
2824
2825   equiv(cat_code_base) = 0;
2826   eq_type(cat_code_base) = data;
2827   eq_level(cat_code_base) = level_one;
2828
2829   for (k = cat_code_base; k <= int_base - 1; k++)
2830     eqtb[k] = eqtb[cat_code_base];
2831
2832   for (k = 0; k <= 255; k++)
2833   {
2834     cat_code(k) = other_char;
2835     math_code(k) = k;
2836     sf_code(k) = 1000;
2837   }
2838
2839   cat_code(carriage_return) = car_ret;
2840   cat_code(' ') = spacer;
2841   cat_code('\\') = escape;
2842   cat_code('%') = comment;
2843   cat_code(invalid_code) = invalid_char;
2844   cat_code(null_code) = ignore;
2845
2846   for (k = '0'; k <= '9'; k++)
2847     math_code(k) = k + var_code;
2848
2849   for (k = 'A'; k <= 'Z'; k++)
2850   {
2851     cat_code(k) = letter;
2852     cat_code(k + 'a' - 'A') = letter;
2853     math_code(k) = k + var_code + 0x100;
2854     math_code(k + 'a' - 'A') = k + 'a' - 'A' + var_code + 0x100;
2855     lc_code(k) = k + 'a' - 'A';
2856     lc_code(k + 'a' - 'A') = k + 'a' - 'A';
2857     uc_code(k) = k;
2858     uc_code(k + 'a' - 'A') = k;
2859     sf_code(k) = 999;
2860   }
2861
2862   for (k = int_base; k <= del_code_base - 1; k++)
2863     eqtb[k].cint = 0;
2864
2865   mag = 1000;
2866   tolerance = 10000;
2867   hang_after = 1;
2868   max_dead_cycles = 25;
2869   escape_char = '\\';
2870   end_line_char = carriage_return;
2871
2872   for (k = 0; k <= 255; k++)
2873     del_code(k) = -1;
2874
2875   del_code('.') = 0;
2876
2877   for (k = dimen_base; k <= eqtb_size; k++)
2878     eqtb[k].cint = 0;
2879
2880   hash_used = frozen_control_sequence;
2881   cs_count = 0;
2882
2883   if (trace_flag)
2884     show_line("initex cs_count = 0 ", 0); /* debugging */
2885
2886   eq_type(frozen_dont_expand) = dont_expand;
2887   text(frozen_dont_expand) = 499;  /* notexpanded */
2888
2889   font_ptr                    = null_font;
2890   fmem_ptr                    = 7;
2891   font_name[null_font]        = 795; /* nullfont */
2892   font_area[null_font]        = 335; /* "" */
2893   hyphen_char[null_font]      = '-';
2894   skew_char[null_font]        = -1; 
2895   bchar_label[null_font]      = non_address;
2896   font_bchar[null_font]       = non_char;
2897   font_false_bchar[null_font] = non_char;
2898   font_bc[null_font]          = 1;
2899   font_ec[null_font]          = 0;
2900   font_size[null_font]        = 0;
2901   font_dsize[null_font]       = 0;
2902   char_base[null_font]        = 0;
2903   width_base[null_font]       = 0;
2904   height_base[null_font]      = 0;
2905   depth_base[null_font]       = 0;
2906   italic_base[null_font]      = 0;
2907   lig_kern_base[null_font]    = 0;
2908   kern_base[null_font]        = 0;
2909   exten_base[null_font]       = 0;
2910   font_glue[null_font]        = 0;
2911   font_params[null_font]      = 7;
2912   param_base[null_font]       = -1;
2913 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***  */
2914   reset_trie();         /* shared 93/Nov/26 */
2915 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***  */
2916
2917   text(frozen_protection) = 1184; /* "inaccessible" */
2918   format_ident = 1251;
2919   text(end_write) = 1290;
2920   eq_level(end_write) = level_one;
2921   eq_type(end_write) = outer_call;
2922   equiv(end_write) = 0;
2923 }
2924 #endif /* INITEX */
2925
2926 #ifdef INITEX
2927 /* starts string pool with strings for 256 chars and then reads tex.pool */
2928 /* adjusted to try both "tex.pool" and "tex.poo" 95/Feb/19               */
2929 /* I have added a texpool file, but I need merge the pool to the binary  */
2930 /* lots of things updates the kpathsea sources -- Clerk Ma               */
2931
2932 bool get_strings_started (void)
2933 {
2934   register bool Result;
2935   unsigned char k/*, l*/;
2936   /* ASCII_code m, n;*/
2937   str_number g;
2938   /* integer a; */ /* not used */
2939   /*bool c;*/
2940 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2941   /*int flag;*/ /* 95/Feb/19 */
2942 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
2943   pool_ptr = 0;
2944   str_ptr = 0;
2945   str_start[0] = 0;
2946
2947   {
2948     register integer for_end;
2949     k = 0;
2950     for_end = 255;
2951     if (k <= for_end)
2952       do {
2953         if (((k < ' ') || (k > '~')))
2954         {
2955           append_char('^');
2956           append_char('^');
2957           if (k < 64)
2958             append_char(k + 64);
2959           else
2960             if (k < 128)
2961               append_char(k - 64);
2962             else
2963             {
2964               append_lc_hex(k / 16);
2965               append_lc_hex(k % 16);
2966             }
2967         }
2968         else
2969           append_char(k);
2970         g = make_string();
2971       } while(k++ < for_end);
2972   }
2973 #ifdef STDPOOL
2974   vstrcpy((char *) name_of_file + 1, pool_name);
2975   name_of_file[0] = ' ';
2976   name_of_file[strlen(pool_name) + 1] = ' '; 
2977   name_length = strlen(pool_name);
2978 /*  if (a_open_in(pool_file, TEXPOOLPATH))  */
2979   flag = a_open_in(pool_file, TEXPOOLPATH);
2980   if (flag == 0) /* 95/Feb/19 */
2981   {
2982     pool_name [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */
2983     vstrcpy((char *) name_of_file + 1, pool_name);
2984     name_of_file[0] = ' ';
2985     name_of_file[strlen(pool_name) + 1] = ' ';
2986     name_length = strlen(pool_name);
2987     flag = a_open_in(pool_file, TEXPOOLPATH);
2988   }
2989   if (flag)
2990   {
2991     c = false;
2992     do {
2993       {
2994         if (test_eof(pool_file))
2995         {
2996           show_line("! string pool file has no check sum.\n", 1);
2997           if (! knuth_flag)
2998             bad_formator_pool(string_file, "the pool file", "TEXPOOL");
2999           (void) a_close(pool_file);
3000           Result = false;
3001           return(Result);
3002         }
3003         read(pool_file, m);
3004         read(pool_file, n);
3005         if (m == '*') /* last line starts with * */
3006         {
3007           a = 0;
3008           k = 1;
3009           while (true) {
3010             if ((xord[n]< 48) || (xord[n]> 57))
3011             {
3012               show_line("! string pool file check sum doesn't have nine digits.\n", 1);
3013               if (!knuth_flag)
3014                 bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3015               (void) a_close(pool_file);
3016               Result = false;
3017               return(Result);
3018             }
3019             a = 10 * a + xord[n] - 48;
3020             if (k == 9)
3021               goto lab30;
3022             incr(k);
3023             read(pool_file, n);
3024           }
3025 /* tex.pool file check sum *367403084 */
3026 lab30:
3027           if (a != BEGINFMTCHECKSUM)
3028           {
3029             show_line("! string pool check sum doesn't match; tangle me again.\n", 1);
3030             if (!knuth_flag)
3031               bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3032             (void) a_close(pool_file);
3033             Result = false;
3034             return(Result);
3035           }
3036           c = true;
3037         }
3038         else
3039         {
3040           if ((xord[m] < 48) || (xord[m] > 57) || (xord[n] < 48) || (xord[n] > 57))
3041           {
3042             show_line("! string pool line doesn't begin with two digits.\n", 1);
3043             if (! knuth_flag)
3044               bad_formator_pool(string_file, "the pool file", "TEXPOOL");
3045             (void) a_close(pool_file);
3046             Result = false;
3047             return(Result);
3048           }
3049           l = xord[m] * 10 + xord[n] - 48 * 11;
3050 #ifdef ALLOCATESTRING
3051 /* can freely extend memory, so we need not be paranoid - stringvacancies */
3052 /* if (pool_ptr + l + stringvacancies > current_pool_size)*/
3053           if (pool_ptr + l + stringmargin > current_pool_size)
3054           {
3055             if (trace_flag)
3056               show_line("String margin reallocation\n", 0);
3057 /* str_pool =  realloc_str_pool (pool_ptr + l + stringvacancies */
3058             str_pool =  realloc_str_pool (pool_ptr + l + stringmargin - current_pool_size + increment_pool_size);
3059           }
3060           if (pool_ptr + l + stringmargin > current_pool_size) /* 94/Jan/24 */
3061 #else
3062           if (pool_ptr + l + stringvacancies > pool_size)
3063 #endif
3064           {
3065             show_line("! You have to increase POOLSIZE.\n", 1);
3066             (void) a_close(pool_file);
3067             Result = false;
3068             return(Result);
3069           }
3070           {
3071             register integer for_end;
3072             k = 1;
3073             for_end = l;
3074             if (k <= for_end) 
3075               do {
3076                 if (eoln(pool_file))
3077                   m = ' ';
3078                 else read(pool_file, m);
3079                 {
3080                   str_pool[pool_ptr] = xord[m];
3081                   incr(pool_ptr);
3082                 }
3083               } while(k++ < for_end);
3084           }
3085           readln(pool_file); /* flush rest to end of file / end of line */
3086           g = make_string();
3087         }
3088       }
3089     } while (!(c));
3090     (void) a_close(pool_file);
3091     Result = true;
3092   }
3093   else
3094   {
3095     sprintf(log_line, "! I can't read %s.\n", pool_name);
3096     show_line(log_line, 1);
3097     if (!knuth_flag)
3098       show_line("  (Was unable to find tex.poo or tex.pool)\n", 0); /* extra explain */
3099     Result = false;
3100     return(Result);
3101   }
3102 #endif
3103   g = load_pool_strings(pool_size - stringvacancies);
3104
3105   if (g == 0)
3106   {
3107     fprintf(stdout , "%s\n",  "! You have to increase POOLSIZE." );
3108     Result = false;
3109     return Result;
3110   }
3111
3112   Result = true;
3113   return Result;
3114 }
3115 #endif /* INITEX */
3116
3117 #ifdef INITEX
3118 void sort_avail (void)
3119 {
3120   halfword p, q, r;
3121   halfword old_rover;
3122
3123   p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */
3124   p = rlink(rover);
3125   rlink(rover) = empty_flag;
3126   old_rover = rover;
3127   while (p != old_rover) {
3128     if (p < rover)
3129     {
3130       q = p;
3131       p = rlink(q);
3132       rlink(q) = rover;
3133       rover = q;
3134     }
3135     else
3136     {
3137       q = rover;
3138       while (rlink(q) < p)
3139         q = rlink(q);
3140       r = rlink(p);
3141       rlink(p) = rlink(q);
3142       rlink(q) = p;
3143       p = r;
3144     }
3145   }
3146   p = rover;
3147   while (rlink(p) != empty_flag) {
3148     llink(rlink(p)) = p;
3149     p = rlink(p);
3150   }
3151   mem[p + 1].hh.v.RH = rover;
3152   llink(rover) = p;
3153 }
3154 #endif /* INITEX */
3155
3156 #ifdef INITEX
3157 /*****************APTEX********************/
3158 str_number make_string_pool (char *s)
3159 {
3160   int slen = strlen(s);
3161
3162   if (slen == 1)
3163   {
3164     return ((str_number)s[0]);
3165   }
3166   else
3167   {
3168     memcpy(str_pool + pool_ptr, s, slen);
3169     pool_ptr += slen;
3170     return (make_string());
3171   }
3172 }
3173 /*****************APTEX********************/
3174 void primitive_ (str_number s, quarterword c, halfword o)
3175
3176   pool_pointer k;
3177   small_number j;
3178 /*  small_number l;  */
3179   int l; /* 95/Jan/7 */
3180
3181   if (s < 256)
3182     cur_val = s + single_base;
3183   else
3184   {
3185     k = str_start[s];
3186     l = str_start[s + 1] - k; /* small_number l */
3187     for (j = 0; j <= l - 1; j++)
3188     {
3189       buffer[j] = str_pool[k + j];
3190     }
3191     cur_val = id_lookup(0, l);
3192     flush_string();
3193 /* **********************  debugging only  96/Jan/20 should not happen */
3194 #ifdef SHORTHASH
3195     if (s > 65535L)
3196       show_line("ERROR: hash entry too large\n", 1);
3197 #endif
3198     hash[cur_val].v.RH = s;
3199   }
3200   eqtb[cur_val].hh.b1 = 1;
3201   eqtb[cur_val].hh.b0 = c;
3202   eqtb[cur_val].hh.v.RH = o;
3203 }
3204 #endif /* INITEX */
3205
3206 /* more weird constants ? page 394 */
3207
3208 #ifdef INITEX
3209 trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
3210 {
3211   register trie_op_code Result;
3212   integer h;
3213   trie_op_code u;
3214   integer l;
3215 /* the 313, 361 and 1009 are hard-wired constants here p.944 */
3216 /* begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) */
3217   h = abs(toint(n) + 313 * toint(d) + 361 * toint(v) + 1009 * toint(cur_lang)) % (trie_op_size - neg_trie_op_size) + neg_trie_op_size;
3218   while (true) {
3219     l = trie_op_hash[h];
3220     if (l == 0)
3221     {
3222       if (trie_op_ptr == trie_op_size)
3223       {
3224         /* pattern memory ops  - NOT DYNAMIC */
3225         overflow("pattern memory ops", trie_op_size);
3226         return 0;     // abort_flag set
3227       }
3228       u = trie_used[cur_lang];
3229 /*    if u=max_quarterword then ??? */
3230       if (u == max_trie_op)
3231       {
3232 /*      overflow("pattern memory ops per language", max_quarterword-min_quarterword); ??? */
3233         /* pattern memory ops per language */
3234         overflow("pattern memory ops per language", max_trie_op - min_trie_op);
3235         return 0;     // abort_flag set
3236       }
3237       incr(trie_op_ptr);
3238       incr(u);
3239       trie_used[cur_lang] = u;
3240       if (u > max_op_used)
3241         max_op_used = u;
3242       hyf_distance[trie_op_ptr] = d;
3243       hyf_num[trie_op_ptr] = n;
3244       hyf_next[trie_op_ptr] = v;
3245       trie_op_lang[trie_op_ptr] = cur_lang;
3246       trie_op_hash[h] = trie_op_ptr;
3247       trie_op_val[trie_op_ptr] = u;
3248       Result = u;
3249       return(Result);
3250     }
3251     if ((hyf_distance[l]== d) && (hyf_num[l]== n) && (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang))
3252     {
3253       Result = trie_op_val[l];
3254       return(Result);
3255     }
3256     if (h > - (integer) trie_op_size)
3257       decr(h);
3258     else
3259       h = trie_op_size;
3260   }
3261 /* return Result;  */ /* unreachable code */
3262 }
3263 /* what are those horrible constants there ? page 395 */
3264 trie_pointer trie_node_ (trie_pointer p)
3265 {
3266   register trie_pointer Result;
3267   trie_pointer h;
3268   trie_pointer q;
3269 /* the 1009, 2718, 3142 are hard-wired constants here (not hyphen_prime) */
3270   h = abs(toint(trie_c[p]) + 1009 * toint(trie_o[p]) +
3271       2718 * toint(trie_l[p]) + 3142 * toint(trie_r[p])) % trie_size;
3272   while (true) {
3273     q = trie_hash[h];
3274     if (q == 0)
3275     {
3276       trie_hash[h] = p;
3277       Result = p;
3278       return(Result);
3279     }
3280     if ((trie_c[q] == trie_c[p]) && (trie_o[q] == trie_o[p]) &&
3281       (trie_l[q]== trie_l[p]) && (trie_r[q]== trie_r[p]))
3282     {
3283       Result = q;
3284       return(Result);
3285     }
3286     if (h > 0)
3287       decr(h);
3288     else
3289       h = trie_size;
3290   }
3291 /* return Result;  */ /* unreachable code */
3292 }
3293 trie_pointer compress_trie_ (trie_pointer p)
3294 {
3295   register trie_pointer Result;
3296
3297   if (p == 0)
3298     Result = 0;
3299   else
3300   {
3301     trie_l[p] = compress_trie(trie_l[p]);
3302     trie_r[p] = compress_trie(trie_r[p]);
3303     Result = trie_node(p);
3304   }
3305   return Result;
3306 }
3307 void first_fit_ (trie_pointer p)
3308 {
3309   trie_pointer h;
3310   trie_pointer z;
3311   trie_pointer q;
3312   ASCII_code c;
3313   trie_pointer l, r;
3314   short ll;
3315
3316   c = trie_c[p];
3317   z = trie_min[c];
3318   while (true) {
3319     h = z - c;
3320     if (trie_max < h + 256)
3321     {
3322       if (trie_size <= h + 256)
3323       {
3324         /* pattern memory - NOT DYNAMIC */
3325         overflow("pattern memory", trie_size);
3326 /*      not dynamic ---- but can be set -h=... from command line in ini-TeX */
3327         return;     // abort_flag set
3328       }
3329       do {
3330         incr(trie_max);
3331         trie_taken[trie_max] = false;
3332         trie_trl[trie_max] = trie_max + 1;
3333         trie_tro[trie_max] = trie_max - 1;
3334       } while (!(trie_max == h + 256));
3335     }
3336     if (trie_taken[h])
3337       goto lab45;
3338     q = trie_r[p];
3339     while (q > 0) {
3340       if (trie_trl[h + trie_c[q]] == 0)
3341         goto lab45;
3342       q = trie_r[q];
3343     }
3344     goto lab40;
3345 lab45:
3346     z = trie_trl[z];
3347   }
3348 lab40:
3349   trie_taken[h] = true; /* h may be used without ... */
3350   trie_hash[p] = h;
3351   q = p;
3352   do {
3353     z = h + trie_c[q];
3354     l = trie_tro[z];
3355     r = trie_trl[z];
3356     trie_tro[r] = l;
3357     trie_trl[l] = r;
3358     trie_trl[z] = 0;
3359     if (l < 256)
3360     {
3361       if (z < 256)
3362         ll = z;         /* short ll */
3363       else
3364         ll = 256;
3365       do {
3366         trie_min[l] = r;
3367         incr(l);
3368       } while (!(l == ll));
3369     }
3370     q = trie_r[q];
3371   } while (!(q == 0));
3372 }
3373 void trie_pack_ (trie_pointer p)
3374 {
3375   trie_pointer q;
3376
3377   do {
3378     q = trie_l[p];
3379
3380     if ((q > 0) && (trie_hash[q]== 0))
3381     {
3382       first_fit(q);
3383       trie_pack(q);
3384     }
3385
3386     p = trie_r[p];
3387   } while(!(p == 0));
3388 }
3389 void trie_fix_ (trie_pointer p)
3390 {
3391   trie_pointer q;
3392   ASCII_code c;
3393   trie_pointer z;
3394
3395   z = trie_hash[p];
3396
3397   do {
3398     q = trie_l[p];
3399     c = trie_c[p];
3400     trie_trl[z + c] = trie_hash[q];
3401     trie_trc[z + c] = c;
3402     trie_tro[z + c] = trie_o[p];
3403
3404     if (q > 0)
3405       trie_fix(q);
3406
3407     p = trie_r[p];
3408   } while(!(p == 0));
3409 }
3410 /* sec 0960 */
3411 void new_patterns (void)
3412 {
3413 /* ******************************************************************* */
3414 /*  was small_number k, l;  in 3.141 */
3415   char k, l;
3416 /* ******************************************************************* */
3417   bool digitsensed;
3418   trie_op_code v;
3419   trie_pointer p, q;
3420   bool firstchild;
3421 /*  ASCII_code c;  */
3422   int c;                /* 95/Jan/7 */
3423
3424   if (!trie_not_ready) /* new stuff */
3425   {
3426     if (allow_patterns)
3427     {
3428       if (trace_flag)
3429         show_line("Resetting patterns\n", 0);
3430
3431       reset_trie();         /* RESET PATTERNS -  93/Nov/26 */
3432
3433       if (reset_exceptions)
3434       {
3435         if (trace_flag)
3436           show_line("Resetting exceptions\n", 0);
3437
3438         reset_hyphen();     /* RESET HYPHENEXCEPTIONS -  93/Nov/26 */
3439       }
3440     }
3441   }
3442 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
3443   if (trie_not_ready)
3444   {
3445     set_cur_lang();
3446     scan_left_brace();
3447     k = 0;
3448     hyf[0] = 0;
3449     digitsensed = false;
3450
3451     while (true)
3452     {
3453       get_x_token();
3454
3455       switch (cur_cmd)
3456       {
3457         case letter:
3458         case other_char:
3459           if (digitsensed || (cur_chr < '0') || (cur_chr > '9'))
3460           {
3461             if (cur_chr == '.')
3462               cur_chr = 0;
3463             else
3464             {
3465               cur_chr = lc_code(cur_chr);
3466
3467               if (cur_chr == 0)
3468               {
3469                 print_err("Nonletter");
3470                 help1("(See Appendix H.)");
3471                 error();
3472               }
3473             }
3474
3475             if (k < 63)
3476             {
3477               incr(k);
3478               hc[k] = cur_chr;
3479               hyf[k] = 0;
3480               digitsensed = false;
3481             }
3482           }
3483           else if (k < 63)
3484           {
3485             hyf[k] = cur_chr - '0';
3486             digitsensed = true;
3487           }
3488           break;
3489         case spacer:
3490         case right_brace:
3491           {
3492             if (k > 0)
3493             {
3494               if (hc[1] == 0)
3495                 hyf[0] = 0;
3496
3497               if (hc[k] == 0)
3498                 hyf[k] = 0;
3499
3500               l = k;
3501               v = min_trie_op;
3502
3503               while (true) {
3504                 if (hyf[l]!= 0)
3505                   v = new_trie_op(k - l, hyf[l], v);
3506
3507                 if (l > 0)
3508                   decr(l);
3509                 else
3510                   goto lab31;
3511               }
3512 lab31:
3513               q = 0;
3514               hc[0] = cur_lang;
3515
3516               while (l <= k) {
3517                 c = hc[l];
3518                 incr(l);
3519                 p = trie_l[q];
3520                 firstchild = true;
3521
3522                 while ((p > 0) && (c > trie_c[p])) {
3523                   q = p;
3524                   p = trie_r[q];
3525                   firstchild = false;
3526                 }
3527
3528                 if ((p == 0) || (c < trie_c[p]))
3529                 {
3530                   if (trie_ptr == trie_size)
3531                   {
3532                     overflow("pattern memory", trie_size);  /* pattern memory - NOT DYNAMIC */
3533 /*      not dynamic ---- but can be set -h=... from command line in ini-TeX */
3534                     return;     // abort_flag set
3535                   }
3536
3537                   incr(trie_ptr);
3538                   trie_r[trie_ptr] = p;
3539                   p = trie_ptr;
3540                   trie_l[p] = 0;
3541
3542                   if (firstchild)
3543                     trie_l[q]= p;
3544                   else
3545                     trie_r[q]= p;
3546
3547                   trie_c[p] = c;
3548                   trie_o[p] = min_trie_op;
3549                 }
3550                 q = p;
3551               }
3552
3553               if (trie_o[q]!= min_trie_op)
3554               {
3555                 print_err("Duplicate pattern");
3556                 help1("(See Appendix H.)");
3557                 error();
3558               }
3559
3560               trie_o[q]= v;
3561             }
3562
3563             if (cur_cmd == right_brace)
3564               goto lab30;
3565
3566             k = 0;
3567             hyf[0] = 0;
3568             digitsensed = false;
3569           }
3570           break;
3571         default:
3572           {
3573             print_err("Bad ");
3574             print_esc("patterns");
3575             help1("(See Appendix H.)");
3576             error();
3577           }
3578           break;
3579       }
3580     }
3581 lab30:;
3582   }
3583   else
3584   {
3585     print_err("Too late for ");
3586     print_esc("patterns");
3587     help1("All patterns must be given before typesetting begins.");
3588     error();
3589     link(garbage) = scan_toks(false, false);
3590     flush_list(def_ref);
3591   }
3592 }
3593 /* sec 0966 */
3594 void init_trie (void)
3595 {
3596   trie_pointer p;
3597 /*  integer j, k, t;  */
3598   integer j, k;
3599   int t;                  /* 95/Jan/7 */
3600   trie_pointer r, s;
3601
3602   op_start[0] = - (integer) min_trie_op;
3603
3604   for (j = 1; j <= 255; j++)
3605   {
3606     op_start[j] = op_start[j - 1] + trie_used[j - 1];
3607   }
3608
3609   for (j = 1; j <= trie_op_ptr; j++)
3610   {
3611     trie_op_hash[j] = op_start[trie_op_lang[j]] + trie_op_val[j];
3612   }
3613
3614   for (j = 1; j <= trie_op_ptr; j++)
3615   {
3616     while (trie_op_hash[j] > j)
3617     {
3618       k = trie_op_hash[j];
3619       t = hyf_distance[k];
3620       hyf_distance[k] = hyf_distance[j];
3621       hyf_distance[j] = t;
3622       t = hyf_num[k];
3623       hyf_num[k] = hyf_num[j];
3624       hyf_num[j] = t;
3625       t = hyf_next[k];
3626       hyf_next[k] = hyf_next[j];
3627       hyf_next[j]= t;
3628       trie_op_hash[j] = trie_op_hash[k];
3629       trie_op_hash[k] = k;
3630     }
3631   }
3632
3633   for (p = 0; p <= trie_size; p++)
3634   {
3635     trie_hash[p] = 0;
3636   }
3637
3638   trie_l[0] = compress_trie(trie_l[0]);
3639
3640   for (p = 0; p <= trie_ptr; p++)
3641   {
3642     trie_hash[p]= 0;
3643   }
3644
3645   for (p = 0; p <= 255; p++)
3646   {
3647     trie_min[p] = p + 1;
3648   }
3649
3650   trie_trl[0] = 1;
3651   trie_max = 0;
3652
3653   if (trie_l[0] != 0)
3654   {
3655     first_fit(trie_l[0]);
3656     trie_pack(trie_l[0]);
3657   }
3658
3659   if (trie_l[0] == 0)
3660   {
3661     for (r = 0; r <= 256; r++)
3662     {
3663       trie_trl[r] = 0;
3664       trie_tro[r] = min_trie_op;
3665       trie_trc[r] = 0;
3666     }
3667     trie_max = 256;
3668   }
3669   else
3670   {
3671     trie_fix(trie_l[0]);
3672     r = 0;
3673     do {
3674       s = trie_trl[r];
3675       {
3676         trie_trl[r] = 0;
3677         trie_tro[r] = min_trie_op;
3678         trie_trc[r] = 0;
3679       }
3680       r = s;
3681     } while(!(r > trie_max));
3682   }
3683   trie_trc[0] = 63;
3684   trie_not_ready = false;
3685 }
3686 #endif /* INITEX */
3687
3688 #ifdef INITEX
3689 void store_fmt_file (void)
3690 {
3691   integer j, k, l;
3692   halfword p, q;
3693   integer x;
3694
3695   if (!is_initex)   /* redundant check 94/Feb/14 */
3696   {
3697     show_line("! \\dump is performed only by INITEX\n", 1);
3698
3699     if (! knuth_flag)
3700       show_line("  (Use -i on the command line)\n", 0);
3701
3702     abort_flag++;
3703     return;
3704   }
3705
3706   if (save_ptr != 0)
3707   {
3708     print_err("You can't dump inside a group");
3709     help1("`{...\\dump}' is a no-no.");
3710     succumb();
3711   }
3712
3713   selector = new_string;
3714   print_string(" (format=");
3715   print(job_name);
3716   print_char(' ');
3717   print_int(year);
3718   print_char('.');
3719   print_int(month);
3720   print_char('.');
3721   print_int(day);
3722   print_char(')');
3723
3724   if (interaction == 0)
3725     selector = log_only;
3726   else
3727     selector = term_and_log;
3728
3729   str_room(1);
3730   format_ident = make_string();
3731   pack_job_name(".fmt");
3732
3733   while(!w_open_out(fmt_file))
3734   {
3735     prompt_file_name("format file name", ".fmt");
3736   }
3737
3738   print_nl("Beginning to dump on file ");
3739   slow_print(w_make_name_string(fmt_file));
3740   flush_string();
3741   print_nl("");
3742   slow_print(format_ident);
3743
3744   dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
3745
3746   dump_int(mem_bot);
3747   dump_int(mem_top);
3748   dump_int(eqtb_size);
3749   dump_int(hash_prime);
3750   dump_int(hyphen_prime);   /* bkph */
3751
3752   dump_int(pool_ptr);
3753   dump_int(str_ptr);
3754
3755   if (dumpthings(str_start[0], str_ptr + 1))
3756     return;
3757
3758   if (dumpthings(str_pool[0], pool_ptr))
3759     return;
3760
3761   print_ln();
3762   print_int(str_ptr);
3763   print_string(" strings of total length ");
3764   print_int(pool_ptr);
3765
3766   sort_avail();
3767   var_used = 0;
3768   dump_int(lo_mem_max);
3769   dump_int(rover);
3770   p = 0;
3771   q = rover;
3772   x = 0;
3773
3774   do
3775     {
3776       if (dumpthings(mem[p], q + 2 - p))
3777         return;
3778
3779       x = x + q + 2 - p;
3780       var_used = var_used + q - p;
3781       p = q + mem[q].hh.v.LH;
3782       q = mem[q + 1].hh.v.RH;
3783     }
3784   while (!(q == rover));
3785
3786   var_used = var_used + lo_mem_max - p;
3787   dyn_used = mem_end + 1 - hi_mem_min;
3788
3789   if (dumpthings(mem[p], lo_mem_max + 1 - p))
3790     return;
3791
3792   x = x + lo_mem_max + 1 - p;
3793   dump_int(hi_mem_min);
3794   dump_int(avail);
3795
3796   if (dumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
3797     return;
3798
3799   x = x + mem_end + 1 - hi_mem_min;
3800   p = avail;
3801
3802   while (p != 0)
3803   {
3804     decr(dyn_used);
3805     p = mem[p].hh.v.RH;
3806   }
3807
3808   dump_int(var_used);
3809   dump_int(dyn_used);
3810   print_ln();
3811   print_int(x);
3812   print_string(" memory locations dumped; current usage is ");
3813   print_int(var_used);
3814   print_char('&');
3815   print_int(dyn_used);
3816
3817   k = active_base;
3818   do
3819     {
3820       j = k;
3821
3822       while (j < (int_base - 1))
3823       {
3824         if ((equiv(j) == equiv(j + 1)) &&
3825           (eq_type(j) == eq_type(j + 1)) &&
3826           (eq_level(j) == eq_level(j + 1)))
3827           goto lab41;
3828         incr(j);
3829       }
3830
3831       l = (int_base);
3832       goto lab31;
3833 lab41:
3834       incr(j);
3835       l = j;
3836       while (j < (int_base - 1)) {
3837         if ((equiv(j) != equiv(j + 1)) ||
3838           (eq_type(j) != eq_type(j + 1)) ||
3839           (eq_level(j) != eq_level(j + 1)))
3840           goto lab31;
3841         incr(j);
3842       }
3843 lab31:
3844       dump_int(l - k);
3845
3846       if (dumpthings(eqtb[k], l - k))
3847         return;
3848
3849       k = j + 1;
3850       dump_int(k - l);
3851     }
3852   while (!(k == (int_base)));
3853
3854   do {
3855     j = k;
3856     while (j < (eqtb_size)) {
3857       if (eqtb[j].cint == eqtb[j + 1].cint)
3858         goto lab42;
3859       incr(j);
3860     }
3861     l = (eqtb_size + 1);
3862     goto lab32;
3863 lab42:
3864     incr(j);
3865     l = j;
3866     while (j < (eqtb_size)) {
3867       if (eqtb[j].cint != eqtb[j + 1].cint)
3868         goto lab32;
3869       incr(j);
3870     }
3871 lab32:
3872     dump_int(l - k);
3873     if (dumpthings(eqtb[k], l - k))
3874       return;
3875     k = j + 1;
3876     dump_int(k - l);
3877   } while (!(k > (eqtb_size)));
3878
3879   dump_int(par_loc);
3880   dump_int(write_loc);
3881
3882   dump_int(hash_used);
3883   cs_count = frozen_control_sequence - 1 - hash_used;
3884
3885   if (trace_flag)
3886   {
3887     sprintf(log_line, "itex cs_count %d hash_size %d hash_extra %d hash_used %d",
3888         cs_count, hash_size, hash_extra, hash_used);
3889     show_line(log_line, 0);
3890   }
3891
3892   for (p = hash_base; p <= hash_used; p++)
3893   {
3894     if (hash[p].v.RH != 0)
3895     {
3896       dump_int(p);
3897       dump_hh(hash[p]);
3898       incr(cs_count);
3899
3900       if (trace_flag)
3901       {
3902         sprintf(log_line, "itex cs_count++ ");
3903         show_line(log_line, 0); /* debugging */
3904       }
3905
3906     }
3907   }
3908 /*  ??? */
3909 /* for p <- hash_used+1 to undefined_control_sequence-1 do dump_hh(hash[p]) */
3910   if (dumpthings(hash[hash_used + 1], (hash_size + 780) - hash_used))
3911     return;
3912
3913   dump_int(cs_count);
3914   print_ln();
3915   print_int(cs_count);
3916   print_string(" multiletter control sequences");
3917
3918   dump_int(fmem_ptr);
3919   {
3920     if (dumpthings(font_info[0], fmem_ptr))
3921       return;
3922
3923     dump_int(font_ptr);
3924
3925     if (dumpthings(font_check[0], font_ptr + 1))
3926       return;
3927
3928     if (dumpthings(font_size[0], font_ptr + 1))
3929       return;
3930
3931     if (dumpthings(font_dsize[0], font_ptr + 1))
3932       return;
3933
3934     if (dumpthings(font_params[0], font_ptr + 1))
3935       return;
3936
3937     if (dumpthings(hyphen_char[0], font_ptr + 1))
3938       return;
3939
3940     if (dumpthings(skew_char[0], font_ptr + 1))
3941       return;
3942
3943     if (dumpthings(font_name[0], font_ptr + 1))
3944       return;
3945
3946     if (dumpthings(font_area[0], font_ptr + 1))
3947       return;
3948
3949     if (dumpthings(font_bc[0], font_ptr + 1))
3950       return;
3951
3952     if (dumpthings(font_ec[0], font_ptr + 1))
3953       return;
3954
3955     if (dumpthings(char_base[0], font_ptr + 1))
3956       return;
3957
3958     if (dumpthings(width_base[0], font_ptr + 1))
3959       return;
3960
3961     if (dumpthings(height_base[0], font_ptr + 1))
3962       return;
3963
3964     if (dumpthings(depth_base[0], font_ptr + 1))
3965       return;
3966
3967     if (dumpthings(italic_base[0], font_ptr + 1))
3968       return;
3969
3970     if (dumpthings(lig_kern_base[0], font_ptr + 1))
3971       return;
3972
3973     if (dumpthings(kern_base[0], font_ptr + 1))
3974       return;
3975
3976     if (dumpthings(exten_base[0], font_ptr + 1))
3977       return;
3978
3979     if (dumpthings(param_base[0], font_ptr + 1))
3980       return;
3981
3982     if (dumpthings(font_glue[0], font_ptr + 1))
3983       return;
3984
3985     if (dumpthings(bchar_label[0], font_ptr + 1))
3986       return;
3987
3988     if (dumpthings(font_bchar[0], font_ptr + 1))
3989       return;
3990
3991     if (dumpthings(font_false_bchar[0], font_ptr + 1))
3992       return;
3993
3994     for (k = 0; k <= font_ptr; k++)
3995     {
3996       print_nl("\\font");
3997 /*  print_esc(hash[(hash_size + 524) + k].v.RH);  */
3998 /*  print_esc(hash[(hash_size + hash_extra + 524) + k].v.RH); */
3999       print_esc("");print(hash[(hash_size + hash_extra + 524) + k].v.RH);
4000       print_char('=');
4001       print_file_name(font_name[k], font_area[k], 335);
4002
4003       if (font_size[k] != font_dsize[k])
4004       {
4005         print_string(" at ");
4006         print_scaled(font_size[k]);
4007         print_string("pt");
4008       }
4009     }
4010   }
4011
4012   print_ln();
4013   print_int(fmem_ptr - 7);
4014   print_string(" words of font info for ");
4015   print_int(font_ptr - 0);
4016   print_string(" preloaded font");
4017
4018   if (font_ptr != 1)
4019     print_char('s');
4020
4021   dump_int(hyph_count);
4022
4023   for (k = 0; k <= hyphen_prime; k++)
4024   {
4025     if (hyph_word[k]!= 0)
4026     {
4027       dump_int(k);
4028       dump_int(hyph_word[k]);
4029       dump_int(hyph_list[k]);
4030     }
4031   }
4032
4033   print_ln();
4034   print_int(hyph_count);
4035   print_string(" hyphenation exception");
4036
4037   if (hyph_count != 1)
4038     print_char('s');
4039
4040   if (trie_not_ready)
4041     init_trie();
4042
4043   dump_int(trie_max);
4044
4045   if (dumpthings(trie_trl[0], trie_max + 1))
4046     return;
4047
4048   if (dumpthings(trie_tro[0], trie_max + 1))
4049     return;
4050
4051   if (dumpthings(trie_trc[0], trie_max + 1))
4052     return;
4053
4054   dump_int(trie_op_ptr);
4055
4056   if (dumpthings(hyf_distance[1], trie_op_ptr))
4057     return;
4058
4059   if (dumpthings(hyf_num[1], trie_op_ptr))
4060     return;
4061
4062   if (dumpthings(hyf_next[1], trie_op_ptr))
4063     return;
4064
4065   print_nl("Hyphenation trie of length ");
4066   print_int(trie_max);
4067   print_string(" has ");
4068   print_int(trie_op_ptr);
4069   print_string(" op");
4070
4071   if (trie_op_ptr != 1)
4072     print_char('s');
4073
4074   print_string(" out of ");
4075   print_int(trie_op_size);
4076
4077   for (k = 255; k >= 0; k--)
4078   {
4079     if (trie_used[k] > 0)
4080     {
4081       print_nl("  ");
4082       print_int(trie_used[k]);
4083       print_string(" for language ");
4084       print_int(k);
4085       dump_int(k);
4086       dump_int(trie_used[k]);
4087     }
4088   }
4089   dump_int(interaction);
4090   dump_int(format_ident);
4091   dump_int(ENDFMTCHECKSUM); /* magic checksum end of FMT file --- change ??? */ 
4092   tracing_stats = 0;
4093
4094   w_close(fmt_file);
4095 }
4096 #endif /* INITEX */
4097
4098 #ifdef INITEX
4099 /* sec 01336 */
4100 void init_prim (void)
4101 {
4102   no_new_control_sequence = false;
4103   primitive("lineskip", assign_glue, glue_base + line_skip_code);
4104   primitive("baselineskip", assign_glue, glue_base + baseline_skip_code);
4105   primitive("parskip", assign_glue, glue_base + par_skip_code);
4106   primitive("abovedisplayskip", assign_glue, glue_base + above_display_skip_code);
4107   primitive("belowdisplayskip", assign_glue, glue_base + below_display_skip_code);
4108   primitive("abovedisplayshortskip", assign_glue, glue_base + above_display_short_skip_code);
4109   primitive("belowdisplayshortskip", assign_glue, glue_base + below_display_short_skip_code);
4110   primitive("leftskip", assign_glue, glue_base + left_skip_code);
4111   primitive("rightskip", assign_glue, glue_base + right_skip_code);
4112   primitive("topskip", assign_glue, glue_base + top_skip_code);
4113   primitive("splittopskip", assign_glue, glue_base + split_top_skip_code);
4114   primitive("tabskip", assign_glue, glue_base + tab_skip_code);
4115   primitive("spaceskip", assign_glue, glue_base + space_skip_code);
4116   primitive("xspaceskip", assign_glue, glue_base + xspace_skip_code);
4117   primitive("parfillskip", assign_glue, glue_base + par_fill_skip_code);
4118   primitive("thinmuskip", assign_mu_glue, glue_base + thin_mu_skip_code);
4119   primitive("medmuskip", assign_mu_glue, glue_base + med_mu_skip_code);
4120   primitive("thickmuskip", assign_mu_glue, glue_base + thick_mu_skip_code);
4121   primitive("output", assign_toks, output_routine_loc);
4122   primitive("everypar", assign_toks, every_par_loc);
4123   primitive("everymath", assign_toks, every_math_loc);
4124   primitive("everydisplay", assign_toks, every_display_loc);
4125   primitive("everyhbox", assign_toks, every_hbox_loc);
4126   primitive("everyvbox", assign_toks, every_vbox_loc);
4127   primitive("everyjob", assign_toks, every_job_loc);
4128   primitive("everycr", assign_toks, every_cr_loc);
4129   primitive("errhelp", assign_toks, err_help_loc);
4130   primitive("pretolerance", assign_int, int_base + pretolerance_code);
4131   primitive("tolerance", assign_int, int_base + tolerance_code);
4132   primitive("linepenalty", assign_int, int_base + line_penalty_code);
4133   primitive("hyphenpenalty", assign_int, int_base + hyphen_penalty_code);
4134   primitive("exhyphenpenalty", assign_int, int_base + ex_hyphen_penalty_code);
4135   primitive("clubpenalty", assign_int, int_base + club_penalty_code);
4136   primitive("widowpenalty", assign_int, int_base + widow_penalty_code);
4137   primitive("displaywidowpenalty", assign_int, int_base + display_widow_penalty_code);
4138   primitive("brokenpenalty", assign_int, int_base + broken_penalty_code);
4139   primitive("binoppenalty", assign_int, int_base + bin_op_penalty_code);
4140   primitive("relpenalty", assign_int, int_base + rel_penalty_code);
4141   primitive("predisplaypenalty", assign_int, int_base + pre_display_penalty_code);
4142   primitive("postdisplaypenalty", assign_int, int_base + post_display_penalty_code);
4143   primitive("interlinepenalty", assign_int, int_base + inter_line_penalty_code);
4144   primitive("doublehyphendemerits", assign_int, int_base + double_hyphen_demerits_code);
4145   primitive("finalhyphendemerits", assign_int, int_base + final_hyphen_demerits_code);
4146   primitive("adjdemerits", assign_int, int_base + adj_demerits_code);
4147   primitive("mag", assign_int, int_base + mag_code);
4148   primitive("delimiterfactor", assign_int, int_base + delimiter_factor_code);
4149   primitive("looseness", assign_int, int_base + looseness_code);
4150   primitive("time", assign_int, int_base + time_code);
4151   primitive("day", assign_int, int_base + day_code);
4152   primitive("month", assign_int, int_base + month_code);
4153   primitive("year", assign_int, int_base + year_code);
4154   primitive("showboxbreadth", assign_int, int_base + show_box_breadth_code);
4155   primitive("showboxdepth", assign_int, int_base + show_box_depth_code);
4156   primitive("hbadness", assign_int, int_base + hbadness_code);
4157   primitive("vbadness", assign_int, int_base + vbadness_code);
4158   primitive("pausing", assign_int, int_base + pausing_code);
4159   primitive("tracingonline", assign_int, int_base + tracing_online_code);
4160   primitive("tracingmacros", assign_int, int_base + tracing_macros_code);
4161   primitive("tracingstats", assign_int, int_base + tracing_stats_code);
4162   primitive("tracingparagraphs", assign_int, int_base + tracing_paragraphs_code);
4163   primitive("tracingpages", assign_int, int_base + tracing_pages_code);
4164   primitive("tracingoutput", assign_int, int_base + tracing_output_code);
4165   primitive("tracinglostchars", assign_int, int_base + tracing_lost_chars_code);
4166   primitive("tracingcommands", assign_int, int_base + tracing_commands_code);
4167   primitive("tracingrestores", assign_int, int_base + tracing_restores_code);
4168   primitive("uchyph", assign_int, int_base + uc_hyph_code);
4169   primitive("outputpenalty", assign_int, int_base + output_penalty_code);
4170   primitive("maxdeadcycles", assign_int, int_base + max_dead_cycles_code);
4171   primitive("hangafter", assign_int, int_base + hang_after_code);
4172   primitive("floatingpenalty", assign_int, int_base + floating_penalty_code);
4173   primitive("globaldefs", assign_int, int_base + global_defs_code);
4174   primitive("fam", assign_int, int_base + cur_fam_code);
4175   primitive("escapechar", assign_int, int_base + escape_char_code);
4176   primitive("defaulthyphenchar", assign_int, int_base + default_hyphen_char_code);
4177   primitive("defaultskewchar", assign_int, int_base + default_skew_char_code);
4178   primitive("endlinechar", assign_int, int_base + end_line_char_code);
4179   primitive("newlinechar", assign_int, int_base + new_line_char_code);
4180   primitive("language", assign_int, int_base + language_code);
4181   primitive("lefthyphenmin", assign_int, int_base + left_hyphen_min_code);
4182   primitive("righthyphenmin", assign_int, int_base + right_hyphen_min_code);
4183   primitive("holdinginserts", assign_int, int_base + holding_inserts_code);
4184   primitive("errorcontextlines", assign_int, int_base + error_context_lines_code);
4185   primitive("parindent", assign_dimen, dimen_base + par_indent_code);
4186   primitive("mathsurround", assign_dimen, dimen_base + math_surround_code);
4187   primitive("lineskiplimit", assign_dimen, dimen_base + line_skip_limit_code);
4188   primitive("hsize", assign_dimen, dimen_base + hsize_code);
4189   primitive("vsize", assign_dimen, dimen_base + vsize_code);
4190   primitive("maxdepth", assign_dimen, dimen_base + max_depth_code);
4191   primitive("splitmaxdepth", assign_dimen, dimen_base + split_max_depth_code);
4192   primitive("boxmaxdepth", assign_dimen, dimen_base + box_max_depth_code);
4193   primitive("hfuzz", assign_dimen, dimen_base + hfuzz_code);
4194   primitive("vfuzz", assign_dimen, dimen_base + vfuzz_code);
4195   primitive("delimitershortfall", assign_dimen, dimen_base + delimiter_shortfall_code);
4196   primitive("nulldelimiterspace", assign_dimen, dimen_base + null_delimiter_space_code);
4197   primitive("scriptspace", assign_dimen, dimen_base + script_space_code);
4198   primitive("predisplaysize", assign_dimen, dimen_base + pre_display_size_code);
4199   primitive("displaywidth", assign_dimen, dimen_base + display_width_code);
4200   primitive("displayindent", assign_dimen, dimen_base + display_indent_code);
4201   primitive("overfullrule", assign_dimen, dimen_base + overfull_rule_code);
4202   primitive("hangindent", assign_dimen, dimen_base + hang_indent_code);
4203   primitive("hoffset", assign_dimen, dimen_base + h_offset_code);
4204   primitive("voffset", assign_dimen, dimen_base + v_offset_code);
4205   primitive("emergencystretch", assign_dimen, dimen_base + emergency_stretch_code);
4206   primitive(" ", ex_space, 0);
4207   primitive("/", ital_corr, 0);
4208   primitive("accent", accent, 0);
4209   primitive("advance", advance, 0);
4210   primitive("afterassignment", after_assignment, 0);
4211   primitive("aftergroup", after_group, 0);
4212   primitive("begingroup", begin_group, 0);
4213   primitive("char", char_num, 0);
4214   primitive("csname", cs_name, 0);
4215   primitive("delimiter", delim_num, 0);
4216   primitive("divide", divide, 0);
4217   primitive("endcsname", end_cs_name, 0);
4218   primitive("endgroup", end_group, 0);
4219   text(frozen_end_group) = make_string_pool("endgroup");
4220   eqtb[frozen_end_group] = eqtb[cur_val]; 
4221   primitive("expandafter", expand_after, 0);
4222   primitive("font", def_font, 0);
4223   primitive("fontdimen", assign_font_dimen, 0);
4224   primitive("halign", halign, 0);
4225   primitive("hrule", hrule, 0);
4226   primitive("ignorespaces", ignore_spaces, 0);
4227   primitive("insert", insert, 0);
4228   primitive("mark", mark, 0);
4229   primitive("mathaccent", math_accent, 0);
4230   primitive("mathchar", math_char_num, 0);
4231   primitive("mathchoice", math_choice, 0);
4232   primitive("multiply", multiply, 0);
4233   primitive("noalign", no_align, 0);
4234   primitive("noboundary", no_boundary, 0);
4235   primitive("noexpand", no_expand, 0);
4236   primitive("nonscript", non_script, 0);
4237   primitive("omit", omit, 0);
4238   primitive("parshape", set_shape, 0);
4239   primitive("penalty", break_penalty, 0);
4240   primitive("prevgraf", set_prev_graf, 0);
4241   primitive("radical", radical, 0);
4242   primitive("read", read_to_cs, 0);
4243   primitive("relax", relax, 256);
4244   text(frozen_relax) = make_string_pool("relax");
4245   eqtb[frozen_relax] = eqtb[cur_val];
4246   primitive("setbox", set_box, 0);
4247   primitive("the", the, 0);
4248   primitive("toks", toks_register, 0);
4249   primitive("vadjust", vadjust, 0);
4250   primitive("valign", valign, 0);
4251   primitive("vcenter", vcenter, 0);
4252   primitive("vrule", vrule, 0);
4253   primitive("par", par_end, 256);
4254   par_loc = cur_val; 
4255   par_token = cs_token_flag + par_loc;
4256   primitive("input", input, 0);
4257   primitive("endinput", input, 1);
4258   primitive("topmark", top_bot_mark, 0);
4259   primitive("firstmark", top_bot_mark, 1);
4260   primitive("botmark", top_bot_mark, 2);
4261   primitive("splitfirstmark", top_bot_mark, 3);
4262   primitive("splitbotmark", top_bot_mark, 4);
4263   primitive("count", tex_register, 0);
4264   primitive("dimen", tex_register, 1);
4265   primitive("skip", tex_register, 2);
4266   primitive("muskip", tex_register, 3);
4267   primitive("spacefactor", set_aux, 102);
4268   primitive("prevdepth", set_aux, 1);
4269   primitive("deadcycles", set_page_int, 0);
4270   primitive("insertpenalties", set_page_int, 1);
4271   primitive("wd", set_box_dimen, 1);
4272   primitive("ht", set_box_dimen, 3);
4273   primitive("dp", set_box_dimen, 2);
4274   primitive("lastpenalty", last_item, 0);
4275   primitive("lastkern", last_item, 1);
4276   primitive("lastskip", last_item, 2);
4277   primitive("inputlineno", last_item, 3);
4278   primitive("badness", last_item, 4);
4279   primitive("number", convert, 0);
4280   primitive("romannumeral", convert, 1);
4281   primitive("string", convert, 2);
4282   primitive("meaning", convert, 3);
4283   primitive("fontname", convert, 4);
4284   primitive("jobname", convert, 5);
4285   primitive("if", if_test, 0);
4286   primitive("ifcat", if_test, 1);
4287   primitive("ifnum", if_test, 2);
4288   primitive("ifdim", if_test, 3);
4289   primitive("ifodd", if_test, 4);
4290   primitive("ifvmode", if_test, 5);
4291   primitive("ifhmode", if_test, 6);
4292   primitive("ifmmode", if_test, 7);
4293   primitive("ifinner", if_test, 8);
4294   primitive("ifvoid", if_test, 9);
4295   primitive("ifhbox", if_test, 10);
4296   primitive("ifvbox", if_test, 11);
4297   primitive("ifx", if_test, 12);
4298   primitive("ifeof", if_test, 13);
4299   primitive("iftrue", if_test, 14);
4300   primitive("iffalse", if_test, 15);
4301   primitive("ifcase", if_test, 16);
4302   primitive("fi", fi_or_else, 2);
4303   text(frozen_fi) = make_string_pool("fi");
4304   eqtb[frozen_fi] = eqtb[cur_val];
4305   primitive("or", fi_or_else, 4);
4306   primitive("else", fi_or_else, 3);
4307   primitive("nullfont", set_font, 0);
4308   text(frozen_null_font) = 795;
4309   eqtb[frozen_null_font] = eqtb[cur_val];
4310   primitive("span", tab_mark, 256);
4311   primitive("cr", car_ret, 257);
4312   text(frozen_cr) = 893;    /* cr */
4313   eqtb[frozen_cr] = eqtb[cur_val];
4314   primitive("crcr", car_ret, 258);
4315   text(frozen_end_template) = 895; /* endtemplate */
4316   text(frozen_endv) = 895; /* endtemplate */
4317   eq_type(frozen_endv) = endv;
4318   equiv(frozen_endv) = null_list; 
4319   eq_level(frozen_endv) = level_one; 
4320   eqtb[frozen_end_template] = eqtb[frozen_endv]; 
4321   eq_type(frozen_end_template) = end_template;
4322   primitive("pagegoal", set_page_dimen, 0);
4323   primitive("pagetotal", set_page_dimen, 1);
4324   primitive("pagestretch", set_page_dimen, 2);
4325   primitive("pagefilstretch", set_page_dimen, 3);
4326   primitive("pagefillstretch", set_page_dimen, 4);
4327   primitive("pagefilllstretch", set_page_dimen, 5);
4328   primitive("pageshrink", set_page_dimen, 6);
4329   primitive("pagedepth", set_page_dimen, 7);
4330   primitive("end", end_match, 0);
4331   primitive("dump", stop, 1);
4332   primitive("hskip", hskip, 4);
4333   primitive("hfil", hskip, 0);
4334   primitive("hfill", hskip, 1);
4335   primitive("hss", hskip, 2);
4336   primitive("hfilneg", hskip, 3);
4337   primitive("vskip", vskip, 4);
4338   primitive("vfil", vskip, 0);
4339   primitive("vfill", vskip, 1);
4340   primitive("vss", vskip, 2);
4341   primitive("vfilneg", vskip, 3);
4342   primitive("mskip", mskip, 5);
4343   primitive("kern", kern, 1);
4344   primitive("mkern", mkern, 99);
4345   primitive("moveleft", hmove, 1);
4346   primitive("moveright", hmove, 0);
4347   primitive("raise", vmove, 1);
4348   primitive("lower", vmove, 0);
4349   primitive("box", make_box, 0);
4350   primitive("copy", make_box, 1);
4351   primitive("lastbox", make_box, 2);
4352   primitive("vsplit", make_box, 3);
4353   primitive("vtop", make_box, 4);
4354   primitive("vbox", make_box, 5);
4355   primitive("hbox", make_box, 106);
4356   primitive("shipout", leader_ship, 99);
4357   primitive("leaders", leader_ship, 100);
4358   primitive("cleaders", leader_ship, 101);
4359   primitive("xleaders", leader_ship, 102);
4360   primitive("indent", start_par, 1);
4361   primitive("noindent", start_par, 0);
4362   primitive("unpenalty", remove_item, 12);
4363   primitive("unkern", remove_item, 11);
4364   primitive("unskip", remove_item, 10);
4365   primitive("unhbox", un_hbox, 0);
4366   primitive("unhcopy", un_hbox, 1);
4367   primitive("unvbox", un_vbox, 0);
4368   primitive("unvcopy", un_vbox, 1);
4369   primitive("-", discretionary, 1);
4370   primitive("discretionary", discretionary, 0);
4371   primitive("eqno", eq_no, 0);
4372   primitive("leqno", eq_no, 1);
4373   primitive("mathord", math_comp, 16);
4374   primitive("mathop", math_comp, 17);
4375   primitive("mathbin", math_comp, 18);
4376   primitive("mathrel", math_comp, 19);
4377   primitive("mathopen", math_comp, 20);
4378   primitive("mathclose", math_comp, 21);
4379   primitive("mathpunct", math_comp, 22);
4380   primitive("mathinner", math_comp, 23);
4381   primitive("underline", math_comp, 26);
4382   primitive("overline", math_comp, 27);
4383   primitive("displaylimits", limit_switch, 0);
4384   primitive("limits", limit_switch, 1);
4385   primitive("nolimits", limit_switch, 2);
4386   primitive("displaystyle", math_style, 0);
4387   primitive("textstyle", math_style, 2);
4388   primitive("scriptstyle", math_style, 4);
4389   primitive("scriptscriptstyle", math_style, 6);
4390   primitive("above", above, 0);
4391   primitive("over", above, 1);
4392   primitive("atop", above, 2);
4393   primitive("abovewithdelims", above, 3);
4394   primitive("overwithdelims", above, 4);
4395   primitive("atopwithdelims", above, 5);
4396   primitive("left", left_right, 30);
4397   primitive("right", left_right, 31);
4398   text(frozen_right) = 871;    /* right */
4399   eqtb[frozen_right] = eqtb[cur_val]; 
4400   primitive("long", prefix, 1);
4401   primitive("outer", prefix, 2);
4402   primitive("global", prefix, 4);
4403   primitive("def", def, 0);
4404   primitive("gdef", def, 1);
4405   primitive("edef", def, 2);
4406   primitive("xdef", def, 3);
4407   primitive("let", let, 0);
4408   primitive("futurelet", let, 1);
4409   primitive("chardef", shorthand_def, 0);
4410   primitive("mathchardef", shorthand_def, 1);
4411   primitive("countdef", shorthand_def, 2);
4412   primitive("dimendef", shorthand_def, 3);
4413   primitive("skipdef", shorthand_def, 4);
4414   primitive("muskipdef", shorthand_def, 5);
4415   primitive("toksdef", shorthand_def, 6);
4416   primitive("catcode", def_code, (hash_size + 1883));
4417   primitive("mathcode", def_code, (hash_size + 2907));
4418   primitive("lccode", def_code, (hash_size + 2139));
4419   primitive("uccode", def_code, (hash_size + 2395));
4420   primitive("sfcode", def_code, (hash_size + 2651));
4421   primitive("delcode", def_code, (hash_size + 3474));
4422   primitive("textfont", def_family, (hash_size + 1835));
4423   primitive("scriptfont", def_family, (hash_size + 1851));
4424   primitive("scriptscriptfont", def_family, (hash_size + 1867));
4425   primitive("hyphenation", hyph_data, 0);
4426   primitive("patterns", hyph_data, 1);
4427   primitive("hyphenchar", assign_font_int, 0);
4428   primitive("skewchar", assign_font_int, 1);
4429   primitive("batchmode", set_interaction, 0);
4430   primitive("nonstopmode", set_interaction, 1);
4431   primitive("scrollmode", set_interaction, 2);
4432   primitive("errorstopmode", set_interaction, 3);
4433   primitive("openin", in_stream, 1);
4434   primitive("closein", in_stream, 0);
4435   primitive("message", message, 0);
4436   primitive("errmessage", message, 1);
4437   primitive("lowercase", case_shift, (hash_size + 2139));
4438   primitive("uppercase", case_shift, (hash_size + 2395));
4439   primitive("show", xray, 0);
4440   primitive("showbox", xray, 1);
4441   primitive("showthe", xray, 2);
4442   primitive("showlists", xray, 3);
4443   primitive("openout", extension, 0);
4444   primitive("write", extension, 1);
4445   write_loc = cur_val;
4446   primitive("closeout", extension, 2);
4447   primitive("special", extension, 3);
4448   primitive("immediate", extension, 4);
4449   primitive("setlanguage", extension, 5);
4450   no_new_control_sequence = true; 
4451 }
4452 #endif /* INITEX */
4453
4454 #pragma optimize("s", off) /* 96/Sep/12 */
4455 #pragma optimize("t", on)  /* 96/Sep/12 */