diff options
Diffstat (limited to 'source/luametatex/source/lua/lmttokenlib.c')
-rw-r--r-- | source/luametatex/source/lua/lmttokenlib.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c index feac7cd46..e15b2de5a 100644 --- a/source/luametatex/source/lua/lmttokenlib.c +++ b/source/luametatex/source/lua/lmttokenlib.c @@ -347,23 +347,16 @@ inline static int tokenlib_aux_to_valid_index(int cmd, int chr) case internal_command_item: case reference_command_item: case data_command_item: - { - halfword c = chr; - switch (item.base) { - case ignore_entry: - return 0; - case direct_entry: - break; - default: - chr -= item.base; - break; - } - if (c >= item.min && c <= item.max) { - return c; - } else { - return item.min; - } + switch (item.base) { + case ignore_entry: + return 0; + case direct_entry: + break; + default: + chr -= item.base; + break; } + return (chr >= item.min && chr <= item.max) ? chr : item.min; case token_command_item: case node_command_item: return item.fixedvalue; @@ -2147,7 +2140,7 @@ static int tokenlib_future_expand(lua_State *L) return 0; } } - return 0; + // return 0; } static int tokenlib_scan_code(lua_State *L) @@ -2735,8 +2728,9 @@ static int tokenlib_get_fields(lua_State *L) size_t l; const char *str = lua_tolstring(L, 1, &l); if (l > 0) { + halfword cs; lua_createtable(L, 0, onlyflags ? 0 : 5); - halfword cs = tex_string_locate(str, l, 0); + cs = tex_string_locate(str, l, 0); cmd = eq_type(cs); chr = eq_value(cs); flags = eq_flag(cs); @@ -3174,10 +3168,11 @@ static int tokenlib_set_lua(lua_State *L) size_t lname = 0; const char *name = lua_tolstring(L, 1, &lname); if (name) { + halfword cs; int flags = 0; int funct = lmt_tointeger(L, 2); /*tex todo: check range */ lmt_check_for_flags(L, 3, &flags, 1, 1); - halfword cs = tex_string_locate(name, lname, 1); + cs = tex_string_locate(name, lname, 1); if (tex_define_permitted(cs, flags)) { if (is_value(flags)) { tex_define(flags, cs, lua_value_cmd, funct); |