OSDN Git Service

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