diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
20 files changed, 2473 insertions, 1377 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h b/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h index 057b5ee9605..eec88e976c9 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h +++ b/Build/source/texk/web2c/luatexdir/lua/lauxlib_bridge.h @@ -44,5 +44,18 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op); #define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) - +/* Is this ok as replacement for lua_copy of lua 5.2.3 ? */ +/* +#if defined(LUAJIT) +LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { + TValue *fr, *to; + lua_lock(L); + fr = index2adr(L, fromidx); + to = index2adr(L, toidx); + api_checkvalidindex(L, to); + copyTV(L,to,fr); + lua_unlock(L); +} +#endif +*/ #endif diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 68c35420350..54a7b7602ff 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -21,7 +21,7 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: lcallbacklib.c 4703 2013-12-31 15:53:26Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; + "$Id: lcallbacklib.c 4877 2014-03-14 01:26:05Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lcallbacklib.c $"; int callback_count = 0; int saved_callback_count = 0; @@ -65,6 +65,7 @@ static const char *const callbacknames[] = { "post_linebreak_filter", "mlist_to_hlist", "finish_pdffile", + "finish_pdfpage", "pre_dump", NULL }; diff --git a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc index d60feb09160..f83a2acf00b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/Build/source/texk/web2c/luatexdir/lua/lepdflib.cc @@ -19,7 +19,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lepdflib.cc 4718 2014-01-02 15:35:31Z taco $ " + "$Id: lepdflib.cc 4847 2014-03-05 18:13:17Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lepdflib.cc $"; #include "image/epdf.h" @@ -48,26 +48,26 @@ static const char *ErrorCodeNames[] = { "None", "OpenFile", "BadCatalog", //********************************************************************** -#define M_Annot "Annot" -#define M_Annots "Annots" -#define M_Array "Array" -#define M_Catalog "Catalog" -#define M_Dict "Dict" -#define M_EmbFile "EmbFile" -#define M_FileSpec "FileSpec" -#define M_GooString "GooString" -#define M_LinkDest "LinkDest" -#define M_Link "Link" -#define M_Links "Links" -#define M_Object "Object" -#define M_Page "Page" -#define M_PDFDoc "PDFDoc" -#define M_PDFRectangle "PDFRectangle" -#define M_Ref "Ref" -#define M_Stream "Stream" -#define M_StructTreeRoot "StructTreeRoot" -#define M_XRefEntry "XRefEntry" -#define M_XRef "XRef" +#define M_Annot "epdf.Annot" /* ls-hh: epdf.* gives better protection in registry */ +#define M_Annots "epdf.Annots" +#define M_Array "epdf.Array" +#define M_Catalog "epdf.Catalog" +#define M_Dict "epdf.Dict" +#define M_EmbFile "epdf.EmbFile" +#define M_FileSpec "epdf.FileSpec" +#define M_GooString "epdf.GooString" +#define M_LinkDest "epdf.LinkDest" +#define M_Link "epdf.Link" +#define M_Links "epdf.Links" +#define M_Object "epdf.Object" +#define M_Page "epdf.Page" +#define M_PDFDoc "epdf.PDFDoc" +#define M_PDFRectangle "epdf.PDFRectangle" +#define M_Ref "epdf.Ref" +#define M_Stream "epdf.Stream" +#define M_StructTreeRoot "epdf.StructTreeRoot" +#define M_XRefEntry "epdf.XRefEntry" +#define M_XRef "epdf.XRef" //********************************************************************** diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c index a3454015b67..611cce83fbb 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c @@ -18,7 +18,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lfontlib.c 4728 2014-01-03 13:32:52Z oneiros $ " + "$Id: lfontlib.c 4847 2014-03-05 18:13:17Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lfontlib.c $"; #include "ptexlib.h" @@ -283,7 +283,7 @@ static const struct luaL_Reg fontlib[] = { int luaopen_font(lua_State * L) { luaL_register(L, "font", fontlib); - make_table(L, "fonts", "getfont", "setfont"); + make_table(L, "fonts", "tex.fonts", "getfont", "setfont"); return 1; } diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index 0fe471ca520..aedccf45298 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -18,7 +18,7 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: limglib.c 4718 2014-01-02 15:35:31Z taco $ " + "$Id: limglib.c 4847 2014-03-05 18:13:17Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/limglib.c $"; #include "ptexlib.h" @@ -29,7 +29,7 @@ static const char _svn_version[] = #include "lua.h" #include "lauxlib.h" -#define IMG_ENV "img_env" +#define IMG_ENV "image.env" /**********************************************************************/ diff --git a/Build/source/texk/web2c/luatexdir/lua/liolibext.c b/Build/source/texk/web2c/luatexdir/lua/liolibext.c index 6b9a602d541..bdcbc7ce2e0 100644 --- a/Build/source/texk/web2c/luatexdir/lua/liolibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/liolibext.c @@ -34,7 +34,7 @@ #endif static const char _svn_version[] = - "$Id: liolibext.c 4730 2014-01-03 14:44:14Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/liolibext.c $"; + "$Id: liolibext.c 4781 2014-02-10 11:05:24Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/liolibext.c $"; /* diff --git a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c index d00a07e8fb4..4822a60a38f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c @@ -29,7 +29,7 @@ #include <kpathsea/paths.h> static const char _svn_version[] = - "$Id: lkpselib.c 4634 2013-04-21 14:45:45Z hhenkel $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/lkpselib.c $"; + "$Id: lkpselib.c 4847 2014-03-05 18:13:17Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lkpselib.c $"; static const unsigned filetypes[] = { kpse_gf_format, @@ -153,7 +153,7 @@ static const char *const filetypenames[] = { }; -#define KPATHSEA_METATABLE "luatex_kpathsea" +#define KPATHSEA_METATABLE "luatex.kpathsea" /* set to 1 by the |program_name| function */ diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c index f27afcd916c..bc85196e551 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llualib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c @@ -21,7 +21,7 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: llualib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/llualib.c $"; + "$Id: llualib.c 4878 2014-03-14 10:48:03Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/llualib.c $"; #define LOAD_BUF_SIZE 256 #define UINT_MAX32 0xFFFFFFFF @@ -128,7 +128,7 @@ void undump_luac_registers(void) static void bytecode_register_shadow_set(lua_State * L, int k) { /* the stack holds the value to be set */ - lua_pushstring(L, "bytecode_shadow"); /* lua.bytecode_shadow */ + lua_pushstring(L, "lua.bytecode_shadow"); /* lua.bytecode_shadow */ lua_rawget(L, LUA_REGISTRYINDEX); if (lua_istable(L, -1)) { lua_pushvalue(L, -2); @@ -143,7 +143,7 @@ static int bytecode_register_shadow_get(lua_State * L, int k) { /* the stack holds the value to be set */ int ret = 0; - lua_pushstring(L, "bytecode_shadow"); + lua_pushstring(L, "lua.bytecode_shadow"); lua_rawget(L, LUA_REGISTRYINDEX); if (lua_istable(L, -1)) { lua_rawgeti(L, -1, k); @@ -306,6 +306,12 @@ static int get_luaname(lua_State * L) return 1; } +static int lua_functions_get_table(lua_State * L) /* hh */ +{ + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(lua_functions)); + lua_gettable(L, LUA_REGISTRYINDEX); + return 1; +} static const struct luaL_Reg lualib[] = { @@ -314,6 +320,7 @@ static const struct luaL_Reg lualib[] = { {"setluaname", set_luaname}, {"getbytecode", get_bytecode}, {"setbytecode", set_bytecode}, + {"get_functions_table",lua_functions_get_table}, /* *INDENT-ON* */ {NULL, NULL} /* sentinel */ }; @@ -321,10 +328,10 @@ static const struct luaL_Reg lualib[] = { int luaopen_lua(lua_State * L, char *fname) { luaL_register(L, "lua", lualib); - make_table(L, "bytecode", "getbytecode", "setbytecode"); - make_table(L, "name", "getluaname", "setluaname"); + make_table(L, "bytecode", "tex.bytecode", "getbytecode", "setbytecode"); + make_table(L, "name", "tex.name", "getluaname", "setluaname"); lua_newtable(L); - lua_setfield(L, LUA_REGISTRYINDEX, "bytecode_shadow"); + lua_setfield(L, LUA_REGISTRYINDEX, "lua.bytecode_shadow"); lua_pushstring(L, LUA_VERSION); lua_setfield(L, -2, "version"); if (fname == NULL) { diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 0a62151427d..ba623572641 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -96,11 +96,12 @@ */ static const char _svn_version[] = - "$Id: lnodelib.c 4775 2014-02-07 12:36:34Z luigi $ " + "$Id: lnodelib.c 4847 2014-03-05 18:13:17Z luigi $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lnodelib.c $"; #include "ptexlib.h" #include "lua/luatex-api.h" +#include "lua/lauxlib_bridge.h" /* @@ -109,25 +110,6 @@ static const char _svn_version[] = */ -#define init_luaS_index(a) do { \ - lua_pushliteral(L,#a); \ - luaS_##a##_ptr = lua_tostring(L,-1); \ - luaS_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ -} while (0) - -#define init_luaS_index_s(a,b) do { \ - lua_pushliteral(L,b); \ - luaS_##a##_ptr = lua_tostring(L,-1); \ - luaS_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \ -} while (0) - -#define make_luaS_index(a) \ - static int luaS_##a##_index = 0; \ - static const char * luaS_##a##_ptr = NULL - -#define luaS_index(a) luaS_##a##_index - -#define luaS_ptr_eq(a,b) (a==luaS_##b##_ptr) /* @@ -275,273 +257,11 @@ while (vlink(t)!=current && t != null) { \ luaL_error(L, "incorrect index value %d for tex.%s()", (int)j, s); \ } -#define NODE_METATABLE "luatex_node" +#define NODE_METATABLE "luatex.node" #define DEBUG 0 #define DEBUG_OUT stdout -make_luaS_index(luatex_node); - -make_luaS_index(accent); -make_luaS_index(action); -make_luaS_index(action_id); -make_luaS_index(action_type); -make_luaS_index(area); -make_luaS_index(attr); -make_luaS_index(best_ins_ptr); -make_luaS_index(bot_accent); -make_luaS_index(box_left); -make_luaS_index(box_left_width); -make_luaS_index(box_right); -make_luaS_index(box_right_width); -make_luaS_index(broken_ins); -make_luaS_index(broken_ptr); -make_luaS_index(char); -make_luaS_index(class); -make_luaS_index(command); -make_luaS_index(components); -make_luaS_index(cost); -make_luaS_index(count); -make_luaS_index(data); -make_luaS_index(degree); -make_luaS_index(delim); -make_luaS_index(denom); -make_luaS_index(depth); -make_luaS_index(dest_id); -make_luaS_index(dest_type); -make_luaS_index(dir); -make_luaS_index(dir_h); -make_luaS_index(display); -make_luaS_index(dvi_ptr); -make_luaS_index(expansion_factor); -make_luaS_index(ext); -make_luaS_index(fam); -make_luaS_index(fast); -make_luaS_index(file); -make_luaS_index(font); -make_luaS_index(global); -make_luaS_index(glue_order); -make_luaS_index(glue_set); -make_luaS_index(glue_sign); -make_luaS_index(glyph); -make_luaS_index(head); -make_luaS_index(height); -make_luaS_index(id); -make_luaS_index(index); -make_luaS_index(kern); -make_luaS_index(lang); -make_luaS_index(large_char); -make_luaS_index(large_fam); -make_luaS_index(last_ins_ptr); -make_luaS_index(leader); -make_luaS_index(left); -make_luaS_index(level); -make_luaS_index(link_attr); -make_luaS_index(list); -make_luaS_index(mark); -make_luaS_index(mode); -make_luaS_index(name); -make_luaS_index(named_id); -make_luaS_index(new_window); -make_luaS_index(next); -make_luaS_index(nucleus); -make_luaS_index(num); -make_luaS_index(number); -make_luaS_index(objnum); -make_luaS_index(pen_broken); -make_luaS_index(pen_inter); -make_luaS_index(penalty); -make_luaS_index(post); -make_luaS_index(pre); -make_luaS_index(prev); -make_luaS_index(ref_count); -make_luaS_index(reg); -make_luaS_index(replace); -make_luaS_index(right); -make_luaS_index(script); -make_luaS_index(scriptscript); -make_luaS_index(shift); -make_luaS_index(shrink); -make_luaS_index(shrink_order); -make_luaS_index(small_char); -make_luaS_index(small_fam); -make_luaS_index(spec); -make_luaS_index(stack); -make_luaS_index(stream); -make_luaS_index(stretch); -make_luaS_index(stretch_order); -make_luaS_index(string); -make_luaS_index(style); -make_luaS_index(sub); -make_luaS_index(subtype); -make_luaS_index(sup); -make_luaS_index(surround); -make_luaS_index(text); -make_luaS_index(thread_attr); -make_luaS_index(thread_id); -make_luaS_index(transform); -make_luaS_index(type); -make_luaS_index(uchyph); -make_luaS_index(user_id); -make_luaS_index(value); -make_luaS_index(width); -make_luaS_index(writable); -make_luaS_index(xoffset); -make_luaS_index(xyz_zoom); -make_luaS_index(yoffset); - -make_luaS_index(additional); -make_luaS_index(cal_expand_ratio); -make_luaS_index(exactly); -make_luaS_index(subst_ex_font); - -make_luaS_index(TLT); -make_luaS_index(TRT); -make_luaS_index(LTL); -make_luaS_index(RTT); - -make_luaS_index(pTLT); -make_luaS_index(pTRT); -make_luaS_index(pLTL); -make_luaS_index(pRTT); - -make_luaS_index(mTLT); -make_luaS_index(mTRT); -make_luaS_index(mLTL); -make_luaS_index(mRTT); - -static void initialize_luaS_indexes(lua_State * L) -{ - init_luaS_index(luatex_node); - - init_luaS_index(accent); - init_luaS_index(action_id); - init_luaS_index(action); - init_luaS_index(action_type); - init_luaS_index(area); - init_luaS_index(attr); - init_luaS_index(best_ins_ptr); - init_luaS_index(bot_accent); - init_luaS_index(box_left); - init_luaS_index(box_left_width); - init_luaS_index(box_right); - init_luaS_index(box_right_width); - init_luaS_index(broken_ins); - init_luaS_index(broken_ptr); - init_luaS_index(char); - init_luaS_index(class); - init_luaS_index(command); - init_luaS_index(components); - init_luaS_index(cost); - init_luaS_index(count); - init_luaS_index(data); - init_luaS_index(degree); - init_luaS_index(delim); - init_luaS_index(denom); - init_luaS_index(depth); - init_luaS_index(dest_id); - init_luaS_index(dest_type); - init_luaS_index(dir); - init_luaS_index(dir_h); - init_luaS_index(display); - init_luaS_index(dvi_ptr); - init_luaS_index(expansion_factor); - init_luaS_index(ext); - init_luaS_index(fam); - init_luaS_index(fast); - init_luaS_index(file); - init_luaS_index(font); - init_luaS_index(global); - init_luaS_index(glue_order); - init_luaS_index(glue_set); - init_luaS_index(glue_sign); - init_luaS_index(glyph); - init_luaS_index(head); - init_luaS_index(height); - init_luaS_index(id); - init_luaS_index(index); - init_luaS_index(kern); - init_luaS_index(lang); - init_luaS_index(large_char); - init_luaS_index(large_fam); - init_luaS_index(last_ins_ptr); - init_luaS_index(leader); - init_luaS_index(left); - init_luaS_index(level); - init_luaS_index(link_attr); - init_luaS_index(list); - init_luaS_index(mark); - init_luaS_index(mode); - init_luaS_index(name); - init_luaS_index(named_id); - init_luaS_index(new_window); - init_luaS_index(next); - init_luaS_index(nucleus); - init_luaS_index(num); - init_luaS_index(number); - init_luaS_index(objnum); - init_luaS_index(pen_broken); - init_luaS_index(pen_inter); - init_luaS_index(penalty); - init_luaS_index(post); - init_luaS_index(pre); - init_luaS_index(prev); - init_luaS_index(ref_count); - init_luaS_index(reg); - init_luaS_index(replace); - init_luaS_index(right); - init_luaS_index(script); - init_luaS_index(scriptscript); - init_luaS_index(shift); - init_luaS_index(shrink); - init_luaS_index(shrink_order); - init_luaS_index(small_char); - init_luaS_index(small_fam); - init_luaS_index(spec); - init_luaS_index(stack); - init_luaS_index(stream); - init_luaS_index(stretch); - init_luaS_index(stretch_order); - init_luaS_index(string); - init_luaS_index(style); - init_luaS_index(sub); - init_luaS_index(subtype); - init_luaS_index(sup); - init_luaS_index(surround); - init_luaS_index(text); - init_luaS_index(thread_attr); - init_luaS_index(thread_id); - init_luaS_index(transform); - init_luaS_index(type); - init_luaS_index(uchyph); - init_luaS_index(user_id); - init_luaS_index(value); - init_luaS_index(width); - init_luaS_index(writable); - init_luaS_index(xoffset); - init_luaS_index(xyz_zoom); - init_luaS_index(yoffset); - - init_luaS_index(additional); - init_luaS_index(cal_expand_ratio); - init_luaS_index(exactly); - init_luaS_index(subst_ex_font); - - init_luaS_index(TLT); - init_luaS_index(TRT); - init_luaS_index(LTL); - init_luaS_index(RTT); - init_luaS_index_s(pTLT,"+TLT"); - init_luaS_index_s(pTRT,"+TRT"); - init_luaS_index_s(pLTL,"+LTL"); - init_luaS_index_s(pRTT,"+RTT"); - init_luaS_index_s(mTLT,"-TLT"); - init_luaS_index_s(mTRT,"-TRT"); - init_luaS_index_s(mLTL,"-LTL"); - init_luaS_index_s(mRTT,"-RTT"); - -} - /* maybe these qualify as macros, not functions */ static halfword *maybe_isnode(lua_State * L, int ud) @@ -566,7 +286,7 @@ halfword *check_isnode(lua_State * L, int ud) halfword *p = maybe_isnode(L, ud); if (p != NULL) return p; - pdftex_fail("There should have been a lua <node> here, not an object with type %s!", luaL_typename(L, ud)); + luatex_fail("There should have been a lua <node> here, not an object with type %s!", luaL_typename(L, ud)); return NULL; } @@ -1349,7 +1069,7 @@ static int lua_nodelib_remove(lua_State * L) current = *(check_isnode(L, 2)); if (head == current) { if (alink(current)){ - vlink(alink(current)) = vlink(current); // vlink(prev) = next + vlink(alink(current)) = vlink(current); // vlink(prev) = next } if (vlink(current)){ alink( vlink(current)) = alink(current); // alink(next) = prev @@ -1401,7 +1121,7 @@ static int lua_nodelib_direct_remove(lua_State * L) } if (head == current) { if (alink(current)){ - vlink( alink(current) ) = vlink(current); // vlink(prev) = next + vlink( alink(current) ) = vlink(current); // vlink(prev) = next } if (vlink(current)){ alink( vlink(current) ) = alink(current); // alink(next) = prev @@ -1597,7 +1317,9 @@ static int lua_nodelib_direct_insert_after(lua_State * L) } /* node.copy_list */ - +/* hh-ls: we need to use an intermediate variable as otherwise target is used in the loop +and subfields get overwritten (or something like that) which results in crashes and +unexpected side effects */ static int lua_nodelib_copy_list(lua_State * L) { halfword n, s = null; @@ -1608,11 +1330,14 @@ static int lua_nodelib_copy_list(lua_State * L) if ((lua_gettop(L) > 1) && (!lua_isnil(L,2))) s = *check_isnode(L, 2); m = do_copy_node_list(n, s); - lua_pushnumber(L, m); - lua_nodelib_push(L); +// lua_pushnumber(L, m); +// lua_nodelib_push(L); + lua_nodelib_push_fast(L,m); return 1; + } + /* node.direct.copy_list */ static int lua_nodelib_direct_copy_list(lua_State * L) @@ -1742,13 +1467,13 @@ static int lua_nodelib_hpack(lua_State * L) if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { s = lua_tostring(L, 3); - if (luaS_ptr_eq(s, additional)) { + if (lua_key_eq(s, additional)) { m = 1; - } else if (luaS_ptr_eq(s, exactly)) { + } else if (lua_key_eq(s, exactly)) { m = 0; - } else if (luaS_ptr_eq(s, cal_expand_ratio)) { + } else if (lua_key_eq(s, cal_expand_ratio)) { m = 2; - } else if (luaS_ptr_eq(s, subst_ex_font)) { + } else if (lua_key_eq(s, subst_ex_font)) { m = 3; } else { luaL_error(L, "3rd argument should be either additional or exactly"); @@ -1789,13 +1514,13 @@ static int lua_nodelib_direct_hpack(lua_State * L) if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { s = lua_tostring(L, 3); - if (luaS_ptr_eq(s, additional)) { + if (lua_key_eq(s, additional)) { m = 1; - } else if (luaS_ptr_eq(s, exactly)) { + } else if (lua_key_eq(s, exactly)) { m = 0; - } else if (luaS_ptr_eq(s, cal_expand_ratio)) { + } else if (lua_key_eq(s, cal_expand_ratio)) { m = 2; - } else if (luaS_ptr_eq(s, subst_ex_font)) { + } else if (lua_key_eq(s, subst_ex_font)) { m = 3; } else { luaL_error(L, "3rd argument should be either additional or exactly"); @@ -1836,9 +1561,9 @@ static int lua_nodelib_vpack(lua_State * L) if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { s = lua_tostring(L, 3); - if (luaS_ptr_eq(s, additional)) { + if (lua_key_eq(s, additional)) { m = 1; - } else if (luaS_ptr_eq(s, exactly)) { + } else if (lua_key_eq(s, exactly)) { m = 0; } else { luaL_error(L, "3rd argument should be either additional or exactly"); @@ -1881,9 +1606,9 @@ static int lua_nodelib_direct_vpack(lua_State * L) if (lua_gettop(L) > 2) { if (lua_type(L, 3) == LUA_TSTRING) { s = lua_tostring(L, 3); - if (luaS_ptr_eq(s, additional)) { + if (lua_key_eq(s, additional)) { m = 1; - } else if (luaS_ptr_eq(s, exactly)) { + } else if (lua_key_eq(s, exactly)) { m = 0; } else { luaL_error(L, "3rd argument should be either additional or exactly"); @@ -2048,19 +1773,19 @@ static int get_node_field_id(lua_State * L, int n, int node) if (s == NULL) return -2; - if (luaS_ptr_eq(s, next)) { + if (lua_key_eq(s, next)) { return 0; - } else if (luaS_ptr_eq(s, id)) { + } else if (lua_key_eq(s, id)) { return 1; - } else if (luaS_ptr_eq(s, subtype)) { + } else if (lua_key_eq(s, subtype)) { if (nodetype_has_subtype(t)) { return 2; } - } else if (luaS_ptr_eq(s, attr)) { + } else if (lua_key_eq(s, attr)) { if (nodetype_has_attributes(t)) { return 3; } - } else if (luaS_ptr_eq(s, prev)) { + } else if (lua_key_eq(s, prev)) { if (nodetype_has_prev(t)) { return -1; } @@ -2070,7 +1795,7 @@ static int get_node_field_id(lua_State * L, int n, int node) if (t == whatsit_node) { fields = whatsit_node_data[subtype(node)].fields; } - if (luaS_ptr_eq(s, list)) { + if (lua_key_eq(s, list)) { /* head and list are equivalent; we don't catch extra virtual fields */ s = luaS_head_ptr; } @@ -2732,33 +2457,31 @@ static void lua_nodelib_getfield_whatsit(lua_State * L, int n, const char *s) t = subtype(n); if (t == dir_node) { - if (luaS_ptr_eq(s, dir)) { + if (lua_key_eq(s, dir)) { nodelib_pushdir(L, dir_dir(n), true); - } else if (luaS_ptr_eq(s, level)) { + } else if (lua_key_eq(s, level)) { lua_pushnumber(L, dir_level(n)); - } else if (luaS_ptr_eq(s, dvi_ptr)) { + } else if (lua_key_eq(s, dvi_ptr)) { lua_pushnumber(L, dir_dvi_ptr(n)); - } else if (luaS_ptr_eq(s, dir_h)) { + } else if (lua_key_eq(s, dir_h)) { lua_pushnumber(L, dir_dvi_h(n)); } else { lua_pushnil(L); } } else if (t == user_defined_node) { - if (luaS_ptr_eq(s, user_id)) { + if (lua_key_eq(s, user_id)) { lua_pushnumber(L, user_node_id(n)); - } else if (luaS_ptr_eq(s, type)) { + } else if (lua_key_eq(s, type)) { lua_pushnumber(L, user_node_type(n)); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { switch (user_node_type(n)) { case 'a': - /* fast_metatable(n) */ nodelib_pushlist(L, user_node_value(n)); break; case 'd': lua_pushnumber(L, user_node_value(n)); break; case 'n': - /* fast_metatable(n) */ nodelib_pushlist(L, user_node_value(n)); break; case 's': @@ -2775,29 +2498,29 @@ static void lua_nodelib_getfield_whatsit(lua_State * L, int n, const char *s) lua_pushnil(L); } } else if (t == local_par_node) { - if (luaS_ptr_eq(s, pen_inter)) { + if (lua_key_eq(s, pen_inter)) { lua_pushnumber(L, local_pen_inter(n)); - } else if (luaS_ptr_eq(s, pen_broken)) { + } else if (lua_key_eq(s, pen_broken)) { lua_pushnumber(L, local_pen_broken(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, local_par_dir(n), false); - } else if (luaS_ptr_eq(s, box_left)) { + } else if (lua_key_eq(s, box_left)) { /* can be: fast_metatable_or_nil(local_box_left(n)) */ nodelib_pushlist(L, local_box_left(n)); - } else if (luaS_ptr_eq(s, box_left_width)) { + } else if (lua_key_eq(s, box_left_width)) { lua_pushnumber(L, local_box_left_width(n)); - } else if (luaS_ptr_eq(s, box_right)) { + } else if (lua_key_eq(s, box_right)) { /* can be: fast_metatable_or_nil(local_box_right(n)) */ nodelib_pushlist(L, local_box_right(n)); - } else if (luaS_ptr_eq(s, box_right_width)) { + } else if (lua_key_eq(s, box_right_width)) { lua_pushnumber(L, local_box_right_width(n)); } else { lua_pushnil(L); } } else if (t == pdf_literal_node) { - if (luaS_ptr_eq(s, mode)) { + if (lua_key_eq(s, mode)) { lua_pushnumber(L, pdf_literal_mode(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { if (pdf_literal_type(n) == lua_refid_literal) { lua_rawgeti(Luas, LUA_REGISTRYINDEX, pdf_literal_data(n)); } else { @@ -2807,9 +2530,9 @@ static void lua_nodelib_getfield_whatsit(lua_State * L, int n, const char *s) lua_pushnil(L); } } else if (t == late_lua_node) { - if (luaS_ptr_eq(s, name)) { + if (lua_key_eq(s, name)) { tokenlist_to_luastring(L, late_lua_name(n)); - } else if (luaS_ptr_eq(s, data) || luaS_ptr_eq(s, string)) { + } else if (lua_key_eq(s, data) || lua_key_eq(s, string)) { if (late_lua_type(n) == lua_refid_literal) { lua_rawgeti(Luas, LUA_REGISTRYINDEX, late_lua_data(n)); } else { @@ -2819,154 +2542,154 @@ static void lua_nodelib_getfield_whatsit(lua_State * L, int n, const char *s) lua_pushnil(L); } } else if (t == pdf_annot_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_annot_objnum(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_annot_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_dest_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_dest_named_id(n)); - } else if (luaS_ptr_eq(s, dest_id)) { + } else if (lua_key_eq(s, dest_id)) { if (pdf_dest_named_id(n) == 1) tokenlist_to_luastring(L, pdf_dest_id(n)); else lua_pushnumber(L, pdf_dest_id(n)); - } else if (luaS_ptr_eq(s, dest_type)) { + } else if (lua_key_eq(s, dest_type)) { lua_pushnumber(L, pdf_dest_type(n)); - } else if (luaS_ptr_eq(s, xyz_zoom)) { + } else if (lua_key_eq(s, xyz_zoom)) { lua_pushnumber(L, pdf_dest_xyz_zoom(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_dest_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_setmatrix_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_setmatrix_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_colorstack_node) { - if (luaS_ptr_eq(s, stack)) { + if (lua_key_eq(s, stack)) { lua_pushnumber(L, pdf_colorstack_stack(n)); - } else if (luaS_ptr_eq(s, command)) { + } else if (lua_key_eq(s, command)) { lua_pushnumber(L, pdf_colorstack_cmd(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_colorstack_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_refobj_node) { - if (luaS_ptr_eq(s, objnum)) { + if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_obj_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_refxform_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_xform_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_refximage_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, transform)) { + } else if (lua_key_eq(s, transform)) { lua_pushnumber(L, pdf_ximage_transform(n)); - } else if (luaS_ptr_eq(s, index)) { + } else if (lua_key_eq(s, index)) { lua_pushnumber(L, pdf_ximage_index(n)); } else { lua_pushnil(L); } } else if (t == write_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_lua(L, write_tokens(n)); } else { lua_pushnil(L); } } else if (t == special_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, write_tokens(n)); } else { lua_pushnil(L); } } else if (t == pdf_start_link_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_link_objnum(n)); - } else if (luaS_ptr_eq(s, link_attr)) { + } else if (lua_key_eq(s, link_attr)) { tokenlist_to_luastring(L, pdf_link_attr(n)); - } else if (luaS_ptr_eq(s, action)) { + } else if (lua_key_eq(s, action)) { nodelib_pushaction(L, pdf_link_action(n)); } else { lua_pushnil(L); } } else if ((t == pdf_thread_node) || (t == pdf_start_thread_node)) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_thread_named_id(n)); - } else if (luaS_ptr_eq(s, thread_id)) { + } else if (lua_key_eq(s, thread_id)) { if (pdf_thread_named_id(n) == 1) { tokenlist_to_luastring(L, pdf_thread_id(n)); } else { lua_pushnumber(L, pdf_thread_id(n)); } - } else if (luaS_ptr_eq(s, thread_attr)) { + } else if (lua_key_eq(s, thread_attr)) { tokenlist_to_luastring(L, pdf_thread_attr(n)); } else { lua_pushnil(L); } } else if (t == open_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { nodelib_pushstring(L, open_name(n)); - } else if (luaS_ptr_eq(s, area)) { + } else if (lua_key_eq(s, area)) { nodelib_pushstring(L, open_area(n)); - } else if (luaS_ptr_eq(s, ext)) { + } else if (lua_key_eq(s, ext)) { nodelib_pushstring(L, open_ext(n)); } else { lua_pushnil(L); } } else if (t == close_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); } else { lua_pushnil(L); @@ -3033,13 +2756,13 @@ static int lua_nodelib_fast_getfield(lua_State * L) s = lua_tostring(L, 2); - if (luaS_ptr_eq(s, id)) { + if (lua_key_eq(s, id)) { lua_pushnumber(L, t); - } else if (luaS_ptr_eq(s, next)) { + } else if (lua_key_eq(s, next)) { fast_metatable_or_nil(vlink(n)); - } else if (luaS_ptr_eq(s, prev)) { + } else if (lua_key_eq(s, prev)) { fast_metatable_or_nil(alink(n)); - } else if (luaS_ptr_eq(s, attr)) { + } else if (lua_key_eq(s, attr)) { if (! nodetype_has_attributes(t)) { lua_pushnil(L); } else { @@ -3047,404 +2770,404 @@ static int lua_nodelib_fast_getfield(lua_State * L) } } else if (t == glyph_node) { /* candidates: fontchar (font,char) whd (width,height,depth) */ - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, font)) { + } else if (lua_key_eq(s, font)) { lua_pushnumber(L, font(n)); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { lua_pushnumber(L, character(n)); - } else if (luaS_ptr_eq(s, xoffset)) { + } else if (lua_key_eq(s, xoffset)) { lua_pushnumber(L, x_displace(n)); - } else if (luaS_ptr_eq(s, yoffset)) { + } else if (lua_key_eq(s, yoffset)) { lua_pushnumber(L, y_displace(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, char_width(font(n),character(n))); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, char_height(font(n),character(n))); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, char_depth(font(n),character(n))); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { lua_pushnumber(L, ex_glyph(n)); - } else if (luaS_ptr_eq(s, components)) { + } else if (lua_key_eq(s, components)) { fast_metatable_or_nil(lig_ptr(n)); - } else if (luaS_ptr_eq(s, lang)) { + } else if (lua_key_eq(s, lang)) { lua_pushnumber(L, char_lang(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { lua_pushnumber(L, char_lhmin(n)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { lua_pushnumber(L, char_rhmin(n)); - } else if (luaS_ptr_eq(s, uchyph)) { + } else if (lua_key_eq(s, uchyph)) { lua_pushnumber(L, char_uchyph(n)); } else { lua_pushnil(L); } } else if ((t == hlist_node) || (t == vlist_node)) { /* candidates: whd (width,height,depth) */ - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, list) || luaS_ptr_eq(s, head)) { + } else if (lua_key_eq(s, list) || lua_key_eq(s, head)) { fast_metatable_or_nil_alink(list_ptr(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, box_dir(n), false); - } else if (luaS_ptr_eq(s, shift)) { + } else if (lua_key_eq(s, shift)) { lua_pushnumber(L, shift_amount(n)); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { lua_pushnumber(L, glue_order(n)); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { lua_pushnumber(L, glue_sign(n)); - } else if (luaS_ptr_eq(s, glue_set)) { + } else if (lua_key_eq(s, glue_set)) { lua_pushnumber(L, (double) glue_set(n)); } else { lua_pushnil(L); } } else if (t == disc_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, pre)) { + } else if (lua_key_eq(s, pre)) { fast_metatable_or_nil(vlink(pre_break(n))); - } else if (luaS_ptr_eq(s, post)) { + } else if (lua_key_eq(s, post)) { fast_metatable_or_nil(vlink(post_break(n))); - } else if (luaS_ptr_eq(s, replace)) { + } else if (lua_key_eq(s, replace)) { fast_metatable_or_nil(vlink(no_break(n))); } else { lua_pushnil(L); } } else if (t == glue_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { nodelib_pushspec(L, glue_ptr(n)); - } else if (luaS_ptr_eq(s, leader)) { + } else if (lua_key_eq(s, leader)) { fast_metatable_or_nil(leader_ptr(n)); } else { lua_pushnil(L); } } else if (t == glue_spec_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, 0); /* dummy, the only one that prevents move up */ - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { lua_pushnumber(L, stretch(n)); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { lua_pushnumber(L, shrink(n)); - } else if (luaS_ptr_eq(s, stretch_order)) { + } else if (lua_key_eq(s, stretch_order)) { lua_pushnumber(L, stretch_order(n)); - } else if (luaS_ptr_eq(s, shrink_order)) { + } else if (lua_key_eq(s, shrink_order)) { lua_pushnumber(L, shrink_order(n)); - } else if (luaS_ptr_eq(s, ref_count)) { + } else if (lua_key_eq(s, ref_count)) { lua_pushnumber(L, glue_ref_count(n)); - } else if (luaS_ptr_eq(s, writable)) { + } else if (lua_key_eq(s, writable)) { lua_pushboolean(L, valid_node(n)); } else { lua_pushnil(L); } } else if (t == kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, kern)) { + } else if (lua_key_eq(s, kern)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { lua_pushnumber(L, ex_kern(n)); } else { lua_pushnil(L); } } else if (t == penalty_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, penalty)) { + } else if (lua_key_eq(s, penalty)) { lua_pushnumber(L, penalty(n)); } else { lua_pushnil(L); } } else if (t == rule_node) { /* candidates: whd (width,height,depth) */ - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, rule_dir(n), false); } else { lua_pushnil(L); } } else if (t == whatsit_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); } else { lua_nodelib_getfield_whatsit(L, n, s); } } else if (t == simple_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { fast_metatable_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { fast_metatable_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { fast_metatable_or_nil(supscr(n)); } else { lua_pushnil(L); } } else if ((t == math_char_node) || (t == math_text_char_node)) { /* candidates: famchar (fam,char) */ - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, fam)) { + } else if (lua_key_eq(s, fam)) { lua_pushnumber(L, math_fam(n)); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { lua_pushnumber(L, math_character(n)); } else { lua_pushnil(L); } } else if (t == mark_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, class)) { + } else if (lua_key_eq(s, class)) { lua_pushnumber(L, mark_class(n)); - } else if (luaS_ptr_eq(s, mark)) { + } else if (lua_key_eq(s, mark)) { tokenlist_to_lua(L, mark_ptr(n)); } else { lua_pushnil(L); } } else if (t == ins_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, cost)) { + } else if (lua_key_eq(s, cost)) { lua_pushnumber(L, float_cost(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { nodelib_pushspec(L, split_top_ptr(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { fast_metatable_or_nil_alink(ins_ptr(n)); } else { lua_pushnil(L); } } else if (t == math_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, surround)) { + } else if (lua_key_eq(s, surround)) { lua_pushnumber(L, surround(n)); } else { lua_pushnil(L); } } else if (t == fraction_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, thickness(n)); - } else if (luaS_ptr_eq(s, num)) { + } else if (lua_key_eq(s, num)) { fast_metatable_or_nil(numerator(n)); - } else if (luaS_ptr_eq(s, denom)) { + } else if (lua_key_eq(s, denom)) { fast_metatable_or_nil(denominator(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { fast_metatable_or_nil(left_delimiter(n)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { fast_metatable_or_nil(right_delimiter(n)); } else { lua_pushnil(L); } } else if (t == style_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, style)) { + } else if (lua_key_eq(s, style)) { lua_pushstring(L, math_style_names[subtype(n)]); } else { lua_pushnil(L); } } else if (t == accent_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { fast_metatable_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { fast_metatable_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { fast_metatable_or_nil(supscr(n)); - } else if (luaS_ptr_eq(s, accent)) { + } else if (lua_key_eq(s, accent)) { fast_metatable_or_nil(accent_chr(n)); - } else if (luaS_ptr_eq(s, bot_accent)) { + } else if (lua_key_eq(s, bot_accent)) { fast_metatable_or_nil(bot_accent_chr(n)); } else { lua_pushnil(L); } } else if (t == fence_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, delim)) { + } else if (lua_key_eq(s, delim)) { fast_metatable_or_nil(delimiter(n)); } else { lua_pushnil(L); } } else if (t == delim_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, small_fam)) { + } else if (lua_key_eq(s, small_fam)) { lua_pushnumber(L, small_fam(n)); - } else if (luaS_ptr_eq(s, small_char)) { + } else if (lua_key_eq(s, small_char)) { lua_pushnumber(L, small_char(n)); - } else if (luaS_ptr_eq(s, large_fam)) { + } else if (lua_key_eq(s, large_fam)) { lua_pushnumber(L, large_fam(n)); - } else if (luaS_ptr_eq(s, large_char)) { + } else if (lua_key_eq(s, large_char)) { lua_pushnumber(L, large_char(n)); } else { lua_pushnil(L); } } else if ((t == sub_box_node) || (t == sub_mlist_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ fast_metatable_or_nil_alink(math_list(n)); } else { lua_pushnil(L); } } else if (t == radical_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { fast_metatable_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { fast_metatable_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { fast_metatable_or_nil(supscr(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { fast_metatable_or_nil(left_delimiter(n)); - } else if (luaS_ptr_eq(s, degree)) { + } else if (lua_key_eq(s, degree)) { fast_metatable_or_nil(degree(n)); } else { lua_pushnil(L); } } else if (t == margin_kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, glyph)) { + } else if (lua_key_eq(s, glyph)) { fast_metatable_or_nil(margin_char(n)); } else { lua_pushnil(L); } } else if (t == split_up_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { fast_metatable_or_nil(last_ins_ptr(n)); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { fast_metatable_or_nil(best_ins_ptr(n)); - } else if (luaS_ptr_eq(s, broken_ptr)) { + } else if (lua_key_eq(s, broken_ptr)) { fast_metatable_or_nil(broken_ptr(n)); - } else if (luaS_ptr_eq(s, broken_ins)) { + } else if (lua_key_eq(s, broken_ins)) { fast_metatable_or_nil(broken_ins(n)); } else { lua_pushnil(L); } } else if (t == choice_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, display)) { + } else if (lua_key_eq(s, display)) { fast_metatable_or_nil(display_mlist(n)); - } else if (luaS_ptr_eq(s, text)) { + } else if (lua_key_eq(s, text)) { fast_metatable_or_nil(text_mlist(n)); - } else if (luaS_ptr_eq(s, script)) { + } else if (lua_key_eq(s, script)) { fast_metatable_or_nil(script_mlist(n)); - } else if (luaS_ptr_eq(s, scriptscript)) { + } else if (lua_key_eq(s, scriptscript)) { fast_metatable_or_nil(script_script_mlist(n)); } else { lua_pushnil(L); } } else if (t == inserting_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { fast_metatable_or_nil(last_ins_ptr(n)); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { fast_metatable_or_nil(best_ins_ptr(n)); } else { lua_pushnil(L); } } else if (t == attribute_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, number)) { + } else if (lua_key_eq(s, number)) { lua_pushnumber(L, attribute_id(n)); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { lua_pushnumber(L, attribute_value(n)); } else { lua_pushnil(L); } } else if (t == adjust_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { fast_metatable_or_nil_alink(adjust_ptr(n)); } else { lua_pushnil(L); } } else if (t == action_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n));/* dummy subtype */ - } else if (luaS_ptr_eq(s, action_type)) { + } else if (lua_key_eq(s, action_type)) { lua_pushnumber(L, pdf_action_type(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_action_named_id(n)); - } else if (luaS_ptr_eq(s, action_id)) { + } else if (lua_key_eq(s, action_id)) { if (pdf_action_named_id(n) == 1) { tokenlist_to_luastring(L, pdf_action_id(n)); } else { lua_pushnumber(L, pdf_action_id(n)); } - } else if (luaS_ptr_eq(s, file)) { + } else if (lua_key_eq(s, file)) { tokenlist_to_luastring(L, pdf_action_file(n)); - } else if (luaS_ptr_eq(s, new_window)) { + } else if (lua_key_eq(s, new_window)) { lua_pushnumber(L, pdf_action_new_window(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_action_tokens(n)); - } else if (luaS_ptr_eq(s, ref_count)) { + } else if (lua_key_eq(s, ref_count)) { lua_pushnumber(L, pdf_action_refcount(n)); } else { lua_pushnil(L); } } else if (t == unset_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, box_dir(n), false); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { lua_pushnumber(L, glue_shrink(n)); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { lua_pushnumber(L, glue_order(n)); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { lua_pushnumber(L, glue_sign(n)); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { lua_pushnumber(L, glue_stretch(n)); - } else if (luaS_ptr_eq(s, count)) { + } else if (lua_key_eq(s, count)) { lua_pushnumber(L, span_count(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ fast_metatable_or_nil_alink(list_ptr(n)); } else { lua_pushnil(L); } } else if (t == attribute_list_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { lua_pushnumber(L, subtype(n)); } else { lua_pushnil(L); @@ -3484,23 +3207,23 @@ static void lua_nodelib_direct_getfield_whatsit(lua_State * L, int n, const char t = subtype(n); if (t == dir_node) { - if (luaS_ptr_eq(s, dir)) { + if (lua_key_eq(s, dir)) { nodelib_pushdir(L, dir_dir(n), true); - } else if (luaS_ptr_eq(s, level)) { + } else if (lua_key_eq(s, level)) { lua_pushnumber(L, dir_level(n)); - } else if (luaS_ptr_eq(s, dvi_ptr)) { + } else if (lua_key_eq(s, dvi_ptr)) { lua_pushnumber(L, dir_dvi_ptr(n)); - } else if (luaS_ptr_eq(s, dir_h)) { + } else if (lua_key_eq(s, dir_h)) { lua_pushnumber(L, dir_dvi_h(n)); } else { lua_pushnil(L); } } else if (t == user_defined_node) { - if (luaS_ptr_eq(s, user_id)) { + if (lua_key_eq(s, user_id)) { lua_pushnumber(L, user_node_id(n)); - } else if (luaS_ptr_eq(s, type)) { + } else if (lua_key_eq(s, type)) { lua_pushnumber(L, user_node_type(n)); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { switch (user_node_type(n)) { case 'a': nodelib_pushdirect(user_node_value(n)); @@ -3525,27 +3248,27 @@ static void lua_nodelib_direct_getfield_whatsit(lua_State * L, int n, const char lua_pushnil(L); } } else if (t == local_par_node) { - if (luaS_ptr_eq(s, pen_inter)) { + if (lua_key_eq(s, pen_inter)) { lua_pushnumber(L, local_pen_inter(n)); - } else if (luaS_ptr_eq(s, pen_broken)) { + } else if (lua_key_eq(s, pen_broken)) { lua_pushnumber(L, local_pen_broken(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, local_par_dir(n), false); - } else if (luaS_ptr_eq(s, box_left)) { + } else if (lua_key_eq(s, box_left)) { nodelib_pushdirect_or_nil(local_box_left(n)); - } else if (luaS_ptr_eq(s, box_left_width)) { + } else if (lua_key_eq(s, box_left_width)) { lua_pushnumber(L, local_box_left_width(n)); - } else if (luaS_ptr_eq(s, box_right)) { + } else if (lua_key_eq(s, box_right)) { nodelib_pushdirect_or_nil(local_box_right(n)); - } else if (luaS_ptr_eq(s, box_right_width)) { + } else if (lua_key_eq(s, box_right_width)) { lua_pushnumber(L, local_box_right_width(n)); } else { lua_pushnil(L); } } else if (t == pdf_literal_node) { - if (luaS_ptr_eq(s, mode)) { + if (lua_key_eq(s, mode)) { lua_pushnumber(L, pdf_literal_mode(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { if (pdf_literal_type(n) == lua_refid_literal) { lua_rawgeti(Luas, LUA_REGISTRYINDEX, pdf_literal_data(n)); } else { @@ -3555,9 +3278,9 @@ static void lua_nodelib_direct_getfield_whatsit(lua_State * L, int n, const char lua_pushnil(L); } } else if (t == late_lua_node) { - if (luaS_ptr_eq(s, name)) { + if (lua_key_eq(s, name)) { tokenlist_to_luastring(L, late_lua_name(n)); - } else if (luaS_ptr_eq(s, data) || luaS_ptr_eq(s, string)) { + } else if (lua_key_eq(s, data) || lua_key_eq(s, string)) { if (late_lua_type(n) == lua_refid_literal) { lua_rawgeti(Luas, LUA_REGISTRYINDEX, late_lua_data(n)); } else { @@ -3567,154 +3290,154 @@ static void lua_nodelib_direct_getfield_whatsit(lua_State * L, int n, const char lua_pushnil(L); } } else if (t == pdf_annot_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_annot_objnum(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_annot_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_dest_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_dest_named_id(n)); - } else if (luaS_ptr_eq(s, dest_id)) { + } else if (lua_key_eq(s, dest_id)) { if (pdf_dest_named_id(n) == 1) tokenlist_to_luastring(L, pdf_dest_id(n)); else lua_pushnumber(L, pdf_dest_id(n)); - } else if (luaS_ptr_eq(s, dest_type)) { + } else if (lua_key_eq(s, dest_type)) { lua_pushnumber(L, pdf_dest_type(n)); - } else if (luaS_ptr_eq(s, xyz_zoom)) { + } else if (lua_key_eq(s, xyz_zoom)) { lua_pushnumber(L, pdf_dest_xyz_zoom(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_dest_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_setmatrix_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_setmatrix_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_colorstack_node) { - if (luaS_ptr_eq(s, stack)) { + if (lua_key_eq(s, stack)) { lua_pushnumber(L, pdf_colorstack_stack(n)); - } else if (luaS_ptr_eq(s, command)) { + } else if (lua_key_eq(s, command)) { lua_pushnumber(L, pdf_colorstack_cmd(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_colorstack_data(n)); } else { lua_pushnil(L); } } else if (t == pdf_refobj_node) { - if (luaS_ptr_eq(s, objnum)) { + if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_obj_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_refxform_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_xform_objnum(n)); } else { lua_pushnil(L); } } else if (t == pdf_refximage_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, transform)) { + } else if (lua_key_eq(s, transform)) { lua_pushnumber(L, pdf_ximage_transform(n)); - } else if (luaS_ptr_eq(s, index)) { + } else if (lua_key_eq(s, index)) { lua_pushnumber(L, pdf_ximage_index(n)); } else { lua_pushnil(L); } } else if (t == write_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_lua(L, write_tokens(n)); } else { lua_pushnil(L); } } else if (t == special_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, write_tokens(n)); } else { lua_pushnil(L); } } else if (t == pdf_start_link_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { lua_pushnumber(L, pdf_link_objnum(n)); - } else if (luaS_ptr_eq(s, link_attr)) { + } else if (lua_key_eq(s, link_attr)) { tokenlist_to_luastring(L, pdf_link_attr(n)); - } else if (luaS_ptr_eq(s, action)) { + } else if (lua_key_eq(s, action)) { nodelib_pushaction(L, pdf_link_action(n)); } else { lua_pushnil(L); } } else if ((t == pdf_thread_node) || (t == pdf_start_thread_node)) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_thread_named_id(n)); - } else if (luaS_ptr_eq(s, thread_id)) { + } else if (lua_key_eq(s, thread_id)) { if (pdf_thread_named_id(n) == 1) { tokenlist_to_luastring(L, pdf_thread_id(n)); } else { lua_pushnumber(L, pdf_thread_id(n)); } - } else if (luaS_ptr_eq(s, thread_attr)) { + } else if (lua_key_eq(s, thread_attr)) { tokenlist_to_luastring(L, pdf_thread_attr(n)); } else { lua_pushnil(L); } } else if (t == open_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { nodelib_pushstring(L, open_name(n)); - } else if (luaS_ptr_eq(s, area)) { + } else if (lua_key_eq(s, area)) { nodelib_pushstring(L, open_area(n)); - } else if (luaS_ptr_eq(s, ext)) { + } else if (lua_key_eq(s, ext)) { nodelib_pushstring(L, open_ext(n)); } else { lua_pushnil(L); } } else if (t == close_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { lua_pushnumber(L, write_stream(n)); } else { lua_pushnil(L); @@ -3768,136 +3491,136 @@ static int lua_nodelib_direct_getfield(lua_State * L) s = lua_tostring(L, 2); - if (luaS_ptr_eq(s, id)) { + if (lua_key_eq(s, id)) { lua_pushnumber(L, t); - } else if (luaS_ptr_eq(s, next)) { + } else if (lua_key_eq(s, next)) { nodelib_pushdirect_or_nil(vlink(n)); - } else if (luaS_ptr_eq(s, prev)) { + } else if (lua_key_eq(s, prev)) { nodelib_pushdirect_or_nil(alink(n)); - } else if (luaS_ptr_eq(s, attr)) { + } else if (lua_key_eq(s, attr)) { if (! nodetype_has_attributes(t)) { lua_pushnil(L); } else { nodelib_pushattr(L, node_attr(n)); } - } else if (luaS_ptr_eq(s, subtype)) { + } else if (lua_key_eq(s, subtype)) { if (t == glue_spec_node) { lua_pushnumber(L, 0); /* dummy, the only one */ } else { lua_pushnumber(L, subtype(n)); } } else if (t == glyph_node) { - if (luaS_ptr_eq(s, font)) { + if (lua_key_eq(s, font)) { lua_pushnumber(L, font(n)); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { lua_pushnumber(L, character(n)); - } else if (luaS_ptr_eq(s, xoffset)) { + } else if (lua_key_eq(s, xoffset)) { lua_pushnumber(L, x_displace(n)); - } else if (luaS_ptr_eq(s, yoffset)) { + } else if (lua_key_eq(s, yoffset)) { lua_pushnumber(L, y_displace(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, char_width(font(n),character(n))); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, char_height(font(n),character(n))); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, char_depth(font(n),character(n))); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { lua_pushnumber(L, ex_glyph(n)); - } else if (luaS_ptr_eq(s, components)) { + } else if (lua_key_eq(s, components)) { nodelib_pushdirect_or_nil(lig_ptr(n)); - } else if (luaS_ptr_eq(s, lang)) { + } else if (lua_key_eq(s, lang)) { lua_pushnumber(L, char_lang(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { lua_pushnumber(L, char_lhmin(n)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { lua_pushnumber(L, char_rhmin(n)); - } else if (luaS_ptr_eq(s, uchyph)) { + } else if (lua_key_eq(s, uchyph)) { lua_pushnumber(L, char_uchyph(n)); } else { lua_pushnil(L); } } else if ((t == hlist_node) || (t == vlist_node)) { /* candidates: whd (width,height,depth) */ - if (luaS_ptr_eq(s, list) || luaS_ptr_eq(s, head)) { + if (lua_key_eq(s, list) || lua_key_eq(s, head)) { nodelib_pushdirect_or_nil_alink(list_ptr(n)); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, box_dir(n), false); - } else if (luaS_ptr_eq(s, shift)) { + } else if (lua_key_eq(s, shift)) { lua_pushnumber(L, shift_amount(n)); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { lua_pushnumber(L, glue_order(n)); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { lua_pushnumber(L, glue_sign(n)); - } else if (luaS_ptr_eq(s, glue_set)) { + } else if (lua_key_eq(s, glue_set)) { lua_pushnumber(L, (double) glue_set(n)); } else { lua_pushnil(L); } } else if (t == disc_node) { - if (luaS_ptr_eq(s, pre)) { + if (lua_key_eq(s, pre)) { nodelib_pushdirect_or_nil(vlink(pre_break(n))); - } else if (luaS_ptr_eq(s, post)) { + } else if (lua_key_eq(s, post)) { nodelib_pushdirect_or_nil(vlink(post_break(n))); - } else if (luaS_ptr_eq(s, replace)) { + } else if (lua_key_eq(s, replace)) { nodelib_pushdirect_or_nil(vlink(no_break(n))); } else { lua_pushnil(L); } } else if (t == glue_node) { - if (luaS_ptr_eq(s, spec)) { + if (lua_key_eq(s, spec)) { nodelib_pushdirect(glue_ptr(n)); - } else if (luaS_ptr_eq(s, leader)) { + } else if (lua_key_eq(s, leader)) { nodelib_pushdirect_or_nil(leader_ptr(n)); } else { lua_pushnil(L); } } else if (t == glue_spec_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { lua_pushnumber(L, stretch(n)); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { lua_pushnumber(L, shrink(n)); - } else if (luaS_ptr_eq(s, stretch_order)) { + } else if (lua_key_eq(s, stretch_order)) { lua_pushnumber(L, stretch_order(n)); - } else if (luaS_ptr_eq(s, shrink_order)) { + } else if (lua_key_eq(s, shrink_order)) { lua_pushnumber(L, shrink_order(n)); - } else if (luaS_ptr_eq(s, ref_count)) { + } else if (lua_key_eq(s, ref_count)) { lua_pushnumber(L, glue_ref_count(n)); - } else if (luaS_ptr_eq(s, writable)) { + } else if (lua_key_eq(s, writable)) { lua_pushboolean(L, valid_node(n)); } else { lua_pushnil(L); } } else if (t == kern_node) { - if (luaS_ptr_eq(s, kern)) { + if (lua_key_eq(s, kern)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { lua_pushnumber(L, ex_kern(n)); } else { lua_pushnil(L); } } else if (t == penalty_node) { - if (luaS_ptr_eq(s, penalty)) { + if (lua_key_eq(s, penalty)) { lua_pushnumber(L, penalty(n)); } else { lua_pushnil(L); } } else if (t == rule_node) { /* candidates: whd (width,height,depth) */ - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, rule_dir(n), false); } else { lua_pushnil(L); @@ -3905,219 +3628,219 @@ static int lua_nodelib_direct_getfield(lua_State * L) } else if (t == whatsit_node) { lua_nodelib_direct_getfield_whatsit(L, n, s); } else if (t == simple_noad) { - if (luaS_ptr_eq(s, nucleus)) { + if (lua_key_eq(s, nucleus)) { nodelib_pushdirect_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { nodelib_pushdirect_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { nodelib_pushdirect_or_nil(supscr(n)); } else { lua_pushnil(L); } } else if ((t == math_char_node) || (t == math_text_char_node)) { - if (luaS_ptr_eq(s, fam)) { + if (lua_key_eq(s, fam)) { lua_pushnumber(L, math_fam(n)); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { lua_pushnumber(L, math_character(n)); } else { lua_pushnil(L); } } else if (t == mark_node) { - if (luaS_ptr_eq(s, class)) { + if (lua_key_eq(s, class)) { lua_pushnumber(L, mark_class(n)); - } else if (luaS_ptr_eq(s, mark)) { + } else if (lua_key_eq(s, mark)) { tokenlist_to_lua(L, mark_ptr(n)); } else { lua_pushnil(L); } } else if (t == ins_node) { - if (luaS_ptr_eq(s, cost)) { + if (lua_key_eq(s, cost)) { lua_pushnumber(L, float_cost(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { nodelib_pushdirect_or_nil(split_top_ptr(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { nodelib_pushdirect_or_nil_alink(ins_ptr(n)); } else { lua_pushnil(L); } } else if (t == math_node) { - if (luaS_ptr_eq(s, surround)) { + if (lua_key_eq(s, surround)) { lua_pushnumber(L, surround(n)); } else { lua_pushnil(L); } } else if (t == fraction_noad) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, thickness(n)); - } else if (luaS_ptr_eq(s, num)) { + } else if (lua_key_eq(s, num)) { nodelib_pushdirect_or_nil(numerator(n)); - } else if (luaS_ptr_eq(s, denom)) { + } else if (lua_key_eq(s, denom)) { nodelib_pushdirect_or_nil(denominator(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { nodelib_pushdirect_or_nil(left_delimiter(n)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { nodelib_pushdirect_or_nil(right_delimiter(n)); } else { lua_pushnil(L); } } else if (t == style_node) { - if (luaS_ptr_eq(s, style)) { + if (lua_key_eq(s, style)) { lua_pushstring(L, math_style_names[subtype(n)]); } else { lua_pushnil(L); } } else if (t == accent_noad) { - if (luaS_ptr_eq(s, nucleus)) { + if (lua_key_eq(s, nucleus)) { nodelib_pushdirect_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { nodelib_pushdirect_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { nodelib_pushdirect_or_nil(supscr(n)); - } else if (luaS_ptr_eq(s, accent)) { + } else if (lua_key_eq(s, accent)) { nodelib_pushdirect_or_nil(accent_chr(n)); - } else if (luaS_ptr_eq(s, bot_accent)) { + } else if (lua_key_eq(s, bot_accent)) { nodelib_pushdirect_or_nil(bot_accent_chr(n)); } else { lua_pushnil(L); } } else if (t == fence_noad) { - if (luaS_ptr_eq(s, delim)) { + if (lua_key_eq(s, delim)) { nodelib_pushdirect_or_nil(delimiter(n)); } else { lua_pushnil(L); } } else if (t == delim_node) { - if (luaS_ptr_eq(s, small_fam)) { + if (lua_key_eq(s, small_fam)) { lua_pushnumber(L, small_fam(n)); - } else if (luaS_ptr_eq(s, small_char)) { + } else if (lua_key_eq(s, small_char)) { lua_pushnumber(L, small_char(n)); - } else if (luaS_ptr_eq(s, large_fam)) { + } else if (lua_key_eq(s, large_fam)) { lua_pushnumber(L, large_fam(n)); - } else if (luaS_ptr_eq(s, large_char)) { + } else if (lua_key_eq(s, large_char)) { lua_pushnumber(L, large_char(n)); } else { lua_pushnil(L); } } else if ((t == sub_box_node) || (t == sub_mlist_node)) { - if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ nodelib_pushdirect_or_nil_alink(math_list(n)); } else { lua_pushnil(L); } } else if (t == radical_noad) { - if (luaS_ptr_eq(s, nucleus)) { + if (lua_key_eq(s, nucleus)) { nodelib_pushdirect_or_nil(nucleus(n)); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { nodelib_pushdirect_or_nil(subscr(n)); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { nodelib_pushdirect_or_nil(supscr(n)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { nodelib_pushdirect_or_nil(left_delimiter(n)); - } else if (luaS_ptr_eq(s, degree)) { + } else if (lua_key_eq(s, degree)) { nodelib_pushdirect_or_nil(degree(n)); } else { lua_pushnil(L); } } else if (t == margin_kern_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, glyph)) { + } else if (lua_key_eq(s, glyph)) { nodelib_pushdirect_or_nil(margin_char(n)); } else { lua_pushnil(L); } } else if (t == split_up_node) { - if (luaS_ptr_eq(s, last_ins_ptr)) { + if (lua_key_eq(s, last_ins_ptr)) { nodelib_pushdirect_or_nil(last_ins_ptr(n)); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { nodelib_pushdirect_or_nil(best_ins_ptr(n)); - } else if (luaS_ptr_eq(s, broken_ptr)) { + } else if (lua_key_eq(s, broken_ptr)) { nodelib_pushdirect_or_nil(broken_ptr(n)); - } else if (luaS_ptr_eq(s, broken_ins)) { + } else if (lua_key_eq(s, broken_ins)) { nodelib_pushdirect_or_nil(broken_ins(n)); } else { lua_pushnil(L); } } else if (t == choice_node) { - if (luaS_ptr_eq(s, display)) { + if (lua_key_eq(s, display)) { nodelib_pushdirect_or_nil(display_mlist(n)); - } else if (luaS_ptr_eq(s, text)) { + } else if (lua_key_eq(s, text)) { nodelib_pushdirect_or_nil(text_mlist(n)); - } else if (luaS_ptr_eq(s, script)) { + } else if (lua_key_eq(s, script)) { nodelib_pushdirect_or_nil(script_mlist(n)); - } else if (luaS_ptr_eq(s, scriptscript)) { + } else if (lua_key_eq(s, scriptscript)) { nodelib_pushdirect_or_nil(script_script_mlist(n)); } else { lua_pushnil(L); } } else if (t == inserting_node) { - if (luaS_ptr_eq(s, last_ins_ptr)) { + if (lua_key_eq(s, last_ins_ptr)) { nodelib_pushdirect_or_nil(last_ins_ptr(n)); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { nodelib_pushdirect_or_nil(best_ins_ptr(n)); } else { lua_pushnil(L); } } else if (t == attribute_node) { - if (luaS_ptr_eq(s, number)) { + if (lua_key_eq(s, number)) { lua_pushnumber(L, attribute_id(n)); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { lua_pushnumber(L, attribute_value(n)); } else { lua_pushnil(L); } } else if (t == adjust_node) { - if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { nodelib_pushdirect_or_nil_alink(adjust_ptr(n)); } else { lua_pushnil(L); } } else if (t == action_node) { - if (luaS_ptr_eq(s, action_type)) { + if (lua_key_eq(s, action_type)) { lua_pushnumber(L, pdf_action_type(n)); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { lua_pushnumber(L, pdf_action_named_id(n)); - } else if (luaS_ptr_eq(s, action_id)) { + } else if (lua_key_eq(s, action_id)) { if (pdf_action_named_id(n) == 1) { tokenlist_to_luastring(L, pdf_action_id(n)); } else { lua_pushnumber(L, pdf_action_id(n)); } - } else if (luaS_ptr_eq(s, file)) { + } else if (lua_key_eq(s, file)) { tokenlist_to_luastring(L, pdf_action_file(n)); - } else if (luaS_ptr_eq(s, new_window)) { + } else if (lua_key_eq(s, new_window)) { lua_pushnumber(L, pdf_action_new_window(n)); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { tokenlist_to_luastring(L, pdf_action_tokens(n)); - } else if (luaS_ptr_eq(s, ref_count)) { + } else if (lua_key_eq(s, ref_count)) { lua_pushnumber(L, pdf_action_refcount(n)); } else { lua_pushnil(L); } } else if (t == unset_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { lua_pushnumber(L, width(n)); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { lua_pushnumber(L, height(n)); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { lua_pushnumber(L, depth(n)); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { nodelib_pushdir(L, box_dir(n), false); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { lua_pushnumber(L, glue_shrink(n)); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { lua_pushnumber(L, glue_order(n)); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { lua_pushnumber(L, glue_sign(n)); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { lua_pushnumber(L, glue_stretch(n)); - } else if (luaS_ptr_eq(s, count)) { + } else if (lua_key_eq(s, count)) { lua_pushnumber(L, span_count(n)); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ nodelib_pushdirect_or_nil_alink(list_ptr(n)); } else { lua_pushnil(L); @@ -4444,7 +4167,7 @@ static int lua_nodelib_direct_has_glyph(lua_State * L) static int lua_nodelib_first_character(lua_State * L) { - pdftex_warn("node.first_character() is deprecated, please update to node.first_glyph()"); + luatex_warn("node.first_character() is deprecated, please update to node.first_glyph()"); return lua_nodelib_first_glyph(L); } @@ -4569,7 +4292,7 @@ static int lua_nodelib_currentattr(lua_State * L) return 1; } else { /* assign */ - pdftex_warn("Assignment via node.current_attr(<list>) is not supported (yet)"); + luatex_warn("Assignment via node.current_attr(<list>) is not supported (yet)"); return 0; } } @@ -4600,7 +4323,7 @@ static int lua_nodelib_direct_todirect(lua_State * L) { if (lua_type(L,1) != LUA_TNUMBER) { /* assume node, no further testing, used in known situations */ - void *n ; + void *n ; n = lua_touserdata(L, 1); if (n == null) { lua_pushnil(L); @@ -4636,21 +4359,21 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s) t = subtype(n); if (t == dir_node) { - if (luaS_ptr_eq(s, dir)) { + if (lua_key_eq(s, dir)) { dir_dir(n) = nodelib_getdir(L, 3, 0); - } else if (luaS_ptr_eq(s, level)) { + } else if (lua_key_eq(s, level)) { dir_level(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dvi_ptr)) { + } else if (lua_key_eq(s, dvi_ptr)) { dir_dvi_ptr(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir_h)) { + } else if (lua_key_eq(s, dir_h)) { dir_dvi_h(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_literal_node) { - if (luaS_ptr_eq(s, mode)) { + if (lua_key_eq(s, mode)) { pdf_literal_mode(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { if (ini_version) { pdf_literal_data(n) = nodelib_gettoks(L, 3); } else { @@ -4662,12 +4385,12 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s) return nodelib_cantset(L, n, s); } } else if (t == late_lua_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { late_lua_data(n) = nodelib_gettoks(L, 3); late_lua_type(n) = normal; - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { late_lua_name(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, string)) { + } else if (lua_key_eq(s, string)) { if (ini_version) { late_lua_data(n) = nodelib_gettoks(L, 3); late_lua_type(n) = normal; @@ -4680,11 +4403,11 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s) return nodelib_cantset(L, n, s); } } else if (t == user_defined_node) { - if (luaS_ptr_eq(s, user_id)) { + if (lua_key_eq(s, user_id)) { user_node_id(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, type)) { + } else if (lua_key_eq(s, type)) { user_node_type(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { switch (user_node_type(n)) { case 'a': user_node_value(n) = nodelib_getlist(L, 3); @@ -4709,173 +4432,173 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s) return nodelib_cantset(L, n, s); } } else if (t == pdf_annot_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_annot_objnum(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_annot_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_dest_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_dest_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dest_id)) { + } else if (lua_key_eq(s, dest_id)) { if (pdf_dest_named_id(n) == 1) { pdf_dest_id(n) = nodelib_gettoks(L, 3); } else { pdf_dest_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, dest_type)) { + } else if (lua_key_eq(s, dest_type)) { pdf_dest_type(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, xyz_zoom)) { + } else if (lua_key_eq(s, xyz_zoom)) { pdf_dest_xyz_zoom(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_dest_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_setmatrix_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { pdf_setmatrix_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refobj_node) { - if (luaS_ptr_eq(s, objnum)) { + if (lua_key_eq(s, objnum)) { pdf_obj_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refxform_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_xform_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refximage_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, transform)) { + } else if (lua_key_eq(s, transform)) { pdf_ximage_transform(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, index)) { + } else if (lua_key_eq(s, index)) { pdf_ximage_index(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == local_par_node) { - if (luaS_ptr_eq(s, pen_inter)) { + if (lua_key_eq(s, pen_inter)) { local_pen_inter(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, pen_broken)) { + } else if (lua_key_eq(s, pen_broken)) { local_pen_broken(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { local_par_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, box_left)) { + } else if (lua_key_eq(s, box_left)) { local_box_left(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, box_left_width)) { + } else if (lua_key_eq(s, box_left_width)) { local_box_left_width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, box_right)) { + } else if (lua_key_eq(s, box_right)) { local_box_right(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, box_right_width)) { + } else if (lua_key_eq(s, box_right_width)) { local_box_right_width(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_start_link_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_link_objnum(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, link_attr)) { + } else if (lua_key_eq(s, link_attr)) { pdf_link_attr(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, action)) { + } else if (lua_key_eq(s, action)) { pdf_link_action(n) = nodelib_getaction(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == write_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { write_tokens(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_colorstack_node) { - if (luaS_ptr_eq(s, stack)) { + if (lua_key_eq(s, stack)) { pdf_colorstack_stack(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, command)) { + } else if (lua_key_eq(s, command)) { pdf_colorstack_cmd(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_colorstack_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if ((t == pdf_thread_node) || (t == pdf_start_thread_node)) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_thread_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, thread_id)) { + } else if (lua_key_eq(s, thread_id)) { if (pdf_thread_named_id(n) == 1) { pdf_thread_id(n) = nodelib_gettoks(L, 3); } else { pdf_thread_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, thread_attr)) { + } else if (lua_key_eq(s, thread_attr)) { pdf_thread_attr(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == special_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { write_tokens(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == open_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { open_name(n) = nodelib_getstring(L, 3); - } else if (luaS_ptr_eq(s, area)) { + } else if (lua_key_eq(s, area)) { open_area(n) = nodelib_getstring(L, 3); - } else if (luaS_ptr_eq(s, ext)) { + } else if (lua_key_eq(s, ext)) { open_ext(n) = nodelib_getstring(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == close_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); @@ -4918,422 +4641,422 @@ static int lua_nodelib_fast_setfield(lua_State * L) s = lua_tostring(L, 2); - if (luaS_ptr_eq(s, id)) { + if (lua_key_eq(s, id)) { lua_pushnumber(L, t); - } else if (luaS_ptr_eq(s, next)) { + } else if (lua_key_eq(s, next)) { halfword x = nodelib_getlist(L, 3); if (x>0 && type(x) == glue_spec_node) { return luaL_error(L, "You can't assign a %s node to a next field\n", node_data[type(x)].name); } vlink(n) = x; - } else if (luaS_ptr_eq(s, prev)) { + } else if (lua_key_eq(s, prev)) { halfword x = nodelib_getlist(L, 3); if (x>0 && type(x) == glue_spec_node) { return luaL_error(L, "You can't assign a %s node to a prev field\n", node_data[type(x)].name); } alink(n) = x; - } else if (luaS_ptr_eq(s, attr)) { + } else if (lua_key_eq(s, attr)) { if (nodetype_has_attributes(type(n))) { nodelib_setattr(L, 3, n); } } else if (t == glyph_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, font)) { + } else if (lua_key_eq(s, font)) { font(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { character(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, xoffset)) { + } else if (lua_key_eq(s, xoffset)) { x_displace(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, yoffset)) { + } else if (lua_key_eq(s, yoffset)) { y_displace(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { /* not yet */ - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { /* not yet */ - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { /* not yet */ - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { ex_glyph(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, components)) { + } else if (lua_key_eq(s, components)) { lig_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, lang)) { + } else if (lua_key_eq(s, lang)) { set_char_lang(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { set_char_lhmin(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { set_char_rhmin(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, uchyph)) { + } else if (lua_key_eq(s, uchyph)) { set_char_uchyph(n, (halfword) lua_tointeger(L, 3)); } else { return nodelib_cantset(L, n, s); } } else if ((t == hlist_node) || (t == vlist_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, list) || luaS_ptr_eq(s, head)) { + } else if (lua_key_eq(s, list) || lua_key_eq(s, head)) { list_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { box_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, shift)) { + } else if (lua_key_eq(s, shift)) { shift_amount(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { glue_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { glue_sign(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_set)) { + } else if (lua_key_eq(s, glue_set)) { glue_set(n) = (glue_ratio) lua_tonumber(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == disc_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, pre)) { + } else if (lua_key_eq(s, pre)) { set_disc_field(pre_break(n), nodelib_getlist(L, 3)); - } else if (luaS_ptr_eq(s, post)) { + } else if (lua_key_eq(s, post)) { set_disc_field(post_break(n), nodelib_getlist(L, 3)); - } else if (luaS_ptr_eq(s, replace)) { + } else if (lua_key_eq(s, replace)) { set_disc_field(no_break(n), nodelib_getlist(L, 3)); } else { return nodelib_cantset(L, n, s); } } else if (t == glue_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { glue_ptr(n) = nodelib_getspec(L, 3); - } else if (luaS_ptr_eq(s, leader)) { + } else if (lua_key_eq(s, leader)) { leader_ptr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == glue_spec_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); /* dummy, the only one that prevents move up */ - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { stretch(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { shrink(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch_order)) { + } else if (lua_key_eq(s, stretch_order)) { stretch_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, shrink_order)) { + } else if (lua_key_eq(s, shrink_order)) { lua_pushnumber(L, shrink_order(n)); - /* } else if (luaS_ptr_eq(s, ref_count)) { + /* } else if (lua_key_eq(s, ref_count)) { glue_ref_count(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, writable)) { + } else if (lua_key_eq(s, writable)) { */ /* can't be set */ } else { return nodelib_cantset(L, n, s); } } else if (t == kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, kern)) { + } else if (lua_key_eq(s, kern)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { ex_kern(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == penalty_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, penalty)) { + } else if (lua_key_eq(s, penalty)) { penalty(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == rule_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { rule_dir(n) = nodelib_getdir(L, 3, 1); } else { return nodelib_cantset(L, n, s); } } else if (t == whatsit_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); } else { lua_nodelib_setfield_whatsit(L, n, s); } } else if (t == simple_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if ((t == math_char_node) || (t == math_text_char_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, fam)) { + } else if (lua_key_eq(s, fam)) { math_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { math_character(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == mark_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, class)) { + } else if (lua_key_eq(s, class)) { mark_class(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, mark)) { + } else if (lua_key_eq(s, mark)) { mark_ptr(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == ins_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, cost)) { + } else if (lua_key_eq(s, cost)) { float_cost(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { split_top_ptr(n) = nodelib_getspec(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { ins_ptr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == math_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, surround)) { + } else if (lua_key_eq(s, surround)) { surround(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == fraction_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { thickness(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, num)) { + } else if (lua_key_eq(s, num)) { numerator(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, denom)) { + } else if (lua_key_eq(s, denom)) { denominator(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { left_delimiter(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { right_delimiter(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == style_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, style)) { + } else if (lua_key_eq(s, style)) { lua_pushstring(L, math_style_names[subtype(n)]); } else { /* return nodelib_cantset(L, n, s); */ subtype(n) = (quarterword) luaL_checkoption(L, 3, "text", math_style_names); /* not 2? */ } } else if (t == accent_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, accent)) { + } else if (lua_key_eq(s, accent)) { accent_chr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, bot_accent)) { + } else if (lua_key_eq(s, bot_accent)) { bot_accent_chr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == fence_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, delim)) { + } else if (lua_key_eq(s, delim)) { delimiter(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == delim_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, small_fam)) { + } else if (lua_key_eq(s, small_fam)) { small_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, small_char)) { + } else if (lua_key_eq(s, small_char)) { small_char(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, large_fam)) { + } else if (lua_key_eq(s, large_fam)) { large_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, large_char)) { + } else if (lua_key_eq(s, large_char)) { large_char(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if ((t == sub_box_node) || (t == sub_mlist_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ math_list(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == radical_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { left_delimiter(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, degree)) { + } else if (lua_key_eq(s, degree)) { degree(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == margin_kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glyph)) { + } else if (lua_key_eq(s, glyph)) { margin_char(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == split_up_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { last_ins_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { best_ins_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, broken_ptr)) { + } else if (lua_key_eq(s, broken_ptr)) { broken_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, broken_ins)) { + } else if (lua_key_eq(s, broken_ins)) { broken_ins(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == choice_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, display)) { + } else if (lua_key_eq(s, display)) { display_mlist(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, text)) { + } else if (lua_key_eq(s, text)) { text_mlist(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, script)) { + } else if (lua_key_eq(s, script)) { script_mlist(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, scriptscript)) { + } else if (lua_key_eq(s, scriptscript)) { script_script_mlist(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == inserting_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { last_ins_ptr(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { best_ins_ptr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == attribute_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, number)) { + } else if (lua_key_eq(s, number)) { attribute_id(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { attribute_value(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == adjust_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { adjust_ptr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == action_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, action_type)) { + } else if (lua_key_eq(s, action_type)) { pdf_action_type(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_action_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, action_id)) { + } else if (lua_key_eq(s, action_id)) { if (pdf_action_named_id(n) == 1) { pdf_action_id(n) = nodelib_gettoks(L, 3); } else { pdf_action_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, file)) { + } else if (lua_key_eq(s, file)) { pdf_action_file(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, new_window)) { + } else if (lua_key_eq(s, new_window)) { pdf_action_new_window(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_action_tokens(n) = nodelib_gettoks(L, 3); - /* } else if (luaS_ptr_eq(s, ref_count)) { + /* } else if (lua_key_eq(s, ref_count)) { pdf_action_refcount(n) = (halfword) lua_tointeger(L, 3); */ } else { return nodelib_cantset(L, n, s); } } else if (t == unset_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { box_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { glue_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { glue_sign(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { glue_stretch(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, count)) { + } else if (lua_key_eq(s, count)) { span_count(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ list_ptr(n) = nodelib_getlist(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == attribute_list_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ } else { return nodelib_cantset(L, n, s); @@ -5371,21 +5094,21 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char t = subtype(n); if (t == dir_node) { - if (luaS_ptr_eq(s, dir)) { + if (lua_key_eq(s, dir)) { dir_dir(n) = nodelib_getdir(L, 3, 0); - } else if (luaS_ptr_eq(s, level)) { + } else if (lua_key_eq(s, level)) { dir_level(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dvi_ptr)) { + } else if (lua_key_eq(s, dvi_ptr)) { dir_dvi_ptr(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir_h)) { + } else if (lua_key_eq(s, dir_h)) { dir_dvi_h(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_literal_node) { - if (luaS_ptr_eq(s, mode)) { + if (lua_key_eq(s, mode)) { pdf_literal_mode(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { if (ini_version) { pdf_literal_data(n) = nodelib_gettoks(L, 3); } else { @@ -5397,12 +5120,12 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char return nodelib_cantset(L, n, s); } } else if (t == late_lua_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { late_lua_data(n) = nodelib_gettoks(L, 3); late_lua_type(n) = normal; - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { late_lua_name(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, string)) { + } else if (lua_key_eq(s, string)) { if (ini_version) { late_lua_data(n) = nodelib_gettoks(L, 3); late_lua_type(n) = normal; @@ -5415,11 +5138,11 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char return nodelib_cantset(L, n, s); } } else if (t == user_defined_node) { - if (luaS_ptr_eq(s, user_id)) { + if (lua_key_eq(s, user_id)) { user_node_id(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, type)) { + } else if (lua_key_eq(s, type)) { user_node_type(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { switch (user_node_type(n)) { case 'a': user_node_value(n) = nodelib_getlist(L, 3); @@ -5444,173 +5167,173 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char return nodelib_cantset(L, n, s); } } else if (t == pdf_annot_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_annot_objnum(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_annot_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_dest_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_dest_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dest_id)) { + } else if (lua_key_eq(s, dest_id)) { if (pdf_dest_named_id(n) == 1) { pdf_dest_id(n) = nodelib_gettoks(L, 3); } else { pdf_dest_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, dest_type)) { + } else if (lua_key_eq(s, dest_type)) { pdf_dest_type(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, xyz_zoom)) { + } else if (lua_key_eq(s, xyz_zoom)) { pdf_dest_xyz_zoom(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_dest_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_setmatrix_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { pdf_setmatrix_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refobj_node) { - if (luaS_ptr_eq(s, objnum)) { + if (lua_key_eq(s, objnum)) { pdf_obj_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refxform_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_xform_objnum(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_refximage_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, transform)) { + } else if (lua_key_eq(s, transform)) { pdf_ximage_transform(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, index)) { + } else if (lua_key_eq(s, index)) { pdf_ximage_index(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == local_par_node) { - if (luaS_ptr_eq(s, pen_inter)) { + if (lua_key_eq(s, pen_inter)) { local_pen_inter(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, pen_broken)) { + } else if (lua_key_eq(s, pen_broken)) { local_pen_broken(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { local_par_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, box_left)) { + } else if (lua_key_eq(s, box_left)) { local_box_left(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, box_left_width)) { + } else if (lua_key_eq(s, box_left_width)) { local_box_left_width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, box_right)) { + } else if (lua_key_eq(s, box_right)) { local_box_right(n) = nodelib_getlist(L, 3); - } else if (luaS_ptr_eq(s, box_right_width)) { + } else if (lua_key_eq(s, box_right_width)) { local_box_right_width(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_start_link_node) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, objnum)) { + } else if (lua_key_eq(s, objnum)) { pdf_link_objnum(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, link_attr)) { + } else if (lua_key_eq(s, link_attr)) { pdf_link_attr(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, action)) { + } else if (lua_key_eq(s, action)) { pdf_link_action(n) = nodelib_popdirect(n); /*nodelib_getaction(L, 3);*/ } else { return nodelib_cantset(L, n, s); } } else if (t == write_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { write_tokens(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == pdf_colorstack_node) { - if (luaS_ptr_eq(s, stack)) { + if (lua_key_eq(s, stack)) { pdf_colorstack_stack(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, command)) { + } else if (lua_key_eq(s, command)) { pdf_colorstack_cmd(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_colorstack_data(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if ((t == pdf_thread_node) || (t == pdf_start_thread_node)) { - if (luaS_ptr_eq(s, width)) { + if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_thread_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, thread_id)) { + } else if (lua_key_eq(s, thread_id)) { if (pdf_thread_named_id(n) == 1) { pdf_thread_id(n) = nodelib_gettoks(L, 3); } else { pdf_thread_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, thread_attr)) { + } else if (lua_key_eq(s, thread_attr)) { pdf_thread_attr(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == special_node) { - if (luaS_ptr_eq(s, data)) { + if (lua_key_eq(s, data)) { write_tokens(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == open_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, name)) { + } else if (lua_key_eq(s, name)) { open_name(n) = nodelib_getstring(L, 3); - } else if (luaS_ptr_eq(s, area)) { + } else if (lua_key_eq(s, area)) { open_area(n) = nodelib_getstring(L, 3); - } else if (luaS_ptr_eq(s, ext)) { + } else if (lua_key_eq(s, ext)) { open_ext(n) = nodelib_getstring(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == close_node) { - if (luaS_ptr_eq(s, stream)) { + if (lua_key_eq(s, stream)) { write_stream(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); @@ -5653,421 +5376,421 @@ static int lua_nodelib_direct_setfield(lua_State * L) s = lua_tostring(L, 2); - if (luaS_ptr_eq(s, id)) { + if (lua_key_eq(s, id)) { lua_pushnumber(L, t); - } else if (luaS_ptr_eq(s, next)) { + } else if (lua_key_eq(s, next)) { halfword x = nodelib_popdirect(3); if (x>0 && type(x) == glue_spec_node) { return luaL_error(L, "You can't assign a %s node to a next field\n", node_data[type(x)].name); } vlink(n) = x; - } else if (luaS_ptr_eq(s, prev)) { + } else if (lua_key_eq(s, prev)) { halfword x = nodelib_popdirect(3); if (x>0 && type(x) == glue_spec_node) { return luaL_error(L, "You can't assign a %s node to a prev field\n", node_data[type(x)].name); } alink(n) = x; - } else if (luaS_ptr_eq(s, attr)) { + } else if (lua_key_eq(s, attr)) { if (nodetype_has_attributes(type(n))) { nodelib_setattr(L, 3, n); } } else if (t == glyph_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, font)) { + } else if (lua_key_eq(s, font)) { font(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { character(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, xoffset)) { + } else if (lua_key_eq(s, xoffset)) { x_displace(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, yoffset)) { + } else if (lua_key_eq(s, yoffset)) { y_displace(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { /* not yet */ - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { /* not yet */ - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { /* not yet */ - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { ex_glyph(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, components)) { + } else if (lua_key_eq(s, components)) { lig_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, lang)) { + } else if (lua_key_eq(s, lang)) { set_char_lang(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { set_char_lhmin(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { set_char_rhmin(n, (halfword) lua_tointeger(L, 3)); - } else if (luaS_ptr_eq(s, uchyph)) { + } else if (lua_key_eq(s, uchyph)) { set_char_uchyph(n, (halfword) lua_tointeger(L, 3)); } else { return nodelib_cantset(L, n, s); } } else if ((t == hlist_node) || (t == vlist_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, list) || luaS_ptr_eq(s, head)) { + } else if (lua_key_eq(s, list) || lua_key_eq(s, head)) { list_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { box_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, shift)) { + } else if (lua_key_eq(s, shift)) { shift_amount(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { glue_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { glue_sign(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_set)) { + } else if (lua_key_eq(s, glue_set)) { glue_set(n) = (glue_ratio) lua_tonumber(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == disc_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, pre)) { + } else if (lua_key_eq(s, pre)) { set_disc_field(pre_break(n), nodelib_popdirect(3)); - } else if (luaS_ptr_eq(s, post)) { + } else if (lua_key_eq(s, post)) { set_disc_field(post_break(n), nodelib_popdirect(3)); - } else if (luaS_ptr_eq(s, replace)) { + } else if (lua_key_eq(s, replace)) { set_disc_field(no_break(n), nodelib_popdirect(3)); } else { return nodelib_cantset(L, n, s); } } else if (t == glue_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { glue_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, leader)) { + } else if (lua_key_eq(s, leader)) { leader_ptr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == glue_spec_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); /* dummy, the only one that prevents move up */ - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { stretch(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { shrink(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch_order)) { + } else if (lua_key_eq(s, stretch_order)) { stretch_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, shrink_order)) { + } else if (lua_key_eq(s, shrink_order)) { lua_pushnumber(L, shrink_order(n)); - /* } else if (luaS_ptr_eq(s, ref_count)) { + /* } else if (lua_key_eq(s, ref_count)) { glue_ref_count(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, writable)) { + } else if (lua_key_eq(s, writable)) { */ } else { return nodelib_cantset(L, n, s); } } else if (t == kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, kern)) { + } else if (lua_key_eq(s, kern)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, expansion_factor)) { + } else if (lua_key_eq(s, expansion_factor)) { ex_kern(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == penalty_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, penalty)) { + } else if (lua_key_eq(s, penalty)) { penalty(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == rule_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { rule_dir(n) = nodelib_getdir(L, 3, 1); } else { return nodelib_cantset(L, n, s); } } else if (t == whatsit_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); } else { lua_nodelib_direct_setfield_whatsit(L, n, s); } } else if (t == simple_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if ((t == math_char_node) || (t == math_text_char_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, fam)) { + } else if (lua_key_eq(s, fam)) { math_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { math_character(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == mark_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, class)) { + } else if (lua_key_eq(s, class)) { mark_class(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, mark)) { + } else if (lua_key_eq(s, mark)) { mark_ptr(n) = nodelib_gettoks(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == ins_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, cost)) { + } else if (lua_key_eq(s, cost)) { float_cost(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, spec)) { + } else if (lua_key_eq(s, spec)) { split_top_ptr(n) = nodelib_popdirect(3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { ins_ptr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == math_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, surround)) { + } else if (lua_key_eq(s, surround)) { surround(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == fraction_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { thickness(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, num)) { + } else if (lua_key_eq(s, num)) { numerator(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, denom)) { + } else if (lua_key_eq(s, denom)) { denominator(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { left_delimiter(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { right_delimiter(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == style_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, style)) { + } else if (lua_key_eq(s, style)) { lua_pushstring(L, math_style_names[subtype(n)]); } else { /* return nodelib_cantset(L, n, s); */ subtype(n) = (quarterword) luaL_checkoption(L, 2, "text", math_style_names); /* was 3 */ } } else if (t == accent_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, accent)) { + } else if (lua_key_eq(s, accent)) { accent_chr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, bot_accent)) { + } else if (lua_key_eq(s, bot_accent)) { bot_accent_chr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == fence_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, delim)) { + } else if (lua_key_eq(s, delim)) { delimiter(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == delim_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, small_fam)) { + } else if (lua_key_eq(s, small_fam)) { small_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, small_char)) { + } else if (lua_key_eq(s, small_char)) { small_char(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, large_fam)) { + } else if (lua_key_eq(s, large_fam)) { large_fam(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, large_char)) { + } else if (lua_key_eq(s, large_char)) { large_char(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if ((t == sub_box_node) || (t == sub_mlist_node)) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ math_list(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == radical_noad) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, nucleus)) { + } else if (lua_key_eq(s, nucleus)) { nucleus(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sub)) { + } else if (lua_key_eq(s, sub)) { subscr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, sup)) { + } else if (lua_key_eq(s, sup)) { supscr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, left)) { + } else if (lua_key_eq(s, left)) { left_delimiter(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, degree)) { + } else if (lua_key_eq(s, degree)) { degree(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == margin_kern_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glyph)) { + } else if (lua_key_eq(s, glyph)) { margin_char(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == split_up_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { last_ins_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { best_ins_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, broken_ptr)) { + } else if (lua_key_eq(s, broken_ptr)) { broken_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, broken_ins)) { + } else if (lua_key_eq(s, broken_ins)) { broken_ins(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == choice_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, display)) { + } else if (lua_key_eq(s, display)) { display_mlist(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, text)) { + } else if (lua_key_eq(s, text)) { text_mlist(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, script)) { + } else if (lua_key_eq(s, script)) { script_mlist(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, scriptscript)) { + } else if (lua_key_eq(s, scriptscript)) { script_script_mlist(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == inserting_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, last_ins_ptr)) { + } else if (lua_key_eq(s, last_ins_ptr)) { last_ins_ptr(n) = nodelib_popdirect(3); - } else if (luaS_ptr_eq(s, best_ins_ptr)) { + } else if (lua_key_eq(s, best_ins_ptr)) { best_ins_ptr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == attribute_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, number)) { + } else if (lua_key_eq(s, number)) { attribute_id(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, value)) { + } else if (lua_key_eq(s, value)) { attribute_value(n) = (halfword) lua_tointeger(L, 3); } else { return nodelib_cantset(L, n, s); } } else if (t == adjust_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { subtype(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))) { + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { adjust_ptr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == action_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, action_type)) { + } else if (lua_key_eq(s, action_type)) { pdf_action_type(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, named_id)) { + } else if (lua_key_eq(s, named_id)) { pdf_action_named_id(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, action_id)) { + } else if (lua_key_eq(s, action_id)) { if (pdf_action_named_id(n) == 1) { pdf_action_id(n) = nodelib_gettoks(L, 3); } else { pdf_action_id(n) = (halfword) lua_tointeger(L, 3); } - } else if (luaS_ptr_eq(s, file)) { + } else if (lua_key_eq(s, file)) { pdf_action_file(n) = nodelib_gettoks(L, 3); - } else if (luaS_ptr_eq(s, new_window)) { + } else if (lua_key_eq(s, new_window)) { pdf_action_new_window(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, data)) { + } else if (lua_key_eq(s, data)) { pdf_action_tokens(n) = nodelib_gettoks(L, 3); - /* } else if (luaS_ptr_eq(s, ref_count)) { + /* } else if (lua_key_eq(s, ref_count)) { pdf_action_refcount(n) = (halfword) lua_tointeger(L, 3); */ } else { return nodelib_cantset(L, n, s); } } else if (t == unset_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ - } else if (luaS_ptr_eq(s, width)) { + } else if (lua_key_eq(s, width)) { width(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, height)) { + } else if (lua_key_eq(s, height)) { height(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, depth)) { + } else if (lua_key_eq(s, depth)) { depth(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, dir)) { + } else if (lua_key_eq(s, dir)) { box_dir(n) = nodelib_getdir(L, 3, 1); - } else if (luaS_ptr_eq(s, shrink)) { + } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_order)) { + } else if (lua_key_eq(s, glue_order)) { glue_order(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, glue_sign)) { + } else if (lua_key_eq(s, glue_sign)) { glue_sign(n) = (quarterword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, stretch)) { + } else if (lua_key_eq(s, stretch)) { glue_stretch(n) = (halfword) lua_tointeger(L, 3); - } else if (luaS_ptr_eq(s, count)) { + } else if (lua_key_eq(s, count)) { span_count(n) = (quarterword) lua_tointeger(L, 3); - } else if ((luaS_ptr_eq(s, list)) || (luaS_ptr_eq(s, head))){ + } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))){ list_ptr(n) = nodelib_popdirect(3); } else { return nodelib_cantset(L, n, s); } } else if (t == attribute_list_node) { - if (luaS_ptr_eq(s, subtype)) { + if (lua_key_eq(s, subtype)) { /* dummy subtype */ } else { return nodelib_cantset(L, n, s); @@ -6159,7 +5882,7 @@ static int lua_nodelib_direct_setbox(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (luaS_ptr_eq(s, global)) + if (lua_key_eq(s, global)) isglobal = 1; } return direct_vsetbox(L, isglobal); @@ -6232,6 +5955,238 @@ static int lua_nodelib_direct_is_node(lua_State * L) */ +/* if really needed we can provide this: + +static int lua_nodelib_attributes_to_table(lua_State * L) // hh +{ // <node|direct> + halfword n; + register halfword attribute; + if (lua_isnumber(L,1)) { + n = lua_tonumber(L,1); + } else { + n = *((halfword *) lua_touserdata(L, 1)); + } + if ((n == null) || (! nodetype_has_attributes(type(n)))) { + lua_pushnil(L); + } else { + attribute = node_attr(n); + if (attribute == null || (attribute == cache_disabled)) { + lua_pushnil(L); + } else { + if (! lua_istable(L,2)) { + lua_newtable(L); + } + while (attribute != null) { + lua_pushnumber(L,(int)attribute_id(attribute)); + lua_pushnumber(L,(int)attribute_value(attribute)); + lua_rawset(L,-3); + attribute = vlink(attribute) ; + } + } + } + return 1 ; +} + +*/ + +/* There is no gain here but let's keep it around: + +static int lua_nodelib_attributes_to_properties(lua_State * L) +{ // <node|direct> + halfword n; + register halfword attribute; + if (lua_isnumber(L,1)) { + n = lua_tonumber(L,1); + } else { + n = *((halfword *) lua_touserdata(L, 1)); + } + if (n == null) { + lua_pushnil(L); + return 1; + } + lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + while (n != null) { + lua_rawseti(L, -1, luaS_index(attributes)); + lua_newtable(L); + if (! nodetype_has_attributes(type(n))) { + lua_pushnil(L); + } else { + attribute = node_attr(n); + if (attribute == null || (attribute == cache_disabled)) { + lua_pushnil(L); + } else { + while (attribute != null) { + lua_pushnumber(L,(int)attribute_id(attribute)); + lua_pushnumber(L,(int)attribute_value(attribute)); + lua_rawset(L,-3); + attribute = vlink(attribute) ; + } + } + } + lua_rawset(Luas,-3); + n = vlink(n); + } + return 1 ; +} + +*/ + +/* Beware, enabling and disabling can result in an inconsistent properties table +but it might make sense sometimes. Of course by default we have disabled this +mechanism. And, one can always sweep the table empty. */ + +static int lua_nodelib_properties_set_mode(lua_State * L) /* hh */ +{ /* <boolean> */ + if (lua_isboolean(L,1)) { + lua_properties_enabled = lua_toboolean(L,1); + } + if (lua_isboolean(L,2)) { + lua_properties_use_metatable = lua_toboolean(L,2); + } + return 0; +} + +/* We used to have variants in assigned defaults but they made no sense. */ + +static int lua_nodelib_properties_flush_table(lua_State * L) /* hh */ +{ /* <node|direct> <number> */ + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + lua_pushnil(L); /* initializes lua_next */ + while (lua_next(L,-2) != 0) { + lua_pushvalue(L,-2); + lua_pushnil(L); + lua_settable(L,-5); + lua_pop(L,1); + } + return 1; +} + +/* maybe we should allocate a proper index 0..var_mem_max but not now */ + +static int lua_nodelib_get_property(lua_State * L) /* hh */ +{ /* <node> */ + halfword n; + n = *((halfword *) lua_touserdata(L, 1)); + if (n == null) { + lua_pushnil(L); + } else { + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + lua_rawgeti(L,-1,n); + } + return 1; +} + +static int lua_nodelib_direct_get_property(lua_State * L) /* hh */ +{ /* <direct> */ + halfword n = lua_tonumber(L, 1); + if (n == null) { + lua_pushnil(L); + } else { + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + lua_rawgeti(L,-1,n); + } + return 1; +} + +static int lua_nodelib_set_property(lua_State * L) /* hh */ +{ + /* <node> <value> */ + halfword n; + n = *((halfword *) lua_touserdata(L, 1)); + if (n != null) { + lua_settop(L,2); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + /* <node> <value> <propertytable> */ + lua_replace(L,-3); + /* <propertytable> <value> */ + lua_rawseti(L,-2,n); + } + return 0; +} + +static int lua_nodelib_direct_set_property(lua_State * L) /* hh */ +{ + /* <direct> <value> */ + halfword n = lua_tonumber(L, 1); + if (n != null) { // we could store in node instead */ + lua_settop(L,2); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + /* <node> <value> <propertytable> */ + lua_replace(L,1); + /* <propertytable> <value> */ + lua_rawseti(L,1,n); + } + return 0; +} + +static int lua_nodelib_direct_properties_get_table(lua_State * L) /* hh */ +{ /* <node|direct> */ + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties)); + lua_gettable(L, LUA_REGISTRYINDEX); + return 1; +} + +static int lua_nodelib_properties_get_table(lua_State * L) /* hh */ +{ /* <node|direct> */ + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(node_properties_indirect)); + lua_gettable(L, LUA_REGISTRYINDEX); + return 1; +} + +/* bonus */ + +static int lua_nodelib_get_property_t(lua_State * L) /* hh */ +{ /* <table> <node> */ + halfword n; + n = *((halfword *) lua_touserdata(L, 2)); + if (n == null) { + lua_pushnil(L); + } else { + lua_rawgeti(L,1,n); + } + return 1; +} + +static int lua_nodelib_set_property_t(lua_State * L) /* hh */ +{ + /* <table> <node> <value> */ + halfword n; + n = *((halfword *) lua_touserdata(L, 2)); + if (n != null) { + lua_settop(L,3); + lua_rawseti(L,1,n); + } + return 0; +} + +static const struct luaL_Reg nodelib_p[] = { + {"__index", lua_nodelib_get_property_t}, + {"__newindex", lua_nodelib_set_property_t}, + {NULL, NULL} /* sentinel */ +}; + +static void lua_new_properties_table(lua_State * L) /* hh */ +{ + lua_pushstring(L,"node.properties"); + lua_newtable(L); + lua_settable(L,LUA_REGISTRYINDEX); + + lua_pushstring(L,"node.properties.indirect"); + lua_newtable(L); + luaL_newmetatable(L,"node.properties.indirect.meta"); + luaL_register(L, NULL, nodelib_p); + lua_setmetatable(L,-2); + lua_settable(L,LUA_REGISTRYINDEX); +} + +/* end of properties experiment */ + /* node.direct.* */ static const struct luaL_Reg direct_nodelib_f[] = { @@ -6272,7 +6227,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"last_node", lua_nodelib_direct_last_node}, {"length", lua_nodelib_direct_length}, /* {"ligaturing", font_tex_ligaturing}, */ /* maybe direct too (rather basic callback exposure) */ - /* {"mlist_to_hlist", lua_nodelib_mlist_to_hlist}, */ /* maybe direct too (rather basic callback exposure) */ + /* {"mlist_to_hlist", lua_nodelib_mlist_to_hset_properties_modelist}, */ /* maybe direct too (rather basic callback exposure) */ {"new", lua_nodelib_direct_new}, /* {"next", lua_nodelib_next}, */ /* replaced by getnext */ /* {"prev", lua_nodelib_prev}, */ /* replaced by getprev */ @@ -6298,6 +6253,15 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"vpack", lua_nodelib_direct_vpack}, /* {"whatsits", lua_nodelib_whatsits}, */ /* no node argument */ {"write", lua_nodelib_direct_append}, + /* an experiment */ + /* {"attributes_to_table",lua_nodelib_attributes_to_table}, */ /* hh experiment */ + /* an experiment */ + {"set_properties_mode",lua_nodelib_properties_set_mode}, /* hh experiment */ + {"flush_properties_table",lua_nodelib_properties_flush_table}, /* hh experiment */ + {"get_properties_table",lua_nodelib_direct_properties_get_table}, /* hh experiment */ + {"getproperty", lua_nodelib_direct_get_property}, /* bonus */ /* hh experiment */ + {"setproperty", lua_nodelib_direct_set_property}, /* bonus */ /* hh experiment */ + /* done */ {NULL, NULL} /* sentinel */ }; @@ -6364,6 +6328,15 @@ static const struct luaL_Reg nodelib_f[] = { {"vpack", lua_nodelib_vpack}, {"whatsits", lua_nodelib_whatsits}, {"write", lua_nodelib_append}, + /* experiment */ + /* {"attributes_to_table",lua_nodelib_attributes_to_table}, */ /* hh experiment */ + /* experiment */ + {"set_properties_mode",lua_nodelib_properties_set_mode}, /* hh experiment */ + {"flush_properties_table",lua_nodelib_properties_flush_table}, /* hh experiment */ + {"get_properties_table",lua_nodelib_properties_get_table}, /* bonus */ /* hh experiment */ + {"getproperty", lua_nodelib_get_property}, /* hh experiment */ + {"setproperty", lua_nodelib_set_property}, /* hh experiment */ + /* done */ {NULL, NULL} /* sentinel */ }; @@ -6377,6 +6350,9 @@ static const struct luaL_Reg nodelib_m[] = { int luaopen_node(lua_State * L) { + + lua_new_properties_table(L); + /* the main metatable of node userdata */ luaL_newmetatable(L, NODE_METATABLE); /* node.* */ @@ -6394,7 +6370,7 @@ int luaopen_node(lua_State * L) luaL_register(L, NULL, direct_nodelib_f); lua_rawset(L,-3); /* initialization of keywords */ - initialize_luaS_indexes(L); + /*initialize_luaS_indexes(L);*/ return 1; } diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 6f7c0842637..00cffd398d7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -18,20 +18,21 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lpdflib.c 4524 2012-12-20 15:38:02Z taco $ " - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/lpdflib.c $"; + "$Id: lpdflib.c 4877 2014-03-14 01:26:05Z luigi $ " + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lpdflib.c $"; #include "ptexlib.h" #include "lua/luatex-api.h" -#define PDF_ENV "pdf_env" +#define PDF_ENV "pdf.env" static int luapdfprint(lua_State * L) { int n; - const_lstring st, modestr; + const_lstring st; + const char *modestr_s; ctm_transform_modes literal_mode; - st.s = modestr.s = NULL; + st.s = modestr_s = NULL; n = lua_gettop(L); if (!lua_isstring(L, -1)) { luaL_error(L, "no string to print"); @@ -41,10 +42,10 @@ static int luapdfprint(lua_State * L) if (!lua_isstring(L, -2)) { luaL_error(L, "invalid argument for print literal mode"); } else { - modestr.s = lua_tolstring(L, -2, &modestr.l); - if (modestr.l == 6 && strncmp(modestr.s, "direct", 6) == 0) - literal_mode = direct_always; - else if (modestr.l == 4 && strncmp(modestr.s, "page", 4) == 0) + modestr_s = lua_tostring(L, -2); + if (lua_key_eq(modestr_s,direct)) + literal_mode = direct_always; + else if (lua_key_eq(modestr_s,page)) literal_mode = direct_page; else { luaL_error(L, "invalid argument for print literal mode"); @@ -97,7 +98,8 @@ static int l_immediateobj(lua_State * L) int n, first_arg = 1; int k; lstring buf; - const_lstring st1, st2, st3; + const_lstring st1,st2, st3; + const char *st1_s = NULL; st1.s = st2.s = st3.s = NULL; check_o_mode(static_pdf, "immediateobj()", 1 << OMODE_PDF, true); if (global_shipping_mode != NOT_SHIPPING) @@ -124,8 +126,10 @@ static int l_immediateobj(lua_State * L) pdf_begin_obj(static_pdf, k, OBJSTM_ALWAYS); st1.s = lua_tolstring(L, first_arg, &st1.l); pdf_out_block(static_pdf, st1.s, st1.l); - if (st1.s[st1.l - 1] != '\n') - pdf_out(static_pdf, '\n'); + /* already in pdf_end_obj: + if (st1.s[st1.l - 1] != '\n') + pdf_out(static_pdf, '\n'); + */ pdf_end_obj(static_pdf); break; case 2: @@ -134,17 +138,18 @@ static int l_immediateobj(lua_State * L) luaL_error(L, "pdf.immediateobj() 1st argument must be string"); if (!lua_isstring(L, first_arg + 1)) luaL_error(L, "pdf.immediateobj() 2nd argument must be string"); - st1.s = lua_tolstring(L, first_arg, &st1.l); + st1_s = lua_tostring(L, first_arg); st2.s = lua_tolstring(L, first_arg + 1, &st2.l); - if (st1.l == 4 && strncmp((const char *) st1.s, "file", 4) == 0) { + if (lua_key_eq(st1_s, file)) { if (n == first_arg + 2) - luaL_error(L, - "pdf.immediateobj() 3rd argument forbidden in file mode"); + luaL_error(L, "pdf.immediateobj() 3rd argument forbidden in file mode"); pdf_begin_obj(static_pdf, k, OBJSTM_ALWAYS); buf.s = fread_to_buf(L, st2.s, &buf.l); pdf_out_block(static_pdf, (const char *) buf.s, buf.l); - if (buf.s[buf.l - 1] != '\n') - pdf_out(static_pdf, '\n'); + /* already in pdf_end_obj: + if (buf.s[buf.l - 1] != '\n') + pdf_out(static_pdf, '\n'); + */ xfree(buf.s); pdf_end_obj(static_pdf); } else { @@ -152,8 +157,7 @@ static int l_immediateobj(lua_State * L) pdf_begin_dict(static_pdf); if (n == first_arg + 2) { /* write attr text */ if (!lua_isstring(L, first_arg + 2)) - luaL_error(L, - "pdf.immediateobj() 3rd argument must be string"); + luaL_error(L, "pdf.immediateobj() 3rd argument must be string"); st3.s = lua_tolstring(L, first_arg + 2, &st3.l); pdf_out_block(static_pdf, st3.s, st3.l); if (st3.s[st3.l - 1] != '\n') @@ -162,11 +166,9 @@ static int l_immediateobj(lua_State * L) pdf_dict_add_streaminfo(static_pdf); pdf_end_dict(static_pdf); pdf_begin_stream(static_pdf); - if (st1.l == 6 && strncmp((const char *) st1.s, "stream", 6) == 0) { + if (lua_key_eq(st1_s, stream)) { pdf_out_block(static_pdf, st2.s, st2.l); - } else if (st1.l == 10 - && strncmp((const char *) st1.s, "streamfile", - 10) == 0) { + } else if (lua_key_eq(st1_s, streamfile)) { buf.s = fread_to_buf(L, st2.s, &buf.l); pdf_out_block(static_pdf, (const char *) buf.s, buf.l); xfree(buf.s); @@ -236,8 +238,9 @@ static int table_obj(lua_State * L) /* get object "type" */ - lua_pushstring(L, "type"); /* ks t */ - lua_gettable(L, -2); /* vs? t */ + /* lua_pushstring(L, "type"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* vs? t *\/ */ + lua_key_rawgeti(type); if (lua_isnil(L, -1)) /* !vs t */ luaL_error(L, "pdf.obj(): object \"type\" missing"); if (!lua_isstring(L, -1)) /* !vs t */ @@ -247,8 +250,7 @@ static int table_obj(lua_State * L) lua_pushvalue(L, -2); /* vs t vs t */ lua_gettable(L, -2); /* i? t vs t */ if (!lua_isnumber(L, -1)) /* !i t vs t */ - luaL_error(L, "pdf.obj(): \"%s\" is not a valid object type", - lua_tostring(L, -3)); + luaL_error(L, "pdf.obj(): \"%s\" is not a valid object type", lua_tostring(L, -3)); type = (int) lua_tointeger(L, -1); /* i t vs t */ switch (type) { case P_RAW: @@ -261,8 +263,9 @@ static int table_obj(lua_State * L) /* get optional "immediate" */ - lua_pushstring(L, "immediate"); /* ks t */ - lua_gettable(L, -2); /* b? t */ + /* lua_pushstring(L, "immediate"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* b? t *\/ */ + lua_key_rawgeti(immediate); if (!lua_isnil(L, -1)) { /* b? t */ if (!lua_isboolean(L, -1)) /* !b t */ luaL_error(L, "pdf.obj(): \"immediate\" must be boolean"); @@ -272,8 +275,9 @@ static int table_obj(lua_State * L) /* is a reserved object referenced by "objnum"? */ - lua_pushstring(L, "objnum"); /* ks t */ - lua_gettable(L, -2); /* vi? t */ + /* lua_pushstring(L, "objnum"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* vi? t *\/ */ + lua_key_rawgeti(objnum); if (!lua_isnil(L, -1)) { /* vi? t */ if (!lua_isnumber(L, -1)) /* !vi t */ luaL_error(L, "pdf.obj(): \"objnum\" must be integer"); @@ -294,12 +298,12 @@ static int table_obj(lua_State * L) /* get optional "attr" (allowed only for stream case) */ - lua_pushstring(L, "attr"); /* ks t */ - lua_gettable(L, -2); /* attr-s? t */ + /* lua_pushstring(L, "attr"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* attr-s? t *\/ */ + lua_key_rawgeti(attr); if (!lua_isnil(L, -1)) { /* attr-s? t */ if (type != P_STREAM) - luaL_error(L, - "pdf.obj(): \"attr\" key not allowed for non-stream object"); + luaL_error(L, "pdf.obj(): \"attr\" key not allowed for non-stream object"); if (!lua_isstring(L, -1)) /* !attr-s t */ luaL_error(L, "pdf.obj(): object \"attr\" must be string"); if (immediate == 1) { @@ -312,12 +316,12 @@ static int table_obj(lua_State * L) /* get optional "compresslevel" (allowed only for stream case) */ - lua_pushstring(L, "compresslevel"); /* ks t */ - lua_gettable(L, -2); /* vi? t */ + /* lua_pushstring(L, "compresslevel"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* vi? t *\/ */ + lua_key_rawgeti(compresslevel); if (!lua_isnil(L, -1)) { /* vi? t */ if (type == P_RAW) - luaL_error(L, - "pdf.obj(): \"compresslevel\" key not allowed for raw object"); + luaL_error(L, "pdf.obj(): \"compresslevel\" key not allowed for raw object"); if (!lua_isnumber(L, -1)) /* !vi t */ luaL_error(L, "pdf.obj(): \"compresslevel\" must be integer"); compress_level = (int) lua_tointeger(L, -1); /* vi t */ @@ -332,12 +336,12 @@ static int table_obj(lua_State * L) /* get optional "objcompression" (allowed only for non-stream case) */ - lua_pushstring(L, "objcompression"); /* ks t */ - lua_gettable(L, -2); /* b? t */ + /* lua_pushstring(L, "objcompression"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* b? t *\/ */ + lua_key_rawgeti(objcompression); if (!lua_isnil(L, -1)) { /* b? t */ if (type == P_STREAM) - luaL_error(L, - "pdf.obj(): \"objcompression\" key not allowed for stream object"); + luaL_error(L, "pdf.obj(): \"objcompression\" key not allowed for stream object"); if (!lua_isboolean(L, -1)) /* !b t */ luaL_error(L, "pdf.obj(): \"objcompression\" must be boolean"); obj_compression = lua_toboolean(L, -1); /* 0 or 1 */ @@ -353,13 +357,16 @@ static int table_obj(lua_State * L) /* now the object contents for all cases are handled */ - lua_pushstring(L, "string"); /* ks t */ - lua_gettable(L, -2); /* string-s? t */ - lua_pushstring(L, "file"); /* ks string-s? t */ - lua_gettable(L, -3); /* file-s? string-s? t */ + /* lua_pushstring(L, "string"); /\* ks t *\/ */ + /* lua_gettable(L, -2); /\* string-s? t *\/ */ + lua_key_rawgeti(string); + /* lua_pushstring(L, "file"); /\* ks string-s? t *\/ */ + /* lua_gettable(L, -3); /\* file-s? string-s? t *\/ */ + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(file)); + lua_gettable(L, -3); + if (!lua_isnil(L, -1) && !lua_isnil(L, -2)) /* file-s? string-s? t */ - luaL_error(L, - "pdf.obj(): \"string\" and \"file\" must not be given together"); + luaL_error(L, "pdf.obj(): \"string\" and \"file\" must not be given together"); if (lua_isnil(L, -1) && lua_isnil(L, -2)) /* nil nil t */ luaL_error(L, "pdf.obj(): no \"string\" or \"file\" given"); @@ -371,26 +378,28 @@ static int table_obj(lua_State * L) /* from string */ lua_pop(L, 1); /* string-s? t */ if (!lua_isstring(L, -1)) /* !string-s t */ - luaL_error(L, - "pdf.obj(): \"string\" must be string for raw object"); + luaL_error(L, "pdf.obj(): \"string\" must be string for raw object"); if (immediate == 1) { st.s = lua_tolstring(L, -1, &st.l); pdf_out_block(static_pdf, st.s, st.l); - if (st.s[st.l - 1] != '\n') - pdf_out(static_pdf, '\n'); + /* already in pdf_end_obj: + if (st.s[st.l - 1] != '\n') + pdf_out(static_pdf, '\n'); + */ } else obj_obj_data(static_pdf, k) = luaL_ref(L, LUA_REGISTRYINDEX); /* t */ } else { /* from file */ if (!lua_isstring(L, -1)) /* !file-s nil t */ - luaL_error(L, - "pdf.obj(): \"file\" name must be string for raw object"); + luaL_error(L, "pdf.obj(): \"file\" name must be string for raw object"); if (immediate == 1) { st.s = lua_tolstring(L, -1, &st.l); /* file-s nil t */ buf.s = fread_to_buf(L, st.s, &buf.l); pdf_out_block(static_pdf, (const char *) buf.s, buf.l); - if (buf.s[buf.l - 1] != '\n') - pdf_out(static_pdf, '\n'); + /* already in pdf_end_obj: + if (buf.s[buf.l - 1] != '\n') + pdf_out(static_pdf, '\n'); + */ xfree(buf.s); } else { set_obj_obj_is_file(static_pdf, k); @@ -423,8 +432,7 @@ static int table_obj(lua_State * L) /* from string */ lua_pop(L, 1); /* string-s? t */ if (!lua_isstring(L, -1)) /* !string-s t */ - luaL_error(L, - "pdf.obj(): \"string\" must be string for stream object"); + luaL_error(L, "pdf.obj(): \"string\" must be string for stream object"); if (immediate == 1) { st.s = lua_tolstring(L, -1, &st.l); /* string-s t */ pdf_out_block(static_pdf, st.s, st.l); @@ -433,8 +441,7 @@ static int table_obj(lua_State * L) } else { /* from file */ if (!lua_isstring(L, -1)) /* !file-s nil t */ - luaL_error(L, - "pdf.obj(): \"file\" name must be string for stream object"); + luaL_error(L, "pdf.obj(): \"file\" name must be string for stream object"); if (immediate == 1) { st.s = lua_tolstring(L, -1, &st.l); /* file-s nil t */ buf.s = fread_to_buf(L, st.s, &buf.l); @@ -461,8 +468,7 @@ static int orig_obj(lua_State * L) { int n, first_arg = 1; int k; - const_lstring st; - st.s = NULL; + const char *st_s = NULL ; n = lua_gettop(L); if (n > 0 && lua_type(L, 1) == LUA_TNUMBER) { first_arg++; @@ -491,8 +497,8 @@ static int orig_obj(lua_State * L) luaL_error(L, "pdf.obj() 1st argument must be string"); if (!lua_isstring(L, first_arg + 1)) luaL_error(L, "pdf.obj() 2nd argument must be string"); - st.s = lua_tolstring(L, first_arg, &st.l); - if (st.l == 4 && strncmp((const char *) st.s, "file", 4) == 0) { + st_s = lua_tostring(L, first_arg); + if (lua_key_eq(st_s, file)) { if (n == first_arg + 2) luaL_error(L, "pdf.obj() 3rd argument forbidden in file mode"); set_obj_obj_is_file(static_pdf, k); @@ -503,10 +509,9 @@ static int orig_obj(lua_State * L) obj_obj_stream_attr(static_pdf, k) = luaL_ref(Luas, LUA_REGISTRYINDEX); } - if (st.l == 6 && strncmp((const char *) st.s, "stream", 6) == 0) { + if (lua_key_eq(st_s, stream)) { set_obj_obj_is_stream(static_pdf, k); - } else if (st.l == 10 - && strncmp((const char *) st.s, "streamfile", 10) == 0) { + } else if (lua_key_eq(st_s, streamfile)) { set_obj_obj_is_stream(static_pdf, k); set_obj_obj_is_file(static_pdf, k); } else @@ -550,8 +555,7 @@ static int l_refobj(lua_State * L) static int l_reserveobj(lua_State * L) { int n; - const_lstring st; - st.s = 0; + const char *st_s = NULL; n = lua_gettop(L); switch (n) { case 0: @@ -562,8 +566,7 @@ static int l_reserveobj(lua_State * L) case 1: if (!lua_isstring(L, -1)) luaL_error(L, "pdf.reserveobj() optional argument must be string"); - st.s = lua_tolstring(L, 1, &st.l); - if (st.l == 5 && strncmp((const char *) st.s, "annot", 5) == 0) { + if (lua_key_eq(st_s, annot)) { pdf_last_annot = pdf_create_obj(static_pdf, obj_type_annot, 0); } else { luaL_error(L, "pdf.reserveobj() optional string must be \"annot\""); @@ -587,8 +590,7 @@ static int l_registerannot(lua_State * L) luaL_error(L, "pdf.registerannot() can only be used in late lua"); i = (int) luaL_checkinteger(L, 1); if (i <= 0) - luaL_error(L, - "pdf.registerannot() can only register positive object numbers"); + luaL_error(L, "pdf.registerannot() can only register positive object numbers"); addto_page_resources(static_pdf, obj_type_annot, i); break; default: @@ -764,6 +766,53 @@ static int l_pageref(lua_State * L) return 1; } +static int l_getpos(lua_State * L) +{ + lua_pushnumber(L, static_pdf->posstruct->pos.h); + lua_pushnumber(L, static_pdf->posstruct->pos.v); + return 2; +} + +static int l_gethpos(lua_State * L) +{ + lua_pushnumber(L, static_pdf->posstruct->pos.h); + return 1; +} + +static int l_getvpos(lua_State * L) +{ + lua_pushnumber(L, static_pdf->posstruct->pos.v); + return 1; +} + +static int l_getmatrix(lua_State * L) +{ + if (matrix_stack_used > 0) { + matrix_entry *m = &matrix_stack[matrix_stack_used - 1]; + lua_pushnumber(L, m->a); + lua_pushnumber(L, m->b); + lua_pushnumber(L, m->c); + lua_pushnumber(L, m->d); + lua_pushnumber(L, m->e); + lua_pushnumber(L, m->f); + } else { + lua_pushnumber(L, 1); + lua_pushnumber(L, 0); + lua_pushnumber(L, 0); + lua_pushnumber(L, 1); + lua_pushnumber(L, 0); + lua_pushnumber(L, 0); + } + return 6 ; +} + +static int l_hasmatrix(lua_State * L) +{ + lua_pushboolean(L, (matrix_stack_used > 0)); + return 1 ; +} + + static const struct luaL_Reg pdflib[] = { {"immediateobj", l_immediateobj}, {"mapfile", l_mapfile}, @@ -778,6 +827,11 @@ static const struct luaL_Reg pdflib[] = { {"refobj", l_refobj}, {"registerannot", l_registerannot}, {"reserveobj", l_reserveobj}, + {"getpos", l_getpos}, + {"gethpos", l_gethpos}, + {"getvpos", l_getvpos}, + {"getmatrix", l_getmatrix}, + {"hasmatrix", l_hasmatrix}, {NULL, NULL} /* sentinel */ }; @@ -788,7 +842,7 @@ int luaopen_pdf(lua_State * L) preset_environment(L, pdf_parms, PDF_ENV); luaL_register(L, "pdf", pdflib); /* build meta table */ - luaL_newmetatable(L, "pdf_meta"); + luaL_newmetatable(L, "pdf.meta"); lua_pushstring(L, "__index"); lua_pushcfunction(L, getpdf); /* do these later, NYI */ diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index 59ab92cbde6..6c2413137c7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -18,8 +18,8 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: lstatslib.c 4524 2012-12-20 15:38:02Z taco $ " - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/lstatslib.c $"; + "$Id: lstatslib.c 4857 2014-03-07 00:01:41Z luigi $ " + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/lstatslib.c $"; #include "ptexlib.h" #include "lua/luatex-api.h" @@ -78,6 +78,25 @@ static const char *luatexrevision(void) return (const char *) (strrchr(luatex_version_string, '.') + 1); } +static lua_Number get_luatexhashchars(void) +{ +#ifdef LuajitTeX + return (lua_Number) LUAJITTEX_HASHCHARS; +#else + return (lua_Number) LUATEX_HASHCHARS; +#endif +} + +static const char *get_luatexhashtype(void) +{ +#ifdef LuajitTeX + return (const char *)jithash_hashname; +#else + return "lua"; +#endif +} + + static lua_Number get_pdf_gone(void) { if (static_pdf != NULL) @@ -172,6 +191,10 @@ static struct statistic stats[] = { {"luatex_svn", 'G', &get_luatexsvn}, {"luatex_version", 'G', &get_luatexversion}, {"luatex_revision", 'S', (void *) &luatexrevision}, + {"luatex_hashtype", 'S', (void *) &get_luatexhashtype}, + {"luatex_hashchars", 'N', &get_luatexhashchars}, + + {"ini_version", 'b', &ini_version}, /* * mem stat @@ -344,7 +367,7 @@ static const struct luaL_Reg statslib[] = { int luaopen_stats(lua_State * L) { luaL_register(L, "status", statslib); - luaL_newmetatable(L, "stats_meta"); + luaL_newmetatable(L, "tex.stats"); lua_pushstring(L, "__index"); lua_pushcfunction(L, getstats); lua_settable(L, -3); diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c index 46f8956f87f..630ed333d51 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c @@ -21,24 +21,25 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: ltexiolib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/ltexiolib.c $"; + "$Id: ltexiolib.c 4847 2014-03-05 18:13:17Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexiolib.c $"; typedef void (*texio_printer) (const char *); static char *loggable_info = NULL; + static boolean get_selector_value(lua_State * L, int i, int *l) { boolean r = false; if (lua_isstring(L, i)) { const char *s = lua_tostring(L, i); - if (strcmp(s, "log") == 0) { + if (lua_key_eq(s,log)) { *l = log_only; r = true; - } else if (strcmp(s, "term") == 0) { + } else if (lua_key_eq(s,term)) { *l = term_only; r = true; - } else if (strcmp(s, "term and log") == 0) { + } else if (lua_key_eq(s,term_and_log)) { *l = term_and_log; r = true; } diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index cbc01ed4763..905b1694164 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -27,7 +27,7 @@ setter no prev link is created so we can presume that it's not used later on. */ static const char _svn_version[] = - "$Id: ltexlib.c 4775 2014-02-07 12:36:34Z luigi $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; + "$Id: ltexlib.c 4878 2014-03-14 10:48:03Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltexlib.c $"; #define attribute(A) eqtb[attribute_base+(A)].hh.rh #define dimen(A) eqtb[scaled_base+(A)].hh.rh @@ -37,6 +37,11 @@ static const char _svn_version[] = #define count(A) eqtb[count_base+(A)].hh.rh #define box(A) equiv(box_base+(A)) +/* tex random generators */ +extern int unif_rand(int ); +extern int norm_rand(void ); +extern void init_randoms(int ); + typedef struct { char *text; @@ -62,6 +67,8 @@ static int spindle_size = 0; static spindle *spindles = NULL; static int spindle_index = 0; + + static void luac_store(lua_State * L, int i, int partial, int cattable) { char *st; @@ -102,8 +109,8 @@ static int do_luacprint(lua_State * L, int partial, int deftable) cattable=(int)lua_tonumber(L, 1); startstrings = 2; if (cattable != -1 && cattable != -2 && !valid_catcode_table(cattable)) { - cattable = DEFAULT_CAT_TABLE; - } + cattable = DEFAULT_CAT_TABLE; + } } } if (lua_type(L, startstrings) == LUA_TTABLE) { @@ -123,10 +130,24 @@ static int do_luacprint(lua_State * L, int partial, int deftable) } luac_store(L, i, partial, cattable); } + /* hh: We could use this but it makes not much different, apart from allocating more ropes so less + memory. To be looked into: lua 5.2 buffer mechanism as now we still hash the concatination. This + test was part of the why-eis-luajit-so-slow on crited experiments. */ + /* + if (startstrings == n) { + luac_store(L, n, partial, cattable); + } else { + lua_concat(L,n-startstrings+1); + luac_store(L, startstrings, partial, cattable); + } + */ } return 0; } + + + static int luacwrite(lua_State * L) { return do_luacprint(L, FULL_LINE, NO_CAT_TABLE); @@ -686,7 +707,7 @@ static int setdimen(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsetdimen(L, isglobal); @@ -729,7 +750,7 @@ static int setskip(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsetskip(L, isglobal); @@ -773,7 +794,7 @@ static int setcount(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsetcount(L, isglobal); @@ -816,7 +837,7 @@ static int setattribute(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsetattribute(L, isglobal); @@ -868,7 +889,7 @@ static int settoks(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsettoks(L, isglobal); @@ -962,7 +983,7 @@ static int setbox(lua_State * L) int n = lua_gettop(L); if (n == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } return vsetbox(L, isglobal); @@ -985,7 +1006,7 @@ static int setcode (lua_State *L, void (*setone)(int,halfword,quarterword), f++; if (n>2 && lua_isstring(L, f)) { const char *s = lua_tostring(L, f); - if (strcmp(s, "global") == 0) { + if (lua_key_eq(s,global)) { level = level_one; f++; } @@ -1054,7 +1075,7 @@ static int setcatcode(lua_State * L) f++; if (n>2 && lua_isstring(L, f)) { const char *s = lua_tostring(L, f); - if (strcmp(s, "global") == 0) { + if (lua_key_eq(s,global)) { level = level_one; f++; } @@ -1094,7 +1115,7 @@ static int setmathcode(lua_State * L) f++; if (n>2 && lua_isstring(L, f)) { const char *s = lua_tostring(L, f); - if (strcmp(s, "global") == 0) { + if (lua_key_eq(s,global)) { level = level_one; f++; } @@ -1149,7 +1170,7 @@ static int setdelcode(lua_State * L) f++; if (n>2 && lua_isstring(L, f)) { const char *s = lua_tostring(L, f); - if (strcmp(s, "global") == 0) { + if (lua_key_eq(s,global)) { level = level_one; f++; } @@ -1215,7 +1236,7 @@ static int settex(lua_State * L) if (is_primitive(texstr)) { if (i == 3 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) isglobal = 1; } cur_cs1 = string_lookup(st, k); @@ -1439,7 +1460,7 @@ static int tex_setmathparm(lua_State * L) if ((n == 3) || (n == 4)) { if (n == 4 && lua_isstring(L, 1)) { const char *s = lua_tostring(L, 1); - if (strcmp(s, "global") == 0) + if (lua_key_eq(s,global)) l = 1; } i = luaL_checkoption(L, (n - 2), NULL, math_param_names); @@ -1600,44 +1621,44 @@ static int getlist(lua_State * L) const char *str; if (lua_isstring(L, 2)) { str = lua_tostring(L, 2); - if (strcmp(str, "page_ins_head") == 0) { + if (lua_key_eq(str,page_ins_head)) { if (vlink(page_ins_head) == page_ins_head) lua_pushnumber(L, null); else lua_pushnumber(L, vlink(page_ins_head)); lua_nodelib_push(L); - } else if (strcmp(str, "contrib_head") == 0) { + } else if (lua_key_eq(str,contrib_head)) { alink(vlink(contrib_head)) = null ; lua_pushnumber(L, vlink(contrib_head)); lua_nodelib_push(L); - } else if (strcmp(str, "page_head") == 0) { + } else if (lua_key_eq(str,page_head)) { alink(vlink(page_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(page_head)); lua_nodelib_push(L); - } else if (strcmp(str, "temp_head") == 0) { + } else if (lua_key_eq(str,temp_head)) { alink(vlink(temp_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(temp_head)); lua_nodelib_push(L); - } else if (strcmp(str, "hold_head") == 0) { + } else if (lua_key_eq(str,hold_head)) { alink(vlink(hold_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(hold_head)); lua_nodelib_push(L); - } else if (strcmp(str, "adjust_head") == 0) { + } else if (lua_key_eq(str,adjust_head)) { alink(vlink(adjust_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(adjust_head)); lua_nodelib_push(L); - } else if (strcmp(str, "best_page_break") == 0) { + } else if (lua_key_eq(str,best_page_break)) { lua_pushnumber(L, best_page_break); lua_nodelib_push(L); - } else if (strcmp(str, "least_page_cost") == 0) { + } else if (lua_key_eq(str,least_page_cost)) { lua_pushnumber(L, least_page_cost); - } else if (strcmp(str, "best_size") == 0) { + } else if (lua_key_eq(str,best_size)) { lua_pushnumber(L, best_size); - } else if (strcmp(str, "pre_adjust_head") == 0) { + } else if (lua_key_eq(str,pre_adjust_head)) { alink(vlink(pre_adjust_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(pre_adjust_head)); lua_nodelib_push(L); - } else if (strcmp(str, "align_head") == 0) { + } else if (lua_key_eq(str,align_head)) { alink(vlink(align_head)) = null ;/*hh-ls */ lua_pushnumber(L, vlink(align_head)); lua_nodelib_push(L); @@ -1657,16 +1678,16 @@ static int setlist(lua_State * L) halfword n = 0; if (lua_isstring(L, 2)) { str = lua_tostring(L, 2); - if (strcmp(str, "best_size") == 0) { + if (lua_key_eq(str,best_size)) { best_size = (int) lua_tointeger(L, 3); - } else if (strcmp(str, "least_page_cost") == 0) { + } else if (lua_key_eq(str,least_page_cost)) { least_page_cost = (int) lua_tointeger(L, 3); } else { if (!lua_isnil(L, 3)) { n_ptr = check_isnode(L, 3); n = *n_ptr; } - if (strcmp(str, "page_ins_head") == 0) { + if (lua_key_eq(str,page_ins_head)) { if (n == 0) { vlink(page_ins_head) = page_ins_head; } else { @@ -1675,27 +1696,27 @@ static int setlist(lua_State * L) m = tail_of_list(n); vlink(m) = page_ins_head; } - } else if (strcmp(str, "contrib_head") == 0) { + } else if (lua_key_eq(str,contrib_head)) { vlink(contrib_head) = n; if (n == 0) { contrib_tail = contrib_head; } - } else if (strcmp(str, "best_page_break") == 0) { + } else if (lua_key_eq(str,best_page_break)) { best_page_break = n; - } else if (strcmp(str, "page_head") == 0) { + } else if (lua_key_eq(str,page_head)) { vlink(page_head) = n; page_tail = (n == 0 ? page_head : tail_of_list(n)); - } else if (strcmp(str, "temp_head") == 0) { + } else if (lua_key_eq(str,temp_head)) { vlink(temp_head) = n; - } else if (strcmp(str, "hold_head") == 0) { + } else if (lua_key_eq(str,hold_head)) { vlink(hold_head) = n; - } else if (strcmp(str, "adjust_head") == 0) { + } else if (lua_key_eq(str,adjust_head)) { vlink(adjust_head) = n; adjust_tail = (n == 0 ? adjust_head : tail_of_list(n)); - } else if (strcmp(str, "pre_adjust_head") == 0) { + } else if (lua_key_eq(str,pre_adjust_head)) { vlink(pre_adjust_head) = n; pre_adjust_tail = (n == 0 ? pre_adjust_head : tail_of_list(n)); - } else if (strcmp(str, "align_head") == 0) { + } else if (lua_key_eq(str,align_head)) { vlink(align_head) = n; } } @@ -1710,32 +1731,32 @@ static int lua_nest_getfield(lua_State * L) list_state_record *r, **rv = lua_touserdata(L, -2); const char *field = lua_tostring(L, -1); r = *rv; - if (strcmp(field, "mode") == 0) { + if (lua_key_eq(field,mode)) { lua_pushnumber(L, r->mode_field); - } else if (strcmp(field, "head") == 0) { + } else if (lua_key_eq(field,head)) { lua_nodelib_push_fast(L, r->head_field); - } else if (strcmp(field, "tail") == 0) { + } else if (lua_key_eq(field,tail)) { lua_nodelib_push_fast(L, r->tail_field); - } else if (strcmp(field, "delimptr") == 0) { + } else if (lua_key_eq(field,delimptr)) { lua_pushnumber(L, r->eTeX_aux_field); lua_nodelib_push(L); - } else if (strcmp(field, "prevgraf") == 0) { + } else if (lua_key_eq(field,prevgraf)) { lua_pushnumber(L, r->pg_field); - } else if (strcmp(field, "modeline") == 0) { + } else if (lua_key_eq(field,modeline)) { lua_pushnumber(L, r->ml_field); - } else if (strcmp(field, "prevdepth") == 0) { + } else if (lua_key_eq(field,prevdepth)) { lua_pushnumber(L, r->prev_depth_field); - } else if (strcmp(field, "spacefactor") == 0) { + } else if (lua_key_eq(field,spacefactor)) { lua_pushnumber(L, r->space_factor_field); - } else if (strcmp(field, "noad") == 0) { + } else if (lua_key_eq(field,noad)) { lua_pushnumber(L, r->incompleat_noad_field); lua_nodelib_push(L); - } else if (strcmp(field, "dirs") == 0) { + } else if (lua_key_eq(field,dirs)) { lua_pushnumber(L, r->dirs_field); lua_nodelib_push(L); - } else if (strcmp(field, "mathdir") == 0) { + } else if (lua_key_eq(field,mathdir)) { lua_pushboolean(L, r->math_field); - } else if (strcmp(field, "mathstyle") == 0) { + } else if (lua_key_eq(field,mathstyle)) { lua_pushnumber(L, r->math_style_field); } else { lua_pushnil(L); @@ -1750,39 +1771,39 @@ static int lua_nest_setfield(lua_State * L) list_state_record *r, **rv = lua_touserdata(L, -3); const char *field = lua_tostring(L, -2); r = *rv; - if (strcmp(field, "mode") == 0) { + if (lua_key_eq(field,mode)) { i=(int)lua_tonumber(L, -1); r->mode_field = i; - } else if (strcmp(field, "head") == 0) { + } else if (lua_key_eq(field,head)) { n = check_isnode(L, -1); r->head_field = *n; - } else if (strcmp(field, "tail") == 0) { + } else if (lua_key_eq(field,tail)) { n = check_isnode(L, -1); r->tail_field = *n; - } else if (strcmp(field, "delimptr") == 0) { + } else if (lua_key_eq(field,delimptr)) { n = check_isnode(L, -1); r->eTeX_aux_field = *n; - } else if (strcmp(field, "prevgraf") == 0) { + } else if (lua_key_eq(field,prevgraf)) { i=(int)lua_tonumber(L, -1); r->pg_field = i; - } else if (strcmp(field, "modeline") == 0) { + } else if (lua_key_eq(field,modeline)) { i=(int)lua_tonumber(L, -1); r->ml_field = i; - } else if (strcmp(field, "prevdepth") == 0) { + } else if (lua_key_eq(field,prevdepth)) { i=(int)lua_tonumber(L, -1); r->prev_depth_field = i; - } else if (strcmp(field, "spacefactor") == 0) { + } else if (lua_key_eq(field,spacefactor)) { i=(int)lua_tonumber(L, -1); r->space_factor_field = i; - } else if (strcmp(field, "noad") == 0) { + } else if (lua_key_eq(field,noad)) { n = check_isnode(L, -1); r->incompleat_noad_field = *n; - } else if (strcmp(field, "dirs") == 0) { + } else if (lua_key_eq(field,dirs)) { n = check_isnode(L, -1); r->dirs_field = *n; - } else if (strcmp(field, "mathdir") == 0) { + } else if (lua_key_eq(field,mathdir)) { r->math_field = lua_toboolean(L, -1); - } else if (strcmp(field, "mathstyle") == 0) { + } else if (lua_key_eq(field,mathstyle)) { i=(int)lua_tonumber(L, -1); r->math_style_field = i; } @@ -1818,7 +1839,7 @@ static int getnest(lua_State * L) } } else if (lua_isstring(L, 2)) { const char *s = lua_tostring(L, 2); - if (strcmp(s, "ptr") == 0) { + if (lua_key_eq(s,ptr)) { lua_pushnumber(L, nest_ptr); } else { lua_pushnil(L); @@ -1981,21 +2002,21 @@ static int tex_extraprimitives(lua_State * L) for (i = 1; i <= n; i++) { if (lua_isstring(L, i)) { const char *s = lua_tostring(L, i); - if (strcmp(s, "etex") == 0) { + if (lua_key_eq(s,etex)) { mask |= etex_command; - } else if (strcmp(s, "tex") == 0) { + } else if (lua_key_eq(s,tex)) { mask |= tex_command; - } else if (strcmp(s, "core") == 0) { + } else if (lua_key_eq(s,core)) { mask |= core_command; - } else if (strcmp(s, "pdftex") == 0) { + } else if (lua_key_eq(s,pdftex)) { mask |= pdftex_command; - } else if (strcmp(s, "aleph") == 0) { + } else if (lua_key_eq(s,aleph)) { mask |= aleph_command; - } else if (strcmp(s, "omega") == 0) { + } else if (lua_key_eq(s,omega)) { mask |= omega_command; - } else if (strcmp(s, "luatex") == 0) { + } else if (lua_key_eq(s,luatex)) { mask |= luatex_command | umath_command; - } else if (strcmp(s, "umath") == 0) { + } else if (lua_key_eq(s,umath)) { mask |= umath_command; } } @@ -2420,6 +2441,69 @@ static int tex_run_boot(lua_State * L) } +/* tex random generators */ +static int tex_init_rand(lua_State * L) +{ + int sp; + if (!lua_isnumber(L, 1)) { + luaL_error(L, "argument must be a number"); + return 0; + } + sp=(int)lua_tonumber(L, 1); + init_randoms(sp); + return 0; +} + +static int tex_unif_rand(lua_State * L) +{ + int sp; + if (!lua_isnumber(L, 1)) { + luaL_error(L, "argument must be a number"); + return 0; + } + sp=(int)lua_tonumber(L, 1); + lua_pushnumber(L, unif_rand(sp)); + return 1; +} + +static int tex_norm_rand(lua_State * L) +{ + lua_pushnumber(L, norm_rand()); + return 1; +} + +/* Same as lua but with tex rng */ +static int lua_math_random (lua_State *L) +{ + lua_Number rand_max = 0x7fffffff ; + lua_Number r = unif_rand(rand_max) ; + r = (r>=0 ? 0+r : 0-r) ; + r = r / rand_max; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + lua_Number u = luaL_checknumber(L, 1); + luaL_argcheck(L, (lua_Number)1.0 <= u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u) + (lua_Number)(1.0)); /* [1, u] */ + break; + } + case 2: { /* lower and upper limits */ + lua_Number l = luaL_checknumber(L, 1); + lua_Number u = luaL_checknumber(L, 2); + luaL_argcheck(L, l <= u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1)) + l); /* [l, u] */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + + static int tex_run_main(lua_State * L) { (void) L; @@ -2436,6 +2520,8 @@ static int tex_run_end(lua_State * L) return 0; } + + void init_tex_table(lua_State * L) { lua_createtable(L, 0, 3); @@ -2455,7 +2541,6 @@ static const struct luaL_Reg texlib[] = { {"run", tex_run_main}, /* may be needed */ {"finish", tex_run_end}, /* may be needed */ {"write", luacwrite}, - {"write", luacwrite}, {"print", luacprint}, {"tprint", luactprint}, {"error", texerror}, @@ -2513,6 +2598,12 @@ static const struct luaL_Reg texlib[] = { {"setmath", tex_setmathparm}, {"getmath", tex_getmathparm}, {"linebreak", tex_run_linebreak}, + /* tex random generators */ + {"init_rand", tex_init_rand}, + {"uniform_rand",tex_unif_rand}, + {"normal_rand", tex_norm_rand}, + {"lua_math_randomseed", tex_init_rand}, /* syntactic sugar */ + {"lua_math_random", lua_math_random}, {NULL, NULL} /* sentinel */ }; @@ -2520,25 +2611,25 @@ int luaopen_tex(lua_State * L) { luaL_register(L, "tex", texlib); /* *INDENT-OFF* */ - make_table(L, "attribute", "getattribute", "setattribute"); - make_table(L, "skip", "getskip", "setskip"); - make_table(L, "dimen", "getdimen", "setdimen"); - make_table(L, "count", "getcount", "setcount"); - make_table(L, "toks", "gettoks", "settoks"); - make_table(L, "box", "getbox", "setbox"); - make_table(L, "sfcode", "getsfcode", "setsfcode"); - make_table(L, "lccode", "getlccode", "setlccode"); - make_table(L, "uccode", "getuccode", "setuccode"); - make_table(L, "catcode", "getcatcode", "setcatcode"); - make_table(L, "mathcode", "getmathcode", "setmathcode"); - make_table(L, "delcode", "getdelcode", "setdelcode"); - make_table(L, "lists", "getlist", "setlist"); - make_table(L, "nest", "getnest", "setnest"); + make_table(L, "attribute", "tex.attribute" ,"getattribute", "setattribute"); + make_table(L, "skip", "tex.skip" ,"getskip", "setskip"); + make_table(L, "dimen", "tex.dimen" ,"getdimen", "setdimen"); + make_table(L, "count", "tex.count" ,"getcount", "setcount"); + make_table(L, "toks", "tex.toks" ,"gettoks", "settoks"); + make_table(L, "box", "tex.box" ,"getbox", "setbox"); + make_table(L, "sfcode", "tex.sfcode" ,"getsfcode", "setsfcode"); + make_table(L, "lccode", "tex.lccode" ,"getlccode", "setlccode"); + make_table(L, "uccode", "tex.uccode" ,"getuccode", "setuccode"); + make_table(L, "catcode", "tex.catcode" ,"getcatcode", "setcatcode"); + make_table(L, "mathcode", "tex.mathcode" ,"getmathcode", "setmathcode"); + make_table(L, "delcode", "tex.delcode" ,"getdelcode", "setdelcode"); + make_table(L, "lists", "tex.lists" ,"getlist", "setlist"); + make_table(L, "nest", "tex.nest" ,"getnest", "setnest"); /* *INDENT-ON* */ init_nest_lib(L); /* make the meta entries */ /* fetch it back */ - luaL_newmetatable(L, "tex_meta"); + luaL_newmetatable(L, "tex.meta"); lua_pushstring(L, "__index"); lua_pushcfunction(L, gettex); lua_settable(L, -3); diff --git a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c index b3188bd3f35..c575614c537 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c @@ -21,7 +21,7 @@ #include "lua/luatex-api.h" static const char _svn_version[] = - "$Id: ltokenlib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/ltokenlib.c $"; + "$Id: ltokenlib.c 4524 2012-12-20 15:38:02Z taco $ $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/ltokenlib.c $"; #define is_valid_token(L,i) (lua_istable(L,i) && lua_rawlen(L,i)==3) #define get_token_cmd(L,i) lua_rawgeti(L,i,1) diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index a65ae045f14..66312164133 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: luainit.w 4736 2014-01-08 09:50:31Z luigi $" + "$Id: luainit.w 4881 2014-03-14 12:51:16Z taco $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luainit.w $"; #include "ptexlib.h" @@ -28,6 +28,253 @@ static const char _svn_version[] = #include "lua/luatex-api.h" +/* internalized strings: see luatex-api.h */ +make_lua_key(LTL); +make_lua_key(MathConstants); +make_lua_key(RTT); +make_lua_key(TLT); +make_lua_key(TRT); +make_lua_key(accent); +make_lua_key(action); +make_lua_key(action_id); +make_lua_key(action_type); +make_lua_key(additional); +make_lua_key(adjust_head); +make_lua_key(advance); +make_lua_key(aleph); +make_lua_key(align_head); +make_lua_key(area); +make_lua_key(attr); +make_lua_key(attributes); +make_lua_key(auto_expand); +make_lua_key(best_ins_ptr); +make_lua_key(best_page_break); +make_lua_key(best_size); +make_lua_key(bot); +make_lua_key(bot_accent); +make_lua_key(bottom_left); +make_lua_key(bottom_right); +make_lua_key(box_left); +make_lua_key(box_left_width); +make_lua_key(box_right); +make_lua_key(box_right_width); +make_lua_key(broken_ins); +make_lua_key(broken_ptr); +make_lua_key(cache); +make_lua_key(cal_expand_ratio); +make_lua_key(char); +make_lua_key(characters); +make_lua_key(checksum); +make_lua_key(cidinfo); +make_lua_key(class); +make_lua_key(command); +make_lua_key(commands); +make_lua_key(comment); +make_lua_key(components); +make_lua_key(contrib_head); +make_lua_key(core); +make_lua_key(cost); +make_lua_key(count); +make_lua_key(data); +make_lua_key(degree); +make_lua_key(delim); +make_lua_key(delimptr); +make_lua_key(denom); +make_lua_key(depth); +make_lua_key(designsize); +make_lua_key(dest_id); +make_lua_key(dest_type); +make_lua_key(dir); +make_lua_key(dir_h); +make_lua_key(direction); +make_lua_key(dirs); +make_lua_key(display); +make_lua_key(down); +make_lua_key(dvi_ptr); +make_lua_key(embedding); +make_lua_key(encodingbytes); +make_lua_key(encodingname); +make_lua_key(end); +make_lua_key(etex); +make_lua_key(exactly); +make_lua_key(expansion_factor); +make_lua_key(ext); +make_lua_key(extend); +make_lua_key(extender); +make_lua_key(extensible); +make_lua_key(extra_space); +make_lua_key(fam); +make_lua_key(fast); +make_lua_key(file); +make_lua_key(filename); +make_lua_key(font); +make_lua_key(fonts); +make_lua_key(format); +make_lua_key(fullname); +make_lua_key(global); +make_lua_key(glue_order); +make_lua_key(glue_set); +make_lua_key(glue_sign); +make_lua_key(glyph); +make_lua_key(head); +make_lua_key(height); +make_lua_key(hold_head); +make_lua_key(horiz_variants); +make_lua_key(hyphenchar); +make_lua_key(id); +make_lua_key(image); +make_lua_key(index); +make_lua_key(italic); +make_lua_key(kern); +make_lua_key(kerns); +make_lua_key(lang); +make_lua_key(large_char); +make_lua_key(large_fam); +make_lua_key(last_ins_ptr); +make_lua_key(leader); +make_lua_key(least_page_cost); +make_lua_key(left); +make_lua_key(left_boundary); +make_lua_key(left_protruding); +make_lua_key(level); +make_lua_key(ligatures); +make_lua_key(link_attr); +make_lua_key(list); +make_lua_key(log); +make_lua_key(lua); +make_lua_key(luatex); +make_lua_key(luatex_node); +make_lua_key(mLTL); +make_lua_key(mRTT); +make_lua_key(mTLT); +make_lua_key(mTRT); +make_lua_key(mark); +make_lua_key(mathdir); +make_lua_key(mathkern); +make_lua_key(mathstyle); +make_lua_key(mid); +make_lua_key(mode); +make_lua_key(modeline); +make_lua_key(name); +make_lua_key(named_id); +make_lua_key(new_window); +make_lua_key(next); +make_lua_key(no); +make_lua_key(noad); +make_lua_key(node); +make_lua_key(node_properties); +make_lua_key(node_properties_indirect); +make_lua_key(nomath); +make_lua_key(nop); +make_lua_key(nucleus); +make_lua_key(num); +make_lua_key(number); +make_lua_key(objnum); +make_lua_key(omega); +make_lua_key(ordering); +make_lua_key(pLTL); +make_lua_key(pRTT); +make_lua_key(pTLT); +make_lua_key(pTRT); +make_lua_key(page_head); +make_lua_key(page_ins_head); +make_lua_key(parameters); +make_lua_key(pdftex); +make_lua_key(pen_broken); +make_lua_key(pen_inter); +make_lua_key(penalty); +make_lua_key(pop); +make_lua_key(post); +make_lua_key(pre); +make_lua_key(pre_adjust_head); +make_lua_key(prev); +make_lua_key(prevdepth); +make_lua_key(prevgraf); +make_lua_key(psname); +make_lua_key(ptr); +make_lua_key(push); +make_lua_key(quad); +make_lua_key(ref_count); +make_lua_key(reg); +make_lua_key(registry); +make_lua_key(renew); +make_lua_key(rep); +make_lua_key(replace); +make_lua_key(right); +make_lua_key(right_boundary); +make_lua_key(right_protruding); +make_lua_key(rule); +make_lua_key(scale); +make_lua_key(script); +make_lua_key(scriptscript); +make_lua_key(shift); +make_lua_key(shrink); +make_lua_key(shrink_order); +make_lua_key(size); +make_lua_key(skewchar); +make_lua_key(slant); +make_lua_key(slot); +make_lua_key(small_char); +make_lua_key(small_fam); +make_lua_key(space); +make_lua_key(space_shrink); +make_lua_key(space_stretch); +make_lua_key(spacefactor); +make_lua_key(spec); +make_lua_key(special); +make_lua_key(stack); +make_lua_key(start); +make_lua_key(step); +make_lua_key(stream); +make_lua_key(stretch); +make_lua_key(stretch_order); +make_lua_key(string); +make_lua_key(style); +make_lua_key(sub); +make_lua_key(subst_ex_font); +make_lua_key(subtype); +make_lua_key(sup); +make_lua_key(supplement); +make_lua_key(surround); +make_lua_key(tail); +make_lua_key(temp_head); +make_lua_key(term); +make_lua_key(term_and_log); +make_lua_key(tex); +make_lua_key(text); +make_lua_key(thread_attr); +make_lua_key(thread_id); +make_lua_key(top); +make_lua_key(top_accent); +make_lua_key(top_left); +make_lua_key(top_right); +make_lua_key(tounicode); +make_lua_key(transform); +make_lua_key(type); +make_lua_key(uchyph); +make_lua_key(umath); +make_lua_key(units_per_em); +make_lua_key(used); +make_lua_key(user_id); +make_lua_key(value); +make_lua_key(version); +make_lua_key(vert_variants); +make_lua_key(width); +make_lua_key(writable); +make_lua_key(x_height); +make_lua_key(xoffset); +make_lua_key(xyz_zoom); +make_lua_key(yoffset); + +make_lua_key(immediate); +make_lua_key(compresslevel); +make_lua_key(objcompression); +make_lua_key(direct); +make_lua_key(page); +make_lua_key(streamfile); +make_lua_key(annot); +make_lua_key(lua_functions); + @ TH: TODO @@ -118,8 +365,10 @@ const_string LUATEX_IHELP[] = { "", " --luaonly run a lua file, then exit", " --luaconly byte-compile a lua file, then exit", + " --luahashchars the bits used by current Lua interpreter for strings hashing", #ifdef LuajitTeX " --jiton turns the JIT compiler on (default off)", + " --jithash=STRING choose the hash function for the lua strings (lua51|luajit20: default lua51)", #endif "", "See the reference manual for more information about the startup process.", @@ -158,6 +407,9 @@ static char *ex_selfdir(char *argv0) #endif } + + + @ @c static void prepare_cmdline(lua_State * L, char **av, int ac, int zero_offset) @@ -187,8 +439,11 @@ static string user_progname = NULL; char *startup_filename = NULL; int lua_only = 0; int lua_offset = 0; +unsigned char show_luahashchars = 0; + #ifdef LuajitTeX int luajiton = 0; +char *jithash_hashname = NULL; #endif int safer_option = 0; @@ -208,8 +463,10 @@ static struct option long_options[] = { {"fmt", 1, 0, 0}, {"lua", 1, 0, 0}, {"luaonly", 0, 0, 0}, +{"luahashchars", 0, 0, 0}, #ifdef LuajitTeX {"jiton", 0, 0, 0}, +{"jithash", 1, 0, 0}, #endif {"safer", 0, &safer_option, 1}, {"nosocket", 0, &nosocket_option, 1}, @@ -252,6 +509,20 @@ static struct option long_options[] }; @ @c +int lua_numeric_field_by_index(lua_State * L, int name_index, int dflt) +{ + register int i = dflt; + lua_rawgeti(L, LUA_REGISTRYINDEX, name_index); /* fetch the stringptr */ + lua_rawget(L, -2); + if (lua_type(L, -1) == LUA_TNUMBER) { + i = lua_roundnumber(L, -1); + } + lua_pop(L, 1); + return i; +} + + +@ @c static void parse_options(int ac, char **av) { #ifdef WIN32 @@ -278,8 +549,11 @@ static void parse_options(int ac, char **av) if (g == -1) /* End of arguments, exit the loop. */ break; - if (g == '?') /* Unknown option. */ - continue; + if (g == '?') { /* Unknown option. */ + if (!luainit) + fprintf(stderr,"%s: unrecognized option '%s'\n", argv[0], argv[optind-1]); + continue; + } assert(g == 0); /* We have no short option names. */ @@ -294,7 +568,21 @@ static void parse_options(int ac, char **av) #ifdef LuajitTeX } else if (ARGUMENT_IS("jiton")) { luajiton = 1; -#endif + } else if (ARGUMENT_IS("jithash")) { + size_t len = strlen(optarg); + if (len<16) + jithash_hashname = optarg; + else{ + WARNING2("hash name truncated to 15 characters from %d. (%s)", + (int) len, optarg); + jithash_hashname = (string) xmalloc(16); + strncpy(jithash_hashname, optarg, 15); + jithash_hashname[15] = 0; + } +#endif + + } else if (ARGUMENT_IS("luahashchars")) { + show_luahashchars = 1; } else if (ARGUMENT_IS("kpathsea-debug")) { kpathsea_debug |= atoi(optarg); @@ -908,6 +1196,257 @@ void lua_initialize(int ac, char **av) luainterpreter(); + /* init internalized strings */ + init_lua_key(LTL); + init_lua_key(MathConstants); + init_lua_key(RTT); + init_lua_key(TLT); + init_lua_key(TRT); + init_lua_key(accent); + init_lua_key(action); + init_lua_key(action_id); + init_lua_key(action_type); + init_lua_key(additional); + init_lua_key(adjust_head); + init_lua_key(advance); + init_lua_key(aleph); + init_lua_key(align_head); + init_lua_key(area); + init_lua_key(attr); + init_lua_key(attributes); + init_lua_key(auto_expand); + init_lua_key(best_ins_ptr); + init_lua_key(best_page_break); + init_lua_key(best_size); + init_lua_key(bot); + init_lua_key(bot_accent); + init_lua_key(bottom_left); + init_lua_key(bottom_right); + init_lua_key(box_left); + init_lua_key(box_left_width); + init_lua_key(box_right); + init_lua_key(box_right_width); + init_lua_key(broken_ins); + init_lua_key(broken_ptr); + init_lua_key(cache); + init_lua_key(cal_expand_ratio); + init_lua_key(char); + init_lua_key(characters); + init_lua_key(checksum); + init_lua_key(cidinfo); + init_lua_key(class); + init_lua_key(command); + init_lua_key(commands); + init_lua_key(comment); + init_lua_key(components); + init_lua_key(contrib_head); + init_lua_key(core); + init_lua_key(cost); + init_lua_key(count); + init_lua_key(data); + init_lua_key(degree); + init_lua_key(delim); + init_lua_key(delimptr); + init_lua_key(denom); + init_lua_key(depth); + init_lua_key(designsize); + init_lua_key(dest_id); + init_lua_key(dest_type); + init_lua_key(dir); + init_lua_key(dir_h); + init_lua_key(direction); + init_lua_key(dirs); + init_lua_key(display); + init_lua_key(down); + init_lua_key(dvi_ptr); + init_lua_key(embedding); + init_lua_key(encodingbytes); + init_lua_key(encodingname); + init_lua_key(end); + init_lua_key(etex); + init_lua_key(exactly); + init_lua_key(expansion_factor); + init_lua_key(ext); + init_lua_key(extend); + init_lua_key(extender); + init_lua_key(extensible); + init_lua_key(extra_space); + init_lua_key(fam); + init_lua_key(fast); + init_lua_key(file); + init_lua_key(filename); + init_lua_key(font); + init_lua_key(fonts); + init_lua_key(format); + init_lua_key(fullname); + init_lua_key(global); + init_lua_key(glue_order); + init_lua_key(glue_set); + init_lua_key(glue_sign); + init_lua_key(glyph); + init_lua_key(head); + init_lua_key(height); + init_lua_key(hold_head); + init_lua_key(horiz_variants); + init_lua_key(hyphenchar); + init_lua_key(id); + init_lua_key(image); + init_lua_key(index); + init_lua_key(italic); + init_lua_key(kern); + init_lua_key(kerns); + init_lua_key(lang); + init_lua_key(large_char); + init_lua_key(large_fam); + init_lua_key(last_ins_ptr); + init_lua_key(leader); + init_lua_key(least_page_cost); + init_lua_key(left); + init_lua_key(left_boundary); + init_lua_key(left_protruding); + init_lua_key(level); + init_lua_key(ligatures); + init_lua_key(link_attr); + init_lua_key(list); + init_lua_key(log); + init_lua_key(lua); + init_lua_key(luatex); + init_lua_key(mark); + init_lua_key(mathdir); + init_lua_key(mathkern); + init_lua_key(mathstyle); + init_lua_key(mid); + init_lua_key(mode); + init_lua_key(modeline); + init_lua_key(name); + init_lua_key(named_id); + init_lua_key(new_window); + init_lua_key(next); + init_lua_key(no); + init_lua_key(noad); + init_lua_key(node); + init_lua_key(nomath); + init_lua_key(nop); + init_lua_key(nucleus); + init_lua_key(num); + init_lua_key(number); + init_lua_key(objnum); + init_lua_key(omega); + init_lua_key(ordering); + init_lua_key(page_head); + init_lua_key(page_ins_head); + init_lua_key(parameters); + init_lua_key(pdftex); + init_lua_key(pen_broken); + init_lua_key(pen_inter); + init_lua_key(penalty); + init_lua_key(pop); + init_lua_key(post); + init_lua_key(pre); + init_lua_key(pre_adjust_head); + init_lua_key(prev); + init_lua_key(prevdepth); + init_lua_key(prevgraf); + init_lua_key(psname); + init_lua_key(ptr); + init_lua_key(push); + init_lua_key(quad); + init_lua_key(ref_count); + init_lua_key(reg); + init_lua_key(registry); + init_lua_key(renew); + init_lua_key(rep); + init_lua_key(replace); + init_lua_key(right); + init_lua_key(right_boundary); + init_lua_key(right_protruding); + init_lua_key(rule); + init_lua_key(scale); + init_lua_key(script); + init_lua_key(scriptscript); + init_lua_key(shift); + init_lua_key(shrink); + init_lua_key(shrink_order); + init_lua_key(size); + init_lua_key(skewchar); + init_lua_key(slant); + init_lua_key(slot); + init_lua_key(small_char); + init_lua_key(small_fam); + init_lua_key(space); + init_lua_key(space_shrink); + init_lua_key(space_stretch); + init_lua_key(spacefactor); + init_lua_key(spec); + init_lua_key(special); + init_lua_key(stack); + init_lua_key(start); + init_lua_key(step); + init_lua_key(stream); + init_lua_key(stretch); + init_lua_key(stretch_order); + init_lua_key(string); + init_lua_key(style); + init_lua_key(sub); + init_lua_key(subst_ex_font); + init_lua_key(subtype); + init_lua_key(sup); + init_lua_key(supplement); + init_lua_key(surround); + init_lua_key(tail); + init_lua_key(temp_head); + init_lua_key(term); + init_lua_key(tex); + init_lua_key(text); + init_lua_key(thread_attr); + init_lua_key(thread_id); + init_lua_key(top); + init_lua_key(top_accent); + init_lua_key(top_left); + init_lua_key(top_right); + init_lua_key(tounicode); + init_lua_key(transform); + init_lua_key(type); + init_lua_key(uchyph); + init_lua_key(umath); + init_lua_key(units_per_em); + init_lua_key(used); + init_lua_key(user_id); + init_lua_key(value); + init_lua_key(version); + init_lua_key(vert_variants); + init_lua_key(width); + init_lua_key(writable); + init_lua_key(x_height); + init_lua_key(xoffset); + init_lua_key(xyz_zoom); + init_lua_key(yoffset); + init_lua_key_alias(luatex_node, "luatex.node"); + init_lua_key_alias(mLTL,"-LTL"); + init_lua_key_alias(mRTT,"-RTT"); + init_lua_key_alias(mTLT,"-TLT"); + init_lua_key_alias(mTRT,"-TRT"); + init_lua_key_alias(node_properties,"node.properties"); + init_lua_key_alias(node_properties_indirect,"node.properties.indirect"); + init_lua_key_alias(pLTL,"+LTL"); + init_lua_key_alias(pRTT,"+RTT"); + init_lua_key_alias(pTLT,"+TLT"); + init_lua_key_alias(pTRT,"+TRT"); + init_lua_key_alias(term_and_log,"term and log"); + init_lua_key_alias(lua_functions,"lua.functions"); + + init_lua_key(immediate); + init_lua_key(compresslevel); + init_lua_key(objcompression); + init_lua_key(direct); + init_lua_key(page); + init_lua_key(streamfile); + init_lua_key(annot); + + lua_pushstring(Luas,"lua.functions"); + lua_newtable(Luas); + lua_settable(Luas,LUA_REGISTRYINDEX); + prepare_cmdline(Luas, argv, argc, lua_offset); /* collect arguments */ setup_lua_path(Luas); diff --git a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w index 0ae3f3f0754..6c20e9d10fb 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w +++ b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w @@ -34,7 +34,7 @@ int luastate_bytes = 0; int lua_active = 0; @ @c -void make_table(lua_State * L, const char *tab, const char *getfunc, +void make_table(lua_State * L, const char *tab, const char *mttab, const char *getfunc, const char *setfunc) { /* make the table *//* |[{<tex>}]| */ @@ -45,7 +45,7 @@ void make_table(lua_State * L, const char *tab, const char *getfunc, lua_pushstring(L, tab); /* |[{<tex>},"dimen"]| */ lua_gettable(L, -2); /* |[{<tex>},{<dimen>}]| */ /* make the meta entries */ - luaL_newmetatable(L, tab); /* |[{<tex>},{<dimen>},{<dimen_m>}]| */ + luaL_newmetatable(L, mttab); /* |[{<tex>},{<dimen>},{<dimen_m>}]| */ lua_pushstring(L, "__index"); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index"]| */ lua_pushstring(L, getfunc); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index","getdimen"]| */ lua_gettable(L, -5); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index",<tex.getdimen>]| */ @@ -95,6 +95,32 @@ static int my_luapanic(lua_State * L) return 0; } + +@ @c +void luafunctioncall(int slot) +{ + int i ; + int stacktop = lua_gettop(Luas); + lua_active++; + lua_rawgeti(Luas, LUA_REGISTRYINDEX, lua_key_index(lua_functions)); + lua_gettable(Luas, LUA_REGISTRYINDEX); + lua_rawgeti(Luas, -1,slot); + if (lua_isfunction(Luas,-1)) { + lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ + lua_insert(Luas, -2); /* put it under chunk */ + lua_pushnumber(Luas, slot); + i = lua_pcall(Luas, 1, 0, -2); + if (i != 0) { + lua_gc(Luas, LUA_GCCOLLECT, 0); + Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); + } + } + lua_settop(Luas,stacktop); + lua_active--; +} + + + @ @c static const luaL_Reg lualibs[] = { {"", luaopen_base}, @@ -199,6 +225,25 @@ static int luatex_dofile (lua_State *L) { void luainterpreter(void) { lua_State *L; + + if (jithash_hashname==NULL){ + /* default lua51 */ + luajittex_choose_hash_function = 0; + jithash_hashname = (char *) xmalloc(strlen("lua51")+1); + jithash_hashname = strcpy ( jithash_hashname, "lua51"); + } else { + if (strcmp((const char*)jithash_hashname,"lua51")==0){ + luajittex_choose_hash_function = 0; + }else if (strcmp((const char*)jithash_hashname,"luajit20")==0){ + luajittex_choose_hash_function = 1; + } else { + /* default lua51 */ + luajittex_choose_hash_function = 0; + jithash_hashname = strcpy ( jithash_hashname, "lua51"); + } + } + + L = luaL_newstate() ; /*L = lua_newstate(my_luaalloc, NULL);*/ if (L == NULL) { @@ -217,7 +262,6 @@ void luainterpreter(void) } - lua_pushcfunction(L,luatex_dofile); lua_setglobal(L, "dofile"); lua_pushcfunction(L,luatex_loadfile); @@ -322,6 +366,8 @@ void luainterpreter(void) (void) hide_lua_value(L, "lfs", "rmdir"); (void) hide_lua_value(L, "lfs", "mkdir"); } + /* fprintf(stdout, "\nLuajitTeX default hash function type:%s\n", */ + /* jithash_hashname); */ Luas = L; } @@ -392,7 +438,7 @@ int lua_traceback(lua_State * L) } @ @c -static void luacall(int p, int nameptr, boolean is_string) +static void luacall(int p, int nameptr, boolean is_string) /* hh-ls: optimized lua_id resolving */ { LoadS ls; int i; @@ -422,18 +468,19 @@ static void luacall(int p, int nameptr, boolean is_string) if (nameptr > 0) { int l = 0; /* not used */ lua_id = tokenlist_to_cstring(nameptr, 1, &l); + i = lua_load(Luas, getS, &ls, lua_id); + xfree(lua_id); } else if (nameptr < 0) { - char *tmp = get_lua_name((nameptr + 65536)); - if (tmp != NULL) - lua_id = xstrdup(tmp); - else - lua_id = xstrdup("\\latelua "); + lua_id = get_lua_name((nameptr + 65536)); + if (lua_id != NULL) { + i = lua_load(Luas, getS, &ls, lua_id); + xfree(lua_id); + } else { + i = lua_load(Luas, getS, &ls, "\\latelua "); + } } else { - lua_id = xmalloc(20); - snprintf((char *) lua_id, 20, "\\latelua "); + i = lua_load(Luas, getS, &ls, "\\latelua "); } - - i = lua_load(Luas, getS, &ls, lua_id); if (i != 0) { Luas = luatex_error(Luas, (i == LUA_ERRSYNTAX ? 0 : 1)); } else { @@ -448,7 +495,6 @@ static void luacall(int p, int nameptr, boolean is_string) Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); } } - xfree(lua_id); xfree(ls.s); } lua_active--; @@ -468,7 +514,7 @@ void late_lua(PDF pdf, halfword p) } @ @c -void luatokencall(int p, int nameptr) +void luatokencall(int p, int nameptr) /* hh-ls: optimized lua_id resolving */ { LoadS ls; int i, l; @@ -483,16 +529,19 @@ void luatokencall(int p, int nameptr) if (ls.size > 0) { if (nameptr > 0) { lua_id = tokenlist_to_cstring(nameptr, 1, &l); + i = lua_load(Luas, getS, &ls, lua_id); + xfree(lua_id); } else if (nameptr < 0) { - char *tmp = get_lua_name((nameptr + 65536)); - if (tmp != NULL) - lua_id = xstrdup(tmp); - else - lua_id = xstrdup("\\directlua "); + lua_id = get_lua_name((nameptr + 65536)); + if (lua_id != NULL) { + i = lua_load(Luas, getS, &ls, lua_id); + xfree(lua_id); + } else { + i = lua_load(Luas, getS, &ls, "\\directlua "); + } } else { - lua_id = xstrdup("\\directlua "); + i = lua_load(Luas, getS, &ls, "\\directlua "); } - i = lua_load(Luas, getS, &ls, lua_id); xfree(s); if (i != 0) { Luas = luatex_error(Luas, (i == LUA_ERRSYNTAX ? 0 : 1)); @@ -508,7 +557,6 @@ void luatokencall(int p, int nameptr) Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); } } - xfree(lua_id); } lua_active--; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.w b/Build/source/texk/web2c/luatexdir/lua/luanode.w index 5e50acc8e02..879b0b3d27e 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luanode.w +++ b/Build/source/texk/web2c/luatexdir/lua/luanode.w @@ -22,8 +22,8 @@ nodes are removedor inserted, temp nodes don't interfere */ @ @c static const char _svn_version[] = - "$Id: luanode.w 4775 2014-02-07 12:36:34Z luigi $" - "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luanode.w $"; + "$Id: luanode.w 4442 2012-05-25 22:40:34Z hhenkel $" + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/luanode.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.w b/Build/source/texk/web2c/luatexdir/lua/luastuff.w index 17789d04d3c..e9942881baf 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luastuff.w +++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: luastuff.w 4730 2014-01-03 14:44:14Z taco $" + "$Id: luastuff.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luastuff.w $"; #include "ptexlib.h" @@ -33,7 +33,7 @@ int luastate_bytes = 0; int lua_active = 0; @ @c -void make_table(lua_State * L, const char *tab, const char *getfunc, +void make_table(lua_State * L, const char *tab, const char *mttab, const char *getfunc, const char *setfunc) { /* make the table *//* |[{<tex>}]| */ @@ -44,7 +44,7 @@ void make_table(lua_State * L, const char *tab, const char *getfunc, lua_pushstring(L, tab); /* |[{<tex>},"dimen"]| */ lua_gettable(L, -2); /* |[{<tex>},{<dimen>}]| */ /* make the meta entries */ - luaL_newmetatable(L, tab); /* |[{<tex>},{<dimen>},{<dimen_m>}]| */ + luaL_newmetatable(L, mttab); /* |[{<tex>},{<dimen>},{<dimen_m>}]| */ lua_pushstring(L, "__index"); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index"]| */ lua_pushstring(L, getfunc); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index","getdimen"]| */ lua_gettable(L, -5); /* |[{<tex>},{<dimen>},{<dimen_m>},"__index",<tex.getdimen>]| */ @@ -92,6 +92,31 @@ static int my_luapanic(lua_State * L) return 0; } + +@ @c +void luafunctioncall(int slot) +{ + int i ; + int stacktop = lua_gettop(Luas); + lua_active++; + lua_rawgeti(Luas, LUA_REGISTRYINDEX, lua_key_index(lua_functions)); + lua_gettable(Luas, LUA_REGISTRYINDEX); + lua_rawgeti(Luas, -1,slot); + if (lua_isfunction(Luas,-1)) { + lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ + lua_insert(Luas, -2); /* put it under chunk */ + lua_pushnumber(Luas, slot); + i = lua_pcall(Luas, 1, 0, -2); + if (i != 0) { + lua_gc(Luas, LUA_GCCOLLECT, 0); + Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); + } + } + lua_settop(Luas,stacktop); + lua_active--; +} + + @ @c static const luaL_Reg lualibs[] = { {"", luaopen_base}, @@ -360,7 +385,7 @@ int lua_traceback(lua_State * L) } @ @c -static void luacall(int p, int nameptr, boolean is_string) +static void luacall(int p, int nameptr, boolean is_string) /* hh-ls: optimized lua_id resolving */ { LoadS ls; int i; @@ -390,18 +415,19 @@ static void luacall(int p, int nameptr, boolean is_string) if (nameptr > 0) { int l = 0; /* not used */ lua_id = tokenlist_to_cstring(nameptr, 1, &l); + i = lua_load(Luas, getS, &ls, lua_id, NULL); + xfree(lua_id); } else if (nameptr < 0) { - char *tmp = get_lua_name((nameptr + 65536)); - if (tmp != NULL) - lua_id = xstrdup(tmp); - else - lua_id = xstrdup("\\latelua "); + lua_id = get_lua_name((nameptr + 65536)); + if (lua_id != NULL) { + i = lua_load(Luas, getS, &ls, lua_id, NULL); + xfree(lua_id); + } else { + i = lua_load(Luas, getS, &ls, "\\latelua ", NULL); + } } else { - lua_id = xmalloc(20); - snprintf((char *) lua_id, 20, "\\latelua "); + i = lua_load(Luas, getS, &ls, "\\latelua ", NULL); } - - i = lua_load(Luas, getS, &ls, lua_id, NULL); if (i != 0) { Luas = luatex_error(Luas, (i == LUA_ERRSYNTAX ? 0 : 1)); } else { @@ -416,7 +442,6 @@ static void luacall(int p, int nameptr, boolean is_string) Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); } } - xfree(lua_id); xfree(ls.s); } lua_active--; @@ -436,7 +461,7 @@ void late_lua(PDF pdf, halfword p) } @ @c -void luatokencall(int p, int nameptr) +void luatokencall(int p, int nameptr) /* hh-ls: optimized lua_id resolving */ { LoadS ls; int i, l; @@ -451,16 +476,19 @@ void luatokencall(int p, int nameptr) if (ls.size > 0) { if (nameptr > 0) { lua_id = tokenlist_to_cstring(nameptr, 1, &l); + i = lua_load(Luas, getS, &ls, lua_id, NULL); + xfree(lua_id); } else if (nameptr < 0) { - char *tmp = get_lua_name((nameptr + 65536)); - if (tmp != NULL) - lua_id = xstrdup(tmp); - else - lua_id = xstrdup("\\directlua "); + lua_id = get_lua_name((nameptr + 65536)); + if (lua_id != NULL) { + i = lua_load(Luas, getS, &ls, lua_id, NULL); + xfree(lua_id); + } else { + i = lua_load(Luas, getS, &ls, "\\directlua ", NULL); + } } else { - lua_id = xstrdup("\\directlua "); + i = lua_load(Luas, getS, &ls, "\\directlua ", NULL); } - i = lua_load(Luas, getS, &ls, lua_id, NULL); xfree(s); if (i != 0) { Luas = luatex_error(Luas, (i == LUA_ERRSYNTAX ? 0 : 1)); @@ -476,7 +504,6 @@ void luatokencall(int p, int nameptr) Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); } } - xfree(lua_id); } lua_active--; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index 075c2882e90..3a88eaf54d7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: luatex-api.h 4718 2014-01-02 15:35:31Z taco $ */ +/* $Id: luatex-api.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef LUATEX_API_H # define LUATEX_API_H 1 @@ -43,7 +43,7 @@ typedef struct LoadS { extern lua_State *Luas; -extern void make_table(lua_State * L, const char *tab, const char *getfunc, +extern void make_table(lua_State * L, const char *tab, const char *mttab, const char *getfunc, const char *setfunc); extern int luac_main(int argc, char *argv[]); @@ -71,6 +71,7 @@ extern int luaopen_zlib(lua_State * L); extern int luaopen_gzip(lua_State * L); extern int luaopen_ff(lua_State * L); extern int luaopen_profiler(lua_State * L); +extern int luaopen_bit32(lua_State * L); extern int luaopen_socket_core(lua_State * L); extern int luaopen_mime_core(lua_State * L); @@ -131,8 +132,18 @@ extern void undump_luac_registers(void); extern int lua_only; #ifdef LuajitTeX extern int luajiton; +extern char *jithash_hashname ; +LUA_API int luajittex_choose_hash_function ; #endif + +#ifdef LuajitTeX +#define LUAJITTEX_HASHCHARS 6 /* todo: It must be like that one on lj_str.c */ +#else +#define LUATEX_HASHCHARS 6 /* todo: It must be LUAI_HASHLIMIT! */ +#endif +extern unsigned char show_luahashchars ; + extern void unhide_lua_table(lua_State * lua, const char *name, int r); extern int hide_lua_table(lua_State * lua, const char *name); @@ -217,4 +228,309 @@ extern char **environ; #ifdef __cplusplus } #endif + +/* + Same as in lnodelib.c, but with prefix G_ for now. + These macros create and access pointers (indices) to keys which is faster. The + shortcuts are created as part of the initialization. + +*/ + +/*#define init_luaS_index(a) do { */ +#define init_lua_key(a) do { \ + lua_pushliteral(Luas,#a); \ + luaS_##a##_ptr = lua_tostring(Luas,-1); \ + luaS_##a##_index = luaL_ref (Luas,LUA_REGISTRYINDEX); \ +} while (0) + + /*#define init_luaS_index_s(a,b) do { */ +#define init_lua_key_alias(a,b) do { \ + lua_pushliteral(Luas,b); \ + luaS_##a##_ptr = lua_tostring(Luas,-1); \ + luaS_##a##_index = luaL_ref (Luas,LUA_REGISTRYINDEX); \ +} while (0) + + /*#define make_luaS_index(a) */ +#define make_lua_key(a) \ + int luaS_##a##_index = 0; \ + const char * luaS_##a##_ptr = NULL + + +/*#define luaS_ptr_eq(a,b) (a==luaS_##b##_ptr)*/ +#define lua_key_eq(a,b) (a==luaS_##b##_ptr) + +#define luaS_index(a) luaS_##a##_index +#define lua_key_index(a) luaS_##a##_index +#define lua_key(a) luaS_##a##_ptr +#define use_lua_key(a) \ + extern int luaS_##a##_index ; \ + extern const char * luaS_##a##_ptr + + +#define lua_key_rawgeti(a) \ + lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_##a##_index);\ + lua_rawget(L, -2) + + +#define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5) +extern int lua_numeric_field_by_index(lua_State *, int , int); + + #endif /* LUATEX_API_H */ + + + + +/* */ +/* These keys have to available to different files */ +/* */ + + +use_lua_key(LTL); +use_lua_key(MathConstants); +use_lua_key(RTT); +use_lua_key(TLT); +use_lua_key(TRT); +use_lua_key(accent); +use_lua_key(action); +use_lua_key(action_id); +use_lua_key(action_type); +use_lua_key(additional); +use_lua_key(adjust_head); +use_lua_key(advance); +use_lua_key(aleph); +use_lua_key(align_head); +use_lua_key(area); +use_lua_key(attr); +use_lua_key(attributes); +use_lua_key(auto_expand); +use_lua_key(best_ins_ptr); +use_lua_key(best_page_break); +use_lua_key(best_size); +use_lua_key(bot); +use_lua_key(bot_accent); +use_lua_key(bottom_left); +use_lua_key(bottom_right); +use_lua_key(box_left); +use_lua_key(box_left_width); +use_lua_key(box_right); +use_lua_key(box_right_width); +use_lua_key(broken_ins); +use_lua_key(broken_ptr); +use_lua_key(cache); +use_lua_key(cal_expand_ratio); +use_lua_key(char); +use_lua_key(characters); +use_lua_key(checksum); +use_lua_key(cidinfo); +use_lua_key(class); +use_lua_key(command); +use_lua_key(commands); +use_lua_key(comment); +use_lua_key(components); +use_lua_key(contrib_head); +use_lua_key(core); +use_lua_key(cost); +use_lua_key(count); +use_lua_key(data); +use_lua_key(degree); +use_lua_key(delim); +use_lua_key(delimptr); +use_lua_key(denom); +use_lua_key(depth); +use_lua_key(designsize); +use_lua_key(dest_id); +use_lua_key(dest_type); +use_lua_key(dir); +use_lua_key(dir_h); +use_lua_key(direction); +use_lua_key(dirs); +use_lua_key(display); +use_lua_key(down); +use_lua_key(dvi_ptr); +use_lua_key(embedding); +use_lua_key(encodingbytes); +use_lua_key(encodingname); +use_lua_key(end); +use_lua_key(etex); +use_lua_key(exactly); +use_lua_key(expansion_factor); +use_lua_key(ext); +use_lua_key(extend); +use_lua_key(extender); +use_lua_key(extensible); +use_lua_key(extra_space); +use_lua_key(fam); +use_lua_key(fast); +use_lua_key(file); +use_lua_key(filename); +use_lua_key(font); +use_lua_key(fonts); +use_lua_key(format); +use_lua_key(fullname); +use_lua_key(global); +use_lua_key(glue_order); +use_lua_key(glue_set); +use_lua_key(glue_sign); +use_lua_key(glyph); +use_lua_key(head); +use_lua_key(height); +use_lua_key(hold_head); +use_lua_key(horiz_variants); +use_lua_key(hyphenchar); +use_lua_key(id); +use_lua_key(image); +use_lua_key(index); +use_lua_key(italic); +use_lua_key(kern); +use_lua_key(kerns); +use_lua_key(lang); +use_lua_key(large_char); +use_lua_key(large_fam); +use_lua_key(last_ins_ptr); +use_lua_key(leader); +use_lua_key(least_page_cost); +use_lua_key(left); +use_lua_key(left_boundary); +use_lua_key(left_protruding); +use_lua_key(level); +use_lua_key(ligatures); +use_lua_key(link_attr); +use_lua_key(list); +use_lua_key(log); +use_lua_key(lua); +use_lua_key(luatex); +use_lua_key(luatex_node); +use_lua_key(mLTL); +use_lua_key(mRTT); +use_lua_key(mTLT); +use_lua_key(mTRT); +use_lua_key(mark); +use_lua_key(mathdir); +use_lua_key(mathkern); +use_lua_key(mathstyle); +use_lua_key(mid); +use_lua_key(mode); +use_lua_key(modeline); +use_lua_key(name); +use_lua_key(named_id); +use_lua_key(new_window); +use_lua_key(next); +use_lua_key(no); +use_lua_key(noad); +use_lua_key(node); +use_lua_key(node_properties); +use_lua_key(node_properties_indirect); +use_lua_key(nomath); +use_lua_key(nop); +use_lua_key(nucleus); +use_lua_key(num); +use_lua_key(number); +use_lua_key(objnum); +use_lua_key(omega); +use_lua_key(ordering); +use_lua_key(pLTL); +use_lua_key(pRTT); +use_lua_key(pTLT); +use_lua_key(pTRT); +use_lua_key(page_head); +use_lua_key(page_ins_head); +use_lua_key(parameters); +use_lua_key(pdftex); +use_lua_key(pen_broken); +use_lua_key(pen_inter); +use_lua_key(penalty); +use_lua_key(pop); +use_lua_key(post); +use_lua_key(pre); +use_lua_key(pre_adjust_head); +use_lua_key(prev); +use_lua_key(prevdepth); +use_lua_key(prevgraf); +use_lua_key(psname); +use_lua_key(ptr); +use_lua_key(push); +use_lua_key(quad); +use_lua_key(ref_count); +use_lua_key(reg); +use_lua_key(registry); +use_lua_key(renew); +use_lua_key(rep); +use_lua_key(replace); +use_lua_key(right); +use_lua_key(right_boundary); +use_lua_key(right_protruding); +use_lua_key(rule); +use_lua_key(scale); +use_lua_key(script); +use_lua_key(scriptscript); +use_lua_key(shift); +use_lua_key(shrink); +use_lua_key(shrink_order); +use_lua_key(size); +use_lua_key(skewchar); +use_lua_key(slant); +use_lua_key(slot); +use_lua_key(small_char); +use_lua_key(small_fam); +use_lua_key(space); +use_lua_key(space_shrink); +use_lua_key(space_stretch); +use_lua_key(spacefactor); +use_lua_key(spec); +use_lua_key(special); +use_lua_key(stack); +use_lua_key(start); +use_lua_key(step); +use_lua_key(stream); +use_lua_key(stretch); +use_lua_key(stretch_order); +use_lua_key(string); +use_lua_key(style); +use_lua_key(sub); +use_lua_key(subst_ex_font); +use_lua_key(subtype); +use_lua_key(sup); +use_lua_key(supplement); +use_lua_key(surround); +use_lua_key(tail); +use_lua_key(temp_head); +use_lua_key(term); +use_lua_key(term_and_log); +use_lua_key(tex); +use_lua_key(text); +use_lua_key(thread_attr); +use_lua_key(thread_id); +use_lua_key(top); +use_lua_key(top_accent); +use_lua_key(top_left); +use_lua_key(top_right); +use_lua_key(tounicode); +use_lua_key(transform); +use_lua_key(type); +use_lua_key(uchyph); +use_lua_key(umath); +use_lua_key(units_per_em); +use_lua_key(used); +use_lua_key(user_id); +use_lua_key(value); +use_lua_key(version); +use_lua_key(vert_variants); +use_lua_key(width); +use_lua_key(writable); +use_lua_key(x_height); +use_lua_key(xoffset); +use_lua_key(xyz_zoom); +use_lua_key(yoffset); + +use_lua_key(immediate); +use_lua_key(compresslevel); +use_lua_key(objcompression); +use_lua_key(direct); +use_lua_key(page); +use_lua_key(streamfile); +use_lua_key(annot); +use_lua_key(lua_functions); + + + diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.w b/Build/source/texk/web2c/luatexdir/lua/luatoken.w index edfecc8ee4d..a88d9e25923 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatoken.w +++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: luatoken.w 4562 2013-01-21 02:58:59Z khaled $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lua/luatoken.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lua/luatoken.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" |