summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/align.w38
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/buildpage.w12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.h451
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.w1122
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/conditional.w15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/directions.h358
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/directions.w22
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h534
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.h11
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.w171
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/expand.w13
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.h124
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.w1088
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/linebreak.h55
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/linebreak.w242
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.w29
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.w192
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.h5
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.w2748
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/packaging.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/packaging.w299
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/postlinebreak.w157
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/primitive.h15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/primitive.w56
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.h77
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w27
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.w84
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.w564
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h657
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.w1899
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.h20
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.w940
36 files changed, 6769 insertions, 5276 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/align.w b/Build/source/texk/web2c/luatexdir/tex/align.w
index 5b8a1a4417e..75c3f932252 100644
--- a/Build/source/texk/web2c/luatexdir/tex/align.w
+++ b/Build/source/texk/web2c/luatexdir/tex/align.w
@@ -45,9 +45,8 @@ void init_col(void);
@ It's sort of a miracle whenever \.{\\halign} and \.{\\valign} work, because
they cut across so many of the control structures of \TeX.
-Therefore the
-present page is probably not the best place for a beginner to start reading
-this program; it is better to master everything else first.
+Therefore the present page is probably not the best place for a beginner to
+start reading this program; it is better to master everything else first.
Let us focus our thoughts on an example of what the input might be, in order
to get some idea about how the alignment miracle happens. The example doesn't
@@ -172,8 +171,6 @@ called upon to step in and do some little action, but most of the time
these routines just lurk in the background. It's something like
post-hypnotic suggestion.
-
-
@ We have mentioned that alignrecords contain no |height| or |depth| fields.
Their |glue_sign| and |glue_order| are pre-empted as well, since it
is necessary to store information about what to do when a template ends.
@@ -185,7 +182,6 @@ This information is called the |extra_info| field.
#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,
indicating the beginning of the preamble list; a |cur_align| pointer,
@@ -219,6 +215,13 @@ pointer cur_pre_head = null, cur_pre_tail = null; /* pre-adjustment list p
@ Alignment stack maintenance is handled by a pair of trivial routines
called |push_alignment| and |pop_alignment|.
+(HH:) It makes not much sense to add support for an \.{attr} keyword to
+\.{\\halign} and \.{\\valign} because then we need to decide if we tag
+rows or cells or both or come up with \.{cellattr} and \.{rowattr} and
+such. But then it even makes sense to have explicit commands (in addition
+to the seperator) to tags individual cells. Too muss hassle for now and the
+advantages are not that large.
+
@c
static void push_alignment(void)
{
@@ -773,7 +776,7 @@ void fin_row(void)
pop_nest();
if (cur_pre_head != cur_pre_tail)
append_list(cur_pre_head, cur_pre_tail);
- append_to_vlist(p);
+ append_to_vlist(p,lua_key_index(alignment));
if (cur_head != cur_tail)
append_list(cur_head, cur_tail);
} else {
@@ -817,7 +820,7 @@ void fin_align(void)
else
o = 0;
/* Go through the preamble list, determining the column widths and
- * changing the alignrecords to dummy unset boxes
+ * changing the alignrecords to dummy unset boxes
*/
/* It's time now to dismantle the preamble list and to compute the column
@@ -952,11 +955,11 @@ value is changed to zero and so is the next tabskip.
if (cur_list.mode_field == -vmode) {
type(q) = hlist_node;
- subtype(q) = HLIST_SUBTYPE_ALIGNROW;
+ subtype(q) = align_row_list;
width(q) = width(p);
} else {
type(q) = vlist_node;
- subtype(q) = HLIST_SUBTYPE_ALIGNROW;
+ subtype(q) = align_row_list;
height(q) = height(p);
}
glue_order(q) = glue_order(p);
@@ -1004,7 +1007,7 @@ value is changed to zero and so is the next tabskip.
vlink(u) = rr;
u = vlink(u);
t = t + width(s);
- subtype(u) = HLIST_SUBTYPE_ALIGNCELL;
+ subtype(u) = align_cell_list;
if (cur_list.mode_field == -vmode) {
width(u) = width(s);
} else {
@@ -1046,7 +1049,7 @@ value is changed to zero and so is the next tabskip.
}
width(r) = w;
type(r) = hlist_node;
- subtype(r) = HLIST_SUBTYPE_ALIGNCELL;
+ subtype(r) = align_cell_list;
} else {
/* Make the unset node |r| into a |vlist_node| of height |w|,
@@ -1078,7 +1081,7 @@ value is changed to zero and so is the next tabskip.
}
height(r) = w;
type(r) = vlist_node;
- subtype(r) = HLIST_SUBTYPE_ALIGNCELL;
+ subtype(r) = align_cell_list;
}
/* subtype(r) = 0; */
@@ -1107,7 +1110,7 @@ value is changed to zero and so is the next tabskip.
vlink(q) = null;
q = hpack(q, 0, additional, -1);
shift_amount(q) = o;
- subtype(q) = HLIST_SUBTYPE_ALIGNCELL;
+ subtype(q) = align_cell_list;
vlink(q) = r;
vlink(s) = q;
}
@@ -1123,7 +1126,7 @@ value is changed to zero and so is the next tabskip.
and ends at |cur_list.tail_field|. This list will be merged with the one that encloses
it. (In case the enclosing mode is |mmode|, for displayed formulas,
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.)
+ program will be deferred until we're more familiar with such operations.)
*/
pd = cur_list.prev_depth_field;
p = vlink(cur_list.head_field);
@@ -1138,15 +1141,12 @@ value is changed to zero and so is the next tabskip.
cur_list.tail_field = q;
if (cur_list.mode_field == vmode) {
if (!output_active)
- // lua_node_filter_s(buildpage_filter_callback, "alignment");
- lua_node_filter_s(buildpage_filter_callback,lua_key_index(alignment));
+ lua_node_filter_s(buildpage_filter_callback,lua_key_index(alignment));
build_page();
}
}
}
-
-
@ The token list |omit_template| just referred to is a constant token
list that contains the special control sequence \.{\\endtemplate} only.
diff --git a/Build/source/texk/web2c/luatexdir/tex/buildpage.w b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
index 54a57d15d0d..a1807b91993 100644
--- a/Build/source/texk/web2c/luatexdir/tex/buildpage.w
+++ b/Build/source/texk/web2c/luatexdir/tex/buildpage.w
@@ -402,16 +402,9 @@ void build_page(void)
}
break;
+ case boundary_node:
case whatsit_node:
- /* Prepare to move whatsit |p| to the current page,
- then |goto contribute| */
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node)) {
- page_total = page_total + page_depth + height(p);
- page_depth = depth(p);
- }
goto CONTRIBUTE;
-
break;
case glue_node:
if (page_contents < box_there)
@@ -1050,8 +1043,7 @@ void resume_after_output(void)
flush_node_list(page_disc);
page_disc = null;
pop_nest();
- //lua_node_filter_s(buildpage_filter_callback, "after_output");
lua_node_filter_s(buildpage_filter_callback,lua_key_index(after_output));
- build_page();
+ build_page();
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h
index c8200ab93f8..b14c59f783f 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.h
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.h
@@ -1,5 +1,5 @@
/* commands.h
-
+
Copyright 2008 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -61,162 +61,164 @@ The ``expandable'' commands come first.
*/
typedef enum {
- relax_cmd = 0, /* do nothing ( \.{\\relax} ) */
-# define escape_cmd relax_cmd /* escape delimiter (called \.\\ in {\sl The \TeX book\/}) */
- left_brace_cmd, /* beginning of a group ( \.\{ ) */
- right_brace_cmd, /* ending of a group ( \.\} ) */
- math_shift_cmd, /* mathematics shift character ( \.\$ ) */
- tab_mark_cmd, /* alignment delimiter ( \.\&, \.{\\span} ) */
- car_ret_cmd, /* end of line ( |carriage_return|, \.{\\cr}, \.{\\crcr} ) */
-# define out_param_cmd car_ret_cmd /* output a macro parameter */
- mac_param_cmd, /* macro parameter symbol ( \.\# ) */
- sup_mark_cmd, /* superscript ( \.{\char'136} ) */
- sub_mark_cmd, /* subscript ( \.{\char'137} ) */
- endv_cmd, /* end of \<v_j> list in alignment template */
-# define ignore_cmd endv_cmd /* characters to ignore ( \.{\^\^@@} ) */
- spacer_cmd, /* characters equivalent to blank space ( \.{\ } ) */
- letter_cmd, /* characters regarded as letters ( \.{A..Z}, \.{a..z} ) */
- other_char_cmd, /* none of the special character types */
- par_end_cmd, /* end of paragraph ( \.{\\par} ) */
-# define active_char_cmd par_end_cmd /* characters that invoke macros ( \.{\char`\~} ) */
-# define match_cmd par_end_cmd /* match a macro parameter */
- stop_cmd, /* end of job ( \.{\\end}, \.{\\dump} ) */
-# define comment_cmd stop_cmd /* characters that introduce comments ( \.\% ) */
-# define end_match_cmd stop_cmd /* end of parameters to macro */
- delim_num_cmd, /* specify delimiter numerically ( \.{\\delimiter} ) */
-# define invalid_char_cmd delim_num_cmd /* characters that shouldn't appear ( \.{\^\^?} ) */
-# define max_char_code_cmd delim_num_cmd
- /* largest catcode for individual characters */
- char_num_cmd, /* character specified numerically ( \.{\\char} ) */
- math_char_num_cmd, /* explicit math code ( \.{\\mathchar} ) */
- mark_cmd, /* mark definition ( \.{\\mark} ) */
- xray_cmd, /* peek inside of \TeX\ ( \.{\\show}, \.{\\showbox}, etc.~) */
- make_box_cmd, /* make a box ( \.{\\box}, \.{\\copy}, \.{\\hbox}, etc.~) */
- hmove_cmd, /* horizontal motion ( \.{\\moveleft}, \.{\\moveright} ) */
- vmove_cmd, /* vertical motion ( \.{\\raise}, \.{\\lower} ) */
- un_hbox_cmd, /* unglue a box ( \.{\\unhbox}, \.{\\unhcopy} ) */
- un_vbox_cmd, /* unglue a box ( \.{\\unvbox}, \.{\\unvcopy} or
- \.{\\pagediscards}, \.{\\splitdiscards} ) */
- remove_item_cmd, /* nullify last item ( \.{\\unpenalty}, \.{\\unkern}, \.{\\unskip} ) */
- hskip_cmd, /* horizontal glue ( \.{\\hskip}, \.{\\hfil}, etc.~) */
- vskip_cmd, /* vertical glue ( \.{\\vskip}, \.{\\vfil}, etc.~) */
- mskip_cmd, /* math glue ( \.{\\mskip} ) */
- kern_cmd, /* fixed space ( \.{\\kern}) */
- mkern_cmd, /* math kern ( \.{\\mkern} ) */
- leader_ship_cmd, /* use a box ( \.{\\shipout}, \.{\\leaders}, etc.~) */
- halign_cmd, /* horizontal table alignment ( \.{\\halign} ) */
- valign_cmd, /* vertical table alignment ( \.{\\valign} ) */
- no_align_cmd, /* temporary escape from alignment ( \.{\\noalign} ) */
- vrule_cmd, /* vertical rule ( \.{\\vrule} ) */
- hrule_cmd, /* horizontal rule ( \.{\\hrule} ) */
- insert_cmd, /* vlist inserted in box ( \.{\\insert} ) */
- vadjust_cmd, /* vlist inserted in enclosing paragraph ( \.{\\vadjust} ) */
- ignore_spaces_cmd, /* gobble |spacer| tokens ( \.{\\ignorespaces} ) */
- after_assignment_cmd, /* save till assignment is done ( \.{\\afterassignment} ) */
- after_group_cmd, /* save till group is done ( \.{\\aftergroup} ) */
- break_penalty_cmd, /* additional badness ( \.{\\penalty} ) */
- start_par_cmd, /* begin paragraph ( \.{\\indent}, \.{\\noindent} ) */
- ital_corr_cmd, /* italic correction ( \.{\\/} ) */
- accent_cmd, /* attach accent in text ( \.{\\accent} ) */
- math_accent_cmd, /* attach accent in math ( \.{\\mathaccent} ) */
- discretionary_cmd, /* discretionary texts ( \.{\\-}, \.{\\discretionary} ) */
- eq_no_cmd, /* equation number ( \.{\\eqno}, \.{\\leqno} ) */
- left_right_cmd, /* variable delimiter ( \.{\\left}, \.{\\right} or \.{\\middle} ) */
- math_comp_cmd, /* component of formula ( \.{\\mathbin}, etc.~) */
- limit_switch_cmd, /* diddle limit conventions ( \.{\\displaylimits}, etc.~) */
- above_cmd, /* generalized fraction ( \.{\\above}, \.{\\atop}, etc.~) */
- math_style_cmd, /* style specification ( \.{\\displaystyle}, etc.~) */
- math_choice_cmd, /* choice specification ( \.{\\mathchoice} ) */
- non_script_cmd, /* conditional math glue ( \.{\\nonscript} ) */
- vcenter_cmd, /* vertically center a vbox ( \.{\\vcenter} ) */
- case_shift_cmd, /* force specific case ( \.{\\lowercase}, \.{\\uppercase}~) */
- message_cmd, /* send to user ( \.{\\message}, \.{\\errmessage} ) */
- extension_cmd, /* extensions to \TeX\ ( \.{\\write}, \.{\\special}, etc.~) */
- in_stream_cmd, /* files for reading ( \.{\\openin}, \.{\\closein} ) */
- begin_group_cmd, /* begin local grouping ( \.{\\begingroup} ) */
- end_group_cmd, /* end local grouping ( \.{\\endgroup} ) */
- omit_cmd, /* omit alignment template ( \.{\\omit} ) */
- ex_space_cmd, /* explicit space ( \.{\\\ } ) */
- no_boundary_cmd, /* suppress boundary ligatures ( \.{\\noboundary} ) */
- radical_cmd, /* square root and similar signs ( \.{\\radical} ) */
- super_sub_script_cmd, /* explicit super- or subscript */
- math_shift_cs_cmd, /* start- and endmath */
- end_cs_name_cmd, /* end control sequence ( \.{\\endcsname} ) */
- char_ghost_cmd, /* \.{\\leftghost}, \.{\\rightghost} character for kerning */
- assign_local_box_cmd, /* box for guillemets \.{\\localleftbox} or \.{\\localrightbox} */
- char_given_cmd, /* character code defined by \.{\\chardef} */
-# define min_internal_cmd char_given_cmd
- /* the smallest code that can follow \.{\\the} */
- math_given_cmd, /* math code defined by \.{\\mathchardef} */
- xmath_given_cmd, /* math code defined by \.{\\Umathchardef} or \.{\\Umathcharnumdef} */
- last_item_cmd, /* most recent item ( \.{\\lastpenalty}, \.{\\lastkern}, \.{\\lastskip} ) */
+ relax_cmd = 0, /* do nothing ( \.{\\relax} ) */
+# define escape_cmd relax_cmd /* escape delimiter (called \.\\ in {\sl The \TeX book\/}) */
+ left_brace_cmd, /* beginning of a group ( \.\{ ) */
+ right_brace_cmd, /* ending of a group ( \.\} ) */
+ math_shift_cmd, /* mathematics shift character ( \.\$ ) */
+ tab_mark_cmd, /* alignment delimiter ( \.\&, \.{\\span} ) */
+ car_ret_cmd, /* end of line ( |carriage_return|, \.{\\cr}, \.{\\crcr} ) */
+# define out_param_cmd car_ret_cmd /* output a macro parameter */
+ mac_param_cmd, /* macro parameter symbol ( \.\# ) */
+ sup_mark_cmd, /* superscript ( \.{\char'136} ) */
+ sub_mark_cmd, /* subscript ( \.{\char'137} ) */
+ endv_cmd, /* end of \<v_j> list in alignment template */
+# define ignore_cmd endv_cmd /* characters to ignore ( \.{\^\^@@} ) */
+ spacer_cmd, /* characters equivalent to blank space ( \.{\ } ) */
+ letter_cmd, /* characters regarded as letters ( \.{A..Z}, \.{a..z} ) */
+ other_char_cmd, /* none of the special character types */
+ par_end_cmd, /* end of paragraph ( \.{\\par} ) */
+# define active_char_cmd par_end_cmd /* characters that invoke macros ( \.{\char`\~} ) */
+# define match_cmd par_end_cmd /* match a macro parameter */
+ stop_cmd, /* end of job ( \.{\\end}, \.{\\dump} ) */
+# define comment_cmd stop_cmd /* characters that introduce comments ( \.\% ) */
+# define end_match_cmd stop_cmd /* end of parameters to macro */
+ delim_num_cmd, /* specify delimiter numerically ( \.{\\delimiter} ) */
+# define invalid_char_cmd delim_num_cmd /* characters that shouldn't appear ( \.{\^\^?} ) */
+# define max_char_code_cmd delim_num_cmd /* largest catcode for individual characters */
+ char_num_cmd, /* character specified numerically ( \.{\\char} ) */
+ math_char_num_cmd, /* explicit math code ( \.{\\mathchar} ) */
+ mark_cmd, /* mark definition ( \.{\\mark} ) */
+ xray_cmd, /* peek inside of \TeX\ ( \.{\\show}, \.{\\showbox}, etc.~) */
+ make_box_cmd, /* make a box ( \.{\\box}, \.{\\copy}, \.{\\hbox}, etc.~) */
+ hmove_cmd, /* horizontal motion ( \.{\\moveleft}, \.{\\moveright} ) */
+ vmove_cmd, /* vertical motion ( \.{\\raise}, \.{\\lower} ) */
+ un_hbox_cmd, /* unglue a box ( \.{\\unhbox}, \.{\\unhcopy} ) */
+ un_vbox_cmd, /* unglue a box ( \.{\\unvbox}, \.{\\unvcopy} or \.{\\pagediscards}, \.{\\splitdiscards} ) */
+ remove_item_cmd, /* nullify last item ( \.{\\unpenalty}, \.{\\unkern}, \.{\\unskip} ) */
+ hskip_cmd, /* horizontal glue ( \.{\\hskip}, \.{\\hfil}, etc.~) */
+ vskip_cmd, /* vertical glue ( \.{\\vskip}, \.{\\vfil}, etc.~) */
+ mskip_cmd, /* math glue ( \.{\\mskip} ) */
+ kern_cmd, /* fixed space ( \.{\\kern}) */
+ mkern_cmd, /* math kern ( \.{\\mkern} ) */
+ leader_ship_cmd, /* use a box ( \.{\\shipout}, \.{\\leaders}, etc.~) */
+ halign_cmd, /* horizontal table alignment ( \.{\\halign} ) */
+ valign_cmd, /* vertical table alignment ( \.{\\valign} ) */
+ no_align_cmd, /* temporary escape from alignment ( \.{\\noalign} ) */
+ vrule_cmd, /* vertical rule ( \.{\\vrule} ) */
+ hrule_cmd, /* horizontal rule ( \.{\\hrule} ) */
+ no_vrule_cmd, /* no rule, just reserve space ( \.{\\novrule} )*/
+ no_hrule_cmd, /* no rule, just reserve space ( \.{\\nohrule} )*/
+ insert_cmd, /* vlist inserted in box ( \.{\\insert} ) */
+ vadjust_cmd, /* vlist inserted in enclosing paragraph ( \.{\\vadjust} ) */
+ ignore_spaces_cmd, /* gobble |spacer| tokens ( \.{\\ignorespaces} ) */
+ after_assignment_cmd, /* save till assignment is done ( \.{\\afterassignment} ) */
+ after_group_cmd, /* save till group is done ( \.{\\aftergroup} ) */
+ break_penalty_cmd, /* additional badness ( \.{\\penalty} ) */
+ start_par_cmd, /* begin paragraph ( \.{\\indent}, \.{\\noindent} ) */
+ ital_corr_cmd, /* italic correction ( \.{\\/} ) */
+ accent_cmd, /* attach accent in text ( \.{\\accent} ) */
+ math_accent_cmd, /* attach accent in math ( \.{\\mathaccent} ) */
+ discretionary_cmd, /* discretionary texts ( \.{\\-}, \.{\\discretionary} ) */
+ eq_no_cmd, /* equation number ( \.{\\eqno}, \.{\\leqno} ) */
+ left_right_cmd, /* variable delimiter ( \.{\\left}, \.{\\right} or \.{\\middle} ) */
+ math_comp_cmd, /* component of formula ( \.{\\mathbin}, etc.~) */
+ limit_switch_cmd, /* diddle limit conventions ( \.{\\displaylimits}, etc.~) */
+ above_cmd, /* generalized fraction ( \.{\\above}, \.{\\atop}, etc.~) */
+ math_style_cmd, /* style specification ( \.{\\displaystyle}, etc.~) */
+ math_choice_cmd, /* choice specification ( \.{\\mathchoice} ) */
+ non_script_cmd, /* conditional math glue ( \.{\\nonscript} ) */
+ vcenter_cmd, /* vertically center a vbox ( \.{\\vcenter} ) */
+ case_shift_cmd, /* force specific case ( \.{\\lowercase}, \.{\\uppercase}~) */
+ message_cmd, /* send to user ( \.{\\message}, \.{\\errmessage} ) */
+ normal_cmd, /* general extensions to \TeX\ that don't fit into a category */
+ extension_cmd, /* extensions to \TeX\ ( \.{\\write}, \.{\\special}, etc.~) */
+ option_cmd,
+ in_stream_cmd, /* files for reading ( \.{\\openin}, \.{\\closein} ) */
+ begin_group_cmd, /* begin local grouping ( \.{\\begingroup} ) */
+ end_group_cmd, /* end local grouping ( \.{\\endgroup} ) */
+ omit_cmd, /* omit alignment template ( \.{\\omit} ) */
+ ex_space_cmd, /* explicit space ( \.{\\\ } ) */
+ boundary_cmd, /* insert boundry node with value ( \.{\\boundary} ) */
+ no_boundary_cmd, /* suppress boundary ligatures ( \.{\\noboundary} ) */
+ radical_cmd, /* square root and similar signs ( \.{\\radical} ) */
+ super_sub_script_cmd, /* explicit super- or subscript */
+ math_shift_cs_cmd, /* start- and endmath */
+ end_cs_name_cmd, /* end control sequence ( \.{\\endcsname} ) */
+ char_ghost_cmd, /* \.{\\leftghost}, \.{\\rightghost} character for kerning */
+ assign_local_box_cmd, /* box for guillemets \.{\\localleftbox} or \.{\\localrightbox} */
+ char_given_cmd, /* character code defined by \.{\\chardef} */
+# define min_internal_cmd char_given_cmd /* the smallest code that can follow \.{\\the} */
+ math_given_cmd, /* math code defined by \.{\\mathchardef} */
+ xmath_given_cmd, /* math code defined by \.{\\Umathchardef} or \.{\\Umathcharnumdef} */
+ last_item_cmd, /* most recent item ( \.{\\lastpenalty}, \.{\\lastkern}, \.{\\lastskip} ) */
# define max_non_prefixed_command_cmd last_item_cmd /* largest command code that can't be \.{\\global} */
- toks_register_cmd, /* token list register ( \.{\\toks} ) */
- assign_toks_cmd, /* special token list ( \.{\\output}, \.{\\everypar}, etc.~) */
- assign_int_cmd, /* user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~) */
- assign_attr_cmd, /* user-defined attributes */
- assign_dimen_cmd, /* user-defined length ( \.{\\hsize}, etc.~) */
- assign_glue_cmd, /* user-defined glue ( \.{\\baselineskip}, etc.~) */
- 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} ) */
- 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.~) */
- set_page_int_cmd, /* specify state info ( \.{\\deadcycles}, \.{\\insertpenalties} ) */
- set_box_dimen_cmd, /* change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} ) */
- set_tex_shape_cmd, /* specify fancy paragraph shape ( \.{\\parshape} ) */
- set_etex_shape_cmd, /* specify etex extended list ( \.{\\interlinepenalties}, etc.~) */
- def_char_code_cmd, /* define a character code ( \.{\\catcode}, etc.~) */
- def_del_code_cmd, /* define a delimiter code ( \.{\\delcode}) */
- extdef_math_code_cmd, /* define an extended character code ( \.{\\Umathcode}, etc.~) */
- extdef_del_code_cmd, /* define an extended delimiter code ( \.{\\Udelcode}, etc.~) */
- def_family_cmd, /* declare math fonts ( \.{\\textfont}, etc.~) */
- set_math_param_cmd, /* set math parameters ( \.{\\mathquad}, etc.~) */
- set_font_cmd, /* set current font ( font identifiers ) */
- def_font_cmd, /* define a font file ( \.{\\font} ) */
- register_cmd, /* internal register ( \.{\\count}, \.{\\dimen}, etc.~) */
- assign_box_dir_cmd, /* (\.{\\boxdir}) */
- assign_dir_cmd, /* (\.{\\pagedir}, \.{\\textdir}) */
-# define max_internal_cmd assign_dir_cmd
- /* the largest code that can follow \.{\\the} */
- advance_cmd, /* advance a register or parameter ( \.{\\advance} ) */
- multiply_cmd, /* multiply a register or parameter ( \.{\\multiply} ) */
- divide_cmd, /* divide a register or parameter ( \.{\\divide} ) */
- prefix_cmd, /* qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} ) */
- let_cmd, /* assign a command code ( \.{\\let}, \.{\\futurelet} ) */
- shorthand_def_cmd, /* code definition ( \.{\\chardef}, \.{\\countdef}, etc.~) */
- read_to_cs_cmd, /* read into a control sequence ( \.{\\read} ) */
- def_cmd, /* macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} ) */
- set_box_cmd, /* set a box ( \.{\\setbox} ) */
- hyph_data_cmd, /* hyphenation data ( \.{\\hyphenation}, \.{\\patterns} ) */
- set_interaction_cmd, /* define level of interaction ( \.{\\batchmode}, etc.~) */
- letterspace_font_cmd, /* letterspace a font ( \.{\\letterspacefont} ) */
- pdf_copy_font_cmd, /* create a new font instance ( \.{\\pdfcopyfont} ) */
- undefined_cs_cmd, /* initial state of most |eq_type| fields */
- expand_after_cmd, /* special expansion ( \.{\\expandafter} ) */
- no_expand_cmd, /* special nonexpansion ( \.{\\noexpand} ) */
- input_cmd, /* input a source file ( \.{\\input}, \.{\\endinput} or
- \.{\\scantokens} or \.{\\scantextokens} ) */
- if_test_cmd, /* conditional text ( \.{\\if}, \.{\\ifcase}, etc.~) */
- fi_or_else_cmd, /* delimiters for conditionals ( \.{\\else}, etc.~) */
- cs_name_cmd, /* make a control sequence from tokens ( \.{\\csname} ) */
- convert_cmd, /* convert to text ( \.{\\number}, \.{\\string}, etc.~) */
- the_cmd, /* expand an internal quantity ( \.{\\the} or \.{\\unexpanded}, \.{\\detokenize} ) */
- top_bot_mark_cmd, /* inserted mark ( \.{\\topmark}, etc.~) */
- call_cmd, /* non-long, non-outer control sequence */
- long_call_cmd, /* long, non-outer control sequence */
- outer_call_cmd, /* non-long, outer control sequence */
- long_outer_call_cmd, /* long, outer control sequence */
- end_template_cmd, /* end of an alignment template */
- dont_expand_cmd, /* the following token was marked by \.{\\noexpand} */
- glue_ref_cmd, /* the equivalent points to a glue specification */
- shape_ref_cmd, /* the equivalent points to a parshape specification */
- box_ref_cmd, /* the equivalent points to a box node, or is |null| */
- data_cmd, /* the equivalent is simply a halfword number */
+ toks_register_cmd, /* token list register ( \.{\\toks} ) */
+ assign_toks_cmd, /* special token list ( \.{\\output}, \.{\\everypar}, etc.~) */
+ assign_int_cmd, /* user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~) */
+ assign_attr_cmd, /* user-defined attributes */
+ assign_dimen_cmd, /* user-defined length ( \.{\\hsize}, etc.~) */
+ assign_glue_cmd, /* user-defined glue ( \.{\\baselineskip}, etc.~) */
+ 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} ) */
+ 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.~) */
+ set_page_int_cmd, /* specify state info ( \.{\\deadcycles}, \.{\\insertpenalties} ) */
+ set_box_dimen_cmd, /* change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} ) */
+ set_tex_shape_cmd, /* specify fancy paragraph shape ( \.{\\parshape} ) */
+ set_etex_shape_cmd, /* specify etex extended list ( \.{\\interlinepenalties}, etc.~) */
+ def_char_code_cmd, /* define a character code ( \.{\\catcode}, etc.~) */
+ def_del_code_cmd, /* define a delimiter code ( \.{\\delcode}) */
+ extdef_math_code_cmd, /* define an extended character code ( \.{\\Umathcode}, etc.~) */
+ extdef_del_code_cmd, /* define an extended delimiter code ( \.{\\Udelcode}, etc.~) */
+ def_family_cmd, /* declare math fonts ( \.{\\textfont}, etc.~) */
+ set_math_param_cmd, /* set math parameters ( \.{\\mathquad}, etc.~) */
+ set_font_cmd, /* set current font ( font identifiers ) */
+ def_font_cmd, /* define a font file ( \.{\\font} ) */
+ register_cmd, /* internal register ( \.{\\count}, \.{\\dimen}, etc.~) */
+ assign_box_dir_cmd, /* (\.{\\boxdir}) */
+ assign_dir_cmd, /* (\.{\\pagedir}, \.{\\textdir}) */
+# define max_internal_cmd assign_dir_cmd /* the largest code that can follow \.{\\the} */
+ advance_cmd, /* advance a register or parameter ( \.{\\advance} ) */
+ multiply_cmd, /* multiply a register or parameter ( \.{\\multiply} ) */
+ divide_cmd, /* divide a register or parameter ( \.{\\divide} ) */
+ prefix_cmd, /* qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} ) */
+ let_cmd, /* assign a command code ( \.{\\let}, \.{\\futurelet} ) */
+ shorthand_def_cmd, /* code definition ( \.{\\chardef}, \.{\\countdef}, etc.~) */
+ read_to_cs_cmd, /* read into a control sequence ( \.{\\read} ) */
+ def_cmd, /* macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} ) */
+ set_box_cmd, /* set a box ( \.{\\setbox} ) */
+ hyph_data_cmd, /* hyphenation data ( \.{\\hyphenation}, \.{\\patterns} ) */
+ set_interaction_cmd, /* define level of interaction ( \.{\\batchmode}, etc.~) */
+ letterspace_font_cmd, /* letterspace a font ( \.{\\letterspacefont} ) */
+ expand_font_cmd, /* expand glyphs ( \.{\\expandglyphsinfont} ) */
+ copy_font_cmd, /* create a new font instance ( \.{\\copyfont} ) */
+ set_font_id_cmd,
+ undefined_cs_cmd, /* initial state of most |eq_type| fields */
+ expand_after_cmd, /* special expansion ( \.{\\expandafter} ) */
+ no_expand_cmd, /* special nonexpansion ( \.{\\noexpand} ) */
+ input_cmd, /* input a source file ( \.{\\input}, \.{\\endinput} or \.{\\scantokens} or \.{\\scantextokens} ) */
+ if_test_cmd, /* conditional text ( \.{\\if}, \.{\\ifcase}, etc.~) */
+ fi_or_else_cmd, /* delimiters for conditionals ( \.{\\else}, etc.~) */
+ cs_name_cmd, /* make a control sequence from tokens ( \.{\\csname} ) */
+ convert_cmd, /* convert to text ( \.{\\number}, \.{\\string}, etc.~) */
+ the_cmd, /* expand an internal quantity ( \.{\\the} or \.{\\unexpanded}, \.{\\detokenize} ) */
+ top_bot_mark_cmd, /* inserted mark ( \.{\\topmark}, etc.~) */
+ call_cmd, /* non-long, non-outer control sequence */
+ long_call_cmd, /* long, non-outer control sequence */
+ outer_call_cmd, /* non-long, outer control sequence */
+ long_outer_call_cmd, /* long, outer control sequence */
+ end_template_cmd, /* end of an alignment template */
+ dont_expand_cmd, /* the following token was marked by \.{\\noexpand} */
+ glue_ref_cmd, /* the equivalent points to a glue specification */
+ shape_ref_cmd, /* the equivalent points to a parshape specification */
+ box_ref_cmd, /* the equivalent points to a box node, or is |null| */
+ data_cmd, /* the equivalent is simply a halfword number */
} tex_command_code;
-# define max_command_cmd pdf_copy_font_cmd /* the largest command code seen at |big_switch| */
+# define max_command_cmd set_font_id_cmd /* the largest command code seen at |big_switch| */
# define last_cmd data_cmd
# define max_non_prefixed_command last_item_cmd
@@ -224,7 +226,8 @@ typedef enum {
above_code = 0,
over_code = 1,
atop_code = 2,
- delimited_code = 3
+ skewed_code = 3,
+ delimited_code = 4,
} fraction_codes;
typedef enum {
@@ -236,21 +239,12 @@ typedef enum {
etex_code, /* command code for \.{\\eTeXVersion} */
format_name_code, /* command code for \.{\\AlephVersion} */
luatex_banner_code, /* command code for \.{\\luatexbanner}: */
- pdf_font_name_code, /* command code for \.{\\pdffontname} */
- pdf_font_objnum_code, /* command code for \.{\\pdffontobjnum} */
- pdf_font_size_code, /* command code for \.{\\pdffontsize} */
- pdf_page_ref_code, /* command code for \.{\\pdfpageref} */
- pdf_xform_name_code, /* command code for \.{\\pdfxformname} */
left_margin_kern_code, /* command code for \.{\\leftmarginkern} */
right_margin_kern_code, /* command code for \.{\\rightmarginkern} */
- pdf_creation_date_code, /* command code for \.{\\pdfcreationdate} */
uniform_deviate_code, /* command code for \.{\\uniformdeviate} */
normal_deviate_code, /* command code for \.{\\normaldeviate} */
- pdf_insert_ht_code, /* command code for \.{\\pdfinsertht} */
- pdf_ximage_bbox_code, /* command code for \.{\\pdfximagebbox} */
lua_code, /* command code for \.{\\directlua} */
lua_escape_string_code, /* command code for \.{\\luaescapestring} */
- pdf_colorstack_init_code, /* command code for \.{\\pdfcolorstackinit} */
luatex_revision_code, /* command code for \.{\\luatexrevision} */
luatex_date_code, /* command code for \.{\\luatexdate} */
math_style_code, /* command code for \.{\\mathstyle} */
@@ -261,61 +255,90 @@ typedef enum {
font_id_code, /* command code for \.{\\fontid} */
uchar_code, /* command code for \.{\\Uchar} */
lua_function_code, /* command code for \.{\\luafunction} */
+ insert_ht_code, /* command code for \.{\\insertht} */
+ math_char_class_code,
+ math_char_fam_code,
+ math_char_slot_code,
+ /* backend */
+ dvi_feedback_code,
+ pdf_feedback_code,
+ dvi_variable_code,
+ pdf_variable_code,
} convert_codes;
typedef enum {
- lastpenalty_code = 0, /* code for \.{\\lastpenalty} */
- lastattr_code, /* not used */
- lastkern_code, /* code for \.{\\lastkern} */
- lastskip_code, /* code for \.{\\lastskip} */
- last_node_type_code, /* code for \.{\\lastnodetype} */
- input_line_no_code, /* code for \.{\\inputlineno} */
- badness_code, /* code for \.{\\badness} */
- pdf_last_obj_code, /* code for \.{\\pdflastobj} */
- pdf_last_xform_code, /* code for \.{\\pdflastxform} */
- pdf_last_ximage_code, /* code for \.{\\pdflastximage} */
- pdf_last_ximage_pages_code, /* code for \.{\\pdflastximagepages} */
- pdf_last_annot_code, /* code for \.{\\pdflastannot} */
- last_x_pos_code, /* code for \.{\\lastxpos} */
- last_y_pos_code, /* code for \.{\\lastypos} */
- pdf_retval_code, /* global multi-purpose return value */
- pdf_last_ximage_colordepth_code, /* code for \.{\\pdflastximagecolordepth} */
- random_seed_code, /* code for \.{\\pdfrandomseed} */
- pdf_last_link_code, /* code for \.{\\pdflastlink} */
- luatex_version_code, /* code for \.{\\luatexversion} */
- eTeX_minor_version_code, /* code for \.{\\eTeXminorversion} */
- eTeX_version_code, /* code for \.{\\eTeXversion} */
-# define eTeX_int eTeX_version_code /* first of \eTeX\ codes for integers */
- current_group_level_code, /* code for \.{\\currentgrouplevel} */
- current_group_type_code, /* code for \.{\\currentgrouptype} */
- current_if_level_code, /* code for \.{\\currentiflevel} */
- current_if_type_code, /* code for \.{\\currentiftype} */
- current_if_branch_code, /* code for \.{\\currentifbranch} */
- glue_stretch_order_code, /* code for \.{\\gluestretchorder} */
- glue_shrink_order_code, /* code for \.{\\glueshrinkorder} */
- font_char_wd_code, /* code for \.{\\fontcharwd} */
-# define eTeX_dim font_char_wd_code /* first of \eTeX\ codes for dimensions */
- font_char_ht_code, /* code for \.{\\fontcharht} */
- font_char_dp_code, /* code for \.{\\fontchardp} */
- font_char_ic_code, /* code for \.{\\fontcharic} */
- par_shape_length_code, /* code for \.{\\parshapelength} */
- par_shape_indent_code, /* code for \.{\\parshapeindent} */
- par_shape_dimen_code, /* code for \.{\\parshapedimen} */
- glue_stretch_code, /* code for \.{\\gluestretch} */
- glue_shrink_code, /* code for \.{\\glueshrink} */
- mu_to_glue_code, /* code for \.{\\mutoglue} */
-# define eTeX_glue mu_to_glue_code /* first of \eTeX\ codes for glue */
- glue_to_mu_code, /* code for \.{\\gluetomu} */
-# define eTeX_mu glue_to_mu_code
- /* first of \eTeX\ codes for muglue */
- numexpr_code, /* code for \.{\\numexpr} */
-# define eTeX_expr numexpr_code /* first of \eTeX\ codes for expressions */
- attrexpr_code, /* not used */
- dimexpr_code, /* code for \.{\\dimexpr} */
- glueexpr_code, /* code for \.{\\glueexpr} */
- muexpr_code, /* code for \.{\\muexpr} */
+ pdf_font_name_code = 32, /* command code for \.{\\pdffeedback fontname} */
+ pdf_font_objnum_code, /* command code for \.{\\pdffeedback fontobjnum} */
+ pdf_font_size_code, /* command code for \.{\\pdffeedback fontsize} */
+ pdf_page_ref_code, /* command code for \.{\\pdffeedback pageref} */
+ pdf_xform_name_code, /* command code for \.{\\pdffeedback xformname} */
+ pdf_creation_date_code, /* command code for \.{\\pdffeedback creationdate} */
+ pdf_colorstack_init_code, /* command code for \.{\\pdffeedback colorstackinit} */
+ pdf_last_obj_code,
+ pdf_last_annot_code,
+ pdf_retval_code,
+ pdf_last_link_code,
+ pdf_version_code,
+ pdf_revision_code,
+} convert_codes_pdf;
+
+typedef enum {
+ lastpenalty_code = 0, /* code for \.{\\lastpenalty} */
+ lastattr_code, /* not used */
+ lastkern_code, /* code for \.{\\lastkern} */
+ lastskip_code, /* code for \.{\\lastskip} */
+ last_node_type_code, /* code for \.{\\lastnodetype} */
+ input_line_no_code, /* code for \.{\\inputlineno} */
+ badness_code, /* code for \.{\\badness} */
+ last_saved_box_resource_index_code, /* code for \.{\\lastsavedboxresourceindex} */
+ last_saved_image_resource_index_code, /* code for \.{\\lastsavedimageresourceindex} */
+ last_saved_image_resource_pages_code, /* code for \.{\\lastsavedimageresourcepages} */
+ last_x_pos_code, /* code for \.{\\lastxpos} */
+ last_y_pos_code, /* code for \.{\\lastypos} */
+ random_seed_code, /* code for \.{\\randomseed} */
+ luatex_version_code, /* code for \.{\\luatexversion} */
+ eTeX_minor_version_code, /* code for \.{\\eTeXminorversion} */
+ eTeX_version_code, /* code for \.{\\eTeXversion} */
+# define eTeX_int eTeX_version_code /* first of \eTeX\ codes for integers */
+ current_group_level_code, /* code for \.{\\currentgrouplevel} */
+ current_group_type_code, /* code for \.{\\currentgrouptype} */
+ current_if_level_code, /* code for \.{\\currentiflevel} */
+ current_if_type_code, /* code for \.{\\currentiftype} */
+ current_if_branch_code, /* code for \.{\\currentifbranch} */
+ glue_stretch_order_code, /* code for \.{\\gluestretchorder} */
+ glue_shrink_order_code, /* code for \.{\\glueshrinkorder} */
+ font_char_wd_code, /* code for \.{\\fontcharwd} */
+# define eTeX_dim font_char_wd_code /* first of \eTeX\ codes for dimensions */
+ font_char_ht_code, /* code for \.{\\fontcharht} */
+ font_char_dp_code, /* code for \.{\\fontchardp} */
+ font_char_ic_code, /* code for \.{\\fontcharic} */
+ par_shape_length_code, /* code for \.{\\parshapelength} */
+ par_shape_indent_code, /* code for \.{\\parshapeindent} */
+ par_shape_dimen_code, /* code for \.{\\parshapedimen} */
+ glue_stretch_code, /* code for \.{\\gluestretch} */
+ glue_shrink_code, /* code for \.{\\glueshrink} */
+ mu_to_glue_code, /* code for \.{\\mutoglue} */
+# define eTeX_glue mu_to_glue_code /* first of \eTeX\ codes for glue */
+ glue_to_mu_code, /* code for \.{\\gluetomu} */
+# define eTeX_mu glue_to_mu_code /* first of \eTeX\ codes for muglue */
+ numexpr_code, /* code for \.{\\numexpr} */
+# define eTeX_expr numexpr_code /* first of \eTeX\ codes for expressions */
+ attrexpr_code, /* not used */
+ dimexpr_code, /* code for \.{\\dimexpr} */
+ glueexpr_code, /* code for \.{\\glueexpr} */
+ muexpr_code, /* code for \.{\\muexpr} */
} last_item_codes;
+
+typedef enum {
+ save_cat_code_table_code=0,
+ init_cat_code_table_code,
+ set_random_seed_code,
+ save_pos_code,
+ late_lua_code,
+ expand_font_code,
+} normal_codes;
+
# define explicit 1
# define acc_kern 2
# define lp_code_base 2
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w
index 2b0f1d83bc5..de4db31ee60 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.w
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.w
@@ -1,4 +1,4 @@
-% commands.w
+ % commands.w
%
% Copyright 2009-2010 Taco Hoekwater <taco@@luatex.org>
%
@@ -32,284 +32,128 @@ now, so that we don't have to list all those parameter names anywhere else.
void initialize_commands(void)
{
- primitive_tex("lineskip", assign_glue_cmd, glue_base + line_skip_code,
- glue_base);
- primitive_tex("baselineskip", assign_glue_cmd,
- glue_base + baseline_skip_code, glue_base);
- primitive_tex("parskip", assign_glue_cmd, glue_base + par_skip_code,
- glue_base);
- primitive_tex("abovedisplayskip", assign_glue_cmd,
- glue_base + above_display_skip_code, glue_base);
- primitive_tex("belowdisplayskip", assign_glue_cmd,
- glue_base + below_display_skip_code, glue_base);
- primitive_tex("abovedisplayshortskip", assign_glue_cmd,
- glue_base + above_display_short_skip_code, glue_base);
- primitive_tex("belowdisplayshortskip", assign_glue_cmd,
- glue_base + below_display_short_skip_code, glue_base);
- primitive_tex("leftskip", assign_glue_cmd, glue_base + left_skip_code,
- glue_base);
- primitive_tex("rightskip", assign_glue_cmd, glue_base + right_skip_code,
- glue_base);
- primitive_tex("topskip", assign_glue_cmd, glue_base + top_skip_code,
- glue_base);
- primitive_tex("splittopskip", assign_glue_cmd,
- glue_base + split_top_skip_code, glue_base);
- primitive_tex("tabskip", assign_glue_cmd, glue_base + tab_skip_code,
- glue_base);
- primitive_tex("spaceskip", assign_glue_cmd, glue_base + space_skip_code,
- glue_base);
- primitive_tex("xspaceskip", assign_glue_cmd, glue_base + xspace_skip_code,
- glue_base);
- primitive_tex("parfillskip", assign_glue_cmd,
- glue_base + par_fill_skip_code, glue_base);
- primitive_tex("thinmuskip", assign_mu_glue_cmd,
- glue_base + thin_mu_skip_code, glue_base + thin_mu_skip_code);
- primitive_tex("medmuskip", assign_mu_glue_cmd, glue_base + med_mu_skip_code,
- glue_base + thin_mu_skip_code);
- primitive_tex("thickmuskip", assign_mu_glue_cmd,
- glue_base + thick_mu_skip_code,
- glue_base + thin_mu_skip_code);
+ primitive_tex("lineskip", assign_glue_cmd, glue_base + line_skip_code, glue_base);
+ primitive_tex("baselineskip", assign_glue_cmd, glue_base + baseline_skip_code, glue_base);
+ primitive_tex("parskip", assign_glue_cmd, glue_base + par_skip_code, glue_base);
+ primitive_tex("abovedisplayskip", assign_glue_cmd, glue_base + above_display_skip_code, glue_base);
+ primitive_tex("belowdisplayskip", assign_glue_cmd, glue_base + below_display_skip_code, glue_base);
+ primitive_tex("abovedisplayshortskip", assign_glue_cmd, glue_base + above_display_short_skip_code, glue_base);
+ primitive_tex("belowdisplayshortskip", assign_glue_cmd, glue_base + below_display_short_skip_code, glue_base);
+ primitive_tex("leftskip", assign_glue_cmd, glue_base + left_skip_code, glue_base);
+ primitive_tex("rightskip", assign_glue_cmd, glue_base + right_skip_code, glue_base);
+ primitive_tex("topskip", assign_glue_cmd, glue_base + top_skip_code, glue_base);
+ primitive_tex("splittopskip", assign_glue_cmd, glue_base + split_top_skip_code, glue_base);
+ primitive_tex("tabskip", assign_glue_cmd, glue_base + tab_skip_code, glue_base);
+ primitive_tex("spaceskip", assign_glue_cmd, glue_base + space_skip_code, glue_base);
+ primitive_tex("xspaceskip", assign_glue_cmd, glue_base + xspace_skip_code, glue_base);
+ primitive_tex("parfillskip", assign_glue_cmd, glue_base + par_fill_skip_code, glue_base);
+ primitive_tex("thinmuskip", assign_mu_glue_cmd, glue_base + thin_mu_skip_code, glue_base + thin_mu_skip_code);
+ primitive_tex("medmuskip", assign_mu_glue_cmd, glue_base + med_mu_skip_code, glue_base + thin_mu_skip_code);
+ primitive_tex("thickmuskip", assign_mu_glue_cmd, glue_base + thick_mu_skip_code, glue_base + thin_mu_skip_code);
+ primitive_luatex("mathsurroundskip", assign_glue_cmd, glue_base + math_skip_code, glue_base);
primitive_tex("output", assign_toks_cmd, output_routine_loc, local_base);
primitive_tex("everypar", assign_toks_cmd, every_par_loc, local_base);
primitive_tex("everymath", assign_toks_cmd, every_math_loc, local_base);
- primitive_tex("everydisplay", assign_toks_cmd, every_display_loc,
- local_base);
+ primitive_tex("everydisplay", assign_toks_cmd, every_display_loc, local_base);
primitive_tex("everyhbox", assign_toks_cmd, every_hbox_loc, local_base);
primitive_tex("everyvbox", assign_toks_cmd, every_vbox_loc, local_base);
primitive_tex("everyjob", assign_toks_cmd, every_job_loc, local_base);
primitive_tex("everycr", assign_toks_cmd, every_cr_loc, local_base);
primitive_tex("errhelp", assign_toks_cmd, err_help_loc, local_base);
- primitive_pdftex("pdfpagesattr", assign_toks_cmd, pdf_pages_attr_loc,
- local_base);
- primitive_pdftex("pdfpageattr", assign_toks_cmd, pdf_page_attr_loc,
- local_base);
- primitive_pdftex("pdfpageresources", assign_toks_cmd,
- pdf_page_resources_loc, local_base);
- primitive_pdftex("pdfxformattr", assign_toks_cmd, pdf_xform_attr_loc,
- local_base);
- primitive_pdftex("pdfxformresources", assign_toks_cmd,
- pdf_xform_resources_loc, local_base);
- primitive_pdftex("pdfpkmode", assign_toks_cmd, pdf_pk_mode_loc, local_base);
/* The integer parameter names must be entered into the hash table */
- primitive_tex("pretolerance", assign_int_cmd, int_base + pretolerance_code,
- int_base);
- primitive_tex("tolerance", assign_int_cmd, int_base + tolerance_code,
- int_base);
- primitive_tex("linepenalty", assign_int_cmd, int_base + line_penalty_code,
- int_base);
- primitive_tex("hyphenpenalty", assign_int_cmd,
- int_base + hyphen_penalty_code, int_base);
- primitive_tex("exhyphenpenalty", assign_int_cmd,
- int_base + ex_hyphen_penalty_code, int_base);
- primitive_tex("clubpenalty", assign_int_cmd, int_base + club_penalty_code,
- int_base);
- primitive_tex("widowpenalty", assign_int_cmd, int_base + widow_penalty_code,
- int_base);
- primitive_tex("displaywidowpenalty", assign_int_cmd,
- int_base + display_widow_penalty_code, int_base);
- primitive_tex("brokenpenalty", assign_int_cmd,
- int_base + broken_penalty_code, int_base);
- primitive_tex("binoppenalty", assign_int_cmd,
- int_base + bin_op_penalty_code, int_base);
- primitive_tex("relpenalty", assign_int_cmd, int_base + rel_penalty_code,
- int_base);
- primitive_tex("predisplaypenalty", assign_int_cmd,
- int_base + pre_display_penalty_code, int_base);
- primitive_tex("postdisplaypenalty", assign_int_cmd,
- int_base + post_display_penalty_code, int_base);
- primitive_tex("interlinepenalty", assign_int_cmd,
- int_base + inter_line_penalty_code, int_base);
- primitive_tex("doublehyphendemerits", assign_int_cmd,
- int_base + double_hyphen_demerits_code, int_base);
- primitive_tex("finalhyphendemerits", assign_int_cmd,
- int_base + final_hyphen_demerits_code, int_base);
- primitive_tex("adjdemerits", assign_int_cmd, int_base + adj_demerits_code,
- int_base);
+
+ primitive_tex("pretolerance", assign_int_cmd, int_base + pretolerance_code, int_base);
+ primitive_tex("tolerance", assign_int_cmd, int_base + tolerance_code, int_base);
+ primitive_tex("linepenalty", assign_int_cmd, int_base + line_penalty_code, int_base);
+ primitive_tex("hyphenpenalty", assign_int_cmd, int_base + hyphen_penalty_code, int_base);
+ primitive_tex("exhyphenpenalty", assign_int_cmd, int_base + ex_hyphen_penalty_code, int_base);
+ primitive_tex("clubpenalty", assign_int_cmd, int_base + club_penalty_code, int_base);
+ primitive_tex("widowpenalty", assign_int_cmd, int_base + widow_penalty_code, int_base);
+ primitive_tex("displaywidowpenalty", assign_int_cmd, int_base + display_widow_penalty_code, int_base);
+ primitive_tex("brokenpenalty", assign_int_cmd, int_base + broken_penalty_code, int_base);
+ primitive_tex("binoppenalty", assign_int_cmd, int_base + bin_op_penalty_code, int_base);
+ primitive_tex("relpenalty", assign_int_cmd, int_base + rel_penalty_code, int_base);
+ primitive_tex("predisplaypenalty", assign_int_cmd, int_base + pre_display_penalty_code, int_base);
+ primitive_tex("postdisplaypenalty", assign_int_cmd, int_base + post_display_penalty_code, int_base);
+ primitive_tex("interlinepenalty", assign_int_cmd, int_base + inter_line_penalty_code, int_base);
+ primitive_tex("doublehyphendemerits", assign_int_cmd, int_base + double_hyphen_demerits_code, int_base);
+ primitive_tex("finalhyphendemerits", assign_int_cmd, int_base + final_hyphen_demerits_code, int_base);
+ primitive_tex("adjdemerits", assign_int_cmd, int_base + adj_demerits_code, int_base);
primitive_tex("mag", assign_int_cmd, int_base + mag_code, int_base);
- primitive_tex("delimiterfactor", assign_int_cmd,
- int_base + delimiter_factor_code, int_base);
- primitive_tex("looseness", assign_int_cmd, int_base + looseness_code,
- int_base);
+ primitive_tex("delimiterfactor", assign_int_cmd, int_base + delimiter_factor_code, int_base);
+ primitive_tex("looseness", assign_int_cmd, int_base + looseness_code, int_base);
primitive_tex("time", assign_int_cmd, int_base + time_code, int_base);
primitive_tex("day", assign_int_cmd, int_base + day_code, int_base);
primitive_tex("month", assign_int_cmd, int_base + month_code, int_base);
primitive_tex("year", assign_int_cmd, int_base + year_code, int_base);
- primitive_tex("showboxbreadth", assign_int_cmd,
- int_base + show_box_breadth_code, int_base);
- primitive_tex("showboxdepth", assign_int_cmd,
- int_base + show_box_depth_code, int_base);
- primitive_tex("hbadness", assign_int_cmd, int_base + hbadness_code,
- int_base);
- primitive_tex("vbadness", assign_int_cmd, int_base + vbadness_code,
- int_base);
+ primitive_tex("showboxbreadth", assign_int_cmd, int_base + show_box_breadth_code, int_base);
+ primitive_tex("showboxdepth", assign_int_cmd, int_base + show_box_depth_code, int_base);
+ primitive_tex("hbadness", assign_int_cmd, int_base + hbadness_code, int_base);
+ primitive_tex("vbadness", assign_int_cmd, int_base + vbadness_code, int_base);
primitive_tex("pausing", assign_int_cmd, int_base + pausing_code, int_base);
- primitive_tex("tracingonline", assign_int_cmd,
- int_base + tracing_online_code, int_base);
- primitive_tex("tracingmacros", assign_int_cmd,
- int_base + tracing_macros_code, int_base);
- primitive_tex("tracingstats", assign_int_cmd, int_base + tracing_stats_code,
- int_base);
- primitive_tex("tracingparagraphs", assign_int_cmd,
- int_base + tracing_paragraphs_code, int_base);
- primitive_tex("tracingpages", assign_int_cmd, int_base + tracing_pages_code,
- int_base);
- primitive_tex("tracingoutput", assign_int_cmd,
- int_base + tracing_output_code, int_base);
- primitive_tex("tracinglostchars", assign_int_cmd,
- int_base + tracing_lost_chars_code, int_base);
- primitive_tex("tracingcommands", assign_int_cmd,
- int_base + tracing_commands_code, int_base);
- primitive_tex("tracingrestores", assign_int_cmd,
- int_base + tracing_restores_code, int_base);
+ primitive_tex("tracingonline", assign_int_cmd, int_base + tracing_online_code, int_base);
+ primitive_tex("tracingmacros", assign_int_cmd, int_base + tracing_macros_code, int_base);
+ primitive_tex("tracingstats", assign_int_cmd, int_base + tracing_stats_code, int_base);
+ primitive_tex("tracingparagraphs", assign_int_cmd, int_base + tracing_paragraphs_code, int_base);
+ primitive_tex("tracingpages", assign_int_cmd, int_base + tracing_pages_code, int_base);
+ primitive_tex("tracingoutput", assign_int_cmd, int_base + tracing_output_code, int_base);
+ primitive_tex("tracinglostchars", assign_int_cmd, int_base + tracing_lost_chars_code, int_base);
+ primitive_tex("tracingcommands", assign_int_cmd, int_base + tracing_commands_code, int_base);
+ primitive_tex("tracingrestores", assign_int_cmd, int_base + tracing_restores_code, int_base);
primitive_tex("uchyph", assign_int_cmd, int_base + uc_hyph_code, int_base);
- primitive_tex("outputpenalty", assign_int_cmd,
- int_base + output_penalty_code, int_base);
- primitive_tex("maxdeadcycles", assign_int_cmd,
- int_base + max_dead_cycles_code, int_base);
- primitive_tex("hangafter", assign_int_cmd, int_base + hang_after_code,
- int_base);
- primitive_tex("floatingpenalty", assign_int_cmd,
- int_base + floating_penalty_code, int_base);
- primitive_tex("globaldefs", assign_int_cmd, int_base + global_defs_code,
- int_base);
+ primitive_tex("outputpenalty", assign_int_cmd, int_base + output_penalty_code, int_base);
+ primitive_tex("maxdeadcycles", assign_int_cmd, int_base + max_dead_cycles_code, int_base);
+ primitive_tex("hangafter", assign_int_cmd, int_base + hang_after_code, int_base);
+ primitive_tex("floatingpenalty", assign_int_cmd, int_base + floating_penalty_code, int_base);
+ primitive_tex("globaldefs", assign_int_cmd, int_base + global_defs_code, int_base);
primitive_tex("fam", assign_int_cmd, int_base + cur_fam_code, int_base);
- primitive_tex("escapechar", assign_int_cmd, int_base + escape_char_code,
- int_base);
- primitive_tex("defaulthyphenchar", assign_int_cmd,
- int_base + default_hyphen_char_code, int_base);
- primitive_tex("defaultskewchar", assign_int_cmd,
- int_base + default_skew_char_code, int_base);
- primitive_tex("endlinechar", assign_int_cmd, int_base + end_line_char_code,
- int_base);
- primitive_tex("newlinechar", assign_int_cmd, int_base + new_line_char_code,
- int_base);
- primitive_tex("language", assign_int_cmd, int_base + language_code,
- int_base);
- primitive_tex("setlanguage", assign_int_cmd, int_base + cur_lang_code,
- int_base);
- primitive_tex("exhyphenchar", assign_int_cmd,
- int_base + ex_hyphen_char_code, int_base);
- primitive_tex("lefthyphenmin", assign_int_cmd,
- int_base + left_hyphen_min_code, int_base);
- primitive_tex("righthyphenmin", assign_int_cmd,
- int_base + right_hyphen_min_code, int_base);
- primitive_tex("holdinginserts", assign_int_cmd,
- int_base + holding_inserts_code, int_base);
- primitive_tex("errorcontextlines", assign_int_cmd,
- int_base + error_context_lines_code, int_base);
- primitive_luatex("luastartup", assign_int_cmd,
- int_base + luastartup_id_code, int_base);
- primitive_luatex("nokerns", assign_int_cmd, int_base + disable_kern_code,
- int_base);
- primitive_luatex("noligs", assign_int_cmd, int_base + disable_lig_code,
- int_base);
- primitive_luatex("catcodetable", assign_int_cmd,
- int_base + cat_code_table_code, int_base);
- primitive_luatex("outputbox", assign_int_cmd, int_base + output_box_code,
- int_base);
- primitive_pdftex("pdfoutput", assign_int_cmd, int_base + pdf_output_code,
- int_base);
- primitive_pdftex("pdfcompresslevel", assign_int_cmd,
- int_base + pdf_compress_level_code, int_base);
- primitive_pdftex("pdfobjcompresslevel", assign_int_cmd,
- int_base + pdf_objcompresslevel_code, int_base);
- primitive_pdftex("pdfdecimaldigits", assign_int_cmd,
- int_base + pdf_decimal_digits_code, int_base);
- primitive_pdftex("pdfimageresolution", assign_int_cmd,
- int_base + pdf_image_resolution_code, int_base);
- primitive_pdftex("pdfpkresolution", assign_int_cmd,
- int_base + pdf_pk_resolution_code, int_base);
- primitive_pdftex("pdfuniqueresname", assign_int_cmd,
- int_base + pdf_unique_resname_code, int_base);
- primitive_pdftex("pdfoptionpdfminorversion", assign_int_cmd,
- int_base + pdf_minor_version_code, int_base);
- primitive_pdftex("pdfminorversion", assign_int_cmd,
- int_base + pdf_minor_version_code, int_base);
- primitive_pdftex("pdfpagebox", assign_int_cmd, int_base + pdf_pagebox_code,
- int_base);
- primitive_pdftex("pdfinclusionerrorlevel", assign_int_cmd,
- int_base + pdf_inclusion_errorlevel_code, int_base);
- primitive_pdftex("pdfgamma", assign_int_cmd, int_base + pdf_gamma_code,
- int_base);
- primitive_pdftex("pdfimagegamma", assign_int_cmd,
- int_base + pdf_image_gamma_code, int_base);
- primitive_pdftex("pdfimagehicolor", assign_int_cmd,
- int_base + pdf_image_hicolor_code, int_base);
- primitive_pdftex("pdfimageapplygamma", assign_int_cmd,
- int_base + pdf_image_apply_gamma_code, int_base);
- primitive_luatex("adjustspacing", assign_int_cmd,
- int_base + adjust_spacing_code, int_base);
- primitive_luatex("protrudechars", assign_int_cmd,
- int_base + protrude_chars_code, int_base);
- primitive_pdftex("pdftracingfonts", assign_int_cmd,
- int_base + pdf_tracing_fonts_code, int_base);
- primitive_pdftex("pdfgentounicode", assign_int_cmd,
- int_base + pdf_gen_tounicode_code, int_base);
- primitive_pdftex("pdfdraftmode", assign_int_cmd,
- int_base + pdf_draftmode_code, int_base);
- primitive_pdftex("pdfinclusioncopyfonts", assign_int_cmd,
- int_base + pdf_inclusion_copy_font_code, int_base);
- primitive_pdftex("pdfreplacefont", assign_int_cmd,
- int_base + pdf_replace_font_code, int_base);
- primitive_tex("parindent", assign_dimen_cmd, dimen_base + par_indent_code,
- dimen_base);
- primitive_tex("mathsurround", assign_dimen_cmd,
- dimen_base + math_surround_code, dimen_base);
- primitive_tex("lineskiplimit", assign_dimen_cmd,
- dimen_base + line_skip_limit_code, dimen_base);
- primitive_tex("hsize", assign_dimen_cmd, dimen_base + hsize_code,
- dimen_base);
- primitive_tex("vsize", assign_dimen_cmd, dimen_base + vsize_code,
- dimen_base);
- primitive_tex("maxdepth", assign_dimen_cmd, dimen_base + max_depth_code,
- dimen_base);
- primitive_tex("splitmaxdepth", assign_dimen_cmd,
- dimen_base + split_max_depth_code, dimen_base);
- primitive_tex("boxmaxdepth", assign_dimen_cmd,
- dimen_base + box_max_depth_code, dimen_base);
- primitive_tex("hfuzz", assign_dimen_cmd, dimen_base + hfuzz_code,
- dimen_base);
- primitive_tex("vfuzz", assign_dimen_cmd, dimen_base + vfuzz_code,
- dimen_base);
- primitive_tex("delimitershortfall", assign_dimen_cmd,
- dimen_base + delimiter_shortfall_code, dimen_base);
- primitive_tex("nulldelimiterspace", assign_dimen_cmd,
- dimen_base + null_delimiter_space_code, dimen_base);
- primitive_tex("scriptspace", assign_dimen_cmd,
- dimen_base + script_space_code, dimen_base);
- primitive_tex("predisplaysize", assign_dimen_cmd,
- dimen_base + pre_display_size_code, dimen_base);
- primitive_tex("displaywidth", assign_dimen_cmd,
- dimen_base + display_width_code, dimen_base);
- primitive_tex("displayindent", assign_dimen_cmd,
- dimen_base + display_indent_code, dimen_base);
- primitive_tex("overfullrule", assign_dimen_cmd,
- dimen_base + overfull_rule_code, dimen_base);
- primitive_tex("hangindent", assign_dimen_cmd, dimen_base + hang_indent_code,
- dimen_base);
- primitive_tex("hoffset", assign_dimen_cmd, dimen_base + h_offset_code,
- dimen_base);
- primitive_tex("voffset", assign_dimen_cmd, dimen_base + v_offset_code,
- dimen_base);
- primitive_tex("emergencystretch", assign_dimen_cmd,
- dimen_base + emergency_stretch_code, dimen_base);
- primitive_pdftex("pdfhorigin", assign_dimen_cmd,
- dimen_base + pdf_h_origin_code, dimen_base);
- primitive_pdftex("pdfvorigin", assign_dimen_cmd,
- dimen_base + pdf_v_origin_code, dimen_base);
- primitive_luatex("pagewidth", assign_dimen_cmd, dimen_base + page_width_code,
- dimen_base);
- primitive_luatex("pageheight", assign_dimen_cmd,
- dimen_base + page_height_code, dimen_base);
- primitive_pdftex("pdflinkmargin", assign_dimen_cmd,
- dimen_base + pdf_link_margin_code, dimen_base);
- primitive_pdftex("pdfdestmargin", assign_dimen_cmd,
- dimen_base + pdf_dest_margin_code, dimen_base);
- primitive_pdftex("pdfthreadmargin", assign_dimen_cmd,
- dimen_base + pdf_thread_margin_code, dimen_base);
- primitive_pdftex("pdfpxdimen", assign_dimen_cmd,
- dimen_base + pdf_px_dimen_code, dimen_base);
+ primitive_tex("escapechar", assign_int_cmd, int_base + escape_char_code, int_base);
+ primitive_tex("defaulthyphenchar", assign_int_cmd, int_base + default_hyphen_char_code, int_base);
+ primitive_tex("defaultskewchar", assign_int_cmd, int_base + default_skew_char_code, int_base);
+ primitive_tex("endlinechar", assign_int_cmd, int_base + end_line_char_code, int_base);
+ primitive_tex("newlinechar", assign_int_cmd, int_base + new_line_char_code, int_base);
+ primitive_tex("language", assign_int_cmd, int_base + language_code, int_base);
+ primitive_tex("setlanguage", assign_int_cmd, int_base + cur_lang_code, int_base);
+ primitive_tex("exhyphenchar", assign_int_cmd, int_base + ex_hyphen_char_code, int_base);
+ primitive_tex("lefthyphenmin", assign_int_cmd, int_base + left_hyphen_min_code, int_base);
+ primitive_tex("righthyphenmin", assign_int_cmd, int_base + right_hyphen_min_code, int_base);
+ primitive_tex("holdinginserts", assign_int_cmd, int_base + holding_inserts_code, int_base);
+ primitive_tex("errorcontextlines", assign_int_cmd, int_base + error_context_lines_code, int_base);
+ primitive_luatex("luastartup", assign_int_cmd, int_base + luastartup_id_code, int_base);
+ primitive_luatex("nokerns", assign_int_cmd, int_base + disable_kern_code, int_base);
+ primitive_luatex("noligs", assign_int_cmd, int_base + disable_lig_code, int_base);
+ primitive_luatex("catcodetable", assign_int_cmd, int_base + cat_code_table_code, int_base);
+ primitive_luatex("outputbox", assign_int_cmd, int_base + output_box_code, int_base);
+ primitive_luatex("outputmode", assign_int_cmd, int_base + output_mode_code, int_base);
+ primitive_luatex("adjustspacing", assign_int_cmd, int_base + adjust_spacing_code, int_base);
+ primitive_luatex("protrudechars", assign_int_cmd, int_base + protrude_chars_code, int_base);
+ primitive_luatex("tracingfonts", assign_int_cmd, int_base + tracing_fonts_code, int_base);
+ primitive_luatex("draftmode", assign_int_cmd, int_base + draft_mode_code, int_base);
+ primitive_tex("parindent", assign_dimen_cmd, dimen_base + par_indent_code, dimen_base);
+ primitive_tex("mathsurround", assign_dimen_cmd, dimen_base + math_surround_code, dimen_base);
+ primitive_tex("lineskiplimit", assign_dimen_cmd, dimen_base + line_skip_limit_code, dimen_base);
+ primitive_tex("hsize", assign_dimen_cmd, dimen_base + hsize_code, dimen_base);
+ primitive_tex("vsize", assign_dimen_cmd, dimen_base + vsize_code, dimen_base);
+ primitive_tex("maxdepth", assign_dimen_cmd, dimen_base + max_depth_code, dimen_base);
+ primitive_tex("splitmaxdepth", assign_dimen_cmd, dimen_base + split_max_depth_code, dimen_base);
+ primitive_tex("boxmaxdepth", assign_dimen_cmd, dimen_base + box_max_depth_code, dimen_base);
+ primitive_tex("hfuzz", assign_dimen_cmd, dimen_base + hfuzz_code, dimen_base);
+ primitive_tex("vfuzz", assign_dimen_cmd, dimen_base + vfuzz_code, dimen_base);
+ primitive_tex("delimitershortfall", assign_dimen_cmd, dimen_base + delimiter_shortfall_code, dimen_base);
+ primitive_tex("nulldelimiterspace", assign_dimen_cmd, dimen_base + null_delimiter_space_code, dimen_base);
+ primitive_tex("scriptspace", assign_dimen_cmd, dimen_base + script_space_code, dimen_base);
+ primitive_tex("predisplaysize", assign_dimen_cmd, dimen_base + pre_display_size_code, dimen_base);
+ primitive_tex("displaywidth", assign_dimen_cmd, dimen_base + display_width_code, dimen_base);
+ primitive_tex("displayindent", assign_dimen_cmd, dimen_base + display_indent_code, dimen_base);
+ primitive_tex("overfullrule", assign_dimen_cmd, dimen_base + overfull_rule_code, dimen_base);
+ primitive_tex("hangindent", assign_dimen_cmd, dimen_base + hang_indent_code, dimen_base);
+ primitive_tex("hoffset", assign_dimen_cmd, dimen_base + h_offset_code, dimen_base);
+ primitive_tex("voffset", assign_dimen_cmd, dimen_base + v_offset_code, dimen_base);
+ primitive_tex("emergencystretch", assign_dimen_cmd, dimen_base + emergency_stretch_code, dimen_base);
+ primitive_luatex("pagewidth", assign_dimen_cmd, dimen_base + page_width_code, dimen_base);
+ primitive_luatex("pageheight", assign_dimen_cmd, dimen_base + page_height_code, dimen_base);
+ primitive_luatex("pxdimen", assign_dimen_cmd, dimen_base + px_dimen_code, dimen_base);
/* Many of \TeX's primitives need no |equiv|, since they are identifiable
by their |eq_type| alone. These primitives are loaded into the hash table
@@ -325,7 +169,7 @@ void initialize_commands(void)
primitive_tex("char", char_num_cmd, 0, 0);
primitive_tex("csname", cs_name_cmd, 0, 0);
primitive_tex("delimiter", delim_num_cmd, 0, 0);
- primitive_umath("Udelimiter", delim_num_cmd, 1, 0);
+ primitive_luatex("Udelimiter", delim_num_cmd, 1, 0);
primitive_tex("divide", divide_cmd, 0, 0);
primitive_tex("endcsname", end_cs_name_cmd, 0, 0);
primitive_tex("endgroup", end_group_cmd, 0, 0);
@@ -334,7 +178,9 @@ void initialize_commands(void)
primitive_tex("expandafter", expand_after_cmd, 0, 0);
primitive_tex("font", def_font_cmd, 0, 0);
primitive_luatex("letterspacefont", letterspace_font_cmd, 0, 0);
- primitive_pdftex("pdfcopyfont", pdf_copy_font_cmd, 0, 0);
+ primitive_luatex("expandglyphsinfont", normal_cmd, expand_font_code, 0);
+ primitive_luatex("copyfont", copy_font_cmd, 0, 0);
+ primitive_luatex("setfontid", set_font_id_cmd, 0, 0);
primitive_tex("fontdimen", assign_font_dimen_cmd, 0, 0);
primitive_tex("halign", halign_cmd, 0, 0);
primitive_tex("hrule", hrule_cmd, 0, 0);
@@ -343,14 +189,17 @@ void initialize_commands(void)
primitive_luatex("leftghost", char_ghost_cmd, 0, 0);
primitive_tex("mark", mark_cmd, 0, 0);
primitive_tex("mathaccent", math_accent_cmd, 0, 0);
- primitive_umath("Umathaccent", math_accent_cmd, 1, 0);
+ primitive_luatex("Umathaccent", math_accent_cmd, 1, 0);
primitive_tex("mathchar", math_char_num_cmd, 0, 0);
- primitive_umath("Umathchar", math_char_num_cmd, 1, 0);
- primitive_umath("Umathcharnum", math_char_num_cmd, 2, 0);
+ primitive_luatex("Umathchar", math_char_num_cmd, 1, 0);
+ primitive_luatex("Umathcharnum", math_char_num_cmd, 2, 0);
primitive_tex("mathchoice", math_choice_cmd, 0, 0);
- primitive_umath("Ustack", math_choice_cmd, 1, 0);
+ primitive_luatex("Ustack", math_choice_cmd, 1, 0);
primitive_tex("multiply", multiply_cmd, 0, 0);
primitive_tex("noalign", no_align_cmd, 0, 0);
+ primitive_luatex("nohrule", no_vrule_cmd, 0, 0);
+ primitive_luatex("novrule", no_hrule_cmd, 0, 0);
+ primitive_tex("boundary", boundary_cmd, 0, 0);
primitive_tex("noboundary", no_boundary_cmd, 0, 0);
primitive_tex("noexpand", no_expand_cmd, 0, 0);
primitive_luatex("primitive", no_expand_cmd, 1, 0);
@@ -360,12 +209,13 @@ void initialize_commands(void)
primitive_tex("penalty", break_penalty_cmd, 0, 0);
primitive_tex("prevgraf", set_prev_graf_cmd, 0, 0);
primitive_tex("radical", radical_cmd, 0, 0);
- primitive_umath("Uradical", radical_cmd, 1, 0);
- primitive_umath("Uroot", radical_cmd, 2, 0);
- primitive_umath("Uunderdelimiter", radical_cmd, 3, 0);
- primitive_umath("Uoverdelimiter", radical_cmd, 4, 0);
- primitive_umath("Udelimiterunder", radical_cmd, 5, 0);
- primitive_umath("Udelimiterover", radical_cmd, 6, 0);
+ primitive_luatex("Uradical", radical_cmd, 1, 0);
+ primitive_luatex("Uroot", radical_cmd, 2, 0);
+ primitive_luatex("Uunderdelimiter", radical_cmd, 3, 0);
+ primitive_luatex("Uoverdelimiter", radical_cmd, 4, 0);
+ primitive_luatex("Udelimiterunder", radical_cmd, 5, 0);
+ primitive_luatex("Udelimiterover", radical_cmd, 6, 0);
+ primitive_luatex("Uhextensible", radical_cmd, 7, 0);
primitive_tex("read", read_to_cs_cmd, 0, 0);
primitive_tex("relax", relax_cmd, too_big_char, too_big_char);
cs_text(frozen_relax) = maketexstring("relax");
@@ -390,8 +240,12 @@ void initialize_commands(void)
@ These are in a separate module due to a CWEAVE limitation.
@<Create a bunch of primitives@>=
- /* The processing of \.{\\input} involves the |start_input| subroutine,
- which will be declared later; the processing of \.{\\endinput} is trivial. */
+
+ /*
+ The processing of \.{\\input} involves the |start_input| subroutine,
+ which will be declared later; the processing of \.{\\endinput} is trivial.
+ */
+
primitive_tex("input", input_cmd, 0, 0);
primitive_tex("endinput", input_cmd, 1, 0);
primitive_tex("topmark", top_bot_mark_cmd, top_mark_code, 0);
@@ -402,19 +256,18 @@ void initialize_commands(void)
primitive_luatex("clearmarks", mark_cmd, clear_marks_code, 0);
primitive_etex("marks", mark_cmd, marks_code, 0);
primitive_etex("topmarks", top_bot_mark_cmd, top_mark_code + marks_code, 0);
- primitive_etex("firstmarks", top_bot_mark_cmd, first_mark_code + marks_code,
- 0);
+ primitive_etex("firstmarks", top_bot_mark_cmd, first_mark_code + marks_code, 0);
primitive_etex("botmarks", top_bot_mark_cmd, bot_mark_code + marks_code, 0);
- primitive_etex("splitfirstmarks", top_bot_mark_cmd,
- split_first_mark_code + marks_code, 0);
- primitive_etex("splitbotmarks", top_bot_mark_cmd,
- split_bot_mark_code + marks_code, 0);
-
- /* The hash table is initialized with `\.{\\count}', `\.{\\attribute}',
- `\.{\\dimen}', `\.{\\skip}', and `\.{\\muskip}' all having |register|
- as their command code; they are distinguished by the |chr_code|, which
- is either |int_val|, |attr_val|, |dimen_val|, |glue_val|, or |mu_val|.
- */
+ primitive_etex("splitfirstmarks", top_bot_mark_cmd, split_first_mark_code + marks_code, 0);
+ primitive_etex("splitbotmarks", top_bot_mark_cmd, split_bot_mark_code + marks_code, 0);
+
+ /*
+ The hash table is initialized with `\.{\\count}', `\.{\\attribute}',
+ `\.{\\dimen}', `\.{\\skip}', and `\.{\\muskip}' all having |register|
+ as their command code; they are distinguished by the |chr_code|, which
+ is either |int_val|, |attr_val|, |dimen_val|, |glue_val|, or |mu_val|.
+ */
+
primitive_tex("count", register_cmd, int_val_level, 0);
primitive_luatex("attribute", register_cmd, attr_val_level, 0);
primitive_tex("dimen", register_cmd, dimen_val_level, 0);
@@ -434,19 +287,12 @@ void initialize_commands(void)
primitive_tex("inputlineno", last_item_cmd, input_line_no_code, 0);
primitive_tex("badness", last_item_cmd, badness_code, 0);
primitive_luatex("luatexversion", last_item_cmd, luatex_version_code, 0);
- primitive_pdftex("pdflastobj", last_item_cmd, pdf_last_obj_code, 0);
- primitive_pdftex("pdflastxform", last_item_cmd, pdf_last_xform_code, 0);
- primitive_pdftex("pdflastximage", last_item_cmd, pdf_last_ximage_code, 0);
- primitive_pdftex("pdflastximagepages", last_item_cmd,
- pdf_last_ximage_pages_code, 0);
- primitive_pdftex("pdflastannot", last_item_cmd, pdf_last_annot_code, 0);
+ primitive_luatex("lastsavedboxresourceindex", last_item_cmd, last_saved_box_resource_index_code, 0);
+ primitive_luatex("lastsavedimageresourceindex", last_item_cmd, last_saved_image_resource_index_code, 0);
+ primitive_luatex("lastsavedimageresourcepages", last_item_cmd, last_saved_image_resource_pages_code, 0);
primitive_luatex("lastxpos", last_item_cmd, last_x_pos_code, 0);
primitive_luatex("lastypos", last_item_cmd, last_y_pos_code, 0);
- primitive_pdftex("pdfretval", last_item_cmd, pdf_retval_code, 0);
- primitive_pdftex("pdflastximagecolordepth", last_item_cmd,
- pdf_last_ximage_colordepth_code, 0);
primitive_luatex("randomseed", last_item_cmd, random_seed_code, 0);
- primitive_pdftex("pdflastlink", last_item_cmd, pdf_last_link_code, 0);
primitive_tex("number", convert_cmd, number_code, 0);
primitive_tex("romannumeral", convert_cmd, roman_numeral_code, 0);
@@ -458,17 +304,9 @@ void initialize_commands(void)
primitive_luatex("luatexrevision", convert_cmd, luatex_revision_code, 0);
primitive_luatex("luatexdatestamp", convert_cmd, luatex_date_code, 0);
primitive_luatex("luatexbanner", convert_cmd, luatex_banner_code, 0);
- primitive_pdftex("pdffontname", convert_cmd, pdf_font_name_code, 0);
- primitive_pdftex("pdffontobjnum", convert_cmd, pdf_font_objnum_code, 0);
- primitive_pdftex("pdffontsize", convert_cmd, pdf_font_size_code, 0);
- primitive_pdftex("pdfpageref", convert_cmd, pdf_page_ref_code, 0);
primitive_luatex("leftmarginkern", convert_cmd, left_margin_kern_code, 0);
primitive_luatex("rightmarginkern", convert_cmd, right_margin_kern_code, 0);
- primitive_pdftex("pdfxformname", convert_cmd, pdf_xform_name_code, 0);
- primitive_pdftex("pdfcreationdate", convert_cmd, pdf_creation_date_code, 0);
primitive_luatex("uniformdeviate", convert_cmd, uniform_deviate_code, 0);
- primitive_pdftex("pdfcolorstackinit", convert_cmd, pdf_colorstack_init_code,
- 0);
primitive_luatex("normaldeviate", convert_cmd, normal_deviate_code, 0);
primitive_core("directlua", convert_cmd, lua_code, 0);
primitive_luatex("luafunction", convert_cmd, lua_function_code, 0);
@@ -477,10 +315,12 @@ void initialize_commands(void)
primitive_luatex("expanded", convert_cmd, expanded_code, 0);
primitive_tex("jobname", convert_cmd, job_name_code, 0);
primitive_luatex("formatname", convert_cmd, format_name_code, 0);
- primitive_pdftex("pdfinsertht", convert_cmd, pdf_insert_ht_code, 0);
- primitive_pdftex("pdfximagebbox", convert_cmd, pdf_ximage_bbox_code, 0);
primitive_luatex("Uchar", convert_cmd, uchar_code, 0);
+ primitive_luatex("Umathcharclass", convert_cmd, math_char_class_code, 0);
+ primitive_luatex("Umathcharfam", convert_cmd, math_char_fam_code, 0);
+ primitive_luatex("Umathcharslot", convert_cmd, math_char_slot_code, 0);
+
primitive_tex("if", if_test_cmd, if_char_code, 0);
primitive_tex("ifcat", if_test_cmd, if_cat_code, 0);
primitive_tex("ifnum", if_test_cmd, if_int_code, 0);
@@ -506,17 +346,18 @@ void initialize_commands(void)
primitive_tex("or", fi_or_else_cmd, or_code, 0);
primitive_tex("else", fi_or_else_cmd, else_code, 0);
- /* \TeX\ always knows at least one font, namely the null font. It has no
- characters, and its seven parameters are all equal to zero. */
+ /*
+ \TeX\ always knows at least one font, namely the null font. It has no
+ characters, and its seven parameters are all equal to zero.
+ */
+
primitive_tex("nullfont", set_font_cmd, null_font, 0);
cs_text(frozen_null_font) = maketexstring("nullfont");
eqtb[frozen_null_font] = eqtb[cur_val];
primitive_tex("span", tab_mark_cmd, span_code, tab_mark_cmd_code);
- primitive_luatex("aligntab", tab_mark_cmd, tab_mark_cmd_code,
- tab_mark_cmd_code);
- primitive_luatex("alignmark", mac_param_cmd, tab_mark_cmd_code,
- tab_mark_cmd_code);
+ primitive_luatex("aligntab", tab_mark_cmd, tab_mark_cmd_code, tab_mark_cmd_code);
+ primitive_luatex("alignmark", mac_param_cmd, tab_mark_cmd_code, tab_mark_cmd_code);
primitive_tex("cr", car_ret_cmd, cr_code, cr_code);
cs_text(frozen_cr) = maketexstring("cr");
eqtb[frozen_cr] = eqtb[cur_val];
@@ -538,8 +379,10 @@ void initialize_commands(void)
primitive_tex("pageshrink", set_page_dimen_cmd, 6, 0);
primitive_tex("pagedepth", set_page_dimen_cmd, 7, 0);
- /* Either \.{\\dump} or \.{\\end} will cause |main_control| to enter the
- endgame, since both of them have `|stop|' as their command code. */
+ /*
+ Either \.{\\dump} or \.{\\end} will cause |main_control| to enter the
+ endgame, since both of them have `|stop|' as their command code.
+ */
primitive_tex("end", stop_cmd, 0, 0);
primitive_tex("dump", stop_cmd, 1, 0);
@@ -589,11 +432,10 @@ void initialize_commands(void)
primitive_luatex("localleftbox", assign_local_box_cmd, 0, 0);
primitive_luatex("localrightbox", assign_local_box_cmd, 1, 0);
- primitive_umath("Ustartmath", math_shift_cs_cmd, text_style, 0);
- primitive_umath("Ustopmath", math_shift_cs_cmd, cramped_text_style, 0);
- primitive_umath("Ustartdisplaymath", math_shift_cs_cmd, display_style, 0);
- primitive_umath("Ustopdisplaymath", math_shift_cs_cmd,
- cramped_display_style, 0);
+ primitive_luatex("Ustartmath", math_shift_cs_cmd, text_style, 0);
+ primitive_luatex("Ustopmath", math_shift_cs_cmd, cramped_text_style, 0);
+ primitive_luatex("Ustartdisplaymath", math_shift_cs_cmd, display_style, 0);
+ primitive_luatex("Ustopdisplaymath", math_shift_cs_cmd, cramped_display_style, 0);
primitive_tex("eqno", eq_no_cmd, 0, 0);
primitive_tex("leqno", eq_no_cmd, 1, 0);
primitive_tex("mathord", math_comp_cmd, ord_noad_type, 0);
@@ -613,26 +455,27 @@ void initialize_commands(void)
primitive_tex("textstyle", math_style_cmd, text_style, 0);
primitive_tex("scriptstyle", math_style_cmd, script_style, 0);
primitive_tex("scriptscriptstyle", math_style_cmd, script_script_style, 0);
- primitive_luatex("crampeddisplaystyle", math_style_cmd,
- cramped_display_style, 0);
+ primitive_luatex("crampeddisplaystyle", math_style_cmd, cramped_display_style, 0);
primitive_luatex("crampedtextstyle", math_style_cmd, cramped_text_style, 0);
- primitive_luatex("crampedscriptstyle", math_style_cmd, cramped_script_style,
- 0);
- primitive_luatex("crampedscriptscriptstyle", math_style_cmd,
- cramped_script_script_style, 0);
- primitive_umath("Usuperscript", super_sub_script_cmd, sup_mark_cmd,
- sup_mark_cmd);
- primitive_umath("Usubscript", super_sub_script_cmd, sub_mark_cmd,
- sup_mark_cmd);
+ primitive_luatex("crampedscriptstyle", math_style_cmd, cramped_script_style, 0);
+ primitive_luatex("crampedscriptscriptstyle", math_style_cmd, cramped_script_script_style, 0);
+ primitive_luatex("Usuperscript", super_sub_script_cmd, sup_mark_cmd, sup_mark_cmd);
+ primitive_luatex("Usubscript", super_sub_script_cmd, sub_mark_cmd, sup_mark_cmd);
primitive_tex("above", above_cmd, above_code, 0);
primitive_tex("over", above_cmd, over_code, 0);
primitive_tex("atop", above_cmd, atop_code, 0);
+ primitive_luatex("Uskewed", above_cmd, skewed_code, 0);
primitive_tex("abovewithdelims", above_cmd, delimited_code + above_code, 0);
primitive_tex("overwithdelims", above_cmd, delimited_code + over_code, 0);
primitive_tex("atopwithdelims", above_cmd, delimited_code + atop_code, 0);
+ primitive_luatex("Uskewedwithdelims", above_cmd, delimited_code + skewed_code, 0);
primitive_tex("left", left_right_cmd, left_noad_side, 0);
primitive_tex("right", left_right_cmd, right_noad_side, 0);
primitive_tex("middle", left_right_cmd, middle_noad_side, 0);
+ primitive_tex("Uleft", left_right_cmd, 10+left_noad_side, 0);
+ primitive_tex("Uright", left_right_cmd, 10+right_noad_side, 0);
+ primitive_tex("Umiddle", left_right_cmd, 10+middle_noad_side, 0);
+ primitive_luatex("Uvextensible", left_right_cmd, 10+no_noad_side, 0);
cs_text(frozen_right) = maketexstring("right");
eqtb[frozen_right] = eqtb[cur_val];
@@ -647,8 +490,8 @@ void initialize_commands(void)
primitive_tex("futurelet", let_cmd, normal + 1, 0);
primitive_tex("chardef", shorthand_def_cmd, char_def_code, 0);
primitive_tex("mathchardef", shorthand_def_cmd, math_char_def_code, 0);
- primitive_umath("Umathchardef", shorthand_def_cmd, xmath_char_def_code, 0);
- primitive_umath("Umathcharnumdef", shorthand_def_cmd, umath_char_def_code, 0);
+ primitive_luatex("Umathchardef", shorthand_def_cmd, xmath_char_def_code, 0);
+ primitive_luatex("Umathcharnumdef", shorthand_def_cmd, umath_char_def_code, 0);
primitive_tex("countdef", shorthand_def_cmd, count_def_code, 0);
primitive_luatex("attributedef", shorthand_def_cmd, attribute_def_code, 0);
primitive_tex("dimendef", shorthand_def_cmd, dimen_def_code, 0);
@@ -664,239 +507,129 @@ void initialize_commands(void)
primitive_tex("textfont", def_family_cmd, text_size, 0);
primitive_tex("scriptfont", def_family_cmd, script_size, 0);
primitive_tex("scriptscriptfont", def_family_cmd, script_script_size, 0);
- primitive_umath("Umathquad", set_math_param_cmd, math_param_quad, 0);
- primitive_umath("Umathaxis", set_math_param_cmd, math_param_axis, 0);
-
+ primitive_luatex("Umathquad", set_math_param_cmd, math_param_quad, 0);
+ primitive_luatex("Umathaxis", set_math_param_cmd, math_param_axis, 0);
@ These are in a separate module due to a CWEAVE limitation.
@<Create the math param primitives@>=
- primitive_umath("Umathoperatorsize", set_math_param_cmd,
- math_param_operator_size, 0);
- primitive_umath("Umathoverbarkern", set_math_param_cmd,
- math_param_overbar_kern, 0);
- primitive_umath("Umathoverbarrule", set_math_param_cmd,
- math_param_overbar_rule, 0);
- primitive_umath("Umathoverbarvgap", set_math_param_cmd,
- math_param_overbar_vgap, 0);
- primitive_umath("Umathunderbarkern", set_math_param_cmd,
- math_param_underbar_kern, 0);
- primitive_umath("Umathunderbarrule", set_math_param_cmd,
- math_param_underbar_rule, 0);
- primitive_umath("Umathunderbarvgap", set_math_param_cmd,
- math_param_underbar_vgap, 0);
- primitive_umath("Umathradicalkern", set_math_param_cmd,
- math_param_radical_kern, 0);
- primitive_umath("Umathradicalrule", set_math_param_cmd,
- math_param_radical_rule, 0);
- primitive_umath("Umathradicalvgap", set_math_param_cmd,
- math_param_radical_vgap, 0);
- primitive_umath("Umathradicaldegreebefore", set_math_param_cmd,
- math_param_radical_degree_before, 0);
- primitive_umath("Umathradicaldegreeafter", set_math_param_cmd,
- math_param_radical_degree_after, 0);
- primitive_umath("Umathradicaldegreeraise", set_math_param_cmd,
- math_param_radical_degree_raise, 0);
- primitive_umath("Umathstackvgap", set_math_param_cmd,
- math_param_stack_vgap, 0);
- primitive_umath("Umathstacknumup", set_math_param_cmd,
- math_param_stack_num_up, 0);
- primitive_umath("Umathstackdenomdown", set_math_param_cmd,
- math_param_stack_denom_down, 0);
- primitive_umath("Umathfractionrule", set_math_param_cmd,
- math_param_fraction_rule, 0);
- primitive_umath("Umathfractionnumvgap", set_math_param_cmd,
- math_param_fraction_num_vgap, 0);
- primitive_umath("Umathfractionnumup", set_math_param_cmd,
- math_param_fraction_num_up, 0);
- primitive_umath("Umathfractiondenomvgap", set_math_param_cmd,
- math_param_fraction_denom_vgap, 0);
- primitive_umath("Umathfractiondenomdown", set_math_param_cmd,
- math_param_fraction_denom_down, 0);
- primitive_umath("Umathfractiondelsize", set_math_param_cmd,
- math_param_fraction_del_size, 0);
- primitive_umath("Umathlimitabovevgap", set_math_param_cmd,
- math_param_limit_above_vgap, 0);
- primitive_umath("Umathlimitabovebgap", set_math_param_cmd,
- math_param_limit_above_bgap, 0);
- primitive_umath("Umathlimitabovekern", set_math_param_cmd,
- math_param_limit_above_kern, 0);
- primitive_umath("Umathlimitbelowvgap", set_math_param_cmd,
- math_param_limit_below_vgap, 0);
- primitive_umath("Umathlimitbelowbgap", set_math_param_cmd,
- math_param_limit_below_bgap, 0);
- primitive_umath("Umathlimitbelowkern", set_math_param_cmd,
- math_param_limit_below_kern, 0);
- primitive_umath("Umathunderdelimitervgap", set_math_param_cmd,
- math_param_under_delimiter_vgap, 0);
- primitive_umath("Umathunderdelimiterbgap", set_math_param_cmd,
- math_param_under_delimiter_bgap, 0);
- primitive_umath("Umathoverdelimitervgap", set_math_param_cmd,
- math_param_over_delimiter_vgap, 0);
- primitive_umath("Umathoverdelimiterbgap", set_math_param_cmd,
- math_param_over_delimiter_bgap, 0);
- primitive_umath("Umathsubshiftdrop", set_math_param_cmd,
- math_param_sub_shift_drop, 0);
- primitive_umath("Umathsupshiftdrop", set_math_param_cmd,
- math_param_sup_shift_drop, 0);
- primitive_umath("Umathsubshiftdown", set_math_param_cmd,
- math_param_sub_shift_down, 0);
- primitive_umath("Umathsubsupshiftdown", set_math_param_cmd,
- math_param_sub_sup_shift_down, 0);
- primitive_umath("Umathsubtopmax", set_math_param_cmd,
- math_param_sub_top_max, 0);
- primitive_umath("Umathsupshiftup", set_math_param_cmd,
- math_param_sup_shift_up, 0);
- primitive_umath("Umathsupbottommin", set_math_param_cmd,
- math_param_sup_bottom_min, 0);
- primitive_umath("Umathsupsubbottommax", set_math_param_cmd,
- math_param_sup_sub_bottom_max, 0);
- primitive_umath("Umathsubsupvgap", set_math_param_cmd,
- math_param_subsup_vgap, 0);
- primitive_umath("Umathspaceafterscript", set_math_param_cmd,
- math_param_space_after_script, 0);
- primitive_umath("Umathconnectoroverlapmin", set_math_param_cmd,
- math_param_connector_overlap_min, 0);
- primitive_umath("Umathordordspacing", set_math_param_cmd,
- math_param_ord_ord_spacing, 0);
- primitive_umath("Umathordopspacing", set_math_param_cmd,
- math_param_ord_op_spacing, 0);
- primitive_umath("Umathordbinspacing", set_math_param_cmd,
- math_param_ord_bin_spacing, 0);
- primitive_umath("Umathordrelspacing", set_math_param_cmd,
- math_param_ord_rel_spacing, 0);
- primitive_umath("Umathordopenspacing", set_math_param_cmd,
- math_param_ord_open_spacing, 0);
- primitive_umath("Umathordclosespacing", set_math_param_cmd,
- math_param_ord_close_spacing, 0);
- primitive_umath("Umathordpunctspacing", set_math_param_cmd,
- math_param_ord_punct_spacing, 0);
- primitive_umath("Umathordinnerspacing", set_math_param_cmd,
- math_param_ord_inner_spacing, 0);
- primitive_umath("Umathopordspacing", set_math_param_cmd,
- math_param_op_ord_spacing, 0);
- primitive_umath("Umathopopspacing", set_math_param_cmd,
- math_param_op_op_spacing, 0);
- primitive_umath("Umathopbinspacing", set_math_param_cmd,
- math_param_op_bin_spacing, 0);
- primitive_umath("Umathoprelspacing", set_math_param_cmd,
- math_param_op_rel_spacing, 0);
- primitive_umath("Umathopopenspacing", set_math_param_cmd,
- math_param_op_open_spacing, 0);
- primitive_umath("Umathopclosespacing", set_math_param_cmd,
- math_param_op_close_spacing, 0);
- primitive_umath("Umathoppunctspacing", set_math_param_cmd,
- math_param_op_punct_spacing, 0);
- primitive_umath("Umathopinnerspacing", set_math_param_cmd,
- math_param_op_inner_spacing, 0);
- primitive_umath("Umathbinordspacing", set_math_param_cmd,
- math_param_bin_ord_spacing, 0);
- primitive_umath("Umathbinopspacing", set_math_param_cmd,
- math_param_bin_op_spacing, 0);
- primitive_umath("Umathbinbinspacing", set_math_param_cmd,
- math_param_bin_bin_spacing, 0);
- primitive_umath("Umathbinrelspacing", set_math_param_cmd,
- math_param_bin_rel_spacing, 0);
- primitive_umath("Umathbinopenspacing", set_math_param_cmd,
- math_param_bin_open_spacing, 0);
- primitive_umath("Umathbinclosespacing", set_math_param_cmd,
- math_param_bin_close_spacing, 0);
- primitive_umath("Umathbinpunctspacing", set_math_param_cmd,
- math_param_bin_punct_spacing, 0);
- primitive_umath("Umathbininnerspacing", set_math_param_cmd,
- math_param_bin_inner_spacing, 0);
- primitive_umath("Umathrelordspacing", set_math_param_cmd,
- math_param_rel_ord_spacing, 0);
- primitive_umath("Umathrelopspacing", set_math_param_cmd,
- math_param_rel_op_spacing, 0);
- primitive_umath("Umathrelbinspacing", set_math_param_cmd,
- math_param_rel_bin_spacing, 0);
- primitive_umath("Umathrelrelspacing", set_math_param_cmd,
- math_param_rel_rel_spacing, 0);
- primitive_umath("Umathrelopenspacing", set_math_param_cmd,
- math_param_rel_open_spacing, 0);
- primitive_umath("Umathrelclosespacing", set_math_param_cmd,
- math_param_rel_close_spacing, 0);
- primitive_umath("Umathrelpunctspacing", set_math_param_cmd,
- math_param_rel_punct_spacing, 0);
- primitive_umath("Umathrelinnerspacing", set_math_param_cmd,
- math_param_rel_inner_spacing, 0);
- primitive_umath("Umathopenordspacing", set_math_param_cmd,
- math_param_open_ord_spacing, 0);
- primitive_umath("Umathopenopspacing", set_math_param_cmd,
- math_param_open_op_spacing, 0);
- primitive_umath("Umathopenbinspacing", set_math_param_cmd,
- math_param_open_bin_spacing, 0);
- primitive_umath("Umathopenrelspacing", set_math_param_cmd,
- math_param_open_rel_spacing, 0);
- primitive_umath("Umathopenopenspacing", set_math_param_cmd,
- math_param_open_open_spacing, 0);
- primitive_umath("Umathopenclosespacing", set_math_param_cmd,
- math_param_open_close_spacing, 0);
- primitive_umath("Umathopenpunctspacing", set_math_param_cmd,
- math_param_open_punct_spacing, 0);
- primitive_umath("Umathopeninnerspacing", set_math_param_cmd,
- math_param_open_inner_spacing, 0);
- primitive_umath("Umathcloseordspacing", set_math_param_cmd,
- math_param_close_ord_spacing, 0);
- primitive_umath("Umathcloseopspacing", set_math_param_cmd,
- math_param_close_op_spacing, 0);
- primitive_umath("Umathclosebinspacing", set_math_param_cmd,
- math_param_close_bin_spacing, 0);
- primitive_umath("Umathcloserelspacing", set_math_param_cmd,
- math_param_close_rel_spacing, 0);
- primitive_umath("Umathcloseopenspacing", set_math_param_cmd,
- math_param_close_open_spacing, 0);
- primitive_umath("Umathcloseclosespacing", set_math_param_cmd,
- math_param_close_close_spacing, 0);
- primitive_umath("Umathclosepunctspacing", set_math_param_cmd,
- math_param_close_punct_spacing, 0);
- primitive_umath("Umathcloseinnerspacing", set_math_param_cmd,
- math_param_close_inner_spacing, 0);
- primitive_umath("Umathpunctordspacing", set_math_param_cmd,
- math_param_punct_ord_spacing, 0);
- primitive_umath("Umathpunctopspacing", set_math_param_cmd,
- math_param_punct_op_spacing, 0);
- primitive_umath("Umathpunctbinspacing", set_math_param_cmd,
- math_param_punct_bin_spacing, 0);
- primitive_umath("Umathpunctrelspacing", set_math_param_cmd,
- math_param_punct_rel_spacing, 0);
- primitive_umath("Umathpunctopenspacing", set_math_param_cmd,
- math_param_punct_open_spacing, 0);
- primitive_umath("Umathpunctclosespacing", set_math_param_cmd,
- math_param_punct_close_spacing, 0);
- primitive_umath("Umathpunctpunctspacing", set_math_param_cmd,
- math_param_punct_punct_spacing, 0);
- primitive_umath("Umathpunctinnerspacing", set_math_param_cmd,
- math_param_punct_inner_spacing, 0);
- primitive_umath("Umathinnerordspacing", set_math_param_cmd,
- math_param_inner_ord_spacing, 0);
- primitive_umath("Umathinneropspacing", set_math_param_cmd,
- math_param_inner_op_spacing, 0);
- primitive_umath("Umathinnerbinspacing", set_math_param_cmd,
- math_param_inner_bin_spacing, 0);
- primitive_umath("Umathinnerrelspacing", set_math_param_cmd,
- math_param_inner_rel_spacing, 0);
- primitive_umath("Umathinneropenspacing", set_math_param_cmd,
- math_param_inner_open_spacing, 0);
- primitive_umath("Umathinnerclosespacing", set_math_param_cmd,
- math_param_inner_close_spacing, 0);
- primitive_umath("Umathinnerpunctspacing", set_math_param_cmd,
- math_param_inner_punct_spacing, 0);
- primitive_umath("Umathinnerinnerspacing", set_math_param_cmd,
- math_param_inner_inner_spacing, 0);
+ primitive_luatex("Umathoperatorsize", set_math_param_cmd, math_param_operator_size, 0);
+ primitive_luatex("Umathoverbarkern", set_math_param_cmd, math_param_overbar_kern, 0);
+ primitive_luatex("Umathoverbarrule", set_math_param_cmd, math_param_overbar_rule, 0);
+ primitive_luatex("Umathoverbarvgap", set_math_param_cmd, math_param_overbar_vgap, 0);
+ primitive_luatex("Umathunderbarkern", set_math_param_cmd, math_param_underbar_kern, 0);
+ primitive_luatex("Umathunderbarrule", set_math_param_cmd, math_param_underbar_rule, 0);
+ primitive_luatex("Umathunderbarvgap", set_math_param_cmd, math_param_underbar_vgap, 0);
+ primitive_luatex("Umathradicalkern", set_math_param_cmd, math_param_radical_kern, 0);
+ primitive_luatex("Umathradicalrule", set_math_param_cmd, math_param_radical_rule, 0);
+ primitive_luatex("Umathradicalvgap", set_math_param_cmd, math_param_radical_vgap, 0);
+ primitive_luatex("Umathradicaldegreebefore", set_math_param_cmd, math_param_radical_degree_before, 0);
+ primitive_luatex("Umathradicaldegreeafter", set_math_param_cmd, math_param_radical_degree_after, 0);
+ primitive_luatex("Umathradicaldegreeraise", set_math_param_cmd, math_param_radical_degree_raise, 0);
+ primitive_luatex("Umathstackvgap", set_math_param_cmd, math_param_stack_vgap, 0);
+ primitive_luatex("Umathstacknumup", set_math_param_cmd, math_param_stack_num_up, 0);
+ primitive_luatex("Umathstackdenomdown", set_math_param_cmd, math_param_stack_denom_down, 0);
+ primitive_luatex("Umathfractionrule", set_math_param_cmd, math_param_fraction_rule, 0);
+ primitive_luatex("Umathfractionnumvgap", set_math_param_cmd, math_param_fraction_num_vgap, 0);
+ primitive_luatex("Umathfractionnumup", set_math_param_cmd, math_param_fraction_num_up, 0);
+ primitive_luatex("Umathfractiondenomvgap", set_math_param_cmd, math_param_fraction_denom_vgap, 0);
+ primitive_luatex("Umathfractiondenomdown", set_math_param_cmd, math_param_fraction_denom_down, 0);
+ primitive_luatex("Umathfractiondelsize", set_math_param_cmd, math_param_fraction_del_size, 0);
+ primitive_luatex("Umathskewedfractionvgap", set_math_param_cmd, math_param_skewed_fraction_vgap, 0);
+ primitive_luatex("Umathskewedfractionhgap", set_math_param_cmd, math_param_skewed_fraction_hgap, 0);
+ primitive_luatex("Umathlimitabovevgap", set_math_param_cmd, math_param_limit_above_vgap, 0);
+ primitive_luatex("Umathlimitabovebgap", set_math_param_cmd, math_param_limit_above_bgap, 0);
+ primitive_luatex("Umathlimitabovekern", set_math_param_cmd, math_param_limit_above_kern, 0);
+ primitive_luatex("Umathlimitbelowvgap", set_math_param_cmd, math_param_limit_below_vgap, 0);
+ primitive_luatex("Umathlimitbelowbgap", set_math_param_cmd, math_param_limit_below_bgap, 0);
+ primitive_luatex("Umathlimitbelowkern", set_math_param_cmd, math_param_limit_below_kern, 0);
+ primitive_luatex("Umathunderdelimitervgap", set_math_param_cmd, math_param_under_delimiter_vgap, 0);
+ primitive_luatex("Umathunderdelimiterbgap", set_math_param_cmd, math_param_under_delimiter_bgap, 0);
+ primitive_luatex("Umathoverdelimitervgap", set_math_param_cmd, math_param_over_delimiter_vgap, 0);
+ primitive_luatex("Umathoverdelimiterbgap", set_math_param_cmd, math_param_over_delimiter_bgap, 0);
+ primitive_luatex("Umathsubshiftdrop", set_math_param_cmd, math_param_sub_shift_drop, 0);
+ primitive_luatex("Umathsupshiftdrop", set_math_param_cmd, math_param_sup_shift_drop, 0);
+ primitive_luatex("Umathsubshiftdown", set_math_param_cmd, math_param_sub_shift_down, 0);
+ primitive_luatex("Umathsubsupshiftdown", set_math_param_cmd, math_param_sub_sup_shift_down, 0);
+ primitive_luatex("Umathsubtopmax", set_math_param_cmd, math_param_sub_top_max, 0);
+ primitive_luatex("Umathsupshiftup", set_math_param_cmd, math_param_sup_shift_up, 0);
+ primitive_luatex("Umathsupbottommin", set_math_param_cmd, math_param_sup_bottom_min, 0);
+ primitive_luatex("Umathsupsubbottommax", set_math_param_cmd, math_param_sup_sub_bottom_max, 0);
+ primitive_luatex("Umathsubsupvgap", set_math_param_cmd, math_param_subsup_vgap, 0);
+ primitive_luatex("Umathspaceafterscript", set_math_param_cmd, math_param_space_after_script, 0);
+ primitive_luatex("Umathconnectoroverlapmin", set_math_param_cmd, math_param_connector_overlap_min, 0);
+ primitive_luatex("Umathordordspacing", set_math_param_cmd, math_param_ord_ord_spacing, 0);
+ primitive_luatex("Umathordopspacing", set_math_param_cmd, math_param_ord_op_spacing, 0);
+ primitive_luatex("Umathordbinspacing", set_math_param_cmd, math_param_ord_bin_spacing, 0);
+ primitive_luatex("Umathordrelspacing", set_math_param_cmd, math_param_ord_rel_spacing, 0);
+ primitive_luatex("Umathordopenspacing", set_math_param_cmd, math_param_ord_open_spacing, 0);
+ primitive_luatex("Umathordclosespacing", set_math_param_cmd, math_param_ord_close_spacing, 0);
+ primitive_luatex("Umathordpunctspacing", set_math_param_cmd, math_param_ord_punct_spacing, 0);
+ primitive_luatex("Umathordinnerspacing", set_math_param_cmd, math_param_ord_inner_spacing, 0);
+ primitive_luatex("Umathopordspacing", set_math_param_cmd, math_param_op_ord_spacing, 0);
+ primitive_luatex("Umathopopspacing", set_math_param_cmd, math_param_op_op_spacing, 0);
+ primitive_luatex("Umathopbinspacing", set_math_param_cmd, math_param_op_bin_spacing, 0);
+ primitive_luatex("Umathoprelspacing", set_math_param_cmd, math_param_op_rel_spacing, 0);
+ primitive_luatex("Umathopopenspacing", set_math_param_cmd, math_param_op_open_spacing, 0);
+ primitive_luatex("Umathopclosespacing", set_math_param_cmd, math_param_op_close_spacing, 0);
+ primitive_luatex("Umathoppunctspacing", set_math_param_cmd, math_param_op_punct_spacing, 0);
+ primitive_luatex("Umathopinnerspacing", set_math_param_cmd, math_param_op_inner_spacing, 0);
+ primitive_luatex("Umathbinordspacing", set_math_param_cmd, math_param_bin_ord_spacing, 0);
+ primitive_luatex("Umathbinopspacing", set_math_param_cmd, math_param_bin_op_spacing, 0);
+ primitive_luatex("Umathbinbinspacing", set_math_param_cmd, math_param_bin_bin_spacing, 0);
+ primitive_luatex("Umathbinrelspacing", set_math_param_cmd, math_param_bin_rel_spacing, 0);
+ primitive_luatex("Umathbinopenspacing", set_math_param_cmd, math_param_bin_open_spacing, 0);
+ primitive_luatex("Umathbinclosespacing", set_math_param_cmd, math_param_bin_close_spacing, 0);
+ primitive_luatex("Umathbinpunctspacing", set_math_param_cmd, math_param_bin_punct_spacing, 0);
+ primitive_luatex("Umathbininnerspacing", set_math_param_cmd, math_param_bin_inner_spacing, 0);
+ primitive_luatex("Umathrelordspacing", set_math_param_cmd, math_param_rel_ord_spacing, 0);
+ primitive_luatex("Umathrelopspacing", set_math_param_cmd, math_param_rel_op_spacing, 0);
+ primitive_luatex("Umathrelbinspacing", set_math_param_cmd, math_param_rel_bin_spacing, 0);
+ primitive_luatex("Umathrelrelspacing", set_math_param_cmd, math_param_rel_rel_spacing, 0);
+ primitive_luatex("Umathrelopenspacing", set_math_param_cmd, math_param_rel_open_spacing, 0);
+ primitive_luatex("Umathrelclosespacing", set_math_param_cmd, math_param_rel_close_spacing, 0);
+ primitive_luatex("Umathrelpunctspacing", set_math_param_cmd, math_param_rel_punct_spacing, 0);
+ primitive_luatex("Umathrelinnerspacing", set_math_param_cmd, math_param_rel_inner_spacing, 0);
+ primitive_luatex("Umathopenordspacing", set_math_param_cmd, math_param_open_ord_spacing, 0);
+ primitive_luatex("Umathopenopspacing", set_math_param_cmd, math_param_open_op_spacing, 0);
+ primitive_luatex("Umathopenbinspacing", set_math_param_cmd, math_param_open_bin_spacing, 0);
+ primitive_luatex("Umathopenrelspacing", set_math_param_cmd, math_param_open_rel_spacing, 0);
+ primitive_luatex("Umathopenopenspacing", set_math_param_cmd, math_param_open_open_spacing, 0);
+ primitive_luatex("Umathopenclosespacing", set_math_param_cmd, math_param_open_close_spacing, 0);
+ primitive_luatex("Umathopenpunctspacing", set_math_param_cmd, math_param_open_punct_spacing, 0);
+ primitive_luatex("Umathopeninnerspacing", set_math_param_cmd, math_param_open_inner_spacing, 0);
+ primitive_luatex("Umathcloseordspacing", set_math_param_cmd, math_param_close_ord_spacing, 0);
+ primitive_luatex("Umathcloseopspacing", set_math_param_cmd, math_param_close_op_spacing, 0);
+ primitive_luatex("Umathclosebinspacing", set_math_param_cmd, math_param_close_bin_spacing, 0);
+ primitive_luatex("Umathcloserelspacing", set_math_param_cmd, math_param_close_rel_spacing, 0);
+ primitive_luatex("Umathcloseopenspacing", set_math_param_cmd, math_param_close_open_spacing, 0);
+ primitive_luatex("Umathcloseclosespacing", set_math_param_cmd, math_param_close_close_spacing, 0);
+ primitive_luatex("Umathclosepunctspacing", set_math_param_cmd, math_param_close_punct_spacing, 0);
+ primitive_luatex("Umathcloseinnerspacing", set_math_param_cmd, math_param_close_inner_spacing, 0);
+ primitive_luatex("Umathpunctordspacing", set_math_param_cmd, math_param_punct_ord_spacing, 0);
+ primitive_luatex("Umathpunctopspacing", set_math_param_cmd, math_param_punct_op_spacing, 0);
+ primitive_luatex("Umathpunctbinspacing", set_math_param_cmd, math_param_punct_bin_spacing, 0);
+ primitive_luatex("Umathpunctrelspacing", set_math_param_cmd, math_param_punct_rel_spacing, 0);
+ primitive_luatex("Umathpunctopenspacing", set_math_param_cmd, math_param_punct_open_spacing, 0);
+ primitive_luatex("Umathpunctclosespacing", set_math_param_cmd, math_param_punct_close_spacing, 0);
+ primitive_luatex("Umathpunctpunctspacing", set_math_param_cmd, math_param_punct_punct_spacing, 0);
+ primitive_luatex("Umathpunctinnerspacing", set_math_param_cmd, math_param_punct_inner_spacing, 0);
+ primitive_luatex("Umathinnerordspacing", set_math_param_cmd, math_param_inner_ord_spacing, 0);
+ primitive_luatex("Umathinneropspacing", set_math_param_cmd, math_param_inner_op_spacing, 0);
+ primitive_luatex("Umathinnerbinspacing", set_math_param_cmd, math_param_inner_bin_spacing, 0);
+ primitive_luatex("Umathinnerrelspacing", set_math_param_cmd, math_param_inner_rel_spacing, 0);
+ primitive_luatex("Umathinneropenspacing", set_math_param_cmd, math_param_inner_open_spacing, 0);
+ primitive_luatex("Umathinnerclosespacing", set_math_param_cmd, math_param_inner_close_spacing, 0);
+ primitive_luatex("Umathinnerpunctspacing", set_math_param_cmd, math_param_inner_punct_spacing, 0);
+ primitive_luatex("Umathinnerinnerspacing", set_math_param_cmd, math_param_inner_inner_spacing, 0);
@ These are in a separate module due to a CWEAVE limitation.
@<Create another bunch of primitives@>=
- primitive_umath("Umathcode", extdef_math_code_cmd, math_code_base,
- math_code_base);
- primitive_umath("Udelcode", extdef_del_code_cmd, del_code_base,
- del_code_base);
- primitive_umath("Umathcodenum", extdef_math_code_cmd, math_code_base + 1,
- math_code_base);
- primitive_umath("Udelcodenum", extdef_del_code_cmd, del_code_base + 1,
- del_code_base);
+ primitive_luatex("Umathcode", extdef_math_code_cmd, math_code_base, math_code_base);
+ primitive_luatex("Udelcode", extdef_del_code_cmd, del_code_base, del_code_base);
+ primitive_luatex("Umathcodenum", extdef_math_code_cmd, math_code_base + 1, math_code_base);
+ primitive_luatex("Udelcodenum", extdef_del_code_cmd, del_code_base + 1, del_code_base);
primitive_tex("hyphenation", hyph_data_cmd, 0, 0);
primitive_tex("patterns", hyph_data_cmd, 1, 0);
primitive_luatex("prehyphenchar", hyph_data_cmd, 2, 0);
@@ -926,84 +659,50 @@ void initialize_commands(void)
primitive_tex("showthe", xray_cmd, show_the_code, 0);
primitive_tex("showlists", xray_cmd, show_lists, 0);
- primitive_tex("openout", extension_cmd, open_node, 0);
- primitive_tex("write", extension_cmd, write_node, 0);
+ primitive_tex("openout", extension_cmd, open_code, 0);
+ primitive_tex("write", extension_cmd, write_code, 0);
write_loc = cur_val;
- primitive_tex("closeout", extension_cmd, close_node, 0);
- primitive_tex("special", extension_cmd, special_node, 0);
+ primitive_tex("closeout", extension_cmd, close_code, 0);
+ primitive_tex("special", extension_cmd, special_code, 0);
cs_text(frozen_special) = maketexstring("special");
eqtb[frozen_special] = eqtb[cur_val];
primitive_tex("immediate", extension_cmd, immediate_code, 0);
- primitive_luatex("localinterlinepenalty", assign_int_cmd,
- int_base + local_inter_line_penalty_code, int_base);
- primitive_luatex("localbrokenpenalty", assign_int_cmd,
- int_base + local_broken_penalty_code, int_base);
- primitive_luatex("pagedir", assign_dir_cmd, int_base + page_direction_code,
- dir_base);
- primitive_luatex("bodydir", assign_dir_cmd, int_base + body_direction_code,
- dir_base);
- 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("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);
- primitive_luatex("pagebottomoffset", assign_dimen_cmd,
- dimen_base + page_bottom_offset_code, dimen_base);
- primitive_pdftex("pdfliteral", extension_cmd, pdf_literal_node, 0);
- primitive_pdftex("pdfcolorstack", extension_cmd, pdf_colorstack_node, 0);
- primitive_pdftex("pdfsetmatrix", extension_cmd, pdf_setmatrix_node, 0);
- primitive_pdftex("pdfsave", extension_cmd, pdf_save_node, 0);
- primitive_pdftex("pdfrestore", extension_cmd, pdf_restore_node, 0);
- primitive_pdftex("pdfobj", extension_cmd, pdf_obj_code, 0);
- primitive_pdftex("pdfrefobj", extension_cmd, pdf_refobj_node, 0);
- primitive_pdftex("pdfxform", extension_cmd, pdf_xform_code, 0);
- primitive_pdftex("pdfrefxform", extension_cmd, pdf_refxform_node, 0);
- primitive_pdftex("pdfximage", extension_cmd, pdf_ximage_code, 0);
- primitive_pdftex("pdfrefximage", extension_cmd, pdf_refximage_node, 0);
- primitive_pdftex("pdfannot", extension_cmd, pdf_annot_node, 0);
- primitive_pdftex("pdfstartlink", extension_cmd, pdf_start_link_node, 0);
- primitive_pdftex("pdfendlink", extension_cmd, pdf_end_link_node, 0);
- primitive_pdftex("pdfoutline", extension_cmd, pdf_outline_code, 0);
- primitive_pdftex("pdfdest", extension_cmd, pdf_dest_node, 0);
- primitive_pdftex("pdfthread", extension_cmd, pdf_thread_node, 0);
- primitive_pdftex("pdfstartthread", extension_cmd, pdf_start_thread_node, 0);
- primitive_pdftex("pdfendthread", extension_cmd, pdf_end_thread_node, 0);
- primitive_luatex("savepos", extension_cmd, save_pos_node, 0);
- primitive_pdftex("pdfinfo", extension_cmd, pdf_info_code, 0);
- primitive_pdftex("pdfcatalog", extension_cmd, pdf_catalog_code, 0);
- primitive_pdftex("pdfnames", extension_cmd, pdf_names_code, 0);
- primitive_pdftex("pdfincludechars", extension_cmd, pdf_include_chars_code,
- 0);
- primitive_pdftex("pdffontattr", extension_cmd, pdf_font_attr_code, 0);
- primitive_pdftex("pdfmapfile", extension_cmd, pdf_map_file_code, 0);
- primitive_pdftex("pdfmapline", extension_cmd, pdf_map_line_code, 0);
- primitive_pdftex("pdftrailer", extension_cmd, pdf_trailer_code, 0);
- primitive_luatex("savecatcodetable", extension_cmd,
- save_cat_code_table_code, 0);
- primitive_luatex("initcatcodetable", extension_cmd,
- init_cat_code_table_code, 0);
- primitive_luatex("setrandomseed", extension_cmd, set_random_seed_code,
- 0);
- primitive_luatex("latelua", extension_cmd, late_lua_node, 0);
- primitive_pdftex("expandglyphsinfont", extension_cmd, font_expand_code, 0);
- primitive_pdftex("pdfglyphtounicode", extension_cmd,
- pdf_glyph_to_unicode_code, 0);
-
- /* some of the internal integer parameters are not associated with actual
- primitives at all. */
-
- primitive_no("nolocalwhatsits", assign_int_cmd,
- int_base + no_local_whatsits_code, int_base);
- primitive_no("nolocaldirs", assign_int_cmd,
- int_base + no_local_dirs_code, int_base);
+ primitive_luatex("localinterlinepenalty", assign_int_cmd, int_base + local_inter_line_penalty_code, int_base);
+ primitive_luatex("localbrokenpenalty", assign_int_cmd, int_base + local_broken_penalty_code, int_base);
+ primitive_luatex("pagedir", assign_dir_cmd, int_base + page_direction_code, dir_base);
+ primitive_luatex("bodydir", assign_dir_cmd, int_base + body_direction_code, dir_base);
+ 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("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);
+ primitive_luatex("pagebottomoffset", assign_dimen_cmd, dimen_base + page_bottom_offset_code, dimen_base);
+ primitive_luatex("saveboxresource", extension_cmd, save_box_resource_code, 0);
+ primitive_luatex("useboxresource", extension_cmd, use_box_resource_code, 0);
+ primitive_luatex("saveimageresource", extension_cmd, save_image_resource_code, 0);
+ primitive_luatex("useimageresource", extension_cmd, use_image_resource_code, 0);
+ primitive_luatex("savepos", normal_cmd, save_pos_code, 0);
+ primitive_luatex("savecatcodetable", normal_cmd, save_cat_code_table_code, 0);
+ primitive_luatex("initcatcodetable", normal_cmd, init_cat_code_table_code, 0);
+ primitive_luatex("setrandomseed", normal_cmd, set_random_seed_code, 0);
+ primitive_luatex("latelua", normal_cmd, late_lua_code, 0);
+ primitive_luatex("insertht", convert_cmd, insert_ht_code, 0);
+ primitive_luatex("dviextension", extension_cmd, dvi_extension_code, 0);
+ primitive_luatex("dvifeedback", convert_cmd, dvi_feedback_code, 0);
+ primitive_luatex("dvivariable", convert_cmd, dvi_variable_code, 0);
+ primitive_luatex("pdfextension", extension_cmd, pdf_extension_code, 0);
+ primitive_luatex("pdffeedback", convert_cmd, pdf_feedback_code, 0);
+ primitive_luatex("pdfvariable", convert_cmd, pdf_variable_code, 0);
+ primitive_luatex("mathoption", option_cmd, math_option_code, 0);
+
+ /*
+ some of the internal integer parameters are not associated with actual
+ primitives at all.
+ */
+ primitive_no("nolocalwhatsits", assign_int_cmd, int_base + no_local_whatsits_code, int_base);
+ primitive_no("nolocaldirs", assign_int_cmd, int_base + no_local_dirs_code, int_base);
@ @c
@@ -1011,50 +710,35 @@ void initialize_etex_commands(void)
{
primitive_etex("lastnodetype", last_item_cmd, last_node_type_code, 0);
primitive_etex("eTeXversion", last_item_cmd, eTeX_version_code, 0);
- primitive_etex("eTeXminorversion", last_item_cmd, eTeX_minor_version_code,
- 0);
+ primitive_etex("eTeXminorversion", last_item_cmd, eTeX_minor_version_code, 0);
primitive_etex("eTeXrevision", convert_cmd, eTeX_revision_code, 0);
- /* First we implement the additional \eTeX\ parameters in the table of equivalents. */
+ /*
+ First we implement the additional \eTeX\ parameters in the table of equivalents.
+ */
primitive_etex("everyeof", assign_toks_cmd, every_eof_loc, local_base);
- primitive_etex("tracingassigns", assign_int_cmd,
- int_base + tracing_assigns_code, int_base);
- primitive_etex("tracinggroups", assign_int_cmd,
- int_base + tracing_groups_code, int_base);
- primitive_etex("tracingifs", assign_int_cmd, int_base + tracing_ifs_code,
- int_base);
- primitive_etex("tracingscantokens", assign_int_cmd,
- int_base + tracing_scan_tokens_code, int_base);
- primitive_etex("tracingnesting", assign_int_cmd,
- int_base + tracing_nesting_code, int_base);
- primitive_etex("predisplaydirection", assign_int_cmd,
- int_base + pre_display_direction_code, int_base);
- primitive_etex("lastlinefit", assign_int_cmd, int_base + last_line_fit_code,
- int_base);
- primitive_etex("savingvdiscards", assign_int_cmd,
- int_base + saving_vdiscards_code, int_base);
- primitive_etex("savinghyphcodes", assign_int_cmd,
- int_base + saving_hyph_codes_code, int_base);
- primitive_luatex("suppressfontnotfounderror", assign_int_cmd,
- int_base + suppress_fontnotfound_error_code, int_base);
- primitive_luatex("suppresslongerror", assign_int_cmd,
- int_base + suppress_long_error_code, int_base);
- primitive_luatex("suppressmathparerror", assign_int_cmd,
- int_base + suppress_mathpar_error_code, int_base);
- primitive_luatex("suppressifcsnameerror", assign_int_cmd,
- int_base + suppress_ifcsname_error_code, int_base);
- primitive_luatex("suppressoutererror", assign_int_cmd,
- int_base + suppress_outer_error_code, int_base);
- primitive_luatex("matheqnogapstep", assign_int_cmd,
- int_base + math_eqno_gap_step_code, int_base);
- primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code,
- int_base);
-
- primitive_etex("currentgrouplevel", last_item_cmd, current_group_level_code,
- 0);
- primitive_etex("currentgrouptype", last_item_cmd, current_group_type_code,
- 0);
+ primitive_etex("tracingassigns", assign_int_cmd, int_base + tracing_assigns_code, int_base);
+ primitive_etex("tracinggroups", assign_int_cmd, int_base + tracing_groups_code, int_base);
+ primitive_etex("tracingifs", assign_int_cmd, int_base + tracing_ifs_code, int_base);
+ primitive_etex("tracingscantokens", assign_int_cmd, int_base + tracing_scan_tokens_code, int_base);
+ primitive_etex("tracingnesting", assign_int_cmd, int_base + tracing_nesting_code, int_base);
+ primitive_etex("predisplaydirection", assign_int_cmd, int_base + pre_display_direction_code, int_base);
+ primitive_etex("lastlinefit", assign_int_cmd, int_base + last_line_fit_code, int_base);
+ primitive_etex("savingvdiscards", assign_int_cmd, int_base + saving_vdiscards_code, int_base);
+ primitive_etex("savinghyphcodes", assign_int_cmd, int_base + saving_hyph_codes_code, int_base);
+ primitive_luatex("suppressfontnotfounderror", assign_int_cmd, int_base + suppress_fontnotfound_error_code, int_base);
+ primitive_luatex("suppresslongerror", assign_int_cmd, int_base + suppress_long_error_code, int_base);
+ primitive_luatex("suppressmathparerror", assign_int_cmd, int_base + suppress_mathpar_error_code, int_base);
+ primitive_luatex("suppressifcsnameerror", assign_int_cmd, int_base + suppress_ifcsname_error_code, int_base);
+ primitive_luatex("suppressoutererror", assign_int_cmd, int_base + suppress_outer_error_code, int_base);
+ primitive_luatex("matheqnogapstep", assign_int_cmd, int_base + math_eqno_gap_step_code, int_base);
+ primitive_luatex("mathdisplayskipmode", assign_int_cmd, int_base + math_display_skip_mode_code, int_base);
+ primitive_luatex("mathscriptsmode", assign_int_cmd, int_base + math_scripts_mode_code, int_base);
+ primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code, int_base);
+
+ primitive_etex("currentgrouplevel", last_item_cmd, current_group_level_code, 0);
+ primitive_etex("currentgrouptype", last_item_cmd, current_group_type_code, 0);
primitive_etex("currentiflevel", last_item_cmd, current_if_level_code, 0);
primitive_etex("currentiftype", last_item_cmd, current_if_type_code, 0);
@@ -1069,29 +753,41 @@ void initialize_etex_commands(void)
primitive_etex("parshapedimen", last_item_cmd, par_shape_dimen_code, 0);
primitive_etex("showgroups", xray_cmd, show_groups, 0);
- /* The \.{\\showtokens} command displays a token list. */
+
+ /*
+ The \.{\\showtokens} command displays a token list.
+ */
+
primitive_etex("showtokens", xray_cmd, show_tokens, 0);
+
/*
- The \.{\\unexpanded} primitive prevents expansion of tokens much as
- the result from \.{\\the} applied to a token variable. The
- \.{\\detokenize} primitive converts a token list into a list of
- character tokens much as if the token list were written to a file. We
- use the fact that the command modifiers for \.{\\unexpanded} and
- \.{\\detokenize} are odd whereas those for \.{\\the} and \.{\\showthe}
- are even.
- */
+ The \.{\\unexpanded} primitive prevents expansion of tokens much as
+ the result from \.{\\the} applied to a token variable. The
+ \.{\\detokenize} primitive converts a token list into a list of
+ character tokens much as if the token list were written to a file. We
+ use the fact that the command modifiers for \.{\\unexpanded} and
+ \.{\\detokenize} are odd whereas those for \.{\\the} and \.{\\showthe}
+ are even.
+ */
+
primitive_etex("unexpanded", the_cmd, 1, 0);
primitive_etex("detokenize", the_cmd, show_tokens, 0);
- /* The \.{\\showifs} command displays all currently active conditionals. */
+ /*
+ The \.{\\showifs} command displays all currently active conditionals.
+ */
primitive_etex("showifs", xray_cmd, show_ifs, 0);
- /* The \.{\\interactionmode} primitive allows to query and set the interaction mode. */
+ /*
+ The \.{\\interactionmode} primitive allows to query and set the interaction mode.
+ */
primitive_etex("interactionmode", set_page_int_cmd, 2, 0);
- /* The |scan_tokens| feature of \eTeX\ defines the \.{\\scantokens} primitive. */
+ /*
+ The |scan_tokens| feature of \eTeX\ defines the \.{\\scantokens} primitive.
+ */
primitive_etex("scantokens", input_cmd, 2, 0);
primitive_luatex("scantextokens", input_cmd, 3, 0);
@@ -1106,26 +802,25 @@ void initialize_etex_commands(void)
primitive_luatex("ifabsnum", if_test_cmd, if_abs_num_code, 0);
primitive_luatex("ifabsdim", if_test_cmd, if_abs_dim_code, 0);
- /* The |protected| feature of \eTeX\ defines the \.{\\protected} prefix
- command for macro definitions. Such macros are protected against
- expansions when lists of expanded tokens are built, e.g., for \.{\\edef}
- or during \.{\\write}. */
+ /*
+ The |protected| feature of \eTeX\ defines the \.{\\protected} prefix
+ command for macro definitions. Such macros are protected against
+ expansions when lists of expanded tokens are built, e.g., for \.{\\edef}
+ or during \.{\\write}.
+ */
primitive_etex("protected", prefix_cmd, 8, 0);
- /* Here are the additional \eTeX\ primitives for expressions. */
+ /*
+ Here are the additional \eTeX\ primitives for expressions.
+ */
- primitive_etex("numexpr", last_item_cmd,
- eTeX_expr - int_val_level + int_val_level, 0);
- primitive_etex("dimexpr", last_item_cmd,
- eTeX_expr - int_val_level + dimen_val_level, 0);
- primitive_etex("glueexpr", last_item_cmd,
- eTeX_expr - int_val_level + glue_val_level, 0);
- primitive_etex("muexpr", last_item_cmd,
- eTeX_expr - int_val_level + mu_val_level, 0);
+ primitive_etex("numexpr", last_item_cmd, eTeX_expr - int_val_level + int_val_level, 0);
+ primitive_etex("dimexpr", last_item_cmd, eTeX_expr - int_val_level + dimen_val_level, 0);
+ primitive_etex("glueexpr", last_item_cmd, eTeX_expr - int_val_level + glue_val_level, 0);
+ primitive_etex("muexpr", last_item_cmd, eTeX_expr - int_val_level + mu_val_level, 0);
- primitive_etex("gluestretchorder", last_item_cmd, glue_stretch_order_code,
- 0);
+ primitive_etex("gluestretchorder", last_item_cmd, glue_stretch_order_code, 0);
primitive_etex("glueshrinkorder", last_item_cmd, glue_shrink_order_code, 0);
primitive_etex("gluestretch", last_item_cmd, glue_stretch_code, 0);
primitive_etex("glueshrink", last_item_cmd, glue_shrink_code, 0);
@@ -1133,25 +828,26 @@ void initialize_etex_commands(void)
primitive_etex("mutoglue", last_item_cmd, mu_to_glue_code, 0);
primitive_etex("gluetomu", last_item_cmd, glue_to_mu_code, 0);
- /* The \.{\\pagediscards} and \.{\\splitdiscards} commands share the
- command code |un_vbox| with \.{\\unvbox} and \.{\\unvcopy}, they are
- distinguished by their |chr_code| values |last_box_code| and
- |vsplit_code|. These |chr_code| values are larger than |box_code| and
- |copy_code|. */
+ /*
+ The \.{\\pagediscards} and \.{\\splitdiscards} commands share the
+ command code |un_vbox| with \.{\\unvbox} and \.{\\unvcopy}, they are
+ distinguished by their |chr_code| values |last_box_code| and
+ |vsplit_code|. These |chr_code| values are larger than |box_code| and
+ |copy_code|.
+ */
primitive_etex("pagediscards", un_vbox_cmd, last_box_code, 0);
primitive_etex("splitdiscards", un_vbox_cmd, vsplit_code, 0);
- /* The \.{\\interlinepenalties}, \.{\\clubpenalties}, \.{\\widowpenalties},
- and \.{\\displaywidowpenalties} commands allow to define arrays of
- penalty values to be used instead of the corresponding single values. */
- primitive_etex("interlinepenalties", set_etex_shape_cmd,
- inter_line_penalties_loc, etex_pen_base);
- primitive_etex("clubpenalties", set_etex_shape_cmd, club_penalties_loc,
- etex_pen_base);
- primitive_etex("widowpenalties", set_etex_shape_cmd, widow_penalties_loc,
- etex_pen_base);
- primitive_etex("displaywidowpenalties", set_etex_shape_cmd,
- display_widow_penalties_loc, etex_pen_base);
+ /*
+ The \.{\\interlinepenalties}, \.{\\clubpenalties}, \.{\\widowpenalties},
+ and \.{\\displaywidowpenalties} commands allow to define arrays of
+ penalty values to be used instead of the corresponding single values.
+ */
+
+ primitive_etex("interlinepenalties", set_etex_shape_cmd, inter_line_penalties_loc, etex_pen_base);
+ primitive_etex("clubpenalties", set_etex_shape_cmd, club_penalties_loc, etex_pen_base);
+ primitive_etex("widowpenalties", set_etex_shape_cmd, widow_penalties_loc, etex_pen_base);
+ primitive_etex("displaywidowpenalties", set_etex_shape_cmd, display_widow_penalties_loc, etex_pen_base);
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/conditional.w b/Build/source/texk/web2c/luatexdir/tex/conditional.w
index 8c312a536c8..4c25a7a922f 100644
--- a/Build/source/texk/web2c/luatexdir/tex/conditional.w
+++ b/Build/source/texk/web2c/luatexdir/tex/conditional.w
@@ -25,7 +25,7 @@
@ @c
#define box(A) eqtb[box_base+(A)].hh.rh
-@* We consider now the way \TeX\ handles various kinds of \.{\\if} commands.
+@* We consider now the way \TeX\ handles various kinds of \.{\\if} commands.
@ Conditions can be inside conditions, and this nesting has a stack
that is independent of the |save_stack|.
@@ -73,7 +73,7 @@ void pass_text(void)
l = 0;
skip_line = line;
while (1) {
- get_token_lua();
+ get_next(); /* get_token_lua(); */
if (cur_cmd == fi_or_else_cmd) {
if (l == 0)
break;
@@ -381,11 +381,11 @@ void conditional(void)
*/
save_scanner_status = scanner_status;
scanner_status = normal;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
n = cur_cs;
p = cur_cmd;
q = cur_chr;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
if (cur_cmd != p) {
b = false;
} else if (cur_cmd < call_cmd) {
@@ -418,8 +418,9 @@ void conditional(void)
scanner_status = save_scanner_status;
break;
case if_eof_code:
+ /* bad this system check here as it's an extension*/
scan_four_bit_int_or_18();
- if (cur_val == 18)
+ if (cur_val == write_target_system)
b = !shellenabledp;
else
b = (read_open[cur_val] == closed);
@@ -459,7 +460,7 @@ void conditional(void)
case if_primitive_code:
save_scanner_status = scanner_status;
scanner_status = normal;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
scanner_status = save_scanner_status;
m = prim_lookup(cs_text(cur_cs));
b = ((cur_cmd != undefined_cs_cmd) &&
@@ -473,7 +474,7 @@ void conditional(void)
are allowed, but we might be scanning a macro definition or preamble. */
save_scanner_status = scanner_status;
scanner_status = normal;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
b = (cur_cmd != undefined_cs_cmd);
scanner_status = save_scanner_status;
break;
diff --git a/Build/source/texk/web2c/luatexdir/tex/directions.h b/Build/source/texk/web2c/luatexdir/tex/directions.h
index b595032f48e..34a89cc29a2 100644
--- a/Build/source/texk/web2c/luatexdir/tex/directions.h
+++ b/Build/source/texk/web2c/luatexdir/tex/directions.h
@@ -21,307 +21,108 @@
#ifndef DIRECTIONS_H
# define DIRECTIONS_H
-# define dir_T 0
-# define dir_L 1
-# define dir_B 2
-# define dir_R 3
-
-# define dir_TLT 0
-# define dir_TRT 4
-# define dir_LTL 9
-# define dir_RTT 24
-
-extern const char *dir_strings[128];
-
- /* # define dir_array_size 25 *//* |dir_RTT + 1| */
-
-/* inv(primary) == tertiary */
/*
-boolean _is_mirrored[dir_array_size];
-_is_mirrored[dir_TLT] = 0;
-_is_mirrored[dir_TRT] = 0;
-_is_mirrored[dir_LTL] = 0;
-_is_mirrored[dir_RTT] = 0;
-*/
-
-# define is_mirrored(a) 0
+ # define dir_TLT 0
+ # define dir_TRT 4
+ # define dir_LTL 9
+ # define dir_RTT 24
-/* secondary == tertiary */
-/*
-boolean _is_rotated[dir_array_size];
-_is_rotated[dir_TLT] = 0;
-_is_rotated[dir_TRT] = 0;
-_is_rotated[dir_LTL] = 0;
-_is_rotated[dir_RTT] = 1;
+ extern const char *dir_strings[128];
*/
-# define is_rotated(a) (a == dir_RTT)
+# define dir_TLT 0 /* maybe use this one as unset value */
+# define dir_TRT 1 /* or swhould we avoid that one because it's a signal too */
+# define dir_LTL 2
+# define dir_RTT 3
-/* secondary == secondary */
-/*
-boolean _textdir_parallel[dir_array_size][dir_array_size];
-_textdir_parallel[dir_TLT][dir_TLT] = 1;
-_textdir_parallel[dir_TLT][dir_TRT] = 1;
-_textdir_parallel[dir_TLT][dir_LTL] = 0;
-_textdir_parallel[dir_TLT][dir_RTT] = 0;
-_textdir_parallel[dir_TRT][dir_TLT] = 1;
-_textdir_parallel[dir_TRT][dir_TRT] = 1;
-_textdir_parallel[dir_TRT][dir_LTL] = 0;
-_textdir_parallel[dir_TRT][dir_RTT] = 0;
-_textdir_parallel[dir_LTL][dir_TLT] = 0;
-_textdir_parallel[dir_LTL][dir_TRT] = 0;
-_textdir_parallel[dir_LTL][dir_LTL] = 1;
-_textdir_parallel[dir_LTL][dir_RTT] = 1;
-_textdir_parallel[dir_RTT][dir_TLT] = 0;
-_textdir_parallel[dir_RTT][dir_TRT] = 0;
-_textdir_parallel[dir_RTT][dir_LTL] = 1;
-_textdir_parallel[dir_RTT][dir_RTT] = 1;
-*/
+extern const char *dir_strings[8];
-# define textdir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
- ((a == dir_LTL || a == dir_RTT)&&(b == dir_LTL || b == dir_RTT)))
+extern int dir_swap;
+# define RETURN_DIR_VALUES(a) \
+ if (s==luaS_##a##_ptr) { \
+ return (dir_##a); \
+ } else if (!absolute_only) { \
+ if (s==luaS_p##a##_ptr) \
+ return (dir_##a); \
+ else if (s==luaS_m##a##_ptr) \
+ return ((dir_##a)-4); \
+ }
-/* primary == primary */
-/*
-boolean _pardir_parallel[dir_array_size][dir_array_size];
-_pardir_parallel[dir_TLT][dir_TLT] = 1;
-_pardir_parallel[dir_TLT][dir_TRT] = 1;
-_pardir_parallel[dir_TLT][dir_LTL] = 0;
-_pardir_parallel[dir_TLT][dir_RTT] = 0;
-_pardir_parallel[dir_TRT][dir_TLT] = 1;
-_pardir_parallel[dir_TRT][dir_TRT] = 1;
-_pardir_parallel[dir_TRT][dir_LTL] = 0;
-_pardir_parallel[dir_TRT][dir_RTT] = 0;
-_pardir_parallel[dir_LTL][dir_TLT] = 0;
-_pardir_parallel[dir_LTL][dir_TRT] = 0;
-_pardir_parallel[dir_LTL][dir_LTL] = 1;
-_pardir_parallel[dir_LTL][dir_RTT] = 1;
-_pardir_parallel[dir_RTT][dir_TLT] = 0;
-_pardir_parallel[dir_RTT][dir_TRT] = 0;
-_pardir_parallel[dir_RTT][dir_LTL] = 1;
-_pardir_parallel[dir_RTT][dir_RTT] = 1;
-*/
+# define BOX_DIR_VALUE(a) \
+ ((s==luaS_p##a##_ptr) : (dir_##a) ? ((s==luaS_m##a##_ptr) : ((dir_##a)-4) ? luaS_pTLT))
+# define is_mirrored(a) 0
-# define pardir_parallel(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT)) || \
- ((a == dir_LTL || a == dir_RTT)&&(b == dir_LTL || b == dir_RTT)))
-
-
-/* inv(primary) == primary */
-/*
-boolean _pardir_opposite[dir_array_size][dir_array_size];
-_pardir_opposite[dir_TLT][dir_TLT] = 0;
-_pardir_opposite[dir_TLT][dir_TRT] = 0;
-_pardir_opposite[dir_TLT][dir_LTL] = 0;
-_pardir_opposite[dir_TLT][dir_RTT] = 0;
-_pardir_opposite[dir_TRT][dir_TLT] = 0;
-_pardir_opposite[dir_TRT][dir_TRT] = 0;
-_pardir_opposite[dir_TRT][dir_LTL] = 0;
-_pardir_opposite[dir_TRT][dir_RTT] = 0;
-_pardir_opposite[dir_LTL][dir_TLT] = 0;
-_pardir_opposite[dir_LTL][dir_TRT] = 0;
-_pardir_opposite[dir_LTL][dir_LTL] = 0;
-_pardir_opposite[dir_LTL][dir_RTT] = 1;
-_pardir_opposite[dir_RTT][dir_TLT] = 0;
-_pardir_opposite[dir_RTT][dir_TRT] = 0;
-_pardir_opposite[dir_RTT][dir_LTL] = 1;
-_pardir_opposite[dir_RTT][dir_RTT] = 0;
-*/
-
-# define pardir_opposite(a,b) ((a == dir_LTL && b == dir_RTT)||(a == dir_RTT && b == dir_LTL))
-
+# define is_rotated(a) (a == dir_RTT)
-/* inv(secondary) == secondary */
-/*
-boolean _textdir_opposite[dir_array_size][dir_array_size];
-_textdir_opposite[dir_TLT][dir_TLT] = 0;
-_textdir_opposite[dir_TLT][dir_TRT] = 1;
-_textdir_opposite[dir_TLT][dir_LTL] = 0;
-_textdir_opposite[dir_TLT][dir_RTT] = 0;
-_textdir_opposite[dir_TRT][dir_TLT] = 1;
-_textdir_opposite[dir_TRT][dir_TRT] = 0;
-_textdir_opposite[dir_TRT][dir_LTL] = 0;
-_textdir_opposite[dir_TRT][dir_RTT] = 0;
-_textdir_opposite[dir_LTL][dir_TLT] = 0;
-_textdir_opposite[dir_LTL][dir_TRT] = 0;
-_textdir_opposite[dir_LTL][dir_LTL] = 0;
-_textdir_opposite[dir_LTL][dir_RTT] = 0;
-_textdir_opposite[dir_RTT][dir_TLT] = 0;
-_textdir_opposite[dir_RTT][dir_TRT] = 0;
-_textdir_opposite[dir_RTT][dir_LTL] = 0;
-_textdir_opposite[dir_RTT][dir_RTT] = 0;
-*/
+# define textdir_parallel(a,b) ( \
+ ((a == dir_TLT || a == dir_TRT) && (b == dir_TLT || b == dir_TRT)) || \
+ ((a == dir_LTL || a == dir_RTT) && (b == dir_LTL || b == dir_RTT)) \
+)
-# define textdir_opposite(a,b) ((a == dir_TLT && b == dir_TRT)||(a == dir_TRT && b == dir_TLT))
+# define pardir_parallel(a,b) ( \
+ ((a == dir_TLT || a == dir_TRT) && (b == dir_TLT || b == dir_TRT)) || \
+ ((a == dir_LTL || a == dir_RTT) && (b == dir_LTL || b == dir_RTT)) \
+)
+# define pardir_opposite(a,b) ( \
+ (a == dir_LTL && b == dir_RTT) || \
+ (a == dir_RTT && b == dir_LTL) \
+)
-/* inv(tertiary) == tertiary */
-/*
-boolean _glyphdir_opposite[dir_array_size][dir_array_size];
-_glyphdir_opposite[dir_TLT][dir_TLT] = 0;
-_glyphdir_opposite[dir_TLT][dir_TRT] = 0;
-_glyphdir_opposite[dir_TLT][dir_LTL] = 0;
-_glyphdir_opposite[dir_TLT][dir_RTT] = 0;
-_glyphdir_opposite[dir_TRT][dir_TLT] = 0;
-_glyphdir_opposite[dir_TRT][dir_TRT] = 0;
-_glyphdir_opposite[dir_TRT][dir_LTL] = 0;
-_glyphdir_opposite[dir_TRT][dir_RTT] = 0;
-_glyphdir_opposite[dir_LTL][dir_TLT] = 0;
-_glyphdir_opposite[dir_LTL][dir_TRT] = 0;
-_glyphdir_opposite[dir_LTL][dir_LTL] = 0;
-_glyphdir_opposite[dir_LTL][dir_RTT] = 0;
-_glyphdir_opposite[dir_RTT][dir_TLT] = 0;
-_glyphdir_opposite[dir_RTT][dir_TRT] = 0;
-_glyphdir_opposite[dir_RTT][dir_LTL] = 0;
-_glyphdir_opposite[dir_RTT][dir_RTT] = 0;
-*/
+# define textdir_opposite(a,b) ( \
+ (a == dir_TLT && b == dir_TRT) || \
+ (a == dir_TRT && b == dir_TLT) \
+)
# define glyphdir_opposite(a,b) 0
-
-/* primary == primary */
-/*
-boolean _pardir_eq[dir_array_size][dir_array_size];
-_pardir_eq[dir_TLT][dir_TLT] = 1;
-_pardir_eq[dir_TLT][dir_TRT] = 1;
-_pardir_eq[dir_TLT][dir_LTL] = 0;
-_pardir_eq[dir_TLT][dir_RTT] = 0;
-_pardir_eq[dir_TRT][dir_TLT] = 1;
-_pardir_eq[dir_TRT][dir_TRT] = 1;
-_pardir_eq[dir_TRT][dir_LTL] = 0;
-_pardir_eq[dir_TRT][dir_RTT] = 0;
-_pardir_eq[dir_LTL][dir_TLT] = 0;
-_pardir_eq[dir_LTL][dir_TRT] = 0;
-_pardir_eq[dir_LTL][dir_LTL] = 1;
-_pardir_eq[dir_LTL][dir_RTT] = 0;
-_pardir_eq[dir_RTT][dir_TLT] = 0;
-_pardir_eq[dir_RTT][dir_TRT] = 0;
-_pardir_eq[dir_RTT][dir_LTL] = 0;
-_pardir_eq[dir_RTT][dir_RTT] = 1;
-*/
-
-# define pardir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_TLT || b == dir_TRT))|| \
- (a == dir_LTL && b == dir_LTL) || \
- (a == dir_RTT && b == dir_RTT))
-
-/* secondary == secondary */
-/*
-boolean _textdir_eq[dir_array_size][dir_array_size];
-_textdir_eq[dir_TLT][dir_TLT] = 1;
-_textdir_eq[dir_TLT][dir_TRT] = 0;
-_textdir_eq[dir_TLT][dir_LTL] = 0;
-_textdir_eq[dir_TLT][dir_RTT] = 0;
-_textdir_eq[dir_TRT][dir_TLT] = 0;
-_textdir_eq[dir_TRT][dir_TRT] = 1;
-_textdir_eq[dir_TRT][dir_LTL] = 0;
-_textdir_eq[dir_TRT][dir_RTT] = 0;
-_textdir_eq[dir_LTL][dir_TLT] = 0;
-_textdir_eq[dir_LTL][dir_TRT] = 0;
-_textdir_eq[dir_LTL][dir_LTL] = 1;
-_textdir_eq[dir_LTL][dir_RTT] = 1;
-_textdir_eq[dir_RTT][dir_TLT] = 0;
-_textdir_eq[dir_RTT][dir_TRT] = 0;
-_textdir_eq[dir_RTT][dir_LTL] = 1;
-_textdir_eq[dir_RTT][dir_RTT] = 1;
-*/
-
-# define textdir_eq(a,b) ((a == dir_TLT && b == dir_TLT) || \
- (a == dir_TRT && b == dir_TRT) || \
- (a == dir_LTL && (b == dir_LTL || b == dir_RTT)) || \
- (a == dir_RTT && (b == dir_LTL || b == dir_RTT))
-
-
-/* tertiary == tertiary */
-/*
-boolean _glyphdir_eq[dir_array_size][dir_array_size];
-_glyphdir_eq[dir_TLT][dir_TLT] = 1;
-_glyphdir_eq[dir_TLT][dir_TRT] = 1;
-_glyphdir_eq[dir_TLT][dir_LTL] = 0;
-_glyphdir_eq[dir_TLT][dir_RTT] = 1;
-_glyphdir_eq[dir_TRT][dir_TLT] = 1;
-_glyphdir_eq[dir_TRT][dir_TRT] = 1;
-_glyphdir_eq[dir_TRT][dir_LTL] = 0;
-_glyphdir_eq[dir_TRT][dir_RTT] = 1;
-_glyphdir_eq[dir_LTL][dir_TLT] = 0;
-_glyphdir_eq[dir_LTL][dir_TRT] = 0;
-_glyphdir_eq[dir_LTL][dir_LTL] = 1;
-_glyphdir_eq[dir_LTL][dir_RTT] = 0;
-_glyphdir_eq[dir_RTT][dir_TLT] = 1;
-_glyphdir_eq[dir_RTT][dir_TRT] = 1;
-_glyphdir_eq[dir_RTT][dir_LTL] = 0;
-_glyphdir_eq[dir_RTT][dir_RTT] = 1;
-*/
-
-# define glyphdir_eq(a,b) ((a != dir_LTL && b != dir_LTL) || \
- (a == dir_LTL && b == dir_LTL))
-
-
-/* primary == secondary */
-/*
-boolean _partextdir_eq[dir_array_size][dir_array_size];
-_partextdir_eq[dir_TLT][dir_TLT] = 0;
-_partextdir_eq[dir_TLT][dir_TRT] = 0;
-_partextdir_eq[dir_TLT][dir_LTL] = 1;
-_partextdir_eq[dir_TLT][dir_RTT] = 1;
-_partextdir_eq[dir_TRT][dir_TLT] = 0;
-_partextdir_eq[dir_TRT][dir_TRT] = 0;
-_partextdir_eq[dir_TRT][dir_LTL] = 1;
-_partextdir_eq[dir_TRT][dir_RTT] = 1;
-_partextdir_eq[dir_LTL][dir_TLT] = 1;
-_partextdir_eq[dir_LTL][dir_TRT] = 0;
-_partextdir_eq[dir_LTL][dir_LTL] = 0;
-_partextdir_eq[dir_LTL][dir_RTT] = 0;
-_partextdir_eq[dir_RTT][dir_TLT] = 0;
-_partextdir_eq[dir_RTT][dir_TRT] = 1;
-_partextdir_eq[dir_RTT][dir_LTL] = 0;
-_partextdir_eq[dir_RTT][dir_RTT] = 0;
-*/
-
-# define partextdir_eq(a,b) (((a == dir_TLT || a == dir_TRT)&&(b == dir_LTL || b == dir_RTT)) || \
- (a == dir_LTL && b == dir_TLT) || \
- (a == dir_RTT && b == dir_TRT))
-
-
-/* secondary != tertiary */
-/*
-boolean _textglyphdir_orthogonal[dir_array_size]
-_textglyphdir_orthogonal[dir_TLT] = 1;
-_textglyphdir_orthogonal[dir_TRT] = 1;
-_textglyphdir_orthogonal[dir_LTL] = 1;
-_textglyphdir_orthogonal[dir_RTT] = 0;
-*/
+# define pardir_eq(a,b) ( \
+ ((a == dir_TLT || a == dir_TRT) && (b == dir_TLT || b == dir_TRT)) || \
+ (a == dir_LTL && b == dir_LTL) || \
+ (a == dir_RTT && b == dir_RTT) \
+)
+
+# define textdir_eq(a,b) ( \
+ (a == dir_TLT && b == dir_TLT) || \
+ (a == dir_TRT && b == dir_TRT) || \
+ (a == dir_LTL && (b == dir_LTL || b == dir_RTT)) || \
+ (a == dir_RTT && (b == dir_LTL || b == dir_RTT) \
+)
+
+# define glyphdir_eq(a,b) ( \
+ (a != dir_LTL && b != dir_LTL) || \
+ (a == dir_LTL && b == dir_LTL) \
+)
+
+# define partextdir_eq(a,b) ( \
+ ((a == dir_TLT || a == dir_TRT)&&(b == dir_LTL || b == dir_RTT)) || \
+ (a == dir_LTL && b == dir_TLT) || \
+ (a == dir_RTT && b == dir_TRT) \
+)
# define textglyphdir_orthogonal(a) (a != dir_RTT)
-/* secondary == L */
-/*
-boolean _textdir_is[dir_array_size];
-_textdir_is[dir_TLT] = 1;
-_textdir_is[dir_TRT] = 1;
-_textdir_is[dir_LTL] = 1;
-_textdir_is[dir_RTT] = 0;
-*/
-
# define textdir_is_L(a) (a == dir_TLT)
-# define push_dir(a,b) \
- { halfword dir_tmp=new_dir((a)); \
- vlink(dir_tmp)=b; \
- b=dir_tmp; \
- }
+# define push_dir(a,b) { \
+ halfword dir_tmp=new_dir((a)); \
+ vlink(dir_tmp)=b; \
+ b=dir_tmp; \
+}
-# define push_dir_node(a,b) \
- { halfword dir_tmp=copy_node((a)); \
- vlink(dir_tmp)=b; \
- b=dir_tmp; \
- }
+# define push_dir_node(a,b) { \
+ halfword dir_tmp=copy_node((a)); \
+ vlink(dir_tmp)=b; \
+ b=dir_tmp; \
+}
-# define pop_dir_node(b) \
- { halfword dir_tmp=b; \
- b=vlink(dir_tmp); \
- flush_node(dir_tmp); \
- }
+# define pop_dir_node(b) { \
+ halfword dir_tmp=b; \
+ b=vlink(dir_tmp); \
+ flush_node(dir_tmp); \
+}
extern halfword dir_ptr;
@@ -339,8 +140,7 @@ extern halfword do_push_dir_node(halfword p, halfword a);
extern halfword do_pop_dir_node(halfword p);
scaled pack_width(int curdir, int pdir, halfword p, boolean isglyph);
-scaled_whd pack_width_height_depth(int curdir, int pdir, halfword p,
- boolean isglyph);
+scaled_whd pack_width_height_depth(int curdir, int pdir, halfword p, boolean isglyph);
void update_text_dir_ptr(int val);
diff --git a/Build/source/texk/web2c/luatexdir/tex/directions.w b/Build/source/texk/web2c/luatexdir/tex/directions.w
index 54f5586bc6b..addde937df7 100644
--- a/Build/source/texk/web2c/luatexdir/tex/directions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/directions.w
@@ -87,7 +87,7 @@ void initialize_directions(void)
halfword new_dir(int s)
{
halfword p; /* the new node */
- p = new_node(whatsit_node, dir_node);
+ p = new_node(dir_node, 0);
dir_dir(p) = s;
dir_dvi_ptr(p) = -1;
dir_level(p) = cur_level;
@@ -100,6 +100,8 @@ it here instead of there avoid the nodelib having to know
about the actual values of |dir_TRT| etc.
@c
+
+/*
const char *dir_strings[128] = {
"-TLT","???", "???", "???", "-TRT","???", "???", "???",
"???", "-LTL","???", "???", "???", "???", "???", "???",
@@ -116,19 +118,27 @@ const char *dir_strings[128] = {
"???", "???", "???", "???", "???", "???", "???", "???",
"???", "???", "???", "???", "???", "???", "???", "???",
"???", "???", "???", "???", "???", "???", "???", "???",
- "???", "???", "???", "???", "???", "???", "???", "???" };
+ "???", "???", "???", "???", "???", "???", "???", "???"
+};
+
+int dir_swap = 64;
+*/
+
+const char *dir_strings[8] = {
+ "-TLT","-TRT","-LTL","-RTT",
+ "+TLT","+TRT","+LTL","+RTT",
+};
+
+int dir_swap = 4;
const char *string_dir(int d)
{
- return (dir_strings[d+64]+1);
+ return (dir_strings[d+dir_swap]+1);
}
-
@ @c
void print_dir(int d)
{
- /* hh-ls: todo: just fetch the string pt from the registry ... then the above can go */
-
tprint(string_dir(d));
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
index a13a456072a..727951b9f32 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
@@ -26,8 +26,8 @@
#define prev_depth cur_list.prev_depth_field
/* 907 = sum of the values of the bytes of "don knuth" */
-/* The next FORMAT_ID will be 907+5 */
-#define FORMAT_ID (907+4)
+/* The next FORMAT_ID will be 907+7 */
+#define FORMAT_ID (907+6)
#if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
#error Wrong value for FORMAT_ID.
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
index 02e53e381ab..f21bf04c6a0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
@@ -49,7 +49,6 @@ emphasize this distinction.
# define script_size 1 /* size code for the medium size in a family */
# define script_script_size 2 /* size code for the smallest size in a family */
-
/*
Each entry in |eqtb| is a |memory_word|. Most of these words are of type
|two_halves|, and subdivided into three fields:
@@ -71,7 +70,6 @@ This may be a font number, a pointer into |mem|, or a variety of other
things.
*/
-
/*
Many locations in |eqtb| have symbolic names. The purpose of the next
paragraphs is to define these names, and to set up the initial values of the
@@ -88,8 +86,6 @@ locations for control sequences that are perpetually defined
(since they are used in error recovery).
*/
-
-
/*
@ Region 3 of |eqtb| contains the |number_regs| \.{\\skip} registers, as well as the
glue parameters defined here. It is important that the ``muskip''
@@ -119,157 +115,146 @@ complete failure.
here, and the |number_regs| \.{\\dimen} registers.
*/
-# define null_cs 1 /* equivalent of \.{\\csname\\endcsname} */
-# define hash_base (null_cs+1) /* beginning of region 2, for the hash table */
-# define frozen_control_sequence (hash_base+hash_size) /* for error recovery */
-# define frozen_protection (frozen_control_sequence) /* inaccessible but definable */
-# define frozen_cr (frozen_control_sequence+1) /* permanent `\.{\\cr}' */
-# define frozen_end_group (frozen_control_sequence+2) /* permanent `\.{\\endgroup}' */
-# define frozen_right (frozen_control_sequence+3) /* permanent `\.{\\right}' */
-# define frozen_fi (frozen_control_sequence+4) /* permanent `\.{\\fi}' */
-# define frozen_end_template (frozen_control_sequence+5)
- /* permanent `\.{\\endtemplate}' */
-# define frozen_endv (frozen_control_sequence+6)
- /* second permanent `\.{\\endtemplate}' */
-# define frozen_relax (frozen_control_sequence+7) /* permanent `\.{\\relax}' */
-# define end_write (frozen_control_sequence+8) /* permanent `\.{\\endwrite}' */
-# define frozen_dont_expand (frozen_control_sequence+9 )
- /* permanent `\.{\\notexpanded:}' */
-# define frozen_primitive (frozen_control_sequence+11 ) /* permanent `\.{\\pdfprimitive}' */
-# define frozen_special (frozen_control_sequence+12 ) /* permanent `\.{\\special}' */
-# define frozen_null_font (frozen_control_sequence+13 ) /* permanent `\.{\\nullfont}' */
-# define font_id_base (frozen_null_font-font_base ) /* begins table of |number_fonts| permanent font identifiers */
+# define null_cs 1 /* equivalent of \.{\\csname\\endcsname} */
+# define hash_base (null_cs+1) /* beginning of region 2, for the hash table */
+# define frozen_control_sequence (hash_base+hash_size) /* for error recovery */
+# define frozen_protection (frozen_control_sequence) /* inaccessible but definable */
+# define frozen_cr (frozen_control_sequence+1) /* permanent `\.{\\cr}' */
+# define frozen_end_group (frozen_control_sequence+2) /* permanent `\.{\\endgroup}' */
+# define frozen_right (frozen_control_sequence+3) /* permanent `\.{\\right}' */
+# define frozen_fi (frozen_control_sequence+4) /* permanent `\.{\\fi}' */
+# define frozen_end_template (frozen_control_sequence+5) /* permanent `\.{\\endtemplate}' */
+# define frozen_endv (frozen_control_sequence+6) /* second permanent `\.{\\endtemplate}' */
+# define frozen_relax (frozen_control_sequence+7) /* permanent `\.{\\relax}' */
+# define end_write (frozen_control_sequence+8) /* permanent `\.{\\endwrite}' */
+# define frozen_dont_expand (frozen_control_sequence+9 ) /* permanent `\.{\\notexpanded:}' */
+# define frozen_primitive (frozen_control_sequence+11 ) /* permanent `\.{\\primitive}' */
+# define frozen_special (frozen_control_sequence+12 ) /* permanent `\.{\\special}' */
+# define frozen_null_font (frozen_control_sequence+13 ) /* permanent `\.{\\nullfont}' */
+# define font_id_base (frozen_null_font-font_base ) /* begins table of |number_fonts| permanent font identifiers */
# define undefined_control_sequence (frozen_null_font+number_fonts)
-# define glue_base (undefined_control_sequence+1) /* beginning of region 3 */
-
-# define line_skip_code 0 /* interline glue if |baseline_skip| is infeasible */
-# define baseline_skip_code 1 /* desired glue between baselines */
-# define par_skip_code 2 /* extra glue just above a paragraph */
-# define above_display_skip_code 3 /* extra glue just above displayed math */
-# define below_display_skip_code 4 /* extra glue just below displayed math */
-# define above_display_short_skip_code 5
- /* glue above displayed math following short lines */
-# define below_display_short_skip_code 6
- /* glue below displayed math following short lines */
-# define left_skip_code 7 /* glue at left of justified lines */
-# define right_skip_code 8 /* glue at right of justified lines */
-# define top_skip_code 9 /* glue at top of main pages */
-# define split_top_skip_code 10 /* glue at top of split pages */
-# define tab_skip_code 11 /* glue between aligned entries */
-# define space_skip_code 12 /* glue between words (if not |zero_glue|) */
-# define xspace_skip_code 13 /* glue after sentences (if not |zero_glue|) */
-# define par_fill_skip_code 14 /* glue on last line of paragraph */
-# define thin_mu_skip_code 15 /* thin space in math formula */
-# define med_mu_skip_code 16 /* medium space in math formula */
-# define thick_mu_skip_code 17 /* thick space in math formula */
-# define glue_pars 18 /* total number of glue parameters */
-
-# define skip_base (glue_base+glue_pars)
- /* table of |number_regs| ``skip'' registers */
-# define mu_skip_base (skip_base+number_regs) /* table of |number_regs| ``muskip'' registers */
-# define local_base (mu_skip_base+number_regs) /* beginning of region 4 */
-
-# define par_shape_loc (local_base) /* specifies paragraph shape */
-# define output_routine_loc (local_base+1) /* points to token list for \.{\\output} */
-# define every_par_loc (local_base+2) /* points to token list for \.{\\everypar} */
-# define every_math_loc (local_base+3) /* points to token list for \.{\\everymath} */
-# define every_display_loc (local_base+4) /* points to token list for \.{\\everydisplay} */
-# define every_hbox_loc (local_base+5) /* points to token list for \.{\\everyhbox} */
-# define every_vbox_loc (local_base+6) /* points to token list for \.{\\everyvbox} */
-# define every_job_loc (local_base+7) /* points to token list for \.{\\everyjob} */
-# define every_cr_loc (local_base+8) /* points to token list for \.{\\everycr} */
-# define err_help_loc (local_base+9) /* points to token list for \.{\\errhelp} */
-# define every_eof_loc (local_base+10) /* points to token list for \.{\\everyeof} */
-# define tex_toks (local_base+11) /* end of (e-)\TeX's token list parameters */
-# define pdftex_first_loc (tex_toks) /* base for \pdfTeX's token list parameters */
-# define pdf_pages_attr_loc (pdftex_first_loc + 0) /* points to token list for \.{\\pdfpagesattr} */
-# define pdf_page_attr_loc (pdftex_first_loc + 1) /* points to token list for \.{\\pdfpageattr} */
-# define pdf_page_resources_loc (pdftex_first_loc + 2) /* points to token list for \.{\\pdfpageresources} */
-# define pdf_xform_attr_loc (pdftex_first_loc + 3) /* points to token list for \.{\\pdfxformattr} */
-# define pdf_xform_resources_loc (pdftex_first_loc + 4) /* points to token list for \.{\\pdfxformresources} */
-# define pdf_pk_mode_loc (pdftex_first_loc + 5) /* points to token list for \.{\\pdfpkmode} */
-# define pdf_toks (pdftex_first_loc+6) /* end of \pdfTeX's token list parameters */
-# define toks_base (pdf_toks) /* table of |number_regs| token list registers */
-# define etex_pen_base (toks_base+number_regs) /* start of table of \eTeX's penalties */
-# define inter_line_penalties_loc (etex_pen_base) /* additional penalties between lines */
-# define club_penalties_loc (etex_pen_base+1) /* penalties for creating club lines */
-# define widow_penalties_loc (etex_pen_base+2) /* penalties for creating widow lines */
-# define display_widow_penalties_loc (etex_pen_base+3) /* ditto, just before a display */
-# define etex_pens (etex_pen_base+4) /* end of table of \eTeX's penalties */
+# define glue_base (undefined_control_sequence+1) /* beginning of region 3 */
+
+# define line_skip_code 0 /* interline glue if |baseline_skip| is infeasible */
+# define baseline_skip_code 1 /* desired glue between baselines */
+# define par_skip_code 2 /* extra glue just above a paragraph */
+# define above_display_skip_code 3 /* extra glue just above displayed math */
+# define below_display_skip_code 4 /* extra glue just below displayed math */
+# define above_display_short_skip_code 5 /* glue above displayed math following short lines */
+# define below_display_short_skip_code 6 /* glue below displayed math following short lines */
+# define left_skip_code 7 /* glue at left of justified lines */
+# define right_skip_code 8 /* glue at right of justified lines */
+# define top_skip_code 9 /* glue at top of main pages */
+# define split_top_skip_code 10 /* glue at top of split pages */
+# define tab_skip_code 11 /* glue between aligned entries */
+# define space_skip_code 12 /* glue between words (if not |zero_glue|) */
+# define xspace_skip_code 13 /* glue after sentences (if not |zero_glue|) */
+# define par_fill_skip_code 14 /* glue on last line of paragraph */
+# define thin_mu_skip_code 15 /* thin space in math formula */
+# define med_mu_skip_code 16 /* medium space in math formula */
+# define thick_mu_skip_code 17 /* thick space in math formula */
+# define math_skip_code 18
+# define glue_pars 19 /* total number of glue parameters */
+
+# define skip_base (glue_base+glue_pars) /* table of |number_regs| ``skip'' registers */
+# define mu_skip_base (skip_base+number_regs) /* table of |number_regs| ``muskip'' registers */
+# define local_base (mu_skip_base+number_regs) /* beginning of region 4 */
+
+# define par_shape_loc (local_base) /* specifies paragraph shape */
+# define output_routine_loc (local_base+1) /* points to token list for \.{\\output} */
+# define every_par_loc (local_base+2) /* points to token list for \.{\\everypar} */
+# define every_math_loc (local_base+3) /* points to token list for \.{\\everymath} */
+# define every_display_loc (local_base+4) /* points to token list for \.{\\everydisplay} */
+# define every_hbox_loc (local_base+5) /* points to token list for \.{\\everyhbox} */
+# define every_vbox_loc (local_base+6) /* points to token list for \.{\\everyvbox} */
+# define every_job_loc (local_base+7) /* points to token list for \.{\\everyjob} */
+# define every_cr_loc (local_base+8) /* points to token list for \.{\\everycr} */
+# define err_help_loc (local_base+9) /* points to token list for \.{\\errhelp} */
+# define every_eof_loc (local_base+10) /* points to token list for \.{\\everyeof} */
+
+/* define toks_base (local_base+11) */ /* table of |number_regs| token list registers */
+
+# define backend_toks_base (local_base+11)
+# define backend_toks_last (backend_toks_base+10)
+
+# define toks_base (backend_toks_last+1) /* table of |number_regs| token list registers */
+
+# define etex_pen_base (toks_base+number_regs) /* start of table of \eTeX's penalties */
+# define inter_line_penalties_loc (etex_pen_base) /* additional penalties between lines */
+# define club_penalties_loc (etex_pen_base+1) /* penalties for creating club lines */
+# define widow_penalties_loc (etex_pen_base+2) /* penalties for creating widow lines */
+# define display_widow_penalties_loc (etex_pen_base+3) /* ditto, just before a display */
+# define etex_pens (etex_pen_base+4) /* end of table of \eTeX's penalties */
# define local_left_box_base (etex_pens)
# define local_right_box_base (local_left_box_base+1)
-# define box_base (local_right_box_base+1) /* table of |number_regs| box registers */
-# define cur_font_loc (box_base+number_regs) /* internal font number outside math mode */
-# define internal_math_param_base (cur_font_loc+1 ) /* current math parameter data index */
-# define cat_code_base (internal_math_param_base+1) /* current category code data index */
-# define lc_code_base (cat_code_base+1) /* table of |number_chars| lowercase mappings */
-# define uc_code_base (lc_code_base+1) /* table of |number_chars| uppercase mappings */
-# define sf_code_base (uc_code_base+1) /* table of |number_chars| spacefactor mappings */
-# define math_code_base (sf_code_base+1)
- /* table of |number_chars| math mode mappings */
-# define int_base (math_code_base+1) /* beginning of region 5 */
-
-# define pretolerance_code 0 /* badness tolerance before hyphenation */
-# define tolerance_code 1 /* badness tolerance after hyphenation */
-# define line_penalty_code 2 /* added to the badness of every line */
-# define hyphen_penalty_code 3 /* penalty for break after discretionary hyphen */
-# define ex_hyphen_penalty_code 4 /* penalty for break after explicit hyphen */
-# define club_penalty_code 5 /* penalty for creating a club line */
-# define widow_penalty_code 6 /* penalty for creating a widow line */
-# define display_widow_penalty_code 7 /* ditto, just before a display */
-# define broken_penalty_code 8 /* penalty for breaking a page at a broken line */
-# define bin_op_penalty_code 9 /* penalty for breaking after a binary operation */
-# define rel_penalty_code 10 /* penalty for breaking after a relation */
-# define pre_display_penalty_code 11 /* penalty for breaking just before a displayed formula */
-# define post_display_penalty_code 12 /* penalty for breaking just after a displayed formula */
-# define inter_line_penalty_code 13 /* additional penalty between lines */
-# define double_hyphen_demerits_code 14 /* demerits for double hyphen break */
-# define final_hyphen_demerits_code 15 /* demerits for final hyphen break */
-# define adj_demerits_code 16 /* demerits for adjacent incompatible lines */
-# define mag_code 17 /* magnification ratio */
-# define delimiter_factor_code 18 /* ratio for variable-size delimiters */
-# define looseness_code 19 /* change in number of lines for a paragraph */
-# define time_code 20 /* current time of day */
-# define day_code 21 /* current day of the month */
-# define month_code 22 /* current month of the year */
-# define year_code 23 /* current year of our Lord */
-# define show_box_breadth_code 24 /* nodes per level in |show_box| */
-# define show_box_depth_code 25 /* maximum level in |show_box| */
-# define hbadness_code 26 /* hboxes exceeding this badness will be shown by |hpack| */
-# define vbadness_code 27 /* vboxes exceeding this badness will be shown by |vpack| */
-# define pausing_code 28 /* pause after each line is read from a file */
-# define tracing_online_code 29 /* show diagnostic output on terminal */
-# define tracing_macros_code 30 /* show macros as they are being expanded */
-# define tracing_stats_code 31 /* show memory usage if \TeX\ knows it */
-# define tracing_paragraphs_code 32 /* show line-break calculations */
-# define tracing_pages_code 33 /* show page-break calculations */
-# define tracing_output_code 34 /* show boxes when they are shipped out */
-# define tracing_lost_chars_code 35 /* show characters that aren't in the font */
-# define tracing_commands_code 36 /* show command codes at |big_switch| */
-# define tracing_restores_code 37 /* show equivalents when they are restored */
-# define uc_hyph_code 38 /* hyphenate words beginning with a capital letter */
-# define output_penalty_code 39 /* penalty found at current page break */
-# define max_dead_cycles_code 40
- /* bound on consecutive dead cycles of output */
-# define hang_after_code 41 /* hanging indentation changes after this many lines */
-# define floating_penalty_code 42 /* penalty for insertions heldover after a split */
-# define global_defs_code 43 /* override \.{\\global} specifications */
-# define cur_fam_code 44 /* current family */
-# define escape_char_code 45 /* escape character for token output */
-# define default_hyphen_char_code 46 /* value of \.{\\hyphenchar} when a font is loaded */
-# define default_skew_char_code 47 /* value of \.{\\skewchar} when a font is loaded */
-# define end_line_char_code 48 /* character placed at the right end of the buffer */
-# define new_line_char_code 49 /* character that prints as |print_ln| */
-# define language_code 50 /* current hyphenation table */
-# define left_hyphen_min_code 51
- /* minimum left hyphenation fragment size */
-# define right_hyphen_min_code 52 /* minimum right hyphenation fragment size */
-# define holding_inserts_code 53
- /* do not remove insertion nodes from \.{\\box255} */
-# define error_context_lines_code 54 /* maximum intermediate line pairs shown */
-# define local_inter_line_penalty_code 55 /* local \.{\\interlinepenalty} */
-# define local_broken_penalty_code 56 /* local \.{\\brokenpenalty} */
-# define no_local_whatsits_code 57 /* counts local whatsits */
+# define box_base (local_right_box_base+1) /* table of |number_regs| box registers */
+# define cur_font_loc (box_base+number_regs) /* internal font number outside math mode */
+# define internal_math_param_base (cur_font_loc+1 ) /* current math parameter data index */
+# define cat_code_base (internal_math_param_base+1) /* current category code data index */
+# define lc_code_base (cat_code_base+1) /* table of |number_chars| lowercase mappings */
+# define uc_code_base (lc_code_base+1) /* table of |number_chars| uppercase mappings */
+# define sf_code_base (uc_code_base+1) /* table of |number_chars| spacefactor mappings */
+# define math_code_base (sf_code_base+1) /* table of |number_chars| math mode mappings */
+# define int_base (math_code_base+1) /* beginning of region 5 */
+
+# define pretolerance_code 0 /* badness tolerance before hyphenation */
+# define tolerance_code 1 /* badness tolerance after hyphenation */
+# define line_penalty_code 2 /* added to the badness of every line */
+# define hyphen_penalty_code 3 /* penalty for break after discretionary hyphen */
+# define ex_hyphen_penalty_code 4 /* penalty for break after explicit hyphen */
+# define club_penalty_code 5 /* penalty for creating a club line */
+# define widow_penalty_code 6 /* penalty for creating a widow line */
+# define display_widow_penalty_code 7 /* ditto, just before a display */
+# define broken_penalty_code 8 /* penalty for breaking a page at a broken line */
+# define bin_op_penalty_code 9 /* penalty for breaking after a binary operation */
+# define rel_penalty_code 10 /* penalty for breaking after a relation */
+# define pre_display_penalty_code 11 /* penalty for breaking just before a displayed formula */
+# define post_display_penalty_code 12 /* penalty for breaking just after a displayed formula */
+# define inter_line_penalty_code 13 /* additional penalty between lines */
+# define double_hyphen_demerits_code 14 /* demerits for double hyphen break */
+# define final_hyphen_demerits_code 15 /* demerits for final hyphen break */
+# define adj_demerits_code 16 /* demerits for adjacent incompatible lines */
+# define mag_code 17 /* magnification ratio */
+# define delimiter_factor_code 18 /* ratio for variable-size delimiters */
+# define looseness_code 19 /* change in number of lines for a paragraph */
+# define time_code 20 /* current time of day */
+# define day_code 21 /* current day of the month */
+# define month_code 22 /* current month of the year */
+# define year_code 23 /* current year of our Lord */
+# define show_box_breadth_code 24 /* nodes per level in |show_box| */
+# define show_box_depth_code 25 /* maximum level in |show_box| */
+# define hbadness_code 26 /* hboxes exceeding this badness will be shown by |hpack| */
+# define vbadness_code 27 /* vboxes exceeding this badness will be shown by |vpack| */
+# define pausing_code 28 /* pause after each line is read from a file */
+# define tracing_online_code 29 /* show diagnostic output on terminal */
+# define tracing_macros_code 30 /* show macros as they are being expanded */
+# define tracing_stats_code 31 /* show memory usage if \TeX\ knows it */
+# define tracing_paragraphs_code 32 /* show line-break calculations */
+# define tracing_pages_code 33 /* show page-break calculations */
+# define tracing_output_code 34 /* show boxes when they are shipped out */
+# define tracing_lost_chars_code 35 /* show characters that aren't in the font */
+# define tracing_commands_code 36 /* show command codes at |big_switch| */
+# define tracing_restores_code 37 /* show equivalents when they are restored */
+# define uc_hyph_code 38 /* hyphenate words beginning with a capital letter */
+# define output_penalty_code 39 /* penalty found at current page break */
+# define max_dead_cycles_code 40 /* bound on consecutive dead cycles of output */
+# define hang_after_code 41 /* hanging indentation changes after this many lines */
+# define floating_penalty_code 42 /* penalty for insertions heldover after a split */
+# define global_defs_code 43 /* override \.{\\global} specifications */
+# define cur_fam_code 44 /* current family */
+# define escape_char_code 45 /* escape character for token output */
+# define default_hyphen_char_code 46 /* value of \.{\\hyphenchar} when a font is loaded */
+# define default_skew_char_code 47 /* value of \.{\\skewchar} when a font is loaded */
+# define end_line_char_code 48 /* character placed at the right end of the buffer */
+# define new_line_char_code 49 /* character that prints as |print_ln| */
+# define language_code 50 /* current hyphenation table */
+# define left_hyphen_min_code 51 /* minimum left hyphenation fragment size */
+# define right_hyphen_min_code 52 /* minimum right hyphenation fragment size */
+# define holding_inserts_code 53 /* do not remove insertion nodes from \.{\\box255} */
+# define error_context_lines_code 54 /* maximum intermediate line pairs shown */
+# define local_inter_line_penalty_code 55 /* local \.{\\interlinepenalty} */
+# define local_broken_penalty_code 56 /* local \.{\\brokenpenalty} */
+# define no_local_whatsits_code 57 /* counts local whatsits */
# define no_local_dirs_code 58
# define luastartup_id_code 60
@@ -277,120 +262,101 @@ here, and the |number_regs| \.{\\dimen} registers.
# define disable_kern_code 62
# define cat_code_table_code 63
# define output_box_code 64
-# define cur_lang_code 65 /* current language id */
+# define cur_lang_code 65 /* current language id */
# define ex_hyphen_char_code 66
-# define hyphenation_min_code 67 /* minimum word length */
-# define adjust_spacing_code 68 /*level of spacing adjusting */
-# define protrude_chars_code 69 /*protrude chars at left/right edge of paragraphs */
-
-# define pdftex_first_integer_code 70 /*base for \pdfTeX's integer parameters */
-# define pdf_output_code (pdftex_first_integer_code + 0)
- /*switch on PDF output if positive */
-# define pdf_compress_level_code (pdftex_first_integer_code + 1)
- /*compress level of streams */
-# define pdf_decimal_digits_code (pdftex_first_integer_code + 2)
- /*digits after the decimal point of numbers */
-# define pdf_image_resolution_code (pdftex_first_integer_code + 3) /*default image resolution */
-# define pdf_pk_resolution_code (pdftex_first_integer_code + 4) /*default resolution of PK font */
-# define pdf_unique_resname_code (pdftex_first_integer_code + 5)
- /*generate unique names for resouces */
-# define pdf_minor_version_code (pdftex_first_integer_code + 6) /*fractional part of the PDF version produced */
-# define pdf_pagebox_code (pdftex_first_integer_code + 7) /*default pagebox to use for PDF inclusion */
-# define pdf_inclusion_errorlevel_code (pdftex_first_integer_code + 8) /*if the PDF inclusion should treat pdfs
- newer than |pdf_minor_version| as an error */
-# define pdf_gamma_code (pdftex_first_integer_code + 9)
-# define pdf_image_gamma_code (pdftex_first_integer_code + 10)
-# define pdf_image_hicolor_code (pdftex_first_integer_code + 11)
-# define pdf_image_apply_gamma_code (pdftex_first_integer_code + 12)
-# define pdf_tracing_fonts_code (pdftex_first_integer_code + 13)
- /*level of font detail in log */
-# define pdf_objcompresslevel_code (pdftex_first_integer_code + 14) /*activate object streams */
-# define pdf_gen_tounicode_code (pdftex_first_integer_code + 15)
- /*generate ToUnicode for fonts? */
-# define pdf_draftmode_code (pdftex_first_integer_code + 16) /*switch on draftmode if positive */
-# define pdf_replace_font_code (pdftex_first_integer_code + 17) /*generate ToUnicode for fonts? */
-# define pdf_inclusion_copy_font_code (pdftex_first_integer_code + 18) /*generate ToUnicode for fonts? */
-# define pdf_int_pars (pdftex_first_integer_code + 19) /*total number of \pdfTeX's integer parameters */
-# define etex_first_integer_code (pdf_int_pars) /*base for \eTeX's integer parameters */
-# define tracing_assigns_code (etex_first_integer_code) /*show assignments */
-# define tracing_groups_code (etex_first_integer_code+1) /*show save/restore groups */
-# define tracing_ifs_code (etex_first_integer_code+2) /*show conditionals */
-# define tracing_scan_tokens_code (etex_first_integer_code+3) /*show pseudo file open and close */
-# define tracing_nesting_code (etex_first_integer_code+4) /*show incomplete groups and ifs within files */
-# define pre_display_direction_code (etex_first_integer_code+5) /*text direction preceding a display */
-# define last_line_fit_code (etex_first_integer_code+6) /*adjustment for last line of paragraph */
-# define saving_vdiscards_code (etex_first_integer_code+7)
- /*save items discarded from vlists */
-# define saving_hyph_codes_code (etex_first_integer_code+8) /*save hyphenation codes for languages */
-# define suppress_fontnotfound_error_code (etex_first_integer_code+9) /*suppress errors for missing fonts */
-# define suppress_long_error_code (etex_first_integer_code+10) /*suppress errors for missing fonts */
-# define suppress_ifcsname_error_code (etex_first_integer_code+11)
- /*suppress errors for failed \.{\\ifcsname} */
-# define suppress_outer_error_code (etex_first_integer_code+12) /*suppress errors for \.{\\outer} */
-# define suppress_mathpar_error_code (etex_first_integer_code+13) /*suppress errors for \.{\\par}} in math */
-# define math_eqno_gap_step_code (etex_first_integer_code+14) /* factor/1000 used for distance between eq and eqno */
-# define synctex_code (etex_first_integer_code+15) /* is synctex file generation enabled ? */
-
-# define tex_int_pars (synctex_code+1) /* total number of integer parameters */
+# define hyphenation_min_code 67 /* minimum word length */
+# define adjust_spacing_code 68 /* level of spacing adjusting */
+# define protrude_chars_code 69 /* protrude chars at left/right edge of paragraphs */
+# define output_mode_code 70 /* switch on PDF output if positive */
+# define draft_mode_code 71
+# define tracing_fonts_code 72
+# define tracing_assigns_code 73 /* show assignments */
+# define tracing_groups_code 74 /* show save/restore groups */
+# define tracing_ifs_code 75 /* show conditionals */
+# define tracing_scan_tokens_code 76 /* show pseudo file open and close */
+# define tracing_nesting_code 77 /* show incomplete groups and ifs within files */
+# define pre_display_direction_code 78 /* text direction preceding a display */
+# define last_line_fit_code 79 /* adjustment for last line of paragraph */
+# define saving_vdiscards_code 80 /* save items discarded from vlists */
+# define saving_hyph_codes_code 81 /* save hyphenation codes for languages */
+# define suppress_fontnotfound_error_code 82 /* suppress errors for missing fonts */
+# define suppress_long_error_code 83 /* suppress errors for missing fonts */
+# define suppress_ifcsname_error_code 84 /* suppress errors for failed \.{\\ifcsname} */
+# define suppress_outer_error_code 85 /* suppress errors for \.{\\outer} */
+# define suppress_mathpar_error_code 86 /* suppress errors for \.{\\par}} in math */
+# define math_eqno_gap_step_code 87 /* factor/1000 used for distance between eq and eqno */
+# define math_display_skip_mode_code 88
+# define math_scripts_mode_code 89
+# define synctex_code 90 /* is synctex file generation enabled ? */
+
+# define math_no_italic_compensation_code 91 /* just for tracing, can change */
+# define math_no_char_italic_code 92 /* just for tracing, can change */
+# define math_use_old_fraction_scaling_code 93 /* just for tracing, can change */
+# define math_old_code 94 /* this one is stable */
+
+# define math_option_code 95
+
+# define backend_int_base (math_option_code+1)
+# define backend_int_last (backend_int_base+20)
+
+# define tex_int_pars (backend_int_last+1) /* 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 int_pars (tex_int_pars+5) /*total number of integer parameters */
+
+# define int_pars (tex_int_pars+5) /* total number of integer parameters */
# define dir_base (int_base+tex_int_pars)
-# define count_base (int_base+int_pars) /*|number_regs| user \.{\\count} registers */
-# define attribute_base (count_base+number_regs)
- /*|number_attrs| user \.{\\attribute} registers */
-# define del_code_base (attribute_base+number_attrs) /*|number_chars| delimiter code mappings */
-# define dimen_base (del_code_base+1) /*beginning of region 6 */
-
-# define par_indent_code 0 /* indentation of paragraphs */
-# define math_surround_code 1 /* space around math in text */
-# define line_skip_limit_code 2 /* threshold for |line_skip| instead of |baseline_skip| */
-# define hsize_code 3 /* line width in horizontal mode */
-# define vsize_code 4 /* page height in vertical mode */
-# define max_depth_code 5 /* maximum depth of boxes on main pages */
-# define split_max_depth_code 6 /* maximum depth of boxes on split pages */
-# define box_max_depth_code 7 /* maximum depth of explicit vboxes */
-# define hfuzz_code 8 /* tolerance for overfull hbox messages */
-# define vfuzz_code 9 /* tolerance for overfull vbox messages */
-# define delimiter_shortfall_code 10 /* maximum amount uncovered by variable delimiters */
-# define null_delimiter_space_code 11 /* blank space in null delimiters */
-# define script_space_code 12 /* extra space after subscript or superscript */
-# define pre_display_size_code 13 /* length of text preceding a display */
-# define display_width_code 14 /* length of line for displayed equation */
-# define display_indent_code 15 /* indentation of line for displayed equation */
-# define overfull_rule_code 16 /* width of rule that identifies overfull hboxes */
-# define hang_indent_code 17 /* amount of hanging indentation */
-# define h_offset_code 18 /* amount of horizontal offset when shipping pages out */
-# define v_offset_code 19 /* amount of vertical offset when shipping pages out */
-# define emergency_stretch_code 20 /* reduces badnesses on final pass of line-breaking */
+# define count_base (int_base+int_pars) /* |number_regs| user \.{\\count} registers */
+# define attribute_base (count_base+number_regs) /* |number_attrs| user \.{\\attribute} registers */
+# define del_code_base (attribute_base+number_attrs) /* |number_chars| delimiter code mappings */
+# define dimen_base (del_code_base+1) /* beginning of region 6 */
+
+# define par_indent_code 0 /* indentation of paragraphs */
+# define math_surround_code 1 /* space around math in text */
+# define line_skip_limit_code 2 /* threshold for |line_skip| instead of |baseline_skip| */
+# define hsize_code 3 /* line width in horizontal mode */
+# define vsize_code 4 /* page height in vertical mode */
+# define max_depth_code 5 /* maximum depth of boxes on main pages */
+# define split_max_depth_code 6 /* maximum depth of boxes on split pages */
+# define box_max_depth_code 7 /* maximum depth of explicit vboxes */
+# define hfuzz_code 8 /* tolerance for overfull hbox messages */
+# define vfuzz_code 9 /* tolerance for overfull vbox messages */
+# define delimiter_shortfall_code 10 /* maximum amount uncovered by variable delimiters */
+# define null_delimiter_space_code 11 /* blank space in null delimiters */
+# define script_space_code 12 /* extra space after subscript or superscript */
+# define pre_display_size_code 13 /* length of text preceding a display */
+# define display_width_code 14 /* length of line for displayed equation */
+# define display_indent_code 15 /* indentation of line for displayed equation */
+# define overfull_rule_code 16 /* width of rule that identifies overfull hboxes */
+# define hang_indent_code 17 /* amount of hanging indentation */
+# define h_offset_code 18 /* amount of horizontal offset when shipping pages out */
+# define v_offset_code 19 /* amount of vertical offset when shipping pages out */
+# define emergency_stretch_code 20 /* reduces badnesses on final pass of line-breaking */
# define page_left_offset_code 21
# define page_top_offset_code 22
# define page_right_offset_code 23
# define page_bottom_offset_code 24
-# define pdftex_first_dimen_code 25 /* first number defined in this section */
-# define pdf_h_origin_code (pdftex_first_dimen_code + 0) /* horigin of the PDF output */
-# define pdf_v_origin_code (pdftex_first_dimen_code + 1) /* vorigin of the PDF output */
-# define page_width_code (pdftex_first_dimen_code + 2) /* page width of the PDF output */
-# define page_height_code (pdftex_first_dimen_code + 3) /* page height of the PDF output */
-# define pdf_link_margin_code (pdftex_first_dimen_code + 4) /* link margin in the PDF output */
-# define pdf_dest_margin_code (pdftex_first_dimen_code + 5) /* dest margin in the PDF output */
-# define pdf_thread_margin_code (pdftex_first_dimen_code + 6) /* thread margin in the PDF output */
-# define pdf_px_dimen_code (pdftex_first_dimen_code + 7)
-# define pdftex_last_dimen_code (pdftex_first_dimen_code + 7) /* last number defined in this section */
-# define dimen_pars (pdftex_last_dimen_code + 1)
- /* total number of dimension parameters */
-
-# define scaled_base (dimen_base+dimen_pars) /* table of |number_regs| user-defined \.{\\dimen} registers */
-# define eqtb_size (scaled_base+biggest_reg) /* largest subscript of |eqtb| */
+# define px_dimen_code 25
+# define page_width_code 26 /* page width of the output */
+# define page_height_code 27 /* page height of the output */
+
+/* define dimen_pars (page_height_code + 1) */ /* total number of dimension parameters */
+
+# define backend_dimen_base (page_height_code+1)
+# define backend_dimen_last (backend_dimen_base+10)
+
+# define dimen_pars (backend_dimen_last + 1) /* total number of dimension parameters */
+
+# define scaled_base (dimen_base+dimen_pars) /* table of |number_regs| user-defined \.{\\dimen} registers */
+# define eqtb_size (scaled_base+biggest_reg) /* largest subscript of |eqtb| */
extern memory_word *eqtb;
-extern halfword eqtb_top; /* maximum of the |eqtb| */
+extern halfword eqtb_top; /* maximum of the |eqtb| */
extern quarterword xeq_level[(eqtb_size + 1)];
extern void initialize_equivalents(void);
@@ -399,10 +365,9 @@ extern void initialize_equivalents(void);
# define eq_type_field(A) (A).hh.b0
# define equiv_field(A) (A).hh.rh
-# define eq_level(A) eq_level_field(eqtb[(A)]) /* level of definition */
-# define eq_type(A) eq_type_field(eqtb[(A)]) /* command code for equivalent */
-# define equiv(A) equiv_field(eqtb[(A)])
- /* equivalent value */
+# define eq_level(A) eq_level_field(eqtb[(A)]) /* level of definition */
+# define eq_type(A) eq_type_field(eqtb[(A)]) /* command code for equivalent */
+# define equiv(A) equiv_field(eqtb[(A)]) /* equivalent value */
# define set_eq_level(A,B) eq_level((A)) = (B)
# define set_eq_type(A,B) eq_type((A)) = (B)
@@ -414,19 +379,17 @@ typedef struct save_record_ {
memory_word word_;
} save_record;
-
extern save_record *save_stack;
-extern int save_ptr; /* first unused entry on |save_stack| */
-extern int max_save_stack; /* maximum usage of save stack */
-extern quarterword cur_level; /* current nesting level for groups */
-extern group_code cur_group; /* current group type */
-extern int cur_boundary; /* where the current level begins */
-
+extern int save_ptr; /* first unused entry on |save_stack| */
+extern int max_save_stack; /* maximum usage of save stack */
+extern quarterword cur_level; /* current nesting level for groups */
+extern group_code cur_group; /* current group type */
+extern int cur_boundary; /* where the current level begins */
-# define save_type(A) save_stack[(A)].type_ /* classifies a |save_stack| entry */
-# define save_level(A) save_stack[(A)].level_ /* saved level for regions 5 and 6, or group code */
-# define save_value(A) save_stack[(A)].word_.cint /* |eqtb| location or token or |save_stack| location */
-# define save_word(A) save_stack[(A)].word_ /* |eqtb| entry */
+# define save_type(A) save_stack[(A)].type_ /* classifies a |save_stack| entry */
+# define save_level(A) save_stack[(A)].level_ /* saved level for regions 5 and 6, or group code */
+# define save_value(A) save_stack[(A)].word_.cint /* |eqtb| location or token or |save_stack| location */
+# define save_word(A) save_stack[(A)].word_ /* |eqtb| entry */
/*
We use the notation |saved(k)| to stand for an item that
@@ -443,10 +406,10 @@ appears in location |save_ptr+k| of the save stack.
saved_value(A) = (D); \
} while (0)
-# define restore_old_value 0 /* |save_type| when a value should be restored later */
-# define restore_zero 1 /* |save_type| when an undefined entry should be restored */
-# define insert_token 2 /* |save_type| when a token is being saved for later use */
-# define level_boundary 3 /* |save_type| corresponding to beginning of group */
+# define restore_old_value 0 /* |save_type| when a value should be restored later */
+# define restore_zero 1 /* |save_type| when an undefined entry should be restored */
+# define insert_token 2 /* |save_type| when a token is being saved for later use */
+# define level_boundary 3 /* |save_type| corresponding to beginning of group */
# define saved_line 4
# define saved_adjust 5
# define saved_insert 6
@@ -488,7 +451,6 @@ one that starts with \.{\\begingroup} should end with \.{\\endgroup}.
*/
-
typedef enum {
bottom_level = 0, /* group code for the outside world */
simple_group, /* group code for local structure only */
@@ -515,30 +477,36 @@ typedef enum {
fin_row_group /* box code for a provisory line in an alignment */
} tex_group_codes;
-# define max_group_code local_box_group /* which is wrong, but is what the web says */
+# define max_group_code local_box_group /* which is wrong, but is what the web says */
-extern int cur_cmd; /* current command set by |get_next| */
-extern halfword cur_chr; /* operand of current command */
-extern halfword cur_cs; /* control sequence found here, zero if none found */
-extern halfword cur_tok; /* packed representative of |cur_cmd| and |cur_chr| */
+extern int cur_cmd; /* current command set by |get_next| */
+extern halfword cur_chr; /* operand of current command */
+extern halfword cur_cs; /* control sequence found here, zero if none found */
+extern halfword cur_tok; /* packed representative of |cur_cmd| and |cur_chr| */
extern void show_cur_cmd_chr(void);
-extern void new_save_level(group_code c); /* begin a new level of grouping */
-extern void eq_destroy(memory_word w); /* gets ready to forget |w| */
-extern void eq_save(halfword p, quarterword l); /* saves |eqtb[p]| */
+extern void new_save_level(group_code c); /* begin a new level of grouping */
+extern void eq_destroy(memory_word w); /* gets ready to forget |w| */
+extern void eq_save(halfword p, quarterword l); /* saves |eqtb[p]| */
extern void eq_define(halfword p, quarterword t, halfword e); /* new data for |eqtb| */
extern void eq_word_define(halfword p, int w);
extern void geq_define(halfword p, quarterword t, halfword e); /* global |eq_define| */
-extern void geq_word_define(halfword p, int w); /* global |eq_word_define| */
+extern void geq_word_define(halfword p, int w); /* global |eq_word_define| */
extern void save_for_after(halfword t);
-extern void unsave(void); /* pops the top level off the save stack */
-extern void restore_trace(halfword p, const char *s); /* |eqtb[p]| has just been restored or retained */
+extern void unsave(void); /* pops the top level off the save stack */
+extern void restore_trace(halfword p, const char *s); /* |eqtb[p]| has just been restored or retained */
extern void show_save_groups(void);
-# define level_zero 0 /* level for undefined quantities */
-# define level_one 1 /* outermost level for defined quantities */
+# define level_zero 0 /* level for undefined quantities */
+# define level_one 1 /* outermost level for defined quantities */
extern void show_eqtb(halfword n);
+/* more will move 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)
+
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.h b/Build/source/texk/web2c/luatexdir/tex/errors.h
index b7f46431e5d..101e78adb71 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.h
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.h
@@ -40,6 +40,13 @@ extern int interactionoption; /* set from command line */
extern void initialize_errors(void);
extern char *last_error;
+extern char *last_lua_error;
+extern char *last_warning_tag;
+extern char *last_warning_str;
+extern char *last_error_context;
+
+extern void set_last_error_context(void);
+
extern void print_err(const char *s);
extern void fixup_selector(boolean log_opened);
@@ -85,14 +92,14 @@ extern void int_error(int n);
extern void normalize_selector(void);
extern void succumb(void);
extern void fatal_error(const char *s);
-extern void lua_norm_error(const char *s);
-extern void lua_fatal_error(const char *s);
extern void overflow(const char *s, unsigned int n);
extern void confusion(const char *s);
extern void check_interrupt(void);
extern void pause_for_instructions(void);
extern void tex_error(const char *msg, const char **hlp);
+extern void normal_error(const char *t, const char *p);
+extern void normal_warning(const char *t, const char *p, boolean pr, boolean ap);
extern void back_error(void);
extern void ins_error(void);
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w
index dd32f5b7a28..e11fcd908fe 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.w
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.w
@@ -17,15 +17,17 @@
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
-@ @c
+@ TODO: we need to use a formatted normal_error in:
+hyphen.w
+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
@@ -55,9 +57,36 @@ int interactionoption; /* set from command line */
/* ls-hh: so, new code only kicks in when we have a callback defined */
char *last_error = NULL;
+char *last_lua_error = NULL;
+char *last_warning_tag = NULL;
+char *last_warning_str = NULL;
+char *last_error_context = NULL;
+
int err_old_setting = 0 ;
int in_error = 0 ;
+void set_last_error_context(void)
+{
+ str_number str;
+ int sel = selector;
+ int saved_new_line_char;
+ int saved_new_string_line;
+ selector = new_string;
+ saved_new_line_char = new_line_char;
+ saved_new_string_line = new_string_line;
+ new_line_char = 10;
+ new_string_line = 10;
+ show_context();
+ xfree(last_error_context);
+ str = make_string();
+ last_error_context = makecstring(str);
+ flush_str(str);
+ selector = sel;
+ new_line_char = saved_new_line_char;
+ new_string_line = saved_new_string_line;
+ return;
+}
+
void flush_err(void)
{
str_number s_error;
@@ -113,8 +142,8 @@ void print_err(const char *s)
might be unusual. The only possible values of |selector| at the time of
error messages are
-\yskip\hang|no_print| (when |interaction=batch_mode|
- and |log_file| not yet open);
+\yskip
+\hang|no_print| (when |interaction=batch_mode| and |log_file| not yet open);
\hang|term_only| (when |interaction>batch_mode| and |log_file| not yet open);
@@ -133,7 +162,6 @@ void fixup_selector(boolean logopened)
selector = selector + 2;
}
-
@ A global variable |deletions_allowed| is set |false| if the |get_next|
routine is active when |error| is called; this ensures that |get_next|
and related routines like |get_token| will never be called recursively.
@@ -157,8 +185,6 @@ int error_count; /* the number of scrolled errors since the last
int interrupt; /* should \TeX\ pause for instructions? */
boolean OK_to_interrupt; /* should interrupts be observed? */
-
-
@ The value of |history| is initially |fatal_error_stop|, but it will
be changed to |spotless| if \TeX\ survives the initialization process.
@@ -175,7 +201,6 @@ void initialize_errors(void)
/* |history| is initialized elsewhere */
}
-
@ It is possible for |error| to be called recursively if some error arises
when |get_token| is being used to delete a token, and/or if some fatal error
occurs while \TeX\ is trying to fix a non-fatal one. But such recursion
@@ -188,7 +213,6 @@ is never more than two levels deep.
const char *help_line[7]; /* helps for the next |error| */
boolean use_err_help; /* should the |err_help| list be shown? */
-
@ The |jump_out| procedure just cuts across all active procedure levels and
exits the program. It is used when there is no recovery from a particular error.
@@ -223,6 +247,7 @@ void error(void)
history = error_message_issued;
callback_id = callback_defined(show_error_hook_callback);
if (callback_id > 0) {
+ set_last_error_context();
run_callback(callback_id, "->");
} else {
print_char('.');
@@ -314,7 +339,6 @@ void error(void)
/* Print the help information and |goto continue| */
if (use_err_help) {
give_err_help();
- use_err_help = false;
} else {
if (help_line[0] == NULL) {
help2
@@ -385,17 +409,18 @@ void error(void)
default:
break;
}
- /* Print the menu of available options */
- tprint
- ("Type <return> to proceed, S to scroll future error messages,");
- tprint_nl("R to run without stopping, Q to run quietly,");
- tprint_nl("I to insert something, ");
- if (base_ptr > 0)
- tprint("E to edit your file,");
- if (deletions_allowed)
- tprint_nl
- ("1 or ... or 9 to ignore the next 1 to 9 tokens of input,");
- tprint_nl("H for help, X to quit.");
+ if (!use_err_help) {
+ /* Print the menu of available options */
+ tprint("Type <return> to proceed, S to scroll future error messages,");
+ tprint_nl("R to run without stopping, Q to run quietly,");
+ tprint_nl("I to insert something, ");
+ if (base_ptr > 0)
+ tprint("E to edit your file,");
+ if (deletions_allowed)
+ tprint_nl("1 or ... or 9 to ignore the next 1 to 9 tokens of input,");
+ tprint_nl("H for help, X to quit.");
+ }
+ use_err_help = false;
}
}
@@ -422,8 +447,6 @@ void error(void)
print_ln();
}
-
-
@ A dozen or so error messages end with a parenthesized integer, so we
save a teeny bit of program space by declaring the following procedure:
@@ -436,7 +459,6 @@ void int_error(int n)
error();
}
-
@ In anomalous cases, the print selector might be in an unknown state;
the following subroutine is called to fix things just enough to keep
running a bit longer.
@@ -479,36 +501,6 @@ void fatal_error(const char *s)
succumb();
}
-@ @c
-void lua_norm_error(const char *s)
-{ /* lua found a problem */
- int saved_new_line_char;
- int report_id ;
- saved_new_line_char = new_line_char;
- new_line_char = 10;
- report_id = callback_defined(show_lua_error_hook_callback);
- if (report_id == 0) {
- print_err("LuaTeX error ");
- tprint(s);
- } else {
- (void) run_callback(report_id, "->");
- }
- help2("The lua interpreter ran into a problem, so the",
- "remainder of this lua chunk will be ignored.");
- error();
- new_line_char = saved_new_line_char;
-}
-
-@ @c
-void lua_fatal_error(const char *s)
-{ /* lua found a problem */
- new_line_char = 10;
- normalize_selector();
- print_err("LuaTeX fatal error ");
- tprint(s);
- succumb();
-}
-
@ Here is the most dreaded error message
@c
void overflow(const char *s, unsigned int n)
@@ -524,7 +516,6 @@ void overflow(const char *s, unsigned int n)
succumb();
}
-
@ The program might sometime run completely amok, at which point there is
no choice but to stop. If no previous error has been detected, that's bad
news; a message is printed that is really intended for the \TeX\
@@ -550,7 +541,6 @@ void confusion(const char *s)
succumb();
}
-
@ Users occasionally want to interrupt \TeX\ while it's running.
If the runtime system allows this, one can implement
a routine that sets the global variable |interrupt| to some nonzero value
@@ -566,8 +556,6 @@ void check_interrupt(void)
pause_for_instructions();
}
-
-
@ When an interrupt has been detected, the program goes into its
highest interaction level and lets the user have nearly the full flexibility of
the |error| routine. \TeX\ checks for interrupts only at times when it is
@@ -631,8 +619,6 @@ void ins_error(void)
error();
}
-
-
@ When \TeX\ wants to typeset a character that doesn't exist, the
character node is not created; thus the output routine can assume
that characters exist when it sees them. The following procedure
@@ -671,3 +657,68 @@ void char_warning(internal_font_number f, int c)
int_par(tracing_online_code) = old_setting;
}
}
+
+@ @c
+void normal_error(const char *t, const char *p)
+{
+ normalize_selector();
+ print_err("error ");
+ if (t != NULL) {
+ tprint(" (");
+ tprint(t);
+ tprint(")");
+ }
+ tprint(": ");
+ if (p != NULL)
+ tprint(p);
+ succumb();
+}
+
+@ @c
+void normal_warning(const char *t, const char *p, boolean prepend_nl, boolean append_nl)
+{
+ int report_id ;
+ if (strcmp(t,"lua") == 0) {
+ int saved_new_line_char;
+ saved_new_line_char = new_line_char;
+ new_line_char = 10;
+ report_id = callback_defined(show_lua_error_hook_callback);
+ if (report_id == 0) {
+ tprint(p);
+ help2("The lua interpreter ran into a problem, so the",
+ "remainder of this lua chunk will be ignored.");
+ } else {
+ (void) run_callback(report_id, "->");
+ }
+ error();
+ new_line_char = saved_new_line_char;
+ } else {
+ report_id = callback_defined(show_warning_message_callback);
+ if (report_id > 0) {
+ /* free last ones */
+ xfree(last_warning_str);
+ xfree(last_warning_tag);
+ last_warning_str = (string) xmalloc(strlen(p) + 1);
+ last_warning_tag = (string) xmalloc(strlen(t) + 1);
+ strcpy(last_warning_str,p);
+ strcpy(last_warning_tag,t);
+ run_callback(report_id, "->");
+ } else {
+ if (prepend_nl)
+ print_ln();
+ tprint("warning ");
+ if (t != NULL) {
+ tprint(" (");
+ tprint(t);
+ tprint(")");
+ }
+ tprint(": ");
+ if (p != NULL)
+ tprint(p);
+ if (append_nl)
+ print_ln();
+ }
+ if (history == spotless)
+ history = warning_issued;
+ }
+}
diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.w b/Build/source/texk/web2c/luatexdir/tex/expand.w
index aad2cb10042..5fa2cd7f08f 100644
--- a/Build/source/texk/web2c/luatexdir/tex/expand.w
+++ b/Build/source/texk/web2c/luatexdir/tex/expand.w
@@ -57,7 +57,7 @@ recursive calls don't invalidate them.
@^recursion@>
@c
-boolean is_in_csname = false;
+int is_in_csname = 0;
@ @c
void expand(void)
@@ -320,7 +320,7 @@ void manufacture_csname(void)
lstring *ss;
r = get_avail();
p = r; /* head of the list of characters */
- is_in_csname = true;
+ is_in_csname += 1;
do {
get_x_token();
if (cur_cs == 0)
@@ -330,10 +330,9 @@ void manufacture_csname(void)
/* Complain about missing \.{\\endcsname} */
complain_missing_csname();
}
- is_in_csname = false;
/* Look up the characters of list |r| in the hash table, and set |cur_cs| */
-
ss = tokenlist_to_lstring(r, true);
+ is_in_csname -= 1;
if (ss->l > 0) {
no_new_control_sequence = false;
cur_cs = string_lookup((char *) ss->s, ss->l);
@@ -373,7 +372,7 @@ common cases.
void get_x_token(void)
{ /* sets |cur_cmd|, |cur_chr|, |cur_tok|, and expands macros */
RESTART:
- get_token_lua();
+ get_next(); /* get_token_lua(); */
if (cur_cmd <= max_command_cmd)
goto DONE;
if (cur_cmd >= call_cmd) {
@@ -404,8 +403,8 @@ void x_token(void)
{ /* |get_x_token| without the initial |get_next| */
while (cur_cmd > max_command_cmd) {
expand();
- get_token_lua();
- }
+ get_next(); /* get_token_lua(); */
+ }
if (cur_cs == 0)
cur_tok = token_val(cur_cmd, cur_chr);
else
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.h b/Build/source/texk/web2c/luatexdir/tex/extensions.h
index ad6dd784861..589a714445d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.h
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.h
@@ -21,43 +21,62 @@
#ifndef EXTENSIONS_H
# define EXTENSIONS_H
-extern alpha_file write_file[16];
-extern halfword write_file_mode[16];
-extern halfword write_file_translation[16];
-extern boolean write_open[18];
+# define write_target_direct 16
+# define write_target_special 17
+# define write_target_system 18
+# define write_target_overflow last_file_selector+16 /* a signal that we write to console */
+# define last_write_open last_file_selector+2 /* keeps track of open state */
+
+extern alpha_file write_file[last_file_selector+1];
+extern halfword write_file_mode[last_file_selector+1];
+extern halfword write_file_translation[last_file_selector+1];
+extern boolean write_open[last_write_open+1];
+
+# define valid_write_file(n) (((n>=0) && (n<16)) || ((n>18) && (n<last_file_selector)))
+# define file_can_be_written(n) (valid_write_file(n) && write_open[n])
+
+extern void expand_macros_in_tokenlist(halfword p);
+extern void write_out(halfword p);
+extern void finalize_write_files(void);
+extern void initialize_write_files(void);
+extern void close_write_file(int id);
+extern boolean open_write_file(int id, char *fn);
+
extern scaled neg_wd;
extern scaled pos_wd;
extern scaled neg_ht;
extern halfword write_loc;
-extern void do_extension(PDF pdf);
+extern void do_extension(int immediate);
+
+extern void do_extension_dvi(int immediate);
+extern void do_extension_pdf(int immediate);
+
+extern void do_resource_dvi(int immediate, int code);
+extern void do_resource_pdf(int immediate, int code);
+
+extern void do_feedback_dvi();
+extern void do_feedback_pdf();
+
+extern int pdf_last_annot;
+extern int pdf_last_link;
+extern int pdf_last_obj;
+extern int pdf_retval;
/* Three extra node types carry information from |main_control|. */
/*
User defined whatsits can be inserted into node lists to pass data
-along from one lua call to anotherb without interference from the
+along from one lua call to another without interference from the
typesetting engine itself. Each has an id, a type, and a value. The
type of the value depends on the |user_node_type| field.
*/
extern void new_whatsit(int s);
-extern void new_write_whatsit(int w);
extern void scan_pdf_ext_toks(void);
-extern halfword prev_rightmost(halfword s, halfword e);
-extern int pdf_last_xform;
-extern int pdf_last_ximage;
-extern int pdf_last_ximage_pages;
-extern int pdf_last_ximage_colordepth;
-extern int pdf_last_annot;
-extern int pdf_last_link;
-extern scaledpos pdf_last_pos;
-extern halfword concat_tokens(halfword q, halfword r);
-extern int pdf_retval;
-
-extern halfword make_local_par_node(void);
+extern halfword concat_tokens(halfword q, halfword r);
/*
The \.{\\pagediscards} and \.{\\splitdiscards} commands share the
@@ -80,17 +99,26 @@ extern halfword last_line_fill; /* the |par_fill_skip| glue node of the new para
# 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)
# define get_tex_count_register(j) count(j)
# define get_tex_attribute_register(j) attribute(j)
# define get_tex_box_register(j) box(j)
+extern int get_tex_extension_count_register(const char *s, int d);
+extern void set_tex_extension_count_register(const char *s, int d);
+extern int get_tex_extension_dimen_register(const char *s, int d);
+extern void set_tex_extension_dimen_register(const char *s, int d);
+extern int get_tex_extension_toks_register (const char *s);
+
extern int set_tex_dimen_register(int j, scaled v);
extern int set_tex_skip_register(int j, halfword v);
+extern int set_tex_mu_skip_register(int j, halfword v);
extern int set_tex_count_register(int j, scaled v);
extern int set_tex_box_register(int j, scaled v);
extern int set_tex_attribute_register(int j, scaled v);
extern int get_tex_toks_register(int l);
extern int set_tex_toks_register(int j, lstring s);
+extern int scan_tex_toks_register(int j, int c, lstring s);
extern scaled get_tex_box_width(int j);
extern int set_tex_box_width(int j, scaled v);
extern scaled get_tex_box_height(int j);
@@ -114,4 +142,62 @@ extern int restrictedshell;
extern char *output_comment;
extern boolean debug_format_file;
+extern int last_saved_box_index ;
+extern int last_saved_image_index ;
+extern int last_saved_image_pages ;
+extern scaledpos last_position ;
+
+typedef enum {
+ /* traditional extensions */
+ open_code = 0,
+ write_code,
+ close_code,
+ reserved_extension_code, // 3: we moved special below immediate //
+ reserved_immediate_code, // 4: same number as main codes, expected value //
+ /* backend specific implementations */
+ special_code,
+ save_box_resource_code,
+ use_box_resource_code,
+ save_image_resource_code,
+ use_image_resource_code,
+ /* backend */
+ dvi_extension_code,
+ pdf_extension_code,
+} extension_codes ;
+
+/* for the moment there */
+
+typedef enum {
+ /* reserved, first needs to be larger than max extension_codes */
+ pdf_literal_code = 32,
+ pdf_dest_code,
+ pdf_annot_code,
+ pdf_save_code,
+ pdf_restore_code,
+ pdf_setmatrix_code,
+ pdf_obj_code,
+ pdf_refobj_code,
+ pdf_colorstack_code,
+ pdf_start_link_code,
+ pdf_end_link_code,
+ pdf_link_data_code,
+ pdf_start_thread_code,
+ pdf_end_thread_code,
+ pdf_thread_code,
+ pdf_outline_code,
+ pdf_glyph_to_unicode_code,
+ pdf_catalog_code,
+ pdf_font_attr_code,
+ pdf_map_file_code,
+ pdf_map_line_code,
+ pdf_include_chars_code,
+ pdf_info_code,
+ pdf_names_code,
+ pdf_trailer_code,
+} pdf_extension_codes;
+
+typedef enum {
+ dvi_literal_code = 32, /* alias for special */
+} dvi_extension_codes;
+
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w
index 30b7c05e02c..fee0d3d025e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w
@@ -21,8 +21,6 @@
\def\pdfTeX{pdf\TeX}
@ @c
-
-
#include "ptexlib.h"
@ @c
@@ -33,18 +31,12 @@
#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 par_direction int_par(par_direction_code)
#define toks(A) equiv(toks_base+(A))
-#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)
-
-
@ The program above includes a bunch of ``hooks'' that allow further
capabilities to be added without upsetting \TeX's basic structure.
Most of these hooks are concerned with ``whatsit'' nodes, which are
@@ -107,409 +99,415 @@ greater than 15, while |write_open[17]| represents a negative stream number,
and both of these variables are always |false|.
@c
-alpha_file write_file[16];
-halfword write_file_mode[16];
-halfword write_file_translation[16];
-boolean write_open[18];
+alpha_file write_file[last_file_selector+1];
+halfword write_file_mode[last_file_selector+1];
+halfword write_file_translation[last_file_selector+1];
+boolean write_open[last_write_open+1];
+
scaled neg_wd;
scaled pos_wd;
scaled neg_ht;
-
@ The variable |write_loc| just introduced is used to provide an
appropriate error message in case of ``runaway'' write texts.
@c
halfword write_loc; /* |eqtb| address of \.{\\write} */
+/*
+ hh: eventually i'll make \pdfextension a lua token parsed function;
+ a complication is that sometimes token lists are delayed
+*/
@ When an |extension| command occurs in |main_control|, in any mode,
the |do_extension| routine is called.
@c
-void do_extension(PDF pdf)
+int last_saved_image_index ;
+int last_saved_image_pages ;
+int last_saved_box_index ;
+scaledpos last_position = { 0, 0 };
+
+void do_extension_dvi(int immediate)
{
- int i, k; /* all-purpose integers */
- halfword p; /* all-purpose pointer */
- switch (cur_chr) {
- case open_node:
- /* Implement \.{\\openout} */
- new_write_whatsit(open_node_size);
- scan_optional_equals();
- scan_file_name();
- open_name(tail) = cur_name;
- open_area(tail) = cur_area;
- open_ext(tail) = cur_ext;
- break;
- case write_node:
- /* Implement \.{\\write} */
- /* When `\.{\\write 12\{...\}}' appears, we scan the token list `\.{\{...\}}'
- without expanding its macros; the macros will be expanded later when this
- token list is rescanned. */
- k = cur_cs;
- new_write_whatsit(write_node_size);
- cur_cs = k;
- p = scan_toks(false, false);
- write_tokens(tail) = def_ref;
- break;
- case close_node:
- /* Implement \.{\\closeout} */
- new_write_whatsit(write_node_size);
- write_tokens(tail) = null;
- break;
- case special_node:
- /* Implement \.{\\special} */
- /* When `\.{\\special\{...\}}' appears, we expand the macros in the token
- list as in \.{\\xdef} and \.{\\mark}. */
+ if (scan_keyword("literal")) {
new_whatsit(special_node);
write_stream(tail) = null;
- p = scan_toks(false, true);
+ scan_toks(false, true);
write_tokens(tail) = def_ref;
- break;
- case immediate_code:
- /* Implement \.{\\immediate} */
- /* To write a token list, we must run it through \TeX's scanner, expanding
- macros and \.{\\the} and \.{\\number}, etc. This might cause runaways,
- if a delimited macro parameter isn't matched, and runaways would be
- extremely confusing since we are calling on \TeX's scanner in the middle
- of a \.{\\shipout} command. Therefore we will put a dummy control sequence as
- a ``stopper,'' right after the token list. This control sequence is
- artificially defined to be \.{\\outer}.
-
- The presence of `\.{\\immediate}' causes the |do_extension| procedure
- to descend to one level of recursion. Nothing happens unless \.{\\immediate}
- is followed by `\.{\\openout}', `\.{\\write}', or `\.{\\closeout}'.
- */
- get_x_token();
- if (cur_cmd == extension_cmd) {
- if (cur_chr <= close_node) {
- p = tail;
- /* |do_extension()| and |out_what()| here can only be open, write, or close */
- do_extension(pdf); /* append a whatsit node */
- out_what(pdf, tail); /* do the action immediately */
+ } else {
+ normal_error("dvi backend", "unknown \\dviextension");
+ }
+}
+
+void do_extension_pdf(int immediate)
+{
+ int i, k;
+
+ i = 0 ;
+ if (scan_keyword("literal")) i = pdf_literal_code ;
+ else if (scan_keyword("dest")) i = pdf_dest_code ;
+ else if (scan_keyword("annot")) i = pdf_annot_code ;
+ else if (scan_keyword("save")) i = pdf_save_code ;
+ else if (scan_keyword("restore")) i = pdf_restore_code ;
+ else if (scan_keyword("setmatrix")) i = pdf_setmatrix_code ;
+ else if (scan_keyword("obj")) i = pdf_obj_code ;
+ else if (scan_keyword("refobj")) i = pdf_refobj_code ;
+ else if (scan_keyword("colorstack")) i = pdf_colorstack_code ;
+ else if (scan_keyword("startlink")) i = pdf_start_link_code ;
+ else if (scan_keyword("endlink")) i = pdf_end_link_code ;
+ else if (scan_keyword("startthread")) i = pdf_start_thread_code ;
+ else if (scan_keyword("endthread")) i = pdf_end_thread_code ;
+ else if (scan_keyword("thread")) i = pdf_thread_code ;
+ else if (scan_keyword("outline")) i = pdf_outline_code ;
+ else if (scan_keyword("glyphtounicode")) i = pdf_glyph_to_unicode_code ;
+ else if (scan_keyword("catalog")) i = pdf_catalog_code ;
+ else if (scan_keyword("fontattr")) i = pdf_font_attr_code ;
+ else if (scan_keyword("mapfile")) i = pdf_map_file_code ;
+ else if (scan_keyword("mapline")) i = pdf_map_line_code ;
+ else if (scan_keyword("includechars")) i = pdf_include_chars_code ;
+ else if (scan_keyword("info")) i = pdf_info_code ;
+ else if (scan_keyword("names")) i = pdf_names_code ;
+ else if (scan_keyword("trailer")) i = pdf_trailer_code ;
+
+ switch (i) {
+ case pdf_literal_code:
+ new_whatsit(pdf_literal_node);
+ if (scan_keyword("direct"))
+ set_pdf_literal_mode(tail, direct_always);
+ else if (scan_keyword("page"))
+ set_pdf_literal_mode(tail, direct_page);
+ else
+ set_pdf_literal_mode(tail, set_origin);
+ scan_pdf_ext_toks();
+ set_pdf_literal_type(tail, normal);
+ set_pdf_literal_data(tail, def_ref);
+ break;
+ case pdf_dest_code:
+ scan_pdfdest(static_pdf);
+ break;
+ case pdf_annot_code:
+ scan_annot(static_pdf);
+ break;
+ case pdf_setmatrix_code:
+ new_whatsit(pdf_setmatrix_node);
+ scan_pdf_ext_toks();
+ set_pdf_setmatrix_data(tail, def_ref);
+ break;
+ case pdf_save_code:
+ new_whatsit(pdf_save_node);
+ break;
+ case pdf_restore_code:
+ new_whatsit(pdf_restore_node);
+ break;
+ case pdf_obj_code:
+ scan_obj(static_pdf);
+ if (immediate) {
+ if (obj_data_ptr(static_pdf, pdf_last_obj) == 0) /* this object has not been initialized yet */
+ normal_error("pdf backend","\\pdfextension obj 'reserveobjnum' cannot be used with \\immediate");
+ pdf_write_obj(static_pdf, pdf_last_obj);
+ }
+ break;
+ case pdf_refobj_code:
+ scan_refobj(static_pdf);
+ break;
+ case pdf_colorstack_code:
+ scan_int();
+ if (cur_val >= colorstackused()) {
+ print_err("Unknown color stack number ");
+ print_int(cur_val);
+ help3
+ ("Allocate and initialize a color stack with \\pdfextension colorstackinit.",
+ "I'll use default color stack 0 here.",
+ "Proceed, with fingers crossed.");
+ error();
+ cur_val = 0;
+ }
+ if (cur_val < 0) {
+ print_err("Invalid negative color stack number");
+ help2("I'll use default color stack 0 here.",
+ "Proceed, with fingers crossed.");
+ error();
+ cur_val = 0;
+ }
+ if (scan_keyword("set"))
+ i = colorstack_set;
+ else if (scan_keyword("push"))
+ i = colorstack_push;
+ else if (scan_keyword("pop"))
+ i = colorstack_pop;
+ else if (scan_keyword("current"))
+ i = colorstack_current;
+ else
+ i = -1; /* error */
+ if (i >= 0) {
+ new_whatsit(pdf_colorstack_node);
+ set_pdf_colorstack_stack(tail, cur_val);
+ set_pdf_colorstack_cmd(tail, i);
+ set_pdf_colorstack_data(tail, null);
+ if (i <= colorstack_data) {
+ scan_pdf_ext_toks();
+ set_pdf_colorstack_data(tail, def_ref);
+ }
+ } else {
+ print_err("Color stack action is missing");
+ help3("The expected actions for \\pdfextension colorstack:",
+ " set, push, pop, current",
+ "I'll ignore the color stack command.");
+ error();
+ }
+ break;
+ case pdf_start_link_code:
+ scan_startlink(static_pdf);
+ break;
+ case pdf_end_link_code:
+ if (abs(mode) == vmode)
+ normal_error("pdf backend", "\\pdfextension endlink cannot be used in vertical mode");
+ new_whatsit(pdf_end_link_node);
+ break;
+ case pdf_start_thread_code:
+ new_annot_whatsit(pdf_start_thread_node);
+ scan_thread_id();
+ break;
+ case pdf_end_thread_code:
+ new_whatsit(pdf_end_thread_node);
+ break;
+ case pdf_outline_code:
+ scan_pdfoutline(static_pdf);
+ break;
+ case pdf_glyph_to_unicode_code:
+ glyph_to_unicode();
+ break;
+ case pdf_catalog_code:
+ scan_pdfcatalog(static_pdf);
+ break;
+ case pdf_font_attr_code:
+ /*
+ The font attributes are simply initialized to zero now, this is easier to deal with from C than an
+ empty \TeX{} string, and surely nobody will want to set font attr to a string containing a single zero,
+ as that would be nonsensical in the PDF output.
+ */
+ scan_font_ident();
+ k = cur_val;
+ if (k == null_font)
+ normal_error("pdf backend", "invalid font identifier");
+ scan_pdf_ext_toks();
+ set_pdf_font_attr(k, tokens_to_string(def_ref));
+ if (str_length(pdf_font_attr(k)) == 0) {
+ flush_str((str_ptr - 1)); /* from |tokens_to_string| */
+ set_pdf_font_attr(k, 0);
+ }
+ break;
+ case pdf_map_file_code:
+ scan_pdf_ext_toks();
+ pdfmapfile(def_ref);
+ delete_token_ref(def_ref);
+ break;
+ case pdf_map_line_code:
+ scan_pdf_ext_toks();
+ pdfmapline(def_ref);
+ delete_token_ref(def_ref);
+ break;
+ case pdf_include_chars_code:
+ pdf_include_chars(static_pdf);
+ break;
+ case pdf_info_code:
+ scan_pdf_ext_toks();
+ pdf_info_toks = concat_tokens(pdf_info_toks, def_ref);
+ break;
+ case pdf_names_code:
+ scan_pdf_ext_toks();
+ pdf_names_toks = concat_tokens(pdf_names_toks, def_ref);
+ break;
+ case pdf_thread_code:
+ new_annot_whatsit(pdf_thread_node);
+ scan_thread_id();
+ break;
+ case pdf_trailer_code:
+ scan_pdf_ext_toks();
+ pdf_trailer_toks = concat_tokens(pdf_trailer_toks, def_ref);
+ break;
+ default:
+ normal_error("pdf backend", "unknown \\pdfextension keyword");
+ break ;
+ }
+}
+
+void do_resource_dvi(int immediate, int code)
+{
+}
+
+void do_resource_pdf(int immediate, int code)
+{
+ switch (code) {
+ case use_box_resource_code:
+ scan_pdfrefxform(static_pdf);
+ break;
+ case use_image_resource_code:
+ scan_pdfrefximage(static_pdf);
+ break;
+ case save_box_resource_code:
+ scan_pdfxform(static_pdf);
+ if (immediate) {
+ pdf_cur_form = last_saved_box_index;
+ ship_out(static_pdf, obj_xform_box(static_pdf, last_saved_box_index), SHIPPING_FORM);
+ }
+ break;
+ case save_image_resource_code:
+ fix_pdf_minorversion(static_pdf);
+ scan_pdfximage(static_pdf);
+ if (immediate) {
+ pdf_write_image(static_pdf, last_saved_image_index);
+ }
+ break;
+ }
+}
+
+/*
+
+ Ad immediate:
+
+ To write a token list, we must run it through \TeX's scanner, expanding
+ macros and \.{\\the} and \.{\\number}, etc. This might cause runaways,
+ if a delimited macro parameter isn't matched, and runaways would be
+ extremely confusing since we are calling on \TeX's scanner in the middle
+ of a \.{\\shipout} command. Therefore we will put a dummy control sequence as
+ a ``stopper,'' right after the token list. This control sequence is
+ artificially defined to be \.{\\outer}.
+
+ The presence of `\.{\\immediate}' causes the |do_extension| procedure
+ to descend to one level of recursion. Nothing happens unless \.{\\immediate}
+ is followed by `\.{\\openout}', `\.{\\write}', or `\.{\\closeout}'.
+
+*/
+
+/* extensions are backend related */
+
+@ The next subroutine uses |cur_chr| to decide what sort of whatsit is
+involved, and also inserts a |write_stream| number.
+
+@c
+static void new_write_whatsit(int w, int check)
+{
+ new_whatsit(cur_chr);
+ if (check) {
+ /* so we check with open and close */
+ scan_limited_int(last_file_selector,NULL);
+ } else {
+ /* but we're tolerant with the rest */
+ scan_int();
+ if (cur_val < 0)
+ cur_val = term_only;
+ else if ((cur_val > last_file_selector) || (cur_val == write_target_direct) || (cur_val == write_target_special)) {
+ /* hh: i need to check what 17 is supposed to do. so let's kind of reserve it */
+ cur_val = write_target_overflow;
+ }
+ }
+ write_stream(tail) = cur_val;
+}
+
+void do_extension(int immediate)
+{
+ halfword p; /* all-purpose pointer */
+ if (cur_cmd == extension_cmd) {
+ /* these have their own range starting at 0 */
+ switch (cur_chr) {
+ case open_code:
+ p = tail;
+ new_write_whatsit(open_node_size,1);
+ scan_optional_equals();
+ scan_file_name();
+ open_name(tail) = cur_name;
+ open_area(tail) = cur_area;
+ open_ext(tail) = cur_ext;
+ if (immediate) {
+ out_what(static_pdf, tail);
flush_node_list(tail);
tail = p;
vlink(p) = null;
- } else {
- switch (cur_chr) {
- case pdf_obj_code:
- check_o_mode(pdf, "\\immediate\\pdfobj", 1 << OMODE_PDF,
- true);
- do_extension(pdf); /* scan object and set |pdf_last_obj| */
- if (obj_data_ptr(pdf, pdf_last_obj) == 0) /* this object has not been initialized yet */
- pdf_error("ext1",
- "`\\pdfobj reserveobjnum' cannot be used with \\immediate");
- pdf_write_obj(pdf, pdf_last_obj);
- break;
- case pdf_xform_code:
- check_o_mode(pdf, "\\immediate\\pdfxform", 1 << OMODE_PDF,
- true);
- do_extension(pdf); /* scan form and set |pdf_last_xform| */
- pdf_cur_form = pdf_last_xform;
- ship_out(pdf, obj_xform_box(pdf, pdf_last_xform), SHIPPING_FORM);
+ }
+ break;
+ case write_code:
+ /*
+ When `\.{\\write 12\{...\}}' appears, we scan the token list `\.{\{...\}}'
+ without expanding its macros; the macros will be expanded later when this
+ token list is rescanned.
+ */
+ p = tail;
+ new_write_whatsit(write_node_size,0);
+ cur_cs = write_stream(tail);
+ scan_toks(false, false);
+ write_tokens(tail) = def_ref;
+ if (immediate) {
+ out_what(static_pdf, tail);
+ flush_node_list(tail);
+ tail = p;
+ vlink(p) = null;
+ }
+ break;
+ case close_code:
+ p = tail;
+ new_write_whatsit(close_node_size,1);
+ write_tokens(tail) = null;
+ if (immediate) {
+ out_what(static_pdf, tail);
+ flush_node_list(tail);
+ tail = p;
+ vlink(p) = null;
+ }
+ break;
+ case special_code:
+ /*
+ When `\.{\\special\{...\}}' appears, we expand the macros in the token
+ list as in \.{\\xdef} and \.{\\mark}.
+ */
+ new_whatsit(special_node);
+ write_stream(tail) = null;
+ p = scan_toks(false, true);
+ write_tokens(tail) = def_ref;
+ break;
+ case immediate_code:
+ get_x_token();
+ do_extension(1);
+ break;
+ case use_box_resource_code:
+ case use_image_resource_code:
+ case save_box_resource_code:
+ case save_image_resource_code:
+ switch (get_o_mode()) {
+ case OMODE_DVI:
+ do_resource_dvi(0,cur_chr);
break;
- case pdf_ximage_code:
- check_o_mode(pdf, "\\immediate\\pdfximage", 1 << OMODE_PDF,
- true);
- do_extension(pdf); /* scan image and set |pdf_last_ximage| */
- pdf_write_image(pdf, pdf_last_ximage);
+ case OMODE_PDF:
+ do_resource_pdf(0,cur_chr);
break;
default:
- back_input();
break;
- }
- }
- } else {
- back_input();
- }
- break;
- case pdf_annot_node:
- /* Implement \.{\\pdfannot} */
- check_o_mode(pdf, "\\pdfannot", 1 << OMODE_PDF, false);
- scan_annot(pdf);
- break;
- case pdf_catalog_code:
- /* Implement \.{\\pdfcatalog} */
- check_o_mode(pdf, "\\pdfcatalog", 1 << OMODE_PDF, true); /* writes an object */
- scan_pdfcatalog(pdf);
- break;
- case pdf_dest_node:
- /* Implement \.{\\pdfdest} */
- check_o_mode(pdf, "\\pdfdest", 1 << OMODE_PDF, false);
- scan_pdfdest(pdf);
- break;
- case pdf_end_link_node:
- /* Implement \.{\\pdfendlink} */
- check_o_mode(pdf, "\\pdfendlink", 1 << OMODE_PDF, false);
- if (abs(mode) == vmode)
- pdf_error("ext1", "\\pdfendlink cannot be used in vertical mode");
- new_whatsit(pdf_end_link_node);
- break;
- case pdf_end_thread_node:
- /* Implement \.{\\pdfendthread} */
- check_o_mode(pdf, "\\pdfendthread", 1 << OMODE_PDF, false);
- new_whatsit(pdf_end_thread_node);
- break;
- case pdf_font_attr_code:
- /* Implement \.{\\pdffontattr} */
- /* A change from Thanh's original code: the font attributes are simply
- initialized to zero now, this is easier to deal with from C than an
- empty \TeX{} string, and surely nobody will want to set
- \.{\\pdffontattr} to a string containing a single zero, as that
- would be nonsensical in the PDF output. */
- check_o_mode(pdf, "\\pdffontattr", 1 << OMODE_PDF, false);
- scan_font_ident();
- k = cur_val;
- if (k == null_font)
- pdf_error("font", "invalid font identifier");
- scan_pdf_ext_toks();
- set_pdf_font_attr(k, tokens_to_string(def_ref));
- if (str_length(pdf_font_attr(k)) == 0) {
- flush_str((str_ptr - 1)); /* from |tokens_to_string| */
- set_pdf_font_attr(k, 0);
- }
- break;
- case font_expand_code:
- /* Implement \.{\\fontexpand} */
- read_expand_font();
- break;
- case pdf_include_chars_code:
- /* Implement \.{\\pdfincludechars} */
- check_o_mode(pdf, "\\pdfincludechars", 1 << OMODE_PDF, false);
- pdf_include_chars(pdf);
- break;
- case pdf_info_code:
- /* Implement \.{\\pdfinfo} */
- check_o_mode(pdf, "\\pdfinfo", 1 << OMODE_PDF, false);
- scan_pdf_ext_toks();
- pdf_info_toks = concat_tokens(pdf_info_toks, def_ref);
- break;
- case pdf_literal_node:
- /* Implement \.{\\pdfliteral} */
- check_o_mode(pdf, "\\pdfliteral", 1 << OMODE_PDF, false);
- new_whatsit(pdf_literal_node);
- if (scan_keyword("direct"))
- set_pdf_literal_mode(tail, direct_always);
- else if (scan_keyword("page"))
- set_pdf_literal_mode(tail, direct_page);
- else
- set_pdf_literal_mode(tail, set_origin);
- scan_pdf_ext_toks();
- set_pdf_literal_type(tail, normal);
- set_pdf_literal_data(tail, def_ref);
- break;
- case pdf_colorstack_node:
- /* Implement \.{\\pdfcolorstack} */
- check_o_mode(pdf, "\\pdfcolorstack", 1 << OMODE_PDF, false);
- /* Scan and check the stack number and store in |cur_val| */
- scan_int();
- if (cur_val >= colorstackused()) {
- print_err("Unknown color stack number ");
- print_int(cur_val);
- help3
- ("Allocate and initialize a color stack with \\pdfcolorstackinit.",
- "I'll use default color stack 0 here.",
- "Proceed, with fingers crossed.");
- error();
- cur_val = 0;
- }
- if (cur_val < 0) {
- print_err("Invalid negative color stack number");
- help2("I'll use default color stack 0 here.",
- "Proceed, with fingers crossed.");
- error();
- cur_val = 0;
- }
- if (scan_keyword("set"))
- i = colorstack_set;
- else if (scan_keyword("push"))
- i = colorstack_push;
- else if (scan_keyword("pop"))
- i = colorstack_pop;
- else if (scan_keyword("current"))
- i = colorstack_current;
- else
- i = -1; /* error */
-
- if (i >= 0) {
- new_whatsit(pdf_colorstack_node);
- set_pdf_colorstack_stack(tail, cur_val);
- set_pdf_colorstack_cmd(tail, i);
- set_pdf_colorstack_data(tail, null);
- if (i <= colorstack_data) {
- scan_pdf_ext_toks();
- set_pdf_colorstack_data(tail, def_ref);
- }
- } else {
- print_err("Color stack action is missing");
- help3("The expected actions for \\pdfcolorstack:",
- " set, push, pop, current",
- "I'll ignore the color stack command.");
- error();
- }
- break;
- case pdf_setmatrix_node:
- /* Implement \.{\\pdfsetmatrix} */
- check_o_mode(pdf, "\\pdfsetmatrix", 1 << OMODE_PDF, false);
- new_whatsit(pdf_setmatrix_node);
- scan_pdf_ext_toks();
- set_pdf_setmatrix_data(tail, def_ref);
- break;
- case pdf_save_node:
- /* Implement \.{\\pdfsave} */
- check_o_mode(pdf, "\\pdfsave", 1 << OMODE_PDF, false);
- new_whatsit(pdf_save_node);
- break;
- case pdf_restore_node:
- /* Implement \.{\\pdfrestore} */
- check_o_mode(pdf, "\\pdfrestore", 1 << OMODE_PDF, false);
- new_whatsit(pdf_restore_node);
- break;
- case pdf_map_file_code:
- /* Implement \.{\\pdfmapfile} */
- check_o_mode(pdf, "\\pdfmapfile", 1 << OMODE_PDF, false);
- scan_pdf_ext_toks();
- pdfmapfile(def_ref);
- delete_token_ref(def_ref);
- break;
- case pdf_map_line_code:
- /* Implement \.{\\pdfmapline} */
- check_o_mode(pdf, "\\pdfmapline", 1 << OMODE_PDF, false);
- scan_pdf_ext_toks();
- pdfmapline(def_ref);
- delete_token_ref(def_ref);
- break;
- case pdf_names_code:
- /* Implement \.{\\pdfnames} */
- check_o_mode(pdf, "\\pdfnames", 1 << OMODE_PDF, false);
- scan_pdf_ext_toks();
- pdf_names_toks = concat_tokens(pdf_names_toks, def_ref);
- break;
- case pdf_obj_code:
- /* Implement \.{\\pdfobj} */
- check_o_mode(pdf, "\\pdfobj", 1 << OMODE_PDF, false);
- scan_obj(pdf);
- break;
- case pdf_outline_code:
- /* Implement \.{\\pdfoutline} */
- check_o_mode(pdf, "\\pdfoutline", 1 << OMODE_PDF, true);
- scan_pdfoutline(pdf);
- break;
- case pdf_refobj_node:
- /* Implement \.{\\pdfrefobj} */
- check_o_mode(pdf, "\\pdfrefobj", 1 << OMODE_PDF, false);
- scan_refobj(pdf);
- break;
- case pdf_refxform_node:
- /* Implement \.{\\pdfrefxform} */
- check_o_mode(pdf, "\\pdfrefxform", 1 << OMODE_PDF, false);
- scan_pdfrefxform(pdf);
- break;
- case pdf_refximage_node:
- /* Implement \.{\\pdfrefximage} */
- check_o_mode(pdf, "\\pdfrefximage", 1 << OMODE_PDF, false);
- scan_pdfrefximage(pdf);
- break;
- case save_pos_node:
- /* Implement \.{\\savepos} */
- new_whatsit(save_pos_node);
- break;
- case pdf_start_link_node:
- /* Implement \.{\\pdfstartlink} */
- check_o_mode(pdf, "\\pdfstartlink", 1 << OMODE_PDF, false);
- scan_startlink(pdf);
- break;
- case pdf_start_thread_node:
- /* Implement \.{\\pdfstartthread} */
- check_o_mode(pdf, "\\pdfstartthread", 1 << OMODE_PDF, false);
- new_annot_whatsit(pdf_start_thread_node);
- scan_thread_id();
- break;
- case pdf_thread_node:
- /* Implement \.{\\pdfthread} */
- check_o_mode(pdf, "\\pdfthread", 1 << OMODE_PDF, false);
- new_annot_whatsit(pdf_thread_node);
- scan_thread_id();
- break;
- case pdf_trailer_code:
- /* Implement \.{\\pdftrailer} */
- check_o_mode(pdf, "\\pdftrailer", 1 << OMODE_PDF, false);
- scan_pdf_ext_toks();
- pdf_trailer_toks = concat_tokens(pdf_trailer_toks, def_ref);
- break;
- case pdf_xform_code:
- /* Implement \.{\\pdfxform} */
- check_o_mode(pdf, "\\pdfxform", 1 << OMODE_PDF, false);
- scan_pdfxform(pdf);
- break;
- case pdf_ximage_code:
- /* Implement \.{\\pdfximage} */
- check_o_mode(pdf, "\\pdfximage", 1 << OMODE_PDF, false);
- /* png, jpeg, and pdf image handling depends on this done so early: */
- fix_pdf_minorversion(pdf);
- scan_pdfximage(pdf);
- break;
- case save_cat_code_table_code:
- /* Implement \.{\\savecatcodetable} */
- scan_int();
- if ((cur_val < 0) || (cur_val > 0x7FFF)) {
- print_err("Invalid \\catcode table");
- help1("All \\catcode table ids must be between 0 and 0x7FFF");
- error();
- } else {
- if (cur_val == cat_code_table) {
- print_err("Invalid \\catcode table");
- help1("You cannot overwrite the current \\catcode table");
- error();
- } else {
- copy_cat_codes(cat_code_table, cur_val);
}
- }
- break;
- case init_cat_code_table_code:
- /* Implement \.{\\initcatcodetable} */
- scan_int();
- if ((cur_val < 0) || (cur_val > 0x7FFF)) {
- print_err("Invalid \\catcode table");
- help1("All \\catcode table ids must be between 0 and 0x7FFF");
- error();
- } else {
- if (cur_val == cat_code_table) {
- print_err("Invalid \\catcode table");
- help1("You cannot overwrite the current \\catcode table");
- error();
+ break;
+ /* backend extensions have their own range starting at 32 */
+ case dvi_extension_code:
+ if (get_o_mode() == OMODE_DVI)
+ do_extension_dvi(immediate);
+ break;
+ case pdf_extension_code:
+ if (get_o_mode() == OMODE_PDF)
+ do_extension_pdf(immediate);
+ break;
+ default:
+ if (immediate) {
+ back_input();
} else {
- initex_cat_codes(cur_val);
+ confusion("ext1x");
}
+ break;
}
- break;
- case set_random_seed_code:
- /* Implement \.{\\setrandomseed} */
- /* Negative random seed values are silently converted to positive ones */
- scan_int();
- if (cur_val < 0)
- negate(cur_val);
- random_seed = cur_val;
- init_randoms(random_seed);
- break;
- case pdf_glyph_to_unicode_code:
- /* Implement \.{\\pdfglyphtounicode} */
- glyph_to_unicode();
- break;
- case late_lua_node:
- /* Implement \.{\\latelua} */
- new_whatsit(late_lua_node); /* type == normal */
- late_lua_name(tail) = scan_lua_state();
- (void) scan_toks(false, false);
- late_lua_data(tail) = def_ref;
- break;
- default:
- confusion("ext1");
- break;
+ } else {
+ /* no extension command, quite certainly following \immediate */
+ back_input();
}
}
-
@ Here is a subroutine that creates a whatsit node having a given |subtype|
and a given number of words. It initializes only the first word of the whatsit,
and appends it to the current list.
@@ -523,78 +521,191 @@ void new_whatsit(int s)
tail = p;
}
-
-@ The next subroutine uses |cur_chr| to decide what sort of whatsit is
-involved, and also inserts a |write_stream| number.
+@ The final line of this routine is slightly subtle; at least, the author
+didn't think about it until getting burnt! There is a used-up token list
+@^Knuth, Donald Ervin@>
+on the stack, namely the one that contained |end_write_token|. (We
+insert this artificial `\.{\\endwrite}' to prevent runaways, as explained
+above.) If it were not removed, and if there were numerous writes on a
+single page, the stack would overflow.
@c
-void new_write_whatsit(int w)
+#define end_write_token cs_token_flag+end_write
+
+void expand_macros_in_tokenlist(halfword p)
{
- new_whatsit(cur_chr);
- if (w != write_node_size) {
- scan_four_bit_int();
- } else {
- scan_int();
- if (cur_val < 0)
- cur_val = 17;
- else if ((cur_val > 15) && (cur_val != 18))
- cur_val = 16;
+ int old_mode; /* saved |mode| */
+ pointer q, r; /* temporary variables for list manipulation */
+ q = get_avail();
+ token_info(q) = right_brace_token + '}';
+ r = get_avail();
+ token_link(q) = r;
+ token_info(r) = end_write_token;
+ begin_token_list(q, inserted);
+ begin_token_list(write_tokens(p), write_text);
+ q = get_avail();
+ token_info(q) = left_brace_token + '{';
+ begin_token_list(q, inserted);
+ /* now we're ready to scan
+ `\.\{$\langle\,$token list$\,\rangle$\.{\} \\endwrite}' */
+ old_mode = mode;
+ mode = 0;
+ /* disable \.{\\prevdepth}, \.{\\spacefactor}, \.{\\lastskip}, \.{\\prevgraf} */
+ cur_cs = write_loc;
+ q = scan_toks(false, true); /* expand macros, etc. */
+ get_token();
+ if (cur_tok != end_write_token) {
+ /* Recover from an unbalanced write command */
+ const char *hlp[] = {
+ "On this page there's a \\write with fewer real {'s than }'s.",
+ "I can't handle that very well; good luck.", NULL
+ };
+ tex_error("Unbalanced write command", hlp);
+ do {
+ get_token();
+ } while (cur_tok != end_write_token);
}
- write_stream(tail) = cur_val;
+ mode = old_mode;
+ end_token_list(); /* conserve stack space */
}
-
-@ We have to check whether \.{\\pdfoutput} is set for using \pdfTeX{}
- extensions.
-
-@c
-void scan_pdf_ext_toks(void)
+void write_out(halfword p)
{
- (void) scan_toks(false, true); /* like \.{\\special} */
+ int old_setting; /* holds print |selector| */
+ int j; /* write stream number */
+ boolean clobbered; /* system string is ok? */
+ int ret; /* return value from |runsystem| */
+ char *s, *ss; /* line to be written, as a C string */
+ int callback_id;
+ int lua_retval;
+ expand_macros_in_tokenlist(p);
+ old_setting = selector;
+ j = write_stream(p);
+ if (j == write_target_system) {
+ selector = new_string;
+ } else if (write_open[j]) {
+ selector = j;
+ } else if ((j == term_only) && (selector == term_and_log)) {
+ /* write to the terminal if file isn't open */
+ selector = log_only;
+ tprint_nl("");
+ } else {
+ tprint_nl("");
+ }
+ s = tokenlist_to_cstring(def_ref, false, NULL);
+ if (selector < no_print) {
+ /* selector is a file */
+ callback_id = callback_defined(process_output_buffer_callback);
+ if (callback_id > 0) {
+ /* fix up the output buffer using callbacks */
+ lua_retval = run_callback(callback_id, "S->S", s, &ss);
+ if ((lua_retval == true) && (ss != NULL)) {
+ xfree(s);
+ s = ss;
+ }
+ }
+ }
+ tprint(s);
+ xfree(s);
+ print_ln();
+ flush_list(def_ref);
+ if (j == write_target_system) {
+ cur_string[cur_length] = '\0'; /* Convert newline to null. */
+ if (tracing_online <= 0)
+ selector = log_only; /* Show what we're doing in the log file. */
+ else
+ selector = term_and_log; /* Show what we're doing. */
+ /* If the log file isn't open yet, we can only send output to the terminal.
+ Calling |open_log_file| from here seems to result in bad data in the log.
+ */
+ if (!log_opened_global)
+ selector = term_only;
+ tprint_nl("runsystem(");
+ tprint((char *) cur_string);
+ tprint(")...");
+ if (shellenabledp) {
+ clobbered = false;
+ if (strlen((char *) cur_string) != cur_length)
+ clobbered = true;
+ /* minimal checking: NUL not allowed in argument string of |system|() */
+ if (clobbered) {
+ tprint("clobbered");
+ } else {
+ /* We have the command. See if we're allowed to execute it,
+ and report in the log. We don't check the actual exit status of
+ the command, or do anything with the output. */
+ ret = runsystem((char *) cur_string);
+ if (ret == -1)
+ tprint("quotation error in system command");
+ else if (ret == 0)
+ tprint("disabled (restricted)");
+ else if (ret == 1)
+ tprint("executed");
+ else if (ret == 2)
+ tprint("executed safely (allowed)");
+ }
+ } else {
+ tprint("disabled"); /* |shellenabledp| false */
+ }
+ print_char('.');
+ tprint_nl("");
+ print_ln();
+ cur_length = 0; /* erase the string */
+ }
+ selector = old_setting;
}
-@ We need to check whether the referenced object exists.
+void finalize_write_files(void) {
+ int k;
+ for (k = 0; k <= last_file_selector; k++) {
+ if (write_open[k]) {
+ lua_a_close_out(write_file[k]);
+ }
+ }
+}
-finds the node preceding the rightmost node |e|; |s| is some node before |e|
-@c
-halfword prev_rightmost(halfword s, halfword e)
-{
- halfword p = s;
- if (p == null)
- return null;
- while (vlink(p) != e) {
- p = vlink(p);
- if (p == null)
- return null;
+void initialize_write_files(void) {
+ int k;
+ for (k = 0; k <= last_write_open; k++) {
+ write_open[k] = false;
}
- return p;
}
-@ \.{\\pdfxform} and \.{\\pdfrefxform} are similiar to \.{\\pdfobj} and
- \.{\\pdfrefobj}
+void close_write_file(int id) {
+ if (write_open[id]) {
+ lua_a_close_out(write_file[id]);
+ write_open[id] = false;
+ }
+}
-@c
-int pdf_last_xform;
+boolean open_write_file(int id, char *fn) {
+ if (lua_a_open_out(&(write_file[id]), fn, (id + 1))) {
+ write_open[id] = true;
+ return true;
+ } else {
+ return false;
+ }
+}
-@ \.{\\pdfximage} and \.{\\pdfrefximage} are similiar to \.{\\pdfxform} and
- \.{\\pdfrefxform}. As we have to scan |<rule spec>| quite often, it is better
- have a |rule_node| that holds the most recently scanned |<rule spec>|.
+@ We have to check whether \.{\\outputmode} is set for using \pdfTeX{}
+ extensions.
@c
-int pdf_last_ximage;
-int pdf_last_ximage_pages;
-int pdf_last_ximage_colordepth;
-int pdf_last_annot;
+void scan_pdf_ext_toks(void)
+{
+ (void) scan_toks(false, true); /* like \.{\\special} */
+}
-@ pdflastlink needs an extra global variable
+@ the pdflast* need extra global variables
@c
+int pdf_last_annot;
int pdf_last_link;
-scaledpos pdf_last_pos = { 0, 0 };
-
+int pdf_last_obj;
+int pdf_retval; /* global multi-purpose return value */
-@ To implement primitives as \.{\\pdfinfo}, \.{\\pdfcatalog} or
-\.{\\pdfnames} we need to concatenate tokens lists.
+@ To implement primitives as \.{\\pdfextension info}, \.{\\pdfextension catalog} or
+\.{\\pdfextension names} we need to concatenate tokens lists.
@c
halfword concat_tokens(halfword q, halfword r)
@@ -610,33 +721,6 @@ halfword concat_tokens(halfword q, halfword r)
return q;
}
-@ @c
-int pdf_retval; /* global multi-purpose return value */
-
-@ @c
-halfword make_local_par_node(void)
-/* This function creates a |local_paragraph| node */
-{
- halfword p, q;
- p = new_node(whatsit_node, local_par_node);
- 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_box_left(p) = q;
- local_box_left_width(p) = width(local_left_box);
- }
- if (local_right_box != null) {
- q = copy_node_list(local_right_box);
- local_box_right(p) = q;
- local_box_right_width(p) = width(local_right_box);
- }
- local_par_dir(p) = par_direction;
- return p;
-}
-
-
-
@ The \eTeX\ features available in extended mode are grouped into two
categories: (1)~Some of them are permanently enabled and have no
semantic effect as long as none of the additional primitives are
@@ -646,14 +730,12 @@ an \eTeX\ state variable named \.{\\...state}; the feature is enabled,
resp.\ disabled by assigning a positive, resp.\ non-positive value to
that integer.
-
@ In order to handle \.{\\everyeof} we need an array |eof_seen| of
boolean variables.
@c
boolean *eof_seen; /* has eof been seen? */
-
@ The |print_group| procedure prints the current level of grouping and
the name corresponding to |cur_group|.
@@ -726,7 +808,6 @@ void print_group(boolean e)
}
}
-
@ The |group_trace| procedure is called when a new level of grouping
begins (|e=false|) or ends (|e=true|) with |saved_value(-1)| containing the
line number.
@@ -756,7 +837,6 @@ and |cond_ptr| values for each input file.
save_pointer *grp_stack; /* initial |cur_boundary| */
halfword *if_stack; /* initial |cond_ptr| */
-
@ When a group ends that was apparently entered in a different input
file, the |group_warning| procedure is invoked in order to update the
|grp_stack|. If moreover \.{\\tracingnesting} is positive we want to
@@ -803,7 +883,6 @@ void group_warning(void)
}
}
-
@ When a conditional ends that was apparently started in a different
input file, the |if_warning| procedure is invoked in order to update the
|if_stack|. If moreover \.{\\tracingnesting} is positive we want to
@@ -901,19 +980,67 @@ void file_warning(void)
@ @c
halfword last_line_fill; /* the |par_fill_skip| glue node of the new paragraph */
-
@ The lua interface needs some extra functions. The functions
themselves are quite boring, but they are handy because otherwise this
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)
#define get_tex_count_register(j) count(j)
#define get_tex_attribute_register(j) attribute(j)
#define get_tex_box_register(j) box(j)
+int get_tex_extension_count_register(const char *s, int d)
+{
+ int cs;
+ cs = string_lookup(s,strlen(s));
+ if ((cs == undefined_control_sequence || cs == undefined_cs_cmd))
+ return d;
+ return (int) get_tex_count_register((equiv(cs) - count_base));
+}
+
+void set_tex_extension_count_register(const char *s, int d)
+{
+ int cs;
+ cs = string_lookup(s,strlen(s));
+ if ((cs == undefined_control_sequence || cs == undefined_cs_cmd))
+ return;
+ get_tex_count_register((equiv(cs) - count_base)) = d;
+}
+
+int get_tex_extension_dimen_register(const char *s, int d)
+{
+ int cs;
+ cs = string_lookup(s,strlen(s));
+ if ((cs == undefined_control_sequence || cs == undefined_cs_cmd))
+ return d;
+ return (int) get_tex_dimen_register((equiv(cs) - scaled_base));
+}
+
+void set_tex_extension_dimen_register(const char *s, int d)
+{
+ int cs;
+ cs = string_lookup(s,strlen(s));
+ if ((cs == undefined_control_sequence || cs == undefined_cs_cmd))
+ return;
+ get_tex_dimen_register((equiv(cs) - scaled_base)) = d;
+}
+
+int get_tex_extension_toks_register(const char *s)
+{
+ int cs;
+ cs = string_lookup(s,strlen(s));
+ if ((cs == undefined_control_sequence || cs == undefined_cs_cmd))
+ return null;
+ return toks((equiv(cs) - toks_base)); /* a pointer to a token list */
+}
+
int set_tex_dimen_register(int j, scaled v)
{
int a; /* return non-nil for error */
@@ -938,6 +1065,19 @@ int set_tex_skip_register(int j, halfword v)
return 0;
}
+int set_tex_mu_skip_register(int j, halfword v)
+{
+ int a; /* return non-nil for error */
+ if (global_defs > 0)
+ a = 4;
+ else
+ a = 0;
+ if (type(v) != glue_spec_node)
+ return 1;
+ word_define(j + mu_skip_base, v);
+ return 0;
+}
+
int set_tex_count_register(int j, scaled v)
{
int a; /* return non-nil for error */
@@ -1000,6 +1140,22 @@ int set_tex_toks_register(int j, lstring s)
return 0;
}
+int scan_tex_toks_register(int j, int c, lstring s)
+{
+ halfword ref;
+ int a;
+ ref = get_avail();
+ (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)
+ a = 4;
+ else
+ a = 0;
+ define(j + toks_base, call_cmd, ref);
+ return 0;
+}
+
scaled get_tex_box_width(int j)
{
halfword q = box(j);
@@ -1034,7 +1190,6 @@ int set_tex_box_height(int j, scaled v)
return 0;
}
-
scaled get_tex_box_depth(int j)
{
halfword q = box(j);
@@ -1052,7 +1207,6 @@ int set_tex_box_depth(int j, scaled v)
return 0;
}
-
@ This section is devoted to the {\sl Synchronize \TeX nology}
- or simply {\sl Sync\TeX} - used to synchronize between input and output.
This section explains how synchronization basics are implemented.
@@ -1086,7 +1240,6 @@ the {\sl Sync\TeX} related options, and the {\sl Sync\TeX} controller will read
@c
int synctexoption;
-
@ A convenient primitive is provided:
\.{\\synctex=1} in the input source file enables synchronization whereas
\.{\\synctex=0} disables it.
@@ -1103,7 +1256,6 @@ the correct value when quite everything is initialized.
@c
int synctexoffset; /* holds the true value of |synctex_code| */
-
@ Synchronization is achieved with the help of an auxiliary file named
`\.{{\sl jobname}.synctex}' ({\sl jobname} is the contents of the
\.{\\jobname} macro), where a {\sl Sync\TeX} controller implemented
@@ -1165,7 +1317,6 @@ If the input comes from the terminal or a pseudo file, the |synctex_tag| is set
It results in automatically disabling synchronization for material
input from the terminal or pseudo files.
-
Synchronized nodes are boxes, math, kern and glue nodes.
Other nodes should be synchronized too, in particular math noads.
\TeX\ assumes that math, kern and glue nodes have the same size,
@@ -1190,7 +1341,6 @@ Of course, all this assumes that {\sl Sync\TeX} is turned off from the command l
@^synctex@>
@^synchronization@>
-
@ Here are extra variables for Web2c. (This numbering of the
system-dependent section allows easy integration of Web2c and e-\TeX, etc.)
@^<system dependencies@>
@@ -1209,7 +1359,7 @@ int shellenabledp;
int restrictedshell;
char *output_comment;
-@ Are we printing extra info as we read the format file?
+@ Are we printing extra info as we read the format file?
@c
boolean debug_format_file;
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.w b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
index 0f591c3c776..aaeec71e65f 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.w
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.w
@@ -378,7 +378,7 @@ void show_context(void)
}
for (q = p; q <= first_count - 1; q++)
print_valid_utf8(q);
- print_ln();
+ print_ln();
for (q = 1; q <= n; q++)
print_char(' '); /* print |n| spaces to begin line~2 */
if (m + n <= error_line)
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.h b/Build/source/texk/web2c/luatexdir/tex/linebreak.h
index af51d2c25a9..9ac444b7a37 100644
--- a/Build/source/texk/web2c/luatexdir/tex/linebreak.h
+++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.h
@@ -70,33 +70,34 @@ extern halfword find_protchar_right(halfword l, halfword r);
/* skipable nodes at the margins during character protrusion */
-# define cp_skipable(a) ((! is_char_node((a))) && \
- ((type((a)) == ins_node) \
- || (type((a)) == mark_node) \
- || (type((a)) == adjust_node) \
- || (type((a)) == penalty_node) \
- || ((type((a)) == whatsit_node) && \
- (subtype((a)) != pdf_refximage_node) && \
- (subtype((a)) != pdf_refxform_node)) \
- /* reference to an image or XObject form */ \
- || ((type((a)) == disc_node) && \
- (vlink_pre_break(a) == null) && \
- (vlink_post_break(a) == null) && \
- (vlink_no_break(a) == null)) \
- /* an empty |disc_node| */ \
- || ((type((a)) == math_node) && \
- (surround((a)) == 0)) \
- || ((type((a)) == kern_node) && \
- ((width((a)) == 0) || \
- (subtype((a)) == normal))) \
- || ((type((a)) == glue_node) && \
- (glue_ptr((a)) == zero_glue)) \
- || ((type((a)) == hlist_node) && \
- (width((a)) == 0) && \
- (height((a)) == 0) && \
- (depth((a)) == 0) && \
- (list_ptr((a)) == null)) \
- ))
+# define zero_dimensions(a) ( \
+ (width((a)) == 0) && \
+ (height((a)) == 0) && \
+ (depth((a)) == 0) \
+)
+
+# define empty_disc(a) ( \
+ (vlink_pre_break(a) == null) && \
+ (vlink_post_break(a) == null) && \
+ (vlink_no_break(a) == null) \
+)
+
+# define cp_skipable(a) ( (! is_char_node((a))) && ( \
+ (type((a)) == ins_node) \
+ || (type((a)) == mark_node) \
+ || (type((a)) == adjust_node) \
+ || (type((a)) == penalty_node) \
+ || (type((a)) == boundary_node) \
+ || (type((a)) == whatsit_node) \
+ || (type((a)) == dir_node) \
+ || (type((a)) == local_par_node) \
+ || ((type((a)) == rule_node) && zero_dimensions(a)) \
+ || ((type((a)) == disc_node) && empty_disc(a)) \
+ || ((type((a)) == math_node) && (surround((a)) == 0)) \
+ || ((type((a)) == kern_node) && ((width((a)) == 0) || (subtype((a)) == normal))) \
+ || ((type((a)) == glue_node) && (glue_ptr((a)) == zero_glue)) \
+ || ((type((a)) == hlist_node) && (list_ptr((a)) == null) && zero_dimensions(a)) \
+) )
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
index e8cd3542a46..90167e43938 100644
--- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w
+++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w
@@ -155,16 +155,16 @@ void line_break(boolean d, int line_break_context)
addressof(cur_list.tail_field));
if (callback_id > 0) {
/* find the correct value for the |just_box| */
- halfword box_search = cur_list.tail_field;
+ halfword box_search = cur_list.tail_field;
just_box = null;
- if (box_search != null) {
+ if (box_search != null) {
do {
- if (type(box_search) == hlist_node) {
+ if (type(box_search) == hlist_node) {
just_box = box_search;
}
box_search = vlink(box_search);
} while (box_search != null);
- }
+ }
if (just_box == null) {
help3
("A linebreaking routine should return a non-empty list of nodes",
@@ -176,17 +176,13 @@ void line_break(boolean d, int line_break_context)
} else {
if (int_par(tracing_paragraphs_code) > 0) {
begin_diagnostic();
- tprint_nl
- ("Lua linebreak_filter failed, reverting to default on line ");
print_int(line);
end_diagnostic(true);
}
}
}
if (callback_id == 0) {
- if ((!is_char_node(vlink(temp_head)))
- && ((type(vlink(temp_head)) == whatsit_node)
- && (subtype(vlink(temp_head)) == local_par_node)))
+ if ((!is_char_node(vlink(temp_head))) && ((type(vlink(temp_head)) == local_par_node)))
paragraph_dir = local_par_dir(vlink(temp_head));
else
assert(0); /* |paragraph_dir = 0|; */
@@ -196,10 +192,6 @@ void line_break(boolean d, int line_break_context)
int_par(tolerance_code),
dimen_par(emergency_stretch_code),
int_par(looseness_code),
- /*
- int_par(hyphen_penalty_code),
- int_par(ex_hyphen_penalty_code),
- */
int_par(adjust_spacing_code),
equiv(par_shape_loc),
int_par(adj_demerits_code),
@@ -217,8 +209,8 @@ void line_break(boolean d, int line_break_context)
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)),
+ (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),
final_par_glue);
}
@@ -306,14 +298,14 @@ static short hlist_stack_level = 0;
static void push_node(halfword p)
{
if (hlist_stack_level >= max_hlist_stack)
- pdf_error("push_node", "stack overflow");
+ normal_error("push_node","stack overflow");
hlist_stack[hlist_stack_level++] = p;
}
static halfword pop_node(void)
{
if (hlist_stack_level <= 0) /* would point to some bug */
- pdf_error("pop_node", "stack underflow (internal error)");
+ normal_error("pop_node","stack underflow (internal error)");
return hlist_stack[--hlist_stack_level];
}
@@ -333,23 +325,20 @@ static boolean check_expand_pars(internal_font_number f)
if (cur_font_step < 0)
cur_font_step = font_step(f);
else if (cur_font_step != font_step(f))
- pdf_error("font expansion",
- "using fonts with different step of expansion in one paragraph is not allowed");
+ normal_error("font expansion","using fonts with different step of expansion in one paragraph is not allowed");
m = font_max_stretch(f);
if (m != 0) {
if (max_stretch_ratio < 0)
max_stretch_ratio = m;
else if (max_stretch_ratio != m)
- pdf_error("font expansion",
- "using fonts with different limit of expansion in one paragraph is not allowed");
+ normal_error("font expansion","using fonts with different limit of expansion in one paragraph is not allowed");
}
m = font_max_shrink(f);
if (m != 0) {
if (max_shrink_ratio < 0)
max_shrink_ratio = -m;
else if (max_shrink_ratio != -m)
- pdf_error("font expansion",
- "using fonts with different limit of expansion in one paragraph is not allowed");
+ normal_error("font expansion","using fonts with different limit of expansion in one paragraph is not allowed");
}
return true;
}
@@ -361,33 +350,44 @@ static boolean check_expand_pars(internal_font_number f)
{
halfword t;
boolean run;
- if ((vlink(l) != null) && (type(l) == hlist_node) && (width(l) == 0)
- && (height(l) == 0) && (depth(l) == 0) && (list_ptr(l) == null)) {
- l = vlink(l); /*for paragraph start with \.{\\parindent} = 0pt */
- } else if (d) {
+ boolean done = false ;
+ while ((vlink(l) != null) && (type(l) == hlist_node) && zero_dimensions(l) && (list_ptr(l) == null)) {
+ /*for paragraph start with \.{\\parindent} = 0pt or any empty hbox */
+ l = vlink(l);
+ done = true ;
+ }
+ if ((!done) && (type(l) == local_par_node)) {
+ l = vlink(l);
+ done = true ;
+ }
+ if ((!done) && d) {
while ((vlink(l) != null) && (!(is_char_node(l) || non_discardable(l)))) {
- l = vlink(l); /* std.\ discardables at line break, \TeX book, p 95 */
+ /* std.\ discardables at line break, \TeX book, p 95 */
+ l = vlink(l);
}
}
- hlist_stack_level = 0;
- run = true;
- do {
- t = l;
- while (run && (type(l) == hlist_node) && (list_ptr(l) != null)) {
- push_node(l);
- l = list_ptr(l);
- }
- while (run && cp_skipable(l)) {
- while ((vlink(l) == null) && (hlist_stack_level > 0)) {
- l = pop_node(); /* don't visit this node again */
- run = false;
+ if (type(l) != glyph_node) {
+ hlist_stack_level = 0;
+ run = true;
+ do {
+ t = l;
+ while (run && (type(l) == hlist_node) && (list_ptr(l) != null)) {
+ push_node(l);
+ l = list_ptr(l);
}
- if (vlink(l) != null)
- l = vlink(l);
- else if (hlist_stack_level == 0)
- run = false;
- }
- } while (t != l);
+ while (run && cp_skipable(l)) {
+ while ((vlink(l) == null) && (hlist_stack_level > 0)) {
+ l = pop_node(); /* don't visit this node again */
+ run = false;
+ }
+ if (vlink(l) != null) {
+ l = vlink(l);
+ } else if (hlist_stack_level == 0) {
+ run = false;
+ }
+ }
+ } while (t != l);
+ }
return l;
}
@@ -723,11 +723,11 @@ static int line_diff; /*the difference between the current line number
#define kern_break() { \
if ((!is_char_node(vlink(cur_p))) && auto_breaking) \
if (type(vlink(cur_p))==glue_node) \
- ext_try_break(0,unhyphenated_node, line_break_dir, adjust_spacing, \
- par_shape_ptr, adj_demerits, \
- tracing_paragraphs, protrude_chars, \
- line_penalty, last_line_fit, \
- double_hyphen_demerits, final_hyphen_demerits,first_p,cur_p); \
+ ext_try_break(0,unhyphenated_node, line_break_dir, adjust_spacing, \
+ par_shape_ptr, adj_demerits, \
+ tracing_paragraphs, protrude_chars, \
+ line_penalty, last_line_fit, \
+ double_hyphen_demerits, final_hyphen_demerits,first_p,cur_p); \
if (type(cur_p)!=math_node) active_width[1]+=width(cur_p); \
else active_width[1]+=surround(cur_p); \
}
@@ -777,8 +777,7 @@ Replacement texts and discretionary texts are supposed to contain
only character nodes, kern nodes, and box or rule nodes.
@c
-static void add_to_widths(halfword s, int line_break_dir,
- int adjust_spacing, scaled * widths)
+static void add_to_widths(halfword s, int line_break_dir, int adjust_spacing, scaled * widths)
{
while (s != null) {
if (is_char_node(s)) {
@@ -795,7 +794,7 @@ static void add_to_widths(halfword s, int line_break_dir,
widths[1] += pack_width(line_break_dir, box_dir(s), s, false);
break;
case kern_node:
- if ((adjust_spacing > 1) && (subtype(s) == normal)) {
+ if ((adjust_spacing == 2) && (subtype(s) == normal)) {
add_kern_stretch(widths[8], s);
add_kern_shrink(widths[9], s);
}
@@ -806,7 +805,7 @@ static void add_to_widths(halfword s, int line_break_dir,
case disc_node: /* TH temp */
break;
default:
- confusion("add_disc_widths");
+ confusion("invalid node found in discretionary"); /* todo: report type */
}
}
s = vlink(s);
@@ -819,8 +818,7 @@ It is used only once, but deserves it own function because of orthogonality
with the |add_to_widths| function.
@c
-static void sub_from_widths(halfword s, int line_break_dir,
- int adjust_spacing, scaled * widths)
+static void sub_from_widths(halfword s, int line_break_dir, int adjust_spacing, scaled * widths)
{
while (s != null) {
/* Subtract the width of node |s| from |break_width|; */
@@ -838,7 +836,7 @@ static void sub_from_widths(halfword s, int line_break_dir,
widths[1] -= pack_width(line_break_dir, box_dir(s), s, false);
break;
case kern_node:
- if ((adjust_spacing > 1) && (subtype(s) == normal)) {
+ if ((adjust_spacing == 2) && (subtype(s) == normal)) {
sub_kern_stretch(widths[8], s);
sub_kern_shrink(widths[9], s);
}
@@ -849,7 +847,7 @@ static void sub_from_widths(halfword s, int line_break_dir,
case disc_node: /* TH temp */
break;
default:
- confusion("sub_disc_widths");
+ confusion("invalid node found in discretionary"); /* todo: report type */
break;
}
}
@@ -879,9 +877,7 @@ static void sub_from_widths(halfword s, int line_break_dir,
@c
static void
-compute_break_width(int break_type, int line_break_dir, int adjust_spacing,
- halfword p
- /*, halfword s */ )
+compute_break_width(int break_type, int line_break_dir, int adjust_spacing, halfword p)
{
halfword s; /* glue and other 'whitespace' to be skipped after a break
* used if unhyphenated, or |post_break==empty| */
@@ -914,10 +910,8 @@ compute_break_width(int break_type, int line_break_dir, int adjust_spacing,
path, as we are talking about the breaking on {\it this} position.
*/
- sub_from_widths(vlink_no_break(p), line_break_dir, adjust_spacing,
- break_width);
- add_to_widths(vlink_post_break(p), line_break_dir, adjust_spacing,
- break_width);
+ sub_from_widths(vlink_no_break(p), line_break_dir, adjust_spacing, break_width);
+ add_to_widths(vlink_post_break(p), line_break_dir, adjust_spacing, break_width);
do_one_seven_eight(add_disc_width_to_break_width);
if (vlink_post_break(p) == null) {
s = vlink(p); /* no |post_break|: 'skip' any 'whitespace' following */
@@ -927,6 +921,15 @@ compute_break_width(int break_type, int line_break_dir, int adjust_spacing,
}
while (s != null) {
switch (type(s)) {
+ case math_node:
+ /* begin mathskip code */
+ if (math_skip == zero_glue) {
+ break_width[1] -= surround(s);
+ break;
+ } else {
+ /* fall through */
+ }
+ /* end mathskip code */
case glue_node:
/*Subtract glue from |break_width|; */
{
@@ -938,9 +941,6 @@ compute_break_width(int break_type, int line_break_dir, int adjust_spacing,
break;
case penalty_node:
break;
- case math_node:
- break_width[1] -= surround(s);
- break;
case kern_node:
if (subtype(s) != explicit)
return;
@@ -1163,8 +1163,7 @@ ext_try_break(int pi,
if (no_break_yet) {
no_break_yet = false;
do_all_eight(set_break_width_to_background);
- compute_break_width(break_type, line_break_dir,
- adjust_spacing, cur_p);
+ compute_break_width(break_type, line_break_dir, adjust_spacing, cur_p);
}
/* Insert a delta node to prepare for breaks at |cur_p|; */
/* We use the fact that |type(active)<>delta_node|. */
@@ -1317,8 +1316,7 @@ ext_try_break(int pi,
o = find_protchar_right(l1, o);
}
/* now the left margin */
- if ((l1 != null) && (type(l1) == disc_node)
- && (vlink_post_break(l1) != null)) {
+ if ((l1 != null) && (type(l1) == disc_node) && (vlink_post_break(l1) != null)) {
/* FIXME: first 'char' could be a disc! */
l1 = vlink_post_break(l1); /* protrude the first char */
} else {
@@ -1326,7 +1324,7 @@ ext_try_break(int pi,
}
shortfall += (left_pw(l1) + right_pw(o));
}
- if ((shortfall != 0) && (adjust_spacing > 1)) {
+ if ((shortfall != 0) && (adjust_spacing == 2)) {
margin_kern_stretch = 0;
margin_kern_shrink = 0;
if (protrude_chars > 1) {
@@ -1345,15 +1343,13 @@ ext_try_break(int pi,
if ((shortfall > 0)
&& ((total_font_stretch + margin_kern_stretch) > 0)) {
if ((total_font_stretch + margin_kern_stretch) > shortfall)
- shortfall = ((total_font_stretch + margin_kern_stretch) /
- (max_stretch_ratio / cur_font_step)) / 2;
+ shortfall = ((total_font_stretch + margin_kern_stretch) / (max_stretch_ratio / cur_font_step)) / 2;
else
shortfall -= (total_font_stretch + margin_kern_stretch);
} else if ((shortfall < 0)
&& ((total_font_shrink + margin_kern_shrink) > 0)) {
if ((total_font_shrink + margin_kern_shrink) > -shortfall)
- shortfall = -((total_font_shrink + margin_kern_shrink) /
- (max_shrink_ratio / cur_font_step)) / 2;
+ shortfall = -((total_font_shrink + margin_kern_shrink) / (max_shrink_ratio / cur_font_step)) / 2;
else
shortfall += (total_font_shrink + margin_kern_shrink);
}
@@ -1630,10 +1626,6 @@ ext_do_line_break(int paragraph_dir,
int tolerance,
scaled emergency_stretch,
int looseness,
- /*
- int hyphen_penalty,
- int ex_hyphen_penalty,
- */
int adjust_spacing,
halfword par_shape_ptr,
int adj_demerits,
@@ -1801,9 +1793,8 @@ ext_do_line_break(int paragraph_dir,
auto_breaking = true;
cur_p = vlink(temp_head);
/* LOCAL: Initialize with first |local_paragraph| node */
- if ((cur_p != null) && (type(cur_p) == whatsit_node)
- && (subtype(cur_p) == local_par_node)) {
- alink(cur_p) = temp_head; /* this used to be an assert, but may as well force it */
+ if ((cur_p != null) && (type(cur_p) == local_par_node)) {
+ alink(cur_p) = temp_head; /* this used to be an assert, but may as well force it */
internal_pen_inter = local_pen_inter(cur_p);
internal_pen_broken = local_pen_broken(cur_p);
init_internal_left_box = local_box_left(cur_p);
@@ -1852,8 +1843,8 @@ ext_do_line_break(int paragraph_dir,
#endif
}
}
- if (cur_p == null) { /* TODO */
- confusion("linebreak_tail");
+ if (cur_p == null) {
+ normal_error("linebreak","invalid list tail, probably missing glue");
}
/* Determine legal breaks: As we move through the hlist, we need to keep
the |active_width| array up to date, so that the badness of individual
@@ -1870,33 +1861,34 @@ ext_do_line_break(int paragraph_dir,
case rule_node:
active_width[1] += width(cur_p);
break;
- case whatsit_node:
- /* Advance past a whatsit node in the |line_break| loop; */
- switch (subtype(cur_p)) {
- case local_par_node: /* LOCAL: Advance past a |local_paragraph| node; */
- internal_pen_inter = local_pen_inter(cur_p);
- internal_pen_broken = local_pen_broken(cur_p);
- internal_left_box = local_box_left(cur_p);
- internal_left_box_width = local_box_left_width(cur_p);
- internal_right_box = local_box_right(cur_p);
- internal_right_box_width = local_box_right_width(cur_p);
- break;
- case dir_node: /* DIR: Adjust the dir stack for the |line_break| routine; */
- if (dir_dir(cur_p) >= 0) {
- line_break_dir = dir_dir(cur_p);
- push_dir_node(cur_p,dir_ptr); /* adds to |dir_ptr| */
- } else {
- pop_dir_node(dir_ptr);
- if (dir_ptr != null)
- line_break_dir = dir_dir(dir_ptr);
- }
- break;
- case pdf_refxform_node:
- case pdf_refximage_node:
- active_width[1] += width(cur_p);
+ case dir_node: /* DIR: Adjust the dir stack for the |line_break| routine; */
+ if (dir_dir(cur_p) >= 0) {
+ line_break_dir = dir_dir(cur_p);
+ push_dir_node(cur_p,dir_ptr); /* adds to |dir_ptr| */
+ } else {
+ pop_dir_node(dir_ptr);
+ if (dir_ptr != null)
+ line_break_dir = dir_dir(dir_ptr);
}
- /* / Advance past a whatsit node in the |line_break| loop/; */
break;
+ case local_par_node: /* LOCAL: Advance past a |local_paragraph| node; */
+ internal_pen_inter = local_pen_inter(cur_p);
+ internal_pen_broken = local_pen_broken(cur_p);
+ internal_left_box = local_box_left(cur_p);
+ internal_left_box_width = local_box_left_width(cur_p);
+ internal_right_box = local_box_right(cur_p);
+ internal_right_box_width = local_box_right_width(cur_p);
+ break;
+ case math_node:
+ auto_breaking = (subtype(cur_p) == after);
+ /* begin mathskip code */
+ if (math_skip == zero_glue) {
+ kern_break();
+ break;
+ } else {
+ /* fall through */
+ }
+ /* end mathskip code */
case glue_node:
/* If node |cur_p| is a legal breakpoint, call |try_break|;
then update the active widths by including the glue in
@@ -1926,13 +1918,18 @@ ext_do_line_break(int paragraph_dir,
active_width[1] += width(q);
active_width[2 + stretch_order(q)] += stretch(q);
active_width[7] += shrink(q);
+ /* begin mathskip code */
+ if (type(cur_p)==math_node) {
+ active_width[1]+=surround(cur_p);
+ }
+ /* end mathskip code */
break;
case kern_node:
if (subtype(cur_p) == explicit) {
kern_break();
} else {
active_width[1] += width(cur_p);
- if ((adjust_spacing > 1) && (subtype(cur_p) == normal)) {
+ if ((adjust_spacing == 2) && (subtype(cur_p) == normal)) {
add_kern_stretch(active_width[8], cur_p);
add_kern_shrink(active_width[9], cur_p);
}
@@ -1970,8 +1967,7 @@ ext_do_line_break(int paragraph_dir,
double_hyphen_demerits,
final_hyphen_demerits, first_p, cur_p);
} else {
- add_to_widths(s, line_break_dir, adjust_spacing,
- disc_width);
+ add_to_widths(s, line_break_dir, adjust_spacing, disc_width);
do_one_seven_eight(add_disc_width_to_active_width);
ext_try_break(actual_penalty, hyphenated_node,
line_break_dir, adjust_spacing,
@@ -1990,8 +1986,7 @@ ext_do_line_break(int paragraph_dir,
assert(type(vlink(cur_p)) == disc_node &&
subtype(vlink(cur_p)) == select_disc);
s = vlink_pre_break(vlink(cur_p));
- add_to_widths(s, line_break_dir, adjust_spacing,
- disc_width);
+ add_to_widths(s, line_break_dir, adjust_spacing, disc_width);
ext_try_break(actual_penalty, hyphenated_node,
line_break_dir, adjust_spacing,
par_shape_ptr, adj_demerits,
@@ -2008,8 +2003,7 @@ ext_do_line_break(int paragraph_dir,
do_one_seven_eight(reset_disc_width);
/* add select |no_break| to |active_width| */
s = vlink_no_break(vlink(cur_p));
- add_to_widths(s, line_break_dir, adjust_spacing,
- disc_width);
+ add_to_widths(s, line_break_dir, adjust_spacing, disc_width);
ext_try_break(actual_penalty, hyphenated_node,
line_break_dir, adjust_spacing,
par_shape_ptr, adj_demerits,
@@ -2024,12 +2018,7 @@ ext_do_line_break(int paragraph_dir,
}
}
s = vlink_no_break(cur_p);
- add_to_widths(s, line_break_dir, adjust_spacing,
- active_width);
- break;
- case math_node:
- auto_breaking = (subtype(cur_p) == after);
- kern_break();
+ add_to_widths(s, line_break_dir, adjust_spacing, active_width);
break;
case penalty_node:
ext_try_break(penalty(cur_p), unhyphenated_node, line_break_dir,
@@ -2039,6 +2028,9 @@ ext_do_line_break(int paragraph_dir,
double_hyphen_demerits, final_hyphen_demerits,
first_p, cur_p);
break;
+ case boundary_node:
+ case whatsit_node:
+ /* / Advance past a whatsit node in the |line_break| loop/; */
case mark_node:
case ins_node:
case adjust_node:
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
index 030e58024f3..745a1531019 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w
@@ -436,11 +436,17 @@ void main_body(void)
while ((iloc < ilimit) && (buffer[iloc] == ' '))
incr(iloc);
}
- if (pdf_output_option != 0)
- int_par(pdf_output_code) = pdf_output_value;
- if (pdf_draftmode_option != 0)
- pdf_draftmode = static_pdf->draftmode = pdf_draftmode_value;
+ if (output_mode_option != 0)
+ int_par(output_mode_code) = output_mode_value;
+ if (draft_mode_option != 0) {
+ int_par(draft_mode_code) = draft_mode_value;
+ }
+ /* this is specific for the pdf backend */
+ if (int_par(draft_mode_code) != 0) { /* should move */
+ static_pdf->draftmode = int_par(draft_mode_code);
+ }
pdf_init_map_file((char *) pdftex_map);
+ /* */
if (end_line_char_inactive)
decr(ilimit);
else
@@ -486,14 +492,10 @@ This program doesn't bother to close the input files that may still be open.
@c
void close_files_and_terminate(void)
{
- int k; /* all-purpose index */
int callback_id;
PDF pdf = static_pdf;
callback_id = callback_defined(stop_run_callback);
- /* Finish the extensions */
- for (k = 0; k <= 15; k++)
- if (write_open[k])
- lua_a_close_out(write_file[k]);
+ finalize_write_files();
if (int_par(tracing_stats_code) > 0) {
if (callback_id == 0) {
/* Output statistics about this job */
@@ -529,24 +531,21 @@ void close_files_and_terminate(void)
}
}
wake_up_terminal();
+ /* rubish, these pdf arguments, passed, needs to be fixed, e.g. with a dummy in dvi */
ensure_output_state(pdf, ST_OMODE_FIX);
- switch (pdf->o_mode) {
+ switch (output_mode_used) {
case OMODE_NONE: /* during initex run */
break;
case OMODE_PDF:
if (history == fatal_error_stop) {
remove_pdffile(pdf);
- print_err
- (" ==> Fatal error occurred, no output PDF file produced!");
+ print_err(" ==> Fatal error occurred, no output PDF file produced!");
} else
finish_pdf_file(pdf, luatex_version, get_luatexrevision());
break;
case OMODE_DVI:
finish_dvi_file(pdf, luatex_version, get_luatexrevision());
break;
- case OMODE_LUA:
- finish_lua_file(pdf);
- break;
default:
assert(0);
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h b/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
index 192b83e1c36..ea22ff80dc7 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.h
@@ -1,5 +1,5 @@
/* maincontrol.h
-
+
Copyright 2009 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -156,8 +156,10 @@ extern void fixup_directions(void);
/* Assignments from Lua need helpers. */
# define is_int_assign(cmd) (cmd==assign_int_cmd)
+# define is_attr_assign(cmd) (cmd==assign_attr_cmd)
# define is_dim_assign(cmd) (cmd==assign_dimen_cmd)
# define is_glue_assign(cmd) (cmd==assign_glue_cmd)
+# define is_mu_glue_assign(cmd) (cmd==assign_mu_glue_cmd)
# define is_toks_assign(cmd) (cmd==assign_toks_cmd)
# define show_code 0 /* \.{\\show} */
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
index e78220d5cb8..0219320ec41 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
@@ -23,6 +23,8 @@
#include "ptexlib.h"
#include "lua/luatex-api.h"
+/* these will move to equivalents.h */
+
@ @c
#define explicit 1
#define acc_kern 2
@@ -32,7 +34,7 @@
#define tag_code 5
#define auto_kern explicit
#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
@@ -55,13 +57,9 @@
#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 pdf_h_origin dimen_par(pdf_h_origin_code)
-#define pdf_v_origin dimen_par(pdf_v_origin_code)
-#define pdf_px_dimen dimen_par(pdf_px_dimen_code)
+#define px_dimen dimen_par(px_dimen_code)
-#define pdf_image_resolution int_par(pdf_image_resolution_code)
-
-#define math_eqno_gap_step int_par(math_eqno_gap_step_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)
@@ -73,6 +71,7 @@
#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)
@@ -250,12 +249,24 @@ static void run_app_space (void) {
}
}
-@ Append a |cancel_boundary_node|
+@ Append a |boundary_node|
@c
static void run_no_boundary (void) {
- new_whatsit(cancel_boundary_node);
+ halfword n ;
+ n = new_node(boundary_node,cancel_boundary);
+ couple_nodes(tail, n);
+ tail = n;
+}
+static void run_boundary (void) {
+ halfword n ;
+ n = new_node(boundary_node,user_boundary);
+ scan_int();
+ boundary_value(n) = cur_val;
+ couple_nodes(tail, n);
+ tail = n;
}
+
@ @c
static void run_char_ghost (void) {
int t;
@@ -294,7 +305,7 @@ static void run_ignore_spaces (void) {
} else {
int t = scanner_status;
scanner_status = normal;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
scanner_status = t;
cur_cs = prim_lookup(cs_text(cur_cs));
if (cur_cs != undefined_primitive) {
@@ -627,9 +638,105 @@ static void run_after_group (void) {
@ @c
static void run_extension (void) {
- do_extension(static_pdf);
+ do_extension(0);
}
+static void run_normal (void) {
+{
+ switch (cur_chr) {
+ case save_pos_code:
+ new_whatsit(save_pos_node);
+ break;
+ case save_cat_code_table_code:
+ scan_int();
+ if ((cur_val < 0) || (cur_val > 0x7FFF)) {
+ print_err("Invalid \\catcode table");
+ help1("All \\catcode table ids must be between 0 and 0x7FFF");
+ error();
+ } else {
+ if (cur_val == cat_code_table) {
+ print_err("Invalid \\catcode table");
+ help1("You cannot overwrite the current \\catcode table");
+ error();
+ } else {
+ copy_cat_codes(cat_code_table, cur_val);
+ }
+ }
+ break;
+ case init_cat_code_table_code:
+ scan_int();
+ if ((cur_val < 0) || (cur_val > 0x7FFF)) {
+ print_err("Invalid \\catcode table");
+ help1("All \\catcode table ids must be between 0 and 0x7FFF");
+ error();
+ } else {
+ if (cur_val == cat_code_table) {
+ print_err("Invalid \\catcode table");
+ help1("You cannot overwrite the current \\catcode table");
+ error();
+ } else {
+ initex_cat_codes(cur_val);
+ }
+ }
+ break;
+ case set_random_seed_code:
+ /* Negative random seed values are silently converted to positive ones */
+ scan_int();
+ if (cur_val < 0)
+ negate(cur_val);
+ random_seed = cur_val;
+ init_randoms(random_seed);
+ break;
+ case late_lua_code:
+ new_whatsit(late_lua_node); /* type == normal */
+ late_lua_name(tail) = scan_lua_state();
+ (void) scan_toks(false, false);
+ late_lua_data(tail) = def_ref;
+ break;
+ case expand_font_code:
+ read_expand_font();
+ break;
+ default:
+ confusion("int1");
+ break;
+ }
+ }
+}
+
+/*
+ this is experimental and not used for production, only for testing and writing
+ macros
+
+*/
+
+static void run_option(void) {
+ int a = 0 ;
+ switch (cur_chr) {
+ case math_option_code:
+ if (scan_keyword("old")) {
+ scan_int();
+ word_define(int_base+math_old_code, cur_val);
+ /* math_no_char_italic = cur_val; */
+ } else if (scan_keyword("noitaliccompensation")) {
+ scan_int();
+ word_define(int_base+math_no_italic_compensation_code, cur_val);
+ /* math_no_italic_compensation = cur_val; */
+ } else if (scan_keyword("nocharitalic")) {
+ scan_int();
+ word_define(int_base+math_no_char_italic_code, cur_val);
+ /* math_no_char_italic = cur_val; */
+ } else if (scan_keyword("useoldfractionscaling")) {
+ scan_int();
+ word_define(int_base+math_use_old_fraction_scaling_code, cur_val);
+ } else {
+ normal_warning("mathoption","unknown key",false,false);
+ }
+ break;
+ default:
+ /* harmless */
+ break;
+ }
+}
@ For mode-independent commands, the following macro is useful.
@@ -657,12 +764,14 @@ static void init_main_control (void) {
jump_table[hmode + spacer_cmd] = run_app_space;
jump_table[hmode + ex_space_cmd] = run_app_space;
jump_table[mmode + ex_space_cmd] = run_app_space;
+ jump_table[hmode + boundary_cmd] = run_boundary;
jump_table[hmode + no_boundary_cmd] = run_no_boundary;
jump_table[hmode + char_ghost_cmd] = run_char_ghost;
jump_table[mmode + char_ghost_cmd] = run_char_ghost;
any_mode(relax_cmd, run_relax);
jump_table[vmode + spacer_cmd] = run_relax;
jump_table[mmode + spacer_cmd] = run_relax;
+ jump_table[mmode + boundary_cmd] = run_relax;
jump_table[mmode + no_boundary_cmd] = run_relax;
any_mode(ignore_spaces_cmd,run_ignore_spaces);
jump_table[vmode + stop_cmd] = run_stop;
@@ -705,9 +814,13 @@ static void init_main_control (void) {
jump_table[mmode + un_vbox_cmd] = insert_dollar_sign;
jump_table[mmode + valign_cmd] = insert_dollar_sign;
jump_table[mmode + hrule_cmd] = insert_dollar_sign;
+ jump_table[mmode + no_hrule_cmd] = insert_dollar_sign;
jump_table[vmode + hrule_cmd] = run_rule;
+ jump_table[vmode + no_hrule_cmd] = run_rule;
jump_table[hmode + vrule_cmd] = run_rule;
+ jump_table[hmode + no_vrule_cmd] = run_rule;
jump_table[mmode + vrule_cmd] = run_rule;
+ jump_table[mmode + no_vrule_cmd] = run_rule;
jump_table[vmode + vskip_cmd] = append_glue;
jump_table[hmode + hskip_cmd] = append_glue;
jump_table[mmode + hskip_cmd] = append_glue;
@@ -736,17 +849,20 @@ static void init_main_control (void) {
jump_table[vmode + math_shift_cs_cmd] = run_new_graf;
jump_table[vmode + un_hbox_cmd] = run_new_graf;
jump_table[vmode + vrule_cmd] = run_new_graf;
+ jump_table[vmode + no_vrule_cmd] = run_new_graf;
jump_table[vmode + accent_cmd] = run_new_graf;
jump_table[vmode + discretionary_cmd] = run_new_graf;
jump_table[vmode + hskip_cmd] = run_new_graf;
jump_table[vmode + valign_cmd] = run_new_graf;
jump_table[vmode + ex_space_cmd] = run_new_graf;
+ jump_table[vmode + boundary_cmd] = run_new_graf;
jump_table[vmode + no_boundary_cmd] = run_new_graf;
jump_table[vmode + par_end_cmd] = run_par_end_vmode;
jump_table[hmode + par_end_cmd] = run_par_end_hmode;
jump_table[hmode + stop_cmd] = head_for_vmode;
jump_table[hmode + vskip_cmd] = head_for_vmode;
jump_table[hmode + hrule_cmd] = head_for_vmode;
+ jump_table[hmode + no_hrule_cmd] = head_for_vmode;
jump_table[hmode + un_vbox_cmd] = head_for_vmode;
jump_table[hmode + halign_cmd] = head_for_vmode;
any_mode(insert_cmd,begin_insert_or_adjust);
@@ -828,7 +944,8 @@ static void init_main_control (void) {
any_mode(set_font_cmd, prefixed_command);
any_mode(def_font_cmd, prefixed_command);
any_mode(letterspace_font_cmd, prefixed_command);
- any_mode(pdf_copy_font_cmd, prefixed_command);
+ any_mode(copy_font_cmd, prefixed_command);
+ any_mode(set_font_id_cmd, prefixed_command);
any_mode(register_cmd, prefixed_command);
any_mode(advance_cmd, prefixed_command);
any_mode(multiply_cmd, prefixed_command);
@@ -847,7 +964,9 @@ static void init_main_control (void) {
any_mode(message_cmd,issue_message);
any_mode(case_shift_cmd, shift_case);
any_mode(xray_cmd, show_whatever);
+ any_mode(normal_cmd, run_normal);
any_mode(extension_cmd, run_extension);
+ any_mode(option_cmd, run_option);
}
@ And here is |main_control| itself. It is quite short nowadays.
@@ -1331,7 +1450,7 @@ void box_end(int box_context)
append_list(pre_adjust_head, pre_adjust_tail);
pre_adjust_tail = null;
}
- append_to_vlist(cur_box);
+ append_to_vlist(cur_box,lua_key_index(box));
if (adjust_tail != null) {
if (adjust_head != adjust_tail)
append_list(adjust_head, adjust_tail);
@@ -1400,8 +1519,9 @@ void scan_box(int box_context)
if (cur_cmd == make_box_cmd) {
begin_box(box_context);
- } else if ((box_context >= leader_flag)
- && ((cur_cmd == hrule_cmd) || (cur_cmd == vrule_cmd))) {
+ } else if ((box_context >= leader_flag) &&
+ ((cur_cmd == hrule_cmd) || (cur_cmd == vrule_cmd) ||
+ (cur_cmd == no_hrule_cmd) || (cur_cmd == no_vrule_cmd))) {
cur_box = scan_rule_spec();
box_end(box_context);
} else {
@@ -1432,7 +1552,7 @@ void new_graf(boolean indented)
p = new_null_box();
box_dir(p) = par_direction;
width(p) = par_indent;
- subtype(p) = HLIST_SUBTYPE_INDENT;
+ subtype(p) = indent_list;
q = tail;
tail_append(p);
} else {
@@ -1768,6 +1888,10 @@ void append_discretionary(void)
disc_penalty(tail) = int_par(ex_hyphen_penalty_code);
} else {
/* \discretionary */
+ if (scan_keyword("penalty")) {
+ scan_int();
+ disc_penalty(tail) = cur_val;
+ }
incr(save_ptr);
set_saved_record(-1, saved_disc, 0, 0);
new_save_level(disc_group);
@@ -2703,9 +2827,14 @@ void prefixed_command(void)
case letterspace_font_cmd:
new_letterspaced_font((small_number) a);
break;
- case pdf_copy_font_cmd:
+ case copy_font_cmd:
make_font_copy((small_number) a);
break;
+ case set_font_id_cmd:
+ scan_int();
+ if (is_valid_font(cur_val))
+ zset_cur_font(cur_val);
+ break ;
case set_interaction_cmd:
new_interaction();
break;
@@ -2744,7 +2873,7 @@ void fixup_directions(void)
/* DIR: Add local dir node */
tail_append(new_dir(text_direction));
- dir_dir(tail) = temporary_dir - 64;
+ dir_dir(tail) = temporary_dir - dir_swap;
}
if (temp_no_whatsits != 0) {
/* LOCAL: Add local paragraph node */
@@ -2832,14 +2961,6 @@ void assign_internal_value(int a, halfword p, int val)
word_define(p, val);
}
break;
- case pdf_compress_level_code:
- static_pdf->compress_level = val;
- word_define(p, val);
- break;
- case pdf_objcompresslevel_code:
- static_pdf->objcompresslevel = val;
- word_define(p, val);
- break;
case language_code:
if (val < 0) {
word_define(int_base + cur_lang_code, -1);
@@ -3494,9 +3615,8 @@ void initialize(void)
format_ident = 0;
format_name = get_nullstr();
- for (k = 0; k <= 17; k++)
- write_open[k] = false;
initialize_directions();
+ initialize_write_files();
seconds_and_micros(epochseconds, microseconds);
init_start_time(static_pdf);
@@ -3597,20 +3717,8 @@ void initialize(void)
cs_text(frozen_primitive) = maketexstring("primitive");
create_null_font();
font_bytes = 0;
- pdf_h_origin = one_inch;
- pdf_v_origin = one_inch;
- pdf_compress_level = 9;
- pdf_objcompresslevel = 0;
- pdf_decimal_digits = 3;
- pdf_image_resolution = 72;
- pdf_minor_version = 4;
- pdf_gamma = 1000;
- pdf_image_gamma = 2200;
- pdf_image_hicolor = 1;
- pdf_image_apply_gamma = 0;
- pdf_px_dimen = one_bp;
- pdf_draftmode = 0;
- math_eqno_gap_step = 1000 ;
+ px_dimen = one_bp;
+ math_eqno_gap_step = 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/mlist.h b/Build/source/texk/web2c/luatexdir/tex/mlist.h
index 487282ca0c7..1f6551cea69 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.h
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.h
@@ -1,5 +1,5 @@
/* mlist.h
-
+
Copyright 1996-2006 Han The Thanh <thanh@pdftex.org>
Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>
@@ -24,6 +24,9 @@
extern int cur_size;
+/* extern int math_no_italic_compensation ; */ /* $$\int\limits_{|}^{|}$$ */
+/* extern int math_no_char_italic ; */ /* catcode"1D443=12 $$P( PP$$ \catcode"1D443=11 $$P( PP$$ */
+
extern void run_mlist_to_hlist(halfword, int, boolean);
extern void fixup_math_parameters(int fam_id, int size_id, int f, int lvl);
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w
index be0cf552378..ccb882b521c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w
@@ -17,13 +17,52 @@
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
-/* hh-ls: by using couple_nodes instead of vlink we make sure that we can backtrack as well as have valid prev links */
+% (HH / 0.82+):
+@ In traditional \TeX\ the italic correction is added to the width of the glyph. This
+is part of the engine design and related font design. In opentype math this is
+different. There the italic correction had more explicit usage. The 1.7 spec
+says:
-\def\LuaTeX{Lua\TeX}
+italic correction:
+
+ When a run of slanted characters is followed by a straight character (such as
+ an operator or a delimiter), the italics correction of the last glyph is added
+ to its advance width.
+
+ When positioning limits on an N-ary operator (e.g., integral sign), the horizontal
+ position of the upper limit is moved to the right by ½ of the italics correction,
+ while the position of the lower limit is moved to the left by the same distance.
+
+ When positioning superscripts and subscripts, their default horizontal positions are
+ also different by the amount of the italics correction of the preceding glyph.
+
+math kerning:
+
+ Set the default horizontal position for the superscript as shifted relative to the
+ position of the subscript by the italics correction of the base glyph.
+
+Before this was specified we had to gamble a bit and assume that cambria was the font
+benchmark and trust our eyes (and msword) for the logic. I must admit that I have been
+fighting these italics in fonts (and the heuristics that Lua\TeX\ provided) right from
+the start (e.g. using Lua based postprocessing) but by now we know more and have more
+fonts to test with. More fonts are handy because not all fonts are alike when it comes
+to italics. Axis are another area of concern, as it looks like opentype math fonts often
+already apply that shift.
@ @c
+#define math_old int_par(math_old_code)
+#define math_no_italic_compensation int_par(math_no_italic_compensation_code)
+#define math_no_char_italic int_par(math_no_char_italic_code)
+#define math_use_old_fraction_scaling int_par(math_use_old_fraction_scaling_code)
+#define is_new_mathfont(A) ((font_math_params(A) >0) && (math_old == 0))
+#define is_old_mathfont(A,B) ((font_math_params(A)==0) && (font_params(A)>=(B)))
+
+@
+\def\LuaTeX{Lua\TeX}
+
+@ @c
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -37,48 +76,42 @@
#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 scripts_mode int_par(math_scripts_mode_code)
#define nDEBUG
-#define reset_attributes(p,newatt) do { \
- delete_attribute_ref(node_attr(p)); \
- node_attr(p) = newatt; \
- if (newatt!=null) { \
- assert(type(newatt)==attribute_list_node); \
- add_node_attr_ref(node_attr(p)); \
- } \
+#define reset_attributes(p,newatt) do { \
+ delete_attribute_ref(node_attr(p)); \
+ node_attr(p) = newatt; \
+ if (newatt!=null) { \
+ assert(type(newatt)==attribute_list_node); \
+ add_node_attr_ref(node_attr(p)); \
+ } \
} while (0)
-
-#define DEFINE_MATH_PARAMETERS(A,B,C,D) do { \
- if (B==text_size) { \
- def_math_param(A, text_style, (C),D); \
- def_math_param(A, cramped_text_style, (C),D); \
- } else if (B==script_size) { \
- def_math_param(A, script_style, (C),D); \
- def_math_param(A, cramped_script_style, (C),D); \
- } else if (B==script_script_size) { \
- def_math_param(A, script_script_style, (C),D); \
- def_math_param(A, cramped_script_script_style, (C),D); \
- } \
+#define DEFINE_MATH_PARAMETERS(A,B,C,D) do { \
+ if (B==text_size) { \
+ def_math_param(A, text_style, (C),D); \
+ def_math_param(A, cramped_text_style, (C),D); \
+ } else if (B==script_size) { \
+ def_math_param(A, script_style, (C),D); \
+ def_math_param(A, cramped_script_style, (C),D); \
+ } else if (B==script_script_size) { \
+ def_math_param(A, script_script_style, (C),D); \
+ def_math_param(A, cramped_script_script_style, (C),D); \
+ } \
} while (0)
-#define DEFINE_DMATH_PARAMETERS(A,B,C,D) do { \
- if (B==text_size) { \
- def_math_param(A, display_style,(C),D); \
- def_math_param(A, cramped_display_style,(C),D); \
- } \
+#define DEFINE_DMATH_PARAMETERS(A,B,C,D) do { \
+ if (B==text_size) { \
+ def_math_param(A, display_style,(C),D); \
+ def_math_param(A, cramped_display_style,(C),D); \
+ } \
} while (0)
-
-#define is_new_mathfont(A) (font_math_params(A)>0)
-#define is_old_mathfont(A,B) (font_math_params(A)==0 && font_params(A)>=(B))
-
-
#define font_MATH_par(a,b) \
(font_math_params(a)>=b ? font_math_param(a,b) : undefined_math_parameter)
-
@ here are the math parameters that are font-dependant
@ Before an mlist is converted to an hlist, \TeX\ makes sure that
@@ -95,24 +128,24 @@ following macros, which take a size code as their parameter; for example,
#define total_mathex_params 13
#define mathsy(A,B) font_param(fam_fnt(2,A),B)
-#define math_x_height(A) mathsy(A,5) /* height of `\.x' */
-#define math_quad(A) mathsy(A,6) /* \.{18mu} */
-#define num1(A) mathsy(A,8) /* numerator shift-up in display styles */
-#define num2(A) mathsy(A,9) /* numerator shift-up in non-display, non-\.{\\atop} */
-#define num3(A) mathsy(A,10) /* numerator shift-up in non-display \.{\\atop} */
-#define denom1(A) mathsy(A,11) /* denominator shift-down in display styles */
-#define denom2(A) mathsy(A,12) /* denominator shift-down in non-display styles */
-#define sup1(A) mathsy(A,13) /* superscript shift-up in uncramped display style */
-#define sup2(A) mathsy(A,14) /* superscript shift-up in uncramped non-display */
-#define sup3(A) mathsy(A,15) /* superscript shift-up in cramped styles */
-#define sub1(A) mathsy(A,16) /* subscript shift-down if superscript is absent */
-#define sub2(A) mathsy(A,17) /* subscript shift-down if superscript is present */
-#define sup_drop(A) mathsy(A,18) /* superscript baseline below top of large box */
-#define sub_drop(A) mathsy(A,19) /* subscript baseline below bottom of large box */
-#define delim1(A) mathsy(A,20) /* size of \.{\\atopwithdelims} delimiters in display styles */
-#define delim2(A) mathsy(A,21) /* size of \.{\\atopwithdelims} delimiters in non-displays */
-#define axis_height(A) mathsy(A,22) /* height of fraction lines above the baseline */
+#define math_x_height(A) mathsy(A,5) /* height of `\.x' */
+#define math_quad(A) mathsy(A,6) /* \.{18mu} */
+#define num1(A) mathsy(A,8) /* numerator shift-up in display styles */
+#define num2(A) mathsy(A,9) /* numerator shift-up in non-display, non-\.{\\atop} */
+#define num3(A) mathsy(A,10) /* numerator shift-up in non-display \.{\\atop} */
+#define denom1(A) mathsy(A,11) /* denominator shift-down in display styles */
+#define denom2(A) mathsy(A,12) /* denominator shift-down in non-display styles */
+#define sup1(A) mathsy(A,13) /* superscript shift-up in uncramped display style */
+#define sup2(A) mathsy(A,14) /* superscript shift-up in uncramped non-display */
+#define sup3(A) mathsy(A,15) /* superscript shift-up in cramped styles */
+#define sub1(A) mathsy(A,16) /* subscript shift-down if superscript is absent */
+#define sub2(A) mathsy(A,17) /* subscript shift-down if superscript is present */
+#define sup_drop(A) mathsy(A,18) /* superscript baseline below top of large box */
+#define sub_drop(A) mathsy(A,19) /* subscript baseline below bottom of large box */
+#define delim1(A) mathsy(A,20) /* size of \.{\\atopwithdelims} delimiters in display styles */
+#define delim2(A) mathsy(A,21) /* size of \.{\\atopwithdelims} delimiters in non-displays */
+#define axis_height(A) mathsy(A,22) /* height of fraction lines above the baseline */
@ The math-extension parameters have similar macros, but the size code is
omitted (since it is always |cur_size| when we refer to such parameters).
@@ -150,13 +183,7 @@ FlattenedAccentBaseHeight:
needs support for MathTopAccentAttachment table to be
implemented first
-SkewedFractionHorizontalGap,
-SkewedFractionVerticalGap:
- I am not sure it makes sense implementing skewed fractions,
- so I would like to see an example first
-
Also still TODO for OpenType Math:
- * extensible large operators
* prescripts
@ this is not really a math parameter at all
@@ -181,7 +208,6 @@ static void math_param_error(const char *param, int style)
return;
}
-
@ @c
static scaled accent_base_height(int f)
{
@@ -210,7 +236,7 @@ scaled get_math_quad(int var)
}
@ this parameter is different because it is called with a size
- specifier instead of a style specifier.
+specifier instead of a style specifier.
@c
static scaled math_axis(int b)
@@ -244,7 +270,6 @@ static scaled get_math_quad_size(int b)
return get_math_param(math_param_quad, var);
}
-
@ @c
static scaled minimum_operator_size(int var)
{
@@ -253,7 +278,7 @@ static scaled minimum_operator_size(int var)
}
@ Old-style fonts do not define the |radical_rule|. This allows |make_radical| to select
- the backward compatibility code, and it means that we can't raise an error here.
+the backward compatibility code, and it means that we can't raise an error here.
@c
static scaled radical_rule(int var)
@@ -277,6 +302,30 @@ static scaled do_get_math_param_or_error(int var, int param, const char *name)
return a;
}
+@ A variant on a suggestion on the list based on analysis by UV.
+
+@c
+static scaled get_delimiter_height(scaled max_d, scaled max_h, boolean axis) {
+ scaled delta, delta1, delta2;
+ if (axis) {
+ delta2 = max_d + math_axis(cur_size);
+ } else {
+ delta2 = max_d;
+ }
+ delta1 = max_h + max_d - delta2;
+ if (delta2 > delta1) {
+ /* |delta1| is max distance from axis */
+ delta1 = delta2;
+ }
+ delta = (delta1 / 500) * delimiter_factor;
+ delta2 = delta1 + delta1 - delimiter_shortfall;
+ if (delta < delta2) {
+ return delta2;
+ } else {
+ return delta;
+ }
+}
+
@ @c
#define radical_degree_before(a) get_math_param_or_error(a, radical_degree_before)
#define radical_degree_after(a) get_math_param_or_error(a, radical_degree_after)
@@ -310,7 +359,11 @@ static scaled do_get_math_param_or_error(int var, int param, const char *name)
#define fraction_denom_vgap(a) get_math_param_or_error(a, fraction_denom_vgap)
#define fraction_num_up(a) get_math_param_or_error(a, fraction_num_up)
#define fraction_denom_down(a) get_math_param_or_error(a, fraction_denom_down)
-#define fraction_del_size(a) get_math_param_or_error(a, fraction_del_size)
+#define fraction_del_size_new(a) get_math_param_or_error(a, fraction_del_size)
+#define fraction_del_size_old(a) get_math_param(a, math_param_fraction_del_size)
+
+#define skewed_fraction_hgap(a) get_math_param_or_error(a, skewed_fraction_hgap)
+#define skewed_fraction_vgap(a) get_math_param_or_error(a, skewed_fraction_vgap)
#define limit_above_vgap(a) get_math_param_or_error(a, limit_above_vgap)
#define limit_above_bgap(a) get_math_param_or_error(a, limit_above_bgap)
@@ -337,494 +390,482 @@ void fixup_math_parameters(int fam_id, int size_id, int f, int lvl)
{
if (is_new_mathfont(f)) { /* fix all known parameters */
- DEFINE_MATH_PARAMETERS(math_param_quad, size_id, font_size(f), lvl);
- DEFINE_DMATH_PARAMETERS(math_param_quad, size_id, font_size(f), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_quad, size_id,
+ font_size(f), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_quad, size_id,
+ font_size(f), lvl);
DEFINE_MATH_PARAMETERS(math_param_axis, size_id,
- font_MATH_par(f, AxisHeight), lvl);
+ font_MATH_par(f, AxisHeight), lvl);
DEFINE_DMATH_PARAMETERS(math_param_axis, size_id,
- font_MATH_par(f, AxisHeight), lvl);
+ font_MATH_par(f, AxisHeight), lvl);
DEFINE_MATH_PARAMETERS(math_param_overbar_kern, size_id,
- font_MATH_par(f, OverbarExtraAscender), lvl);
+ font_MATH_par(f, OverbarExtraAscender), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_kern, size_id,
- font_MATH_par(f, OverbarExtraAscender), lvl);
+ font_MATH_par(f, OverbarExtraAscender), lvl);
DEFINE_MATH_PARAMETERS(math_param_overbar_rule, size_id,
- font_MATH_par(f, OverbarRuleThickness), lvl);
+ font_MATH_par(f, OverbarRuleThickness), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_rule, size_id,
- font_MATH_par(f, OverbarRuleThickness), lvl);
+ font_MATH_par(f, OverbarRuleThickness), lvl);
DEFINE_MATH_PARAMETERS(math_param_overbar_vgap, size_id,
- font_MATH_par(f, OverbarVerticalGap), lvl);
+ font_MATH_par(f, OverbarVerticalGap), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_vgap, size_id,
- font_MATH_par(f, OverbarVerticalGap), lvl);
+ font_MATH_par(f, OverbarVerticalGap), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_kern, size_id,
- font_MATH_par(f, UnderbarExtraDescender), lvl);
+ font_MATH_par(f, UnderbarExtraDescender), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_kern, size_id,
- font_MATH_par(f, UnderbarExtraDescender), lvl);
+ font_MATH_par(f, UnderbarExtraDescender), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_rule, size_id,
- font_MATH_par(f, UnderbarRuleThickness), lvl);
+ font_MATH_par(f, UnderbarRuleThickness), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_rule, size_id,
- font_MATH_par(f, UnderbarRuleThickness), lvl);
+ font_MATH_par(f, UnderbarRuleThickness), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_vgap, size_id,
- font_MATH_par(f, UnderbarVerticalGap), lvl);
+ font_MATH_par(f, UnderbarVerticalGap), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_vgap, size_id,
- font_MATH_par(f, UnderbarVerticalGap), lvl);
+ font_MATH_par(f, UnderbarVerticalGap), lvl);
DEFINE_MATH_PARAMETERS(math_param_under_delimiter_vgap, size_id,
- font_MATH_par(f, StretchStackGapAboveMin), lvl);
+ font_MATH_par(f, StretchStackGapAboveMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_under_delimiter_vgap, size_id,
- font_MATH_par(f, StretchStackGapAboveMin), lvl);
+ font_MATH_par(f, StretchStackGapAboveMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_under_delimiter_bgap, size_id,
- font_MATH_par(f, StretchStackBottomShiftDown),
- lvl);
+ font_MATH_par(f, StretchStackBottomShiftDown), lvl);
DEFINE_DMATH_PARAMETERS(math_param_under_delimiter_bgap, size_id,
- font_MATH_par(f, StretchStackBottomShiftDown),
- lvl);
+ font_MATH_par(f, StretchStackBottomShiftDown), lvl);
DEFINE_MATH_PARAMETERS(math_param_over_delimiter_vgap, size_id,
- font_MATH_par(f, StretchStackGapBelowMin), lvl);
+ font_MATH_par(f, StretchStackGapBelowMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_over_delimiter_vgap, size_id,
- font_MATH_par(f, StretchStackGapBelowMin), lvl);
+ font_MATH_par(f, StretchStackGapBelowMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_over_delimiter_bgap, size_id,
- font_MATH_par(f, StretchStackTopShiftUp), lvl);
+ font_MATH_par(f, StretchStackTopShiftUp), lvl);
DEFINE_DMATH_PARAMETERS(math_param_over_delimiter_bgap, size_id,
- font_MATH_par(f, StretchStackTopShiftUp), lvl);
-
+ font_MATH_par(f, StretchStackTopShiftUp), lvl);
DEFINE_MATH_PARAMETERS(math_param_stack_num_up, size_id,
- font_MATH_par(f, StackTopShiftUp), lvl);
+ font_MATH_par(f, StackTopShiftUp), lvl);
DEFINE_DMATH_PARAMETERS(math_param_stack_num_up, size_id,
- font_MATH_par(f, StackTopDisplayStyleShiftUp),
- lvl);
+ font_MATH_par(f, StackTopDisplayStyleShiftUp), lvl);
DEFINE_MATH_PARAMETERS(math_param_stack_denom_down, size_id,
- font_MATH_par(f, StackBottomShiftDown), lvl);
+ font_MATH_par(f, StackBottomShiftDown), lvl);
DEFINE_DMATH_PARAMETERS(math_param_stack_denom_down, size_id,
- font_MATH_par(f,
- StackBottomDisplayStyleShiftDown),
- lvl);
+ font_MATH_par(f, StackBottomDisplayStyleShiftDown), lvl);
DEFINE_MATH_PARAMETERS(math_param_stack_vgap, size_id,
- font_MATH_par(f, StackGapMin), lvl);
+ font_MATH_par(f, StackGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_stack_vgap, size_id,
- font_MATH_par(f, StackDisplayStyleGapMin), lvl);
+ font_MATH_par(f, StackDisplayStyleGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_kern, size_id,
- font_MATH_par(f, RadicalExtraAscender), lvl);
+ font_MATH_par(f, RadicalExtraAscender), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_kern, size_id,
- font_MATH_par(f, RadicalExtraAscender), lvl);
+ font_MATH_par(f, RadicalExtraAscender), lvl);
DEFINE_DMATH_PARAMETERS(math_param_operator_size, size_id,
- font_MATH_par(f, DisplayOperatorMinHeight),
- lvl);
+ font_MATH_par(f, DisplayOperatorMinHeight), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_rule, size_id,
- font_MATH_par(f, RadicalRuleThickness), lvl);
+ font_MATH_par(f, RadicalRuleThickness), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_rule, size_id,
- font_MATH_par(f, RadicalRuleThickness), lvl);
+ font_MATH_par(f, RadicalRuleThickness), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_vgap, size_id,
- font_MATH_par(f, RadicalVerticalGap), lvl);
+ font_MATH_par(f, RadicalVerticalGap), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id,
- font_MATH_par(f,
- RadicalDisplayStyleVerticalGap),
- lvl);
+ font_MATH_par(f, RadicalDisplayStyleVerticalGap), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_before, size_id,
- font_MATH_par(f, RadicalKernBeforeDegree), lvl);
+ font_MATH_par(f, RadicalKernBeforeDegree), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_before, size_id,
- font_MATH_par(f, RadicalKernBeforeDegree), lvl);
+ font_MATH_par(f, RadicalKernBeforeDegree), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_after, size_id,
- font_MATH_par(f, RadicalKernAfterDegree), lvl);
+ font_MATH_par(f, RadicalKernAfterDegree), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_after, size_id,
- font_MATH_par(f, RadicalKernAfterDegree), lvl);
+ font_MATH_par(f, RadicalKernAfterDegree), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, size_id,
- font_MATH_par(f,
- RadicalDegreeBottomRaisePercent),
- lvl);
+ font_MATH_par(f, RadicalDegreeBottomRaisePercent), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_raise, size_id,
- font_MATH_par(f,
- RadicalDegreeBottomRaisePercent),
- lvl);
+ font_MATH_par(f, RadicalDegreeBottomRaisePercent), lvl);
+
if (size_id == text_size) {
def_math_param(math_param_sup_shift_up, display_style,
- font_MATH_par(f, SuperscriptShiftUp), lvl);
+ font_MATH_par(f, SuperscriptShiftUp), lvl);
def_math_param(math_param_sup_shift_up, cramped_display_style,
- font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
+ font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
def_math_param(math_param_sup_shift_up, text_style,
- font_MATH_par(f, SuperscriptShiftUp), lvl);
+ font_MATH_par(f, SuperscriptShiftUp), lvl);
def_math_param(math_param_sup_shift_up, cramped_text_style,
- font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
+ font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
} else if (size_id == script_size) {
def_math_param(math_param_sup_shift_up, script_style,
- font_MATH_par(f, SuperscriptShiftUp), lvl);
+ font_MATH_par(f, SuperscriptShiftUp), lvl);
def_math_param(math_param_sup_shift_up, cramped_script_style,
- font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
+ font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
} else if (size_id == script_script_size) {
def_math_param(math_param_sup_shift_up, script_script_style,
- font_MATH_par(f, SuperscriptShiftUp), lvl);
+ font_MATH_par(f, SuperscriptShiftUp), lvl);
def_math_param(math_param_sup_shift_up, cramped_script_script_style,
- font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
+ font_MATH_par(f, SuperscriptShiftUpCramped), lvl);
}
DEFINE_MATH_PARAMETERS(math_param_sub_shift_drop, size_id,
- font_MATH_par(f, SubscriptBaselineDropMin), lvl);
+ font_MATH_par(f, SubscriptBaselineDropMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_shift_drop, size_id,
- font_MATH_par(f, SubscriptBaselineDropMin),
- lvl);
+ font_MATH_par(f, SubscriptBaselineDropMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_sup_shift_drop, size_id,
- font_MATH_par(f, SuperscriptBaselineDropMax),
- lvl);
+ font_MATH_par(f, SuperscriptBaselineDropMax), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sup_shift_drop, size_id,
- font_MATH_par(f, SuperscriptBaselineDropMax),
- lvl);
+ font_MATH_par(f, SuperscriptBaselineDropMax), lvl);
DEFINE_MATH_PARAMETERS(math_param_sub_shift_down, size_id,
- font_MATH_par(f, SubscriptShiftDown), lvl);
+ font_MATH_par(f, SubscriptShiftDown), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_shift_down, size_id,
- font_MATH_par(f, SubscriptShiftDown), lvl);
+ font_MATH_par(f, SubscriptShiftDown), lvl);
- if (font_MATH_par(f, SubscriptShiftDownWithSuperscript) !=
- undefined_math_parameter) {
+ if (font_MATH_par(f, SubscriptShiftDownWithSuperscript) != undefined_math_parameter) {
DEFINE_MATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- font_MATH_par(f,
- SubscriptShiftDownWithSuperscript),
- lvl);
+ font_MATH_par(f, SubscriptShiftDownWithSuperscript), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- font_MATH_par(f,
- SubscriptShiftDownWithSuperscript),
- lvl);
+ font_MATH_par(f, SubscriptShiftDownWithSuperscript), lvl);
} else {
DEFINE_MATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- font_MATH_par(f, SubscriptShiftDown), lvl);
+ font_MATH_par(f, SubscriptShiftDown), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- font_MATH_par(f, SubscriptShiftDown), lvl);
+ font_MATH_par(f, SubscriptShiftDown), lvl);
}
DEFINE_MATH_PARAMETERS(math_param_sub_top_max, size_id,
- font_MATH_par(f, SubscriptTopMax), lvl);
+ font_MATH_par(f, SubscriptTopMax), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_top_max, size_id,
- font_MATH_par(f, SubscriptTopMax), lvl);
+ font_MATH_par(f, SubscriptTopMax), lvl);
DEFINE_MATH_PARAMETERS(math_param_sup_bottom_min, size_id,
- font_MATH_par(f, SuperscriptBottomMin), lvl);
+ font_MATH_par(f, SuperscriptBottomMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sup_bottom_min, size_id,
- font_MATH_par(f, SuperscriptBottomMin), lvl);
+ font_MATH_par(f, SuperscriptBottomMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_sup_sub_bottom_max, size_id,
- font_MATH_par(f,
- SuperscriptBottomMaxWithSubscript),
- lvl);
+ font_MATH_par(f, SuperscriptBottomMaxWithSubscript), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sup_sub_bottom_max, size_id,
- font_MATH_par(f,
- SuperscriptBottomMaxWithSubscript),
- lvl);
+ font_MATH_par(f, SuperscriptBottomMaxWithSubscript), lvl);
DEFINE_MATH_PARAMETERS(math_param_subsup_vgap, size_id,
- font_MATH_par(f, SubSuperscriptGapMin), lvl);
+ font_MATH_par(f, SubSuperscriptGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_subsup_vgap, size_id,
- font_MATH_par(f, SubSuperscriptGapMin), lvl);
+ font_MATH_par(f, SubSuperscriptGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_above_vgap, size_id,
- font_MATH_par(f, UpperLimitGapMin), lvl);
+ font_MATH_par(f, UpperLimitGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_above_vgap, size_id,
- font_MATH_par(f, UpperLimitGapMin), lvl);
+ font_MATH_par(f, UpperLimitGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_above_bgap, size_id,
- font_MATH_par(f, UpperLimitBaselineRiseMin),
- lvl);
+ font_MATH_par(f, UpperLimitBaselineRiseMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_above_bgap, size_id,
- font_MATH_par(f, UpperLimitBaselineRiseMin),
- lvl);
- DEFINE_MATH_PARAMETERS(math_param_limit_above_kern, size_id, 0, lvl);
- DEFINE_DMATH_PARAMETERS(math_param_limit_above_kern, size_id, 0, lvl);
+ font_MATH_par(f, UpperLimitBaselineRiseMin), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_limit_above_kern, size_id,
+ 0, lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_limit_above_kern, size_id,
+ 0, lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_below_vgap, size_id,
- font_MATH_par(f, LowerLimitGapMin), lvl);
+ font_MATH_par(f, LowerLimitGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_below_vgap, size_id,
- font_MATH_par(f, LowerLimitGapMin), lvl);
+ font_MATH_par(f, LowerLimitGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_below_bgap, size_id,
- font_MATH_par(f, LowerLimitBaselineDropMin),
- lvl);
+ font_MATH_par(f, LowerLimitBaselineDropMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_below_bgap, size_id,
- font_MATH_par(f, LowerLimitBaselineDropMin),
- lvl);
- DEFINE_MATH_PARAMETERS(math_param_limit_below_kern, size_id, 0, lvl);
- DEFINE_DMATH_PARAMETERS(math_param_limit_below_kern, size_id, 0, lvl);
+ font_MATH_par(f, LowerLimitBaselineDropMin), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_limit_below_kern, size_id,
+ 0, lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_limit_below_kern, size_id,
+ 0, lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_rule, size_id,
- font_MATH_par(f, FractionRuleThickness), lvl);
+ font_MATH_par(f, FractionRuleThickness), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_rule, size_id,
- font_MATH_par(f, FractionRuleThickness), lvl);
+ font_MATH_par(f, FractionRuleThickness), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_num_vgap, size_id,
- font_MATH_par(f, FractionNumeratorGapMin), lvl);
+ font_MATH_par(f, FractionNumeratorGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_num_vgap, size_id,
- font_MATH_par(f,
- FractionNumeratorDisplayStyleGapMin),
- lvl);
+ font_MATH_par(f, FractionNumeratorDisplayStyleGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_num_up, size_id,
- font_MATH_par(f, FractionNumeratorShiftUp), lvl);
+ font_MATH_par(f, FractionNumeratorShiftUp), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_num_up, size_id,
- font_MATH_par(f,
- FractionNumeratorDisplayStyleShiftUp),
- lvl);
+ font_MATH_par(f, FractionNumeratorDisplayStyleShiftUp), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_denom_vgap, size_id,
- font_MATH_par(f, FractionDenominatorGapMin),
- lvl);
+ font_MATH_par(f, FractionDenominatorGapMin), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_denom_vgap, size_id,
- font_MATH_par(f,
- FractionDenominatorDisplayStyleGapMin),
- lvl);
+ font_MATH_par(f,FractionDenominatorDisplayStyleGapMin), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_denom_down, size_id,
- font_MATH_par(f, FractionDenominatorShiftDown),
- lvl);
+ font_MATH_par(f, FractionDenominatorShiftDown), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_denom_down, size_id,
- font_MATH_par(f,
- FractionDenominatorDisplayStyleShiftDown),
- lvl);
+ font_MATH_par(f, FractionDenominatorDisplayStyleShiftDown), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_del_size, size_id,
- font_MATH_par(f, FractionDelimiterSize), lvl);
+ font_MATH_par(f, FractionDelimiterSize), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_del_size, size_id,
- font_MATH_par(f,
- FractionDelimiterDisplayStyleSize),
- lvl);
+ font_MATH_par(f, FractionDelimiterDisplayStyleSize), lvl);
+
+ DEFINE_MATH_PARAMETERS(math_param_skewed_fraction_hgap, size_id,
+ font_MATH_par(f, SkewedFractionHorizontalGap), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_skewed_fraction_hgap, size_id,
+ font_MATH_par(f, SkewedFractionHorizontalGap), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_skewed_fraction_vgap, size_id,
+ font_MATH_par(f, SkewedFractionVerticalGap), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_skewed_fraction_vgap, size_id,
+ font_MATH_par(f, SkewedFractionVerticalGap), lvl);
DEFINE_MATH_PARAMETERS(math_param_space_after_script, size_id,
- font_MATH_par(f, SpaceAfterScript), lvl);
+ font_MATH_par(f, SpaceAfterScript), lvl);
DEFINE_DMATH_PARAMETERS(math_param_space_after_script, size_id,
- font_MATH_par(f, SpaceAfterScript), lvl);
+ font_MATH_par(f, SpaceAfterScript), lvl);
DEFINE_MATH_PARAMETERS(math_param_connector_overlap_min, size_id,
- font_MATH_par(f, MinConnectorOverlap), lvl);
+ font_MATH_par(f, MinConnectorOverlap), lvl);
DEFINE_DMATH_PARAMETERS(math_param_connector_overlap_min, size_id,
- font_MATH_par(f, MinConnectorOverlap), lvl);
-
+ font_MATH_par(f, MinConnectorOverlap), lvl);
} else if (fam_id == 2 && is_old_mathfont(f, total_mathsy_params)) {
+
/* fix old-style |sy| parameters */
- DEFINE_MATH_PARAMETERS(math_param_quad, size_id, math_quad(size_id),
- lvl);
- DEFINE_DMATH_PARAMETERS(math_param_quad, size_id, math_quad(size_id),
- lvl);
- DEFINE_MATH_PARAMETERS(math_param_axis, size_id, axis_height(size_id),
- lvl);
- DEFINE_DMATH_PARAMETERS(math_param_axis, size_id, axis_height(size_id),
- lvl);
- DEFINE_MATH_PARAMETERS(math_param_stack_num_up, size_id, num3(size_id),
- lvl);
- DEFINE_DMATH_PARAMETERS(math_param_stack_num_up, size_id, num1(size_id),
- lvl);
+
+ DEFINE_MATH_PARAMETERS(math_param_quad, size_id,
+ math_quad(size_id), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_quad, size_id,
+ math_quad(size_id), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_axis, size_id,
+ axis_height(size_id), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_axis, size_id,
+ axis_height(size_id), lvl);
+ DEFINE_MATH_PARAMETERS(math_param_stack_num_up, size_id,
+ num3(size_id), lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_stack_num_up, size_id,
+ num1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_stack_denom_down, size_id,
- denom2(size_id), lvl);
+ denom2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_stack_denom_down, size_id,
- denom1(size_id), lvl);
+ denom1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_num_up, size_id,
- num2(size_id), lvl);
+ num2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_num_up, size_id,
- num1(size_id), lvl);
+ num1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_denom_down, size_id,
- denom2(size_id), lvl);
+ denom2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_denom_down, size_id,
- denom1(size_id), lvl);
+ denom1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_del_size, size_id,
- delim2(size_id), lvl);
+ delim2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_del_size, size_id,
- delim1(size_id), lvl);
+ delim1(size_id), lvl);
+
+ DEFINE_MATH_PARAMETERS(math_param_skewed_fraction_hgap, size_id,
+ 0, lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_skewed_fraction_hgap, size_id,
+ 0, lvl);
+ DEFINE_MATH_PARAMETERS(math_param_skewed_fraction_vgap, size_id,
+ 0, lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_skewed_fraction_vgap, size_id,
+ 0, lvl);
+
if (size_id == text_size) {
def_math_param(math_param_sup_shift_up, display_style,
- sup1(size_id), lvl);
+ sup1(size_id), lvl);
def_math_param(math_param_sup_shift_up, cramped_display_style,
- sup3(size_id), lvl);
- def_math_param(math_param_sup_shift_up, text_style, sup2(size_id),
- lvl);
+ sup3(size_id), lvl);
+ def_math_param(math_param_sup_shift_up, text_style,
+ sup2(size_id), lvl);
def_math_param(math_param_sup_shift_up, cramped_text_style,
- sup3(size_id), lvl);
+ sup3(size_id), lvl);
} else if (size_id == script_size) {
def_math_param(math_param_sub_shift_drop, display_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop, cramped_display_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop, text_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop, cramped_text_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, display_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, cramped_display_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, text_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, cramped_text_style,
- sup_drop(size_id), lvl);
- def_math_param(math_param_sup_shift_up, script_style, sup2(size_id),
- lvl);
+ sup_drop(size_id), lvl);
+ def_math_param(math_param_sup_shift_up, script_style,
+ sup2(size_id), lvl);
def_math_param(math_param_sup_shift_up, cramped_script_style,
- sup3(size_id), lvl);
+ sup3(size_id), lvl);
} else if (size_id == script_script_size) {
def_math_param(math_param_sub_shift_drop, script_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop, cramped_script_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop, script_script_style,
- sub_drop(size_id), lvl);
+ sub_drop(size_id), lvl);
def_math_param(math_param_sub_shift_drop,
- cramped_script_script_style, sub_drop(size_id), lvl);
+ cramped_script_script_style, sub_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, script_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, cramped_script_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop, script_script_style,
- sup_drop(size_id), lvl);
+ sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_drop,
- cramped_script_script_style, sup_drop(size_id), lvl);
+ cramped_script_script_style, sup_drop(size_id), lvl);
def_math_param(math_param_sup_shift_up, script_script_style,
- sup2(size_id), lvl);
+ sup2(size_id), lvl);
def_math_param(math_param_sup_shift_up, cramped_script_script_style,
- sup3(size_id), lvl);
+ sup3(size_id), lvl);
}
+
DEFINE_MATH_PARAMETERS(math_param_sub_shift_down, size_id,
- sub1(size_id), lvl);
+ sub1(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_shift_down, size_id,
- sub1(size_id), lvl);
+ sub1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- sub2(size_id), lvl);
+ sub2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_sup_shift_down, size_id,
- sub2(size_id), lvl);
+ sub2(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_sub_top_max, size_id,
- (abs(math_x_height(size_id) * 4) / 5), lvl);
+ (abs(math_x_height(size_id) * 4) / 5), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sub_top_max, size_id,
- (abs(math_x_height(size_id) * 4) / 5), lvl);
+ (abs(math_x_height(size_id) * 4) / 5), lvl);
DEFINE_MATH_PARAMETERS(math_param_sup_bottom_min, size_id,
- (abs(math_x_height(size_id)) / 4), lvl);
+ (abs(math_x_height(size_id)) / 4), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sup_bottom_min, size_id,
- (abs(math_x_height(size_id)) / 4), lvl);
+ (abs(math_x_height(size_id)) / 4), lvl);
DEFINE_MATH_PARAMETERS(math_param_sup_sub_bottom_max, size_id,
- (abs(math_x_height(size_id) * 4) / 5), lvl);
+ (abs(math_x_height(size_id) * 4) / 5), lvl);
DEFINE_DMATH_PARAMETERS(math_param_sup_sub_bottom_max, size_id,
- (abs(math_x_height(size_id) * 4) / 5), lvl);
+ (abs(math_x_height(size_id) * 4) / 5), lvl);
- /* The display-size |radical_vgap| is done twice because it needs
- values from both the sy and the ex font. */
- DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id,
- (default_rule_thickness(size_id) +
- (abs(math_x_height(size_id)) / 4)), lvl);
+ /*
+ The display-size |radical_vgap| is done twice because it needs
+ values from both the sy and the ex font.
+ */
+ DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id,
+ (default_rule_thickness(size_id) + (abs(math_x_height(size_id)) / 4)), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_raise, size_id,
- 60, lvl);
+ 60, lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_raise, size_id,
- 60, lvl);
+ 60, lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_before, size_id,
- xn_over_d(get_math_quad_size(size_id), 5, 18),
- lvl);
+ xn_over_d(get_math_quad_size(size_id), 5, 18), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_before, size_id,
- xn_over_d(get_math_quad_size(size_id), 5, 18),
- lvl);
+ xn_over_d(get_math_quad_size(size_id), 5, 18), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_degree_after, size_id,
- (-xn_over_d
- (get_math_quad_size(size_id), 10, 18)), lvl);
+ (-xn_over_d (get_math_quad_size(size_id), 10, 18)), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_degree_after, size_id,
- (-xn_over_d
- (get_math_quad_size(size_id), 10, 18)), lvl);
+ (-xn_over_d (get_math_quad_size(size_id), 10, 18)), lvl);
} else if (fam_id == 3 && is_old_mathfont(f, total_mathex_params)) {
+
/* fix old-style |ex| parameters */
+
DEFINE_MATH_PARAMETERS(math_param_overbar_kern, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_overbar_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_overbar_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_kern, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_overbar_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_kern, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_underbar_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_kern, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_underbar_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_kern, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_radical_kern, size_id,
- default_rule_thickness(size_id), lvl);
-
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_radical_vgap, size_id,
- (default_rule_thickness(size_id) +
- (abs(default_rule_thickness(size_id)) / 4)),
- lvl);
-
+ (default_rule_thickness(size_id) + (abs(default_rule_thickness(size_id)) / 4)), lvl);
DEFINE_MATH_PARAMETERS(math_param_stack_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_stack_vgap, size_id,
- 7 * default_rule_thickness(size_id), lvl);
+ 7 * default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_rule, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_num_vgap, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_num_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_fraction_denom_vgap, size_id,
- default_rule_thickness(size_id), lvl);
+ default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_fraction_denom_vgap, size_id,
- 3 * default_rule_thickness(size_id), lvl);
+ 3 * default_rule_thickness(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_above_vgap, size_id,
- big_op_spacing1(size_id), lvl);
+ big_op_spacing1(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_above_vgap, size_id,
- big_op_spacing1(size_id), lvl);
+ big_op_spacing1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_above_bgap, size_id,
- big_op_spacing3(size_id), lvl);
+ big_op_spacing3(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_above_bgap, size_id,
- big_op_spacing3(size_id), lvl);
+ big_op_spacing3(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_above_kern, size_id,
- big_op_spacing5(size_id), lvl);
+ big_op_spacing5(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_above_kern, size_id,
- big_op_spacing5(size_id), lvl);
+ big_op_spacing5(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_below_vgap, size_id,
- big_op_spacing2(size_id), lvl);
+ big_op_spacing2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_below_vgap, size_id,
- big_op_spacing2(size_id), lvl);
+ big_op_spacing2(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_below_bgap, size_id,
- big_op_spacing4(size_id), lvl);
+ big_op_spacing4(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_below_bgap, size_id,
- big_op_spacing4(size_id), lvl);
+ big_op_spacing4(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_limit_below_kern, size_id,
- big_op_spacing5(size_id), lvl);
+ big_op_spacing5(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_limit_below_kern, size_id,
- big_op_spacing5(size_id), lvl);
+ big_op_spacing5(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_subsup_vgap, size_id,
- 4 * default_rule_thickness(size_id), lvl);
+ 4 * default_rule_thickness(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_subsup_vgap, size_id,
- 4 * default_rule_thickness(size_id), lvl);
- /* All of the |space_after_script|s are done in |finalize_math_parameters| because the
- \.{\\scriptspace} may have been altered by the user
- */
- DEFINE_MATH_PARAMETERS(math_param_connector_overlap_min, size_id, 0,
- lvl);
- DEFINE_DMATH_PARAMETERS(math_param_connector_overlap_min, size_id, 0,
- lvl);
+ 4 * default_rule_thickness(size_id), lvl);
+
+ /*
+ All of the |space_after_script|s are done in |finalize_math_parameters|
+ because the \.{\\scriptspace} may have been altered by the user
+ */
+
+ DEFINE_MATH_PARAMETERS(math_param_connector_overlap_min, size_id,
+ 0, lvl);
+ DEFINE_DMATH_PARAMETERS(math_param_connector_overlap_min, size_id,
+ 0, lvl);
DEFINE_MATH_PARAMETERS(math_param_under_delimiter_vgap, size_id,
- big_op_spacing2(size_id), lvl);
+ big_op_spacing2(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_under_delimiter_vgap, size_id,
- big_op_spacing2(size_id), lvl);
+ big_op_spacing2(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_under_delimiter_bgap, size_id,
- big_op_spacing4(size_id), lvl);
+ big_op_spacing4(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_under_delimiter_bgap, size_id,
- big_op_spacing4(size_id), lvl);
+ big_op_spacing4(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_over_delimiter_vgap, size_id,
- big_op_spacing1(size_id), lvl);
+ big_op_spacing1(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_over_delimiter_vgap, size_id,
- big_op_spacing1(size_id), lvl);
+ big_op_spacing1(size_id), lvl);
DEFINE_MATH_PARAMETERS(math_param_over_delimiter_bgap, size_id,
- big_op_spacing3(size_id), lvl);
+ big_op_spacing3(size_id), lvl);
DEFINE_DMATH_PARAMETERS(math_param_over_delimiter_bgap, size_id,
- big_op_spacing3(size_id), lvl);
+ big_op_spacing3(size_id), lvl);
+
+ /*
+ The display-size |radical_vgap| is done twice because it needs
+ values from both the sy and the ex font.
+ */
- /* The display-size |radical_vgap| is done twice because it needs
- values from both the sy and the ex font. */
DEFINE_DMATH_PARAMETERS(math_param_radical_vgap, size_id,
- (default_rule_thickness(size_id) +
- (abs(math_x_height(size_id)) / 4)), lvl);
+ (default_rule_thickness(size_id) + (abs(math_x_height(size_id)) / 4)), lvl);
+
}
}
@@ -836,30 +877,27 @@ static void finalize_math_parameters(void)
{
int saved_trace = int_par(tracing_assigns_code);
int_par(tracing_assigns_code) = 0;
- if (get_math_param(math_param_space_after_script, display_style) ==
- undefined_math_parameter) {
+ 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, level_one);
def_math_param(math_param_space_after_script, text_style,
- script_space, level_one);
+ script_space, level_one);
def_math_param(math_param_space_after_script, script_style,
- script_space, level_one);
+ script_space, level_one);
def_math_param(math_param_space_after_script, script_script_style,
- script_space, level_one);
+ script_space, level_one);
def_math_param(math_param_space_after_script, cramped_display_style,
- script_space, level_one);
+ script_space, level_one);
def_math_param(math_param_space_after_script, cramped_text_style,
- script_space, level_one);
+ script_space, level_one);
def_math_param(math_param_space_after_script, cramped_script_style,
- script_space, level_one);
- def_math_param(math_param_space_after_script,
- cramped_script_script_style, script_space, level_one);
+ script_space, level_one);
+ def_math_param(math_param_space_after_script, cramped_script_script_style,
+ script_space, level_one);
}
int_par(tracing_assigns_code) = saved_trace;
-
}
-
@ In order to convert mlists to hlists, i.e., noads to nodes, we need several
subroutines that are conveniently dealt with now.
@@ -884,14 +922,14 @@ static const char *math_size_string(int s)
information:
@c
-#define setup_cur_size(a) do { \
- if (a==script_style || \
- a==cramped_script_style) \
- cur_size=script_size; \
- else if (a==script_script_style || \
- a==cramped_script_script_style) \
- cur_size=script_script_size; \
- else cur_size=text_size; \
+#define setup_cur_size(a) do { \
+ if (a==script_style || \
+ a==cramped_script_style) \
+ cur_size=script_size; \
+ else if (a==script_script_style || \
+ a==cramped_script_script_style) \
+ cur_size=script_script_size; \
+ else cur_size=text_size; \
} while (0)
@@ -913,9 +951,6 @@ static pointer math_clone(pointer q)
return x;
}
-
-
-
@ Here is a function that returns a pointer to a rule node having a given
thickness |t|. The rule will extend horizontally to the boundary of the vlist
that eventually contains it.
@@ -924,7 +959,7 @@ static pointer math_clone(pointer q)
static pointer do_fraction_rule(scaled t, pointer att)
{
pointer p; /* the new node */
- p = new_rule();
+ p = new_rule(normal_rule);
rule_dir(p) = math_direction;
height(p) = t;
depth(p) = 0;
@@ -932,8 +967,7 @@ static pointer do_fraction_rule(scaled t, pointer att)
return p;
}
-
-@ The |overbar| function returns a pointer to a vlist box that consists of
+@ The |overbar| function returns a pointer to a vlist box that consists of
a given box |b|, above which has been placed a kern of height |k| under a
fraction rule of thickness |t| under additional space of height |ht|.
@@ -942,8 +976,8 @@ static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att)
{
pointer p, q; /* nodes being constructed */
p = new_kern(k);
- couple_nodes(p,b);
reset_attributes(p, att);
+ couple_nodes(p,b);
q = do_fraction_rule(t, att);
couple_nodes(q,p);
p = new_kern(ht);
@@ -955,17 +989,20 @@ static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att)
}
@ Here is a subroutine that creates a new box, whose list contains a
- single character, and whose width includes the italic correction for
- that character. The height or depth of the box will be negative, if
- the height or depth of the character is negative; thus, this routine
- may deliver a slightly different result than |hpack| would produce.
+single character, and whose width includes the italic correction for
+that character. The height or depth of the box will be negative, if
+the height or depth of the character is negative; thus, this routine
+may deliver a slightly different result than |hpack| would produce.
@c
static pointer char_box(internal_font_number f, int c, pointer bb)
{
- pointer b, p; /* the new box and its character node */
+ pointer b, p; /* the new box and its character node */
b = new_null_box();
- width(b) = char_width(f, c) + char_italic(f, c);
+ if (is_new_mathfont(f))
+ width(b) = char_width(f, c);
+ else
+ width(b) = char_width(f, c) + char_italic(f, c);
height(b) = char_height(f, c);
depth(b) = char_depth(f, c);
reset_attributes(b, bb);
@@ -976,7 +1013,7 @@ static pointer char_box(internal_font_number f, int c, pointer bb)
}
@ Another handy subroutine computes the height plus depth of
- a given character:
+ a given character:
@c
static scaled height_plus_depth(internal_font_number f, int c)
@@ -984,19 +1021,17 @@ static scaled height_plus_depth(internal_font_number f, int c)
return (char_height(f, c) + char_depth(f, c));
}
-
-@ When we build an extensible character, it's handy to have the
+@ When we build an extensible character, it's handy to have the
following subroutine, which puts a given character on top
of the characters already in box |b|:
@c
static scaled stack_into_box(pointer b, internal_font_number f, int c)
{
- pointer p, q; /* new node placed into |b| */
- p = char_box(f, c, node_attr(b));
+ pointer p, q; /* new node placed into |b| */
+ p = char_box(f, c, node_attr(b)); /* italic gets added to width */
if (type(b) == vlist_node) {
-// vlink(p) = list_ptr(b);
-try_couple_nodes(p,list_ptr(b));
+ try_couple_nodes(p,list_ptr(b));
list_ptr(b) = p;
height(b) = height(p);
if (width(b) < width(p))
@@ -1019,7 +1054,6 @@ try_couple_nodes(p,list_ptr(b));
}
}
-
static void stack_glue_into_box(pointer b, scaled min, scaled max) {
pointer p, q; /* new node placed into |b| */
q = new_spec(zero_glue);
@@ -1059,11 +1093,11 @@ static void stack_glue_into_box(pointer b, scaled min, scaled max) {
@^recursion@>
@c
-int cur_size; /* size code corresponding to |cur_style| */
+int cur_size; /* size code corresponding to |cur_style| */
@ @c
-static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
- pointer att, int boxtype, int cur_style)
+static pointer get_delim_box(pointer q, extinfo * ext, internal_font_number f, scaled v,
+ pointer att, int cur_style, int boxtype)
{
pointer b; /* new box */
scaled b_max; /* natural (maximum) size of the stack */
@@ -1131,28 +1165,31 @@ static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
num_normal = 1;
num_extenders--;
}
- /* |ext| holds a linked list of numerous items that may or may not be
- repeatable. For the total height, we have to figure out how many items
- are needed to create a stack of at least |v|.
- The next |while| loop does that. It has two goals: it finds out
- the natural height |b_max| of the all the parts needed to reach
- at least |v|, and it sets |with_extenders| to the number of times
- each of the repeatable items in |ext| has to be repeated to reach
- that height.
- */
+ /*
+ |ext| holds a linked list of numerous items that may or may not be
+ repeatable. For the total height, we have to figure out how many items
+ are needed to create a stack of at least |v|.
+
+ The next |while| loop does that. It has two goals: it finds out
+ the natural height |b_max| of the all the parts needed to reach
+ at least |v|, and it sets |with_extenders| to the number of times
+ each of the repeatable items in |ext| has to be repeated to reach
+ that height.
+
+ */
cur = ext;
b_max = 0;
while (b_max < v && num_extenders > 0) {
b_max = 0;
- prev_overlap = 0;
+ prev_overlap = 0;
with_extenders++;
for (cur = ext; cur != NULL; cur = cur->next) {
- if (cur->extender == 0) {
- c = cur->start_overlap;
- if (min_overlap < c)
- c = min_overlap;
- if (prev_overlap < c)
- c = prev_overlap;
+ if (cur->extender == 0) {
+ c = cur->start_overlap;
+ if (min_overlap < c)
+ c = min_overlap;
+ if (prev_overlap < c)
+ c = prev_overlap;
a = cur->advance;
if (a == 0) {
/* for tfm fonts */
@@ -1162,16 +1199,16 @@ static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
a = char_width(f, cur->glyph);
assert(a >= 0);
}
- b_max += a - c;
- prev_overlap = cur->end_overlap;
- } else {
- i = with_extenders;
- while (i > 0) {
- c = cur->start_overlap;
- if (min_overlap < c)
- c = min_overlap;
- if (prev_overlap < c)
- c = prev_overlap;
+ b_max += a - c;
+ prev_overlap = cur->end_overlap;
+ } else {
+ i = with_extenders;
+ while (i > 0) {
+ c = cur->start_overlap;
+ if (min_overlap < c)
+ c = min_overlap;
+ if (prev_overlap < c)
+ c = prev_overlap;
a = cur->advance;
if (a == 0) {
/* for tfm fonts */
@@ -1181,57 +1218,60 @@ static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
a = char_width(f, cur->glyph);
assert(a >= 0);
}
- b_max += a - c;
- prev_overlap = cur->end_overlap;
- i--;
- }
- }
- }
+ b_max += a - c;
+ prev_overlap = cur->end_overlap;
+ i--;
+ }
+ }
+ }
}
- /* assemble box using |with_extenders| copies of each extender, with
- appropriate glue wherever an overlap occurs */
+ /*
+ assemble box using |with_extenders| copies of each extender, with
+ appropriate glue wherever an overlap occurs
+ */
prev_overlap = 0;
b_max = 0;
s_max = 0;
for (cur = ext; cur != NULL; cur = cur->next) {
if (cur->extender == 0) {
- c = cur->start_overlap;
- if (prev_overlap < c)
- c = prev_overlap;
- d = c;
- if (min_overlap < c)
- c = min_overlap;
- if (d > 0) {
- stack_glue_into_box(b, -d, -c);
- s_max += (-c) - (-d);
- b_max -= d;
- }
+ c = cur->start_overlap;
+ if (prev_overlap < c)
+ c = prev_overlap;
+ d = c;
+ if (min_overlap < c)
+ c = min_overlap;
+ if (d > 0) {
+ stack_glue_into_box(b, -d, -c);
+ s_max += (-c) - (-d);
+ b_max -= d;
+ }
b_max += stack_into_box(b, f, cur->glyph);
- prev_overlap = cur->end_overlap;
- i--;
- } else {
- i = with_extenders;
- while (i > 0) {
- c = cur->start_overlap;
- if (prev_overlap < c)
- c = prev_overlap;
- d = c;
- if (min_overlap < c)
- c = min_overlap;
- if (d > 0) {
- stack_glue_into_box(b, -d, -c);
- s_max += (-c) - (-d);
- b_max -= d;
- }
+ prev_overlap = cur->end_overlap;
+ i--;
+ } else {
+ i = with_extenders;
+ while (i > 0) {
+ c = cur->start_overlap;
+ if (prev_overlap < c)
+ c = prev_overlap;
+ d = c;
+ if (min_overlap < c)
+ c = min_overlap;
+ if (d > 0) {
+ stack_glue_into_box(b, -d, -c);
+ s_max += (-c) - (-d);
+ b_max -= d;
+ }
b_max += stack_into_box(b, f, cur->glyph);
- prev_overlap = cur->end_overlap;
- i--;
- }
- }
+ prev_overlap = cur->end_overlap;
+ i--;
+ }
+ }
}
/* set glue so as to stretch the connections if needed */
+
d = 0;
if (v > b_max && s_max > 0) {
d = v-b_max;
@@ -1244,29 +1284,16 @@ static pointer get_delim_box(extinfo * ext, internal_font_number f, scaled v,
b_max += d;
}
- if (boxtype == vlist_node)
+ if (boxtype == vlist_node) {
height(b) = b_max;
- else
+ } else {
width(b) = b_max;
+ }
return b;
}
-static pointer get_delim_vbox(extinfo * ext, internal_font_number f, scaled v,
- pointer att, int cur_style)
-{
- return get_delim_box(ext, f, v, att, vlist_node, cur_style);
-}
-
-static pointer get_delim_hbox(extinfo * ext, internal_font_number f, scaled v,
- pointer att, int cur_style)
-{
- return get_delim_box(ext, f, v, att, hlist_node, cur_style);
-}
-
-
-
-@ The |var_delimiter| function, which finds or constructs a sufficiently
+@ The |var_delimiter| function, which finds or constructs a sufficiently
large delimiter, is the most interesting of the auxiliary functions that
currently concern us. Given a pointer |d| to a delimiter field in some noad,
together with a size code |s| and a vertical distance |v|, this function
@@ -1288,7 +1315,7 @@ static void endless_loop_error(internal_font_number g, int y)
const char *hlp[] = {
"You managed to create a seemingly endless charlist chain in the current",
"font. I have counted until 10000 already and still have not escaped, so"
- "I will jump out of the loop all by myself now. Fix your font!",
+ "I will jump out of the loop all by myself now. Fix your font!",
NULL
};
snprintf(s, 256, "Math error: endless loop in charlist (U+%04x in %s)",
@@ -1296,10 +1323,8 @@ static void endless_loop_error(internal_font_number g, int y)
tex_error(s, hlp);
}
-static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
- boolean flat, int cur_style)
+static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat, int cur_style, boolean shift, boolean *stack, scaled *delta)
{
- /* label found,continue; */
pointer b; /* the box that will be constructed */
internal_font_number f, g; /* best-so-far and tentative font codes */
int c, i, x, y; /* best-so-far and tentative character codes */
@@ -1322,9 +1347,11 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
x = small_char(d);
i = 0;
while (true) {
- /* The search process is complicated slightly by the facts that some of the
- characters might not be present in some of the fonts, and they might not
- be probed in increasing order of height. */
+ /*
+ The search process is complicated slightly by the facts that some of the
+ characters might not be present in some of the fonts, and they might not
+ be probed in increasing order of height.
+ */
if ((z != 0) || (x != 0)) {
g = fam_fnt(z, s);
if (g != null_font) {
@@ -1362,7 +1389,7 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
}
}
if (large_attempt)
- goto FOUND; /* there were none large enough */
+ goto FOUND; /* there were none large enough */
large_attempt = true;
z = large_fam(d);
x = large_char(d);
@@ -1374,60 +1401,65 @@ static pointer do_var_delimiter(pointer d, int s, scaled v, scaled * ic,
flush_node(d);
}
if (f != null_font) {
- /* When the following code is executed, |do_parts| will be true
- if a built-up symbol is supposed to be returned.
- */
+ /*
+ When the following code is executed, |do_parts| will be true
+ if a built-up symbol is supposed to be returned.
+ */
ext = NULL;
- if ((do_parts) &&
- ((!flat
- && (ext = get_charinfo_vert_variants(char_info(f, c))) != NULL)
- || (flat
- && (ext =
- get_charinfo_hor_variants(char_info(f, c))) != NULL))) {
- b = (flat ? get_delim_hbox(ext, f, v, att, cur_style) :
- get_delim_vbox(ext, f, v, att, cur_style));
+ if ((do_parts) && ((!flat && (ext = get_charinfo_vert_variants(char_info(f,c))) != NULL)
+ || ( flat && (ext = get_charinfo_hor_variants (char_info(f,c))) != NULL))) {
+ if (flat) {
+ b = get_delim_box(d, ext, f, v, att, cur_style, hlist_node);
+ } else {
+ b = get_delim_box(d, ext, f, v, att, cur_style, vlist_node);
+ }
+ if (delta != NULL) {
+ if (is_new_mathfont(f)) {
+ *delta = char_vert_italic(f,x);
+ } else {
+ *delta = char_italic(f,x);
+ }
+ }
+ if (stack != NULL)
+ *stack = true ;
} else {
b = char_box(f, c, att);
+ if (!is_new_mathfont(f)) {
+ /* italic gets added to width */
+ width(b) += char_italic(f, c);
+ }
+ if (delta != NULL) {
+ *delta = char_italic(f,x);
+ }
+ if (stack != NULL)
+ *stack = false ;
}
- /* This next test is because for OT MATH fonts, the italic correction of an
- extensible character is only used for the placement of a subscript
- (in negated form), and it is not supposed to be added to the
- width of the character box at all.
-
- This has an effect later on in |make_op| as well, where it has to do
- an extra correction for |make_script|'s addition of yet another italic
- correction.
- */
- if (!is_new_mathfont(f)) {
- width(b) += char_italic(f, c);
- }
- if (ic != NULL)
- *ic = char_italic(f, c);
} else {
b = new_null_box();
reset_attributes(b, att);
- width(b) = (flat ? 0 : null_delimiter_space); /* use this width if no delimiter was found */
- if (ic != NULL)
- *ic = 0;
+ if (flat) {
+ width(b) = 0;
+ } else {
+ /* use this width if no delimiter was found */
+ width(b) = null_delimiter_space;
+ }
+ if (delta != NULL) {
+ *delta = 0;
+ }
+ if (stack != NULL)
+ *stack = false ;
+ }
+ if (!flat) {
+ /* vertical variant */
+ shift_amount(b) = half(height(b) - depth(b));
+ if (shift) {
+ shift_amount(b) -= math_axis(s);
+ }
}
- if (!flat)
- shift_amount(b) = half(height(b) - depth(b)) - math_axis(s);
delete_attribute_ref(att);
return b;
}
-
-static pointer var_delimiter(pointer d, int s, scaled v, scaled * ic,
- int cur_style)
-{
- return do_var_delimiter(d, s, v, ic, false, cur_style);
-}
-
-static pointer flat_delimiter(pointer d, int s, scaled v, int cur_style)
-{
- return do_var_delimiter(d, s, v, NULL, true, cur_style);
-}
-
@ The next subroutine is much simpler; it is used for numerators and
denominators of fractions as well as for displayed operators and
their limits above and below. It takes a given box~|b| and
@@ -1437,7 +1469,6 @@ of the list inside |b|, then packaging the new box; thus, the
actual box might not really be centered, if it already contains
infinite glue.
-
The given box might contain a single character whose italic correction
has been added to the width of the box; in this case a compensating
kern is inserted.
@@ -1495,9 +1526,9 @@ one that is expressed in `\.{mu}', given the value of the math unit.
static pointer math_glue(pointer g, scaled m)
{
- pointer p; /* the new glue specification */
- int n; /* integer part of |m| */
- scaled f; /* fraction part of |m| */
+ pointer p; /* the new glue specification */
+ int n; /* integer part of |m| */
+ scaled f; /* fraction part of |m| */
n = x_over_n(m, unity);
f = tex_remainder;
if (f < 0) {
@@ -1505,7 +1536,7 @@ static pointer math_glue(pointer g, scaled m)
f = f + unity;
}
p = new_node(glue_spec_node, 0);
- width(p) = mu_mult(width(g)); /* convert \.{mu} to \.{pt} */
+ width(p) = mu_mult(width(g)); /* convert \.{mu} to \.{pt} */
stretch_order(p) = stretch_order(g);
if (stretch_order(p) == normal)
stretch(p) = mu_mult(stretch(g));
@@ -1525,8 +1556,8 @@ the value of the math unit.
@c
static void math_kern(pointer p, scaled m)
{
- int n; /* integer part of |m| */
- scaled f; /* fraction part of |m| */
+ int n; /* integer part of |m| */
+ scaled f; /* fraction part of |m| */
if (subtype(p) == mu_glue) {
n = x_over_n(m, unity);
f = tex_remainder;
@@ -1558,17 +1589,19 @@ void run_mlist_to_hlist(halfword p, int mstyle, boolean penalties)
return;
}
alink(p) = null ;
- nodelist_to_lua(L, p); /* arg 1 */
- lua_pushstring(L, math_style_names[mstyle]); /* arg 2 */
- lua_pushboolean(L, penalties); /* arg 3 */
- if (lua_pcall(L, 3, 1, 0) != 0) { /* 3 args, 1 result */
- fprintf(stdout, "error: %s\n", lua_tostring(L, -1));
+ nodelist_to_lua(L, p); /* arg 1 */
+ lua_pushstring(L, math_style_names[mstyle]); /* arg 2 */
+ lua_pushboolean(L, penalties); /* arg 3 */
+ if (lua_pcall(L, 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));
+ errmsg[255]='\0';
lua_settop(L, sfix);
- error();
+ normal_error("mlist to hlist",errmsg); /* to be done */
return;
}
a = nodelist_from_lua(L);
- /* alink(vlink(a)) = null; */ /* hh-ls: not need to null here */
+ /* alink(vlink(a)) = null; */
lua_settop(L, sfix);
vlink(temp_head) = a;
} else if (callback_id == 0) {
@@ -1584,17 +1617,16 @@ math style; |mlist_to_hlist| can call |clean_box|, which can call
|mlist_to_hlist|.
@^recursion@>
-
The box returned by |clean_box| is ``clean'' in the
sense that its |shift_amount| is zero.
@c
static pointer clean_box(pointer p, int s, int cur_style)
{
- pointer q; /* beginning of a list to be boxed */
- pointer x; /* box to be returned */
- pointer r; /* temporary pointer */
- pointer mlist = null; /* beginning of mlist to be translated */
+ pointer q; /* beginning of a list to be boxed */
+ pointer x; /* box to be returned */
+ pointer r; /* temporary pointer */
+ pointer mlist = null; /* beginning of mlist to be translated */
switch (type(p)) {
case math_char_node:
mlist = new_noad();
@@ -1613,14 +1645,13 @@ static pointer clean_box(pointer p, int s, int cur_style)
goto FOUND;
}
mlist_to_hlist_args(mlist, s, false);
- q = vlink(temp_head); /* recursive call */
+ q = vlink(temp_head); /* recursive call */
setup_cur_size(cur_style);
FOUND:
if (is_char_node(q) || (q == null))
x = hpack(q, 0, additional, -1);
- else if ((vlink(q) == null) && (type(q) <= vlist_node)
- && (shift_amount(q) == 0))
- x = q; /* it's already clean */
+ else if ((vlink(q) == null) && (type(q) <= vlist_node) && (shift_amount(q) == 0))
+ x = q; /* it's already clean */
else
x = hpack(q, 0, additional, -1);
if (x != q && q != null)
@@ -1654,11 +1685,13 @@ after |fetch| has acted, and the field will also have been reset to |null|.
The outputs of |fetch| are placed in global variables.
@c
-internal_font_number cur_f; /* the |font| field of a |math_char| */
-int cur_c; /* the |character| field of a |math_char| */
+internal_font_number cur_f; /* the |font| field of a |math_char| */
+int cur_c; /* the |character| field of a |math_char| */
+
+@ Here we unpack the |math_char| field |a|.
-static void fetch(pointer a)
-{ /* unpack the |math_char| field |a| */
+@c static void fetch(pointer a)
+{
cur_c = math_character(a);
cur_f = fam_fnt(math_fam(a), cur_size);
if (cur_f == null_font) {
@@ -1675,14 +1708,11 @@ static void fetch(pointer a)
math_size_string(cur_size), (int) math_fam(a), (int) cur_c);
tex_error(msg, hlp);
free(msg);
- } else {
- if (!(char_exists(cur_f, cur_c))) {
- char_warning(cur_f, cur_c);
- }
+ } else if (!(char_exists(cur_f, cur_c))) {
+ char_warning(cur_f, cur_c);
}
}
-
@ We need to do a lot of different things, so |mlist_to_hlist| makes two
passes over the given mlist.
@@ -1727,20 +1757,17 @@ static void assign_new_hlist(pointer q, pointer r)
@ @c
#define choose_mlist(A) do { p=A(q); A(q)=null; } while (0)
-
@ Most of the actual construction work of |mlist_to_hlist| is done
-by procedures with names
-like |make_fraction|, |make_radical|, etc. To illustrate
-the general setup of such procedures, let's begin with a couple of
-simple ones.
+by procedures with names like |make_fraction|, |make_radical|, etc. To
+illustrate the general setup of such procedures, let's begin with a
+couple of simple ones.
@c
static void make_over(pointer q, int cur_style)
{
pointer p;
p = overbar(clean_box(nucleus(q), cramped_style(cur_style), cur_style),
- overbar_vgap(cur_style),
- overbar_rule(cur_style),
+ overbar_vgap(cur_style), overbar_rule(cur_style),
overbar_kern(cur_style), node_attr(nucleus(q)));
math_list(nucleus(q)) = p;
type(nucleus(q)) = sub_box_node;
@@ -1771,7 +1798,7 @@ static void make_vcenter(pointer q)
scaled delta; /* its height plus depth */
v = math_list(nucleus(q));
if (type(v) != vlist_node)
- confusion("vcenter"); /* this can't happen vcenter */
+ confusion("vcenter");
delta = height(v) + depth(v);
height(v) = math_axis(cur_size) + half(delta);
depth(v) = delta - height(v);
@@ -1787,36 +1814,69 @@ of the nucleus plus a certain minimum clearance~|psi|. The symbol will be
placed so that the actual clearance is |psi| plus half the excess.
@c
+static void make_hextension(pointer q, int cur_style)
+{
+ pointer e, p;
+ halfword w;
+ boolean stack = false;
+ e = do_delimiter(q, left_delimiter(q), cur_size, radicalwidth(q), true, cur_style, true, &stack, NULL);
+ w = width(e);
+ if (!stack&& (radicalwidth(q) != 0) && (radicalwidth(q) != width(e))) {
+ if (radicalmiddle(q)) {
+ p = new_kern(half(radicalwidth(q)-w));
+ reset_attributes(p, node_attr(q));
+ couple_nodes(p,e);
+ e = p;
+ w = radicalwidth(q);
+ } else if (radicalexact(q)) {
+ w = radicalwidth(q);
+ }
+ }
+ e = hpack(e, 0, additional, -1);
+ width(e) = w ;
+ reset_attributes(e, node_attr(q));
+ math_list(nucleus(q)) = e;
+ left_delimiter(q) = null;
+}
+
static void make_radical(pointer q, int cur_style)
{
- pointer x, y, p; /* temporary registers for box construction */
- scaled delta, clr, theta, h; /* dimensions involved in the calculation */
+ pointer x, y, p, l1, l2; /* temporary registers for box construction */
+ scaled delta, clr, theta, h; /* dimensions involved in the calculation */
x = clean_box(nucleus(q), cramped_style(cur_style), cur_style);
clr = radical_vgap(cur_style);
theta = radical_rule(cur_style);
if (theta == undefined_math_parameter) {
+ /* a real radical */
theta = fraction_rule(cur_style);
- y = var_delimiter(left_delimiter(q), cur_size,
- height(x) + depth(x) + clr + theta, NULL, cur_style);
- /* If |y| is a composite then set |theta| to the height of its top
- character, else set it to the height of |y|. */
- if (list_ptr(y) != null
- && type(list_ptr(y)) == hlist_node
- && list_ptr(list_ptr(y)) != null
- && type(list_ptr(list_ptr(y))) == glyph_node) { /* and it should be */
- theta = char_height(font(list_ptr(list_ptr(y))),
- character(list_ptr(list_ptr(y))));
+ y = do_delimiter(q, left_delimiter(q), cur_size, height(x) + depth(x) + clr + theta, false, cur_style, true, NULL, NULL);
+ /*
+ If |y| is a composite then set |theta| to the height of its top
+ character, else set it to the height of |y|.
+ */
+ l1 = list_ptr(y);
+ if ((l1 != null) && (type(l1) == hlist_node)) {
+ /* possible composite */
+ l2 = list_ptr(l1);
+ if ((l2 != null) && (type(l2) == glyph_node)) {
+ /* top character */
+ theta = char_height(font(l2), character(l2));
+ } else {
+ theta = height(y);
+ }
} else {
theta = height(y);
}
} else {
- y = var_delimiter(left_delimiter(q), cur_size,
- height(x) + depth(x) + clr + theta, NULL, cur_style);
+ /* not really a radical but we use its node, historical sharing (like in mathml) */
+ y = do_delimiter(q, left_delimiter(q), cur_size, height(x) + depth(x) + clr + theta, false, cur_style, true, NULL, NULL);
}
left_delimiter(q) = null;
delta = (depth(y) + height(y) - theta) - (height(x) + depth(x) + clr);
- if (delta > 0)
- clr = clr + half(delta); /* increase the actual clearance */
+ if (delta > 0) {
+ /* increase the actual clearance */
+ clr = clr + half(delta);
+ }
shift_amount(y) = (height(y) - theta) - (height(x) + clr);
h = depth(y) + height(y);
p = overbar(x, clr, theta, radical_kern(cur_style), node_attr(y));
@@ -1845,7 +1905,8 @@ static void make_radical(pointer q, int cur_style)
couple_nodes(x,r);
y = x;
}
- math_list(degree(q)) = null; /* for \.{\\Uroot ..{<list>}{}} */
+ /* for \.{\\Uroot ..{<list>}{}} : */
+ math_list(degree(q)) = null;
flush_node(degree(q));
}
p = hpack(y, 0, additional, -1);
@@ -1854,14 +1915,12 @@ static void make_radical(pointer q, int cur_style)
type(nucleus(q)) = sub_box_node;
}
-
@ Construct a vlist box
+
@c
-static pointer
-wrapup_delimiter(pointer x, pointer y, pointer q,
- scaled shift_up, scaled shift_down)
+static pointer wrapup_over_under_delimiter(pointer x, pointer y, pointer q, scaled shift_up, scaled shift_down)
{
- pointer p; /* temporary register for box construction */
+ pointer p; /* temporary register for box construction */
pointer v = new_null_box();
type(v) = vlist_node;
height(v) = shift_up + height(x);
@@ -1875,26 +1934,72 @@ wrapup_delimiter(pointer x, pointer y, pointer q,
return v;
}
+/* when exact use radicalwidth (y is delimiter) */
+
@ @c
-#define fixup_widths(x,y) do { \
- if (width(y) >= width(x)) { \
- width(x) = width(y); \
- } else { \
- width(y) = width(x); \
- } \
- } while (0)
+
+#define fixup_widths(q,x,y) do { \
+ if (width(y) >= width(x)) { \
+ if (radicalwidth(q) != zero_glue) { \
+ shift_amount(x) += half(width(y)-width(x)) ; \
+ } \
+ width(x) = width(y); \
+ } else { \
+ if (radicalwidth(q) != zero_glue) { \
+ shift_amount(y) += half(width(x)-width(y)) ; \
+ } \
+ width(y) = width(x); \
+ } \
+} while (0)
+
+
+#define check_radical(q,stack,r,t) do { \
+ if (!stack && (width(r) >= width(t)) && (radicalwidth(q) != zero_glue) && (radicalwidth(q) != width(r))) { \
+ if (radicalleft(q)) { \
+ halfword p = new_kern(radicalwidth(q)-width(r)); \
+ reset_attributes(p, node_attr(q)); \
+ couple_nodes(p,r); \
+ r = hpack(p, 0, additional, -1); \
+ width(r) = radicalwidth(q); \
+ reset_attributes(r, node_attr(q)); \
+ } else if (radicalmiddle(q)) { \
+ halfword p = new_kern(half(radicalwidth(q)-width(r))); \
+ reset_attributes(p, node_attr(q)); \
+ couple_nodes(p,r); \
+ r = hpack(p, 0, additional, -1); \
+ width(r) = radicalwidth(q); \
+ reset_attributes(r, node_attr(q)); \
+ } else if (radicalright(q)) { \
+ /* also kind of exact compared to vertical */ \
+ r = hpack(r, 0, additional, -1); \
+ width(r) = radicalwidth(q); \
+ reset_attributes(r, node_attr(q)); \
+ } \
+ } \
+} while (0)
+
+#define check_widths(q,p) do { \
+ if (radicalwidth(q) != zero_glue) { \
+ wd = radicalwidth(q); \
+ } else { \
+ wd = width(p); \
+ } \
+} while (0)
@ this has the |nucleus| box |x| as a limit above an extensible delimiter |y|
@c
static void make_over_delimiter(pointer q, int cur_style)
{
- pointer x, y, v; /* temporary registers for box construction */
- scaled shift_up, shift_down, clr, delta;
+ pointer x, y, v; /* temporary registers for box construction */
+ scaled shift_up, shift_down, clr, delta, wd;
+ boolean stack;
x = clean_box(nucleus(q), sub_style(cur_style), cur_style);
- y = flat_delimiter(left_delimiter(q), cur_size, width(x), cur_style);
+ check_widths(q,x);
+ y = do_delimiter(q, left_delimiter(q), cur_size, wd, true, cur_style, true, &stack, NULL);
left_delimiter(q) = null;
- fixup_widths(x, y);
+ check_radical(q,stack,y,x);
+ fixup_widths(q, x, y);
shift_up = over_delimiter_bgap(cur_style);
shift_down = 0;
clr = over_delimiter_vgap(cur_style);
@@ -1902,8 +2007,35 @@ static void make_over_delimiter(pointer q, int cur_style)
if (delta > 0) {
shift_up = shift_up + delta;
}
- v = wrapup_delimiter(x, y, q, shift_up, shift_down);
- width(v) = width(x); /* this also equals |width(y)| */
+ v = wrapup_over_under_delimiter(x, y, q, shift_up, shift_down);
+ width(v) = width(x); /* this also equals |width(y)| */
+ math_list(nucleus(q)) = v;
+ type(nucleus(q)) = sub_box_node;
+}
+
+@ this has the extensible delimiter |x| as a limit below |nucleus| box |y|
+
+@c
+static void make_under_delimiter(pointer q, int cur_style)
+{
+ pointer x, y, v; /* temporary registers for box construction */
+ scaled shift_up, shift_down, clr, delta, wd;
+ boolean stack;
+ y = clean_box(nucleus(q), sup_style(cur_style), cur_style);
+ check_widths(q,y);
+ x = do_delimiter(q, left_delimiter(q), cur_size, wd, true, cur_style, true, &stack, NULL);
+ left_delimiter(q) = null;
+ check_radical(q,stack,x,y);
+ fixup_widths(q, x, y);
+ shift_up = 0;
+ shift_down = under_delimiter_bgap(cur_style);
+ clr = under_delimiter_vgap(cur_style);
+ delta = clr - ((shift_up - depth(x)) - (height(y) - shift_down));
+ if (delta > 0) {
+ shift_down = shift_down + delta;
+ }
+ v = wrapup_over_under_delimiter(x, y, q, shift_up, shift_down);
+ width(v) = width(y); /* this also equals |width(y)| */
math_list(nucleus(q)) = v;
type(nucleus(q)) = sub_box_node;
}
@@ -1913,14 +2045,15 @@ static void make_over_delimiter(pointer q, int cur_style)
@c
static void make_delimiter_over(pointer q, int cur_style)
{
- pointer x, y, v; /* temporary registers for box construction */
- scaled shift_up, shift_down, clr, actual;
+ pointer x, y, v; /* temporary registers for box construction */
+ scaled shift_up, shift_down, clr, actual, wd;
+ boolean stack;
y = clean_box(nucleus(q), cur_style, cur_style);
- x = flat_delimiter(left_delimiter(q),
- cur_size + (cur_size == script_script_size ? 0 : 1),
- width(y), cur_style);
+ check_widths(q,y);
+ x = do_delimiter(q, left_delimiter(q), cur_size + (cur_size == script_script_size ? 0 : 1), wd, true, cur_style, true, &stack, NULL);
left_delimiter(q) = null;
- fixup_widths(x, y);
+ check_radical(q,stack,x,y);
+ fixup_widths(q, x, y);
shift_up = over_delimiter_bgap(cur_style)-height(x)-depth(x);
shift_down = 0;
clr = over_delimiter_vgap(cur_style);
@@ -1928,26 +2061,26 @@ static void make_delimiter_over(pointer q, int cur_style)
if (actual < clr) {
shift_up = shift_up + (clr-actual);
}
- v = wrapup_delimiter(x, y, q, shift_up, shift_down);
- width(v) = width(x); /* this also equals |width(y)| */
+ v = wrapup_over_under_delimiter(x, y, q, shift_up, shift_down);
+ width(v) = width(x); /* this also equals |width(y)| */
math_list(nucleus(q)) = v;
type(nucleus(q)) = sub_box_node;
}
-
@ this has the extensible delimiter |y| as a limit below a |nucleus| box |x|
@c
static void make_delimiter_under(pointer q, int cur_style)
{
pointer x, y, v; /* temporary registers for box construction */
- scaled shift_up, shift_down, clr, actual;
+ scaled shift_up, shift_down, clr, actual, wd;
+ boolean stack;
x = clean_box(nucleus(q), cur_style, cur_style);
- y = flat_delimiter(left_delimiter(q),
- cur_size + (cur_size == script_script_size ? 0 : 1),
- width(x), cur_style);
+ check_widths(q,x);
+ y = do_delimiter(q, left_delimiter(q), cur_size + (cur_size == script_script_size ? 0 : 1), wd, true, cur_style, true, &stack, NULL);
left_delimiter(q) = null;
- fixup_widths(x, y);
+ check_radical(q,stack,y,x);
+ fixup_widths(q, x, y);
shift_up = 0;
shift_down = under_delimiter_bgap(cur_style) - height(y)-depth(y);
clr = under_delimiter_vgap(cur_style);
@@ -1955,154 +2088,158 @@ static void make_delimiter_under(pointer q, int cur_style)
if (actual<clr) {
shift_down += (clr-actual);
}
- v = wrapup_delimiter(x, y, q, shift_up, shift_down);
- width(v) = width(y); /* this also equals |width(y)| */
+ v = wrapup_over_under_delimiter(x, y, q, shift_up, shift_down);
+ width(v) = width(y); /* this also equals |width(y)| */
math_list(nucleus(q)) = v;
type(nucleus(q)) = sub_box_node;
-
}
-@ this has the extensible delimiter |x| as a limit below |nucleus| box |y|
-
-@c
-static void make_under_delimiter(pointer q, int cur_style)
-{
- pointer x, y, v; /* temporary registers for box construction */
- scaled shift_up, shift_down, clr, delta;
- y = clean_box(nucleus(q), sup_style(cur_style), cur_style);
- x = flat_delimiter(left_delimiter(q), cur_size, width(y), cur_style);
- left_delimiter(q) = null;
- fixup_widths(x, y);
- shift_up = 0;
- shift_down = under_delimiter_bgap(cur_style);
- clr = under_delimiter_vgap(cur_style);
- delta = clr - ((shift_up - depth(x)) - (height(y) - shift_down));
- if (delta > 0) {
- shift_down = shift_down + delta;
- }
- v = wrapup_delimiter(x, y, q, shift_up, shift_down);
- width(v) = width(y); /* this also equals |width(y)| */
- math_list(nucleus(q)) = v;
- type(nucleus(q)) = sub_box_node;
-
-}
-
-
@ Slants are not considered when placing accents in math mode. The accenter is
centered over the accentee, and the accent width is treated as zero with
respect to the size of the final box.
@c
-#define TOP_CODE 1
-#define BOT_CODE 2
-#define TOP_OR_BOT_MASK ((TOP_CODE) | (BOT_CODE))
-#define STRETCH_ACCENT_CODE 4
+#define TOP_CODE 1
+#define BOT_CODE 2
+#define OVERLAY_CODE 4
+#define STRETCH_ACCENT_CODE 8
-static boolean compute_accent_skew(pointer q, int top_or_bot, scaled *s)
+static boolean compute_accent_skew(pointer q, int flags, scaled *s)
{
- pointer p; /* temporary register for box construction */
- boolean s_is_absolute; /* will be true if a top-accent is placed in |s| */
-
- s_is_absolute = false;
-
+ pointer p; /* temporary register for box construction */
+ boolean s_is_absolute = false; /* will be true if a top-accent is placed in |s| */
if (type(nucleus(q)) == math_char_node) {
fetch(nucleus(q));
if (is_new_mathfont(cur_f)) {
- if (top_or_bot == TOP_CODE) {
- *s = char_top_accent(cur_f, cur_c);
- if (*s != INT_MIN) {
- s_is_absolute = true;
- }
- } else {
- *s = char_bot_accent(cur_f, cur_c);
- if (*s != INT_MIN) {
- s_is_absolute = true;
+ /*
+ there is no bot_accent so let's assume similarity
+
+ if (flags & (TOP_CODE | OVERLAY_CODE)) {
+ *s = char_top_accent(cur_f, cur_c);
+ if (*s != INT_MIN) {
+ s_is_absolute = true;
+ }
+ } else {
+ *s = char_bot_accent(cur_f, cur_c);
+ if (*s != INT_MIN) {
+ s_is_absolute = true;
+ }
}
+ */
+ *s = char_top_accent(cur_f, cur_c);
+ if (*s != INT_MIN) {
+ s_is_absolute = true;
}
} else {
- if (top_or_bot == TOP_CODE) {
+ if (flags & TOP_CODE) {
*s = get_kern(cur_f, cur_c, skew_char(cur_f));
} else {
*s = 0;
}
}
} else if (type(nucleus(q)) == sub_mlist_node) {
- /* if |nucleus(q)| is a |sub_mlist_node| composed of an |accent_noad| we
- * use the positioning of the nucleus of that noad, recursing until
- * the inner most |accent_noad|. This way multiple stacked accents are
- * aligned to the inner most one. */
+ /*
+ if |nucleus(q)| is a |sub_mlist_node| composed of an |accent_noad| we
+
+ * use the positioning of the nucleus of that noad, recursing until
+ * the inner most |accent_noad|. This way multiple stacked accents are
+ * aligned to the inner most one.
+ */
p = math_list(nucleus(q));
if (type(p) == accent_noad) {
- s_is_absolute = compute_accent_skew(p, top_or_bot, s);
+ s_is_absolute = compute_accent_skew(p, flags, s);
}
}
return s_is_absolute;
}
-static void do_make_math_accent(pointer q, internal_font_number f, int c,
- int flags, int cur_style)
+static void do_make_math_accent(pointer q, internal_font_number f, int c, int flags, int cur_style)
{
- pointer p, r, x, y; /* temporary registers for box construction */
- scaled s; /* amount to skew the accent to the right */
- scaled h; /* height of character being accented */
- scaled delta; /* space to remove between accent and accentee */
- scaled w; /* width of the accentee, not including sub/superscripts */
- boolean s_is_absolute; /* will be true if a top-accent is placed in |s| */
+ pointer p, r, x, y; /* temporary registers for box construction */
+ scaled s; /* amount to skew the accent to the right */
+ scaled h; /* height of character being accented */
+ scaled delta; /* space to remove between accent and accentee */
+ scaled w; /* width of the accentee, not including sub/superscripts */
+ boolean s_is_absolute; /* will be true if a top-accent is placed in |s| */
+ scaled fraction ;
+ scaled target ;
extinfo *ext;
pointer attr_p;
- const int top_or_bot = flags & TOP_OR_BOT_MASK;
- attr_p = (top_or_bot == TOP_CODE ? accent_chr(q) : bot_accent_chr(q));
+ attr_p = (flags & TOP_CODE ? top_accent_chr(q) : flags & BOT_CODE ? bot_accent_chr(q) : overlay_accent_chr(q));
+ fraction = accentfraction(q);
c = cur_c;
f = cur_f;
-
- s = 0;
- s_is_absolute = false;
+ s = 1;
+ if (fraction == 0) {
+ fraction = 1000;
+ }
/* Compute the amount of skew, or set |s| to an alignment point */
- s_is_absolute = compute_accent_skew(q, top_or_bot, &s);
-
+ s_is_absolute = compute_accent_skew(q, flags, &s);
x = clean_box(nucleus(q), cramped_style(cur_style), cur_style);
w = width(x);
h = height(x);
if (is_new_mathfont(cur_f) && !s_is_absolute) {
- s = half(w);
- s_is_absolute = true;
+ s = half(w);
+ s_is_absolute = true;
}
/* Switch to a larger accent if available and appropriate */
y = null;
ext = NULL;
+ if (flags & OVERLAY_CODE) {
+ if (fraction > 0) {
+ target = xn_over_d(h,fraction,1000);
+ } else {
+ target = h;
+ }
+ } else {
+ if (fraction > 0) {
+ target = xn_over_d(w,fraction,1000);
+ } else {
+ target = w;
+ }
+ }
if ((flags & STRETCH_ACCENT_CODE) && (char_width(f, c) < w)) {
while (1) {
- if ((char_tag(f, c) == ext_tag) &&
- ((ext = get_charinfo_hor_variants(char_info(f, c))) != NULL)) {
- y = get_delim_hbox(ext, f, w, node_attr(attr_p), cur_style);
+ if ((char_tag(f, c) == ext_tag) && ((ext = get_charinfo_hor_variants(char_info(f, c))) != NULL)) {
+ /* a bit weird for an overlay but anyway, here we don't need a factor as we don't step */
+ y = get_delim_box(q, ext, f, w, node_attr(attr_p), cur_style, hlist_node);
break;
} else if (char_tag(f, c) != list_tag) {
break;
} else {
int yy = char_remainder(f, c);
- if (!char_exists(f, yy))
- break;
- if (char_width(f, yy) > w)
+ if (!char_exists(f, yy)) {
break;
+ } else if (flags & OVERLAY_CODE) {
+ if (char_height(f, yy) > target) {
+ break;
+ }
+ } else {
+ if (char_width(f, yy) > target)
+ break;
+ }
c = yy;
}
}
}
if (y == null) {
- y = char_box(f, c, node_attr(attr_p));
+ y = char_box(f, c, node_attr(attr_p)); /* italic gets added to width */
}
- if (top_or_bot == TOP_CODE) {
- if (h < accent_base_height(f))
+ if (flags & TOP_CODE) {
+ if (h < accent_base_height(f)) {
delta = h;
- else
+ } else {
delta = accent_base_height(f);
+ }
+ } else if (flags & OVERLAY_CODE) {
+ delta = half(height(y) + depth(y) + height(x) + depth(x)); /* center the accent vertically around the accentee */
} else {
- delta = 0; /* hm */
+ delta = 0; /* hm */
}
if ((supscr(q) != null) || (subscr(q) != null)) {
if (type(nucleus(q)) == math_char_node) {
- /* Swap the subscript and superscript into box |x| */
+ /* swap the subscript and superscript into box |x| */
flush_node_list(x);
x = new_noad();
r = math_clone(nucleus(q));
@@ -2118,15 +2255,27 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
h = height(x);
}
}
+ /* the top accents of both characters are aligned */
if (s_is_absolute) {
scaled sa;
if (ext != NULL) {
- sa = half(width(y)); /* if the accent is extensible just take the center */
+ /* if the accent is extensible just take the center */
+ sa = half(width(y));
} else {
+ /*
+ there is no bot_accent so let's assume similarity
+
+ if (flags & BOT_CODE) {
+ sa = char_bot_accent(f, c);
+ } else {
+ sa = char_top_accent(f, c);
+ }
+ */
sa = char_top_accent(f, c);
}
if (sa == INT_MIN) {
- sa = half(width(y)); /* just take the center */
+ /* just take the center */
+ sa = half(width(y));
}
if (math_direction == dir_TRT) {
shift_amount(y) = s + sa - width(y);
@@ -2136,26 +2285,19 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
} else {
if (width(y)== 0) {
shift_amount(y) = s + w;
+ } else if (math_direction == dir_TRT) {
+ shift_amount(y) = s + width(y); /* ok? */
} else {
- if (math_direction == dir_TRT) {
- shift_amount(y) = s + width(y);
- } else {
- shift_amount(y) = s + half(w - width(y));
- }
+ shift_amount(y) = s + half(w - width(y));
}
}
width(y) = 0;
- if (top_or_bot == TOP_CODE) {
+ if (flags & (TOP_CODE | OVERLAY_CODE)) {
p = new_kern(-delta);
+ reset_attributes(p, node_attr(q));
couple_nodes(p,x);
couple_nodes(y,p);
} else {
-#if 0
- p = new_kern(-delta);
- couple_nodes(x,p);
- couple_nodes(p,y);
- y = x;
-#endif
couple_nodes(x,y);
y = x;
}
@@ -2163,13 +2305,12 @@ static void do_make_math_accent(pointer q, internal_font_number f, int c,
reset_attributes(r, node_attr(q));
width(r) = width(x);
y = r;
- if (top_or_bot == TOP_CODE) {
+ if (flags & (TOP_CODE | OVERLAY_CODE)) {
if (height(y) < h) {
- /* Make the height of box |y| equal to |h| */
+ /* make the height of box |y| equal to |h| */
p = new_kern(h - height(y));
reset_attributes(p, node_attr(q));
-// vlink(p) = list_ptr(y);
-try_couple_nodes(p,list_ptr(y));
+ try_couple_nodes(p,list_ptr(y));
list_ptr(y) = p;
height(y) = h;
}
@@ -2185,13 +2326,13 @@ static void make_math_accent(pointer q, int cur_style)
int topstretch = !(subtype(q) % 2);
int botstretch = !(subtype(q) / 2);
- if (accent_chr(q) != null) {
- fetch(accent_chr(q));
+ if (top_accent_chr(q) != null) {
+ fetch(top_accent_chr(q));
if (char_exists(cur_f, cur_c)) {
do_make_math_accent(q, cur_f, cur_c, TOP_CODE | (topstretch ? STRETCH_ACCENT_CODE : 0), cur_style);
}
- flush_node(accent_chr(q));
- accent_chr(q) = null;
+ flush_node(top_accent_chr(q));
+ top_accent_chr(q) = null;
}
if (bot_accent_chr(q) != null) {
fetch(bot_accent_chr(q));
@@ -2201,6 +2342,14 @@ static void make_math_accent(pointer q, int cur_style)
flush_node(bot_accent_chr(q));
bot_accent_chr(q) = null;
}
+ if (overlay_accent_chr(q) != null) {
+ fetch(overlay_accent_chr(q));
+ if (char_exists(cur_f, cur_c)) {
+ do_make_math_accent(q, cur_f, cur_c, OVERLAY_CODE | STRETCH_ACCENT_CODE, cur_style);
+ }
+ flush_node(overlay_accent_chr(q));
+ overlay_accent_chr(q) = null;
+ }
}
@ The |make_fraction| procedure is a bit different because it sets
@@ -2209,28 +2358,46 @@ static void make_math_accent(pointer q, int cur_style)
@c
static void make_fraction(pointer q, int cur_style)
{
- pointer p, v, x, y, z; /* temporary registers for box construction */
- scaled delta, delta1, delta2, shift_up, shift_down, clr;
+ pointer p, p1, p2, v, x, y, z, l, r, m; /* temporary registers for box construction */
+ scaled delta, delta1, delta2, shift_up, shift_down, clr1, clr2;
/* dimensions for box calculations */
if (thickness(q) == default_code)
thickness(q) = fraction_rule(cur_style);
- /* Create equal-width boxes |x| and |z| for the numerator and denominator,
- and compute the default amounts |shift_up| and |shift_down| by which they
- are displaced from the baseline */
+ /*
+ Create equal-width boxes |x| and |z| for the numerator and denominator,
+ and compute the default amounts |shift_up| and |shift_down| by which they
+ are displaced from the baseline
+ */
+
x = clean_box(numerator(q), num_style(cur_style), cur_style);
z = clean_box(denominator(q), denom_style(cur_style), cur_style);
- if (width(x) < width(z))
- x = rebox(x, width(z));
- else
- z = rebox(z, width(x));
- if (thickness(q) == 0) {
+
+ if (middle_delimiter(q) != null) {
+ delta = 0;
+ m = do_delimiter(q, middle_delimiter(q), cur_size, delta, false, cur_style, true, NULL, NULL);
+ middle_delimiter(q) = null;
+ } else {
+ m = null ;
+ if (width(x) < width(z)) {
+ x = rebox(x, width(z));
+ } else {
+ z = rebox(z, width(x));
+ }
+ }
+
+ if (m != null) {
+ shift_up = 0;
+ shift_down = 0;
+ } else if (thickness(q) == 0) {
shift_up = stack_num_up(cur_style);
shift_down = stack_denom_down(cur_style);
- /* The numerator and denominator must be separated by a certain minimum
- clearance, called |clr| in the following program. The difference between
- |clr| and the actual clearance is |2delta|. */
- clr = stack_vgap(cur_style);
- delta = half(clr - ((shift_up - depth(x)) - (height(z) - shift_down)));
+ /*
+ the numerator and denominator must be separated by a certain minimum
+ clearance, called |clr| in the following program. The difference between
+ |clr| and the actual clearance is |2delta|.
+ */
+ clr1 = stack_vgap(cur_style);
+ delta = half(clr1 - ((shift_up - depth(x)) - (height(z) - shift_down)));
if (delta > 0) {
shift_up = shift_up + delta;
shift_down = shift_down + delta;
@@ -2238,58 +2405,157 @@ static void make_fraction(pointer q, int cur_style)
} else {
shift_up = fraction_num_up(cur_style);
shift_down = fraction_denom_down(cur_style);
- /* In the case of a fraction line, the minimum clearance depends on the actual
- thickness of the line. */
+ /*
+ in the case of a fraction line, the minimum clearance depends on the actual
+ thickness of the line.
+ */
+ clr1 = fraction_num_vgap(cur_style);
+ clr2 = fraction_denom_vgap(cur_style);
delta = half(thickness(q));
- clr = fraction_num_vgap(cur_style);
- clr = ext_xn_over_d(clr, thickness(q), fraction_rule(cur_style));
- delta1 = clr - ((shift_up - depth(x)) - (math_axis(cur_size) + delta));
- if (delta1 > 0)
+ if (fractionexact(q)) {
+ delta1 = clr1 - ((shift_up - depth(x) ) - (math_axis(cur_size) + delta));
+ delta2 = clr2 - ((shift_down - height(z)) + (math_axis(cur_size) - delta));
+ } else {
+ delta = half(thickness(q));
+ clr1 = ext_xn_over_d(clr1, thickness(q), fraction_rule(cur_style));
+ clr2 = ext_xn_over_d(clr2, thickness(q), fraction_rule(cur_style));
+ delta1 = clr1 - ((shift_up - depth(x) ) - (math_axis(cur_size) + delta));
+ delta2 = clr2 - ((shift_down - height(z)) + (math_axis(cur_size) - delta));
+ }
+ if (delta1 > 0) {
shift_up = shift_up + delta1;
- clr = fraction_denom_vgap(cur_style);
- clr = ext_xn_over_d(clr, thickness(q), fraction_rule(cur_style));
- delta2 =
- clr - ((math_axis(cur_size) - delta) - (height(z) - shift_down));
- if (delta2 > 0)
+ }
+ if (delta2 > 0) {
shift_down = shift_down + delta2;
+ }
}
- /* Construct a vlist box for the fraction, according to |shift_up| and |shift_down| */
- v = new_null_box();
- type(v) = vlist_node;
- height(v) = shift_up + height(x);
- depth(v) = depth(z) + shift_down;
- width(v) = width(x); /* this also equals |width(z)| */
- reset_attributes(v, node_attr(q));
- if (thickness(q) == 0) {
- p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
- couple_nodes(p,z);
+ if (m != null) {
+ /*
+ construct a hlist box for the fraction, according to |hgap| and |vgap|
+ */
+ shift_up = skewed_fraction_vgap(cur_style);
+
+ if (!fractionnoaxis(q)) {
+ shift_up += half(math_axis(cur_size));
+ }
+
+ shift_down = shift_up;
+ v = new_null_box();
+ reset_attributes(v, node_attr(q));
+ type(v) = hlist_node;
+ list_ptr(v) = x;
+ width(v) = width(x);
+ height(v) = height(x) + shift_up;
+ depth(v) = depth(x);
+ shift_amount(v) = - shift_up;
+ x = v;
+
+ v = new_null_box();
+ reset_attributes(v, node_attr(q));
+ type(v) = hlist_node;
+ list_ptr(v) = z;
+ width(v) = width(z);
+ height(v) = height(z);
+ depth(v) = depth(z) + shift_down;
+ shift_amount(v) = shift_down;
+ z = v;
+
+ v = new_null_box();
+ reset_attributes(v, node_attr(q));
+ type(v) = hlist_node;
+ if (height(x) > height(z)) {
+ height(v) = height(x);
+ } else {
+ height(v) = height(z);
+ }
+ if (depth(x) > depth(z)) {
+ depth(v) = depth(x);
+ } else {
+ depth(v) = depth(z);
+ }
+ if (height(m) > height(v)) {
+ height(v) = height(m);
+ }
+ if (depth(m) > depth(v)) {
+ depth(v) = depth(m);
+ }
+
+ if (fractionexact(q)) {
+ delta1 = -half(skewed_fraction_hgap(cur_style));
+ delta2 = delta1;
+ width(v) = width(x) + width(z) + width(m) - skewed_fraction_hgap(cur_style);
+ } else {
+ delta1 = half(skewed_fraction_hgap(cur_style)-width(m));
+ delta2 = half(skewed_fraction_hgap(cur_style)+width(m));
+ width(v) = width(x) + width(z) + skewed_fraction_hgap(cur_style);
+ width(m) = 0;
+ }
+
+ p1 = new_kern(delta1);
+ reset_attributes(p1, node_attr(q));
+ p2 = new_kern(delta2);
+ reset_attributes(p2, node_attr(q));
+
+ couple_nodes(x,p1);
+ couple_nodes(p1,m);
+ couple_nodes(m,p2);
+ couple_nodes(p2,z);
+
+ list_ptr(v) = x;
} else {
- y = do_fraction_rule(thickness(q), node_attr(q));
- p = new_kern((math_axis(cur_size) - delta) - (height(z) - shift_down));
+ /*
+ construct a vlist box for the fraction, according to |shift_up| and |shift_down|
+ */
+ v = new_null_box();
+ type(v) = vlist_node;
+ height(v) = shift_up + height(x);
+ depth(v) = depth(z) + shift_down;
+ width(v) = width(x); /* this also equals |width(z)| */
+ reset_attributes(v, node_attr(q));
+ if (thickness(q) == 0) {
+ p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
+ couple_nodes(p,z);
+ } else {
+ y = do_fraction_rule(thickness(q), node_attr(q));
+ p = new_kern((math_axis(cur_size) - delta) - (height(z) - shift_down));
+ reset_attributes(p, node_attr(q));
+ couple_nodes(y,p);
+ couple_nodes(p,z);
+ p = new_kern((shift_up - depth(x)) - (math_axis(cur_size) + delta));
+ couple_nodes(p,y);
+ }
reset_attributes(p, node_attr(q));
- couple_nodes(y,p);
- couple_nodes(p,z);
- p = new_kern((shift_up - depth(x)) - (math_axis(cur_size) + delta));
- couple_nodes(p,y);
+ couple_nodes(x,p);
+ list_ptr(v) = x;
}
- reset_attributes(p, node_attr(q));
- couple_nodes(x,p);
- list_ptr(v) = x;
- /* Put the fraction into a box with its delimiters, and make |new_hlist(q)|
- point to it */
- delta = fraction_del_size(cur_style);
- x = var_delimiter(left_delimiter(q), cur_size, delta, NULL, cur_style);
+ /*
+ put the fraction into a box with its delimiters, and make |new_hlist(q)|
+ point to it
+ */
+ if (is_new_mathfont(cur_f)) {
+ if (math_use_old_fraction_scaling) {
+ delta = fraction_del_size_old(cur_style);
+ } else {
+ delta = fraction_del_size_new(cur_style);
+ }
+ if (delta == undefined_math_parameter) {
+ delta = get_delimiter_height(depth(v), height(v), true);
+ }
+ } else {
+ delta = fraction_del_size_old(cur_style);
+ }
+
+ l = do_delimiter(q, left_delimiter(q), cur_size, delta, false, cur_style, true, NULL, NULL);
left_delimiter(q) = null;
- couple_nodes(x,v);
- z = var_delimiter(right_delimiter(q), cur_size, delta, NULL, cur_style);
+ r = do_delimiter(q, right_delimiter(q), cur_size, delta, false, cur_style, true, NULL, NULL);
right_delimiter(q) = null;
- couple_nodes(v,z);
- y = hpack(x, 0, additional, -1);
+ couple_nodes(l,v);
+ couple_nodes(v,r);
+ y = hpack(l, 0, additional, -1);
reset_attributes(y, node_attr(q));
assign_new_hlist(q, y);
}
-
@ If the nucleus of an |op_noad| is a single character, it is to be
centered vertically with respect to the axis, after first being enlarged
(via a character list in the font) if we are in display style. The normal
@@ -2297,52 +2563,49 @@ convention for placing displayed limits is to put them above and below the
operator in display style.
The italic correction is removed from the character if there is a subscript
-and the limits are not being displayed. The |make_op|
-routine returns the value that should be used as an offset between
-subscript and superscript.
+and the limits are not being displayed. The |make_op| routine returns the
+value that should be used as an offset between subscript and superscript.
After |make_op| has acted, |subtype(q)| will be |limits| if and only if
the limits have been set above and below the operator. In that case,
|new_hlist(q)| will already contain the desired final box.
@c
+static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled supshift, scaled subshift);
+static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_style);
+
static scaled make_op(pointer q, int cur_style)
{
- scaled delta; /* offset between subscript and superscript */
- pointer p, v, x, y, z; /* temporary registers for box construction */
- int c; /* register for character examination */
- scaled shift_up, shift_down; /* dimensions for box calculation */
+ scaled delta = 0; /* offset between subscript and superscript */
+ pointer p, v, x, y, z, n; /* temporary registers for box construction */
+ int c; /* register for character examination */
+ scaled shift_up, shift_down; /* dimensions for box calculation */
+ boolean axis_shift = false;
scaled ok_size;
- if ((subtype(q) == op_noad_type_normal) && (cur_style < text_style))
+ if ((subtype(q) == op_noad_type_normal) && (cur_style < text_style)) {
subtype(q) = op_noad_type_limits;
+ }
if (type(nucleus(q)) == math_char_node) {
fetch(nucleus(q));
- if (cur_style < text_style) { /* try to make it larger */
+ if (cur_style < text_style) {
+ /* try to make it larger */
ok_size = minimum_operator_size(cur_style);
if (ok_size != undefined_math_parameter) {
/* creating a temporary delimiter is the cleanest way */
y = new_node(delim_node, 0);
+ reset_attributes(y, node_attr(q));
small_fam(y) = math_fam(nucleus(q));
small_char(y) = math_character(nucleus(q));
- x = var_delimiter(y, text_size, ok_size, &delta, cur_style);
- if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
- width(x) -= delta; /* remove italic correction */
- }
- /* For an OT MATH font, we may have to get rid of yet another italic
- correction because |make_scripts()| will add one.
- This test is somewhat more complicated because |x| can be a null
- delimiter */
- if ((subscr(q) != null || supscr(q) != null)
- && (subtype(q) != op_noad_type_limits)
- && ((list_ptr(x) != null)
- && (type(list_ptr(x)) == glyph_node)
- && is_new_mathfont(font(list_ptr(x))))) {
- width(x) -= delta; /* remove another italic correction */
+ x = do_delimiter(q, y, text_size, ok_size, false, cur_style, true, NULL, &delta);
+ if (is_new_mathfont(cur_f)) {
+ /* we never added italic correction */
+ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
+ /* remove italic correction */
+ width(x) -= delta;
}
} else {
ok_size = height_plus_depth(cur_f, cur_c) + 1;
- while ((char_tag(cur_f, cur_c) == list_tag) &&
- height_plus_depth(cur_f, cur_c) < ok_size) {
+ while ((char_tag(cur_f, cur_c) == list_tag) && height_plus_depth(cur_f, cur_c) < ok_size) {
c = char_remainder(cur_f, cur_c);
if (!char_exists(cur_f, c))
break;
@@ -2351,43 +2614,55 @@ static scaled make_op(pointer q, int cur_style)
}
delta = char_italic(cur_f, cur_c);
x = clean_box(nucleus(q), cur_style, cur_style);
- if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits))
- width(x) = width(x) - delta; /* remove italic correction */
-
- shift_amount(x) =
- half(height(x) - depth(x)) - math_axis(cur_size);
- /* center vertically */
+ if (delta != null) {
+ if (is_new_mathfont(cur_f)) {
+ /* we never added italic correction */
+ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
+ /* remove italic correction */
+ width(x) = width(x) - delta;
+ }
+ }
+ axis_shift = true;
}
- type(nucleus(q)) = sub_box_node;
- math_list(nucleus(q)) = x;
-
- } else { /* normal size */
+ } else {
+ /* normal size */
delta = char_italic(cur_f, cur_c);
x = clean_box(nucleus(q), cur_style, cur_style);
- if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits))
- width(x) = width(x) - delta; /* remove italic correction */
-
- /* For an OT MATH font, we may have to get rid of yet another italic
- correction because |make_scripts()| will add one.
- This test is somewhat more complicated because |x| can be a null
- delimiter */
- if ((subscr(q) != null || supscr(q) != null)
- && (subtype(q) != op_noad_type_limits)
- && ((list_ptr(x) != null)
- && (type(list_ptr(x)) == glyph_node)
- && is_new_mathfont(font(list_ptr(x))))) {
- width(x) -= delta; /* remove another italic correction */
- }
-
- shift_amount(x) = half(height(x) - depth(x)) - math_axis(cur_size);
+ if (delta != 0) {
+ if (is_new_mathfont(cur_f)) {
+ /* we never added italic correction */
+ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
+ /* remove italic correction */
+ width(x) = width(x) - delta;
+ }
+ }
+ axis_shift = true;
+ }
+ if (axis_shift) {
/* center vertically */
- type(nucleus(q)) = sub_box_node;
- math_list(nucleus(q)) = x;
+ shift_amount(x) = half(height(x) - depth(x)) - math_axis(cur_size);
}
- } else {
- delta = 0;
+ type(nucleus(q)) = sub_box_node;
+ math_list(nucleus(q)) = x;
}
- if (subtype(q) == op_noad_type_limits) {
+
+ /* we now handle op_nod_type_no_limits here too */
+
+ if (subtype(q) == op_noad_type_no_limits) {
+ if (is_new_mathfont(cur_f)) {
+ if (delta != 0) {
+ delta = half(delta) ;
+ /* similar code then the caller */
+ p = check_nucleus_complexity(q, 0, cur_style);
+ if ((subscr(q) == null) && (supscr(q) == null)) {
+ assign_new_hlist(q, p);
+ } else {
+ make_scripts(q, p, 0, cur_style, delta, -delta);
+ }
+ delta = 0;
+ }
+ }
+ } else if (subtype(q) == op_noad_type_limits) {
/* The following program builds a vlist box |v| for displayed limits. The
width of the box is not affected by the fact that the limits may be skewed. */
x = clean_box(supscr(q), sup_style(cur_style), cur_style);
@@ -2396,6 +2671,43 @@ static scaled make_op(pointer q, int cur_style)
v = new_null_box();
reset_attributes(v, node_attr(q));
type(v) = vlist_node;
+ if (is_new_mathfont(cur_f)) {
+ n = null;
+ if (! math_no_italic_compensation) {
+ n = nucleus(q);
+ if (n != null) {
+ if ((type(n) == sub_mlist_node) || (type(n) == sub_box_node)) {
+ n = math_list(n);
+ if (n != null) {
+ if (type(n) == hlist_node) {
+ n = list_ptr(n); /* just a not scaled char */
+ while (n != null) {
+ if (type(n) == glyph_node) {
+ delta = char_italic(font(n),character(n));
+ }
+ n = vlink(n);
+ }
+ } else {
+ while (n != null) {
+ if (type(n) == fence_noad) {
+ if (delimiteritalic(n) > delta) {
+ /* we can have dummies, the period ones */
+ delta = delimiteritalic(n);
+ }
+ }
+ n = vlink(n);
+ }
+ }
+ }
+ } else {
+ n = nucleus(q);
+ if (type(n) == math_char_node) {
+ delta = char_italic(fam_fnt(math_fam(n),cur_size),math_character(n));
+ }
+ }
+ }
+ }
+ }
width(v) = width(y);
if (width(x) > width(v))
width(v) = width(x);
@@ -2406,14 +2718,23 @@ static scaled make_op(pointer q, int cur_style)
z = rebox(z, width(v));
shift_amount(x) = half(delta);
shift_amount(z) = -shift_amount(x);
+ /* v is the still empty target */
height(v) = height(y);
depth(v) = depth(y);
- /* Attach the limits to |y| and adjust |height(v)|, |depth(v)| to
- account for their presence */
- /* We use |shift_up| and |shift_down| in the following program for the
- amount of glue between the displayed operator |y| and its limits |x| and
- |z|. The vlist inside box |v| will consist of |x| followed by |y| followed
- by |z|, with kern nodes for the spaces between and around them. */
+ /*
+ attach the limits to |y| and adjust |height(v)|, |depth(v)| to
+ account for their presence
+
+ we use |shift_up| and |shift_down| in the following program for the
+ amount of glue between the displayed operator |y| and its limits |x| and
+ |z|
+
+ the vlist inside box |v| will consist of |x| followed by |y| followed
+ by |z|, with kern nodes for the spaces between and around them
+
+ b: baseline v: minumum gap
+ */
+
if (supscr(q) == null) {
list_ptr(x) = null;
flush_node(x);
@@ -2430,9 +2751,7 @@ static scaled make_op(pointer q, int cur_style)
reset_attributes(p, node_attr(q));
couple_nodes(p,x);
list_ptr(v) = p;
- height(v) =
- height(v) + limit_above_kern(cur_style) + height(x) + depth(x) +
- shift_up;
+ height(v) = height(v) + limit_above_kern(cur_style) + height(x) + depth(x) + shift_up;
}
if (subscr(q) == null) {
list_ptr(z) = null;
@@ -2441,16 +2760,16 @@ static scaled make_op(pointer q, int cur_style)
shift_down = limit_below_bgap(cur_style) - height(z);
if (shift_down < limit_below_vgap(cur_style))
shift_down = limit_below_vgap(cur_style);
- p = new_kern(shift_down);
- reset_attributes(p, node_attr(q));
- couple_nodes(y,p);
- couple_nodes(p,z);
+ if (shift_down > 0) {
+ p = new_kern(shift_down);
+ reset_attributes(p, node_attr(q));
+ couple_nodes(y,p);
+ couple_nodes(p,z);
+ }
p = new_kern(limit_below_kern(cur_style));
reset_attributes(p, node_attr(q));
couple_nodes(z,p);
- depth(v) =
- depth(v) + limit_below_kern(cur_style) + height(z) + depth(z) +
- shift_down;
+ depth(v) = depth(v) + limit_below_kern(cur_style) + height(z) + depth(z) + shift_down;
}
if (subscr(q) != null) {
math_list(subscr(q)) = null;
@@ -2463,6 +2782,9 @@ static scaled make_op(pointer q, int cur_style)
supscr(q) = null;
}
assign_new_hlist(q, v);
+ if (is_new_mathfont(cur_f)) {
+ delta = 0;
+ }
}
return delta;
}
@@ -2478,36 +2800,52 @@ to a math font (i.e., a font with |space=0|).
No boundary characters enter into these ligatures.
@c
+#define simple_char_noad(p) (\
+ (p != null) && \
+ (type(p) == simple_noad) && \
+ (subtype(p) <= punct_noad_type) && \
+ (type(nucleus(p)) == math_char_node) \
+)
+
+#define same_nucleus_fam(p,q) \
+ (math_fam(nucleus(p)) == math_fam(nucleus(q)))
+
static void make_ord(pointer q)
{
- int a; /* the left-side character for lig/kern testing */
- pointer p, r, s; /* temporary registers for list manipulation */
- scaled k; /* a kern */
- liginfo lig; /* a ligature */
+ int a; /* the left-side character for lig/kern testing */
+ pointer p, r, s; /* temporary registers for list manipulation */
+ scaled k; /* a kern */
+ liginfo lig; /* a ligature */
RESTART:
- if (subscr(q) == null &&
- supscr(q) == null && type(nucleus(q)) == math_char_node) {
+ if (subscr(q) == null && supscr(q) == null && type(nucleus(q)) == math_char_node) {
p = vlink(q);
- if ((p != null) &&
- (type(p) == simple_noad) &&
- (subtype(p) <= punct_noad_type) &&
- (type(nucleus(p)) == math_char_node) &&
- (math_fam(nucleus(p)) == math_fam(nucleus(q)))) {
+ if (simple_char_noad(p) && same_nucleus_fam(p,q)) {
type(nucleus(q)) = math_text_char_node;
fetch(nucleus(q));
a = cur_c;
+ /* add italic correction */
+ if (is_new_mathfont(cur_f) && (char_italic(cur_f,math_character(nucleus(q))) != 0)) {
+ p = new_kern(char_italic(cur_f,math_character(nucleus(q))));
+ reset_attributes(p, node_attr(q));
+ couple_nodes(p,vlink(q));
+ couple_nodes(q,p);
+ return;
+ }
+ /* construct ligatures, quite unlikely in new math fonts */
if ((has_kern(cur_f, a)) || (has_lig(cur_f, a))) {
cur_c = math_character(nucleus(p));
- /* If character |a| has a kern with |cur_c|, attach
- the kern after~|q|; or if it has a ligature with |cur_c|, combine
- noads |q| and~|p| appropriately; then |return| if the cursor has
- moved past a noad, or |goto restart| */
+ /*
+ if character |a| has a kern with |cur_c|, attach the kern after~|q|; or if
+ it has a ligature with |cur_c|, combine noads |q| and~|p| appropriately;
+ then |return| if the cursor has moved past a noad, or |goto restart|
- /* Note that a ligature between an |ord_noad| and another kind of noad
- is replaced by an |ord_noad|, when the two noads collapse into one.
- But we could make a parenthesis (say) change shape when it follows
- certain letters. Presumably a font designer will define such
- ligatures only when this convention makes sense. */
+ note that a ligature between an |ord_noad| and another kind of noad
+ is replaced by an |ord_noad|, when the two noads collapse into one
+
+ we could make a parenthesis (say) change shape when it follows
+ certain letters. Presumably a font designer will define such
+ ligatures only when this convention makes sense
+ */
if (disable_lig == 0 && has_lig(cur_f, a)) {
lig = get_ligature(cur_f, a, cur_c);
@@ -2515,17 +2853,24 @@ static void make_ord(pointer q)
check_interrupt(); /* allow a way out of infinite ligature loop */
switch (lig_type(lig)) {
case 1:
+ /* \.{=:\char`\|} */
case 5:
- math_character(nucleus(q)) = lig_replacement(lig); /* \.{=:\char`\|}, \.{=:\char`\|>} */
+ /* \.{=:\char`\|>} */
+ math_character(nucleus(q)) = lig_replacement(lig);
break;
case 2:
+ /* \.{\char`\|=:} */
case 6:
- math_character(nucleus(p)) = lig_replacement(lig); /* \.{\char`\|=:}, \.{\char`\|=:>} */
+ /* \.{\char`\|=:>} */
+ math_character(nucleus(p)) = lig_replacement(lig);
break;
case 3:
+ /* \.{\char`\|=:\char`\|} */
case 7:
+ /* \.{\char`\|=:\char`\|>} */
case 11:
- r = new_noad(); /* \.{\char`\|=:\char`\|}, \.{\char`\|=:\char`\|>}, \.{\char`\|=:\char`\|>>} */
+ /* \.{\char`\|=:\char`\|>>} */
+ r = new_noad();
reset_attributes(r, node_attr(q));
s = new_node(math_char_node, 0);
reset_attributes(s, node_attr(q));
@@ -2537,16 +2882,17 @@ static void make_ord(pointer q)
if (lig_type(lig) < 11)
type(nucleus(r)) = math_char_node;
else
- type(nucleus(r)) = math_text_char_node; /* prevent combination */
+ /* prevent combination */
+ type(nucleus(r)) = math_text_char_node;
break;
default:
try_couple_nodes(q,vlink(p));
- math_character(nucleus(q)) = lig_replacement(lig); /* \.{=:} */
+ math_character(nucleus(q)) = lig_replacement(lig); /* \.{=:} */
s = math_clone(subscr(p));
subscr(q) = s;
s = math_clone(supscr(p));
supscr(q) = s;
- math_reset(subscr(p)); /* just in case */
+ math_reset(subscr(p)); /* just in case */
math_reset(supscr(p));
flush_node(p);
break;
@@ -2558,7 +2904,8 @@ static void make_ord(pointer q)
}
}
if (disable_kern == 0 && has_kern(cur_f, a)) {
- k = get_kern(cur_f, a, cur_c); /* todo: should this use mathkerns? */
+ /* todo: should this use mathkerns? */
+ k = get_kern(cur_f, a, cur_c);
if (k != 0) {
p = new_kern(k);
reset_attributes(p, node_attr(q));
@@ -2580,12 +2927,12 @@ please use old-style italic correction placement
#define MATH_KERN_NOT_FOUND 0x7FFFFFFF
@ This function tries to find the kern needed for proper cut-ins.
- The left side doesn't move, but the right side does, so the first
- order of business is to create a staggered fence line on the
- left side of the right character.
+The left side doesn't move, but the right side does, so the first
+order of business is to create a staggered fence line on the
+left side of the right character.
- The microsoft spec says that there are four quadrants, but the
- actual images say
+The microsoft spec says that there are four quadrants, but the
+actual images say
@c
static scaled math_kern_at(internal_font_number f, int c, int side, int v)
@@ -2593,7 +2940,7 @@ static scaled math_kern_at(internal_font_number f, int c, int side, int v)
int h, k, numkerns;
scaled *kerns_heights;
scaled kern = 0;
- charinfo *co = char_info(f, c); /* known to exist */
+ charinfo *co = char_info(f, c); /* known to exist */
numkerns = get_charinfo_math_kerns(co, side);
#ifdef DEBUG
fprintf(stderr, " entries = %d, height = %d\n", numkerns, v);
@@ -2632,24 +2979,22 @@ static scaled math_kern_at(internal_font_number f, int c, int side, int v)
}
@ @c
-static scaled
-find_math_kern(internal_font_number l_f, int l_c,
- internal_font_number r_f, int r_c, int cmd, scaled shift)
+static scaled find_math_kern(internal_font_number l_f, int l_c,
+ internal_font_number r_f, int r_c,
+ int cmd, scaled shift)
{
scaled corr_height_top = 0, corr_height_bot = 0;
scaled krn_l = 0, krn_r = 0, krn = 0;
- if ((!is_new_mathfont(l_f)) || (!is_new_mathfont(r_f))
- || (!char_exists(l_f, l_c)) || (!char_exists(r_f, r_c)))
+ if ((!is_new_mathfont(l_f)) || (!is_new_mathfont(r_f)) || (!char_exists(l_f, l_c)) || (!char_exists(r_f, r_c)))
return MATH_KERN_NOT_FOUND;
if (cmd == sup_mark_cmd) {
corr_height_top = char_height(l_f, l_c);
- corr_height_bot = -char_depth(r_f, r_c) + shift; /* bottom of superscript */
+ corr_height_bot = -char_depth(r_f, r_c) + shift; /* bottom of superscript */
krn_l = math_kern_at(l_f, l_c, top_right_kern, corr_height_top);
krn_r = math_kern_at(r_f, r_c, bottom_left_kern, corr_height_top);
#ifdef DEBUG
- fprintf(stderr, "SUPER Top LR = %d,%d (shift %d)\n", krn_l, krn_r,
- shift);
+ fprintf(stderr, "SUPER Top LR = %d,%d (shift %d)\n", krn_l, krn_r, shift);
#endif
krn = (krn_l + krn_r);
krn_l = math_kern_at(l_f, l_c, top_right_kern, corr_height_bot);
@@ -2662,7 +3007,7 @@ find_math_kern(internal_font_number l_f, int l_c,
return (krn);
} else if (cmd == sub_mark_cmd) {
- corr_height_top = char_height(r_f, r_c) - shift; /* top of subscript */
+ corr_height_top = char_height(r_f, r_c) - shift; /* top of subscript */
corr_height_bot = -char_depth(l_f, l_c);
krn_l = math_kern_at(l_f, l_c, bottom_right_kern, corr_height_top);
krn_r = math_kern_at(r_f, r_c, top_left_kern, corr_height_top);
@@ -2682,7 +3027,7 @@ find_math_kern(internal_font_number l_f, int l_c,
} else {
confusion("find_math_kern");
}
- return 0; /* not reached */
+ return 0; /* not reached */
}
@ just a small helper
@@ -2691,7 +3036,9 @@ static pointer attach_hkern_to_new_hlist(pointer q, scaled delta2)
{
pointer y;
pointer z = new_kern(delta2);
- if (new_hlist(q) == null) { /* this is somewhat weird */
+ reset_attributes(z, node_attr(q));
+ if (new_hlist(q) == null) {
+ /* this is somewhat weird */
new_hlist(q) = z;
} else {
y = new_hlist(q);
@@ -2730,7 +3077,6 @@ void dump_simple_field(pointer q)
}
}
-
void dump_simple_node(pointer q)
{
printf("node %d, type=%d, vlink=%d\n", q, type(q), vlink(q));
@@ -2794,11 +3140,10 @@ the new fonts so eventualy there will be an option to ignore such corrections.
} \
} while (0)
-
-static void make_scripts(pointer q, pointer p, scaled it, int cur_style)
+static void make_scripts(pointer q, pointer p, scaled it, int cur_style, scaled supshift, scaled subshift)
{
- pointer x, y, z; /* temporary registers for box construction */
- scaled shift_up, shift_down, clr; /* dimensions in the calculation */
+ pointer x, y, z; /* temporary registers for box construction */
+ scaled shift_up, shift_down, clr; /* dimensions in the calculation */
scaled delta1, delta2;
halfword sub_n, sup_n;
internal_font_number sub_f, sup_f;
@@ -2818,14 +3163,15 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style)
printf("p: node %d, type=%d, subtype=%d\n", p, type(p), subtype(p));
#endif
switch (type(nucleus(q))) {
- case math_char_node:
- case math_text_char_node:
- if ((subscr(q) == null) && (delta1 != 0)) {
- x = new_kern(delta1);
- reset_attributes(x, node_attr(nucleus(q)));
- couple_nodes(p,x);
- delta1 = 0;
- }
+ case math_char_node:
+ case math_text_char_node:
+ if ((subscr(q) == null) && (delta1 != 0)) {
+ /* todo: selective */
+ x = new_kern(delta1); /* italic correction */
+ reset_attributes(x, node_attr(nucleus(q)));
+ couple_nodes(p,x);
+ delta1 = 0;
+ }
}
assign_new_hlist(q, p);
if (is_char_node(p)) {
@@ -2833,8 +3179,8 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style)
shift_down = 0;
} else {
z = hpack(p, 0, additional, -1);
- shift_up = height(z) - sup_shift_drop(cur_style); /* r18 */
- shift_down = depth(z) + sub_shift_drop(cur_style); /* r19 */
+ shift_up = height(z) - sup_shift_drop(cur_style); /* r18 */
+ shift_down = depth(z) + sub_shift_drop(cur_style); /* r19 */
list_ptr(z) = null;
flush_node(z);
}
@@ -2847,103 +3193,194 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style)
}
if (supscr(q) == null) {
+ /*
+ construct a subscript box |x| when there is no superscript
- /* Construct a subscript box |x| when there is no superscript */
- /* When there is a subscript without a superscript, the top of the subscript
- should not exceed the baseline plus four-fifths of the x-height. */
+ when there is a subscript without a superscript, the top of the subscript
+ should not exceed the baseline plus four-fifths of the x-height.
+ */
x = clean_box(subscr(q), sub_style(cur_style), cur_style);
width(x) = width(x) + space_after_script(cur_style);
- if (shift_down < sub_shift_down(cur_style))
- shift_down = sub_shift_down(cur_style);
- clr = height(x) - sub_top_max(cur_style);
- if (shift_down < clr)
- shift_down = clr;
+ switch (scripts_mode) {
+ case 1:
+ shift_down = sub_shift_down(cur_style) ;
+ break;
+ case 2:
+ shift_down = sub_sup_shift_down(cur_style) ;
+ break;
+ case 3:
+ shift_down = sub_sup_shift_down(cur_style) ;
+ break;
+ case 4:
+ shift_down = sub_shift_down(cur_style) + half(sub_sup_shift_down(cur_style)-sub_shift_down(cur_style)) ;
+ break;
+ case 5:
+ shift_down = sub_shift_down(cur_style) ;
+ break;
+ default:
+ if (shift_down < sub_shift_down(cur_style))
+ shift_down = sub_shift_down(cur_style);
+ clr = height(x) - sub_top_max(cur_style);
+ if (shift_down < clr)
+ shift_down = clr;
+ break;
+ }
shift_amount(x) = shift_down;
/* now find and correct for horizontal shift */
if (sub_n != null) {
delta2 = find_math_kern(font(p), character(p),sub_f,sub_c,sub_mark_cmd, shift_down);
- if (delta2 != MATH_KERN_NOT_FOUND && delta2 != 0) {
- p = attach_hkern_to_new_hlist(q, delta2);
+ if (delta2 == MATH_KERN_NOT_FOUND) {
+ delta2 = subshift ;
+ } else {
+ delta2 = delta2 + subshift ;
}
+ } else {
+ delta2 = subshift ;
+ }
+ if (delta2 != 0) {
+ p = attach_hkern_to_new_hlist(q, delta2);
}
} else {
- /* Construct a superscript box |x| */
- /*The bottom of a superscript should never descend below the baseline plus
- one-fourth of the x-height. */
+ /*
+ construct a superscript box |x|
+
+ the bottom of a superscript should never descend below the baseline plus
+ one-fourth of the x-height.
+ */
x = clean_box(supscr(q), sup_style(cur_style), cur_style);
width(x) = width(x) + space_after_script(cur_style);
- clr = sup_shift_up(cur_style);
- if (shift_up < clr)
- shift_up = clr;
- clr = depth(x) + sup_bottom_min(cur_style);
- if (shift_up < clr)
- shift_up = clr;
-
+ switch (scripts_mode) {
+ case 1:
+ shift_up = sup_shift_up(cur_style);
+ break;
+ case 2:
+ shift_up = sup_shift_up(cur_style) ;
+ break;
+ case 3:
+ shift_up = sup_shift_up(cur_style) + sub_sup_shift_down(cur_style) - sub_shift_down(cur_style) ;
+ break;
+ case 4:
+ shift_up = sup_shift_up(cur_style) + half(sub_sup_shift_down(cur_style)-sub_shift_down(cur_style)) ;
+ break;
+ case 5:
+ shift_up = sup_shift_up(cur_style) + sub_sup_shift_down(cur_style)-sub_shift_down(cur_style) ;
+ break;
+ default:
+ clr = sup_shift_up(cur_style);
+ if (shift_up < clr)
+ shift_up = clr;
+ clr = depth(x) + sup_bottom_min(cur_style);
+ if (shift_up < clr)
+ shift_up = clr;
+ break;
+ }
if (subscr(q) == null) {
shift_amount(x) = -shift_up;
/* now find and correct for horizontal shift */
if (sup_n != null) {
clr = find_math_kern(font(p),character(p),sup_f,sup_c,sup_mark_cmd,shift_up);
- if (clr != MATH_KERN_NOT_FOUND && clr != 0) {
- p = attach_hkern_to_new_hlist(q, clr);
+ if (clr == MATH_KERN_NOT_FOUND) {
+ clr = supshift ;
+ } else {
+ clr = clr + supshift ;
}
+ } else {
+ clr = supshift;
+ }
+ if (clr != 0) {
+ p = attach_hkern_to_new_hlist(q, clr);
}
} else {
- /* Construct a sub/superscript combination box |x|, with the
- superscript offset by |delta| */
- /* When both subscript and superscript are present, the subscript must be
- separated from the superscript by at least four times |default_rule_thickness|.
- If this condition would be violated, the subscript moves down, after which
- both subscript and superscript move up so that the bottom of the superscript
- is at least as high as the baseline plus four-fifths of the x-height. */
+ /*
+ construct a sub/superscript combination box |x|, with the superscript offset
+ by |delta|
+
+ when both subscript and superscript are present, the subscript must be
+ separated from the superscript by at least four times |default_rule_thickness|
+ if this condition would be violated, the subscript moves down, after which
+ both subscript and superscript move up so that the bottom of the superscript
+ is at least as high as the baseline plus four-fifths of the x-height
+ */
y = clean_box(subscr(q), sub_style(cur_style), cur_style);
width(y) = width(y) + space_after_script(cur_style);
- if (shift_down < sub_sup_shift_down(cur_style))
- shift_down = sub_sup_shift_down(cur_style);
- clr = subsup_vgap(cur_style) - ((shift_up - depth(x)) - (height(y) - shift_down));
- if (clr > 0) {
- shift_down = shift_down + clr;
- clr = sup_sub_bottom_max(cur_style) - (shift_up - depth(x));
- if (clr > 0) {
- shift_up = shift_up + clr;
- shift_down = shift_down - clr;
- }
+ switch (scripts_mode) {
+ case 1:
+ shift_down = sub_shift_down(cur_style) ;
+ break;
+ case 2:
+ shift_down = sub_sup_shift_down(cur_style) ;
+ break;
+ case 3:
+ shift_down = sub_sup_shift_down(cur_style) ;
+ break;
+ case 4:
+ shift_down = sub_shift_down(cur_style) + half(sub_sup_shift_down(cur_style)-sub_shift_down(cur_style)) ;
+ break;
+ case 5:
+ shift_down = sub_shift_down(cur_style) ;
+ break;
+ default:
+ if (shift_down < sub_sup_shift_down(cur_style))
+ shift_down = sub_sup_shift_down(cur_style);
+ clr = subsup_vgap(cur_style) - ((shift_up - depth(x)) - (height(y) - shift_down));
+ if (clr > 0) {
+ shift_down = shift_down + clr;
+ clr = sup_sub_bottom_max(cur_style) - (shift_up - depth(x));
+ if (clr > 0) {
+ shift_up = shift_up + clr;
+ shift_down = shift_down - clr;
+ }
+ }
+ break;
}
/* now find and correct for horizontal shift */
if (sub_n != null) {
delta2 = find_math_kern(font(p), character(p),sub_f,sub_c,sub_mark_cmd, shift_down);
- if (delta2 != MATH_KERN_NOT_FOUND && delta2 != 0) {
- p = attach_hkern_to_new_hlist(q, delta2);
+ if (delta2 == MATH_KERN_NOT_FOUND) {
+ delta2 = subshift ;
+ } else {
+ delta2 = delta2 + subshift ;
}
+ } else {
+ delta2 = subshift ;
+ }
+ if (delta2 != 0) {
+ p = attach_hkern_to_new_hlist(q, delta2);
}
- /* now the horizontal shift for the superscript. */
- /* the superscript is also to be shifted by |delta1| (the italic correction) */
+ /*
+ now the horizontal shift for the superscript; the superscript is also to be shifted
+ by |delta1| (the italic correction)
+ */
clr = MATH_KERN_NOT_FOUND;
if (sup_n != null) {
clr = find_math_kern(font(p),character(p),sup_f,sup_c,sup_mark_cmd,shift_up);
}
+ /* delta can already have been applied and now be 0 */
if (delta2 == MATH_KERN_NOT_FOUND)
- delta2 = 0;
+ delta2 = - supshift ;
+ else
+ delta2 = delta2 - supshift ;
if (clr != MATH_KERN_NOT_FOUND) {
shift_amount(x) = clr + delta1 - delta2;
} else {
shift_amount(x) = delta1 - delta2;
}
+ /* todo: only if kern != 0 */
p = new_kern((shift_up - depth(x)) - (height(y) - shift_down));
reset_attributes(p, node_attr(q));
couple_nodes(x,p);
couple_nodes(p,y);
+ /* we end up with funny dimensions */
x = vpackage(x, 0, additional, max_dimen, math_direction);
reset_attributes(x, node_attr(q));
shift_amount(x) = shift_down;
}
}
-
if (new_hlist(q) == null) {
new_hlist(q) = x;
} else {
@@ -2962,7 +3399,6 @@ static void make_scripts(pointer q, pointer p, scaled it, int cur_style)
flush_node(supscr(q));
supscr(q) = null;
}
-
}
@ The |make_left_right| function constructs a left or right delimiter of
@@ -2971,27 +3407,86 @@ the required size and returns the value |open_noad| or |close_noad|. The
so they will have consistent sizes.
@c
-static small_number make_left_right(pointer q, int style, scaled max_d,
- scaled max_hv)
+static small_number make_left_right(pointer q, int style, scaled max_d, scaled max_h)
{
- scaled delta, delta1, delta2; /* dimensions used in the calculation */
- pointer tmp;
+ scaled delta;
+ pointer tmp, lst;
+ scaled hd_asked = 0;
+ scaled ic = 0;
+ boolean stack = false;
+ boolean axis = false;
+ /*
+ scaled hd_done = 0;
+ boolean fitting = true;
+ boolean fence = false;
+ int chr = 0;
+ int cls = 0;
+ */
setup_cur_size(style);
- delta2 = max_d + math_axis(cur_size);
- delta1 = max_hv + max_d - delta2;
- if (delta2 > delta1)
- delta1 = delta2; /* |delta1| is max distance from axis */
- delta = (delta1 / 500) * delimiter_factor;
- delta2 = delta1 + delta1 - delimiter_shortfall;
- if (delta < delta2)
- delta = delta2;
- tmp = var_delimiter(delimiter(q), cur_size, delta, NULL, style);
+
+ if ((delimiterheight(q)!=0) || (delimiterdepth(q)!=0)) {
+
+ hd_asked = delimiterheight(q) + delimiterdepth(q);
+ tmp = do_delimiter(q, delimiter(q), cur_size, hd_asked, false, style, false, &stack, &ic);
+ delimiteritalic(q) = ic;
+
+ /* beware, a stacked delimiter has a shift but no corrected height/depth (yet) */
+
+ if (stack) {
+ shift_amount(tmp) = delimiterdepth(q);
+ }
+
+ /*
+ hd_done = height(tmp) + depth(tmp);
+ fitting = stack || ((hd_done-hd_asked) == 0);
+
+ if (type(delimiter(q)) == delim_node && (small_char(delimiter(q)) != 0)) {
+ chr = small_char(delimiter(q));
+ cls = get_math_code(chr).class_value ;
+ fence = (cls == 4) || (cls == 5) ;
+ }
+
+ printf("delimiter stack %i fence %i fitting %i\n",stack,fence,fitting);
+ */
+
+ if (delimiterexact(q)) {
+ delimiterheight(q) = height(tmp) - shift_amount(tmp);
+ delimiterdepth(q) = depth(tmp) + shift_amount(tmp);
+ }
+ if (delimiteraxis(q)) {
+ delimiterheight(q) += math_axis(cur_size);
+ delimiterdepth(q) -= math_axis(cur_size);
+ shift_amount(tmp) -= math_axis(cur_size);
+ }
+ lst = new_node(hlist_node,0);
+ reset_attributes(lst, node_attr(q));
+ box_dir(lst) = dir_TLT ;
+ height(lst) = delimiterheight(q);
+ depth(lst) = delimiterdepth(q);
+ width(lst) = width(tmp);
+ list_ptr(lst) = tmp;
+ tmp = lst ;
+ } else {
+ axis = ! delimiternoaxis(q);
+ delta = get_delimiter_height(max_d,max_h,axis);
+ tmp = do_delimiter(q, delimiter(q), cur_size, delta, false, style, axis, &stack, &ic);
+ delimiteritalic(q) = ic;
+ }
delimiter(q) = null;
assign_new_hlist(q, tmp);
- if (subtype(q) == left_noad_side)
+ if (delimiterclass(q) >= ord_noad_type) {
+ if (delimiterclass(q) <= inner_noad_type) {
+ return delimiterclass(q);
+ } else {
+ return ord_noad_type;
+ }
+ } else if (subtype(q) == no_noad_side) {
return open_noad_type;
- else
+ } else if (subtype(q) == left_noad_side) {
+ return open_noad_type;
+ } else {
return close_noad_type;
+ }
}
@ @c
@@ -3097,7 +3592,6 @@ void initialize_math_spacing(void)
/* *INDENT-ON* */
}
-
@ @c
#define both_types(A,B) ((A)*16+(B))
@@ -3111,82 +3605,82 @@ static pointer math_spacing_glue(int l_type, int r_type, int mstyle, scaled mmu)
r_type = op_noad_type_normal;
switch (both_types(l_type, r_type)) {
/* *INDENT-OFF* */
- case both_types(ord_noad_type, ord_noad_type ): x = get_math_param(math_param_ord_ord_spacing,mstyle); break;
- case both_types(ord_noad_type, op_noad_type_normal ): x = get_math_param(math_param_ord_op_spacing,mstyle); break;
- case both_types(ord_noad_type, bin_noad_type ): x = get_math_param(math_param_ord_bin_spacing,mstyle); break;
- case both_types(ord_noad_type, rel_noad_type ): x = get_math_param(math_param_ord_rel_spacing,mstyle); break;
- case both_types(ord_noad_type, open_noad_type ): x = get_math_param(math_param_ord_open_spacing,mstyle); break;
- case both_types(ord_noad_type, close_noad_type): x = get_math_param(math_param_ord_close_spacing,mstyle); break;
- case both_types(ord_noad_type, punct_noad_type): x = get_math_param(math_param_ord_punct_spacing,mstyle); break;
- case both_types(ord_noad_type, inner_noad_type): x = get_math_param(math_param_ord_inner_spacing,mstyle); break;
- case both_types(op_noad_type_normal, ord_noad_type ): x = get_math_param(math_param_op_ord_spacing,mstyle); break;
- case both_types(op_noad_type_normal, op_noad_type_normal ): x = get_math_param(math_param_op_op_spacing,mstyle); break;
+ case both_types(ord_noad_type, ord_noad_type ): x = get_math_param(math_param_ord_ord_spacing,mstyle); break;
+ case both_types(ord_noad_type, op_noad_type_normal): x = get_math_param(math_param_ord_op_spacing,mstyle); break;
+ case both_types(ord_noad_type, bin_noad_type ): x = get_math_param(math_param_ord_bin_spacing,mstyle); break;
+ case both_types(ord_noad_type, rel_noad_type ): x = get_math_param(math_param_ord_rel_spacing,mstyle); break;
+ case both_types(ord_noad_type, open_noad_type ): x = get_math_param(math_param_ord_open_spacing,mstyle); break;
+ case both_types(ord_noad_type, close_noad_type ): x = get_math_param(math_param_ord_close_spacing,mstyle); break;
+ case both_types(ord_noad_type, punct_noad_type ): x = get_math_param(math_param_ord_punct_spacing,mstyle); break;
+ case both_types(ord_noad_type, inner_noad_type ): x = get_math_param(math_param_ord_inner_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, ord_noad_type ): x = get_math_param(math_param_op_ord_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, op_noad_type_normal): x = get_math_param(math_param_op_op_spacing,mstyle); break;
#if 0
- case both_types(op_noad_type_normal, bin_noad_type ): x = get_math_param(math_param_op_bin_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, bin_noad_type ): x = get_math_param(math_param_op_bin_spacing,mstyle); break;
#endif
- case both_types(op_noad_type_normal, rel_noad_type ): x = get_math_param(math_param_op_rel_spacing,mstyle); break;
- case both_types(op_noad_type_normal, open_noad_type ): x = get_math_param(math_param_op_open_spacing,mstyle); break;
- case both_types(op_noad_type_normal, close_noad_type): x = get_math_param(math_param_op_close_spacing,mstyle); break;
- case both_types(op_noad_type_normal, punct_noad_type): x = get_math_param(math_param_op_punct_spacing,mstyle); break;
- case both_types(op_noad_type_normal, inner_noad_type): x = get_math_param(math_param_op_inner_spacing,mstyle); break;
- case both_types(bin_noad_type, ord_noad_type ): x = get_math_param(math_param_bin_ord_spacing,mstyle); break;
- case both_types(bin_noad_type, op_noad_type_normal ): x = get_math_param(math_param_bin_op_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, rel_noad_type ): x = get_math_param(math_param_op_rel_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, open_noad_type ): x = get_math_param(math_param_op_open_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, close_noad_type ): x = get_math_param(math_param_op_close_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, punct_noad_type ): x = get_math_param(math_param_op_punct_spacing,mstyle); break;
+ case both_types(op_noad_type_normal, inner_noad_type ): x = get_math_param(math_param_op_inner_spacing,mstyle); break;
+ case both_types(bin_noad_type, ord_noad_type ): x = get_math_param(math_param_bin_ord_spacing,mstyle); break;
+ case both_types(bin_noad_type, op_noad_type_normal): x = get_math_param(math_param_bin_op_spacing,mstyle); break;
#if 0
- case both_types(bin_noad_type, bin_noad_type ): x = get_math_param(math_param_bin_bin_spacing,mstyle); break;
- case both_types(bin_noad_type, rel_noad_type ): x = get_math_param(math_param_bin_rel_spacing,mstyle); break;
+ case both_types(bin_noad_type, bin_noad_type ): x = get_math_param(math_param_bin_bin_spacing,mstyle); break;
+ case both_types(bin_noad_type, rel_noad_type ): x = get_math_param(math_param_bin_rel_spacing,mstyle); break;
#endif
- case both_types(bin_noad_type, open_noad_type ): x = get_math_param(math_param_bin_open_spacing,mstyle); break;
+ case both_types(bin_noad_type, open_noad_type ): x = get_math_param(math_param_bin_open_spacing,mstyle); break;
#if 0
- case both_types(bin_noad_type, close_noad_type): x = get_math_param(math_param_bin_close_spacing,mstyle); break;
- case both_types(bin_noad_type, punct_noad_type): x = get_math_param(math_param_bin_punct_spacing,mstyle); break;
+ case both_types(bin_noad_type, close_noad_type ): x = get_math_param(math_param_bin_close_spacing,mstyle); break;
+ case both_types(bin_noad_type, punct_noad_type ): x = get_math_param(math_param_bin_punct_spacing,mstyle); break;
#endif
- case both_types(bin_noad_type, inner_noad_type): x = get_math_param(math_param_bin_inner_spacing,mstyle); break;
- case both_types(rel_noad_type, ord_noad_type ): x = get_math_param(math_param_rel_ord_spacing,mstyle); break;
- case both_types(rel_noad_type, op_noad_type_normal ): x = get_math_param(math_param_rel_op_spacing,mstyle); break;
+ case both_types(bin_noad_type, inner_noad_type ): x = get_math_param(math_param_bin_inner_spacing,mstyle); break;
+ case both_types(rel_noad_type, ord_noad_type ): x = get_math_param(math_param_rel_ord_spacing,mstyle); break;
+ case both_types(rel_noad_type, op_noad_type_normal): x = get_math_param(math_param_rel_op_spacing,mstyle); break;
#if 0
- case both_types(rel_noad_type, bin_noad_type ): x = get_math_param(math_param_rel_bin_spacing,mstyle); break;
+ case both_types(rel_noad_type, bin_noad_type ): x = get_math_param(math_param_rel_bin_spacing,mstyle); break;
#endif
- case both_types(rel_noad_type, rel_noad_type ): x = get_math_param(math_param_rel_rel_spacing,mstyle); break;
- case both_types(rel_noad_type, open_noad_type ): x = get_math_param(math_param_rel_open_spacing,mstyle); break;
- case both_types(rel_noad_type, close_noad_type): x = get_math_param(math_param_rel_close_spacing,mstyle); break;
- case both_types(rel_noad_type, punct_noad_type): x = get_math_param(math_param_rel_punct_spacing,mstyle); break;
- case both_types(rel_noad_type, inner_noad_type): x = get_math_param(math_param_rel_inner_spacing,mstyle); break;
- case both_types(open_noad_type, ord_noad_type ): x = get_math_param(math_param_open_ord_spacing,mstyle); break;
- case both_types(open_noad_type, op_noad_type_normal ): x = get_math_param(math_param_open_op_spacing,mstyle); break;
+ case both_types(rel_noad_type, rel_noad_type ): x = get_math_param(math_param_rel_rel_spacing,mstyle); break;
+ case both_types(rel_noad_type, open_noad_type ): x = get_math_param(math_param_rel_open_spacing,mstyle); break;
+ case both_types(rel_noad_type, close_noad_type ): x = get_math_param(math_param_rel_close_spacing,mstyle); break;
+ case both_types(rel_noad_type, punct_noad_type ): x = get_math_param(math_param_rel_punct_spacing,mstyle); break;
+ case both_types(rel_noad_type, inner_noad_type ): x = get_math_param(math_param_rel_inner_spacing,mstyle); break;
+ case both_types(open_noad_type, ord_noad_type ): x = get_math_param(math_param_open_ord_spacing,mstyle); break;
+ case both_types(open_noad_type, op_noad_type_normal): x = get_math_param(math_param_open_op_spacing,mstyle); break;
#if 0
- case both_types(open_noad_type, bin_noad_type ): x = get_math_param(math_param_open_bin_spacing,mstyle); break;
+ case both_types(open_noad_type, bin_noad_type ): x = get_math_param(math_param_open_bin_spacing,mstyle); break;
#endif
- case both_types(open_noad_type, rel_noad_type ): x = get_math_param(math_param_open_rel_spacing,mstyle); break;
- case both_types(open_noad_type, open_noad_type ): x = get_math_param(math_param_open_open_spacing,mstyle); break;
- case both_types(open_noad_type, close_noad_type): x = get_math_param(math_param_open_close_spacing,mstyle); break;
- case both_types(open_noad_type, punct_noad_type): x = get_math_param(math_param_open_punct_spacing,mstyle); break;
- case both_types(open_noad_type, inner_noad_type): x = get_math_param(math_param_open_inner_spacing,mstyle); break;
- case both_types(close_noad_type,ord_noad_type ): x = get_math_param(math_param_close_ord_spacing,mstyle); break;
- case both_types(close_noad_type,op_noad_type_normal ): x = get_math_param(math_param_close_op_spacing,mstyle); break;
- case both_types(close_noad_type,bin_noad_type ): x = get_math_param(math_param_close_bin_spacing,mstyle); break;
- case both_types(close_noad_type,rel_noad_type ): x = get_math_param(math_param_close_rel_spacing,mstyle); break;
- case both_types(close_noad_type,open_noad_type ): x = get_math_param(math_param_close_open_spacing,mstyle); break;
- case both_types(close_noad_type,close_noad_type): x = get_math_param(math_param_close_close_spacing,mstyle); break;
- case both_types(close_noad_type,punct_noad_type): x = get_math_param(math_param_close_punct_spacing,mstyle); break;
- case both_types(close_noad_type,inner_noad_type): x = get_math_param(math_param_close_inner_spacing,mstyle); break;
- case both_types(punct_noad_type,ord_noad_type ): x = get_math_param(math_param_punct_ord_spacing,mstyle); break;
- case both_types(punct_noad_type,op_noad_type_normal ): x = get_math_param(math_param_punct_op_spacing,mstyle); break;
+ case both_types(open_noad_type, rel_noad_type ): x = get_math_param(math_param_open_rel_spacing,mstyle); break;
+ case both_types(open_noad_type, open_noad_type ): x = get_math_param(math_param_open_open_spacing,mstyle); break;
+ case both_types(open_noad_type, close_noad_type ): x = get_math_param(math_param_open_close_spacing,mstyle); break;
+ case both_types(open_noad_type, punct_noad_type ): x = get_math_param(math_param_open_punct_spacing,mstyle); break;
+ case both_types(open_noad_type, inner_noad_type ): x = get_math_param(math_param_open_inner_spacing,mstyle); break;
+ case both_types(close_noad_type, ord_noad_type ): x = get_math_param(math_param_close_ord_spacing,mstyle); break;
+ case both_types(close_noad_type, op_noad_type_normal): x = get_math_param(math_param_close_op_spacing,mstyle); break;
+ case both_types(close_noad_type, bin_noad_type ): x = get_math_param(math_param_close_bin_spacing,mstyle); break;
+ case both_types(close_noad_type, rel_noad_type ): x = get_math_param(math_param_close_rel_spacing,mstyle); break;
+ case both_types(close_noad_type, open_noad_type ): x = get_math_param(math_param_close_open_spacing,mstyle); break;
+ case both_types(close_noad_type, close_noad_type ): x = get_math_param(math_param_close_close_spacing,mstyle); break;
+ case both_types(close_noad_type, punct_noad_type ): x = get_math_param(math_param_close_punct_spacing,mstyle); break;
+ case both_types(close_noad_type, inner_noad_type ): x = get_math_param(math_param_close_inner_spacing,mstyle); break;
+ case both_types(punct_noad_type, ord_noad_type ): x = get_math_param(math_param_punct_ord_spacing,mstyle); break;
+ case both_types(punct_noad_type, op_noad_type_normal): x = get_math_param(math_param_punct_op_spacing,mstyle); break;
#if 0
- case both_types(punct_noad_type,bin_noad_type ): x = get_math_param(math_param_punct_bin_spacing,mstyle); break;
+ case both_types(punct_noad_type, bin_noad_type ): x = get_math_param(math_param_punct_bin_spacing,mstyle); break;
#endif
- case both_types(punct_noad_type,rel_noad_type ): x = get_math_param(math_param_punct_rel_spacing,mstyle); break;
- case both_types(punct_noad_type,open_noad_type ): x = get_math_param(math_param_punct_open_spacing,mstyle); break;
- case both_types(punct_noad_type,close_noad_type): x = get_math_param(math_param_punct_close_spacing,mstyle); break;
- case both_types(punct_noad_type,punct_noad_type): x = get_math_param(math_param_punct_punct_spacing,mstyle); break;
- case both_types(punct_noad_type,inner_noad_type): x = get_math_param(math_param_punct_inner_spacing,mstyle); break;
- case both_types(inner_noad_type,ord_noad_type ): x = get_math_param(math_param_inner_ord_spacing,mstyle); break;
- case both_types(inner_noad_type,op_noad_type_normal ): x = get_math_param(math_param_inner_op_spacing,mstyle); break;
- case both_types(inner_noad_type,bin_noad_type ): x = get_math_param(math_param_inner_bin_spacing,mstyle); break;
- case both_types(inner_noad_type,rel_noad_type ): x = get_math_param(math_param_inner_rel_spacing,mstyle); break;
- case both_types(inner_noad_type,open_noad_type ): x = get_math_param(math_param_inner_open_spacing,mstyle); break;
- case both_types(inner_noad_type,close_noad_type): x = get_math_param(math_param_inner_close_spacing,mstyle); break;
- case both_types(inner_noad_type,punct_noad_type): x = get_math_param(math_param_inner_punct_spacing,mstyle); break;
- case both_types(inner_noad_type,inner_noad_type): x = get_math_param(math_param_inner_inner_spacing,mstyle); break;
+ case both_types(punct_noad_type, rel_noad_type ): x = get_math_param(math_param_punct_rel_spacing,mstyle); break;
+ case both_types(punct_noad_type, open_noad_type ): x = get_math_param(math_param_punct_open_spacing,mstyle); break;
+ case both_types(punct_noad_type, close_noad_type ): x = get_math_param(math_param_punct_close_spacing,mstyle); break;
+ case both_types(punct_noad_type, punct_noad_type ): x = get_math_param(math_param_punct_punct_spacing,mstyle); break;
+ case both_types(punct_noad_type, inner_noad_type ): x = get_math_param(math_param_punct_inner_spacing,mstyle); break;
+ case both_types(inner_noad_type, ord_noad_type ): x = get_math_param(math_param_inner_ord_spacing,mstyle); break;
+ case both_types(inner_noad_type, op_noad_type_normal): x = get_math_param(math_param_inner_op_spacing,mstyle); break;
+ case both_types(inner_noad_type, bin_noad_type ): x = get_math_param(math_param_inner_bin_spacing,mstyle); break;
+ case both_types(inner_noad_type, rel_noad_type ): x = get_math_param(math_param_inner_rel_spacing,mstyle); break;
+ case both_types(inner_noad_type, open_noad_type ): x = get_math_param(math_param_inner_open_spacing,mstyle); break;
+ case both_types(inner_noad_type, close_noad_type ): x = get_math_param(math_param_inner_close_spacing,mstyle); break;
+ case both_types(inner_noad_type, punct_noad_type ): x = get_math_param(math_param_inner_punct_spacing,mstyle); break;
+ case both_types(inner_noad_type, inner_noad_type ): x = get_math_param(math_param_inner_inner_spacing,mstyle); break;
/* *INDENT-ON* */
}
if (x < 0) {
@@ -3194,11 +3688,13 @@ static pointer math_spacing_glue(int l_type, int r_type, int mstyle, scaled mmu)
}
if (x != 0) {
pointer y;
- if (x <= thick_mu_skip_code) { /* trap thin/med/thick settings cf. old TeX */
+ if (x <= thick_mu_skip_code) {
+ /* trap thin/med/thick settings cf. old TeX */
y = math_glue(glue_par(x), mmu);
z = new_glue(y);
glue_ref_count(y) = null;
- subtype(z) = (quarterword) (x + 1); /* store a symbolic subtype */
+ /* store a symbolic subtype */
+ subtype(z) = (quarterword) (x + 1);
} else {
y = math_glue(x, mmu);
z = new_glue(y);
@@ -3209,8 +3705,7 @@ static pointer math_spacing_glue(int l_type, int r_type, int mstyle, scaled mmu)
}
@ @c
-static pointer check_nucleus_complexity(halfword q, scaled * delta,
- int cur_style)
+static pointer check_nucleus_complexity(halfword q, scaled * delta, int cur_style)
{
pointer p = null;
switch (type(nucleus(q))) {
@@ -3218,19 +3713,37 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta,
case math_text_char_node:
fetch(nucleus(q));
if (char_exists(cur_f, cur_c)) {
- *delta = char_italic(cur_f, cur_c);
+ /* we could look at neighbours */
+ if (is_new_mathfont(cur_f)) {
+ *delta = 0 ; /* cf spec only the last one */
+ } else {
+ *delta = char_italic(cur_f, cur_c);
+ }
p = new_glyph(cur_f, cur_c);
reset_attributes(p, node_attr(nucleus(q)));
- if ((is_new_mathfont(cur_f) && get_char_cat_code(cur_c) == 11) ||
- (!is_new_mathfont(cur_f) && type(nucleus(q)) == math_text_char_node && space(cur_f)) != 0) {
- *delta = 0; /* no italic correction in mid-word of text font */
- }
+ if (is_new_mathfont(cur_f)) {
+ if (! math_no_char_italic) {
+ /* 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 */
+ *delta = 0;
+ }
+ } else {
+ /* no italic correction in mid-word of text font */
+ if (((type(nucleus(q))) == math_text_char_node) && (space(cur_f) != 0)) {
+ *delta = 0;
+ }
+ }
+ /* so we only add italic correction when we have no scripts */
if ((subscr(q) == null) && (supscr(q) == null) && (*delta != 0)) {
pointer x = new_kern(*delta);
reset_attributes(x, node_attr(nucleus(q)));
couple_nodes(p,x);
*delta = 0;
}
+ if (is_new_mathfont(cur_f)) {
+ *delta = char_italic(cur_f, cur_c); /* must be more selective */
+ }
}
break;
case sub_box_node:
@@ -3254,19 +3767,19 @@ static pointer check_nucleus_complexity(halfword q, scaled * delta,
@c
static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
{
- pointer q; /* runs through the mlist */
- pointer r; /* the most recent noad preceding |q| */
+ pointer q; /* runs through the mlist */
+ pointer r; /* the most recent noad preceding |q| */
int style;
- int r_type; /* the |type| of noad |r|, or |op_noad| if |r=null| */
- int r_subtype; /* the |subtype| of noad |r| if |r_type| is |fence_noad| */
- int t; /* the effective |type| of noad |q| during the second pass */
- int t_subtype; /* the effective |subtype| of noad |q| during the second pass */
- pointer p, x, y, z; /* temporary registers for list construction */
- int pen; /* a penalty to be inserted */
- scaled max_hl, max_d; /* maximum height and depth of the list translated so far */
- scaled delta; /* italic correction offset for subscript and superscript */
- scaled cur_mu; /* the math unit width corresponding to |cur_size| */
- style = cur_style; /* tuck global parameter away as local variable */
+ int r_type; /* the |type| of noad |r|, or |op_noad| if |r=null| */
+ int r_subtype; /* the |subtype| of noad |r| if |r_type| is |fence_noad| */
+ int t; /* the effective |type| of noad |q| during the second pass */
+ int t_subtype; /* the effective |subtype| of noad |q| during the second pass */
+ pointer p, x, y, z; /* temporary registers for list construction */
+ int pen; /* a penalty to be inserted */
+ scaled max_hl, max_d; /* maximum height and depth of the list translated so far */
+ scaled delta; /* italic correction offset for subscript and superscript */
+ scaled cur_mu; /* the math unit width corresponding to |cur_size| */
+ style = cur_style; /* tuck global parameter away as local variable */
q = mlist;
r = null;
r_type = simple_noad;
@@ -3278,12 +3791,15 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
setup_cur_size(cur_style);
cur_mu = x_over_n(get_math_quad(cur_size), 18);
while (q != null) {
- /* We use the fact that no character nodes appear in an mlist, hence
- the field |type(q)| is always present. */
+ /*
+ we use the fact that no character nodes appear in an mlist, hence
+ the field |type(q)| is always present.
+
+ one of the things we must do on the first pass is change a |bin_noad| to
+ an |ord_noad| if the |bin_noad| is not in the context of a binary operator
- /* One of the things we must do on the first pass is change a |bin_noad| to
- an |ord_noad| if the |bin_noad| is not in the context of a binary operator.
- The values of |r| and |r_type| make this fairly easy. */
+ the values of |r| and |r_type| make this fairly easy
+ */
RESWITCH:
delta = 0;
switch (type(q)) {
@@ -3307,7 +3823,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
break;
case fence_noad:
if (r_subtype == left_noad_side) {
- subtype(q) = ord_noad_type;
+ subtype(q) = ord_noad_type; /* so these can best be the same size */
goto RESWITCH;
}
break;
@@ -3326,7 +3842,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
case close_noad_type:
case punct_noad_type:
if (r_type == simple_noad && r_subtype == bin_noad_type) {
- type(r) = simple_noad;
+ type(r) = simple_noad; /* assumes the same size .. can't this go */
subtype(r) = ord_noad_type;
}
break;
@@ -3334,7 +3850,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
case op_noad_type_limits:
case op_noad_type_no_limits:
delta = make_op(q, cur_style);
- if (subtype(q) == op_noad_type_limits)
+ if ((subtype(q) == op_noad_type_limits) || (subtype(q) == op_noad_type_no_limits))
goto CHECK_DIMENSIONS;
break;
case ord_noad_type:
@@ -3348,7 +3864,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
case fence_noad:
if (subtype(q) != left_noad_side)
if (r_type == simple_noad && r_subtype == bin_noad_type) {
- type(r) = simple_noad;
+ type(r) = simple_noad; /* assumes the same size */
subtype(r) = ord_noad_type;
}
goto DONE_WITH_NOAD;
@@ -3358,7 +3874,9 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
goto CHECK_DIMENSIONS;
break;
case radical_noad:
- if (subtype(q) == 6)
+ if (subtype(q) == 7)
+ make_hextension(q, cur_style);
+ else if (subtype(q) == 6)
make_delimiter_over(q, cur_style);
else if (subtype(q) == 5)
make_delimiter_under(q, cur_style);
@@ -3375,26 +3893,24 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
case style_node:
cur_style = subtype(q);
setup_cur_size(cur_style);
- /* HH-LS: was cur_mu = x_over_n(get_math_quad(cur_size), 18);*/
- /* This is an old bug so the fix can influence outcome */
cur_mu = x_over_n(get_math_quad(cur_style), 18);
goto DONE_WITH_NODE;
break;
case choice_node:
switch (cur_style / 2) {
- case 0:
+ case 0: /* |display_style=0| */
choose_mlist(display_mlist);
- break; /* |display_style=0| */
- case 1:
+ break;
+ case 1: /* |text_style=2| */
choose_mlist(text_mlist);
- break; /* |text_style=2| */
- case 2:
+ break;
+ case 2: /* |script_style=4| */
choose_mlist(script_mlist);
- break; /* |script_style=4| */
- case 3:
+ break;
+ case 3: /* |script_script_style=6| */
choose_mlist(script_script_mlist);
- break; /* |script_script_style=6| */
- } /* there are no other cases */
+ break;
+ }
flush_node_list(display_mlist(q));
flush_node_list(text_mlist(q));
flush_node_list(script_mlist(q));
@@ -3413,6 +3929,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
case ins_node:
case mark_node:
case adjust_node:
+ case boundary_node:
case whatsit_node:
case penalty_node:
case disc_node:
@@ -3427,21 +3944,22 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
break;
case glue_node:
/*
- Conditional math glue (`\.{\\nonscript}') results in a |glue_node|
- pointing to |zero_glue|, with |subtype(q)=cond_math_glue|; in such a case
- the node following will be eliminated if it is a glue or kern node and if the
- current size is different from |text_size|. Unconditional math glue
- (`\.{\\muskip}') is converted to normal glue by multiplying the dimensions
- by |cur_mu|.
- */
+ conditional math glue (`\.{\\nonscript}') results in a |glue_node|
+ pointing to |zero_glue|, with |subtype(q)=cond_math_glue|; in such a case
+ the node following will be eliminated if it is a glue or kern node and if the
+ current size is different from |text_size|
+
+ unconditional math glue (`\.{\\muskip}') is converted to normal glue by
+ multiplying the dimensions by |cur_mu|
+
+ */
if (subtype(q) == mu_glue) {
x = glue_ptr(q);
y = math_glue(x, cur_mu);
delete_glue_ref(x);
glue_ptr(q) = y;
subtype(q) = normal;
- } else if ((cur_size != text_size)
- && (subtype(q) == cond_math_glue)) {
+ } else if ((cur_size != text_size) && (subtype(q) == cond_math_glue)) {
p = vlink(q);
if (p != null)
if ((type(p) == glue_node) || (type(p) == kern_node)) {
@@ -3457,24 +3975,27 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
goto DONE_WITH_NODE;
break;
default:
- confusion("mlist1"); /* this can't happen mlist1 */
- }
- /* When we get to the following part of the program, we have ``fallen through''
- from cases that did not lead to |check_dimensions| or |done_with_noad| or
- |done_with_node|. Thus, |q|~points to a noad whose nucleus may need to be
- converted to an hlist, and whose subscripts and superscripts need to be
- appended if they are present.
-
- If |nucleus(q)| is not a |math_char|, the variable |delta| is the amount
- by which a superscript should be moved right with respect to a subscript
- when both are present.
- */
+ confusion("mlist1");
+ }
+ /*
+ When we get to the following part of the program, we have ``fallen through''
+ from cases that did not lead to |check_dimensions| or |done_with_noad| or
+ |done_with_node|. Thus, |q|~points to a noad whose nucleus may need to be
+ converted to an hlist, and whose subscripts and superscripts need to be
+ appended if they are present.
+
+ If |nucleus(q)| is not a |math_char|, the variable |delta| is the amount
+ by which a superscript should be moved right with respect to a subscript
+ when both are present.
+
+ */
p = check_nucleus_complexity(q, &delta, cur_style);
if ((subscr(q) == null) && (supscr(q) == null)) {
assign_new_hlist(q, p);
} else {
- make_scripts(q, p, delta, cur_style); /* top, bottom */
+ /* top, bottom */
+ make_scripts(q, p, delta, cur_style, 0, 0);
}
CHECK_DIMENSIONS:
z = hpack(new_hlist(q), 0, additional, -1);
@@ -3483,7 +4004,8 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
if (depth(z) > max_d)
max_d = depth(z);
list_ptr(z) = null;
- flush_node(z); /* only drop the \.{\\hbox} */
+ /* only drop the \.{\\hbox} */
+ flush_node(z);
DONE_WITH_NOAD:
r = q;
r_type = type(r);
@@ -3501,15 +4023,16 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
type(r) = simple_noad;
subtype(r) = ord_noad_type;
}
- /* Make a second pass over the mlist, removing all noads and inserting the
- proper spacing and penalties */
-
- /* We have now tied up all the loose ends of the first pass of |mlist_to_hlist|.
- The second pass simply goes through and hooks everything together with the
- proper glue and penalties. It also handles the |fence_noad|s that
- might be present, since |max_hl| and |max_d| are now known. Variable |p| points
- to a node at the current end of the final hlist.
- */
+ /*
+ Make a second pass over the mlist, removing all noads and inserting the
+ proper spacing and penalties.
+
+ We have now tied up all the loose ends of the first pass of |mlist_to_hlist|.
+ The second pass simply goes through and hooks everything together with the
+ proper glue and penalties. It also handles the |fence_noad|s that
+ might be present, since |max_hl| and |max_d| are now known. Variable |p| points
+ to a node at the current end of the final hlist.
+ */
p = temp_head;
vlink(p) = null;
q = mlist;
@@ -3520,13 +4043,16 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
cur_mu = x_over_n(get_math_quad(cur_size), 18);
NEXT_NODE:
while (q != null) {
- /* If node |q| is a style node, change the style and |goto delete_q|;
- otherwise if it is not a noad, put it into the hlist,
- advance |q|, and |goto done|; otherwise set |s| to the size
- of noad |q|, set |t| to the associated type (|ord_noad..
- inner_noad|), and set |pen| to the associated penalty */
- /* Just before doing the big |case| switch in the second pass, the program
- sets up default values so that most of the branches are short. */
+ /*
+ If node |q| is a style node, change the style and |goto delete_q|;
+ otherwise if it is not a noad, put it into the hlist,
+ advance |q|, and |goto done|; otherwise set |s| to the size
+ of noad |q|, set |t| to the associated type (|ord_noad..
+ inner_noad|), and set |pen| to the associated penalty
+
+ Just before doing the big |case| switch in the second pass, the program
+ sets up default values so that most of the branches are short.
+ */
t = simple_noad;
t_subtype = ord_noad_type;
pen = inf_penalty;
@@ -3580,10 +4106,11 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
goto NEXT_NODE;
break;
default:
- confusion("mlist3"); /* this can't happen mlist3 */
+ confusion("mlist3");
}
/* Append inter-element spacing based on |r_type| and |t| */
- if (r_type > 0) { /* not the first noad */
+ if (r_type > 0) {
+ /* not the first noad */
z = math_spacing_glue(r_subtype, t_subtype, cur_style, cur_mu);
if (z != null) {
reset_attributes(z, node_attr(p));
@@ -3591,12 +4118,13 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
p = z;
}
}
+ /*
+ Append any |new_hlist| entries for |q|, and any appropriate penalties
- /* Append any |new_hlist| entries for |q|, and any appropriate penalties */
- /* We insert a penalty node after the hlist entries of noad |q| if |pen|
- is not an ``infinite'' penalty, and if the node immediately following |q|
- is not a penalty node or a |rel_noad| or absent entirely. */
-
+ We insert a penalty node after the hlist entries of noad |q| if |pen|
+ is not an ``infinite'' penalty, and if the node immediately following |q|
+ is not a penalty node or a |rel_noad| or absent entirely.
+ */
if (new_hlist(q) != null) {
couple_nodes(p,new_hlist(q));
do {
@@ -3606,8 +4134,7 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
if (penalties && vlink(q) != null && pen < inf_penalty) {
r_type = type(vlink(q));
r_subtype = subtype(vlink(q));
- if (r_type != penalty_node
- && (r_type != simple_noad || r_subtype != rel_noad_type)) {
+ if (r_type != penalty_node && (r_type != simple_noad || r_subtype != rel_noad_type)) {
z = new_penalty(pen);
reset_attributes(z, node_attr(q));
couple_nodes(p,z);
@@ -3623,15 +4150,16 @@ static void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
DELETE_Q:
r = q;
q = vlink(q);
- /* The m-to-hlist conversion takes place in-place,
- so the various dependant fields may not be freed
- (as would happen if |flush_node| was called).
- A low-level |free_node| is easier than attempting
- to nullify such dependant fields for all possible
- node and noad types.
- */
+ /*
+ The m-to-hlist conversion takes place in-place, so the various dependant
+ fields may not be freed (as would happen if |flush_node| was called).
+
+ A low-level |free_node| is easier than attempting to nullify such dependant
+ fields for all possible node and noad types.
+ */
if (nodetype_has_attributes(type(r)))
delete_attribute_ref(node_attr(r));
+ reset_node_properties(r);
free_node(r, get_node_size(type(r), subtype(r)));
}
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.h b/Build/source/texk/web2c/luatexdir/tex/packaging.h
index b1e68e8f732..c431ed15396 100644
--- a/Build/source/texk/web2c/luatexdir/tex/packaging.h
+++ b/Build/source/texk/web2c/luatexdir/tex/packaging.h
@@ -1,5 +1,5 @@
/* packaging.h
-
+
Copyright 2009 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -58,7 +58,7 @@ extern halfword new_margin_kern(scaled w, halfword p, int side);
# define update_adjust_list(A) do { \
if (A == null) \
- pdf_error("pre vadjust", "adjust_tail or pre_adjust_tail is null"); \
+ normal_error("pre vadjust", "adjust_tail or pre_adjust_tail is null"); \
vlink(A) = adjust_ptr(p); \
while (vlink(A) != null) \
A = vlink(A); \
@@ -80,7 +80,7 @@ extern halfword filtered_vpackage(halfword p, scaled h, int m, scaled l,
int grp, int d);
extern void finish_vcenter(void);
extern void package(int c);
-extern void append_to_vlist(halfword b);
+extern void append_to_vlist(halfword b, int location);
extern halfword prune_page_top(halfword p, boolean s);
extern scaled active_height[10]; /* distance from first active node to~|cur_p| */
diff --git a/Build/source/texk/web2c/luatexdir/tex/packaging.w b/Build/source/texk/web2c/luatexdir/tex/packaging.w
index 731e7e1524a..173b7894cb2 100644
--- a/Build/source/texk/web2c/luatexdir/tex/packaging.w
+++ b/Build/source/texk/web2c/luatexdir/tex/packaging.w
@@ -1,4 +1,4 @@
-% packaging.w
+4% packaging.w
%
% Copyright 2009-2010 Taco Hoekwater <taco@@luatex.org>
%
@@ -220,7 +220,7 @@ halfword last_rightmost_char;
halfword next_char_p; /* pointer to the next char of an implicit kern */
halfword prev_char_p; /* pointer to the previous char of an implicit kern */
-@ This procedure is called repeatedly from inside the line break algorithm.
+@ This procedure is called repeatedly from inside the line break algorithm.
@c
void set_prev_char_p(halfword p)
{
@@ -337,7 +337,7 @@ void do_subst_font(halfword p, int ex_ratio)
if (is_char_node(p)) {
r = p;
} else {
- pdf_error("font expansion", "invalid node type");
+ normal_error("font expansion", "invalid node type");
return;
}
f = font(r);
@@ -387,7 +387,7 @@ halfword new_margin_kern(scaled w, halfword p, int side)
k = new_node(margin_kern_node, side);
width(k) = w;
if (p == null)
- pdf_error("margin kerning", "invalid pointer to marginal char node");
+ normal_error("margin kerning", "invalid pointer to marginal char node");
q = new_char(font(p), character(p));
margin_char(k) = q;
return k;
@@ -541,31 +541,26 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
p = q;
}
break;
- case whatsit_node:
- /* Incorporate a whatsit node into an hbox */
- if (subtype(p) == dir_node) {
- /* DIR: Adjust the dir stack for the |hpack| routine */
- if (dir_dir(p) >= 0) {
- hpack_dir = dir_dir(p);
- push_dir_node(p,dir_ptr1);
- } else {
- pop_dir_node(dir_ptr1);
- if (dir_ptr1 != null)
- hpack_dir = dir_dir(dir_ptr1);
- }
-
+ case dir_node:
+ /* DIR: Adjust the dir stack for the |hpack| routine */
+ if (dir_dir(p) >= 0) {
+ hpack_dir = dir_dir(p);
+ push_dir_node(p,dir_ptr1);
} else {
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node)) {
- x += width(p);
- s = 0;
- if (height(p) - s > h)
- h = height(p) - s;
- if (depth(p) + s > d)
- d = depth(p) + s;
- }
+ pop_dir_node(dir_ptr1);
+ if (dir_ptr1 != null)
+ hpack_dir = dir_dir(dir_ptr1);
}
break;
+ case math_node:
+ /* begin mathskip code */
+ if (glue_ptr(p) == zero_glue) {
+ x += surround(p);
+ break;
+ } else {
+ /* fall through: mathskip */
+ }
+ /* end mathskip code */
case glue_node:
/* Incorporate glue into the horizontal totals */
g = glue_ptr(p);
@@ -623,9 +618,6 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
}
x += width(p);
break;
- case math_node:
- x += surround(p);
- break;
case disc_node:
if (m == subst_ex_font)
do_subst_font(p, font_expand_ratio);
@@ -699,13 +691,30 @@ 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)) {
- print_ln();
- if (last_badness > 100)
- tprint_nl("Underfull \\hbox (badness ");
- else
- tprint_nl("Loose \\hbox (badness ");
- print_int(last_badness);
- goto COMMON_ENDING;
+ int callback_id = callback_defined(hpack_quality_callback);
+ if (callback_id > 0) {
+ halfword rule = null;
+ if (last_badness > 100) {
+ run_callback(callback_id, "SdNdd->N","underfull",last_badness,r,abs(pack_begin_line),line,&rule);
+ } else {
+ run_callback(callback_id, "SdNdd->N","loose",last_badness,r,abs(pack_begin_line),line,&rule);
+ }
+ if (rule != null) {
+ while (vlink(q) != null) {
+ q = vlink(q);
+ }
+ couple_nodes(q,rule);
+ }
+ } else {
+ print_ln();
+ if (last_badness > 100) {
+ tprint_nl("Underfull \\hbox (badness ");
+ } else {
+ tprint_nl("Loose \\hbox (badness ");
+ }
+ print_int(last_badness);
+ goto COMMON_ENDING;
+ }
}
}
}
@@ -738,35 +747,56 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
set_glue_ratio_zero(glue_set(r)); /* there's nothing to shrink */
}
if ((total_shrink[o] < -x) && (o == normal) && (list_ptr(r) != null)) {
+ int overshoot = -x - total_shrink[normal] ;
last_badness = 1000000;
set_glue_ratio_one(glue_set(r)); /* use the maximum shrinkage */
/* Report an overfull hbox and |goto common_ending|, if this box
is sufficiently bad */
- if ((-x - total_shrink[normal] > dimen_par(hfuzz_code))
- || (int_par(hbadness_code) < 100)) {
- if ((dimen_par(overfull_rule_code) > 0)
- && (-x - total_shrink[normal] > dimen_par(hfuzz_code))) {
- while (vlink(q) != null)
+ if ((overshoot > dimen_par(hfuzz_code)) || (int_par(hbadness_code) < 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) {
+ rule = new_rule(normal_rule);
+ rule_dir(rule) = box_dir(r);
+ width(rule) = dimen_par(overfull_rule_code);
+ }
+ if (rule != null) {
+ while (vlink(q) != null) {
q = vlink(q);
- vlink(q) = new_rule();
- rule_dir(vlink(q)) = box_dir(r);
- width(vlink(q)) = dimen_par(overfull_rule_code);
+ }
+ couple_nodes(q,rule);
+ }
+ if (callback_id == 0) {
+ print_ln();
+ tprint_nl("Overfull \\hbox (");
+ print_scaled(overshoot);
+ tprint("pt too wide");
+ goto COMMON_ENDING;
}
- print_ln();
- tprint_nl("Overfull \\hbox (");
- print_scaled(-x - total_shrink[normal]);
- tprint("pt too wide");
- goto COMMON_ENDING;
}
} else if (o == normal) {
if (list_ptr(r) != null) {
/* Report a tight hbox and |goto common_ending|, if this box is sufficiently bad */
last_badness = badness(-x, total_shrink[normal]);
if (last_badness > int_par(hbadness_code)) {
- print_ln();
- tprint_nl("Tight \\hbox (badness ");
- print_int(last_badness);
- goto COMMON_ENDING;
+ int callback_id = callback_defined(hpack_quality_callback);
+ if (callback_id > 0) {
+ halfword rule = null;
+ run_callback(callback_id, "SdNdd->N","tight",last_badness,r,abs(pack_begin_line),line,&rule);
+ if (rule != null) {
+ while (vlink(q) != null) {
+ q = vlink(q);
+ }
+ couple_nodes(q,rule);
+ }
+ } else {
+ print_ln();
+ tprint_nl("Tight \\hbox (badness ");
+ print_int(last_badness);
+ goto COMMON_ENDING;
+ }
}
}
}
@@ -779,10 +809,11 @@ halfword hpack(halfword p, scaled w, int m, int pack_direction)
tprint(") has occurred while \\output is active");
} else {
if (pack_begin_line != 0) {
- if (pack_begin_line > 0)
+ if (pack_begin_line > 0) {
tprint(") in paragraph at lines ");
- else
+ } else {
tprint(") in alignment at lines ");
+ }
print_int(abs(pack_begin_line));
tprint("--");
} else {
@@ -874,17 +905,15 @@ scaled_whd natural_sizes(halfword p, halfword pp, glue_ratio g_mult,
if (depth(p) + s > siz.dp)
siz.dp = depth(p) + s;
break;
- case whatsit_node:
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node)) {
- siz.wd += width(p);
- s = 0;
- if (height(p) - s > siz.ht)
- siz.ht = height(p) - s;
- if (depth(p) + s > siz.dp)
- siz.dp = depth(p) + s;
+ case math_node:
+ /* begin mathskip code */
+ if (glue_ptr(p) == zero_glue) {
+ siz.wd += surround(p);
+ break;
+ } else {
+ /* fall through: mathskip */
}
- break;
+ /* end mathskip code */
case glue_node:
g = glue_ptr(p);
siz.wd += width(g);
@@ -913,9 +942,6 @@ scaled_whd natural_sizes(halfword p, halfword pp, glue_ratio g_mult,
case kern_node:
siz.wd += width(p);
break;
- case math_node:
- siz.wd += surround(p);
- break;
case disc_node:
xx = natural_sizes(no_break(p), null, g_mult, g_sign, g_order,
hpack_dir);
@@ -1016,17 +1042,6 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
if (width(p) + s > w)
w = width(p) + s;
break;
- case whatsit_node:
- /* Incorporate a whatsit node into a vbox */
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node)) {
- x += d + height(p);
- d = depth(p);
- s = 0;
- if (width(p) + s > w)
- w = width(p) + s;
- }
- break;
case glue_node:
/* Incorporate glue into the vertical totals */
x += d;
@@ -1102,13 +1117,24 @@ 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)) {
- print_ln();
- if (last_badness > 100)
- tprint_nl("Underfull \\vbox (badness ");
- else
- tprint_nl("Loose \\vbox (badness ");
- print_int(last_badness);
- goto COMMON_ENDING;
+ int callback_id = callback_defined(vpack_quality_callback);
+ if (callback_id > 0) {
+ if (last_badness > 100) {
+ run_callback(callback_id, "SdNdd->","underfull",last_badness,r,abs(pack_begin_line),line);
+ } else {
+ run_callback(callback_id, "SdNdd->","loose",last_badness,r,abs(pack_begin_line),line);
+ }
+ goto EXIT;
+ } else {
+ print_ln();
+ if (last_badness > 100) {
+ tprint_nl("Underfull \\vbox (badness ");
+ } else {
+ tprint_nl("Loose \\vbox (badness ");
+ }
+ print_int(last_badness);
+ goto COMMON_ENDING;
+ }
}
}
}
@@ -1138,26 +1164,38 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
set_glue_ratio_zero(glue_set(r)); /* there's nothing to shrink */
}
if ((total_shrink[o] < -x) && (o == normal) && (list_ptr(r) != null)) {
+ int overshoot = -x - total_shrink[normal];
last_badness = 1000000;
set_glue_ratio_one(glue_set(r)); /* use the maximum shrinkage */
/* Report an overfull vbox and |goto common_ending|, if this box is sufficiently bad */
- if ((-x - total_shrink[normal] > dimen_par(vfuzz_code))
- || (int_par(vbadness_code) < 100)) {
- print_ln();
- tprint_nl("Overfull \\vbox (");
- print_scaled(-x - total_shrink[normal]);
- tprint("pt too high");
- goto COMMON_ENDING;
+ if ((overshoot > dimen_par(vfuzz_code)) || (int_par(vbadness_code) < 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);
+ goto EXIT;
+ } else {
+ print_ln();
+ tprint_nl("Overfull \\vbox (");
+ print_scaled(-x - total_shrink[normal]);
+ tprint("pt too high");
+ goto COMMON_ENDING;
+ }
}
} else if (o == normal) {
if (list_ptr(r) != null) {
/* Report a tight vbox and |goto common_ending|, if this box is sufficiently bad */
last_badness = badness(-x, total_shrink[normal]);
if (last_badness > int_par(vbadness_code)) {
- print_ln();
- tprint_nl("Tight \\vbox (badness ");
- print_int(last_badness);
- goto COMMON_ENDING;
+ 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);
+ goto EXIT;
+ } else {
+ print_ln();
+ tprint_nl("Tight \\vbox (badness ");
+ print_int(last_badness);
+ goto COMMON_ENDING;
+ }
}
}
}
@@ -1182,6 +1220,7 @@ halfword vpackage(halfword p, scaled h, int m, scaled l, int pack_direction)
begin_diagnostic();
show_box(r);
end_diagnostic(true);
+ EXIT:
return r;
}
@@ -1226,7 +1265,7 @@ void package(int c)
cur_box = filtered_hpack(cur_list.head_field,
cur_list.tail_field, saved_value(1),
saved_level(1), grp, saved_level(2));
- subtype(cur_box) = HLIST_SUBTYPE_HBOX;
+ subtype(cur_box) = hbox_list;
} else {
cur_box = filtered_vpackage(vlink(cur_list.head_field),
saved_value(1), saved_level(1), d, grp,
@@ -1265,31 +1304,47 @@ void package(int c)
baselineskip calculation is handled by the |append_to_vlist| routine.
@c
-void append_to_vlist(halfword b)
+void append_to_vlist(halfword b, int location)
{
- scaled d; /* deficiency of space between baselines */
- halfword p; /* a new glue node */
- if (prev_depth > ignore_depth) {
- if ((type(b) == hlist_node) && is_mirrored(box_dir(b))) {
- d = width(glue_par(baseline_skip_code)) - prev_depth - depth(b);
- } else {
- d = width(glue_par(baseline_skip_code)) - prev_depth - height(b);
+ scaled d; /* deficiency of space between baselines */
+ halfword p; /* a new glue node */
+ boolean mirrored = (type(b) == hlist_node) && is_mirrored(box_dir(b)) ;
+ 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)) {
+ 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;
}
- if (d < dimen_par(line_skip_limit_code)) {
- p = new_param_glue(line_skip_code);
+ } else {
+ if (prev_depth > ignore_depth) {
+ if (mirrored) {
+ d = width(glue_par(baseline_skip_code)) - prev_depth - depth(b);
+ } else {
+ d = width(glue_par(baseline_skip_code)) - prev_depth - height(b);
+ }
+ if (d < dimen_par(line_skip_limit_code)) {
+ p = new_param_glue(line_skip_code);
+ } else {
+ p = new_skip_param(baseline_skip_code);
+ width(temp_ptr) = d; /* |temp_ptr=glue_ptr(p)| */
+ }
+ couple_nodes(cur_list.tail_field, p);
+ cur_list.tail_field = p;
+ }
+ couple_nodes(cur_list.tail_field, b);
+ cur_list.tail_field = b;
+ if (mirrored) {
+ prev_depth = height(b);
} else {
- p = new_skip_param(baseline_skip_code);
- width(temp_ptr) = d; /* |temp_ptr=glue_ptr(p)| */
+ prev_depth = depth(b);
}
- couple_nodes(cur_list.tail_field, p);
- cur_list.tail_field = p;
}
- couple_nodes(cur_list.tail_field, b);
- cur_list.tail_field = b;
- if ((type(b) == hlist_node) && is_mirrored(box_dir(b)))
- prev_depth = height(b);
- else
- prev_depth = depth(b);
}
@@ -1344,6 +1399,7 @@ halfword prune_page_top(halfword p, boolean s)
width(temp_ptr) = 0;
p = null;
break;
+ case boundary_node:
case whatsit_node:
case mark_node:
case ins_node:
@@ -1444,13 +1500,8 @@ halfword vert_break(halfword p, scaled h, scaled d)
prev_dp = depth(p);
goto NOT_FOUND;
break;
+ case boundary_node:
case whatsit_node:
- /* Process whatsit |p| in |vert_break| loop, |goto not_found| */
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node)) {
- cur_height = cur_height + prev_dp + height(p);
- prev_dp = depth(p);
- }
goto NOT_FOUND;
break;
case glue_node:
diff --git a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
index 423164ef3d3..873eaf96856 100644
--- a/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
+++ b/Build/source/texk/web2c/luatexdir/tex/postlinebreak.w
@@ -156,12 +156,39 @@ void ext_post_line_break(int paragraph_dir,
list about to be justified. In the meanwhile |r| will point to the
node we will use to insert end-of-line stuff after. |q==null| means
we use the final position of |r| */
+
+ /* begin mathskip code */
+ if (temp_head != null) {
+ q = temp_head;
+ while(q != null) {
+ if (type(q) == math_node) {
+ surround(q) = 0 ;
+ if (glue_ptr(q) != zero_glue) {
+ delete_glue_ref(glue_ptr(q));
+ glue_ptr(q) = zero_glue;
+ }
+ break;
+ } else if ((type(q) == hlist_node) && (subtype(q) == indent_list)) {
+ /* go on */
+ } else if (is_char_node(q)) {
+ break;
+ } else if (non_discardable(q)) {
+ break;
+ } else if (type(q) == kern_node && subtype(q) != explicit) {
+ break;
+ }
+ q = vlink(q);
+ }
+ }
+ /* end mathskip code */
+
r = cur_break(cur_p);
q = null;
disc_break = false;
post_disc_break = false;
glue_break = false;
+
if (r == null) {
for (r = temp_head; vlink(r) != null; r = vlink(r));
if (r == final_par_glue) {
@@ -172,6 +199,14 @@ void ext_post_line_break(int paragraph_dir,
r = alink(r);
}
/* |r| refers to the node after which the dir nodes should be closed */
+ } else if (type(r) == math_node) {
+ surround(r) = 0;
+ /* begin mathskip code */
+ if (glue_ptr(r) != zero_glue) {
+ delete_glue_ref(glue_ptr(r));
+ glue_ptr(r) = zero_glue;
+ }
+ /* end mathskip code */
} else if (type(r) == glue_node) {
delete_glue_ref(glue_ptr(r));
glue_ptr(r) = right_skip;
@@ -245,8 +280,6 @@ void ext_post_line_break(int paragraph_dir,
disc_break = true;
} else if (type(r) == kern_node) {
width(r) = 0;
- } else if (type(r) == math_node) {
- surround(r) = 0;
}
/* DIR: Adjust the dir stack based on dir nodes in this line; */
@@ -254,15 +287,13 @@ void ext_post_line_break(int paragraph_dir,
if (have_directional) {
halfword e;
halfword p;
- for (e = vlink(temp_head); e != null && e != cur_break(cur_p);
- e = vlink(e)) {
- if (type(e) != whatsit_node || subtype(e) != dir_node)
- continue;
- if (dir_dir(e) >= 0) {
- dir_ptr = do_push_dir_node(dir_ptr, e);
- } else if (dir_ptr != null
- && dir_dir(dir_ptr) == (dir_dir(e) + 64)) {
- dir_ptr = do_pop_dir_node(dir_ptr);
+ for (e = vlink(temp_head); e != null && e != cur_break(cur_p); e = vlink(e)) {
+ if (type(e) == dir_node) {
+ if (dir_dir(e) >= 0) {
+ dir_ptr = do_push_dir_node(dir_ptr, e);
+ } else if (dir_ptr != null && dir_dir(dir_ptr) == (dir_dir(e) + dir_swap)) {
+ dir_ptr = do_pop_dir_node(dir_ptr);
+ }
}
}
assert(e == cur_break(cur_p));
@@ -270,7 +301,7 @@ void ext_post_line_break(int paragraph_dir,
/* DIR: Insert dir nodes at the end of the current line; */
e = vlink(r);
for (p = dir_ptr; p != null; p = vlink(p)) {
- halfword s = new_dir(dir_dir(p) - 64);
+ halfword s = new_dir(dir_dir(p) - dir_swap);
delete_attribute_ref(node_attr(s));
node_attr(s) = node_attr(r);
add_node_attr_ref(node_attr(s));
@@ -383,8 +414,8 @@ void ext_post_line_break(int paragraph_dir,
}
if (left_skip != zero_glue) {
r = new_glue(copy_node(left_skip));
- glue_ref_count(glue_ptr(r)) = null;
- subtype(r) = left_skip_code+1;
+ glue_ref_count(glue_ptr(r)) = null;
+ subtype(r) = left_skip_code+1;
delete_attribute_ref(node_attr(r));
node_attr(r) = node_attr(q);
add_node_attr_ref(node_attr(r));
@@ -416,7 +447,7 @@ void ext_post_line_break(int paragraph_dir,
just_box = hpack(q, cur_width, exactly, paragraph_dir);
}
shift_amount(just_box) = cur_indent;
- subtype(just_box) = HLIST_SUBTYPE_LINE;
+ subtype(just_box) = line_list;
/* /Call the packaging subroutine, setting |just_box| to the justified box; */
if ((vlink(contrib_head) != null))
@@ -428,7 +459,7 @@ void ext_post_line_break(int paragraph_dir,
lua_node_filter_s(buildpage_filter_callback, lua_key_index(pre_adjust));
}
pre_adjust_tail = null;
- append_to_vlist(just_box);
+ append_to_vlist(just_box,lua_key_index(post_linebreak));
if (!output_active)
lua_node_filter_s(buildpage_filter_callback, lua_key_index(box));
if (adjust_head != adjust_tail) {
@@ -510,78 +541,50 @@ void ext_post_line_break(int paragraph_dir,
|break_width| values are computed for non-discretionary
breakpoints. */
r = temp_head;
- if (experimental_code[1]) {
- /* hh-ls: This is a first step to improving symmetry and consistency in the node
- list. This is normally no issue in tex, but in callbacks it matters. */
-
- /* Normally we have a matching math open and math close node but when we cross a line
+ /*
+ Normally we have a matching math open and math close node but when we cross a line
the open node is removed, including any glue or penalties following it. This is however
not that nice for callbacks that rely on symmetry. Of course this only counts for one
liners, as we can still have only a begin or end node on a line. The end_of_math lua
helper is made robust against this although there you should be aware of the fact that
one can end up in the middle of math in callbacks that don't work on whole paragraphs,
but at least this branch makes sure that some proper analysis is possible. (todo: check
- if math glyphs have the subtype marked done). */
-
- halfword m = null ;
- halfword mp, mn, rn ;
- while (1) {
- q = vlink(r);
- if (! q) {
- /* unlikely */
- break;
- } else if (q == cur_break(cur_p)) {
- /* quit */
- break;
- } else if (type(q) == glyph_node) {
- /* quit: is > math_code */
- break;
- } else if (type(q) == math_node) {
- /* we want to keep symmetry */
- surround(q) = 0 ;
- // fprintf(stdout,"KEEP MATH NODE\n");
- m = q ;
- } else if (type(q) == kern_node && subtype(q) != explicit) {
- /* quit: so we keep \kern but also auto kerns */
+ if math glyphs have the subtype marked done).
+
+ Todo: turn math nodes into glues when mathskip otherwise remove them.
+ */
+ while (1) {
+ q = vlink(r);
+ /*
+ if (q == cur_break(cur_p) || is_char_node(q))
+ break;
+ if (!((type(q) == local_par_node))) {
+ if (non_discardable(q) || (type(q) == kern_node && subtype(q) != explicit))
break;
- } if (non_discardable(q)) {
- /* quit: < math_node */
- break;
- } else {
- /* skip: glue, penalty, (font)kern, noads, temp stuff, all kind of left-overs */
- }
- r = q;
}
- if (m != null) {
- if (r == m) {
- /* [a] [b] [m=r] => [a] [b=r] */
- r = alink(m) ;
- } else {
- /* [a] [b] [m] [c] [r] [rn] => [a] [b] [c] [r] [m] [rn] */
- mp = alink(m) ;
- mn = vlink(m) ;
- rn = vlink(r) ;
- vlink(r) = m ;
- alink(m) = r ;
- if (rn) {
- alink(rn) = m ;
- vlink(m) = rn ;
- }
- vlink(mp) = mn ;
- alink(mn) = mp ;
+ */
+ if (type(q) == math_node) {
+ /* begin mathskip code */
+ surround(q) = 0 ;
+ if (glue_ptr(q) != zero_glue) {
+ delete_glue_ref(glue_ptr(q));
+ glue_ptr(q) = zero_glue;
+ add_glue_ref(glue_ptr(q));
}
+ /* end mathskip code */
}
- } else {
- while (1) {
- q = vlink(r);
- if (q == cur_break(cur_p) || is_char_node(q))
- break;
- if (!((type(q) == whatsit_node) && (subtype(q) == local_par_node))) {
- if (non_discardable(q) || (type(q) == kern_node && subtype(q) != explicit))
- break;
- }
- r = q;
+ if (q == cur_break(cur_p)) {
+ break;
+ } else if (is_char_node(q)) {
+ break;
+ } else if (type(q) == local_par_node) {
+ /* weird, in the middle somewhere */
+ } else if (non_discardable(q)) {
+ break;
+ } else if (type(q) == kern_node && subtype(q) != explicit) {
+ break;
}
+ r = q;
}
if (r != temp_head) {
vlink(r) = null;
diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.h b/Build/source/texk/web2c/luatexdir/tex/primitive.h
index 36df9c9be82..b6b13c74f73 100644
--- a/Build/source/texk/web2c/luatexdir/tex/primitive.h
+++ b/Build/source/texk/web2c/luatexdir/tex/primitive.h
@@ -25,17 +25,16 @@
typedef enum {
/* Can be modified as suggested ?*/
- tex_command = 1, /* 1 */
- etex_command = 2, /* 2 */
- pdftex_command = 16,/* 4 */
- luatex_command = 32,/* 8 */
- core_command = 64, /* 16 */
- no_command = 128, /* 32 */
- umath_command = 256,/* 64 */
+ tex_command = 1, /* 1 */
+ etex_command = 2, /* 2 */
+ pdftex_command = 16, /* 4 */ /* obsolete */
+ luatex_command = 32, /* 8 */
+ core_command = 64, /* 16 */
+ no_command = 128, /* 32 */
+ umath_command = 256, /* 64 */ /* obsolete */
} command_origin;
# define hash_size 65536 /* maximum number of control sequences; it should be at most about |(fix_mem_max-fix_mem_min)/10| */
-
# define hash_prime 55711 /* a prime number equal to about 85\pct! of |hash_size| */
extern two_halves *hash; /* the hash table */
diff --git a/Build/source/texk/web2c/luatexdir/tex/primitive.w b/Build/source/texk/web2c/luatexdir/tex/primitive.w
index 432bde28878..05f3cc1126c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/primitive.w
+++ b/Build/source/texk/web2c/luatexdir/tex/primitive.w
@@ -63,8 +63,8 @@ int cs_count; /* total number of known identifiers */
#define prim_base 1
@ The arrays |prim| and |prim_eqtb| are used for name -> cmd,chr lookups.
-
- The are modelled after |hash| and |eqtb|, except that primitives do not
+
+ The are modelled after |hash| and |eqtb|, except that primitives do not
have an |eq_level|, that field is replaced by |origin|.
@c
@@ -84,7 +84,7 @@ static two_halves prim[(prim_size + 1)]; /* the primitives table */
static memory_word prim_eqtb[(prim_size + 1)];
@ The array |prim_data| works the other way around, it is used for
- cmd,chr -> name lookups.
+ cmd,chr -> name lookups.
@c
typedef struct prim_info {
@@ -95,7 +95,7 @@ typedef struct prim_info {
static prim_info prim_data[(last_cmd + 1)];
-@ initialize the memory arrays
+@ initialize the memory arrays
@c
void init_primitives(void)
{
@@ -134,7 +134,7 @@ static halfword compute_hash(const char *j, unsigned int l,
}
-@ Here is the subroutine that searches the primitive table for an identifier
+@ Here is the subroutine that searches the primitive table for an identifier
@c
pointer prim_lookup(str_number s)
{
@@ -182,7 +182,7 @@ pointer prim_lookup(str_number s)
return p;
}
-@ how to test a csname for primitive-ness
+@ how to test a csname for primitive-ness
@c
boolean is_primitive(str_number csname)
{
@@ -198,7 +198,7 @@ boolean is_primitive(str_number csname)
}
-@ a few simple accessors
+@ a few simple accessors
@c
quarterword get_prim_eq_type(int p)
{
@@ -221,7 +221,7 @@ str_number get_prim_text(int p)
}
-@ dumping and undumping
+@ dumping and undumping
@c
void dump_primitives(void)
{
@@ -270,7 +270,7 @@ void undump_primitives(void)
@ Because the definitions of the actual user-accessible name of a
primitive can be postponed until runtime, the function |primitive_def|
- is needed that does nothing except creating the control sequence name.
+ is needed that does nothing except creating the control sequence name.
@c
void primitive_def(const char *s, size_t l, quarterword c, halfword o)
@@ -323,7 +323,7 @@ store_primitive_name(str_number s, quarterword c, halfword o, halfword offset)
prim_data[c].names[idx] = s;
}
-@ Compared to tex82, |primitive| has two extra parameters. The |off| is an offset
+@ Compared to tex82, |primitive| has two extra parameters. The |off| is an offset
that will be passed on to |store_primitive_name|, the |cmd_origin| is the bit
that is used to group primitives by originator.
@@ -363,7 +363,7 @@ static halfword insert_id(halfword p, const unsigned char *j, unsigned int l)
if (cs_text(p) > 0) {
if (hash_high < hash_extra) {
incr(hash_high);
- /* can't use |eqtb_top| here (perhaps because that is not finalized
+ /* can't use |eqtb_top| here (perhaps because that is not finalized
yet when called from |primitive|?) */
cs_next(p) = hash_high + eqtb_size;
p = cs_next(p);
@@ -473,9 +473,9 @@ pointer string_lookup(const char *s, size_t l)
The body of |print_cmd_chr| use to be a rather tedious listing of print
commands, and most of it was essentially an inverse to the |primitive|
- routine that enters a \TeX\ primitive into |eqtb|.
+ routine that enters a \TeX\ primitive into |eqtb|.
- Thanks to |prim_data|, there is no need for all that tediousness. What
+ Thanks to |prim_data|, there is no need for all that tediousness. What
is left of |primt_cnd_chr| are just the exceptions to the general rule
that the |cmd,chr_code| pair represents in a single primitive command.
@@ -591,17 +591,6 @@ void print_cmd_chr(quarterword cmd, halfword chr_code)
tprint(" ");
tprint("macro");
break;
- case extension_cmd:
- if (chr_code < prim_data[cmd].subids &&
- prim_data[cmd].names[chr_code] != 0) {
- prim_cmd_chr(cmd, chr_code);
- } else {
- tprint("[unknown extension! (");
- print_int(chr_code);
- tprint(")]");
-
- }
- break;
case assign_glue_cmd:
case assign_mu_glue_cmd:
if (chr_code < skip_base) {
@@ -642,6 +631,25 @@ void print_cmd_chr(quarterword cmd, halfword chr_code)
print_int(chr_code - scaled_base);
}
break;
+ case normal_cmd:
+ if (chr_code < prim_data[cmd].subids && prim_data[cmd].names[chr_code] != 0) {
+ prim_cmd_chr(cmd, chr_code);
+ } else {
+ tprint("[unknown command! (");
+ print_int(chr_code);
+ tprint(")]");
+ }
+ break;
+ case extension_cmd:
+ if (chr_code < prim_data[cmd].subids && prim_data[cmd].names[chr_code] != 0) {
+ prim_cmd_chr(cmd, chr_code);
+ } else {
+ tprint("[unknown extension! (");
+ print_int(chr_code);
+ tprint(")]");
+
+ }
+ break;
default:
/* these are most commands, actually */
prim_cmd_chr(cmd, chr_code);
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.h b/Build/source/texk/web2c/luatexdir/tex/printing.h
index 04109cdf8a4..838e87e5bde 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.h
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.h
@@ -1,5 +1,5 @@
/* printing.h
-
+
Copyright 2009 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -17,22 +17,29 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-
#ifndef PRINTING_H
# define PRINTING_H
+#define last_file_selector 127 /* was 15 */
+
+/*
+ Nicer will be to start these with 0 and then use an offset for the write
+ registers internally.
+*/
+
typedef enum {
- no_print = 16, /* |selector| setting that makes data disappear */
- term_only = 17, /* printing is destined for the terminal only */
- log_only = 18, /* printing is destined for the transcript file only */
- term_and_log = 19, /* normal |selector| setting */
- pseudo = 20, /* special |selector| setting for |show_context| */
- new_string = 21, /* printing is deflected to the string pool */
+ no_print = last_file_selector + 1, /* 16 */ /* |selector| setting that makes data disappear */
+ term_only = last_file_selector + 2, /* 17 */ /* printing is destined for the terminal only */
+ log_only = last_file_selector + 3, /* 18 */ /* printing is destined for the transcript file only */
+ term_and_log = last_file_selector + 4, /* 19 */ /* normal |selector| setting */
+ pseudo = last_file_selector + 5, /* 20 */ /* special |selector| setting for |show_context| */
+ new_string = last_file_selector + 6, /* 21 */ /* printing is deflected to the string pool */
} selector_settings;
+extern int new_string_line;
+
# define ssup_error_line 255
-# define max_selector new_string
- /* highest selector setting */
+# define max_selector new_string /* highest selector setting */
extern alpha_file log_file;
extern int selector;
@@ -46,11 +53,11 @@ extern int first_count;
extern boolean inhibit_par_tokens;
/*
-Macro abbreviations for output to the terminal and to the log file are
-defined here for convenience. Some systems need special conventions
-for terminal output, and it is possible to adhere to those conventions
-by changing |wterm|, |wterm_ln|, and |wterm_cr| in this section.
-@^system dependencies@>
+ Macro abbreviations for output to the terminal and to the log file are
+ defined here for convenience. Some systems need special conventions
+ for terminal output, and it is possible to adhere to those conventions
+ by changing |wterm|, |wterm_ln|, and |wterm_cr| in this section.
+ @^system dependencies@>
*/
# define wterm_cr() fprintf(term_out,"\n")
@@ -83,34 +90,33 @@ extern void tprint_esc(const char *s);
extern void prompt_input(const char *s);
-
-# define single_letter(A) \
- ((str_length(A)==1)|| \
- ((str_length(A)==4)&&*(str_string((A)))>=0xF0)|| \
- ((str_length(A)==3)&&*(str_string((A)))>=0xE0)|| \
+# define single_letter(A) \
+ ((str_length(A)==1)|| \
+ ((str_length(A)==4)&&*(str_string((A)))>=0xF0)|| \
+ ((str_length(A)==3)&&*(str_string((A)))>=0xE0)|| \
((str_length(A)==2)&&*(str_string((A)))>=0xC0))
-# define is_active_cs(a) (a && str_length(a)>3 && \
- (*str_string(a) == 0xEF) && \
- (*(str_string(a)+1) == 0xBF) && \
- (*(str_string(a)+2) == 0xBF))
-
+# define is_active_cs(a) \
+ (a && str_length(a)>3 && \
+ ( *str_string(a) == 0xEF) && \
+ (*(str_string(a)+1) == 0xBF) && \
+ (*(str_string(a)+2) == 0xBF))
# define active_cs_value(A) pool_to_unichar((str_string((A))+3))
-extern void print_glue(scaled d, int order, const char *s); /* prints a glue component */
-extern void print_spec(int p, const char *s); /* prints a glue specification */
+extern void print_glue(scaled d, int order, const char *s); /* prints a glue component */
+extern void print_spec(int p, const char *s); /* prints a glue specification */
-extern int font_in_short_display; /* an internal font number */
+extern int font_in_short_display; /* an internal font number */
extern void print_font_identifier(internal_font_number f);
-extern void short_display(int p); /* prints highlights of list |p| */
-extern void print_font_and_char(int p); /* prints |char_node| data */
-extern void print_mark(int p); /* prints token list data in braces */
-extern void print_rule_dimen(scaled d); /* prints dimension in rule node */
-extern int depth_threshold; /* maximum nesting depth in box displays */
-extern int breadth_max; /* maximum number of items shown at the same list level */
+extern void short_display(int p); /* prints highlights of list |p| */
+extern void print_font_and_char(int p); /* prints |char_node| data */
+extern void print_mark(int p); /* prints token list data in braces */
+extern void print_rule_dimen(scaled d); /* prints dimension in rule node */
+extern int depth_threshold; /* maximum nesting depth in box displays */
+extern int breadth_max; /* maximum number of items shown at the same list level */
extern void show_box(halfword p);
-extern void short_display_n(int p, int m); /* prints highlights of list |p| */
+extern void short_display_n(int p, int m); /* prints highlights of list |p| */
extern void print_csnames(int hstart, int hfinish);
extern void print_file_line(void);
@@ -119,5 +125,4 @@ extern void begin_diagnostic(void);
extern void end_diagnostic(boolean blank_line);
extern int global_old_setting;
-
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index b2ca7c9a94e..6cab2dd0060 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -29,6 +29,7 @@
#define wlog(A) fputc(A,log_file)
#define wterm(A) fputc(A,term_out)
+int new_string_line = 0;
@ Messages that are sent to a user's terminal and to the transcript-log file
are produced by several `|print|' procedures. These procedures will
@@ -101,8 +102,12 @@ void print_ln(void)
term_offset = 0;
break;
case no_print:
+ break;
case pseudo:
+ break;
case new_string:
+ if (new_string_line > 0)
+ print_char(new_string_line);
break;
default:
fprintf(write_file[selector], "\n");
@@ -218,7 +223,7 @@ The first 256 entries above the 17th unicode plane are used for a
special trick: when \TeX\ has to print items in that range, it will
instead print the character that results from substracting 0x110000
from that value. This allows byte-oriented output to things like
-\.{\\specials} and \.{\\pdfliterals}. Todo: Perhaps it would be useful
+\.{\\specials} and \.{\\pdfextension literals}. Todo: Perhaps it would be useful
to do the same substraction while typesetting.
@c
@@ -260,8 +265,7 @@ void print(int s)
} else if (s >= 0x110000) {
int c = s - 0x110000;
if (c >= 256) {
- pdf_warning("print", "bad raw byte to print (c=",
- true, false);
+ normal_warning("print", "bad raw byte to print (c=", true, false);
print_int(c);
tprint("), skipped.");
print_ln();
@@ -309,9 +313,12 @@ string appears at the beginning of a new line.
@c
void print_nlp(void)
{ /* move to beginning of a line */
- if (((term_offset > 0) && (odd(selector))) ||
- ((file_offset > 0) && (selector >= log_only)))
+ if (new_string_line > 0) {
+ print_char(new_string_line);
+ } else if (((term_offset > 0) && (odd(selector))) ||
+ ((file_offset > 0) && (selector >= log_only))) {
print_ln();
+ }
}
void print_nl(str_number s)
@@ -419,9 +426,9 @@ void tprint(const char *sss)
term_offset=0;
}
if (s != newlinechar) {
- if ((s>=0x20)||(s==0x0A)||(s==0x0D)||(s==0x09)) {
+ if ((s>=0x20)||(s==0x0A)||(s==0x0D)||(s==0x09)) {
buffer[i++] = s;
- } else {
+ } else {
buffer[i++] = '^';
buffer[i++] = '^';
buffer[i++] = s+64;
@@ -474,7 +481,7 @@ void print_banner(const char *v, int ver)
wterm(' ');
fprintf(term_out,"Number of bits used by the hash function (" my_name "): %d",LUAI_HASHLIMIT);
print_ln();
- }
+ }
if (shellenabledp) {
wterm(' ');
if (restrictedshell)
@@ -499,7 +506,7 @@ void log_banner(const char *v, int ver)
if (ver < 0)
fprintf(log_file, "This is " MyName ", Version %s ", v);
else
- fprintf(log_file, "This is " MyName ", Version %s%s (rev %d) ", v,
+ fprintf(log_file, "This is " MyName ", Version %s%s (rev %d) ", v,
WEB2CVERSION, ver);
print(format_ident);
print_char(' ');
@@ -834,7 +841,7 @@ void print_font_identifier(internal_font_number f)
tprint_esc("FONT");
print_int(f);
}
- if (int_par(pdf_tracing_fonts_code) > 0) {
+ if (int_par(tracing_fonts_code) > 0) {
tprint(" (");
print_font_name(f);
if (font_size(f) != font_dsize(f)) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w
index 1adeb5770fa..06b89cd585c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.w
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w
@@ -193,7 +193,7 @@ static void negate_cur_val(boolean delete_glue)
@ Some of the internal items can be fetched both routines,
and these have been split off into the next routine, that
-returns true if the command code was understood
+returns true if the command code was understood
@c
static boolean short_scan_something_internal(int cmd, int chr, int level,
@@ -315,7 +315,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
cur_chr = chr;
/* Fetch an item in the current node, if appropriate */
/* Here is where \.{\\lastpenalty}, \.{\\lastkern}, and \.{\\lastskip} are
- implemented. The reference count for \.{\\lastskip} will be updated later.
+ implemented. The reference count for \.{\\lastskip} will be updated later.
We also handle \.{\\inputlineno} and \.{\\badness} here, because they are
legal in similar contexts. */
@@ -344,7 +344,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
/* This code for reducing |cur_val_level| and\slash or negating the
result is similar to the one for all the other cases of
|scan_something_internal|, with the difference that |scan_expr| has
- already increased the reference count of a glue specification.
+ already increased the reference count of a glue specification.
*/
while (cur_val_level > level) {
downgrade_cur_val(true);
@@ -424,39 +424,24 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
case luatex_version_code:
cur_val = get_luatexversion();
break;
- case pdf_last_obj_code:
- cur_val = pdf_last_obj;
+ case last_saved_box_resource_index_code:
+ cur_val = last_saved_box_index;
break;
- case pdf_last_xform_code:
- cur_val = pdf_last_xform;
+ case last_saved_image_resource_index_code:
+ cur_val = last_saved_image_index;
break;
- case pdf_last_ximage_code:
- cur_val = pdf_last_ximage;
- break;
- case pdf_last_ximage_pages_code:
- cur_val = pdf_last_ximage_pages;
- break;
- case pdf_last_annot_code:
- cur_val = pdf_last_annot;
+ case last_saved_image_resource_pages_code:
+ cur_val = last_saved_image_pages;
break;
case last_x_pos_code:
- cur_val = pdf_last_pos.h;
+ cur_val = last_position.h;
break;
case last_y_pos_code:
- cur_val = pdf_last_pos.v;
- break;
- case pdf_retval_code:
- cur_val = pdf_retval;
- break;
- case pdf_last_ximage_colordepth_code:
- cur_val = pdf_last_ximage_colordepth;
+ cur_val = last_position.v;
break;
case random_seed_code:
cur_val = random_seed;
break;
- case pdf_last_link_code:
- cur_val = pdf_last_link;
- break;
case eTeX_version_code:
cur_val = eTeX_version;
break;
@@ -503,7 +488,6 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
cur_val = shrink_order(q);
delete_glue_ref(q);
break;
-
} /* there are no other cases */
cur_val_level = int_val_level;
}
@@ -588,7 +572,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level,
@ First, here is a short routine that is called from lua code. All
the real work is delegated to |short_scan_something_internal| that
-is shared between this routine and |scan_something_internal|.
+is shared between this routine and |scan_something_internal|.
@c
void scan_something_simple(halfword cmd, halfword subitem)
@@ -661,7 +645,7 @@ void scan_something_internal(int level, boolean negative)
case set_font_cmd:
case def_font_cmd:
case letterspace_font_cmd:
- case pdf_copy_font_cmd:
+ case copy_font_cmd:
/* Fetch a token list or font identifier, provided that |level=tok_val| */
if (level != tok_val_level) {
print_err("Missing number, treated as zero");
@@ -680,6 +664,10 @@ void scan_something_internal(int level, boolean negative)
scanned_result(font_id_base + cur_val, ident_val_level);
}
break;
+ case set_font_id_cmd:
+ scan_int();
+ scanned_result(font_id_base + cur_val, ident_val_level);
+ break;
case def_family_cmd:
/* Fetch a math font identifier */
scan_char_num();
@@ -852,9 +840,9 @@ void scan_something_internal(int level, boolean negative)
|scan_eight_bit_int| is superceded by |scan_register_num| and
|scan_mark_num|. It may become split up even further in the future.
-Many of the |restricted classes| routines are the essentially
+Many of the |restricted classes| routines are the essentially
the same except for the upper limit and the error message, so it makes
-sense to combine these all into one function.
+sense to combine these all into one function.
@c
void scan_limited_int(int max, const char *name)
@@ -1263,7 +1251,7 @@ void scan_dimen(boolean mu, boolean inf, boolean shortcut)
/* Scan for (f)\.{fil} units; |goto attach_fraction| if found */
/* In traditional TeX, a specification like `\.{filllll}' or `\.{fill L L
L}' will lead to two error messages (one for each additional keyword
- \.{"l"}).
+ \.{"l"}).
Not so for luatex, it just parses the construct in reverse. */
if (scan_keyword("filll")) {
cur_order = filll;
@@ -1309,7 +1297,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(pdf_px_dimen_code);
+ v = dimen_par(px_dimen_code);
} else {
goto NOT_FOUND;
}
@@ -1498,7 +1486,7 @@ void scan_glue(int level)
cur_val = q;
}
-@ This is an omega routine
+@ This is an omega routine
@c
void scan_scaled(void)
{ /* sets |cur_val| to a scaled value */
@@ -1798,8 +1786,17 @@ found (in any order).
@c
halfword scan_rule_spec(void)
{
- halfword q; /* the rule node being created */
- q = new_rule(); /* |width|, |depth|, and |height| all equal |null_flag| now */
+ /* |width|, |depth|, and |height| all equal |null_flag| now */
+ halfword q;
+ if (cur_cmd == no_vrule_cmd) {
+ q = new_rule(empty_rule);
+ cur_cmd = vrule_cmd;
+ } else if (cur_cmd == no_hrule_cmd) {
+ q = new_rule(empty_rule);
+ cur_cmd = hrule_cmd;
+ } else {
+ q = new_rule(normal_rule);
+ }
if (cur_cmd == vrule_cmd) {
width(q) = default_rule;
rule_dir(q) = body_direction;
@@ -1840,8 +1837,7 @@ void scan_font_ident(void)
get_x_token();
} while (cur_cmd == spacer_cmd);
- if ((cur_cmd == def_font_cmd) || (cur_cmd == letterspace_font_cmd)
- || (cur_cmd == pdf_copy_font_cmd)) {
+ if ((cur_cmd == def_font_cmd) || (cur_cmd == letterspace_font_cmd) || (cur_cmd == copy_font_cmd)) {
f = get_cur_font();
} else if (cur_cmd == set_font_cmd) {
f = cur_chr;
@@ -1862,7 +1858,7 @@ void scan_font_ident(void)
}
@ The |scan_general_text| procedure is much like |scan_toks(false,false)|,
-but will be invoked via |expand|, i.e., recursively.
+but will be invoked via |expand|, i.e., recursively.
The token list (balanced text) created by |scan_general_text| begins
at |link(temp_token_head)| and ends at |cur_val|. (If |cur_val=temp_token_head|,
@@ -2038,7 +2034,7 @@ halfword scan_toks(boolean macro_def, boolean xpand)
/* Here we insert an entire token list created by |the_toks| without
expanding it further. */
while (1) {
- get_token_lua();
+ get_next(); /* get_token_lua(); */
if (cur_cmd >= call_cmd) {
if (token_info(token_link(cur_chr)) == protected_token) {
cur_cmd = relax_cmd;
@@ -2140,8 +2136,8 @@ typedef enum {
($2^{31}-1$) in absolute value, dimensions must not exceed |max_dimen|
($2^{30}-1$). We avoid the absolute value of an integer, because this
might fail for the value $-2^{31}$ using 32-bit arithmetic.
-
-@ clear a number or dimension and set |arith_error|
+
+@ clear a number or dimension and set |arith_error|
@c
#define num_error(A) do { \
@@ -2149,8 +2145,8 @@ typedef enum {
A=0; \
} while (0)
-
-@ clear a glue spec and set |arith_error|
+
+@ clear a glue spec and set |arith_error|
@c
#define glue_error(A) do { \
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.h b/Build/source/texk/web2c/luatexdir/tex/texmath.h
index 72b83de6143..90ae5f20a1d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.h
@@ -1,5 +1,5 @@
/* texmath.h
-
+
Copyright 1996-2006 Han The Thanh <thanh@pdftex.org>
Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>
@@ -160,6 +160,8 @@ typedef enum {
math_param_fraction_denom_vgap,
math_param_fraction_denom_down,
math_param_fraction_del_size,
+ math_param_skewed_fraction_hgap,
+ math_param_skewed_fraction_vgap,
math_param_limit_above_vgap,
math_param_limit_above_bgap,
math_param_limit_above_kern,
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w
index 04152ff2999..77c6161f475 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w
@@ -35,6 +35,23 @@
#define cur_fam int_par(cur_fam_code)
#define text_direction int_par(text_direction_code)
+/*
+
+ \mathdisplayskipmode
+
+ tex normally always inserts before and only after when larger than zero
+
+ 0 = normal tex
+ 1 = always
+ 2 = non-zero
+ 3 = ignore
+
+*/
+
+#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
@@ -48,18 +65,19 @@
@ @c
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 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)
@@ -151,7 +169,6 @@ static void unsave_math(void)
text_dir_ptr = saved_value(0);
}
-
@ Sometimes it is necessary to destroy an mlist. The following
subroutine empties the current list, assuming that |abs(mode)=mmode|.
@@ -229,8 +246,6 @@ static void unsave_math_fam_data(int gl)
}
}
-
-
@ and parameters
@c
@@ -263,7 +278,6 @@ scaled get_math_param(int param_id, int style_id)
return (scaled) get_sa_item(math_param_head, n);
}
-
@ @c
static void unsave_math_param_data(int gl)
{
@@ -295,7 +309,6 @@ static void unsave_math_param_data(int gl)
}
}
-
@ saving and unsaving of both
@c
@@ -335,8 +348,6 @@ void initialize_math(void)
return;
}
-
-
@ Each portion of a formula is classified as Ord, Op, Bin, Rel, Ope,
Clo, Pun, or Inn, for purposes of spacing and line breaking. An
|ord_noad|, |op_noad|, |bin_noad|, |rel_noad|, |open_noad|, |close_noad|,
@@ -381,8 +392,6 @@ be placed at the left and right of the fraction. In this way, a
\.{\\atop}, \.{\\above}, \.{\\overwithdelims}, \.{\\atopwithdelims}, and
\.{\\abovewithdelims}.
-
-
@ The |new_noad| function creates an |ord_noad| that is completely null
@c
@@ -405,7 +414,6 @@ pointer new_sub_box(pointer curbox)
return p;
}
-
@ A few more kinds of noads will complete the set: An |under_noad| has its
nucleus underlined; an |over_noad| has it overlined. An |accent_noad| places
an accent over its nucleus; the accent character appears as
@@ -424,8 +432,6 @@ with subtype |right_noad_side| never appears in an mlist
except as the last element; furthermore, we either have both a |left_noad_side|
and a |right_noad_side|, or neither one is present.
-
-
@ Math formulas can also contain instructions like \.{\\textstyle} that
override \TeX's normal style rules. A |style_node| is inserted into the
data structure to record such instructions; it is three words long, so it
@@ -507,7 +513,6 @@ static pointer new_choice(void)
return new_node(choice_node, 0); /* the |subtype| is not used */
}
-
@ Let's consider now the previously unwritten part of |show_node_list|
that displays the things that can only be present in mlists; this
program illustrates how to access the data structures just defined.
@@ -566,7 +571,6 @@ void show_math_node(pointer p)
}
}
-
@ Here are some simple routines used in the display of noads.
@c
@@ -582,6 +586,31 @@ static void print_fam_and_char(pointer p)
static void print_delimiter(pointer p)
{
int a;
+ if (delimiteroptionset(p)) {
+ tprint(" [ ");
+ if (delimiteraxis(p))
+ tprint("axis ");
+ if (delimiternoaxis(p))
+ tprint("noaxis ");
+ if (delimiterexact(p))
+ tprint("exact ");
+ tprint("]");
+ }
+ if (delimiterheight(p)) {
+ tprint("height=");
+ print_scaled(delimiterheight(p));
+ tprint(" ");
+ }
+ if (delimiterdepth(p)) {
+ tprint("depth=");
+ print_scaled(delimiterdepth(p));
+ tprint(" ");
+ }
+ if (delimiterclass(p)) {
+ tprint("class=");
+ print_int(delimiterclass(p));
+ tprint(" ");
+ }
if (small_fam(p) < 0) {
print_int(-1); /* this should never happen */
} else if (small_fam(p) < 16 && large_fam(p) < 16 &&
@@ -598,7 +627,6 @@ static void print_delimiter(pointer p)
}
}
-
@ The next subroutine will descend to another level of recursion when a
subsidiary mlist needs to be displayed. The parameter |c| indicates what
character is to become part of the recursion history. An empty mlist is
@@ -689,8 +717,7 @@ void display_normal_noad(pointer p)
break;
}
break;
-
- case radical_noad:
+ case radical_noad:
if (subtype(p) == 6)
tprint_esc("Udelimiterover");
else if (subtype(p) == 5)
@@ -707,64 +734,90 @@ void display_normal_noad(pointer p)
if (degree(p) != null) {
print_subsidiary_data(degree(p), '/');
}
+ if (radicalwidth(p)) {
+ tprint("width=");
+ print_scaled(radicalwidth(p));
+ tprint(" ");
+ }
+ if (radicaloptionset(p)) {
+ tprint(" [ ");
+ if (radicalexact(p))
+ tprint("exact ");
+ if (radicalleft(p))
+ tprint("left ");
+ if (radicalmiddle(p))
+ tprint("middle ");
+ if (radicalright(p))
+ tprint("right ");
+ tprint("]");
+ }
break;
case accent_noad:
- if (accent_chr(p) != null) {
+ if (top_accent_chr(p) != null) {
if (bot_accent_chr(p) != null) {
tprint_esc("Umathaccent both");
} else {
tprint_esc("Umathaccent");
}
- } else {
- tprint_esc("Umathaccent bottom");
- }
- switch (subtype(p)) {
- case 0:
- if (accent_chr(p) != null) {
- if (bot_accent_chr(p) != null) {
- print_fam_and_char(accent_chr(p));
- print_fam_and_char(bot_accent_chr(p));
- } else {
- print_fam_and_char(accent_chr(p));
- }
+ } else if (bot_accent_chr(p) != null) {
+ tprint_esc("Umathaccent bottom");
} else {
- print_fam_and_char(bot_accent_chr(p));
+ tprint_esc("Umathaccent overlay");
}
- break;
- case 1:
- if (accent_chr(p) != null) {
- tprint(" fixed ");
- print_fam_and_char(accent_chr(p));
- if (bot_accent_chr(p) != null) {
- print_fam_and_char(bot_accent_chr(p));
- }
- } else {
- confusion("display_accent_noad");
+ if (accentfraction(p)) {
+ tprint(" fraction=");
+ print_int(accentfraction(p));
+ tprint(" ");
}
- break;
- case 2:
- if (bot_accent_chr(p) != null) {
- if (accent_chr(p) != null) {
- print_fam_and_char(accent_chr(p));
+ switch (subtype(p)) {
+ case 0:
+ if (top_accent_chr(p) != null) {
+ if (bot_accent_chr(p) != null) {
+ print_fam_and_char(top_accent_chr(p));
+ print_fam_and_char(bot_accent_chr(p));
+ } else {
+ print_fam_and_char(top_accent_chr(p));
+ }
+ } else if (bot_accent_chr(p) != null) {
+ print_fam_and_char(bot_accent_chr(p));
+ } else {
+ print_fam_and_char(overlay_accent_chr(p));
+ }
+ break;
+ case 1:
+ if (top_accent_chr(p) != null) {
+ tprint(" fixed ");
+ print_fam_and_char(top_accent_chr(p));
+ if (bot_accent_chr(p) != null) {
+ print_fam_and_char(bot_accent_chr(p));
+ }
+ } else {
+ confusion("display_accent_noad");
+ }
+ break;
+ case 2:
+ if (bot_accent_chr(p) != null) {
+ if (top_accent_chr(p) != null) {
+ print_fam_and_char(top_accent_chr(p));
+ }
+ tprint(" fixed ");
+ print_fam_and_char(bot_accent_chr(p));
+ } else{
+ confusion("display_accent_noad");
+ }
+ break;
+ case 3:
+ if (top_accent_chr(p) != null && bot_accent_chr(p) != null) {
+ tprint(" fixed ");
+ print_fam_and_char(top_accent_chr(p));
+ tprint(" fixed ");
+ print_fam_and_char(bot_accent_chr(p));
+ } else {
+ confusion("display_accent_noad");
+ }
+ break;
}
- tprint(" fixed ");
- print_fam_and_char(bot_accent_chr(p));
- } else{
- confusion("display_accent_noad");
- }
break;
- case 3:
- if (accent_chr(p) != null && bot_accent_chr(p) != null) {
- tprint(" fixed ");
- print_fam_and_char(accent_chr(p));
- tprint(" fixed ");
- print_fam_and_char(bot_accent_chr(p));
- } else {
- confusion("display_accent_noad");
- }
- break;
- }
- break;
}
print_subsidiary_data(nucleus(p), '.');
print_subsidiary_data(supscr(p), '^');
@@ -811,7 +864,6 @@ void display_fraction_noad(pointer p)
print_subsidiary_data(denominator(p), '/');
}
-
@ The routines that \TeX\ uses to create mlists are similar to those we have
just seen for the generation of hlists and vlists. But it is necessary to
make ``noads'' as well as nodes, so the reader should review the
@@ -882,12 +934,10 @@ void init_math(void)
}
}
-
@ We get into ordinary math mode from display math mode when `\.{\\eqno}' or
`\.{\\leqno}' appears. In such cases |cur_chr| will be 0 or~1, respectively;
the value of |cur_chr| is placed onto |save_stack| for safe keeping.
-
@ When \TeX\ is in display math mode, |cur_group=math_shift_group|,
so it is not necessary for the |start_eq_no| procedure to test for
this condition.
@@ -953,10 +1003,6 @@ static boolean math_and_text_reversed_p(void)
return false;
}
-
-
-
-
@ When we enter display math mode, we need to call |line_break| to
process the partial paragraph that has just been interrupted by the
display. Then we can set the proper values of |display_width| and
@@ -972,8 +1018,7 @@ void enter_display_math(void)
int n; /* scope of paragraph shape specification */
if (head == tail || /* `\.{\\noindent\$\$}' or `\.{\$\${ }\$\$}' */
(vlink(head) == tail && /* the 2nd of \.{\$\${ }\$\$} \.{\$\${ }\$\$} */
- type(tail) == whatsit_node &&
- subtype(tail) == local_par_node && vlink(tail) == null)) {
+ type(tail) == local_par_node && vlink(tail) == null)) {
if (vlink(head) == tail) {
/* bug \#270: |resume_after_display| inserts a |local_par_node|, but if
there is another display immediately following, we have to get rid
@@ -1202,7 +1247,6 @@ void scan_extdef_math_code(int level, int extcode)
d.family_value, d.character_value, (quarterword) (level));
}
-
@ this reads in a delcode when actually a mathcode is needed
@c
mathcodeval scan_delimiter_as_mathchar(int extcode)
@@ -1248,6 +1292,16 @@ that subformula into a given word of |mem|.
@c
#define get_next_nb_nr() do { get_x_token(); } while (cur_cmd==spacer_cmd||cur_cmd==relax_cmd)
+int scan_math_style(pointer p, int mstyle)
+{
+ get_next_nb_nr();
+ back_input();
+ scan_left_brace();
+ set_saved_record(0, saved_math, 0, p);
+ incr(save_ptr);
+ push_math(math_group, mstyle);
+ return 1;
+}
int scan_math(pointer p, int mstyle)
{
@@ -1321,8 +1375,6 @@ int scan_math(pointer p, int mstyle)
return 0;
}
-
-
@ The |set_math_char| procedure creates a new noad appropriate to a given
math code, and appends it to the current mlist. However, if the math code
is sufficiently large, the |cur_chr| is treated as an active character and
@@ -1368,8 +1420,6 @@ void set_math_char(mathcodeval mval)
}
}
-
-
@ The |math_char_in_text| procedure creates a new node representing a math char
in text code, and appends it to the current list. However, if the math code
is sufficiently large, the |cur_chr| is treated as an active character and
@@ -1387,14 +1437,12 @@ void math_char_in_text(mathcodeval mval)
x_token();
back_input();
} else {
- p = new_char(fam_fnt(mval.family_value, text_size),
- mval.character_value);
+ p = new_char(fam_fnt(mval.family_value, text_size), mval.character_value);
vlink(tail) = p;
tail = p;
}
}
-
@ @c
void math_math_comp(void)
{
@@ -1409,7 +1457,6 @@ void math_math_comp(void)
(void) scan_math(nucleus(tail), m_style);
}
-
@ @c
void math_limit_switch(void)
{
@@ -1429,7 +1476,6 @@ void math_limit_switch(void)
tex_error("Limit controls must follow a math operator", hlp);
}
-
@ Delimiter fields of noads are filled in by the |scan_delimiter| routine.
The first parameter of this procedure is the |mem| address where the
delimiter is to be placed; the second tells if this delimiter follows
@@ -1491,15 +1537,30 @@ static void scan_delimiter(pointer p, int r)
return;
}
-
@ @c
void math_radical(void)
{
halfword q;
int chr_code = cur_chr;
+ halfword options = 0;
tail_append(new_node(radical_noad, chr_code));
q = new_node(delim_node, 0);
left_delimiter(tail) = q;
+ while (1) {
+ if (scan_keyword("width")) {
+ scan_dimen(false,false,false);
+ radicalwidth(tail) = cur_val ;
+ } else if (scan_keyword("left")) {
+ options = options | noad_option_left ;
+ } else if (scan_keyword("middle")) {
+ options = options | noad_option_middle ;
+ } else if (scan_keyword("right")) {
+ options = options | noad_option_right ;
+ } else {
+ break;
+ }
+ }
+ radicaloptions(tail) = options;
if (chr_code == 0) /* \.{\\radical} */
scan_delimiter(left_delimiter(tail), tex_mathcode);
else if (chr_code == 1) /* \.{\\Uradical} */
@@ -1514,9 +1575,15 @@ void math_radical(void)
scan_delimiter(left_delimiter(tail), umath_mathcode);
else if (chr_code == 6) /* \.{\\Udelimiterover} */
scan_delimiter(left_delimiter(tail), umath_mathcode);
+ else if (chr_code == 7) /* \.{\\Uhextensible} */
+ scan_delimiter(left_delimiter(tail), umath_mathcode);
else
confusion("math_radical");
- if (chr_code == 2) {
+ if (chr_code == 7) {
+ q = new_node(sub_box_node, 0); /* type will change */
+ nucleus(tail) = q;
+ return;
+ } else if (chr_code == 2) {
/* the trick with the |vlink(q)| is used by |scan_math|
to decide whether it needs to go on */
q = new_node(math_char_node, 0);
@@ -1539,8 +1606,9 @@ void math_radical(void)
void math_ac(void)
{
halfword q;
- mathcodeval t = { 0, 0, 0, 0 }, b = {
- 0, 0, 0, 0};
+ mathcodeval t = { 0, 0, 0, 0 };
+ mathcodeval b = { 0, 0, 0, 0 };
+ mathcodeval o = { 0, 0, 0, 0 };
if (cur_cmd == accent_cmd) {
const char *hlp[] = {
"I'm changing \\accent to \\mathaccent here; wish me luck.",
@@ -1553,37 +1621,57 @@ void math_ac(void)
if (cur_chr == 0) { /* \.{\\mathaccent} */
t = scan_mathchar(tex_mathcode);
} else if (cur_chr == 1) { /* \.{\\Umathaccent} */
- if (scan_keyword("fixed")) {
- subtype(tail) = 1;
- t = scan_mathchar(umath_mathcode);
- } else if (scan_keyword("both")) {
- if (scan_keyword("fixed")) {
- subtype(tail) = 1;
- }
- t = scan_mathchar(umath_mathcode);
- if (scan_keyword("fixed")) {
- subtype(tail) += 2;
- }
- b = scan_mathchar(umath_mathcode);
- } else if (scan_keyword("bottom")) {
- if (scan_keyword("fixed")) {
- subtype(tail) = 2;
- }
- b = scan_mathchar(umath_mathcode);
- } else {
- t = scan_mathchar(umath_mathcode);
- }
+ if (scan_keyword("fixed")) {
+ /* top */
+ subtype(tail) = 1;
+ t = scan_mathchar(umath_mathcode);
+ } else if (scan_keyword("both")) {
+ /* top bottom */
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 1;
+ }
+ t = scan_mathchar(umath_mathcode);
+ if (scan_keyword("fixed")) {
+ subtype(tail) += 2;
+ }
+ b = scan_mathchar(umath_mathcode);
+ } else if (scan_keyword("bottom")) {
+ /* bottom */
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 2;
+ }
+ b = scan_mathchar(umath_mathcode);
+ } else if (scan_keyword("top")) {
+ /* top */
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 1;
+ }
+ t = scan_mathchar(umath_mathcode);
+ } else if (scan_keyword("overlay")) {
+ /* overlay */
+ if (scan_keyword("fixed")) {
+ subtype(tail) = 1;
+ }
+ o = scan_mathchar(umath_mathcode);
+ } else {
+ /* top */
+ t = scan_mathchar(umath_mathcode);
+ }
+ if (scan_keyword("fraction")) {
+ scan_int();
+ accentfraction(tail) = cur_val;
+ }
} else {
- confusion("math_ac");
+ confusion("mathaccent");
}
if (!(t.character_value == 0 && t.family_value == 0)) {
q = new_node(math_char_node, 0);
- accent_chr(tail) = q;
- math_character(accent_chr(tail)) = t.character_value;
+ 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(accent_chr(tail)) = cur_fam;
+ math_fam(top_accent_chr(tail)) = cur_fam;
else
- math_fam(accent_chr(tail)) = t.family_value;
+ math_fam(top_accent_chr(tail)) = t.family_value;
}
if (!(b.character_value == 0 && b.family_value == 0)) {
q = new_node(math_char_node, 0);
@@ -1594,6 +1682,15 @@ void math_ac(void)
else
math_fam(bot_accent_chr(tail)) = b.family_value;
}
+ if (!(o.character_value == 0 && o.family_value == 0)) {
+ 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;
+ else
+ math_fam(overlay_accent_chr(tail)) = o.family_value;
+ }
q = new_node(math_char_node, 0);
nucleus(tail) = q;
(void) scan_math(nucleus(tail), cramped_style(m_style));
@@ -1611,7 +1708,6 @@ pointer math_vcenter_group(pointer p)
return q;
}
-
@ The routine that scans the four mlists of a \.{\\mathchoice} is very
much like the routine that builds discretionary nodes.
@@ -1655,7 +1751,6 @@ void build_choices(void)
scan_left_brace();
}
-
@ Subscripts and superscripts are attached to the previous nucleus by the
action procedure called |sub_sup|.
@@ -1697,7 +1792,6 @@ void sub_sup(void)
}
}
-
@ An operation like `\.{\\over}' causes the current mlist to go into a
state of suspended animation: |incompleat_noad| points to a |fraction_noad|
that contains the mlist-so-far as its numerator, while the denominator
@@ -1711,6 +1805,7 @@ void math_fraction(void)
{
halfword c; /* the type of generalized fraction we are scanning */
pointer q;
+ halfword options = 0;
c = cur_chr;
if (incompleat_noad != null) {
const char *hlp[] = {
@@ -1734,6 +1829,11 @@ void math_fraction(void)
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);
+ }
if (c >= delimited_code) {
q = new_node(delim_node, 0);
left_delimiter(incompleat_noad) = q;
@@ -1743,22 +1843,41 @@ void math_fraction(void)
scan_delimiter(right_delimiter(incompleat_noad), no_mathcode);
}
switch (c % delimited_code) {
- case above_code:
- scan_normal_dimen();
- thickness(incompleat_noad) = cur_val;
- break;
- case over_code:
- thickness(incompleat_noad) = default_code;
- break;
- case atop_code:
- thickness(incompleat_noad) = 0;
- break;
- } /* there are no other cases */
+ case above_code:
+ while (1) {
+ if (scan_keyword("exact")) {
+ options = options | noad_option_exact ;
+ } else {
+ break;
+ }
+ }
+ fractionoptions(incompleat_noad) = options;
+ scan_normal_dimen();
+ thickness(incompleat_noad) = cur_val;
+ break;
+ case over_code:
+ thickness(incompleat_noad) = default_code;
+ break;
+ case atop_code:
+ thickness(incompleat_noad) = 0;
+ break;
+ case skewed_code:
+ while (1) {
+ if (scan_keyword("exact")) {
+ options = options | noad_option_exact ;
+ } else if (scan_keyword("noaxis")) {
+ options = options | noad_option_no_axis ;
+ } else {
+ break;
+ }
+ }
+ fractionoptions(incompleat_noad) = options;
+ thickness(incompleat_noad) = 0;
+ break;
+ }
}
}
-
-
@ At the end of a math formula or subformula, the |fin_mlist| routine is
called upon to return a pointer to the newly completed mlist, and to
pop the nest back to the enclosing semantic level. The parameter to
@@ -1796,7 +1915,6 @@ pointer fin_mlist(pointer p)
return q;
}
-
@ Now at last we're ready to see what happens when a right brace occurs
in a math formula. Two special cases are simplified here: Braces are effectively
removed when they surround a single Ord without sub/superscripts, or when they
@@ -1863,7 +1981,6 @@ void close_math_group(pointer p)
}
}
-
@ We have dealt with all constructions of math mode except `\.{\\left}' and
`\.{\\right}', so the picture is completed by the following sections of
the program. The |middle| feature of eTeX allows one ore several \.{\\middle}
@@ -1872,12 +1989,42 @@ delimiters to appear between \.{\\left} and \.{\\right}.
@c
void math_left_right(void)
{
- halfword t; /* |left_noad_side| .. |right_noad_side| */
- pointer p; /* new noad */
- pointer q; /* resulting mlist */
- pointer r; /* temporary */
+ halfword t; /* |left_noad_side| .. |right_noad_side| */
+ pointer p; /* new noad */
+ pointer q; /* resulting mlist */
+ pointer r; /* temporary */
+ halfword ht = 0;
+ halfword dp = 0;
+ halfword options = 0;
+ halfword type = -1 ;
t = cur_chr;
- if ((t != left_noad_side) && (cur_group != math_left_group)) {
+
+ if (t > 10) {
+ /* we have \Uleft \Uright \Umiddle */
+ t = t - 10;
+ while (1) {
+ if (scan_keyword("height")) {
+ scan_dimen(false,false,false);
+ ht = cur_val ;
+ } else if (scan_keyword("depth")) {
+ scan_dimen(false,false,false);
+ dp = cur_val ;
+ } else if (scan_keyword("axis")) {
+ options = options | noad_option_axis ;
+ } else if (scan_keyword("noaxis")) {
+ options = options | noad_option_no_axis ;
+ } else if (scan_keyword("exact")) {
+ options = options | noad_option_exact ;
+ } else if (scan_keyword("class")) {
+ scan_int();
+ type = cur_val ;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if ((t != no_noad_side) && (t != left_noad_side) && (cur_group != math_left_group)) {
if (cur_group == math_shift_group) {
scan_delimiter(null, no_mathcode);
if (t == middle_noad_side) {
@@ -1902,7 +2049,24 @@ void math_left_right(void)
subtype(p) = (quarterword) t;
r = new_node(delim_node, 0);
delimiter(p) = r;
+
+ delimiterheight(p) = ht;
+ delimiterdepth(p) = dp;
+ delimiteroptions(p) = options;
+ delimiterclass(p) = type;
+ delimiteritalic(p) = 0;
+
scan_delimiter(delimiter(p), no_mathcode);
+
+ if (t == no_noad_side) {
+ tail_append(new_noad());
+ subtype(tail) = inner_noad_type;
+ r = new_node(sub_mlist_node, 0);
+ nucleus(tail) = r;
+ math_list(nucleus(tail)) = p;
+ return ;
+ }
+
if (t == left_noad_side) {
q = p;
} else {
@@ -1924,7 +2088,6 @@ void math_left_right(void)
}
}
-
@ \TeX\ gets to the following part of the program when
the first `\.\$' ending a display has been scanned.
@@ -1985,18 +2148,15 @@ static void resume_after_display(void)
}
}
-
@ The fussiest part of math mode processing occurs when a displayed formula is
being centered and placed with an optional equation number.
-
At this time we are in vertical mode (or internal vertical mode).
|p| points to the mlist for the formula.
|a| is either |null| or it points to a box containing the equation number.
|l| is true if there was an \.{\\leqno}/ (so |a| is a horizontal box).
-
@c
static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
{
@@ -2019,6 +2179,8 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
adjust_tail = adjust_head;
pre_adjust_tail = pre_adjust_head;
eq_box = hpack(p, 0, additional, -1);
+ subtype(eq_box) = equation_list; /* new */
+ build_attribute_list(eq_box);
p = list_ptr(eq_box);
t = adjust_tail;
adjust_tail = null;
@@ -2034,25 +2196,31 @@ 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(text_size), 1000);
- }
+ eqno_w2 = eqno_w + round_xn_over_d(math_eqno_gap_step, get_math_quad(text_size), 1000);
+ subtype(eqno_box) = equation_number_list; /* new */
+ /* build_attribute_list(eqno_box); */ /* probably already set */
+ }
if (eq_w + eqno_w2 > line_w) {
/* The user can force the equation number to go on a separate line
by causing its width to be zero. */
- if ((eqno_w != 0)
- && ((eq_w - total_shrink[normal] + eqno_w2 <= line_w)
- || (total_shrink[sfi] != 0) || (total_shrink[fil] != 0)
+ if ((eqno_w != 0) && ((eq_w - total_shrink[normal] + eqno_w2 <= line_w)
+ || (total_shrink[sfi] != 0)
+ || (total_shrink[fil] != 0)
|| (total_shrink[fill] != 0)
|| (total_shrink[filll] != 0))) {
list_ptr(eq_box) = null;
flush_node(eq_box);
eq_box = hpack(p, line_w - eqno_w2, exactly, -1);
+ subtype(eq_box) = equation_list; /* new */
+ build_attribute_list(eq_box);
} else {
eqno_w = 0;
if (eq_w > line_w) {
list_ptr(eq_box) = null;
flush_node(eq_box);
eq_box = hpack(p, line_w, exactly, -1);
+ subtype(eq_box) = equation_list; /* new */
+ build_attribute_list(eq_box);
}
}
eq_w = width(eq_box);
@@ -2092,18 +2260,29 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
/* \.{\\leqno} on a forced single line due to |width=0| */
/* it follows that |type(a)=hlist_node| */
- if (eqno_box && l && (eqno_w == 0)) {
-/* if (math_direction==dir_TLT) { */
- shift_amount(eqno_box) = 0;
-/* } else { */
-/* } */
- append_to_vlist(eqno_box);
- tail_append(new_penalty(inf_penalty));
- } else {
-
- tail_append(new_param_glue(g1));
-
+ if (eqno_box && l && (eqno_w == 0)) {
+ /* if (math_direction==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;
}
+ }
if (eqno_w != 0) {
r = new_kern(line_w - eq_w - eqno_w - d);
@@ -2181,38 +2360,53 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
}
}
eq_box = hpack(eq_box, 0, additional, -1);
+ subtype(eq_box) = equation_list; /* new */
+ build_attribute_list(eq_box);
shift_amount(eq_box) = line_s;
} else {
shift_amount(eq_box) = line_s + d;
}
/* check for prev: */
- append_to_vlist(eq_box);
+ append_to_vlist(eq_box,lua_key_index(equation));
if ((eqno_box != null) && (eqno_w == 0) && !l) {
tail_append(new_penalty(inf_penalty));
-/* if (math_direction==dir_TLT) { */
+ /* if (math_direction==dir_TLT) { */
shift_amount(eqno_box) = line_s + line_w - eqno_width ;
-/* } else { */
-/* } */
-/* check for prev: */
- append_to_vlist(eqno_box);
+ /* } else { */
+ /* } */
+ append_to_vlist(eqno_box,lua_key_index(equation_number));
g2 = 0;
}
if (t != adjust_head) { /* migrating material comes after equation number */
vlink(tail) = vlink(adjust_head);
-/* needs testing */
-alink(adjust_tail) = alink(tail);
+ /* needs testing */
+ alink(adjust_tail) = alink(tail);
tail = t;
}
if (pre_t != pre_adjust_head) {
vlink(tail) = vlink(pre_adjust_head);
-/* needs testing */
-alink(pre_adjust_tail) = alink(tail);
+ /* needs testing */
+ alink(pre_adjust_tail) = alink(tail);
tail = pre_t;
}
tail_append(new_penalty(int_par(post_display_penalty_code)));
- if (g2 > 0)
- tail_append(new_param_glue(g2));
+
+ 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;
+ }
resume_after_display();
}
@@ -2238,6 +2432,7 @@ void after_math(void)
}
run_mlist_to_hlist(p, text_style, false);
a = hpack(vlink(temp_head), 0, additional, -1);
+ build_attribute_list(a);
unsave_math();
decr(save_ptr); /* now |cur_group=math_shift_group| */
assert(saved_type(0) == saved_eqno);
@@ -2245,6 +2440,7 @@ void after_math(void)
l = true;
m = mode;
p = fin_mlist(null);
+
}
if (m < 0) {
/* The |unsave| is done after everything else here; hence an appearance of
@@ -2257,6 +2453,12 @@ void after_math(void)
check_inline_math_end();
}
tail_append(new_math(math_surround, before));
+ /* begin mathskip code */
+ if (math_skip != zero_glue) {
+ glue_ptr(tail) = math_skip;
+ add_glue_ref(math_skip);
+ }
+ /* end mathskip code */
if (dir_math_save) {
tail_append(new_dir(math_direction));
}
@@ -2265,10 +2467,16 @@ void after_math(void)
while (vlink(tail) != null)
tail = vlink(tail);
if (dir_math_save) {
- tail_append(new_dir(math_direction - 64));
+ tail_append(new_dir(math_direction - dir_swap));
}
dir_math_save = false;
tail_append(new_math(math_surround, after));
+ /* begin mathskip code */
+ if (math_skip != zero_glue) {
+ glue_ptr(tail) = math_skip;
+ add_glue_ref(math_skip);
+ }
+ /* end mathskip code */
space_factor = 1000;
unsave_math();
} else {
@@ -2284,7 +2492,6 @@ void after_math(void)
}
}
-
@ When \.{\\halign} appears in a display, the alignment routines operate
essentially as they do in vertical mode. Then the following program is
activated, with |p| and |q| pointing to the beginning and end of the
@@ -2320,10 +2527,9 @@ void setup_math_style(void)
tail_append(new_noad());
q = new_node(math_char_node, 0);
nucleus(tail) = q;
- (void) scan_math(nucleus(tail), num_style(m_style));
+ (void) scan_math_style(nucleus(tail), num_style(m_style));
}
-
@ @c
void print_math_style(void)
{
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 3b74f77ea29..ae6a38929c9 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
@@ -29,17 +29,15 @@
# define get_vlink(a) vlink(a)
# define get_character(a) character(a)
-extern halfword insert_discretionary(halfword t, halfword pre, halfword post,
- halfword replace, int penalty);
+extern halfword insert_discretionary(halfword t, halfword pre, halfword post, halfword replace, int penalty);
extern halfword insert_syllable_discretionary(halfword t, lang_variables * lan);
extern halfword insert_word_discretionary(halfword t, lang_variables * lan);
-extern halfword insert_complex_discretionary(halfword t, lang_variables * lan,
- halfword pre, halfword post,
- halfword replace);
+extern halfword insert_complex_discretionary(halfword t, lang_variables * lan, halfword pre, halfword post, halfword replace);
extern halfword insert_character(halfword t, int n);
extern void set_disc_field(halfword f, halfword t);
# define varmemcast(a) (memory_word *)(a)
+
extern memory_word *volatile varmem;
extern halfword var_mem_max;
@@ -49,29 +47,26 @@ extern void init_node_mem(int s);
extern void dump_node_mem(void);
extern void undump_node_mem(void);
-
# define max_halfword 0x3FFFFFFF
# define max_dimen 0x3FFFFFFF
# ifndef null
-# define null 0
+# define null 0
# endif
# define null_flag -0x40000000
-# define zero_glue 0
-# define normal 0
+# define zero_glue 0
+# define normal 0
-# define vinfo(a) varmem[(a)].hh.v.LH
-# define vlink(a) varmem[(a)].hh.v.RH
-# define type(a) varmem[(a)].hh.u.B0
-# define subtype(a) varmem[(a)].hh.u.B1
-# define node_attr(a) vinfo((a)+1)
-# define alink(a) vlink((a)+1)
+# define vinfo(a) varmem[(a)].hh.v.LH
+# define vlink(a) varmem[(a)].hh.v.RH
+# define type(a) varmem[(a)].hh.u.B0
+# define subtype(a) varmem[(a)].hh.u.B1
+# define node_attr(a) vinfo((a)+1)
+# define alink(a) vlink((a)+1)
-# define node_size(a) varmem[(a)].hh.v.LH
+# define node_size(a) varmem[(a)].hh.v.LH
-# define rlink(a) vlink((a)+1)
- /* aka alink() */
-# define llink(a) vinfo((a)+1)
- /* overlaps with node_attr() */
+# define rlink(a) vlink((a)+1) /* aka alink() */
+# define llink(a) vinfo((a)+1) /* overlaps with node_attr() */
# define add_glue_ref(a) glue_ref_count(a)++ /* new reference to a glue spec */
@@ -88,27 +83,29 @@ extern void undump_node_mem(void);
*/
# define attribute_node_size 2
+# define cache_disabled max_halfword
-
-# define attr_list_ref(a) vinfo((a)+1)
- /* the reference count */
-# define assign_attribute_ref(n,p) do { node_attr(n) = p;attr_list_ref(p)++;} while (0)
+# define attr_list_ref(a) vinfo((a)+1) /* the reference count */
# define attribute_id(a) vinfo((a)+1)
# define attribute_value(a) vlink((a)+1)
-# define cache_disabled max_halfword
-# define add_node_attr_ref(a) { if (a!=null) attr_list_ref((a))++; }
+# define assign_attribute_ref(n,p) do { \
+ node_attr(n) = p;attr_list_ref(p)++; \
+} while (0)
-# define replace_attribute_list(a,b) do { \
- delete_attribute_ref(node_attr(a)); \
- node_attr(a)=b; \
- } while (0)
+# define add_node_attr_ref(a) do { \
+ if (a!=null) attr_list_ref((a))++; \
+} while (0)
+
+# define replace_attribute_list(a,b) do { \
+ delete_attribute_ref(node_attr(a)); \
+ node_attr(a)=b; \
+} while (0)
extern void update_attribute_cache(void);
extern halfword copy_attribute_list(halfword n);
extern halfword do_set_attribute(halfword p, int i, int val);
-
/* a glue spec */
# define glue_spec_size 4
# define stretch(a) vlink((a)+1)
@@ -130,28 +127,27 @@ typedef enum {
c_leaders, /* |subtype| for centered leaders */
x_leaders, /* |subtype| for expanded leaders */
g_leaders /* |subtype| for global (page) leaders */
-} glue_subtype_codes;
+} glue_subtypes;
/* normal nodes */
-# define inf_bad 10000 /* infinitely bad value */
-# define inf_penalty inf_bad /*``infinite'' penalty value */
-# define eject_penalty -(inf_penalty) /*``negatively infinite'' penalty value */
+# define inf_bad 10000 /* infinitely bad value */
+# define inf_penalty inf_bad /* ``infinite'' penalty value */
+# define eject_penalty -(inf_penalty) /* ``negatively infinite'' penalty value */
-# define penalty_node_size 3
-# define penalty(a) vlink((a)+2)
+# define penalty_node_size 3
+# define penalty(a) vlink((a)+2)
-# define glue_node_size 4
-# define glue_ptr(a) vinfo((a)+2)
-# define leader_ptr(a) vlink((a)+2)
+# define glue_node_size 4
+# define glue_ptr(a) vinfo((a)+2)
+# define leader_ptr(a) vlink((a)+2)
# define synctex_tag_glue(a) vinfo((a)+3)
# define synctex_line_glue(a) vlink((a)+3)
-/* disc nodes could eventually be smaller, because the indirect
- pointers are not really needed (8 instead of 10).
- */
-
-# define disc_node_size 11
+/*
+ disc nodes could eventually be smaller, because the indirect
+ pointers are not really needed (8 instead of 10).
+*/
typedef enum {
discretionary_disc = 0,
@@ -160,16 +156,17 @@ typedef enum {
syllable_disc,
init_disc, /* first of a duo of syllable_discs */
select_disc, /* second of a duo of syllable_discs */
-} discretionary_types;
+} discretionary_subtypes;
+# define disc_node_size 11
# define pre_break_head(a) ((a)+5)
# define post_break_head(a) ((a)+7)
# define no_break_head(a) ((a)+9)
-# define disc_penalty(a) vlink((a)+2)
-# define pre_break(a) vinfo((a)+3)
-# define post_break(a) vlink((a)+3)
-# define no_break(a) vlink((a)+4)
+# define disc_penalty(a) vlink((a)+2)
+# define pre_break(a) vinfo((a)+3)
+# define post_break(a) vlink((a)+3)
+# define no_break(a) vlink((a)+4)
# define tlink llink
# define vlink_pre_break(a) vlink(pre_break_head(a))
@@ -180,21 +177,27 @@ typedef enum {
# define tlink_post_break(a) tlink(post_break_head(a))
# define tlink_no_break(a) tlink(no_break_head(a))
-# define kern_node_size 5
-# define explicit 1 /*|subtype| of kern nodes from \.{\\kern} and \.{\\/} */
-# define acc_kern 2 /*|subtype| of kern nodes from accents */
-# define synctex_tag_kern(a) vinfo((a)+3)
-# define synctex_line_kern(a) vlink((a)+3)
-# define ex_kern(a) vinfo((a)+4) /* expansion factor (hz) */
+# define kern_node_size 5
+# define explicit 1 /* |subtype| of kern nodes from \.{\\kern} and \.{\\/} */
+# define acc_kern 2 /* |subtype| of kern nodes from accents */
+# define ex_kern(a) vinfo((a)+3) /* expansion factor (hz) */
+# define synctex_tag_kern(a) vinfo((a)+4)
+# define synctex_line_kern(a) vlink((a)+4)
# define box_node_size 9
-# define HLIST_SUBTYPE_UNKNOWN 0
-# define HLIST_SUBTYPE_LINE 1 /* paragraph lines */
-# define HLIST_SUBTYPE_HBOX 2 /* \.{\\hbox} */
-# define HLIST_SUBTYPE_INDENT 3 /* indentation box */
-# define HLIST_SUBTYPE_ALIGNROW 4 /* row from a \.{\\halign} or \.{\\valign} */
-# define HLIST_SUBTYPE_ALIGNCELL 5 /* cell from a \.{\\halign} or \.{\\valign} */
+/* todo, make an enum of this */
+
+typedef enum {
+ unknown_list = 0,
+ line_list = 1, /* paragraph lines */
+ hbox_list = 2, /* \.{\\hbox} */
+ indent_list = 3, /* indentation box */
+ align_row_list = 4, /* row from a \.{\\halign} or \.{\\valign} */
+ align_cell_list = 5, /* cell from a \.{\\halign} or \.{\\valign} */
+ equation_list = 6, /* display equation */
+ equation_number_list = 7, /* display equation number */
+} list_subtypes ;
# define width(a) varmem[(a)+2].cint
# define depth(a) varmem[(a)+3].cint
@@ -208,18 +211,27 @@ typedef enum {
# define synctex_tag_box(a) vinfo((a)+8)
# define synctex_line_box(a) vlink((a)+8)
-
/* unset nodes */
+
# define glue_stretch(a) varmem[(a)+7].cint
# define glue_shrink shift_amount
# define span_count subtype
-# define rule_node_size 7
-# define rule_dir(a) vlink((a)+5)
-# define synctex_tag_rule(a) vinfo((a)+6)
-# define synctex_line_rule(a) vlink((a)+6)
-
-# define mark_node_size 3
+typedef enum {
+ normal_rule = 0,
+ box_rule,
+ image_rule,
+ empty_rule,
+} rule_subtypes;
+
+# define rule_node_size 8
+# define rule_dir(a) vlink((a)+5)
+# define rule_index(a) vinfo((a)+6)
+# define rule_transform(a) vlink((a)+6)
+# define synctex_tag_rule(a) vinfo((a)+7)
+# define synctex_line_rule(a) vlink((a)+7)
+
+# define mark_node_size 3
# define mark_ptr(a) vlink((a)+2)
# define mark_class(a) vinfo((a)+2)
@@ -228,7 +240,6 @@ typedef enum {
# define adjust_ptr(a) vlink(a+2)
# define glyph_node_size 6
-
# define character(a) vinfo((a)+2)
# define font(a) vlink((a)+2)
# define lang_data(a) vinfo((a)+3)
@@ -236,17 +247,18 @@ typedef enum {
# define x_displace(a) vinfo((a)+4)
# define y_displace(a) vlink((a)+4)
# define ex_glyph(a) vinfo((a)+5) /* expansion factor (hz) */
-# define is_char_node(a) (a!=null && type(a)==glyph_node)
+
+# define is_char_node(a) (a!=null && type(a)==glyph_node)
# define char_lang(a) ((const int)(signed short)(((signed int)((unsigned)lang_data(a)&0x7FFF0000)<<1)>>17))
# define char_lhmin(a) ((const int)(((unsigned)lang_data(a) & 0x0000FF00)>>8))
# define char_rhmin(a) ((const int)(((unsigned)lang_data(a) & 0x000000FF)))
# define char_uchyph(a) ((const int)(((unsigned)lang_data(a) & 0x80000000)>>31))
-# define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+ \
+# define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+ \
(b<<16)+ (((c>0 && c<256) ? c : 255)<<8)+(((d>0 && d<256) ? d : 255))
-# define init_lang_data(a) lang_data(a)=256+1
+# define init_lang_data(a) lang_data(a)=256+1
# define set_char_lang(a,b) lang_data(a)=make_lang_data(char_uchyph(a),b,char_lhmin(a),char_rhmin(a))
# define set_char_lhmin(a,b) lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),b,char_rhmin(a))
@@ -254,61 +266,53 @@ typedef enum {
# define set_char_uchyph(a,b) lang_data(a)=make_lang_data(b,char_lang(a),char_lhmin(a),char_rhmin(a))
# define margin_kern_node_size 4
-# define margin_char(a) vlink((a)+3)
+# define margin_char(a) vlink((a)+3)
/*@# {|subtype| of marginal kerns}*/
-# define left_side 0
+
+# define left_side 0
# define right_side 1
-# define math_node_size 4
-# define surround(a) vlink((a)+2)
-# define before 0 /*|subtype| for math node that introduces a formula */
-# define after 1 /*|subtype| for math node that winds up a formula */
+# define before 0 /* |subtype| for math node that introduces a formula */
+# define after 1 /* |subtype| for math node that winds up a formula */
+
+# define math_node_size 4
+# define surround(a) vlink((a)+2)
+/* also: glue_ptr(a) vinfo((a)+2) */
# define synctex_tag_math(a) vinfo((a)+3)
# define synctex_line_math(a) vlink((a)+3)
-# define ins_node_size 6
+# define ins_node_size 6
# define float_cost(a) varmem[(a)+2].cint
# define ins_ptr(a) vinfo((a)+5)
# define split_top_ptr(a) vlink((a)+5)
-
# define page_ins_node_size 5
/* height = 4 */
typedef enum {
hlist_node = 0,
- vlist_node = 1,
+ vlist_node,
rule_node,
ins_node,
mark_node,
adjust_node,
- /* 6 used to be ligatures */
- disc_node = 7,
+ boundary_node,
+ disc_node,
whatsit_node,
math_node,
- glue_node, /* 10 */
+ glue_node,
kern_node,
penalty_node,
unset_node,
style_node,
- choice_node, /* 15 */
+ choice_node,
simple_noad,
- old_op_noad,
- old_bin_noad,
- old_rel_noad,
- old_open_noad, /* 20 */
- old_close_noad,
- old_punct_noad,
- old_inner_noad,
radical_noad,
- fraction_noad, /* 25 */
- old_under_noad,
- old_over_noad,
+ fraction_noad,
accent_noad,
- old_vcenter_noad,
- fence_noad, /* 30 */
+ fence_noad,
math_char_node, /* kernel fields */
sub_box_node,
sub_mlist_node,
@@ -318,175 +322,221 @@ typedef enum {
glyph_node,
align_record_node,
pseudo_file_node,
- pseudo_line_node, /* 40 */
+ pseudo_line_node,
inserting_node,
split_up_node,
expr_node,
nesting_node,
- span_node, /* 45 */
+ span_node,
attribute_node,
glue_spec_node,
attribute_list_node,
- action_node,
- temp_node, /* 50 */
+ temp_node,
align_stack_node,
movement_node,
if_node,
unhyphenated_node,
- hyphenated_node, /* 55 */
+ hyphenated_node,
delta_node,
passive_node,
shape_node,
+ dir_node,
+ local_par_node,
} node_types;
-# define MAX_NODE_TYPE 58
+# define MAX_NODE_TYPE 60
# 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 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 nesting_node_size 2
-# define span_node_size 3
-# define span_span(a) vlink((a)+1)
-# define span_link(a) vinfo((a)+1)
+# define span_node_size 3
+# define span_span(a) vlink((a)+1)
+# define span_link(a) vinfo((a)+1)
# define pseudo_file_node_size 2
-# define pseudo_lines(a) vlink((a)+1)
+# define pseudo_lines(a) vlink((a)+1)
# define nodetype_has_attributes(t) (((t)<=glyph_node) && ((t)!=unset_node))
-# define nodetype_has_subtype(t) ((t)!=action_node && (t)!=attribute_list_node && (t)!=attribute_node && (t)!=glue_spec_node)
-# define nodetype_has_prev(t) nodetype_has_subtype((t))
+# define nodetype_has_subtype(t) ((t)!=attribute_list_node && (t)!=attribute_node && (t)!=glue_spec_node)
+# define nodetype_has_prev(t) nodetype_has_subtype((t))
+
+/*
+ style and choice nodes; style nodes can be smaller, the information is encoded in
+ |subtype|, but choice nodes are on-the-spot converted to style nodes
+*/
-/* style and choice nodes */
-/* style nodes can be smaller, the information is encoded in |subtype|,
- but choice nodes are on-the-spot converted to style nodes */
+# define style_node_size 4
+# define display_mlist(a) vinfo((a)+2) /* mlist to be used in display style */
+# define text_mlist(a) vlink((a)+2) /* mlist to be used in text style */
+# define script_mlist(a) vinfo((a)+3) /* mlist to be used in script style */
+# define script_script_mlist(a) vlink((a)+3) /* mlist to be used in scriptscript style */
-# define style_node_size 4 /* number of words in a style node */
+/*
+ because noad types get changed when processing we need to make sure some if the node
+ sizes match and that we don't share slots with different properties
-# define display_mlist(a) vinfo((a)+2) /* mlist to be used in display style */
-# define text_mlist(a) vlink((a)+2) /* mlist to be used in text style */
-# define script_mlist(a) vinfo((a)+3) /* mlist to be used in script style */
-# define script_script_mlist(a) vlink((a)+3) /* mlist to be used in scriptscript style */
+ once it's sorted out we can go smaller and also adapt the flush etc code to it
+*/
/* regular noads */
-# define noad_size 4 /* number of words in a normal noad */
-# define new_hlist(a) vlink((a)+2) /* the translation of an mlist */
-# define nucleus(a) vinfo((a)+2) /* the |nucleus| field of a noad */
-# define supscr(a) vlink((a)+3) /* the |supscr| field of a noad */
-# define subscr(a) vinfo((a)+3) /* the |subscr| field of a noad */
+# define noad_size 8
+# define new_hlist(a) vlink((a)+2) /* the translation of an mlist */
+# define nucleus(a) vinfo((a)+2) /* the |nucleus| field of a noad */
+# define supscr(a) vlink((a)+3) /* the |supscr| field of a noad */
+# define subscr(a) vinfo((a)+3) /* the |subscr| field of a noad */
+# define noaditalic(a) vlink((a)+4)
+# define noadwidth(a) vinfo((a)+4)
+# define noadheight(a) vlink((a)+5)
+# define noaddepth(a) vinfo((a)+5)
+# define noadextra1(a) vlink((a)+6) /* we need to match delimiter (saves copy) */
+# define noadextra2(a) vinfo((a)+6)
+# define noadextra3(a) vlink((a)+7) /* see (!) below */
+# define noadextra4(a) vinfo((a)+7)
/* accent noads */
-/* like a regular noad, but with two extra fields. */
-# define accent_noad_size 5 /*number of |mem| words in an accent noad */
-# define accent_chr(a) vinfo((a)+4) /* the |accent_chr| field of an accent noad */
-# define bot_accent_chr(a) vlink((a)+4) /* the |bot_accent_chr| field of an accent noad */
+# define accent_noad_size 8
+# define top_accent_chr(a) vinfo((a)+6) /* the |top_accent_chr| field of an accent noad */
+# define bot_accent_chr(a) vlink((a)+6) /* the |bot_accent_chr| field of an accent noad */
+# define overlay_accent_chr(a) vinfo((a)+7) /* the |overlay_accent_chr| field of an accent noad */
+# define accentfraction(a) vlink((a)+7)
/* left and right noads */
-# define fence_noad_size 3
-# define delimiter(a) vlink((a)+2) /* |delimiter| field in left and right noads */
+# define fence_noad_size 8 /* needs to match noad size */
+# define delimiteritalic(a) vlink((a)+4)
+/* define delimiterwidth(a) vinfo((a)+4) */
+# define delimiterheight(a) vlink((a)+5)
+# define delimiterdepth(a) vinfo((a)+5)
+# define delimiter(a) vlink((a)+6) /* |delimiter| field in left and right noads */
+# define delimiteroptions(a) vinfo((a)+6)
+# define delimiterclass(a) vlink((a)+7) /* (!) we could probably pack some more in 6 */
+# define delimiterextra1(a) vinfo((a)+7) /* not used */
+
+/* when dimensions then axis else noaxis */
+
+typedef enum {
+ noad_option_set = 0x08,
+ noad_option_unused_1 = 0x00 + 0x08,
+ noad_option_unused_2 = 0x01 + 0x08,
+ noad_option_axis = 0x02 + 0x08,
+ noad_option_no_axis = 0x04 + 0x08,
+ noad_option_exact = 0x10 + 0x08,
+ noad_option_left = 0x11 + 0x08,
+ noad_option_middle = 0x12 + 0x08,
+ noad_option_right = 0x14 + 0x08,
+} delimiter_options ;
+
+# define delimiteroptionset(a) ((delimiteroptions(a) & noad_option_set ) == noad_option_set )
+# define delimiteraxis(a) ((delimiteroptions(a) & noad_option_axis ) == noad_option_axis )
+# define delimiternoaxis(a) ((delimiteroptions(a) & noad_option_no_axis) == noad_option_no_axis)
+# define delimiterexact(a) ((delimiteroptions(a) & noad_option_exact ) == noad_option_exact )
/* subtype of fence noads */
-# define left_noad_side 1
+# define left_noad_side 1
# define middle_noad_side 2
-# define right_noad_side 3
+# define right_noad_side 3
+# define no_noad_side 4
/* fraction noads */
-# define fraction_noad_size 5 /*number of |mem| words in a fraction noad */
-# define thickness(a) vlink((a)+2) /* |thickness| field in a fraction noad */
-# define numerator(a) vlink((a)+3) /*|numerator| field in a fraction noad */
-# define denominator(a) vinfo((a)+3) /*|denominator| field in a fraction noad */
-# define left_delimiter(a) vlink((a)+4) /* first delimiter field of a noad */
-# define right_delimiter(a) vinfo((a)+4) /* second delimiter field of a fraction noad */
+# define fraction_noad_size 7
+# define thickness(a) vlink((a)+2) /* |thickness| field in a fraction noad */
+# define numerator(a) vlink((a)+3) /* |numerator| field in a fraction noad */
+# define denominator(a) vinfo((a)+3) /* |denominator| field in a fraction noad */
+# define left_delimiter(a) vlink((a)+5) /* first delimiter field of a noad */
+# define right_delimiter(a) vinfo((a)+5) /* second delimiter field of a fraction noad */
+# define middle_delimiter(a) vlink((a)+6)
+# define fractionoptions(a) vinfo((a)+6)
+
+# define fractionoptionset(a) ((fractionoptions(a) & noad_option_set ) == noad_option_set )
+# define fractionexact(a) ((fractionoptions(a) & noad_option_exact ) == noad_option_exact )
+# define fractionnoaxis(a) ((fractionoptions(a) & noad_option_no_axis) == noad_option_no_axis)
/* radical noads */
/* this is like a fraction, but it only stores a |left_delimiter| */
-# define radical_noad_size 5 /*number of |mem| words in a radical noad */
-# define degree(a) vinfo((a)+4) /* the root degree in a radical noad */
+# define radical_noad_size 7
+# define radicalwidth(a) vinfo((a)+4)
+# define degree(a) vlink((a)+6) /* the root degree in a radical noad */
+# define radicaloptions(a) vinfo((a)+6)
-# define math_kernel_node_size 3
+# define radicaloptionset(a) ((radicaloptions(a) & noad_option_set ) == noad_option_set)
+# define radicalexact(a) ((radicaloptions(a) & noad_option_exact ) == noad_option_exact)
+# define radicalleft(a) ((radicaloptions(a) & noad_option_left ) == noad_option_left)
+# define radicalmiddle(a) ((radicaloptions(a) & noad_option_middle) == noad_option_middle)
+# define radicalright(a) ((radicaloptions(a) & noad_option_right ) == noad_option_right)
/* accessors for the |nucleus|-style node fields */
-# define math_fam(a) vinfo((a)+2)
-# define math_character(a) vlink((a)+2)
-# define math_list(a) vlink((a)+2)
+
+# define math_kernel_node_size 3
+# define math_fam(a) vinfo((a)+2)
+# define math_character(a) vlink((a)+2)
+# define math_list(a) vlink((a)+2)
/* accessors for the |delimiter|-style two-word subnode fields */
-# define math_shield_node_size 4
- /* not used yet */
+# define math_shield_node_size 4 /* not used yet */
-# define small_fam(A) vinfo((A)+2) /* |fam| for ``small'' delimiter */
-# define small_char(A) vlink((A)+2) /* |character| for ``small'' delimiter */
-# define large_fam(A) vinfo((A)+3) /* |fam| for ``large'' delimiter */
-# define large_char(A) vlink((A)+3) /* |character| for ``large'' delimiter */
+# define small_fam(A) vinfo((A)+2) /* |fam| for ``small'' delimiter */
+# define small_char(A) vlink((A)+2) /* |character| for ``small'' delimiter */
+# define large_fam(A) vinfo((A)+3) /* |fam| for ``large'' delimiter */
+# define large_char(A) vlink((A)+3) /* |character| for ``large'' delimiter */
+/* we should have the codes in a separate enum: extension_codes */
/* be careful: must be in sync with whatsit_node_data[] ! (at least) */
+
typedef enum {
+ /* core */
open_node = 0,
write_node,
close_node,
special_node,
- /*language_node, OBSOLETE*/
- /*set_language_code, OBSOLETE*/
- local_par_node=6,
- dir_node,
- pdf_literal_node,
- pdf_obj_code,
- pdf_refobj_node, /* 10 */
- pdf_xform_code,
- pdf_refxform_node,
- pdf_ximage_code,
- pdf_refximage_node,
+ use_box_resource_node,
+ use_image_resource_node,
+ save_pos_node,
+ late_lua_node,
+ user_defined_node,
+ /* dvi backend */
+ dvi_literal_node = 15,
+ /* pdf backend */
+ pdf_literal_node = 16,
+ pdf_refobj_node,
pdf_annot_node,
pdf_start_link_node,
pdf_end_link_node,
- pdf_outline_code,
pdf_dest_node,
- pdf_thread_node, /* 20 */
+ pdf_action_node,
+ pdf_thread_node,
pdf_start_thread_node,
pdf_end_thread_node,
- save_pos_node,
pdf_thread_data_node,
pdf_link_data_node,
- pdf_names_code,
- pdf_font_attr_code,
- pdf_include_chars_code,
- pdf_map_file_code,
- pdf_map_line_code, /* 30 */
- pdf_trailer_code,
- font_expand_code,
- set_random_seed_code,
- pdf_glyph_to_unicode_code,
- late_lua_node, /* 35 */
- save_cat_code_table_code =37,
- init_cat_code_table_code,
pdf_colorstack_node,
- pdf_setmatrix_node, /*40 */
+ pdf_setmatrix_node,
pdf_save_node,
pdf_restore_node,
- cancel_boundary_node,
- user_defined_node /* 44 */
} whatsit_types;
-# define MAX_WHATSIT_TYPE 44
+# define backend_first_dvi_whatsit 15
+# define backend_last_dvi_whatsit 15
+# define backend_first_pdf_whatsit 16
+# define backend_last_pdf_whatsit 31
-# define get_node_size(i,j) (i!=whatsit_node ? node_data[i].size : whatsit_node_data[j].size)
-# define get_node_name(i,j) (i!=whatsit_node ? node_data[i].name : whatsit_node_data[j].name)
+# define MAX_WHATSIT_TYPE 32
-
-# define pdf_info_code pdf_thread_data_node
-# define pdf_catalog_code pdf_link_data_node
+# define get_node_size(i,j) (i!=whatsit_node ? node_data[i].size : whatsit_node_data[j].size)
+# define get_node_name(i,j) (i!=whatsit_node ? node_data[i].name : whatsit_node_data[j].name)
+# define get_etex_code(i) (node_data[i].etex)
# define GLYPH_CHARACTER (1 << 0)
# define GLYPH_LIGATURE (1 << 1)
@@ -500,10 +550,11 @@ typedef enum {
# define is_simple_character(p) (is_character(p) && !is_ligature(p) && !is_ghost(p))
-# define is_leftboundary(p) (is_ligature(p) && ((subtype(p)) & GLYPH_LEFT ))
+# define is_leftboundary(p) (is_ligature(p) && ((subtype(p)) & GLYPH_LEFT ))
# define is_rightboundary(p) (is_ligature(p) && ((subtype(p)) & GLYPH_RIGHT ))
-# define is_leftghost(p) (is_ghost(p) && ((subtype(p)) & GLYPH_LEFT ))
-# define is_rightghost(p) (is_ghost(p) && ((subtype(p)) & GLYPH_RIGHT ))
+# define is_leftghost(p) (is_ghost(p) && ((subtype(p)) & GLYPH_LEFT ))
+# define is_rightghost(p) (is_ghost(p) && ((subtype(p)) & GLYPH_RIGHT ))
+
# define set_is_glyph(p) subtype(p) = (quarterword) (subtype(p) & ~GLYPH_CHARACTER)
# define set_is_character(p) subtype(p) = (quarterword) (subtype(p) | GLYPH_CHARACTER)
@@ -520,6 +571,13 @@ typedef enum {
# define set_is_leftghost(p) { set_to_ghost(p); subtype(p) |= GLYPH_LEFT; }
# define set_is_rightghost(p) { set_to_ghost(p); subtype(p) |= GLYPH_RIGHT; }
+typedef enum {
+ cancel_boundary = 0,
+ user_boundary
+} boundary_subtypes ;
+
+# define boundary_size 3
+# define boundary_value(a) vinfo((a)+2)
# define special_node_size 3
@@ -551,7 +609,6 @@ typedef enum {
# define save_pos_node_size 3
-
# define local_par_size 6
# define local_pen_inter(a) vinfo((a)+2)
@@ -562,9 +619,11 @@ typedef enum {
# define local_box_right_width(a) vinfo((a)+4)
# define local_par_dir(a) vinfo((a)+5)
-
/* type of literal data */
-# define lua_refid_literal 1 /* not a |normal| string */
+
+# define lua_refid_literal 1 /* not a |normal| string */
+
+/* begin of pdf backend nodes */
/* literal ctm types */
@@ -575,44 +634,39 @@ typedef enum {
scan_special,
} ctm_transform_modes;
-
# define pdf_refobj_node_size 3
-# define pdf_obj_objnum(a) vinfo((a) + 2)
+# define pdf_obj_objnum(a) vinfo((a) + 2)
-# define pdf_refxform_node_size 6
-# define pdf_refximage_node_size 6
# define pdf_annot_node_size 8
# define pdf_dest_node_size 8
# define pdf_thread_node_size 8
/*
-when a whatsit node representing annotation is created, words |1..3| are
-width, height and depth of this annotation; after shipping out words |1..4|
-are rectangle specification of annotation. For whatsit node representing
-destination |pdf_ann_left| and |pdf_ann_top| are used for some types of destinations
+ when a whatsit node representing annotation is created, words |1..3| are
+ width, height and depth of this annotation; after shipping out words |1..4|
+ are rectangle specification of annotation. For whatsit node representing
+ destination |pdf_ann_left| and |pdf_ann_top| are used for some types of destinations
*/
-/* coordinates of destinations/threads/annotations (in whatsit node) */
-# define pdf_ann_left(a) varmem[(a) + 2].cint
-# define pdf_ann_top(a) varmem[(a) + 3].cint
-# define pdf_ann_right(a) varmem[(a) + 4].cint
-# define pdf_ann_bottom(a) varmem[(a) + 5].cint
+/*
+ coordinates of destinations/threads/annotations (in whatsit node)
+*/
-# define pdf_literal_data(a) vlink((a)+2)
-# define pdf_literal_mode(a) type((a)+2)
-# define pdf_literal_type(a) subtype((a)+2)
+# define pdf_ann_left(a) varmem[(a) + 2].cint
+# define pdf_ann_top(a) varmem[(a) + 3].cint
+# define pdf_ann_right(a) varmem[(a) + 4].cint
+# define pdf_ann_bottom(a) varmem[(a) + 5].cint
-# define pdf_ximage_index(a) vinfo((a) + 5) /* /Im* number and image index in array */
-# define pdf_ximage_transform(a) vlink((a) + 5)
-# define pdf_xform_objnum(a) vinfo((a) + 5)
-# define pdf_xform_transform(a) vlink((a) + 5)
+# define pdf_literal_data(a) vlink((a)+2)
+# define pdf_literal_mode(a) type((a)+2)
+# define pdf_literal_type(a) subtype((a)+2)
-# define pdf_annot_data(a) vinfo((a) + 6)
-# define pdf_link_attr(a) vinfo((a) + 6)
-# define pdf_link_action(a) vlink((a) + 6)
-# define pdf_annot_objnum(a) varmem[(a) + 7].cint
-# define pdf_link_objnum(a) varmem[(a) + 7].cint
+# define pdf_annot_data(a) vinfo((a) + 6)
+# define pdf_link_attr(a) vinfo((a) + 6)
+# define pdf_link_action(a) vlink((a) + 6)
+# define pdf_annot_objnum(a) varmem[(a) + 7].cint
+# define pdf_link_objnum(a) varmem[(a) + 7].cint
# define pdf_dest_type(a) type((a) + 6)
# define pdf_dest_named_id(a) subtype((a) + 6)
@@ -624,19 +678,41 @@ destination |pdf_ann_left| and |pdf_ann_top| are used for some types of destinat
# define pdf_thread_id(a) vlink((a) + 6)
# define pdf_thread_attr(a) vinfo((a) + 7)
-# define pdf_end_link_node_size 3
-# define pdf_end_thread_node_size 3
+# define pdf_end_link_node_size 3
+# define pdf_end_thread_node_size 3
-# define pdf_colorstack_node_size 4
-# define pdf_setmatrix_node_size 3
+# define pdf_setmatrix_node_size 3
+# define pdf_save_node_size 3
+# define pdf_restore_node_size 3
-# define pdf_colorstack_stack(a) vlink((a)+2)
-# define pdf_colorstack_cmd(a) vinfo((a)+2)
-# define pdf_colorstack_data(a) vlink((a)+3)
-# define pdf_setmatrix_data(a) vlink((a)+2)
+# define pdf_colorstack_node_size 4
+# define pdf_colorstack_stack(a) vlink((a)+2)
+# define pdf_colorstack_cmd(a) vinfo((a)+2)
+# define pdf_colorstack_data(a) vlink((a)+3)
+# define pdf_setmatrix_data(a) vlink((a)+2)
-# define pdf_save_node_size 3
-# define pdf_restore_node_size 3
+typedef enum {
+ pdf_action_page = 0,
+ pdf_action_goto,
+ pdf_action_thread,
+ pdf_action_user
+} pdf_action_type;
+
+typedef enum {
+ pdf_window_notset,
+ pdf_window_new,
+ pdf_window_nonew,
+} pdf_window_type;
+
+# define pdf_action_size 6
+
+# define pdf_action_type(a) vlink((a)+2) /* enum pdf_action_type */
+# define pdf_action_named_id(a) vinfo((a)+2) /* boolean */
+# define pdf_action_id(a) vlink((a)+3) /* number or toks */
+# define pdf_action_file(a) vinfo((a)+3) /* toks */
+# define pdf_action_new_window(a) vlink((a)+4) /* enum pdf_window_type */
+# define pdf_action_tokens(a) vinfo((a)+4) /* toks */
+# define pdf_action_refcount(a) vlink((a)+5) /* number */
typedef enum {
colorstack_set = 0,
@@ -645,22 +721,26 @@ typedef enum {
colorstack_current
} colorstack_commands;
-# define colorstack_data colorstack_push /* last value where data field is set */
+# define colorstack_data colorstack_push /* last value where data field is set */
+
+/* end of pdf backend nodes */
+
+/* user defined nodes */
# define user_defined_node_size 4
# define user_node_type(a) vinfo((a)+2)
# define user_node_id(a) vlink((a)+2)
# define user_node_value(a) vinfo((a)+3)
-# define cancel_boundary_size 3
+/* node sused in the parbuilder */
-# define active_node_size 4 /*number of words in extended active nodes */
-# define fitness subtype /*|very_loose_fit..tight_fit| on final line for this break */
-# define break_node(a) vlink((a)+1) /*pointer to the corresponding passive node */
-# define line_number(a) vinfo((a)+1) /*line that begins at this breakpoint */
+# define active_node_size 4 /*number of words in extended active nodes */
+# define fitness subtype /*|very_loose_fit..tight_fit| on final line for this break */
+# define break_node(a) vlink((a)+1) /*pointer to the corresponding passive node */
+# define line_number(a) vinfo((a)+1) /*line that begins at this breakpoint */
# define total_demerits(a) varmem[(a)+2].cint /* the quantity that \TeX\ minimizes */
-# define active_short(a) vinfo(a+3) /* |shortfall| of this line */
-# define active_glue(a) vlink(a+3) /*corresponding glue stretch or shrink */
+# define active_short(a) vinfo(a+3) /* |shortfall| of this line */
+# define active_glue(a) vlink(a+3) /*corresponding glue stretch or shrink */
# define passive_node_size 7
# define cur_break(a) vlink((a)+1) /*in passive node, points to position of this breakpoint */
@@ -675,7 +755,9 @@ typedef enum {
# define passive_right_box_width(a) vinfo((a)+5)
# define serial(a) vlink((a)+6) /* serial number for symbolic identification */
-# define delta_node_size 10 /* 8 fields, stored in a+1..9 */
+# define delta_node_size 10 /* 8 fields, stored in a+1..9 */
+
+/* helpers */
# define couple_nodes(a,b) {assert(b!=null);vlink(a)=b;alink(b)=a;}
# define try_couple_nodes(a,b) if (b==null) vlink(a)=b; else {couple_nodes(a,b);}
@@ -684,8 +766,8 @@ typedef enum {
# define cache_disabled max_halfword
extern void delete_attribute_ref(halfword b);
+extern void reset_node_properties(halfword b);
extern void reassign_attribute(halfword n,halfword new);
-extern void delete_attribute_ref(halfword b);
extern void build_attribute_list(halfword b);
extern halfword current_attribute_list(void);
@@ -693,19 +775,30 @@ extern int unset_attribute(halfword n, int c, int w);
extern void set_attribute(halfword n, int c, int w);
extern int has_attribute(halfword n, int c, int w);
-
extern halfword new_span_node(halfword n, int c, scaled w);
extern void print_short_node_contents(halfword n);
extern void show_node_list(int i);
extern pointer actual_box_width(pointer r, scaled base_width);
+/*
+ TH: these two defines still need checking. The node ordering in luatex is not
+ quite the same as in tex82
+*/
+
+/*
+
+# define precedes_break(a) \
+# (type((a))<math_node && (type(a)!=whatsit_node || (subtype(a)!=dir_node && subtype(a)!=local_par_node)))
+
+*/
-/* TH: these two defines still need checking. The node ordering in luatex is not
- quite the same as in tex82 */
+/*
+ so what comes before math (as we have put dir_node and local_par_node to the end)
+*/
+
+# define precedes_break(a) (type((a))<math_node)
-# define precedes_break(a) (type((a))<math_node && \
- (type(a)!=whatsit_node || (subtype(a)!=dir_node && subtype(a)!=local_par_node)))
# define non_discardable(a) (type((a))<math_node)
/* from luanode.c */
@@ -715,10 +808,31 @@ typedef struct _node_info {
int size;
const char **fields;
const char *name;
+ int etex;
} node_info;
extern node_info node_data[];
extern node_info whatsit_node_data[];
+
+extern const char *node_subtypes_glue[];
+extern const char *node_subtypes_leader[];
+extern const char *node_subtypes_fill[];
+extern const char *node_subtypes_penalty[];
+extern const char *node_subtypes_kern[];
+extern const char *node_subtypes_rule[];
+extern const char *node_subtypes_glyph[];
+extern const char *node_subtypes_disc[];
+extern const char *node_subtypes_marginkern[];
+extern const char *node_subtypes_list[];
+extern const char *node_subtypes_math[];
+extern const char *node_subtypes_noad[];
+extern const char *node_subtypes_radical[];
+extern const char *node_subtypes_accent[];
+extern const char *node_subtypes_fence[];
+
+extern const char *node_subtypes_pdf_destination[];
+extern const char *node_subtypes_pdf_literal[];
+
extern halfword new_node(int i, int j);
extern void flush_node_list(halfword);
extern void flush_node(halfword);
@@ -734,6 +848,15 @@ extern halfword raw_glyph_node(void);
extern halfword new_glyph_node(void);
extern int valid_node(halfword);
+extern void flush_node_wrapup_dvi(halfword);
+extern void flush_node_wrapup_pdf(halfword);
+extern void copy_node_wrapup_dvi(halfword, halfword); /* original target */
+extern void copy_node_wrapup_pdf(halfword, halfword); /* original target */
+extern void check_node_wrapup_dvi(halfword);
+extern void check_node_wrapup_pdf(halfword);
+extern void show_node_wrapup_dvi(halfword);
+extern void show_node_wrapup_pdf(halfword);
+
typedef enum {
normal_g = 0,
sfi,
@@ -742,24 +865,24 @@ typedef enum {
filll
} glue_orders;
-# define zero_glue 0
-# define sfi_glue zero_glue+glue_spec_size
-# define fil_glue sfi_glue+glue_spec_size
-# define fill_glue fil_glue+glue_spec_size
-# define ss_glue fill_glue+glue_spec_size
-# define fil_neg_glue ss_glue+glue_spec_size
-# define page_ins_head fil_neg_glue+glue_spec_size
-# define contrib_head page_ins_head+temp_node_size
-# define page_head contrib_head+temp_node_size
-# define temp_head page_head+temp_node_size
-# define hold_head temp_head+temp_node_size
-# define adjust_head hold_head+temp_node_size
-# define pre_adjust_head adjust_head+temp_node_size
-# define active pre_adjust_head+temp_node_size
-# define align_head active+active_node_size
-# define end_span align_head+temp_node_size
-# define begin_point end_span+span_node_size
-# define end_point begin_point+glyph_node_size
+# define zero_glue 0
+# define sfi_glue zero_glue+glue_spec_size
+# define fil_glue sfi_glue+glue_spec_size
+# define fill_glue fil_glue+glue_spec_size
+# define ss_glue fill_glue+glue_spec_size
+# define fil_neg_glue ss_glue+glue_spec_size
+# define page_ins_head fil_neg_glue+glue_spec_size
+# define contrib_head page_ins_head+temp_node_size
+# define page_head contrib_head+temp_node_size
+# define temp_head page_head+temp_node_size
+# define hold_head temp_head+temp_node_size
+# define adjust_head hold_head+temp_node_size
+# define pre_adjust_head adjust_head+temp_node_size
+# define active pre_adjust_head+temp_node_size
+# define align_head active+active_node_size
+# define end_span align_head+temp_node_size
+# define begin_point end_span+span_node_size
+# define end_point begin_point+glyph_node_size
# define var_mem_stat_max (end_point+glyph_node_size-1)
# define stretching 1
@@ -779,7 +902,7 @@ extern int max_used_attr;
extern halfword attr_list_cache;
extern halfword new_null_box(void);
-extern halfword new_rule(void);
+extern halfword new_rule(int s);
extern halfword new_glyph(int f, int c);
extern quarterword norm_min(int h);
extern halfword new_char(int f, int c);
@@ -799,5 +922,13 @@ 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)
+#define par_direction int_par(par_direction_code)
+
+extern halfword make_local_par_node(void);
+
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
index d7f03865d1a..5dac909c7b9 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
@@ -17,6 +17,8 @@
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% hh: Here the backend nodes are still interwoven .. when I'm in the mood...
+
@ @c
@@ -68,269 +70,358 @@ int copy_error(halfword p); /* define below */
#define variable_node_size 2
-const char *node_fields_list[] =
- { "attr", "width", "depth", "height", "dir", "shift",
- "glue_order", "glue_sign", "glue_set", "head", NULL
-};
-const char *node_fields_rule[] =
- { "attr", "width", "depth", "height", "dir", NULL };
-const char *node_fields_insert[] =
- { "attr", "cost", "depth", "height", "spec", "head", NULL };
-const char *node_fields_mark[] = { "attr", "class", "mark", NULL };
-const char *node_fields_adjust[] = { "attr", "head", NULL };
-const char *node_fields_disc[] = { "attr", "pre", "post", "replace", "penalty", NULL };
-const char *node_fields_math[] = { "attr", "surround", NULL };
-const char *node_fields_glue[] = { "attr", "spec", "leader", NULL };
-const char *node_fields_kern[] = { "attr", "kern", "expansion_factor", NULL };
-const char *node_fields_penalty[] = { "attr", "penalty", NULL };
-
-const char *node_fields_unset[] =
- { "attr", "width", "depth", "height", "dir", "shrink",
- "glue_order", "glue_sign", "stretch", "span", "head", NULL
-};
-const char *node_fields_margin_kern[] = { "attr", "width", "glyph", NULL };
-
-const char *node_fields_glyph[] =
- { "attr", "char", "font", "lang", "left", "right", "uchyph",
- "components", "xoffset", "yoffset", "width", "height", "depth", "expansion_factor", NULL
-};
-const char *node_fields_style[] = { "attr", "style", NULL };
-const char *node_fields_choice[] =
- { "attr", "display", "text", "script", "scriptscript", NULL };
-const char *node_fields_ord[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_op[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_bin[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_rel[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_open[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_close[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_punct[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_inner[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_under[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_over[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_vcenter[] = { "attr", "nucleus", "sub", "sup", NULL };
-const char *node_fields_radical[] =
- { "attr", "nucleus", "sub", "sup", "left", "degree", NULL };
-const char *node_fields_fraction[] =
- { "attr", "width", "num", "denom", "left", "right", NULL };
-const char *node_fields_accent[] =
- { "attr", "nucleus", "sub", "sup", "accent", "bot_accent", NULL };
-const char *node_fields_fence[] = { "attr", "delim", NULL };
-const char *node_fields_math_char[] = { "attr", "fam", "char", NULL };
-const char *node_fields_sub_box[] = { "attr", "head", NULL };
-const char *node_fields_sub_mlist[] = { "attr", "head", NULL };
-const char *node_fields_math_text_char[] = { "attr", "fam", "char", NULL };
-const char *node_fields_delim[] =
- { "attr", "small_fam", "small_char", "large_fam", "large_char", NULL };
-
-const char *node_fields_inserting[] =
- { "height", "last_ins_ptr", "best_ins_ptr", NULL };
-
-const char *node_fields_splitup[] = { "height", "last_ins_ptr", "best_ins_ptr",
- "broken_ptr", "broken_ins", NULL
-};
-
-const char *node_fields_action[] = { "action_type", "named_id", "action_id",
- "file", "new_window", "data", "ref_count", NULL
-};
-const char *node_fields_attribute[] = { "number", "value", NULL };
-
-const char *node_fields_glue_spec[] = { "width", "stretch", "shrink",
- "stretch_order", "shrink_order", "ref_count", "writable", NULL
-};
-const char *node_fields_attribute_list[] = { NULL };
-
-const char *node_fields_whatsit_open[] =
- { "attr", "stream", "name", "area", "ext", NULL };
-const char *node_fields_whatsit_write[] = { "attr", "stream", "data", NULL };
-const char *node_fields_whatsit_close[] = { "attr", "stream", NULL };
-const char *node_fields_whatsit_special[] = { "attr", "data", NULL };
-
-const char *node_fields_whatsit_local_par[] =
- { "attr", "pen_inter", "pen_broken", "dir",
- "box_left", "box_left_width", "box_right", "box_right_width", NULL
-};
-const char *node_fields_whatsit_dir[] =
- { "attr", "dir", "level", "dvi_ptr", "dvi_h", NULL };
-
-const char *node_fields_whatsit_pdf_literal[] =
- { "attr", "mode", "data", NULL };
-const char *node_fields_whatsit_pdf_refobj[] = { "attr", "objnum", NULL };
-const char *node_fields_whatsit_pdf_refxform[] =
- { "attr", "width", "depth", "height", "objnum", NULL };
-const char *node_fields_whatsit_pdf_refximage[] =
- { "attr", "width", "depth", "height", "transform", "index", NULL };
-const char *node_fields_whatsit_pdf_annot[] =
- { "attr", "width", "depth", "height", "objnum", "data", NULL };
-const char *node_fields_whatsit_pdf_start_link[] =
- { "attr", "width", "depth", "height",
- "objnum", "link_attr", "action", NULL
-};
-const char *node_fields_whatsit_pdf_end_link[] = { "attr", NULL };
-
-const char *node_fields_whatsit_pdf_dest[] =
- { "attr", "width", "depth", "height",
- "named_id", "dest_id", "dest_type", "xyz_zoom", "objnum", NULL
-};
-
-const char *node_fields_whatsit_pdf_thread[] =
- { "attr", "width", "depth", "height",
- "named_id", "thread_id", "thread_attr", NULL
-};
-
-const char *node_fields_whatsit_pdf_start_thread[] =
- { "attr", "width", "depth", "height",
- "named_id", "thread_id", "thread_attr", NULL
-};
-const char *node_fields_whatsit_pdf_end_thread[] = { "attr", NULL };
-const char *node_fields_whatsit_save_pos[] = { "attr", NULL };
-const char *node_fields_whatsit_late_lua[] =
- { "attr", "reg", "data", "name", "string", NULL };
-const char *node_fields_whatsit_pdf_colorstack[] =
- { "attr", "stack", "cmd", "data", NULL };
-const char *node_fields_whatsit_pdf_setmatrix[] = { "attr", "data", NULL };
-const char *node_fields_whatsit_pdf_save[] = { "attr", NULL };
-const char *node_fields_whatsit_pdf_restore[] = { "attr", NULL };
-const char *node_fields_whatsit_cancel_boundary[] = { "attr", NULL };
-const char *node_fields_whatsit_user_defined[] =
- { "attr", "user_id", "type", "value", NULL };
-
-node_info node_data[] = {
- {hlist_node, box_node_size, node_fields_list, "hlist"},
- {vlist_node, box_node_size, node_fields_list, "vlist"},
- {rule_node, rule_node_size, node_fields_rule, "rule"},
- {ins_node, ins_node_size, node_fields_insert, "ins"},
- {mark_node, mark_node_size, node_fields_mark, "mark"},
- {adjust_node, adjust_node_size, node_fields_adjust, "adjust"},
- {fake_node, fake_node_size, NULL, fake_node_name}, /* don't touch this! */
- {disc_node, disc_node_size, node_fields_disc, "disc"},
- {whatsit_node, -1, NULL, "whatsit"},
- {math_node, math_node_size, node_fields_math, "math"},
- {glue_node, glue_node_size, node_fields_glue, "glue"},
- {kern_node, kern_node_size, node_fields_kern, "kern"},
- {penalty_node, penalty_node_size, node_fields_penalty, "penalty"},
- {unset_node, box_node_size, node_fields_unset, "unset"},
- {style_node, style_node_size, node_fields_style, "style"},
- {choice_node, style_node_size, node_fields_choice, "choice"},
- {simple_noad, noad_size, node_fields_ord, "noad"},
- {old_op_noad, noad_size, node_fields_op, "op"},
- {old_bin_noad, noad_size, node_fields_bin, "bin"},
- {old_rel_noad, noad_size, node_fields_rel, "rel"},
- {old_open_noad, noad_size, node_fields_open, "open"},
- {old_close_noad, noad_size, node_fields_close, "close"},
- {old_punct_noad, noad_size, node_fields_punct, "punct"},
- {old_inner_noad, noad_size, node_fields_inner, "inner"},
- {radical_noad, radical_noad_size, node_fields_radical, "radical"},
- {fraction_noad, fraction_noad_size, node_fields_fraction, "fraction"},
- {old_under_noad, noad_size, node_fields_under, "under"},
- {old_over_noad, noad_size, node_fields_over, "over"},
- {accent_noad, accent_noad_size, node_fields_accent, "accent"},
- {old_vcenter_noad, noad_size, node_fields_vcenter, "vcenter"},
- {fence_noad, fence_noad_size, node_fields_fence, "fence"},
- {math_char_node, math_kernel_node_size, node_fields_math_char, "math_char"},
- {sub_box_node, math_kernel_node_size, node_fields_sub_box, "sub_box"},
- {sub_mlist_node, math_kernel_node_size, node_fields_sub_mlist, "sub_mlist"},
- {math_text_char_node, math_kernel_node_size, node_fields_math_text_char, "math_text_char"},
- {delim_node, math_shield_node_size, node_fields_delim, "delim"},
- {margin_kern_node, margin_kern_node_size, node_fields_margin_kern, "margin_kern"},
- {glyph_node, glyph_node_size, node_fields_glyph, "glyph"},
- {align_record_node, box_node_size, NULL, "align_record"},
- {pseudo_file_node, pseudo_file_node_size, NULL, "pseudo_file"},
- {pseudo_line_node, variable_node_size, NULL, "pseudo_line"},
- {inserting_node, page_ins_node_size, node_fields_inserting, "page_insert"},
- {split_up_node, page_ins_node_size, node_fields_splitup, "split_insert"},
- {expr_node, expr_node_size, NULL, "expr_stack"},
- {nesting_node, nesting_node_size, NULL, "nested_list"},
- {span_node, span_node_size, NULL, "span"},
- {attribute_node, attribute_node_size, node_fields_attribute, "attribute"},
- {glue_spec_node, glue_spec_size, node_fields_glue_spec, "glue_spec"},
- {attribute_list_node, attribute_node_size, node_fields_attribute_list, "attribute_list"},
- {action_node, pdf_action_size, node_fields_action, "action"},
- {temp_node, temp_node_size, NULL, "temp"},
- {align_stack_node, align_stack_node_size, NULL, "align_stack"},
- {movement_node, movement_node_size, NULL, "movement_stack"},
- {if_node, if_node_size, NULL, "if_stack"},
- {unhyphenated_node, active_node_size, NULL, "unhyphenated"},
- {hyphenated_node, active_node_size, NULL, "hyphenated"},
- {delta_node, delta_node_size, NULL, "delta"},
- {passive_node, passive_node_size, NULL, "passive"},
- {shape_node, variable_node_size, NULL, "shape"},
- {-1, -1, NULL, NULL}
-};
-
-#define last_normal_node shape_node
+/* core nodes */
+
+const char *node_fields_list[] = {
+ "attr", "width", "depth", "height", "dir", "shift", "glue_order", "glue_sign",
+ "glue_set", "head", NULL
+};
+const char *node_fields_rule[] = {
+ "attr", "width", "depth", "height", "dir", "index", NULL
+};
+const char *node_fields_insert[] = {
+ "attr", "cost", "depth", "height", "spec", "head", NULL
+};
+const char *node_fields_mark[] = {
+ "attr", "class", "mark", NULL
+};
+const char *node_fields_adjust[] = {
+ "attr", "head", NULL
+};
+const char *node_fields_disc[] = {
+ "attr", "pre", "post", "replace", "penalty", NULL
+};
+const char *node_fields_math[] = {
+ "attr", "surround", NULL
+};
+const char *node_fields_glue[] = {
+ "attr", "spec", "leader", NULL
+};
+const char *node_fields_kern[] = {
+ "attr", "kern", "expansion_factor", NULL
+};
+const char *node_fields_penalty[] = {
+ "attr", "penalty", NULL
+};
+const char *node_fields_unset[] = {
+ "attr", "width", "depth", "height", "dir", "shrink", "glue_order",
+ "glue_sign", "stretch", "span", "head", NULL
+};
+const char *node_fields_margin_kern[] = {
+ "attr", "width", "glyph", NULL
+};
+const char *node_fields_glyph[] = {
+ "attr", "char", "font", "lang", "left", "right", "uchyph", "components",
+ "xoffset", "yoffset", "width", "height", "depth", "expansion_factor", NULL
+};
+const char *node_fields_inserting[] = {
+ "height", "last_ins_ptr", "best_ins_ptr", NULL
+};
+const char *node_fields_splitup[] = {
+ "height", "last_ins_ptr", "best_ins_ptr", "broken_ptr", "broken_ins", NULL
+};
+const char *node_fields_attribute[] = {
+ "number", "value", NULL
+};
+const char *node_fields_glue_spec[] = {
+ "width", "stretch", "shrink", "stretch_order", "shrink_order", "ref_count",
+ "writable", NULL
+};
+const char *node_fields_attribute_list[] = {
+ NULL
+};
+const char *node_fields_local_par[] = {
+ "attr", "pen_inter", "pen_broken", "dir", "box_left", "box_left_width",
+ "box_right", "box_right_width", NULL
+};
+const char *node_fields_dir[] = {
+ "attr", "dir", "level", "dvi_ptr", "dvi_h", NULL
+};
+const char *node_fields_boundary[] = {
+ "attr", "value", NULL
+};
+
+/* math nodes */
+
+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
+};
+const char *node_fields_choice[] = {
+ "attr", "display", "text", "script", "scriptscript", NULL
+};
+const char *node_fields_radical[] = {
+ "attr", "nucleus", "sub", "sup", "left", "degree", NULL
+};
+const char *node_fields_fraction[] = {
+ "attr", "width", "num", "denom", "left", "right", NULL
+};
+const char *node_fields_accent[] = {
+ "attr", "nucleus", "sub", "sup", "accent", "bot_accent", "top_accent",
+ "overlay_accent", NULL
+};
+const char *node_fields_fence[] = {
+ "attr", "delim", NULL
+};
+const char *node_fields_math_char[] = {
+ "attr", "fam", "char", NULL
+};
+const char *node_fields_sub_box[] = {
+ "attr", "head", NULL
+};
+const char *node_fields_sub_mlist[] = {
+ "attr", "head", NULL
+};
+const char *node_fields_math_text_char[] = {
+ "attr", "fam", "char", NULL
+};
+const char *node_fields_delim[] = {
+ "attr", "small_fam", "small_char", "large_fam", "large_char", NULL
+};
+
+/* whatsit nodes */
+
+const char *node_fields_whatsit_open[] = {
+ "attr", "stream", "name", "area", "ext", NULL
+};
+const char *node_fields_whatsit_write[] = {
+ "attr", "stream", "data", NULL
+};
+const char *node_fields_whatsit_close[] = {
+ "attr", "stream", NULL
+};
+const char *node_fields_whatsit_special[] = {
+ "attr", "data", NULL
+};
+const char *node_fields_whatsit_save_pos[] = {
+ "attr", NULL
+};
+const char *node_fields_whatsit_late_lua[] = {
+ "attr", "reg", "data", "name", "string", NULL
+};
+const char *node_fields_whatsit_user_defined[] = {
+ "attr", "user_id", "type", "value", NULL
+};
+
+/* pdf backend whatsit nodes */
+
+const char *node_fields_whatsit_pdf_literal[] = {
+ "attr", "mode", "data", NULL
+};
+const char *node_fields_whatsit_pdf_refobj[] = {
+ "attr", "objnum", NULL
+};
+const char *node_fields_whatsit_pdf_annot[] = {
+ "attr", "width", "depth", "height", "objnum", "data", NULL
+};
+const char *node_fields_whatsit_pdf_start_link[] = {
+ "attr", "width", "depth", "height", "objnum", "link_attr", "action", NULL
+};
+const char *node_fields_whatsit_pdf_end_link[] = {
+ "attr", NULL
+};
+const char *node_fields_whatsit_pdf_dest[] = {
+ "attr", "width", "depth", "height", "named_id", "dest_id", "dest_type",
+ "xyz_zoom", "objnum", NULL
+};
+const char *node_fields_whatsit_pdf_action[] = {
+ "action_type", "named_id", "action_id", "file", "new_window", "data",
+ "ref_count", NULL
+};
+const char *node_fields_whatsit_pdf_thread[] = {
+ "attr", "width", "depth", "height", "named_id", "thread_id", "thread_attr", NULL
+};
+const char *node_fields_whatsit_pdf_start_thread[] = {
+ "attr", "width", "depth", "height", "named_id", "thread_id", "thread_attr", NULL
+};
+const char *node_fields_whatsit_pdf_end_thread[] = {
+ "attr", NULL
+};
+const char *node_fields_whatsit_pdf_colorstack[] = {
+ "attr", "stack", "cmd", "data", NULL
+};
+const char *node_fields_whatsit_pdf_setmatrix[] = {
+ "attr", "data", NULL
+};
+const char *node_fields_whatsit_pdf_save[] = {
+ "attr", NULL
+};
+const char *node_fields_whatsit_pdf_restore[] = {
+ "attr", NULL
+};
+
+/* subtypes */
+
+const char *node_subtypes_glue[] = {
+ "userskip", "lineskip", "baselineskip", "parskip", "abovedisplayskip", "belowdisplayskip",
+ "abovedisplayshortskip", "belowdisplayshortskip", "leftskip", "rightskip", "topskip",
+ "splittopskip", "tabskip", "spaceskip", "xspaceskip", "parfillskip", "thinmuskip",
+ "medmuskip", "thickmuskip", "mathskip", NULL
+};
+const char *node_subtypes_leader[] = { /* 100+ */
+ "leaders", "cleaders", "xleaders", "gleaders", NULL
+};
+const char *node_subtypes_fill[] = {
+ "stretch", "fi", "fil", "fill", "filll", NULL
+};
+const char *node_subtypes_penalty[] = {
+ "userpenalty", NULL
+};
+const char *node_subtypes_kern[] = {
+ "fontkern", "userkern", "accentkern", NULL
+};
+const char *node_subtypes_rule[] = {
+ "normal", "box", "image", "empty", NULL
+};
+const char *node_subtypes_glyph[] = {
+ "character", "glyph", "ligature", "ghost", "left", "right", NULL
+};
+const char *node_subtypes_disc[] = {
+ "discretionary", "explicit", "automatic", "regular", "first", "second", NULL
+};
+const char *node_subtypes_marginkern[] = {
+ "left", "right", NULL
+};
+const char *node_subtypes_list[] = {
+ "unknown", "line", "box", "indent", "alignment", "cell", "equation", "equationnumber", NULL
+};
+const char *node_subtypes_math[] = {
+ "beginmath", "endmath", NULL
+};
+const char *node_subtypes_noad[] = {
+ "ord", "opdisplaylimits", "oplimits", "opnolimits", "bin", "rel", "open", "close",
+ "punct", "inner", "under", "over", "vcenter", NULL
+};
+const char *node_subtypes_radical[] = {
+ "radical", "uradical", "uroot", "uunderdelimiter", "uoverdelimiter", "udelimiterunder",
+ "udelimiterover", NULL
+};
+const char *node_subtypes_accent[] = {
+ "bothflexible", "fixedtop", "fixedbottom", "fixedboth", NULL,
+};
+const char *node_subtypes_fence[] = {
+ "unset", "left", "middle", "right", NULL
+};
+
+node_info node_data[] = { /* the last entry in a row is the etex number */
+ { hlist_node, box_node_size, node_fields_list, "hlist", 1 },
+ { vlist_node, box_node_size, node_fields_list, "vlist", 2 },
+ { rule_node, rule_node_size, node_fields_rule, "rule", 3 },
+ { ins_node, ins_node_size, node_fields_insert, "ins", 4 },
+ { mark_node, mark_node_size, node_fields_mark, "mark", 5 },
+ { adjust_node, adjust_node_size, node_fields_adjust, "adjust", 6 },
+ { boundary_node, boundary_size, node_fields_boundary, "boundary", -1 },
+ { disc_node, disc_node_size, node_fields_disc, "disc", 8 },
+ { whatsit_node, -1, NULL, "whatsit", 9 },
+ { math_node, math_node_size, node_fields_math, "math", 10 },
+ { glue_node, glue_node_size, node_fields_glue, "glue", 11 },
+ { kern_node, kern_node_size, node_fields_kern, "kern", 12 },
+ { penalty_node, penalty_node_size, node_fields_penalty, "penalty", 13 },
+ { 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 },
+ { 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 },
+ { fence_noad, fence_noad_size, node_fields_fence, "fence", 15 },
+ { math_char_node, math_kernel_node_size, node_fields_math_char, "math_char", 15 },
+ { sub_box_node, math_kernel_node_size, node_fields_sub_box, "sub_box", 15 },
+ { sub_mlist_node, math_kernel_node_size, node_fields_sub_mlist, "sub_mlist", 15 },
+ { math_text_char_node, math_kernel_node_size, node_fields_math_text_char, "math_text_char", 15 },
+ { delim_node, math_shield_node_size, node_fields_delim, "delim", 15 },
+ { margin_kern_node, margin_kern_node_size, node_fields_margin_kern, "margin_kern", -1 },
+ { glyph_node, glyph_node_size, node_fields_glyph, "glyph", 0 },
+ { align_record_node, box_node_size, NULL, "align_record", -1 },
+ { pseudo_file_node, pseudo_file_node_size, NULL, "pseudo_file", -1 },
+ { pseudo_line_node, variable_node_size, NULL, "pseudo_line", -1 },
+ { inserting_node, page_ins_node_size, node_fields_inserting, "page_insert", -1 },
+ { split_up_node, page_ins_node_size, node_fields_splitup, "split_insert", -1 },
+ { expr_node, expr_node_size, NULL, "expr_stack", -1 },
+ { nesting_node, nesting_node_size, NULL, "nested_list", -1 },
+ { span_node, span_node_size, NULL, "span", -1 },
+ { attribute_node, attribute_node_size, node_fields_attribute, "attribute", -1 },
+ { glue_spec_node, glue_spec_size, node_fields_glue_spec, "glue_spec", -1 },
+ { attribute_list_node, attribute_node_size, node_fields_attribute_list, "attribute_list", -1 },
+ { temp_node, temp_node_size, NULL, "temp", -1 },
+ { align_stack_node, align_stack_node_size, NULL, "align_stack", -1 },
+ { movement_node, movement_node_size, NULL, "movement_stack", -1 },
+ { if_node, if_node_size, NULL, "if_stack", -1 },
+ { unhyphenated_node, active_node_size, NULL, "unhyphenated", -1 },
+ { hyphenated_node, active_node_size, NULL, "hyphenated", -1 },
+ { delta_node, delta_node_size, NULL, "delta", -1 },
+ { passive_node, passive_node_size, NULL, "passive", -1 },
+ { shape_node, variable_node_size, NULL, "shape", -1 },
+ { dir_node, dir_node_size, node_fields_dir, "dir", -1 },
+ { local_par_node, local_par_size, node_fields_local_par, "local_par", -1 },
+ { -1, -1, NULL, NULL, -1 },
+};
+
+#define last_normal_node local_par_node
+
+const char *node_subtypes_pdf_destination[] = {
+ "xyz", "fit", "fith", "fitv", "fitb", "fitbh", "fitbv", "fitr", NULL
+};
+const char *node_subtypes_pdf_literal[] = {
+ "origin", "page", "direct", NULL
+};
node_info whatsit_node_data[] = {
- {open_node, open_node_size, node_fields_whatsit_open, "open"},
- {write_node, write_node_size, node_fields_whatsit_write, "write"},
- {close_node, close_node_size, node_fields_whatsit_close, "close"},
- {special_node, special_node_size, node_fields_whatsit_special, "special"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {local_par_node, local_par_size, node_fields_whatsit_local_par,
- "local_par"},
- {dir_node, dir_node_size, node_fields_whatsit_dir, "dir"},
- {pdf_literal_node, write_node_size, node_fields_whatsit_pdf_literal,
- "pdf_literal"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {pdf_refobj_node, pdf_refobj_node_size, node_fields_whatsit_pdf_refobj,
- "pdf_refobj"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {pdf_refxform_node, pdf_refxform_node_size,
- node_fields_whatsit_pdf_refxform, "pdf_refxform"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {pdf_refximage_node, pdf_refximage_node_size,
- node_fields_whatsit_pdf_refximage, "pdf_refximage"},
- {pdf_annot_node, pdf_annot_node_size, node_fields_whatsit_pdf_annot,
- "pdf_annot"},
- {pdf_start_link_node, pdf_annot_node_size,
- node_fields_whatsit_pdf_start_link, "pdf_start_link"},
- {pdf_end_link_node, pdf_end_link_node_size,
- node_fields_whatsit_pdf_end_link, "pdf_end_link"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {pdf_dest_node, pdf_dest_node_size, node_fields_whatsit_pdf_dest,
- "pdf_dest"},
- {pdf_thread_node, pdf_thread_node_size, node_fields_whatsit_pdf_thread,
- "pdf_thread"},
- {pdf_start_thread_node, pdf_thread_node_size,
- node_fields_whatsit_pdf_start_thread, "pdf_start_thread"},
- {pdf_end_thread_node, pdf_end_thread_node_size,
- node_fields_whatsit_pdf_end_thread, "pdf_end_thread"},
- {save_pos_node, save_pos_node_size,
- node_fields_whatsit_save_pos, "save_pos"},
- {pdf_thread_data_node, pdf_thread_node_size, NULL, "pdf_thread_data"},
- {pdf_link_data_node, pdf_annot_node_size, NULL, "pdf_link_data"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {late_lua_node, late_lua_node_size, node_fields_whatsit_late_lua,
- "late_lua"},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {fake_node, fake_node_size, NULL, fake_node_name},
- {pdf_colorstack_node, pdf_colorstack_node_size,
- node_fields_whatsit_pdf_colorstack, "pdf_colorstack"},
- {pdf_setmatrix_node, pdf_setmatrix_node_size,
- node_fields_whatsit_pdf_setmatrix, "pdf_setmatrix"},
- {pdf_save_node, pdf_save_node_size, node_fields_whatsit_pdf_save,
- "pdf_save"},
- {pdf_restore_node, pdf_restore_node_size, node_fields_whatsit_pdf_restore,
- "pdf_restore"},
- {cancel_boundary_node, cancel_boundary_size,
- node_fields_whatsit_cancel_boundary, "cancel_boundary"},
- {user_defined_node, user_defined_node_size,
- node_fields_whatsit_user_defined, "user_defined"},
- {-1, -1, NULL, NULL}
-};
-
-#define last_whatsit_node user_defined_node
-
-/* hh: experiment */
+ { open_node, open_node_size, node_fields_whatsit_open, "open", -1 },
+ { write_node, write_node_size, node_fields_whatsit_write, "write", -1 },
+ { close_node, close_node_size, node_fields_whatsit_close, "close", -1 },
+ { special_node, special_node_size, node_fields_whatsit_special, "special", -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { save_pos_node, save_pos_node_size, node_fields_whatsit_save_pos, "save_pos", -1 },
+ { late_lua_node, late_lua_node_size, node_fields_whatsit_late_lua, "late_lua", -1 },
+ { user_defined_node, user_defined_node_size, node_fields_whatsit_user_defined, "user_defined", -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ { fake_node, fake_node_size, NULL, fake_node_name, -1 },
+ /* here starts the dvi backend section, todo: a separate list */
+ /* nothing for dvi */
+ /* here starts the pdf backend section, todo: a separate list */
+ { pdf_literal_node, write_node_size, node_fields_whatsit_pdf_literal, "pdf_literal", -1 },
+ { pdf_refobj_node, pdf_refobj_node_size, node_fields_whatsit_pdf_refobj, "pdf_refobj", -1 },
+ { pdf_annot_node, pdf_annot_node_size, node_fields_whatsit_pdf_annot, "pdf_annot", -1 },
+ { pdf_start_link_node, pdf_annot_node_size, node_fields_whatsit_pdf_start_link, "pdf_start_link", -1 },
+ { pdf_end_link_node, pdf_end_link_node_size, node_fields_whatsit_pdf_end_link, "pdf_end_link", -1 },
+ { pdf_dest_node, pdf_dest_node_size, node_fields_whatsit_pdf_dest, "pdf_dest", -1 },
+ { pdf_action_node, pdf_action_size, node_fields_whatsit_pdf_action, "pdf_action", -1 },
+ { pdf_thread_node, pdf_thread_node_size, node_fields_whatsit_pdf_thread, "pdf_thread", -1 },
+ { pdf_start_thread_node, pdf_thread_node_size, node_fields_whatsit_pdf_start_thread, "pdf_start_thread", -1 },
+ { pdf_end_thread_node, pdf_end_thread_node_size, node_fields_whatsit_pdf_end_thread, "pdf_end_thread", -1 },
+ { pdf_thread_data_node, pdf_thread_node_size, NULL, "pdf_thread_data", -1 },
+ { pdf_link_data_node, pdf_annot_node_size, NULL, "pdf_link_data", -1 },
+ { pdf_colorstack_node, pdf_colorstack_node_size, node_fields_whatsit_pdf_colorstack, "pdf_colorstack", -1 },
+ { pdf_setmatrix_node, pdf_setmatrix_node_size, node_fields_whatsit_pdf_setmatrix, "pdf_setmatrix", -1 },
+ { pdf_save_node, pdf_save_node_size, node_fields_whatsit_pdf_save, "pdf_save", -1 },
+ { pdf_restore_node, pdf_restore_node_size, node_fields_whatsit_pdf_restore, "pdf_restore", -1 },
+ /* done */
+ { -1, -1, NULL, NULL, -1 },
+};
+
+#define last_whatsit_node pdf_restore_node
/*
@@ -540,6 +631,8 @@ halfword new_node(int i, int j)
depth(n) = null_flag;
height(n) = null_flag;
rule_dir(n) = -1;
+ rule_index(n) = 0;
+ rule_transform(n) = 0;
/* fall through */
case unset_node:
width(n) = null_flag;
@@ -560,32 +653,34 @@ halfword new_node(int i, int j)
default:
break;
}
- /* handle synctex extension */
- switch (i) {
- case math_node:
- synctex_tag_math(n) = cur_input.synctex_tag_field;
- synctex_line_math(n) = line;
- break;
- case glue_node:
- synctex_tag_glue(n) = cur_input.synctex_tag_field;
- synctex_line_glue(n) = line;
- break;
- case kern_node:
- if (j != 0) {
- synctex_tag_kern(n) = cur_input.synctex_tag_field;
- synctex_line_kern(n) = line;
+ if (int_par(synctex_code)) {
+ /* handle synctex extension */
+ switch (i) {
+ case math_node:
+ synctex_tag_math(n) = cur_input.synctex_tag_field;
+ synctex_line_math(n) = line;
+ break;
+ case glue_node:
+ synctex_tag_glue(n) = cur_input.synctex_tag_field;
+ synctex_line_glue(n) = line;
+ break;
+ case kern_node:
+ if (j != 0) {
+ synctex_tag_kern(n) = cur_input.synctex_tag_field;
+ synctex_line_kern(n) = line;
+ }
+ break;
+ case hlist_node:
+ case vlist_node:
+ case unset_node:
+ synctex_tag_box(n) = cur_input.synctex_tag_field;
+ synctex_line_box(n) = line;
+ break;
+ case rule_node:
+ synctex_tag_rule(n) = cur_input.synctex_tag_field;
+ synctex_line_rule(n) = line;
+ break;
}
- break;
- case hlist_node:
- case vlist_node:
- case unset_node:
- synctex_tag_box(n) = cur_input.synctex_tag_field;
- synctex_line_box(n) = line;
- break;
- case rule_node:
- synctex_tag_rule(n) = cur_input.synctex_tag_field;
- synctex_line_rule(n) = line;
- break;
}
/* take care of attributes */
if (nodetype_has_attributes(i)) {
@@ -699,10 +794,98 @@ halfword copy_node_list(halfword p)
} while (0)
@ make a dupe of a single node
+
@c
+
+/*
+ at some point we can use function pointers as in the backend itself:
+
+ typedef void (*copy_function) ();
+ copy_function *copy_functions;
+ xmalloc((MAX_WHATSIT_TYPE + 1) * sizeof(copy_function));
+*/
+
+static void copy_node_wrapup_core(halfword p, halfword r)
+{
+ halfword s ;
+ switch (subtype(p)) {
+ case write_node:
+ case special_node:
+ add_token_ref(write_tokens(p));
+ break;
+ case late_lua_node:
+ copy_late_lua(r, p);
+ break;
+ case user_defined_node:
+ switch (user_node_type(p)) {
+ case 'a':
+ add_node_attr_ref(user_node_value(p));
+ break;
+ case 'l':
+ copy_user_lua(r, p);
+ break;
+ case 'n':
+ s = copy_node_list(user_node_value(p));
+ user_node_value(r) = s;
+ break;
+ case 's':
+ /* |add_string_ref(user_node_value(p));| *//* if this was mpost .. */
+ break;
+ case 't':
+ add_token_ref(user_node_value(p));
+ break;
+ }
+ break;
+ default:
+ break ;
+ }
+}
+
+void copy_node_wrapup_dvi(halfword p, halfword r)
+{
+}
+
+void copy_node_wrapup_pdf(halfword p, halfword r)
+{
+ switch(subtype(p)) {
+ case pdf_literal_node:
+ copy_pdf_literal(r, p);
+ break;
+ case pdf_colorstack_node:
+ if (pdf_colorstack_cmd(p) <= colorstack_data)
+ add_token_ref(pdf_colorstack_data(p));
+ break;
+ case pdf_setmatrix_node:
+ add_token_ref(pdf_setmatrix_data(p));
+ break;
+ case pdf_annot_node:
+ add_token_ref(pdf_annot_data(p));
+ break;
+ case pdf_start_link_node:
+ if (pdf_link_attr(r) != null)
+ add_token_ref(pdf_link_attr(r));
+ add_action_ref(pdf_link_action(r));
+ break;
+ case pdf_dest_node:
+ if (pdf_dest_named_id(p) > 0)
+ add_token_ref(pdf_dest_id(p));
+ break;
+ case pdf_thread_node:
+ case pdf_start_thread_node:
+ if (pdf_thread_named_id(p) > 0)
+ add_token_ref(pdf_thread_id(p));
+ if (pdf_thread_attr(p) != null)
+ add_token_ref(pdf_thread_attr(p));
+ break;
+ default:
+ break;
+ }
+}
+
halfword copy_node(const halfword p)
{
halfword r; /* current node being fabricated for new list */
+ halfword w ; /* whatsit subtype */
register halfword s; /* a helper variable for copying into variable mem */
register int i;
if (copy_error(p)) {
@@ -715,16 +898,18 @@ halfword copy_node(const halfword p)
(void) memcpy((void *) (varmem + r), (void *) (varmem + p),
(sizeof(memory_word) * (unsigned) i));
- /* handle synctex extension */
- switch (type(p)) {
- case math_node:
- synctex_tag_math(r) = cur_input.synctex_tag_field;
- synctex_line_math(r) = line;
- break;
- case kern_node:
- synctex_tag_kern(r) = cur_input.synctex_tag_field;
- synctex_line_kern(r) = line;
- break;
+ if (int_par(synctex_code)) {
+ /* handle synctex extension */
+ switch (type(p)) {
+ case math_node:
+ synctex_tag_math(r) = cur_input.synctex_tag_field;
+ synctex_line_math(r) = line;
+ break;
+ case kern_node:
+ synctex_tag_kern(r) = cur_input.synctex_tag_field;
+ synctex_line_kern(r) = line;
+ break;
+ }
}
if (nodetype_has_attributes(type(p))) {
add_node_attr_ref(node_attr(p));
@@ -775,6 +960,11 @@ halfword copy_node(const halfword p)
assert(tlink_no_break(r) == null);
}
break;
+ case math_node:
+ if (glue_ptr(p) != zero_glue) {
+ add_glue_ref(glue_ptr(p));
+ }
+ break;
case ins_node:
add_glue_ref(split_top_ptr(p));
copy_sub_list(ins_ptr(r),ins_ptr(p)) ;
@@ -795,18 +985,24 @@ halfword copy_node(const halfword p)
copy_sub_list(script_script_mlist(r),script_script_mlist(p)) ;
break;
case simple_noad:
+ copy_sub_list(nucleus(r),nucleus(p)) ;
+ copy_sub_list(subscr(r),subscr(p)) ;
+ copy_sub_list(supscr(r),supscr(p)) ;
+ break;
case radical_noad:
+ copy_sub_list(nucleus(r),nucleus(p)) ;
+ copy_sub_list(subscr(r),subscr(p)) ;
+ copy_sub_list(supscr(r),supscr(p)) ;
+ copy_sub_node(left_delimiter(r),left_delimiter(p)) ;
+ copy_sub_list(degree(r),degree(p)) ;
+ break;
case accent_noad:
copy_sub_list(nucleus(r),nucleus(p)) ;
copy_sub_list(subscr(r),subscr(p)) ;
copy_sub_list(supscr(r),supscr(p)) ;
- if (type(p) == accent_noad) {
- copy_sub_list(accent_chr(r),accent_chr(p)) ;
- copy_sub_list(bot_accent_chr(r),bot_accent_chr(p)) ;
- } else if (type(p) == radical_noad) {
- copy_sub_node(left_delimiter(r),left_delimiter(p)) ;
- copy_sub_list(degree(r),degree(p)) ;
- }
+ copy_sub_list(top_accent_chr(r),top_accent_chr(p)) ;
+ copy_sub_list(bot_accent_chr(r),bot_accent_chr(p)) ;
+ copy_sub_list(overlay_accent_chr(r),overlay_accent_chr(p)) ;
break;
case fence_noad:
copy_sub_node(delimiter(r),delimiter(p)) ;
@@ -824,77 +1020,18 @@ halfword copy_node(const halfword p)
case glue_spec_node:
glue_ref_count(r) = null;
break;
- case whatsit_node:
- switch (subtype(p)) {
- case dir_node:
- case local_par_node:
- break;
- case write_node:
- case special_node:
- add_token_ref(write_tokens(p));
- break;
- case pdf_literal_node:
- copy_pdf_literal(r, p);
- break;
- case pdf_colorstack_node:
- if (pdf_colorstack_cmd(p) <= colorstack_data)
- add_token_ref(pdf_colorstack_data(p));
- break;
- case pdf_setmatrix_node:
- add_token_ref(pdf_setmatrix_data(p));
- break;
- case late_lua_node:
- copy_late_lua(r, p);
- break;
- case pdf_annot_node:
- add_token_ref(pdf_annot_data(p));
- break;
- case pdf_start_link_node:
- if (pdf_link_attr(r) != null)
- add_token_ref(pdf_link_attr(r));
- add_action_ref(pdf_link_action(r));
- break;
- case pdf_dest_node:
- if (pdf_dest_named_id(p) > 0)
- add_token_ref(pdf_dest_id(p));
- break;
- case pdf_thread_node:
- case pdf_start_thread_node:
- if (pdf_thread_named_id(p) > 0)
- add_token_ref(pdf_thread_id(p));
- if (pdf_thread_attr(p) != null)
- add_token_ref(pdf_thread_attr(p));
- break;
- case user_defined_node:
- switch (user_node_type(p)) {
- case 'a':
- add_node_attr_ref(user_node_value(p));
- break;
- case 'l':
- copy_user_lua(r, p);
- break;
- case 'n':
- s = copy_node_list(user_node_value(p));
- user_node_value(r) = s;
- break;
- case 's':
- /* |add_string_ref(user_node_value(p));| *//* if this was mpost .. */
- break;
- case 't':
- add_token_ref(user_node_value(p));
- break;
- }
- break;
-#if 0
- case style_node:
- case delim_node:
- case math_char_node:
- case math_text_char_node:
+ case dir_node:
+ case local_par_node:
+ case boundary_node:
break;
-#else
- default:
-#endif
- break;
+ case whatsit_node:
+ w = subtype(p) ;
+ if (w >= backend_first_pdf_whatsit) {
+ copy_node_wrapup_pdf(p,r);
+ } else if (w >= backend_first_dvi_whatsit) {
+ copy_node_wrapup_dvi(p,r);
+ } else {
+ copy_node_wrapup_core(p,r);
}
break;
}
@@ -1097,9 +1234,118 @@ int copy_error(halfword p)
} while (0)
@ @c
-void flush_node(halfword p)
+
+static void flush_node_wrapup_core(halfword p)
+{
+ switch (subtype(p)) {
+ case open_node:
+ case write_node:
+ case close_node:
+ case save_pos_node:
+ break;
+ case special_node:
+ delete_token_ref(write_tokens(p));
+ break;
+ case late_lua_node:
+ free_late_lua(p);
+ break;
+ case user_defined_node:
+ switch (user_node_type(p)) {
+ case 'a':
+ delete_attribute_ref(user_node_value(p));
+ break;
+ case 'd':
+ break;
+ case 'n':
+ flush_node_list(user_node_value(p));
+ break;
+ case 's':
+ /* |delete_string_ref(user_node_value(p));| *//* if this was mpost .. */
+ break;
+ case 't':
+ delete_token_ref(user_node_value(p));
+ break;
+ default:
+ {
+ const char *hlp[] = {
+ "The type of the value in a user defined whatsit node should be one",
+ "of 'a' (attribute list), 'd' (number), 'n' (node list), 's' (string),",
+ "or 't' (tokenlist). Yours has an unknown type, and therefore I don't",
+ "know how to free the node's value. A memory leak may result.",
+ NULL
+ };
+ tex_error("Unidentified user defined whatsit", hlp);
+ }
+ break;
+ }
+ break;
+ }
+}
+
+void flush_node_wrapup_dvi(halfword p)
{
+}
+void flush_node_wrapup_pdf(halfword p)
+{
+ switch(subtype(p)) {
+ case pdf_save_node:
+ case pdf_restore_node:
+ case pdf_refobj_node:
+ case pdf_end_link_node:
+ case pdf_end_thread_node:
+ break;
+ case pdf_literal_node:
+ free_pdf_literal(p);
+ break;
+ case pdf_colorstack_node:
+ if (pdf_colorstack_cmd(p) <= colorstack_data)
+ delete_token_ref(pdf_colorstack_data(p));
+ break;
+ case pdf_setmatrix_node:
+ delete_token_ref(pdf_setmatrix_data(p));
+ break;
+ case pdf_annot_node:
+ delete_token_ref(pdf_annot_data(p));
+ break;
+ case pdf_link_data_node:
+ break;
+ case pdf_start_link_node:
+ if (pdf_link_attr(p) != null)
+ delete_token_ref(pdf_link_attr(p));
+ delete_action_ref(pdf_link_action(p));
+ break;
+ case pdf_dest_node:
+ if (pdf_dest_named_id(p) > 0)
+ delete_token_ref(pdf_dest_id(p));
+ break;
+ case pdf_action_node:
+ if (pdf_action_type(p) == pdf_action_user) {
+ delete_token_ref(pdf_action_tokens(p));
+ } else {
+ if (pdf_action_file(p) != null)
+ delete_token_ref(pdf_action_file(p));
+ if (pdf_action_type(p) == pdf_action_page)
+ delete_token_ref(pdf_action_tokens(p));
+ else if (pdf_action_named_id(p) > 0)
+ delete_token_ref(pdf_action_id(p));
+ }
+ break;
+ case pdf_thread_data_node:
+ break;
+ case pdf_thread_node:
+ case pdf_start_thread_node:
+ if (pdf_thread_named_id(p) > 0)
+ delete_token_ref(pdf_thread_id(p));
+ if (pdf_thread_attr(p) != null)
+ delete_token_ref(pdf_thread_attr(p));
+ break;
+ }
+}
+
+void flush_node(halfword p)
+{
+ halfword w;
if (p == null) /* legal, but no-op */
return;
@@ -1124,18 +1370,22 @@ void flush_node(halfword p)
free_sub_list(list_ptr(p));
break;
case disc_node:
+ /* watch the start at temp node hack */
free_sub_list(vlink(pre_break(p)));
free_sub_list(vlink(post_break(p)));
free_sub_list(vlink(no_break(p)));
-// why not: free_sub_list(pre_break(p));
-// why not: free_sub_list(post_break(p));
-// why not: free_sub_list(no_break(p));
break;
case rule_node:
case kern_node:
- case math_node:
case penalty_node:
break;
+ case math_node:
+ /* begin mathskip code */
+ if (glue_ptr(p) != zero_glue) {
+ delete_glue_ref(glue_ptr(p));
+ }
+ /* end mathskip code */
+ break;
case glue_spec_node:
/* this allows free-ing of lua-allocated glue specs */
if (valid_node(p)) {
@@ -1147,104 +1397,18 @@ void flush_node(halfword p)
}
return ;
break ;
+ case dir_node:
+ case local_par_node:
+ case boundary_node:
+ break;
case whatsit_node:
- switch (subtype(p)) {
-
- case dir_node:
- break;
- case open_node:
- case write_node:
- case close_node:
- case pdf_save_node:
- case pdf_restore_node:
- case cancel_boundary_node:
- case pdf_refobj_node:
- case pdf_refxform_node:
- case pdf_refximage_node:
- case pdf_end_link_node:
- case pdf_end_thread_node:
- case save_pos_node:
- case local_par_node:
- break;
-
- case special_node:
- delete_token_ref(write_tokens(p));
- break;
- case pdf_literal_node:
- free_pdf_literal(p);
- break;
- case pdf_colorstack_node:
- if (pdf_colorstack_cmd(p) <= colorstack_data)
- delete_token_ref(pdf_colorstack_data(p));
- break;
- case pdf_setmatrix_node:
- delete_token_ref(pdf_setmatrix_data(p));
- break;
- case late_lua_node:
- free_late_lua(p);
- break;
- case pdf_annot_node:
- delete_token_ref(pdf_annot_data(p));
- break;
-
- case pdf_link_data_node:
- break;
-
- case pdf_start_link_node:
- if (pdf_link_attr(p) != null)
- delete_token_ref(pdf_link_attr(p));
- delete_action_ref(pdf_link_action(p));
- break;
- case pdf_dest_node:
- if (pdf_dest_named_id(p) > 0)
- delete_token_ref(pdf_dest_id(p));
- break;
-
- case pdf_thread_data_node:
- break;
-
- case pdf_thread_node:
- case pdf_start_thread_node:
- if (pdf_thread_named_id(p) > 0)
- delete_token_ref(pdf_thread_id(p));
- if (pdf_thread_attr(p) != null)
- delete_token_ref(pdf_thread_attr(p));
- break;
- case user_defined_node:
- switch (user_node_type(p)) {
- case 'a':
- delete_attribute_ref(user_node_value(p));
- break;
- case 'd':
- break;
- case 'n':
- flush_node_list(user_node_value(p));
- break;
- case 's':
- /* |delete_string_ref(user_node_value(p));| *//* if this was mpost .. */
- break;
- case 't':
- delete_token_ref(user_node_value(p));
- break;
- default:
- {
- const char *hlp[] = {
- "The type of the value in a user defined whatsit node should be one",
- "of 'a' (attribute list), 'd' (number), 'n' (node list), 's' (string),",
- "or 't' (tokenlist). Yours has an unknown type, and therefore I don't",
- "know how to free the node's value. A memory leak may result.",
- NULL
- };
- tex_error("Unidentified user defined whatsit", hlp);
- }
- break;
- }
- break;
-
- default:
- confusion("ext3");
- return;
-
+ w = subtype(p) ;
+ if (w >= backend_first_pdf_whatsit) {
+ flush_node_wrapup_pdf(p);
+ } else if (w >= backend_first_dvi_whatsit) {
+ flush_node_wrapup_dvi(p);
+ } else {
+ flush_node_wrapup_core(p);
}
break;
case ins_node:
@@ -1269,18 +1433,24 @@ void flush_node(halfword p)
free_sub_list(script_script_mlist(p));
break;
case simple_noad:
+ free_sub_list(nucleus(p));
+ free_sub_list(subscr(p));
+ free_sub_list(supscr(p));
+ break;
case radical_noad:
+ free_sub_list(nucleus(p));
+ free_sub_list(subscr(p));
+ free_sub_list(supscr(p));
+ free_sub_node(left_delimiter(p));
+ free_sub_list(degree(p));
+ break;
case accent_noad:
free_sub_list(nucleus(p));
free_sub_list(subscr(p));
free_sub_list(supscr(p));
- if (type(p) == accent_noad) {
- free_sub_list(accent_chr(p));
- free_sub_list(bot_accent_chr(p));
- } else if (type(p) == radical_noad) {
- free_sub_node(left_delimiter(p));
- free_sub_list(degree(p));
- }
+ free_sub_list(top_accent_chr(p));
+ free_sub_list(bot_accent_chr(p));
+ free_sub_list(overlay_accent_chr(p));
break;
case fence_noad:
free_sub_list(delimiter(p));
@@ -1316,7 +1486,6 @@ void flush_node(halfword p)
case hyphenated_node:
case delta_node:
case passive_node:
- case action_node:
case inserting_node:
case split_up_node:
case expr_node:
@@ -1377,32 +1546,48 @@ static int test_count = 1;
#define check_attribute_ref(a) { dorangetest(p,a,var_mem_max); }
#define check_token_ref(a) assert(1)
-void check_node(halfword p)
+static void check_node_wrapup_core(halfword p)
{
-
- switch (type(p)) {
- case glyph_node:
- dorangetest(p, lig_ptr(p), var_mem_max);
- break;
- case glue_node:
- check_glue_ref(glue_ptr(p));
- dorangetest(p, leader_ptr(p), var_mem_max);
- break;
- case hlist_node:
- case vlist_node:
- case unset_node:
- case align_record_node:
- dorangetest(p, list_ptr(p), var_mem_max);
- break;
- case ins_node:
- dorangetest(p, ins_ptr(p), var_mem_max);
- check_glue_ref(split_top_ptr(p));
- break;
- case whatsit_node:
- switch (subtype(p)) {
+ switch (subtype(p)) {
+ /* frontend code */
case special_node:
check_token_ref(write_tokens(p));
break;
+ case user_defined_node:
+ switch (user_node_type(p)) {
+ case 'a':
+ check_attribute_ref(user_node_value(p));
+ break;
+ case 't':
+ check_token_ref(user_node_value(p));
+ break;
+ case 'n':
+ dorangetest(p, user_node_value(p), var_mem_max);
+ break;
+ case 's':
+ case 'd':
+ break;
+ default:
+ confusion("extuser");
+ break;
+ }
+ break;
+ case open_node:
+ case write_node:
+ case close_node:
+ case save_pos_node:
+ confusion("ext3"); /* why */
+ break;
+ }
+}
+
+void check_node_wrapup_dvi(halfword p)
+{
+}
+
+void check_node_wrapup_pdf(halfword p)
+{
+ switch (subtype(p)) {
case pdf_literal_node:
if (pdf_literal_type(p) == normal)
check_token_ref(pdf_literal_data(p));
@@ -1439,47 +1624,59 @@ void check_node(halfword p)
if (pdf_thread_attr(p) != null)
check_token_ref(pdf_thread_attr(p));
break;
- case user_defined_node:
- switch (user_node_type(p)) {
- case 'a':
- check_attribute_ref(user_node_value(p));
- break;
- case 't':
- check_token_ref(user_node_value(p));
- break;
- case 'n':
- dorangetest(p, user_node_value(p), var_mem_max);
- break;
- case 's':
- case 'd':
- break;
- default:
- confusion("extuser");
- break;
- }
- break;
- case dir_node:
- case open_node:
- case write_node:
- case close_node:
case pdf_save_node:
case pdf_restore_node:
- case cancel_boundary_node:
case pdf_refobj_node:
- case pdf_refxform_node:
- case pdf_refximage_node:
case pdf_end_link_node:
case pdf_end_thread_node:
- case save_pos_node:
- case local_par_node:
break;
default:
confusion("ext3");
+ break;
+ }
+}
+
+void check_node(halfword p)
+{
+ halfword w ;
+ switch (type(p)) {
+ case glyph_node:
+ dorangetest(p, lig_ptr(p), var_mem_max);
+ break;
+ case glue_node:
+ check_glue_ref(glue_ptr(p));
+ dorangetest(p, leader_ptr(p), var_mem_max);
+ break;
+ case hlist_node:
+ case vlist_node:
+ case unset_node:
+ case align_record_node:
+ dorangetest(p, list_ptr(p), var_mem_max);
+ break;
+ case ins_node:
+ dorangetest(p, ins_ptr(p), var_mem_max);
+ check_glue_ref(split_top_ptr(p));
+ break;
+ case whatsit_node:
+ w = subtype(p) ;
+ if (w >= backend_first_pdf_whatsit) {
+ check_node_wrapup_pdf(p);
+ } else if (w >= backend_first_dvi_whatsit) {
+ check_node_wrapup_dvi(p);
+ } else {
+ check_node_wrapup_core(p);
}
break;
case margin_kern_node:
check_node(margin_char(p));
break;
+ case math_node:
+ /* begin mathskip code */
+ if (glue_ptr(p) != zero_glue) {
+ check_glue_ref(glue_ptr(p));
+ }
+ /* end mathskip code */
+ break;
case disc_node:
dorangetest(p, vlink(pre_break(p)), var_mem_max);
dorangetest(p, vlink(post_break(p)), var_mem_max);
@@ -1522,15 +1719,15 @@ void check_node(halfword p)
dorangetest(p, nucleus(p), var_mem_max);
dorangetest(p, subscr(p), var_mem_max);
dorangetest(p, supscr(p), var_mem_max);
- dorangetest(p, accent_chr(p), var_mem_max);
+ dorangetest(p, top_accent_chr(p), var_mem_max);
dorangetest(p, bot_accent_chr(p), var_mem_max);
+ dorangetest(p, overlay_accent_chr(p), var_mem_max);
break;
case fence_noad:
dorangetest(p, delimiter(p), var_mem_max);
break;
case rule_node:
case kern_node:
- case math_node:
case penalty_node:
case mark_node:
case style_node:
@@ -1548,6 +1745,9 @@ void check_node(halfword p)
case delta_node:
case passive_node:
case expr_node:
+ case dir_node:
+ case boundary_node:
+ case local_par_node:
break;
default:
fprintf(stdout, "check_node: type is %d\n", type(p));
@@ -2265,6 +2465,13 @@ void delete_attribute_ref(halfword b)
}
}
+void reset_node_properties(halfword b)
+{
+ if (b != null) {
+ lua_properties_reset(b);
+ }
+}
+
@ |p| is an attr list head, or zero
@c
halfword do_set_attribute(halfword p, int i, int val)
@@ -2522,312 +2729,258 @@ static void print_write_whatsit(const char *s, pointer p)
@ @c
-static void show_whatsit_node(int p)
+
+static void show_node_wrapup_core(int p)
{
switch (subtype(p)) {
- case open_node:
- print_write_whatsit("openout", p);
- print_char('=');
- print_file_name(open_name(p), open_area(p), open_ext(p));
- break;
- case write_node:
- print_write_whatsit("write", p);
- print_mark(write_tokens(p));
- break;
- case close_node:
- print_write_whatsit("closeout", p);
- break;
- case special_node:
- tprint_esc("special");
- print_mark(write_tokens(p));
- break;
- case dir_node:
- if (dir_dir(p) < 0) {
- tprint_esc("enddir");
- print_char(' ');
- print_dir(dir_dir(p) + 64);
- } else {
- tprint_esc("begindir");
- print_char(' ');
- print_dir(dir_dir(p));
- }
- break;
- case local_par_node:
- tprint_esc("whatsit");
- append_char('.');
- print_ln();
- print_current_string();
- tprint_esc("localinterlinepenalty");
- print_char('=');
- print_int(local_pen_inter(p));
- print_ln();
- print_current_string();
- tprint_esc("localbrokenpenalty");
- print_char('=');
- print_int(local_pen_broken(p));
- print_ln();
- print_current_string();
- tprint_esc("localleftbox");
- if (local_box_left(p) == null) {
- tprint("=null");
- } else {
- append_char('.');
- show_node_list(local_box_left(p));
- decr(cur_length);
- }
- print_ln();
- print_current_string();
- tprint_esc("localrightbox");
- if (local_box_right(p) == null) {
- tprint("=null");
- } else {
- append_char('.');
- show_node_list(local_box_right(p));
- decr(cur_length);
- }
- decr(cur_length);
- break;
- case pdf_literal_node:
- show_pdf_literal(p);
- break;
- case pdf_colorstack_node:
- tprint_esc("pdfcolorstack ");
- print_int(pdf_colorstack_stack(p));
- switch (pdf_colorstack_cmd(p)) {
- case colorstack_set:
- tprint(" set ");
- break;
- case colorstack_push:
- tprint(" push ");
+ case open_node:
+ print_write_whatsit("openout", p);
+ print_char('=');
+ print_file_name(open_name(p), open_area(p), open_ext(p));
break;
- case colorstack_pop:
- tprint(" pop");
+ case write_node:
+ print_write_whatsit("write", p);
+ print_mark(write_tokens(p));
break;
- case colorstack_current:
- tprint(" current");
+ case close_node:
+ print_write_whatsit("closeout", p);
break;
- default:
- confusion("pdfcolorstack");
+ case special_node:
+ tprint_esc("special");
+ print_mark(write_tokens(p));
break;
- }
- if (pdf_colorstack_cmd(p) <= colorstack_data)
- print_mark(pdf_colorstack_data(p));
- break;
- case pdf_setmatrix_node:
- tprint_esc("pdfsetmatrix");
- print_mark(pdf_setmatrix_data(p));
- break;
- case pdf_save_node:
- tprint_esc("pdfsave");
- break;
- case pdf_restore_node:
- tprint_esc("pdfrestore");
- break;
- case cancel_boundary_node:
- tprint_esc("noboundary");
- break;
- case late_lua_node:
- show_late_lua(p);
- break;
- case pdf_refobj_node:
- tprint_esc("pdfrefobj");
- if (obj_obj_is_stream(static_pdf, pdf_obj_objnum(p))) {
- if (obj_obj_stream_attr(static_pdf, pdf_obj_objnum(p)) != LUA_NOREF) {
- tprint(" attr");
- lua_rawgeti(Luas, LUA_REGISTRYINDEX,
- obj_obj_stream_attr(static_pdf, pdf_obj_objnum(p)));
- print_char(' ');
- tprint((const char *) lua_tostring(Luas, -1));
- lua_pop(Luas, 1);
- }
- tprint(" stream");
- }
- if (obj_obj_is_file(static_pdf, pdf_obj_objnum(p)))
- tprint(" file");
- if (obj_obj_data(static_pdf, pdf_obj_objnum(p)) != LUA_NOREF) {
- lua_rawgeti(Luas, LUA_REGISTRYINDEX,
- obj_obj_data(static_pdf, pdf_obj_objnum(p)));
- print_char(' ');
- tprint((const char *) lua_tostring(Luas, -1));
- lua_pop(Luas, 1);
- }
- break;
- case pdf_refxform_node:
- case pdf_refximage_node:
- if (subtype(p) == pdf_refxform_node)
- tprint_esc("pdfrefxform");
- else
- tprint_esc("pdfrefximage");
- tprint("(");
- print_scaled(height(p));
- print_char('+');
- print_scaled(depth(p));
- tprint(")x");
- print_scaled(width(p));
- break;
- case pdf_annot_node:
- tprint_esc("pdfannot");
- show_pdftex_whatsit_rule_spec(p);
- print_mark(pdf_annot_data(p));
- break;
- case pdf_start_link_node:
- tprint_esc("pdfstartlink");
- show_pdftex_whatsit_rule_spec(p);
- if (pdf_link_attr(p) != null) {
- tprint(" attr");
- print_mark(pdf_link_attr(p));
- }
- tprint(" action");
- if (pdf_action_type(pdf_link_action(p)) == pdf_action_user) {
- tprint(" user");
- print_mark(pdf_action_tokens(pdf_link_action(p)));
- return;
- }
- if (pdf_action_file(pdf_link_action(p)) != null) {
- tprint(" file");
- print_mark(pdf_action_file(pdf_link_action(p)));
- }
- switch (pdf_action_type(pdf_link_action(p))) {
- case pdf_action_goto:
- if (pdf_action_named_id(pdf_link_action(p)) > 0) {
- tprint(" goto name");
- print_mark(pdf_action_id(pdf_link_action(p)));
- } else {
- tprint(" goto num");
- print_int(pdf_action_id(pdf_link_action(p)));
- }
+ case late_lua_node:
+ show_late_lua(p);
break;
- case pdf_action_page:
- tprint(" page");
- print_int(pdf_action_id(pdf_link_action(p)));
- print_mark(pdf_action_tokens(pdf_link_action(p)));
+ case save_pos_node:
+ tprint_esc("savepos");
break;
- case pdf_action_thread:
- if (pdf_action_named_id(pdf_link_action(p)) > 0) {
- tprint(" thread name");
- print_mark(pdf_action_id(pdf_link_action(p)));
- } else {
- tprint(" thread num");
- print_int(pdf_action_id(pdf_link_action(p)));
+ case user_defined_node:
+ tprint_esc("whatsit");
+ print_int(user_node_id(p));
+ print_char('=');
+ switch (user_node_type(p)) {
+ case 'a':
+ tprint("<>");
+ break;
+ case 'n':
+ tprint("[");
+ show_node_list(user_node_value(p));
+ tprint("]");
+ break;
+ case 's':
+ print_char('"');
+ print(user_node_value(p));
+ print_char('"');
+ break;
+ case 't':
+ print_mark(user_node_value(p));
+ break;
+ default: /* only 'd' */
+ print_int(user_node_value(p));
+ break;
}
break;
- default:
- pdf_error("displaying", "unknown action type");
+ }
+}
+
+void show_node_wrapup_dvi(int p)
+{
+}
+
+void show_node_wrapup_pdf(int p)
+{
+ switch (subtype(p)) {
+ case pdf_literal_node:
+ show_pdf_literal(p);
break;
- }
- break;
- case pdf_end_link_node:
- tprint_esc("pdfendlink");
- break;
- case pdf_dest_node:
- tprint_esc("pdfdest");
- if (pdf_dest_named_id(p) > 0) {
- tprint(" name");
- print_mark(pdf_dest_id(p));
- } else {
- tprint(" num");
- print_int(pdf_dest_id(p));
- }
- print_char(' ');
- switch (pdf_dest_type(p)) {
- case pdf_dest_xyz:
- tprint("xyz");
- if (pdf_dest_xyz_zoom(p) != null) {
- tprint(" zoom");
- print_int(pdf_dest_xyz_zoom(p));
+ case pdf_colorstack_node:
+ tprint_esc("pdfcolorstack ");
+ print_int(pdf_colorstack_stack(p));
+ switch (pdf_colorstack_cmd(p)) {
+ case colorstack_set:
+ tprint(" set ");
+ break;
+ case colorstack_push:
+ tprint(" push ");
+ break;
+ case colorstack_pop:
+ tprint(" pop");
+ break;
+ case colorstack_current:
+ tprint(" current");
+ break;
+ default:
+ confusion("pdfcolorstack");
+ break;
}
+ if (pdf_colorstack_cmd(p) <= colorstack_data)
+ print_mark(pdf_colorstack_data(p));
break;
- case pdf_dest_fitbh:
- tprint("fitbh");
- break;
- case pdf_dest_fitbv:
- tprint("fitbv");
+ case pdf_setmatrix_node:
+ tprint_esc("pdfsetmatrix");
+ print_mark(pdf_setmatrix_data(p));
break;
- case pdf_dest_fitb:
- tprint("fitb");
+ case pdf_save_node:
+ tprint_esc("pdfsave");
break;
- case pdf_dest_fith:
- tprint("fith");
+ case pdf_restore_node:
+ tprint_esc("pdfrestore");
break;
- case pdf_dest_fitv:
- tprint("fitv");
+ case pdf_refobj_node:
+ tprint_esc("pdfrefobj");
+ if (obj_obj_is_stream(static_pdf, pdf_obj_objnum(p))) {
+ if (obj_obj_stream_attr(static_pdf, pdf_obj_objnum(p)) != LUA_NOREF) {
+ tprint(" attr");
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX,
+ obj_obj_stream_attr(static_pdf, pdf_obj_objnum(p)));
+ print_char(' ');
+ tprint((const char *) lua_tostring(Luas, -1));
+ lua_pop(Luas, 1);
+ }
+ tprint(" stream");
+ }
+ if (obj_obj_is_file(static_pdf, pdf_obj_objnum(p)))
+ tprint(" file");
+ if (obj_obj_data(static_pdf, pdf_obj_objnum(p)) != LUA_NOREF) {
+ lua_rawgeti(Luas, LUA_REGISTRYINDEX,
+ obj_obj_data(static_pdf, pdf_obj_objnum(p)));
+ print_char(' ');
+ tprint((const char *) lua_tostring(Luas, -1));
+ lua_pop(Luas, 1);
+ }
break;
- case pdf_dest_fitr:
- tprint("fitr");
+ case pdf_annot_node:
+ tprint_esc("pdfannot");
show_pdftex_whatsit_rule_spec(p);
+ print_mark(pdf_annot_data(p));
break;
- case pdf_dest_fit:
- tprint("fit");
- break;
- default:
- tprint("unknown!");
+ case pdf_start_link_node:
+ tprint_esc("pdfstartlink");
+ show_pdftex_whatsit_rule_spec(p);
+ if (pdf_link_attr(p) != null) {
+ tprint(" attr");
+ print_mark(pdf_link_attr(p));
+ }
+ tprint(" action");
+ if (pdf_action_type(pdf_link_action(p)) == pdf_action_user) {
+ tprint(" user");
+ print_mark(pdf_action_tokens(pdf_link_action(p)));
+ return;
+ }
+ if (pdf_action_file(pdf_link_action(p)) != null) {
+ tprint(" file");
+ print_mark(pdf_action_file(pdf_link_action(p)));
+ }
+ switch (pdf_action_type(pdf_link_action(p))) {
+ case pdf_action_goto:
+ if (pdf_action_named_id(pdf_link_action(p)) > 0) {
+ tprint(" goto name");
+ print_mark(pdf_action_id(pdf_link_action(p)));
+ } else {
+ tprint(" goto num");
+ print_int(pdf_action_id(pdf_link_action(p)));
+ }
+ break;
+ case pdf_action_page:
+ tprint(" page");
+ print_int(pdf_action_id(pdf_link_action(p)));
+ print_mark(pdf_action_tokens(pdf_link_action(p)));
+ break;
+ case pdf_action_thread:
+ if (pdf_action_named_id(pdf_link_action(p)) > 0) {
+ tprint(" thread name");
+ print_mark(pdf_action_id(pdf_link_action(p)));
+ } else {
+ tprint(" thread num");
+ print_int(pdf_action_id(pdf_link_action(p)));
+ }
+ break;
+ default:
+ normal_error("pdf backend", "unknown action type for link");
+ break;
+ }
break;
- }
- break;
- case pdf_thread_node:
- case pdf_start_thread_node:
- if (subtype(p) == pdf_thread_node)
- tprint_esc("pdfthread");
- else
- tprint_esc("pdfstartthread");
- tprint("(");
- print_rule_dimen(height(p));
- print_char('+');
- print_rule_dimen(depth(p));
- tprint(")x");
- print_rule_dimen(width(p));
- if (pdf_thread_attr(p) != null) {
- tprint(" attr");
- print_mark(pdf_thread_attr(p));
- }
- if (pdf_thread_named_id(p) > 0) {
- tprint(" name");
- print_mark(pdf_thread_id(p));
- } else {
- tprint(" num");
- print_int(pdf_thread_id(p));
- }
- break;
- case pdf_end_thread_node:
- tprint_esc("pdfendthread");
- break;
- case save_pos_node:
- tprint_esc("savepos");
- break;
- case user_defined_node:
- tprint_esc("whatsit");
- print_int(user_node_id(p));
- print_char('=');
- switch (user_node_type(p)) {
- case 'a':
- tprint("<>");
+ case pdf_end_link_node:
+ tprint_esc("pdfendlink");
break;
- case 'n':
- tprint("[");
- show_node_list(user_node_value(p));
- tprint("]");
+ case pdf_dest_node:
+ tprint_esc("pdfdest");
+ if (pdf_dest_named_id(p) > 0) {
+ tprint(" name");
+ print_mark(pdf_dest_id(p));
+ } else {
+ tprint(" num");
+ print_int(pdf_dest_id(p));
+ }
+ print_char(' ');
+ switch (pdf_dest_type(p)) {
+ case pdf_dest_xyz:
+ tprint("xyz");
+ if (pdf_dest_xyz_zoom(p) != null) {
+ tprint(" zoom");
+ print_int(pdf_dest_xyz_zoom(p));
+ }
+ break;
+ case pdf_dest_fitbh:
+ tprint("fitbh");
+ break;
+ case pdf_dest_fitbv:
+ tprint("fitbv");
+ break;
+ case pdf_dest_fitb:
+ tprint("fitb");
+ break;
+ case pdf_dest_fith:
+ tprint("fith");
+ break;
+ case pdf_dest_fitv:
+ tprint("fitv");
+ break;
+ case pdf_dest_fitr:
+ tprint("fitr");
+ show_pdftex_whatsit_rule_spec(p);
+ break;
+ case pdf_dest_fit:
+ tprint("fit");
+ break;
+ default:
+ tprint("unknown!");
+ break;
+ }
break;
- case 's':
- print_char('"');
- print(user_node_value(p));
- print_char('"');
+ case pdf_thread_node:
+ case pdf_start_thread_node:
+ if (subtype(p) == pdf_thread_node)
+ tprint_esc("pdfthread");
+ else
+ tprint_esc("pdfstartthread");
+ tprint("(");
+ print_rule_dimen(height(p));
+ print_char('+');
+ print_rule_dimen(depth(p));
+ tprint(")x");
+ print_rule_dimen(width(p));
+ if (pdf_thread_attr(p) != null) {
+ tprint(" attr");
+ print_mark(pdf_thread_attr(p));
+ }
+ if (pdf_thread_named_id(p) > 0) {
+ tprint(" name");
+ print_mark(pdf_thread_id(p));
+ } else {
+ tprint(" num");
+ print_int(pdf_thread_id(p));
+ }
break;
- case 't':
- print_mark(user_node_value(p));
+ case pdf_end_thread_node:
+ tprint_esc("pdfendthread");
break;
- default: /* only 'd' */
- print_int(user_node_value(p));
+ default:
break;
- }
- break;
- default:
- tprint("whatsit?");
- break;
}
}
-
-
@ Now we are ready for |show_node_list| itself. This procedure has been
written to be ``extra robust'' in the sense that it should not crash or get
into a loop even if the data structures have been messed up by bugs in
@@ -2853,6 +3006,7 @@ static void show_whatsit_node(int p)
void show_node_list(int p)
{ /* prints a node list symbolically */
int n; /* the number of items already printed at this level */
+ halfword w;
real g; /* a glue ratio, as a floating point number */
if ((int) cur_length > depth_threshold) {
if (p > null)
@@ -2955,7 +3109,13 @@ void show_node_list(int p)
break;
case rule_node:
/* Display rule |p|; */
- tprint_esc("rule(");
+ if (subtype(p) == normal_rule) {
+ tprint_esc("rule(");
+ } else if (subtype(p) == box_rule) {
+ tprint_esc("box(");
+ } else if (subtype(p) == image_rule) {
+ tprint_esc("image(");
+ }
print_rule_dimen(height(p));
print_char('+');
print_rule_dimen(depth(p));
@@ -2976,8 +3136,72 @@ void show_node_list(int p)
print_int(float_cost(p));
node_list_display(ins_ptr(p)); /* recursive call */
break;
+ case dir_node:
+ if (dir_dir(p) < 0) {
+ tprint_esc("enddir");
+ print_char(' ');
+ print_dir(dir_dir(p) + dir_swap);
+ } else {
+ tprint_esc("begindir");
+ print_char(' ');
+ print_dir(dir_dir(p));
+ }
+ break;
+ case local_par_node:
+ tprint_esc("localpar");
+ append_char('.');
+ print_ln();
+ print_current_string();
+ tprint_esc("localinterlinepenalty");
+ print_char('=');
+ print_int(local_pen_inter(p));
+ print_ln();
+ print_current_string();
+ tprint_esc("localbrokenpenalty");
+ print_char('=');
+ print_int(local_pen_broken(p));
+ print_ln();
+ print_current_string();
+ tprint_esc("localleftbox");
+ if (local_box_left(p) == null) {
+ tprint("=null");
+ } else {
+ append_char('.');
+ show_node_list(local_box_left(p));
+ decr(cur_length);
+ }
+ print_ln();
+ print_current_string();
+ tprint_esc("localrightbox");
+ if (local_box_right(p) == null) {
+ tprint("=null");
+ } else {
+ append_char('.');
+ show_node_list(local_box_right(p));
+ decr(cur_length);
+ }
+ decr(cur_length);
+ break;
+ case boundary_node:
+ if (subtype(p)==0) {
+ tprint_esc("noboundary");
+ } else{
+ tprint_esc("boundary");
+ print_char('=');
+ print_int(subtype(p));
+ print_char(':');
+ print_int(boundary_value(p));
+ }
+ break;
case whatsit_node:
- show_whatsit_node(p);
+ w = subtype(p) ;
+ if (w >= backend_first_pdf_whatsit) {
+ show_node_wrapup_pdf(p);
+ } else if (w >= backend_first_dvi_whatsit) {
+ show_node_wrapup_dvi(p);
+ } else {
+ show_node_wrapup_core(p);
+ }
break;
case glue_node:
/* Display glue |p|; */
@@ -3148,8 +3372,14 @@ pointer actual_box_width(pointer r, scaled base_width)
d = width(p);
break;
case math_node:
- d = surround(p);
- break;
+ /* begin mathskip code */
+ if (glue_ptr(p) == zero_glue) {
+ d = surround(p);
+ break;
+ } else {
+ /* fall through */
+ }
+ /* end mathskip code */
case glue_node:
/* We need to be careful that |w|, |v|, and |d| do not depend on any |glue_set|
values, since such values are subject to system-dependent rounding.
@@ -3171,13 +3401,6 @@ pointer actual_box_width(pointer r, scaled base_width)
if (subtype(p) >= a_leaders)
goto found;
break;
- case whatsit_node:
- if ((subtype(p) == pdf_refxform_node)
- || (subtype(p) == pdf_refximage_node))
- d = width(p);
- else
- d = 0;
- break;
default:
d = 0;
break;
@@ -3307,10 +3530,10 @@ makes all the dimensions ``running,'' so you have to change the
ones that are not allowed to run.
@c
-halfword new_rule(void)
+halfword new_rule(int s)
{
halfword p; /* the new node */
- p = new_node(rule_node, 0); /* the |subtype| is not used */
+ p = new_node(rule_node,s);
return p;
}
@@ -3684,3 +3907,27 @@ However, other references to the nodes are made symbolically in terms of
the \.{WEB} macro definitions above, so that format changes will leave
\TeX's other algorithms intact.
@^system dependencies@>
+
+@ @c
+halfword make_local_par_node(void)
+/* This function creates a |local_paragraph| node */
+{
+ halfword p, q;
+ 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_box_left(p) = q;
+ local_box_left_width(p) = width(local_left_box);
+ }
+ if (local_right_box != null) {
+ q = copy_node_list(local_right_box);
+ local_box_right(p) = q;
+ local_box_right_width(p) = width(local_right_box);
+ }
+ local_par_dir(p) = par_direction;
+ return p;
+}
+
+
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h
index c2a96b33b40..321799551f5 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.h
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.h
@@ -1,5 +1,5 @@
/* textoken.h
-
+
Copyright 2006-2008 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -27,9 +27,7 @@
# define left_brace_token 0x200000 /* $2^{21}\cdot|left_brace|$ */
# define right_brace_token 0x400000 /* $2^{21}\cdot|right_brace|$ */
-# define left_brace_token 0x200000 /* $2^{21}\cdot|left_brace|$ */
# define left_brace_limit 0x400000 /* $2^{21}\cdot(|left_brace|+1)$ */
-# define right_brace_token 0x400000 /* $2^{21}\cdot|right_brace|$ */
# define right_brace_limit 0x600000 /* $2^{21}\cdot(|right_brace|+1)$ */
# define math_shift_token 0x600000 /* $2^{21}\cdot|math_shift|$ */
# define tab_token 0x800000 /* $2^{21}\cdot|tab_mark|$ */
@@ -140,7 +138,7 @@ 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))
+# define end_line_char_inactive ((end_line_char < 0) || (end_line_char > 127))
extern halfword par_loc;
extern halfword par_token;
@@ -151,14 +149,26 @@ extern void firm_up_the_line(void);
extern void get_token(void);
extern halfword str_toks(lstring b);
+extern halfword str_scan_toks(int c, lstring b);
extern void ins_the_toks(void);
extern int scan_lua_state(void);
+
extern void conv_toks(void);
+extern str_number the_convert_string(halfword c, int i);
+extern int conv_toks_dvi(halfword c); /* plugin */
+extern int conv_toks_pdf(halfword c); /* plugin */
+
+extern int conv_var_dvi(halfword c); /* plugin */
+extern int conv_var_pdf(halfword c); /* plugin */
+
+extern int the_convert_string_dvi(halfword c, int i); /* plugin */
+extern int the_convert_string_pdf(halfword c, int i); /* plugin */
+
+extern halfword lua_str_toks(lstring b);
extern boolean in_lua_escape;
extern boolean is_convert(halfword c);
-extern str_number the_convert_string(halfword c, int i);
# define closed 2 /* not open, or at end of file */
# define just_open 1 /* newly opened, first line not yet read */
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w
index 06fffee9c38..b22f3cdd62e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.w
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w
@@ -19,7 +19,6 @@
@ @c
-
#include "ptexlib.h"
@ @c
@@ -351,7 +350,7 @@ void show_token_list(int p, int q, int l)
print(c);
break;
case mac_param_cmd:
- if (!in_lua_escape)
+ if (!in_lua_escape && (is_in_csname==0))
print(c);
print(c);
break;
@@ -482,7 +481,7 @@ boolean scan_keyword(const char *s)
int saved_align_state = align_state;
if (strlen(s) == 0) /* was assert (strlen(s) > 1); */
return false ; /* but not with newtokenlib zero keyword simply doesn't match */
- p = backup_head;
+ p = backup_head;
token_link(p) = null;
k = s;
while (*k) {
@@ -1001,7 +1000,8 @@ static boolean process_sup_mark(void)
if (cur_chr == buffer[iloc]) {
int c, cc;
if (iloc < ilimit) {
- if ((cur_chr == buffer[iloc + 1]) && (cur_chr == buffer[iloc + 2])
+ if ( (cur_chr == buffer[iloc + 1])
+ && (cur_chr == buffer[iloc + 2])
&& (cur_chr == buffer[iloc + 3])
&& (cur_chr == buffer[iloc + 4])
&& ((iloc + 10) <= ilimit)) {
@@ -1020,8 +1020,10 @@ static boolean process_sup_mark(void)
return true;
}
}
- if ((cur_chr == buffer[iloc + 1]) && (cur_chr == buffer[iloc + 2])
- && (cur_chr == buffer[iloc + 3]) && ((iloc + 8) <= ilimit)) {
+ if ( (cur_chr == buffer[iloc + 1])
+ && (cur_chr == buffer[iloc + 2])
+ && (cur_chr == buffer[iloc + 3])
+ && ((iloc + 8) <= ilimit)) {
int ccc, cccc, ccccc; /* constituents of a possible expanded code */
c = buffer[iloc + 4];
cc = buffer[iloc + 5];
@@ -1035,7 +1037,8 @@ static boolean process_sup_mark(void)
return true;
}
}
- if ((cur_chr == buffer[iloc + 1]) && (cur_chr == buffer[iloc + 2])
+ if ( (cur_chr == buffer[iloc + 1])
+ && (cur_chr == buffer[iloc + 2])
&& ((iloc + 6) <= ilimit)) {
int ccc, cccc; /* constituents of a possible expanded code */
c = buffer[iloc + 3];
@@ -1468,7 +1471,7 @@ No new control sequences will be defined except during a call of
void get_token(void)
{ /* sets |cur_cmd|, |cur_chr|, |cur_tok| */
no_new_control_sequence = false;
- get_token_lua();
+ get_next(); /* get_token_lua(); */
no_new_control_sequence = true;
if (cur_cs == 0)
cur_tok = token_val(cur_cmd, cur_chr);
@@ -1532,7 +1535,7 @@ at the value |p| that is returned. (If |p=temp_token_head|, the list is empty.)
symbols that |lua| considers special while scanning a literal string
@c
-static halfword lua_str_toks(lstring b)
+halfword lua_str_toks(lstring b)
{ /* changes the string |str_pool[b..pool_ptr]| to a token list */
halfword p; /* tail of the token list */
halfword q; /* new node being added to the token list via |store_new_token| */
@@ -1547,8 +1550,7 @@ static halfword lua_str_toks(lstring b)
if (t == ' ') {
t = space_token;
} else {
- if ((t == '\\') || (t == '"') || (t == '\'') || (t == 10)
- || (t == 13))
+ if ((t == '\\') || (t == '"') || (t == '\'') || (t == 10) || (t == 13))
fast_store_new_token(other_token + '\\');
if (t == 10)
t = 'n';
@@ -1588,6 +1590,77 @@ halfword str_toks(lstring s)
return p;
}
+/*
+ hh: most of the converter is similar to the one i made for macro so at some point i
+ can make a helper; also todo: there is no need to go through the pool
+
+*/
+
+halfword str_scan_toks(int ct, lstring s)
+{ /* changes the string |str_pool[b..pool_ptr]| to a token list */
+ halfword p; /* tail of the token list */
+ halfword q; /* new node being added to the token list via |store_new_token| */
+ halfword t; /* token being appended */
+ unsigned char *k, *l; /* index into string */
+ int cc;
+ p = temp_token_head;
+ set_token_link(p, null);
+ k = s.s;
+ l = k + s.l;
+ while (k < l) {
+ t = pool_to_unichar(k);
+ k += utf8_size(t);
+ cc = get_cat_code(ct,t);
+ if (cc == 0) {
+ /* we have a potential control sequence so we check for it */
+ int _lname = 0 ;
+ int _s = 0 ;
+ int _c = 0 ;
+ halfword _cs = null ;
+ unsigned char *_name = k ;
+ while (k < l) {
+ t = (halfword) str2uni((const unsigned char *) k);
+ _s = utf8_size(t);
+ _c = get_cat_code(ct,t);
+ if (_c == 11) {
+ k += _s ;
+ _lname = _lname + _s ;
+ } else if (_c == 10) {
+ /* we ignore a trailing space like normal scanning does */
+ k += _s ;
+ break ;
+ } else {
+ break ;
+ }
+ }
+ if (_s > 0) {
+ /* we have a potential \cs */
+ _cs = string_lookup((const char *) _name, _lname);
+ if (_cs == undefined_control_sequence) {
+ /* let's play safe and backtrack */
+ t = cc * (1<<21) + t ;
+ k = _name ;
+ } else {
+ t = cs_token_flag + _cs;
+ }
+ } else {
+ /* just a character with some meaning, so \unknown becomes effectively */
+ /* \\unknown assuming that \\ has some useful meaning of course */
+ t = cc * (1<<21) + t ;
+ k = _name ;
+ }
+
+ } else {
+ /* whatever token, so for instance $x^2$ just works given a tex */
+ /* catcode regime */
+ t = cc * (1<<21) + t ;
+ }
+ fast_store_new_token(t);
+
+ }
+ return p;
+}
+
@ Here's part of the |expand| subroutine that we are now ready to complete:
@c
void ins_the_toks(void)
@@ -1623,88 +1696,6 @@ static void print_job_name(void)
the code |c|. The function exists because lua code and tex code can
both call it to convert something.
-@c
-static boolean print_convert_string(halfword c, int i)
-{
- int ff; /* for use with |set_ff| */
- boolean ret = true;
- switch (c) {
- case number_code:
- print_int(i);
- break;
- case uchar_code:
- print(i);
- break;
- case roman_numeral_code:
- print_roman_int(i);
- break;
- case etex_code:
- tprint(eTeX_version_string);
- break;
- case luatex_revision_code:
- print(get_luatexrevision());
- break;
- case luatex_date_code:
- print_int(get_luatex_date_info());
- break;
- case luatex_banner_code:
- tprint(luatex_banner);
- break;
- case uniform_deviate_code:
- print_int(unif_rand(i));
- break;
- case normal_deviate_code:
- print_int(norm_rand());
- break;
- case format_name_code:
- print(format_name);
- break;
- case job_name_code:
- print_job_name();
- break;
- case font_name_code:
- append_string((unsigned char *) font_name(i),
- (unsigned) strlen(font_name(i)));
- if (font_size(i) != font_dsize(i)) {
- tprint(" at ");
- print_scaled(font_size(i));
- tprint("pt");
- }
- break;
- case font_id_code:
- print_int(i);
- break;
- case math_style_code:
- print_math_style();
- break;
- case pdf_font_name_code:
- case pdf_font_objnum_code:
- set_ff(i);
- if (c == pdf_font_name_code)
- print_int(obj_info(static_pdf, pdf_font_num(ff)));
- else
- print_int(pdf_font_num(ff));
- break;
- case pdf_font_size_code:
- print_scaled(font_size(i));
- tprint("pt");
- break;
- case pdf_page_ref_code:
- print_int(pdf_get_obj(static_pdf, obj_type_page, i, false));
- break;
- case pdf_xform_name_code:
- print_int(obj_info(static_pdf, i));
- break;
- case eTeX_revision_code:
- tprint(eTeX_revision);
- break;
- default:
- ret = false;
- break;
- }
- return ret;
-}
-
@ @c
int scan_lua_state(void) /* hh-ls: optional name or number (not optional name optional number) */
{
@@ -1728,8 +1719,6 @@ int scan_lua_state(void) /* hh-ls: optional name or number (not optional name op
return sn;
}
-
-
@ The procedure |conv_toks| uses |str_toks| to insert the token list
for |convert| functions into the scanner; `\.{\\outer}' control sequences
are allowed to follow `\.{\\string}' and `\.{\\meaning}'.
@@ -1739,6 +1728,262 @@ any pending string in its output. In order to save such a pending string,
we have to create a temporary string that is destroyed immediately after.
@c
+#define push_selector { \
+ old_setting = selector; \
+ selector = new_string; \
+}
+
+#define pop_selector { \
+ selector = old_setting; \
+}
+
+int conv_var_dvi(halfword c)
+{
+ return 0;
+}
+
+#define backend_dimen(A) eqtb[scaled_base+(A)].hh.rh
+#define backend_count(A) eqtb[count_base+(A)].hh.rh
+
+#define get_backend_count(cur_cs,name,index,default) { \
+ no_new_control_sequence = false; \
+ cur_cs = string_lookup(name,strlen(name)); \
+ no_new_control_sequence = true; \
+ if (eq_type(cur_cs) == undefined_cs_cmd) { \
+ assert(index < backend_int_last); \
+ primitive_tex(name, assign_int_cmd, int_base + index, int_base); \
+ backend_count(cur_cs) = default ; \
+ } \
+ cur_tok = cur_cs + cs_token_flag; \
+ back_input(); \
+}
+
+#define get_backend_dimen(cur_cs,name,index,default) { \
+ no_new_control_sequence = false; \
+ cur_cs = string_lookup(name,strlen(name)); \
+ no_new_control_sequence = true; \
+ if (eq_type(cur_cs) == undefined_cs_cmd) { \
+ assert(index < backend_dimen_last); \
+ primitive_tex(name, assign_dimen_cmd, dimen_base + index, dimen_base); \
+ backend_dimen(cur_cs) = default ; \
+ } \
+ cur_tok = cur_cs + cs_token_flag; \
+ back_input(); \
+}
+
+#define get_backend_toks(cur_cs,name,index) { \
+ no_new_control_sequence = false; \
+ cur_cs = string_lookup(name,strlen(name)); \
+ no_new_control_sequence = true; \
+ if (eq_type(cur_cs) == undefined_cs_cmd) { \
+ assert(index < backend_toks_last); \
+ primitive_tex(name, assign_toks_cmd, index, local_base); \
+ } \
+ cur_tok = cur_cs + cs_token_flag; \
+ back_input(); \
+}
+
+int conv_var_pdf(halfword c)
+{
+ /* todo: optimize order, but hardly any access */
+
+ if (scan_keyword("compresslevel")) { get_backend_count(cur_cs,"pdf_compresslevel", backend_int_base + 1, 9); }
+ else if (scan_keyword("decimaldigits")) { get_backend_count(cur_cs,"pdf_decimaldigits", backend_int_base + 2, 3); }
+ else if (scan_keyword("imageresolution")) { get_backend_count(cur_cs,"pdf_imageresolution", backend_int_base + 3, 72); }
+ else if (scan_keyword("pkresolution")) { get_backend_count(cur_cs,"pdf_pkresolution", backend_int_base + 4, 72); }
+ else if (scan_keyword("uniqueresname")) { get_backend_count(cur_cs,"pdf_uniqueresname", backend_int_base + 5, 0); }
+ else if (scan_keyword("minorversion")) { get_backend_count(cur_cs,"pdf_minorversion", backend_int_base + 6, 4); }
+ else if (scan_keyword("pagebox")) { get_backend_count(cur_cs,"pdf_pagebox", backend_int_base + 7, 0); }
+ else if (scan_keyword("inclusionerrorlevel")) { get_backend_count(cur_cs,"pdf_inclusionerrorlevel", backend_int_base + 8, 0); }
+ else if (scan_keyword("gamma")) { get_backend_count(cur_cs,"pdf_gamma", backend_int_base + 9, 1000); }
+ else if (scan_keyword("imageapplygamma")) { get_backend_count(cur_cs,"pdf_imageapplygamma", backend_int_base + 10, 0); }
+ else if (scan_keyword("imagegamma")) { get_backend_count(cur_cs,"pdf_imagegamma", backend_int_base + 11, 2200); }
+ else if (scan_keyword("imagehicolor")) { get_backend_count(cur_cs,"pdf_imagehicolor", backend_int_base + 12, 1); }
+ else if (scan_keyword("imageaddfilename")) { get_backend_count(cur_cs,"pdf_imageaddfilename", backend_int_base + 12, 1); }
+ else if (scan_keyword("objcompresslevel")) { get_backend_count(cur_cs,"pdf_objcompresslevel", backend_int_base + 13, 0); }
+ else if (scan_keyword("inclusioncopyfonts")) { get_backend_count(cur_cs,"pdf_inclusioncopyfonts", backend_int_base + 14, 0); }
+ else if (scan_keyword("gentounicode")) { get_backend_count(cur_cs,"pdf_gentounicode", backend_int_base + 15, 0); }
+ else if (scan_keyword("replacefont")) { get_backend_count(cur_cs,"pdf_replacefont", backend_int_base + 16, 0); }
+
+ else if (scan_keyword("horigin")) { get_backend_dimen(cur_cs,"pdf_horigin", backend_dimen_base + 1, one_inch); }
+ else if (scan_keyword("vorigin")) { get_backend_dimen(cur_cs,"pdf_vorigin", backend_dimen_base + 2, one_inch); }
+ else if (scan_keyword("threadmargin")) { get_backend_dimen(cur_cs,"pdf_threadmargin", backend_dimen_base + 3, 0); }
+ else if (scan_keyword("destmargin")) { get_backend_dimen(cur_cs,"pdf_destmargin", backend_dimen_base + 4, 0); }
+ else if (scan_keyword("linkmargin")) { get_backend_dimen(cur_cs,"pdf_linkmargin", backend_dimen_base + 5, 0); }
+
+ else if (scan_keyword("pageattr")) { get_backend_toks (cur_cs,"pdf_pageattr", backend_toks_base + 1); }
+ else if (scan_keyword("pageresources")) { get_backend_toks (cur_cs,"pdf_pageresources", backend_toks_base + 2); }
+ else if (scan_keyword("pagesattr")) { get_backend_toks (cur_cs,"pdf_pagesattr", backend_toks_base + 3); }
+ else if (scan_keyword("xformattr")) { get_backend_toks (cur_cs,"pdf_xformattr", backend_toks_base + 4); }
+ else if (scan_keyword("xformresources")) { get_backend_toks (cur_cs,"pdf_xformresources", backend_toks_base + 5); }
+ else if (scan_keyword("pkmode")) { get_backend_toks (cur_cs,"pdf_pkmode", backend_toks_base + 6); }
+
+ else
+ return 0;
+ return 1;
+}
+
+int conv_toks_dvi(halfword c)
+{
+ return 0;
+}
+
+/* codes not really needed but cleaner when testing */
+
+#define pdftex_version 40 /* these values will not change any more */
+#define pdftex_revision "0" /* these values will not change any more */
+
+int conv_toks_pdf(halfword c)
+{
+ int old_setting; /* holds |selector| setting */
+ int save_scanner_status; /* |scanner_status| upon entry */
+ halfword save_def_ref; /* |def_ref| upon entry, important if inside `\.{\\message}' */
+ halfword save_warning_index;
+ boolean bool; /* temp boolean */
+ str_number s; /* first temp string */
+ int ff; /* for use with |set_ff| */
+ str_number u = 0; /* third temp string, will become non-nil if a string is already being built */
+ char *str; /* color stack init str */
+
+ if (scan_keyword("lastlink")) c = pdf_last_link_code;
+ else if (scan_keyword("retval")) c = pdf_retval_code;
+ else if (scan_keyword("lastobj")) c = pdf_last_obj_code;
+ else if (scan_keyword("lastannot")) c = pdf_last_annot_code;
+ else if (scan_keyword("xformname")) c = pdf_xform_name_code;
+ else if (scan_keyword("creationdate")) c = pdf_creation_date_code;
+ else if (scan_keyword("fontname")) c = pdf_font_name_code;
+ else if (scan_keyword("fontobjnum")) c = pdf_font_objnum_code;
+ else if (scan_keyword("fontsize")) c = pdf_font_size_code;
+ else if (scan_keyword("pageref")) c = pdf_page_ref_code;
+ else if (scan_keyword("colorstackinit")) c = pdf_colorstack_init_code;
+ else if (scan_keyword("version")) c = pdf_version_code;
+ else if (scan_keyword("revision")) c = pdf_revision_code;
+
+ switch (c) {
+ case pdf_last_link_code:
+ push_selector;
+ print_int(pdf_last_link);
+ pop_selector;
+ break;
+ case pdf_retval_code:
+ push_selector;
+ print_int(pdf_retval);
+ pop_selector;
+ break;
+ case pdf_last_obj_code:
+ push_selector;
+ print_int(pdf_last_obj);
+ pop_selector;
+ break;
+ case pdf_last_annot_code:
+ push_selector;
+ print_int(pdf_last_annot);
+ pop_selector;
+ break;
+ case pdf_xform_name_code:
+ scan_int();
+ check_obj_type(static_pdf, obj_type_xform, cur_val);
+ push_selector;
+ print_int(obj_info(static_pdf, cur_val));
+ pop_selector;
+ break;
+ case pdf_creation_date_code:
+ ins_list(string_to_toks(getcreationdate(static_pdf)));
+ /* no further action */
+ return 2;
+ break;
+ case pdf_font_name_code:
+ scan_font_ident();
+ if (cur_val == null_font)
+ normal_error("pdf backend", "invalid font identifier when asking 'fontname'");
+ pdf_check_vf(cur_val);
+ if (!font_used(cur_val))
+ pdf_init_font(static_pdf, cur_val);
+ push_selector;
+ set_ff(cur_val);
+ print_int(obj_info(static_pdf, pdf_font_num(ff)));
+ pop_selector;
+ break;
+ case pdf_font_objnum_code:
+ scan_font_ident();
+ if (cur_val == null_font)
+ normal_error("pdf backend", "invalid font identifier when asking 'objnum'");
+ pdf_check_vf(cur_val);
+ if (!font_used(cur_val))
+ pdf_init_font(static_pdf, cur_val);
+ push_selector;
+ set_ff(cur_val);
+ print_int(pdf_font_num(ff));
+ pop_selector;
+ break;
+ case pdf_font_size_code:
+ scan_font_ident();
+ if (cur_val == null_font)
+ normal_error("pdf backend", "invalid font identifier when asking 'fontsize'");
+ push_selector;
+ print_scaled(font_size(cur_val));
+ tprint("pt");
+ pop_selector;
+ break;
+ case pdf_page_ref_code:
+ scan_int();
+ if (cur_val <= 0)
+ normal_error("pdf backend", "invalid page number when asking 'pageref'");
+ push_selector;
+ print_int(pdf_get_obj(static_pdf, obj_type_page, cur_val, false));
+ pop_selector;
+ break;
+ case pdf_colorstack_init_code:
+ bool = scan_keyword("page");
+ if (scan_keyword("direct"))
+ cur_val = direct_always;
+ else if (scan_keyword("page"))
+ cur_val = direct_page;
+ else
+ cur_val = set_origin;
+ save_scanner_status = scanner_status;
+ save_warning_index = warning_index;
+ save_def_ref = def_ref;
+ u = save_cur_string();
+ scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/
+ s = tokens_to_string(def_ref);
+ delete_token_ref(def_ref);
+ def_ref = save_def_ref;
+ warning_index = save_warning_index;
+ scanner_status = save_scanner_status;
+ str = makecstring(s);
+ cur_val = newcolorstack(str, cur_val, bool);
+ free(str);
+ flush_str(s);
+ cur_val_level = int_val_level;
+ if (cur_val < 0) {
+ print_err("Too many color stacks");
+ help2("The number of color stacks is limited to 32768.",
+ "I'll use the default color stack 0 here.");
+ error();
+ cur_val = 0;
+ restore_cur_string(u);
+ }
+ push_selector;
+ print_int(cur_val);
+ pop_selector;
+ break;
+ case pdf_version_code:
+ push_selector;
+ print_int(pdftex_version);
+ pop_selector;
+ break;
+ case pdf_revision_code:
+ ins_list(string_to_toks(pdftex_revision));
+ return 2;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ return 1;
+}
+
void conv_toks(void)
{
int old_setting; /* holds |selector| setting */
@@ -1750,106 +1995,166 @@ void conv_toks(void)
str_number s; /* first temp string */
int sn; /* lua chunk name */
str_number u = 0; /* third temp string, will become non-nil if a string is already being built */
- int i = 0; /* first temp integer */
- int j = 0; /* second temp integer */
int c = cur_chr; /* desired type of conversion */
str_number str;
+ int done = 1;
+ int i = 0;
/* Scan the argument for command |c| */
switch (c) {
case uchar_code:
scan_char_num();
+ push_selector;
+ print(cur_val);
+ pop_selector;
break;
case number_code:
+ scan_int();
+ push_selector;
+ print_int(cur_val);
+ pop_selector;
+ break;
case roman_numeral_code:
scan_int();
+ push_selector;
+ print_roman_int(cur_val);
+ pop_selector;
break;
case string_code:
+ save_scanner_status = scanner_status;
+ scanner_status = normal;
+ get_token();
+ scanner_status = save_scanner_status;
+ push_selector;
+ if (cur_cs != 0)
+ sprint_cs(cur_cs);
+ else
+ print(cur_chr);
+ pop_selector;
+ break;
case meaning_code:
save_scanner_status = scanner_status;
scanner_status = normal;
get_token();
scanner_status = save_scanner_status;
+ push_selector;
+ print_meaning();
+ pop_selector;
break;
case etex_code:
+ push_selector;
+ tprint(eTeX_version_string);
+ pop_selector;
break;
case font_name_code:
+ scan_font_ident();
+ push_selector;
+ append_string((unsigned char *) font_name(cur_val),(unsigned) strlen(font_name(cur_val)));
+ if (font_size(cur_val) != font_dsize(cur_val)) {
+ tprint(" at ");
+ print_scaled(font_size(cur_val));
+ tprint("pt");
+ }
+ pop_selector;
+ break;
case font_id_code:
scan_font_ident();
+ push_selector;
+ print_int(cur_val);
+ pop_selector;
break;
case luatex_revision_code:
- case luatex_date_code:
- case luatex_banner_code:
+ push_selector;
+ print(get_luatexrevision());
+ pop_selector;
break;
- case pdf_font_name_code:
- case pdf_font_objnum_code:
- case pdf_font_size_code:
- scan_font_ident();
- if (cur_val == null_font)
- pdf_error("font", "invalid font identifier");
- if (c != pdf_font_size_code) {
- pdf_check_vf(cur_val);
- if (!font_used(cur_val))
- pdf_init_font(static_pdf, cur_val);
- }
+ case luatex_date_code:
+ push_selector;
+ print_int(get_luatex_date_info());
+ pop_selector;
break;
- case pdf_page_ref_code:
- scan_int();
- if (cur_val <= 0)
- pdf_error("pageref", "invalid page number");
+ case luatex_banner_code:
+ push_selector;
+ tprint(luatex_banner);
+ pop_selector;
break;
case left_margin_kern_code:
- case right_margin_kern_code:
scan_int();
if ((box(cur_val) == null) || (type(box(cur_val)) != hlist_node))
- pdf_error("marginkern", "a non-empty hbox expected");
+ normal_error("marginkern", "a non-empty hbox expected");
+ push_selector;
+ p = list_ptr(box(cur_val));
+ while ((p != null) && (type(p) == glue_node)) {
+ p = vlink(p);
+ }
+ if ((p != null) && (type(p) == margin_kern_node) && (subtype(p) == left_side))
+ print_scaled(width(p));
+ else
+ print_char('0');
+ tprint("pt");
+ pop_selector;
break;
- case pdf_xform_name_code:
+ case right_margin_kern_code:
scan_int();
- check_obj_type(static_pdf, obj_type_xform, cur_val);
- break;
- case pdf_creation_date_code:
- ins_list(string_to_toks(getcreationdate(static_pdf)));
- return;
+ if ((box(cur_val) == null) || (type(box(cur_val)) != hlist_node))
+ normal_error("marginkern", "a non-empty hbox expected");
+ push_selector;
+ p = list_ptr(box(cur_val));
+ if (p != null) {
+ p = tail_of_list(p);
+ /*
+ there can be a leftskip, rightskip, penalty and yes, also a disc node with a nesting
+ node that points to glue spec ... and we don't want to analyze that messy lot
+ */
+ while ((p != null) && (type(p) == glue_node)) {
+ p = alink(p);
+ }
+ if ((p != null) && ! ((type(p) == margin_kern_node) && (subtype(p) == right_side))) {
+ if (type(p) == disc_node) {
+ q = alink(p);
+ if ((q != null) && ((type(q) == margin_kern_node) && (subtype(q) == right_side))) {
+ p = q;
+ } else {
+ /*
+ officially we should look in the replace but currently protrusion doesn't
+ work anyway with "foo\discretionary{}{}{bar-} " (no following char) so we
+ don't need it now
+ */
+ }
+ }
+ }
+ }
+ if ((p != null) && (type(p) == margin_kern_node) && (subtype(p) == right_side))
+ print_scaled(width(p));
+ else
+ print_char('0');
+ tprint("pt");
+ pop_selector;
break;
case format_name_code:
- case job_name_code:
if (job_name == 0)
open_log_file();
+ push_selector;
+ print(format_name);
+ pop_selector;
break;
- case pdf_colorstack_init_code:
- bool = scan_keyword("page");
- if (scan_keyword("direct"))
- cur_val = direct_always;
- else if (scan_keyword("page"))
- cur_val = direct_page;
- else
- cur_val = set_origin;
- save_scanner_status = scanner_status;
- save_warning_index = warning_index;
- save_def_ref = def_ref;
- u = save_cur_string();
- scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/
- s = tokens_to_string(def_ref);
- delete_token_ref(def_ref);
- def_ref = save_def_ref;
- warning_index = save_warning_index;
- scanner_status = save_scanner_status;
- cur_val = newcolorstack(s, cur_val, bool);
- flush_str(s);
- cur_val_level = int_val_level;
- if (cur_val < 0) {
- print_err("Too many color stacks");
- help2("The number of color stacks is limited to 32768.",
- "I'll use the default color stack 0 here.");
- error();
- cur_val = 0;
- restore_cur_string(u);
- }
+ case job_name_code:
+ if (job_name == 0)
+ open_log_file();
+ push_selector;
+ print_job_name();
+ pop_selector;
break;
case uniform_deviate_code:
scan_int();
+ push_selector;
+ print_int(unif_rand(cur_val));
+ pop_selector;
break;
case normal_deviate_code:
+ scan_int();
+ push_selector;
+ print_int(norm_rand());
+ pop_selector;
break;
case lua_escape_string_code:
{
@@ -1873,8 +2178,42 @@ void conv_toks(void)
free(escstr.s);
return;
}
+ /* no further action */
break;
case math_style_code:
+ push_selector;
+ print_math_style();
+ pop_selector;
+ break;
+ case math_char_class_code:
+ {
+ mathcodeval mval;
+ scan_int();
+ mval = get_math_code(cur_val);
+ push_selector;
+ print_int(mval.class_value);
+ pop_selector;
+ }
+ break;
+ case math_char_fam_code:
+ {
+ mathcodeval mval;
+ scan_int();
+ mval = get_math_code(cur_val);
+ push_selector;
+ print_int(mval.family_value);
+ pop_selector;
+ }
+ break;
+ case math_char_slot_code:
+ {
+ mathcodeval mval;
+ scan_int();
+ mval = get_math_code(cur_val);
+ push_selector;
+ print_int(mval.character_value);
+ pop_selector;
+ }
break;
case expanded_code:
save_scanner_status = scanner_status;
@@ -1887,6 +2226,7 @@ void conv_toks(void)
ins_list(token_link(def_ref));
def_ref = save_def_ref;
restore_cur_string(u);
+ /* no further action */
return;
break;
case lua_code:
@@ -1906,12 +2246,13 @@ void conv_toks(void)
restore_cur_string(u); /* TODO: check this, was different */
if (luacstrings > 0)
lua_string_start();
+ /* no further action */
return;
break;
case lua_function_code:
scan_int();
if (cur_val <= 0) {
- pdf_error("luafunction", "invalid number");
+ normal_error("luafunction", "invalid number");
} else {
u = save_cur_string();
luacstrings = 0;
@@ -1920,119 +2261,65 @@ void conv_toks(void)
if (luacstrings > 0)
lua_string_start();
}
+ /* no further action */
return;
break;
- case pdf_insert_ht_code:
+ case eTeX_revision_code:
+ push_selector;
+ tprint(eTeX_revision);
+ pop_selector;
+ break;
+ case insert_ht_code:
scan_register_num();
+ push_selector;
+ i = cur_val;
+ p = page_ins_head;
+ while (i >= subtype(vlink(p)))
+ p = vlink(p);
+ if (subtype(p) == i)
+ print_scaled(height(p));
+ else
+ print_char('0');
+ tprint("pt");
+ pop_selector;
break;
- case pdf_ximage_bbox_code:
- scan_int();
- check_obj_type(static_pdf, obj_type_ximage, cur_val);
- i = obj_data_ptr(static_pdf, cur_val);
- scan_int();
- j = cur_val;
- if ((j < 1) || (j > 4))
- pdf_error("pdfximagebbox", "invalid parameter");
+ case dvi_variable_code:
+ done = conv_var_dvi(c);
+ if (done==0)
+ confusion("dvi variable");
+ return;
break;
- /* Cases of 'Scan the argument for command |c|' */
- case eTeX_revision_code:
+ case pdf_variable_code:
+ done = conv_var_pdf(c);
+ if (done==0)
+ confusion("pdf variable");
+ return;
+ break;
+ case dvi_feedback_code:
+ if (get_o_mode() == OMODE_DVI)
+ done = conv_toks_dvi(c);
+ else
+ done = 0;
+ if (done==0)
+ confusion("dvi feedback");
+ else if (done==2)
+ return;
+ break;
+ case pdf_feedback_code:
+ if (get_o_mode() == OMODE_PDF)
+ done = conv_toks_pdf(c);
+ else
+ done = 0;
+ if (done==0)
+ confusion("pdf feedback");
+ else if (done==2)
+ return;
break;
default:
confusion("convert");
break;
}
- old_setting = selector;
- selector = new_string;
-
- /* Print the result of command |c| */
- if (!print_convert_string(c, cur_val)) {
- switch (c) {
- case string_code:
- if (cur_cs != 0)
- sprint_cs(cur_cs);
- else
- print(cur_chr);
- break;
- case meaning_code:
- print_meaning();
- break;
- case left_margin_kern_code:
- p = list_ptr(box(cur_val));
- if ((p != null) && (!is_char_node(p)) &&
- (type(p) == glue_node) && (subtype(p) == left_skip_code + 1))
- p = vlink(p);
- if ((p != null) && (!is_char_node(p)) &&
- (type(p) == margin_kern_node) && (subtype(p) == left_side))
- print_scaled(width(p));
- else
- print_char('0');
- tprint("pt");
- break;
- case right_margin_kern_code:
- q = list_ptr(box(cur_val));
- p = null;
- if (q != null) {
- p = prev_rightmost(q, null);
- if ((p != null) && (!is_char_node(p)) && (type(p) == glue_node)
- && (subtype(p) == right_skip_code + 1))
- p = prev_rightmost(q, p);
- }
- if ((p != null) && (!is_char_node(p)) &&
- (type(p) == margin_kern_node) && (subtype(p) == right_side))
- print_scaled(width(p));
- else
- print_char('0');
- tprint("pt");
- break;
- case pdf_colorstack_init_code:
- print_int(cur_val);
- break;
- case pdf_insert_ht_code:
- i = cur_val;
- p = page_ins_head;
- while (i >= subtype(vlink(p)))
- p = vlink(p);
- if (subtype(p) == i)
- print_scaled(height(p));
- else
- print_char('0');
- tprint("pt");
- break;
- case pdf_ximage_bbox_code:
- if (is_pdf_image(i)) {
- switch (j) {
- case 1:
- print_scaled(epdf_orig_x(i));
- break;
- case 2:
- print_scaled(epdf_orig_y(i));
- break;
- case 3:
- print_scaled(epdf_orig_x(i) + epdf_xsize(i));
- break;
- case 4:
- print_scaled(epdf_orig_y(i) + epdf_ysize(i));
- break;
- }
- } else {
- print_scaled(0);
- }
- tprint("pt");
- break;
- case pdf_creation_date_code:
- case lua_escape_string_code:
- case lua_code:
- case lua_function_code:
- case expanded_code:
- break;
- default:
- confusion("convert");
- break;
- }
- }
-
- selector = old_setting;
str = make_string();
(void) str_toks(str_lstring(str));
flush_str(str);
@@ -2050,18 +2337,144 @@ boolean is_convert(halfword c)
return (c == convert_cmd);
}
+int the_convert_string_dvi(halfword c, int i)
+{
+ return 0;
+}
+
+int the_convert_string_pdf(halfword c, int i)
+{
+ int ff;
+
+ if (scan_keyword("lastlink")) c = pdf_last_link_code;
+ else if (scan_keyword("retval")) c = pdf_retval_code;
+ else if (scan_keyword("lastobj")) c = pdf_last_obj_code;
+ else if (scan_keyword("lastannot")) c = pdf_last_annot_code;
+ else if (scan_keyword("xformname")) c = pdf_xform_name_code;
+ /* else if (scan_keyword("creationdate")) c = pdf_creation_date_code; */
+ else if (scan_keyword("fontname")) c = pdf_font_name_code;
+ else if (scan_keyword("fontobjnum")) c = pdf_font_objnum_code;
+ else if (scan_keyword("fontsize")) c = pdf_font_size_code;
+ else if (scan_keyword("pageref")) c = pdf_page_ref_code;
+ /* else if (scan_keyword("colorstackinit")) c = pdf_colorstack_init_code; */
+
+ switch(c) {
+ case pdf_last_link_code:
+ print_int(pdf_last_link);
+ break;
+ case pdf_retval_code:
+ print_int(pdf_retval);
+ break;
+ case pdf_last_obj_code:
+ print_int(pdf_last_obj);
+ break;
+ case pdf_last_annot_code:
+ print_int(pdf_last_annot);
+ break;
+ case pdf_font_name_code:
+ set_ff(i);
+ print_int(obj_info(static_pdf, pdf_font_num(ff)));
+ break;
+ case pdf_font_objnum_code:
+ set_ff(i);
+ print_int(pdf_font_num(ff));
+ break;
+ case pdf_font_size_code:
+ print_scaled(font_size(i));
+ tprint("pt");
+ break;
+ case pdf_page_ref_code:
+ print_int(pdf_get_obj(static_pdf, obj_type_page, i, false));
+ break;
+ case pdf_xform_name_code:
+ print_int(obj_info(static_pdf, i));
+ break;
+ default:
+ return 0;
+ break;
+ }
+ return 1;
+}
+
str_number the_convert_string(halfword c, int i)
{
int old_setting; /* saved |selector| setting */
str_number ret = 0;
+ boolean done = true ;
old_setting = selector;
selector = new_string;
- if (print_convert_string(c, i)) {
- ret = make_string();
- } else if (c == font_identifier_code) {
- print_font_identifier(i);
- ret = make_string();
+ switch (c) {
+ case number_code:
+ print_int(i);
+ break;
+ case uchar_code:
+ print(i);
+ break;
+ case roman_numeral_code:
+ print_roman_int(i);
+ break;
+ case etex_code:
+ tprint(eTeX_version_string);
+ break;
+ case luatex_revision_code:
+ print(get_luatexrevision());
+ break;
+ case luatex_date_code:
+ print_int(get_luatex_date_info());
+ break;
+ case luatex_banner_code:
+ tprint(luatex_banner);
+ break;
+ case uniform_deviate_code:
+ print_int(unif_rand(i));
+ break;
+ case normal_deviate_code:
+ print_int(norm_rand());
+ break;
+ case format_name_code:
+ print(format_name);
+ break;
+ case job_name_code:
+ print_job_name();
+ break;
+ case font_name_code:
+ append_string((unsigned char *) font_name(i),(unsigned) strlen(font_name(i)));
+ if (font_size(i) != font_dsize(i)) {
+ tprint(" at ");
+ print_scaled(font_size(i));
+ tprint("pt");
+ }
+ break;
+ case font_id_code:
+ print_int(i);
+ break;
+ case math_style_code:
+ print_math_style();
+ break;
+ case eTeX_revision_code:
+ tprint(eTeX_revision);
+ break;
+ case font_identifier_code:
+ print_font_identifier(i);
+ break;
+ case dvi_feedback_code:
+ if (get_o_mode() == OMODE_DVI)
+ done = the_convert_string_dvi(c,i);
+ else
+ done = false;
+ break;
+ case pdf_feedback_code:
+ if (get_o_mode() == OMODE_PDF)
+ done = the_convert_string_pdf(c,i);
+ else
+ done = false;
+ break;
+ default:
+ done = false;
+ break;
}
+ if (done)
+ ret = make_string();
selector = old_setting;
return ret;
}
@@ -2202,11 +2615,10 @@ void read_toks(int n, halfword r, halfword j)
@ @c
str_number tokens_to_string(halfword p)
-{ /* return a string from tokens list */
+{ /* return a string from tokens list */
int old_setting;
if (selector == new_string)
- pdf_error("tokens",
- "tokens_to_string() called while selector = new_string");
+ normal_error("tokens","tokens_to_string() called while selector = new_string");
old_setting = selector;
selector = new_string;
show_token_list(token_link(p), null, -1);
@@ -2352,7 +2764,7 @@ char *tokenlist_to_cstring(int pp, int inhibit_par, int *siz)
Print_uchar(c);
break;
case mac_param_cmd:
- if (!in_lua_escape)
+ if (!in_lua_escape && (is_in_csname==0))
Print_uchar(c);
Print_uchar(c);
break;