void line_break_ (integer final_widow_penalty)
{
boolean auto_breaking;
- halfword prevp;
+ halfword prev_p;
halfword q, r, s, prevs;
internal_font_number f;
/* small_number j; */
init_r_hyf = (prev_graf / 65536L) % 64;
pop_nest();
no_shrink_error_yet = true;
-
- if ((shrink_order(left_skip) != normal) && (shrink(left_skip) != 0))
- left_skip = finite_shrink(left_skip);
-
- if ((shrink_order(right_skip) != normal) && (shrink(right_skip) != 0))
- right_skip = finite_shrink(right_skip);
-
+ check_shrinkage(left_skip);
+ check_shrinkage(right_skip);
q = left_skip;
r = right_skip;
background[1] = width(q) + width(r);
line_number(q) = prev_graf + 1;
total_demerits(q) = 0;
link(active) = q;
- active_width[1] = background[1];
+ act_width = background[1];
active_width[2] = background[2];
active_width[3] = background[3];
active_width[4] = background[4];
cur_p = link(temp_head);
auto_breaking = true;
- prevp = cur_p;
+ prev_p = cur_p;
while ((cur_p != 0) && (link(active) != active))
{
if (is_char_node(cur_p))
{
- prevp = cur_p;
+ prev_p = cur_p;
do
{
f = font(cur_p);
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(cur_p)));
+ act_width = act_width + char_width(f, char_info(f, character(cur_p)));
cur_p = link(cur_p);
}
while (!(!is_char_node(cur_p)));
case hlist_node:
case vlist_node:
case rule_node:
- active_width[1] = active_width[1] + width(cur_p);
+ act_width = act_width + width(cur_p);
break;
case whatsit_node:
{
if (auto_breaking)
{
- if (is_char_node(prevp))
+ if (is_char_node(prev_p))
try_break(0, unhyphenated);
- else if ((mem[prevp].hh.b0 < 9))
+ else if ((mem[prev_p].hh.b0 < 9))
try_break(0, unhyphenated);
- else if ((type(prevp) == kern_node) && (subtype(prevp) != explicit))
+ else if ((type(prev_p) == kern_node) && (subtype(prev_p) != explicit))
try_break(0, unhyphenated);
}
- if ((mem[glue_ptr(cur_p)].hh.b1 != 0) && (mem[glue_ptr(cur_p) + 3].cint != 0))
- {
- glue_ptr(cur_p) = finite_shrink(glue_ptr(cur_p));
- }
-
+ check_shrinkage(glue_ptr(cur_p));
q = glue_ptr(cur_p);
- active_width[1] = active_width[1]+ width(q);
+ act_width = act_width+ width(q);
active_width[2 + stretch_order(q)] = active_width[2 + stretch_order(q)] + stretch(q);
active_width[6] = active_width[6] + shrink(q);
break;
case kern_node:
if (subtype(cur_p) == explicit)
- {
- if (!is_char_node(link(cur_p)) && auto_breaking)
- if (type(link(cur_p)) == glue_node)
- try_break(0, unhyphenated);
-
- active_width[1] = active_width[1] + width(cur_p);
- }
+ kern_break();
else
- active_width[1] = active_width[1] + width(cur_p);
+ act_width = act_width + width(cur_p);
break;
case ligature_node:
{
f = font(lig_char(cur_p));
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(cur_p))));
+ act_width = act_width + char_width(f, char_info(f, character(lig_char(cur_p))));
}
break;
case disc_node:
}
while (!(s == 0));
- active_width[1] = active_width[1] + disc_width;
+ act_width = act_width + disc_width;
try_break(hyphen_penalty, hyphenated);
- active_width[1] = active_width[1] - disc_width;
+ act_width = act_width - disc_width;
}
r = replace_count(cur_p);
s = link(cur_p);
if (is_char_node(s))
{
f = font(s);
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(s)));
+ act_width = act_width + char_width(f, char_info(f, character(s)));
}
else switch(type(s))
{
case ligature_node:
{
f = font(lig_char(s));
- active_width[1] = active_width[1] + char_width(f, char_info(f, character(lig_char(s))));
+ act_width = act_width + char_width(f, char_info(f, character(lig_char(s))));
}
break;
case vlist_node:
case rule_node:
case kern_node:
- active_width[1] = active_width[1] + width(s);
+ act_width = act_width + width(s);
break;
default:
s = link(s);
}
- prevp = cur_p;
+ prev_p = cur_p;
cur_p = s;
goto lab35;
}
case math_node:
{
- auto_breaking = (subtype(cur_p) == 1);
- {
- if (!is_char_node(link(cur_p)) && auto_breaking)
- if (type(link(cur_p)) == glue_node)
- try_break(0, unhyphenated);
-
- active_width[1] = active_width[1] + width(cur_p);
- }
+ auto_breaking = (subtype(cur_p) == after);
+ kern_break();
}
break;
break;
}
- prevp = cur_p;
+ prev_p = cur_p;
cur_p = link(cur_p);
lab35:;
}
#ifdef STAT
if (tracing_paragraphs > 0)
print_nl("@secondpass");
-#endif /* STAT */
+#endif
threshold = tolerance;
second_pass = true;
second_pass_count++; /* 96 Feb 9 */
incr(loc);
}
- if ((end_line_char < 0) || (end_line_char > 255))
+ if (end_line_char_inactive())
decr(limit);
else
buffer[limit] = end_line_char;
line = line_stack[index];
if (cur_input.name_field > 17)
- a_close(input_file[index]);
+ a_close(cur_file);
pop_input();
decr(in_open);
if (c < 128)
{
d = 2;
- if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
+ if (is_hex(c))
if (k + 2 <= limit)
{
cc = buffer[k + 2];
- if ((((cc >= 48) && (cc <= 57)) || ((cc >= 97) && (cc <= 102))))
+ if (is_hex(cc))
incr(d);
}
if (d > 2)
{
- if (c <= 57)
- cur_chr = c - 48;
- else
- cur_chr = c - 87;
-
- if (cc <= 57)
- cur_chr = 16 * cur_chr + cc - 48;
- else
- cur_chr = 16 * cur_chr + cc - 87;
-
+ hex_to_cur_chr();
buffer[k - 1] = cur_chr;
}
else if (c < 64)
if (c < 128) /* ? */
{
d = 2;
- if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
+
+ if (is_hex(c))
if (k + 2 <= limit)
{
cc = buffer[k + 2];
- if ((((cc >= 48) && (cc <= 57)) || ((cc >= 97) && (cc <= 102))))
+ if (is_hex(cc))
incr(d);
}
if (d > 2)
{
- if (c <= 57)
- cur_chr = c - 48;
- else
- cur_chr = c - 87;
-
- if (cc <= 57) /* cc may be used without ... */
- cur_chr = 16 * cur_chr + cc - 48;
- else
- cur_chr = 16 * cur_chr + cc - 87;
-
+ hex_to_cur_chr();
buffer[k - 1] = cur_chr;
}
else if (c < 64)
{
loc = loc + 2;
- if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
+ if (is_hex(c))
if (loc <= limit)
{
cc = buffer[loc];
- if ((((cc >= 48) && (cc <= 57)) || ((cc >= 97) && (cc <= 102))))
+ if (is_hex(cc))
{
incr(loc);
-
- if (c <= 57)
- cur_chr = c - 48;
- else
- cur_chr = c - 87;
-
- if (cc <= 57)
- cur_chr = 16 * cur_chr + cc - 48;
- else
- cur_chr = 16 * cur_chr + cc - 87;
-
+ hex_to_cur_chr();
goto lab21;
}
}
if (!force_eof)
{
- if (input_ln(input_file[index], true))
+ if (input_ln(cur_file, true))
firm_up_the_line();
else
force_eof = true;
goto lab20;
}
- if ((end_line_char < 0) || (end_line_char > 255))
+ if (end_line_char_inactive())
decr(limit);
else
buffer[limit] = end_line_char;
if (interaction > nonstop_mode)
{
- if ((end_line_char < 0) || (end_line_char > 255))
+ if (end_line_char_inactive())
incr(limit);
if (limit == start)
prompt_input("*");
limit = last;
- if ((end_line_char < 0) || (end_line_char > 255))
+ if (end_line_char_inactive())
decr(limit);
else
buffer[limit]= end_line_char;
#define mid_line 1
#define skip_blanks 2 + max_char_code // 17
#define new_line 3 + max_char_code + max_char_code // 33
+/* sec 0304 */
+#define cur_file input_file[index]
/* sec 0305 */
#define skipping 1
#define defining 2
case (a) + sub_mark: \
case (a) + letter: \
case (a) + other_char
+/* sec 0352 */
+#define is_hex(a) \
+ (((a >= '0') && (a <= '9')) || ((a >= 'a') && (a <= 'f')))
+#define hex_to_cur_chr() \
+do \
+{ \
+ if (c <= '9') \
+ cur_chr = c - '0'; \
+ else \
+ cur_chr = c - 'a' + 10; \
+ \
+ if (cc <= '9') \
+ cur_chr = 16 * cur_chr + cc - '0'; \
+ else \
+ cur_chr = 16 * cur_chr + cc - 'a' + 10; \
+} \
+while (0)
+/* sec 0360 */
+#define end_line_char_inactive() \
+ (end_line_char < 0) || (end_line_char > 255)
/* sec 0358 */
/* sec 0371 */
#define store_new_token(a) \
#define delta_node 2
/* sec 0823 */
#define do_all_six(a) a(1); a(2); a(3); a(4); a(5); a(6)
+/* sec 0825 */
+#define check_shrinkage(s) \
+do \
+{ \
+ if ((shrink_order(s) != normal) && (shrink(s) != 0))\
+ s = finite_shrink(s); \
+} \
+while (0)
/* sec 0829 */
#define copy_to_cur_active(a) cur_active_width[a] = active_width[a]
/* sec 0832 */
#define downdate_width(a) cur_active_width[(a)] = cur_active_width[(a)] - mem[prev_r + (a)].cint
/* sec 0861 */
#define update_active(a) active_width[(a)] = active_width[(a)] + mem[r + (a)].cint
+/* sec 0866 */
+#define act_width active_width[1]
+#define kern_break() \
+do \
+{ \
+ if (!is_char_node(link(cur_p)) && auto_breaking) \
+ if (type(link(cur_p)) == glue_node) \
+ try_break(0, unhyphenated); \
+ \
+ act_width = act_width + width(cur_p); \
+} \
+while (0)
/* sec 0877 */
#define next_break prev_break
/* sec 0908 */