OSDN Git Service

line_break & string pool.
[putex/putex.git] / src / texsourc / tex6.c
1 #ifdef _WINDOWS
2   #define NOCOMM
3   #define NOSOUND
4   #define NODRIVERS
5   #define STRICT
6   #pragma warning(disable:4115) // kill rpcasync.h complaint
7   #include <windows.h>
8   #define MYLIBAPI __declspec(dllexport)
9 #endif
10
11 #include "texwin.h"
12
13 #pragma warning(disable:4131) // old style declarator
14 #pragma warning(disable:4135) // conversion between different integral types 
15 #pragma warning(disable:4127) // conditional expression is constant
16
17 #include <setjmp.h>
18
19 #define EXTERN extern
20
21 #include "texd.h"
22
23 #pragma warning(disable:4244)       /* 96/Jan/10 */
24
25 /* sec 0785 */
26 void align_peek (void)
27 {
28 lab20:
29   align_state = 1000000L;
30
31   do
32     {
33       get_x_token();
34     }
35   while (!(cur_cmd != spacer));
36
37   if (cur_cmd == no_align)
38   {
39     scan_left_brace();
40
41     new_save_level(no_align_group);
42
43     if (mode == -1)
44       normal_paragraph();
45   }
46   else if (cur_cmd == right_brace)
47   {
48     fin_align();
49   }
50   else if ((cur_cmd == car_ret) && (cur_chr == cr_cr_code))
51     goto lab20;
52   else
53   {
54     init_row();
55     init_col();
56   }
57 }
58 /* used in itex.c only */
59 /* sec 0826 */
60 halfword finite_shrink_(halfword p)
61 {
62   halfword q;
63
64   if (no_shrink_error_yet)
65   {
66     no_shrink_error_yet = false;
67     print_err("Infinite glue shrinkage found in a paragraph");
68     help5("The paragraph just ended includes some glue that has",
69         "infinite shrinkability, e.g., `\\hskip 0pt minus 1fil'.",
70         "Such glue doesn't belong there---it allows a paragraph",
71         "of any length to fit on one line. But it's safe to proceed,",
72         "since the offensive shrinkability has been made finite.");
73     error();
74   }
75
76   q = new_spec(p);
77   shrink_order(q) = normal;
78   delete_glue_ref(p);
79   return q;
80 }
81 /* sec 0829 */
82 void try_break_ (integer pi, small_number breaktype)
83 {
84   halfword r;
85   halfword prevr;
86   halfword oldl;
87   bool nobreakyet;
88   halfword prevprevr;
89   halfword s;
90   halfword q;
91   halfword v;
92   integer t;
93   internal_font_number f;
94   halfword l;
95   bool noderstaysactive;
96   scaled linewidth;
97   char fitclass;
98   halfword b;       /* current badness */
99   integer d;
100   bool artificialdemerits;
101   halfword savelink;
102   scaled shortfall;
103
104   if (abs(pi)>= 10000)
105     if (pi > 0)
106       goto lab10;
107     else
108       pi = -10000;
109
110   nobreakyet = true;
111   prevr = active;
112   oldl = 0;
113   cur_active_width[1] = active_width[1];
114   cur_active_width[2] = active_width[2];
115   cur_active_width[3] = active_width[3];
116   cur_active_width[4] = active_width[4];
117   cur_active_width[5] = active_width[5];
118   cur_active_width[6] = active_width[6];
119   while (true)
120   {
121 lab22:
122     r = mem[prevr].hh.v.RH;
123     if (mem[r].hh.b0 == 2)
124     {
125       cur_active_width[1] = cur_active_width[1] + mem[r + 1].cint;
126       cur_active_width[2] = cur_active_width[2] + mem[r + 2].cint;
127       cur_active_width[3] = cur_active_width[3] + mem[r + 3].cint;
128       cur_active_width[4] = cur_active_width[4] + mem[r + 4].cint;
129       cur_active_width[5] = cur_active_width[5] + mem[r + 5].cint;
130       cur_active_width[6] = cur_active_width[6] + mem[r + 6].cint;
131       prevprevr = prevr;
132       prevr = r;
133       goto lab22;
134     }
135     {
136       l = mem[r + 1].hh.v.LH;
137       if (l > oldl)
138       {
139         if ((minimum_demerits < 1073741823L) &&  /* 2^30 - 1 */
140           ((oldl != easyline) || (r == active)))
141         {
142           if (nobreakyet)
143           {
144             nobreakyet = false;
145             break_width[1] = background[1];
146             break_width[2] = background[2];
147             break_width[3] = background[3];
148             break_width[4] = background[4];
149             break_width[5] = background[5];
150             break_width[6] = background[6];
151             s = cur_p;
152 /* if break_type>unhyphenated then if cur_p<>null then l.16451 */
153             if (breaktype > 0)
154               if (cur_p != 0)
155               {
156                 t = mem[cur_p].hh.b1;
157                 v = cur_p;
158                 s = mem[cur_p + 1].hh.v.RH;
159                 while (t > 0)
160                 {
161                   decr(t);
162                   v = mem[v].hh.v.RH;
163                   if ((v >= hi_mem_min))
164                   {
165                     f = mem[v].hh.b0;
166                     break_width[1] = break_width[1]- font_info[width_base[f]+ font_info[char_base[f]+ mem[v].hh.b1].qqqq.b0].cint;
167                   }
168                   else switch (mem[v].hh.b0)
169                   {
170                     case 6:
171                       {
172                         f = mem[v + 1].hh.b0;
173                         break_width[1] = break_width[1]- font_info[width_base[f]+ font_info[char_base[f]+ mem[v + 1].hh.b1].qqqq.b0].cint;
174                       }
175                       break;
176                     case 0:
177                     case 1:
178                     case 2:
179                     case 11:
180                       break_width[1] = break_width[1]- mem[v + 1].cint;
181                       break;
182                     default:
183                       {
184                         confusion("disc1");
185                         return;       // abort_flag set
186                       }
187                       break;
188                     }
189                   }
190                   while (s != 0)
191                   {  /* while s<>null do l.16453 */
192                     if ((s >= hi_mem_min))
193                     {
194                       f = mem[s].hh.b0;
195                       break_width[1] = break_width[1]+ font_info[width_base[f]+ font_info[char_base[f]+ mem[s].hh.b1].qqqq.b0].cint;
196                     }
197                     else switch(mem[s].hh.b0)
198                     {
199                       case 6:
200                         {
201                           f = mem[s + 1].hh.b0;
202                           break_width[1] = break_width[1]+ font_info[width_base[f]+ font_info[char_base[f]+ mem[s + 1].hh.b1].qqqq.b0].cint;
203                         }
204                         break;
205                       case 0:
206                       case 1:
207                       case 2:
208 /* didn't used to drop through to case 11 from case 2 in  3.141 */
209                       case 11:
210 /* used to be some extra code here in case 11 in 3.141 */
211                         break_width[1] = break_width[1]+ mem[s + 1].cint;
212                         break;
213                       default:
214                         {
215                           confusion("disc1");
216                           return;       // abort_flag set
217                         }
218                         break;
219                     }
220 /* used to be an increment t here in 3.141 */
221                     s = mem[s].hh.v.RH;
222                   }
223                   break_width[1] = break_width[1] + disc_width;
224 /* used to be a test on t here instead in 3.141 */
225                   if (mem[cur_p + 1].hh.v.RH == 0)
226                     s = mem[v].hh.v.RH;
227                 }
228                 while (s != 0)
229                 {
230                   if ((s >= hi_mem_min))
231                     goto lab30;
232                   switch(mem[s].hh.b0)
233                   {
234                     case 10:
235                       {
236                         v = mem[s + 1].hh.v.LH;
237                         break_width[1] = break_width[1] - mem[v + 1].cint;
238                         break_width[2 + mem[v].hh.b0] = break_width[2 + mem[v].hh.b0] - mem[v + 2].cint;
239                         break_width[6] = break_width[6] - mem[v + 3].cint;
240                       }
241                       break;
242                     case 12:
243                       ;
244                       break;
245                     case 9:
246 /* case 9 used to drop through to case 11 in 3.141 */
247                       break_width[1] = break_width[1] - mem[s + 1].cint;
248                       break;
249                     case 11:
250 /* changes here in nature of test since 3.141 */
251                       if (mem[s].hh.b1 != 1)
252                         goto lab30;
253                       else
254                         break_width[1] = break_width[1] - mem[s + 1].cint;
255                       break;
256                     default:
257                       goto lab30;
258                       break;
259                   }
260                   s = mem[s].hh.v.RH;
261                 }
262 lab30:          ;
263           }
264           if (mem[prevr].hh.b0 == 2)
265           {
266             mem[prevr + 1].cint = mem[prevr + 1].cint - cur_active_width[1] + break_width[1];
267             mem[prevr + 2].cint = mem[prevr + 2].cint - cur_active_width[2] + break_width[2];
268             mem[prevr + 3].cint = mem[prevr + 3].cint - cur_active_width[3] + break_width[3];
269             mem[prevr + 4].cint = mem[prevr + 4].cint - cur_active_width[4] + break_width[4];
270             mem[prevr + 5].cint = mem[prevr + 5].cint - cur_active_width[5] + break_width[5];
271             mem[prevr + 6].cint = mem[prevr + 6].cint - cur_active_width[6] + break_width[6];
272           }
273           else if (prevr == active)
274           {
275             active_width[1] = break_width[1];
276             active_width[2] = break_width[2];
277             active_width[3] = break_width[3];
278             active_width[4] = break_width[4];
279             active_width[5] = break_width[5];
280             active_width[6] = break_width[6];
281           }
282           else
283           {
284             q = get_node(7);
285             mem[q].hh.v.RH = r;
286             mem[q].hh.b0 = 2;
287             mem[q].hh.b1 = 0;
288             mem[q + 1].cint = break_width[1]- cur_active_width[1];
289             mem[q + 2].cint = break_width[2]- cur_active_width[2];
290             mem[q + 3].cint = break_width[3]- cur_active_width[3];
291             mem[q + 4].cint = break_width[4]- cur_active_width[4];
292             mem[q + 5].cint = break_width[5]- cur_active_width[5];
293             mem[q + 6].cint = break_width[6]- cur_active_width[6];
294             mem[prevr].hh.v.RH = q;
295             prevprevr = prevr;
296             prevr = q;
297           }
298           if (abs(adj_demerits) >= 1073741823L - minimum_demerits)
299             minimum_demerits = 1073741822L; /* 2^30 - 2 */
300           else
301             minimum_demerits = minimum_demerits + abs(adj_demerits);
302           {
303             register integer for_end;
304             fitclass = 0;
305             for_end = 3;
306             if (fitclass <= for_end) do
307             {
308               if (minimal_demerits[fitclass] <= minimum_demerits)
309               {
310                 q = get_node(2);
311                 mem[q].hh.v.RH = passive;
312                 passive = q;
313                 mem[q + 1].hh.v.RH = cur_p;
314 #ifdef STAT
315                 incr(pass_number);
316                 mem[q].hh.v.LH = pass_number;
317 #endif /* STAT */
318                 mem[q + 1].hh.v.LH = best_place[fitclass];
319                 q = get_node(3);
320                 mem[q + 1].hh.v.RH = passive;
321                 mem[q + 1].hh.v.LH = best_pl_line[fitclass] + 1;
322                 mem[q].hh.b1 = fitclass;
323                 mem[q].hh.b0 = breaktype;
324                 mem[q + 2].cint = minimal_demerits[fitclass];
325                 mem[q].hh.v.RH = r;
326                 mem[prevr].hh.v.RH = q;
327                 prevr = q;
328 #ifdef STAT
329                 if (tracing_paragraphs > 0)
330                 {
331                   print_nl("@@");
332                   print_int(mem[passive].hh.v.LH);
333                   print_string(": line ");
334                   print_int(mem[q + 1].hh.v.LH - 1);
335                   print_char('.');
336                   print_int(fitclass);
337                   if (breaktype == 1)
338                     print_char('-');
339                   print_string(" t=");
340                   print_int(mem[q + 2].cint);
341                   print_string(" -> @@");
342                   if (mem[passive + 1].hh.v.LH == 0)
343                     print_char('0');
344                   else
345                     print_int(mem[mem[passive + 1].hh.v.LH].hh.v.LH);
346                 }
347 #endif /* STAT */
348               }
349               minimal_demerits[fitclass] = 1073741823L; /* 2^30 - 1 */
350             }
351             while (fitclass++ < for_end);
352           }
353           minimum_demerits = 1073741823L; /* 2^30 - 1 */
354           if (r != active)
355           {
356             q = get_node(7);
357             mem[q].hh.v.RH = r;
358             mem[q].hh.b0 = 2;
359             mem[q].hh.b1 = 0;
360             mem[q + 1].cint = cur_active_width[1] - break_width[1];
361             mem[q + 2].cint = cur_active_width[2] - break_width[2];
362             mem[q + 3].cint = cur_active_width[3] - break_width[3];
363             mem[q + 4].cint = cur_active_width[4] - break_width[4];
364             mem[q + 5].cint = cur_active_width[5] - break_width[5];
365             mem[q + 6].cint = cur_active_width[6] - break_width[6];
366             mem[prevr].hh.v.RH = q;
367             prevprevr = prevr;
368             prevr = q;
369           }
370         }
371         if (r == active)
372           goto lab10;
373         if (l > easyline)
374         {
375           linewidth = second_width;
376           oldl = 262142L;       /* 2^18 - 2 ? */
377         }
378         else
379         {
380           oldl = l;
381           if (l > last_special_line)
382             linewidth = second_width;
383           else if (par_shape_ptr == 0)
384             linewidth = first_width;
385           else
386             linewidth = mem[par_shape_ptr + 2 * l].cint;
387         }
388       }
389     }
390     {
391       artificialdemerits = false;
392       shortfall = linewidth - cur_active_width[1];  /* linewidth may be ... */
393       if (shortfall > 0)
394         if ((cur_active_width[3]!= 0) || (cur_active_width[4]!= 0) || (cur_active_width[5]!= 0))
395         {
396           b = 0;
397           fitclass = 2;
398         }
399         else
400         {
401           if (shortfall > 7230584L)
402             if (cur_active_width[2]< 1663497L)
403             {
404               b = 10000;
405               fitclass = 0;
406               goto lab31;
407             }
408           b = badness(shortfall, cur_active_width[2]);
409           if (b > 12)
410             if (b > 99)
411               fitclass = 0;
412             else
413               fitclass = 1;
414           else
415             fitclass = 2;
416 lab31:
417           ;
418         }
419       else
420       {
421         if (- (integer) shortfall > cur_active_width[6])
422           b = 10001;
423         else
424           b = badness(- (integer) shortfall, cur_active_width[6]);
425         if (b > 12)
426           fitclass = 3;
427         else
428           fitclass = 2;
429       }
430       if ((b > 10000) || (pi == -10000))
431       {
432         if (final_pass && (minimum_demerits == 1073741823L) &&  /* 2^30 - 1 */
433             (mem[r].hh.v.RH == active) && (prevr == active))
434           artificialdemerits = true;
435         else if (b > threshold)
436           goto lab60;
437         noderstaysactive = false;
438       }
439       else
440       {
441         prevr = r;
442         if (b > threshold)
443           goto lab22;
444         noderstaysactive = true;
445       }
446       if (artificialdemerits)
447         d = 0;
448       else
449       {
450         d = line_penalty + b;
451         if (abs(d)>= 10000)
452           d = 100000000L;
453         else
454           d = d * d;
455         if (pi != 0)
456           if (pi > 0)
457             d = d + pi * pi;
458           else if (pi > -10000)
459             d = d - pi * pi;
460         if ((breaktype == 1) && (mem[r].hh.b0 == 1))
461           if (cur_p != 0)
462             d = d + double_hyphen_demerits;
463           else
464             d = d + final_hyphen_demerits;
465         if (abs(toint(fitclass)- toint(mem[r].hh.b1)) > 1)
466           d = d + adj_demerits;
467       }
468 #ifdef STAT
469       if (tracing_paragraphs > 0)
470       {
471         if (printed_node != cur_p)
472         {
473           print_nl("");
474           if (cur_p == 0)
475             short_display(mem[printed_node].hh.v.RH);
476           else
477           {
478             savelink = mem[cur_p].hh.v.RH;
479             mem[cur_p].hh.v.RH = 0;
480             print_nl("");
481             short_display(mem[printed_node].hh.v.RH);
482             mem[cur_p].hh.v.RH = savelink;
483           }
484           printed_node = cur_p;
485         }
486         print_nl("@");
487         if (cur_p == 0)
488           print_esc("par");
489         else if (mem[cur_p].hh.b0 != 10)
490         {
491           if (mem[cur_p].hh.b0 == 12)
492             print_esc("penalty");
493           else if (mem[cur_p].hh.b0 == 7)
494             print_esc("discretionary");
495           else if (mem[cur_p].hh.b0 == 11)
496             print_esc("kern");
497           else
498             print_esc("math");
499         }
500         print_string(" via @@");
501         if (mem[r + 1].hh.v.RH == 0)
502           print_char('0');
503         else
504           print_int(mem[mem[r + 1].hh.v.RH].hh.v.LH);
505         print_string(" b=");
506         if (b > 10000)
507           print_char('*');
508         else print_int(b);
509         print_string(" p=");
510         print_int(pi);
511         print_string(" d=");
512         if (artificialdemerits)
513           print_char('*');
514         else
515           print_int(d);
516       }
517 #endif /* STAT */
518       d = d + mem[r + 2].cint;
519       if (d <= minimal_demerits[fitclass])
520       {
521         minimal_demerits[fitclass] = d;
522         best_place[fitclass] = mem[r + 1].hh.v.RH;
523         best_pl_line[fitclass] = l;
524         if (d < minimum_demerits)
525           minimum_demerits = d;
526       }
527       if (noderstaysactive)
528         goto lab22;
529 lab60:
530       mem[prevr].hh.v.RH = mem[r].hh.v.RH;
531       free_node(r, 3);
532       if (prevr == active)
533       {
534         r = mem[active].hh.v.RH;
535         if (mem[r].hh.b0 == 2)
536         {
537           active_width[1] = active_width[1] + mem[r + 1].cint;
538           active_width[2] = active_width[2] + mem[r + 2].cint;
539           active_width[3] = active_width[3] + mem[r + 3].cint;
540           active_width[4] = active_width[4] + mem[r + 4].cint;
541           active_width[5] = active_width[5] + mem[r + 5].cint;
542           active_width[6] = active_width[6] + mem[r + 6].cint;
543           cur_active_width[1] = active_width[1];
544           cur_active_width[2] = active_width[2];
545           cur_active_width[3] = active_width[3];
546           cur_active_width[4] = active_width[4];
547           cur_active_width[5] = active_width[5];
548           cur_active_width[6] = active_width[6];
549           mem[active].hh.v.RH = mem[r].hh.v.RH;
550           free_node(r, 7);
551         }
552       }
553       else if (mem[prevr].hh.b0 == 2)
554       {
555         r = mem[prevr].hh.v.RH;
556         if (r == active)
557         {
558           cur_active_width[1] = cur_active_width[1] - mem[prevr + 1].cint;
559           cur_active_width[2] = cur_active_width[2] - mem[prevr + 2].cint;
560           cur_active_width[3] = cur_active_width[3] - mem[prevr + 3].cint;
561           cur_active_width[4] = cur_active_width[4] - mem[prevr + 4].cint;
562           cur_active_width[5] = cur_active_width[5] - mem[prevr + 5].cint;
563           cur_active_width[6] = cur_active_width[6] - mem[prevr + 6].cint;
564           mem[prevprevr].hh.v.RH = active; /* prevprevr may be used ... */
565           free_node(prevr, 7);
566           prevr = prevprevr;
567         }
568         else if (mem[r].hh.b0 == 2)
569         {
570           cur_active_width[1] = cur_active_width[1] + mem[r + 1].cint;
571           cur_active_width[2] = cur_active_width[2] + mem[r + 2].cint;
572           cur_active_width[3] = cur_active_width[3] + mem[r + 3].cint;
573           cur_active_width[4] = cur_active_width[4] + mem[r + 4].cint;
574           cur_active_width[5] = cur_active_width[5] + mem[r + 5].cint;
575           cur_active_width[6] = cur_active_width[6] + mem[r + 6].cint;
576           mem[prevr + 1].cint = mem[prevr + 1].cint + mem[r + 1].cint;
577           mem[prevr + 2].cint = mem[prevr + 2].cint + mem[r + 2].cint;
578           mem[prevr + 3].cint = mem[prevr + 3].cint + mem[r + 3].cint;
579           mem[prevr + 4].cint = mem[prevr + 4].cint + mem[r + 4].cint;
580           mem[prevr + 5].cint = mem[prevr + 5].cint + mem[r + 5].cint;
581           mem[prevr + 6].cint = mem[prevr + 6].cint + mem[r + 6].cint;
582           mem[prevr].hh.v.RH = mem[r].hh.v.RH;
583           free_node(r, 7);
584         }
585       }
586     }
587   }
588 lab10:
589   ;
590 #ifdef STAT
591   if (cur_p == printed_node)
592     if (cur_p != 0)
593       if (mem[cur_p].hh.b0 == 7)
594       {
595         t = mem[cur_p].hh.b1;
596         while (t > 0)
597         {
598           decr(t);
599           printed_node = mem[printed_node].hh.v.RH;
600         }
601       }
602 #endif /* STAT */
603 /*  must exit here, there are no internal return - except for confusion */
604 /*  savedbadness = b; */      /* 96/Feb/9 - for test in itex.c */
605 }
606 /* end of the old tex5.c here */
607 /* sec 0877 */
608 void post_line_break_(integer final_widow_penalty)
609 {
610   halfword q, r, s;
611   bool discbreak;
612   bool postdiscbreak;
613   scaled curwidth;
614   scaled curindent;
615   quarterword t;
616   integer pen;
617   halfword curline;
618
619   q = mem[best_bet + 1].hh.v.RH;
620   cur_p = 0;
621   do
622   {
623     r = q;
624     q = mem[q + 1].hh.v.LH;
625     mem[r + 1].hh.v.LH = cur_p;
626     cur_p = r;
627   }
628   while (!(q == 0));
629   curline = prev_graf + 1;
630   do
631   {
632     q = mem[cur_p + 1].hh.v.RH;
633     discbreak = false;
634     postdiscbreak = false;
635     if (q != 0)
636       if (mem[q].hh.b0 == 10)
637       {
638         delete_glue_ref(mem[q + 1].hh.v.LH);
639         mem[q + 1].hh.v.LH = eqtb[(hash_size + 790)].hh.v.RH;
640         mem[q].hh.b1 = 9;
641         incr(mem[eqtb[(hash_size + 790)].hh.v.RH].hh.v.RH);
642         goto lab30;
643       }
644       else
645       {
646         if (mem[q].hh.b0 == 7)
647         {
648           t = mem[q].hh.b1;
649           if (t == 0)
650             r = mem[q].hh.v.RH;
651           else
652           {
653             r = q;
654             while (t > 1)
655             {
656               r = mem[r].hh.v.RH;
657               decr(t);
658             }
659             s = mem[r].hh.v.RH;
660             r = mem[s].hh.v.RH;
661             mem[s].hh.v.RH = 0;
662             flush_node_list(mem[q].hh.v.RH);
663             mem[q].hh.b1 = 0;
664           }
665           if (mem[q + 1].hh.v.RH != 0)
666           {
667             s = mem[q + 1].hh.v.RH;
668             while (mem[s].hh.v.RH != 0)
669               s = mem[s].hh.v.RH;
670             mem[s].hh.v.RH = r;
671             r = mem[q + 1].hh.v.RH;
672             mem[q + 1].hh.v.RH = 0;
673             postdiscbreak = true;
674           }
675           if (mem[q + 1].hh.v.LH != 0)
676           {
677             s = mem[q + 1].hh.v.LH;
678             mem[q].hh.v.RH = s;
679             while (mem[s].hh.v.RH != 0)
680               s = mem[s].hh.v.RH;
681             mem[q + 1].hh.v.LH = 0;
682             q = s;
683           }
684           mem[q].hh.v.RH = r;
685           discbreak = true;
686         }
687         else if ((mem[q].hh.b0 == 9) || (mem[q].hh.b0 == 11))
688           mem[q + 1].cint = 0;
689       }
690     else
691     {
692       q = temp_head;
693       while (mem[q].hh.v.RH != 0)
694         q = mem[q].hh.v.RH;
695     }
696     r = new_param_glue(8);
697     mem[r].hh.v.RH = mem[q].hh.v.RH;
698     mem[q].hh.v.RH = r;
699     q = r;
700 lab30:
701     ;
702     r = mem[q].hh.v.RH;
703     mem[q].hh.v.RH = 0;
704     q = mem[temp_head].hh.v.RH;
705     mem[temp_head].hh.v.RH = r;
706     if (eqtb[(hash_size + 789)].hh.v.RH != 0)
707     {
708       r = new_param_glue(7);
709       mem[r].hh.v.RH = q;
710       q = r;
711     }
712     if (curline > last_special_line)
713     {
714       curwidth = second_width;
715       curindent = second_indent;
716     }
717     else if (par_shape_ptr == 0)
718     {
719       curwidth = first_width;
720       curindent = first_indent;
721     }
722     else
723     {
724       curwidth = mem[par_shape_ptr + 2 * curline].cint;
725       curindent = mem[par_shape_ptr + 2 * curline - 1].cint;
726     }
727     adjust_tail = adjust_head;
728     just_box = hpack(q, curwidth, 0);
729     mem[just_box + 4].cint = curindent;
730     append_to_vlist(just_box);
731 /* if adjust_head<>adjust_tail then l.17346 */
732     if (adjust_head != adjust_tail)
733     {
734       mem[tail].hh.v.RH = mem[adjust_head].hh.v.RH;
735       tail = adjust_tail;
736     }
737     adjust_tail = 0; /* adjust_tail:=null */
738     if (curline + 1 != best_line)
739     {
740       pen = inter_line_penalty;
741       if (curline == prev_graf + 1)
742         pen = pen + club_penalty;
743       if (curline + 2 == best_line)
744         pen = pen + final_widow_penalty;
745       if (discbreak)
746         pen = pen + broken_penalty;
747       if (pen != 0)
748       {
749         r = new_penalty(pen);
750         mem[tail].hh.v.RH = r;
751         tail = r;
752       }
753     }
754     incr(curline);
755     cur_p = mem[cur_p + 1].hh.v.LH;
756     if (cur_p != 0)
757       if (!postdiscbreak)
758       {
759         r = temp_head;
760         while (true)
761         {
762           q = mem[r].hh.v.RH;
763           if (q == mem[cur_p + 1].hh.v.RH)
764             goto lab31;
765           if ((q >= hi_mem_min))
766             goto lab31;
767           if ((mem[q].hh.b0 < 9))
768             goto lab31;
769 /* change in tests here from 3.141 != 1 instead of == 2 */
770           if (mem[q].hh.b0 == 11)
771             if (mem[q].hh.b1 != 1)
772               goto lab31;
773           r = q;
774         }
775 lab31:
776         if (r != temp_head)
777         {
778           mem[r].hh.v.RH = 0;
779           flush_node_list(mem[temp_head].hh.v.RH);
780           mem[temp_head].hh.v.RH = q;
781         }
782       }
783   }
784   while (!(cur_p == 0));
785   if ((curline != best_line) || (mem[temp_head].hh.v.RH != 0))
786   {
787     confusion("disc2");
788     return;       // abort_flag set
789   }
790   prev_graf = best_line - 1;
791 }
792 /* Reconstitute ligatures during hyphenation pass */
793 /* sec 0906 */
794 small_number reconstitute_(small_number j, small_number n, halfword bchar, halfword hchar)
795 {
796   register small_number Result;
797   halfword p;
798   halfword t;
799   ffourquarters q;
800   halfword currh;
801   halfword testchar;
802   scaled w;
803   font_index k;
804   hyphen_passed = 0;            /* paragraph 907 ? */
805   t = hold_head;
806   w = 0;
807   mem[hold_head].hh.v.RH = 0;
808   cur_l = hu[j];
809   cur_q = t;
810   if (j == 0)
811   {
812     ligature_present = init_lig;
813     p = init_list; 
814     if (ligature_present)
815       lft_hit = init_lft; 
816 /*   while p>null do l.17772 */
817 /*    while(p > 0){ */  /* NO! */
818     while(p != 0)
819     {          /* 94/Mar/22 BUG FIX */
820       {
821 /*    append_charnode_to_t(character(p)); */ 
822         mem[t].hh.v.RH = get_avail();
823         t = mem[t].hh.v.RH;
824         mem[t].hh.b0 = hf;
825         mem[t].hh.b1 = mem[p].hh.b1;
826       }
827       p = mem[p].hh.v.RH; /* p:=link(p); */
828     }
829   }
830   else if (cur_l < 256)
831   {
832     mem[t].hh.v.RH = get_avail();
833     t = mem[t].hh.v.RH;
834     mem[t].hh.b0 = hf;
835     mem[t].hh.b1 = cur_l;
836   }
837   lig_stack = 0;    /* lig_stack:=null; */
838   {
839     if (j < n)
840       cur_r = hu[j + 1];
841     else
842       cur_r = bchar;
843     if (odd(hyf[j]))
844       currh = hchar;
845     else
846       currh = 256; 
847   }
848 lab22:
849   if (cur_l == 256)   /* if cur_l = non_char then */
850   {
851     k = bchar_label[hf];    /* begin k:=bchar_label[hf]; */
852 /*  if k=non_address then goto done@+else q:=font_info[k].qqqq; l.17812 */
853 /*    if (k == font_mem_size) */
854     if (k == non_address)    /* i.e. 0 ---  96/Jan/15 */
855       goto lab30;
856     else
857       q = font_info[k].qqqq;
858   }
859   else
860   {
861     q = font_info[char_base[hf]+ cur_l].qqqq;
862     if (((q.b2) % 4)!= 1)
863       goto lab30;
864     k = lig_kern_base[hf] + q.b3;
865     q = font_info[k].qqqq;
866     if (q.b0 > 128)
867     {
868       k = lig_kern_base[hf]+ 256 * q.b2 + q.b3 + 32768L - 256 *(128);
869       q = font_info[k].qqqq;
870     }
871   }
872   if (currh < 256) /* if cur_rh < non_char then test_char:=cur_rh */
873     testchar = currh;
874   else
875     testchar = cur_r;  /* else test_char:=cur_r; l.17817 */
876 /* loop@+begin if next_char(q)=test_char then if skip_byte(q)<=stop_flag then */
877   while (true)
878   {
879     if (q.b1 == testchar)
880       if (q.b0 <= 128)
881         if (currh < 256)   /*  if cur_rh<non_char then */
882         {
883           hyphen_passed = j;
884           hchar = 256;
885           currh = 256;
886           goto lab22;     /* goto continue; */
887         }
888         else
889         {    /* else begin if hchar<non_char then if odd(hyf[j]) then */
890           if (hchar < 256)
891             if (odd(hyf[j]))
892             {
893               hyphen_passed = j;
894               hchar = 256;
895             }
896           if (q.b2 < 128)  /* if op_byte(q)<kern_flag then */
897           {
898 // @<Carry out a ligature replacement, updating the cursor structure
899 //  and possibly advancing~|j|; |goto continue| if the cursor doesn't
900 //  advance, otherwise |goto done|@>;  => l.17869
901             if (cur_l == 256)    /* begin if cur_l=non_char then lft_hit:=true; */
902               lft_hit = true;
903             if (j == n)
904               if (lig_stack == 0)/* if lig_stack=null ? */
905                 rt_hit = true;
906             {
907               if (interrupt != 0)
908               {
909                 pause_for_instructions();
910               }
911             }
912             switch(q.b2)  /* case op_byte(q) of */
913             {
914               case 1:
915               case 5:
916                 {
917                   cur_l = q.b3;
918                   ligature_present = true;
919                 }
920                 break;
921               case 2:
922               case 6:
923                 {
924                   cur_r = q.b3;
925 /*   if lig_stack>null then character(lig_stack):=cur_r */
926 /*      if (lig_stack > 0) */      /* 94/Mar/22 */
927                   if (lig_stack != 0)      /* line breaking?? */
928                     mem[lig_stack].hh.b1 = cur_r; /* l.17877 ? */
929                   else
930                   {
931                     lig_stack = new_lig_item(cur_r);
932                     if (j == n)
933                       bchar = 256;
934                     else
935                     {
936                       p = get_avail();
937                       mem[lig_stack + 1].hh.v.RH = p;
938                       mem[p].hh.b1 = hu[j + 1];
939                       mem[p].hh.b0 = hf;
940                     }
941                   }
942                 }
943                 break;
944               case 3:
945                 {
946                   cur_r = q.b3;
947                   p = lig_stack;
948                   lig_stack = new_lig_item(cur_r);
949                   mem[lig_stack].hh.v.RH = p;
950                 }
951                 break;
952               case 7:
953               case 11:
954                 {
955                   if (ligature_present)
956                   {
957                     p = new_ligature(hf, cur_l, mem[cur_q].hh.v.RH);
958                     if (lft_hit)
959                     {
960                       mem[p].hh.b1 = 2;
961                       lft_hit = false;
962                     }
963 /*        if (false)
964         if (lig_stack == 0){
965           incr(mem[p].hh.b1); 
966           rt_hit = false; 
967         } */              /* removed 99/Jan/6 */
968                     mem[cur_q].hh.v.RH = p;
969                     t = p;
970                     ligature_present = false;
971                   }
972                   cur_q = t;
973                   cur_l = q.b3;
974                   ligature_present = true;
975                 }
976                 break;
977               default:
978                 {
979 /* othercases begin cur_l:=rem_byte(q);
980     ligature_present:=true; {\.{=:}} l.17869 */
981                   cur_l = q.b3;
982                   ligature_present = true;
983 /*   if lig_stack>null then pop_lig_stack l.17870 => l.17828 */
984 /*      if (lig_stack > 0)*/       /* 94/Mar/22 ??? */
985                   if (lig_stack != 0)        /* BUG FIX  */
986                   {
987 /*        if (mem[lig_stack + 1].hh.v.RH > 0) */ /* 94/Mar/22  */
988                     if (mem[lig_stack + 1].hh.v.RH != 0) /* l.17828 ? */
989                     {
990                       mem[t].hh.v.RH = mem[lig_stack + 1].hh.v.RH;
991                       t = mem[t].hh.v.RH;
992                       incr(j);
993                     }
994                     p = lig_stack;
995                     lig_stack = mem[p].hh.v.RH;
996                     free_node(p, 2);
997                     if (lig_stack == 0)  /* if lig_stack=null ? */
998                     {
999                       if (j < n)
1000                         cur_r = hu[j + 1];
1001                       else
1002                         cur_r = bchar;
1003                       if (odd(hyf[j]))
1004                         currh = hchar;
1005                       else
1006                         currh = 256;
1007                     }
1008                     else
1009                       cur_r = mem[lig_stack].hh.b1;
1010                   }
1011                   else if (j == n)
1012                     goto lab30;
1013                   else
1014                   {
1015                     {
1016                       mem[t].hh.v.RH = get_avail();
1017                       t = mem[t].hh.v.RH;
1018                       mem[t].hh.b0 = hf;
1019                       mem[t].hh.b1 = cur_r;
1020                     }
1021                     incr(j);
1022                     {
1023                       if (j < n)
1024                         cur_r = hu[j + 1];
1025                       else
1026                         cur_r = bchar;
1027                       if (odd(hyf[j]))
1028                         currh = hchar;
1029                       else
1030                         currh = 256;
1031                     }
1032                   }
1033                 }
1034                 break;
1035             }
1036             if (q.b2 > 4)
1037               if (q.b2 != 7)
1038                 goto lab30;
1039             goto lab22;
1040           }
1041           w = font_info[kern_base[hf]+ 256 * q.b2 + q.b3].cint;
1042           goto lab30;
1043         }
1044     if (q.b0 >= 128)
1045       if (currh == 256)
1046         goto lab30;
1047       else
1048       {
1049         currh = 256;
1050         goto lab22;
1051       }
1052     k = k + q.b0 + 1;
1053     q = font_info[k].qqqq;
1054   }
1055 lab30:;
1056   if (ligature_present)
1057   {
1058     p = new_ligature(hf, cur_l, mem[cur_q].hh.v.RH);
1059     if (lft_hit)
1060     {
1061       mem[p].hh.b1 = 2;
1062       lft_hit = false;
1063     }
1064     if (rt_hit)
1065       if (lig_stack == 0)  /* if lig_stack=null ? */
1066       {
1067         incr(mem[p].hh.b1);
1068         rt_hit = false;
1069       }
1070     mem[cur_q].hh.v.RH = p;
1071     t = p;
1072     ligature_present = false;
1073   }
1074   if (w != 0)
1075   {
1076     mem[t].hh.v.RH = new_kern(w);
1077     t = mem[t].hh.v.RH;
1078     w = 0;
1079   }
1080 /*  if (lig_stack > 0)*/     /* 94/Mar/22 ??? l.17870 */
1081   if (lig_stack != 0)        /* l.17841 */
1082   {
1083 /* begin cur_q:=t; cur_l:=character(lig_stack);
1084   ligature_present:=true; l.17842 */
1085     cur_q = t;
1086     cur_l = mem[lig_stack].hh.b1;
1087     ligature_present = true;
1088     {
1089 /*   pop_lig_stack; goto continue; l.17843 => l.17828 */
1090 /*      if (mem[lig_stack + 1].hh.v.RH > 0) *//* 94/Mar/22 */
1091       if (mem[lig_stack + 1].hh.v.RH != 0) /* BUG FIX */
1092       {
1093         mem[t].hh.v.RH = mem[lig_stack + 1].hh.v.RH;
1094         t = mem[t].hh.v.RH;
1095         incr(j);
1096       }
1097       p = lig_stack;
1098       lig_stack = mem[p].hh.v.RH;
1099       free_node(p, 2);
1100       if (lig_stack == 0)
1101       {
1102         if (j < n)
1103           cur_r = hu[j + 1];
1104         else
1105           cur_r = bchar;
1106         if (odd(hyf[j]))
1107           currh = hchar;
1108         else
1109           currh = 256;
1110       }
1111       else
1112         cur_r = mem[lig_stack].hh.b1;
1113     }
1114     goto lab22;
1115   }
1116   Result = j;
1117   return Result;
1118 }
1119 /* #pragma optimize ("g", off) */ /* not needed for MSVC it seems ... */
1120 /* sec 0895 */
1121 void hyphenate (void)
1122 {
1123 /*  char i, j, l;  */
1124   char i, j;
1125   int l;              /* 95/Jan/7 */
1126   halfword q, r, s;
1127   halfword bchar;
1128   halfword majortail, minortail;
1129 /*  ASCII_code c;  */
1130   int c;              /* 95/Jan/7 */
1131   char cloc;
1132 /*  integer rcount; */
1133   int rcount;           /* 95/Jan/7 */
1134   halfword hyfnode;
1135   trie_pointer z;
1136   integer v;
1137   hyph_pointer h;
1138   str_number k;
1139   pool_pointer u;
1140
1141   for (j = 0; j <= hn; j++) hyf[j] = 0;
1142   h = hc[1];
1143   incr(hn);
1144   hc[hn] = cur_lang;
1145   for (j = 2; j <= hn; j++) h = (h + h + hc[j]) % hyphen_prime;
1146   while (true)
1147   {
1148     k = hyph_word[h];
1149     if (k == 0)
1150       goto lab45;
1151     if (length(k) < hn)
1152       goto lab45;
1153     if (length(k) == hn)
1154     {
1155       j = 1;
1156       u = str_start[k];
1157       do
1158       {
1159         if (str_pool[u] < hc[j])
1160           goto lab45;
1161         if (str_pool[u] > hc[j])
1162           goto lab30;
1163         incr(j);
1164         incr(u);
1165       }
1166       while(!(j > hn));
1167       s = hyph_list[h];
1168       while (s != 0)
1169       {  /* while s<>null do l.18173 */
1170         hyf[mem[s].hh.v.LH] = 1;
1171         s = mem[s].hh.v.RH;
1172       }
1173       decr(hn);
1174       goto lab40;
1175     }
1176 lab30:;
1177     if (h > 0)
1178       decr(h);
1179 /*    else h = 607;  */
1180     else
1181       h = hyphen_prime;
1182   }
1183 lab45:
1184   decr(hn);
1185   if (trie_trc[cur_lang + 1]!= cur_lang)
1186     return;
1187   hc[0] = 0;
1188   hc[hn + 1]= 0;
1189   hc[hn + 2]= 256;
1190   for (j = 0; j <= hn - rhyf + 1; j++)
1191   {
1192     z = trie_trl[cur_lang + 1] + hc[j];
1193     l = j;
1194     while (hc[l]== trie_trc[z])
1195     {
1196       if (trie_tro[z]!= min_trie_op)
1197       {
1198         v = trie_tro[z];
1199         do
1200         {
1201           v = v + op_start[cur_lang];
1202           i = l - hyf_distance[v];
1203           if (hyf_num[v] > hyf[i])
1204             hyf[i]= hyf_num[v];
1205           v = hyf_next[v];
1206         }
1207         while(!(v == min_trie_op));
1208       }
1209       incr(l);
1210       z = trie_trl[z]+ hc[l];
1211     }
1212   }
1213 lab40:
1214   for (j = 0; j <= lhyf - 1; j++)
1215     hyf[j] = 0;
1216   for (j = 0; j <= rhyf - 1; j++)
1217     hyf[hn - j]= 0;
1218   for (j = lhyf; j <= hn - rhyf; j++)
1219     if (odd(hyf[j]))
1220       goto lab41;
1221   return;
1222 lab41:;
1223   q = mem[hb].hh.v.RH;
1224   mem[hb].hh.v.RH = 0;
1225   r = mem[ha].hh.v.RH;
1226   mem[ha].hh.v.RH = 0;
1227   bchar = hyfbchar;
1228   if ((ha >= hi_mem_min))
1229     if (mem[ha].hh.b0 != hf)
1230       goto lab42;
1231     else
1232     {
1233       init_list = ha;
1234       init_lig = false;
1235       hu[0] = mem[ha].hh.b1;
1236     }
1237   else if (mem[ha].hh.b0 == 6)
1238     if (mem[ha + 1].hh.b0 != hf)
1239       goto lab42;
1240     else
1241     {
1242       init_list = mem[ha + 1].hh.v.RH;
1243       init_lig = true;
1244       init_lft = (mem[ha].hh.b1 > 1);
1245       hu[0] = mem[ha + 1].hh.b1;
1246       if (init_list == 0)
1247         if (init_lft)
1248         {
1249           hu[0]= 256;
1250           init_lig = false;
1251         }
1252       free_node(ha, 2);
1253     }
1254   else
1255   {
1256     if (!(r >= hi_mem_min))
1257       if (mem[r].hh.b0 == 6)
1258         if (mem[r].hh.b1 > 1)
1259           goto lab42;
1260     j = 1;
1261     s = ha;
1262     init_list = 0;
1263     goto lab50;
1264   }
1265   s = cur_p;
1266   while (mem[s].hh.v.RH != ha)
1267     s = mem[s].hh.v.RH;
1268   j = 0;
1269   goto lab50;
1270 lab42:
1271   s = ha;
1272   j = 0;
1273   hu[0] = 256;
1274   init_lig = false;
1275   init_list = 0;
1276 lab50:
1277   flush_node_list(r);
1278   do
1279   {
1280     l = j;
1281     j = reconstitute(j, hn, bchar, hyf_char) + 1;
1282     if (hyphen_passed == 0)
1283     {
1284       mem[s].hh.v.RH = mem[hold_head].hh.v.RH;
1285 /*    while(mem[s].hh.v.RH > 0)*/ /* 94/Mar/22 */
1286       while (link(s) != 0) /* l.17903 */
1287         s = link(s);
1288       if (odd(hyf[j - 1]))
1289       {
1290         l = j;
1291         hyphen_passed = j - 1;
1292         mem[hold_head].hh.v.RH = 0; /* link(hold_head):=null; */
1293       }
1294     }
1295     if (hyphen_passed > 0)
1296       do
1297       {
1298         r = get_node(2);
1299         mem[r].hh.v.RH = mem[hold_head].hh.v.RH;
1300         mem[r].hh.b0 = 7;
1301         majortail = r;
1302         rcount = 0;
1303 /* while link(major_tail) > null do advance_major_tail; l.17929 */
1304 /*      while(mem[majortail].hh.v.RH > 0) { */ /* 94/Mar/22 */
1305         while (mem[majortail].hh.v.RH != 0)
1306         {
1307           majortail = mem[majortail].hh.v.RH;
1308           incr(rcount);
1309         }
1310         i = hyphen_passed;
1311         hyf[i]= 0;
1312         minortail = 0;
1313         mem[r + 1].hh.v.LH = 0;
1314         hyfnode = new_character(hf, hyf_char);
1315         if (hyfnode != 0)
1316         {
1317           incr(i);
1318           c = hu[i];
1319           hu[i]= hyf_char;
1320           {
1321             mem[hyfnode].hh.v.RH = avail;
1322             avail = hyfnode;
1323 #ifdef STAT
1324             decr(dyn_used);
1325 #endif /* STAT */
1326           }
1327         }
1328         while (l <= i)
1329         {
1330           l = reconstitute(l, i, font_bchar[hf], 256) + 1;
1331 /*        if (mem[hold_head].hh.v.RH > 0)*/  /* 94/Mar/22 */
1332           if (mem[hold_head].hh.v.RH != 0) /* BUG FIX ??? */
1333           {
1334             if (minortail == 0) /* if minor_tail=null then */
1335               mem[r + 1].hh.v.LH = mem[hold_head].hh.v.RH;
1336             else
1337               mem[minortail].hh.v.RH = mem[hold_head].hh.v.RH;
1338             minortail = mem[hold_head].hh.v.RH;
1339 /*    while(mem[minortail].hh.v.RH > 0)*/ /* 94/Mar/22 */
1340             while (mem[minortail].hh.v.RH != 0)  /* BUG FIX */
1341               minortail = mem[minortail].hh.v.RH;
1342           }
1343         }
1344         if (hyfnode != 0) /* if hyf_node<>null then l.17956 */
1345         {
1346           hu[i]= c;
1347           l = i;
1348           decr(i);
1349         }
1350         minortail = 0;
1351         mem[r + 1].hh.v.RH = 0;
1352         cloc = 0;
1353 /* if bchar_label[hf]<non_address then l.17991 3.1415 */
1354 /*      if (bchar_label[hf]< font_mem_size) */
1355 /* if bchar_label[hf]<>non_address then l.17991 3.14159 */
1356         if (bchar_label[hf]!= non_address) /* i.e. 0 --- 96/Jan/15 */
1357         {
1358           decr(l);
1359           c = hu[l];
1360           cloc = l;
1361           hu[l]= 256;
1362         }
1363         while (l < j)
1364         {
1365           do
1366           {
1367             l = reconstitute(l, hn, bchar, 256) + 1;
1368             if (cloc > 0)
1369             {
1370               hu[cloc] = c;    /* c may be used ... */
1371               cloc = 0;
1372             }
1373 /*    if (mem[hold_head].hh.v.RH > 0)  */    /* 94/Mar/22 ??? */
1374             if (mem[hold_head].hh.v.RH != 0)     /* BUG FIX */
1375             {
1376               if (minortail == 0) /* begin if minor_tail=null then */
1377                 mem[r + 1].hh.v.RH = mem[hold_head].hh.v.RH;
1378               else
1379                 mem[minortail].hh.v.RH = mem[hold_head].hh.v.RH;
1380               minortail = mem[hold_head].hh.v.RH;
1381 /*     while link(minor_tail)>null do minor_tail:=link(minor_tail); l.17977 */
1382 /*      while(mem[minortail].hh.v.RH > 0)*/ /* 94/Mar/22 */
1383               while (mem[minortail].hh.v.RH != 0)    /* ??? */
1384                 minortail = mem[minortail].hh.v.RH;
1385             }
1386           }
1387           while (!(l >= j));
1388           while (l > j)
1389           {
1390             j = reconstitute(j, hn, bchar, 256) + 1;
1391             mem[majortail].hh.v.RH = mem[hold_head].hh.v.RH;
1392 /*          while (mem[majortail].hh.v.RH > 0) { */ /* 94/Mar/22 */
1393             while (mem[majortail].hh.v.RH != 0)
1394             {
1395               majortail = mem[majortail].hh.v.RH;
1396               incr(rcount);
1397             }
1398           }
1399         }
1400         if (rcount > 127)
1401         {
1402           mem[s].hh.v.RH = mem[r].hh.v.RH;
1403           mem[r].hh.v.RH = 0; /* link(r):=null */
1404           flush_node_list(r);
1405         }
1406         else
1407         {
1408           mem[s].hh.v.RH = r;
1409           mem[r].hh.b1 = rcount;
1410         }
1411         s = majortail;
1412         hyphen_passed = j - 1;
1413         mem[hold_head].hh.v.RH = 0;  /* link(hold_head):=null; */
1414       } while(!(! odd(hyf[j - 1])));
1415      } while(!(j > hn));
1416      mem[s].hh.v.RH = q;
1417      flush_list(init_list);
1418 }
1419 /* #pragma optimize ("g", off) */ /* not needed for MSVC it seems ... */
1420 /* used only in itex.c */
1421 /* sec 0934 */
1422 void new_hyph_exceptions (void)
1423 {
1424 /*  small_number n;  */ /* in 3.141 */
1425   char n;
1426 /*  small_number j;  */ /* in 3.141 */
1427   char j;
1428   hyph_pointer h;
1429   str_number k;
1430   halfword p;
1431   halfword q;
1432   str_number s, t;
1433   pool_pointer u, v;
1434   scan_left_brace();
1435   if (language <= 0)
1436     cur_lang = 0;
1437   else if (language > 255)
1438     cur_lang = 0;
1439   else
1440     cur_lang = language;
1441   n = 0;
1442   p = 0;
1443
1444   while (true)
1445   {
1446     get_x_token();
1447 lab21:
1448     switch (cur_cmd)
1449     {
1450       case 11:
1451       case 12:
1452       case 68:
1453         if (cur_chr == 45)
1454         {
1455           if (n < 63)
1456           {
1457             q = get_avail();
1458             mem[q].hh.v.RH = p;
1459             mem[q].hh.v.LH = n;
1460             p = q;
1461           }
1462         }
1463         else
1464         {
1465           if (eqtb[(hash_size + 2139) + cur_chr].hh.v.RH == 0)
1466           {
1467             print_err("Not a letter");
1468             help2("Letters in \\hyphenation words must have \\lccode>0.",
1469                 "Proceed; I'll ignore the character I just read.");
1470             error();
1471           }
1472           else if (n < 63)
1473           {
1474             incr(n);
1475             hc[n]= eqtb[(hash_size + 2139) + cur_chr].hh.v.RH;
1476           }
1477         }
1478         break;
1479       case 16:
1480         {
1481           scan_char_num();
1482           cur_chr = cur_val;
1483           cur_cmd = 68;
1484           goto lab21;
1485         }
1486         break;
1487       case 10:
1488       case 2:
1489         {
1490           if (n > 1)
1491           {
1492             incr(n);
1493             hc[n]= cur_lang;
1494             str_room(n);
1495             h = 0;
1496             for (j = 1; j <= n; j++)
1497             {
1498               h =(h + h + hc[j]) % hyphen_prime;
1499               {
1500                 str_pool[pool_ptr]= hc[j];
1501                 incr(pool_ptr);
1502               }
1503             }
1504             s = make_string();
1505 /*    if (hyph_count == 607)*/
1506             if (hyph_count == hyphen_prime)
1507             {
1508 /*      overflow(942, 607);  */
1509               overflow("exception dictionary", hyphen_prime); /* exception dictionary - NOT DYNAMIC */
1510 /*    not dynamic ---- but can be set -e=... from command line in ini-TeX */
1511               return;     // abort_flag set
1512             }
1513             incr(hyph_count);
1514             while (hyph_word[h]!= 0)
1515             {
1516               k = hyph_word[h];
1517               if (length(k) < length(s))
1518                 goto lab40;
1519               if (length(k) > length(s))
1520                 goto lab45;
1521               u = str_start[k];
1522               v = str_start[s];
1523               do
1524               {
1525                 if (str_pool[u] < str_pool[v])
1526                   goto lab40;
1527                 if (str_pool[u] > str_pool[v])
1528                   goto lab45;
1529                 incr(u);
1530                 incr(v);
1531               }
1532               while(!(u == str_start[k + 1]));
1533 lab40:
1534               q = hyph_list[h];
1535               hyph_list[h] = p;
1536               p = q;
1537               t = hyph_word[h];
1538               hyph_word[h] = s;
1539               s = t;
1540 lab45:;
1541               if (h > 0)
1542                 decr(h);
1543 /*      else h = 607;  */
1544               else
1545                 h = hyphen_prime;
1546             }
1547             hyph_word[h]= s;
1548             hyph_list[h]= p;
1549           }
1550           if (cur_cmd == 2)
1551             return;
1552           n = 0;
1553           p = 0;
1554         }
1555         break;
1556       default:
1557         {
1558           print_err("Improper ");
1559           print_esc("hyphenation");
1560           print_string("will be flushed");
1561           help2("Hyphenation exceptions must contain only letters",
1562               "and hyphens. But continue; I'll forgive and forget.");
1563           error();
1564         }
1565         break;
1566     } /* end of switch */
1567   }
1568 }
1569 /* sec 0968 */
1570 halfword prune_page_top_(halfword p)
1571 {
1572   register halfword Result;
1573   halfword prevp;
1574   halfword q;
1575
1576   prevp = temp_head;
1577   mem[temp_head].hh.v.RH = p;
1578 /* while p<>null do l.18803 */
1579   while(p != 0)
1580     switch(mem[p].hh.b0)
1581     {
1582       case 0:
1583       case 1:
1584       case 2:
1585         {
1586           q = new_skip_param(10);
1587           mem[prevp].hh.v.RH = q;
1588           mem[q].hh.v.RH = p;
1589           if (mem[temp_ptr + 1].cint > mem[p + 3].cint)
1590             mem[temp_ptr + 1].cint = mem[temp_ptr + 1].cint - mem[p + 3].cint;
1591           else
1592             mem[temp_ptr + 1].cint = 0;
1593           p = 0;  /* p:=null */
1594         }
1595         break;
1596       case 8:
1597       case 4:
1598       case 3:
1599         {
1600           prevp = p;
1601           p = mem[prevp].hh.v.RH;
1602         }
1603         break;
1604       case 10:
1605       case 11:
1606       case 12:
1607         {
1608           q = p;
1609           p = mem[q].hh.v.RH;
1610           mem[q].hh.v.RH = 0;
1611           mem[prevp].hh.v.RH = p;
1612           flush_node_list(q);
1613         }
1614         break;
1615       default:
1616         {
1617           confusion("pruning");
1618           return 0;       // abort_flag set
1619         }
1620         break;
1621     }
1622   Result = mem[temp_head].hh.v.RH;
1623   return Result;
1624 }
1625 /* sec 0970 */
1626 halfword vert_break_(halfword p, scaled h, scaled d)
1627 {
1628   register halfword Result;
1629   halfword prevp;
1630   halfword q, r;
1631   integer pi;
1632   integer b;
1633   integer leastcost;
1634   halfword best_place;
1635   scaled prevdp; 
1636 /*  small_number t;  */
1637   int t;              /* 95/Jan/7 */
1638   prevp = p;
1639
1640   leastcost = 1073741823L;  /* 2^30 - 1 */
1641   active_width[1] = 0;
1642   active_width[2] = 0;
1643   active_width[3] = 0;
1644   active_width[4] = 0;
1645   active_width[5] = 0;
1646   active_width[6] = 0;
1647   prevdp = 0;
1648   while (true)
1649   {
1650     if (p == 0)  /* if p=null l.18879 */
1651       pi = -10000;
1652     else switch(mem[p].hh.b0)
1653     {
1654       case 0:
1655       case 1:
1656       case 2:
1657         {
1658           active_width[1]= active_width[1]+ prevdp + mem[p + 3].cint;
1659           prevdp = mem[p + 2].cint;
1660           goto lab45;
1661         }
1662         break;
1663       case 8:
1664         goto lab45;
1665         break;
1666       case 10:
1667         if ((mem[prevp].hh.b0 < 9))
1668           pi = 0;
1669         else
1670           goto lab90;
1671         break;
1672       case 11:
1673         {
1674           if (mem[p].hh.v.RH == 0)/* if link(p)=null l.18903 */
1675             t = 12;
1676           else
1677             t = mem[mem[p].hh.v.RH].hh.b0;
1678           if (t == 10)
1679             pi = 0;
1680           else
1681             goto lab90;
1682         }
1683         break;
1684       case 12:
1685         pi = mem[p + 1].cint;
1686         break;
1687       case 4:
1688       case 3:
1689         goto lab45;
1690         break;
1691       default:
1692         {
1693           confusion("vertbreak");
1694           return 0;       // abort_flag set
1695         }
1696         break;
1697     }
1698     if (pi < 10000)      /* pi may be used ... */
1699     {
1700       if (active_width[1] < h)
1701         if ((active_width[3] != 0) || (active_width[4] != 0) || (active_width[5]!= 0))
1702           b = 0;
1703         else
1704           b = badness(h - active_width[1], active_width[2]);
1705       else if (active_width[1] - h > active_width[6])
1706         b = 1073741823L;  /* 2^30 - 1 */
1707       else
1708         b = badness(active_width[1] - h, active_width[6]);
1709       if (b < 1073741823L) /* 2^30 - 1 */
1710         if (pi <= -10000)
1711           b = pi;
1712         else if (b < 10000)
1713           b = b + pi;
1714         else
1715           b = 100000L;
1716       if (b <= leastcost)
1717       {
1718         best_place = p;
1719         leastcost = b;
1720         best_height_plus_depth = active_width[1]+ prevdp;
1721       }
1722       if ((b == 1073741823L) || (pi <= -10000))  /* 2^30 - 1 */
1723         goto lab30;
1724     }
1725     if ((mem[p].hh.b0 < 10) || (mem[p].hh.b0 > 11))
1726       goto lab45;
1727 lab90:
1728     if (mem[p].hh.b0 == 11)
1729       q = p;
1730     else
1731     {
1732       q = mem[p + 1].hh.v.LH;
1733       active_width[2 + mem[q].hh.b0] = active_width[2 + mem[q].hh.b0]+ mem[q + 2].cint;
1734       active_width[6] = active_width[6]+ mem[q + 3].cint;
1735       if ((mem[q].hh.b1 != 0)&&(mem[q + 3].cint != 0))
1736       {
1737         print_err("Infinite glue shrinkage found in box being split");
1738         help4("The box you are \\vsplitting contains some infinitely",
1739             "shrinkable glue, e.g., `\\vss' or `\\vskip 0pt minus 1fil'.",
1740             "Such glue doesn't belong there; but you can safely proceed,",
1741             "since the offensive shrinkability has been made finite.");
1742         error();
1743         r = new_spec(q);
1744         mem[r].hh.b1 = 0;
1745         delete_glue_ref(q);
1746         mem[p + 1].hh.v.LH = r;
1747         q = r;
1748       }
1749     }
1750     active_width[1] = active_width[1]+ prevdp + mem[q + 1].cint;
1751     prevdp = 0;
1752 lab45:
1753     if (prevdp > d)
1754     {
1755       active_width[1] = active_width[1]+ prevdp - d;
1756       prevdp = d;
1757     }
1758     prevp = p;
1759     p = mem[prevp].hh.v.RH;
1760   }
1761 lab30:
1762   Result = best_place; /* best_place may be used ... */
1763   return Result;
1764 }
1765 /* called only from tex7.c */
1766 /* sec 0977 */
1767 halfword vsplit_(eight_bits n, scaled h)
1768 {
1769   register halfword Result;
1770   halfword v;
1771   halfword p;
1772   halfword q;
1773
1774   v = eqtb[(hash_size + 1578) + n].hh.v.RH;
1775   if (cur_mark[3]!= 0)
1776   {
1777     delete_token_ref(cur_mark[3]);
1778     cur_mark[3] = 0;
1779     delete_token_ref(cur_mark[4]);
1780     cur_mark[4] = 0;
1781   }
1782   if (v == 0)    /* if v=null then l.18999 */
1783   {
1784     Result = 0; /*   begin vsplit:=null; return; */
1785     return(Result);
1786   }
1787   if (mem[v].hh.b0 != 1)
1788   {
1789     print_err("");
1790     print_esc("vsplit");
1791     print_string("needs a ");
1792     print_esc("vbox");
1793     help2("The box you are trying to split is an \\hbox.",
1794         "I can't split such a box, so I'll leave it alone.");
1795     error();
1796     Result = 0;
1797     return(Result);
1798   }
1799   q = vert_break(mem[v + 5].hh.v.RH, h, split_max_depth);
1800   p = mem[v + 5].hh.v.RH;
1801   if (p == q)
1802     mem[v + 5].hh.v.RH = 0;
1803   else while (true)
1804   {
1805     if (mem[p].hh.b0 == 4)
1806       if (cur_mark[3]== 0)
1807       {
1808         cur_mark[3] = mem[p + 1].cint;
1809         cur_mark[4] = cur_mark[3];
1810         mem[cur_mark[3]].hh.v.LH = mem[cur_mark[3]].hh.v.LH + 2;
1811       }
1812       else
1813       {
1814         delete_token_ref(cur_mark[4]);
1815         cur_mark[4]= mem[p + 1].cint;
1816         incr(mem[cur_mark[4]].hh.v.LH);
1817       }
1818     if (mem[p].hh.v.RH == q)
1819     {
1820       mem[p].hh.v.RH = 0;
1821       goto lab30;
1822     }
1823     p = mem[p].hh.v.RH;
1824   }
1825 lab30:;
1826   q = prune_page_top(q);
1827   p = mem[v + 5].hh.v.RH;
1828   free_node(v, 7);
1829   if (q == 0)    /* if q=null l.18993 */
1830     eqtb[(hash_size + 1578) + n].hh.v.RH = 0;  /* then box(n):=null */
1831   else
1832     eqtb[(hash_size + 1578) + n].hh.v.RH = vpackage(q, 0, 1, 1073741823L);  /* 2^30 - 1 */
1833   Result = vpackage(p, h, 0, split_max_depth);
1834   return Result;
1835 }
1836 /* sec 0985 */
1837 void print_totals (void)
1838 {
1839   print_scaled(page_so_far[1]);
1840   if (page_so_far[2] != 0)
1841   {
1842     print_string(" plus ");
1843     print_scaled(page_so_far[2]);
1844     print_string("");
1845   }
1846   if (page_so_far[3] != 0)
1847   {
1848     print_string(" plus ");
1849     print_scaled(page_so_far[3]);
1850     print_string("fil");
1851   }
1852   if (page_so_far[4] != 0)
1853   {
1854     print_string(" plus ");
1855     print_scaled(page_so_far[4]);
1856     print_string("fill");
1857   }
1858   if (page_so_far[5] != 0)
1859   {
1860     print_string(" plus ");
1861     print_scaled(page_so_far[5]);
1862     print_string("filll");
1863   }
1864   if (page_so_far[6] != 0)
1865   {
1866     print_string(" minus ");
1867     print_scaled(page_so_far[6]);
1868   }
1869 }
1870 /* sec 0987 */
1871 void freeze_page_specs_(small_number s)
1872 {
1873   page_contents = s;
1874   page_so_far[0] = vsize;
1875   page_max_depth = max_depth;
1876   page_so_far[7] = 0;
1877   page_so_far[1] = 0;
1878   page_so_far[2] = 0;
1879   page_so_far[3] = 0;
1880   page_so_far[4] = 0;
1881   page_so_far[5] = 0;
1882   page_so_far[6] = 0;
1883   least_page_cost = 1073741823L;  /* 2^30 - 1 */
1884 #ifdef STAT
1885   if (tracing_pages > 0)
1886   {
1887     begin_diagnostic();
1888     print_nl("might split");
1889     print_scaled(page_so_far[0]);
1890     print_string(", max depth=");
1891     print_scaled(page_max_depth);
1892     end_diagnostic(false);
1893   }
1894 #endif /* STAT */
1895 }
1896 /* sec 0992 */
1897 void box_error_(eight_bits n)
1898 {
1899   error();
1900   begin_diagnostic();
1901   print_nl("The following box has been deleted:");
1902   show_box(eqtb[(hash_size + 1578) + n].hh.v.RH);
1903   end_diagnostic(true);
1904   flush_node_list(eqtb[(hash_size + 1578) + n].hh.v.RH);
1905   eqtb[(hash_size + 1578) + n].hh.v.RH = 0;
1906 }
1907 /* sec 0993 */
1908 void ensure_vbox_(eight_bits n)
1909 {
1910   halfword p; 
1911   p = eqtb[(hash_size + 1578) + n].hh.v.RH;
1912   if (p != 0) /* if p<>null then if type(p)=hlist_node then l.19324 */
1913     if (mem[p].hh.b0 == 0)
1914     {
1915       print_err("Insertions can only be added to a vbox");
1916       help3("Tut tut: You're trying to \\insert into a",
1917           "\\box register that now contains an \\hbox.",
1918           "Proceed, and I'll discard its present contents.");
1919       box_error(n);
1920     }
1921 }
1922 /* called only from tex7.c */
1923 /* sec 1012 */
1924 void fire_up_(halfword c)
1925 {
1926   halfword p, q, r, s;
1927   halfword prevp;
1928 /*  unsigned char n;  */
1929   unsigned int n;         /* 95/Jan/7 */
1930   bool wait;
1931   integer savevbadness;
1932   scaled savevfuzz;
1933   halfword savesplittopskip;
1934
1935   if (mem[best_page_break].hh.b0 == 12)
1936   {
1937     geq_word_define((hash_size + 3202), mem[best_page_break + 1].cint);
1938     mem[best_page_break + 1].cint = 10000;
1939   }
1940   else
1941     geq_word_define((hash_size + 3202), 10000);
1942   if (cur_mark[2]!= 0)
1943   {
1944     if (cur_mark[0]!= 0)
1945       delete_token_ref(cur_mark[0]);
1946     cur_mark[0]= cur_mark[2];
1947     incr(mem[cur_mark[0]].hh.v.LH);
1948     delete_token_ref(cur_mark[1]);
1949     cur_mark[1]= 0;
1950   }
1951   if (c == best_page_break)
1952     best_page_break = 0;
1953   if (eqtb[(hash_size + 1833)].hh.v.RH != 0)
1954   {
1955     print_err("");
1956     print_esc("box");
1957     print_string("255 is not void");
1958     help2("You shouldn't use \\box255 except in \\output routines.",
1959         "Proceed, and I'll discard its present contents.");
1960     box_error(255);
1961   }
1962   insert_penalties = 0;
1963   savesplittopskip = eqtb[(hash_size + 792)].hh.v.RH;
1964   if (holding_inserts <= 0)
1965   {
1966     r = mem[mem_top].hh.v.RH;
1967     while (r != mem_top)
1968     {
1969       if (mem[r + 2].hh.v.LH != 0)
1970       {
1971         n = mem[r].hh.b1;
1972         ensure_vbox(n);
1973 /*    if box(n)=null then box(n):=new_null_box; l.19759 */
1974         if (eqtb[(hash_size + 1578) + n].hh.v.RH == 0)
1975           eqtb[(hash_size + 1578) + n].hh.v.RH = new_null_box();
1976         p = eqtb[(hash_size + 1578) + n].hh.v.RH + 5;
1977         while (mem[p].hh.v.RH != 0)
1978           p = mem[p].hh.v.RH;
1979         mem[r + 2].hh.v.RH = p;
1980       }
1981       r = mem[r].hh.v.RH;
1982     }
1983   }
1984   q = hold_head;
1985   mem[q].hh.v.RH = 0;
1986   prevp = page_head;
1987   p = mem[prevp].hh.v.RH;
1988   while (p != best_page_break)
1989   {
1990     if (mem[p].hh.b0 == 3)
1991     {
1992       if (holding_inserts <= 0)
1993       {
1994         r = mem[mem_top].hh.v.RH;
1995         while (mem[r].hh.b1 != mem[p].hh.b1)
1996           r = mem[r].hh.v.RH;
1997 /*  if best_ins_ptr(r)=null then wait:=true l.19783 */
1998         if (mem[r + 2].hh.v.LH == 0)
1999           wait = true;
2000         else
2001         {
2002           wait = false;
2003           s = mem[r + 2].hh.v.RH;
2004           mem[s].hh.v.RH = mem[p + 4].hh.v.LH;
2005           if (mem[r + 2].hh.v.LH == p)
2006           {
2007             if (mem[r].hh.b0 == 1)
2008               if ((mem[r + 1].hh.v.LH == p) && (mem[r + 1].hh.v.RH != 0))
2009               {
2010                 while (mem[s].hh.v.RH != mem[r + 1].hh.v.RH)
2011                   s = mem[s].hh.v.RH;
2012                 mem[s].hh.v.RH = 0;
2013                 eqtb[(hash_size + 792)].hh.v.RH = mem[p + 4].hh.v.RH;
2014                 mem[p + 4].hh.v.LH = prune_page_top(mem[r + 1].hh.v.RH);
2015                 if (mem[p + 4].hh.v.LH != 0)
2016                 {
2017                   temp_ptr = vpackage(mem[p + 4].hh.v.LH, 0, 1, 1073741823L);  /* 2^30 - 1 */
2018                   mem[p + 3].cint = mem[temp_ptr + 3].cint + mem[temp_ptr + 2].cint;
2019                   free_node(temp_ptr, 7);
2020                   wait = true;
2021                 }
2022               }
2023             mem[r + 2].hh.v.LH = 0;
2024             n = mem[r].hh.b1;
2025             temp_ptr = mem[eqtb[(hash_size + 1578) + n].hh.v.RH + 5].hh.v.RH;
2026             free_node(eqtb[(hash_size + 1578) + n].hh.v.RH, 7);
2027             eqtb[(hash_size + 1578) + n].hh.v.RH = vpackage(temp_ptr, 0, 1, 1073741823L);  /* 2^30 - 1 */
2028           }
2029           else
2030           {
2031             while (mem[s].hh.v.RH != 0)
2032               s = mem[s].hh.v.RH;
2033             mem[r + 2].hh.v.RH = s;
2034           }
2035         }
2036         mem[prevp].hh.v.RH = mem[p].hh.v.RH;
2037         mem[p].hh.v.RH = 0;
2038         if (wait)
2039         {
2040           mem[q].hh.v.RH = p;
2041           q = p;
2042           incr(insert_penalties);
2043         }
2044         else
2045         {
2046           delete_glue_ref(mem[p + 4].hh.v.RH);
2047           free_node(p, 5);
2048         }
2049         p = prevp;
2050       }
2051     }
2052     else if (mem[p].hh.b0 == 4)
2053     {
2054       if (cur_mark[1] == 0)
2055       {
2056         cur_mark[1]= mem[p + 1].cint;
2057         incr(mem[cur_mark[1]].hh.v.LH);
2058       }
2059       if (cur_mark[2] != 0)
2060         delete_token_ref(cur_mark[2]);
2061       cur_mark[2]= mem[p + 1].cint;
2062       incr(mem[cur_mark[2]].hh.v.LH);
2063     }
2064     prevp = p;
2065     p = mem[prevp].hh.v.RH;
2066   }
2067   eqtb[(hash_size + 792)].hh.v.RH = savesplittopskip;
2068   if (p != 0)    /* if p<>null then l.19730 */
2069   {
2070     if (mem[contrib_head].hh.v.RH == 0)/* if link(contrib_head)=null then */
2071       if (nest_ptr == 0)
2072         tail = page_tail;
2073       else
2074         nest[0].tail_field = page_tail;
2075     mem[page_tail].hh.v.RH = mem[contrib_head].hh.v.RH;
2076     mem[contrib_head].hh.v.RH = p;
2077     mem[prevp].hh.v.RH = 0; /*   link(prev_p):=null; */
2078   }
2079   savevbadness = vbadness;
2080   vbadness = 10000;
2081   savevfuzz = eqtb[(hash_size + 3739)].cint;
2082   eqtb[(hash_size + 3739)].cint = 1073741823L;  /* 2^30 - 1 */
2083   eqtb[(hash_size + 1833)].hh.v.RH = vpackage(mem[page_head].hh.v.RH, best_size, 0, page_max_depth);
2084   vbadness = savevbadness;
2085   eqtb[(hash_size + 3739)].cint = savevfuzz;
2086 /*  if (last_glue != 262143L) */
2087   if (last_glue != empty_flag)
2088     delete_glue_ref(last_glue);
2089   page_contents = 0;
2090   page_tail = page_head;
2091   mem[page_head].hh.v.RH = 0;
2092 /*  last_glue = 262143L;  */
2093   last_glue = empty_flag;
2094   last_penalty = 0;
2095   last_kern = 0;
2096   page_so_far[7] = 0;
2097   page_max_depth = 0;
2098   if (q != hold_head)
2099   {
2100     mem[page_head].hh.v.RH = mem[hold_head].hh.v.RH;
2101     page_tail = q;
2102   }
2103   r = mem[mem_top].hh.v.RH;
2104   while (r != mem_top)
2105   {
2106     q = mem[r].hh.v.RH;
2107     free_node(r, 4);
2108     r = q;
2109   }
2110   mem[mem_top].hh.v.RH = mem_top;
2111 /* if (top_mark<>null)and(first_mark=null) then l.19654 */
2112   if ((cur_mark[0]!= 0) && (cur_mark[1]== 0))
2113   {
2114     cur_mark[1] = cur_mark[0];
2115     incr(mem[cur_mark[0]].hh.v.LH);
2116   }
2117 /* if output_routine<>null then */
2118   if (output_routine != 0)
2119     if (dead_cycles >= max_dead_cycles)
2120     {
2121       print_err("Output loop---");
2122       print_int(dead_cycles);
2123       print_string(" consecutive dead cycles");
2124       help3("I've concluded that your \\output is awry; it never does",
2125           "\\ship_out, so I'm shipping \box255 out myself. Next ",
2126           "increase \\maxdeadcycles if you want me to be more patient!");
2127       error();
2128     }
2129     else
2130     {
2131       output_active = true;
2132       incr(dead_cycles);
2133       push_nest();
2134       mode = -1;
2135       cur_list.aux_field.cint = ignore_depth;
2136       mode_line = - (integer) line;
2137       begin_token_list(output_routine, 6); /* output */
2138       new_save_level(8);
2139       normal_paragraph();
2140       scan_left_brace();
2141       return;
2142     }
2143   {
2144     if (mem[page_head].hh.v.RH != 0)
2145     {
2146       if (mem[contrib_head].hh.v.RH == 0)
2147         if (nest_ptr == 0)
2148           tail = page_tail;
2149         else
2150           nest[0].tail_field = page_tail;
2151       else
2152         mem[page_tail].hh.v.RH = mem[contrib_head].hh.v.RH;
2153       mem[contrib_head].hh.v.RH = mem[page_head].hh.v.RH;
2154       mem[page_head].hh.v.RH = 0;
2155       page_tail = page_head;
2156     }
2157     ship_out(eqtb[(hash_size + 1833)].hh.v.RH);
2158     eqtb[(hash_size + 1833)].hh.v.RH = 0; 
2159   }
2160 }
2161 /* used to continue here with build_page etc in tex6.c */