1 /* Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 void char_warning_(internal_font_number f, eight_bits c)
25 if (tracing_lost_chars > 0)
27 if (show_missing == 0)
30 if (show_missing) /* add ! before 94/June/10 */
33 print_string("Missing character: there is no ");
36 print_nl("Missing character: there is no ");
40 if (show_numeric) /* bkph 93/Dec/21 */
47 print_char(48 + c / 100);
49 c = c - (c / 100) * 100; /* ? */
50 print_char(48 + c / 10);
55 c = c - (c / 100) * 100; /* ? */
56 if (c / 10 > 0) print_char(48 + c / 10);
58 print_char(48 + c % 10);
62 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
63 print_string(" in font ");
64 slow_print(font_name[f]);
66 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
67 /* if (show_missing) show_context(); */ /* in tex2.c 94/June/10 */
71 show_context(); /* not if its the nullfont */
74 if (show_missing == 0) /* show on screen 94/June/10 */
75 end_diagnostic(false);
77 missing_characters++; /* bkph 93/Dec/16 */
78 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
82 halfword new_character_(internal_font_number f, eight_bits c)
88 if (char_exists(char_info(f, c)))
105 sprintf(log_line, "dvi_swap %d", dvi_gone);
106 show_line(log_line, 0);
109 if (dvi_limit == dvi_buf_size)
111 write_dvi(0, half_buf - 1);
112 dvi_limit = half_buf;
113 dvi_offset = dvi_offset + dvi_buf_size;
118 write_dvi(half_buf, dvi_buf_size - 1);
119 dvi_limit = dvi_buf_size;
122 dvi_gone = dvi_gone + half_buf;
124 /* attempt at speeding up bkph - is compiler smart ? */
126 void dvi_four_(integer x)
129 dvi_out(x / 0100000000); // dvi_out((x >> 24));
132 x = x + 010000000000;
133 x = x + 010000000000;
134 dvi_out((x / 0100000000) + 128); // dvi_out((x >> 24) + 128);
137 x = x % 0100000000; // x = x & 16777215L;
138 dvi_out(x / 0200000); // dvi_out((x >> 16));
139 x = x % 0200000; // x = x & 65535L;
140 dvi_out(x / 0400); // dvi_out((x >> 8));
141 dvi_out(x % 0400); // dvi_out(x & 255);
144 void zdvipop(integer l)
146 if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0))
152 void dvi_font_def_(internal_font_number f)
165 dvi_out(((f - 1) >> 8));
166 dvi_out(((f - 1) & 255));
173 dvi_out(font_check[f].b0);
174 dvi_out(font_check[f].b1);
175 dvi_out(font_check[f].b2);
176 dvi_out(font_check[f].b3);
177 dvi_four(font_size[f]);
178 dvi_four(font_dsize[f]);
179 dvi_out(length(font_area[f]));
180 dvi_out(length(font_name[f]));
182 for (k = str_start[font_area[f]]; k <= str_start[font_area[f] + 1] - 1; k++)
183 dvi_out(str_pool[k]);
185 for (k = str_start[font_name[f]]; k <= str_start[font_name[f] + 1] - 1; k++)
186 dvi_out(str_pool[k]);
189 void zmovement(scaled w, eight_bits o)
195 q = get_node(movement_node_size);
197 location(q) = dvi_offset + dvi_ptr;
216 switch(mstate + info(p))
218 case none_seen + yz_OK:
219 case none_seen + y_OK:
222 if (location(p) < dvi_gone)
226 k = location(p) - dvi_offset;
229 k = k + dvi_buf_size;
231 dvi_buf[k] = dvi_buf[k] + y1 - down1;
237 case none_seen + z_OK:
240 if (location(p) < dvi_gone)
244 k = location(p) - dvi_offset;
247 k = k + dvi_buf_size;
249 dvi_buf[k] = dvi_buf[k] + z1 - down1;
255 case none_seen + y_here:
256 case none_seen + z_here:
257 case y_seen + z_here:
258 case z_seen + y_here:
265 else switch (mstate + info(p))
267 case none_seen + y_here:
271 case none_seen + z_here:
275 case y_seen + z_here:
276 case z_seen + y_here:
289 if (abs(w) >= 8388608L) /* 2^23 */
296 if (abs(w) >= 32768L)
301 w = w + 16777216L; /* 2^24 */
302 //dvi_out(w / 65536L);
304 /* w = w % 65536L; */
335 if (info(q) == y_here)
337 dvi_out(o + y0 - down1);
360 dvi_out(o + z0 - down1);
383 void prune_movements_(integer l)
387 while (down_ptr != 0)
389 if (location(down_ptr) < l)
394 free_node(p, movement_node_size);
398 while (right_ptr != 0)
400 if (location(right_ptr) < l)
405 free_node(p, movement_node_size);
409 void special_out_(halfword p)
416 old_setting = selector;
417 selector = new_string;
419 #ifdef ALLOCATESTRING
420 if (pool_ptr + 32000 > current_pool_size)
421 str_pool = realloc_str_pool (increment_pool_size);
422 /* We don't bother to check whether this worked - will catch later */
424 /* Potential problem here if current_pool_size is not much more than pool_ptr! */
425 /* Fixed 97/Mar/9 in version 2.0.3 */
426 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
427 #ifdef ALLOCATESTRING
428 show_token_list(link(write_tokens(p)), 0, 10000000L);
429 /* Above is safe, since print/print_char/print_esc will extend string space */
431 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
432 show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
435 selector = old_setting;
438 if (cur_length < 256) /* can use xxx1 ? */
446 dvi_four(cur_length);
449 for (k = str_start[str_ptr]; k <= pool_ptr - 1; k++)
450 dvi_out(str_pool[k]);
452 pool_ptr = str_start[str_ptr];
455 void write_out_(halfword p)
458 /* integer oldmode; */
459 int oldmode; /* 1995/Jan/7 */
460 /* small_number j; */
461 int j; /* 1995/Jan/7 */
465 info(q) = right_brace_token + '}';
468 info(r) = end_write_token;
470 begin_token_list(write_tokens(p), write_text);
472 info(q) = left_brace_token + '{';
477 q = scan_toks(false, true);
480 if (cur_tok != end_write_token)
482 print_err("Unbalanced write command");
483 help2("On this page there's a \\write with fewer real {'s than }'s.",
484 "I can't handle that very well; good luck.");
491 while(!(cur_tok == end_write_token)); /*1996/Jan/10*/
496 old_setting = selector;
503 if ((j == 17) && (selector == term_and_log))
512 selector = old_setting;
515 void out_what_(halfword p)
517 /* small_number j; */
518 int j; /* 1995/Jan/7 */
529 if (subtype(p) == write_node)
536 (void) a_close(write_file[j]);
538 if (subtype(p) == close_node)
539 write_open[j]= false;
542 cur_name = open_name(p);
543 cur_area = open_area(p);
544 cur_ext = open_ext(p);
546 if (cur_ext == 335) /* "" */
547 cur_ext = 785; /* => ".tex" */
549 pack_file_name(cur_name, cur_area, cur_ext);
551 while(! a_open_out(write_file[j]))
553 prompt_file_name("output file name", ".tex");
556 write_open[j] = true;
573 return; // abort_flag set
579 void hlist_out (void)
583 scaled save_h, save_v;
585 /* glue_ord g_order; */
586 int g_order; /* 95/Jan/7 */
588 int g_sign; /* 95/Jan/7 */
594 bool outer_doing_leaders;
603 g_order = glue_order(this_box);
604 g_sign = glue_sign(this_box);
605 p = list_ptr(this_box);
611 if (cur_s > max_push)
614 save_loc = dvi_offset + dvi_ptr;
638 if (f <= 64 + font_base)
639 dvi_out(f - font_base - 1 + fnt_num_0);
641 /* if we allow greater than 256 fonts */
648 /* normal TeX 82 case */
656 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
658 /* fnt2 followed by f / 256, f % 256 */
662 dvi_out(((f - 1) >> 8)); /* top byte */
663 dvi_out(((f - 1) & 255)); /* bottom byte */
666 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
674 cur_h = cur_h + char_width(f, char_info(f, c));
677 while(!(!(p >= hi_mem_min)));
687 if (list_ptr(p) == 0)
688 cur_h = cur_h + width(p);
693 cur_v = base_line + shift_amount(p);
697 if (type(p) == vlist_node)
704 cur_h = edge + width(p);
725 rule_wd = width(g) - cur_g;
727 if (g_sign != normal)
729 if (g_sign == stretching)
731 if (stretch_order(g) == g_order)
733 cur_glue = cur_glue + stretch(g);
734 glue_temp = glue_set(this_box) * cur_glue;
736 if (glue_temp > 1000000000.0)
737 glue_temp = 1000000000.0;
738 else if (glue_temp < -1000000000.0)
739 glue_temp = -1000000000.0;
741 cur_g = round(glue_temp);
744 else if (shrink_order(g) == g_order)
746 cur_glue = cur_glue - shrink(g);
747 glue_temp = glue_set(this_box) * cur_glue;
749 if (glue_temp > 1000000000.0)
750 glue_temp = 1000000000.0;
751 else if (glue_temp < -1000000000.0)
752 glue_temp = -1000000000.0;
754 cur_g = round(glue_temp);
758 rule_wd = rule_wd + cur_g;
760 if (subtype(p) >= a_leaders)
762 leader_box = leader_ptr(p);
764 if (type(leader_box) == rule_node)
766 rule_ht = height(leader_box);
767 rule_dp = depth(leader_box);
771 leader_wd = width(leader_box);
773 if ((leader_wd > 0) && (rule_wd > 0))
775 rule_wd = rule_wd + 10;
776 edge = cur_h + rule_wd;
779 if (subtype(p) == a_leaders)
782 cur_h = left_edge + leader_wd * ((cur_h - left_edge) / leader_wd);
785 cur_h = cur_h + leader_wd;
789 lq = rule_wd / leader_wd;
790 lr = rule_wd % leader_wd;
792 if (subtype(p) == c_leaders)
793 cur_h = cur_h + (lr / 2);
796 lx =(2 * lr + lq + 1) / (2 * lq + 2);
797 cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
801 while (cur_h + leader_wd <= edge)
803 cur_v = base_line + shift_amount(leader_box);
808 temp_ptr = leader_box;
809 outer_doing_leaders = doing_leaders;
810 doing_leaders = true;
812 if (type(leader_box) == vlist_node)
817 doing_leaders = outer_doing_leaders;
821 cur_h = save_h + leader_wd + lx;
835 cur_h = cur_h + width(p);
840 mem[lig_trick] = mem[lig_char(p)];
841 link(lig_trick) = link(p);
853 if ((rule_ht == -1073741824L)) /* - 2^30 */
854 rule_ht = height(this_box);
856 if ((rule_dp == -1073741824L)) /* - 2^30 */
857 rule_dp = depth(this_box);
859 rule_ht = rule_ht + rule_dp;
861 if ((rule_ht > 0) && (rule_wd > 0))
864 cur_v = base_line + rule_dp;
870 dvi_h = dvi_h + rule_wd;
873 cur_h = cur_h + rule_wd;
878 prune_movements(save_loc);
886 void vlist_out (void)
890 scaled save_h, save_v;
892 /* glue_ord g_order; */
893 int g_order; /* 95/Jan/7 */
895 int g_sign; /* 95/Jan/7 */
901 bool outer_doing_leaders;
910 g_order = glue_order(this_box);
911 g_sign = glue_sign(this_box);
912 p = list_ptr(this_box);
918 if (cur_s > max_push)
921 save_loc = dvi_offset + dvi_ptr;
923 cur_v = cur_v - height(this_box);
928 if ((p >= hi_mem_min))
930 confusion("vlistout");
931 return; // abort_flag set
939 if (list_ptr(p) == 0)
940 cur_v = cur_v + height(p) + depth(p);
943 cur_v = cur_v + height(p);
947 cur_h = left_edge + shift_amount(p);
950 if (type(p) == vlist_node)
957 cur_v = save_v + depth(p);
978 rule_ht = width(g) - cur_g;
980 if (g_sign != normal)
982 if (g_sign == stretching)
984 if (stretch_order(g) == g_order)
986 cur_glue = cur_glue + stretch(g);
987 glue_temp = glue_set(this_box) * cur_glue;
989 if (glue_temp > 1000000000.0)
990 glue_temp = 1000000000.0;
991 else if (glue_temp < -1000000000.0)
992 glue_temp = -1000000000.0;
994 cur_g = round(glue_temp);
997 else if (shrink_order(g) == g_order) /* BUG FIX !!! */
999 cur_glue = cur_glue - shrink(g);
1000 glue_temp = glue_set(this_box) * cur_glue;
1002 if (glue_temp > 1000000000.0)
1003 glue_temp = 1000000000.0;
1004 else if (glue_temp < -1000000000.0)
1005 glue_temp = -1000000000.0;
1007 cur_g = round(glue_temp);
1011 rule_ht = rule_ht + cur_g;
1013 if (subtype(p) >= a_leaders)
1015 leader_box = leader_ptr(p);
1017 if (type(leader_box) == rule_node)
1019 rule_wd = width(leader_box);
1024 leader_ht = height(leader_box) + depth(leader_box);
1026 if ((leader_ht > 0) && (rule_ht > 0))
1028 rule_ht = rule_ht + 10;
1029 edge = cur_v + rule_ht;
1032 if (subtype(p) == a_leaders)
1035 cur_v = top_edge + leader_ht * ((cur_v - top_edge) / leader_ht);
1038 cur_v = cur_v + leader_ht;
1042 lq = rule_ht / leader_ht;
1043 lr = rule_ht % leader_ht;
1045 if (subtype(p) == c_leaders)
1046 cur_v = cur_v + (lr / 2);
1049 lx = (2 * lr + lq + 1) / (2 * lq + 2);
1050 cur_v = cur_v + ((lr - (lq - 1) * lx) / 2);
1054 while (cur_v + leader_ht <= edge)
1056 cur_h = left_edge + shift_amount(leader_box);
1059 cur_v = cur_v + height(leader_box);
1062 temp_ptr = leader_box;
1063 outer_doing_leaders = doing_leaders;
1064 doing_leaders = true;
1066 if (type(leader_box) == vlist_node)
1071 doing_leaders = outer_doing_leaders;
1075 cur_v = save_v - height(leader_box) + leader_ht + lx;
1088 cur_v = cur_v + width(p);
1096 if ((rule_wd == -1073741824L)) /* -2^30 */
1097 rule_wd = width(this_box);
1099 rule_ht = rule_ht + rule_dp;
1100 cur_v = cur_v + rule_ht;
1102 if ((rule_ht > 0) && (rule_wd > 0))
1113 cur_v = cur_v + rule_ht;
1119 prune_movements(save_loc);
1127 void dvi_ship_out_(halfword p)
1134 if (tracing_output > 0)
1138 print_string("Completed box being shipped out");
1141 if (term_offset > max_print_line - 9)
1143 else if ((term_offset > 0) || (file_offset > 0))
1149 while((count(j) == 0) && (j > 0))
1152 for (k = 0; k <= j; k++)
1154 print_int(count(k));
1164 if (tracing_output > 0)
1169 end_diagnostic(true);
1172 if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
1173 (height(p) + depth(p) + v_offset > max_dimen) ||
1174 (width(p) + h_offset > max_dimen))
1176 print_err("Huge page cannot be shipped out");
1177 help2("The page just created is more than 18 feet tall or",
1178 "more than 18 feet wide, so I suspect something went wrong.");
1181 if (tracing_output <= 0)
1184 print_nl("The following box has been deleted:");
1186 end_diagnostic(true);
1192 if (height(p) + depth(p) + v_offset > max_v)
1193 max_v = height(p) + depth(p) + v_offset;
1195 if (width(p) + h_offset > max_h)
1196 max_h = width(p) + h_offset;
1203 if (output_file_name == 0)
1208 pack_job_name(".dvi");
1210 while(!b_open_out(dvi_file))
1212 prompt_file_name("file name for output", ".dvi");
1215 output_file_name = b_make_name_string(dvi_file);
1218 if (total_pages == 0)
1222 dvi_four(25400000L); /* magic DVI scale factor */
1223 dvi_four(473628672L); /* 7227 * 65536 */
1226 old_setting = selector;
1227 selector = new_string;
1228 print_string(" TeX output ");
1235 print_two(tex_time / 60);
1236 print_two(tex_time % 60);
1237 selector = old_setting;
1238 dvi_out(cur_length);
1240 for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++)
1241 dvi_out(str_pool[s]);
1243 pool_ptr = str_start[str_ptr];
1246 page_loc = dvi_offset + dvi_ptr;
1249 for (k = 0; k <= 9; k++)
1253 last_bop = page_loc;
1254 cur_v = height(p) + v_offset;
1257 if (type(p) == vlist_node)
1262 dvi_out(eop); // do not need a endpage in haru.
1266 if (tracing_output <= 0)
1276 if (tracing_stats > 1)
1278 print_nl("Memory usage before: ");
1279 print_int(var_used);
1281 print_int(dyn_used);
1289 if (tracing_stats > 1)
1291 print_string(" after: ");
1292 print_int(var_used);
1294 print_int(dyn_used);
1295 print_string("; still utouched: ");
1296 print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1301 void ship_out_(halfword p)
1303 if (pdf_output_flag)
1309 void scan_spec_(group_code c, bool three_codes)
1317 if (scan_keyword("to"))
1318 spec_code = exactly;
1319 else if (scan_keyword("spread"))
1320 spec_code = additional;
1323 spec_code = additional;
1328 scan_dimen(false, false, false);
1337 saved(0) = spec_code;
1339 save_ptr = save_ptr + 2;
1344 halfword hpack_(halfword p, scaled w, small_number m)
1352 int o; /* 95/Jan/7 */
1353 internal_font_number f;
1358 r = get_node(box_node_size);
1359 type(r) = hlist_node;
1361 shift_amount(r) = 0;
1362 q = r + list_offset;
1367 total_stretch[normal] = 0;
1368 total_shrink[normal] = 0;
1369 total_stretch[fil] = 0;
1370 total_shrink[fil] = 0;
1371 total_stretch[fill] = 0;
1372 total_shrink[fill] = 0;
1373 total_stretch[filll] = 0;
1374 total_shrink[filll] = 0;
1379 while ((p >= hi_mem_min))
1382 i = char_info(f, character(p));
1383 hd = height_depth(i);
1384 x = x + char_width(f, i);
1385 s = char_height(f, hd);
1390 s = char_depth(f, hd);
1409 if (type(p) >= rule_node)
1412 s = shift_amount(p);
1414 if (height(p) - s > h)
1417 if (depth(p) + s > d)
1425 if (adjust_tail != 0)
1427 while (link(q) != p)
1430 if (type(p) == adjust_node)
1432 link(adjust_tail) = adjust_ptr(p);
1434 while (link(adjust_tail)!= 0)
1435 adjust_tail = link(adjust_tail);
1438 free_node(link(q), small_node_size);
1442 link(adjust_tail) = p;
1458 o = stretch_order(g);
1459 total_stretch[o] = total_stretch[o] + stretch(g);
1460 o = shrink_order(g);
1461 total_shrink[o] = total_shrink[o] + shrink(g);
1463 if (subtype(p) >= a_leaders)
1483 mem[lig_trick] = mem[lig_char(p)];
1484 link(lig_trick) = link(p);
1497 if (adjust_tail != 0)
1498 link(adjust_tail) = 0;
1503 if (m == additional)
1511 glue_sign(r) = normal;
1512 glue_order(r) = normal;
1518 if (total_stretch[filll] != 0)
1520 else if (total_stretch[fill] != 0)
1522 else if (total_stretch[fil] != 0)
1528 glue_sign(r) = stretching;
1530 if (total_stretch[o] != 0)
1531 glue_set(r) = x / ((double) total_stretch[o]);
1534 glue_sign(r) = normal;
1539 if (list_ptr(r) != 0)
1541 last_badness = badness(x, total_stretch[normal]);
1543 if (last_badness > hbadness)
1547 if (last_badness > 100)
1548 print_nl("Underfull");
1552 print_string(" \\hbox (badness ");
1553 print_int(last_badness);
1555 if (last_badness > 100) /* Y&Y TeX */
1556 underfull_hbox++; /* 1996/Feb/9 */
1565 if (total_shrink[filll] != 0)
1567 else if (total_shrink[fill] != 0)
1569 else if (total_shrink[fil] != 0)
1575 glue_sign(r) = shrinking;
1577 if (total_shrink[o] != 0)
1578 glue_set(r) =(- (integer) x) / ((double) total_shrink[o]);
1581 glue_sign(r) = normal;
1585 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1587 last_badness = 1000000L;
1590 if ((- (integer) x - total_shrink[normal] > hfuzz) || (hbadness < 100))
1592 if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
1597 link(q) = new_rule();
1598 width(link(q)) = overfull_rule;
1602 print_nl("Overfull \\hbox (");
1603 print_scaled(- (integer) x - total_shrink[normal]);
1604 print_string("pt too wide");
1606 overfull_hbox++; /* 1996/Feb/9 */
1611 else if (o == normal)
1612 if (list_ptr(r) != 0)
1614 last_badness = badness(- (integer) x, total_shrink[normal]);
1616 if (last_badness > hbadness)
1619 print_nl("Tight \\hbox (badness ");
1620 print_int(last_badness);
1628 print_string(") has occurred while \\output is active");
1631 if (pack_begin_line != 0)
1633 if (pack_begin_line > 0)
1634 print_string(") in paragraph at lines ");
1636 print_string(") in alignment at lines ");
1638 print_int(abs(pack_begin_line));
1642 print_string(") detected at line ");
1648 font_in_short_display = null_font;
1649 short_display(list_ptr(r));
1653 end_diagnostic(true);
1658 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1665 int o; /* 95/Jan/7 */
1668 r = get_node(box_node_size);
1669 type(r) = vlist_node;
1670 subtype(r) = min_quarterword;
1671 shift_amount(r) = 0;
1676 total_stretch[normal] = 0;
1677 total_shrink[normal] = 0;
1678 total_stretch[fil] = 0;
1679 total_shrink[fil] = 0;
1680 total_stretch[fill] = 0;
1681 total_shrink[fill] = 0;
1682 total_stretch[filll] = 0;
1683 total_shrink[filll] = 0;
1687 if ((p >= hi_mem_min))
1690 return 0; // abort_flag set
1692 else switch (type(p))
1699 x = x + d + height(p);
1702 if (type(p) >= rule_node)
1705 s = shift_amount(p);
1707 if (width(p) + s > w)
1721 o = stretch_order(g);
1722 total_stretch[o] = total_stretch[o] + stretch(g);
1723 o = shrink_order(g);
1724 total_shrink[o] = total_shrink[o] + shrink(g);
1726 if (subtype(p) >= a_leaders)
1738 x = x + d + width(p);
1759 if (m == additional)
1767 glue_sign(r) = normal;
1768 glue_order(r) = normal;
1774 if (total_stretch[filll] != 0)
1776 else if (total_stretch[fill] != 0)
1778 else if (total_stretch[fil] != 0)
1784 glue_sign(r) = stretching;
1786 if (total_stretch[o] != 0)
1787 glue_set(r) = x / ((double) total_stretch[o]);
1790 glue_sign(r) = normal;
1795 if (list_ptr(r) != 0)
1797 last_badness = badness(x, total_stretch[normal]);
1799 if (last_badness > vbadness)
1803 if (last_badness > 100)
1804 print_nl("Underfull");
1808 print_string(" \\vbox (badness ");
1809 print_int(last_badness);
1811 if (last_badness > 100)
1812 underfull_vbox++; /* 1996/Feb/9 */
1821 if (total_shrink[filll] != 0)
1823 else if (total_shrink[fill] != 0)
1825 else if (total_shrink[fil] != 0)
1831 glue_sign(r) = shrinking;
1833 if (total_shrink[o] != 0)
1834 glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
1837 glue_sign(r) = normal;
1841 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1843 last_badness = 1000000L;
1846 if ((- (integer) x - total_shrink[0] > vfuzz) || (vbadness < 100))
1849 print_nl("Overfull \\vbox (");
1850 print_scaled(- (integer) x - total_shrink[0]);
1851 print_string("pt too high");
1853 overfull_vbox++; /* 1996/Feb/9 */
1859 if (list_ptr(r) != 0)
1861 last_badness = badness(- (integer) x, total_shrink[normal]);
1862 if (last_badness > vbadness)
1865 print_nl("Tight \\vbox (badness ");
1866 print_int(last_badness);
1874 print_string(") has occurred while \\output is active");
1877 if (pack_begin_line != 0)
1879 print_string(") in alignment at lines ");
1880 print_int(abs(pack_begin_line));
1884 print_string(") detected at line ");
1892 end_diagnostic(true);
1897 void append_to_vlist_(halfword b)
1902 if (cur_list.aux_field.cint > ignore_depth)
1904 d = width(baseline_skip) - prev_depth - height(b);
1906 if (d < line_skip_limit)
1907 p = new_param_glue(line_skip_code);
1910 p = new_skip_param(baseline_skip_code);
1911 width(temp_ptr) = d;
1919 prev_depth = depth(b);
1922 halfword new_noad (void)
1926 p = get_node(noad_size);
1928 subtype(p) = normal;
1929 mem[nucleus(p)].hh = empty_field;
1930 mem[subscr(p)].hh = empty_field;
1931 mem[supscr(p)].hh = empty_field;
1936 halfword new_style_(small_number s)
1940 p = get_node(style_node_size);
1941 type(p) = style_node;
1949 halfword new_choice (void)
1953 p = get_node(style_node_size);
1954 type(p) = choice_node;
1956 display_mlist(p) = 0;
1958 script_mlist(p) = 0;
1959 script_script_mlist(p) = 0;
1964 void show_info (void)
1966 show_node_list(info(temp_ptr));
1969 halfword fraction_rule_(scaled t)
1980 halfword overbar_(halfword b, scaled k, scaled t)
1986 q = fraction_rule(t);
1990 return vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
1993 halfword char_box_(internal_font_number f, quarterword c)
1999 q = char_info(f, c);
2000 hd = height_depth(q);
2002 width(b) = char_width(f, q) + char_italic(f, q);
2003 height(b) = char_height(f, hd);
2004 depth(b) = char_depth(f, hd);
2013 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
2018 link(p) = list_ptr(b);
2020 height(b) = height(p);
2023 scaled height_plus_depth_(internal_font_number f, fquarterword c)
2028 q = char_info(f, c);
2029 hd = height_depth(q);
2030 return char_height(f, hd) + char_depth(f, hd);
2033 halfword var_delimiter_(halfword d, small_number s, scaled v)
2036 internal_font_number f, g;
2037 quarterword c, x, y;
2044 /* small_number z; */
2045 int z; /* 95/Jan/7 */
2046 /* bool large_attempt; */
2047 int large_attempt; /* 95/Jan/7 */
2051 large_attempt = false;
2057 if ((z != 0) || (x != 0))
2070 if ((y >= font_bc[g]) && (y <= font_ec[g]))
2073 q = char_info(g, y);
2077 if (char_tag(q) == ext_tag)
2084 hd = height_depth(q);
2085 u = char_height(g, hd) + char_depth(g, hd);
2097 if (char_tag(q) == list_tag)
2112 large_attempt = true;
2118 if (char_tag(q) == ext_tag)
2121 type(b) = vlist_node;
2122 r = font_info[exten_base[f] + rem_byte(q)].qqqq;
2124 u = height_plus_depth(f, c);
2126 q = char_info(f, c);
2127 width(b) = char_width(f, q) + char_italic(f, q);
2130 if (c != min_quarterword)
2131 w = w + height_plus_depth(f, c);
2135 if (c != min_quarterword)
2136 w = w + height_plus_depth(f, c);
2140 if (c != min_quarterword)
2141 w = w + height_plus_depth(f, c);
2151 if (ext_mid(r) != min_quarterword)
2157 if (c != min_quarterword)
2158 stack_into_box(b, f, c);
2162 for (m = 1; m <= n; m++)
2163 stack_into_box(b, f, c);
2167 if (c != min_quarterword)
2169 stack_into_box(b, f, c);
2172 for (m = 1; m <= n; m++)
2173 stack_into_box(b, f, c);
2179 stack_into_box(b, f, c);
2181 depth(b) = w - height(b);
2188 width(b) = null_delimiter_space;
2191 shift_amount(b) = half(height(b) - depth(b)) - axis_height(s);
2195 /* rebox_ etc used to follow here in tex4.c */