| 1 |
/* buildpage.h |
| 2 |
|
| 3 |
Copyright 2009 Taco Hoekwater <[email protected]> |
| 4 |
|
| 5 |
This file is part of LuaTeX. |
| 6 |
|
| 7 |
LuaTeX is free software; you can redistribute it and/or modify it under |
| 8 |
the terms of the GNU General Public License as published by the Free |
| 9 |
Software Foundation; either version 2 of the License, or (at your |
| 10 |
option) any later version. |
| 11 |
|
| 12 |
LuaTeX is distributed in the hope that it will be useful, but WITHOUT |
| 13 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 15 |
License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License along |
| 18 |
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
|
| 21 |
#ifndef BUILDPAGE_H |
| 22 |
# define BUILDPAGE_H |
| 23 |
|
| 24 |
/* empty = 0 */ |
| 25 |
# define inserts_only 1 /* |page_contents| when an insert node has been contributed, but no boxes */ |
| 26 |
# define box_there 2 /* |page_contents| when a box or rule has been contributed */ |
| 27 |
|
| 28 |
extern halfword page_tail; /* the final node on the current page */ |
| 29 |
extern int page_contents; /* what is on the current page so far? */ |
| 30 |
extern scaled page_max_depth; /* maximum box depth on page being built */ |
| 31 |
extern halfword best_page_break; /* break here to get the best page known so far */ |
| 32 |
extern int least_page_cost; /* the score for this currently best page */ |
| 33 |
extern scaled best_size; /* its |page_goal| */ |
| 34 |
|
| 35 |
/* |
| 36 |
The data structure definitions here use the fact that the |@!height| field |
| 37 |
appears in the fourth word of a box node. |
| 38 |
@^data structure assumptions@> |
| 39 |
*/ |
| 40 |
|
| 41 |
# define broken_ptr(A) vlink((A)+2) /* an insertion for this class will break here if anywhere */ |
| 42 |
# define broken_ins(A) vinfo((A)+2) /* this insertion might break at |broken_ptr| */ |
| 43 |
# define last_ins_ptr(A) vlink((A)+3) /* the most recent insertion for this |subtype| */ |
| 44 |
# define best_ins_ptr(A) vinfo((A)+3) /* the optimum most recent insertion */ |
| 45 |
|
| 46 |
extern void initialize_buildpage(void); |
| 47 |
|
| 48 |
# define page_goal page_so_far[0] /* desired height of information on page being built */ |
| 49 |
# define page_total page_so_far[1] /* height of the current page */ |
| 50 |
# define page_shrink page_so_far[6] /* shrinkability of the current page */ |
| 51 |
# define page_depth page_so_far[7] /* depth of the current page */ |
| 52 |
|
| 53 |
extern scaled page_so_far[8]; /* height and glue of the current page */ |
| 54 |
extern halfword last_glue; /* used to implement \.{\\lastskip */ |
| 55 |
extern int last_penalty; /* used to implement \.{\\lastpenalty} */ |
| 56 |
extern scaled last_kern; /* used to implement \.{\\lastkern} */ |
| 57 |
extern int last_node_type; /* used to implement \.{\\lastnodetype} */ |
| 58 |
extern int insert_penalties; /* sum of the penalties for held-over insertions */ |
| 59 |
|
| 60 |
extern void print_totals(void); |
| 61 |
extern void freeze_page_specs(int s); |
| 62 |
|
| 63 |
extern boolean output_active; |
| 64 |
|
| 65 |
extern void start_new_page(void); |
| 66 |
|
| 67 |
# define contrib_tail nest[0].tail_field |
| 68 |
/* tail of the contribution list */ |
| 69 |
|
| 70 |
extern void build_page(void); /* append contributions to the current page */ |
| 71 |
extern void fire_up(halfword c); |
| 72 |
extern void resume_after_output(void); |
| 73 |
|
| 74 |
#endif |