summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-07-24 22:43:11 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-07-24 22:43:11 +0000
commit7b14b75626befe976530136bcf3158a16bd95df0 (patch)
tree9aefff9670d456ac7402074ffddb1a7f2d7b036d /Build/source/texk/web2c/luatexdir/tex
parentb7f40e4f685e941ac062cac36728a4cad0faab6c (diff)
luatexdir: Sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@41755 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/align.w65
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/buildpage.w98
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.h14
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/conditional.w13
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h267
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.w50
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.w30
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/expand.w14
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.w47
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.w19
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/linebreak.w78
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.h3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.w11
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.h15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.w410
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mathcodes.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.w105
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/nesting.w13
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/packaging.w98
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/primitive.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w33
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.w143
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.w12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.w311
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h61
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.w116
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.w63
32 files changed, 1134 insertions, 991 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/align.w b/Build/source/texk/web2c/luatexdir/tex/align.w
index cd8086af301..dd0ed10338e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/align.w
+++ b/Build/source/texk/web2c/luatexdir/tex/align.w
@@ -31,17 +31,6 @@ void init_col(void);
#define noDEBUG
-#define end_template_token (cs_token_flag+frozen_end_template)
-
-#define prev_depth cur_list.prev_depth_field
-#define space_factor cur_list.space_factor_field
-#define incompleat_noad cur_list.incompleat_noad_field
-
-#define every_cr equiv(every_cr_loc)
-#define display_indent dimen_par(display_indent_code)
-#define max_depth dimen_par(max_depth_code)
-#define overfull_rule dimen_par(overfull_rule_code)
-
@ It's sort of a miracle whenever \.{\\halign} and \.{\\valign} work, because
they cut across so many of the control structures of \TeX.
@@ -177,10 +166,12 @@ is necessary to store information about what to do when a template ends.
This information is called the |extra_info| field.
@c
-#define u_part(A) vlink((A)+depth_offset) /* pointer to \<u_j> token list */
-#define v_part(A) vinfo((A)+depth_offset) /* pointer to \<v_j> token list */
-#define span_ptr(A) vinfo((A)+1) /* column spanning list */
-#define extra_info(A) vinfo((A)+list_offset) /* info to remember during template */
+/* could be in texnodes.h, but documented here*/
+
+#define u_part(A) vlink((A)+depth_offset) /* pointer to \<u_j> token list */
+#define v_part(A) vinfo((A)+depth_offset) /* pointer to \<v_j> token list */
+#define span_ptr(A) vinfo((A)+1) /* column spanning list */
+#define extra_info(A) vinfo((A)+list_offset) /* info to remember during template */
@ Alignments can occur within alignments, so a small stack is used to access
the alignrecord information. At each level we have a |preamble| pointer,
@@ -201,6 +192,8 @@ when they have to be pushed down, they are stored in 6-word nodes, and
|align_ptr| points to the topmost such node.
@c
+/* could be in texnodes.h but documented here*/
+
#define preamble vlink(align_head) /* the current preamble list */
pointer cur_align = null; /* current position in preamble list */
@@ -301,7 +294,7 @@ static void get_preamble_token(void)
&& (cur_chr == glue_base + tab_skip_code)) {
scan_optional_equals();
scan_glue(glue_val_level);
- if (int_par(global_defs_code) > 0)
+ if (global_defs_par > 0)
geq_define(glue_base + tab_skip_code, glue_ref_cmd, cur_val);
else
eq_define(glue_base + tab_skip_code, glue_ref_cmd, cur_val);
@@ -332,7 +325,7 @@ void init_align(void)
if ((cur_list.mode_field == mmode)
&& ((cur_list.tail_field != cur_list.head_field)
- || (incompleat_noad != null))) {
+ || (incompleat_noad_par != null))) {
const char *hlp[] =
{ "Displays can use special alignments (like \\eqalignno)",
"only if nothing but the alignment itself is between $$'s.",
@@ -349,7 +342,7 @@ void init_align(void)
correct baseline calculations. */
if (cur_list.mode_field == mmode) {
cur_list.mode_field = -vmode;
- prev_depth = nest[nest_ptr - 2].prev_depth_field;
+ prev_depth_par = nest[nest_ptr - 2].prev_depth_field;
} else if (cur_list.mode_field > 0) {
cur_list.mode_field = -(cur_list.mode_field);
}
@@ -445,8 +438,8 @@ void init_align(void)
scanner_status = normal;
new_save_level(align_group);
- if (every_cr != null)
- begin_token_list(every_cr, every_cr_text);
+ if (every_cr_par != null)
+ begin_token_list(every_cr_par, every_cr_text);
align_peek(); /* look for \.{\\noalign} or \.{\\omit} */
}
@@ -494,9 +487,9 @@ static void init_span(pointer p)
{
push_nest();
if (cur_list.mode_field == -hmode) {
- space_factor = 1000;
+ space_factor_par = 1000;
} else {
- prev_depth = ignore_depth;
+ prev_depth_par = ignore_depth;
normal_paragraph();
}
cur_span = p;
@@ -515,9 +508,9 @@ void init_row(void)
push_nest();
cur_list.mode_field = (-hmode - vmode) - cur_list.mode_field;
if (cur_list.mode_field == -hmode)
- space_factor = 0;
+ space_factor_par = 0;
else
- prev_depth = 0;
+ prev_depth_par = 0;
tail_append(new_glue(preamble));
subtype(cur_list.tail_field) = tab_skip_code + 1;
cur_align = vlink(preamble);
@@ -781,16 +774,16 @@ void fin_row(void)
append_list(cur_head, cur_tail);
} else {
p = filtered_vpackage(vlink(cur_list.head_field),
- 0, additional, max_depth, fin_row_group, -1, 0, 0);
+ 0, additional, max_depth_par, fin_row_group, -1, 0, 0);
pop_nest();
vlink(cur_list.tail_field) = p;
cur_list.tail_field = p;
- space_factor = 1000;
+ space_factor_par = 1000;
}
type(p) = unset_node;
glue_stretch(p) = 0;
- if (every_cr != null)
- begin_token_list(every_cr, every_cr_text);
+ if (every_cr_par != null)
+ begin_token_list(every_cr_par, every_cr_text);
align_peek();
/* note that |glue_shrink(p)=0| since |glue_shrink==shift_amount| */
}
@@ -817,7 +810,7 @@ void fin_align(void)
confusion("align0");
unsave(); /* that |align_group| was for the whole alignment */
if (nest[nest_ptr - 1].mode_field == mmode)
- o = display_indent;
+ o = display_indent_par;
else
o = 0;
/* Go through the preamble list, determining the column widths and
@@ -856,7 +849,7 @@ value is changed to zero and so is the next tabskip.
/* Nullify |width(q)| and the tabskip glue following this column */
width(q) = 0;
r = vlink(q);
- reset_glue_to_zero(r); /* is a lready copy */
+ reset_glue_to_zero(r); /* is a lready copy */
}
if (span_ptr(q) != end_span) {
/* Merge the widths in the span nodes of |q| with those of |p|,
@@ -917,10 +910,10 @@ value is changed to zero and so is the next tabskip.
decr(save_ptr);
pack_begin_line = -cur_list.ml_field;
if (cur_list.mode_field == -vmode) {
- rule_save = overfull_rule;
- overfull_rule = 0; /* prevent rule from being packaged */
+ rule_save = overfull_rule_par;
+ overfull_rule_par = 0; /* prevent rule from being packaged */
p = hpack(preamble, saved_value(0), saved_level(0), -1);
- overfull_rule = rule_save;
+ overfull_rule_par = rule_save;
} else {
q = vlink(preamble);
do {
@@ -929,7 +922,7 @@ value is changed to zero and so is the next tabskip.
q = vlink(vlink(q));
} while (q != null);
p = filtered_vpackage(preamble,
- saved_value(0), saved_level(0), max_depth, preamble_group, -1, 0, 0);
+ saved_value(0), saved_level(0), max_depth_par, preamble_group, -1, 0, 0);
q = vlink(preamble);
do {
width(q) = height(q);
@@ -1120,14 +1113,14 @@ value is changed to zero and so is the next tabskip.
we will need to insert glue before and after the display; that part of the
program will be deferred until we're more familiar with such operations.)
*/
- pd = cur_list.prev_depth_field;
+ pd = prev_depth_par;
p = vlink(cur_list.head_field);
q = cur_list.tail_field;
pop_nest();
if (cur_list.mode_field == mmode) {
finish_display_alignment(p, q, pd);
} else {
- cur_list.prev_depth_field = pd; /* aux:=aux_save; */
+ prev_depth_par = pd; /* aux:=aux_save; */
vlink(cur_list.tail_field) = p;
if (p != null)
cur_list.tail_field = q;
diff --git a/Build/source/texk/web2c/luatexdir/tex/buildpage.w b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
index 104566f790b..c45d9cb7d7e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/buildpage.w
+++ b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
@@ -22,29 +22,9 @@
#include "ptexlib.h"
@ @c
-#define box(A) eqtb[box_base+(A)].hh.rh
-#define count(A) eqtb[count_base+(A)].hh.rh
-#undef skip
-#define skip(A) eqtb[skip_base+(A)].hh.rh
-#define dimen(A) eqtb[scaled_base+(A)].hh.rh
-
-#define vbadness int_par(vbadness_code)
-#define max_dead_cycles int_par(max_dead_cycles_code)
-#define output_box int_par(output_box_code)
-#define holding_inserts int_par(holding_inserts_code)
-
-#define vsize dimen_par(vsize_code)
-#define vfuzz dimen_par(vfuzz_code)
-#define max_depth dimen_par(max_depth_code)
-
-#define output_routine equiv(output_routine_loc)
-#define split_top_skip glue_par(split_top_skip_code)
-
-#define prev_depth cur_list.prev_depth_field
-#define mode_line cur_list.ml_field
-#define mode cur_list.mode_field
-#define tail cur_list.tail_field
-#define head cur_list.head_field
+#define mode mode_par
+#define head head_par
+#define tail tail_par
@ When \TeX\ appends new material to its main vlist in vertical mode, it uses
a method something like |vsplit| to decide where a page ends, except that
@@ -221,12 +201,12 @@ from |empty| to |inserts_only| or |box_there|.
void freeze_page_specs(int s)
{
page_contents = s;
- page_goal = vsize;
- page_max_depth = max_depth;
+ page_goal = vsize_par;
+ page_max_depth = max_depth_par;
page_depth = 0;
do_all_six(set_page_so_far_zero);
least_page_cost = awful_bad;
- if (int_par(tracing_pages_code) > 0) {
+ if (tracing_pages_par > 0) {
begin_diagnostic();
tprint_nl("%% goal height=");
print_scaled(page_goal);
@@ -360,7 +340,7 @@ void build_page(void)
else
page_contents = box_there;
q = new_skip_param(top_skip_code);
- if ((type(p) == hlist_node) && is_mirrored(body_direction)) {
+ if ((type(p) == hlist_node) && is_mirrored(body_direction_par)) {
if (width(q) > depth(p))
width(q) = width(q) - depth(p);
else
@@ -378,7 +358,7 @@ void build_page(void)
} else {
/* Prepare to move a box or rule node to the current page,
then |goto contribute| */
- if ((type(p) == hlist_node) && is_mirrored(body_direction)) {
+ if ((type(p) == hlist_node) && is_mirrored(body_direction_par)) {
page_total = page_total + page_depth + depth(p);
page_depth = height(p);
} else {
@@ -510,7 +490,7 @@ void build_page(void)
w = dimen(n) - height(r);
q = vert_break(ins_ptr(p), w, depth(p));
height(r) = height(r) + best_height_plus_depth;
- if (int_par(tracing_pages_code) > 0) {
+ if (tracing_pages_par > 0) {
/* Display the insertion split cost */
begin_diagnostic();
tprint_nl("% split");
@@ -582,7 +562,7 @@ void build_page(void)
}
if (insert_penalties >= 10000)
c = awful_bad;
- if (int_par(tracing_pages_code) > 0) {
+ if (tracing_pages_par > 0) {
/* Display the page break cost */
begin_diagnostic();
tprint_nl("%");
@@ -670,7 +650,7 @@ void build_page(void)
/* Recycle node |p| */
try_couple_nodes(contrib_head,vlink(p));
vlink(p) = null;
- if (int_par(saving_vdiscards_code) > 0) {
+ if (saving_vdiscards_par > 0) {
if (page_disc == null) {
page_disc = p;
} else {
@@ -746,18 +726,18 @@ void fire_up(halfword c)
if (c == best_page_break)
best_page_break = null; /* |c| not yet linked in */
/* Ensure that box |output_box| is empty before output */
- if (box(output_box) != null) {
+ if (box(output_box_par) != null) {
print_err("\\box");
- print_int(output_box);
+ print_int(output_box_par);
tprint(" is not void");
help2("You shouldn't use \\box\\outputbox except in \\output routines.",
"Proceed, and I'll discard its present contents.");
- box_error(output_box);
+ box_error(output_box_par);
}
insert_penalties = 0; /* this will count the number of insertions held over */
- save_split_top_skip = split_top_skip;
- if (holding_inserts <= 0) {
+ save_split_top_skip = split_top_skip_par;
+ if (holding_inserts_par <= 0) {
/* Prepare all the boxes involved in insertions to act as queues */
/* If many insertions are supposed to go into the same box, we want to know
the position of the last node in that box, so that we don't need to waste time
@@ -787,7 +767,7 @@ void fire_up(halfword c)
p = vlink(prev_p);
while (p != best_page_break) {
if (type(p) == ins_node) {
- if (holding_inserts <= 0) {
+ if (holding_inserts_par <= 0) {
/* Either insert the material specified by node |p| into the
appropriate box, or hold it for the next page;
also delete node |p| from the current page */
@@ -814,7 +794,7 @@ void fire_up(halfword c)
while (vlink(s) != broken_ptr(r))
s = vlink(s);
vlink(s) = null;
- split_top_skip = split_top_ptr(p);
+ split_top_skip_par = split_top_ptr(p);
ins_ptr(p) =
prune_page_top(broken_ptr(r), false);
if (ins_ptr(p) != null) {
@@ -831,7 +811,7 @@ void fire_up(halfword c)
t = list_ptr(box(n));
list_ptr(box(n)) = null;
flush_node(box(n));
- box(n) = vpack(t, 0, additional, body_direction);
+ box(n) = vpack(t, 0, additional, body_direction_par);
} else {
while (vlink(s) != null)
@@ -869,7 +849,7 @@ void fire_up(halfword c)
prev_p = p;
p = vlink(prev_p);
}
- split_top_skip = save_split_top_skip;
+ split_top_skip_par = save_split_top_skip;
/* Break the current page at node |p|, put it in box~|output_box|,
and put the remaining nodes on the contribution list */
/* When the following code is executed, the current page runs from node
@@ -891,14 +871,14 @@ void fire_up(halfword c)
couple_nodes(contrib_head, p);
vlink(prev_p) = null;
}
- save_vbadness = vbadness;
- vbadness = inf_bad;
- save_vfuzz = vfuzz;
- vfuzz = max_dimen; /* inhibit error messages */
- box(output_box) = filtered_vpackage(vlink(page_head),
- best_size, exactly, page_max_depth, output_group, body_direction, 0, 0);
- vbadness = save_vbadness;
- vfuzz = save_vfuzz;
+ save_vbadness = vbadness_par;
+ vbadness_par = inf_bad;
+ save_vfuzz = vfuzz_par;
+ vfuzz_par = max_dimen; /* inhibit error messages */
+ box(output_box_par) = filtered_vpackage(vlink(page_head),
+ best_size, exactly, page_max_depth, output_group, body_direction_par, 0, 0);
+ vbadness_par = save_vbadness;
+ vfuzz_par = save_vfuzz;
if (last_glue != max_halfword)
flush_node(last_glue);
/* Start a new current page */
@@ -911,7 +891,7 @@ void fire_up(halfword c)
/* Delete the page-insertion nodes */
r = vlink(page_ins_head);
while (r != page_ins_head) {
- /* todo: couple */
+ /* todo: couple */
q = vlink(r);
flush_node(r);
r = q;
@@ -924,8 +904,8 @@ void fire_up(halfword c)
add_token_ref(top_mark(i));
}
}
- if (output_routine != null) {
- if (dead_cycles >= max_dead_cycles) {
+ if (output_routine_par != null) {
+ if (dead_cycles >= max_dead_cycles_par) {
/* Explain that too many dead cycles have occurred in a row */
print_err("Output loop---");
print_int(dead_cycles);
@@ -941,9 +921,9 @@ void fire_up(halfword c)
incr(dead_cycles);
push_nest();
mode = -vmode;
- prev_depth = ignore_depth;
- mode_line = -line;
- begin_token_list(output_routine, output_text);
+ prev_depth_par = ignore_depth;
+ mode_line_par = -line;
+ begin_token_list(output_routine_par, output_text);
new_save_level(output_group);
normal_paragraph();
scan_left_brace();
@@ -967,8 +947,8 @@ void fire_up(halfword c)
}
flush_node_list(page_disc);
page_disc = null;
- ship_out(static_pdf, box(output_box), SHIPPING_PAGE);
- box(output_box) = null;
+ ship_out(static_pdf, box(output_box_par), SHIPPING_PAGE);
+ box(output_box_par) = null;
}
@ When the user's output routine finishes, it has constructed a vlist
@@ -996,13 +976,13 @@ void resume_after_output(void)
output_active = false;
insert_penalties = 0;
/* Ensure that box |output_box| is empty after output */
- if (box(output_box) != null) {
+ if (box(output_box_par) != null) {
print_err("Output routine didn't use all of \\box");
- print_int(output_box);
+ print_int(output_box_par);
help3("Your \\output commands should empty \\box\\outputbox,",
"e.g., by saying `\\shipout\\box\\outputbox'.",
"Proceed; I'll discard its present contents.");
- box_error(output_box);
+ box_error(output_box_par);
}
if (tail != head) { /* current list goes after heldover insertions */
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h
index edaeb72fe28..fc61ffd46c8 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.h
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.h
@@ -161,6 +161,7 @@ typedef enum {
assign_mu_glue_cmd, /* user-defined muglue ( \.{\\thinmuskip}, etc.~) */
assign_font_dimen_cmd, /* user-defined font dimension ( \.{\\fontdimen} ) */
assign_font_int_cmd, /* user-defined font integer ( \.{\\hyphenchar}, \.{\\skewchar} ) */
+ assign_hang_indent_cmd,
set_aux_cmd, /* specify state info ( \.{\\spacefactor}, \.{\\prevdepth} ) */
set_prev_graf_cmd, /* specify state info ( \.{\\prevgraf} ) */
set_page_dimen_cmd, /* specify state info ( \.{\\pagegoal}, etc.~) */
@@ -326,11 +327,14 @@ typedef enum {
expand_font_code,
} normal_codes;
-# define lp_code_base 2
-# define rp_code_base 3
-# define ef_code_base 4
-# define tag_code 5
-# define no_lig_code 6
+typedef enum {
+ lp_code_base = 2,
+ rp_code_base = 3,
+ ef_code_base = 4,
+ tag_code = 5,
+ no_lig_code = 6,
+ gp_code_base = 7
+} font_codes ;
# define immediate_code 4 /* command modifier for \.{\\immediate} */
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w
index ece74a5406b..88211643533 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.w
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.w
@@ -689,6 +689,7 @@ void initialize_commands(void)
primitive_luatex("pardir", assign_dir_cmd, int_base + par_direction_code, dir_base);
primitive_luatex("textdir", assign_dir_cmd, int_base + text_direction_code, dir_base);
primitive_luatex("mathdir", assign_dir_cmd, int_base + math_direction_code, dir_base);
+ primitive_luatex("linedir", assign_dir_cmd, int_base + line_direction_code, dir_base);
primitive_luatex("pageleftoffset", assign_dimen_cmd, dimen_base + page_left_offset_code, dimen_base);
primitive_luatex("pagetopoffset", assign_dimen_cmd, dimen_base + page_top_offset_code, dimen_base);
primitive_luatex("pagerightoffset", assign_dimen_cmd, dimen_base + page_right_offset_code, dimen_base);
@@ -767,6 +768,9 @@ void initialize_etex_commands(void)
primitive_etex("parshapeindent", last_item_cmd, par_shape_indent_code, 0);
primitive_etex("parshapedimen", last_item_cmd, par_shape_dimen_code, 0);
+ primitive_luatex("shapemode", assign_int_cmd, int_base + shape_mode_code, int_base);
+ primitive_luatex("hyphenationbounds", assign_int_cmd, int_base + hyphenation_bounds_code, int_base);
+
primitive_etex("showgroups", xray_cmd, show_groups, 0);
/*
diff --git a/Build/source/texk/web2c/luatexdir/tex/conditional.w b/Build/source/texk/web2c/luatexdir/tex/conditional.w
index fa4e73b49cb..268786add75 100644
--- a/Build/source/texk/web2c/luatexdir/tex/conditional.w
+++ b/Build/source/texk/web2c/luatexdir/tex/conditional.w
@@ -21,9 +21,6 @@
#include "ptexlib.h"
-@ @c
-#define box(A) eqtb[box_base+(A)].hh.rh
-
@* We consider now the way \TeX\ handles various kinds of \.{\\if} commands.
@ Conditions can be inside conditions, and this nesting has a stack
@@ -79,7 +76,7 @@ void pass_text(void)
}
}
scanner_status = save_scanner_status;
- if (int_par(tracing_ifs_code) > 0)
+ if (tracing_ifs_par > 0)
show_cur_cmd_chr();
}
@@ -163,7 +160,7 @@ static boolean test_for_cs(void)
}
if (cur_cmd != end_cs_name_cmd) {
last_tested_cs = null_cs;
- if (int_par(suppress_ifcsname_error_code)) {
+ if (suppress_ifcsname_error_par) {
do {
get_x_token();
} while (cur_cmd != end_cs_name_cmd);
@@ -241,7 +238,7 @@ void conditional(void)
halfword save_cond_ptr; /*|cond_ptr| corresponding to this conditional */
int this_if; /*type of this conditional */
boolean is_unless; /*was this if preceded by `\.{\\unless}' ? */
- if ((int_par(tracing_ifs_code) > 0) && (int_par(tracing_commands_code) <= 1))
+ if ((tracing_ifs_par > 0) && (tracing_commands_par <= 1))
show_cur_cmd_chr();
push_condition_stack();
save_cond_ptr = cond_ptr;
@@ -441,7 +438,7 @@ void conditional(void)
scan_int();
/* |n| is the number of cases to pass */
n = cur_val;
- if (int_par(tracing_commands_code) > 1) {
+ if (tracing_commands_par > 1) {
begin_diagnostic();
tprint("{case ");
print_int(n);
@@ -508,7 +505,7 @@ void conditional(void)
}
if (is_unless)
b = !b;
- if (int_par(tracing_commands_code) > 1) {
+ if (tracing_commands_par > 1) {
/* Display the value of |b| */
begin_diagnostic();
if (b)
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
index 993ad8a16c0..ae769584381 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
@@ -19,15 +19,11 @@
@ @c
-
#include "ptexlib.h"
-#define font_id_text(A) cs_text(font_id_base+(A))
-#define prev_depth cur_list.prev_depth_field
-
/* we start with 907: the sum of the values of the bytes of "don knuth" */
-#define FORMAT_ID (907+15)
+#define FORMAT_ID (907+17)
#if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
#error Wrong value for FORMAT_ID.
#endif
@@ -91,11 +87,11 @@ void store_fmt_file(void)
tprint(" (format=");
print(job_name);
print_char(' ');
- print_int(int_par(year_code));
+ print_int(year_par);
print_char('.');
- print_int(int_par(month_code));
+ print_int(month_par);
print_char('.');
- print_int(int_par(day_code));
+ print_int(day_par);
print_char(')');
str_room(2);
format_ident = make_string();
@@ -308,7 +304,7 @@ void store_fmt_file(void)
dump_int(69069);
/* We have already printed a lot of statistics, so we set |tracing_stats:=0|
to prevent them from appearing again. */
- int_par(tracing_stats_code) = 0;
+ tracing_stats_par = 0;
/* Dump the lua bytecodes */
dump_luac_registers();
@@ -520,7 +516,7 @@ boolean load_fmt_file(const char *fmtname)
/* Undump the lua bytecodes */
undump_luac_registers();
- prev_depth = ignore_depth;
+ prev_depth_par = ignore_depth;
return true; /* it worked! */
BAD_FMT:
wake_up_terminal();
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
index 1289ab70cba..7f83dd3d6cc 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
@@ -279,23 +279,26 @@ the |number_regs| \.{\\dimen} registers.
# define math_display_skip_mode_code 88
# define math_scripts_mode_code 89
# define synctex_code 90 /* is synctex file generation enabled ? */
-# define first_valid_language_code 91
+# define shape_mode_code 91
+# define first_valid_language_code 92
+# define hyphenation_bounds_code 93
-# define math_option_code 92
+# define math_option_code 94
-# define mathoption_int_base (int_base+93)
-# define mathoption_int_last (int_base+99)
+# define mathoption_int_base (int_base+95) /* one reserve */
+# define mathoption_int_last (int_base+100)
-# define backend_int_base (int_base+100)
-# define backend_int_last (int_base+124)
+# define backend_int_base (int_base+101)
+# define backend_int_last (int_base+125)
-# define tex_int_pars (125) /* total number of integer parameters */
+# define tex_int_pars (126) /* total number of integer parameters */
# define page_direction_code (tex_int_pars)
# define body_direction_code (tex_int_pars+1)
# define par_direction_code (tex_int_pars+2)
# define text_direction_code (tex_int_pars+3)
# define math_direction_code (tex_int_pars+4)
+# define line_direction_code (tex_int_pars+5) /* gets remapped so is no real register */
# define int_pars (tex_int_pars+5) /* total number of integer parameters */
@@ -533,16 +536,248 @@ extern void show_eqtb(halfword n);
extern halfword last_cs_name;
-/* more will move here */
+/*
+ The *_par macros expand to the variables that are (in most cases) also accessible
+ at the users end. Most are registers but some are in the (stack) lists.
+
+ More *_par will move here : there is no real need for thse macros but because there
+ were already a bunch and because they were defined all over the place we moved them
+ here.
+
+*/
-#define space_skip glue_par(space_skip_code)
-#define xspace_skip glue_par(xspace_skip_code)
-#define math_skip glue_par(math_skip_code)
+#define space_skip_par glue_par(space_skip_code)
+#define xspace_skip_par glue_par(xspace_skip_code)
+#define math_skip_par glue_par(math_skip_code)
+
+#define pre_display_size_par dimen_par(pre_display_size_code)
+#define display_width_par dimen_par(display_width_code)
+#define display_indent_par dimen_par(display_indent_code)
+#define math_surround_par dimen_par(math_surround_code)
+
+#define display_skip_mode_par int_par(math_display_skip_mode_code)
+#define math_eqno_gap_step_par int_par(math_eqno_gap_step_code)
+
+#define body_direction_par int_par(body_direction_code)
+#define page_direction_par int_par(page_direction_code)
+#define par_direction_par int_par(par_direction_code)
+#define text_direction_par int_par(text_direction_code)
+#define math_direction_par int_par(math_direction_code)
+
+#define shape_mode_par int_par(shape_mode_code)
+#define hyphenation_bounds_par int_par(hyphenation_bounds_code)
+#define first_valid_language_par int_par(first_valid_language_code)
+
+#define hsize_par dimen_par(hsize_code)
+#define vsize_par dimen_par(vsize_code)
+#define hfuzz_par dimen_par(hfuzz_code)
+#define vfuzz_par dimen_par(vfuzz_code)
+#define hbadness_par int_par(hbadness_code)
+#define vbadness_par int_par(vbadness_code)
+
+#define baseline_skip_par glue_par(baseline_skip_code)
+#define par_indent_par dimen_par(par_indent_code)
+#define hang_indent_par dimen_par(hang_indent_code)
+#define hang_after_par int_par(hang_after_code)
+#define left_skip_par glue_par(left_skip_code)
+#define right_skip_par glue_par(right_skip_code)
+
+#define emergency_stretch_par dimen_par(emergency_stretch_code)
+#define pretolerance_par int_par(pretolerance_code)
+#define tolerance_par int_par(tolerance_code)
+#define looseness_par int_par(looseness_code)
+#define adjust_spacing_par int_par(adjust_spacing_code)
+#define adj_demerits_par int_par(adj_demerits_code)
+#define protrude_chars_par int_par(protrude_chars_code)
+#define line_penalty_par int_par(line_penalty_code)
+#define last_line_fit_par int_par(last_line_fit_code)
+#define double_hyphen_demerits_par int_par(double_hyphen_demerits_code)
+#define final_hyphen_demerits_par int_par(final_hyphen_demerits_code)
+#define inter_line_penalty_par int_par(inter_line_penalty_code)
+#define club_penalty_par int_par(club_penalty_code)
+#define broken_penalty_par int_par(broken_penalty_code)
+#define display_widow_penalty_par int_par(display_widow_penalty_code)
+#define widow_penalty_par int_par(widow_penalty_code)
+#define line_skip_limit_par dimen_par(line_skip_limit_code)
+
+#define delimiter_shortfall_par dimen_par(delimiter_shortfall_code)
+#define null_delimiter_space_par dimen_par(null_delimiter_space_code)
+#define script_space_par dimen_par(script_space_code)
+#define max_depth_par dimen_par(max_depth_code)
+#define box_max_depth_par dimen_par(box_max_depth_code)
+#define split_max_depth_par dimen_par(split_max_depth_code)
+#define overfull_rule_par dimen_par(overfull_rule_code)
+#define box_max_depth_par dimen_par(box_max_depth_code)
+#define top_skip_par glue_par(top_skip_code)
+#define split_top_skip_par glue_par(split_top_skip_code)
+
+#define cur_fam_par int_par(cur_fam_code)
+#define pre_display_direction_par int_par(pre_display_direction_code)
+#define pre_display_penalty_par int_par(pre_display_penalty_code)
+#define post_display_penalty_par int_par(post_display_penalty_code)
+
+#define cur_fam_par_in_range ((cur_fam_par>=0)&&(cur_fam_par<256))
+
+#define local_inter_line_penalty_par int_par(local_inter_line_penalty_code)
+#define local_broken_penalty_par int_par(local_broken_penalty_code)
+#define local_left_box_par equiv(local_left_box_base)
+#define local_right_box_par equiv(local_right_box_base)
+
+#define end_line_char_par int_par(end_line_char_code)
+#define new_line_char_par int_par(new_line_char_code)
+#define escape_char_par int_par(escape_char_code)
+
+#define end_line_char_inactive ((end_line_char_par < 0) || (end_line_char_par > 127))
+
+#define delimiter_factor_par int_par(delimiter_factor_code)
+#define bin_op_penalty_par int_par(bin_op_penalty_code)
+#define rel_penalty_par int_par(rel_penalty_code)
+#define null_delimiter_space_par dimen_par(null_delimiter_space_code)
+#define disable_lig_par int_par(disable_lig_code)
+#define disable_kern_par int_par(disable_kern_code)
+#define disable_space_par int_par(disable_space_code)
+#define scripts_mode_par int_par(math_scripts_mode_code)
+
+#define thin_mu_skip_par glue_par(thin_mu_skip_code)
+#define med_mu_skip_par glue_par(med_mu_skip_code)
+#define thick_mu_skip_par glue_par(thick_mu_skip_code)
+
+#define every_math_par equiv(every_math_loc)
+#define every_display_par equiv(every_display_loc)
+#define every_cr_par equiv(every_cr_loc)
+#define every_hbox_par equiv(every_hbox_loc)
+#define every_vbox_par equiv(every_vbox_loc)
+#define every_eof_par equiv(every_eof_loc)
+#define every_par_par equiv(every_par_loc)
+#define err_help_par equiv(err_help_loc)
+
+#define no_local_whatsits_par int_par(no_local_whatsits_code)
+#define no_local_dirs_par int_par(no_local_dirs_code)
+
+#define prev_depth_par cur_list.prev_depth_field
+#define prev_graf_par cur_list.pg_field
+#define tail_par cur_list.tail_field
+#define head_par cur_list.head_field
+#define mode_par cur_list.mode_field
+#define dirs_par cur_list.dirs_field
+#define space_factor_par cur_list.space_factor_field
+#define incompleat_noad_par cur_list.incompleat_noad_field
+#define mode_line_par cur_list.ml_field
+#define aux_par cur_list.eTeX_aux_field
+#define delim_par aux_par
+
+#define par_shape_par_ptr equiv(par_shape_loc)
+#define inter_line_penalties_par_ptr equiv(inter_line_penalties_loc)
+#define club_penalties_par_ptr equiv(club_penalties_loc)
+#define widow_penalties_par_ptr equiv(widow_penalties_loc)
+#define display_widow_penalties_par_ptr equiv(display_widow_penalties_loc)
+
+#define page_width_par dimen_par(page_width_code)
+#define page_height_par dimen_par(page_height_code)
+#define h_offset_par dimen_par(h_offset_code)
+#define v_offset_par dimen_par(v_offset_code)
+#define page_left_offset_par dimen_par(page_left_offset_code)
+#define page_top_offset_par dimen_par(page_top_offset_code)
+#define page_right_offset_par dimen_par(page_right_offset_code)
+#define page_bottom_offset_par dimen_par(page_bottom_offset_code)
+#define px_dimen_par dimen_par(px_dimen_code)
+
+#define max_dead_cycles_par int_par(max_dead_cycles_code)
+#define output_box_par int_par(output_box_code)
+#define holding_inserts_par int_par(holding_inserts_code)
+#define output_routine_par equiv(output_routine_loc)
+#define floating_penalty_par int_par(floating_penalty_code)
+
+#define mag_par int_par(mag_code)
+
+#define global_defs_par int_par(global_defs_code)
+#define cat_code_table_par int_par(cat_code_table_code)
+#define saving_vdiscards_par int_par(saving_vdiscards_code)
+
+#define tracing_output_par int_par(tracing_output_code)
+#define tracing_stats_par int_par(tracing_stats_code)
+#define tracing_online_par int_par(tracing_online_code)
+#define tracing_paragraphs_par int_par(tracing_paragraphs_code)
+#define tracing_nesting_par int_par(tracing_nesting_code)
+#define tracing_lost_chars_par int_par(tracing_lost_chars_code)
+#define tracing_scan_tokens_par int_par(tracing_scan_tokens_code)
+#define tracing_ifs_par int_par(tracing_ifs_code)
+#define tracing_commands_par int_par(tracing_commands_code)
+#define tracing_macros_par int_par(tracing_macros_code)
+#define tracing_assigns_par int_par(tracing_assigns_code)
+#define tracing_fonts_par int_par(tracing_fonts_code)
+#define tracing_pages_par int_par(tracing_pages_code)
+#define tracing_restores_par int_par(tracing_restores_code)
+#define tracing_groups_par int_par(tracing_groups_code)
+
+#define show_box_depth_par int_par(show_box_depth_code)
+#define show_box_breadth_par int_par(show_box_breadth_code)
+
+#define pausing_par int_par(pausing_code)
+
+#define suppress_outer_error_par int_par(suppress_outer_error_code)
+#define suppress_long_error_par int_par(suppress_long_error_code)
+#define suppress_mathpar_error_par int_par(suppress_mathpar_error_code)
+#define suppress_fontnotfound_error_par int_par(suppress_fontnotfound_error_code)
+#define suppress_ifcsname_error_par int_par(suppress_ifcsname_error_code)
+#define error_context_lines_par int_par(error_context_lines_code)
+
+#define math_old_par mathoption_int_par(c_mathoption_old_code)
+#define math_no_italic_compensation_par mathoption_int_par(c_mathoption_no_italic_compensation_code)
+#define math_no_char_italic_par mathoption_int_par(c_mathoption_no_char_italic_code)
+#define math_use_old_fraction_scaling_par mathoption_int_par(c_mathoption_use_old_fraction_scaling_code)
+#define math_umathcode_meaning_par mathoption_int_par(c_mathoption_umathcode_meaning_code)
+
+#define time_par int_par(time_code)
+#define day_par int_par(day_code)
+#define month_par int_par(month_code)
+#define year_par int_par(year_code)
+
+#define output_mode_par int_par(output_mode_code)
+#define draft_mode_par int_par(draft_mode_code)
+#define synctex_par int_par(synctex_code)
+
+#define language_par int_par(language_code)
+#define uc_hyph_par int_par(uc_hyph_code)
+#define left_hyphen_min_par int_par(left_hyphen_min_code)
+#define right_hyphen_min_par int_par(right_hyphen_min_code)
+#define ex_hyphen_char_par int_par(ex_hyphen_char_code)
+#define hyphen_penalty_par int_par(hyphen_penalty_code)
+#define ex_hyphen_penalty_par int_par(ex_hyphen_penalty_code)
+#define default_hyphen_char_par int_par(default_hyphen_char_code)
+#define default_skew_char_par int_par(default_skew_char_code)
+#define saving_hyph_codes_par int_par(saving_hyph_codes_code)
+
+#define cur_lang_par int_par(cur_lang_code)
+#define cur_font_par equiv(cur_font_loc)
+
+/* */
+
+#define math_use_current_family_code 7
+
+/*
+ #define box(A) equiv(box_base+(A))
+ #define box(A) eqtb[box_base+(A)].hh.rh
+*/
-#define body_direction int_par(body_direction_code)
-#define page_direction int_par(page_direction_code)
-#define par_direction int_par(par_direction_code)
-#define text_direction int_par(text_direction_code)
-#define math_direction int_par(math_direction_code)
+#define attribute(A) equiv(attribute_base+(A))
+#define box(A) equiv(box_base+(A))
+#define count(A) equiv(count_base+(A))
+#define dimen(A) equiv(scaled_base+(A))
+#define mu_skip(A) equiv(mu_skip_base+(A))
+#define skip(A) equiv(skip_base+(A))
+#define toks(A) equiv(toks_base+(A))
+
+#define get_tex_attribute_register(j) attribute(j)
+#define get_tex_box_register(j) box(j)
+#define get_tex_count_register(j) count(j)
+#define get_tex_dimen_register(j) dimen(j)
+#define get_tex_mu_skip_register(j) mu_skip(j)
+#define get_tex_skip_register(j) skip(j)
+
+#define font_id_text(A) cs_text(font_id_base+(A))
+
+#define end_template_token (cs_token_flag+frozen_end_template)
+#define end_write_token (cs_token_flag+end_write)
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.w b/Build/source/texk/web2c/luatexdir/tex/equivalents.w
index cc709c1bd7e..271fc67ffbd 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.w
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.w
@@ -37,8 +37,6 @@ static void diagnostic_trace(halfword p, const char *s)
}
@ @c
-#define par_shape_ptr equiv(par_shape_loc)
-
void show_eqtb_meaning(halfword n); /* forward */
@ Now that we have studied the data structures for \TeX's semantic routines,
@@ -216,7 +214,7 @@ void new_save_level(group_code c)
/* quit if |(cur_level+1)| is too big to be stored in |eqtb| */
cur_boundary = save_ptr;
cur_group = c;
- if (int_par(tracing_groups_code) > 0)
+ if (tracing_groups_par > 0)
group_trace(false);
incr(cur_level);
incr(save_ptr);
@@ -627,7 +625,7 @@ the call, since |eq_save| makes the necessary test.
@c
void eq_define(halfword p, quarterword t, halfword e)
{
- boolean trace = int_par(tracing_assigns_code) > 0;
+ boolean trace = tracing_assigns_par > 0;
if ((eq_type(p) == t) && (equiv(p) == e)) {
if (trace)
diagnostic_trace(p, "reassigning");
@@ -654,7 +652,7 @@ void eq_define(halfword p, quarterword t, halfword e)
@c
void eq_word_define(halfword p, int w)
{
- boolean trace = int_par(tracing_assigns_code) > 0;
+ boolean trace = tracing_assigns_par > 0;
if (eqtb[p].cint == w) {
if (trace)
diagnostic_trace(p, "reassigning");
@@ -680,7 +678,7 @@ to save old values, and the new value is associated with |level_one|.
@c
void geq_define(halfword p, quarterword t, halfword e)
{ /* global |eq_define| */
- boolean trace = int_par(tracing_assigns_code) > 0;
+ boolean trace = tracing_assigns_par > 0;
if (trace)
diagnostic_trace(p, "globally changing");
eq_destroy(eqtb[p]);
@@ -693,7 +691,7 @@ void geq_define(halfword p, quarterword t, halfword e)
void geq_word_define(halfword p, int w)
{ /* global |eq_word_define| */
- boolean trace = int_par(tracing_assigns_code) > 0;
+ boolean trace = tracing_assigns_par > 0;
if (trace)
diagnostic_trace(p, "globally changing");
eqtb[p].cint = w;
@@ -727,11 +725,11 @@ void unsave(void)
quarterword l = level_one; /* saved level, if in fullword regions of |eqtb| */
boolean a = false; /* have we already processed an \.{\\aftergroup} ? */
unsave_math_codes(cur_level);
- unsave_cat_codes(int_par(cat_code_table_code), cur_level);
+ unsave_cat_codes(cat_code_table_par, cur_level);
unsave_text_codes(cur_level);
unsave_math_data(cur_level);
if (cur_level > level_one) {
- boolean trace = int_par(tracing_restores_code) > 0;
+ boolean trace = tracing_restores_par > 0;
decr(cur_level);
/* Clear off top level from |save_stack| */
while (true) {
@@ -778,7 +776,7 @@ void unsave(void)
}
}
}
- if (int_par(tracing_groups_code) > 0)
+ if (tracing_groups_par > 0)
group_trace(true);
if (grp_stack[in_open] == cur_boundary)
group_warning(); /* groups possibly not properly nested with files */
@@ -798,19 +796,17 @@ entire run. The global variable |mag_set| is set to the current magnification
whenever it becomes necessary to ``freeze'' it at a particular value.
@c
-int mag_set; /* if nonzero, this magnification should be used henceforth */
+int mag_set = 0; /* if nonzero, this magnification should be used henceforth */
@ The |prepare_mag| subroutine is called whenever \TeX\ wants to use |mag|
for magnification.
@c
-#define mag int_par(mag_code)
-
void prepare_mag(void)
{
- if ((mag_set > 0) && (mag != mag_set)) {
+ if ((mag_set > 0) && (mag_par != mag_set)) {
print_err("Incompatible magnification (");
- print_int(mag);
+ print_int(mag_par);
tprint(");");
tprint_nl(" the previous value will be retained");
help2("I can handle only one magnification ratio per job. So I've",
@@ -818,19 +814,19 @@ void prepare_mag(void)
int_error(mag_set);
geq_word_define(int_base + mag_code, mag_set); /* |mag:=mag_set| */
}
- if ((mag <= 0) || (mag > 32768)) {
+ if ((mag_par <= 0) || (mag_par > 32768)) {
print_err("Illegal magnification has been changed to 1000");
help1("The magnification ratio must be between 1 and 32768.");
- int_error(mag);
+ int_error(mag_par);
geq_word_define(int_base + mag_code, 1000);
}
- if ((mag_set == 0) && (mag != mag_set)) {
- if (mag != 1000)
- one_true_inch = xn_over_d(one_hundred_inch, 10, mag);
+ if ((mag_set == 0) && (mag_par != mag_set)) {
+ if (mag_par != 1000)
+ one_true_inch = xn_over_d(one_hundred_inch, 10, mag_par);
else
one_true_inch = one_inch;
}
- mag_set = mag;
+ mag_set = mag_par;
}
@ Let's pause a moment now and try to look at the Big Picture.
@@ -888,8 +884,6 @@ halfword cur_tok; /* packed representative of |cur_cmd| and |cur_c
@ Here is a procedure that displays the current command.
@c
-#define mode cur_list.mode_field
-
void show_cur_cmd_chr(void)
{
int n; /* level of \.{\\if...\\fi} nesting */
@@ -897,13 +891,13 @@ void show_cur_cmd_chr(void)
halfword p;
begin_diagnostic();
tprint_nl("{");
- if (mode != shown_mode) {
- print_mode(mode);
+ if (mode_par != shown_mode) {
+ print_mode(mode_par);
tprint(": ");
- shown_mode = mode;
+ shown_mode = mode_par;
}
print_cmd_chr((quarterword) cur_cmd, cur_chr);
- if (int_par(tracing_ifs_code) > 0) {
+ if (tracing_ifs_par > 0) {
if (cur_cmd >= if_test_cmd) {
if (cur_cmd <= fi_or_else_cmd) {
tprint(": ");
@@ -1013,7 +1007,7 @@ void show_eqtb(halfword n)
if (penalty(equiv(n)) > 1)
tprint_esc("ETC.");
} else {
- print_int(vinfo(par_shape_ptr + 1));
+ print_int(vinfo(par_shape_par_ptr + 1));
}
} else if (n < toks_base) {
print_cmd_chr(assign_toks_cmd, n);
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w
index d981f9fee4f..4cad07c6f28 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.w
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.w
@@ -25,9 +25,6 @@ luafflib.c
@ @c
#include "ptexlib.h"
-@ @c
-#define new_line_char int_par(new_line_char_code)
-
@ When something anomalous is detected, \TeX\ typically does something like this:
$$\vbox{\halign{#\hfil\cr
|print_err("Something anomalous has been detected");|\cr
@@ -72,9 +69,9 @@ void set_last_error_context(void)
int saved_new_line_char;
int saved_new_string_line;
selector = new_string;
- saved_new_line_char = new_line_char;
+ saved_new_line_char = new_line_char_par;
saved_new_string_line = new_string_line;
- new_line_char = 10;
+ new_line_char_par = 10;
new_string_line = 10;
show_context();
xfree(last_error_context);
@@ -82,7 +79,7 @@ void set_last_error_context(void)
last_error_context = makecstring(str);
flush_str(str);
selector = sel;
- new_line_char = saved_new_line_char;
+ new_line_char_par = saved_new_line_char;
new_string_line = saved_new_string_line;
return;
}
@@ -511,6 +508,11 @@ void overflow(const char *s, unsigned int n)
print_char('=');
print_int((int) n);
print_char(']');
+ if (varmem == NULL) {
+ print_err("Sorry, I ran out of memory.");
+ print_ln();
+ exit(EXIT_FAILURE);
+ }
help2("If you really absolutely need more capacity,",
"you can ask a wizard to enlarge me.");
succumb();
@@ -629,10 +631,10 @@ void char_warning(internal_font_number f, int c)
{
int old_setting; /* saved value of |tracing_online| */
int k; /* index to current digit; we assume that $0\L n<16^{22}$ */
- if (int_par(tracing_lost_chars_code) > 0) {
- old_setting = int_par(tracing_online_code);
- if (int_par(tracing_lost_chars_code) > 1)
- int_par(tracing_online_code) = 1;
+ if (tracing_lost_chars_par > 0) {
+ old_setting = tracing_online_par;
+ if (tracing_lost_chars_par > 1)
+ tracing_online_par = 1;
begin_diagnostic();
tprint_nl("Missing character: There is no ");
print(c);
@@ -654,7 +656,7 @@ void char_warning(internal_font_number f, int c)
print_font_name(f);
print_char('!');
end_diagnostic(false);
- int_par(tracing_online_code) = old_setting;
+ tracing_online_par = old_setting;
}
}
@@ -737,8 +739,8 @@ void normal_warning(const char *t, const char *p)
int report_id ;
if (strcmp(t,"lua") == 0) {
int saved_new_line_char;
- saved_new_line_char = new_line_char;
- new_line_char = 10;
+ saved_new_line_char = new_line_char_par;
+ new_line_char_par = 10;
report_id = callback_defined(show_lua_error_hook_callback);
if (report_id == 0) {
tprint(p);
@@ -748,7 +750,7 @@ void normal_warning(const char *t, const char *p)
(void) run_callback(report_id, "->");
}
error();
- new_line_char = saved_new_line_char;
+ new_line_char_par = saved_new_line_char;
} else {
report_id = callback_defined(show_warning_message_callback);
if (report_id > 0) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.w b/Build/source/texk/web2c/luatexdir/tex/expand.w
index 46c8622b491..731345eb66e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/expand.w
+++ b/Build/source/texk/web2c/luatexdir/tex/expand.w
@@ -80,7 +80,7 @@ void expand(void)
RESWITCH:
if (cur_cmd < call_cmd) {
/* Expand a nonmacro */
- if (int_par(tracing_commands_code) > 1)
+ if (tracing_commands_par > 1)
show_cur_cmd_chr();
switch (cur_cmd) {
case top_bot_mark_cmd:
@@ -247,8 +247,8 @@ void expand(void)
code, which is actually part of |expand|. It comes into play when
\.{\\or}, \.{\\else}, or \.{\\fi} is scanned. */
- if (int_par(tracing_ifs_code) > 0)
- if (int_par(tracing_commands_code) <= 1)
+ if (tracing_ifs_par > 0)
+ if (tracing_commands_par <= 1)
show_cur_cmd_chr();
if (cur_chr > if_limit) {
if (if_limit == if_code) {
@@ -554,7 +554,7 @@ void macro_call(void)
warning_index = cur_cs;
ref_count = cur_chr;
r = token_link(ref_count);
- if (int_par(tracing_macros_code) > 0) {
+ if (tracing_macros_par > 0) {
/* Show the text of the macro being expanded */
begin_diagnostic();
print_ln();
@@ -686,7 +686,7 @@ void macro_call(void)
if (cur_tok == par_token)
if (long_state != long_call_cmd)
- if (!int_par(suppress_long_error_code)) {
+ if (!suppress_long_error_par) {
goto RUNAWAY;
}
if (cur_tok < right_brace_limit) {
@@ -698,7 +698,7 @@ void macro_call(void)
get_token();
if (cur_tok == par_token) {
if (long_state != long_call_cmd) {
- if (!int_par(suppress_long_error_code)) {
+ if (!suppress_long_error_par) {
goto RUNAWAY;
}
@@ -768,7 +768,7 @@ void macro_call(void)
pstack[n] = token_link(temp_token_head);
}
incr(n);
- if (int_par(tracing_macros_code) > 0) {
+ if (tracing_macros_par > 0) {
begin_diagnostic();
print_nl(match_chr);
print_int(n);
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w
index f787e936092..feff6e38277 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w
@@ -24,18 +24,10 @@
#include "ptexlib.h"
@ @c
-#define mode cur_list.mode_field
-#define tail cur_list.tail_field
-#define head cur_list.head_field
-#define prev_graf cur_list.pg_field
-#define dir_save cur_list.dirs_field
-
-#define tracing_nesting int_par(tracing_nesting_code)
-#define tracing_online int_par(tracing_online_code)
-#define box(A) eqtb[box_base+(A)].hh.rh
-#define global_defs int_par(global_defs_code)
-#define cat_code_table int_par(cat_code_table_code)
-#define toks(A) equiv(toks_base+(A))
+#define mode mode_par
+#define tail tail_par
+#define head head_par
+#define dir_save dirs_par
@ The program above includes a bunch of ``hooks'' that allow further
capabilities to be added without upsetting \TeX's basic structure.
@@ -477,8 +469,6 @@ above.) If it were not removed, and if there were numerous writes on a
single page, the stack would overflow.
@c
-#define end_write_token cs_token_flag+end_write
-
void expand_macros_in_tokenlist(halfword p)
{
int old_mode;
@@ -741,7 +731,7 @@ void group_warning(void)
/* Set variable |w| to indicate if this case should be reported */
/* This code scans the input stack in order to determine the type of the
current input file. */
- if (tracing_nesting > 0) {
+ if (tracing_nesting_par > 0) {
while ((input_stack[base_ptr].state_field == token_list) ||
(input_stack[base_ptr].index_field > i))
decr(base_ptr);
@@ -757,7 +747,7 @@ void group_warning(void)
print_group(true);
tprint(" of a different file");
print_ln();
- if (tracing_nesting > 1)
+ if (tracing_nesting_par > 1)
show_context();
if (history == spotless)
history = warning_issued;
@@ -778,7 +768,7 @@ void if_warning(void)
input_stack[base_ptr] = cur_input; /* store current state */
while (if_stack[i] == cond_ptr) {
/* Set variable |w| to... */
- if (tracing_nesting > 0) {
+ if (tracing_nesting_par > 0) {
while ((input_stack[base_ptr].state_field == token_list) ||
(input_stack[base_ptr].index_field > i))
decr(base_ptr);
@@ -795,7 +785,7 @@ void if_warning(void)
print_if_line(if_line);
tprint(" of a different file");
print_ln();
- if (tracing_nesting > 1)
+ if (tracing_nesting_par > 1)
show_context();
if (history == spotless)
history = warning_issued;
@@ -847,7 +837,7 @@ void file_warning(void)
cur_if = c;
if_line = i; /* restore old values */
print_ln();
- if (tracing_nesting > 1)
+ if (tracing_nesting_par > 1)
show_context();
if (history == spotless)
history = warning_issued;
@@ -862,9 +852,6 @@ internal stuff has to be accessed from C directly, where lots of the
defines are not available.
@c
-#define dimen(A) eqtb[scaled_base+(A)].hh.rh
-#define count(A) eqtb[count_base+(A)].hh.rh
-
#define get_tex_dimen_register(j) dimen(j)
#define get_tex_skip_register(j) skip(j)
#define get_tex_mu_skip_register(j) mu_skip(j)
@@ -902,7 +889,7 @@ int get_tex_extension_toks_register(int i)
int set_tex_dimen_register(int j, scaled v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -913,7 +900,7 @@ int set_tex_dimen_register(int j, scaled v)
int set_tex_skip_register(int j, halfword v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -926,7 +913,7 @@ int set_tex_skip_register(int j, halfword v)
int set_tex_mu_skip_register(int j, halfword v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -939,7 +926,7 @@ int set_tex_mu_skip_register(int j, halfword v)
int set_tex_count_register(int j, scaled v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -950,7 +937,7 @@ int set_tex_count_register(int j, scaled v)
int set_tex_box_register(int j, scaled v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -961,7 +948,7 @@ int set_tex_box_register(int j, scaled v)
int set_tex_attribute_register(int j, scaled v)
{
int a; /* return non-nil for error */
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -988,7 +975,7 @@ int set_tex_toks_register(int j, lstring s)
(void) str_toks(s);
set_token_ref_count(ref, 0);
set_token_link(ref, token_link(temp_token_head));
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
@@ -1003,7 +990,7 @@ int scan_tex_toks_register(int j, int c, lstring s)
(void) str_scan_toks(c,s);
set_token_ref_count(ref, 0);
set_token_link(ref, token_link(temp_token_head));
- if (global_defs > 0)
+ if (global_defs_par > 0)
a = 4;
else
a = 0;
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.w b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
index be4cf9378e4..68b22e1a334 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.w
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
@@ -22,15 +22,11 @@
#include "ptexlib.h"
@ @c
-#define end_line_char int_par(end_line_char_code)
-#define error_context_lines int_par(error_context_lines_code)
-
in_state_record *input_stack = NULL;
int input_ptr = 0; /* first unused location of |input_stack| */
int max_in_stack = 0; /* largest value of |input_ptr| when pushing */
in_state_record cur_input; /* the ``top'' input state */
-
int in_open = 0; /* the number of lines in the buffer, less one */
int open_parens = 0; /* the number of open text files */
alpha_file *input_file = NULL;
@@ -39,7 +35,6 @@ int *line_stack = NULL;
str_number *source_filename_stack = NULL;
char **full_source_filename_stack = NULL;
-
int scanner_status = 0; /* can a subfile end now? */
pointer warning_index = null; /* identifier relevant to non-|normal| scanner status */
pointer def_ref = null; /* reference count of token list being defined */
@@ -235,7 +230,7 @@ void set_trick_count(void)
#define PSEUDO_PRINT_THE_LINE() do { \
begin_pseudoprint(); \
- if (buffer[ilimit]==end_line_char) \
+ if (buffer[ilimit]==end_line_char_par) \
j=ilimit; \
else \
j=ilimit+1; /* determine the effective end of the line */ \
@@ -300,7 +295,7 @@ void show_context(void)
if ((iname > 21) || (base_ptr == 0))
bottom_line = true;
}
- if ((base_ptr == input_ptr) || bottom_line || (nn < error_context_lines)) {
+ if ((base_ptr == input_ptr) || bottom_line || (nn < error_context_lines_par)) {
/* Display the current context */
if ((base_ptr == input_ptr) || (istate != token_list) || (token_type != backed_up) || (iloc != null)) {
/* we omit backed-up token lists that have already been read */
@@ -381,10 +376,10 @@ void show_context(void)
tprint("...");
incr(nn);
}
- } else if (nn == error_context_lines) {
+ } else if (nn == error_context_lines_par) {
tprint_nl("...");
incr(nn);
- /* omitted if |error_context_lines<0| */
+ /* omitted if |error_context_lines_par<0| */
}
if (bottom_line)
break;
@@ -435,7 +430,7 @@ void begin_token_list(halfword p, quarterword t)
param_start = param_ptr;
} else {
iloc = token_link(p);
- if (int_par(tracing_macros_code) > 1) {
+ if (tracing_macros_par > 1) {
begin_diagnostic();
tprint_nl("");
if (t == mark_text)
@@ -726,7 +721,7 @@ void pseudo_from_string(void)
halfword p; /* for list construction */
s = make_string();
/* Convert string |s| into a new pseudo file */
- p = string_to_pseudo(s, int_par(new_line_char_code));
+ p = string_to_pseudo(s, new_line_char_par);
vlink(p) = pseudo_files;
pseudo_files = p;
flush_str(s);
@@ -735,7 +730,7 @@ void pseudo_from_string(void)
line = 0;
ilimit = istart;
iloc = ilimit + 1; /* force line read */
- if (int_par(tracing_scan_tokens_code) > 0) {
+ if (tracing_scan_tokens_par > 0) {
if (term_offset > max_print_line - 3)
print_ln();
else if ((term_offset > 0) || (file_offset > 0))
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
index 6e74e0b27be..fb67eb2fcec 100644
--- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w
+++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
@@ -146,7 +146,7 @@ void line_break(boolean d, int line_break_context)
succumb();
}
} else {
- if (int_par(tracing_paragraphs_code) > 0) {
+ if (tracing_paragraphs_par > 0) {
begin_diagnostic();
print_int(line);
end_diagnostic(true);
@@ -160,31 +160,31 @@ void line_break(boolean d, int line_break_context)
confusion("weird par dir"); /* assert(0); */ /* |paragraph_dir = 0|; */
}
ext_do_line_break(paragraph_dir,
- int_par(pretolerance_code),
- int_par(tracing_paragraphs_code),
- int_par(tolerance_code),
- dimen_par(emergency_stretch_code),
- int_par(looseness_code),
- int_par(adjust_spacing_code),
- equiv(par_shape_loc),
- int_par(adj_demerits_code),
- int_par(protrude_chars_code),
- int_par(line_penalty_code),
- int_par(last_line_fit_code),
- int_par(double_hyphen_demerits_code),
- int_par(final_hyphen_demerits_code),
- dimen_par(hang_indent_code),
- dimen_par(hsize_code),
- int_par(hang_after_code),
- glue_par(left_skip_code),
- glue_par(right_skip_code),
- equiv(inter_line_penalties_loc),
- int_par(inter_line_penalty_code),
- int_par(club_penalty_code),
- equiv(club_penalties_loc),
- (d ? equiv(display_widow_penalties_loc) : equiv(widow_penalties_loc)),
- (d ? int_par(display_widow_penalty_code) : int_par(widow_penalty_code)),
- int_par(broken_penalty_code),
+ pretolerance_par,
+ tracing_paragraphs_par,
+ tolerance_par,
+ emergency_stretch_par,
+ looseness_par,
+ adjust_spacing_par,
+ par_shape_par_ptr,
+ adj_demerits_par,
+ protrude_chars_par,
+ line_penalty_par,
+ last_line_fit_par,
+ double_hyphen_demerits_par,
+ final_hyphen_demerits_par,
+ hang_indent_par,
+ hsize_par,
+ hang_after_par,
+ left_skip_par,
+ right_skip_par,
+ inter_line_penalties_par_ptr,
+ inter_line_penalty_par,
+ club_penalty_par,
+ club_penalties_par_ptr,
+ (d ? display_widow_penalties_par_ptr : widow_penalties_par_ptr),
+ (d ? display_widow_penalty_code : widow_penalty_code),
+ broken_penalty_par,
final_par_glue);
}
lua_node_filter(post_linebreak_filter_callback,
@@ -898,7 +898,7 @@ static void compute_break_width(int break_type, int line_break_dir, int adjust_s
switch (type(s)) {
case math_node:
/* begin mathskip code */
- if (glue_is_zero(math_skip)) {
+ if (glue_is_zero(math_skip_par)) {
break_width[1] -= surround(s);
break;
} else {
@@ -1630,14 +1630,15 @@ void ext_do_line_break(int paragraph_dir,
second_width = hsize;
second_indent = 0;
} else {
+ halfword used_hang_indent = swap_hang_indent(hang_indent);
/* Set line length parameters in preparation for hanging indentation */
/* We compute the values of |easy_line| and the other local variables relating
to line length when the |line_break| procedure is initializing itself. */
last_special_line = abs(hang_after);
if (hang_after < 0) {
- first_width = hsize - abs(hang_indent);
- if (hang_indent >= 0)
- first_indent = hang_indent;
+ first_width = hsize - abs(used_hang_indent);
+ if (used_hang_indent >= 0)
+ first_indent = used_hang_indent;
else
first_indent = 0;
second_width = hsize;
@@ -1645,19 +1646,18 @@ void ext_do_line_break(int paragraph_dir,
} else {
first_width = hsize;
first_indent = 0;
- second_width = hsize - abs(hang_indent);
- if (hang_indent >= 0)
- second_indent = hang_indent;
+ second_width = hsize - abs(used_hang_indent);
+ if (used_hang_indent >= 0)
+ second_indent = used_hang_indent;
else
second_indent = 0;
}
}
} else {
last_special_line = vinfo(par_shape_ptr + 1) - 1;
- second_indent =
- varmem[(par_shape_ptr + 2 * (last_special_line + 1))].cint;
- second_width =
- varmem[(par_shape_ptr + 2 * (last_special_line + 1) + 1)].cint;
+ second_indent = varmem[(par_shape_ptr + 2 * (last_special_line + 1))].cint;
+ second_width = varmem[(par_shape_ptr + 2 * (last_special_line + 1) + 1)].cint;
+ second_indent = swap_parshape_indent(second_indent,second_width);
}
if (looseness == 0)
easy_line = last_special_line;
@@ -1840,7 +1840,7 @@ void ext_do_line_break(int paragraph_dir,
case math_node:
auto_breaking = (subtype(cur_p) == after);
/* begin mathskip code */
- if (glue_is_zero(math_skip)) {
+ if (glue_is_zero(math_skip_par)) {
kern_break();
break;
} else {
@@ -2132,7 +2132,7 @@ void ext_do_line_break(int paragraph_dir,
protrude_chars,
par_shape_ptr,
adjust_spacing,
- inter_line_penalties_ptr,
+ inter_line_penalties_par_ptr,
inter_line_penalty,
club_penalty,
club_penalties_ptr,
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.h b/Build/source/texk/web2c/luatexdir/tex/mainbody.h
index fdef20ab882..158893631d7 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.h
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.h
@@ -214,8 +214,7 @@ is conditionally compiled in the C code.
@^system dependencies@>
*/
-
-# define fix_date_and_time() dateandtime(int_par(time_code),int_par(day_code),int_par(month_code),int_par(year_code))
+# define fix_date_and_time() dateandtime(time_par,day_par,month_par,year_par)
extern int get_luatexversion(void);
extern str_number get_luatexrevision(void);
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
index ad0bb783a1f..0fb8bc4b484 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
@@ -432,9 +432,9 @@ void main_body(void)
incr(iloc);
}
if (output_mode_option != 0)
- int_par(output_mode_code) = output_mode_value;
+ output_mode_par = output_mode_value;
if (draft_mode_option != 0) {
- int_par(draft_mode_code) = draft_mode_value;
+ draft_mode_par = draft_mode_value;
}
/* can this be moved? */
pdf_init_map_file((char *) pdftex_map);
@@ -442,15 +442,14 @@ void main_body(void)
if (end_line_char_inactive)
decr(ilimit);
else
- buffer[ilimit] = (packed_ASCII_code) int_par(end_line_char_code);
+ buffer[ilimit] = (packed_ASCII_code) end_line_char_par;
fix_date_and_time();
random_seed = (microseconds * 1000) + (epochseconds % 1000000);
init_randoms(random_seed);
initialize_math();
fixup_selector(log_opened_global);
check_texconfig_init();
- if ((iloc < ilimit) && (get_cat_code(int_par(cat_code_table_code),
- buffer[iloc]) != escape_cmd))
+ if ((iloc < ilimit) && (get_cat_code(cat_code_table_code, buffer[iloc]) != escape_cmd))
start_input(); /* \.{\\input} assumed */
/* DIR: Initialize |text_dir_ptr| */
text_dir_ptr = new_dir(0);
@@ -487,7 +486,7 @@ void close_files_and_terminate(void)
int callback_id;
callback_id = callback_defined(stop_run_callback);
finalize_write_files();
- if (int_par(tracing_stats_code) > 0) {
+ if (tracing_stats_par > 0) {
if (callback_id == 0) {
/* Output statistics about this job */
/* The present section goes directly to the log file instead of using
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h b/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
index c42dcc93aa4..13e3c6ff3b0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
@@ -71,9 +71,9 @@ since the following routines test for the \.{\\global} prefix as follows.
# define define_cat_code(A,B) do { \
if (is_global(a)) \
- set_cat_code(int_par(cat_code_table_code),(A),(B),level_one); \
+ set_cat_code(cat_code_table_par,(A),(B),level_one); \
else \
- set_cat_code(int_par(cat_code_table_code),(A),(B),cur_level); \
+ set_cat_code(cat_code_table_par,(A),(B),cur_level); \
} while (0)
# define define_fam_fnt(A,B,C) do { \
@@ -174,6 +174,17 @@ extern void fixup_directions(void);
tprint(" entered on line "); print_int((A)); \
}
+/*
+ extern halfword swap_hang_indent(halfword indentation, halfword shape_mode);
+ extern halfword swap_parshape_indent(halfword indentation, halfword width, halfword shape_mode);
+*/
+
+#define swap_hang_indent(indentation) \
+ ( ((shape_mode_par == 1 || shape_mode_par == 3 || shape_mode_par == -1 || shape_mode_par == -3)) ? negate(indentation) : indentation )
+
+#define swap_parshape_indent(indentation,width) \
+ ( ((shape_mode_par == 2 || shape_mode_par == 3 || shape_mode_par == -2 || shape_mode_par == -3)) ? (hsize_par - width - indentation) : indentation )
+
extern void get_r_token(void);
extern void assign_internal_value(int a, halfword p, int cur_val);
extern void do_register_command(int a);
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
index 690952b2bf2..cbfd333bbb7 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
@@ -22,72 +22,11 @@
#include "ptexlib.h"
#include "lua/luatex-api.h"
-/* these will move to equivalents.h */
-
@ @c
-#define lp_code_base 2
-#define rp_code_base 3
-#define ef_code_base 4
-#define tag_code 5
-#define no_lig_code 6
-#define gp_code_base 7
-
-#define prev_depth cur_list.prev_depth_field
-#define space_factor cur_list.space_factor_field
-#define par_shape_ptr equiv(par_shape_loc)
-
-#define cur_lang int_par(cur_lang_code)
-#define global_defs int_par(global_defs_code)
-#define output_box int_par(output_box_code)
-#define end_line_char int_par(end_line_char_code)
-#define new_line_char int_par(new_line_char_code)
-#define tracing_online int_par(tracing_online_code)
-#define no_local_whatsits int_par(no_local_whatsits_code)
-#define no_local_dirs int_par(no_local_dirs_code)
-#define err_help equiv(err_help_loc)
-#define every_par equiv(every_par_loc)
-
-#define page_left_offset dimen_par(page_left_offset_code)
-#define page_top_offset dimen_par(page_top_offset_code)
-#define page_right_offset dimen_par(page_right_offset_code)
-#define page_bottom_offset dimen_par(page_bottom_offset_code)
-#define px_dimen dimen_par(px_dimen_code)
-
-#define math_eqno_gap_step int_par(math_eqno_gap_step_code)
-
-#define escape_char int_par(escape_char_code)
-#define max_dead_cycles int_par(max_dead_cycles_code)
-#define tolerance int_par(tolerance_code)
-#define mag int_par(mag_code)
-#define cat_code_table int_par(cat_code_table_code)
-
-#define par_indent dimen_par(par_indent_code)
-#define looseness int_par(looseness_code)
-#define space_skip glue_par(space_skip_code)
-#define xspace_skip glue_par(xspace_skip_code)
-#define math_skip glue_par(math_skip_code)
-#define every_vbox equiv(every_vbox_loc)
-
-#define split_top_skip glue_par(split_top_skip_code)
-#define split_max_depth dimen_par(split_max_depth_code)
-
-#define hang_indent dimen_par(hang_indent_code)
-#define hang_after int_par(hang_after_code)
-#define inter_line_penalties_ptr equiv(inter_line_penalties_loc)
-
-#define box(A) eqtb[box_base+(A)].hh.rh
-#define cur_font equiv(cur_font_loc)
-#define hsize dimen_par(hsize_code)
-#define ex_hyphen_char int_par(ex_hyphen_char_code)
-#define floating_penalty int_par(floating_penalty_code)
-
-#define mode cur_list.mode_field
-#define tail cur_list.tail_field
-#define head cur_list.head_field
-#define prev_graf cur_list.pg_field
-#define dir_save cur_list.dirs_field
-
-#define var_code 7 /* math code meaning ``use the current family'' */
+#define mode mode_par
+#define tail tail_par
+#define head head_par
+#define dir_save dirs_par
@ We come now to the |main_control| routine, which contains the master
switch that causes all the various pieces of \TeX\ to do their things,
@@ -140,14 +79,14 @@ void adjust_space_factor(void)
{
halfword s = get_sf_code(cur_chr);
if (s == 1000) {
- space_factor = 1000;
+ space_factor_par = 1000;
} else if (s < 1000) {
if (s > 0)
- space_factor = s;
- } else if (space_factor < 1000) {
- space_factor = 1000;
+ space_factor_par = s;
+ } else if (space_factor_par < 1000) {
+ space_factor_par = 1000;
} else {
- space_factor = s;
+ space_factor_par = s;
}
}
@@ -179,12 +118,12 @@ static void run_char_num (void) {
scan_char_num();
cur_chr = cur_val;
adjust_space_factor();
- tail_append(new_char(cur_font, cur_chr));
+ tail_append(new_char(cur_font_par, cur_chr));
}
static void run_char (void) {
adjust_space_factor();
- tail_append(new_char(cur_font, cur_chr));
+ tail_append(new_char(cur_font_par, cur_chr));
}
@
@@ -201,23 +140,23 @@ is zero or~not.
@c
static void run_app_space (void) {
halfword p; /* was a global temp_ptr */
- int method = int_par(disable_space_code) ;
+ int method = disable_space_par ;
if (method == 1) {
/* don't inject anything, not even zero skip */
} else if (method == 2) {
p = new_glue(zero_glue);
couple_nodes(tail,p);
tail = p;
- } else if ((abs(mode) + cur_cmd == hmode + spacer_cmd) && (!(space_factor == 1000))) {
+ } else if ((abs(mode) + cur_cmd == hmode + spacer_cmd) && (!(space_factor_par == 1000))) {
app_space();
} else {
/* Append a normal inter-word space to the current list */
- if (glue_is_zero(space_skip)) {
+ if (glue_is_zero(space_skip_par)) {
/* Find the glue specification for text spaces in the current font */
p = new_glue(zero_glue);
- width(p) = space(cur_font);
- stretch(p) = space_stretch(cur_font);
- shrink(p) = space_shrink(cur_font);
+ width(p) = space(cur_font_par);
+ stretch(p) = space_stretch(cur_font_par);
+ shrink(p) = space_shrink(cur_font_par);
} else {
p = new_param_glue(space_skip_code);
@@ -351,9 +290,9 @@ mode, by setting |prev_depth:=ignore_depth|.
static void run_rule (void) {
tail_append(scan_rule_spec());
if (abs(mode) == vmode)
- prev_depth = ignore_depth;
+ prev_depth_par = ignore_depth;
else if (abs(mode) == hmode)
- space_factor = 1000;
+ space_factor_par = 1000;
}
@
@@ -567,9 +506,9 @@ static void run_vcenter (void) {
normal_paragraph();
push_nest();
mode = -vmode;
- prev_depth = ignore_depth;
- if (every_vbox != null)
- begin_token_list(every_vbox, every_vbox_text);
+ prev_depth_par = ignore_depth;
+ if (every_vbox_par != null)
+ begin_token_list(every_vbox_par, every_vbox_text);
}
@ @c
@@ -629,12 +568,12 @@ static void run_normal (void) {
help1("All \\catcode table ids must be between 0 and 0x7FFF");
error();
} else {
- if (cur_val == cat_code_table) {
+ if (cur_val == cat_code_table_par) {
print_err("Invalid \\catcode table");
help1("You cannot overwrite the current \\catcode table");
error();
} else {
- copy_cat_codes(cat_code_table, cur_val);
+ copy_cat_codes(cat_code_table_par, cur_val);
}
}
break;
@@ -645,7 +584,7 @@ static void run_normal (void) {
help1("All \\catcode table ids must be between 0 and 0x7FFF");
error();
} else {
- if (cur_val == cat_code_table) {
+ if (cur_val == cat_code_table_par) {
print_err("Invalid \\catcode table");
help1("You cannot overwrite the current \\catcode table");
error();
@@ -965,7 +904,7 @@ void main_control(void)
check_interrupt();
continue;
}
- if (int_par(tracing_commands_code) > 0)
+ if (tracing_commands_par > 0)
show_cur_cmd_chr();
(jump_table[(abs(mode) + cur_cmd)])(); /* run the command */
@@ -981,24 +920,24 @@ void main_control(void)
void app_space(void)
{ /* handle spaces when |space_factor<>1000| */
halfword q; /* glue node */
- if ((space_factor >= 2000) && (! glue_is_zero(xspace_skip))) {
+ if ((space_factor_par >= 2000) && (! glue_is_zero(xspace_skip_par))) {
q = new_param_glue(xspace_skip_code);
/* so from now we have a subtype with spaces: */
subtype(q) = xspace_skip_code + 1;
} else {
- if (!glue_is_zero(space_skip)) {
- q = new_glue(space_skip);
+ if (!glue_is_zero(space_skip_par)) {
+ q = new_glue(space_skip_par);
} else {
q = new_glue(zero_glue);
- width(q) = space(cur_font);
- stretch(q) = space_stretch(cur_font);
- shrink(q) = space_shrink(cur_font);
+ width(q) = space(cur_font_par);
+ stretch(q) = space_stretch(cur_font_par);
+ shrink(q) = space_shrink(cur_font_par);
}
/* Modify the glue specification in |q| according to the space factor */
- if (space_factor >= 2000)
- width(q) = width(q) + extra_space(cur_font);
- stretch(q) = xn_over_d(stretch(q), space_factor, 1000);
- shrink(q) = xn_over_d(shrink(q), 1000, space_factor);
+ if (space_factor_par >= 2000)
+ width(q) = width(q) + extra_space(cur_font_par);
+ stretch(q) = xn_over_d(stretch(q), space_factor_par, 1000);
+ shrink(q) = xn_over_d(shrink(q), 1000, space_factor_par);
/* so from now we have a subtype with spaces: */
subtype(q) = space_skip_code + 1;
@@ -1023,7 +962,7 @@ void insert_dollar_sign(void)
@c
void insert_dollar_sign_par_end(void)
{
- if (!int_par(suppress_mathpar_error_code)) {
+ if (!suppress_mathpar_error_par) {
insert_dollar_sign() ;
}
}
@@ -1094,7 +1033,7 @@ boolean its_all_over(void)
}
back_input(); /* we will try to end again after ejecting residual material */
tail_append(new_null_box());
- width(tail) = hsize;
+ width(tail) = hsize_par;
tail_append(new_glue(fill_glue));
tail_append(new_penalty(-010000000000));
normal_page_filter(end);
@@ -1265,9 +1204,9 @@ void handle_right_brace(void)
break;
case insert_group:
end_graf(insert_group);
- q = new_glue(split_top_skip);
- d = split_max_depth;
- f = floating_penalty;
+ q = new_glue(split_top_skip_par);
+ d = split_max_depth_par;
+ f = floating_penalty_par;
unsave();
save_ptr--;
/* now |saved_value(0)| is the insertion number, or the |vadjust| subtype */
@@ -1368,16 +1307,18 @@ default values after every paragraph and when internal vertical mode is entered.
@c
void normal_paragraph(void)
{
- if (looseness != 0)
+ if (looseness_par != 0)
eq_word_define(int_base + looseness_code, 0);
- if (hang_indent != 0)
+ if (hang_indent_par != 0)
eq_word_define(dimen_base + hang_indent_code, 0);
- if (hang_after != 1)
+ if (hang_after_par != 1)
eq_word_define(int_base + hang_after_code, 1);
- if (par_shape_ptr != null)
+ if (par_shape_par_ptr != null)
eq_define(par_shape_loc, shape_ref_cmd, null);
- if (inter_line_penalties_ptr != null)
+ if (inter_line_penalties_par_ptr != null)
eq_define(inter_line_penalties_loc, shape_ref_cmd, null);
+ if (shape_mode_par > 0)
+ eq_word_define(dimen_base + shape_mode_code, 0);
}
@ The global variable |cur_box| will point to a newly-made box. If the box
@@ -1421,7 +1362,7 @@ void box_end(int box_context)
}
} else {
if (abs(mode) == hmode)
- space_factor = 1000;
+ space_factor_par = 1000;
else
cur_box = new_sub_box(cur_box);
couple_nodes(tail, cur_box);
@@ -1491,19 +1432,19 @@ void new_graf(boolean indented)
{
halfword p, q, dir_graf_tmp;
halfword dir_rover;
- prev_graf = 0;
+ prev_graf_par = 0;
if ((mode == vmode) || (head != tail)) {
tail_append(new_param_glue(par_skip_code));
}
push_nest();
mode = hmode;
- space_factor = 1000;
+ space_factor_par = 1000;
/* LOCAL: Add local paragraph node */
tail_append(make_local_par_node(new_graf_par_code));
if (indented) {
p = new_null_box();
- box_dir(p) = par_direction;
- width(p) = par_indent;
+ box_dir(p) = par_direction_par;
+ width(p) = par_indent_par;
subtype(p) = indent_list;
q = tail;
tail_append(p);
@@ -1512,7 +1453,7 @@ void new_graf(boolean indented)
}
dir_rover = text_dir_ptr;
while (dir_rover != null) {
- if ((vlink(dir_rover) != null) || (dir_dir(dir_rover) != par_direction)) {
+ if ((vlink(dir_rover) != null) || (dir_dir(dir_rover) != par_direction_par)) {
dir_graf_tmp = new_dir(dir_dir(dir_rover));
try_couple_nodes(dir_graf_tmp,vlink(q));
couple_nodes(q,dir_graf_tmp);
@@ -1523,8 +1464,8 @@ void new_graf(boolean indented)
while (vlink(q) != null)
q = vlink(q);
tail = q;
- if (every_par != null)
- begin_token_list(every_par, every_par_text);
+ if (every_par_par != null)
+ begin_token_list(every_par_par, every_par_text);
if (nest_ptr == 1) {
checked_page_filter(new_graf);
build_page(); /* put |par_skip| glue on current page */
@@ -1537,9 +1478,9 @@ void indent_in_hmode(void)
halfword p;
if (cur_chr > 0) { /* \.{\\indent} */
p = new_null_box();
- width(p) = par_indent;
+ width(p) = par_indent_par;
if (abs(mode) == hmode)
- space_factor = 1000;
+ space_factor_par = 1000;
else
p = new_sub_box(p);
tail_append(p);
@@ -1596,9 +1537,9 @@ void begin_insert_or_adjust(void)
{
if (cur_cmd != vadjust_cmd) {
scan_register_num();
- if (cur_val == output_box) {
+ if (cur_val == output_box_par) {
print_err("You can't \\insert");
- print_int(output_box);
+ print_int(output_box_par);
help1("I'm changing to \\insert0; box \\outputbox is special.");
error();
cur_val = 0;
@@ -1615,7 +1556,7 @@ void begin_insert_or_adjust(void)
normal_paragraph();
push_nest();
mode = -vmode;
- prev_depth = ignore_depth;
+ prev_depth_par = ignore_depth;
}
@ I (TH)'ve renamed the |make_mark| procedure to this, because if the
@@ -1800,7 +1741,7 @@ void append_local_box(int kind)
scan_left_brace();
push_nest();
mode = -hmode;
- space_factor = 1000;
+ space_factor_par = 1000;
}
@ Discretionary nodes are easy in the common case `\.{\\-}', but in the
@@ -1817,19 +1758,19 @@ void append_discretionary(void)
subtype(tail) = (quarterword) cur_chr;
if (cur_chr == explicit_disc) {
/* \- */
- c = get_pre_hyphen_char(cur_lang);
+ c = get_pre_hyphen_char(cur_lang_par);
if (c != 0) {
vlink(pre_break(tail)) = new_char(equiv(cur_font_loc), c);
alink(vlink(pre_break(tail))) = pre_break(tail);
tlink(pre_break(tail)) = vlink(pre_break(tail));
}
- c = get_post_hyphen_char(cur_lang);
+ c = get_post_hyphen_char(cur_lang_par);
if (c != 0) {
vlink(post_break(tail)) = new_char(equiv(cur_font_loc), c);
alink(vlink(post_break(tail))) = post_break(tail);
tlink(post_break(tail)) = vlink(post_break(tail));
}
- disc_penalty(tail) = int_par(ex_hyphen_penalty_code);
+ disc_penalty(tail) = ex_hyphen_penalty_par;
} else {
/* \discretionary */
if (scan_keyword("penalty")) {
@@ -1842,8 +1783,8 @@ void append_discretionary(void)
scan_left_brace();
push_nest();
mode = -hmode;
- space_factor = 1000;
- /* already preset: disc_penalty(tail) = int_par(hyphen_penalty_code); */
+ space_factor_par = 1000;
+ /* already preset: disc_penalty(tail) = hyphen_penalty_par; */
}
}
@@ -1871,7 +1812,7 @@ void build_local_box(void)
/* LOCAL: Add local paragraph node */
tail_append(make_local_par_node(local_box_par_code));
}
- eq_word_define(int_base + no_local_whatsits_code, no_local_whatsits + 1);
+ eq_word_define(int_base + no_local_whatsits_code, no_local_whatsits_par + 1);
}
@ The three discretionary lists are constructed somewhat as if they were
@@ -1954,7 +1895,7 @@ void build_discretionary(void)
scan_left_brace();
push_nest();
mode = -hmode;
- space_factor = 1000;
+ space_factor_par = 1000;
}
@ The positioning of accents is straightforward but tedious. Given an accent
@@ -2023,7 +1964,7 @@ void make_accent(void)
}
couple_nodes(tail, p);
tail = p;
- space_factor = 1000;
+ space_factor_par = 1000;
}
}
@@ -2177,6 +2118,25 @@ following program is careful to check each case properly.
} while (0)
@ @c
+/*
+halfword swap_hang_indent(halfword indentation, halfword shape_mode) {
+ if (shape_mode == 1 || shape_mode == 3 || shape_mode == -1 || shape_mode == -3) {
+ return negate(indentation);
+ } else {
+ return indentation;
+ }
+}
+
+halfword swap_parshape_indent(halfword indentation, halfword width, halfword shape_mode) {
+ if (shape_mode == 2 || shape_mode == 3 || shape_mode == -2 || shape_mode == -3) {
+ return hsize_par - width - indentation;
+ } else {
+ return indentation;
+ }
+}
+
+*/
+
void prefixed_command(void)
{
int a; /* accumulated prefix codes so far */
@@ -2184,7 +2144,7 @@ void prefixed_command(void)
halfword j; /* index into a \.{\\parshape} specification */
halfword p, q; /* for temporary short-term use */
int n; /* ditto */
- boolean e; /* should a definition be expanded? or was \.{\\let} not done? */
+ boolean e, check_glue; /* should a definition be expanded? or was \.{\\let} not done? */
mathcodeval mval; /* for handling of \.{\\mathchardef}s */
a = 0;
while (cur_cmd == prefix_cmd) {
@@ -2206,7 +2166,7 @@ void prefixed_command(void)
back_error();
return;
}
- if (int_par(tracing_commands_code) > 2)
+ if (tracing_commands_par > 2)
show_cur_cmd_chr();
}
/* Discard the prefixes \.{\\long} and \.{\\outer} if they are irrelevant */
@@ -2224,8 +2184,8 @@ void prefixed_command(void)
error();
}
/* Adjust for the setting of \.{\\globaldefs} */
- if (global_defs != 0) {
- if (global_defs < 0) {
+ if (global_defs_par != 0) {
+ if (global_defs_par < 0) {
if (is_global(a))
a = a - 4;
} else {
@@ -2244,7 +2204,7 @@ void prefixed_command(void)
|cur_chr| is odd if the definition is supposed to be global, and
|cur_chr>=2| if the definition is supposed to be expanded. */
- if (odd(cur_chr) && !is_global(a) && (global_defs >= 0))
+ if (odd(cur_chr) && !is_global(a) && (global_defs_par >= 0))
a = a + 4;
e = (cur_chr >= 2);
get_r_token();
@@ -2325,7 +2285,7 @@ void prefixed_command(void)
break;
case math_char_def_code:
mval = scan_mathchar(tex_mathcode);
- if (mathoption_int_par(c_mathoption_umathcode_meaning_code) == 1) {
+ if (math_umathcode_meaning_par == 1) {
cur_val = (mval.class_value + (8 * mval.family_value)) * (65536 * 32) + mval.character_value;
define(p, xmath_given_cmd, cur_val);
} else {
@@ -2464,42 +2424,78 @@ void prefixed_command(void)
/* DIR: Assign direction codes */
scan_direction();
switch (cur_chr) {
- case int_base + page_direction_code:
- eq_word_define(int_base + page_direction_code, cur_val);
- break;
- case int_base + body_direction_code:
- eq_word_define(int_base + body_direction_code, cur_val);
- break;
- case int_base + par_direction_code:
- eq_word_define(int_base + par_direction_code, cur_val);
- break;
- case int_base + math_direction_code:
- eq_word_define(int_base + math_direction_code, cur_val);
- break;
- case int_base + text_direction_code:
-#if 0
- /* various tests hint that this is unnecessary and
- * sometimes even produces weird results, eg
- * (\hbox{\textdir TRT ABC\textdir TLT DEF})
- * becomes
- * (DEFCBA)
- * in the output
- */
- if ((no_local_dirs > 0) && (abs(mode) == hmode)) {
- /* DIR: Add local dir node */
- tail_append(new_dir(text_direction));
- }
-#endif
- update_text_dir_ptr(cur_val);
- if (abs(mode) == hmode) {
- /* DIR: Add local dir node */
- tail_append(new_dir(cur_val));
- dir_level(tail) = cur_level;
+ case int_base + page_direction_code:
+ eq_word_define(int_base + page_direction_code, cur_val);
+ break;
+ case int_base + body_direction_code:
+ eq_word_define(int_base + body_direction_code, cur_val);
+ break;
+ case int_base + par_direction_code:
+ eq_word_define(int_base + par_direction_code, cur_val);
+ break;
+ case int_base + math_direction_code:
+ eq_word_define(int_base + math_direction_code, cur_val);
+ break;
+ case int_base + text_direction_code:
+ case int_base + line_direction_code:
+ /*
+ pre version 0.97 this was a commented section because various tests hint that this
+ is unnecessary and sometimes even produces weird results, like:
+
+ (\hbox{\textdir TRT ABC\textdir TLT DEF}))
+
+ becomes
+
+ (DEFCBA)
+
+ in the output when we use
+
+ tail_append(new_dir(text_direction_par)
+
+ but when we append the reverse of the current it goes better
+
+ */
+ check_glue = (cur_chr == (int_base + line_direction_code));
+ if (check_glue) {
+ cur_chr = int_base + text_direction_code ;
+ }
+ if (abs(mode) == hmode) {
+ if (no_local_dirs_par > 0) {
+ /* tail is non zero but we test anyway */
+ if (check_glue && (tail != null && type(tail) == glue_node)) {
+ halfword prev = alink(tail);
+ halfword dirn = new_dir(text_direction_par - dir_swap);
+ couple_nodes(prev,dirn);
+ couple_nodes(dirn,tail);
+ } else {
+ tail_append(new_dir(text_direction_par - dir_swap));
+ }
+ } else {
+ /* what is the use of nolocaldirs .. maybe we should get rid of it */
+ }
+ update_text_dir_ptr(cur_val);
+ tail_append(new_dir(cur_val));
+ dir_level(tail) = cur_level;
+ } else {
+ update_text_dir_ptr(cur_val);
+ }
+ /* original:
+
+ // if ((no_local_dirs_par > 0) && (abs(mode) == hmode)) {
+ // // tail_append(new_dir(text_direction_par) // kind of wrong
+ // tail_append(new_dir(text_direction_par - dir_swap)); // better
+ // }
+
+ update_text_dir_ptr(cur_val);
+ if (abs(mode) == hmode) {
+ tail_append(new_dir(cur_val));
+ dir_level(tail) = cur_level;
+ }
+ */
+ eq_word_define(int_base + text_direction_code, cur_val);
+ eq_word_define(int_base + no_local_dirs_code, no_local_dirs_par + 1);
+ break;
}
- eq_word_define(int_base + text_direction_code, cur_val);
- eq_word_define(int_base + no_local_dirs_code, no_local_dirs + 1);
- break;
- }
break;
case assign_dimen_cmd:
p = cur_chr;
@@ -2614,11 +2610,11 @@ void prefixed_command(void)
scan_dimen(false, false, false);
} else {
scan_glue(mu_val_level);
- if (cur_val == glue_par(thin_mu_skip_code))
+ if (cur_val == thin_mu_skip_par)
cur_val = thin_mu_skip_code;
- else if (cur_val == glue_par(med_mu_skip_code))
+ else if (cur_val == med_mu_skip_par)
cur_val = med_mu_skip_code;
- else if (cur_val == glue_par(thick_mu_skip_code))
+ else if (cur_val == thick_mu_skip_par)
cur_val = thick_mu_skip_code;
}
define_math_param(p, cur_val1, cur_val);
@@ -2812,9 +2808,9 @@ void prefixed_command(void)
@ @c
void fixup_directions(void)
{
- int temp_no_whatsits = no_local_whatsits;
- int temp_no_dirs = no_local_dirs;
- int temporary_dir = text_direction;
+ int temp_no_whatsits = no_local_whatsits_par;
+ int temp_no_dirs = no_local_dirs_par;
+ int temporary_dir = text_direction_par;
if (dir_level(text_dir_ptr) == cur_level) {
/* DIR: Remove from |text_dir_ptr| */
halfword text_dir_tmp = vlink(text_dir_ptr);
@@ -2825,7 +2821,7 @@ void fixup_directions(void)
if (abs(mode) == hmode) {
if (temp_no_dirs != 0) {
/* DIR: Add local dir node */
- tail_append(new_dir(text_direction));
+ tail_append(new_dir(text_direction_par));
dir_dir(tail) = temporary_dir - dir_swap;
}
if (temp_no_whatsits != 0) {
@@ -2870,7 +2866,7 @@ void assign_internal_value(int a, halfword p, int val)
switch ((p - int_base)) {
case cat_code_table_code:
if (valid_catcode_table(val)) {
- if (val != int_par(cat_code_table_code))
+ if (val != cat_code_table_par)
word_define(p, val);
} else {
print_err("Invalid \\catcode table");
@@ -2941,9 +2937,7 @@ void assign_internal_value(int a, halfword p, int val)
(p == (int_base + local_broken_penalty_code)))) {
/* LOCAL: Add local paragraph node */
tail_append(make_local_par_node(penalty_par_code));
-
- eq_word_define(int_base + no_local_whatsits_code,
- no_local_whatsits + 1);
+ eq_word_define(int_base + no_local_whatsits_code, no_local_whatsits_par + 1);
}
} else if ((p >= dimen_base) && (p <= eqtb_size)) {
if (p == (dimen_base + page_left_offset_code)) {
@@ -3117,7 +3111,7 @@ void alter_aux(void)
scan_optional_equals();
if (c == vmode) {
scan_normal_dimen();
- prev_depth = cur_val;
+ prev_depth_par = cur_val;
} else {
scan_int();
if ((cur_val <= 0) || (cur_val > 32767)) {
@@ -3125,7 +3119,7 @@ void alter_aux(void)
help1("I allow only values in the range 1..32767 here.");
int_error(cur_val);
} else {
- space_factor = cur_val;
+ space_factor_par = cur_val;
}
}
}
@@ -3301,7 +3295,7 @@ void issue_message(void)
give a verbose explanation only once. */
print_err("");
print(s);
- if (err_help != null) {
+ if (err_help_par != null) {
use_err_help = true;
} else if (long_help_seen) {
help1("(That was another \\errmessage.)");
@@ -3326,7 +3320,7 @@ the |err_help| parameter.
@c
void give_err_help(void)
{
- token_show(err_help);
+ token_show(err_help_par);
}
@ The \.{\\uppercase} and \.{\\lowercase} commands are implemented by
@@ -3469,7 +3463,7 @@ void show_whatever(void)
end_diagnostic(true);
print_err("OK");
if (selector == term_and_log) {
- if (tracing_online <= 0) {
+ if (tracing_online_par <= 0) {
selector = term_only;
tprint(" (see the transcript file)");
selector = term_and_log;
@@ -3479,7 +3473,7 @@ void show_whatever(void)
if (interaction < error_stop_mode) {
help0();
decr(error_count);
- } else if (tracing_online > 0) {
+ } else if (tracing_online_par > 0) {
help3("This isn't an error message; I'm just \\showing something.",
"Type `I\\show...' to show more (e.g., \\show\\cs,",
"\\showthe\\count10, \\showbox255, \\showlists).");
@@ -3533,7 +3527,7 @@ void initialize(void)
initialize_directions();
initialize_write_files();
seconds_and_micros(epochseconds, microseconds);
- init_start_time(static_pdf);
+ initialize_start_time(static_pdf);
edit_name_start = 0;
stop_at_space = true;
@@ -3560,7 +3554,7 @@ void initialize(void)
for (k = glue_base + 1; k <= local_base - 1; k++) {
eqtb[k] = eqtb[glue_base];
}
- par_shape_ptr = null;
+ par_shape_par_ptr = null;
set_eq_type(par_shape_loc, shape_ref_cmd);
set_eq_level(par_shape_loc, level_one);
for (k = etex_pen_base; k <= (etex_pens - 1); k++)
@@ -3572,7 +3566,7 @@ void initialize(void)
set_eq_level(box_base, level_one);
for (k = box_base + 1; k <= (box_base + biggest_reg); k++)
eqtb[k] = eqtb[box_base];
- cur_font = null_font;
+ cur_font_par = null_font;
set_eq_type(cur_font_loc, data_cmd);
set_eq_level(cur_font_loc, level_one);
set_equiv(cat_code_base, 0);
@@ -3583,15 +3577,15 @@ void initialize(void)
eqtb[uc_code_base] = eqtb[cat_code_base];
eqtb[sf_code_base] = eqtb[cat_code_base];
eqtb[math_code_base] = eqtb[cat_code_base];
- cat_code_table = 0;
+ cat_code_table_par = 0;
initialize_math_codes();
initialize_text_codes();
initex_cat_codes(0);
for (k = '0'; k <= '9'; k++)
- set_math_code(k, var_code, 0, k, level_one);
+ set_math_code(k, math_use_current_family_code, 0, k, level_one);
for (k = 'A'; k <= 'Z'; k++) {
- set_math_code(k, var_code, 1, k, level_one);
- set_math_code((k + 32), var_code, 1, (k + 32), level_one);
+ set_math_code(k, math_use_current_family_code, 1, k, level_one);
+ set_math_code((k + 32), math_use_current_family_code, 1, (k + 32), level_one);
set_lc_code(k, k + 32, level_one);
set_lc_code(k + 32, k + 32, level_one);
set_uc_code(k, k, level_one);
@@ -3602,21 +3596,21 @@ void initialize(void)
eqtb[k].cint = 0;
for (k = attribute_base; k <= del_code_base - 1; k++)
eqtb[k].cint = UNUSED_ATTRIBUTE;
- mag = 1000;
- tolerance = 10000;
- hang_after = 1;
- max_dead_cycles = 25;
- escape_char = '\\';
- end_line_char = carriage_return;
+ mag_par = 1000;
+ tolerance_par = 10000;
+ hang_after_par = 1;
+ max_dead_cycles_par = 25;
+ escape_char_par = '\\';
+ end_line_char_par = carriage_return;
set_del_code('.', 0, 0, 0, 0, level_one); /* this null delimiter is used in error recovery */
- ex_hyphen_char = '-';
- output_box = 255;
+ ex_hyphen_char_par = '-';
+ output_box_par = 255;
for (k = dimen_base; k <= eqtb_size; k++)
eqtb[k].cint = 0;
- page_left_offset = one_inch;
- page_top_offset = one_inch;
- page_right_offset = one_inch;
- page_bottom_offset = one_inch;
+ page_left_offset_par = one_inch;
+ page_top_offset_par = one_inch;
+ page_right_offset_par = one_inch;
+ page_bottom_offset_par = one_inch;
ini_init_primitives();
hash_used = frozen_control_sequence; /* nothing is used */
hash_high = 0;
@@ -3629,8 +3623,8 @@ void initialize(void)
cs_text(frozen_primitive) = maketexstring("primitive");
create_null_font();
font_bytes = 0;
- px_dimen = one_bp;
- math_eqno_gap_step = 1000 ;
+ px_dimen_par = one_bp;
+ math_eqno_gap_step_par = 1000 ;
cs_text(frozen_protection) = maketexstring("inaccessible");
format_ident = maketexstring(" (INITEX)");
cs_text(end_write) = maketexstring("endwrite");
diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
index 64efce9d898..8c0760ae51e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w
@@ -124,7 +124,7 @@ static void unsavemathcode(quarterword gl)
st = mathcode_head->stack[mathcode_head->stack_ptr];
if (st.level > 0) {
rawset_sa_item(mathcode_head, st.code, st.value);
- if (int_par(tracing_restores_code) > 1) {
+ if (tracing_restores_par > 1) {
begin_diagnostic();
print_char('{');
tprint("restoring");
@@ -150,7 +150,7 @@ void set_math_code(int n, int mathclass, int mathfamily, int mathcharacter, quar
v.math_code_value.character_value = mathcharacter;
}
set_sa_item(mathcode_head, n, v, level);
- if (int_par(tracing_assigns_code) > 1) {
+ if (tracing_assigns_par > 1) {
begin_diagnostic();
print_char('{');
tprint("assigning");
@@ -242,7 +242,7 @@ static void unsavedelcode(quarterword gl)
st = delcode_head->stack[delcode_head->stack_ptr];
if (st.level > 0) {
rawset_sa_item(delcode_head, st.code, st.value);
- if (int_par(tracing_restores_code) > 1) {
+ if (tracing_restores_par > 1) {
begin_diagnostic();
print_char('{');
tprint("restoring");
@@ -267,7 +267,7 @@ void set_del_code(int n, int smathfamily, int smathcharacter, int lmathfamily, i
v.del_code_value.large_family_value = lmathfamily;
v.del_code_value.large_character_value = lmathcharacter;
set_sa_item(delcode_head, n, v, gl); /* always global */
- if (int_par(tracing_assigns_code) > 1) {
+ if (tracing_assigns_par > 1) {
begin_diagnostic();
print_char('{');
tprint("assigning");
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w
index bceb4e88ad1..331be47de7d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w
@@ -51,12 +51,7 @@ to italics. Axis are another area of concern, as it looks like opentype math fon
already apply that shift.
@ @c
-#define math_old mathoption_int_par(c_mathoption_old_code)
-#define math_no_italic_compensation mathoption_int_par(c_mathoption_no_italic_compensation_code)
-#define math_no_char_italic mathoption_int_par(c_mathoption_no_char_italic_code)
-#define math_use_old_fraction_scaling mathoption_int_par(c_mathoption_use_old_fraction_scaling_code)
-
-#define is_new_mathfont(A) ((font_math_params(A) >0) && (math_old == 0))
+#define is_new_mathfont(A) ((font_math_params(A) >0) && (math_old_par == 0))
#define is_old_mathfont(A,B) ((font_math_params(A)==0) && (font_params(A)>=(B)))
@
@@ -68,17 +63,6 @@ already apply that shift.
#include "lua/luatex-api.h"
@ @c
-#define delimiter_factor int_par(delimiter_factor_code)
-#define delimiter_shortfall dimen_par(delimiter_shortfall_code)
-#define bin_op_penalty int_par(bin_op_penalty_code)
-#define rel_penalty int_par(rel_penalty_code)
-#define null_delimiter_space dimen_par(null_delimiter_space_code)
-#define script_space dimen_par(script_space_code)
-#define disable_lig int_par(disable_lig_code)
-#define disable_kern int_par(disable_kern_code)
-#define disable_space int_par(disable_space_code)
-#define scripts_mode int_par(math_scripts_mode_code)
-
#define nDEBUG
#define reset_attributes(p,newatt) do { \
@@ -322,8 +306,8 @@ static scaled get_delimiter_height(scaled max_d, scaled max_h, boolean axis) {
/* |delta1| is max distance from axis */
delta1 = delta2;
}
- delta = (delta1 / 500) * delimiter_factor;
- delta2 = delta1 + delta1 - delimiter_shortfall;
+ delta = (delta1 / 500) * delimiter_factor_par;
+ delta2 = delta1 + delta1 - delimiter_shortfall_par;
if (delta < delta2) {
return delta2;
} else {
@@ -884,27 +868,27 @@ backward compatibility with \.{\\scriptspace}.
@c
static void finalize_math_parameters(void)
{
- int saved_trace = int_par(tracing_assigns_code);
- int_par(tracing_assigns_code) = 0;
+ int saved_trace = tracing_assigns_par;
+ tracing_assigns_par = 0;
if (get_math_param(math_param_space_after_script, display_style) == undefined_math_parameter) {
def_math_param(math_param_space_after_script, display_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, text_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, script_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, script_script_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, cramped_display_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, cramped_text_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, cramped_script_style,
- script_space, level_one);
+ script_space_par, level_one);
def_math_param(math_param_space_after_script, cramped_script_script_style,
- script_space, level_one);
+ script_space_par, level_one);
}
- int_par(tracing_assigns_code) = saved_trace;
+ tracing_assigns_par = saved_trace;
}
@ In order to convert mlists to hlists, i.e., noads to nodes, we need several
@@ -968,7 +952,7 @@ static pointer do_fraction_rule(scaled t, pointer att)
{
pointer p; /* the new node */
p = new_rule(normal_rule);
- rule_dir(p) = math_direction;
+ rule_dir(p) = math_direction_par;
height(p) = t;
depth(p) = 0;
reset_attributes(p, att);
@@ -991,7 +975,7 @@ static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att)
p = new_kern(ht);
reset_attributes(p, att);
couple_nodes(p,q);
- q = vpackage(p, 0, additional, max_dimen, math_direction);
+ q = vpackage(p, 0, additional, max_dimen, math_direction_par);
reset_attributes(q, att);
return q;
}
@@ -1134,7 +1118,7 @@ static pointer get_delim_box(pointer q, extinfo * ext, internal_font_number f, s
NULL
};
tex_error("Variant part doesn't exist.", hlp);
- width(b) = null_delimiter_space;
+ width(b) = null_delimiter_space_par;
return b;
}
if (cur->extender > 0)
@@ -1447,7 +1431,7 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
width(b) = 0;
} else {
/* use this width if no delimiter was found */
- width(b) = null_delimiter_space;
+ width(b) = null_delimiter_space_par;
}
if (delta != NULL) {
*delta = 0;
@@ -1595,7 +1579,6 @@ void run_mlist_to_hlist(halfword p, boolean penalties, int mstyle)
{
int callback_id;
int a, sfix;
- lua_State *L = Luas;
if (p == null) {
vlink(temp_head) = null;
return;
@@ -1603,26 +1586,26 @@ void run_mlist_to_hlist(halfword p, boolean penalties, int mstyle)
finalize_math_parameters();
callback_id = callback_defined(mlist_to_hlist_callback);
if (callback_id > 0) {
- sfix = lua_gettop(L);
- if (!get_callback(L, callback_id)) {
- lua_settop(L, sfix);
+ sfix = lua_gettop(Luas);
+ if (!get_callback(Luas, callback_id)) {
+ lua_settop(Luas, sfix);
return;
}
alink(p) = null ;
- nodelist_to_lua(L, p);
- lua_push_math_style_name(L,mstyle);
- lua_pushboolean(L, penalties);
- if (lua_pcall(L, 3, 1, 0) != 0) { /* 3 args, 1 result */
+ nodelist_to_lua(Luas, p);
+ lua_push_math_style_name(Luas, mstyle);
+ lua_pushboolean(Luas, penalties);
+ if (lua_pcall(Luas, 3, 1, 0) != 0) { /* 3 args, 1 result */
char errmsg[256]; /* temp hack ... we will have a formatted error */
- snprintf(errmsg, 255, "error: %s\n", lua_tostring(L, -1));
+ snprintf(errmsg, 255, "error: %s\n", lua_tostring(Luas, -1));
errmsg[255]='\0';
- lua_settop(L, sfix);
+ lua_settop(Luas, sfix);
normal_error("mlist to hlist",errmsg); /* to be done */
return;
}
- a = nodelist_from_lua(L);
+ a = nodelist_from_lua(Luas);
/* alink(vlink(a)) = null; */
- lua_settop(L, sfix);
+ lua_settop(Luas, sfix);
vlink(temp_head) = a;
} else if (callback_id == 0) {
mlist_to_hlist(p, penalties, mstyle);
@@ -1803,7 +1786,7 @@ static void make_under(pointer q, int cur_style)
couple_nodes(x,p);
r = do_fraction_rule(underbar_rule(cur_style), node_attr(q));
couple_nodes(p,r);
- y = vpackage(x, 0, additional, max_dimen, math_direction);
+ y = vpackage(x, 0, additional, max_dimen, math_direction_par);
reset_attributes(y, node_attr(q));
delta = height(y) + depth(y) + underbar_kern(cur_style);
height(y) = height(x);
@@ -2304,7 +2287,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
/* just take the center */
sa = half(width(y));
}
- if (math_direction == dir_TRT) {
+ if (math_direction_par == dir_TRT) {
shift_amount(y) = s + sa - width(y);
} else {
shift_amount(y) = s - sa;
@@ -2312,7 +2295,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
} else {
if (width(y)== 0) {
shift_amount(y) = s + w;
- } else if (math_direction == dir_TRT) {
+ } else if (math_direction_par == dir_TRT) {
shift_amount(y) = s + width(y); /* ok? */
} else {
shift_amount(y) = s + half(w - width(y));
@@ -2328,7 +2311,7 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c, int fl
couple_nodes(x,y);
y = x;
}
- r = vpackage(y, 0, additional, max_dimen, math_direction);
+ r = vpackage(y, 0, additional, max_dimen, math_direction_par);
reset_attributes(r, node_attr(q));
width(r) = width(x);
y = r;
@@ -2564,7 +2547,7 @@ static void make_fraction(pointer q, int cur_style)
point to it
*/
if (is_new_mathfont(cur_f)) {
- if (math_use_old_fraction_scaling) {
+ if (math_use_old_fraction_scaling_par) {
delta = fraction_del_size_old(cur_style);
} else {
delta = fraction_del_size_new(cur_style);
@@ -2711,7 +2694,7 @@ static scaled make_op(pointer q, int cur_style)
type(v) = vlist_node;
if (is_new_mathfont(cur_f)) {
n = null;
- if (! math_no_italic_compensation) {
+ if (! math_no_italic_compensation_par) {
n = nucleus(q);
if (n != null) {
if ((type(n) == sub_mlist_node) || (type(n) == sub_box_node)) {
@@ -2885,7 +2868,7 @@ static void make_ord(pointer q)
ligatures only when this convention makes sense
*/
- if (disable_lig == 0 && has_lig(cur_f, a)) {
+ if (disable_lig_par == 0 && has_lig(cur_f, a)) {
lig = get_ligature(cur_f, a, cur_c);
if (is_valid_ligature(lig)) {
check_interrupt(); /* allow a way out of infinite ligature loop */
@@ -2941,7 +2924,7 @@ static void make_ord(pointer q)
goto RESTART;
}
}
- if (disable_kern == 0 && has_kern(cur_f, a)) {
+ if (disable_kern_par == 0 && has_kern(cur_f, a)) {
/* todo: should this use mathkerns? */
k = get_kern(cur_f, a, cur_c);
if (k != 0) {
@@ -3239,7 +3222,7 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled
*/
x = clean_box(subscr(q), sub_style(cur_style), cur_style);
width(x) = width(x) + space_after_script(cur_style);
- switch (scripts_mode) {
+ switch (scripts_mode_par) {
case 1:
shift_down = sub_shift_down(cur_style) ;
break;
@@ -3289,7 +3272,7 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled
*/
x = clean_box(supscr(q), sup_style(cur_style), cur_style);
width(x) = width(x) + space_after_script(cur_style);
- switch (scripts_mode) {
+ switch (scripts_mode_par) {
case 1:
shift_up = sup_shift_up(cur_style);
break;
@@ -3344,7 +3327,7 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled
*/
y = clean_box(subscr(q), sub_style(cur_style), cur_style);
width(y) = width(y) + space_after_script(cur_style);
- switch (scripts_mode) {
+ switch (scripts_mode_par) {
case 1:
shift_down = sub_shift_down(cur_style) ;
break;
@@ -3413,7 +3396,7 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled
couple_nodes(x,p);
couple_nodes(p,y);
/* we end up with funny dimensions */
- x = vpackage(x, 0, additional, max_dimen, math_direction);
+ x = vpackage(x, 0, additional, max_dimen, math_direction_par);
reset_attributes(x, node_attr(q));
shift_amount(x) = shift_down;
}
@@ -3758,7 +3741,7 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_styl
p = new_glyph(cur_f, cur_c);
reset_attributes(p, node_attr(nucleus(q)));
if (is_new_mathfont(cur_f)) {
- if (! math_no_char_italic) {
+ if (! math_no_char_italic_par) {
/* keep italic, but bad with two successive letters */
} else if (get_char_cat_code(cur_c) == 11) {
/* no italic correction in mid-word of text font */
@@ -4087,10 +4070,10 @@ void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
t_subtype = subtype(q);
switch (t_subtype) {
case bin_noad_type:
- pen = bin_op_penalty;
+ pen = bin_op_penalty_par;
break;
case rel_noad_type:
- pen = rel_penalty;
+ pen = rel_penalty_par;
break;
case vcenter_noad_type:
case over_noad_type:
diff --git a/Build/source/texk/web2c/luatexdir/tex/nesting.w b/Build/source/texk/web2c/luatexdir/tex/nesting.w
index 045bf78febe..d9e7cf744ee 100644
--- a/Build/source/texk/web2c/luatexdir/tex/nesting.w
+++ b/Build/source/texk/web2c/luatexdir/tex/nesting.w
@@ -19,14 +19,11 @@
@ @c
-
#include "ptexlib.h"
@ these are for |show_activities|
@c
#define page_goal page_so_far[0]
-#define count(A) eqtb[count_base+(A)].cint
-
@ \TeX\ is typically in the midst of building many lists at once. For example,
when a math formula is being processed, \TeX\ is in math mode and
@@ -251,9 +248,7 @@ void initialize_nesting(void)
init_math_fields();
}
-
-
-@ Here is a common way to make the current list grow:
+@ Here is a common way to make the current list grow:
@c
void tail_append(halfword p)
@@ -262,7 +257,6 @@ void tail_append(halfword p)
cur_list.tail_field = vlink(cur_list.tail_field);
}
-
@ @c
halfword pop_tail(void)
{
@@ -311,7 +305,6 @@ void push_nest(void)
init_math_fields();
}
-
@ Conversely, when \TeX\ is finished on the current level, the former
state is restored by calling |pop_nest|. This routine will never be
called at the lowest semantic level, nor will it be called unless |head|
@@ -324,7 +317,7 @@ void pop_nest(void)
decr(nest_ptr);
}
-@ Here is a procedure that displays what \TeX\ is working on, at all levels.
+@ Here is a procedure that displays what \TeX\ is working on, at all levels.
@c
void show_activities(void)
@@ -343,7 +336,7 @@ void show_activities(void)
print_int(abs(nest[p].ml_field));
/* we dont do this any more */
#if 0
-
+
if (m == hmode)
if (nest[p].pg_field != 040600000) {
tprint(" (language");
diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.w b/Build/source/texk/web2c/luatexdir/tex/packaging.w
index 4a5ab77c690..ba0a5d764ac 100644
--- a/Build/source/texk/web2c/luatexdir/tex/packaging.w
+++ b/Build/source/texk/web2c/luatexdir/tex/packaging.w
@@ -21,17 +21,6 @@
#include "ptexlib.h"
-@ @c
-#define scan_normal_dimen() scan_dimen(false,false,false)
-
-#define prev_depth cur_list.prev_depth_field
-#define space_factor cur_list.space_factor_field
-#define box(A) eqtb[box_base+(A)].hh.rh
-
-#define every_hbox equiv(every_hbox_loc)
-#define every_vbox equiv(every_vbox_loc)
-#define box_max_depth dimen_par(box_max_depth_code)
-
@ We're essentially done with the parts of \TeX\ that are concerned with the
input (|get_next|) and the output (|ship_out|). So it's time to get heavily into
the remaining part, which does the real work of typesetting.
@@ -286,7 +275,7 @@ void scan_full_spec(group_code c, int spec_direction, int just_pack)
if (! done) {
scan_left_brace();
}
- /* no gain: if (body_direction != spec_direction) etc */
+ /* no gain: if (body_direction_par != spec_direction) etc */
eq_word_define(int_base + body_direction_code, spec_direction);
eq_word_define(int_base + par_direction_code, spec_direction);
eq_word_define(int_base + text_direction_code, spec_direction);
@@ -439,7 +428,7 @@ scaled kern_stretch(halfword p)
return 0;
}
/* we use the old logic, kind of, but average the ef as we might depend on proper overlap */
- m = (font_max_shrink(font(l)) + font_max_shrink(font(r)))/2;
+ m = (font_max_stretch(font(l)) + font_max_stretch(font(r)))/2;
if (m == 0) {
/* nothing to kern */
return 0;
@@ -478,7 +467,7 @@ scaled kern_shrink(halfword p)
// and a reason to kern
if ((font(l) != font(r)) || (font_max_shrink(font(l)) == 0))
return 0;
- m = font_max_stretch(font(l));
+ m = font_max_shrink(font(l));
d = get_kern(font(l), character(l), character(r)); // real kern, so what is width(p) then; the messed up one
d = round_xn_over_d(d, 1000 - m, 1000);
return round_xn_over_d(width(p) - d, get_ef_code(font(l), character(l)), 1000);
@@ -632,7 +621,7 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
halfword pack_interrupt[8];
scaled font_stretch = 0;
scaled font_shrink = 0;
- int adjust_spacing = int_par(adjust_spacing_code);
+ int adjust_spacing = adjust_spacing_par;
/*
int font_expand_ratio = 0;
@@ -640,7 +629,7 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
last_badness = 0;
r = new_node(hlist_node, min_quarterword); /* the box node that will be returned */
if (pack_direction == -1) {
- hpack_dir = text_direction;
+ hpack_dir = text_direction_par;
} else {
hpack_dir = pack_direction;
}
@@ -943,7 +932,7 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
is sufficiently bad.
*/
last_badness = badness(x, total_stretch[normal]);
- if (last_badness > int_par(hbadness_code)) {
+ if (last_badness > hbadness_par) {
int callback_id = callback_defined(hpack_quality_callback);
if (callback_id > 0) {
halfword rule = null;
@@ -1010,15 +999,15 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
Report an overfull hbox and |goto common_ending|, if this box
is sufficiently bad.
*/
- if ((overshoot > dimen_par(hfuzz_code)) || (int_par(hbadness_code) < 100)) {
+ if ((overshoot > hfuzz_par) || (hbadness_par < 100)) {
int callback_id = callback_defined(hpack_quality_callback);
halfword rule = null;
if (callback_id > 0) {
run_callback(callback_id, "SdNdd->N","overfull",overshoot,r,abs(pack_begin_line),line,&rule);
- } else if (dimen_par(overfull_rule_code) > 0) {
+ } else if (overfull_rule_par > 0) {
rule = new_rule(normal_rule);
rule_dir(rule) = box_dir(r);
- width(rule) = dimen_par(overfull_rule_code);
+ width(rule) = overfull_rule_par;
}
if (rule != null) {
while (vlink(q) != null) {
@@ -1041,7 +1030,7 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
sufficiently bad.
*/
last_badness = badness(-x, total_shrink[normal]);
- if (last_badness > int_par(hbadness_code)) {
+ if (last_badness > hbadness_par) {
int callback_id = callback_defined(hpack_quality_callback);
if (callback_id > 0) {
halfword rule = null;
@@ -1119,7 +1108,7 @@ halfword filtered_hpack(halfword p, halfword qt, scaled w, int m, int grp, int p
q = vlink(p);
/*
q = new_node(hlist_node, min_quarterword);
- box_dir(q) = (pac == -1) ? text_direction : pac;
+ box_dir(q) = (pac == -1) ? text_direction_par : pac;
width(q) = w;
return q;
*/
@@ -1147,7 +1136,7 @@ scaled_whd natural_sizes(halfword p, halfword pp, glue_ratio g_mult,
scaled gp = 0;
scaled gm = 0;
if (pack_direction == -1) {
- hpack_dir = text_direction;
+ hpack_dir = text_direction_par;
} else {
hpack_dir = pack_direction;
}
@@ -1292,7 +1281,7 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
last_badness = 0;
r = new_node(vlist_node, 0);
if (pack_direction == -1) {
- box_dir(r) = body_direction;
+ box_dir(r) = body_direction_par;
} else {
box_dir(r) = pack_direction;
}
@@ -1434,7 +1423,7 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
is sufficiently bad.
*/
last_badness = badness(x, total_stretch[normal]);
- if (last_badness > int_par(vbadness_code)) {
+ if (last_badness > vbadness_par) {
int callback_id = callback_defined(vpack_quality_callback);
if (callback_id > 0) {
if (last_badness > 100) {
@@ -1492,7 +1481,7 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
Report an overfull vbox and |goto common_ending|, if this box
is sufficiently bad.
*/
- if ((overshoot > dimen_par(vfuzz_code)) || (int_par(vbadness_code) < 100)) {
+ if ((overshoot > vfuzz_par) || (vbadness_par < 100)) {
int callback_id = callback_defined(vpack_quality_callback);
if (callback_id > 0) {
run_callback(callback_id, "SdNdd->","overfull",overshoot,r,abs(pack_begin_line),line);
@@ -1512,7 +1501,7 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
sufficiently bad.
*/
last_badness = badness(-x, total_shrink[normal]);
- if (last_badness > int_par(vbadness_code)) {
+ if (last_badness > vbadness_par) {
int callback_id = callback_defined(vpack_quality_callback);
if (callback_id > 0) {
run_callback(callback_id, "SdNdd->","tight",last_badness,r,abs(pack_begin_line),line);
@@ -1579,7 +1568,7 @@ void package(int c)
{
halfword saved0, saved2, saved3, saved4;
int grp = cur_group;
- scaled d = box_max_depth; /* max depth */
+ scaled d = box_max_depth_par; /* max depth */
unsave();
save_ptr -= 5;
saved0 = saved_value(0);
@@ -1633,23 +1622,23 @@ void append_to_vlist(halfword b, int location)
halfword result = null;
halfword next_depth = ignore_depth;
boolean prev_set = false ;
- if (lua_appendtovlist_callback(b,location,prev_depth,mirrored,&result,&next_depth,&prev_set)) {
+ if (lua_appendtovlist_callback(b,location,prev_depth_par,mirrored,&result,&next_depth,&prev_set)) {
while (result != null) {
couple_nodes(cur_list.tail_field, result);
cur_list.tail_field = result;
result = vlink(result);
}
if (prev_set) {
- prev_depth = next_depth;
+ prev_depth_par = next_depth;
}
} else {
- if (prev_depth > ignore_depth) {
+ if (prev_depth_par > ignore_depth) {
if (mirrored) {
- d = width(glue_par(baseline_skip_code)) - prev_depth - depth(b);
+ d = width(baseline_skip_par) - prev_depth_par - depth(b);
} else {
- d = width(glue_par(baseline_skip_code)) - prev_depth - height(b);
+ d = width(baseline_skip_par) - prev_depth_par - height(b);
}
- if (d < dimen_par(line_skip_limit_code)) {
+ if (d < line_skip_limit_par) {
p = new_param_glue(line_skip_code);
} else {
p = new_skip_param(baseline_skip_code);
@@ -1661,9 +1650,9 @@ void append_to_vlist(halfword b, int location)
couple_nodes(cur_list.tail_field, b);
cur_list.tail_field = b;
if (mirrored) {
- prev_depth = height(b);
+ prev_depth_par = height(b);
} else {
- prev_depth = depth(b);
+ prev_depth_par = depth(b);
}
}
}
@@ -1959,7 +1948,7 @@ halfword vsplit(halfword n, scaled h, int m)
error();
return null;
}
- q = vert_break(list_ptr(v), h, dimen_par(split_max_depth_code));
+ q = vert_break(list_ptr(v), h, split_max_depth_par);
/*
Look at all the marks in nodes before the break, and set the final
link to |null| at the break. It's possible that the box begins with
@@ -1990,7 +1979,7 @@ halfword vsplit(halfword n, scaled h, int m)
p = vlink(p);
}
}
- q = prune_page_top(q, int_par(saving_vdiscards_code) > 0);
+ q = prune_page_top(q, saving_vdiscards_par > 0);
p = list_ptr(v);
list_ptr(v) = null;
flush_node(v);
@@ -1998,12 +1987,12 @@ halfword vsplit(halfword n, scaled h, int m)
/* the |eq_level| of the box stays the same */
box(n) = null;
} else {
- box(n) = filtered_vpackage(q, 0, additional, dimen_par(max_depth_code), split_keep_group, vdir, 0, 0);
+ box(n) = filtered_vpackage(q, 0, additional, max_depth_par, split_keep_group, vdir, 0, 0);
}
if (m == exactly) {
- return filtered_vpackage(p, h, exactly, dimen_par(split_max_depth_code), split_off_group, vdir, 0, 0);
+ return filtered_vpackage(p, h, exactly, split_max_depth_par, split_off_group, vdir, 0, 0);
} else {
- return filtered_vpackage(p, 0, additional, dimen_par(max_depth_code), split_off_group, vdir, 0, 0);
+ return filtered_vpackage(p, 0, additional, max_depth_par, split_off_group, vdir, 0, 0);
}
}
@@ -2020,6 +2009,7 @@ void begin_box(int box_context)
int n; /* a box number */
int spec_direction = -1;
int just_pack = 0;
+ int split_mode = exactly ;
switch (cur_chr) {
case box_code:
scan_register_num();
@@ -2077,15 +2067,17 @@ void begin_box(int box_context)
*/
scan_register_num();
n = cur_val;
- if (!scan_keyword("to")) {
+ if (scan_keyword("upto")) {
+ split_mode = additional ;
+ } else if (!scan_keyword("to")) {
print_err("Missing `to' inserted");
help2("I'm working on `\\vsplit<box number> to <dimen>';",
"will look for the <dimen> next.");
error();
}
scan_normal_dimen();
- cur_box = vsplit(n, cur_val, additional);
- break;
+ cur_box = vsplit(n, cur_val, split_mode);
+ break;
default:
/*
Initiate the construction of an hbox or vbox, then |return|. Here is
@@ -2111,13 +2103,13 @@ void begin_box(int box_context)
set_saved_record(0, saved_boxcontext, 0, box_context);
switch (abs(cur_list.mode_field)) {
case vmode:
- spec_direction = body_direction;
+ spec_direction = body_direction_par;
break;
case hmode:
- spec_direction = text_direction;
+ spec_direction = text_direction_par;
break;
case mmode:
- spec_direction = math_direction;
+ spec_direction = math_direction_par;
break;
}
if (k == hmode) {
@@ -2137,13 +2129,13 @@ void begin_box(int box_context)
push_nest();
cur_list.mode_field = -k;
if (k == vmode) {
- prev_depth = ignore_depth;
- if (every_vbox != null)
- begin_token_list(every_vbox, every_vbox_text);
+ prev_depth_par = ignore_depth;
+ if (every_vbox_par != null)
+ begin_token_list(every_vbox_par, every_vbox_text);
} else {
- space_factor = 1000;
- if (every_hbox != null)
- begin_token_list(every_hbox, every_hbox_text);
+ space_factor_par = 1000;
+ if (every_hbox_par != null)
+ begin_token_list(every_hbox_par, every_hbox_text);
}
return;
break;
diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.w b/Build/source/texk/web2c/luatexdir/tex/primitive.w
index a173e133d44..8c6592c9edf 100644
--- a/Build/source/texk/web2c/luatexdir/tex/primitive.w
+++ b/Build/source/texk/web2c/luatexdir/tex/primitive.w
@@ -555,7 +555,7 @@ void print_cmd_chr(quarterword cmd, halfword chr_code)
print_hex(chr_code);
break;
case math_given_cmd:
- if (mathoption_int_par(c_mathoption_umathcode_meaning_code) == 1) {
+ if (math_umathcode_meaning_par == 1) {
tprint_esc("Umathchar");
show_mathcode_value(mathchar_from_integer(chr_code, tex_mathcode));
} else {
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index 478d55f88ba..006392810b9 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -22,8 +22,6 @@
#include "lua/luatex-api.h" /* for luatex_banner */
@ @c
-#define font_id_text(A) cs_text(font_id_base+(A))
-
#define wlog(A) fputc(A,log_file)
#define wterm(A) fputc(A,term_out)
@@ -182,7 +180,7 @@ void print_char(int s)
formatted_warning("print","weird character %i",s);
return;
}
- if (s == int_par(new_line_char_code)) {
+ if (s == new_line_char_par) {
if (selector < pseudo) {
print_ln();
return;
@@ -270,7 +268,7 @@ void print(int s)
print_char(s);
return;
}
- if (s == int_par(new_line_char_code)) {
+ if (s == new_line_char_par) {
if (selector < pseudo) {
print_ln();
return;
@@ -364,7 +362,7 @@ void tprint(const char *sss)
{
char *buffer = NULL;
int i = 0; /* buffer index */
- int newlinechar = int_par(new_line_char_code);
+ int newlinechar = new_line_char_par;
int dolog = 0;
int doterm = 0;
switch (selector) {
@@ -509,22 +507,22 @@ void log_banner(const char *v)
"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
};
- unsigned month = (unsigned) int_par(month_code);
+ unsigned month = (unsigned) month_par;
if (month > 12)
month = 0;
fprintf(log_file, "This is " MyName ", Version %s%s ", v, WEB2CVERSION);
print(format_ident);
print_char(' ');
print_char(' ');
- print_int(int_par(day_code));
+ print_int(day_par);
print_char(' ');
fprintf(log_file, "%s", months[month]);
print_char(' ');
- print_int(int_par(year_code));
+ print_int(year_par);
print_char(' ');
- print_two(int_par(time_code) / 60);
+ print_two(time_par / 60);
print_char(':');
- print_two(int_par(time_code) % 60);
+ print_two(time_par % 60);
if (shellenabledp) {
wlog_cr();
wlog(' ');
@@ -550,7 +548,7 @@ the user's escape character (which is usually a backslash).
@c
void print_esc(str_number s)
{
- int c = int_par(escape_char_code); /* Set variable |c| to the current escape character */
+ int c = escape_char_par; /* Set variable |c| to the current escape character */
if (c >= 0 && c < STRING_OFFSET)
print(c);
print(s);
@@ -561,7 +559,7 @@ void print_esc(str_number s)
@c
void tprint_esc(const char *s)
{
- int c = int_par(escape_char_code); /* Set variable |c| to the current escape character */
+ int c = escape_char_par; /* Set variable |c| to the current escape character */
if (c >= 0 && c < STRING_OFFSET)
print(c);
tprint(s);
@@ -724,8 +722,7 @@ void print_cs(int p)
} else {
print_esc(t);
if (single_letter(t)) {
- if (get_cat_code(int_par(cat_code_table_code),
- pool_to_unichar(str_string(t))) == letter_cmd)
+ if (get_cat_code(cat_code_table_par, pool_to_unichar(str_string(t))) == letter_cmd)
print_char(' ');
} else {
print_char(' ');
@@ -851,7 +848,7 @@ void print_font_identifier(internal_font_number f)
tprint_esc("FONT");
print_int(f);
}
- if (int_par(tracing_fonts_code) > 0) {
+ if (tracing_fonts_par > 0) {
tprint(" (");
print_font_name(f);
if (font_size(f) != font_dsize(f)) {
@@ -955,8 +952,8 @@ int breadth_max; /* maximum number of items shown at the same list level */
@c
void show_box(halfword p)
{
- depth_threshold = int_par(show_box_depth_code);
- breadth_max = int_par(show_box_breadth_code);
+ depth_threshold = show_box_depth_par;
+ breadth_max = show_box_breadth_par;
if (breadth_max <= 0)
breadth_max = 5;
/* the show starts at |p| */
@@ -1072,7 +1069,7 @@ Here are two routines that adjust the destination of print commands:
void begin_diagnostic(void)
{
global_old_setting = selector;
- if ((int_par(tracing_online_code) <= 0) && (selector == term_and_log)) {
+ if ((tracing_online_par <= 0) && (selector == term_and_log)) {
decr(selector);
if (history == spotless)
history = warning_issued;
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.h b/Build/source/texk/web2c/luatexdir/tex/scanning.h
index 729fcda20ef..f5f620c6746 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.h
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.h
@@ -45,6 +45,8 @@ extern void scan_something_internal(int level, boolean negative);
extern void scan_limited_int(int max, const char *name);
+extern void negate_cur_val(boolean delete_glue);
+
# define scan_register_num() scan_limited_int(65535,"register code")
# define scan_mark_num() scan_limited_int(65535,"marks code")
# define scan_char_num() scan_limited_int(biggest_char,"character code")
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w
index 907d25f5bac..658f149adaf 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.w
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w
@@ -22,19 +22,6 @@
#include "ptexlib.h"
@ @c
-#define prev_depth cur_list.prev_depth_field
-#define space_factor cur_list.space_factor_field
-#define par_shape_ptr equiv(par_shape_loc)
-#define font_id_text(A) cs_text(font_id_base+(A))
-
-#define attribute(A) eqtb[attribute_base+(A)].hh.rh
-#define dimen(A) eqtb[scaled_base+(A)].hh.rh
-#undef skip
-#define skip(A) eqtb[skip_base+(A)].hh.rh
-#define mu_skip(A) eqtb[mu_skip_base+(A)].hh.rh
-#define count(A) eqtb[count_base+(A)].hh.rh
-#define box(A) equiv(box_base+(A))
-
static void scan_expr(void);
@ Let's turn now to some procedures that \TeX\ calls upon frequently to digest
@@ -165,7 +152,7 @@ static void downgrade_cur_val(boolean delete_glue)
decr(cur_val_level);
}
-static void negate_cur_val(boolean delete_glue)
+void negate_cur_val(boolean delete_glue)
{
halfword m;
if (cur_val_level >= glue_val_level) {
@@ -208,6 +195,9 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
scanned_result(eqtb[m].cint, int_val_level);
break;
case assign_dir_cmd:
+ if (m == (int_base + line_direction_code)) {
+ m = int_base + text_direction_code;
+ }
scanned_result(eqtb[m].cint, dir_val_level);
break;
case assign_dimen_cmd:
@@ -215,11 +205,9 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
break;
case assign_glue_cmd:
scanned_result(equiv(m), glue_val_level);
-// cur_val = new_spec(cur_val);
break;
case assign_mu_glue_cmd:
scanned_result(equiv(m), mu_val_level);
-// cur_val = new_spec(cur_val);
break;
case math_style_cmd:
scanned_result(m, int_val_level);
@@ -239,9 +227,9 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
else
scanned_result(0, int_val_level);
} else if (m == vmode) {
- scanned_result(prev_depth, dimen_val_level);
+ scanned_result(prev_depth_par, dimen_val_level);
} else {
- scanned_result(space_factor, int_val_level);
+ scanned_result(space_factor_par, int_val_level);
}
break;
case set_prev_graf_cmd:
@@ -279,10 +267,10 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
break;
case set_tex_shape_cmd:
/* Fetch the |par_shape| size */
- if (par_shape_ptr == null)
+ if (par_shape_par_ptr == null)
cur_val = 0;
else
- cur_val = vinfo(par_shape_ptr + 1);
+ cur_val = vinfo(par_shape_par_ptr + 1);
cur_val_level = int_val_level;
break;
case set_etex_shape_cmd:
@@ -381,17 +369,17 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
case par_shape_dimen_code:
q = cur_chr - par_shape_length_code;
scan_int();
- if ((par_shape_ptr == null) || (cur_val <= 0)) {
+ if ((par_shape_par_ptr == null) || (cur_val <= 0)) {
cur_val = 0;
} else {
if (q == 2) {
q = cur_val % 2;
cur_val = (cur_val + q) / 2;
}
- if (cur_val > vinfo(par_shape_ptr + 1))
- cur_val = vinfo(par_shape_ptr + 1);
+ if (cur_val > vinfo(par_shape_par_ptr + 1))
+ cur_val = vinfo(par_shape_par_ptr + 1);
cur_val =
- varmem[par_shape_ptr + 2 * cur_val - q + 1].cint;
+ varmem[par_shape_par_ptr + 2 * cur_val - q + 1].cint;
}
cur_val_level = dimen_val_level;
break;
@@ -531,7 +519,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
break;
case lastskip_code:
if (last_glue != max_halfword)
- cur_val = last_glue; /* maybe new_glue */
+ cur_val = last_glue; /* maybe new_glue */
break;
case last_node_type_code:
cur_val = last_node_type;
@@ -614,7 +602,7 @@ void scan_something_internal(int level, boolean negative)
cur_val1 = get_sf_code(cur_val);
scanned_result(cur_val1, int_val_level);
} else if (m == cat_code_base) {
- cur_val1 = get_cat_code(int_par(cat_code_table_code), cur_val);
+ cur_val1 = get_cat_code(cat_code_table_par, cur_val);
scanned_result(cur_val1, int_val_level);
} else {
confusion("def_char");
@@ -690,11 +678,11 @@ void scan_something_internal(int level, boolean negative)
} else {
cur_val1 = get_math_param(cur_val1, cur_chr);
if (cur_val1 == thin_mu_skip_code)
- cur_val1 = glue_par(thin_mu_skip_code);
+ cur_val1 = thin_mu_skip_par;
else if (cur_val1 == med_mu_skip_code)
- cur_val1 = glue_par(med_mu_skip_code);
+ cur_val1 = med_mu_skip_par;
else if (cur_val1 == thick_mu_skip_code)
- cur_val1 = glue_par(thick_mu_skip_code);
+ cur_val1 = thick_mu_skip_par;
scanned_result(cur_val1, mu_val_level);
}
break;
@@ -803,28 +791,28 @@ void scan_something_internal(int level, boolean negative)
goto DEFAULT;
break;
case 2:
- cur_val = get_pre_hyphen_char(int_par(language_code));
+ cur_val = get_pre_hyphen_char(language_par);
cur_val_level = int_val_level;
break;
case 3:
- cur_val = get_post_hyphen_char(int_par(language_code));
+ cur_val = get_post_hyphen_char(language_par);
cur_val_level = int_val_level;
break;
case 4:
- cur_val = get_pre_exhyphen_char(int_par(language_code));
+ cur_val = get_pre_exhyphen_char(language_par);
cur_val_level = int_val_level;
break;
case 5:
- cur_val = get_post_exhyphen_char(int_par(language_code));
+ cur_val = get_post_exhyphen_char(language_par);
cur_val_level = int_val_level;
break;
case 6:
- cur_val = get_hyphenation_min(int_par(language_code));
+ cur_val = get_hyphenation_min(language_par);
cur_val_level = int_val_level;
break;
case 7:
scan_int();
- cur_val = get_hj_code(int_par(language_code),cur_val);
+ cur_val = get_hj_code(language_par,cur_val);
cur_val_level = int_val_level;
break;
}
@@ -1192,15 +1180,16 @@ static void scan_dimen_out_of_range_error(void) {
void scan_dimen(boolean mu, boolean inf, boolean shortcut)
{
- boolean negative; /* should the answer be negated? */
- int f = 0; /* numerator of a fraction whose denominator is $2^{16}$ */
- int num, denom; /* conversion ratio for the scanned units */
- halfword q; /* top of decimal digit stack */
- scaled v; /* an internal dimension */
- int save_cur_val; /* temporary storage of |cur_val| */
+ boolean negative = false; /* should the answer be negated? */
+ boolean is_true = false;
+ int f = 0; /* numerator of a fraction whose denominator is $2^{16}$ */
+ int num = 0; /* conversion ratio for the scanned units */
+ int denom = 0;
+ halfword q; /* top of decimal digit stack */
+ scaled v; /* an internal dimension */
+ int save_cur_val; /* temporary storage of |cur_val| */
arith_error = false;
cur_order = normal;
- negative = false;
if (!shortcut) {
/* Get the next non-blank non-sign... */
do {
@@ -1370,7 +1359,7 @@ void scan_dimen(boolean mu, boolean inf, boolean shortcut)
} else if (scan_keyword("ex")) {
v = x_height(get_cur_font());
} else if (scan_keyword("px")) {
- v = dimen_par(px_dimen_code);
+ v = px_dimen_par;
} else {
goto PICKUP_UNIT;
}
@@ -1388,7 +1377,7 @@ void scan_dimen(boolean mu, boolean inf, boolean shortcut)
*/
PICKUP_UNIT:
if (scan_keyword("pt")) {
- goto ATTACH_FRACTION; /* the easy case */
+ goto SCALE_VALUE; /* the easy case */
} else if (scan_keyword("mm")) {
set_conversion(7227, 2540);
goto SCALE_VALUE;
@@ -1418,28 +1407,37 @@ void scan_dimen(boolean mu, boolean inf, boolean shortcut)
} else if (scan_keyword("nc")) {
set_conversion(1370, 107);
goto SCALE_VALUE;
- } else if (scan_keyword("true")) {
- /* Adjust (f)for the magnification ratio */
- if (output_mode_used == OMODE_DVI) {
+ } else if (!is_true && scan_keyword("true")) {
+ is_true = true;
+ goto PICKUP_UNIT;
+ }
+ /* Complain about unknown unit and |goto done2| */
+ scan_dimen_unknown_unit_error();
+ goto BAD_NEWS;
+ SCALE_VALUE:
+ /* Adjust (f) for the magnification ratio */
+ if (is_true) {
+ /* maybe at some point we will drop mag completely, even in dvi mode */
+ if (output_mode_used <= OMODE_DVI) {
prepare_mag();
- if (int_par(mag_code) != 1000) {
- cur_val = xn_over_d(cur_val, 1000, int_par(mag_code));
- f = (1000 * f + 0200000 * tex_remainder) / int_par(mag_code);
+ if (mag_par != 1000) {
+ cur_val = xn_over_d(cur_val, 1000, mag_par);
+ f = (1000 * f + 0200000 * tex_remainder) / mag_par;
cur_val = cur_val + (f / 0200000);
f = f % 0200000;
}
+ } else {
+ /* in pdf mode we're always true */
+ one_true_inch = one_inch; /* saveguard */
}
- goto PICKUP_UNIT;
- } else {
- /* Complain about unknown unit and |goto done2| */
- scan_dimen_unknown_unit_error();
- goto BAD_NEWS;
}
- SCALE_VALUE:
- cur_val = xn_over_d(cur_val, num, denom);
- f = (num * f + 0200000 * tex_remainder) / denom;
- cur_val = cur_val + (f / 0200000);
- f = f % 0200000;
+ /* */
+ if (num) {
+ cur_val = xn_over_d(cur_val, num, denom);
+ f = (num * f + 0200000 * tex_remainder) / denom;
+ cur_val = cur_val + (f / 0200000);
+ f = f % 0200000;
+ }
BAD_NEWS:
ATTACH_FRACTION:
if (cur_val >= 040000) {
@@ -1837,11 +1835,11 @@ halfword scan_rule_spec(void)
}
if (cur_cmd == vrule_cmd) {
width(q) = default_rule;
- rule_dir(q) = body_direction;
+ rule_dir(q) = body_direction_par;
} else {
height(q) = default_rule;
depth(q) = 0;
- rule_dir(q) = text_direction;
+ rule_dir(q) = text_direction_par;
}
RESWITCH:
if (scan_keyword("width")) {
@@ -2157,15 +2155,14 @@ parenthesis.
@c
typedef enum {
- expr_none = 0, /* \.( seen, or \.( $\langle\it expr\rangle$ \.) seen */
- expr_add = 1, /* \.( $\langle\it expr\rangle$ \.+ seen */
- expr_sub = 2, /* \.( $\langle\it expr\rangle$ \.- seen */
- expr_mult = 3, /* $\langle\it term\rangle$ \.* seen */
- expr_div = 4, /* $\langle\it term\rangle$ \./ seen */
- expr_scale = 5, /* $\langle\it term\rangle$ \.* $\langle\it factor\rangle$ \./ seen */
+ expr_none = 0, /* \.( seen, or \.( $\langle\it expr\rangle$ \.) seen */
+ expr_add = 1, /* \.( $\langle\it expr\rangle$ \.+ seen */
+ expr_sub = 2, /* \.( $\langle\it expr\rangle$ \.- seen */
+ expr_mult = 3, /* $\langle\it term\rangle$ \.* seen */
+ expr_div = 4, /* $\langle\it term\rangle$ \./ seen */
+ expr_scale = 5, /* $\langle\it term\rangle$ \.* $\langle\it factor\rangle$ \./ seen */
} expression_states;
-
@ We want to make sure that each term and (intermediate) result is in
the proper range. Integer values must not exceed |infinity|
($2^{31}-1$) in absolute value, dimensions must not exceed |max_dimen|
@@ -2202,12 +2199,6 @@ term so far and |s| is the state of its evaluation; finally |n| is the
numerator for a combined multiplication and division, if any.
@c
-#define expr_type(A) type((A)+1)
-#define expr_state(A) subtype((A)+1)
-#define expr_e_field(A) vlink((A)+1) /* saved expression so far */
-#define expr_t_field(A) vlink((A)+2) /* saved term so far */
-#define expr_n_field(A) vinfo((A)+2) /* saved numerator */
-
#define expr_add_sub(A,B,C) add_or_sub((A),(B),(C),(r==expr_sub))
#define expr_a(A,B) expr_add_sub((A),(B),max_dimen)
@@ -2493,7 +2484,7 @@ static void scan_expr(void)
*/
t = f;
if ((l >= glue_val_level) && (o != expr_none)) {
- /* do we really need to copy here ? */
+ /* do we really need to copy here ? */
t = new_spec(f);
flush_node(f);
normalize_glue(t);
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
index e04bf991afb..8b21cd02e71 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
@@ -25,10 +25,6 @@
#include <string.h>
#include <kpathsea/absolute.h>
-@ @c
-#define end_line_char int_par(end_line_char_code)
-
-
@ The bane of portability is the fact that different operating systems treat
input and output quite differently, perhaps because computer scientists
have not given sufficient attention to this problem. People have felt somehow
@@ -116,7 +112,7 @@ char *luatex_find_read_file(const char *s, int n, int callback_index)
char *ftemp = NULL;
int callback_id = callback_defined(callback_index);
if (callback_id > 0) {
- (void) run_callback(callback_id, "dS->S", n, s, &ftemp);
+ (void) run_callback(callback_id, "dS->R", n, s, &ftemp);
} else {
/* use kpathsea here */
ftemp = find_in_output_directory(s);
@@ -844,7 +840,7 @@ void open_log_file(void)
input_stack[input_ptr] = cur_input; /* make sure bottom level is in memory */
tprint_nl("**");
l = input_stack[0].limit_field; /* last position of first line */
- if (buffer[l] == end_line_char)
+ if (buffer[l] == end_line_char_par)
decr(l); /* TODO: multichar endlinechar */
for (k = 1; k <= l; k++)
print_char(buffer[k]);
@@ -978,7 +974,7 @@ void start_input(void)
if (end_line_char_inactive)
decr(ilimit);
else
- buffer[ilimit] = (packed_ASCII_code) end_line_char;
+ buffer[ilimit] = (packed_ASCII_code) end_line_char_par;
first = ilimit + 1;
iloc = istart;
}
@@ -1137,7 +1133,7 @@ boolean zopen_w_input(FILE ** f, const char *fname, int format,
char *fnam;
callbackid = callback_defined(find_format_file_callback);
if (callbackid > 0) {
- res = run_callback(callbackid, "S->S", fname, &fnam);
+ res = run_callback(callbackid, "S->R", fname, &fnam);
if (res && fnam && strlen(fnam) > 0) {
*f = fopen(fnam, fopen_mode);
if (*f == NULL) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.h b/Build/source/texk/web2c/luatexdir/tex/texmath.h
index f36644e997d..93e85b46221 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.h
@@ -109,8 +109,6 @@ void print_math_style(void);
# define script_size 1
# define script_script_size 2
-# define math_direction int_par(math_direction_code)
-
# define dir_math_save cur_list.math_field
# define m_style cur_list.math_style_field
# define init_math_fields() do { \
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w
index 32bc134a488..4d588079ce7 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w
@@ -18,21 +18,13 @@
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-
-// define DEBUG
#include "ptexlib.h"
@ @c
-#define mode cur_list.mode_field
-#define head cur_list.head_field
-#define tail cur_list.tail_field
-#define prev_graf cur_list.pg_field
-#define eTeX_aux cur_list.eTeX_aux_field
-#define delim_ptr eTeX_aux
-#define space_factor cur_list.space_factor_field
-#define incompleat_noad cur_list.incompleat_noad_field
-
-#define cur_fam int_par(cur_fam_code)
+#define mode mode_par
+#define tail tail_par
+#define head head_par
+#define dir_save dirs_par
/*
@@ -47,12 +39,6 @@
*/
-#define display_skip_mode int_par(math_display_skip_mode_code)
-
-#define math_skip glue_par(math_skip_code)
-
-#define var_code 7
-
@ TODO: not sure if this is the right order
@c
#define back_error(A,B) do { \
@@ -67,19 +53,6 @@ int scan_math(pointer, int);
int scan_math_style(pointer, int);
pointer fin_mlist(pointer);
-#define pre_display_size dimen_par(pre_display_size_code)
-#define hsize dimen_par(hsize_code)
-#define display_width dimen_par(display_width_code)
-#define display_indent dimen_par(display_indent_code)
-#define math_surround dimen_par(math_surround_code)
-#define hang_indent dimen_par(hang_indent_code)
-#define hang_after int_par(hang_after_code)
-#define every_math equiv(every_math_loc)
-#define every_display equiv(every_display_loc)
-#define par_shape_ptr equiv(par_shape_loc)
-
-#define math_eqno_gap_step int_par(math_eqno_gap_step_code)
-
@ When \TeX\ reads a formula that is enclosed between \.\$'s, it constructs an
{\sl mlist}, which is essentially a tree structure representing that
formula. An mlist is a linear sequence of items, but we can regard it as
@@ -175,10 +148,10 @@ subroutine empties the current list, assuming that |abs(mode)=mmode|.
void flush_math(void)
{
flush_node_list(vlink(head));
- flush_node_list(incompleat_noad);
+ flush_node_list(incompleat_noad_par);
vlink(head) = null;
tail = head;
- incompleat_noad = null;
+ incompleat_noad_par = null;
}
@ Before we can do anything in math mode, we need fonts.
@@ -203,7 +176,7 @@ void def_fam_fnt(int fam_id, int size_id, int f, int lvl)
sa_value.int_value = f;
set_sa_item(math_fam_head, n, sa_value, lvl);
fixup_math_parameters(fam_id, size_id, f, lvl);
- if (int_par(tracing_assigns_code) > 1) {
+ if (tracing_assigns_par > 1) {
begin_diagnostic();
tprint("{assigning");
print_char(' ');
@@ -229,7 +202,7 @@ static void unsave_math_fam_data(int gl)
if (st.level > 0) {
rawset_sa_item(math_fam_head, st.code, st.value);
/* now do a trace message, if requested */
- if (int_par(tracing_restores_code) > 1) {
+ if (tracing_restores_par > 1) {
int size_id = st.code / 256;
int fam_id = st.code % 256;
begin_diagnostic();
@@ -262,7 +235,7 @@ void def_math_param(int param_id, int style_id, scaled value, int lvl)
sa_tree_item sa_value = { 0 };
sa_value.int_value = (int) value;
set_sa_item(math_param_head, n, sa_value, lvl);
- if (int_par(tracing_assigns_code) > 1) {
+ if (tracing_assigns_par > 1) {
begin_diagnostic();
tprint("{assigning");
print_char(' ');
@@ -294,7 +267,7 @@ static void unsave_math_param_data(int gl)
if (st.level > 0) {
rawset_sa_item(math_param_head, st.code, st.value);
/* now do a trace message, if requested */
- if (int_par(tracing_restores_code) > 1) {
+ if (tracing_restores_par > 1) {
int param_id = st.code % 256;
int style_id = st.code / 256;
begin_diagnostic();
@@ -889,22 +862,22 @@ is about to be processed. The parameter is a code like |math_group|.
static void new_save_level_math(group_code c)
{
set_saved_record(0, saved_textdir, 0, text_dir_ptr);
- text_dir_ptr = new_dir(math_direction);
+ text_dir_ptr = new_dir(math_direction_par);
incr(save_ptr);
new_save_level(c);
- eq_word_define(int_base + body_direction_code, math_direction);
- eq_word_define(int_base + par_direction_code, math_direction);
- eq_word_define(int_base + text_direction_code, math_direction);
+ eq_word_define(int_base + body_direction_code, math_direction_par);
+ eq_word_define(int_base + par_direction_code, math_direction_par);
+ eq_word_define(int_base + text_direction_code, math_direction_par);
}
@ @c
static void push_math(group_code c, int mstyle)
{
- if (math_direction != text_direction)
+ if (math_direction_par != text_direction_par)
dir_math_save = true;
push_nest();
mode = -mmode;
- incompleat_noad = null;
+ incompleat_noad_par = null;
m_style = mstyle;
new_save_level_math(c);
}
@@ -914,8 +887,8 @@ static void enter_ordinary_math(void)
{
push_math(math_shift_group, text_style);
eq_word_define(int_base + cur_fam_code, -1);
- if (every_math != null)
- begin_token_list(every_math, every_math_text);
+ if (every_math_par != null)
+ begin_token_list(every_math_par, every_math_text);
}
@ @c
@@ -1007,7 +980,7 @@ static boolean math_and_text_reversed_p(void)
while (i < save_ptr) {
if (save_type(i) == restore_old_value &&
save_value(i) == int_base + par_direction_code) {
- if (textdir_opposite(math_direction, save_value(i - 1)))
+ if (textdir_opposite(math_direction_par, save_value(i - 1)))
return true;
}
i++;
@@ -1046,27 +1019,27 @@ void enter_display_math(void)
/* now we are in vertical mode, working on the list that will contain the display */
/* A displayed equation is considered to be three lines long, so we
calculate the length and offset of line number |prev_graf+2|. */
- if (par_shape_ptr == null) {
- if ((hang_indent != 0) &&
- (((hang_after >= 0) && (prev_graf + 2 > hang_after)) ||
- (prev_graf + 1 < -hang_after))) {
- l = hsize - abs(hang_indent);
- if (hang_indent > 0)
- s = hang_indent;
+ if (par_shape_par_ptr == null) {
+ if ((hang_indent_par != 0) && (((hang_after_par >= 0) && (prev_graf_par + 2 > hang_after_par)) || (prev_graf_par + 1 < -hang_after_par))) {
+ halfword used_hang_indent = swap_hang_indent(hang_indent_par);
+ l = hsize_par - abs(used_hang_indent);
+ if (used_hang_indent > 0)
+ s = used_hang_indent;
else
s = 0;
} else {
- l = hsize;
+ l = hsize_par;
s = 0;
}
} else {
- n = vinfo(par_shape_ptr + 1);
- if (prev_graf + 2 >= n)
- p = par_shape_ptr + 2 * n + 1;
+ n = vinfo(par_shape_par_ptr + 1);
+ if (prev_graf_par + 2 >= n)
+ p = par_shape_par_ptr + 2 * n + 1;
else
- p = par_shape_ptr + 2 * (prev_graf + 2) + 1;
+ p = par_shape_par_ptr + 2 * (prev_graf_par + 2) + 1;
s = varmem[(p - 1)].cint;
l = varmem[p].cint;
+ s = swap_parshape_indent(s,l);
}
push_math(math_shift_group, display_style);
@@ -1076,8 +1049,8 @@ void enter_display_math(void)
eq_word_define(dimen_base + display_width_code, l);
eq_word_define(dimen_base + display_indent_code, s);
eq_word_define(int_base + pre_display_direction_code, (math_and_text_reversed_p() ? -1 : 0));
- if (every_display != null)
- begin_token_list(every_display, every_display_text);
+ if (every_display_par != null)
+ begin_token_list(every_display_par, every_display_text);
if (nest_ptr == 1) {
checked_page_filter(before_display);
build_page();
@@ -1090,8 +1063,6 @@ void enter_display_math(void)
(the class is passed on for conversion to \.{\\mathchar}).
@c
-#define fam_in_range ((cur_fam>=0)&&(cur_fam<256))
-
static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass)
{
const char *hlp[] = {
@@ -1368,8 +1339,8 @@ int scan_math(pointer p, int mstyle)
}
type(p) = math_char_node;
math_character(p) = mval.character_value;
- if ((mval.class_value == var_code) && fam_in_range)
- math_fam(p) = cur_fam;
+ if ((mval.class_value == math_use_current_family_code) && cur_fam_par_in_range)
+ math_fam(p) = cur_fam_par;
else
math_fam(p) = mval.family_value;
return 0;
@@ -1398,9 +1369,9 @@ void set_math_char(mathcodeval mval)
nucleus(p) = q;
math_character(nucleus(p)) = mval.character_value;
math_fam(nucleus(p)) = mval.family_value;
- if (mval.class_value == var_code) {
- if (fam_in_range)
- math_fam(nucleus(p)) = cur_fam;
+ if (mval.class_value == math_use_current_family_code) {
+ if (cur_fam_par_in_range)
+ math_fam(nucleus(p)) = cur_fam_par;
subtype(p) = ord_noad_type;
} else {
switch (mval.class_value) {
@@ -1668,8 +1639,8 @@ void math_ac(void)
q = new_node(math_char_node, 0);
top_accent_chr(tail) = q;
math_character(top_accent_chr(tail)) = t.character_value;
- if ((t.class_value == var_code) && fam_in_range)
- math_fam(top_accent_chr(tail)) = cur_fam;
+ if ((t.class_value == math_use_current_family_code) && cur_fam_par_in_range)
+ math_fam(top_accent_chr(tail)) = cur_fam_par;
else
math_fam(top_accent_chr(tail)) = t.family_value;
}
@@ -1677,8 +1648,8 @@ void math_ac(void)
q = new_node(math_char_node, 0);
bot_accent_chr(tail) = q;
math_character(bot_accent_chr(tail)) = b.character_value;
- if ((b.class_value == var_code) && fam_in_range)
- math_fam(bot_accent_chr(tail)) = cur_fam;
+ if ((b.class_value == math_use_current_family_code) && cur_fam_par_in_range)
+ math_fam(bot_accent_chr(tail)) = cur_fam_par;
else
math_fam(bot_accent_chr(tail)) = b.family_value;
}
@@ -1686,8 +1657,8 @@ void math_ac(void)
q = new_node(math_char_node, 0);
overlay_accent_chr(tail) = q;
math_character(overlay_accent_chr(tail)) = o.character_value;
- if ((o.class_value == var_code) && fam_in_range)
- math_fam(overlay_accent_chr(tail)) = cur_fam;
+ if ((o.class_value == math_use_current_family_code) && cur_fam_par_in_range)
+ math_fam(overlay_accent_chr(tail)) = cur_fam_par;
else
math_fam(overlay_accent_chr(tail)) = o.family_value;
}
@@ -1807,7 +1778,7 @@ void math_fraction(void)
pointer q;
halfword options = 0;
c = cur_chr;
- if (incompleat_noad != null) {
+ if (incompleat_noad_par != null) {
const char *hlp[] = {
"I'm ignoring this fraction specification, since I don't",
"know whether a construction like `x \\over y \\over z'",
@@ -1822,25 +1793,25 @@ void math_fraction(void)
scan_normal_dimen();
tex_error("Ambiguous; you need another { and }", hlp);
} else {
- incompleat_noad = new_node(fraction_noad, 0);
- numerator(incompleat_noad) = new_node(sub_mlist_node, 0);
- math_list(numerator(incompleat_noad)) = vlink(head);
+ incompleat_noad_par = new_node(fraction_noad, 0);
+ numerator(incompleat_noad_par) = new_node(sub_mlist_node, 0);
+ math_list(numerator(incompleat_noad_par)) = vlink(head);
vlink(head) = null;
tail = head;
m_style = cramped_style(m_style);
if ((c % delimited_code) == skewed_code) {
q = new_node(delim_node, 0);
- middle_delimiter(incompleat_noad) = q;
- scan_delimiter(middle_delimiter(incompleat_noad), no_mathcode);
+ middle_delimiter(incompleat_noad_par) = q;
+ scan_delimiter(middle_delimiter(incompleat_noad_par), no_mathcode);
}
if (c >= delimited_code) {
q = new_node(delim_node, 0);
- left_delimiter(incompleat_noad) = q;
+ left_delimiter(incompleat_noad_par) = q;
q = new_node(delim_node, 0);
- right_delimiter(incompleat_noad) = q;
- scan_delimiter(left_delimiter(incompleat_noad), no_mathcode);
- scan_delimiter(right_delimiter(incompleat_noad), no_mathcode);
+ right_delimiter(incompleat_noad_par) = q;
+ scan_delimiter(left_delimiter(incompleat_noad_par), no_mathcode);
+ scan_delimiter(right_delimiter(incompleat_noad_par), no_mathcode);
}
switch (c % delimited_code) {
case above_code:
@@ -1851,15 +1822,15 @@ void math_fraction(void)
break;
}
}
- fractionoptions(incompleat_noad) = options;
+ fractionoptions(incompleat_noad_par) = options;
scan_normal_dimen();
- thickness(incompleat_noad) = cur_val;
+ thickness(incompleat_noad_par) = cur_val;
break;
case over_code:
- thickness(incompleat_noad) = default_code;
+ thickness(incompleat_noad_par) = default_code;
break;
case atop_code:
- thickness(incompleat_noad) = 0;
+ thickness(incompleat_noad_par) = 0;
break;
case skewed_code:
while (1) {
@@ -1871,8 +1842,8 @@ void math_fraction(void)
break;
}
}
- fractionoptions(incompleat_noad) = options;
- thickness(incompleat_noad) = 0;
+ fractionoptions(incompleat_noad_par) = options;
+ thickness(incompleat_noad_par) = 0;
break;
}
}
@@ -1888,24 +1859,24 @@ current mlist; this |fence_noad| has not yet been appended.
pointer fin_mlist(pointer p)
{
pointer q; /* the mlist to return */
- if (incompleat_noad != null) {
- if (denominator(incompleat_noad) != null) {
- type(denominator(incompleat_noad)) = sub_mlist_node;
+ if (incompleat_noad_par != null) {
+ if (denominator(incompleat_noad_par) != null) {
+ type(denominator(incompleat_noad_par)) = sub_mlist_node;
} else {
q = new_node(sub_mlist_node, 0);
- denominator(incompleat_noad) = q;
+ denominator(incompleat_noad_par) = q;
}
- math_list(denominator(incompleat_noad)) = vlink(head);
+ math_list(denominator(incompleat_noad_par)) = vlink(head);
if (p == null) {
- q = incompleat_noad;
+ q = incompleat_noad_par;
} else {
- q = math_list(numerator(incompleat_noad));
+ q = math_list(numerator(incompleat_noad_par));
if ((type(q) != fence_noad) || (subtype(q) != left_noad_side)
- || (delim_ptr == null))
+ || (delim_par == null))
confusion("right"); /* this can't happen */
- math_list(numerator(incompleat_noad)) = vlink(delim_ptr);
- vlink(delim_ptr) = incompleat_noad;
- vlink(incompleat_noad) = p;
+ math_list(numerator(incompleat_noad_par)) = vlink(delim_par);
+ vlink(delim_par) = incompleat_noad_par;
+ vlink(incompleat_noad_par) = p;
}
} else {
vlink(tail) = p;
@@ -2077,7 +2048,7 @@ void math_left_right(void)
push_math(math_left_group, m_style);
vlink(head) = q;
tail = p;
- delim_ptr = p;
+ delim_par = p;
} else {
tail_append(new_noad());
subtype(tail) = inner_noad_type;
@@ -2133,10 +2104,10 @@ static void resume_after_display(void)
if (cur_group != math_shift_group)
confusion("display");
unsave_math();
- prev_graf = prev_graf + 3;
+ prev_graf_par = prev_graf_par + 3;
push_nest();
mode = hmode;
- space_factor = 1000;
+ space_factor_par = 1000;
/* this needs to be intercepted in the display math start ! */
tail_append(make_local_par_node(penalty_par_code));
get_x_token();
@@ -2158,6 +2129,39 @@ At this time we are in vertical mode (or internal vertical mode).
|l| is true if there was an \.{\\leqno}/ (so |a| is a horizontal box).
@c
+#define inject_display_skip_before(g) \
+ switch (display_skip_mode_par) { \
+ case 0 : /* normal tex */ \
+ tail_append(new_param_glue(g)); \
+ break;\
+ case 1 : /* always */ \
+ tail_append(new_param_glue(g)); \
+ break; \
+ case 2 : /* non-zero */ \
+ if (g != 0 && ! glue_is_zero(glue_par(g))) \
+ tail_append(new_param_glue(g)); \
+ break; \
+ case 3: /* ignore */ \
+ break; \
+ }
+
+#define inject_display_skip_after(g) \
+ switch (display_skip_mode_par) { \
+ case 0 : /* normal tex */ \
+ if (g != 0 && glue_is_positive(glue_par(g))) \
+ tail_append(new_param_glue(g)); \
+ break; \
+ case 1 : /* always */ \
+ tail_append(new_param_glue(g)); \
+ break; \
+ case 2 : /* non-zero */ \
+ if (g != 0 && ! glue_is_zero(glue_par(g))) \
+ tail_append(new_param_glue(g)); \
+ break; \
+ case 3: /* ignore */ \
+ break; \
+ }
+
static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
{
pointer eq_box; /* box containing the equation */
@@ -2173,7 +2177,7 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
pointer pre_t; /* tail of pre-adjustment list */
boolean swap_dir; /* true if the math and surrounding text dirs are opposed */
scaled eqno_width;
- swap_dir = (int_par(pre_display_direction_code) < 0 ? true : false );
+ swap_dir = (pre_display_direction_par < 0 ? true : false );
if (eqno_box != null && swap_dir)
l = !l;
adjust_tail = adjust_head;
@@ -2187,8 +2191,8 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
pre_t = pre_adjust_tail;
pre_adjust_tail = null;
eq_w = width(eq_box);
- line_w = display_width;
- line_s = display_indent;
+ line_w = display_width_par;
+ line_s = display_indent_par;
if (eqno_box == null) {
eqno_w = 0;
eqno_width = 0;
@@ -2196,7 +2200,7 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
} else {
eqno_w = width(eqno_box);
eqno_width = eqno_w;
- eqno_w2 = eqno_w + round_xn_over_d(math_eqno_gap_step, get_math_quad_style(text_style), 1000);
+ eqno_w2 = eqno_w + round_xn_over_d(math_eqno_gap_step_par, get_math_quad_style(text_style), 1000);
subtype(eqno_box) = equation_number_list; /* new */
/* build_attribute_list(eqno_box); */ /* probably already set */
}
@@ -2242,8 +2246,8 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
d = 0;
}
- tail_append(new_penalty(int_par(pre_display_penalty_code)));
- if ((d + line_s <= pre_display_size) || l) { /* not enough clearance */
+ tail_append(new_penalty(pre_display_penalty_par));
+ if ((d + line_s <= pre_display_size_par) || l) { /* not enough clearance */
g1 = above_display_skip_code;
g2 = below_display_skip_code;
} else {
@@ -2261,35 +2265,22 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
/* it follows that |type(a)=hlist_node| */
if (eqno_box && l && (eqno_w == 0)) {
- /* if (math_direction==dir_TLT) { */
+ /* if (math_direction_par==dir_TLT) { */
shift_amount(eqno_box) = 0;
/* } else { */
/* } */
append_to_vlist(eqno_box,lua_key_index(equation_number));
tail_append(new_penalty(inf_penalty));
} else {
- switch (display_skip_mode) {
- case 0 : /* normal tex */
- tail_append(new_param_glue(g1));
- break;
- case 1 : /* always */
- tail_append(new_param_glue(g1));
- break;
- case 2 : /* non-zero */
- if (g1 != 0)
- tail_append(new_param_glue(g1));
- break;
- case 3: /* ignore */
- break;
- }
+ inject_display_skip_before(g1);
}
if (eqno_w != 0) {
r = new_kern(line_w - eq_w - eqno_w - d);
if (l) {
if (swap_dir) {
- if (math_direction==dir_TLT) {
- /* TRT + TLT + \eqno, (swap_dir=true, math_direction=TLT, l=true) */
+ if (math_direction_par==dir_TLT) {
+ /* TRT + TLT + \eqno, (swap_dir=true, math_direction_par=TLT, l=true) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 1\n");
#endif
@@ -2298,7 +2289,7 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
try_couple_nodes(r,eq_box);
try_couple_nodes(eq_box,s);
} else {
- /* TLT + TRT + \eqno, (swap_dir=true, math_direction=TRT, l=true) */
+ /* TLT + TRT + \eqno, (swap_dir=true, math_direction_par=TRT, l=true) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 2\n");
#endif
@@ -2306,14 +2297,14 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
try_couple_nodes(r,eq_box);
}
} else {
- if (math_direction==dir_TLT) {
- /* TLT + TLT + \leqno, (swap_dir=false, math_direction=TLT, l=true) */ /* OK */
+ if (math_direction_par==dir_TLT) {
+ /* TLT + TLT + \leqno, (swap_dir=false, math_direction_par=TLT, l=true) */ /* OK */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 3\n");
#endif
s = new_kern(width(r) + eqno_w);
} else {
- /* TRT + TRT + \leqno, (swap_dir=false, math_direction=TRT, l=true) */
+ /* TRT + TRT + \leqno, (swap_dir=false, math_direction_par=TRT, l=true) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 4\n");
#endif
@@ -2326,13 +2317,13 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
eq_box = eqno_box;
} else {
if (swap_dir) {
- if (math_direction==dir_TLT) {
- /* TRT + TLT + \leqno, (swap_dir=true, math_direction=TLT, l=false) */
+ if (math_direction_par==dir_TLT) {
+ /* TRT + TLT + \leqno, (swap_dir=true, math_direction_par=TLT, l=false) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 5\n");
#endif
} else {
- /* TLT + TRT + \leqno, (swap_dir=true, math_direction=TRT, l=false) */
+ /* TLT + TRT + \leqno, (swap_dir=true, math_direction_par=TRT, l=false) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 6\n");
#endif
@@ -2340,14 +2331,14 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
try_couple_nodes(eq_box,r);
try_couple_nodes(r,eqno_box);
} else {
- if (math_direction==dir_TLT) {
- /* TLT + TLT + \eqno, (swap_dir=false, math_direction=TLT, l=false) */ /* OK */
+ if (math_direction_par==dir_TLT) {
+ /* TLT + TLT + \eqno, (swap_dir=false, math_direction_par=TLT, l=false) */ /* OK */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 7\n");
#endif
s = new_kern(d);
} else {
- /* TRT + TRT + \eqno, (swap_dir=false, math_direction=TRT, l=false) */
+ /* TRT + TRT + \eqno, (swap_dir=false, math_direction_par=TRT, l=false) */
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: CASE 8\n");
#endif
@@ -2371,7 +2362,7 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
if ((eqno_box != null) && (eqno_w == 0) && !l) {
tail_append(new_penalty(inf_penalty));
- /* if (math_direction==dir_TLT) { */
+ /* if (math_direction_par==dir_TLT) { */
shift_amount(eqno_box) = line_s + line_w - eqno_width ;
/* } else { */
/* } */
@@ -2390,24 +2381,8 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
alink(pre_adjust_tail) = alink(tail);
tail = pre_t;
}
- tail_append(new_penalty(int_par(post_display_penalty_code)));
-
- switch (display_skip_mode) {
- case 0 : /* normal tex */
- if (g2 > 0)
- tail_append(new_param_glue(g2));
- break;
- case 1 : /* always */
- tail_append(new_param_glue(g2));
- break;
- case 2 : /* non-zero */
- if (g2 != 0)
- tail_append(new_param_glue(g2));
- break;
- case 3: /* ignore */
- break;
- }
-
+ tail_append(new_penalty(post_display_penalty_par));
+ inject_display_skip_after(g2);
resume_after_display();
}
@@ -2452,15 +2427,15 @@ void after_math(void)
if (cur_cmd == math_shift_cs_cmd) {
check_inline_math_end();
}
- tail_append(new_math(math_surround, before));
+ tail_append(new_math(math_surround_par, before));
/* begin mathskip code */
- if (! glue_is_zero(math_skip)) {
- copy_glue_values(tail,math_skip);
+ if (! glue_is_zero(math_skip_par)) {
+ copy_glue_values(tail,math_skip_par);
surround(tail) = 0;
}
/* end mathskip code */
if (dir_math_save) {
- tail_append(new_dir(math_direction));
+ tail_append(new_dir(math_direction_par));
}
run_mlist_to_hlist(p, (mode > 0), text_style);
vlink(tail) = vlink(temp_head);
@@ -2468,17 +2443,17 @@ void after_math(void)
tail = vlink(tail);
}
if (dir_math_save) {
- tail_append(new_dir(math_direction - dir_swap));
+ tail_append(new_dir(math_direction_par - dir_swap));
}
dir_math_save = false;
- tail_append(new_math(math_surround, after));
+ tail_append(new_math(math_surround_par, after));
/* begin mathskip code */
- if (! glue_is_zero(math_skip)) {
- copy_glue_values(tail,math_skip);
+ if (! glue_is_zero(math_skip_par)) {
+ copy_glue_values(tail,math_skip_par);
surround(tail) = 0;
}
/* end mathskip code */
- space_factor = 1000;
+ space_factor_par = 1000;
unsave_math();
} else {
if (a == null) {
@@ -2508,13 +2483,13 @@ void finish_display_alignment(pointer p, pointer q, halfword saved_prevdepth)
check_display_math_end();
}
pop_nest();
- tail_append(new_penalty(int_par(pre_display_penalty_code)));
- tail_append(new_param_glue(above_display_skip_code));
+ tail_append(new_penalty(pre_display_penalty_par));
+ inject_display_skip_before(above_display_skip_code);
vlink(tail) = p;
if (p != null)
tail = q;
- tail_append(new_penalty(int_par(post_display_penalty_code)));
- tail_append(new_param_glue(below_display_skip_code));
+ tail_append(new_penalty(post_display_penalty_par));
+ inject_display_skip_after(below_display_skip_code);
cur_list.prev_depth_field = saved_prevdepth;
resume_after_display();
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 93670b7f5b3..6650d17f410 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
@@ -148,30 +148,33 @@ typedef enum {
# define synctex_line_glue(a) vlink((a)+6)
#define glue_is_zero(p) \
- ((p == null) || (width(p) == 0 && stretch(p) == 0 && shrink(p) == 0))
+ ((p == null) || (width(p) == 0 && stretch(p) == 0 && shrink(p) == 0))
+
+#define glue_is_positive(p) \
+ ((p == null) || (width(p) > 0))
#define reset_glue_to_zero(p) \
- if (p != null) { \
- width(p) = 0; \
- stretch(p) = 0; \
- shrink(p) = 0; \
- stretch_order(p) = 0; \
- shrink_order(p) = 0; \
- }
+ if (p != null) { \
+ width(p) = 0; \
+ stretch(p) = 0; \
+ shrink(p) = 0; \
+ stretch_order(p) = 0; \
+ shrink_order(p) = 0; \
+ }
#define copy_glue_values(p,q) \
- if (q == null) { \
- width(p) = 0; \
- stretch(p) = 0; \
- shrink(p) = 0; \
- stretch_order(p) = 0; \
- shrink_order(p) = 0; \
- } else { \
- width(p) = width(q); \
- stretch(p) = stretch(q); \
- shrink(p) = shrink(q); \
- stretch_order(p) = stretch_order(q); \
- shrink_order(p) = shrink_order(q); \
+ if (q == null) { \
+ width(p) = 0; \
+ stretch(p) = 0; \
+ shrink(p) = 0; \
+ stretch_order(p) = 0; \
+ shrink_order(p) = 0; \
+ } else { \
+ width(p) = width(q); \
+ stretch(p) = stretch(q); \
+ shrink(p) = shrink(q); \
+ stretch_order(p) = stretch_order(q); \
+ shrink_order(p) = shrink_order(q); \
}
@@ -417,11 +420,17 @@ typedef enum {
# define last_known_node temp_node /* used by \lastnodetype */
# define movement_node_size 3
-# define expr_node_size 3
# define if_node_size 2
# define align_stack_node_size 6
# define nesting_node_size 2
+# define expr_node_size 3
+# define expr_type(A) type((A)+1)
+# define expr_state(A) subtype((A)+1) /* enum defined in scanning.w */
+# define expr_e_field(A) vlink((A)+1) /* saved expression so far */
+# define expr_t_field(A) vlink((A)+2) /* saved term so far */
+# define expr_n_field(A) vinfo((A)+2) /* saved numerator */
+
# define span_node_size 3
# define span_span(a) vlink((a)+1)
# define span_link(a) vinfo((a)+1)
@@ -944,7 +953,10 @@ typedef enum {
# define var_mem_stat_max (end_point+glyph_node_size-1)
# define stretching 1
-# define shrinking 2
+# define shrinking 2
+
+# define last_normal_node shape_node
+# define last_whatsit_node pdf_restore_node
# define is_running(A) ((A)==null_flag) /* tests for a running dimension */
@@ -978,11 +990,6 @@ extern int lua_properties_enabled ;
extern int lua_properties_level ;
extern int lua_properties_use_metatable ;
-#define local_inter_line_penalty int_par(local_inter_line_penalty_code)
-#define local_broken_penalty int_par(local_broken_penalty_code)
-#define local_left_box equiv(local_left_box_base)
-#define local_right_box equiv(local_right_box_base)
-
extern halfword make_local_par_node(int mode);
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
index df7de17db5f..6bfa14f2356 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
@@ -33,16 +33,8 @@ makes no sense, not even to make it configureable. There is a little more memory
used but that is neglectable compared to other memory usage.
@c
-#define attribute(A) eqtb[attribute_base+(A)].cint
-
-#define uc_hyph int_par(uc_hyph_code)
-#define cur_lang int_par(cur_lang_code)
-#define left_hyphen_min int_par(left_hyphen_min_code)
-#define right_hyphen_min int_par(right_hyphen_min_code)
-
-#define MAX_CHAIN_SIZE 13 /* why not a bit larger */
-
-#define CHECK_NODE_USAGE 1 /* this triggers checking */
+#define MAX_CHAIN_SIZE 13 /* why not a bit larger */
+#define CHECK_NODE_USAGE 1 /* this triggers checking */
memory_word *volatile varmem = NULL;
@@ -61,8 +53,8 @@ int fix_node_lists = 1; /* used in font and lang */
halfword slow_get_node(int s); /* defined below */
-#define fake_node 100
-#define fake_node_size 2
+#define fake_node 100
+#define fake_node_size 2
#define fake_node_name "fake"
#define variable_node_size 2
@@ -144,18 +136,6 @@ const char *node_fields_noad[] = {
"attr", "nucleus", "sub", "sup", NULL
};
-#define node_fields_ord node_fields_noad
-#define node_fields_op node_fields_noad
-#define node_fields_bin node_fields_noad
-#define node_fields_rel node_fields_noad
-#define node_fields_open node_fields_noad
-#define node_fields_close node_fields_noad
-#define node_fields_punct node_fields_noad
-#define node_fields_inner node_fields_noad
-#define node_fields_under node_fields_noad
-#define node_fields_over node_fields_noad
-#define node_fields_vcenter node_fields_noad
-
const char *node_fields_style[] = {
"attr", "style", NULL
};
@@ -342,7 +322,7 @@ node_info node_data[] = { /* the last entry in a row is the etex number */
{ unset_node, box_node_size, node_fields_unset, "unset", 14 },
{ style_node, style_node_size, node_fields_style, "style", 15 },
{ choice_node, style_node_size, node_fields_choice, "choice", 15 },
- { simple_noad, noad_size, node_fields_ord, "noad", 15 },
+ { simple_noad, noad_size, node_fields_noad, "noad", 15 },
{ radical_noad, radical_noad_size, node_fields_radical, "radical", 15 },
{ fraction_noad, fraction_noad_size, node_fields_fraction, "fraction", 15 },
{ accent_noad, accent_noad_size, node_fields_accent, "accent", 15 },
@@ -377,8 +357,6 @@ node_info node_data[] = { /* the last entry in a row is the etex number */
{ -1, -1, NULL, NULL, -1 },
};
-#define last_normal_node shape_node
-
const char *node_subtypes_pdf_destination[] = {
"xyz", "fit", "fith", "fitv", "fitb", "fitbh", "fitbv", "fitr", NULL
};
@@ -552,6 +530,8 @@ important, don't keep resolving the registry index.
/* isn't there a faster way to metatable? */
+/*
+
#define lua_properties_copy(target,source) do { \
if (lua_properties_enabled) { \
if (lua_properties_level == 0) { \
@@ -590,6 +570,55 @@ important, don't keep resolving the registry index.
} \
} while(0)
+*/
+
+/*
+ A simple testrun on many pages of dumb text shows 1% gain (of course it depends
+ on how properties are used but some other tests confirm it).
+*/
+
+#define lua_properties_copy(target,source) do { \
+ if (lua_properties_enabled) { \
+ if (lua_properties_level == 0) { \
+ lua_get_metatablelua_l(Luas,node_properties); \
+ lua_rawgeti(Luas,-1,source); \
+ if (lua_type(Luas,-1)==LUA_TTABLE) { \
+ if (lua_properties_use_metatable) { \
+ lua_newtable(Luas); \
+ lua_insert(Luas,-2); \
+ lua_push_string_by_name(Luas,__index); \
+ lua_insert(Luas,-2); \
+ lua_rawset(Luas, -3); \
+ lua_newtable(Luas); \
+ lua_insert(Luas,-2); \
+ lua_setmetatable(Luas,-2); \
+ } \
+ lua_rawseti(Luas,-2,target); \
+ } else { \
+ lua_pop(Luas,1); \
+ } \
+ lua_pop(Luas,1); \
+ } else { \
+ lua_rawgeti(Luas,-1,source); \
+ if (lua_type(Luas,-1)==LUA_TTABLE) { \
+ if (lua_properties_use_metatable) { \
+ lua_newtable(Luas); \
+ lua_insert(Luas,-2); \
+ lua_push_string_by_name(Luas,__index); \
+ lua_insert(Luas,-2); \
+ lua_rawset(Luas, -3); \
+ lua_newtable(Luas); \
+ lua_insert(Luas,-2); \
+ lua_setmetatable(Luas,-2); \
+ } \
+ lua_rawseti(Luas,-2,target); \
+ } else { \
+ lua_pop(Luas,1); \
+ } \
+ } \
+ } \
+} while(0)
+
/* Here end the property handlers. */
@ @c
@@ -862,7 +891,7 @@ halfword new_node(int i, int j)
default:
break;
}
- if (int_par(synctex_code)) {
+ if (synctex_par) {
/* handle synctex extension */
switch (i) {
case math_node:
@@ -1063,7 +1092,7 @@ halfword copy_node(const halfword p)
(void) memcpy((void *) (varmem + r), (void *) (varmem + p), (sizeof(memory_word) * (unsigned) i));
- if (int_par(synctex_code)) {
+ if (synctex_par) {
/* handle synctex extension */
switch (type(p)) {
case math_node:
@@ -1224,6 +1253,9 @@ static void flush_node_wrapup_core(halfword p)
break;
case 'd':
break;
+ case 'l':
+ free_user_lua(user_node_value(p));
+ break;
case 'n':
flush_node_list(user_node_value(p));
break;
@@ -2815,7 +2847,7 @@ void show_node_list(int p)
while (p != null) {
print_ln();
print_current_string(); /* display the nesting history */
- if (int_par(tracing_online_code) < -2)
+ if (tracing_online_par < -2)
print_int(p);
incr(n);
if (n > breadth_max) { /* time to stop */
@@ -3296,7 +3328,7 @@ The |subtype| field is set to |min_quarterword|, since that's the desired
halfword new_null_box(void)
{ /* creates a new box node */
halfword p = new_node(hlist_node, min_quarterword);
- box_dir(p) = text_direction;
+ box_dir(p) = text_direction_par;
return p;
}
@@ -3413,7 +3445,7 @@ halfword new_char(int f, int c)
set_to_character(p);
font(p) = f;
character(p) = c;
- lang_data(p) = make_lang_data(uc_hyph, cur_lang, left_hyphen_min, right_hyphen_min);
+ lang_data(p) = make_lang_data(uc_hyph_par, cur_lang_par, left_hyphen_min_par, right_hyphen_min_par);
return p;
}
@@ -3471,7 +3503,7 @@ not chosen.
halfword new_disc(void)
{ /* creates an empty |disc_node| */
halfword p = new_node(disc_node, 0);
- disc_penalty(p) = int_par(hyphen_penalty_code);
+ disc_penalty(p) = hyphen_penalty_par;
return p;
}
@@ -3694,19 +3726,19 @@ halfword make_local_par_node(int mode)
int callback_id;
halfword q;
halfword p = new_node(local_par_node,0);
- local_pen_inter(p) = local_inter_line_penalty;
- local_pen_broken(p) = local_broken_penalty;
- if (local_left_box != null) {
- q = copy_node_list(local_left_box);
+ local_pen_inter(p) = local_inter_line_penalty_par;
+ local_pen_broken(p) = local_broken_penalty_par;
+ if (local_left_box_par != null) {
+ q = copy_node_list(local_left_box_par);
local_box_left(p) = q;
- local_box_left_width(p) = width(local_left_box);
+ local_box_left_width(p) = width(local_left_box_par);
}
- if (local_right_box != null) {
- q = copy_node_list(local_right_box);
+ if (local_right_box_par != null) {
+ q = copy_node_list(local_right_box_par);
local_box_right(p) = q;
- local_box_right_width(p) = width(local_right_box);
+ local_box_right_width(p) = width(local_right_box_par);
}
- local_par_dir(p) = par_direction;
+ local_par_dir(p) = par_direction_par;
/* callback with node passed */
callback_id = callback_defined(insert_local_par_callback);
if (callback_id > 0) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h
index d2174beb370..9a9ef501cf6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.h
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.h
@@ -137,8 +137,6 @@ extern int get_char_cat_code(int);
*/
# define no_expand_flag special_char
-# define end_line_char int_par(end_line_char_code)
-# define end_line_char_inactive ((end_line_char < 0) || (end_line_char > 127))
extern halfword par_loc;
extern halfword par_token;
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w
index 8d147f4e2a8..8f44f686641 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.w
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w
@@ -22,17 +22,6 @@
#include "ptexlib.h"
@ @c
-#define pausing int_par(pausing_code)
-#define cat_code_table int_par(cat_code_table_code)
-#define tracing_nesting int_par(tracing_nesting_code)
-#define suppress_outer_error int_par(suppress_outer_error_code)
-#define suppress_mathpar_error int_par(suppress_mathpar_error_code)
-
-
-#define every_eof equiv(every_eof_loc)
-#define box(A) equiv(box_base+(A))
-#define toks(A) equiv(toks_base+(A))
-
#define detokenized_line() (line_catcode_table==NO_CAT_TABLE)
/*
@@ -42,13 +31,13 @@
else if (line_catcode_table!=DEFAULT_CAT_TABLE) \
a=get_cat_code(line_catcode_table,b); \
else \
- a=get_cat_code(cat_code_table,b); \
+ a=get_cat_code(cat_code_table_par,b); \
} while (0)
*/
#define do_get_cat_code(a,b) do { \
if (line_catcode_table==DEFAULT_CAT_TABLE) \
- a=get_cat_code(cat_code_table,b); \
+ a=get_cat_code(cat_code_table_par,b); \
else if (line_catcode_table>-0xFF) \
a=get_cat_code(line_catcode_table,b); \
else \
@@ -766,7 +755,7 @@ void firm_up_the_line(void)
{
int k; /* an index into |buffer| */
ilimit = last;
- if (pausing > 0) {
+ if (pausing_par > 0) {
if (interaction > nonstop_mode) {
wake_up_terminal();
print_ln();
@@ -795,7 +784,7 @@ void check_outer_validity(void)
{
halfword p; /* points to inserted token list */
halfword q; /* auxiliary pointer */
- if (suppress_outer_error)
+ if (suppress_outer_error_par)
return;
if (scanner_status != normal) {
deletions_allowed = false;
@@ -980,7 +969,7 @@ static boolean get_next_file(void)
case skip_blanks + escape_cmd:
/* Scan a control sequence ...; */
istate = (unsigned char) scan_control_sequence();
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
break;
case mid_line + active_char_cmd:
@@ -991,7 +980,7 @@ static boolean get_next_file(void)
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
istate = mid_line;
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
break;
case mid_line + sup_mark_cmd:
@@ -1041,7 +1030,7 @@ static boolean get_next_file(void)
cur_cs = par_loc;
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
break;
case skip_blanks + left_brace_cmd:
@@ -1141,7 +1130,7 @@ static boolean get_next_file(void)
switch (c-new_line) {
case escape_cmd:
istate = (unsigned char) scan_control_sequence();
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case left_brace_cmd:
@@ -1164,7 +1153,7 @@ static boolean get_next_file(void)
cur_cs = par_loc;
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case mac_param_cmd:
@@ -1196,7 +1185,7 @@ static boolean get_next_file(void)
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
istate = mid_line;
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case comment_cmd:
@@ -1214,7 +1203,7 @@ static boolean get_next_file(void)
case escape_cmd:
/* Scan a control sequence ...; */
istate = (unsigned char) scan_control_sequence();
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case left_brace_cmd:
@@ -1262,7 +1251,7 @@ static boolean get_next_file(void)
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
istate = mid_line;
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case comment_cmd:
@@ -1281,7 +1270,7 @@ static boolean get_next_file(void)
switch (c-mid_line) {
case escape_cmd:
istate = (unsigned char) scan_control_sequence();
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case left_brace_cmd:
@@ -1334,7 +1323,7 @@ static boolean get_next_file(void)
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
istate = mid_line;
- if (! suppress_outer_error && cur_cmd >= outer_call_cmd)
+ if (! suppress_outer_error_par && cur_cmd >= outer_call_cmd)
check_outer_validity();
return true;
case comment_cmd:
@@ -1694,11 +1683,11 @@ one more branch.
line_catcode_table = DEFAULT_CAT_TABLE;
if ((iname == 19) && (pseudo_lines(pseudo_files) == null))
inhibit_eol = true;
- } else if ((every_eof != null) && !eof_seen[iindex]) {
+ } else if ((every_eof_par != null) && !eof_seen[iindex]) {
ilimit = first - 1;
eof_seen[iindex] = true; /* fake one empty line */
if (iname != 19)
- begin_token_list(every_eof, every_eof_text);
+ begin_token_list(every_eof_par, every_eof_text);
return next_line_restart;
} else {
force_eof = true;
@@ -1721,10 +1710,10 @@ one more branch.
if (lua_input_ln(cur_file, 0, true)) { /* not end of file */
firm_up_the_line(); /* this sets |ilimit| */
line_catcode_table = DEFAULT_CAT_TABLE;
- } else if ((every_eof != null) && (!eof_seen[iindex])) {
+ } else if ((every_eof_par != null) && (!eof_seen[iindex])) {
ilimit = first - 1;
eof_seen[iindex] = true; /* fake one empty line */
- begin_token_list(every_eof, every_eof_text);
+ begin_token_list(every_eof_par, every_eof_text);
return next_line_restart;
} else {
force_eof = true;
@@ -1733,7 +1722,7 @@ one more branch.
}
}
if (force_eof) {
- if (tracing_nesting > 0)
+ if (tracing_nesting_par > 0)
if ((grp_stack[in_open] != cur_boundary) || (if_stack[in_open] != cond_ptr))
if (!((iname == 19) || (iname == 21))) {
/* give warning for some unfinished groups and/or conditionals */
@@ -1749,7 +1738,7 @@ one more branch.
end_file_reading();
} else {
end_file_reading();
- if (! suppress_outer_error)
+ if (! suppress_outer_error_par)
check_outer_validity();
}
return next_line_restart;
@@ -1757,7 +1746,7 @@ one more branch.
if (inhibit_eol || end_line_char_inactive)
ilimit--;
else
- buffer[ilimit] = (packed_ASCII_code) end_line_char;
+ buffer[ilimit] = (packed_ASCII_code) end_line_char_par;
first = ilimit + 1;
iloc = istart; /* ready to read */
} else {
@@ -1788,7 +1777,7 @@ one more branch.
if (end_line_char_inactive)
ilimit--;
else
- buffer[ilimit] = (packed_ASCII_code) end_line_char;
+ buffer[ilimit] = (packed_ASCII_code) end_line_char_par;
first = ilimit + 1;
iloc = istart;
} else {
@@ -1829,7 +1818,7 @@ static boolean get_next_tokenlist(void)
cur_chr = no_expand_flag;
return true;
}
- } else if (! suppress_outer_error) {
+ } else if (! suppress_outer_error_par) {
check_outer_validity();
}
}
@@ -2364,7 +2353,7 @@ static int do_feedback_dvi(halfword c)
/* codes not really needed but cleaner when testing */
-#define pdftex_version 40 /* these values will not change any more */
+#define pdftex_version 140 /* these values will not change any more */
#define pdftex_revision "0" /* these values will not change any more */
static int do_feedback_pdf(halfword c)
@@ -3154,7 +3143,7 @@ void read_toks(int n, halfword r, halfword j)
if (end_line_char_inactive)
decr(ilimit);
else
- buffer[ilimit] = (packed_ASCII_code) int_par(end_line_char_code);
+ buffer[ilimit] = (packed_ASCII_code) end_line_char_par;
first = ilimit + 1;
iloc = istart;
istate = new_line;
@@ -3285,7 +3274,7 @@ char *tokenlist_to_cstring(int pp, int inhibit_par, int *siz)
ret = xmalloc(alloci);
p = token_link(p); /* skip refcount */
if (p != null) {
- e = int_par(escape_char_code);
+ e = escape_char_par;
}
while (p != null) {
if (p < (int) fix_mem_min || p > (int) fix_mem_end) {