summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2019-10-13 17:09:41 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2019-10-13 17:09:41 +0000
commit378030dd89abc0f2b0d9902dd343d1f2108a202f (patch)
tree65db6ed6a3bd3124cbb14b3634c3aae2401e5cd2 /Build
parentdf16ddc90a200f2c3a5f5724c8ad376a3258c298 (diff)
sync with upstream luatex rev. 7197
git-svn-id: svn://tug.org/texlive/trunk@52360 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog17
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.c24
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c99
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.c32
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luanode.c7
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatoken.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c16
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex_svnversion.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/luatexcallbackids.h1
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/expand.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.c7
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/inputstack.h12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.c43
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.c37
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.c10
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.h2
25 files changed, 270 insertions, 73 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index f845f9bf463..8e816af4ad4 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,20 @@
+2019-10-13 Luigi Scarso <luigi.scarso@gmail.com>
+ * extra features runtoks (HH)
+ * tex.getmodenames() (as these can differ per engine/version) (HH)
+ * permit nested runtoks in more complex situations of nesting (HH)
+ * more accurate and correct test for tex.[set|get]math
+ * minor clean-up and bugs fixed
+
+
+
+2019-08-12 Luigi Scarso <luigi.scarso@gmail.com>
+ * Support new option --cnf-line from kapthsea.
+
+
+2019-07-27 Luigi Scarso <luigi.scarso@gmail.com>
+ * Fixed \opein, to be consistent with pdftex in opening
+ a file without extension (but not enclosed in {})
+
2019-07-06 Luigi Scarso <luigi.scarso@gmail.com>
* Integration of harfbuzz.
* Splitting of exe into *hbtex variants.
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.c b/Build/source/texk/web2c/luatexdir/font/writecff.c
index 31a49bae01d..8082259757b 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.c
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.c
@@ -1174,6 +1174,7 @@ static long pack_real(card8 * dest, long destlen, double value)
long e;
int i = 0, pos = 2;
int res;
+ char local_work_buffer[WORK_BUFFER_SIZE];
#define CFF_REAL_MAX_LEN 17
if (destlen < 2)
normal_error("cff","buffer overflow (6)");
@@ -1199,20 +1200,23 @@ static long pack_real(card8 * dest, long destlen, double value)
e--;
}
}
- res = sprintf(work_buffer, "%1.14g", value);
+ res = sprintf(local_work_buffer, "%1.14g", value);
+ if ( (dest>work_buffer) && (dest-((card8*)work_buffer))<(res+1)) {
+ normal_warning("cff","invalid real value to pack. Continuing, but the font looks wrong.");
+ }
if (res<0)
normal_error("cff","invalid conversion");
if (res>CFF_REAL_MAX_LEN)
res=CFF_REAL_MAX_LEN;
for (i = 0; i < res; i++) {
unsigned char ch = 0;
- if (work_buffer[i] == '\0') {
+ if (local_work_buffer[i] == '\0') {
/*tex In fact |res| should prevent this. */
break;
- } else if (work_buffer[i] == '.') {
+ } else if (local_work_buffer[i] == '.') {
ch = 0x0a;
- } else if (work_buffer[i] >= '0' && work_buffer[i] <= '9') {
- ch = (unsigned char) (work_buffer[i] - '0');
+ } else if (local_work_buffer[i] >= '0' && local_work_buffer[i] <= '9') {
+ ch = (unsigned char) (local_work_buffer[i] - '0');
} else {
normal_error("cff","invalid character");
}
@@ -1247,15 +1251,15 @@ static long pack_real(card8 * dest, long destlen, double value)
pos++;
}
if (e != 0) {
- sprintf(work_buffer, "%ld", e);
+ sprintf(local_work_buffer, "%ld", e);
for (i = 0; i < CFF_REAL_MAX_LEN; i++) {
unsigned char ch = 0;
- if (work_buffer[i] == '\0') {
+ if (local_work_buffer[i] == '\0') {
break;
- } else if (work_buffer[i] == '.') {
+ } else if (local_work_buffer[i] == '.') {
ch = 0x0a;
- } else if (work_buffer[i] >= '0' && work_buffer[i] <= '9') {
- ch = (unsigned char) (work_buffer[i] - '0');
+ } else if (local_work_buffer[i] >= '0' && local_work_buffer[i] <= '9') {
+ ch = (unsigned char) (local_work_buffer[i] - '0');
} else {
normal_error("cff","invalid character");
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
index f0297ae8f51..163906eedf5 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
@@ -56,7 +56,7 @@ static const char *const callbacknames[] = {
"pre_output_filter",
"buildpage_filter",
"hpack_filter", "vpack_filter",
- "glyph_not_found",
+ "glyph_not_found", "glyph_info",
"hyphenate",
"ligaturing",
"kerning",
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index dd794827646..d5ab00a5541 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -7581,6 +7581,7 @@ static int lua_nodelib_direct_uses_font(lua_State * L)
halfword p;
if (type(n) == glyph_node) {
lua_pushboolean(L,font(n) == f);
+ return 1;
} else if (type(n) == disc_node) {
uses_font_disc(pre_break,p,n);
uses_font_disc(post_break,p,n);
@@ -7598,6 +7599,7 @@ static int lua_nodelib_uses_font(lua_State * L)
halfword p;
if (type(n) == glyph_node) {
lua_pushboolean(L,font(n) == f);
+ return 1;
} else if (type(n) == disc_node) {
uses_font_disc(pre_break,p,n);
uses_font_disc(post_break,p,n);
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index 9dc9350b5c6..5187bc89c01 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -2066,7 +2066,7 @@ static int tex_setmathparm(lua_State * L)
}
i = luaL_checkoption(L, (n - 2), NULL, math_param_names);
j = luaL_checkoption(L, (n - 1), NULL, math_style_names);
- if (i<0 && i>=math_param_last) {
+ if (i < 0 || j < 0) {
/* invalid spec, just ignore it */
} else if (i>=math_param_first_mu_glue) {
p = lua_touserdata(L, n);
@@ -2084,20 +2084,24 @@ static int tex_setmathparm(lua_State * L)
static int tex_getmathparm(lua_State * L)
{
- if ((lua_gettop(L) == 2)) {
+ if (lua_gettop(L) == 2) {
int i = luaL_checkoption(L, 1, NULL, math_param_names);
int j = luaL_checkoption(L, 2, NULL, math_style_names);
- scaled k = get_math_param(i, j);
- if (i<0 && i>=math_param_last) {
+ if (i < 0 || j < 0) {
lua_pushnil(L);
- } else if (i>=math_param_first_mu_glue) {
- if (k <= thick_mu_skip_code) {
- k = glue_par(k);
- }
- lua_nodelib_push_fast(L, k);
} else {
- lua_pushinteger(L, k);
+ scaled k = get_math_param(i, j);
+ if (i >= math_param_first_mu_glue) {
+ if (k <= thick_mu_skip_code) {
+ k = glue_par(k);
+ }
+ lua_nodelib_push_fast(L, k);
+ } else {
+ lua_pushinteger(L, k);
+ }
}
+ } else {
+ lua_pushnil(L);
}
return 1;
}
@@ -3483,8 +3487,8 @@ static int runtoks(lua_State * L)
if (lua_type(L,1) == LUA_TFUNCTION) {
int old_mode = mode;
int ref;
- pointer r = get_avail();
- pointer t = get_avail();
+ halfword r = get_avail();
+ halfword t = get_avail();
token_info(r) = token_val(extension_cmd,end_local_code);
lua_pushvalue(L, 1);
ref = luaL_ref(L,LUA_REGISTRYINDEX);
@@ -3502,16 +3506,31 @@ static int runtoks(lua_State * L)
mode = old_mode;
luaL_unref(L,LUA_REGISTRYINDEX,ref);
} else {
- int k = get_item_index(L, lua_gettop(L), toks_base);
- halfword t = toks(k);
+ halfword t;
+ int k = get_item_index(L, 1, toks_base);
check_index_range(k, "gettoks");
- if (t != null) {
+ t = toks(k);
+ if (! t) {
+ /* nothing to do */
+ } else if ((scanner_status != defining) || (lua_toboolean(L,2))) {
+ int grouped = lua_toboolean(L,3);
int old_mode = mode;
- pointer r = get_avail();
- token_info(r) = token_val(extension_cmd,end_local_code);
- begin_token_list(r,inserted);
- /* new_save_level(semi_simple_group); */
+ if (grouped) {
+ halfword r = get_avail();
+ token_info(r) = token_val(right_brace_cmd,0);
+ begin_token_list(r,inserted);
+ }
+ {
+ halfword r = get_avail();
+ token_info(r) = token_val(extension_cmd,end_local_code);
+ begin_token_list(r,inserted);
+ }
begin_token_list(t,local_text);
+ if (grouped) {
+ halfword r = get_avail();
+ token_info(r) = token_val(left_brace_cmd,0);
+ begin_token_list(r,inserted);
+ }
if (luacstrings > 0) {
lua_string_start();
}
@@ -3522,11 +3541,51 @@ static int runtoks(lua_State * L)
local_control();
mode = old_mode;
/* unsave(); */
+ } else {
+ halfword q;
+ halfword p = temp_token_head;
+ halfword r = token_link(t);
+ set_token_link(p, null);
+ while (r) {
+ fast_store_new_token(token_info(r));
+ r = token_link(r);
+ }
+ ins_list(token_link(temp_token_head));
}
}
return 0;
}
+static int quittoks(lua_State * L)
+{
+ (void) L;
+ if (tracing_nesting_par > 2) {
+ local_control_message("quitting token scanner");
+ }
+ end_local_control();
+ return 0;
+}
+
+/*tex Negative values are internal and inline. */
+
+static int tex_getmodevalues(lua_State * L)
+{
+ lua_newtable(L);
+ lua_pushinteger(L,0);
+ lua_push_string_by_name(L,unset); /* 0 */
+ lua_rawset(L, -3);
+ lua_pushinteger(L,vmode);
+ lua_push_string_by_name(L,vertical); /* 1 */
+ lua_rawset(L, -3);
+ lua_pushinteger(L,hmode);
+ lua_push_string_by_name(L,horizontal); /* 127 */
+ lua_rawset(L, -3);
+ lua_pushinteger(L,mmode);
+ lua_push_string_by_name(L,math); /* 253 */
+ lua_rawset(L, -3);
+ return 1;
+}
+
/* till here */
void init_tex_table(lua_State * L)
@@ -3650,7 +3709,9 @@ static const struct luaL_Reg texlib[] = {
{ "get_synctex_line", lua_get_synctex_line },
/* test */
{ "runtoks", runtoks },
+ { "quittoks", quittoks },
{ "forcehmode", forcehmode },
+ { "getmodevalues", tex_getmodevalues },
/* sentinel */
{ NULL, NULL }
};
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.c b/Build/source/texk/web2c/luatexdir/lua/luainit.c
index 7abf8c8ee5e..7570910b0ef 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.c
@@ -24,6 +24,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
#include "ptexlib.h"
#include <kpathsea/c-stat.h>
+#include <kpathsea/cnf.h>
#include "lua/luatex-api.h"
@@ -66,6 +67,7 @@ const_string LUATEX_IHELP[] = {
"",
" The following regular options are understood: ",
"",
+ " --cnf-line =STRING parse STRING as a configuration file line",
" --credits display credits and exit",
" --debug-format enable format debugging",
" --draftmode switch on draft mode (generates no output PDF)",
@@ -183,6 +185,16 @@ static void prepare_cmdline(lua_State * L, char **av, int ac, int zero_offset)
int kpse_init = -1;
+/*tex
+
+Array and count of values given with --cnf-line.
+
+*/
+static string *user_cnf_lines = NULL;
+static unsigned user_cnf_nlines = 0;
+
+
+
string input_name = NULL;
static string user_progname = NULL;
@@ -234,6 +246,7 @@ static struct option long_options[] = {
{"interaction", 1, 0, 0},
{"halt-on-error", 0, &haltonerrorp, 1},
{"kpathsea-debug", 1, 0, 0},
+ {"cnf-line", 1,0 ,0},
{"progname", 1, 0, 0},
{"version", 0, 0, 0},
{"credits", 0, 0, 0},
@@ -359,6 +372,16 @@ static void parse_options(int ac, char **av)
show_luahashchars = 1;
} else if (ARGUMENT_IS("kpathsea-debug")) {
kpathsea_debug |= atoi(optarg);
+ } else if (ARGUMENT_IS ("cnf-line")) {
+ if (user_cnf_lines == NULL) {
+ user_cnf_nlines = 1;
+ user_cnf_lines = xmalloc (sizeof (const_string));
+ } else {
+ user_cnf_nlines++;
+ user_cnf_lines = xrealloc (user_cnf_lines,
+ user_cnf_nlines * sizeof (const_string));
+ }
+ user_cnf_lines[user_cnf_nlines-1] = xstrdup (optarg);
} else if (ARGUMENT_IS("progname")) {
user_progname = optarg;
} else if (ARGUMENT_IS("jobname")) {
@@ -998,6 +1021,15 @@ void lua_initialize(int ac, char **av)
putenv(LC_NUMERIC_C);
/*tex this is sometimes needed */
putenv(engine_luatex);
+ /*tex add user's cnf values*/
+ if (user_cnf_lines) {
+ unsigned i;
+ for (i = 0; i < user_cnf_nlines; i++) {
+ /* debug printf ("ucnf%d: %s\n", i, user_cnf_lines[i]); */
+ kpathsea_cnf_line_env_progname (kpse_def, user_cnf_lines[i]);
+ free (user_cnf_lines[i]);
+ }
+ }
luainterpreter();
/*tex init internalized strings */
set_init_keys;
diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.c b/Build/source/texk/web2c/luatexdir/lua/luanode.c
index 3182b609773..a0c97e37dc8 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luanode.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luanode.c
@@ -140,13 +140,18 @@ int lua_linebreak_callback(int is_broken, halfword head_node, halfword * new_hea
luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1));
return ret;
}
- lua_settop(Luas, s_top);
+ /*tex This should prevent a stack overflow (see r6689), */
+ /*tex but as side effect it discards the ouput */
+ /*tex of the linebreak_filter, see [Dev-luatex] linebreak_filter */
+ /*tex lua_settop(Luas, s_top);*/
p = lua_touserdata(Luas, -1);
if (p != NULL) {
a = nodelist_from_lua(Luas,-1);
try_couple_nodes(*new_head,a);
ret = 1;
}
+ /*tex re-inserted this line */
+ lua_settop(Luas, s_top);
return ret;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index d54bd84663f..9525cecd26d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -799,6 +799,7 @@ make_lua_key(hlist);\
make_lua_key(hmode_par);\
make_lua_key(hmove);\
make_lua_key(hold_head);\
+make_lua_key(horizontal);\
make_lua_key(horiz_variants);\
make_lua_key(hrule);\
make_lua_key(hsize);\
@@ -1215,6 +1216,7 @@ make_lua_key(variable);\
make_lua_key(vbox);\
make_lua_key(vcenter);\
make_lua_key(version);\
+make_lua_key(vertical);\
make_lua_key(vert_italic);\
make_lua_key(vert_variants);\
make_lua_key(visiblefilename);\
@@ -1502,6 +1504,7 @@ init_lua_key(hlist);\
init_lua_key(hmode_par);\
init_lua_key(hmove);\
init_lua_key(hold_head);\
+init_lua_key(horizontal);\
init_lua_key(horiz_variants);\
init_lua_key(hrule);\
init_lua_key(hsize);\
@@ -1905,6 +1908,7 @@ init_lua_key(variable);\
init_lua_key(vbox);\
init_lua_key(vcenter);\
init_lua_key(version);\
+init_lua_key(vertical);\
init_lua_key(vert_italic);\
init_lua_key(vert_variants);\
init_lua_key(visiblefilename);\
@@ -2256,6 +2260,7 @@ use_lua_key(hlist);
use_lua_key(hmode_par);
use_lua_key(hmove);
use_lua_key(hold_head);
+use_lua_key(horizontal);
use_lua_key(horiz_variants);
use_lua_key(hrule);
use_lua_key(hsize);
@@ -2672,6 +2677,7 @@ use_lua_key(variable);
use_lua_key(vbox);
use_lua_key(vcenter);
use_lua_key(version);
+use_lua_key(vertical);
use_lua_key(vert_italic);
use_lua_key(vert_variants);
use_lua_key(visiblefilename);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.c b/Build/source/texk/web2c/luatexdir/lua/luatoken.c
index fb197b68f7b..874fbc99a5d 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatoken.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.c
@@ -140,6 +140,7 @@ command_item command_names[] = {
{ assign_box_dir_cmd, NULL, 0},
{ assign_direction_cmd, NULL, 0},
{ assign_dir_cmd, NULL, 0},
+ { combine_toks_cmd, NULL, 0},
{ advance_cmd, NULL, 0},
{ multiply_cmd, NULL, 0},
{ divide_cmd, NULL, 0},
@@ -169,7 +170,6 @@ command_item command_names[] = {
{ variable_cmd, NULL, 0},
{ feedback_cmd, NULL, 0},
{ the_cmd, NULL, 0},
- { combine_toks_cmd, NULL, 0},
{ top_bot_mark_cmd, NULL, 0},
{ call_cmd, NULL, 0},
{ long_call_cmd, NULL, 0},
@@ -306,6 +306,7 @@ void l_set_token_data(void)
init_token_key(command_names, assign_box_dir_cmd, assign_box_dir);
init_token_key(command_names, assign_direction_cmd, assign_direction);
init_token_key(command_names, assign_dir_cmd, assign_dir);
+ init_token_key(command_names, combine_toks_cmd, combinetoks);
init_token_key(command_names, advance_cmd, advance);
init_token_key(command_names, multiply_cmd, multiply);
init_token_key(command_names, divide_cmd, divide);
@@ -334,7 +335,6 @@ void l_set_token_data(void)
init_token_key(command_names, variable_cmd, variable);
init_token_key(command_names, feedback_cmd, feedback);
init_token_key(command_names, the_cmd, the);
- init_token_key(command_names, combine_toks_cmd, combinetoks);
init_token_key(command_names, top_bot_mark_cmd, top_bot_mark);
init_token_key(command_names, call_cmd, call);
init_token_key(command_names, long_call_cmd, long_call);
diff --git a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c
index d7840ae3cd0..ddb05581fae 100644
--- a/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c
+++ b/Build/source/texk/web2c/luatexdir/luaharfbuzz/src/luaharfbuzz/face.c
@@ -56,7 +56,7 @@ static int face_get_name(lua_State *L) {
hb_ot_name_id_t name_id = (hb_ot_name_id_t) luaL_checkinteger(L, 2);
hb_language_t lang = HB_LANGUAGE_INVALID;
char name[STATIC_ARRAY_SIZE];
- int text_size = STATIC_ARRAY_SIZE, len;
+ unsigned int text_size = STATIC_ARRAY_SIZE, len;
if (lua_gettop(L) > 2)
lang = *((Language*)luaL_checkudata(L, 3, "harfbuzz.Language"));
@@ -105,7 +105,7 @@ static int face_get_table_tags(lua_State *L) {
count = STATIC_ARRAY_SIZE;
hb_face_get_table_tags(*f, offset, &count, tags);
for (i = 0; i < count; i++) {
- lua_pushnumber(L, i + 1);
+ lua_pushnumber(L, offset + i + 1);
Tag *tp = (Tag *)lua_newuserdata(L, sizeof(*tp));
luaL_getmetatable(L, "harfbuzz.Tag");
@@ -137,7 +137,7 @@ static int face_ot_layout_get_script_tags(lua_State *L) {
count = STATIC_ARRAY_SIZE;
hb_ot_layout_table_get_script_tags(*face, *table, offset, &count, tags);
for (i = 0; i < count; i++) {
- lua_pushnumber(L, i + 1);
+ lua_pushnumber(L, offset + i + 1);
Tag *tp = (Tag *)lua_newuserdata(L, sizeof(*tp));
luaL_getmetatable(L, "harfbuzz.Tag");
@@ -170,7 +170,7 @@ static int face_ot_layout_get_language_tags(lua_State *L) {
count = STATIC_ARRAY_SIZE;
hb_ot_layout_script_get_language_tags(*face, *table, script_index, offset, &count, tags);
for (i = 0; i < count; i++) {
- lua_pushnumber(L, i + 1);
+ lua_pushnumber(L, offset + i + 1);
Tag *tp = (Tag *)lua_newuserdata(L, sizeof(*tp));
luaL_getmetatable(L, "harfbuzz.Tag");
@@ -204,7 +204,7 @@ static int face_ot_layout_get_feature_tags(lua_State *L) {
count = STATIC_ARRAY_SIZE;
hb_ot_layout_language_get_feature_tags(*face, *table, script_index, language_index, offset, &count, tags);
for (i = 0; i < count; i++) {
- lua_pushnumber(L, i + 1);
+ lua_pushnumber(L, offset + i + 1);
Tag *tp = (Tag *)lua_newuserdata(L, sizeof(*tp));
luaL_getmetatable(L, "harfbuzz.Tag");
@@ -241,7 +241,7 @@ static int face_ot_layout_find_language(lua_State *L) {
Tag *language = (Tag *)luaL_checkudata(L, 4, "harfbuzz.Tag");
unsigned int index = 0;
- int found = hb_ot_layout_script_find_language(*face, *table, script_index, *language, &index);
+ int found = hb_ot_layout_script_select_language(*face, *table, script_index, 1, &(*language), &index);
lua_pushboolean(L, found);
lua_pushinteger(L, index);
return 2;
@@ -320,7 +320,7 @@ static int face_ot_color_palette_get_colors(lua_State *L) {
for (i = 0; i < count; i++) {
hb_color_t color = colors[i];
- lua_pushnumber(L, i+1); // 1-indexed key parent table
+ lua_pushnumber(L, offset + i + 1); // 1-indexed key parent table
lua_createtable(L, 0, 4); // child table
lua_pushinteger(L, hb_color_get_red(color));
@@ -371,7 +371,7 @@ static int face_ot_color_glyph_get_layers(lua_State *L) {
if (color_index != 0xFFFF)
color_index++; // make it 1-indexed
- lua_pushnumber(L, i+1); // 1-indexed key parent table
+ lua_pushnumber(L, offset + i + 1); // 1-indexed key parent table
lua_createtable(L, 0, 2); // child table
lua_pushinteger(L, layer.glyph);
diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
index 2cf5e812739..d0f4858f4d7 100644
--- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
+++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
@@ -1 +1 @@
-#define luatex_svn_revision 7172
+#define luatex_svn_revision 7195
diff --git a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
index 4c5e5d140ba..b3b55ce09ea 100644
--- a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
+++ b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
@@ -47,6 +47,7 @@ typedef enum {
buildpage_filter_callback,
hpack_filter_callback, vpack_filter_callback,
glyph_not_found_callback,
+ glyph_info_callback,
hyphenate_callback,
ligaturing_callback,
kerning_callback,
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.c b/Build/source/texk/web2c/luatexdir/tex/commands.c
index aceb0eb093d..f78d8bb612e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.c
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.c
@@ -900,6 +900,9 @@ void initialize_etex_commands(void)
primitive_etex("gluestretch", last_item_cmd, glue_stretch_code, 0);
primitive_etex("glueshrink", last_item_cmd, glue_shrink_code, 0);
+ primitive_luatex("eTeXgluestretchorder", last_item_cmd, eTeX_glue_stretch_order_code, 0);
+ primitive_luatex("eTeXglueshrinkorder", last_item_cmd, eTeX_glue_shrink_order_code, 0);
+
primitive_etex("mutoglue", last_item_cmd, mu_to_glue_code, 0);
primitive_etex("gluetomu", last_item_cmd, glue_to_mu_code, 0);
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h
index c3a3ca30452..7d7a7056564 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.h
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.h
@@ -187,6 +187,7 @@ typedef enum {
assign_box_dir_cmd, /* (\.{\\boxdir}) */
assign_direction_cmd, /* (\.{\\pagedirection}, \.{\\textdirection}) */
assign_dir_cmd, /* (\.{\\pagedir}, \.{\\textdir}) */
+ combine_toks_cmd,
# 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} ) */
@@ -217,7 +218,6 @@ typedef enum {
variable_cmd,
feedback_cmd,
the_cmd, /* expand an internal quantity ( \.{\\the} or \.{\\unexpanded}, \.{\\detokenize} ) */
- combine_toks_cmd,
top_bot_mark_cmd, /* inserted mark ( \.{\\topmark}, etc.~) */
call_cmd, /* non-long, non-outer control sequence */
long_call_cmd, /* long, non-outer control sequence */
@@ -307,6 +307,8 @@ typedef enum {
current_if_branch_code, /* code for \.{\\currentifbranch} */
glue_stretch_order_code, /* code for \.{\\gluestretchorder} */
glue_shrink_order_code, /* code for \.{\\glueshrinkorder} */
+ eTeX_glue_stretch_order_code, /* code for \.{\\eTeXgluestretchorder} */
+ eTeX_glue_shrink_order_code, /* code for \.{\\eTeXglueshrinkorder} */
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} */
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.c b/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
index 0091685fb74..78835d00f6e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
@@ -32,7 +32,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
*/
-#define FORMAT_ID (907+48)
+#define FORMAT_ID (907+51)
#if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
#error Wrong value for FORMAT_ID.
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.c b/Build/source/texk/web2c/luatexdir/tex/expand.c
index a0a317db238..bdf82c8c0da 100644
--- a/Build/source/texk/web2c/luatexdir/tex/expand.c
+++ b/Build/source/texk/web2c/luatexdir/tex/expand.c
@@ -261,9 +261,6 @@ void expand(void)
case the_cmd:
ins_the_toks();
break;
- case combine_toks_cmd:
- combine_the_toks(cur_chr);
- break;
case if_test_cmd:
/*tex An experiment. */
if (cur_chr == if_condition_code) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.c b/Build/source/texk/web2c/luatexdir/tex/inputstack.c
index c64111edc89..ad67ac24820 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.c
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.c
@@ -661,7 +661,7 @@ void begin_file_reading(void)
check_buffer_overflow(first);
incr(in_open);
push_input();
- iindex = (unsigned char) in_open;
+ iindex = (unsigned short)(in_open);
source_filename_stack[iindex] = 0;
full_source_filename_stack[iindex] = NULL;
eof_seen[iindex] = false;
@@ -696,6 +696,11 @@ void end_file_reading(void)
} else if (iname > 17) {
/*tex Forget it. */
lua_a_close_in(cur_file, 0);
+ source_filename_stack[iindex] = 0;
+ if (full_source_filename_stack[iindex] != NULL) {
+ free(full_source_filename_stack[iindex]);
+ full_source_filename_stack[iindex] = NULL;
+ }
}
pop_input();
decr(in_open);
diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.h b/Build/source/texk/web2c/luatexdir/tex/inputstack.h
index 8c139a8332e..0c7669ff3c8 100644
--- a/Build/source/texk/web2c/luatexdir/tex/inputstack.h
+++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.h
@@ -32,12 +32,12 @@ typedef struct in_state_record {
halfword loc_field;
halfword limit_field;
halfword name_field;
- int synctex_tag_field; /* stack the tag of the current file */
- signed int cattable_field:16; /* category table used by the current line (see textoken.c) */
- quarterword state_field:8;
- quarterword index_field:8;
- boolean partial_field:8; /* is the current line partial? (see textoken.c) */
- boolean nofilter_field:8; /* used by token filtering */
+ int synctex_tag_field; /* stack the tag of the current file */
+ unsigned short state_field:16;
+ unsigned short index_field:16;
+ signed short cattable_field:16; /* category table used by the current line (see textoken.c) */
+ boolean partial_field:8; /* is the current line partial? (see textoken.c) */
+ boolean nofilter_field:8; /* used by token filtering */
} in_state_record;
extern in_state_record *input_stack;
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
index ef5fb64d601..f68f9e7ad76 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
@@ -991,6 +991,7 @@ static void init_main_control (void) {
/* any_mode(lua_expandable_call_cmd, run_lua_call); */ /* no! outside jump table anyway, handled in expand() */
any_mode(node_cmd, run_node);
+ any_mode(combine_toks_cmd, combine_the_toks);
}
/*tex
@@ -1041,8 +1042,6 @@ We assume a trailing relax: |{...}\relax|, so we don't need a |back_input()| her
*/
-/*int local_level = 0; */
-
extern void local_control_message(const char *s)
{
tprint("local control level ");
@@ -1052,11 +1051,29 @@ extern void local_control_message(const char *s)
tprint_nl("");
}
+/*tex Note for me (HH): in luametatex I have the option to use the save stack which for
+ some experiments seems to work better. But I'll probably not go forward with
+ some intended extension anyway (too messy), so we're currently in sync.
+ Instead there are now two optional parameters in |runtoks|, plus a |quittoks|
+ companion. I also added some more tracing as well as a warning when we jump
+ out of control too often.
+*/
+
void local_control(void)
{
+ /*tex Wrr to saving the state local_control is like some of the conv_toks which
+ is not entirely correct but good enough for now. Future extensions might
+ demand another solution.
+ */
+ int save_scanner_status = scanner_status;
+ halfword save_def_ref = def_ref;
+ halfword save_warning_index = warning_index;
int ll = local_level;
main_control_state = goto_next;
local_level += 1;
+ if (tracing_nesting_par > 2) {
+ local_control_message("entering local control");
+ }
while (1) {
if (main_control_state == goto_skip_token) {
main_control_state = goto_next;
@@ -1075,22 +1092,32 @@ void local_control(void)
if (local_level <= ll) {
main_control_state = goto_next;
if (tracing_nesting_par > 2) {
- local_control_message("leaving due to level change");
+ local_control_message("leaving local control due to level change");
}
- return ;
+ break;
} else if (main_control_state == goto_return) {
if (tracing_nesting_par > 2) {
- local_control_message("leaving due to triggering");
+ local_control_message("leaving local control due to triggering");
}
- return;
+ break;
}
}
- return;
+ /*tex From the perspective of ending and changing the level this is the
+ wrong spot, as it should be done in |end_local_control| in which case
+ we should use the save stack. Maybe some day.
+ */
+ scanner_status = save_scanner_status;
+ def_ref = save_def_ref;
+ warning_index = save_warning_index;
}
void end_local_control(void )
{
- local_level -= 1;
+ if (local_level > 0) {
+ local_level -= 1;
+ } else {
+ local_control_message("redundant end local control");
+ }
}
/*tex
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.c b/Build/source/texk/web2c/luatexdir/tex/printing.c
index 70bf1fc4148..c85a6a5323c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.c
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.c
@@ -1005,9 +1005,33 @@ void print_font_identifier(internal_font_number f)
}
/*tex
+ We could do this much nicer but then we need to also adapt short_display a
+ bit and we have to be as compatible as possible in the log for some macro
+ packages.
-This prints highlights of list |p|.
+ The callback is also responsible for either or not reporting the character
+ number itself.
+*/
+void print_character_info(halfword p)
+{
+ int callback_id = callback_defined(glyph_info_callback);
+ if (callback_id) {
+ char* str = NULL;
+ run_callback(callback_id, "N->R", p, &str);
+ if (str == NULL) {
+ print_qhex(character(p));
+ } else {
+ tprint(str);
+ free(str);
+ }
+ } else {
+ print(character(p));
+ }
+}
+
+/*tex
+ This prints highlights of list |p|.
*/
void short_display(int p)
@@ -1018,14 +1042,15 @@ void short_display(int p)
short_display(lig_ptr(p));
} else {
if (font(p) != font_in_short_display) {
- if (!is_valid_font(font(p)))
+ if (!is_valid_font(font(p))) {
print_char('*');
- else
+ } else {
print_font_identifier(font(p));
+ }
print_char(' ');
font_in_short_display = font(p);
}
- print(character(p));
+ print_character_info(p);
}
} else {
/*tex Print a short indication of the contents of node |p| */
@@ -1056,7 +1081,7 @@ void print_font_and_char(int p)
else
print_font_identifier(font(p));
print_char(' ');
- print(character(p));
+ print_character_info(p);
}
/*tex
@@ -1154,7 +1179,7 @@ void short_display_n(int p, int m)
print_char(' ');
font_in_short_display = font(p);
}
- print(character(p));
+ print_character_info(p);
}
} else {
if ( (type(p) == glue_node) ||
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.h b/Build/source/texk/web2c/luatexdir/tex/printing.h
index 79ca524ef6f..e54186a2710 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.h
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.h
@@ -127,4 +127,6 @@ extern void begin_diagnostic(void);
extern void end_diagnostic(boolean blank_line);
extern int global_old_setting;
+extern void print_character_info(halfword p);
+
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.c b/Build/source/texk/web2c/luatexdir/tex/scanning.c
index 8f7e1d59178..66f28a18b13 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.c
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.c
@@ -505,12 +505,18 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, boolea
break;
case glue_stretch_order_code:
case glue_shrink_order_code:
+ case eTeX_glue_stretch_order_code:
+ case eTeX_glue_shrink_order_code:
scan_normal_glue();
q = cur_val;
- if (m == glue_stretch_order_code)
+ if (m == glue_stretch_order_code || m == eTeX_glue_stretch_order_code) {
cur_val = stretch_order(q);
- else
+ } else {
cur_val = shrink_order(q);
+ }
+ if (cur_val && (m == eTeX_glue_stretch_order_code || m == eTeX_glue_shrink_order_code)) {
+ cur_val = (cur_val == 1) ? - 1 : cur_val - 1;
+ }
flush_node(q);
break;
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.c b/Build/source/texk/web2c/luatexdir/tex/texmath.c
index 7f1f1296d33..67f352d40fc 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.c
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.c
@@ -461,6 +461,7 @@ const char *math_param_names[] = {
"stackvgap", "stacknumup", "stackdenomdown",
"fractionrule", "fractionnumvgap", "fractionnumup",
"fractiondenomvgap", "fractiondenomdown", "fractiondelsize",
+ "skewedfractionhgap", "skewedfractionvgap",
"limitabovevgap", "limitabovebgap", "limitabovekern",
"limitbelowvgap", "limitbelowbgap", "limitbelowkern",
"nolimitsubfactor", "nolimitsupfactor", /* bonus */
@@ -2621,7 +2622,7 @@ void after_math(void)
}
run_mlist_to_hlist(p, (mode > 0), text_style);
try_couple_nodes(tail,vlink(temp_head));
-
+
while (vlink(tail) != null) {
tail = vlink(tail);
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c
index d6c16890649..609eae8104b 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.c
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c
@@ -2352,8 +2352,9 @@ void ins_the_toks(void)
*/
-void combine_the_toks(int how)
+void combine_the_toks(void)
{
+ halfword how = cur_chr;
halfword source = null;
halfword target = null;
halfword append = (how == 0) || (how == 1) || (how == 4) || (how == 5);
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h
index 4b33b099ab3..248a12168cf 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.h
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.h
@@ -150,7 +150,7 @@ 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 void combine_the_toks(int how);
+extern void combine_the_toks(void);
extern int scan_lua_state(void);