OSDN Git Service

print_string
[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("! ");    /* !  */
41     print_string("Missing character: there is no");
42   }
43   else 
44 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
45   print_nl("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_string("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           help2("On this page there's a \\write with fewer real {'s than }'s.",
677                   "I can't handle that very well; good luck.");
678     error (); 
679     do {
680     get_token (); 
681 /*    } while(!(cur_tok == (hash_size + 4617)));  */
682 /*    } while(!(cur_tok == (hash_size + 4095 + 522)));  */
683     } while(!(cur_tok == (hash_size + hash_extra + 4095 + 522))); /*1996/Jan/10*/
684   } 
685   mode = oldmode; 
686   end_token_list (); 
687   old_setting = selector; 
688   j = mem[p + 1].hh.v.LH; 
689   if(write_open[j])selector = j; 
690   else {
691     if((j == 17)&&(selector == 19)) 
692     selector = 18; 
693     print_nl("");  /*  */
694   } 
695   token_show(def_ref); 
696   print_ln (); 
697   flush_list(def_ref); 
698   selector = old_setting; 
699
700 void out_what_(halfword p)
701 {
702 /*  small_number j;  */
703   int j;            /* 1995/Jan/7 */
704   switch(mem[p].hh.b1)
705   {case 0 : 
706   case 1 : 
707   case 2 : 
708     if(! doing_leaders){
709       j = mem[p + 1].hh.v.LH; 
710       if(mem[p].hh.b1 == 1){
711       write_out(p);
712     }
713       else {
714       if(write_open[j])
715         (void) a_close(write_file[j]); 
716       if(mem[p].hh.b1 == 2)
717         write_open[j]= false; 
718       else if(j < 16){
719         cur_name = mem[p + 1].hh.v.RH; 
720         cur_area = mem[p + 2].hh.v.LH; 
721         cur_ext = mem[p + 2].hh.v.RH; 
722         if(cur_ext == 335)  /* "" */
723           cur_ext = 785;  /* => ".tex" */
724         pack_file_name(cur_name, cur_area, cur_ext); 
725         while(! a_open_out(write_file[j])) {
726           prompt_file_name(1294, 785); /* output file name  .tex */
727     }
728     write_open[j]= true; 
729   } 
730       } 
731     } 
732     break; 
733   case 3 : 
734     special_out(p); 
735     break; 
736   case 4 : 
737  ; 
738     break; 
739     default: 
740     {
741       confusion(1293); /* ext4 */
742       return;       // abort_flag set
743     }
744     break; 
745   } 
746
747 /* following needs access to dvi_buf=zdvibuf see coerce.h */
748 void hlist_out (void) 
749 {/* 21 13 14 15 */ 
750   scaled baseline; 
751   scaled leftedge; 
752   scaled saveh, savev; 
753   halfword thisbox; 
754 /*  glue_ord gorder;  */
755   int gorder;           /* 95/Jan/7 */
756 /*  char gsign;  */
757   int gsign;            /* 95/Jan/7 */
758   halfword p; 
759   integer saveloc; 
760   halfword leaderbox; 
761   scaled leaderwd; 
762   scaled lx; 
763   bool outerdoingleaders; 
764   scaled edge; 
765 /* ********************************************************************* */
766   real gluetemp;  /* new in 3.14159 */
767 /* ********************************************************************* */
768   thisbox = temp_ptr; 
769   gorder = mem[thisbox + 5].hh.b1; 
770   gsign = mem[thisbox + 5].hh.b0; 
771   p = mem[thisbox + 5].hh.v.RH; 
772   incr(cur_s); 
773   if(cur_s > 0)
774   {
775     dvi_buf[dvi_ptr]= 141; 
776     incr(dvi_ptr); 
777     if(dvi_ptr == dvi_limit)dvi_swap (); 
778   } 
779   if(cur_s > max_push)
780   max_push = cur_s; 
781   saveloc = dvi_offset + dvi_ptr; 
782   baseline = cur_v; 
783   leftedge = cur_h; 
784 /* while p<>null do l.12314 */
785   while(p != 0)lab21: if((p >= hi_mem_min)) 
786   {
787     if(cur_h != dvi_h)
788     {
789       movement(cur_h - dvi_h, 143);   /* 143 == right1 */
790       dvi_h = cur_h; 
791     } 
792     if(cur_v != dvi_v)
793     {
794       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
795       dvi_v = cur_v; 
796     } 
797     do {
798   f = mem[p].hh.b0; 
799       c = mem[p].hh.b1; 
800       if(f != dvi_f)
801       {
802   if(! font_used[f])
803   {
804     dvi_font_def(f); 
805     font_used[f]= true; 
806   } 
807   if(f <= 64)
808   {               /* fnt_num_0 --- fnt_num_63 */
809     dvi_buf[dvi_ptr]= f + 170; 
810     incr(dvi_ptr); 
811     if(dvi_ptr == dvi_limit)dvi_swap (); 
812   } 
813 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
814 #ifdef INCREASEFONTS
815   else if(f <= 256){      /* if we allow greater than 256 fonts */
816 #else
817 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
818   else {              /* normal TeX 82 case */
819 #endif
820     {               /* fnt1 followed by f */
821       dvi_buf[dvi_ptr]= 235; 
822       incr(dvi_ptr); 
823       if(dvi_ptr == dvi_limit)dvi_swap (); 
824     } 
825     {
826       dvi_buf[dvi_ptr]= f - 1; 
827       incr(dvi_ptr); 
828       if(dvi_ptr == dvi_limit)dvi_swap (); 
829     } 
830   } 
831 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
832 #ifdef INCREASEFONTS
833   else {              /* fnt2 followed by f / 256,  f % 256 */
834     {
835       dvi_buf[dvi_ptr]= 236;
836       incr(dvi_ptr); 
837       if(dvi_ptr == dvi_limit)dvi_swap (); 
838     } 
839     {
840       dvi_buf[dvi_ptr]= (f - 1) >> 8;   /* top byte */
841       incr(dvi_ptr); 
842       if(dvi_ptr == dvi_limit)dvi_swap (); 
843     }
844     {
845       dvi_buf[dvi_ptr]= (f - 1) & 255;    /* bottom byte */
846       incr(dvi_ptr); 
847       if(dvi_ptr == dvi_limit)dvi_swap (); 
848     }     
849   }
850 #endif
851 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
852     dvi_f = f; 
853       } 
854       if(c >= 128)
855       {
856   dvi_buf[dvi_ptr]= 128; 
857   incr(dvi_ptr); 
858   if(dvi_ptr == dvi_limit)dvi_swap (); 
859       } 
860       {
861   dvi_buf[dvi_ptr]= c; 
862   incr(dvi_ptr); 
863   if(dvi_ptr == dvi_limit)dvi_swap (); 
864       } 
865       cur_h = cur_h + font_info[width_base[f]+ font_info[char_base[f]+ c 
866     ].qqqq.b0].cint; 
867       p = mem[p].hh.v.RH; 
868     } while(!(!(p >= hi_mem_min))); 
869     dvi_h = cur_h; 
870   } 
871   else {
872       
873     switch(mem[p].hh.b0)
874     {case 0 : 
875     case 1 : 
876 /* if list_ptr(p)=null then cur_h:=cur_h+width(p) l.12371 */
877       if(mem[p + 5].hh.v.RH == 0)
878       cur_h = cur_h + mem[p + 1].cint; 
879       else {
880     
881   saveh = dvi_h; 
882   savev = dvi_v; 
883   cur_v = baseline + mem[p + 4].cint; 
884   temp_ptr = p; 
885   edge = cur_h; 
886   if(mem[p].hh.b0 == 1)vlist_out (); 
887   else hlist_out ();
888   dvi_h = saveh; 
889   dvi_v = savev; 
890   cur_h = edge + mem[p + 1].cint; 
891   cur_v = baseline; 
892       } 
893       break; 
894     case 2 : 
895       {
896   rule_ht = mem[p + 3].cint; 
897   rule_dp = mem[p + 2].cint; 
898   rule_wd = mem[p + 1].cint; 
899   goto lab14; 
900       } 
901       break; 
902     case 8 : 
903       out_what(p);
904       break; 
905     case 10 : 
906       {
907   g = mem[p + 1].hh.v.LH; 
908   rule_wd = mem[g + 1].cint; 
909   if(gsign != 0)
910   {
911     if(gsign == 1)
912     {
913       if(mem[g].hh.b0 == gorder)
914 /* *********************************************************************** */
915 /*      rule_wd = rule_wd + round(mem[thisbox + 6].gr * mem[g + 2].cint); */
916 /* ******************** 3.14159 ******************************************* */
917       {
918         gluetemp = mem[thisbox + 6].gr * mem[g + 2].cint; 
919         if(gluetemp > 1000000000.0)
920         gluetemp = 1000000000.0; 
921         else if(gluetemp < -1000000000.0)
922         gluetemp = -1000000000.0; 
923         rule_wd = rule_wd + round(gluetemp); 
924       } 
925 /* ************************************************************************* */
926     } 
927 /*    else { */
928 /*      if(mem[g].hh.b1 == gorder)*/
929 /*      rule_wd = rule_wd - round(mem[thisbox + 6].gr * mem[g + 3].cint); */
930 /*    }  */
931 /* ******************** 3.14159 ******************************************* */
932     else if(mem[g].hh.b1 == gorder)
933     {
934       gluetemp = mem[thisbox + 6].gr * mem[g + 3].cint; 
935       if(gluetemp > 1000000000.0)
936       gluetemp = 1000000000.0; 
937       else if(gluetemp < -1000000000.0)
938       gluetemp = -1000000000.0; 
939       rule_wd = rule_wd - round(gluetemp); 
940     } 
941 /* ************************************************************************* */
942   } 
943   if(mem[p].hh.b1 >= 100)
944   {
945     leaderbox = mem[p + 1].hh.v.RH; 
946     if(mem[leaderbox].hh.b0 == 2)
947     {
948       rule_ht = mem[leaderbox + 3].cint; 
949       rule_dp = mem[leaderbox + 2].cint; 
950       goto lab14; 
951     } 
952     leaderwd = mem[leaderbox + 1].cint; 
953     if((leaderwd > 0)&&(rule_wd > 0)) 
954     {
955       rule_wd = rule_wd + 10; 
956       edge = cur_h + rule_wd; 
957       lx = 0; 
958       if(mem[p].hh.b1 == 100)
959       {
960         saveh = cur_h; 
961         cur_h = leftedge + leaderwd *((cur_h - leftedge)/ leaderwd)
962      ; 
963         if(cur_h < saveh)
964         cur_h = cur_h + leaderwd; 
965       } 
966       else {
967     
968         lq = rule_wd / leaderwd; 
969         lr = rule_wd % leaderwd; 
970         if(mem[p].hh.b1 == 101)
971         cur_h = cur_h +(lr / 2); 
972         else {
973       
974     lx =(2 * lr + lq + 1)/(2 * lq + 2); 
975     cur_h = cur_h +((lr -(lq - 1)* lx)/ 2); 
976         } 
977       } 
978       while(cur_h + leaderwd <= edge){
979     
980         cur_v = baseline + mem[leaderbox + 4].cint; 
981         if(cur_v != dvi_v)
982         {
983     movement(cur_v - dvi_v, 157); /* 157 == down1 */
984     dvi_v = cur_v; 
985         } 
986         savev = dvi_v; 
987         if(cur_h != dvi_h)
988         {
989     movement(cur_h - dvi_h, 143); /* 143 == right1 */
990     dvi_h = cur_h; 
991         } 
992         saveh = dvi_h; 
993         temp_ptr = leaderbox; 
994         outerdoingleaders = doing_leaders; 
995         doing_leaders = true; 
996         if(mem[leaderbox].hh.b0 == 1)vlist_out (); 
997         else hlist_out ();
998         doing_leaders = outerdoingleaders; 
999         dvi_v = savev; 
1000         dvi_h = saveh; 
1001 /* ****************************************************************** */
1002 /*        cur_v = saveh;  */  
1003         cur_v = baseline;   /* changed in 3.1415 */
1004 /* ****************************************************************** */
1005         cur_h = saveh + leaderwd + lx; 
1006       } 
1007       cur_h = edge - 10; 
1008       goto lab15; 
1009     } 
1010   } 
1011   goto lab13; 
1012       } 
1013       break; 
1014     case 11 : 
1015     case 9 : 
1016       cur_h = cur_h + mem[p + 1].cint; 
1017       break; 
1018     case 6 : 
1019       {
1020   mem[mem_top - 12]= mem[p + 1]; 
1021   mem[mem_top - 12].hh.v.RH = mem[p].hh.v.RH; 
1022   p = mem_top - 12; 
1023   goto lab21; 
1024       } 
1025       break; 
1026       default: 
1027    ; 
1028       break; 
1029     } 
1030     goto lab15; 
1031     lab14: if((rule_ht == -1073741824L))  /* - 2^30 */
1032     rule_ht = mem[thisbox + 3].cint; 
1033     if((rule_dp == -1073741824L))     /* - 2^30 */
1034     rule_dp = mem[thisbox + 2].cint; 
1035     rule_ht = rule_ht + rule_dp; 
1036     if((rule_ht > 0)&&(rule_wd > 0)) 
1037     {
1038       if(cur_h != dvi_h)
1039       {
1040   movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1041   dvi_h = cur_h; 
1042       } 
1043       cur_v = baseline + rule_dp; 
1044       if(cur_v != dvi_v)
1045       {
1046   movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1047   dvi_v = cur_v; 
1048       } 
1049       {
1050   dvi_buf[dvi_ptr]= 132; 
1051   incr(dvi_ptr); 
1052   if(dvi_ptr == dvi_limit)dvi_swap (); 
1053       } 
1054       dvi_four(rule_ht); 
1055       dvi_four(rule_wd); 
1056       cur_v = baseline; 
1057       dvi_h = dvi_h + rule_wd; 
1058     } 
1059     lab13: cur_h = cur_h + rule_wd; 
1060     lab15: p = mem[p].hh.v.RH; 
1061   } 
1062   prune_movements(saveloc); 
1063   if(cur_s > 0)
1064   dvi_pop(saveloc); 
1065   decr(cur_s); 
1066
1067 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1068 void vlist_out (void) 
1069 {/* 13 14 15 */ 
1070   scaled leftedge; 
1071   scaled topedge; 
1072   scaled saveh, savev; 
1073   halfword thisbox; 
1074 /*  glue_ord gorder;  */
1075   int gorder;         /* 95/Jan/7 */
1076 /*  char gsign;  */
1077   int gsign;          /* 95/Jan/7 */
1078   halfword p; 
1079   integer saveloc; 
1080   halfword leaderbox; 
1081   scaled leaderht; 
1082   scaled lx; 
1083   bool outerdoingleaders; 
1084   scaled edge; 
1085 /* ************************************************************************ */
1086   real gluetemp;  /* new in 3.14159 */
1087 /* ************************************************************************ */
1088   thisbox = temp_ptr; 
1089   gorder = mem[thisbox + 5].hh.b1; 
1090   gsign = mem[thisbox + 5].hh.b0; 
1091   p = mem[thisbox + 5].hh.v.RH; 
1092   incr(cur_s); 
1093   if(cur_s > 0)
1094   {
1095     dvi_buf[dvi_ptr]= 141; 
1096     incr(dvi_ptr); 
1097     if(dvi_ptr == dvi_limit)dvi_swap (); 
1098   } 
1099   if(cur_s > max_push)
1100   max_push = cur_s; 
1101   saveloc = dvi_offset + dvi_ptr; 
1102   leftedge = cur_h; 
1103   cur_v = cur_v - mem[thisbox + 3].cint; 
1104   topedge = cur_v; 
1105   while(p != 0){  /* while p<>null do l.12494 OK */
1106     if((p >= hi_mem_min)) {
1107     confusion(822);   /* vlist_out */
1108     return;       // abort_flag set
1109   }
1110     else {
1111       switch(mem[p].hh.b0)
1112       {case 0 : 
1113       case 1 : 
1114 /* if list_ptr(p)=null then cur_v:=cur_v+height(p)+depth(p) l.12529 */
1115   if(mem[p + 5].hh.v.RH == 0)
1116   cur_v = cur_v + mem[p + 3].cint + mem[p + 2].cint; 
1117   else {
1118       
1119     cur_v = cur_v + mem[p + 3].cint; 
1120     if(cur_v != dvi_v)
1121     {
1122       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1123       dvi_v = cur_v; 
1124     } 
1125     saveh = dvi_h; 
1126     savev = dvi_v; 
1127     cur_h = leftedge + mem[p + 4].cint; 
1128     temp_ptr = p; 
1129     if(mem[p].hh.b0 == 1)vlist_out (); 
1130     else hlist_out ();
1131     dvi_h = saveh; 
1132     dvi_v = savev; 
1133     cur_v = savev + mem[p + 2].cint; 
1134     cur_h = leftedge; 
1135   } 
1136   break; 
1137       case 2 : 
1138   {
1139     rule_ht = mem[p + 3].cint; 
1140     rule_dp = mem[p + 2].cint; 
1141     rule_wd = mem[p + 1].cint; 
1142     goto lab14; 
1143   } 
1144   break; 
1145       case 8 : 
1146       out_what(p);
1147       break; 
1148       case 10 : 
1149   {
1150     g = mem[p + 1].hh.v.LH; 
1151     rule_ht = mem[g + 1].cint; 
1152     if(gsign != 0)
1153     {
1154       if(gsign == 1)
1155       {
1156         if(mem[g].hh.b0 == gorder)
1157 /* ************************************************************************ */
1158 /*        rule_ht = rule_ht + round(mem[thisbox + 6].gr * mem[g + 2].cint); */
1159 /* ************************ 3.14159 **************************************** */
1160         {
1161     gluetemp = mem[thisbox + 6].gr * mem[g + 2].cint; 
1162     if(gluetemp > 1000000000.0)
1163     gluetemp = 1000000000.0; 
1164     else if(gluetemp < -1000000000.0)
1165     gluetemp = -1000000000.0; 
1166     rule_ht = rule_ht + round(gluetemp); 
1167         } 
1168 /* ************************************************************************* */
1169       } 
1170 /* ************************************************************************* */
1171 /*      else { */
1172 /*        if(mem[g].hh.b1 == gorder) */
1173 /*        rule_ht = rule_ht - round(mem[thisbox + 6].gr * mem[g + 3].cint); */
1174 /*      } */
1175       else if(mem[g].hh.b1 == gorder)   /* BUG FIX !!! */
1176         {
1177         gluetemp = mem[thisbox + 6].gr * mem[g + 3].cint; 
1178         if(gluetemp > 1000000000.0)
1179         gluetemp = 1000000000.0; 
1180         else if(gluetemp < -1000000000.0)
1181         gluetemp = -1000000000.0; 
1182         rule_ht = rule_ht - round(gluetemp); 
1183       } 
1184 /* ************************************************************************* */
1185     } 
1186     if(mem[p].hh.b1 >= 100)
1187     {
1188       leaderbox = mem[p + 1].hh.v.RH; 
1189       if(mem[leaderbox].hh.b0 == 2)
1190       {
1191         rule_wd = mem[leaderbox + 1].cint; 
1192         rule_dp = 0; 
1193         goto lab14; 
1194       } 
1195       leaderht = mem[leaderbox + 3].cint + mem[leaderbox + 2]
1196      .cint; 
1197       if((leaderht > 0)&&(rule_ht > 0)) 
1198       {
1199         rule_ht = rule_ht + 10; 
1200         edge = cur_v + rule_ht; 
1201         lx = 0; 
1202         if(mem[p].hh.b1 == 100)
1203         {
1204     savev = cur_v; 
1205     cur_v = topedge + leaderht *((cur_v - topedge)/ leaderht)
1206     ; 
1207     if(cur_v < savev)
1208     cur_v = cur_v + leaderht; 
1209         } 
1210         else {
1211       
1212     lq = rule_ht / leaderht; 
1213     lr = rule_ht % leaderht; 
1214     if(mem[p].hh.b1 == 101)
1215     cur_v = cur_v +(lr / 2); 
1216     else {
1217         
1218       lx =(2 * lr + lq + 1)/(2 * lq + 2); 
1219       cur_v = cur_v +((lr -(lq - 1)* lx)/ 2); 
1220     } 
1221         } 
1222         while(cur_v + leaderht <= edge){
1223       
1224     cur_h = leftedge + mem[leaderbox + 4].cint; 
1225     if(cur_h != dvi_h)
1226     {
1227       movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1228       dvi_h = cur_h; 
1229     } 
1230     saveh = dvi_h; 
1231     cur_v = cur_v + mem[leaderbox + 3].cint; 
1232     if(cur_v != dvi_v)
1233     {
1234       movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1235       dvi_v = cur_v; 
1236     } 
1237     savev = dvi_v; 
1238     temp_ptr = leaderbox; 
1239     outerdoingleaders = doing_leaders; 
1240     doing_leaders = true; 
1241     if(mem[leaderbox].hh.b0 == 1)vlist_out (); 
1242     else hlist_out (); 
1243     doing_leaders = outerdoingleaders; 
1244     dvi_v = savev; 
1245     dvi_h = saveh; 
1246 /* ************************************************************************ */
1247 /*    cur_h = saveh;  */
1248     cur_h = leftedge;  /* 3.1415 */
1249 /* ************************************************************************ */
1250     cur_v = savev - mem[leaderbox + 3].cint + leaderht + lx; 
1251         } 
1252         cur_v = edge - 10; 
1253         goto lab15; 
1254       } 
1255     } 
1256     goto lab13; 
1257   } 
1258   break; 
1259       case 11 : 
1260   cur_v = cur_v + mem[p + 1].cint; 
1261   break; 
1262   default: 
1263   ; 
1264   break; 
1265       } 
1266       goto lab15; 
1267       lab14: if((rule_wd == -1073741824L))    /* -2^30 */
1268       rule_wd = mem[thisbox + 1].cint; 
1269       rule_ht = rule_ht + rule_dp; 
1270       cur_v = cur_v + rule_ht; 
1271       if((rule_ht > 0)&&(rule_wd > 0)) 
1272       {
1273   if(cur_h != dvi_h)
1274   {
1275     movement(cur_h - dvi_h, 143);   /* 143 == right1 */
1276     dvi_h = cur_h; 
1277   } 
1278   if(cur_v != dvi_v)
1279   {
1280     movement(cur_v - dvi_v, 157);   /* 157 == down1 */
1281     dvi_v = cur_v; 
1282   } 
1283   {
1284     dvi_buf[dvi_ptr]= 137; 
1285     incr(dvi_ptr); 
1286     if(dvi_ptr == dvi_limit)dvi_swap (); 
1287   } 
1288   dvi_four(rule_ht); 
1289   dvi_four(rule_wd); 
1290       } 
1291       goto lab15; 
1292       lab13: cur_v = cur_v + rule_ht; 
1293     } 
1294     lab15: p = mem[p].hh.v.RH; 
1295   } 
1296   prune_movements(saveloc); 
1297   if(cur_s > 0)
1298   dvi_pop(saveloc); 
1299   decr(cur_s); 
1300
1301 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1302 void ship_out_(halfword p)
1303 {/* 30 */ 
1304   integer pageloc; 
1305   char j, k; 
1306   pool_pointer s; 
1307   char old_setting; 
1308   if(eqtb[(hash_size + 3197)].cint > 0)
1309   {
1310     print_nl("");    /*  */
1311     print_ln (); 
1312     print_string("Completed box being shipped out");
1313   } 
1314   if(term_offset > max_print_line - 9)
1315   print_ln (); 
1316   else if((term_offset > 0)||(file_offset > 0)) 
1317   print_char(32);   /*   */
1318   print_char(91);   /*[*/
1319   j = 9; 
1320   while((eqtb[(hash_size + 3218) + j].cint == 0)&&(j > 0)) decr(j); 
1321   {
1322     register integer for_end; 
1323     k = 0; 
1324     for_end = j; 
1325     if(k <= for_end) do 
1326     {
1327       print_int(eqtb[(hash_size + 3218) + k].cint); 
1328       if(k < j)
1329         print_char(46);   /* . */
1330     } 
1331     while(k++ < for_end);
1332   } 
1333 #ifndef _WINDOWS
1334   fflush(stdout); 
1335 #endif
1336   if(eqtb[(hash_size + 3197)].cint > 0)
1337   {
1338     print_char(93);   /*]*/
1339     begin_diagnostic (); 
1340     show_box(p); 
1341     end_diagnostic(true); 
1342   } 
1343   if((mem[p + 3].cint > 1073741823L)|| /* 2^30 - 1 */
1344     (mem[p + 2].cint > 1073741823L)||
1345     (mem[p + 3].cint + mem[p + 2].cint +
1346      eqtb[(hash_size + 3749)].cint > 1073741823L)||
1347     (mem[p + 1].cint + eqtb[(hash_size + 3748)].cint > 1073741823L)) 
1348   {
1349           print_err("Huge page cannot be shipped out");
1350           help2("The page just created is more than 18 feet tall or",
1351                   "more than 18 feet wide, so I suspect something went wrong.");
1352     error (); 
1353     if(eqtb[(hash_size + 3197)].cint <= 0)
1354     {
1355       begin_diagnostic (); 
1356       print_nl("The following box has been deleted:");    /*  */
1357       show_box(p); 
1358       end_diagnostic(true); 
1359     } 
1360     goto lab30; 
1361   } 
1362   if(mem[p + 3].cint + mem[p + 2].cint + eqtb[(hash_size + 3749)].cint > max_v 
1363 )
1364   max_v = mem[p + 3].cint + mem[p + 2].cint + eqtb[(hash_size + 3749)].cint; 
1365   if(mem[p + 1].cint + eqtb[(hash_size + 3748)].cint > max_h)
1366   max_h = mem[p + 1].cint + eqtb[(hash_size + 3748)].cint; 
1367   dvi_h = 0; 
1368   dvi_v = 0; 
1369   cur_h = eqtb[(hash_size + 3748)].cint; 
1370   dvi_f = 0; 
1371   if(output_file_name == 0)
1372   {
1373     if(job_name == 0)open_log_file (); 
1374     pack_job_name(788);   /* .dvi */
1375     while(! b_open_out(dvi_file)) {
1376     prompt_file_name(789, 788); /* file name for output  .dvi */
1377   }
1378     output_file_name = b_make_name_string(dvi_file); 
1379   } 
1380
1381   if(total_pages == 0)
1382   {
1383     {
1384       dvi_buf[dvi_ptr]= 247; 
1385       incr(dvi_ptr); 
1386       if(dvi_ptr == dvi_limit)dvi_swap (); 
1387     } 
1388     {
1389       dvi_buf[dvi_ptr]= 2; 
1390       incr(dvi_ptr); 
1391       if(dvi_ptr == dvi_limit)dvi_swap (); 
1392     } 
1393     dvi_four(25400000L);  /* magic DVI scale factor */
1394     dvi_four(473628672L); /* 7227 * 65536 */
1395     prepare_mag (); 
1396     dvi_four(eqtb[(hash_size + 3180)].cint); 
1397     old_setting = selector; 
1398     selector = 21; 
1399     print_string("TeX output ");
1400     print_int(eqtb[(hash_size + 3186)].cint); 
1401     print_char(46); /* . */
1402     print_two(eqtb[(hash_size + 3185)].cint); 
1403     print_char(46); /* . */
1404     print_two(eqtb[(hash_size + 3184)].cint); 
1405     print_char(58); /* : */
1406     print_two(eqtb[(hash_size + 3183)].cint / 60); 
1407     print_two(eqtb[(hash_size + 3183)].cint % 60); 
1408     selector = old_setting; 
1409     {
1410 /*    long to unsigned char ... */
1411       dvi_buf[dvi_ptr]=(pool_ptr - str_start[str_ptr]); 
1412       incr(dvi_ptr); 
1413       if(dvi_ptr == dvi_limit)dvi_swap (); 
1414     } 
1415     {
1416     register integer for_end; 
1417     s = str_start[str_ptr]; 
1418     for_end = pool_ptr - 1; 
1419     if(s <= for_end) do 
1420     {
1421       dvi_buf[dvi_ptr]= str_pool[s]; 
1422       incr(dvi_ptr); 
1423       if(dvi_ptr == dvi_limit)dvi_swap (); 
1424     } 
1425     while(s++ < for_end);
1426   } 
1427     pool_ptr = str_start[str_ptr]; 
1428   } // end of if total_pages == 0
1429
1430   pageloc = dvi_offset + dvi_ptr; 
1431   {
1432     dvi_buf[dvi_ptr]= 139; 
1433     incr(dvi_ptr); 
1434     if(dvi_ptr == dvi_limit)dvi_swap (); 
1435   } 
1436   {
1437     register integer for_end; 
1438     k = 0; 
1439     for_end = 9; 
1440     if(k <= for_end) do 
1441       dvi_four(eqtb[(hash_size + 3218) + k].cint); 
1442       while(k++ < for_end);
1443   } 
1444   dvi_four(last_bop); 
1445   last_bop = pageloc; 
1446   cur_v = mem[p + 3].cint + eqtb[(hash_size + 3749)].cint; 
1447   temp_ptr = p; 
1448   if(mem[p].hh.b0 == 1)vlist_out (); 
1449   else hlist_out (); 
1450   {
1451     dvi_buf[dvi_ptr]= 140; 
1452     incr(dvi_ptr); 
1453     if(dvi_ptr == dvi_limit)dvi_swap (); 
1454   } 
1455   incr(total_pages); 
1456   cur_s = -1; 
1457   lab30:; 
1458   if(eqtb[(hash_size + 3197)].cint <= 0)
1459   print_char(93);   /*]*/
1460   dead_cycles = 0; 
1461 #ifndef _WINDOWS
1462   fflush(stdout); 
1463 #endif
1464   ;
1465 #ifdef STAT
1466   if(eqtb[(hash_size + 3194)].cint > 1)
1467   {
1468     print_nl("Memory usage before: ");        /*  */
1469     print_int(var_used); 
1470     print_char(38);       /* & */
1471     print_int(dyn_used); 
1472     print_char(59);       /*; */
1473   } 
1474 #endif /* STAT */
1475   flush_node_list(p); 
1476   ;
1477 #ifdef STAT
1478   if(eqtb[(hash_size + 3194)].cint > 1)
1479   {
1480     print_string("after");
1481     print_int(var_used); 
1482     print_char(38);         /* & */
1483     print_int(dyn_used); 
1484     print_string("still utouched");
1485     print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1486     print_ln (); 
1487   } 
1488 #endif /* STAT */
1489
1490 void scan_spec_(group_code c, bool threecodes)
1491 {/* 40 */ 
1492   integer s; 
1493   char speccode; 
1494   if(threecodes)
1495     s = save_stack[save_ptr + 0].cint; 
1496   if(scan_keyword(836))   /* to */
1497     speccode = 0; 
1498   else if(scan_keyword(837))  /* spread */
1499     speccode = 1; 
1500   else {
1501     speccode = 1; 
1502     cur_val = 0; 
1503     goto lab40; 
1504   } 
1505   scan_dimen(false, false, false); 
1506   lab40: if(threecodes)
1507   {
1508     save_stack[save_ptr + 0].cint = s;  /* s may be used without ... */
1509     incr(save_ptr); 
1510   } 
1511   save_stack[save_ptr + 0].cint = speccode; 
1512   save_stack[save_ptr + 1].cint = cur_val; 
1513   save_ptr = save_ptr + 2; 
1514   new_save_level(c); 
1515   scan_left_brace (); 
1516
1517 halfword hpack_(halfword p, scaled w, small_number m)
1518 {/* 21 50 10 */ register halfword Result;
1519   halfword r; 
1520   halfword q; 
1521   scaled h, d, x; 
1522   scaled s; 
1523   halfword g; 
1524 /*  glue_ord o;  */
1525   int o;              /* 95/Jan/7 */
1526   internal_font_number f; 
1527   ffourquarters i; 
1528   eight_bits hd; 
1529   last_badness = 0; 
1530   r = get_node(7); 
1531   mem[r].hh.b0 = 0; 
1532   mem[r].hh.b1 = 0; 
1533   mem[r + 4].cint = 0; 
1534   q = r + 5; 
1535   mem[q].hh.v.RH = p; 
1536   h = 0; 
1537   d = 0; 
1538   x = 0; 
1539   totalstretch[0]= 0; 
1540   totalshrink[0]= 0; 
1541   totalstretch[1]= 0; 
1542   totalshrink[1]= 0; 
1543   totalstretch[2]= 0; 
1544   totalshrink[2]= 0; 
1545   totalstretch[3]= 0; 
1546   totalshrink[3]= 0; 
1547   while(p != 0){ /* while p<>null do l.12862 */
1548       
1549     lab21: while((p >= hi_mem_min)) {
1550   
1551       f = mem[p].hh.b0; 
1552       i = font_info[char_base[f]+ mem[p].hh.b1].qqqq; 
1553       hd = i.b1; 
1554       x = x + font_info[width_base[f]+ i.b0].cint; 
1555       s = font_info[height_base[f]+(hd)/ 16].cint; 
1556       if(s > h)
1557       h = s; 
1558       s = font_info[depth_base[f]+(hd)% 16].cint; 
1559       if(s > d)
1560       d = s; 
1561       p = mem[p].hh.v.RH; 
1562     } 
1563     if(p != 0)  /* if p<>null then l.12886 */
1564     {
1565       switch(mem[p].hh.b0)
1566       {case 0 : 
1567       case 1 : 
1568       case 2 : 
1569       case 13 : 
1570   {
1571     x = x + mem[p + 1].cint; 
1572     if(mem[p].hh.b0 >= 2)
1573     s = 0; 
1574     else s = mem[p + 4].cint; 
1575     if(mem[p + 3].cint - s > h)
1576     h = mem[p + 3].cint - s; 
1577     if(mem[p + 2].cint + s > d)
1578     d = mem[p + 2].cint + s; 
1579   } 
1580   break; 
1581       case 3 : 
1582       case 4 : 
1583       case 5 : 
1584 /* if adjust_tail<>null then link(adjust_tail):=null; l.12865 / 12891 */
1585   if(adjust_tail != 0)
1586   {
1587     while(mem[q].hh.v.RH != p)q = mem[q].hh.v.RH; 
1588     if(mem[p].hh.b0 == 5)
1589     {
1590       mem[adjust_tail].hh.v.RH = mem[p + 1].cint; 
1591       while(mem[adjust_tail].hh.v.RH != 0)adjust_tail = mem[
1592       adjust_tail].hh.v.RH; 
1593       p = mem[p].hh.v.RH; 
1594       free_node(mem[q].hh.v.RH, 2); 
1595     } 
1596     else {
1597         
1598       mem[adjust_tail].hh.v.RH = p; 
1599       adjust_tail = p; 
1600       p = mem[p].hh.v.RH; 
1601     } 
1602     mem[q].hh.v.RH = p; 
1603     p = q; 
1604   } 
1605   break; 
1606       case 8 : 
1607   ; 
1608   break; 
1609       case 10 : 
1610   {
1611     g = mem[p + 1].hh.v.LH; 
1612     x = x + mem[g + 1].cint; 
1613     o = mem[g].hh.b0; 
1614     totalstretch[o]= totalstretch[o]+ mem[g + 2].cint; 
1615     o = mem[g].hh.b1; 
1616     totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; 
1617     if(mem[p].hh.b1 >= 100)
1618     {
1619       g = mem[p + 1].hh.v.RH; 
1620       if(mem[g + 3].cint > h)
1621       h = mem[g + 3].cint; 
1622       if(mem[g + 2].cint > d)
1623       d = mem[g + 2].cint; 
1624     } 
1625   } 
1626   break; 
1627       case 11 : 
1628       case 9 : 
1629   x = x + mem[p + 1].cint; 
1630   break; 
1631       case 6 : 
1632   {
1633     mem[mem_top - 12]= mem[p + 1]; 
1634     mem[mem_top - 12].hh.v.RH = mem[p].hh.v.RH; 
1635     p = mem_top - 12; 
1636     goto lab21; 
1637   } 
1638   break; 
1639   default: 
1640   ; 
1641   break; 
1642       } 
1643       p = mem[p].hh.v.RH; 
1644     } 
1645   } 
1646   if(adjust_tail != 0)
1647   mem[adjust_tail].hh.v.RH = 0; 
1648   mem[r + 3].cint = h; 
1649   mem[r + 2].cint = d; 
1650   if(m == 1)
1651   w = x + w; 
1652   mem[r + 1].cint = w; 
1653   x = w - x; 
1654   if(x == 0)
1655   {
1656     mem[r + 5].hh.b0 = 0; 
1657     mem[r + 5].hh.b1 = 0; 
1658     mem[r + 6].gr = 0.0; 
1659     goto lab10; 
1660   } 
1661   else if(x > 0)
1662   {
1663     if(totalstretch[3]!= 0)
1664     o = 3; 
1665     else if(totalstretch[2]!= 0)
1666     o = 2; 
1667     else if(totalstretch[1]!= 0)
1668     o = 1; 
1669     else o = 0; 
1670     mem[r + 5].hh.b1 = o; 
1671     mem[r + 5].hh.b0 = 1; 
1672 /* if total_stretch[o]<>0 then glue_set(r):=... l.12982 */
1673     if(totalstretch[o]!= 0)
1674     mem[r + 6].gr = x / ((double) totalstretch[o]); 
1675     else {
1676   
1677       mem[r + 5].hh.b0 = 0; 
1678       mem[r + 6].gr = 0.0; 
1679     } 
1680 /* if o=normal then if list_ptr(r)<>null then l.12987 */
1681     if(o == 0)
1682     if(mem[r + 5].hh.v.RH != 0)
1683     {
1684       last_badness = badness(x, totalstretch[0]); 
1685       if(last_badness > eqtb[(hash_size + 3189)].cint)
1686       {
1687   print_ln (); 
1688   if(last_badness > 100)
1689     print_nl("Underfull");    /*  */
1690   else print_nl("Loose");   /*  */
1691   print_string("\\hbox (badness");
1692   print_int(last_badness); 
1693   if(last_badness > 100)underfull_hbox++;   /* 1996/Feb/9 */
1694   goto lab50; 
1695       } 
1696     } 
1697     goto lab10; 
1698   } 
1699   else {
1700       
1701     if(totalshrink[3]!= 0)
1702     o = 3; 
1703     else if(totalshrink[2]!= 0)
1704     o = 2; 
1705     else if(totalshrink[1]!= 0)
1706     o = 1; 
1707     else o = 0; 
1708     mem[r + 5].hh.b1 = o; 
1709     mem[r + 5].hh.b0 = 2; 
1710     if(totalshrink[o]!= 0)
1711     mem[r + 6].gr =(- (integer) x)/ ((double) totalshrink[o]); 
1712     else {
1713   
1714       mem[r + 5].hh.b0 = 0; 
1715       mem[r + 6].gr = 0.0; 
1716     } 
1717 /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13946 */
1718     if((totalshrink[o]< - (integer) x)&&(o == 0)&&(mem[r + 5 
1719   ].hh.v.RH != 0)) 
1720     {
1721       last_badness = 1000000L; 
1722 /*   set_glue_ratio_one(glue_set(r)); {use the maximum shrinkage} */
1723       mem[r + 6].gr = 1.0; 
1724 /* if (-x-total_shrink[normal]>hfuzz)or(hbadness<100) then */
1725       if((- (integer) x - totalshrink[0]> eqtb[(hash_size + 3738)].cint)||(
1726       eqtb[(hash_size + 3189)].cint < 100)) 
1727       {
1728   if((eqtb[(hash_size + 3746)].cint > 0)&&(- (integer) x - totalshrink[0 
1729   ] > eqtb[(hash_size + 3738)].cint)) 
1730   {
1731     while(mem[q].hh.v.RH != 0)q = mem[q].hh.v.RH; 
1732     mem[q].hh.v.RH = new_rule (); 
1733     mem[mem[q].hh.v.RH + 1].cint = eqtb[(hash_size + 3746)].cint; 
1734   } 
1735   print_ln (); 
1736   print_nl("Overfull \\hbox(");    /* */
1737   print_scaled(- (integer) x - totalshrink[0]); 
1738   print_string("pt too wide");
1739   overfull_hbox++;      /* 1996/Feb/9 */
1740   goto lab50; 
1741       } 
1742     } 
1743     else if(o == 0)
1744     if(mem[r + 5].hh.v.RH != 0)
1745     {
1746       last_badness = badness(- (integer) x, totalshrink[0]); 
1747       if(last_badness > eqtb[(hash_size + 3189)].cint)
1748       {
1749   print_ln (); 
1750   print_nl("Tight \\hbox (badness ");  /*  */
1751   print_int(last_badness); 
1752   goto lab50; 
1753       } 
1754     } 
1755     goto lab10; 
1756   } 
1757   lab50: if(output_active)
1758   print_string(")has occurred while \\output is active");
1759   else {
1760       
1761     if(pack_begin_line != 0)
1762     {
1763       if(pack_begin_line > 0)
1764       print_string(")in paragraph at lines ");
1765       else print_string(")in alignment at lines ");
1766       print_int(abs(pack_begin_line)); 
1767       print_string("--");
1768     } 
1769     else print_string(")detected at line ");
1770     print_int(line); 
1771   } 
1772   print_ln (); 
1773   font_in_short_display = 0; 
1774   short_display(mem[r + 5].hh.v.RH); 
1775   print_ln (); 
1776   begin_diagnostic (); 
1777   show_box(r); 
1778   end_diagnostic(true); 
1779   lab10: Result = r; 
1780   return Result; 
1781
1782 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1783 {/* 50 10 */ register halfword Result; 
1784   halfword r; 
1785   scaled w, d, x; 
1786   scaled s; 
1787   halfword g; 
1788 /*  glue_ord o;  */
1789   int o;              /* 95/Jan/7 */
1790   last_badness = 0; 
1791   r = get_node(7); 
1792   mem[r].hh.b0 = 1; 
1793   mem[r].hh.b1 = 0; 
1794   mem[r + 4].cint = 0; 
1795   mem[r + 5].hh.v.RH = p; 
1796   w = 0; 
1797   d = 0; 
1798   x = 0; 
1799   totalstretch[0]= 0; 
1800   totalshrink[0]= 0; 
1801   totalstretch[1]= 0; 
1802   totalshrink[1]= 0; 
1803   totalstretch[2]= 0; 
1804   totalshrink[2]= 0; 
1805   totalstretch[3]= 0; 
1806   totalshrink[3]= 0; 
1807   while(p != 0){
1808       
1809     if((p >= hi_mem_min)) {
1810     confusion(849);   /* vpack */
1811     return 0;       // abort_flag set
1812   }
1813     else switch(mem[p].hh.b0)
1814     {case 0 : 
1815     case 1 : 
1816     case 2 : 
1817     case 13 : 
1818       {
1819   x = x + d + mem[p + 3].cint; 
1820   d = mem[p + 2].cint; 
1821   if(mem[p].hh.b0 >= 2)
1822   s = 0; 
1823   else s = mem[p + 4].cint; 
1824   if(mem[p + 1].cint + s > w)
1825   w = mem[p + 1].cint + s; 
1826       } 
1827       break; 
1828     case 8 : 
1829    ; 
1830       break; 
1831     case 10 : 
1832       {
1833   x = x + d; 
1834   d = 0; 
1835   g = mem[p + 1].hh.v.LH; 
1836   x = x + mem[g + 1].cint; 
1837   o = mem[g].hh.b0; 
1838   totalstretch[o]= totalstretch[o]+ mem[g + 2].cint; 
1839   o = mem[g].hh.b1; 
1840   totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; 
1841   if(mem[p].hh.b1 >= 100)
1842   {
1843     g = mem[p + 1].hh.v.RH; 
1844     if(mem[g + 1].cint > w)
1845     w = mem[g + 1].cint; 
1846   } 
1847       } 
1848       break; 
1849     case 11 : 
1850       {
1851   x = x + d + mem[p + 1].cint; 
1852   d = 0; 
1853       } 
1854       break; 
1855       default: 
1856    ; 
1857       break; 
1858     } 
1859     p = mem[p].hh.v.RH; 
1860   } 
1861   mem[r + 1].cint = w; 
1862   if(d > l)
1863   {
1864     x = x + d - l; 
1865     mem[r + 2].cint = l; 
1866   } 
1867   else mem[r + 2].cint = d; 
1868   if(m == 1)
1869   h = x + h; 
1870   mem[r + 3].cint = h; 
1871   x = h - x; 
1872   if(x == 0)
1873   {
1874     mem[r + 5].hh.b0 = 0; 
1875     mem[r + 5].hh.b1 = 0; 
1876     mem[r + 6].gr = 0.0; 
1877     goto lab10; 
1878   } 
1879   else if(x > 0)
1880   {
1881     if(totalstretch[3]!= 0)
1882     o = 3; 
1883     else if(totalstretch[2]!= 0)
1884     o = 2; 
1885     else if(totalstretch[1]!= 0)
1886     o = 1; 
1887     else o = 0; 
1888     mem[r + 5].hh.b1 = o; 
1889     mem[r + 5].hh.b0 = 1; 
1890     if(totalstretch[o]!= 0)
1891     mem[r + 6].gr = x / ((double) totalstretch[o]); 
1892     else {
1893   
1894       mem[r + 5].hh.b0 = 0; 
1895       mem[r + 6].gr = 0.0; 
1896     } 
1897     if(o == 0)
1898     if(mem[r + 5].hh.v.RH != 0)
1899     {
1900       last_badness = badness(x, totalstretch[0]); 
1901       if(last_badness > eqtb[(hash_size + 3190)].cint)
1902       {
1903   print_ln (); 
1904   if(last_badness > 100)
1905     print_nl("Underfull");      /*  */
1906   else print_nl("Loose");     /*  */
1907   print_string("\\vbox (badness");
1908   print_int(last_badness); 
1909   if(last_badness > 100)underfull_vbox++; /* 1996/Feb/9 */
1910   goto lab50; 
1911       } 
1912     } 
1913     goto lab10; 
1914   } 
1915   else {
1916       
1917     if(totalshrink[3]!= 0)
1918     o = 3; 
1919     else if(totalshrink[2]!= 0)
1920     o = 2; 
1921     else if(totalshrink[1]!= 0)
1922     o = 1; 
1923     else o = 0; 
1924     mem[r + 5].hh.b1 = o; 
1925     mem[r + 5].hh.b0 = 2; 
1926     if(totalshrink[o]!= 0)
1927     mem[r + 6].gr =(- (integer) x)/ ((double) totalshrink[o]); 
1928     else {
1929   
1930       mem[r + 5].hh.b0 = 0; 
1931       mem[r + 6].gr = 0.0; 
1932     } 
1933 /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13046 */
1934     if((totalshrink[o]< - (integer) x)&&(o == 0)&&(mem[r + 5 
1935   ].hh.v.RH != 0)) 
1936     {
1937       last_badness = 1000000L; 
1938       mem[r + 6].gr = 1.0; 
1939       if((- (integer) x - totalshrink[0]> eqtb[(hash_size + 3739)].cint)||(
1940       eqtb[(hash_size + 3190)].cint < 100)) 
1941       {
1942   print_ln (); 
1943   print_nl("Overfull \\vbox(");  /* */
1944   print_scaled(- (integer) x - totalshrink[0]); 
1945   print_string("pt too high");
1946   overfull_vbox++;    /* 1996/Feb/9 */
1947   goto lab50; 
1948       } 
1949     } 
1950 /* else if o=normal then if list_ptr(r)<>null then l.13052  */
1951     else if(o == 0)
1952     if(mem[r + 5].hh.v.RH != 0)
1953     {
1954       last_badness = badness(- (integer) x, totalshrink[0]); 
1955       if(last_badness > eqtb[(hash_size + 3190)].cint)
1956       {
1957   print_ln (); 
1958   print_nl("Tight \\vbox (badness ");  /*  */
1959   print_int(last_badness); 
1960   goto lab50; 
1961       } 
1962     } 
1963     goto lab10; 
1964   } 
1965   lab50: if(output_active)
1966   print_string(")has occurred while \\output is active");
1967   else {
1968       
1969     if(pack_begin_line != 0)
1970     {
1971       print_string(")in alignment at lines ");
1972       print_int(abs(pack_begin_line)); 
1973       print_string("--");
1974     } 
1975     else print_string(")detected at line ");
1976     print_int(line); 
1977     print_ln (); 
1978   } 
1979   begin_diagnostic (); 
1980   show_box(r); 
1981   end_diagnostic(true); 
1982   lab10: Result = r; 
1983   return Result; 
1984
1985 void append_to_vlist_(halfword b)
1986
1987   scaled d; 
1988   halfword p; 
1989   if(cur_list.aux_field.cint > ignore_depth)
1990   {
1991     d = mem[eqtb[(hash_size + 783)].hh.v.RH + 1].cint - cur_list.aux_field.cint - 
1992     mem[b + 3].cint; 
1993     if(d < eqtb[(hash_size + 3732)].cint)
1994     p = new_param_glue(0); 
1995     else {
1996   
1997       p = new_skip_param(1); 
1998       mem[temp_ptr + 1].cint = d; 
1999     } 
2000     mem[tail].hh.v.RH = p; 
2001     tail = p; 
2002   } 
2003   mem[tail].hh.v.RH = b; 
2004   tail = b; 
2005   cur_list.aux_field.cint = mem[b + 2].cint; 
2006
2007 halfword new_noad (void) 
2008 {register halfword Result; 
2009   halfword p; 
2010   p = get_node(4); 
2011   mem[p].hh.b0 = 16; 
2012   mem[p].hh.b1 = 0; 
2013   mem[p + 1].hh = empty_field; 
2014   mem[p + 3].hh = empty_field; 
2015   mem[p + 2].hh = empty_field; 
2016   Result = p; 
2017   return Result; 
2018
2019 halfword new_style_(small_number s)
2020 {register halfword Result; 
2021   halfword p; 
2022   p = get_node(3); 
2023   mem[p].hh.b0 = 14; 
2024   mem[p].hh.b1 = s; 
2025   mem[p + 1].cint = 0; 
2026   mem[p + 2].cint = 0; 
2027   Result = p; 
2028   return Result; 
2029
2030 halfword new_choice (void) 
2031 {register halfword Result; 
2032   halfword p; 
2033   p = get_node(3); 
2034   mem[p].hh.b0 = 15; 
2035   mem[p].hh.b1 = 0; 
2036   mem[p + 1].hh.v.LH = 0; 
2037   mem[p + 1].hh.v.RH = 0; 
2038   mem[p + 2].hh.v.LH = 0; 
2039   mem[p + 2].hh.v.RH = 0; 
2040   Result = p; 
2041   return Result; 
2042
2043 void show_info (void) 
2044
2045   show_node_list(mem[temp_ptr].hh.v.LH); 
2046
2047 halfword fraction_rule_(scaled t)
2048 {register halfword Result;
2049   halfword p; 
2050   p = new_rule (); 
2051   mem[p + 3].cint = t; 
2052   mem[p + 2].cint = 0; 
2053   Result = p; 
2054   return Result; 
2055
2056 halfword overbar_(halfword b, scaled k, scaled t)
2057 {register halfword Result;
2058   halfword p, q; 
2059   p = new_kern(k); 
2060   mem[p].hh.v.RH = b; 
2061   q = fraction_rule(t); 
2062   mem[q].hh.v.RH = p; 
2063   p = new_kern(t); 
2064   mem[p].hh.v.RH = q; 
2065   Result = vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
2066   return Result; 
2067
2068 halfword char_box_(internal_font_number f, quarterword c)
2069 {register halfword Result;
2070   ffourquarters q; 
2071   eight_bits hd; 
2072   halfword b, p; 
2073   q = font_info[char_base[f]+ c].qqqq; 
2074   hd = q.b1; 
2075   b = new_null_box (); 
2076   mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + font_info 
2077  [italic_base[f]+(q.b2)/ 4].cint; 
2078   mem[b + 3].cint = font_info[height_base[f]+(hd)/ 16].cint; 
2079   mem[b + 2].cint = font_info[depth_base[f]+(hd)% 16].cint; 
2080 /*  long to unsigned short ... */
2081   p = get_avail (); 
2082   mem[p].hh.b1 = c; 
2083   mem[p].hh.b0 = f; 
2084   mem[b + 5].hh.v.RH = p; 
2085   Result = b; 
2086   return Result; 
2087
2088 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
2089 {
2090   halfword p; 
2091   p = char_box(f, c); 
2092   mem[p].hh.v.RH = mem[b + 5].hh.v.RH; 
2093   mem[b + 5].hh.v.RH = p; 
2094   mem[b + 3].cint = mem[p + 3].cint; 
2095
2096 scaled height_plus_depth_(internal_font_number f, fquarterword c)
2097 {register scaled Result; 
2098   ffourquarters q; 
2099   eight_bits hd; 
2100   q = font_info[char_base[f]+ c].qqqq; 
2101   hd = q.b1; 
2102   Result = font_info[height_base[f]+(hd)/ 16].cint + font_info[
2103   depth_base[f]+(hd)% 16].cint; 
2104   return Result; 
2105
2106 halfword var_delimiter_(halfword d, small_number s, scaled v)
2107 {/* 40 22 */ register halfword Result; 
2108   halfword b; 
2109   internal_font_number f, g; 
2110   quarterword c, x, y; 
2111   integer m, n; 
2112   scaled u; 
2113   scaled w; 
2114   ffourquarters q; 
2115   ffourquarters r; 
2116   eight_bits hd; 
2117 /*  small_number z;  */
2118   int z;                  /* 95/Jan/7 */
2119 /*  bool largeattempt;  */
2120   int largeattempt;           /* 95/Jan/7 */
2121   f = 0; 
2122   w = 0; 
2123   largeattempt = false; 
2124   z = mem[d].qqqq.b0; 
2125   x = mem[d].qqqq.b1; 
2126   while(true){
2127     if((z != 0)||(x != 0)) 
2128     {
2129       z = z + s + 16; 
2130       do {
2131     z = z - 16; 
2132   g = eqtb[(hash_size + 1835) + z].hh.v.RH; 
2133   if(g != 0)
2134   {
2135     y = x; 
2136     if((y >= font_bc[g])&&(y <= font_ec[g])) 
2137     {
2138       lab22: q = font_info[char_base[g]+ y].qqqq; 
2139       if((q.b0 > 0)) 
2140       {
2141         if(((q.b2)% 4)== 3)
2142         {
2143     f = g; 
2144     c = y; 
2145     goto lab40; 
2146         } 
2147         hd = q.b1; 
2148         u = font_info[height_base[g]+(hd)/ 16].cint + font_info 
2149        [depth_base[g]+(hd)% 16].cint; 
2150         if(u > w)
2151         {
2152     f = g; 
2153     c = y; 
2154     w = u; 
2155     if(u >= v)
2156     goto lab40; 
2157         } 
2158         if(((q.b2)% 4)== 2)
2159         {
2160     y = q.b3; 
2161     goto lab22; 
2162         } 
2163       } 
2164     } 
2165   } 
2166       } while(!(z < 16)); 
2167     } 
2168     if(largeattempt)
2169     goto lab40; 
2170     largeattempt = true; 
2171     z = mem[d].qqqq.b2; 
2172     x = mem[d].qqqq.b3; 
2173   } 
2174   lab40: if(f != 0)
2175   if(((q.b2)% 4)== 3)   /* q may be used without ... */
2176   {
2177     b = new_null_box (); 
2178     mem[b].hh.b0 = 1; 
2179     r = font_info[exten_base[f]+ q.b3].qqqq; 
2180     c = r.b3; 
2181     u = height_plus_depth(f, c); 
2182     w = 0; 
2183     q = font_info[char_base[f]+ c].qqqq; 
2184     mem[b + 1].cint = font_info[width_base[f]+ q.b0].cint + 
2185     font_info[italic_base[f]+(q.b2)/ 4].cint; 
2186     c = r.b2; 
2187     if(c != 0)
2188     w = w + height_plus_depth(f, c); 
2189     c = r.b1; 
2190     if(c != 0)
2191     w = w + height_plus_depth(f, c); 
2192     c = r.b0; 
2193     if(c != 0)
2194     w = w + height_plus_depth(f, c); 
2195     n = 0; 
2196     if(u > 0)
2197     while(w < v){
2198   
2199       w = w + u; 
2200       incr(n); 
2201       if(r.b1 != 0)
2202       w = w + u; 
2203     } 
2204     c = r.b2; 
2205     if(c != 0)
2206     stack_into_box(b, f, c); 
2207     c = r.b3; 
2208     {
2209     register integer for_end; 
2210     m = 1; 
2211     for_end = n; 
2212     if(m <= for_end) do 
2213       stack_into_box(b, f, c); 
2214     while(m++ < for_end);
2215   } 
2216     c = r.b1; 
2217     if(c != 0)
2218     {
2219       stack_into_box(b, f, c); 
2220       c = r.b3; 
2221       {
2222       register integer for_end; 
2223       m = 1; 
2224       for_end = n; 
2225       if(m <= for_end) do 
2226         stack_into_box(b, f, c); 
2227       while(m++ < for_end);
2228     } 
2229     } 
2230     c = r.b0; 
2231     if(c != 0)
2232     stack_into_box(b, f, c); 
2233     mem[b + 2].cint = w - mem[b + 3].cint; 
2234   } 
2235   else b = char_box(f, c); 
2236   else {    /* c may be used without ... */
2237     b = new_null_box (); 
2238     mem[b + 1].cint = eqtb[(hash_size + 3741)].cint; 
2239   } 
2240   mem[b + 4].cint = half(mem[b + 3].cint - mem[b + 2].cint)- 
2241   font_info[22 + param_base[eqtb[(hash_size + 1837) + s].hh.v.RH]].cint; 
2242   Result = b; 
2243   return Result; 
2244 }
2245 /* rebox_ etc used to follow here in tex4.c */