OSDN Git Service

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