OSDN Git Service

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