OSDN Git Service

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