1% vim ft=ch
2% Fix page dimension bugs
3% TODO : not there yet for BLB?
4@x
5emergency_stretch_code:print_esc("emergencystretch");
6othercases print("[unknown dimen parameter!]")
7endcases;
8end;
9@y
10emergency_stretch_code:print_esc("emergencystretch");
11page_width_code:print_esc("pagewidth");
12page_height_code:print_esc("pageheight");
13page_right_offset_code:print_esc("pagerightoffset");
14page_bottom_offset_code:print_esc("pagebottomoffset");
15othercases print("[unknown dimen parameter!]")
16endcases;
17end;
18@z
19
20@x
21@ @<Ship box |p| out@>=
22@<Update the values of |max_h| and |max_v|; but if the page is too large,
23  |goto done|@>;
24@<Initialize variables as |ship_out| begins@>;
25page_loc:=dvi_offset+dvi_ptr;
26dvi_out(bop);
27for k:=0 to 9 do dvi_four(count(k));
28dvi_four(last_bop); last_bop:=page_loc;
29dvi_direction:=page_direction;
30case box_direction(dvi_direction) of
31dir_TL_,dir_LT_: begin
32  end;
33dir_TR_,dir_RT_: begin
34  dvi_right(page_right_offset);
35  end;
36dir_RB_,dir_BR_: begin
37  dvi_right(page_right_offset);
38  dvi_down(page_bottom_offset);
39  end;
40dir_BL_,dir_LB_: begin
41  dvi_down(page_bottom_offset);
42  end;
43end;
44cur_h:=h_offset;
45cur_v:=height(p)+v_offset;
46case box_direction(dvi_direction) of
47dir_TL_: begin
48  dvi_down(cur_v);
49  dvi_right(cur_h);
50  end;
51dir_TR_: begin
52  dvi_down(cur_v);
53  dvi_right(-cur_h);
54  end;
55dir_LT_: begin
56  dvi_right(cur_v);
57  dvi_down(cur_h);
58  end;
59dir_LB_: begin
60  dvi_right(cur_v);
61  dvi_down(-cur_h);
62  end;
63dir_BL_: begin
64  dvi_down(-cur_v);
65  dvi_right(cur_h);
66  end;
67dir_BR_: begin
68  dvi_down(-cur_v);
69  dvi_right(-cur_h);
70  end;
71dir_RT_: begin
72  dvi_right(-cur_v);
73  dvi_down(cur_h);
74  end;
75dir_RB_: begin
76  dvi_right(-cur_v);
77  dvi_down(-cur_h);
78  end;
79end;
80dvi_h:=cur_h;
81dvi_v:=cur_v;
82temp_ptr:=p;
83if type(p)=vlist_node then vlist_out@+else hlist_out;
84dvi_out(eop); incr(total_pages); cur_s:=-1;
85done:
86
87@y
88@ @<Ship box |p| out@>=
89@<Update the values of |max_h| and |max_v|; but if the page is too large,
90  |goto done|@>;
91@<Initialize variables as |ship_out| begins@>;
92page_loc:=dvi_offset+dvi_ptr;
93dvi_out(bop);
94for k:=0 to 9 do dvi_four(count(k));
95dvi_four(last_bop); last_bop:=page_loc;
96dvi_direction:=page_direction;
97case box_direction(dvi_direction) of
98dir_TL_,dir_LT_: begin
99  end;
100dir_TR_,dir_RT_: begin
101  dvi_right(page_width-page_right_offset);
102  dvi_h:=-page_right_offset;
103  end;
104dir_RB_,dir_BR_: begin
105  dvi_right(page_width-page_right_offset);
106  dvi_down(page_height-page_bottom_offset);
107  dvi_h:=-page_right_offset;
108  dvi_v:=-page_bottom_offset;
109  end;
110dir_BL_,dir_LB_: begin
111  dvi_down(page_height-page_bottom_offset);
112  dvi_v:=-page_bottom_offset;
113  end;
114end;
115cur_h:=h_offset;
116cur_v:=height(p)+v_offset;
117case box_direction(dvi_direction) of
118dir_TL_: begin
119  dvi_right(cur_h);
120  dvi_down(cur_v);
121  end;
122dir_TR_: begin
123  dvi_right(-cur_h);
124  dvi_down(cur_v);
125  end;
126dir_LT_: begin
127  dvi_right(cur_v);
128  dvi_down(cur_h);
129  end;
130dir_LB_: begin
131  dvi_right(cur_v);
132  dvi_down(-cur_h);
133  end;
134dir_BL_: begin
135  dvi_right(cur_h);
136  dvi_down(-cur_v);
137  end;
138dir_BR_: begin
139  dvi_right(-cur_h);
140  dvi_down(-cur_v);
141  end;
142dir_RT_: begin
143  dvi_right(-cur_v);
144  dvi_down(cur_h);
145  end;
146dir_RB_: begin
147  dvi_right(-cur_v);
148  dvi_down(-cur_h);
149  end;
150end;
151temp_ptr:=p;
152dvi_h:=dvi_h+cur_h;
153dvi_v:=dvi_v+cur_v;
154if type(p)=vlist_node then vlist_out@+else hlist_out;
155dvi_out(eop); incr(total_pages); cur_s:=-1;
156done:
157
158@z
159
160@x
161set_new_eqtb_sc(dimen_base+page_bottom_offset_code,page_height-9472573);
162                {-2 inches}
163set_new_eqtb_sc(dimen_base+page_right_offset_code,page_width-9472573);
164                {-2 inches}
165@y
166set_new_eqtb_sc(dimen_base+page_bottom_offset_code,4736287); {1 inch}
167set_new_eqtb_sc(dimen_base+page_right_offset_code,4736287); {1 inch}
168@z
169
170@x
171{
172|primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code);|
173|primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code);|
174}
175@y
176primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code);
177primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code);
178@z
179
180
181