diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-07-08 06:07:11 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-07-08 06:07:11 +0000 |
commit | f93b62903a20648ab4328443b88495da81f70909 (patch) | |
tree | 6a870996cc04dca9a1ae3dbbc334b4c2a1385711 /Build/source/texk/web2c/luatexdir/lua | |
parent | 54d39e16610eee4dde770b0a6b569203c79abde8 (diff) |
sync with luatex rev.7174: luatex and luahbtex and jit variants
git-svn-id: svn://tug.org/texlive/trunk@51577 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/limglib.c | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c | 26 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/ltexlib.c | 36 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luastuff.c | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luatex-api.h | 21 |
5 files changed, 73 insertions, 16 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index 76c96bfb316..734e591a4d3 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -729,7 +729,8 @@ static void lua_to_image(lua_State * L, image * a, image_dict * d) img_type(d) = IMG_TYPE_PDFSTREAM; } } else { - luaL_error(L, "img.%s can not be set", s); + /*tex Let's be a bit more tolerant to adding private keys. */ + /* luaL_error(L, "img.%s can not be set", s); */ } } diff --git a/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c b/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c index 1c2bd8533f0..a50ea2f20d9 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c @@ -812,34 +812,40 @@ inline static int lua_tokenlib_get_command(lua_State * L) inline static int lua_tokenlib_get_index(lua_State * L) { + int cmd, chr; lua_token *n = check_istoken(L, 1); halfword t = token_info(n->token); - int cmd = (t >= cs_token_flag ? eq_type(t - cs_token_flag) : token_cmd(t)); - halfword e = equiv(t - cs_token_flag); + if (t >= cs_token_flag) { + cmd = eq_type(t - cs_token_flag); + chr = equiv(t - cs_token_flag); + } else { + cmd = token_cmd(t); + chr = token_chr(t); + } switch (cmd) { case assign_int_cmd: - e -= count_base; + chr -= count_base; break; case assign_attr_cmd: - e -= attribute_base; + chr -= attribute_base; break; case assign_dimen_cmd: - e -= dimen_base; + chr -= scaled_base; break; case assign_glue_cmd: - e -= skip_base; + chr -= skip_base; break; case assign_mu_glue_cmd: - e -= mu_skip_base; + chr -= mu_skip_base; break; case assign_toks_cmd: - e -= toks_base; + chr -= toks_base; break; default: break; } - if ((e >= 0) && (e <= 65535)) { - lua_pushinteger(L, e); + if (chr >= 0 && chr <= 65535) { + lua_pushinteger(L, chr); } else { lua_pushnil(L); } diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index c3e459b2211..9dc9350b5c6 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -1781,7 +1781,7 @@ static int getdelcodes(lua_State * L) static int settex(lua_State * L) { const char *st; - int texstr; + int texstr, isprim; size_t k; int cur_cs1, cur_cmd1; int isglobal = 0; @@ -1814,7 +1814,9 @@ static int settex(lua_State * L) return 0; } texstr = maketexlstring(st, k); - if (is_primitive(texstr)) { + isprim = is_primitive(texstr); + flush_str(texstr); + if (isprim) { if (i == 3 && (lua_type(L,1) == LUA_TSTRING)) { const char *s = lua_tostring(L, 1); if (lua_key_eq(s,global)) @@ -2545,7 +2547,7 @@ static int tex_definefont(lua_State * L) { const char *csname; int f, u; - str_number t; + str_number t, d; size_t l; int i = 1; int a = 0; @@ -2559,7 +2561,6 @@ static int tex_definefont(lua_State * L) } csname = luaL_checklstring(L, i, &l); f = luaL_checkinteger(L, (i + 1)); - t = maketexlstring(csname, l); no_new_control_sequence = 0; u = string_lookup(csname, l); no_new_control_sequence = 1; @@ -2568,7 +2569,32 @@ static int tex_definefont(lua_State * L) else eq_define(u, set_font_cmd, f); eqtb[font_id_base + f] = eqtb[u]; - hash_text(font_id_base + f) = t; + /*tex + + This is tricky: when we redefine a string we loose the old one. So this + will change as it's only used to display the |\fontname| so we can store + that with the font. + + */ + d = cs_text(font_id_base + f); + t = maketexlstring(csname, l); /* the csname */ + if (!d) { + /*tex We have a new string. */ + cs_text(font_id_base + f) = t; + } else if ((d!=t) && str_eq_str(d,t)){ + /*tex We have a duplicate string. */ + flush_str(t); + } else if(d!=t){ + d = search_string(t); + if (d) { + /*tex We have already such a string. */ + cs_text(font_id_base + f) = d; + flush_str(t); + } else { + /*tex The old value is lost but still in the pool. */ + cs_text(font_id_base + f) = t; + } + } return 0; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.c b/Build/source/texk/web2c/luatexdir/lua/luastuff.c index cf2b1684431..fb05c60dd1f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luastuff.c +++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.c @@ -189,6 +189,9 @@ static const luaL_Reg lualibs[] = { #endif { "ffi", luaopen_ffi }, /*tex more libraries will be loaded later */ +#ifdef LUATEX_HARFBUZZ_ENABLED + { "luaharfbuzz", luaopen_luaharfbuzz }, +#endif { NULL, NULL } }; diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index c662e76b983..d54bd84663f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -50,12 +50,29 @@ extern void fix_o_mode(void); # include "lualib.h" #ifdef LuajitTeX # include "luajit.h" +#endif + +/* Names */ +#ifndef LUATEX_HARFBUZZ_ENABLED +#ifdef LuajitTeX # define MyName "LuajitTeX" # define my_name "luajittex" #else # define MyName "LuaTeX" # define my_name "luatex" #endif +#endif + +#ifdef LUATEX_HARFBUZZ_ENABLED +#ifdef LuajitTeX +# define MyName "LuajitHBTeX" +# define my_name "luajithbtex" +#else +# define MyName "LuaHBTeX" +# define my_name "luahbtex" +#endif +#endif + #ifdef __cplusplus extern "C" { @@ -94,6 +111,10 @@ extern int luaopen_sha2(lua_State * L); extern int luaopen_ffi(lua_State * L); #endif +#ifdef LUATEX_HARFBUZZ_ENABLED +extern int luaopen_luaharfbuzz(lua_State * L); +#endif + extern int luaopen_zlib(lua_State * L); extern int luaopen_gzip(lua_State * L); extern int luaopen_ff(lua_State * L); |