From 6ac21981b4f6eb6bd37dc4f85f9b6710b0f0575e Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 18 Dec 2015 23:17:39 +0000 Subject: web2c/luatexdir: Sync with the upstream. git-svn-id: svn://tug.org/texlive/trunk@39142 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/lua/lnodelib.c | 89 ++++++++++++++++++++++- Build/source/texk/web2c/luatexdir/tex/mathcodes.w | 25 +++++-- Build/source/texk/web2c/luatexdir/tex/scanning.w | 34 +++++++++ Build/source/texk/web2c/luatexdir/tex/texmath.w | 3 +- Build/source/texk/web2c/luatexdir/tex/textcodes.w | 12 ++- 5 files changed, 148 insertions(+), 15 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index fcd5d994baa..03033273fa0 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -543,6 +543,15 @@ static int lua_nodelib_direct_getsubtype(lua_State * L) return 1; } +static int lua_nodelib_direct_setsubtype(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if ((n != null) && (lua_type(L,2) == LUA_TNUMBER)) { + subtype(n) = (halfword) lua_tointeger(L, 2); + } + return 0; +} + /* node.getfont */ static int lua_nodelib_getfont(lua_State * L) @@ -665,7 +674,6 @@ static int lua_nodelib_direct_getcharacter(lua_State * L) /* node.getdisc */ - static int lua_nodelib_direct_getdiscretionary(lua_State * L) { halfword n = lua_tointeger(L, 1); @@ -689,13 +697,38 @@ static int lua_nodelib_direct_getdiscretionary(lua_State * L) return 1; } +static int lua_nodelib_getdiscretionary(lua_State * L) +{ + halfword *a; + halfword *n = lua_touserdata(L, 1); + if (n != NULL) { + if (type(*n) == disc_node) { + fast_metatable_or_nil(vlink(pre_break(*n))); + fast_metatable_or_nil(vlink(post_break(*n))); + fast_metatable_or_nil(vlink(no_break(*n))); + if (lua_isboolean(L, 2)) { + if (lua_toboolean(L, 2)) { + fast_metatable_or_nil(tlink(pre_break(*n))); + fast_metatable_or_nil(tlink(post_break(*n))); + fast_metatable_or_nil(tlink(no_break(*n))); + return 6; + } + } + return 3; + } + } + lua_pushnil(L); + return 1; +} + + /* node.getlist */ static int lua_nodelib_getlist(lua_State * L) { halfword *a; halfword *n = lua_touserdata(L, 1); - if ( (n == NULL) || (! lua_getmetatable(L,1)) ) { + if ((n == NULL) || (! lua_getmetatable(L,1))) { lua_pushnil(L); } else if ((type(*n) == hlist_node) || (type(*n) == vlist_node)) { fast_metatable_or_nil_alink(list_ptr(*n)); @@ -705,6 +738,24 @@ static int lua_nodelib_getlist(lua_State * L) return 1; } +/* + +static int lua_nodelib_setlist(lua_State * L) +{ + halfword *n = lua_touserdata(L, 1); + if ((n != null) && ((type(n) == hlist_node) || (type(n) == vlist_node))) { + if (lua_type(L,2) == LUA_TNIL) { + list_ptr(n) = null; + } else { + halfword *l = lua_touserdata(L, 2); + list_ptr(n) = l; + } + } + return 0; +} + +*/ + /* node.direct.getlist */ static int lua_nodelib_direct_getlist(lua_State * L) @@ -720,6 +771,19 @@ static int lua_nodelib_direct_getlist(lua_State * L) return 1; } +static int lua_nodelib_direct_setlist(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if ((n != null) && ((type(n) == hlist_node) || (type(n) == vlist_node))) { + if (lua_type(L,2) == LUA_TNUMBER) { + list_ptr(n) = (halfword) lua_tointeger(L, 2); + } else { + list_ptr(n) = null; + } + } + return 0; +} + /* node.getleader */ static int lua_nodelib_getleader(lua_State * L) @@ -751,6 +815,19 @@ static int lua_nodelib_direct_getleader(lua_State * L) return 1; } +static int lua_nodelib_direct_setleader(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if ((n != null) && (type(n) == glue_node)) { + if (lua_type(L,2) == LUA_TNUMBER) { + leader_ptr(n) = (halfword) lua_tointeger(L, 2); + } else { + leader_ptr(n) = null; + } + } + return 0; +} + /* node.getnext */ static int lua_nodelib_getnext(lua_State * L) @@ -6788,6 +6865,9 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"setprev", lua_nodelib_direct_setprev}, {"setboth", lua_nodelib_direct_setboth}, {"setlink", lua_nodelib_direct_setlink}, + {"setlist", lua_nodelib_direct_setlist}, + {"setleader", lua_nodelib_direct_setleader}, + {"setsubtype", lua_nodelib_direct_setsubtype}, {"slide", lua_nodelib_direct_slide}, /* {"subtype", lua_nodelib_subtype}, */ /* no node argument */ {"tail", lua_nodelib_direct_tail}, @@ -6835,14 +6915,15 @@ static const struct luaL_Reg nodelib_f[] = { {"getnext", lua_nodelib_getnext}, {"getprev", lua_nodelib_getprev}, {"getboth", lua_nodelib_getboth}, + {"getdisc", lua_nodelib_getdiscretionary}, {"getlist", lua_nodelib_getlist}, {"getleader", lua_nodelib_getleader}, {"getid", lua_nodelib_getid}, - {"getfield", lua_nodelib_getfield}, - {"setfield", lua_nodelib_setfield}, {"getsubtype", lua_nodelib_getsubtype}, {"getfont", lua_nodelib_getfont}, {"getchar", lua_nodelib_getcharacter}, + {"getfield", lua_nodelib_getfield}, + {"setfield", lua_nodelib_setfield}, {"has_glyph", lua_nodelib_has_glyph}, {"has_attribute", lua_nodelib_has_attribute}, {"get_attribute", lua_nodelib_get_attribute}, diff --git a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w index b9ac4905f7d..062e271055a 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mathcodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/mathcodes.w @@ -27,8 +27,10 @@ static sa_tree mathcode_head = NULL; /* the 0xFFFFFFFF is a flag value */ + #define MATHCODESTACK 8 #define MATHCODEDEFAULT 0xFFFFFFFF +#define MATHCODEACTIVE 0xFFFFFFFE @ delcodes @c @@ -127,9 +129,13 @@ static void unsavemathcode(quarterword gl) void set_math_code(int n, int mathclass, int mathfamily, int mathcharacter, quarterword level) { sa_tree_item v; - v.math_code_value.class_value = mathclass; - v.math_code_value.family_value = mathfamily; - v.math_code_value.character_value = mathcharacter; + if (mathclass == 8 && mathfamily == 0 && mathcharacter == 0) { + v.uint_value = MATHCODEACTIVE; + } else { + v.math_code_value.class_value = mathclass; + v.math_code_value.family_value = mathfamily; + v.math_code_value.character_value = mathcharacter; + } set_sa_item(mathcode_head, n, v, level); if (int_par(tracing_assigns_code) > 1) { begin_diagnostic(); @@ -153,10 +159,19 @@ mathcodeval get_math_code(int n) d.class_value = 0; d.family_value = 0; d.character_value = n; + } else if (v.uint_value == MATHCODEACTIVE) { + d.class_value = 8; + d.family_value = 0; + d.character_value = 0; } else { d.class_value = v.math_code_value.class_value; - d.family_value = v.math_code_value.family_value; - d.character_value = v.math_code_value.character_value; + if (d.class_value == 8) { + d.family_value = 0; + d.character_value = n; + } else { + d.family_value = v.math_code_value.family_value; + d.character_value = v.math_code_value.character_value; + } } return d; } diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w index 635ea03e2e2..0a9276c7db7 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.w +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w @@ -795,7 +795,41 @@ void scan_something_internal(int level, boolean negative) goto RESTART; } break; + case hyph_data_cmd: + switch (cur_chr) { + case 0: + case 1: + goto DEFAULT; + break; + case 2: + cur_val = get_pre_hyphen_char(int_par(language_code)); + cur_val_level = int_val_level; + break; + case 3: + cur_val = get_post_hyphen_char(int_par(language_code)); + cur_val_level = int_val_level; + break; + case 4: + cur_val = get_pre_exhyphen_char(int_par(language_code)); + cur_val_level = int_val_level; + break; + case 5: + cur_val = get_post_exhyphen_char(int_par(language_code)); + cur_val_level = int_val_level; + break; + case 6: + cur_val = get_hyphenation_min(int_par(language_code)); + cur_val_level = int_val_level; + break; + case 7: + scan_int(); + cur_val = get_hj_code(int_par(language_code),cur_val); + cur_val_level = int_val_level; + break; + } + break; default: + DEFAULT: /* Complain that \.{\\the} can not do this; give zero result */ print_err("You can't use `"); print_cmd_chr((quarterword) cur_cmd, cur_chr); diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w index 676f4262b21..16224f09ff0 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.w +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w @@ -1100,8 +1100,7 @@ static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass) NULL }; delcodeval d; - int mcls, msfam = 0, mschr = 0, mlfam = 0, mlchr = 0; - mcls = 0; + int mcls = 0, msfam = 0, mschr = 0, mlfam = 0, mlchr = 0; if (extcode == tex_mathcode) { /* \.{\\delcode}, this is the easiest */ scan_int(); /* "MFCCFCC or "FCCFCC */ diff --git a/Build/source/texk/web2c/luatexdir/tex/textcodes.w b/Build/source/texk/web2c/luatexdir/tex/textcodes.w index 8a4fbb949c5..5868716201b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textcodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/textcodes.w @@ -362,15 +362,19 @@ but management is then upto the used, so no: static void initializehjcodes(void) { - sa_tree_item sa_value = { 0 }; + /* + sa_tree_item sa_value = { 0 }; + */ hjcode_max = 0; hjcode_heads = Mxmalloc_array(sa_tree, (HJCODE_MAX + 1)); hjcode_valid = Mxmalloc_array(unsigned char, (HJCODE_MAX + 1)); memset(hjcode_heads, 0, sizeof(sa_tree) * (HJCODE_MAX + 1)); memset(hjcode_valid, 0, sizeof(unsigned char) * (HJCODE_MAX + 1)); - hjcode_valid[0] = 1; - sa_value.int_value = HJCODEDEFAULT; - hjcode_heads[0] = new_sa_tree(HJCODESTACK, 1, sa_value); + /* + hjcode_valid[0] = 1; + sa_value.int_value = HJCODEDEFAULT; + hjcode_heads[0] = new_sa_tree(HJCODESTACK, 1, sa_value); + */ } void hj_codes_from_lc_codes(int h) -- cgit v1.2.3