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 align_peek (void)
26 align_state = 1000000L;
32 while (!(cur_cmd != spacer));
34 if (cur_cmd == no_align)
38 new_save_level(no_align_group);
43 else if (cur_cmd == right_brace)
47 else if ((cur_cmd == car_ret) && (cur_chr == cr_cr_code))
56 pointer finite_shrink_(pointer p)
60 if (no_shrink_error_yet)
62 no_shrink_error_yet = false;
63 print_err("Infinite glue shrinkage found in a paragraph");
64 help5("The paragraph just ended includes some glue that has",
65 "infinite shrinkability, e.g., `\\hskip 0pt minus 1fil'.",
66 "Such glue doesn't belong there---it allows a paragraph",
67 "of any length to fit on one line. But it's safe to proceed,",
68 "since the offensive shrinkability has been made finite.");
73 shrink_order(q) = normal;
79 void try_break_ (integer pi, small_number break_type)
90 internal_font_number f;
92 boolean node_r_stays_active;
97 boolean artificial_demerits;
101 if (abs(pi) >= inf_penalty)
110 do_all_six(copy_to_cur_active);
117 if (type(r) == delta_node)
119 do_all_six(update_width);
120 prev_prev_r = prev_r;
130 if ((minimum_demerits < awful_bad) && ((old_l != easy_line) || (r == active)))
134 no_break_yet = false;
135 do_all_six(set_break_width_to_background);
138 if (break_type > unhyphenated)
141 t = replace_count(cur_p);
143 s = post_break(cur_p);
153 break_width[1] = break_width[1] - char_width(f, char_info(f, character(v)));
155 else switch (type(v))
159 f = font(lig_char(v));
160 break_width[1] = break_width[1] - char_width(f, char_info(f, character(lig_char(v))));
168 break_width[1] = break_width[1] - width(v);
185 break_width[1] = break_width[1] + char_width(f, char_info(f, character(s)));
187 else switch (type(s))
191 f = font(lig_char(s));
192 break_width[1] = break_width[1] + char_width(f, char_info(f, character(lig_char(s))));
200 break_width[1] = break_width[1] + width(s);
214 break_width[1] = break_width[1] + disc_width;
216 if (post_break(cur_p) == 0)
230 break_width[1] = break_width[1] - width(v);
231 break_width[2 + stretch_order(v)] = break_width[2 + stretch_order(v)] - stretch(v);
232 break_width[6] = break_width[6] - shrink(v);
241 break_width[1] = break_width[1] - width(s);
245 if (subtype(s) != explicit)
248 break_width[1] = break_width[1] - width(s);
261 if (type(prev_r) == delta_node)
262 do_all_six(convert_to_break_width);
263 else if (prev_r == active)
264 do_all_six(store_break_width);
267 q = get_node(delta_node_size);
269 type(q) = delta_node;
271 do_all_six(new_delta_to_break_width);
273 prev_prev_r = prev_r;
277 if (abs(adj_demerits) >= awful_bad - minimum_demerits)
278 minimum_demerits = awful_bad - 1;
280 minimum_demerits = minimum_demerits + abs(adj_demerits);
282 for (fit_class = very_loose_fit; fit_class <= tight_fit; fit_class++)
284 if (minimal_demerits[fit_class] <= minimum_demerits)
286 q = get_node(passive_node_size);
289 cur_break(q) = cur_p;
292 serial(q) = pass_number;
294 prev_break(q) = best_place[fit_class];
295 q = get_node(active_node_size);
296 break_node(q) = passive;
297 line_number(q) = best_pl_line[fit_class] + 1;
298 fitness(q) = fit_class;
299 type(q) = break_type;
300 total_demerits(q) = minimal_demerits[fit_class];
305 if (tracing_paragraphs > 0)
308 print_int(serial(passive));
310 print_int(line_number(q) - 1);
312 print_int(fit_class);
314 if (break_type == hyphenated)
318 print_int(total_demerits(q));
321 if (prev_break(passive) == 0)
324 print_int(serial(prev_break(passive)));
329 minimal_demerits[fit_class] = awful_bad;
332 minimum_demerits = awful_bad;
336 q = get_node(delta_node_size);
338 type(q) = delta_node;
340 do_all_six(new_delta_from_break_width);
342 prev_prev_r = prev_r;
352 line_width = second_width;
353 old_l = max_halfword - 1; /*262142L*/ /* 2^18 - 2 ? */
359 if (l > last_special_line)
360 line_width = second_width;
361 else if (par_shape_ptr == 0)
362 line_width = first_width;
364 line_width = mem[par_shape_ptr + 2 * l].cint;
370 artificial_demerits = false;
371 shortfall = line_width - cur_active_width[1];
374 if ((cur_active_width[3] != 0) || (cur_active_width[4] != 0) || (cur_active_width[5] != 0))
377 fit_class = decent_fit;
381 if (shortfall > 7230584L)
382 if (cur_active_width[2] < 1663497L)
385 fit_class = very_loose_fit;
389 b = badness(shortfall, cur_active_width[2]);
393 fit_class = very_loose_fit;
395 fit_class = loose_fit;
397 fit_class = decent_fit;
402 if (- (integer) shortfall > cur_active_width[6])
405 b = badness(- (integer) shortfall, cur_active_width[6]);
408 fit_class = tight_fit;
410 fit_class = decent_fit;
413 if ((b > inf_bad) || (pi == eject_penalty))
415 if (final_pass && (minimum_demerits == awful_bad) && (link(r) == active) && (prev_r == active))
416 artificial_demerits = true;
417 else if (b > threshold)
420 node_r_stays_active = false;
429 node_r_stays_active = true;
432 if (artificial_demerits)
436 d = line_penalty + b;
446 else if (pi > -10000)
449 if ((break_type == hyphenated) && (type(r) == hyphenated))
451 d = d + double_hyphen_demerits;
453 d = d + final_hyphen_demerits;
455 if (abs(toint(fit_class)- toint(fitness(r))) > 1)
456 d = d + adj_demerits;
460 if (tracing_paragraphs > 0)
462 if (printed_node != cur_p)
467 short_display(link(printed_node));
470 save_link = link(cur_p);
473 short_display(link(printed_node));
474 link(cur_p) = save_link;
477 printed_node = cur_p;
484 else if (type(cur_p) != glue_node)
486 if (type(cur_p) == penalty_node)
487 print_esc("penalty");
488 else if (type(cur_p) == disc_node)
489 print_esc("discretionary");
490 else if (type(cur_p) == kern_node)
498 if (break_node(r) == 0)
501 print_int(serial(break_node(r)));
514 if (artificial_demerits)
521 d = d + total_demerits(r);
523 if (d <= minimal_demerits[fit_class])
525 minimal_demerits[fit_class] = d;
526 best_place[fit_class] = break_node(r);
527 best_pl_line[fit_class] = l;
529 if (d < minimum_demerits)
530 minimum_demerits = d;
533 if (node_r_stays_active)
536 link(prev_r) = link(r);
537 free_node(r, active_node_size);
539 if (prev_r == active)
543 if (type(r) == delta_node)
545 do_all_six(update_active);
546 do_all_six(copy_to_cur_active);
547 link(active) = link(r);
548 free_node(r, delta_node_size);
551 else if (type(prev_r) == delta_node)
557 do_all_six(downdate_width);
558 link(prev_prev_r) = active;
559 free_node(prev_r, delta_node_size);
560 prev_r = prev_prev_r;
562 else if (type(r) == delta_node)
564 do_all_six(update_width);
565 do_all_six(combine_two_deltas);
566 link(prev_r) = link(r);
567 free_node(r, delta_node_size);
575 if (cur_p == printed_node)
577 if (type(cur_p) == disc_node)
579 t = replace_count(cur_p);
584 printed_node = link(printed_node);
589 /* end of the old tex5.c here */
591 void post_line_break_(integer final_widow_penalty)
595 boolean post_disc_break;
602 q = break_node(best_bet);
609 next_break(r) = cur_p;
614 cur_line = prev_graf + 1;
618 q = cur_break(cur_p);
620 post_disc_break = false;
623 if (type(q) == glue_node)
625 delete_glue_ref(glue_ptr(q));
626 glue_ptr(q) = right_skip;
627 subtype(q) = right_skip_code + 1;
628 add_glue_ref(right_skip);
633 if (type(q) == disc_node)
635 t = replace_count(q);
652 flush_node_list(link(q));
653 replace_count(q) = 0;
656 if (post_break(q) != 0)
666 post_disc_break = true;
669 if (pre_break(q) != 0)
684 else if ((type(q) == math_node) || (type(q) == kern_node))
695 r = new_param_glue(right_skip_code);
709 r = new_param_glue(left_skip_code);
714 if (cur_line > last_special_line)
716 cur_width = second_width;
717 cur_indent = second_indent;
719 else if (par_shape_ptr == 0)
721 cur_width = first_width;
722 cur_indent = first_indent;
726 cur_width = mem[par_shape_ptr + 2 * cur_line].cint;
727 cur_indent = mem[par_shape_ptr + 2 * cur_line - 1].cint;
730 adjust_tail = adjust_head;
731 just_box = hpack(q, cur_width, 0);
732 shift_amount(just_box) = cur_indent;
733 append_to_vlist(just_box);
735 if (adjust_head != adjust_tail)
737 link(tail) = link(adjust_head);
743 if (cur_line + 1 != best_line)
745 pen = inter_line_penalty;
747 if (cur_line == prev_graf + 1)
748 pen = pen + club_penalty;
750 if (cur_line + 2 == best_line)
751 pen = pen + final_widow_penalty;
754 pen = pen + broken_penalty;
758 r = new_penalty(pen);
765 cur_p = next_break(cur_p);
768 if (!post_disc_break)
776 if (q == cur_break(cur_p))
782 if (non_discardable(q))
785 if (type(q) == kern_node)
795 flush_node_list(link(temp_head));
800 while (!(cur_p == 0));
802 if ((cur_line != best_line) || (link(temp_head) != 0))
804 confusion("line breaking");
808 prev_graf = best_line - 1;
811 small_number reconstitute_(small_number j, small_number n, halfword bchar, halfword hchar)
830 ligature_present = init_lig;
833 if (ligature_present)
838 append_charnode_to_t(character(p));
842 else if (cur_l < 256)
844 append_charnode_to_t(cur_l);
851 if (cur_l == non_char)
855 if (k == non_address)
858 q = font_info[k].qqqq;
862 q = char_info(hf, cur_l);
864 if (char_tag(q) != lig_tag)
867 k = lig_kern_start(hf, q);
868 q = font_info[k].qqqq;
870 if (skip_byte(q) > stop_flag)
872 k = lig_kern_restart(hf, q);
873 q = font_info[k].qqqq;
877 if (cur_rh < non_char)
884 if (next_char(q) == test_char)
885 if (skip_byte(q) <= 128)
886 if (cur_rh < non_char)
895 if (hchar < non_char)
902 if (op_byte(q) < kern_flag)
904 if (cur_l == non_char)
919 ligature_present = true;
929 character(lig_stack) = cur_r;
932 lig_stack = new_lig_item(cur_r);
939 list_ptr(lig_stack) = p;
940 character(p) = hu[j + 1];
951 lig_stack = new_lig_item(cur_r);
959 if (ligature_present)
961 p = new_ligature(hf, cur_l, mem[cur_q].hh.rh);
969 mem[cur_q].hh.rh = p;
971 ligature_present = false;
976 ligature_present = true;
983 ligature_present = true;
987 if (lig_ptr(lig_stack) != 0)
989 link(t) = lig_ptr(lig_stack);
996 free_node(p, small_node_size);
1011 cur_r = character(lig_stack);
1017 append_charnode_to_t(cur_r);
1026 if (op_byte(q) != 7)
1032 w = char_kern(hf, q);
1036 if (q.b0 >= stop_flag)
1037 if (cur_rh == non_char)
1045 k = k + skip_byte(q) + 1;
1046 q = font_info[k].qqqq;
1054 link(t) = new_kern(w);
1062 cur_l = character(lig_stack);
1063 ligature_present = true;
1071 void hyphenate (void)
1075 int l; /* 95/Jan/7 */
1078 pointer major_tail, minor_tail;
1082 /* integer r_count; */
1091 for (j = 0; j <= hn; j++)
1098 for (j = 2; j <= hn; j++)
1099 h = (h + h + hc[j]) % hyphen_prime;
1111 if (length(k) == hn)
1118 if (str_pool[u] < hc[j])
1121 if (str_pool[u] > hc[j])
1151 if (trie_trc[cur_lang + 1] != cur_lang)
1158 for (j = 0; j <= hn - r_hyf + 1; j++)
1160 z = trie_trl[cur_lang + 1] + hc[j];
1163 while (hc[l] == trie_trc[z])
1165 if (trie_tro[z] != min_trie_op)
1171 v = v + op_start[cur_lang];
1172 i = l - hyf_distance[v];
1174 if (hyf_num[v] > hyf[i])
1179 while (!(v == min_trie_op));
1183 z = trie_trl[z] + hc[l];
1188 for (j = 0; j <= l_hyf - 1; j++)
1191 for (j = 0; j <= r_hyf - 1; j++)
1194 for (j = l_hyf; j <= hn - r_hyf; j++)
1207 if (is_char_node(ha))
1214 hu[0] = character(ha);
1216 else if (type(ha) == ligature_node)
1217 if (font(lig_char(ha)) != hf)
1221 init_list = lig_ptr(ha);
1223 init_lft = (subtype(ha) > 1);
1224 hu[0] = character(lig_char(ha));
1233 free_node(ha, small_node_size);
1237 if (!is_char_node(r))
1238 if (type(r) == ligature_node)
1250 while (link(s) != ha)
1269 j = reconstitute(j, hn, bchar, hyf_char) + 1;
1271 if (hyphen_passed == 0)
1273 link(s) = link(hold_head);
1275 while (link(s) != 0) /* l.17903 */
1278 if (odd(hyf[j - 1]))
1281 hyphen_passed = j - 1;
1282 link(hold_head) = 0;
1286 if (hyphen_passed > 0)
1289 r = get_node(small_node_size);
1290 link(r) = link(hold_head);
1291 type(r) = disc_node;
1295 while (mem[major_tail].hh.rh != 0)
1297 major_tail = link(major_tail);
1305 hyf_node = new_character(hf, hyf_char);
1312 free_avail(hyf_node);
1317 l = reconstitute(l, i, font_bchar[hf], non_char) + 1;
1319 if (link(hold_head) != 0) /* BUG FIX ??? */
1321 if (minor_tail == 0)
1322 pre_break(r) = link(hold_head);
1324 link(minor_tail) = link(hold_head);
1326 minor_tail = link(hold_head);
1328 while (link(minor_tail) != 0) /* BUG FIX */
1329 minor_tail = link(minor_tail);
1333 if (hyf_node != 0) /* if hyf_node<>null then l.17956 */
1344 if (bchar_label[hf] != non_address) /* i.e. 0 --- 96/Jan/15 */
1356 l = reconstitute(l, hn, bchar, 256) + 1;
1364 if (link(hold_head) != 0) /* BUG FIX */
1366 if (minor_tail == 0) /* begin if minor_tail=null then */
1367 post_break(r) = link(hold_head);
1369 link(minor_tail) = link(hold_head);
1371 minor_tail = link(hold_head);
1373 while (link(minor_tail) != 0) /* ??? */
1374 minor_tail = link(minor_tail);
1381 j = reconstitute(j, hn, bchar, non_char) + 1;
1382 link(major_tail) = link(hold_head);
1384 while (mem[major_tail].hh.rh != 0)
1386 major_tail = link(major_tail);
1401 replace_count(r) = r_count;
1405 hyphen_passed = j - 1;
1406 link(hold_head) = 0;
1408 while (!(! odd(hyf[j - 1])));
1413 flush_list(init_list);
1416 void new_hyph_exceptions (void)
1454 if (lc_code(cur_chr) == 0)
1456 print_err("Not a letter");
1457 help2("Letters in \\hyphenation words must have \\lccode>0.",
1458 "Proceed; I'll ignore the character I just read.");
1464 hc[n] = lc_code(cur_chr);
1473 cur_cmd = char_given;
1488 for (j = 1; j <= n; j++)
1490 h = (h + h + hc[j]) % hyphen_prime;
1496 if (hyph_count == hyphen_prime)
1498 overflow("exception dictionary", hyphen_prime);
1504 while (hyph_word[h] != 0)
1508 if (length(k) < length(s))
1511 if (length(k) > length(s))
1519 if (str_pool[u] < str_pool[v])
1522 if (str_pool[u] > str_pool[v])
1528 while (!(u == str_start[k + 1]));
1548 if (cur_cmd == right_brace)
1558 print_err("Improper ");
1559 print_esc("hyphenation");
1560 prints(" will be flushed");
1561 help2("Hyphenation exceptions must contain only letters",
1562 "and hyphens. But continue; I'll forgive and forget.");
1570 pointer prune_page_top_(pointer p)
1576 link(temp_head) = p;
1585 q = new_skip_param(split_top_skip_code);
1589 if (width(temp_ptr) > height(p))
1590 width(temp_ptr) = width(temp_ptr) - height(p);
1592 width(temp_ptr) = 0;
1621 confusion("pruning");
1627 return link(temp_head);
1630 pointer vert_break_(pointer p, scaled h, scaled d)
1639 /* small_number t; */
1643 least_cost = awful_bad;
1644 do_all_six(set_height_zero);
1651 else switch (type(p))
1657 cur_height = cur_height + prev_dp + height(p);
1668 if (precedes_break(prev_p))
1671 goto update_heights;
1684 goto update_heights;
1699 confusion("vertbreak");
1705 if (pi < inf_penalty)
1708 if ((active_width[3] != 0) || (active_width[4] != 0) || (active_width[5]!= 0))
1711 b = badness(h - cur_height, active_width[2]);
1712 else if (act_width - h > active_width[6])
1715 b = badness(cur_height - h, active_width[6]);
1718 if (pi <= eject_penalty)
1720 else if (b < inf_bad)
1725 if (b <= least_cost)
1729 best_height_plus_depth = cur_height + prev_dp;
1732 if ((b == awful_bad) || (pi <= eject_penalty))
1736 if ((type(p) < glue_node) || (type(p) > kern_node))
1741 if (type(p) == kern_node)
1746 active_width[2 + stretch_order(q)] = active_width[2 + stretch_order(q)] + stretch(q);
1747 active_width[6] = active_width[6] + shrink(q);
1749 if ((shrink_order(q) != normal) && (shrink(q) != 0))
1751 print_err("Infinite glue shrinkage found in box being split");
1752 help4("The box you are \\vsplitting contains some infinitely",
1753 "shrinkable glue, e.g., `\\vss' or `\\vskip 0pt minus 1fil'.",
1754 "Such glue doesn't belong there; but you can safely proceed,",
1755 "since the offensive shrinkability has been made finite.");
1758 shrink_order(r) = normal;
1765 cur_height = cur_height + prev_dp + width(q);
1772 cur_height = cur_height + prev_dp - d;
1784 pointer vsplit_(eight_bits n, scaled h)
1792 if (split_first_mark != 0)
1794 delete_token_ref(split_first_mark);
1795 split_first_mark = 0;
1796 delete_token_ref(split_bot_mark);
1805 if (type(v) != vlist_node)
1808 print_esc("vsplit");
1809 prints(" needs a ");
1811 help2("The box you are trying to split is an \\hbox.",
1812 "I can't split such a box, so I'll leave it alone.");
1817 q = vert_break(list_ptr(v), h, split_max_depth);
1824 if (type(p) == mark_node)
1825 if (split_first_mark == 0)
1827 split_first_mark = mark_ptr(p);
1828 split_bot_mark = split_first_mark;
1829 token_ref_count(split_first_mark) = token_ref_count(split_first_mark) + 2;
1833 delete_token_ref(split_bot_mark);
1834 split_bot_mark = mark_ptr(p);
1835 add_token_ref(split_bot_mark);
1848 q = prune_page_top(q);
1850 free_node(v, box_node_size);
1855 box(n) = vpackage(q, 0, 1, 1073741823L); /* 2^30 - 1 */
1857 return vpackage(p, h, exactly, split_max_depth);
1860 void print_totals (void)
1862 print_scaled(page_so_far[1]);
1864 if (page_so_far[2] != 0)
1867 print_scaled(page_so_far[2]);
1871 if (page_so_far[3] != 0)
1874 print_scaled(page_so_far[3]);
1878 if (page_so_far[4] != 0)
1881 print_scaled(page_so_far[4]);
1885 if (page_so_far[5] != 0)
1888 print_scaled(page_so_far[5]);
1892 if (page_so_far[6] != 0)
1895 print_scaled(page_so_far[6]);
1899 void freeze_page_specs_(small_number s)
1903 page_max_depth = max_depth;
1905 do_all_six(set_page_so_far_zero);
1906 least_page_cost = awful_bad;
1909 if (tracing_pages > 0)
1912 print_nl("%% goal height=");
1913 print_scaled(page_goal);
1914 prints(", max depth=");
1915 print_scaled(page_max_depth);
1916 end_diagnostic(false);
1921 void box_error_(eight_bits n)
1925 print_nl("The following box has been deleted:");
1927 end_diagnostic(true);
1928 flush_node_list(box(n));
1932 void ensure_vbox_(eight_bits n)
1939 if (type(p) == hlist_node)
1941 print_err("Insertions can only be added to a vbox");
1942 help3("Tut tut: You're trying to \\insert into a",
1943 "\\box register that now contains an \\hbox.",
1944 "Proceed, and I'll discard its present contents.");
1949 void fire_up_(pointer c)
1953 /* unsigned char n; */
1956 integer save_vbadness;
1958 pointer save_split_top_skip;
1960 if (type(best_page_break) == penalty_node)
1962 geq_word_define(int_base + output_penalty_code, penalty(best_page_break));
1963 penalty(best_page_break) = inf_penalty;
1966 geq_word_define(int_base + output_penalty_code, inf_penalty);
1971 delete_token_ref(top_mark);
1973 top_mark = bot_mark;
1974 add_token_ref(top_mark);
1975 delete_token_ref(first_mark);
1979 if (c == best_page_break)
1980 best_page_break = 0;
1986 prints("255 is not void");
1987 help2("You shouldn't use \\box255 except in \\output routines.",
1988 "Proceed, and I'll discard its present contents.");
1992 insert_penalties = 0;
1993 save_split_top_skip = split_top_skip;
1995 if (holding_inserts <= 0)
1997 r = link(page_ins_head);
1999 while (r != page_ins_head)
2001 if (best_ins_ptr(r) != 0)
2007 box(n) = new_null_box();
2009 p = box(n) + list_offset;
2011 while (link(p) != 0)
2014 last_ins_ptr(r) = p;
2026 while (p != best_page_break)
2028 if (type(p) == ins_node)
2030 if (holding_inserts <= 0)
2032 r = link(page_ins_head);
2034 while (subtype(r) != subtype(p))
2037 if (best_ins_ptr(r) == 0)
2042 s = last_ins_ptr(r);
2043 link(s) = ins_ptr(p);
2045 if (best_ins_ptr(r) == p)
2047 if (type(r) == split_up)
2048 if ((broken_ins(r) == p) && (broken_ins(r) != 0))
2050 while (link(s) != broken_ptr(r))
2054 split_top_skip = split_top_ptr(p);
2055 ins_ptr(p) = prune_page_top(broken_ptr(r));
2057 if (ins_ptr(p) != 0)
2059 temp_ptr = vpackage(ins_ptr(p), 0, 1, 1073741823L); /* 2^30 - 1 */
2060 height(p) = height(temp_ptr) + depth(temp_ptr);
2061 free_node(temp_ptr, box_node_size);
2066 best_ins_ptr(r) = 0;
2068 temp_ptr = list_ptr(box(n));
2069 free_node(box(n), box_node_size);
2070 box(n) = vpackage(temp_ptr, 0, 1, 1073741823L); /* 2^30 - 1 */
2074 while (link(s) != 0)
2077 last_ins_ptr(r) = s;
2081 link(prev_p) = link(p);
2088 incr(insert_penalties);
2092 delete_glue_ref(split_top_ptr(p));
2093 free_node(p, ins_node_size);
2099 else if (type(p) == mark_node)
2101 if (first_mark == 0)
2103 first_mark = mark_ptr(p);
2104 add_token_ref(first_mark);
2108 delete_token_ref(bot_mark);
2110 bot_mark = mark_ptr(p);
2111 add_token_ref(bot_mark);
2117 split_top_skip = save_split_top_skip;
2121 if (link(contrib_head) == 0)
2125 nest[0].tail_field = page_tail;
2127 link(page_tail) = link(contrib_head);
2128 link(contrib_head) = p;
2132 save_vbadness = vbadness;
2136 box(255) = vpackage(link(page_head), best_size, 0, page_max_depth);
2137 vbadness = save_vbadness;
2140 if (last_glue != empty_flag)
2141 delete_glue_ref(last_glue);
2144 page_tail = page_head;
2145 link(page_head) = 0;
2146 last_glue = empty_flag;
2154 link(page_head) = link(hold_head);
2158 r = link(page_ins_head);
2160 while (r != page_ins_head)
2163 free_node(r, page_ins_node_size);
2167 link(page_ins_head) = page_ins_head;
2169 if ((top_mark != 0) && (first_mark == 0))
2171 first_mark = top_mark;
2172 add_token_ref(top_mark);
2175 if (output_routine != 0)
2176 if (dead_cycles >= max_dead_cycles)
2178 print_err("Output loop---");
2179 print_int(dead_cycles);
2180 prints(" consecutive dead cycles");
2181 help3("I've concluded that your \\output is awry; it never does",
2182 "\\ship_out, so I'm shipping \box255 out myself. Next ",
2183 "increase \\maxdeadcycles if you want me to be more patient!");
2188 output_active = true;
2192 prev_depth = ignore_depth;
2193 mode_line = - (integer) line;
2194 begin_token_list(output_routine, output_text);
2195 new_save_level(output_group);
2202 if (link(page_head) != 0)
2204 if (link(contrib_head) == 0)
2208 nest[0].tail_field = page_tail;
2210 link(page_tail) = link(contrib_head);
2212 link(contrib_head) = link(page_head);
2213 link(page_head) = 0;
2214 page_tail = page_head;