OSDN Git Service

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