summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-09-23 12:35:11 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-09-23 12:35:11 +0000
commit8b5b4f556944eac343069de79302d0ecc386442c (patch)
treee96592b152ec51fca993c7dd5e7fbc1871bde75f /Build/source/texk/web2c/luatexdir/tex
parenta109e77c63fb849f1bb5f45bca427f4f712c4b15 (diff)
luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@42133 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h24
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.w173
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.w50
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.w6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.w2
10 files changed, 228 insertions, 43 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w
index e4a269d93d0..b89dadffd1f 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.w
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.w
@@ -754,6 +754,8 @@ void initialize_etex_commands(void)
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("mathnolimitsmode", assign_int_cmd, int_base + math_nolimits_mode_code, int_base);
+ primitive_luatex("mathrulesmode", assign_int_cmd, int_base + math_rules_mode_code, int_base);
+ primitive_luatex("mathrulesfam", assign_int_cmd, int_base + math_rules_fam_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);
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
index 85ff55f4e09..c7bb4c2e87d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
@@ -23,7 +23,7 @@
/* we start with 907: the sum of the values of the bytes of "don knuth" */
-#define FORMAT_ID (907+18)
+#define FORMAT_ID (907+20)
#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 b2bda5f605b..27a4f96401b 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
@@ -279,20 +279,22 @@ the |number_regs| \.{\\dimen} registers.
# define math_display_skip_mode_code 88
# define math_scripts_mode_code 89
# define math_nolimits_mode_code 90
-# define synctex_code 91 /* is synctex file generation enabled ? */
-# define shape_mode_code 92
-# define first_valid_language_code 93
-# define hyphenation_bounds_code 94
+# define math_rules_mode_code 91
+# define math_rules_fam_code 92
+# define synctex_code 93 /* is synctex file generation enabled ? */
+# define shape_mode_code 94
+# define first_valid_language_code 95
+# define hyphenation_bounds_code 96
-# define math_option_code 95
+# define math_option_code 97
-# define mathoption_int_base (int_base+96) /* one reserve */
-# define mathoption_int_last (int_base+104)
+# define mathoption_int_base (int_base+98) /* one reserve */
+# define mathoption_int_last (int_base+106)
-# define backend_int_base (int_base+105)
-# define backend_int_last (int_base+129)
+# define backend_int_base (int_base+107)
+# define backend_int_last (int_base+131)
-# define tex_int_pars (130) /* total number of integer parameters */
+# define tex_int_pars (132) /* total number of integer parameters */
# define page_direction_code (tex_int_pars)
# define body_direction_code (tex_int_pars+1)
@@ -639,6 +641,8 @@ extern halfword last_cs_name;
#define disable_space_par int_par(disable_space_code)
#define scripts_mode_par int_par(math_scripts_mode_code)
#define nolimits_mode_par int_par(math_nolimits_mode_code)
+#define math_rules_mode_par int_par(math_rules_mode_code)
+#define math_rules_fam_par int_par(math_rules_fam_code)
#define thin_mu_skip_par glue_par(thin_mu_skip_code)
#define med_mu_skip_par glue_par(med_mu_skip_code)
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w
index 1af16ec58ef..cec9a144f1c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.w
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.w
@@ -24,6 +24,7 @@ luafflib.c
@ @c
#include "ptexlib.h"
+#define edit_var "TEXEDIT"
@ When something anomalous is detected, \TeX\ typically does something like this:
$$\vbox{\halign{#\hfil\cr
@@ -232,6 +233,155 @@ void jump_out(void)
close_files_and_terminate();
do_final_end();
}
+@ Here is the function that calls the editor, if one is defined. This
+is loosely based on a similar function in kpathsea, but the calling
+convention is quite different.
+
+@c
+static const_string edit_value = EDITOR;
+
+#if defined(WIN32)
+static int
+Isspace (char c)
+{
+ return (c == ' ' || c == '\t');
+}
+#endif /* WIN32 */
+
+__attribute__ ((noreturn))
+static void luatex_calledit (int baseptr, int linenumber)
+{
+ char *temp, *command, *fullcmd;
+ char c;
+ int sdone, ddone, i;
+ char *filename = makecstring(input_stack[base_ptr].name_field);
+ int fnlength = strlen(filename);
+
+#ifdef WIN32
+ char *fp, *ffp, *env, editorname[256], buffer[256];
+ int cnt = 0;
+ int dontchange = 0;
+#endif
+
+ sdone = ddone = 0;
+
+ /* Close any open input files, since we're going to kill the job. */
+ close_files_and_terminate();
+
+ /* Replace the default with the value of the appropriate environment
+ variable or config file value, if it's set. */
+ temp = kpse_var_value (edit_var);
+ if (temp != NULL)
+ edit_value = temp;
+
+ /* Construct the command string. The `11' is the maximum length an
+ integer might be. */
+ command = xmalloc (strlen (edit_value) + fnlength + 11);
+
+ /* So we can construct it as we go. */
+ temp = command;
+
+#ifdef WIN32
+ fp = editorname;
+ if ((isalpha(*edit_value) && *(edit_value + 1) == ':'
+ && IS_DIR_SEP (*(edit_value + 2)))
+ || (*edit_value == '"' && isalpha(*(edit_value + 1))
+ && *(edit_value + 2) == ':'
+ && IS_DIR_SEP (*(edit_value + 3)))
+ )
+ dontchange = 1;
+#endif
+
+ while ((c = *edit_value++) != 0)
+ {
+ if (c == '%')
+ {
+ switch (c = *edit_value++)
+ {
+ case 'd':
+ if (ddone)
+ FATAL1 ("call_edit: `%%d' appears twice in editor command: `%s'", edit_value);
+ sprintf (temp, "%ld", (long int)linenumber);
+ while (*temp != '\0')
+ temp++;
+ ddone = 1;
+ break;
+
+ case 's':
+ if (sdone)
+ FATAL1 ("call_edit: `%%s' appears twice in editor command: `%s'", edit_value);
+ for (i =0; i < fnlength; i++)
+ *temp++ = filename[i];
+ sdone = 1;
+ break;
+
+ case '\0':
+ *temp++ = '%';
+ /* Back up to the null to force termination. */
+ edit_value--;
+ break;
+
+ default:
+ *temp++ = '%';
+ *temp++ = c;
+ break;
+ }
+ }
+ else {
+#ifdef WIN32
+ if (dontchange)
+ *temp++ = c;
+ else { if(Isspace(c) && cnt == 0) {
+ cnt++;
+ temp = command;
+ *temp++ = c;
+ *fp = '\0';
+ } else if(!Isspace(c) && cnt == 0) {
+ *fp++ = c;
+ } else {
+ *temp++ = c;
+ }
+ }
+#else
+ *temp++ = c;
+#endif
+ }
+ }
+
+ *temp = 0;
+
+#ifdef WIN32
+ if (dontchange == 0) {
+ if(editorname[0] == '.' ||
+ editorname[0] == '/' ||
+ editorname[0] == '\\') {
+ fprintf(stderr, "%s is not allowed to execute.\n", editorname);
+ do_final_end();
+ }
+ env = (char *)getenv("PATH");
+ if(SearchPath(env, editorname, ".exe", 256, buffer, &ffp)==0) {
+ if(SearchPath(env, editorname, ".bat", 256, buffer, &ffp)==0) {
+ fprintf(stderr, "I cannot find %s in the PATH.\n", editorname);
+ do_final_end();
+ }
+ }
+ fullcmd = (char *)xmalloc(strlen(buffer)+strlen(command)+5);
+ strcpy(fullcmd, "\"");
+ strcat(fullcmd, buffer);
+ strcat(fullcmd, "\"");
+ strcat(fullcmd, command);
+ } else
+#endif
+ fullcmd = command;
+
+ /* Execute the command. */
+ if (system (fullcmd) != 0)
+ fprintf (stderr, "! Trouble executing `%s'.\n", command);
+
+ /* Quit, since we found an error. */
+ do_final_end ();
+}
+
@ @c
void error(void)
@@ -325,12 +475,23 @@ void error(void)
#endif
case 'E':
if (base_ptr > 0) {
- tprint_nl("You want to edit file ");
- print(input_stack[base_ptr].name_field);
- tprint(" at line ");
- print_int(line);
- interaction = scroll_mode;
- jump_out();
+ int callback_id = callback_defined(call_edit_callback);
+ if (callback_id>0) {
+ (void)run_callback(callback_id, "Sd->", makecstring(input_stack[base_ptr].name_field), line);
+ jump_out(); /* should not be reached */
+ } else {
+ tprint_nl("You want to edit file ");
+ print(input_stack[base_ptr].name_field);
+ tprint(" at line ");
+ print_int(line);
+ interaction = scroll_mode;
+ if (kpse_init) {
+ luatex_calledit(base_ptr, line);
+ } else {
+ tprint_nl("There is no valid callback defined.");
+ jump_out(); /* should not be reached */
+ }
+ }
}
break;
case 'H':
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w
index 838c6edcead..f3c66d32ed2 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w
@@ -142,6 +142,8 @@ static void do_extension_pdf(int immediate)
set_pdf_literal_mode(tail, direct_always);
else if (scan_keyword("page"))
set_pdf_literal_mode(tail, direct_page);
+ else if (scan_keyword("raw"))
+ set_pdf_literal_mode(tail, direct_raw);
else
set_pdf_literal_mode(tail, set_origin);
scan_toks(false, true);
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w
index 753ce840cbc..909128e93c6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.w
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w
@@ -271,7 +271,7 @@ static scaled minimum_operator_size(int var)
the backward compatibility code, and it means that we can't raise an error here.
@c
-static scaled radical_rule(int var)
+static scaled radical_rule_par(int var)
{
scaled a = get_math_param(math_param_radical_rule, var);
return a;
@@ -978,10 +978,16 @@ static pointer math_clone(pointer q)
that eventually contains it.
@c
-static pointer do_fraction_rule(scaled t, pointer att)
+static pointer do_fraction_rule(scaled t, pointer att, halfword some_rule, halfword cur_size, halfword cur_fam)
{
pointer p; /* the new node */
- p = new_rule(normal_rule);
+ if (math_rules_mode_par) {
+ p = new_rule(some_rule);
+ rule_math_size(p) = cur_size;
+ rule_math_font(p) = fam_fnt(cur_fam, cur_size);
+ } else {
+ p = new_rule(normal_rule);
+ }
rule_dir(p) = math_direction_par;
height(p) = t;
depth(p) = 0;
@@ -994,13 +1000,13 @@ static pointer do_fraction_rule(scaled t, pointer att)
fraction rule of thickness |t| under additional space of height |ht|.
@c
-static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att)
+static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att, halfword index, halfword cur_size, halfword cur_fam)
{
pointer p, q; /* nodes being constructed */
p = new_kern(k);
reset_attributes(p, att);
couple_nodes(p,b);
- q = do_fraction_rule(t, att);
+ q = do_fraction_rule(t, att, index, cur_size, cur_fam);
couple_nodes(q,p);
p = new_kern(ht);
reset_attributes(p, att);
@@ -1796,17 +1802,17 @@ 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)
+static void make_over(pointer q, int cur_style, int cur_size, int cur_fam)
{
pointer p;
p = overbar(clean_box(nucleus(q), cramped_style(cur_style), cur_style),
overbar_vgap(cur_style), overbar_rule(cur_style),
- overbar_kern(cur_style), node_attr(nucleus(q)));
+ overbar_kern(cur_style), node_attr(nucleus(q)), math_over_rule, cur_size, cur_fam);
math_list(nucleus(q)) = p;
type(nucleus(q)) = sub_box_node;
}
-static void make_under(pointer q, int cur_style)
+static void make_under(pointer q, int cur_style, int cur_size, int cur_fam)
{
pointer p, x, y, r; /* temporary registers for box construction */
scaled delta; /* overall height plus depth */
@@ -1814,7 +1820,7 @@ static void make_under(pointer q, int cur_style)
p = new_kern(underbar_vgap(cur_style));
reset_attributes(p, node_attr(q));
couple_nodes(x,p);
- r = do_fraction_rule(underbar_rule(cur_style), node_attr(q));
+ r = do_fraction_rule(underbar_rule(cur_style), node_attr(q), math_under_rule, cur_size, cur_fam);
couple_nodes(p,r);
y = vpackage(x, 0, additional, max_dimen, math_direction_par);
reset_attributes(y, node_attr(q));
@@ -1878,7 +1884,7 @@ static void make_radical(pointer q, int cur_style)
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);
+ theta = radical_rule_par(cur_style);
if (theta == undefined_math_parameter) {
/* a real radical */
theta = fraction_rule(cur_style);
@@ -1912,7 +1918,7 @@ static void make_radical(pointer q, int cur_style)
}
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));
+ p = overbar(x, clr, theta, radical_kern(cur_style), node_attr(y), math_radical_rule, cur_size, small_fam(left_delimiter(q)));
couple_nodes(y,p);
if (degree(q) != null) {
scaled wr, br, ar;
@@ -2559,7 +2565,7 @@ static void make_fraction(pointer q, int cur_style)
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));
+ y = do_fraction_rule(thickness(q), node_attr(q), math_fraction_rule, cur_size, math_rules_fam_par);
p = new_kern((math_axis_size(cur_size) - delta) - (height(z) - shift_down));
reset_attributes(p, node_attr(q));
couple_nodes(y,p);
@@ -2656,8 +2662,9 @@ static scaled make_op(pointer q, int cur_style)
math_character(nucleus(q)) = c;
}
delta = char_italic(cur_f, cur_c);
+printf("delta %i\n",delta);
x = clean_box(nucleus(q), cur_style, cur_style);
- if (delta != null) {
+ if (delta != 0) {
if (do_new_math(cur_f)) {
/* we never added italic correction */
} else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) {
@@ -2712,8 +2719,8 @@ static scaled make_op(pointer q, int cur_style)
*/
switch (mode) {
case 0 :
- /* as with limits */
- make_scripts(q, p, 0, cur_style, half(delta), -half(delta));
+ /* full bottom correction */
+ make_scripts(q, p, 0, cur_style, 0, -delta);
break;
case 1 :
/* MathConstants driven */
@@ -2723,22 +2730,21 @@ static scaled make_op(pointer q, int cur_style)
case 2 :
/* no correction */
make_scripts(q, p, 0, cur_style, 0, 0);
- break;
+ break ;
case 3 :
/* half bottom correction */
make_scripts(q, p, 0, cur_style, 0, -half(delta));
break;
case 4 :
- /* full bottom correction */
- make_scripts(q, p, 0, cur_style, 0, -delta);
+ /* half bottom and top correction */
+ make_scripts(q, p, 0, cur_style, half(delta), -half(delta));
break;
default :
- /* half bottom and top correction */
if (mode > 15) {
/* for quickly testing values */
make_scripts(q, p, 0, cur_style, 0, -round_xn_over_d(delta, mode, 1000));
} else {
- make_scripts(q, p, 0, cur_style, half(delta), -half(delta));
+ make_scripts(q, p, 0, cur_style, 0, 0);
}
break;
}
@@ -3913,10 +3919,10 @@ void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style)
}
break;
case over_noad_type:
- make_over(q, cur_style);
+ make_over(q, cur_style, cur_size, math_rules_fam_par);
break;
case under_noad_type:
- make_under(q, cur_style);
+ make_under(q, cur_style, cur_size, math_rules_fam_par);
break;
case vcenter_noad_type:
make_vcenter(q);
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
index c222eef975b..2281de12c4c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
@@ -170,12 +170,12 @@ char *luatex_find_file(const char *s, int callback_index)
case find_data_file_callback:
ftemp = find_in_output_directory(s);
if (!ftemp)
- ftemp = kpse_find_file(s, kpse_tex_format, 0);
+ ftemp = kpse_find_file(s, kpse_tex_format, 1);
break;
case find_font_file_callback:
- ftemp = kpse_find_file(s, kpse_ofm_format, 0);
+ ftemp = kpse_find_file(s, kpse_ofm_format, 1);
if (ftemp == NULL)
- ftemp = kpse_find_file(s, kpse_tfm_format, 0);
+ ftemp = kpse_find_file(s, kpse_tfm_format, 1);
break;
case find_vf_file_callback:
ftemp = kpse_find_file(s, kpse_ovf_format, 0);
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 6650d17f410..943a347554d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
@@ -261,6 +261,10 @@ typedef enum {
image_rule,
empty_rule,
user_rule,
+ math_over_rule,
+ math_under_rule,
+ math_fraction_rule,
+ math_radical_rule,
} rule_subtypes;
# define rule_node_size 8
@@ -270,6 +274,9 @@ typedef enum {
# define synctex_tag_rule(a) vinfo((a)+7)
# define synctex_line_rule(a) vlink((a)+7)
+# define rule_math_size rule_index
+# define rule_math_font rule_transform
+
# define mark_node_size 3
# define mark_ptr(a) vlink((a)+2)
# define mark_class(a) vinfo((a)+2)
@@ -716,6 +723,7 @@ typedef enum {
set_origin = 0,
direct_page,
direct_always,
+ direct_raw,
scan_special,
} ctm_transform_modes;
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
index c242577404f..3a368c82336 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
@@ -268,7 +268,7 @@ const char *node_subtypes_kern[] = {
"fontkern", "userkern", "accentkern", "italiccorrection", NULL
};
const char *node_subtypes_rule[] = {
- "normal", "box", "image", "empty", "user", NULL
+ "normal", "box", "image", "empty", "user", "over", "under", "fraction", "radical", NULL
};
const char *node_subtypes_glyph[] = {
"character", "glyph", "ligature", "ghost", "left", "right", NULL
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w
index 8f44f686641..7b781fc082b 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.w
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w
@@ -2437,6 +2437,8 @@ static int do_feedback_pdf(halfword c)
cur_val = direct_always;
else if (scan_keyword("page"))
cur_val = direct_page;
+ else if (scan_keyword("raw"))
+ cur_val = direct_raw;
else
cur_val = set_origin;
save_scanner_status = scanner_status;