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);
423 show_token_list(link(write_tokens(p)), 0, 10000000L);
425 show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
428 selector = old_setting;
431 if (cur_length < 256)
439 dvi_four(cur_length);
442 for (k = str_start[str_ptr]; k <= pool_ptr - 1; k++)
443 dvi_out(str_pool[k]);
445 pool_ptr = str_start[str_ptr];
448 void write_out_(halfword p)
451 /* integer oldmode; */
452 int oldmode; /* 1995/Jan/7 */
453 /* small_number j; */
454 int j; /* 1995/Jan/7 */
458 info(q) = right_brace_token + '}';
461 info(r) = end_write_token;
463 begin_token_list(write_tokens(p), write_text);
465 info(q) = left_brace_token + '{';
470 q = scan_toks(false, true);
473 if (cur_tok != end_write_token)
475 print_err("Unbalanced write command");
476 help2("On this page there's a \\write with fewer real {'s than }'s.",
477 "I can't handle that very well; good luck.");
484 while(!(cur_tok == end_write_token));
489 old_setting = selector;
496 if ((j == 17) && (selector == term_and_log))
505 selector = old_setting;
508 void out_what_(halfword p)
510 /* small_number j; */
511 int j; /* 1995/Jan/7 */
522 if (subtype(p) == write_node)
529 (void) a_close(write_file[j]);
531 if (subtype(p) == close_node)
532 write_open[j]= false;
535 cur_name = open_name(p);
536 cur_area = open_area(p);
537 cur_ext = open_ext(p);
539 if (cur_ext == 335) /* "" */
540 cur_ext = 785; /* => ".tex" */
542 pack_file_name(cur_name, cur_area, cur_ext);
544 while(! a_open_out(write_file[j]))
546 prompt_file_name("output file name", ".tex");
549 write_open[j] = true;
566 return; // abort_flag set
572 void hlist_out (void)
576 scaled save_h, save_v;
578 /* glue_ord g_order; */
579 int g_order; /* 95/Jan/7 */
581 int g_sign; /* 95/Jan/7 */
587 bool outer_doing_leaders;
596 g_order = glue_order(this_box);
597 g_sign = glue_sign(this_box);
598 p = list_ptr(this_box);
604 if (cur_s > max_push)
607 save_loc = dvi_offset + dvi_ptr;
631 if (f <= 64 + font_base)
632 dvi_out(f - font_base - 1 + fnt_num_0);
634 /* if we allow greater than 256 fonts */
641 /* normal TeX 82 case */
649 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
651 /* fnt2 followed by f / 256, f % 256 */
655 dvi_out(((f - 1) >> 8)); /* top byte */
656 dvi_out(((f - 1) & 255)); /* bottom byte */
659 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
667 cur_h = cur_h + char_width(f, char_info(f, c));
670 while(!(!(p >= hi_mem_min)));
680 if (list_ptr(p) == 0)
681 cur_h = cur_h + width(p);
686 cur_v = base_line + shift_amount(p);
690 if (type(p) == vlist_node)
697 cur_h = edge + width(p);
718 rule_wd = width(g) - cur_g;
720 if (g_sign != normal)
722 if (g_sign == stretching)
724 if (stretch_order(g) == g_order)
726 cur_glue = cur_glue + stretch(g);
727 glue_temp = glue_set(this_box) * cur_glue;
729 if (glue_temp > 1000000000.0)
730 glue_temp = 1000000000.0;
731 else if (glue_temp < -1000000000.0)
732 glue_temp = -1000000000.0;
734 cur_g = round(glue_temp);
737 else if (shrink_order(g) == g_order)
739 cur_glue = cur_glue - shrink(g);
740 glue_temp = glue_set(this_box) * cur_glue;
742 if (glue_temp > 1000000000.0)
743 glue_temp = 1000000000.0;
744 else if (glue_temp < -1000000000.0)
745 glue_temp = -1000000000.0;
747 cur_g = round(glue_temp);
751 rule_wd = rule_wd + cur_g;
753 if (subtype(p) >= a_leaders)
755 leader_box = leader_ptr(p);
757 if (type(leader_box) == rule_node)
759 rule_ht = height(leader_box);
760 rule_dp = depth(leader_box);
764 leader_wd = width(leader_box);
766 if ((leader_wd > 0) && (rule_wd > 0))
768 rule_wd = rule_wd + 10;
769 edge = cur_h + rule_wd;
772 if (subtype(p) == a_leaders)
775 cur_h = left_edge + leader_wd * ((cur_h - left_edge) / leader_wd);
778 cur_h = cur_h + leader_wd;
782 lq = rule_wd / leader_wd;
783 lr = rule_wd % leader_wd;
785 if (subtype(p) == c_leaders)
786 cur_h = cur_h + (lr / 2);
789 lx =(2 * lr + lq + 1) / (2 * lq + 2);
790 cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
794 while (cur_h + leader_wd <= edge)
796 cur_v = base_line + shift_amount(leader_box);
801 temp_ptr = leader_box;
802 outer_doing_leaders = doing_leaders;
803 doing_leaders = true;
805 if (type(leader_box) == vlist_node)
810 doing_leaders = outer_doing_leaders;
814 cur_h = save_h + leader_wd + lx;
828 cur_h = cur_h + width(p);
833 mem[lig_trick] = mem[lig_char(p)];
834 link(lig_trick) = link(p);
846 if ((rule_ht == -1073741824L)) /* - 2^30 */
847 rule_ht = height(this_box);
849 if ((rule_dp == -1073741824L)) /* - 2^30 */
850 rule_dp = depth(this_box);
852 rule_ht = rule_ht + rule_dp;
854 if ((rule_ht > 0) && (rule_wd > 0))
857 cur_v = base_line + rule_dp;
863 dvi_h = dvi_h + rule_wd;
866 cur_h = cur_h + rule_wd;
871 prune_movements(save_loc);
879 void vlist_out (void)
883 scaled save_h, save_v;
885 /* glue_ord g_order; */
886 int g_order; /* 95/Jan/7 */
888 int g_sign; /* 95/Jan/7 */
894 bool outer_doing_leaders;
903 g_order = glue_order(this_box);
904 g_sign = glue_sign(this_box);
905 p = list_ptr(this_box);
911 if (cur_s > max_push)
914 save_loc = dvi_offset + dvi_ptr;
916 cur_v = cur_v - height(this_box);
921 if ((p >= hi_mem_min))
923 confusion("vlistout");
924 return; // abort_flag set
932 if (list_ptr(p) == 0)
933 cur_v = cur_v + height(p) + depth(p);
936 cur_v = cur_v + height(p);
940 cur_h = left_edge + shift_amount(p);
943 if (type(p) == vlist_node)
950 cur_v = save_v + depth(p);
971 rule_ht = width(g) - cur_g;
973 if (g_sign != normal)
975 if (g_sign == stretching)
977 if (stretch_order(g) == g_order)
979 cur_glue = cur_glue + stretch(g);
980 glue_temp = glue_set(this_box) * cur_glue;
982 if (glue_temp > 1000000000.0)
983 glue_temp = 1000000000.0;
984 else if (glue_temp < -1000000000.0)
985 glue_temp = -1000000000.0;
987 cur_g = round(glue_temp);
990 else if (shrink_order(g) == g_order) /* BUG FIX !!! */
992 cur_glue = cur_glue - shrink(g);
993 glue_temp = glue_set(this_box) * cur_glue;
995 if (glue_temp > 1000000000.0)
996 glue_temp = 1000000000.0;
997 else if (glue_temp < -1000000000.0)
998 glue_temp = -1000000000.0;
1000 cur_g = round(glue_temp);
1004 rule_ht = rule_ht + cur_g;
1006 if (subtype(p) >= a_leaders)
1008 leader_box = leader_ptr(p);
1010 if (type(leader_box) == rule_node)
1012 rule_wd = width(leader_box);
1017 leader_ht = height(leader_box) + depth(leader_box);
1019 if ((leader_ht > 0) && (rule_ht > 0))
1021 rule_ht = rule_ht + 10;
1022 edge = cur_v + rule_ht;
1025 if (subtype(p) == a_leaders)
1028 cur_v = top_edge + leader_ht * ((cur_v - top_edge) / leader_ht);
1031 cur_v = cur_v + leader_ht;
1035 lq = rule_ht / leader_ht;
1036 lr = rule_ht % leader_ht;
1038 if (subtype(p) == c_leaders)
1039 cur_v = cur_v + (lr / 2);
1042 lx = (2 * lr + lq + 1) / (2 * lq + 2);
1043 cur_v = cur_v + ((lr - (lq - 1) * lx) / 2);
1047 while (cur_v + leader_ht <= edge)
1049 cur_h = left_edge + shift_amount(leader_box);
1052 cur_v = cur_v + height(leader_box);
1055 temp_ptr = leader_box;
1056 outer_doing_leaders = doing_leaders;
1057 doing_leaders = true;
1059 if (type(leader_box) == vlist_node)
1064 doing_leaders = outer_doing_leaders;
1068 cur_v = save_v - height(leader_box) + leader_ht + lx;
1081 cur_v = cur_v + width(p);
1089 if ((rule_wd == -1073741824L)) /* -2^30 */
1090 rule_wd = width(this_box);
1092 rule_ht = rule_ht + rule_dp;
1093 cur_v = cur_v + rule_ht;
1095 if ((rule_ht > 0) && (rule_wd > 0))
1106 cur_v = cur_v + rule_ht;
1112 prune_movements(save_loc);
1120 void dvi_ship_out_(halfword p)
1127 if (tracing_output > 0)
1131 print_string("Completed box being shipped out");
1134 if (term_offset > max_print_line - 9)
1136 else if ((term_offset > 0) || (file_offset > 0))
1142 while((count(j) == 0) && (j > 0))
1145 for (k = 0; k <= j; k++)
1147 print_int(count(k));
1157 if (tracing_output > 0)
1162 end_diagnostic(true);
1165 if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
1166 (height(p) + depth(p) + v_offset > max_dimen) ||
1167 (width(p) + h_offset > max_dimen))
1169 print_err("Huge page cannot be shipped out");
1170 help2("The page just created is more than 18 feet tall or",
1171 "more than 18 feet wide, so I suspect something went wrong.");
1174 if (tracing_output <= 0)
1177 print_nl("The following box has been deleted:");
1179 end_diagnostic(true);
1185 if (height(p) + depth(p) + v_offset > max_v)
1186 max_v = height(p) + depth(p) + v_offset;
1188 if (width(p) + h_offset > max_h)
1189 max_h = width(p) + h_offset;
1196 if (output_file_name == 0)
1201 pack_job_name(".dvi");
1203 while(!b_open_out(dvi_file))
1205 prompt_file_name("file name for output", ".dvi");
1208 output_file_name = b_make_name_string(dvi_file);
1211 if (total_pages == 0)
1215 dvi_four(25400000L); /* magic DVI scale factor */
1216 dvi_four(473628672L); /* 7227 * 65536 */
1219 old_setting = selector;
1220 selector = new_string;
1221 print_string(" TeX output ");
1228 print_two(tex_time / 60);
1229 print_two(tex_time % 60);
1230 selector = old_setting;
1231 dvi_out(cur_length);
1233 for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++)
1234 dvi_out(str_pool[s]);
1236 pool_ptr = str_start[str_ptr];
1239 page_loc = dvi_offset + dvi_ptr;
1242 for (k = 0; k <= 9; k++)
1246 last_bop = page_loc;
1247 cur_v = height(p) + v_offset;
1250 if (type(p) == vlist_node)
1255 dvi_out(eop); // do not need a endpage in haru.
1259 if (tracing_output <= 0)
1269 if (tracing_stats > 1)
1271 print_nl("Memory usage before: ");
1272 print_int(var_used);
1274 print_int(dyn_used);
1282 if (tracing_stats > 1)
1284 print_string(" after: ");
1285 print_int(var_used);
1287 print_int(dyn_used);
1288 print_string("; still utouched: ");
1289 print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1294 void ship_out_(halfword p)
1296 if (pdf_output_flag)
1302 void scan_spec_(group_code c, bool three_codes)
1310 if (scan_keyword("to"))
1311 spec_code = exactly;
1312 else if (scan_keyword("spread"))
1313 spec_code = additional;
1316 spec_code = additional;
1321 scan_dimen(false, false, false);
1330 saved(0) = spec_code;
1332 save_ptr = save_ptr + 2;
1337 halfword hpack_(halfword p, scaled w, small_number m)
1345 int o; /* 95/Jan/7 */
1346 internal_font_number f;
1351 r = get_node(box_node_size);
1352 type(r) = hlist_node;
1354 shift_amount(r) = 0;
1355 q = r + list_offset;
1360 total_stretch[normal] = 0;
1361 total_shrink[normal] = 0;
1362 total_stretch[fil] = 0;
1363 total_shrink[fil] = 0;
1364 total_stretch[fill] = 0;
1365 total_shrink[fill] = 0;
1366 total_stretch[filll] = 0;
1367 total_shrink[filll] = 0;
1372 while ((p >= hi_mem_min))
1375 i = char_info(f, character(p));
1376 hd = height_depth(i);
1377 x = x + char_width(f, i);
1378 s = char_height(f, hd);
1383 s = char_depth(f, hd);
1402 if (type(p) >= rule_node)
1405 s = shift_amount(p);
1407 if (height(p) - s > h)
1410 if (depth(p) + s > d)
1418 if (adjust_tail != 0)
1420 while (link(q) != p)
1423 if (type(p) == adjust_node)
1425 link(adjust_tail) = adjust_ptr(p);
1427 while (link(adjust_tail)!= 0)
1428 adjust_tail = link(adjust_tail);
1431 free_node(link(q), small_node_size);
1435 link(adjust_tail) = p;
1451 o = stretch_order(g);
1452 total_stretch[o] = total_stretch[o] + stretch(g);
1453 o = shrink_order(g);
1454 total_shrink[o] = total_shrink[o] + shrink(g);
1456 if (subtype(p) >= a_leaders)
1476 mem[lig_trick] = mem[lig_char(p)];
1477 link(lig_trick) = link(p);
1490 if (adjust_tail != 0)
1491 link(adjust_tail) = 0;
1496 if (m == additional)
1504 glue_sign(r) = normal;
1505 glue_order(r) = normal;
1511 if (total_stretch[filll] != 0)
1513 else if (total_stretch[fill] != 0)
1515 else if (total_stretch[fil] != 0)
1521 glue_sign(r) = stretching;
1523 if (total_stretch[o] != 0)
1524 glue_set(r) = x / ((double) total_stretch[o]);
1527 glue_sign(r) = normal;
1532 if (list_ptr(r) != 0)
1534 last_badness = badness(x, total_stretch[normal]);
1536 if (last_badness > hbadness)
1540 if (last_badness > 100)
1541 print_nl("Underfull");
1545 print_string(" \\hbox (badness ");
1546 print_int(last_badness);
1548 if (last_badness > 100) /* Y&Y TeX */
1549 underfull_hbox++; /* 1996/Feb/9 */
1558 if (total_shrink[filll] != 0)
1560 else if (total_shrink[fill] != 0)
1562 else if (total_shrink[fil] != 0)
1568 glue_sign(r) = shrinking;
1570 if (total_shrink[o] != 0)
1571 glue_set(r) =(- (integer) x) / ((double) total_shrink[o]);
1574 glue_sign(r) = normal;
1578 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1580 last_badness = 1000000L;
1583 if ((- (integer) x - total_shrink[normal] > hfuzz) || (hbadness < 100))
1585 if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
1590 link(q) = new_rule();
1591 width(link(q)) = overfull_rule;
1595 print_nl("Overfull \\hbox (");
1596 print_scaled(- (integer) x - total_shrink[normal]);
1597 print_string("pt too wide");
1599 overfull_hbox++; /* 1996/Feb/9 */
1604 else if (o == normal)
1605 if (list_ptr(r) != 0)
1607 last_badness = badness(- (integer) x, total_shrink[normal]);
1609 if (last_badness > hbadness)
1612 print_nl("Tight \\hbox (badness ");
1613 print_int(last_badness);
1621 print_string(") has occurred while \\output is active");
1624 if (pack_begin_line != 0)
1626 if (pack_begin_line > 0)
1627 print_string(") in paragraph at lines ");
1629 print_string(") in alignment at lines ");
1631 print_int(abs(pack_begin_line));
1635 print_string(") detected at line ");
1641 font_in_short_display = null_font;
1642 short_display(list_ptr(r));
1646 end_diagnostic(true);
1651 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1658 int o; /* 95/Jan/7 */
1661 r = get_node(box_node_size);
1662 type(r) = vlist_node;
1663 subtype(r) = min_quarterword;
1664 shift_amount(r) = 0;
1669 total_stretch[normal] = 0;
1670 total_shrink[normal] = 0;
1671 total_stretch[fil] = 0;
1672 total_shrink[fil] = 0;
1673 total_stretch[fill] = 0;
1674 total_shrink[fill] = 0;
1675 total_stretch[filll] = 0;
1676 total_shrink[filll] = 0;
1680 if ((p >= hi_mem_min))
1683 return 0; // abort_flag set
1685 else switch (type(p))
1692 x = x + d + height(p);
1695 if (type(p) >= rule_node)
1698 s = shift_amount(p);
1700 if (width(p) + s > w)
1714 o = stretch_order(g);
1715 total_stretch[o] = total_stretch[o] + stretch(g);
1716 o = shrink_order(g);
1717 total_shrink[o] = total_shrink[o] + shrink(g);
1719 if (subtype(p) >= a_leaders)
1731 x = x + d + width(p);
1752 if (m == additional)
1760 glue_sign(r) = normal;
1761 glue_order(r) = normal;
1767 if (total_stretch[filll] != 0)
1769 else if (total_stretch[fill] != 0)
1771 else if (total_stretch[fil] != 0)
1777 glue_sign(r) = stretching;
1779 if (total_stretch[o] != 0)
1780 glue_set(r) = x / ((double) total_stretch[o]);
1783 glue_sign(r) = normal;
1788 if (list_ptr(r) != 0)
1790 last_badness = badness(x, total_stretch[normal]);
1792 if (last_badness > vbadness)
1796 if (last_badness > 100)
1797 print_nl("Underfull");
1801 print_string(" \\vbox (badness ");
1802 print_int(last_badness);
1804 if (last_badness > 100)
1805 underfull_vbox++; /* 1996/Feb/9 */
1814 if (total_shrink[filll] != 0)
1816 else if (total_shrink[fill] != 0)
1818 else if (total_shrink[fil] != 0)
1824 glue_sign(r) = shrinking;
1826 if (total_shrink[o] != 0)
1827 glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
1830 glue_sign(r) = normal;
1834 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1836 last_badness = 1000000L;
1839 if ((- (integer) x - total_shrink[0] > vfuzz) || (vbadness < 100))
1842 print_nl("Overfull \\vbox (");
1843 print_scaled(- (integer) x - total_shrink[0]);
1844 print_string("pt too high");
1846 overfull_vbox++; /* 1996/Feb/9 */
1852 if (list_ptr(r) != 0)
1854 last_badness = badness(- (integer) x, total_shrink[normal]);
1855 if (last_badness > vbadness)
1858 print_nl("Tight \\vbox (badness ");
1859 print_int(last_badness);
1867 print_string(") has occurred while \\output is active");
1870 if (pack_begin_line != 0)
1872 print_string(") in alignment at lines ");
1873 print_int(abs(pack_begin_line));
1877 print_string(") detected at line ");
1885 end_diagnostic(true);
1890 void append_to_vlist_(halfword b)
1895 if (cur_list.aux_field.cint > ignore_depth)
1897 d = width(baseline_skip) - prev_depth - height(b);
1899 if (d < line_skip_limit)
1900 p = new_param_glue(line_skip_code);
1903 p = new_skip_param(baseline_skip_code);
1904 width(temp_ptr) = d;
1912 prev_depth = depth(b);
1915 halfword new_noad (void)
1919 p = get_node(noad_size);
1921 subtype(p) = normal;
1922 mem[nucleus(p)].hh = empty_field;
1923 mem[subscr(p)].hh = empty_field;
1924 mem[supscr(p)].hh = empty_field;
1929 halfword new_style_(small_number s)
1933 p = get_node(style_node_size);
1934 type(p) = style_node;
1942 halfword new_choice (void)
1946 p = get_node(style_node_size);
1947 type(p) = choice_node;
1949 display_mlist(p) = 0;
1951 script_mlist(p) = 0;
1952 script_script_mlist(p) = 0;
1957 void show_info (void)
1959 show_node_list(info(temp_ptr));
1962 halfword fraction_rule_(scaled t)
1973 halfword overbar_(halfword b, scaled k, scaled t)
1979 q = fraction_rule(t);
1983 return vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
1986 halfword char_box_(internal_font_number f, quarterword c)
1992 q = char_info(f, c);
1993 hd = height_depth(q);
1995 width(b) = char_width(f, q) + char_italic(f, q);
1996 height(b) = char_height(f, hd);
1997 depth(b) = char_depth(f, hd);
2006 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
2011 link(p) = list_ptr(b);
2013 height(b) = height(p);
2016 scaled height_plus_depth_(internal_font_number f, quarterword c)
2021 q = char_info(f, c);
2022 hd = height_depth(q);
2023 return char_height(f, hd) + char_depth(f, hd);
2026 halfword var_delimiter_(halfword d, small_number s, scaled v)
2029 internal_font_number f, g;
2030 quarterword c, x, y;
2037 /* small_number z; */
2038 int z; /* 95/Jan/7 */
2039 /* bool large_attempt; */
2040 int large_attempt; /* 95/Jan/7 */
2044 large_attempt = false;
2050 if ((z != 0) || (x != 0))
2063 if ((y >= font_bc[g]) && (y <= font_ec[g]))
2066 q = char_info(g, y);
2070 if (char_tag(q) == ext_tag)
2077 hd = height_depth(q);
2078 u = char_height(g, hd) + char_depth(g, hd);
2090 if (char_tag(q) == list_tag)
2105 large_attempt = true;
2111 if (char_tag(q) == ext_tag)
2114 type(b) = vlist_node;
2115 r = font_info[exten_base[f] + rem_byte(q)].qqqq;
2117 u = height_plus_depth(f, c);
2119 q = char_info(f, c);
2120 width(b) = char_width(f, q) + char_italic(f, q);
2123 if (c != min_quarterword)
2124 w = w + height_plus_depth(f, c);
2128 if (c != min_quarterword)
2129 w = w + height_plus_depth(f, c);
2133 if (c != min_quarterword)
2134 w = w + height_plus_depth(f, c);
2144 if (ext_mid(r) != min_quarterword)
2150 if (c != min_quarterword)
2151 stack_into_box(b, f, c);
2155 for (m = 1; m <= n; m++)
2156 stack_into_box(b, f, c);
2160 if (c != min_quarterword)
2162 stack_into_box(b, f, c);
2165 for (m = 1; m <= n; m++)
2166 stack_into_box(b, f, c);
2172 stack_into_box(b, f, c);
2174 depth(b) = w - height(b);
2181 width(b) = null_delimiter_space;
2184 shift_amount(b) = half(height(b) - depth(b)) - axis_height(s);
2188 /* rebox_ etc used to follow here in tex4.c */