6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
11 #pragma warning(disable:4996)
12 #pragma warning(disable:4131) // old style declarator
13 #pragma warning(disable:4135) // conversion between different integral types
14 #pragma warning(disable:4127) // conditional expression is constant
22 #pragma warning(disable:4244) /* 96/Jan/10 */
25 void char_warning_(internal_font_number f, eight_bits c)
27 if (tracing_lost_chars > 0)
29 if (show_missing == 0)
32 if (show_missing) /* add ! before 94/June/10 */
35 print_string("Missing character: there is no ");
38 print_nl("Missing character: there is no ");
42 if (show_numeric) /* bkph 93/Dec/21 */
49 print_char(48 + c / 100);
51 c = c - (c / 100) * 100; /* ? */
52 print_char(48 + c / 10);
57 c = c - (c / 100) * 100; /* ? */
58 if (c / 10 > 0) print_char(48 + c / 10);
60 print_char(48 + c % 10);
64 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
65 print_string(" in font ");
66 slow_print(font_name[f]);
68 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
69 /* if (show_missing) show_context(); */ /* in tex2.c 94/June/10 */
73 show_context(); /* not if its the nullfont */
76 if (show_missing == 0) /* show on screen 94/June/10 */
77 end_diagnostic(false);
79 missing_characters++; /* bkph 93/Dec/16 */
80 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
84 halfword new_character_(internal_font_number f, eight_bits c)
90 if (char_exists(char_info(f, c)))
107 sprintf(log_line, "dvi_swap %d", dvi_gone);
108 show_line(log_line, 0);
111 if (dvi_limit == dvi_buf_size)
113 write_dvi(0, half_buf - 1);
114 dvi_limit = half_buf;
115 dvi_offset = dvi_offset + dvi_buf_size;
120 write_dvi(half_buf, dvi_buf_size - 1);
121 dvi_limit = dvi_buf_size;
124 dvi_gone = dvi_gone + half_buf;
126 /* attempt at speeding up bkph - is compiler smart ? */
128 void dvi_four_(integer x)
131 dvi_out(x / 0100000000); // dvi_out((x >> 24));
134 x = x + 010000000000;
135 x = x + 010000000000;
136 dvi_out((x / 0100000000) + 128); // dvi_out((x >> 24) + 128);
139 x = x % 0100000000; // x = x & 16777215L;
140 dvi_out(x / 0200000); // dvi_out((x >> 16));
141 x = x % 0200000; // x = x & 65535L;
142 dvi_out(x / 0400); // dvi_out((x >> 8));
143 dvi_out(x % 0400); // dvi_out(x & 255);
145 /* following needs access to dvi_buf=zdvibuf see coerce.h */
147 void zdvipop(integer l)
149 if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0))
154 /* following needs access to dvi_buf=zdvibuf see coerce.h */
156 void dvi_font_def_(internal_font_number f)
169 dvi_out(((f - 1) >> 8));
170 dvi_out(((f - 1) & 255));
177 dvi_out(font_check[f].b0);
178 dvi_out(font_check[f].b1);
179 dvi_out(font_check[f].b2);
180 dvi_out(font_check[f].b3);
181 dvi_four(font_size[f]);
182 dvi_four(font_dsize[f]);
183 dvi_out(length(font_area[f]));
184 dvi_out(length(font_name[f]));
186 for (k = str_start[font_area[f]]; k <= str_start[font_area[f] + 1] - 1; k++)
187 dvi_out(str_pool[k]);
189 for (k = str_start[font_name[f]]; k <= str_start[font_name[f] + 1] - 1; k++)
190 dvi_out(str_pool[k]);
193 void zmovement(scaled w, eight_bits o)
199 q = get_node(movement_node_size);
201 location(q) = dvi_offset + dvi_ptr;
220 switch(mstate + info(p))
222 case none_seen + yz_OK:
223 case none_seen + y_OK:
226 if (location(p) < dvi_gone)
230 k = location(p) - dvi_offset;
233 k = k + dvi_buf_size;
235 dvi_buf[k] = dvi_buf[k] + y1 - down1;
241 case none_seen + z_OK:
244 if (location(p) < dvi_gone)
248 k = location(p) - dvi_offset;
251 k = k + dvi_buf_size;
253 dvi_buf[k] = dvi_buf[k] + z1 - down1;
259 case none_seen + y_here:
260 case none_seen + z_here:
261 case y_seen + z_here:
262 case z_seen + y_here:
269 else switch (mstate + info(p))
271 case none_seen + y_here:
275 case none_seen + z_here:
279 case y_seen + z_here:
280 case z_seen + y_here:
293 if (abs(w) >= 8388608L) /* 2^23 */
300 if (abs(w) >= 32768L)
305 w = w + 16777216L; /* 2^24 */
306 //dvi_out(w / 65536L);
308 /* w = w % 65536L; */
339 if (info(q) == y_here)
341 dvi_out(o + y0 - down1);
364 dvi_out(o + z0 - down1);
387 void prune_movements_(integer l)
391 while (down_ptr != 0)
393 if (location(down_ptr) < l)
398 free_node(p, movement_node_size);
402 while (right_ptr != 0)
404 if (location(right_ptr) < l)
409 free_node(p, movement_node_size);
412 /* following needs access to dvi_buf=zdvibuf see coerce.h */
414 void special_out_(halfword p)
421 movement(cur_h - dvi_h, right1);
427 movement(cur_v - dvi_v, down1);
431 old_setting = selector;
432 selector = new_string;
434 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
435 /* About output \special{...} make some space in string pool 97/Mar/9 */
436 #ifdef ALLOCATESTRING
437 if (pool_ptr + 32000 > current_pool_size)
438 str_pool = realloc_str_pool (increment_pool_size);
439 /* We don't bother to check whether this worked - will catch later */
441 /* Potential problem here if current_pool_size is not much more than pool_ptr! */
442 /* Fixed 97/Mar/9 in version 2.0.3 */
443 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
444 #ifdef ALLOCATESTRING
445 show_token_list(link(write_tokens(p)), 0, 10000000L);
446 /* Above is safe, since print/print_char/print_esc will extend string space */
448 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
449 show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
451 selector = old_setting;
454 if (cur_length < 256) /* can use xxx1 ? */
462 dvi_four(cur_length);
465 for (k = str_start[str_ptr]; k <= pool_ptr - 1; k++)
466 dvi_out(str_pool[k]);
468 pool_ptr = str_start[str_ptr];
470 /* noew returns -1 if it fails */
472 void write_out_(halfword p)
475 /* integer oldmode; */
476 int oldmode; /* 1995/Jan/7 */
477 /* small_number j; */
478 int j; /* 1995/Jan/7 */
482 info(q) = right_brace_token + '}';
485 info(r) = end_write_token;
487 begin_token_list(write_tokens(p), write_text);
489 info(q) = left_brace_token + '{';
494 q = scan_toks(false, true);
497 if (cur_tok != end_write_token)
499 print_err("Unbalanced write command");
500 help2("On this page there's a \\write with fewer real {'s than }'s.",
501 "I can't handle that very well; good luck.");
508 while(!(cur_tok == end_write_token)); /*1996/Jan/10*/
513 old_setting = selector;
520 if ((j == 17) && (selector == term_and_log))
529 selector = old_setting;
532 void out_what_(halfword p)
534 /* small_number j; */
535 int j; /* 1995/Jan/7 */
546 if (subtype(p) == write_node)
553 (void) a_close(write_file[j]);
555 if (subtype(p) == close_node)
556 write_open[j]= false;
559 cur_name = open_name(p);
560 cur_area = open_area(p);
561 cur_ext = open_ext(p);
563 if (cur_ext == 335) /* "" */
564 cur_ext = 785; /* => ".tex" */
566 pack_file_name(cur_name, cur_area, cur_ext);
568 while(! a_open_out(write_file[j]))
570 prompt_file_name("output file name", ".tex");
573 write_open[j] = true;
590 return; // abort_flag set
595 /* following needs access to dvi_buf=zdvibuf see coerce.h */
597 void hlist_out (void)
601 scaled save_h, save_v;
603 /* glue_ord g_order; */
604 int g_order; /* 95/Jan/7 */
606 int g_sign; /* 95/Jan/7 */
612 bool outer_doing_leaders;
621 g_order = glue_order(this_box);
622 g_sign = glue_sign(this_box);
623 p = list_ptr(this_box);
629 if (cur_s > max_push)
632 save_loc = dvi_offset + dvi_ptr;
656 if (f <= 64 + font_base)
657 dvi_out(f - font_base - 1 + fnt_num_0);
659 /* if we allow greater than 256 fonts */
666 /* normal TeX 82 case */
674 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
676 /* fnt2 followed by f / 256, f % 256 */
680 dvi_out(((f - 1) >> 8)); /* top byte */
681 dvi_out(((f - 1) & 255)); /* bottom byte */
684 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
692 cur_h = cur_h + char_width(f, char_info(f, c));
695 while(!(!(p >= hi_mem_min)));
705 if (list_ptr(p) == 0)
706 cur_h = cur_h + width(p);
711 cur_v = base_line + shift_amount(p);
715 if (type(p) == vlist_node)
722 cur_h = edge + width(p);
743 rule_wd = width(g) - cur_g;
745 if (g_sign != normal)
747 if (g_sign == stretching)
749 if (stretch_order(g) == g_order)
751 cur_glue = cur_glue + stretch(g);
752 glue_temp = glue_set(this_box) * cur_glue;
754 if (glue_temp > 1000000000.0)
755 glue_temp = 1000000000.0;
756 else if (glue_temp < -1000000000.0)
757 glue_temp = -1000000000.0;
759 cur_g = round(glue_temp);
762 else if (shrink_order(g) == g_order)
764 cur_glue = cur_glue - shrink(g);
765 glue_temp = glue_set(this_box) * cur_glue;
767 if (glue_temp > 1000000000.0)
768 glue_temp = 1000000000.0;
769 else if (glue_temp < -1000000000.0)
770 glue_temp = -1000000000.0;
772 cur_g = round(glue_temp);
776 rule_wd = rule_wd + cur_g;
778 if (subtype(p) >= a_leaders)
780 leader_box = leader_ptr(p);
782 if (type(leader_box) == rule_node)
784 rule_ht = height(leader_box);
785 rule_dp = depth(leader_box);
789 leader_wd = width(leader_box);
791 if ((leader_wd > 0) && (rule_wd > 0))
793 rule_wd = rule_wd + 10;
794 edge = cur_h + rule_wd;
797 if (subtype(p) == a_leaders)
800 cur_h = left_edge + leader_wd * ((cur_h - left_edge) / leader_wd);
803 cur_h = cur_h + leader_wd;
807 lq = rule_wd / leader_wd;
808 lr = rule_wd % leader_wd;
810 if (subtype(p) == c_leaders)
811 cur_h = cur_h + (lr / 2);
814 lx =(2 * lr + lq + 1) / (2 * lq + 2);
815 cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
819 while (cur_h + leader_wd <= edge)
821 cur_v = base_line + shift_amount(leader_box);
826 temp_ptr = leader_box;
827 outer_doing_leaders = doing_leaders;
828 doing_leaders = true;
830 if (type(leader_box) == vlist_node)
835 doing_leaders = outer_doing_leaders;
839 cur_h = save_h + leader_wd + lx;
853 cur_h = cur_h + width(p);
858 mem[lig_trick] = mem[lig_char(p)];
859 link(lig_trick) = link(p);
871 if ((rule_ht == -1073741824L)) /* - 2^30 */
872 rule_ht = height(this_box);
874 if ((rule_dp == -1073741824L)) /* - 2^30 */
875 rule_dp = depth(this_box);
877 rule_ht = rule_ht + rule_dp;
879 if ((rule_ht > 0) && (rule_wd > 0))
882 cur_v = base_line + rule_dp;
888 dvi_h = dvi_h + rule_wd;
891 cur_h = cur_h + rule_wd;
896 prune_movements(save_loc);
903 /* following needs access to dvi_buf=zdvibuf see coerce.h */
905 void vlist_out (void)
909 scaled save_h, save_v;
911 /* glue_ord g_order; */
912 int g_order; /* 95/Jan/7 */
914 int g_sign; /* 95/Jan/7 */
920 bool outer_doing_leaders;
929 g_order = glue_order(this_box);
930 g_sign = glue_sign(this_box);
931 p = list_ptr(this_box);
937 if (cur_s > max_push)
940 save_loc = dvi_offset + dvi_ptr;
942 cur_v = cur_v - height(this_box);
947 if ((p >= hi_mem_min))
949 confusion("vlistout");
950 return; // abort_flag set
958 if (list_ptr(p) == 0)
959 cur_v = cur_v + height(p) + depth(p);
962 cur_v = cur_v + height(p);
966 cur_h = left_edge + shift_amount(p);
969 if (type(p) == vlist_node)
976 cur_v = save_v + depth(p);
997 rule_ht = width(g) - cur_g;
999 if (g_sign != normal)
1001 if (g_sign == stretching)
1003 if (stretch_order(g) == g_order)
1005 cur_glue = cur_glue + stretch(g);
1006 glue_temp = glue_set(this_box) * cur_glue;
1008 if (glue_temp > 1000000000.0)
1009 glue_temp = 1000000000.0;
1010 else if (glue_temp < -1000000000.0)
1011 glue_temp = -1000000000.0;
1013 cur_g = round(glue_temp);
1016 else if (shrink_order(g) == g_order) /* BUG FIX !!! */
1018 cur_glue = cur_glue - shrink(g);
1019 glue_temp = glue_set(this_box) * cur_glue;
1021 if (glue_temp > 1000000000.0)
1022 glue_temp = 1000000000.0;
1023 else if (glue_temp < -1000000000.0)
1024 glue_temp = -1000000000.0;
1026 cur_g = round(glue_temp);
1030 rule_ht = rule_ht + cur_g;
1032 if (subtype(p) >= a_leaders)
1034 leader_box = leader_ptr(p);
1036 if (type(leader_box) == rule_node)
1038 rule_wd = width(leader_box);
1043 leader_ht = height(leader_box) + depth(leader_box);
1045 if ((leader_ht > 0) && (rule_ht > 0))
1047 rule_ht = rule_ht + 10;
1048 edge = cur_v + rule_ht;
1051 if (subtype(p) == a_leaders)
1054 cur_v = top_edge + leader_ht * ((cur_v - top_edge) / leader_ht);
1057 cur_v = cur_v + leader_ht;
1061 lq = rule_ht / leader_ht;
1062 lr = rule_ht % leader_ht;
1064 if (subtype(p) == c_leaders)
1065 cur_v = cur_v + (lr / 2);
1068 lx = (2 * lr + lq + 1) / (2 * lq + 2);
1069 cur_v = cur_v + ((lr - (lq - 1) * lx) / 2);
1073 while (cur_v + leader_ht <= edge)
1075 cur_h = left_edge + shift_amount(leader_box);
1078 cur_v = cur_v + height(leader_box);
1081 temp_ptr = leader_box;
1082 outer_doing_leaders = doing_leaders;
1083 doing_leaders = true;
1085 if (type(leader_box) == vlist_node)
1090 doing_leaders = outer_doing_leaders;
1094 cur_v = save_v - height(leader_box) + leader_ht + lx;
1107 cur_v = cur_v + width(p);
1115 if ((rule_wd == -1073741824L)) /* -2^30 */
1116 rule_wd = width(this_box);
1118 rule_ht = rule_ht + rule_dp;
1119 cur_v = cur_v + rule_ht;
1121 if ((rule_ht > 0) && (rule_wd > 0))
1132 cur_v = cur_v + rule_ht;
1138 prune_movements(save_loc);
1146 /* following needs access to dvi_buf=zdvibuf see coerce.h */
1148 void dvi_ship_out_(halfword p)
1155 if (tracing_output > 0)
1159 print_string("Completed box being shipped out");
1162 if (term_offset > max_print_line - 9)
1164 else if ((term_offset > 0) || (file_offset > 0))
1170 while((count(j) == 0) && (j > 0))
1173 for (k = 0; k <= j; k++)
1175 print_int(count(k));
1185 if (tracing_output > 0)
1190 end_diagnostic(true);
1193 if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
1194 (height(p) + depth(p) + v_offset > max_dimen) ||
1195 (width(p) + h_offset > max_dimen))
1197 print_err("Huge page cannot be shipped out");
1198 help2("The page just created is more than 18 feet tall or",
1199 "more than 18 feet wide, so I suspect something went wrong.");
1202 if (tracing_output <= 0)
1205 print_nl("The following box has been deleted:");
1207 end_diagnostic(true);
1213 if (height(p) + depth(p) + v_offset > max_v)
1214 max_v = height(p) + depth(p) + v_offset;
1216 if (width(p) + h_offset > max_h)
1217 max_h = width(p) + h_offset;
1224 if (output_file_name == 0)
1229 pack_job_name(".dvi");
1231 while(!b_open_out(dvi_file))
1233 prompt_file_name("file name for output", ".dvi");
1236 output_file_name = b_make_name_string(dvi_file);
1239 if (total_pages == 0)
1243 dvi_four(25400000L); /* magic DVI scale factor */
1244 dvi_four(473628672L); /* 7227 * 65536 */
1247 old_setting = selector;
1248 selector = new_string;
1249 print_string(" TeX output ");
1256 print_two(tex_time / 60);
1257 print_two(tex_time % 60);
1258 selector = old_setting;
1259 dvi_out(cur_length);
1261 for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++)
1262 dvi_out(str_pool[s]);
1264 pool_ptr = str_start[str_ptr];
1267 page_loc = dvi_offset + dvi_ptr;
1270 for (k = 0; k <= 9; k++)
1274 last_bop = page_loc;
1275 cur_v = height(p) + v_offset;
1278 if (type(p) == vlist_node)
1283 dvi_out(eop); // do not need a endpage in haru.
1287 if (tracing_output <= 0)
1297 if (tracing_stats > 1)
1299 print_nl("Memory usage before: ");
1300 print_int(var_used);
1302 print_int(dyn_used);
1310 if (tracing_stats > 1)
1312 print_string(" after: ");
1313 print_int(var_used);
1315 print_int(dyn_used);
1316 print_string("; still utouched: ");
1317 print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */
1322 void ship_out_(halfword p)
1324 if (pdf_output_flag)
1330 void scan_spec_(group_code c, bool three_codes)
1338 if (scan_keyword("to"))
1339 spec_code = exactly;
1340 else if (scan_keyword("spread"))
1341 spec_code = additional;
1344 spec_code = additional;
1349 scan_dimen(false, false, false);
1358 saved(0) = spec_code;
1360 save_ptr = save_ptr + 2;
1365 halfword hpack_(halfword p, scaled w, small_number m)
1373 int o; /* 95/Jan/7 */
1374 internal_font_number f;
1379 r = get_node(box_node_size);
1380 type(r) = hlist_node;
1382 shift_amount(r) = 0;
1383 q = r + list_offset;
1388 total_stretch[normal] = 0;
1389 total_shrink[normal] = 0;
1390 total_stretch[fil] = 0;
1391 total_shrink[fil] = 0;
1392 total_stretch[fill] = 0;
1393 total_shrink[fill] = 0;
1394 total_stretch[filll] = 0;
1395 total_shrink[filll] = 0;
1400 while ((p >= hi_mem_min))
1403 i = char_info(f, character(p));
1404 hd = height_depth(i);
1405 x = x + char_width(f, i);
1406 s = char_height(f, hd);
1411 s = char_depth(f, hd);
1430 if (type(p) >= rule_node)
1433 s = shift_amount(p);
1435 if (height(p) - s > h)
1438 if (depth(p) + s > d)
1446 if (adjust_tail != 0)
1448 while (link(q) != p)
1451 if (type(p) == adjust_node)
1453 link(adjust_tail) = adjust_ptr(p);
1455 while (link(adjust_tail)!= 0)
1456 adjust_tail = link(adjust_tail);
1459 free_node(link(q), small_node_size);
1463 link(adjust_tail) = p;
1479 o = stretch_order(g);
1480 total_stretch[o] = total_stretch[o] + stretch(g);
1481 o = shrink_order(g);
1482 total_shrink[o] = total_shrink[o] + shrink(g);
1484 if (subtype(p) >= a_leaders)
1504 mem[lig_trick] = mem[lig_char(p)];
1505 link(lig_trick) = link(p);
1518 if (adjust_tail != 0)
1519 link(adjust_tail) = 0;
1524 if (m == additional)
1532 glue_sign(r) = normal;
1533 glue_order(r) = normal;
1539 if (total_stretch[filll] != 0)
1541 else if (total_stretch[fill] != 0)
1543 else if (total_stretch[fil] != 0)
1549 glue_sign(r) = stretching;
1551 if (total_stretch[o] != 0)
1552 glue_set(r) = x / ((double) total_stretch[o]);
1555 glue_sign(r) = normal;
1560 if (list_ptr(r) != 0)
1562 last_badness = badness(x, total_stretch[normal]);
1564 if (last_badness > hbadness)
1568 if (last_badness > 100)
1569 print_nl("Underfull");
1573 print_string(" \\hbox (badness ");
1574 print_int(last_badness);
1576 if (last_badness > 100) /* Y&Y TeX */
1577 underfull_hbox++; /* 1996/Feb/9 */
1586 if (total_shrink[filll] != 0)
1588 else if (total_shrink[fill] != 0)
1590 else if (total_shrink[fil] != 0)
1596 glue_sign(r) = shrinking;
1598 if (total_shrink[o] != 0)
1599 glue_set(r) =(- (integer) x) / ((double) total_shrink[o]);
1602 glue_sign(r) = normal;
1606 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1608 last_badness = 1000000L;
1611 if ((- (integer) x - total_shrink[normal] > hfuzz) || (hbadness < 100))
1613 if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
1618 link(q) = new_rule();
1619 width(link(q)) = overfull_rule;
1623 print_nl("Overfull \\hbox (");
1624 print_scaled(- (integer) x - total_shrink[normal]);
1625 print_string("pt too wide");
1627 overfull_hbox++; /* 1996/Feb/9 */
1632 else if (o == normal)
1633 if (list_ptr(r) != 0)
1635 last_badness = badness(- (integer) x, total_shrink[normal]);
1637 if (last_badness > hbadness)
1640 print_nl("Tight \\hbox (badness ");
1641 print_int(last_badness);
1649 print_string(") has occurred while \\output is active");
1652 if (pack_begin_line != 0)
1654 if (pack_begin_line > 0)
1655 print_string(") in paragraph at lines ");
1657 print_string(") in alignment at lines ");
1659 print_int(abs(pack_begin_line));
1663 print_string(") detected at line ");
1669 font_in_short_display = null_font;
1670 short_display(list_ptr(r));
1674 end_diagnostic(true);
1679 halfword vpackage_(halfword p, scaled h, small_number m, scaled l)
1686 int o; /* 95/Jan/7 */
1689 r = get_node(box_node_size);
1690 type(r) = vlist_node;
1691 subtype(r) = min_quarterword;
1692 shift_amount(r) = 0;
1697 total_stretch[normal] = 0;
1698 total_shrink[normal] = 0;
1699 total_stretch[fil] = 0;
1700 total_shrink[fil] = 0;
1701 total_stretch[fill] = 0;
1702 total_shrink[fill] = 0;
1703 total_stretch[filll] = 0;
1704 total_shrink[filll] = 0;
1708 if ((p >= hi_mem_min))
1711 return 0; // abort_flag set
1713 else switch (type(p))
1720 x = x + d + height(p);
1723 if (type(p) >= rule_node)
1726 s = shift_amount(p);
1728 if (width(p) + s > w)
1742 o = stretch_order(g);
1743 total_stretch[o] = total_stretch[o] + stretch(g);
1744 o = shrink_order(g);
1745 total_shrink[o] = total_shrink[o] + shrink(g);
1747 if (subtype(p) >= a_leaders)
1759 x = x + d + width(p);
1780 if (m == additional)
1788 glue_sign(r) = normal;
1789 glue_order(r) = normal;
1795 if (total_stretch[filll] != 0)
1797 else if (total_stretch[fill] != 0)
1799 else if (total_stretch[fil] != 0)
1805 glue_sign(r) = stretching;
1807 if (total_stretch[o] != 0)
1808 glue_set(r) = x / ((double) total_stretch[o]);
1811 glue_sign(r) = normal;
1816 if (list_ptr(r) != 0)
1818 last_badness = badness(x, total_stretch[normal]);
1820 if (last_badness > vbadness)
1824 if (last_badness > 100)
1825 print_nl("Underfull");
1829 print_string(" \\vbox (badness ");
1830 print_int(last_badness);
1832 if (last_badness > 100)
1833 underfull_vbox++; /* 1996/Feb/9 */
1842 if (total_shrink[filll] != 0)
1844 else if (total_shrink[fill] != 0)
1846 else if (total_shrink[fil] != 0)
1852 glue_sign(r) = shrinking;
1854 if (total_shrink[o] != 0)
1855 glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
1858 glue_sign(r) = normal;
1862 if ((total_shrink[o] < - (integer) x) && (o == 0) && (list_ptr(r) != 0))
1864 last_badness = 1000000L;
1867 if ((- (integer) x - total_shrink[0] > vfuzz) || (vbadness < 100))
1870 print_nl("Overfull \\vbox (");
1871 print_scaled(- (integer) x - total_shrink[0]);
1872 print_string("pt too high");
1874 overfull_vbox++; /* 1996/Feb/9 */
1880 if (list_ptr(r) != 0)
1882 last_badness = badness(- (integer) x, total_shrink[normal]);
1883 if (last_badness > vbadness)
1886 print_nl("Tight \\vbox (badness ");
1887 print_int(last_badness);
1895 print_string(") has occurred while \\output is active");
1898 if (pack_begin_line != 0)
1900 print_string(") in alignment at lines ");
1901 print_int(abs(pack_begin_line));
1905 print_string(") detected at line ");
1913 end_diagnostic(true);
1918 void append_to_vlist_(halfword b)
1923 if (cur_list.aux_field.cint > ignore_depth)
1925 d = width(baseline_skip) - prev_depth - height(b);
1927 if (d < line_skip_limit)
1928 p = new_param_glue(line_skip_code);
1931 p = new_skip_param(baseline_skip_code);
1932 width(temp_ptr) = d;
1940 prev_depth = depth(b);
1943 halfword new_noad (void)
1947 p = get_node(noad_size);
1949 subtype(p) = normal;
1950 mem[nucleus(p)].hh = empty_field;
1951 mem[subscr(p)].hh = empty_field;
1952 mem[supscr(p)].hh = empty_field;
1957 halfword new_style_(small_number s)
1961 p = get_node(style_node_size);
1962 type(p) = style_node;
1970 halfword new_choice (void)
1974 p = get_node(style_node_size);
1975 type(p) = choice_node;
1977 display_mlist(p) = 0;
1979 script_mlist(p) = 0;
1980 script_script_mlist(p) = 0;
1985 void show_info (void)
1987 show_node_list(info(temp_ptr));
1990 halfword fraction_rule_(scaled t)
2001 halfword overbar_(halfword b, scaled k, scaled t)
2007 q = fraction_rule(t);
2011 return vpackage(p, 0, 1, 1073741823L); /* 2^30 - 1 */
2014 halfword char_box_(internal_font_number f, quarterword c)
2020 q = char_info(f, c);
2021 hd = height_depth(q);
2023 width(b) = char_width(f, q) + char_italic(f, q);
2024 height(b) = char_height(f, hd);
2025 depth(b) = char_depth(f, hd);
2034 void stack_into_box_(halfword b, internal_font_number f, quarterword c)
2039 link(p) = list_ptr(b);
2041 height(b) = height(p);
2044 scaled height_plus_depth_(internal_font_number f, fquarterword c)
2049 q = char_info(f, c);
2050 hd = height_depth(q);
2051 return char_height(f, hd) + char_depth(f, hd);
2054 halfword var_delimiter_(halfword d, small_number s, scaled v)
2057 internal_font_number f, g;
2058 quarterword c, x, y;
2065 /* small_number z; */
2066 int z; /* 95/Jan/7 */
2067 /* bool large_attempt; */
2068 int large_attempt; /* 95/Jan/7 */
2072 large_attempt = false;
2078 if ((z != 0) || (x != 0))
2091 if ((y >= font_bc[g]) && (y <= font_ec[g]))
2094 q = char_info(g, y);
2098 if (char_tag(q) == ext_tag)
2105 hd = height_depth(q);
2106 u = char_height(g, hd) + char_depth(g, hd);
2118 if (char_tag(q) == list_tag)
2133 large_attempt = true;
2139 if (char_tag(q) == ext_tag)
2142 type(b) = vlist_node;
2143 r = font_info[exten_base[f] + rem_byte(q)].qqqq;
2145 u = height_plus_depth(f, c);
2147 q = char_info(f, c);
2148 width(b) = char_width(f, q) + char_italic(f, q);
2151 if (c != min_quarterword)
2152 w = w + height_plus_depth(f, c);
2156 if (c != min_quarterword)
2157 w = w + height_plus_depth(f, c);
2161 if (c != min_quarterword)
2162 w = w + height_plus_depth(f, c);
2172 if (ext_mid(r) != min_quarterword)
2178 if (c != min_quarterword)
2179 stack_into_box(b, f, c);
2183 for (m = 1; m <= n; m++)
2184 stack_into_box(b, f, c);
2188 if (c != min_quarterword)
2190 stack_into_box(b, f, c);
2193 for (m = 1; m <= n; m++)
2194 stack_into_box(b, f, c);
2200 stack_into_box(b, f, c);
2202 depth(b) = w - height(b);
2209 width(b) = null_delimiter_space;
2212 shift_amount(b) = half(height(b) - depth(b)) - axis_height(s);
2216 /* rebox_ etc used to follow here in tex4.c */