OSDN Git Service

macro to function: print_err().
[putex/putex.git] / src / texsourc / tex4.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:4996)
14 #pragma warning(disable:4131) // old style declarator
15 #pragma warning(disable:4135) // conversion between different integral types 
16 #pragma warning(disable:4127) // conditional expression is constant
17
18 #include <setjmp.h>
19
20 #define EXTERN extern
21
22 #include "texd.h"
23
24 #pragma warning(disable:4244)       /* 96/Jan/10 */
25
26 /* #pragma optimize("a", off) */        /* 98/Dec/10 experiment */
27
28 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
29
30 void char_warning_(internal_font_number f, eight_bits c)
31
32   if(eqtb[(hash_size + 3198)].cint > 0)
33   {
34 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
35   if (show_missing == 0)            /* show on screen 94/June/10 */
36 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
37       begin_diagnostic (); 
38 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
39   if (show_missing) {     /* add ! before 94/June/10 */
40     print_nl(262);    /* !  */
41     print(819);     /* Missing character: there is no */
42   }
43   else 
44 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
45   print_nl(819);      /* Missing character: there is no */
46     print(c); 
47 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
48   if (show_numeric) {             /* bkph 93/Dec/21 */
49     print_char(32);   /*   */
50     print_char(40);   /*(*/
51     if (c / 100 > 0) {
52       print_char(48 + c / 100);
53 /*      c = c % 100; */
54       c = c - (c / 100) * 100;      /* ? */
55       print_char(48 + c / 10);
56     }
57     else {
58 /*      c = c % 100; */
59       c = c - (c / 100) * 100;      /* ? */
60       if (c / 10 > 0) print_char(48 + c / 10);
61     }
62     print_char(48 + c % 10);
63     print_char(41);   /*)*/
64 /*    print_char(32); */
65   }
66 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
67     print(820);               /* in font */
68     slow_print(font_name[f]); 
69     print_char(33);     /* ! */
70 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
71 /*  if (show_missing) show_context(); */    /* in tex2.c 94/June/10 */
72   if (show_missing) {
73     if (f != 0) show_context();     /* not if its the nullfont */
74   }
75   if (show_missing == 0)            /* show on screen 94/June/10 */
76 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
77     end_diagnostic(false); 
78 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
79   missing_characters++;           /* bkph 93/Dec/16 */
80 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
81   } 
82
83 halfword new_character_(internal_font_number f, eight_bits c)
84 {/* 10 */ register halfword Result; 
85   halfword p; 
86   if(font_bc[f]<= c)
87   if(font_ec[f]>= c)
88   if((font_info[char_base[f]+ c].qqqq.b0 > 0)) 
89   {
90     p = get_avail (); 
91 /*  long to unsigned short ... */
92     mem[p].hh.b0 = f; 
93     mem[p].hh.b1 = c; 
94     Result = p; 
95     return(Result); 
96   } 
97   char_warning(f, c); /* char_warning(f,c); l.11283 */
98   Result = 0;       /* new_character:=null */
99   return Result; 
100
101 /* following needs access to dvi_buf=zdvibuf see coerce.h */
102 void dvi_swap (void) 
103
104 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
105   if (trace_flag) {
106   show_char('\n');
107   sprintf(log_line, "dvi_swap %d", dvi_gone);
108   show_line(log_line, 0);
109 }
110 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
111   if(dvi_limit == dvi_buf_size)   {
112     writedvi(0, half_buf - 1); 
113     dvi_limit = half_buf; 
114     dvi_offset = dvi_offset + dvi_buf_size; 
115     dvi_ptr = 0; 
116   } 
117   else {
118     writedvi(half_buf, dvi_buf_size - 1); 
119     dvi_limit = dvi_buf_size; 
120   } 
121   dvi_gone = dvi_gone + half_buf; 
122
123 /* following needs access to dvi_buf=zdvibuf see coerce.h */
124 void dvi_four_(integer x)    /* attempt at speeding up bkph - is compiler smart ? */
125
126   if(x >= 0)
127   {
128 /*    dvi_buf[dvi_ptr]= x / 16777216L;  */ /* 2^24 */
129 /*    dvi_buf[dvi_ptr]=(x >> 24);  */
130     dvi_buf[dvi_ptr]= (unsigned char)(x >> 24); 
131     incr(dvi_ptr); 
132     if(dvi_ptr == dvi_limit)dvi_swap (); 
133   } 
134   else {
135     x = x + 1073741824L;    /* 2^30 40000000 hex */ 
136     x = x + 1073741824L; 
137     {
138 /*      dvi_buf[dvi_ptr]=(x / 16777216L)+ 128;   */  /* 2^24 */
139       dvi_buf[dvi_ptr]=(x >> 24)+ 128;      /* set sign bit */
140       incr(dvi_ptr); 
141       if(dvi_ptr == dvi_limit)dvi_swap (); 
142     } 
143   } 
144 /*  x = x % 16777216L;  */  /* % 2^24 */
145   x = x & 16777215L; 
146   {
147 /*    dvi_buf[dvi_ptr]= x / 65536L;  */
148 /*    dvi_buf[dvi_ptr]=(x >> 16);  */
149     dvi_buf[dvi_ptr]= (unsigned char)(x >> 16); 
150     incr(dvi_ptr); 
151     if(dvi_ptr == dvi_limit)dvi_swap (); 
152   } 
153 /*  x = x % 65536L;  */ /* % 2^16 */
154   x = x & 65535L;
155   {
156 /*    dvi_buf[dvi_ptr]= x / 256;  */
157 /*    dvi_buf[dvi_ptr]=(x >> 8);  */
158     dvi_buf[dvi_ptr]= (unsigned char)(x >> 8); 
159     incr(dvi_ptr); 
160     if(dvi_ptr == dvi_limit)dvi_swap (); 
161   } 
162   {
163 /*    dvi_buf[dvi_ptr]= x % 256; */ /* % 2^8 */
164     dvi_buf[dvi_ptr]= x & 255; 
165     incr(dvi_ptr); 
166     if(dvi_ptr == dvi_limit)dvi_swap (); 
167   } 
168
169 /* following needs access to dvi_buf=zdvibuf see coerce.h */
170 void zdvipop(integer l)
171
172   if((l == dvi_offset + dvi_ptr)&&(dvi_ptr > 0)) 
173   decr(dvi_ptr); 
174   else {
175       
176     dvi_buf[dvi_ptr]= 142; 
177     incr(dvi_ptr); 
178     if(dvi_ptr == dvi_limit)dvi_swap (); 
179   } 
180
181 /* following needs access to dvi_buf=zdvibuf see coerce.h */
182 void dvi_font_def_(internal_font_number f)
183
184   pool_pointer k; 
185 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
186 #ifdef INCREASEFONTS
187   if (f <= 256) {
188   {
189     dvi_buf[dvi_ptr]= 243; 
190     incr(dvi_ptr); 
191     if(dvi_ptr == dvi_limit)dvi_swap (); 
192   } 
193   {
194     dvi_buf[dvi_ptr]= f - 1; 
195     incr(dvi_ptr); 
196     if(dvi_ptr == dvi_limit)dvi_swap (); 
197   } 
198   }
199   else {
200   {
201     dvi_buf[dvi_ptr]= 244; 
202     incr(dvi_ptr); 
203     if(dvi_ptr == dvi_limit)dvi_swap (); 
204   } 
205   {
206     dvi_buf[dvi_ptr]= (f - 1) >> 8; /* top byte */
207     incr(dvi_ptr); 
208     if(dvi_ptr == dvi_limit)dvi_swap (); 
209   } 
210   {
211     dvi_buf[dvi_ptr]= (f - 1) & 255; /* bottom byte */
212     incr(dvi_ptr); 
213     if(dvi_ptr == dvi_limit)dvi_swap (); 
214   } 
215   }
216 #else
217   {
218     dvi_buf[dvi_ptr]= 243; 
219     incr(dvi_ptr); 
220     if(dvi_ptr == dvi_limit)dvi_swap (); 
221   } 
222   {
223     dvi_buf[dvi_ptr]= f - 1; 
224     incr(dvi_ptr); 
225     if(dvi_ptr == dvi_limit)dvi_swap (); 
226   } 
227 #endif
228 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
229 /* spit out the font checksum now */
230   {
231     dvi_buf[dvi_ptr]= font_check[f].b0; 
232     incr(dvi_ptr); 
233     if(dvi_ptr == dvi_limit)dvi_swap (); 
234   } 
235   {
236     dvi_buf[dvi_ptr]= font_check[f].b1; 
237     incr(dvi_ptr); 
238     if(dvi_ptr == dvi_limit)dvi_swap (); 
239   } 
240   {
241     dvi_buf[dvi_ptr]= font_check[f].b2; 
242     incr(dvi_ptr); 
243     if(dvi_ptr == dvi_limit)dvi_swap (); 
244   } 
245   {
246     dvi_buf[dvi_ptr]= font_check[f].b3; 
247     incr(dvi_ptr); 
248     if(dvi_ptr == dvi_limit)dvi_swap (); 
249   } 
250   dvi_four(font_size[f]); 
251   dvi_four(font_dsize[f]); 
252   {
253 /*  long to unsigned char ... */
254     dvi_buf[dvi_ptr]=
255       (str_start[font_area[f]+ 1]- str_start[font_area[f]]); 
256     incr(dvi_ptr); 
257     if(dvi_ptr == dvi_limit)dvi_swap (); 
258   } 
259   {
260 /*  long to unsigned char ... */
261     dvi_buf[dvi_ptr]=
262       (str_start[font_name[f]+ 1]- str_start[font_name[f]]); 
263     incr(dvi_ptr); 
264     if(dvi_ptr == dvi_limit)dvi_swap (); 
265   } 
266   {
267     register integer for_end; 
268     k = str_start[font_area[f]]; 
269     for_end = str_start[font_area[f]+ 1]- 1; 
270     if(k <= for_end) do 
271     {
272       dvi_buf[dvi_ptr]= str_pool[k]; 
273       incr(dvi_ptr); 
274       if(dvi_ptr == dvi_limit)dvi_swap (); 
275     } 
276     while(k++ < for_end);
277   } 
278   {
279     register integer for_end; 
280     k = str_start[font_name[f]]; 
281     for_end =   str_start[font_name[f]+ 1]- 1;
282     if(k <= for_end) do 
283     {
284       dvi_buf[dvi_ptr]= str_pool[k]; 
285       incr(dvi_ptr); 
286       if(dvi_ptr == dvi_limit)dvi_swap (); 
287     } 
288     while(k++ < for_end);
289   } 
290
291 /* following needs access to dvi_buf=zdvibuf see coerce.h */
292 void zmovement(scaled w, eight_bits o) 
293 {/* 10 40 45 2 1 */ 
294   small_number mstate; 
295   halfword p, q; 
296   integer k; 
297   q = get_node(3); 
298   mem[q + 1].cint = w; 
299   mem[q + 2].cint = dvi_offset + dvi_ptr; 
300   if(o == 157)          /* 157 == down1 */
301   {
302     mem[q].hh.v.RH = down_ptr; 
303     down_ptr = q; 
304   } 
305   else {              /* 143 == right1 */
306       
307     mem[q].hh.v.RH = right_ptr; 
308     right_ptr = q; 
309   } 
310   p = mem[q].hh.v.RH; 
311   mstate = 0; 
312   while(p != 0){  /* while p<>null do l.12153 */
313       
314     if(mem[p + 1].cint == w)
315     switch(mstate + mem[p].hh.v.LH)
316     {case 3 : 
317     case 4 : 
318     case 15 : 
319     case 16 : 
320       if(mem[p + 2].cint < dvi_gone)
321       goto lab45; 
322       else {
323     
324   k = mem[p + 2].cint - dvi_offset; 
325   if(k < 0)
326   k = k + dvi_buf_size; 
327   dvi_buf[k]= dvi_buf[k]+ 5; 
328   mem[p].hh.v.LH = 1; 
329   goto lab40; 
330       } 
331       break; 
332     case 5 : 
333     case 9 : 
334     case 11 : 
335       if(mem[p + 2].cint < dvi_gone)
336       goto lab45; 
337       else {
338     
339   k = mem[p + 2].cint - dvi_offset; 
340   if(k < 0)
341   k = k + dvi_buf_size; 
342   dvi_buf[k]= dvi_buf[k]+ 10; 
343   mem[p].hh.v.LH = 2; 
344   goto lab40; 
345       } 
346       break; 
347     case 1 : 
348     case 2 : 
349     case 8 : 
350     case 13 : 
351       goto lab40; 
352       break; 
353       default: 
354    ; 
355       break; 
356     } 
357     else switch(mstate + mem[p].hh.v.LH)
358     {case 1 : 
359       mstate = 6; 
360       break; 
361     case 2 : 
362       mstate = 12; 
363       break; 
364     case 8 : 
365     case 13 : 
366       goto lab45; 
367       break; 
368       default: 
369    ; 
370       break; 
371     } 
372     p = mem[p].hh.v.RH; 
373   } 
374   lab45:; 
375   mem[q].hh.v.LH = 3; 
376   if(abs(w)>= 8388608L) /* 2^23 */
377   {
378     {
379       dvi_buf[dvi_ptr]= o + 3; 
380       incr(dvi_ptr); 
381       if(dvi_ptr == dvi_limit)dvi_swap (); 
382     } 
383     dvi_four(w); 
384     return; 
385   } 
386   if(abs(w)>= 32768L)
387   {
388     {
389       dvi_buf[dvi_ptr]= o + 2; 
390       incr(dvi_ptr); 
391       if(dvi_ptr == dvi_limit)dvi_swap (); 
392     } 
393     if(w < 0)
394     w = w + 16777216L;  /* 2^24 */
395     {
396 /*      dvi_buf[dvi_ptr]= w / 65536L;  */
397 /*      dvi_buf[dvi_ptr]=(w >> 16);  */
398       dvi_buf[dvi_ptr]= (unsigned char)(w >> 16); 
399       incr(dvi_ptr); 
400       if(dvi_ptr == dvi_limit)dvi_swap (); 
401     } 
402 /*    w = w % 65536L; */
403   w = w & 65535L; 
404     goto lab2; 
405   } 
406   if(abs(w)>= 128)
407   {
408     {
409       dvi_buf[dvi_ptr]= o + 1; 
410       incr(dvi_ptr); 
411       if(dvi_ptr == dvi_limit)dvi_swap (); 
412     } 
413     if(w < 0)
414     w = w + 65536L; 
415     goto lab2; 
416   } 
417   {
418     dvi_buf[dvi_ptr]= o; 
419     incr(dvi_ptr); 
420     if(dvi_ptr == dvi_limit)dvi_swap (); 
421   } 
422   if(w < 0)
423   w = w + 256; 
424   goto lab1; 
425   lab2: {
426       
427 /*    dvi_buf[dvi_ptr]= w / 256;  */
428 /*    dvi_buf[dvi_ptr]=(w >> 8);  */
429     dvi_buf[dvi_ptr]= (unsigned char)(w >> 8); 
430     incr(dvi_ptr); 
431     if(dvi_ptr == dvi_limit)dvi_swap (); 
432   } 
433   lab1: {
434       
435 /*    dvi_buf[dvi_ptr]= w % 256;  */
436     dvi_buf[dvi_ptr]= w & 255; 
437     incr(dvi_ptr); 
438     if(dvi_ptr == dvi_limit)dvi_swap (); 
439   } 
440   return; 
441   lab40: mem[q].hh.v.LH = mem[p].hh.v.LH; 
442   if(mem[q].hh.v.LH == 1)
443   {
444     {
445       dvi_buf[dvi_ptr]= o + 4; 
446       incr(dvi_ptr); 
447       if(dvi_ptr == dvi_limit)dvi_swap (); 
448     } 
449     while(mem[q].hh.v.RH != p){
450   
451       q = mem[q].hh.v.RH; 
452       switch(mem[q].hh.v.LH)
453       {case 3 : 
454   mem[q].hh.v.LH = 5; 
455   break; 
456       case 4 : 
457   mem[q].hh.v.LH = 6; 
458   break; 
459   default: 
460   ; 
461   break; 
462       } 
463     } 
464   } 
465   else {
466       
467     {
468       dvi_buf[dvi_ptr]= o + 9; 
469       incr(dvi_ptr); 
470       if(dvi_ptr == dvi_limit)dvi_swap (); 
471     } 
472     while(mem[q].hh.v.RH != p){
473   
474       q = mem[q].hh.v.RH; 
475       switch(mem[q].hh.v.LH)
476       {case 3 : 
477   mem[q].hh.v.LH = 4; 
478   break; 
479       case 5 : 
480   mem[q].hh.v.LH = 6; 
481   break; 
482   default: 
483   ; 
484   break; 
485       } 
486     } 
487   } 
488
489 void prune_movements_(integer l) 
490 {/* 30 10 */ 
491   halfword p; 
492   while(down_ptr != 0){ /* while down_ptr<>null do l.12206 */
493       
494     if(mem[down_ptr + 2].cint < l)
495     goto lab30; 
496     p = down_ptr; 
497     down_ptr = mem[p].hh.v.RH; 
498     free_node(p, 3); 
499   } 
500   lab30: while(right_ptr != 0){ /* done: while right_ptr<>null do */
501       
502     if(mem[right_ptr + 2].cint < l)
503     return; 
504     p = right_ptr; 
505     right_ptr = mem[p].hh.v.RH; 
506     free_node(p, 3); 
507   } 
508
509 /* following needs access to dvi_buf=zdvibuf see coerce.h */
510 void special_out_(halfword p)
511 {
512   char old_setting; 
513   pool_pointer k; 
514   if(cur_h != dvi_h)
515   {
516     movement(cur_h - dvi_h, 143); /* 143 == right1 */
517     dvi_h = cur_h; 
518   } 
519   if(cur_v != dvi_v)
520   {
521     movement(cur_v - dvi_v, 157); /* 157 == down1 */
522     dvi_v = cur_v; 
523   } 
524   old_setting = selector; 
525   selector = 21; 
526 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
527 /* About output \special{...} make some space in string pool 97/Mar/9 */
528 #ifdef ALLOCATESTRING
529   if(pool_ptr + 32000 > current_pool_size)
530     str_pool = realloc_str_pool (increment_pool_size);
531 /* We don't bother to check whether this worked - will catch later */
532 #endif
533 /* Potential problem here if current_pool_size is not much more than pool_ptr! */
534 /* Fixed 97/Mar/9 in version 2.0.3 */
535 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
536 #ifdef ALLOCATESTRING
537 /*  show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0,
538     current_pool_size - pool_ptr); */
539   show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0,
540     10000000L);   
541 /*  Above is safe, since print/print_char/print_esc will extend string space */
542 #else
543 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
544   show_token_list(mem[mem[p + 1].hh.v.RH].hh.v.RH, 0,
545       pool_size - pool_ptr); 
546 #endif
547
548   selector = old_setting; 
549   {
550 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
551 /* str_room(1) - is there space for one more character in string pool ? */
552 #ifdef ALLOCATESTRING
553   if(pool_ptr + 1 > current_pool_size)
554     str_pool = realloc_str_pool (increment_pool_size);
555   if(pool_ptr + 1 > current_pool_size)  { /* in case it failed 94/Jan/24 */
556     overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */
557     return;     // abort_flag set
558   }
559 #else
560 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
561     if(pool_ptr + 1 > pool_size){
562     overflow(257, pool_size - init_pool_ptr); /* pool size */
563     return;     // abort_flag set
564   }
565 #endif
566   } 
567   if((pool_ptr - str_start[str_ptr])< 256)  /* can use xxx1 ? */
568   {
569     {
570       dvi_buf[dvi_ptr]= 239;    /* xxx1 */
571       incr(dvi_ptr); 
572       if(dvi_ptr == dvi_limit)dvi_swap (); 
573     } 
574     {
575 /*    long to unsigned char ... */
576       dvi_buf[dvi_ptr]=(pool_ptr - str_start[str_ptr]); 
577       incr(dvi_ptr); 
578       if(dvi_ptr == dvi_limit)dvi_swap (); 
579     } 
580   } 
581   else {              /* use xxx4 instead */
582       
583     {
584       dvi_buf[dvi_ptr]= 242;    /* xxx4 */
585       incr(dvi_ptr); 
586       if(dvi_ptr == dvi_limit)dvi_swap (); 
587     } 
588     dvi_four((pool_ptr - str_start[str_ptr])); 
589   } 
590
591 #ifdef IGNORED
592 /*  debugging code for \special{src: ... } 98/Nov/11 */
593   {
594     int k = str_start[str_ptr];
595     int kend = pool_ptr;
596     if (kend > k + 4) {
597       if (str_pool [k] == 's' &&
598         str_pool [k+1] == 'r' &&
599         str_pool [k+2] == 'c' &&
600         str_pool [k+3] == ':') {  /* \special{src: ... } */
601         show_char('\n');
602         s = log_line;
603         while (k < kend) {
604           *s++ = str_pool[k++];
605         }
606         *s++ = ' ';
607         *s++ = '\0';
608         show_line(log_line, 0)
609 #ifndef _WINDOWS
610         fflush(stdout);
611 #endif
612         if (cur_input.name_field > 17)  { /* redundant ? */
613           print(cur_input.name_field);          
614           print_char(40);       /*(*/
615           print_int(line);      /* line number */
616           print_char(41);       /*)*/
617           print_char(32);       /*   */
618           print_char(58);       /* : */
619         }
620 #ifndef _WINDOWS
621         fflush(stdout);
622 #endif
623       }
624     }
625   }
626 #endif
627
628   {
629     register integer for_end; 
630     k = str_start[str_ptr]; 
631     for_end = pool_ptr - 1; 
632     if(k <= for_end) do 
633     {
634       dvi_buf[dvi_ptr]= str_pool[k]; 
635       incr(dvi_ptr); 
636       if(dvi_ptr == dvi_limit)dvi_swap (); 
637     } 
638     while(k++ < for_end);
639   } 
640   pool_ptr = str_start[str_ptr]; 
641
642 /* noew returns -1 if it fails */
643 void write_out_(halfword p)
644 {
645   char old_setting; 
646 /*  integer oldmode;  */
647   int oldmode;          /* 1995/Jan/7 */
648 /*  small_number j;  */
649   int j;              /* 1995/Jan/7 */
650   halfword q, r; 
651 /* q:=get_avail; info(q):=right_brace_token+"}";@/ */
652   q = get_avail (); 
653   mem[q].hh.v.LH = 637; 
654 /* r:=get_avail; link(q):=r; info(r):=end_write_token; ins_list(q);@/ */
655 /* @d end_write_token==cs_token_flag+end_write */
656   r = get_avail (); 
657   mem[q].hh.v.RH = r; 
658 /*  mem[r].hh.v.LH = (hash_size + 4617);  */
659 /*  mem[r].hh.v.LH = (hash_size + 4095 + 522); */
660   mem[r].hh.v.LH = (hash_size + hash_extra + 4095 + 522); 
661   begin_token_list(q, 4); 
662   begin_token_list(mem[p + 1].hh.v.RH, 15); 
663   q = get_avail (); 
664   mem[q].hh.v.LH = 379; 
665   begin_token_list(q, 4); 
666   oldmode = mode; 
667   mode = 0; 
668   cur_cs = write_loc; 
669   q = scan_toks(false, true); 
670   get_token (); 
671 /*  if(cur_tok != (hash_size + 4617)) */
672 /*  if(cur_tok != (hash_size + 4095 + 522)) */
673   if(cur_tok != (hash_size + hash_extra + 4095 + 522))
674   {
675           print_err("Unbalanced write command");
676     {
677       help_ptr = 2; 
678       help_line[1]= 1292; /* On this page there's a \write with fewer real {'s than }'s. */
679       help_line[0]= 1006; /* I can't handle that very well; good luck. */
680     } 
681     error (); 
682     do {
683     get_token (); 
684 /*    } while(!(cur_tok == (hash_size + 4617)));  */
685 /*    } while(!(cur_tok == (hash_size + 4095 + 522)));  */
686     } while(!(cur_tok == (hash_size + hash_extra + 4095 + 522))); /*1996/Jan/10*/
687   } 
688   mode = oldmode; 
689   end_token_list (); 
690   old_setting = selector; 
691   j = mem[p + 1].hh.v.LH; 
692   if(write_open[j])selector = j; 
693   else {
694     if((j == 17)&&(selector == 19)) 
695     selector = 18; 
696     print_nl(335);  /*  */
697   } 
698   token_show(def_ref); 
699   print_ln (); 
700   flush_list(def_ref); 
701   selector = old_setting; 
702
703 void out_what_(halfword p)
704 {
705 /*  small_number j;  */
706   int j;            /* 1995/Jan/7 */
707   switch(mem[p].hh.b1)
708   {case 0 : 
709   case 1 : 
710   case 2 : 
711     if(! doing_leaders){
712       j = mem[p + 1].hh.v.LH; 
713       if(mem[p].hh.b1 == 1){
714       write_out(p);
715     }
716       else {
717       if(write_open[j])
718         (void) a_close(write_file[j]); 
719       if(mem[p].hh.b1 == 2)
720         write_open[j]= false; 
721       else if(j < 16){
722         cur_name = mem[p + 1].hh.v.RH; 
723         cur_area = mem[p + 2].hh.v.LH; 
724         cur_ext = mem[p + 2].hh.v.RH; 
725         if(cur_ext == 335)  /* "" */
726           cur_ext = 785;  /* => ".tex" */
727         pack_file_name(cur_name, cur_area, cur_ext); 
728         while(! a_open_out(write_file[j])) {
729           prompt_file_name(1294, 785); /* output file name  .tex */
730     }
731     write_open[j]= true; 
732   } 
733       } 
734     } 
735     break; 
736   case 3 : 
737     special_out(p); 
738     break; 
739   case 4 : 
740  ; 
741     break; 
742     default: 
743     {
744       confusion(1293); /* ext4 */
745       return;       // abort_flag set
746     }
747     break; 
748   } 
749
750 /* following needs access to dvi_buf=zdvibuf see coerce.h */
751 void hlist_out (void) 
752 {/* 21 13 14 15 */ 
753   scaled baseline; 
754   scaled leftedge; 
755   scaled saveh, savev; 
756   halfword thisbox; 
757 /*  glue_ord gorder;  */
758   int gorder;           /* 95/Jan/7 */
759 /*  char gsign;  */
760   int gsign;            /* 95/Jan/7 */
761   halfword p; 
762   integer saveloc; 
763   halfword leaderbox; 
764   scaled leaderwd; 
765   scaled lx; 
766   bool outerdoingleaders; 
767   scaled edge; 
768 /* ********************************************************************* */
769   real gluetemp;  /* new in 3.14159 */
770 /* ********************************************************************* */
771   thisbox = temp_ptr; 
772   gorder = mem[thisbox + 5].hh.b1; 
773   gsign = mem[thisbox + 5].hh.b0; 
774   p = mem[thisbox + 5].hh.v.RH; 
775   incr(cur_s); 
776   if(cur_s > 0)
777   {
778     dvi_buf[dvi_ptr]= 141; 
779     incr(dvi_ptr); 
780     if(dvi_ptr == dvi_limit)dvi_swap (); 
781   } 
782   if(cur_s > max_push)
783   max_push = cur_s; 
784   saveloc = dvi_offset + dvi_ptr; 
785   baseline = cur_v; 
786   leftedge = cur_h; 
787 /* while p<>null do l.12314 */
788   while(p != 0)lab21: if((p >= hi_mem_min)) 
789   {
790     if(cur_h != dvi_h)
791     {
792       movement(cur_h - dvi_h, 143);   /* 143 == right1 */
793       dvi_h = cur_h; 
794     } 
795     if(cur_v != dvi_v)
796     {
797       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
798       dvi_v = cur_v; 
799     } 
800     do {
801   f = mem[p].hh.b0; 
802       c = mem[p].hh.b1; 
803       if(f != dvi_f)
804       {
805   if(! font_used[f])
806   {
807     dvi_font_def(f); 
808     font_used[f]= true; 
809   } 
810   if(f <= 64)
811   {               /* fnt_num_0 --- fnt_num_63 */
812     dvi_buf[dvi_ptr]= f + 170; 
813     incr(dvi_ptr); 
814     if(dvi_ptr == dvi_limit)dvi_swap (); 
815   } 
816 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
817 #ifdef INCREASEFONTS
818   else if(f <= 256){      /* if we allow greater than 256 fonts */
819 #else
820 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
821   else {              /* normal TeX 82 case */
822 #endif
823     {               /* fnt1 followed by f */
824       dvi_buf[dvi_ptr]= 235; 
825       incr(dvi_ptr); 
826       if(dvi_ptr == dvi_limit)dvi_swap (); 
827     } 
828     {
829       dvi_buf[dvi_ptr]= f - 1; 
830       incr(dvi_ptr); 
831       if(dvi_ptr == dvi_limit)dvi_swap (); 
832     } 
833   } 
834 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
835 #ifdef INCREASEFONTS
836   else {              /* fnt2 followed by f / 256,  f % 256 */
837     {
838       dvi_buf[dvi_ptr]= 236;
839       incr(dvi_ptr); 
840       if(dvi_ptr == dvi_limit)dvi_swap (); 
841     } 
842     {
843       dvi_buf[dvi_ptr]= (f - 1) >> 8;   /* top byte */
844       incr(dvi_ptr); 
845       if(dvi_ptr == dvi_limit)dvi_swap (); 
846     }
847     {
848       dvi_buf[dvi_ptr]= (f - 1) & 255;    /* bottom byte */
849       incr(dvi_ptr); 
850       if(dvi_ptr == dvi_limit)dvi_swap (); 
851     }     
852   }
853 #endif
854 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
855     dvi_f = f; 
856       } 
857       if(c >= 128)
858       {
859   dvi_buf[dvi_ptr]= 128; 
860   incr(dvi_ptr); 
861   if(dvi_ptr == dvi_limit)dvi_swap (); 
862       } 
863       {
864   dvi_buf[dvi_ptr]= c; 
865   incr(dvi_ptr); 
866   if(dvi_ptr == dvi_limit)dvi_swap (); 
867       } 
868       cur_h = cur_h + font_info[width_base[f]+ font_info[char_base[f]+ c 
869     ].qqqq.b0].cint; 
870       p = mem[p].hh.v.RH; 
871     } while(!(!(p >= hi_mem_min))); 
872     dvi_h = cur_h; 
873   } 
874   else {
875       
876     switch(mem[p].hh.b0)
877     {case 0 : 
878     case 1 : 
879 /* if list_ptr(p)=null then cur_h:=cur_h+width(p) l.12371 */
880       if(mem[p + 5].hh.v.RH == 0)
881       cur_h = cur_h + mem[p + 1].cint; 
882       else {
883     
884   saveh = dvi_h; 
885   savev = dvi_v; 
886   cur_v = baseline + mem[p + 4].cint; 
887   temp_ptr = p; 
888   edge = cur_h; 
889   if(mem[p].hh.b0 == 1)vlist_out (); 
890   else hlist_out ();
891   dvi_h = saveh; 
892   dvi_v = savev; 
893   cur_h = edge + mem[p + 1].cint; 
894   cur_v = baseline; 
895       } 
896       break; 
897     case 2 : 
898       {
899   rule_ht = mem[p + 3].cint; 
900   rule_dp = mem[p + 2].cint; 
901   rule_wd = mem[p + 1].cint; 
902   goto lab14; 
903       } 
904       break; 
905     case 8 : 
906       out_what(p);
907       break; 
908     case 10 : 
909       {
910   g = mem[p + 1].hh.v.LH; 
911   rule_wd = mem[g + 1].cint; 
912   if(gsign != 0)
913   {
914     if(gsign == 1)
915     {
916       if(mem[g].hh.b0 == gorder)
917 /* *********************************************************************** */
918 /*      rule_wd = rule_wd + round(mem[thisbox + 6].gr * mem[g + 2].cint); */
919 /* ******************** 3.14159 ******************************************* */
920       {
921         gluetemp = mem[thisbox + 6].gr * mem[g + 2].cint; 
922         if(gluetemp > 1000000000.0)
923         gluetemp = 1000000000.0; 
924         else if(gluetemp < -1000000000.0)
925         gluetemp = -1000000000.0; 
926         rule_wd = rule_wd + round(gluetemp); 
927       } 
928 /* ************************************************************************* */
929     } 
930 /*    else { */
931 /*      if(mem[g].hh.b1 == gorder)*/
932 /*      rule_wd = rule_wd - round(mem[thisbox + 6].gr * mem[g + 3].cint); */
933 /*    }  */
934 /* ******************** 3.14159 ******************************************* */
935     else if(mem[g].hh.b1 == gorder)
936     {
937       gluetemp = mem[thisbox + 6].gr * mem[g + 3].cint; 
938       if(gluetemp > 1000000000.0)
939       gluetemp = 1000000000.0; 
940       else if(gluetemp < -1000000000.0)
941       gluetemp = -1000000000.0; 
942       rule_wd = rule_wd - round(gluetemp); 
943     } 
944 /* ************************************************************************* */
945   } 
946   if(mem[p].hh.b1 >= 100)
947   {
948     leaderbox = mem[p + 1].hh.v.RH; 
949     if(mem[leaderbox].hh.b0 == 2)
950     {
951       rule_ht = mem[leaderbox + 3].cint; 
952       rule_dp = mem[leaderbox + 2].cint; 
953       goto lab14; 
954     } 
955     leaderwd = mem[leaderbox + 1].cint; 
956     if((leaderwd > 0)&&(rule_wd > 0)) 
957     {
958       rule_wd = rule_wd + 10; 
959       edge = cur_h + rule_wd; 
960       lx = 0; 
961       if(mem[p].hh.b1 == 100)
962       {
963         saveh = cur_h; 
964         cur_h = leftedge + leaderwd *((cur_h - leftedge)/ leaderwd)
965      ; 
966         if(cur_h < saveh)
967         cur_h = cur_h + leaderwd; 
968       } 
969       else {
970     
971         lq = rule_wd / leaderwd; 
972         lr = rule_wd % leaderwd; 
973         if(mem[p].hh.b1 == 101)
974         cur_h = cur_h +(lr / 2); 
975         else {
976       
977     lx =(2 * lr + lq + 1)/(2 * lq + 2); 
978     cur_h = cur_h +((lr -(lq - 1)* lx)/ 2); 
979         } 
980       } 
981       while(cur_h + leaderwd <= edge){
982     
983         cur_v = baseline + mem[leaderbox + 4].cint; 
984         if(cur_v != dvi_v)
985         {
986     movement(cur_v - dvi_v, 157); /* 157 == down1 */
987     dvi_v = cur_v; 
988         } 
989         savev = dvi_v; 
990         if(cur_h != dvi_h)
991         {
992     movement(cur_h - dvi_h, 143); /* 143 == right1 */
993     dvi_h = cur_h; 
994         } 
995         saveh = dvi_h; 
996         temp_ptr = leaderbox; 
997         outerdoingleaders = doing_leaders; 
998         doing_leaders = true; 
999         if(mem[leaderbox].hh.b0 == 1)vlist_out (); 
1000         else hlist_out ();
1001         doing_leaders = outerdoingleaders; 
1002         dvi_v = savev; 
1003         dvi_h = saveh; 
1004 /* ****************************************************************** */
1005 /*        cur_v = saveh;  */  
1006         cur_v = baseline;   /* changed in 3.1415 */
1007 /* ****************************************************************** */
1008         cur_h = saveh + leaderwd + lx; 
1009       } 
1010       cur_h = edge - 10; 
1011       goto lab15; 
1012     } 
1013   } 
1014   goto lab13; 
1015       } 
1016       break; 
1017     case 11 : 
1018     case 9 : 
1019       cur_h = cur_h + mem[p + 1].cint; 
1020       break; 
1021     case 6 : 
1022       {
1023   mem[mem_top - 12]= mem[p + 1]; 
1024   mem[mem_top - 12].hh.v.RH = mem[p].hh.v.RH; 
1025   p = mem_top - 12; 
1026   goto lab21; 
1027       } 
1028       break; 
1029       default: 
1030    ; 
1031       break; 
1032     } 
1033     goto lab15; 
1034     lab14: if((rule_ht == -1073741824L))  /* - 2^30 */
1035     rule_ht = mem[thisbox + 3].cint; 
1036     if((rule_dp == -1073741824L))     /* - 2^30 */
1037     rule_dp = mem[thisbox + 2].cint; 
1038     rule_ht = rule_ht + rule_dp; 
1039     if((rule_ht > 0)&&(rule_wd > 0)) 
1040     {
1041       if(cur_h != dvi_h)
1042       {
1043   movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1044   dvi_h = cur_h; 
1045       } 
1046       cur_v = baseline + rule_dp; 
1047       if(cur_v != dvi_v)
1048       {
1049   movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1050   dvi_v = cur_v; 
1051       } 
1052       {
1053   dvi_buf[dvi_ptr]= 132; 
1054   incr(dvi_ptr); 
1055   if(dvi_ptr == dvi_limit)dvi_swap (); 
1056       } 
1057       dvi_four(rule_ht); 
1058       dvi_four(rule_wd); 
1059       cur_v = baseline; 
1060       dvi_h = dvi_h + rule_wd; 
1061     } 
1062     lab13: cur_h = cur_h + rule_wd; 
1063     lab15: p = mem[p].hh.v.RH; 
1064   } 
1065   prune_movements(saveloc); 
1066   if(cur_s > 0)
1067   dvi_pop(saveloc); 
1068   decr(cur_s); 
1069
1070 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1071 void vlist_out (void) 
1072 {/* 13 14 15 */ 
1073   scaled leftedge; 
1074   scaled topedge; 
1075   scaled saveh, savev; 
1076   halfword thisbox; 
1077 /*  glue_ord gorder;  */
1078   int gorder;         /* 95/Jan/7 */
1079 /*  char gsign;  */
1080   int gsign;          /* 95/Jan/7 */
1081   halfword p; 
1082   integer saveloc; 
1083   halfword leaderbox; 
1084   scaled leaderht; 
1085   scaled lx; 
1086   bool outerdoingleaders; 
1087   scaled edge; 
1088 /* ************************************************************************ */
1089   real gluetemp;  /* new in 3.14159 */
1090 /* ************************************************************************ */
1091   thisbox = temp_ptr; 
1092   gorder = mem[thisbox + 5].hh.b1; 
1093   gsign = mem[thisbox + 5].hh.b0; 
1094   p = mem[thisbox + 5].hh.v.RH; 
1095   incr(cur_s); 
1096   if(cur_s > 0)
1097   {
1098     dvi_buf[dvi_ptr]= 141; 
1099     incr(dvi_ptr); 
1100     if(dvi_ptr == dvi_limit)dvi_swap (); 
1101   } 
1102   if(cur_s > max_push)
1103   max_push = cur_s; 
1104   saveloc = dvi_offset + dvi_ptr; 
1105   leftedge = cur_h; 
1106   cur_v = cur_v - mem[thisbox + 3].cint; 
1107   topedge = cur_v; 
1108   while(p != 0){  /* while p<>null do l.12494 OK */
1109     if((p >= hi_mem_min)) {
1110     confusion(822);   /* vlist_out */
1111     return;       // abort_flag set
1112   }
1113     else {
1114       switch(mem[p].hh.b0)
1115       {case 0 : 
1116       case 1 : 
1117 /* if list_ptr(p)=null then cur_v:=cur_v+height(p)+depth(p) l.12529 */
1118   if(mem[p + 5].hh.v.RH == 0)
1119   cur_v = cur_v + mem[p + 3].cint + mem[p + 2].cint; 
1120   else {
1121       
1122     cur_v = cur_v + mem[p + 3].cint; 
1123     if(cur_v != dvi_v)
1124     {
1125       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1126       dvi_v = cur_v; 
1127     } 
1128     saveh = dvi_h; 
1129     savev = dvi_v; 
1130     cur_h = leftedge + mem[p + 4].cint; 
1131     temp_ptr = p; 
1132     if(mem[p].hh.b0 == 1)vlist_out (); 
1133     else hlist_out ();
1134     dvi_h = saveh; 
1135     dvi_v = savev; 
1136     cur_v = savev + mem[p + 2].cint; 
1137     cur_h = leftedge; 
1138   } 
1139   break; 
1140       case 2 : 
1141   {
1142     rule_ht = mem[p + 3].cint; 
1143     rule_dp = mem[p + 2].cint; 
1144     rule_wd = mem[p + 1].cint; 
1145     goto lab14; 
1146   } 
1147   break; 
1148       case 8 : 
1149       out_what(p);
1150       break; 
1151       case 10 : 
1152   {
1153     g = mem[p + 1].hh.v.LH; 
1154     rule_ht = mem[g + 1].cint; 
1155     if(gsign != 0)
1156     {
1157       if(gsign == 1)
1158       {
1159         if(mem[g].hh.b0 == gorder)
1160 /* ************************************************************************ */
1161 /*        rule_ht = rule_ht + round(mem[thisbox + 6].gr * mem[g + 2].cint); */
1162 /* ************************ 3.14159 **************************************** */
1163         {
1164     gluetemp = mem[thisbox + 6].gr * mem[g + 2].cint; 
1165     if(gluetemp > 1000000000.0)
1166     gluetemp = 1000000000.0; 
1167     else if(gluetemp < -1000000000.0)
1168     gluetemp = -1000000000.0; 
1169     rule_ht = rule_ht + round(gluetemp); 
1170         } 
1171 /* ************************************************************************* */
1172       } 
1173 /* ************************************************************************* */
1174 /*      else { */
1175 /*        if(mem[g].hh.b1 == gorder) */
1176 /*        rule_ht = rule_ht - round(mem[thisbox + 6].gr * mem[g + 3].cint); */
1177 /*      } */
1178       else if(mem[g].hh.b1 == gorder)   /* BUG FIX !!! */
1179         {
1180         gluetemp = mem[thisbox + 6].gr * mem[g + 3].cint; 
1181         if(gluetemp > 1000000000.0)
1182         gluetemp = 1000000000.0; 
1183         else if(gluetemp < -1000000000.0)
1184         gluetemp = -1000000000.0; 
1185         rule_ht = rule_ht - round(gluetemp); 
1186       } 
1187 /* ************************************************************************* */
1188     } 
1189     if(mem[p].hh.b1 >= 100)
1190     {
1191       leaderbox = mem[p + 1].hh.v.RH; 
1192       if(mem[leaderbox].hh.b0 == 2)
1193       {
1194         rule_wd = mem[leaderbox + 1].cint; 
1195         rule_dp = 0; 
1196         goto lab14; 
1197       } 
1198       leaderht = mem[leaderbox + 3].cint + mem[leaderbox + 2]
1199      .cint; 
1200       if((leaderht > 0)&&(rule_ht > 0)) 
1201       {
1202         rule_ht = rule_ht + 10; 
1203         edge = cur_v + rule_ht; 
1204         lx = 0; 
1205         if(mem[p].hh.b1 == 100)
1206         {
1207     savev = cur_v; 
1208     cur_v = topedge + leaderht *((cur_v - topedge)/ leaderht)
1209     ; 
1210     if(cur_v < savev)
1211     cur_v = cur_v + leaderht; 
1212         } 
1213         else {
1214       
1215     lq = rule_ht / leaderht; 
1216     lr = rule_ht % leaderht; 
1217     if(mem[p].hh.b1 == 101)
1218     cur_v = cur_v +(lr / 2); 
1219     else {
1220         
1221       lx =(2 * lr + lq + 1)/(2 * lq + 2); 
1222       cur_v = cur_v +((lr -(lq - 1)* lx)/ 2); 
1223     } 
1224         } 
1225         while(cur_v + leaderht <= edge){
1226       
1227     cur_h = leftedge + mem[leaderbox + 4].cint; 
1228     if(cur_h != dvi_h)
1229     {
1230       movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1231       dvi_h = cur_h; 
1232     } 
1233     saveh = dvi_h; 
1234     cur_v = cur_v + mem[leaderbox + 3].cint; 
1235     if(cur_v != dvi_v)
1236     {
1237       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1238       dvi_v = cur_v; 
1239     } 
1240     savev = dvi_v; 
1241     temp_ptr = leaderbox; 
1242     outerdoingleaders = doing_leaders; 
1243     doing_leaders = true; 
1244     if(mem[leaderbox].hh.b0 == 1)vlist_out (); 
1245     else hlist_out (); 
1246     doing_leaders = outerdoingleaders; 
1247     dvi_v = savev; 
1248     dvi_h = saveh; 
1249 /* ************************************************************************ */
1250 /*    cur_h = saveh;  */
1251     cur_h = leftedge;  /* 3.1415 */
1252 /* ************************************************************************ */
1253     cur_v = savev - mem[leaderbox + 3].cint + leaderht + lx; 
1254         } 
1255         cur_v = edge - 10; 
1256         goto lab15; 
1257       } 
1258     } 
1259     goto lab13; 
1260   } 
1261   break; 
1262       case 11 : 
1263   cur_v = cur_v + mem[p + 1].cint; 
1264   break; 
1265   default: 
1266   ; 
1267   break; 
1268       } 
1269       goto lab15; 
1270       lab14: if((rule_wd == -1073741824L))    /* -2^30 */
1271       rule_wd = mem[thisbox + 1].cint; 
1272       rule_ht = rule_ht + rule_dp; 
1273       cur_v = cur_v + rule_ht; 
1274       if((rule_ht > 0)&&(rule_wd > 0)) 
1275       {
1276   if(cur_h != dvi_h)
1277   {
1278     movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1279     dvi_h = cur_h; 
1280   } 
1281   if(cur_v != dvi_v)
1282   {
1283     movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1284     dvi_v = cur_v; 
1285   } 
1286   {
1287     dvi_buf[dvi_ptr]= 137; 
1288     incr(dvi_ptr); 
1289     if(dvi_ptr == dvi_limit)dvi_swap (); 
1290   } 
1291   dvi_four(rule_ht); 
1292   dvi_four(rule_wd); 
1293       } 
1294       goto lab15; 
1295       lab13: cur_v = cur_v + rule_ht; 
1296     } 
1297     lab15: p = mem[p].hh.v.RH; 
1298   } 
1299   prune_movements(saveloc); 
1300   if(cur_s > 0)
1301   dvi_pop(saveloc); 
1302   decr(cur_s); 
1303
1304 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1305 void ship_out_(halfword p)
1306 {/* 30 */ 
1307   integer pageloc; 
1308   char j, k; 
1309   pool_pointer s; 
1310   char old_setting; 
1311   if(eqtb[(hash_size + 3197)].cint > 0)
1312   {
1313     print_nl(335);    /*  */
1314     print_ln (); 
1315     print(823);   /* Completed box being shipped out */
1316   } 
1317   if(term_offset > max_print_line - 9)
1318   print_ln (); 
1319   else if((term_offset > 0)||(file_offset > 0)) 
1320   print_char(32);   /*   */
1321   print_char(91);   /*[*/
1322   j = 9; 
1323   while((eqtb[(hash_size + 3218) + j].cint == 0)&&(j > 0)) decr(j); 
1324   {
1325     register integer for_end; 
1326     k = 0; 
1327     for_end = j; 
1328     if(k <= for_end) do 
1329     {
1330       print_int(eqtb[(hash_size + 3218) + k].cint); 
1331       if(k < j)
1332         print_char(46);   /* . */
1333     } 
1334     while(k++ < for_end);
1335   } 
1336 #ifndef _WINDOWS
1337   fflush(stdout); 
1338 #endif
1339   if(eqtb[(hash_size + 3197)].cint > 0)
1340   {
1341     print_char(93);   /*]*/
1342     begin_diagnostic (); 
1343     show_box(p); 
1344     end_diagnostic(true); 
1345   } 
1346   if((mem[p + 3].cint > 1073741823L)|| /* 2^30 - 1 */
1347     (mem[p + 2].cint > 1073741823L)||
1348     (mem[p + 3].cint + mem[p + 2].cint +
1349      eqtb[(hash_size + 3749)].cint > 1073741823L)||
1350     (mem[p + 1].cint + eqtb[(hash_size + 3748)].cint > 1073741823L)) 
1351   {
1352           print_err("Huge page cannot be shipped out");
1353     {
1354       help_ptr = 2; 
1355       help_line[1]= 828;  /* The page just created is more than 18 feet tall or */
1356       help_line[0]= 829;  /* more than 18 feet wide, so I suspect something went wrong. */
1357     } 
1358     error (); 
1359     if(eqtb[(hash_size + 3197)].cint <= 0)
1360     {
1361       begin_diagnostic (); 
1362       print_nl(830);    /* The following box has been deleted: */
1363       show_box(p); 
1364       end_diagnostic(true); 
1365     } 
1366     goto lab30; 
1367   } 
1368   if(mem[p + 3].cint + mem[p + 2].cint + eqtb[(hash_size + 3749)].cint > max_v 
1369 )
1370   max_v = mem[p + 3].cint + mem[p + 2].cint + eqtb[(hash_size + 3749)].cint; 
1371   if(mem[p + 1].cint + eqtb[(hash_size + 3748)].cint > max_h)
1372   max_h = mem[p + 1].cint + eqtb[(hash_size + 3748)].cint; 
1373   dvi_h = 0; 
1374   dvi_v = 0; 
1375   cur_h = eqtb[(hash_size + 3748)].cint; 
1376   dvi_f = 0; 
1377   if(output_file_name == 0)
1378   {
1379     if(job_name == 0)open_log_file (); 
1380     pack_job_name(788);   /* .dvi */
1381     while(! b_open_out(dvi_file)) {
1382     prompt_file_name(789, 788); /* file name for output  .dvi */
1383   }
1384     output_file_name = b_make_name_string(dvi_file); 
1385   } 
1386
1387   if(total_pages == 0)
1388   {
1389     {
1390       dvi_buf[dvi_ptr]= 247; 
1391       incr(dvi_ptr); 
1392       if(dvi_ptr == dvi_limit)dvi_swap (); 
1393     } 
1394     {
1395       dvi_buf[dvi_ptr]= 2; 
1396       incr(dvi_ptr); 
1397       if(dvi_ptr == dvi_limit)dvi_swap (); 
1398     } 
1399     dvi_four(25400000L);  /* magic DVI scale factor */
1400     dvi_four(473628672L); /* 7227 * 65536 */
1401     prepare_mag (); 
1402     dvi_four(eqtb[(hash_size + 3180)].cint); 
1403     old_setting = selector; 
1404     selector = 21; 
1405     print(821);   /* TeX output  */
1406     print_int(eqtb[(hash_size + 3186)].cint); 
1407     print_char(46); /* . */
1408     print_two(eqtb[(hash_size + 3185)].cint); 
1409     print_char(46); /* . */
1410     print_two(eqtb[(hash_size + 3184)].cint); 
1411     print_char(58); /* : */
1412     print_two(eqtb[(hash_size + 3183)].cint / 60); 
1413     print_two(eqtb[(hash_size + 3183)].cint % 60); 
1414     selector = old_setting; 
1415     {
1416 /*    long to unsigned char ... */
1417       dvi_buf[dvi_ptr]=(pool_ptr - str_start[str_ptr]); 
1418       incr(dvi_ptr); 
1419       if(dvi_ptr == dvi_limit)dvi_swap (); 
1420     } 
1421     {
1422     register integer for_end; 
1423     s = str_start[str_ptr]; 
1424     for_end = pool_ptr - 1; 
1425     if(s <= for_end) do 
1426     {
1427       dvi_buf[dvi_ptr]= str_pool[s]; 
1428       incr(dvi_ptr); 
1429       if(dvi_ptr == dvi_limit)dvi_swap (); 
1430     } 
1431     while(s++ < for_end);
1432   } 
1433     pool_ptr = str_start[str_ptr]; 
1434   } // end of if total_pages == 0
1435
1436   pageloc = dvi_offset + dvi_ptr; 
1437   {
1438     dvi_buf[dvi_ptr]= 139; 
1439     incr(dvi_ptr); 
1440     if(dvi_ptr == dvi_limit)dvi_swap (); 
1441   } 
1442   {
1443     register integer for_end; 
1444     k = 0; 
1445     for_end = 9; 
1446     if(k <= for_end) do 
1447       dvi_four(eqtb[(hash_size + 3218) + k].cint); 
1448       while(k++ < for_end);
1449   } 
1450   dvi_four(last_bop); 
1451   last_bop = pageloc; 
1452   cur_v = mem[p + 3].cint + eqtb[(hash_size + 3749)].cint; 
1453   temp_ptr = p; 
1454   if(mem[p].hh.b0 == 1)vlist_out (); 
1455   else hlist_out (); 
1456   {
1457     dvi_buf[dvi_ptr]= 140; 
1458     incr(dvi_ptr); 
1459     if(dvi_ptr == dvi_limit)dvi_swap (); 
1460   } 
1461   incr(total_pages); 
1462   cur_s = -1; 
1463   lab30:; 
1464   if(eqtb[(hash_size + 3197)].cint <= 0)
1465   print_char(93);   /*]*/
1466   dead_cycles = 0; 
1467 #ifndef _WINDOWS
1468   fflush(stdout); 
1469 #endif
1470   ;
1471 #ifdef STAT
1472   if(eqtb[(hash_size + 3194)].cint > 1)
1473   {
1474     print_nl(824);        /* Memory usage before:  */
1475     print_int(var_used); 
1476     print_char(38);       /* & */
1477     print_int(dyn_used); 
1478     print_char(59);       /*; */
1479   } 
1480 #endif /* STAT */
1481   flush_node_list(p); 
1482   ;
1483 #ifdef STAT
1484   if(eqtb[(hash_size + 3194)].cint > 1)
1485   {
1486     print(825);         /* after */
1487     print_int(var_used); 
1488     print_char(38);         /* & */
1489     print_int(dyn_used); 
1490     print(826);         /* still utouched */
1491     print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1492     print_ln (); 
1493   } 
1494 #endif /* STAT */
1495
1496 void scan_spec_(group_code c, bool threecodes)
1497 {/* 40 */ 
1498   integer s; 
1499   char speccode; 
1500   if(threecodes)
1501     s = save_stack[save_ptr + 0].cint; 
1502   if(scan_keyword(836))   /* to */
1503     speccode = 0; 
1504   else if(scan_keyword(837))  /* spread */
1505     speccode = 1; 
1506   else {
1507     speccode = 1; 
1508     cur_val = 0; 
1509     goto lab40; 
1510   } 
1511   scan_dimen(false, false, false); 
1512   lab40: if(threecodes)
1513   {
1514     save_stack[save_ptr + 0].cint = s;  /* s may be used without ... */
1515     incr(save_ptr); 
1516   } 
1517   save_stack[save_ptr + 0].cint = speccode; 
1518   save_stack[save_ptr + 1].cint = cur_val; 
1519   save_ptr = save_ptr + 2; 
1520   new_save_level(c); 
1521   scan_left_brace (); 
1522
1523 halfword hpack_(halfword p, scaled w, small_number m)
1524 {/* 21 50 10 */ register halfword Result;
1525   halfword r; 
1526   halfword q; 
1527   scaled h, d, x; 
1528   scaled s; 
1529   halfword g; 
1530 /*  glue_ord o;  */
1531   int o;              /* 95/Jan/7 */
1532   internal_font_number f; 
1533   ffourquarters i; 
1534   eight_bits hd; 
1535   last_badness = 0; 
1536   r = get_node(7); 
1537   mem[r].hh.b0 = 0; 
1538   mem[r].hh.b1 = 0; 
1539   mem[r + 4].cint = 0; 
1540   q = r + 5; 
1541   mem[q].hh.v.RH = p; 
1542   h = 0; 
1543   d = 0; 
1544   x = 0; 
1545   totalstretch[0]= 0; 
1546   totalshrink[0]= 0; 
1547   totalstretch[1]= 0; 
1548   totalshrink[1]= 0; 
1549   totalstretch[2]= 0; 
1550   totalshrink[2]= 0; 
1551   totalstretch[3]= 0; 
1552   totalshrink[3]= 0; 
1553   while(p != 0){ /* while p<>null do l.12862 */
1554       
1555     lab21: while((p >= hi_mem_min)) {
1556   
1557       f = mem[p].hh.b0; 
1558       i = font_info[char_base[f]+ mem[p].hh.b1].qqqq; 
1559       hd = i.b1; 
1560       x = x + font_info[width_base[f]+ i.b0].cint; 
1561       s = font_info[height_base[f]+(hd)/ 16].cint; 
1562       if(s > h)
1563       h = s; 
1564       s = font_info[depth_base[f]+(hd)% 16].cint; 
1565       if(s > d)
1566       d = s; 
1567       p = mem[p].hh.v.RH; 
1568     } 
1569     if(p != 0)  /* if p<>null then l.12886 */
1570     {
1571       switch(mem[p].hh.b0)
1572       {case 0 : 
1573       case 1 : 
1574       case 2 : 
1575       case 13 : 
1576   {
1577     x = x + mem[p + 1].cint; 
1578     if(mem[p].hh.b0 >= 2)
1579     s = 0; 
1580     else s = mem[p + 4].cint; 
1581     if(mem[p + 3].cint - s > h)
1582     h = mem[p + 3].cint - s; 
1583     if(mem[p + 2].cint + s > d)
1584     d = mem[p + 2].cint + s; 
1585   } 
1586   break; 
1587       case 3 : 
1588       case 4 : 
1589       case 5 : 
1590 /* if adjust_tail<>null then link(adjust_tail):=null; l.12865 / 12891 */
1591   if(adjust_tail != 0)
1592   {
1593     while(mem[q].hh.v.RH != p)q = mem[q].hh.v.RH; 
1594     if(mem[p].hh.b0 == 5)
1595     {
1596       mem[adjust_tail].hh.v.RH = mem[p + 1].cint; 
1597       while(mem[adjust_tail].hh.v.RH != 0)adjust_tail = mem[
1598       adjust_tail].hh.v.RH; 
1599       p = mem[p].hh.v.RH; 
1600       free_node(mem[q].hh.v.RH, 2); 
1601     } 
1602     else {
1603         
1604       mem[adjust_tail].hh.v.RH = p; 
1605       adjust_tail = p; 
1606       p = mem[p].hh.v.RH; 
1607     } 
1608     mem[q].hh.v.RH = p; 
1609     p = q; 
1610   } 
1611   break; 
1612       case 8 : 
1613   ; 
1614   break; 
1615       case 10 : 
1616   {
1617     g = mem[p + 1].hh.v.LH; 
1618     x = x + mem[g + 1].cint; 
1619     o = mem[g].hh.b0; 
1620     totalstretch[o]= totalstretch[o]+ mem[g + 2].cint; 
1621     o = mem[g].hh.b1; 
1622     totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; 
1623     if(mem[p].hh.b1 >= 100)
1624     {
1625       g = mem[p + 1].hh.v.RH; 
1626       if(mem[g + 3].cint > h)
1627       h = mem[g + 3].cint; 
1628       if(mem[g + 2].cint > d)
1629       d = mem[g + 2].cint; 
1630     } 
1631   } 
1632   break; 
1633       case 11 : 
1634       case 9 : 
1635   x = x + mem[p + 1].cint; 
1636   break; 
1637       case 6 : 
1638   {
1639     mem[mem_top - 12]= mem[p + 1]; 
1640     mem[mem_top - 12].hh.v.RH = mem[p].hh.v.RH; 
1641     p = mem_top - 12; 
1642     goto lab21; 
1643   } 
1644   break; 
1645   default: 
1646   ; 
1647   break; 
1648       } 
1649       p = mem[p].hh.v.RH; 
1650     } 
1651   } 
1652   if(adjust_tail != 0)
1653   mem[adjust_tail].hh.v.RH = 0; 
1654   mem[r + 3].cint = h; 
1655   mem[r + 2].cint = d; 
1656   if(m == 1)
1657   w = x + w; 
1658   mem[r + 1].cint = w; 
1659   x = w - x; 
1660   if(x == 0)
1661   {
1662     mem[r + 5].hh.b0 = 0; 
1663     mem[r + 5].hh.b1 = 0; 
1664     mem[r + 6].gr = 0.0; 
1665     goto lab10; 
1666   } 
1667   else if(x > 0)
1668   {
1669     if(totalstretch[3]!= 0)
1670     o = 3; 
1671     else if(totalstretch[2]!= 0)
1672     o = 2; 
1673     else if(totalstretch[1]!= 0)
1674     o = 1; 
1675     else o = 0; 
1676     mem[r + 5].hh.b1 = o; 
1677     mem[r + 5].hh.b0 = 1; 
1678 /* if total_stretch[o]<>0 then glue_set(r):=... l.12982 */
1679     if(totalstretch[o]!= 0)
1680     mem[r + 6].gr = x / ((double) totalstretch[o]); 
1681     else {
1682   
1683       mem[r + 5].hh.b0 = 0; 
1684       mem[r + 6].gr = 0.0; 
1685     } 
1686 /* if o=normal then if list_ptr(r)<>null then l.12987 */
1687     if(o == 0)
1688     if(mem[r + 5].hh.v.RH != 0)
1689     {
1690       last_badness = badness(x, totalstretch[0]); 
1691       if(last_badness > eqtb[(hash_size + 3189)].cint)
1692       {
1693   print_ln (); 
1694   if(last_badness > 100)
1695     print_nl(838);    /* Underfull */
1696   else print_nl(839);   /* Loose */
1697   print(840);       /* \hbox (badness */
1698   print_int(last_badness); 
1699   if(last_badness > 100)underfull_hbox++;   /* 1996/Feb/9 */
1700   goto lab50; 
1701       } 
1702     } 
1703     goto lab10; 
1704   } 
1705   else {
1706       
1707     if(totalshrink[3]!= 0)
1708     o = 3; 
1709     else if(totalshrink[2]!= 0)
1710     o = 2; 
1711     else if(totalshrink[1]!= 0)
1712     o = 1; 
1713     else o = 0; 
1714     mem[r + 5].hh.b1 = o; 
1715     mem[r + 5].hh.b0 = 2; 
1716     if(totalshrink[o]!= 0)
1717     mem[r + 6].gr =(- (integer) x)/ ((double) totalshrink[o]); 
1718     else {
1719   
1720       mem[r + 5].hh.b0 = 0; 
1721       mem[r + 6].gr = 0.0; 
1722     } 
1723 /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13946 */
1724     if((totalshrink[o]< - (integer) x)&&(o == 0)&&(mem[r + 5 
1725   ].hh.v.RH != 0)) 
1726     {
1727       last_badness = 1000000L; 
1728 /*   set_glue_ratio_one(glue_set(r)); {use the maximum shrinkage} */
1729       mem[r + 6].gr = 1.0; 
1730 /* if (-x-total_shrink[normal]>hfuzz)or(hbadness<100) then */
1731       if((- (integer) x - totalshrink[0]> eqtb[(hash_size + 3738)].cint)||(
1732       eqtb[(hash_size + 3189)].cint < 100)) 
1733       {
1734   if((eqtb[(hash_size + 3746)].cint > 0)&&(- (integer) x - totalshrink[0 
1735   ] > eqtb[(hash_size + 3738)].cint)) 
1736   {
1737     while(mem[q].hh.v.RH != 0)q = mem[q].hh.v.RH; 
1738     mem[q].hh.v.RH = new_rule (); 
1739     mem[mem[q].hh.v.RH + 1].cint = eqtb[(hash_size + 3746)].cint; 
1740   } 
1741   print_ln (); 
1742   print_nl(846);    /* Overfull \hbox(*/
1743   print_scaled(- (integer) x - totalshrink[0]); 
1744   print(847);     /* pt too wide */
1745   overfull_hbox++;      /* 1996/Feb/9 */
1746   goto lab50; 
1747       } 
1748     } 
1749     else if(o == 0)
1750     if(mem[r + 5].hh.v.RH != 0)
1751     {
1752       last_badness = badness(- (integer) x, totalshrink[0]); 
1753       if(last_badness > eqtb[(hash_size + 3189)].cint)
1754       {
1755   print_ln (); 
1756   print_nl(848);  /* Tight \hbox (badness  */
1757   print_int(last_badness); 
1758   goto lab50; 
1759       } 
1760     } 
1761     goto lab10; 
1762   } 
1763   lab50: if(output_active)
1764   print(841); /*)has occurred while \output is active */
1765   else {
1766       
1767     if(pack_begin_line != 0)
1768     {
1769       if(pack_begin_line > 0)
1770       print(842); /*)in paragraph at lines  */
1771       else print(843);  /*)in alignment at lines  */
1772       print_int(abs(pack_begin_line)); 
1773       print(844); /* -- */
1774     } 
1775     else print(845);  /*)detected at line  */
1776     print_int(line); 
1777   } 
1778   print_ln (); 
1779   font_in_short_display = 0; 
1780   short_display(mem[r + 5].hh.v.RH); 
1781   print_ln (); 
1782   begin_diagnostic (); 
1783   show_box(r); 
1784   end_diagnostic(true); 
1785   lab10: Result = r; 
1786   return Result; 
1787
1788 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1789 {/* 50 10 */ register halfword Result; 
1790   halfword r; 
1791   scaled w, d, x; 
1792   scaled s; 
1793   halfword g; 
1794 /*  glue_ord o;  */
1795   int o;              /* 95/Jan/7 */
1796   last_badness = 0; 
1797   r = get_node(7); 
1798   mem[r].hh.b0 = 1; 
1799   mem[r].hh.b1 = 0; 
1800   mem[r + 4].cint = 0; 
1801   mem[r + 5].hh.v.RH = p; 
1802   w = 0; 
1803   d = 0; 
1804   x = 0; 
1805   totalstretch[0]= 0; 
1806   totalshrink[0]= 0; 
1807   totalstretch[1]= 0; 
1808   totalshrink[1]= 0; 
1809   totalstretch[2]= 0; 
1810   totalshrink[2]= 0; 
1811   totalstretch[3]= 0; 
1812   totalshrink[3]= 0; 
1813   while(p != 0){
1814       
1815     if((p >= hi_mem_min)) {
1816     confusion(849);   /* vpack */
1817     return 0;       // abort_flag set
1818   }
1819     else switch(mem[p].hh.b0)
1820     {case 0 : 
1821     case 1 : 
1822     case 2 : 
1823     case 13 : 
1824       {
1825   x = x + d + mem[p + 3].cint; 
1826   d = mem[p + 2].cint; 
1827   if(mem[p].hh.b0 >= 2)
1828   s = 0; 
1829   else s = mem[p + 4].cint; 
1830   if(mem[p + 1].cint + s > w)
1831   w = mem[p + 1].cint + s; 
1832       } 
1833       break; 
1834     case 8 : 
1835    ; 
1836       break; 
1837     case 10 : 
1838       {
1839   x = x + d; 
1840   d = 0; 
1841   g = mem[p + 1].hh.v.LH; 
1842   x = x + mem[g + 1].cint; 
1843   o = mem[g].hh.b0; 
1844   totalstretch[o]= totalstretch[o]+ mem[g + 2].cint; 
1845   o = mem[g].hh.b1; 
1846   totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; 
1847   if(mem[p].hh.b1 >= 100)
1848   {
1849     g = mem[p + 1].hh.v.RH; 
1850     if(mem[g + 1].cint > w)
1851     w = mem[g + 1].cint; 
1852   } 
1853       } 
1854       break; 
1855     case 11 : 
1856       {
1857   x = x + d + mem[p + 1].cint; 
1858   d = 0; 
1859       } 
1860       break; 
1861       default: 
1862    ; 
1863       break; 
1864     } 
1865     p = mem[p].hh.v.RH; 
1866   } 
1867   mem[r + 1].cint = w; 
1868   if(d > l)
1869   {
1870     x = x + d - l; 
1871     mem[r + 2].cint = l; 
1872   } 
1873   else mem[r + 2].cint = d; 
1874   if(m == 1)
1875   h = x + h; 
1876   mem[r + 3].cint = h; 
1877   x = h - x; 
1878   if(x == 0)
1879   {
1880     mem[r + 5].hh.b0 = 0; 
1881     mem[r + 5].hh.b1 = 0; 
1882     mem[r + 6].gr = 0.0; 
1883     goto lab10; 
1884   } 
1885   else if(x > 0)
1886   {
1887     if(totalstretch[3]!= 0)
1888     o = 3; 
1889     else if(totalstretch[2]!= 0)
1890     o = 2; 
1891     else if(totalstretch[1]!= 0)
1892     o = 1; 
1893     else o = 0; 
1894     mem[r + 5].hh.b1 = o; 
1895     mem[r + 5].hh.b0 = 1; 
1896     if(totalstretch[o]!= 0)
1897     mem[r + 6].gr = x / ((double) totalstretch[o]); 
1898     else {
1899   
1900       mem[r + 5].hh.b0 = 0; 
1901       mem[r + 6].gr = 0.0; 
1902     } 
1903     if(o == 0)
1904     if(mem[r + 5].hh.v.RH != 0)
1905     {
1906       last_badness = badness(x, totalstretch[0]); 
1907       if(last_badness > eqtb[(hash_size + 3190)].cint)
1908       {
1909   print_ln (); 
1910   if(last_badness > 100)
1911     print_nl(838);      /* Underfull */
1912   else print_nl(839);     /* Loose */
1913   print(850);         /* \vbox (badness */
1914   print_int(last_badness); 
1915   if(last_badness > 100)underfull_vbox++; /* 1996/Feb/9 */
1916   goto lab50; 
1917       } 
1918     } 
1919     goto lab10; 
1920   } 
1921   else {
1922       
1923     if(totalshrink[3]!= 0)
1924     o = 3; 
1925     else if(totalshrink[2]!= 0)
1926     o = 2; 
1927     else if(totalshrink[1]!= 0)
1928     o = 1; 
1929     else o = 0; 
1930     mem[r + 5].hh.b1 = o; 
1931     mem[r + 5].hh.b0 = 2; 
1932     if(totalshrink[o]!= 0)
1933     mem[r + 6].gr =(- (integer) x)/ ((double) totalshrink[o]); 
1934     else {
1935   
1936       mem[r + 5].hh.b0 = 0; 
1937       mem[r + 6].gr = 0.0; 
1938     } 
1939 /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13046 */
1940     if((totalshrink[o]< - (integer) x)&&(o == 0)&&(mem[r + 5 
1941   ].hh.v.RH != 0)) 
1942     {
1943       last_badness = 1000000L; 
1944       mem[r + 6].gr = 1.0; 
1945       if((- (integer) x - totalshrink[0]> eqtb[(hash_size + 3739)].cint)||(
1946       eqtb[(hash_size + 3190)].cint < 100)) 
1947       {
1948   print_ln (); 
1949   print_nl(851);  /* Overfull \vbox(*/
1950   print_scaled(- (integer) x - totalshrink[0]); 
1951   print(852);   /* pt too high */
1952   overfull_vbox++;    /* 1996/Feb/9 */
1953   goto lab50; 
1954       } 
1955     } 
1956 /* else if o=normal then if list_ptr(r)<>null then l.13052  */
1957     else if(o == 0)
1958     if(mem[r + 5].hh.v.RH != 0)
1959     {
1960       last_badness = badness(- (integer) x, totalshrink[0]); 
1961       if(last_badness > eqtb[(hash_size + 3190)].cint)
1962       {
1963   print_ln (); 
1964   print_nl(853);  /* Tight \vbox (badness  */
1965   print_int(last_badness); 
1966   goto lab50; 
1967       } 
1968     } 
1969     goto lab10; 
1970   } 
1971   lab50: if(output_active)
1972   print(841); /*)has occurred while \output is active */
1973   else {
1974       
1975     if(pack_begin_line != 0)
1976     {
1977       print(843); /*)in alignment at lines  */
1978       print_int(abs(pack_begin_line)); 
1979       print(844); /* -- */
1980     } 
1981     else print(845);  /*)detected at line  */
1982     print_int(line); 
1983     print_ln (); 
1984   } 
1985   begin_diagnostic (); 
1986   show_box(r); 
1987   end_diagnostic(true); 
1988   lab10: Result = r; 
1989   return Result; 
1990
1991 void append_to_vlist_(halfword b)
1992
1993   scaled d; 
1994   halfword p; 
1995   if(cur_list.aux_field.cint > ignore_depth)
1996   {
1997     d = mem[eqtb[(hash_size + 783)].hh.v.RH + 1].cint - cur_list.aux_field.cint - 
1998     mem[b + 3].cint; 
1999     if(d < eqtb[(hash_size + 3732)].cint)
2000     p = new_param_glue(0); 
2001     else {
2002   
2003       p = new_skip_param(1); 
2004       mem[temp_ptr + 1].cint = d; 
2005     } 
2006     mem[tail].hh.v.RH = p; 
2007     tail = p; 
2008   } 
2009   mem[tail].hh.v.RH = b; 
2010   tail = b; 
2011   cur_list.aux_field.cint = mem[b + 2].cint; 
2012
2013 halfword new_noad (void) 
2014 {register halfword Result; 
2015   halfword p; 
2016   p = get_node(4); 
2017   mem[p].hh.b0 = 16; 
2018   mem[p].hh.b1 = 0; 
2019   mem[p + 1].hh = empty_field; 
2020   mem[p + 3].hh = empty_field; 
2021   mem[p + 2].hh = empty_field; 
2022   Result = p; 
2023   return Result; 
2024
2025 halfword new_style_(small_number s)
2026 {register halfword Result; 
2027   halfword p; 
2028   p = get_node(3); 
2029   mem[p].hh.b0 = 14; 
2030   mem[p].hh.b1 = s; 
2031   mem[p + 1].cint = 0; 
2032   mem[p + 2].cint = 0; 
2033   Result = p; 
2034   return Result; 
2035
2036 halfword new_choice (void) 
2037 {register halfword Result; 
2038   halfword p; 
2039   p = get_node(3); 
2040   mem[p].hh.b0 = 15; 
2041   mem[p].hh.b1 = 0; 
2042   mem[p + 1].hh.v.LH = 0; 
2043   mem[p + 1].hh.v.RH = 0; 
2044   mem[p + 2].hh.v.LH = 0; 
2045   mem[p + 2].hh.v.RH = 0; 
2046   Result = p; 
2047   return Result; 
2048
2049 void show_info (void) 
2050
2051   show_node_list(mem[temp_ptr].hh.v.LH); 
2052
2053 halfword fraction_rule_(scaled t)
2054 {register halfword Result;
2055   halfword p; 
2056   p = new_rule (); 
2057   mem[p + 3].cint = t; 
2058   mem[p + 2].cint = 0; 
2059   Result = p; 
2060   return Result; 
2061
2062 halfword overbar_(halfword b, scaled k, scaled t)
2063 {register halfword Result;
2064   halfword p, q; 
2065   p = new_kern(k); 
2066   mem[p].hh.v.RH = b; 
2067   q = fraction_rule(t); 
2068   mem[q].hh.v.RH = p; 
2069   p = new_kern(t); 
2070   mem[p].hh.v.RH = q; 
2071   Result = vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
2072   return Result; 
2073
2074 halfword char_box_(internal_font_number f, quarterword c)
2075 {register halfword Result;
2076   ffourquarters q; 
2077   eight_bits hd; 
2078   halfword b, p; 
2079   q = font_info[char_base[f]+ c].qqqq; 
2080   hd = q.b1; 
2081   b = new_null_box (); 
2082   mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + font_info 
2083  [italic_base[f]+(q.b2)/ 4].cint; 
2084   mem[b + 3].cint = font_info[height_base[f]+(hd)/ 16].cint; 
2085   mem[b + 2].cint = font_info[depth_base[f]+(hd)% 16].cint; 
2086 /*  long to unsigned short ... */
2087   p = get_avail (); 
2088   mem[p].hh.b1 = c; 
2089   mem[p].hh.b0 = f; 
2090   mem[b + 5].hh.v.RH = p; 
2091   Result = b; 
2092   return Result; 
2093
2094 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
2095 {
2096   halfword p; 
2097   p = char_box(f, c); 
2098   mem[p].hh.v.RH = mem[b + 5].hh.v.RH; 
2099   mem[b + 5].hh.v.RH = p; 
2100   mem[b + 3].cint = mem[p + 3].cint; 
2101
2102 scaled height_plus_depth_(internal_font_number f, fquarterword c)
2103 {register scaled Result; 
2104   ffourquarters q; 
2105   eight_bits hd; 
2106   q = font_info[char_base[f]+ c].qqqq; 
2107   hd = q.b1; 
2108   Result = font_info[height_base[f]+(hd)/ 16].cint + font_info[
2109   depth_base[f]+(hd)% 16].cint; 
2110   return Result; 
2111
2112 halfword var_delimiter_(halfword d, small_number s, scaled v)
2113 {/* 40 22 */ register halfword Result; 
2114   halfword b; 
2115   internal_font_number f, g; 
2116   quarterword c, x, y; 
2117   integer m, n; 
2118   scaled u; 
2119   scaled w; 
2120   ffourquarters q; 
2121   ffourquarters r; 
2122   eight_bits hd; 
2123 /*  small_number z;  */
2124   int z;                  /* 95/Jan/7 */
2125 /*  bool largeattempt;  */
2126   int largeattempt;           /* 95/Jan/7 */
2127   f = 0; 
2128   w = 0; 
2129   largeattempt = false; 
2130   z = mem[d].qqqq.b0; 
2131   x = mem[d].qqqq.b1; 
2132   while(true){
2133     if((z != 0)||(x != 0)) 
2134     {
2135       z = z + s + 16; 
2136       do {
2137     z = z - 16; 
2138   g = eqtb[(hash_size + 1835) + z].hh.v.RH; 
2139   if(g != 0)
2140   {
2141     y = x; 
2142     if((y >= font_bc[g])&&(y <= font_ec[g])) 
2143     {
2144       lab22: q = font_info[char_base[g]+ y].qqqq; 
2145       if((q.b0 > 0)) 
2146       {
2147         if(((q.b2)% 4)== 3)
2148         {
2149     f = g; 
2150     c = y; 
2151     goto lab40; 
2152         } 
2153         hd = q.b1; 
2154         u = font_info[height_base[g]+(hd)/ 16].cint + font_info 
2155        [depth_base[g]+(hd)% 16].cint; 
2156         if(u > w)
2157         {
2158     f = g; 
2159     c = y; 
2160     w = u; 
2161     if(u >= v)
2162     goto lab40; 
2163         } 
2164         if(((q.b2)% 4)== 2)
2165         {
2166     y = q.b3; 
2167     goto lab22; 
2168         } 
2169       } 
2170     } 
2171   } 
2172       } while(!(z < 16)); 
2173     } 
2174     if(largeattempt)
2175     goto lab40; 
2176     largeattempt = true; 
2177     z = mem[d].qqqq.b2; 
2178     x = mem[d].qqqq.b3; 
2179   } 
2180   lab40: if(f != 0)
2181   if(((q.b2)% 4)== 3)   /* q may be used without ... */
2182   {
2183     b = new_null_box (); 
2184     mem[b].hh.b0 = 1; 
2185     r = font_info[exten_base[f]+ q.b3].qqqq; 
2186     c = r.b3; 
2187     u = height_plus_depth(f, c); 
2188     w = 0; 
2189     q = font_info[char_base[f]+ c].qqqq; 
2190     mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + 
2191     font_info[italic_base[f]+(q.b2)/ 4].cint; 
2192     c = r.b2; 
2193     if(c != 0)
2194     w = w + height_plus_depth(f, c); 
2195     c = r.b1; 
2196     if(c != 0)
2197     w = w + height_plus_depth(f, c); 
2198     c = r.b0; 
2199     if(c != 0)
2200     w = w + height_plus_depth(f, c); 
2201     n = 0; 
2202     if(u > 0)
2203     while(w < v){
2204   
2205       w = w + u; 
2206       incr(n); 
2207       if(r.b1 != 0)
2208       w = w + u; 
2209     } 
2210     c = r.b2; 
2211     if(c != 0)
2212     stack_into_box(b, f, c); 
2213     c = r.b3; 
2214     {
2215     register integer for_end; 
2216     m = 1; 
2217     for_end = n; 
2218     if(m <= for_end) do 
2219       stack_into_box(b, f, c); 
2220     while(m++ < for_end);
2221   } 
2222     c = r.b1; 
2223     if(c != 0)
2224     {
2225       stack_into_box(b, f, c); 
2226       c = r.b3; 
2227       {
2228       register integer for_end; 
2229       m = 1; 
2230       for_end = n; 
2231       if(m <= for_end) do 
2232         stack_into_box(b, f, c); 
2233       while(m++ < for_end);
2234     } 
2235     } 
2236     c = r.b0; 
2237     if(c != 0)
2238     stack_into_box(b, f, c); 
2239     mem[b + 2].cint = w - mem[b + 3].cint; 
2240   } 
2241   else b = char_box(f, c); 
2242   else {    /* c may be used without ... */
2243     b = new_null_box (); 
2244     mem[b + 1].cint = eqtb[(hash_size + 3741)].cint; 
2245   } 
2246   mem[b + 4].cint = half(mem[b + 3].cint - mem[b + 2].cint)- 
2247   font_info[22 + param_base[eqtb[(hash_size + 1837) + s].hh.v.RH]].cint; 
2248   Result = b; 
2249   return Result; 
2250 }
2251 /* rebox_ etc used to follow here in tex4.c */