diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2014-03-15 12:21:15 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2014-03-15 12:21:15 +0000 |
commit | a22d9897afbabdd07f13d2bc5c7c5b9c5865ab53 (patch) | |
tree | 70829ffa23329ca4c04efa8da7a18cfe9c44a1f4 /Build/source/texk/web2c | |
parent | 5909dbd7ee4290cc486c9c12e4ef0b2bfb9067d4 (diff) |
here is luatex 0.79.0
git-svn-id: svn://tug.org/texlive/trunk@33180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
80 files changed, 3485 insertions, 2320 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 24fb03932a5..931b0c5f8c9 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,37 +1,6 @@ -2014-03-14 Peter Breitenlohner <peb@mppmu.mpg.de> +2014-03-15 Taco Hoekwater <taco@luatex.org> - * bitlib/lbitlib.c (removed), lua/luatex-api.h, am/luamisc.am: - Revert change from 2014-02-07, keep lbitlib.c in LuaJIT-2.0.3. - -2014-03-13 Peter Breitenlohner <peb@mppmu.mpg.de> - - * am/luatex.am: Use LUAJIT_LDEXTRA instead of luajittex_extra. - -2014-03-06 Peter Breitenlohner <peb@mppmu.mpg.de> - - * luafilesystem/src/lfs.c: Avoid to redefine _O_TEXT, _O_BINARY. - -2014-02-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * utils/utils.w: Typo in a comment. Simplify rint() for W32. - Thanks Peter. - -2014-02-12 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * tex/mlist.w: Luigi fixes a bug (r4804). - -2014-02-11 Peter Breitenlohner <peb@mppmu.mpg.de> - - * lua/luanode.w, tex/linebreak.w, tex/mlist.w, - tex/texnodes.w, tex/textoken.w: Convert CRLF => NL. - -2014-02-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * lua/lnodelib.c, lua/ltexlib.c, lua/luanode.w, - luafontloader/fontforge/fontforge/parsettf.c, - luafontloader/src/luafflib.c, luapeg/lpeg.c, luapeg/lpeg.h, - luatex_svnversion.h, tex/linebreak.w, tex/mlist.w, - tex/texnodes.w, tex/textoken.w: Import from r4794. + Import LuaTeX snapshot 0.79.0 from LuaTeX repository (r4903). 2014-02-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp> @@ -39,14 +8,7 @@ 2014-02-07 Peter Breitenlohner <peb@mppmu.mpg.de> - * bitlib/lbitlib.c (new): Copied from - ../../../libs/luajit/LuaJIT-2.0.2/src/lbitlib.c. * lua/luatex-api.h: Declare luaopen_bit32(); - * am/luamisc.am: Add the new file. - -2014-02-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * luatex.c: Change engine_name for luajittex. 2014-02-06 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w index 5d8e3030859..c64f6544ecb 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.w +++ b/Build/source/texk/web2c/luatexdir/font/luafont.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: luafont.w 4679 2013-12-19 15:47:53Z luigi $" + "$Id: luafont.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.w $"; #include "ptexlib.h" @@ -584,40 +584,56 @@ static void append_float(eight_bits ** cpp, float a) *cpp = cp; } -#define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5) - -static int numeric_field(lua_State * L, const char *name, int dflt) -{ - int i = dflt; - lua_pushstring(L, name); - lua_rawget(L, -2); - if (lua_isnumber(L, -1)) { - i = lua_roundnumber(L, -1); - } - lua_pop(L, 1); - return i; -} - -static int n_numeric_field(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; -} - - -static int enum_field(lua_State * L, const char *name, int dflt, +//#define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5) + + +/* static int n_numeric_field(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; */ +/* } */ + + + + +/* static int enum_field(lua_State * L, const char *name, int dflt, */ +/* const char **values) */ +/* { */ +/* int k; */ +/* const char *s; */ +/* int i = dflt; */ +/* lua_pushstring(L, name); */ +/* lua_rawget(L, -2); */ +/* if (lua_isnumber(L, -1)) { */ +/* i=(int)lua_tonumber(L, -1); */ +/* } else if (lua_isstring(L, -1)) { */ +/* s = lua_tostring(L, -1); */ +/* k = 0; */ +/* while (values[k] != NULL) { */ +/* if (strcmp(values[k], s) == 0) { */ +/* i = k; */ +/* break; */ +/* } */ +/* k++; */ +/* } */ +/* } */ +/* lua_pop(L, 1); */ +/* return i; */ +/* } */ + +static int n_enum_field(lua_State * L, int name_index, int dflt, const char **values) { int k; const char *s; int i = dflt; - lua_pushstring(L, name); + lua_rawgeti(L, LUA_REGISTRYINDEX, name_index); /* fetch the stringptr */ lua_rawget(L, -2); if (lua_isnumber(L, -1)) { i=(int)lua_tonumber(L, -1); @@ -636,17 +652,19 @@ static int enum_field(lua_State * L, const char *name, int dflt, return i; } -static int boolean_field(lua_State * L, const char *name, int dflt) -{ - int i = dflt; - lua_pushstring(L, name); - lua_rawget(L, -2); - if (lua_isboolean(L, -1)) { - i = lua_toboolean(L, -1); - } - lua_pop(L, 1); - return i; -} + + +/* static int boolean_field(lua_State * L, const char *name, int dflt) */ +/* { */ +/* int i = dflt; */ +/* lua_pushstring(L, name); */ +/* lua_rawget(L, -2); */ +/* if (lua_isboolean(L, -1)) { */ +/* i = lua_toboolean(L, -1); */ +/* } */ +/* lua_pop(L, 1); */ +/* return i; */ +/* } */ static int n_boolean_field(lua_State * L, int name_index, int dflt) { @@ -661,23 +679,7 @@ static int n_boolean_field(lua_State * L, int name_index, int dflt) } -static char *string_field(lua_State * L, const char *name, const char *dflt) -{ - char *i; - lua_pushstring(L, name); - lua_rawget(L, -2); - if (lua_isstring(L, -1)) { - i = xstrdup(lua_tostring(L, -1)); - } else if (dflt == NULL) { - i = NULL; - } else { - i = xstrdup(dflt); - } - lua_pop(L, 1); - return i; -} - -static char *n_string_field(lua_State * L, int name_index, char *dflt) +static char *n_string_field_copy(lua_State * L, int name_index, const char *dflt) { char *i; lua_rawgeti(L, LUA_REGISTRYINDEX, name_index); /* fetch the stringptr */ @@ -693,138 +695,13 @@ static char *n_string_field(lua_State * L, int name_index, char *dflt) return i; } -#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 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) - -make_luaS_index(width); -make_luaS_index(height); -make_luaS_index(depth); -make_luaS_index(italic); -make_luaS_index(top_accent); -make_luaS_index(bot_accent); -make_luaS_index(index); -make_luaS_index(left_protruding); -make_luaS_index(right_protruding); -make_luaS_index(expansion_factor); -make_luaS_index(top); -make_luaS_index(bot); -make_luaS_index(rep); -make_luaS_index(mid); -make_luaS_index(next); -make_luaS_index(used); -make_luaS_index(name); -make_luaS_index(tounicode); -make_luaS_index(font); -make_luaS_index(char); -make_luaS_index(slot); -make_luaS_index(comment); -make_luaS_index(nop); -make_luaS_index(push); -make_luaS_index(pop); -make_luaS_index(rule); -make_luaS_index(right); -make_luaS_index(node); -make_luaS_index(down); -make_luaS_index(special); -make_luaS_index(image); -make_luaS_index(slant); -make_luaS_index(space); -make_luaS_index(space_stretch); -make_luaS_index(space_shrink); -make_luaS_index(x_height); -make_luaS_index(quad); -make_luaS_index(extra_space); -make_luaS_index(left_boundary); -make_luaS_index(right_boundary); -make_luaS_index(kerns); -make_luaS_index(ligatures); -make_luaS_index(fonts); -make_luaS_index(extender); -make_luaS_index(start); -make_luaS_index(end); -make_luaS_index(advance); -make_luaS_index(glyph); -make_luaS_index(extensible); -make_luaS_index(horiz_variants); -make_luaS_index(vert_variants); -make_luaS_index(mathkern); -make_luaS_index(commands); -make_luaS_index(scale); -make_luaS_index(lua); - -static void init_font_string_pointers(lua_State * L) +static const char *n_string_field(lua_State * L, int name_index) { - init_luaS_index(width); - init_luaS_index(height); - init_luaS_index(depth); - init_luaS_index(italic); - init_luaS_index(top_accent); - init_luaS_index(bot_accent); - init_luaS_index(index); - init_luaS_index(left_protruding); - init_luaS_index(right_protruding); - init_luaS_index(expansion_factor); - init_luaS_index(top); - init_luaS_index(bot); - init_luaS_index(rep); - init_luaS_index(mid); - init_luaS_index(next); - init_luaS_index(used); - init_luaS_index(name); - init_luaS_index(tounicode); - init_luaS_index(font); - init_luaS_index(char); - init_luaS_index(slot); - init_luaS_index(comment); - init_luaS_index(nop); - init_luaS_index(push); - init_luaS_index(pop); - init_luaS_index(rule); - init_luaS_index(right); - init_luaS_index(node); - init_luaS_index(down); - init_luaS_index(special); - init_luaS_index(image); - - init_luaS_index(slant); - init_luaS_index(space); - init_luaS_index(space_stretch); - init_luaS_index(space_shrink); - init_luaS_index(x_height); - init_luaS_index(quad); - init_luaS_index(extra_space); - - init_luaS_index(left_boundary); - init_luaS_index(right_boundary); - init_luaS_index(kerns); - init_luaS_index(ligatures); - init_luaS_index(fonts); - - init_luaS_index(extender); - init_luaS_index(start); - init_luaS_index(end); - init_luaS_index(advance); - init_luaS_index(glyph); - - init_luaS_index(extensible); - init_luaS_index(horiz_variants); - init_luaS_index(vert_variants); - init_luaS_index(mathkern); - init_luaS_index(commands); - init_luaS_index(scale); - init_luaS_index(lua); + lua_rawgeti(L, LUA_REGISTRYINDEX, name_index); /* fetch the stringptr */ + lua_rawget(L, -2); + return lua_tostring(L,-1); } +/*static void init_font_string_pointers(lua_State * L){}*/ static int count_char_packet_bytes(lua_State * L) { @@ -837,30 +714,30 @@ static int count_char_packet_bytes(lua_State * L) lua_rawgeti(L, -1, 1); if (lua_isstring(L, -1)) { const char *s = lua_tostring(L, -1); - if (luaS_ptr_eq(s, font)) { + if (lua_key_eq(s, font)) { l += 5; ff = 1; - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { if (ff == 0) { l += 5; } l += 5; ff = 1; - } else if (luaS_ptr_eq(s, slot)) { + } else if (lua_key_eq(s, slot)) { l += 10; ff = 1; - } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) { + } else if (lua_key_eq(s, comment) || lua_key_eq(s, nop)) { ; - } else if (luaS_ptr_eq(s, push) || luaS_ptr_eq(s, pop)) { + } else if (lua_key_eq(s, push) || lua_key_eq(s, pop)) { l++; - } else if (luaS_ptr_eq(s, rule)) { + } else if (lua_key_eq(s, rule)) { l += 9; - } else if (luaS_ptr_eq(s, right) || luaS_ptr_eq(s, node) - || luaS_ptr_eq(s, down) || luaS_ptr_eq(s, image)) { + } else if (lua_key_eq(s, right) || lua_key_eq(s, node) + || lua_key_eq(s, down) || lua_key_eq(s, image)) { l += 5; - } else if (luaS_ptr_eq(s, scale)) { + } else if (lua_key_eq(s, scale)) { l += sizeof(float) + 1; - } else if (luaS_ptr_eq(s, special) || luaS_ptr_eq(s, lua)) { + } else if (lua_key_eq(s, special) || lua_key_eq(s, lua)) { size_t len; lua_rawgeti(L, -2, 2); if (lua_isstring(L, -1)) { @@ -922,16 +799,16 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) if (lua_isstring(L, -1)) { s = lua_tostring(L, -1); cmd = 0; - if (luaS_ptr_eq(s, font)) { + if (lua_key_eq(s, font)) { cmd = packet_font_code; - } else if (luaS_ptr_eq(s, char)) { + } else if (lua_key_eq(s, char)) { cmd = packet_char_code; if (ff == 0) { append_packet(packet_font_code); ff = l_fonts[1]; do_store_four(ff); } - } else if (luaS_ptr_eq(s, slot)) { + } else if (lua_key_eq(s, slot)) { cmd = packet_nop_code; lua_rawgeti(L, -2, 2); n = (int) luaL_checkinteger(L, -1); @@ -943,27 +820,27 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) do_store_four(ff); append_packet(packet_char_code); do_store_four(n); - } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) { + } else if (lua_key_eq(s, comment) || lua_key_eq(s, nop)) { cmd = packet_nop_code; - } else if (luaS_ptr_eq(s, node)) { + } else if (lua_key_eq(s, node)) { cmd = packet_node_code; - } else if (luaS_ptr_eq(s, push)) { + } else if (lua_key_eq(s, push)) { cmd = packet_push_code; - } else if (luaS_ptr_eq(s, pop)) { + } else if (lua_key_eq(s, pop)) { cmd = packet_pop_code; - } else if (luaS_ptr_eq(s, rule)) { + } else if (lua_key_eq(s, rule)) { cmd = packet_rule_code; - } else if (luaS_ptr_eq(s, right)) { + } else if (lua_key_eq(s, right)) { cmd = packet_right_code; - } else if (luaS_ptr_eq(s, down)) { + } else if (lua_key_eq(s, down)) { cmd = packet_down_code; - } else if (luaS_ptr_eq(s, special)) { + } else if (lua_key_eq(s, special)) { cmd = packet_special_code; - } else if (luaS_ptr_eq(s, image)) { + } else if (lua_key_eq(s, image)) { cmd = packet_image_code; - } else if (luaS_ptr_eq(s, scale)) { + } else if (lua_key_eq(s, scale)) { cmd = packet_scale_code; - } else if (luaS_ptr_eq(s, lua)) { + } else if (lua_key_eq(s, lua)) { cmd = packet_lua_code; } @@ -1071,15 +948,16 @@ static void read_lua_cidinfo(lua_State * L, int f) { int i; char *s; - lua_getfield(L, -1, "cidinfo"); + //lua_getfield(L, -1, "cidinfo"); + lua_key_rawgeti(cidinfo); if (lua_istable(L, -1)) { - i = numeric_field(L, "version", 0); + i = lua_numeric_field_by_index(L,lua_key_index(version), 0); set_font_cidversion(f, i); - i = numeric_field(L, "supplement", 0); + i = lua_numeric_field_by_index(L,lua_key_index(supplement), 0); set_font_cidsupplement(f, i); - s = string_field(L, "registry", "Adobe"); /* Adobe-Identity-0 */ + s = n_string_field_copy(L, lua_key_index(registry), "Adobe"); /* Adobe-Identity-0 */ set_font_cidregistry(f, s); - s = string_field(L, "ordering", "Identity"); + s = n_string_field_copy(L, lua_key_index(ordering), "Identity"); set_font_cidordering(f, s); } lua_pop(L, 1); @@ -1091,7 +969,8 @@ static void read_lua_parameters(lua_State * L, int f) { int i, n; const char *s; - lua_getfield(L, -1, "parameters"); + //lua_getfield(L, -1, "parameters"); + lua_key_rawgeti(parameters); if (lua_istable(L, -1)) { /* the number of parameters is the max(IntegerKeys(L)),7) */ n = 7; @@ -1126,19 +1005,19 @@ static void read_lua_parameters(lua_State * L, int f) } else if (lua_isstring(L, -2)) { s = lua_tostring(L, -2); n = (lua_isnumber(L, -1) ? lua_roundnumber(L, -1) : 0); - if (luaS_ptr_eq(s, slant)) { + if (lua_key_eq(s, slant)) { set_font_param(f, slant_code, n); - } else if (luaS_ptr_eq(s, space)) { + } else if (lua_key_eq(s, space)) { set_font_param(f, space_code, n); - } else if (luaS_ptr_eq(s, space_stretch)) { + } else if (lua_key_eq(s, space_stretch)) { set_font_param(f, space_stretch_code, n); - } else if (luaS_ptr_eq(s, space_shrink)) { + } else if (lua_key_eq(s, space_shrink)) { set_font_param(f, space_shrink_code, n); - } else if (luaS_ptr_eq(s, x_height)) { + } else if (lua_key_eq(s, x_height)) { set_font_param(f, x_height_code, n); - } else if (luaS_ptr_eq(s, quad)) { + } else if (lua_key_eq(s, quad)) { set_font_param(f, quad_code, n); - } else if (luaS_ptr_eq(s, extra_space)) { + } else if (lua_key_eq(s, extra_space)) { set_font_param(f, extra_space_code, n); } } @@ -1153,7 +1032,8 @@ static void read_lua_parameters(lua_State * L, int f) static void read_lua_math_parameters(lua_State * L, int f) { int i = 0, n = 0; - lua_getfield(L, -1, "MathConstants"); + //lua_getfield(L, -1, "MathConstants"); + lua_key_rawgeti(MathConstants); if (lua_istable(L, -1)) { lua_pushnil(L); while (lua_next(L, -2) != 0) { @@ -1176,36 +1056,24 @@ static void read_lua_math_parameters(lua_State * L, int f) #define MIN_INF -0x7FFFFFFF -static void store_math_kerns(lua_State * L, charinfo * co, int id) +static void store_math_kerns(lua_State * L, int index, charinfo * co, int id) { - int l, k, i; + int l, k; scaled ht, krn; + lua_rawgeti(L, LUA_REGISTRYINDEX, index);lua_rawget(L, -2); if (lua_istable(L, -1) && ((k = (int) lua_rawlen(L, -1)) > 0)) { for (l = 0; l < k; l++) { lua_rawgeti(L, -1, (l + 1)); if (lua_istable(L, -1)) { - lua_getfield(L, -1, "height"); - if (lua_isnumber(L, -1)) { - i=(int)lua_tonumber(L, -1); - ht = (scaled) i; - } else { - ht = MIN_INF; - } - lua_pop(L, 1); - lua_getfield(L, -1, "kern"); - if (lua_isnumber(L, -1)) { - i=(int)lua_tonumber(L, -1); - krn = (scaled) i; - } else { - krn = MIN_INF; - } - lua_pop(L, 1); + ht = (scaled) lua_numeric_field_by_index(L, lua_key_index(height), MIN_INF); + krn = (scaled) lua_numeric_field_by_index(L, lua_key_index(kern), MIN_INF); if (krn > MIN_INF && ht > MIN_INF) add_charinfo_math_kern(co, id, ht, krn); } lua_pop(L, 1); } } + lua_pop(L, 1); } @ @c @@ -1226,66 +1094,69 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, if (lua_istable(L, -1)) { co = get_charinfo(f, i); set_charinfo_tag(co, 0); - j = n_numeric_field(L, luaS_width_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(width), 0); set_charinfo_width(co, j); - j = n_numeric_field(L, luaS_height_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(height), 0); set_charinfo_height(co, j); - j = n_numeric_field(L, luaS_depth_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(depth), 0); set_charinfo_depth(co, j); - j = n_numeric_field(L, luaS_italic_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(italic), 0); set_charinfo_italic(co, j); - j = n_numeric_field(L, luaS_index_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(index), 0); set_charinfo_index(co, j); - j = n_numeric_field(L, luaS_expansion_factor_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(expansion_factor), 0); set_charinfo_ef(co, j); - j = n_numeric_field(L, luaS_left_protruding_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(left_protruding), 0); set_charinfo_lp(co, j); - j = n_numeric_field(L, luaS_right_protruding_index, 0); + j = lua_numeric_field_by_index(L, lua_key_index(right_protruding), 0); set_charinfo_rp(co, j); - k = n_boolean_field(L, luaS_used_index, 0); + k = n_boolean_field(L, lua_key_index(used), 0); set_charinfo_used(co, k); - s = n_string_field(L, luaS_name_index, NULL); + s = n_string_field(L, lua_key_index(name)); if (s != NULL) set_charinfo_name(co, xstrdup(s)); else set_charinfo_name(co, NULL); - s = n_string_field(L, luaS_tounicode_index, NULL); + /* n_string_field leaves a value on stack*/ + lua_pop(L,1); + s = n_string_field(L, lua_key_index(tounicode)); if (s != NULL) set_charinfo_tounicode(co, xstrdup(s)); else set_charinfo_tounicode(co, NULL); - + /* n_string_field leaves a value on stack*/ + lua_pop(L,1); if (has_math) { - j = n_numeric_field(L, luaS_top_accent_index, INT_MIN); + j = lua_numeric_field_by_index(L, lua_key_index(top_accent), INT_MIN); set_charinfo_top_accent(co, j); - j = n_numeric_field(L, luaS_bot_accent_index, INT_MIN); + j = lua_numeric_field_by_index(L, lua_key_index(bot_accent), INT_MIN); set_charinfo_bot_accent(co, j); - k = n_numeric_field(L, luaS_next_index, -1); + k = lua_numeric_field_by_index(L, lua_key_index(next), -1); if (k >= 0) { set_charinfo_tag(co, list_tag); set_charinfo_remainder(co, k); } - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_extensible_index); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(extensible)); lua_rawget(L, -2); if (lua_istable(L, -1)) { int top, bot, mid, rep; - top = n_numeric_field(L, luaS_top_index, 0); - bot = n_numeric_field(L, luaS_bot_index, 0); - mid = n_numeric_field(L, luaS_mid_index, 0); - rep = n_numeric_field(L, luaS_rep_index, 0); + top = lua_numeric_field_by_index(L, lua_key_index(top), 0); + bot = lua_numeric_field_by_index(L, lua_key_index(bot), 0); + mid = lua_numeric_field_by_index(L, lua_key_index(mid), 0); + rep = lua_numeric_field_by_index(L, lua_key_index(rep), 0); if (top != 0 || bot != 0 || mid != 0 || rep != 0) { set_charinfo_tag(co, ext_tag); set_charinfo_extensible(co, top, bot, mid, rep); } else { - pdftex_warn + luatex_warn ("lua-loaded font %s char [U+%X] has an invalid extensible field!", font_name(f), (int) i); } } lua_pop(L, 1); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_horiz_variants_index); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(horiz_variants)); lua_rawget(L, -2); if (lua_istable(L, -1)) { int glyph, startconnect, endconnect, advance, extender; @@ -1295,11 +1166,11 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, for (k = 1;; k++) { lua_rawgeti(L, -1, k); if (lua_istable(L, -1)) { - glyph = n_numeric_field(L, luaS_glyph_index, 0); - extender = n_numeric_field(L, luaS_extender_index, 0); - startconnect = n_numeric_field(L, luaS_start_index, 0); - endconnect = n_numeric_field(L, luaS_end_index, 0); - advance = n_numeric_field(L, luaS_advance_index, 0); + glyph = lua_numeric_field_by_index(L, lua_key_index(glyph), 0); + extender = lua_numeric_field_by_index(L, lua_key_index(extender), 0); + startconnect = lua_numeric_field_by_index(L, lua_key_index(start), 0); + endconnect = lua_numeric_field_by_index(L, lua_key_index(end), 0); + advance = lua_numeric_field_by_index(L, lua_key_index(advance), 0); h = new_variant(glyph, startconnect, endconnect, advance, extender); add_charinfo_hor_variant(co, h); @@ -1312,7 +1183,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, } lua_pop(L, 1); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_vert_variants_index); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(vert_variants)); lua_rawget(L, -2); if (lua_istable(L, -1)) { int glyph, startconnect, endconnect, advance, extender; @@ -1322,11 +1193,11 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, for (k = 1;; k++) { lua_rawgeti(L, -1, k); if (lua_istable(L, -1)) { - glyph = n_numeric_field(L, luaS_glyph_index, 0); - extender = n_numeric_field(L, luaS_extender_index, 0); - startconnect = n_numeric_field(L, luaS_start_index, 0); - endconnect = n_numeric_field(L, luaS_end_index, 0); - advance = n_numeric_field(L, luaS_advance_index, 0); + glyph = lua_numeric_field_by_index(L, lua_key_index(glyph), 0); + extender = lua_numeric_field_by_index(L, lua_key_index(extender), 0); + startconnect = lua_numeric_field_by_index(L, lua_key_index(start), 0); + endconnect = lua_numeric_field_by_index(L, lua_key_index(end), 0); + advance = lua_numeric_field_by_index(L, lua_key_index(advance), 0); h = new_variant(glyph, startconnect, endconnect, advance, extender); add_charinfo_vert_variant(co, h); @@ -1348,29 +1219,21 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, |["top_right"] ={ { ["height"]=676, ["kern"]=115 }, { ["height"]=776, ["kern"]=45 } },| |}| */ - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_mathkern_index); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(mathkern)); lua_rawget(L, -2); if (lua_istable(L, -1)) { - lua_getfield(L, -1, "top_left"); - store_math_kerns(L, co, top_left_kern); - lua_pop(L, 1); - lua_getfield(L, -1, "top_right"); - store_math_kerns(L, co, top_right_kern); - lua_pop(L, 1); - lua_getfield(L, -1, "bottom_right"); - store_math_kerns(L, co, bottom_right_kern); - lua_pop(L, 1); - lua_getfield(L, -1, "bottom_left"); - store_math_kerns(L, co, bottom_left_kern); - lua_pop(L, 1); + store_math_kerns(L,lua_key_index(top_left), co, top_left_kern); + store_math_kerns(L,lua_key_index(top_right), co, top_right_kern); + store_math_kerns(L,lua_key_index(bottom_right), co, bottom_right_kern); + store_math_kerns(L,lua_key_index(bottom_left), co, bottom_left_kern); } lua_pop(L, 1); } /* end of |has_math| */ - nk = count_hash_items(L, luaS_index(kerns)); + nk = count_hash_items(L, lua_key_index(kerns)); if (nk > 0) { ckerns = xcalloc((unsigned) (nk + 1), sizeof(kerninfo)); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(kerns)); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(kerns)); lua_rawget(L, -2); if (lua_istable(L, -1)) { /* there are kerns */ ctr = 0; @@ -1383,7 +1246,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, k = non_boundarychar; } else if (lua_isstring(L, -2)) { s = lua_tostring(L, -2); - if (luaS_ptr_eq(s, right_boundary)) { + if (lua_key_eq(s, right_boundary)) { k = right_boundarychar; if (!has_right_boundary(f)) set_right_boundary(f, @@ -1396,7 +1259,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, set_kern_item(ckerns[ctr], k, j); ctr++; } else { - pdftex_warn + luatex_warn ("lua-loaded font %s char [U+%X] has an invalid kern field!", font_name(f), (int) i); } @@ -1407,7 +1270,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, set_kern_item(ckerns[ctr], end_kern, 0); set_charinfo_kerns(co, ckerns); } else { - pdftex_warn + luatex_warn ("lua-loaded font %s char [U+%X] has an invalid kerns field!", font_name(f), (int) i); } @@ -1416,7 +1279,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, } /* packet commands */ - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_commands_index); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(commands)); lua_rawget(L, -2); if (lua_istable(L, -1)) { lua_pushnil(L); /* first key */ @@ -1428,11 +1291,11 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, lua_pop(L, 1); /* ligatures */ - nl = count_hash_items(L, luaS_index(ligatures)); + nl = count_hash_items(L, lua_key_index(ligatures)); if (nl > 0) { cligs = xcalloc((unsigned) (nl + 1), sizeof(liginfo)); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(ligatures)); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(ligatures)); lua_rawget(L, -2); if (lua_istable(L, -1)) { /* do ligs */ ctr = 0; @@ -1446,7 +1309,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, } } else if (lua_isstring(L, -2)) { s = lua_tostring(L, -2); - if (luaS_ptr_eq(s, right_boundary)) { + if (lua_key_eq(s, right_boundary)) { k = right_boundarychar; if (!has_right_boundary(f)) set_right_boundary(f, @@ -1456,15 +1319,15 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, } r = -1; if (lua_istable(L, -1)) { - r = n_numeric_field(L, luaS_char_index, -1); /* ligature */ + r = lua_numeric_field_by_index(L, lua_key_index(char), -1); /* ligature */ } if (r != -1 && k != non_boundarychar) { - t = enum_field(L, "type", 0, ligature_type_strings); - set_ligature_item(cligs[ctr], (char) ((t * 2) + 1), k, + t = n_enum_field(L, lua_key_index(type), 0, ligature_type_strings); + set_ligature_item(cligs[ctr], (char) ((t * 2) + 1), k, r); ctr++; } else { - pdftex_warn + luatex_warn ("lua-loaded font %s char [U+%X] has an invalid ligature field!", font_name(f), (int) i); } @@ -1475,7 +1338,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, set_ligature_item(cligs[ctr], 0, end_ligature, 0); set_charinfo_ligatures(co, cligs); } else { - pdftex_warn + luatex_warn ("lua-loaded font %s char [U+%X] has an invalid ligatures field!", font_name(f), (int) i); } @@ -1499,89 +1362,91 @@ int font_from_lua(lua_State * L, int f) char *s; const char *ss; int *l_fonts = NULL; - int save_ref = 1; /* unneeded, really */ + int save_ref ; boolean no_math = false; /* will we save a cache of the luat table? */ - s = string_field(L, "cache", "yes"); - if (strcmp(s, "yes") == 0) - save_ref = 1; - else if (strcmp(s, "no") == 0) + + save_ref = 1; /* we start with ss = "yes" */ + ss = NULL; + ss = n_string_field(L, lua_key_index(cache)); + if (lua_key_eq(ss, no)) save_ref = -1; - else if (strcmp(s, "renew") == 0) + else if (lua_key_eq(ss, renew)) save_ref = 0; - free(s); + /* n_string_field leaves a value on stack*/ + lua_pop(L,1); /* the table is at stack index -1 */ - - if (luaS_width_index == 0) + /*if (luaS_width_index == 0) init_font_string_pointers(L); - - s = string_field(L, "area", ""); + */ + + s = n_string_field_copy(L,lua_key_index(area), ""); set_font_area(f, s); - s = string_field(L, "filename", NULL); + s = n_string_field_copy(L, lua_key_index(filename), NULL); set_font_filename(f, s); - s = string_field(L, "encodingname", NULL); + s = n_string_field_copy(L, lua_key_index(encodingname), NULL); set_font_encodingname(f, s); - s = string_field(L, "name", NULL); + s = n_string_field_copy(L, lua_key_index(name), NULL); set_font_name(f, s); - s = string_field(L, "fullname", font_name(f)); + s = n_string_field_copy(L, lua_key_index(fullname), font_name(f)); set_font_fullname(f, s); if (s == NULL) { - pdftex_fail("lua-loaded font [%d] has no name!", f); + luatex_fail("lua-loaded font [%d] has no name!", f); return false; } - s = string_field(L, "psname", NULL); + s = n_string_field_copy(L, lua_key_index(psname), NULL); set_font_psname(f, s); - i = numeric_field(L, "units_per_em", 0); + i = lua_numeric_field_by_index(L,lua_key_index(units_per_em), 0); set_font_units_per_em(f, i); - i = numeric_field(L, "designsize", 655360); + i = lua_numeric_field_by_index(L,lua_key_index(designsize), 655360); set_font_dsize(f, i); - i = numeric_field(L, "size", font_dsize(f)); + i = lua_numeric_field_by_index(L,lua_key_index(size), font_dsize(f)); set_font_size(f, i); - i = numeric_field(L, "checksum", 0); + i = lua_numeric_field_by_index(L,lua_key_index(checksum), 0); set_font_checksum(f, (unsigned) i); - i = numeric_field(L, "direction", 0); + i = lua_numeric_field_by_index(L,lua_key_index(direction), 0); set_font_natural_dir(f, i); - i = numeric_field(L, "encodingbytes", 0); + i = lua_numeric_field_by_index(L,lua_key_index(encodingbytes), 0); set_font_encodingbytes(f, (char) i); - i = numeric_field(L, "tounicode", 0); + i = lua_numeric_field_by_index(L,lua_key_index(tounicode), 0); set_font_tounicode(f, (char) i); - i = numeric_field(L, "extend", 1000); + i = lua_numeric_field_by_index(L,lua_key_index(extend), 1000); if (i < FONT_EXTEND_MIN) i = FONT_EXTEND_MIN; if (i > FONT_EXTEND_MAX) i = FONT_EXTEND_MAX; set_font_extend(f, i); - i = numeric_field(L, "slant", 0); + i = lua_numeric_field_by_index(L,lua_key_index(slant), 0); if (i < FONT_SLANT_MIN) i = FONT_SLANT_MIN; if (i > FONT_SLANT_MAX) i = FONT_SLANT_MAX; set_font_slant(f, i); - i = numeric_field(L, "hyphenchar", int_par(default_hyphen_char_code)); + i = lua_numeric_field_by_index(L,lua_key_index(hyphenchar), int_par(default_hyphen_char_code)); set_hyphen_char(f, i); - i = numeric_field(L, "skewchar", int_par(default_skew_char_code)); + i = lua_numeric_field_by_index(L,lua_key_index(skewchar), int_par(default_skew_char_code)); set_skew_char(f, i); - i = boolean_field(L, "used", 0); + i = n_boolean_field(L, lua_key_index(used), 0); set_font_used(f, (char) i); - s = string_field(L, "attributes", NULL); + s = n_string_field_copy(L, lua_key_index(attributes), NULL); if (s != NULL && strlen(s) > 0) { i = maketexstring(s); set_pdf_font_attr(f, i); } - i = enum_field(L, "type", unknown_font_type, font_type_strings); + i = n_enum_field(L, lua_key_index(type), unknown_font_type, font_type_strings); set_font_type(f, i); - i = enum_field(L, "format", unknown_format, font_format_strings); + i = n_enum_field(L, lua_key_index(format), unknown_format, font_format_strings); set_font_format(f, i); - i = enum_field(L, "embedding", unknown_embedding, font_embedding_strings); + i = n_enum_field(L, lua_key_index(embedding), unknown_embedding, font_embedding_strings); set_font_embedding(f, i); if (font_encodingbytes(f) == 0 && (font_format(f) == opentype_format @@ -1590,16 +1455,16 @@ int font_from_lua(lua_State * L, int f) } /* now fetch the base fonts, if needed */ - n = count_hash_items(L, luaS_index(fonts)); + n = count_hash_items(L, lua_key_index(fonts)); if (n > 0) { l_fonts = xmalloc((unsigned) ((unsigned) (n + 2) * sizeof(int))); memset(l_fonts, 0, (size_t) ((unsigned) (n + 2) * sizeof(int))); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_index(fonts)); + lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(fonts)); lua_rawget(L, -2); for (i = 1; i <= n; i++) { lua_rawgeti(L, -1, i); if (lua_istable(L, -1)) { - lua_getfield(L, -1, "id"); + lua_key_rawgeti(id); if (lua_isnumber(L, -1)) { l_fonts[i]=(int)lua_tonumber(L, -1); lua_pop(L, 2); /* pop id and entry */ @@ -1609,17 +1474,18 @@ int font_from_lua(lua_State * L, int f) }; ss = NULL; if (lua_istable(L, -1)) { - lua_getfield(L, -1, "name"); - if (lua_isstring(L, -1)) { - ss = lua_tostring(L, -1); - } - lua_pop(L, 1); /* pop name */ + /* lua_getfield(L, -1, "name"); */ + /* if (lua_isstring(L, -1)) { */ + /* ss = lua_tostring(L, -1); */ + /* } */ + /* lua_pop(L, 1); /\* pop name *\/ */ + ss = n_string_field(L, lua_key_index(name)); } if (ss != NULL) { - lua_getfield(L, -1, "size"); - t = (lua_isnumber(L, -1) ? lua_roundnumber(L, -1) : -1000); - lua_pop(L, 1); - + /* lua_getfield(L, -1, "size"); */ + /* t = (lua_isnumber(L, -1) ? lua_roundnumber(L, -1) : -1000); */ + /* lua_pop(L, 1); */ + t = lua_numeric_field_by_index(L, lua_key_index(size), -1000); /* TODO: the stack is messed up, otherwise this * explicit resizing would not be needed */ @@ -1630,14 +1496,14 @@ int font_from_lua(lua_State * L, int f) l_fonts[i] = find_font_id(ss, t); lua_settop(L, s_top); } else { - pdftex_fail("Invalid local font in font %s!\n", font_name(f)); + luatex_fail("Invalid local font in font %s!\n", font_name(f)); } lua_pop(L, 1); /* pop list entry */ } lua_pop(L, 1); /* pop list entry */ } else { if (font_type(f) == virtual_font_type) { - pdftex_fail("Invalid local fonts in font %s!\n", font_name(f)); + luatex_fail("Invalid local fonts in font %s!\n", font_name(f)); } else { l_fonts = xmalloc(3 * sizeof(int)); l_fonts[0] = 0; @@ -1647,7 +1513,7 @@ int font_from_lua(lua_State * L, int f) } /* parameters */ - no_math = boolean_field(L, "nomath", 0); + no_math = n_boolean_field(L, lua_key_index(nomath), 0); read_lua_parameters(L, f); if (!no_math) { read_lua_math_parameters(L, f); @@ -1655,8 +1521,9 @@ int font_from_lua(lua_State * L, int f) read_lua_cidinfo(L, f); /* characters */ - - lua_getfield(L, -1, "characters"); + //lua_rawgeti(L, LUA_REGISTRYINDEX, lua_key_index(characters));lua_rawget(L, -2); + lua_key_rawgeti(characters); + /*lua_getfield(L, -1, "characters");*/ if (lua_istable(L, -1)) { /* find the array size values */ int num = 0; /* number of charinfo's to add */ @@ -1696,10 +1563,10 @@ int font_from_lua(lua_State * L, int f) } } else if (lua_isstring(L, -2)) { const char *ss1 = lua_tostring(L, -2); - if (luaS_ptr_eq(ss1, left_boundary)) { + if (lua_key_eq(ss1, left_boundary)) { font_char_from_lua(L, f, left_boundarychar, l_fonts, !no_math); - } else if (luaS_ptr_eq(ss1, right_boundary)) { + } else if (lua_key_eq(ss1, right_boundary)) { font_char_from_lua(L, f, right_boundarychar, l_fonts, !no_math); } @@ -1711,15 +1578,15 @@ int font_from_lua(lua_State * L, int f) /* handle font expansion last: the |copy_font| routine is called eventually, and that needs to know |bc| and |ec|. */ if (font_type(f) != virtual_font_type) { - int fstep = numeric_field(L, "step", 0); + int fstep = lua_numeric_field_by_index(L, lua_key_index(step), 0); if (fstep < 0) fstep = 0; if (fstep > 100) fstep = 100; if (fstep != 0) { - int fshrink = numeric_field(L, "shrink", 0); - int fstretch = numeric_field(L, "stretch", 0); - int fexpand = boolean_field(L, "auto_expand", 0); + int fshrink = lua_numeric_field_by_index(L, lua_key_index(shrink), 0); + int fstretch =lua_numeric_field_by_index(L, lua_key_index(stretch), 0); + int fexpand = n_boolean_field(L, lua_key_index(auto_expand), 0); if (fshrink < 0) fshrink = 0; if (fshrink > 500) @@ -1739,7 +1606,7 @@ int font_from_lua(lua_State * L, int f) } } else { /* jikes, no characters */ - pdftex_warn("lua-loaded font [%d] (%s) has no characters!", f, + luatex_warn("lua-loaded font [%d] (%s) has no characters!", f, font_name(f)); } @@ -1751,7 +1618,7 @@ int font_from_lua(lua_State * L, int f) set_font_cache_id(f, save_ref); } } else { /* jikes, no characters */ - pdftex_warn("lua-loaded font [%d] (%s) has no character table!", f, + luatex_warn("lua-loaded font [%d] (%s) has no character table!", f, font_name(f)); } diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h index 0d78199862b..bb4901d5107 100644 --- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h +++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.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: luatexfont.h 4679 2013-12-19 15:47:53Z luigi $ */ +/* $Id: luatexfont.h 4781 2014-02-10 11:05:24Z taco $ */ #ifndef LUATEXFONT_H # define LUATEXFONT_H diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w index c6d826da9b5..aa076a0a587 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.w +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: mapfile.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: mapfile.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/mapfile.w $"; #include "ptexlib.h" @@ -166,7 +166,7 @@ int avl_do_entry(fm_entry * fm, int mode) if (p != NULL) { switch (mode) { case FM_DUPIGNORE: - pdftex_warn + luatex_warn ("fontmap entry for `%s' already exists, duplicates ignored", fm->tfm_name); delete_new = 1; @@ -174,7 +174,7 @@ int avl_do_entry(fm_entry * fm, int mode) case FM_REPLACE: case FM_DELETE: if (is_inuse(p)) { - pdftex_warn + luatex_warn ("fontmap entry for `%s' has been used, replace/delete not allowed", fm->tfm_name); delete_new = 1; @@ -222,7 +222,7 @@ static int check_fm_entry(fm_entry * fm, boolean warn) if (is_fontfile(fm) && !is_included(fm)) { if (warn) - pdftex_warn + luatex_warn ("ambiguous entry for `%s': font file present but not included, " "will be treated as font file not present", fm->tfm_name); xfree(fm->ff_name); @@ -232,7 +232,7 @@ static int check_fm_entry(fm_entry * fm, boolean warn) /* if both ps_name and font file are missing, drop this entry */ if (fm->ps_name == NULL && !is_fontfile(fm)) { if (warn) - pdftex_warn + luatex_warn ("invalid entry for `%s': both ps_name and font file missing", fm->tfm_name); a += 1; @@ -241,7 +241,7 @@ static int check_fm_entry(fm_entry * fm, boolean warn) /* TrueType fonts cannot be reencoded without subsetting */ if (is_truetype(fm) && is_reencoded(fm) && !is_subsetted(fm)) { if (warn) - pdftex_warn + luatex_warn ("invalid entry for `%s': only subsetted TrueType font can be reencoded", fm->tfm_name); a += 2; @@ -250,14 +250,14 @@ static int check_fm_entry(fm_entry * fm, boolean warn) /* the value of SlantFont and ExtendFont must be reasonable */ if (fm->slant < FONT_SLANT_MIN || fm->slant > FONT_SLANT_MAX) { if (warn) - pdftex_warn + luatex_warn ("invalid entry for `%s': too big value of SlantFont (%g)", fm->tfm_name, fm->slant / 1000.0); a += 8; } if (fm->extend < FONT_EXTEND_MIN || fm->extend > FONT_EXTEND_MAX) { if (warn) - pdftex_warn + luatex_warn ("invalid entry for `%s': too big value of ExtendFont (%g)", fm->tfm_name, fm->extend / 1000.0); a += 16; @@ -267,7 +267,7 @@ static int check_fm_entry(fm_entry * fm, boolean warn) if (fm->pid != -1 && !(is_truetype(fm) && is_subsetted(fm) && !is_reencoded(fm))) { if (warn) - pdftex_warn + luatex_warn ("invalid entry for `%s': PidEid can be used only with subsetted non-reencoded TrueType fonts", fm->tfm_name); a += 32; @@ -406,7 +406,7 @@ static void fm_scan_line(void) for (r = s; *r != ' ' && *r != '"' && *r != '\0'; r++); /* jump over name */ c = *r; /* remember char for temporary end of string */ *r = '\0'; - pdftex_warn + luatex_warn ("invalid entry for `%s': unknown name `%s' ignored", fm->tfm_name, s); *r = (char) c; @@ -418,7 +418,7 @@ static void fm_scan_line(void) if (*r == '"') /* closing quote */ r++; else { - pdftex_warn + luatex_warn ("invalid entry for `%s': closing quote missing", fm->tfm_name); goto bad_line; @@ -528,14 +528,14 @@ static void fm_read_info(void) fm_file = NULL; } } else { - pdftex_warn("cannot open font map file (%s)", cur_file_name); + luatex_warn("cannot open font map file (%s)", cur_file_name); } } else { - pdftex_warn("cannot open font map file (%s)", cur_file_name); + luatex_warn("cannot open font map file (%s)", cur_file_name); } } else { if (!fm_open(cur_file_name)) { - pdftex_warn("cannot open font map file (%s)", cur_file_name); + luatex_warn("cannot open font map file (%s)", cur_file_name); } else { fm_read_file(); tex_printf("{%s", cur_file_name); @@ -552,7 +552,7 @@ static void fm_read_info(void) } break; case MAPLINE: - cur_file_name = NULL; /* makes pdftex_warn() shorter */ + cur_file_name = NULL; /* makes luatex_warn() shorter */ fm_scan_line(); break; default: diff --git a/Build/source/texk/web2c/luatexdir/font/pkin.w b/Build/source/texk/web2c/luatexdir/font/pkin.w index 9be0e3c1b09..d96e69537c7 100644 --- a/Build/source/texk/web2c/luatexdir/font/pkin.w +++ b/Build/source/texk/web2c/luatexdir/font/pkin.w @@ -48,8 +48,8 @@ Modified for use with pdftex by Han The Thanh <thanh@@fi.muni.cz>. @c static const char _svn_version[] = - "$Id: pkin.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/pkin.w $"; + "$Id: pkin.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/pkin.w $"; #include "ptexlib.h" @@ -65,7 +65,7 @@ static shalfword pkbyte(void) register shalfword i; i = t3_getchar(); if (t3_eof()) - pdftex_fail("unexpected eof in pk file"); + luatex_fail("unexpected eof in pk file"); return (i); } @@ -202,7 +202,7 @@ static halfword rest(void) return (i); } } else { - pdftex_fail("shouldn't happen"); + luatex_fail("shouldn't happen"); return 0; /*NOTREACHED*/} } @@ -321,7 +321,7 @@ static void unpack(chardesc * cd) turnon = !turnon; } if ((rowsleft != 0) || ((int) hbit != cd->cwidth)) - pdftex_fail("error while unpacking; more bits than required"); + luatex_fail("error while unpacking; more bits than required"); } } @@ -343,9 +343,9 @@ int readchar(boolean check_preamble, chardesc * cd) */ if (check_preamble) { if (pkbyte() != 247) - pdftex_fail("bad pk file, expected pre"); + luatex_fail("bad pk file, expected pre"); if (pkbyte() != 89) - pdftex_fail("bad version of pk file"); + luatex_fail("bad version of pk file"); for (i = pkbyte(); i > 0; i--) /* creator of pkfile */ (void) pkbyte(); (void) pkquad(); /* design size */ @@ -401,7 +401,7 @@ int readchar(boolean check_preamble, chardesc * cd) cd->yoff = pkquad(); } if (length <= 0) - pdftex_fail("packet length (%i) too small", (int) length); + luatex_fail("packet length (%i) too small", (int) length); unpack(cd); return 1; } else { @@ -426,7 +426,7 @@ int readchar(boolean check_preamble, chardesc * cd) case 246: break; default: - pdftex_fail("unexpected command (%i)", (int) flagbyte); + luatex_fail("unexpected command (%i)", (int) flagbyte); } } } diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.h b/Build/source/texk/web2c/luatexdir/font/sfnt.h index dda13643ff6..74f5701ec0f 100644 --- a/Build/source/texk/web2c/luatexdir/font/sfnt.h +++ b/Build/source/texk/web2c/luatexdir/font/sfnt.h @@ -19,7 +19,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: sfnt.h 3765 2010-07-29 07:10:21Z taco $ */ +/* $Id: sfnt.h 4847 2014-03-05 18:13:17Z luigi $ */ #ifndef _SFNT_H_ # define _SFNT_H_ @@ -183,7 +183,7 @@ typedef struct { # define RELEASE(a) free(a) # define NEW(a,b) xmalloc((unsigned)((unsigned)(a)*sizeof(b))) # define RENEW(a,b,c) xrealloc(a, (unsigned)((unsigned)(b)*sizeof(c))) -# define TT_ERROR pdftex_fail +# define TT_ERROR luatex_fail # define WARN printf diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.w b/Build/source/texk/web2c/luatexdir/font/subfont.w index 5b436393d98..06678c1e195 100644 --- a/Build/source/texk/web2c/luatexdir/font/subfont.w +++ b/Build/source/texk/web2c/luatexdir/font/subfont.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: subfont.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/subfont.w $"; + "$Id: subfont.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.w $"; #include "ptexlib.h" #include <string.h> @@ -105,7 +105,7 @@ static void sfd_getline(boolean expect_eof) if (expect_eof) return; else - pdftex_fail("unexpected end of file"); + luatex_fail("unexpected end of file"); } p = sfd_line; do { @@ -149,13 +149,13 @@ static sfd_entry *read_sfd(char *sfd_name) if (!(run_callback(callback_id, "S->bSd", cur_file_name, &file_opened, &sfd_buffer, &sfd_size) && file_opened && sfd_size > 0)) { - pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name); + luatex_warn("cannot open SFD file for reading (%s)", cur_file_name); cur_file_name = NULL; return NULL; } } else { if (!sfd_open(cur_file_name)) { - pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name); + luatex_warn("cannot open SFD file for reading (%s)", cur_file_name); cur_file_name = NULL; return NULL; } @@ -187,16 +187,16 @@ static sfd_entry *read_sfd(char *sfd_name) } else if (*p == 0) /* end of subfont */ break; if (sscanf(p, " %li %n", &i, &n) == 0) - pdftex_fail("invalid token:\n%s", p); + luatex_fail("invalid token:\n%s", p); p += n; if (*p == ':') { /* offset */ k = i; p++; } else if (*p == '_') { /* range */ if (sscanf(p + 1, " %li %n", &j, &n) == 0) - pdftex_fail("invalid token:\n%s", p); + luatex_fail("invalid token:\n%s", p); if (i > j || k + (j - i) > 255) - pdftex_fail("invalid range:\n%s", p); + luatex_fail("invalid range:\n%s", p); while (i <= j) sf->charcodes[k++] = i++; p += n + 1; diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w index 86bdda167d6..6d2358349d3 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.w +++ b/Build/source/texk/web2c/luatexdir/font/texfont.w @@ -32,7 +32,7 @@ problematic |if 0 != null|. @c static const char _svn_version[] = - "$Id: texfont.w 4685 2013-12-20 13:39:30Z luigi $" + "$Id: texfont.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.w $"; #include "ptexlib.h" @@ -196,7 +196,7 @@ static void set_charinfo(internal_font_number f, int c, charinfo * ci) if (glyph) { font_tables[f]->charinfo[glyph] = *ci; } else { - pdftex_fail("font: %s", "character insertion failed"); + luatex_fail("font: %s", "character insertion failed"); } } else if (c == left_boundarychar) { set_left_boundary(f, ci); diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w index e303e470fa4..b33bef027a0 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.w +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: tounicode.w 4643 2013-09-16 20:33:56Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/tounicode.w $"; + "$Id: tounicode.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tounicode.w $"; #include "ptexlib.h" @@ -99,7 +99,7 @@ void def_tounicode(str_number glyph, str_number unistr) } if (l == 0 || valid_unistr == 0 || strlen(buf) == 0 || strcmp(buf, notdef) == 0) { - pdftex_warn("ToUnicode: invalid parameter(s): `%s' => `%s'", buf, p); + luatex_warn("ToUnicode: invalid parameter(s): `%s' => `%s'", buf, p); return; } if (glyph_unicode_tree == NULL) { @@ -311,7 +311,7 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name) assert(strlen(name) + strlen(builtin_suffix) < SMALL_BUF_SIZE); if (glyph_unicode_tree == NULL) { #ifdef DEBUG - pdftex_warn("no GlyphToUnicode entry has been inserted yet!"); + luatex_warn("no GlyphToUnicode entry has been inserted yet!"); #endif pdf->gen_tounicode = 0; return 0; diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.w b/Build/source/texk/web2c/luatexdir/font/vfovf.w index 1e21b55f630..1ce4165a5df 100644 --- a/Build/source/texk/web2c/luatexdir/font/vfovf.w +++ b/Build/source/texk/web2c/luatexdir/font/vfovf.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: vfovf.w 4679 2013-12-19 15:47:53Z luigi $" + "$Id: vfovf.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/vfovf.w $"; #include "ptexlib.h" @@ -133,7 +133,7 @@ typedef struct vf_stack_record { { \ eight_bits vf_tmp_b; \ if (vf_cur >= vf_size) { \ - pdftex_fail("unexpected eof on virtual font"); \ + luatex_fail("unexpected eof on virtual font"); \ } \ vf_tmp_b = vf_buffer[vf_cur++]; \ a = vf_tmp_b; \ diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w index 5ec397b4a23..ed0ec53ce1e 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.w +++ b/Build/source/texk/web2c/luatexdir/font/writecff.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: writecff.w 4690 2013-12-21 22:25:27Z luigi $" + "$Id: writecff.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.w $"; #include "ptexlib.h" @@ -51,9 +51,9 @@ static unsigned long get_unsigned(cff_font * cff, int n) } @ @c -#define CFF_ERROR pdftex_fail +#define CFF_ERROR luatex_fail #undef WARN -#define WARN pdftex_warn +#define WARN luatex_warn const char *const cff_stdstr[CFF_STDSTR_MAX] = { ".notdef", "space", "exclam", "quotedbl", "numbersign", @@ -863,7 +863,7 @@ cff_dict *cff_dict_unpack(card8 * data, card8 * endptr) } if (status != CFF_PARSE_OK) { - pdftex_fail("Parsing CFF DICT failed. (error=%d)", status); + luatex_fail("Parsing CFF DICT failed. (error=%d)", status); } else if (stack_top != 0) { WARN("Garbage in CFF DICT data."); stack_top = 0; @@ -899,13 +899,13 @@ double cff_dict_get(cff_dict * dict, const char *key, int idx) if ((dict->entries)[i].count > idx) value = (dict->entries)[i].values[idx]; else - pdftex_fail("Invalid index number."); + luatex_fail("Invalid index number."); break; } } if (i == dict->count) - pdftex_fail("DICT entry \"%s\" not found.", key); + luatex_fail("DICT entry \"%s\" not found.", key); return value; } @@ -1122,7 +1122,7 @@ cff_font *read_cff(unsigned char *buf, long buflength, int n) return NULL; } if (cff->header_major > 1) { - pdftex_warn("CFF major version %u not supported.", cff->header_major); + luatex_warn("CFF major version %u not supported.", cff->header_major); cff_close(cff); return NULL; } @@ -1131,7 +1131,7 @@ cff_font *read_cff(unsigned char *buf, long buflength, int n) /* Name INDEX */ idx = cff_get_index(cff); if (n > idx->count - 1) { - pdftex_warn("Invalid CFF fontset index number."); + luatex_warn("Invalid CFF fontset index number."); cff_close(cff); return NULL; } @@ -1540,7 +1540,7 @@ void cff_dict_set(cff_dict * dict, const char *key, int idx, double value) } if (i == dict->count) - pdftex_fail("DICT entry \"%s\" not found.", key); + luatex_fail("DICT entry \"%s\" not found.", key); } @@ -3014,7 +3014,7 @@ static void write_fontfile(PDF pdf, cff_font * cffont, char *fullname) if ((avl_find(fd->gl_tree,glyph) != NULL)) { \ size = (long)(cs_idx->offset[code+1] - cs_idx->offset[code]); \ if (size > CS_STR_LEN_MAX) { \ - pdftex_fail("Charstring too long: gid=%u, %ld bytes", code, size); \ + luatex_fail("Charstring too long: gid=%u, %ld bytes", code, size); \ } \ if (charstring_len + CS_STR_LEN_MAX >= max_len) { \ max_len = (long)(charstring_len + 2 * CS_STR_LEN_MAX); \ @@ -3457,7 +3457,7 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd) (CIDToGIDMap[2 * cid + 1])); size = (long) (cs_idx->offset[gid_org + 1] - cs_idx->offset[gid_org]); if (size > CS_STR_LEN_MAX) { - pdftex_fail("Charstring too long: gid=%u, %ld bytes", cid, size); + luatex_fail("Charstring too long: gid=%u, %ld bytes", cid, size); } if (charstring_len + CS_STR_LEN_MAX >= max_len) { max_len = charstring_len + 2 * CS_STR_LEN_MAX; diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w index 6e4808e6b76..ff986bf86fe 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.w +++ b/Build/source/texk/web2c/luatexdir/font/writefont.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: writefont.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/writefont.w $"; + "$Id: writefont.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" @@ -525,7 +525,7 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd) fd_flags = is_std_t1font(fd->fm) ? std_flags[check_std_t1font(fd->fm->ps_name)] : FD_FLAGS_DEFAULT_NON_EMBED; - pdftex_warn + luatex_warn ("No flags specified for non-embedded font `%s' (%s) (I'm using %i): " "fix your map entry.", fd->fm->ps_name != NULL ? fd->fm->ps_name : "No name given", @@ -716,7 +716,7 @@ static void create_fontdictionary(PDF pdf, internal_font_number f) create_fontdescriptor(fo, f); write_fontdescriptor(pdf, fo->fd); if (!is_std_t1font(fo->fm)) - pdftex_warn("font `%s' is not a standard font; " + luatex_warn("font `%s' is not a standard font; " "I suppose it is available to your PDF viewer then", fo->fm->ps_name); } @@ -780,7 +780,7 @@ void do_pdf_font(PDF pdf, internal_font_number f) fm->ff_name = s; del_file = 1; } else { - pdftex_fail + luatex_fail ("writefont.c: The file (%s) does not contain font `%s'", fm->ff_name, fm->ps_name); } @@ -808,7 +808,7 @@ void do_pdf_font(PDF pdf, internal_font_number f) set_type1(fm); break; default: - pdftex_fail + luatex_fail ("writefont.c: The file format (%s) for font `%s' is incompatible with wide characters\n", font_format_name(f), font_name(f)); } diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w index 37af7723320..567d3768936 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.w +++ b/Build/source/texk/web2c/luatexdir/font/writet1.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: writet1.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/writet1.w $"; + "$Id: writet1.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet1.w $"; #include "ptexlib.h" #include <string.h> @@ -257,7 +257,7 @@ static void enc_getline(void) char c; restart: if (enc_eof()) - pdftex_fail("unexpected end of file"); + luatex_fail("unexpected end of file"); p = enc_line; do { c = (char) enc_getchar(); @@ -283,7 +283,7 @@ char **load_enc_file(char *enc_name) cur_file_name = luatex_find_file(enc_name, find_enc_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find encoding file '%s' for reading", enc_name); + luatex_fail("cannot find encoding file '%s' for reading", enc_name); } callback_id = callback_defined(read_enc_file_callback); enc_curbyte = 0; @@ -292,12 +292,12 @@ char **load_enc_file(char *enc_name) if (run_callback(callback_id, "S->bSd", cur_file_name, &file_opened, &enc_buffer, &enc_size)) { if ((!file_opened) || enc_size == 0) { - pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name); + luatex_fail("cannot open encoding file '%s' for reading", cur_file_name); } } } else { if (!enc_open(cur_file_name)) { - pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name); + luatex_fail("cannot open encoding file '%s' for reading", cur_file_name); } enc_read_file(); enc_close(); @@ -311,7 +311,7 @@ char **load_enc_file(char *enc_name) enc_getline(); if (*enc_line != '/' || (r = strchr(enc_line, '[')) == NULL) { remove_eol(r, enc_line); - pdftex_fail + luatex_fail ("invalid encoding vector (a name or `[' missing): `%s'", enc_line); } names_count = 0; @@ -324,7 +324,7 @@ char **load_enc_file(char *enc_name) *p = 0; skip(r, ' '); if (names_count >= 256) - pdftex_fail("encoding vector contains more than 256 names"); + luatex_fail("encoding vector contains more than 256 names"); if (strcmp(buf, notdef) != 0) glyph_names[names_count] = xstrdup(buf); names_count++; @@ -334,7 +334,7 @@ char **load_enc_file(char *enc_name) goto done; else { remove_eol(r, enc_line); - pdftex_fail + luatex_fail ("invalid encoding vector: a name or `] def' expected: `%s'", enc_line); } @@ -376,7 +376,7 @@ static int t1_getbyte(void) return c; if (t1_block_length == 0) { if (c != 128) - pdftex_fail("invalid marker"); + luatex_fail("invalid marker"); c = t1_getchar(); if (c == 3) { while (!t1_eof()) @@ -456,7 +456,7 @@ static float t1_scan_num(char *p, char **r) skip(p, ' '); if (sscanf(p, "%g", &f) != 1) { remove_eol(p, t1_line_array); - pdftex_fail("a number expected: `%s'", t1_line_array); + luatex_fail("a number expected: `%s'", t1_line_array); } if (r != NULL) { for (; isdigit(*p) || *p == '.' || @@ -488,7 +488,7 @@ static void t1_getline(void) static int eexec_len = 17; /* |strlen(eexec_str)| */ restart: if (t1_eof()) - pdftex_fail("unexpected end of file"); + luatex_fail("unexpected end of file"); t1_line_ptr = t1_line_array; alloc_array(t1_line, 1, T1_BUF_SIZE); t1_cslen = 0; @@ -605,7 +605,7 @@ static void t1_check_block_len(boolean decrypt) c = edecrypt((byte) c); l = (int) t1_block_length; if (!(l == 0 && (c == 10 || c == 13))) { - pdftex_fail("%i bytes more than expected were ignored", l + 1); + luatex_fail("%i bytes more than expected were ignored", l + 1); } } @@ -642,7 +642,7 @@ static void t1_stop_eexec(PDF pdf) if (last_hexbyte == 0) t1_puts(pdf, "00"); else - pdftex_fail("unexpected data after eexec"); + luatex_fail("unexpected data after eexec"); } } t1_cs = false; @@ -680,7 +680,7 @@ static void t1_scan_keys(PDF pdf) if (t1_prefix("/FontType")) { p = t1_line_array + strlen("FontType") + 1; if ((i = (int) t1_scan_num(p, 0)) != 1) - pdftex_fail("Type%d fonts unsupported by pdfTeX", i); + luatex_fail("Type%d fonts unsupported by pdfTeX", i); return; } for (key = (const key_entry *) font_key; key - font_key < FONT_KEYS_NUM; @@ -696,7 +696,7 @@ static void t1_scan_keys(PDF pdf) if ((k = (int) (key - font_key)) == FONTNAME_CODE) { if (*p != '/') { remove_eol(p, t1_line_array); - pdftex_fail("a name expected: `%s'", t1_line_array); + luatex_fail("a name expected: `%s'", t1_line_array); } r = ++p; /* skip the slash */ for (q = t1_buf_array; *p != ' ' && *p != 10; *q++ = *p++); @@ -738,7 +738,7 @@ static void t1_scan_param(PDF pdf) if (t1_prefix(lenIV)) { t1_lenIV = (short) t1_scan_num(t1_line_array + strlen(lenIV), 0); if (t1_lenIV < 0) - pdftex_fail("negative value of lenIV is not supported"); + luatex_fail("negative value of lenIV is not supported"); return; } t1_scan_keys(pdf); @@ -776,7 +776,7 @@ static char **t1_builtin_enc(void) } return glyph_names; } else - pdftex_fail + luatex_fail ("cannot subset font (unknown predefined encoding `%s')", t1_buf_array); } @@ -808,7 +808,7 @@ static char **t1_builtin_enc(void) *p = 0; skip(r, ' '); if (counter > 255) - pdftex_fail("encoding vector contains more than 256 names"); + luatex_fail("encoding vector contains more than 256 names"); if (strcmp(t1_buf_array, notdef) != 0) glyph_names[counter] = xstrdup(t1_buf_array); counter++; @@ -818,7 +818,7 @@ static char **t1_builtin_enc(void) break; else { remove_eol(r, t1_line_array); - pdftex_fail + luatex_fail ("a name or `] def' or `] readonly def' expected: `%s'", t1_line_array); } @@ -906,13 +906,13 @@ static boolean t1_open_fontfile(const char *open_name_prefix) t1_size = 0; ff = check_ff_exist(fd_cur->fm->ff_name, is_truetype(fd_cur->fm)); if (ff->ff_path == NULL) { - pdftex_fail("cannot open Type 1 font file for reading (%s)", + luatex_fail("cannot open Type 1 font file for reading (%s)", fd_cur->fm->ff_name); return false; } cur_file_name = luatex_find_file(ff->ff_path, find_type1_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot open Type 1 font file for reading (%s)", + luatex_fail("cannot open Type 1 font file for reading (%s)", ff->ff_path); return false; } @@ -921,7 +921,7 @@ static boolean t1_open_fontfile(const char *open_name_prefix) if (!run_callback(callback_id, "S->bSd", cur_file_name, &file_opened, &t1_buffer, &t1_size) && file_opened && t1_size > 0) { - pdftex_warn("cannot open Type 1 font file for reading (%s)", + luatex_warn("cannot open Type 1 font file for reading (%s)", cur_file_name); return false; } @@ -972,7 +972,7 @@ static void t1_include(PDF pdf) @c #define check_subr(subr) \ if (subr >= subr_size || subr < 0) \ - pdftex_fail("Subrs array: entry index out of range (%i)", subr); + luatex_fail("Subrs array: entry index out of range (%i)", subr); static const char **check_cs_token_pair(void) { @@ -998,7 +998,7 @@ static void cs_store(boolean is_subr) } else { ptr = cs_ptr++; if (cs_ptr - cs_tab > cs_size) - pdftex_fail + luatex_fail ("CharStrings dict: more entries than dict size (%i)", cs_size); if (strcmp(t1_buf_array + 1, notdef) == 0) /* skip the slash */ ptr->name = (char *) notdef; @@ -1040,7 +1040,7 @@ static boolean is_cc_init = false; stack_ptr -= N #define stack_error(N) { \ - pdftex_fail("CharString: invalid access (%i) to stack (%i entries)", \ + luatex_fail("CharString: invalid access (%i) to stack (%i entries)", \ (int) N, (int)(stack_ptr - cc_stack)); \ goto cs_error; \ } @@ -1110,9 +1110,9 @@ static void cs_fail(const char *cs_name, int subr, const char *fmt, ...) vsprintf(buf, fmt, args); va_end(args); if (cs_name == NULL) - pdftex_fail("Subr (%i): %s", (int) subr, buf); + luatex_fail("Subr (%i): %s", (int) subr, buf); else - pdftex_fail("CharString (/%s): %s", cs_name, buf); + luatex_fail("CharString (/%s): %s", cs_name, buf); } @ fix a return-less subr by appending |CS_RETURN| @@ -1176,7 +1176,7 @@ static void cs_mark(const char *cs_name, int subr) if (strcmp(ptr->name, cs_name) == 0) break; if (ptr == cs_ptr) { - pdftex_warn("glyph `%s' undefined", cs_name); + luatex_warn("glyph `%s' undefined", cs_name); return; } if (ptr->name == notdef) @@ -1282,7 +1282,7 @@ static void cs_mark(const char *cs_name, int subr) } } if (cs_name == NULL && last_cmd != CS_RETURN) { - pdftex_warn("last command in subr `%i' is not a RETURN; " + luatex_warn("last command in subr `%i' is not a RETURN; " "I will add it now but please consider fixing the font", (int) subr); append_cs_return(ptr); @@ -1670,7 +1670,7 @@ static void t1_subset_charstrings(PDF pdf) t1_mark_glyphs(); if (subr_tab != NULL) { if (cs_token_pair == NULL) - pdftex_fail + luatex_fail ("This Type 1 font uses mismatched subroutine begin/end token pairs."); t1_subr_flush(); } diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.w b/Build/source/texk/web2c/luatexdir/font/writet3.w index 54fb3c1f4f0..c03a6d84374 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet3.w +++ b/Build/source/texk/web2c/luatexdir/font/writet3.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writet3.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writet3.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet3.w $"; #include "ptexlib.h" @@ -50,7 +50,7 @@ int t3_curbyte = 0; #define t3_check_eof() \ if (t3_eof()) \ - pdftex_fail("unexpected end of file"); + luatex_fail("unexpected end of file"); @ @c @@ -141,7 +141,7 @@ static boolean writepk(PDF pdf, internal_font_number f) if (name == NULL || !FILESTRCASEEQ(cur_file_name, font_ret.name) || !kpse_bitmap_tolerance((float) font_ret.dpi, (float) dpi)) { - pdftex_fail("Font %s at %i not found", cur_file_name, (int) dpi); + luatex_fail("Font %s at %i not found", cur_file_name, (int) dpi); } } callback_id = callback_defined(read_pk_file_callback); @@ -150,7 +150,7 @@ static boolean writepk(PDF pdf, internal_font_number f) (run_callback (callback_id, "S->bSd", name, &file_opened, &t3_buffer, &t3_size) && file_opened && t3_size > 0)) { - pdftex_warn("Font %s at %i not found", cur_file_name, (int) dpi); + luatex_warn("Font %s at %i not found", cur_file_name, (int) dpi); cur_file_name = NULL; return false; } diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w index 93be125837b..2cab4b2371c 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.w +++ b/Build/source/texk/web2c/luatexdir/font/writettf.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writettf.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writettf.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writettf.w $"; #include "ptexlib.h" @@ -487,7 +487,7 @@ long ttf_getnum(int s) int c; while (s > 0) { if (ttf_eof()) - pdftex_fail("unexpected EOF"); + luatex_fail("unexpected EOF"); c = ttf_getchar(); i = (i << 8) + c; s--; @@ -517,7 +517,7 @@ dirtab_entry *ttf_name_lookup(const char *s, boolean required) break; if (tab - dir_tab == ntabs) { if (required) - pdftex_fail("can't find table `%s'", s); + luatex_fail("can't find table `%s'", s); else tab = NULL; } @@ -587,7 +587,7 @@ static void ttf_copy_encoding(void) e = ttfenc_tab + *q; e->code = charcodes[*q]; if (e->code == -1) - pdftex_warn + luatex_warn ("character %i in subfont %s is not mapped to any charcode", *q, fd_cur->fm->tfm_name); else { @@ -817,7 +817,7 @@ void ttf_read_post(void) } break; default: - pdftex_warn("unsupported format (%.8X) of `post' table, assuming 3.0", + luatex_warn("unsupported format (%.8X) of `post' table, assuming 3.0", (unsigned int) post_format); case 0x00030000: for (glyph = glyph_tab; glyph - glyph_tab < NMACGLYPHS; glyph++) { @@ -893,13 +893,13 @@ static ttf_cmap_entry *ttf_read_cmap(char *ttf_name, int pid, int eid, goto read_cmap_format_4; else { if (warn) - pdftex_warn("cmap format %i unsupported", format); + luatex_warn("cmap format %i unsupported", format); return NULL; } } } if (warn) - pdftex_warn("cannot find cmap subtable for (pid,eid) = (%i, %i)", + luatex_warn("cannot find cmap subtable for (pid,eid) = (%i, %i)", pid, eid); return NULL; read_cmap_format_4: @@ -950,10 +950,10 @@ static ttf_cmap_entry *ttf_read_cmap(char *ttf_name, int pid, int eid, index = (index + s->idDelta) & 0xFFFF; } if (index >= glyphs_count) - pdftex_fail("cmap: glyph index %li out of range [0..%i)", + luatex_fail("cmap: glyph index %li out of range [0..%i)", index, glyphs_count); if (p->table[i] != -1) - pdftex_warn + luatex_warn ("cmap: multiple glyphs are mapped to unicode %.4lX, " "only %li will be used (glyph %li being ignored)", i, p->table[i], index); @@ -999,7 +999,7 @@ static void ttf_reset_chksm(PDF pdf, dirtab_entry * tab) tmp_ulong = 0; tab->offset = (TTF_ULONG) ttf_offset(); if (tab->offset % 4 != 0) - pdftex_warn("offset of `%4.4s' is not a multiple of 4", tab->tag); + luatex_warn("offset of `%4.4s' is not a multiple of 4", tab->tag); } @@ -1035,7 +1035,7 @@ static void ttf_byte_encoding(PDF pdf) put_byte(e->newindex); } else { if (e->name != notdef) - pdftex_warn + luatex_warn ("glyph `%s' has been mapped to `%s' in `ttf_byte_encoding' cmap table", e->name, notdef); put_byte(0); /* notdef */ @@ -1124,7 +1124,7 @@ static void ttf_write_cmap(PDF pdf) offset += TRIMMED_TABLE_MAP_LENGTH; break; default: - pdftex_fail("invalid format (it should not have happened)"); + luatex_fail("invalid format (it should not have happened)"); } (void) put_ushort(ce->platform_id); (void) put_ushort(ce->encoding_id); @@ -1268,7 +1268,7 @@ static void ttf_write_dirtab(PDF pdf) } } if (i % 4 != 0) { - pdftex_warn("font length is not a multiple of 4 (%li)", i); + luatex_warn("font length is not a multiple of 4 (%li)", i); checksum <<= 8 * (4 - i % 4); } k = 0xB1B0AFBA - checksum; @@ -1365,7 +1365,7 @@ static void ttf_reindex_glyphs(void) t = cmap->table; assert(t != NULL && e->code < 0x10000); if (t[e->code] < 0) { - pdftex_warn + luatex_warn ("subfont %s: wrong mapping: character %li --> 0x%4.4lX --> .notdef", fd_cur->fm->tfm_name, (long) (e - ttfenc_tab), e->code); continue; @@ -1381,7 +1381,7 @@ static void ttf_reindex_glyphs(void) /* scan form `index123' */ if (sscanf(e->name, GLYPH_PREFIX_INDEX "%i", &index) == 1) { if (index >= glyphs_count) { - pdftex_warn("`%s' out of valid range [0..%i)", + luatex_warn("`%s' out of valid range [0..%i)", e->name, glyphs_count); continue; } @@ -1396,7 +1396,7 @@ static void ttf_reindex_glyphs(void) if (cmap == NULL) cmap = ttf_read_cmap(fd_cur->fm->ff_name, 0, 3, false); if (cmap == NULL) { - pdftex_warn + luatex_warn ("no unicode mapping found, all `uniXXXX' names will be ignored"); cmap_not_found = true; /* once only */ } @@ -1407,7 +1407,7 @@ static void ttf_reindex_glyphs(void) assert(t != NULL); if (t[index] != -1) { if (t[index] >= glyphs_count) { - pdftex_warn + luatex_warn ("`%s' is mapped to index %li which is out of valid range [0..%i)", e->name, t[index], glyphs_count); continue; @@ -1415,7 +1415,7 @@ static void ttf_reindex_glyphs(void) glyph = glyph_tab + t[index]; goto append_new_glyph; } else { - pdftex_warn("`unicode %s%.4X' is not mapped to any glyph", + luatex_warn("`unicode %s%.4X' is not mapped to any glyph", GLYPH_PREFIX_UNICODE, index); continue; } @@ -1425,7 +1425,7 @@ static void ttf_reindex_glyphs(void) if (glyph->name != notdef && strcmp(glyph->name, e->name) == 0) break; if (!(glyph - glyph_tab < glyphs_count)) { - pdftex_warn("glyph `%s' not found", e->name); + luatex_warn("glyph `%s' not found", e->name); continue; } append_new_glyph: @@ -1556,7 +1556,7 @@ static void ttf_write_OS2(PDF pdf) ttf_reset_chksm(pdf, tab); version = get_ushort(); if (version > 3) - pdftex_fail("unknown version of OS/2 table (%.4X)", version); + luatex_fail("unknown version of OS/2 table (%.4X)", version); (void) put_ushort(0x0001); /* fix version to 1 */ ttf_ncopy(pdf, 2 * TTF_USHORT_SIZE + 13 * TTF_SHORT_SIZE + 10 * TTF_BYTE_SIZE); @@ -1694,7 +1694,7 @@ void writettf(PDF pdf, fd_entry * fd) if (is_subsetted(fd_cur->fm) && (fd_cur->fe == NULL) && !is_subfont(fd_cur->fm)) { - pdftex_fail("Subset TrueType must be a reencoded or a subfont"); + luatex_fail("Subset TrueType must be a reencoded or a subfont"); } ttf_curbyte = 0; ttf_size = 0; @@ -1702,7 +1702,7 @@ void writettf(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_truetype_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find TrueType font file for reading (%s)", fd_cur->fm->ff_name); + luatex_fail("cannot find TrueType font file for reading (%s)", fd_cur->fm->ff_name); } callback_id = callback_defined(read_truetype_file_callback); if (callback_id > 0) { @@ -1710,11 +1710,11 @@ void writettf(PDF pdf, fd_entry * fd) &file_opened, &ttf_buffer, &ttf_size) && file_opened && ttf_size > 0) { } else { - pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); } } else { if (!ttf_open(cur_file_name)) { - pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); @@ -1807,7 +1807,7 @@ void writeotf(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name); + luatex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name); } callback_id = callback_defined(read_opentype_file_callback); if (callback_id > 0) { @@ -1815,11 +1815,11 @@ void writeotf(PDF pdf, fd_entry * fd) &file_opened, &ttf_buffer, &ttf_size) && file_opened && ttf_size > 0) { } else { - pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } } else { if (!otf_open(cur_file_name)) { - pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.w b/Build/source/texk/web2c/luatexdir/font/writetype0.w index 19bab05906f..1196899ba79 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype0.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype0.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: writetype0.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/writetype0.w $"; + "$Id: writetype0.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype0.w $"; #include "ptexlib.h" #include "font/writettf.h" @@ -48,7 +48,7 @@ void writetype0(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find OpenType font file for reading (%s)", + luatex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name); } callback_id = callback_defined(read_opentype_file_callback); @@ -57,12 +57,12 @@ void writetype0(PDF pdf, fd_entry * fd) &file_opened, &ttf_buffer, &ttf_size) && file_opened && ttf_size > 0) { } else { - pdftex_fail("cannot open OpenType font file for reading (%s)", + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } } else { if (!otf_open(cur_file_name)) { - pdftex_fail("cannot open OpenType font file for reading (%s)", + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.w b/Build/source/texk/web2c/luatexdir/font/writetype2.w index b7c32f0616b..c2bdb97b152 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype2.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype2.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: writetype2.w 4457 2012-07-13 13:16:19Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/font/writetype2.w $"; + "$Id: writetype2.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype2.w $"; #include "ptexlib.h" #include "font/writettf.h" @@ -153,7 +153,7 @@ void writetype2(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name); + luatex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name); } callback_id = callback_defined(read_opentype_file_callback); if (callback_id > 0) { @@ -161,11 +161,11 @@ void writetype2(PDF pdf, fd_entry * fd) &file_opened, &ttf_buffer, &ttf_size) && file_opened && ttf_size > 0) { } else { - pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } } else { if (!otf_open(cur_file_name)) { - pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); + luatex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h index 4e88dbeeaba..0526b84ec57 100644 --- a/Build/source/texk/web2c/luatexdir/image/image.h +++ b/Build/source/texk/web2c/luatexdir/image/image.h @@ -18,7 +18,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: image.h 4406 2012-05-07 21:47:26Z hhenkel $ */ +/* $Id: image.h 4847 2014-03-05 18:13:17Z luigi $ */ #ifndef IMAGE_H # define IMAGE_H @@ -35,8 +35,8 @@ extern scaled one_hundred_bp; /* from pdfgen.w */ # define bp2sp(p) do_zround(p * (one_hundred_bp / 100.0)) # define sp2bp(i) (i * 100.0 / one_hundred_bp) -# define TYPE_IMG "image" -# define TYPE_IMG_DICT "image-dict" +# define TYPE_IMG "image.meta" +# define TYPE_IMG_DICT "image.dict" /**********************************************************************/ diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w index 52838d338b4..492492c5fd3 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: pdftoepdf.w 4749 2014-01-15 08:43:57Z taco $" + "$Id: pdftoepdf.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/pdftoepdf.w $"; // define DEBUG @@ -70,14 +70,14 @@ static char *get_file_checksum(char *a, file_error_mode fe) time_t mtime = finfo.st_mtime; ck = (char *) malloc(PDF_CHECKSUM_SIZE); if (ck == NULL) - pdftex_fail("PDF inclusion: out of memory while processing '%s'", + luatex_fail("PDF inclusion: out of memory while processing '%s'", a); snprintf(ck, PDF_CHECKSUM_SIZE, "%" PRIu64 "_%" PRIu64, (uint64_t) size, (uint64_t) mtime); } else { switch (fe) { case FE_FAIL: - pdftex_fail("PDF inclusion: could not stat() file '%s'", a); + luatex_fail("PDF inclusion: could not stat() file '%s'", a); break; case FE_RETURN_NULL: if (ck != NULL) @@ -127,7 +127,7 @@ PdfDocument *refPdfDocument(char *file_path, file_error_mode fe) #endif assert(pdf_doc->checksum != NULL); if (strncmp(pdf_doc->checksum, checksum, PDF_CHECKSUM_SIZE) != 0) { - pdftex_fail("PDF inclusion: file has changed '%s'", file_path); + luatex_fail("PDF inclusion: file has changed '%s'", file_path); } free(checksum); } @@ -144,7 +144,7 @@ PdfDocument *refPdfDocument(char *file_path, file_error_mode fe) if (!doc->isOk() || !doc->okToPrint()) { switch (fe) { case FE_FAIL: - pdftex_fail("xpdf: reading PDF image failed"); + luatex_fail("xpdf: reading PDF image failed"); break; case FE_RETURN_NULL: delete doc; @@ -242,7 +242,7 @@ static int addInObj(PDF pdf, PdfDocument * pdf_doc, Ref ref) ObjMap *obj_map; InObj *p, *q, *n; if (ref.num == 0) { - pdftex_fail("PDF inclusion: reference to invalid object" + luatex_fail("PDF inclusion: reference to invalid object" " (is the included pdf broken?)"); } if ((obj_map = findObjMap(pdf_doc, ref)) != NULL) @@ -429,7 +429,7 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj) case objError: case objEOF: case objNone: - pdftex_fail("PDF inclusion: type <%s> cannot be copied", + luatex_fail("PDF inclusion: type <%s> cannot be copied", obj->getTypeName()); break; default: @@ -482,7 +482,7 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec) return page->getArtBox(); break; default: - pdftex_fail("PDF inclusion: unknown value of pagebox spec (%i)", + luatex_fail("PDF inclusion: unknown value of pagebox spec (%i)", (int) pagebox_spec); } return page->getMediaBox(); // to make the compiler happy @@ -530,10 +530,10 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted, const char *msg = "PDF inclusion: found PDF version <%d.%d>, but at most version <1.%d> allowed"; if (pdf_inclusion_errorlevel > 0) { - pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, + luatex_fail(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted); } else { - pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, + luatex_warn(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted); } } @@ -543,19 +543,19 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted, GooString name(img_pagename(idict)); LinkDest *link = doc->findDest(&name); if (link == NULL || !link->isOk()) - pdftex_fail("PDF inclusion: invalid destination <%s>", + luatex_fail("PDF inclusion: invalid destination <%s>", img_pagename(idict)); Ref ref = link->getPageRef(); img_pagenum(idict) = catalog->findPage(ref.num, ref.gen); if (img_pagenum(idict) == 0) - pdftex_fail("PDF inclusion: destination is not a page <%s>", + luatex_fail("PDF inclusion: destination is not a page <%s>", img_pagename(idict)); delete link; } else { // get page by number if (img_pagenum(idict) <= 0 || img_pagenum(idict) > img_totalpages(idict)) - pdftex_fail("PDF inclusion: required page <%i> does not exist", + luatex_fail("PDF inclusion: required page <%i> does not exist", (int) img_pagenum(idict)); } // get the required page @@ -600,7 +600,7 @@ read_pdf_info(image_dict * idict, int minor_pdf_version_wanted, img_rotation(idict) = 1; break; default: - pdftex_warn + luatex_warn ("PDF inclusion: " "/Rotate parameter in PDF file not multiple of 90 degrees."); } @@ -695,7 +695,7 @@ void write_epdf(PDF pdf, image_dict * idict) // Metadata validity check (as a stream it must be indirect) pageDict->lookupNF((char *) "Metadata", &obj1); if (!obj1.isNull() && !obj1.isRef()) - pdftex_warn("PDF inclusion: /Metadata must be indirect object"); + luatex_warn("PDF inclusion: /Metadata must be indirect object"); obj1.free(); // copy selected items in Page dictionary @@ -732,7 +732,7 @@ void write_epdf(PDF pdf, image_dict * idict) op2->free(); }; if (!op1->isDict()) - pdftex_warn("PDF inclusion: Page /Resources missing."); + luatex_warn("PDF inclusion: Page /Resources missing."); op1->free(); } obj1.free(); @@ -751,7 +751,7 @@ void write_epdf(PDF pdf, image_dict * idict) // contents.streamGetDict()->lookup((char *) "F", &obj1); if (!obj1.isNull()) { - pdftex_fail("PDF inclusion: Unsupported external stream"); + luatex_fail("PDF inclusion: Unsupported external stream"); } obj1.free(); contents.streamGetDict()->lookup((char *) "Length", &obj1); diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w index 03b5af45c50..e5c39466ce7 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.w +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w @@ -22,7 +22,7 @@ @ @c static const char _svn_version[] = - "$Id: writeimg.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writeimg.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writeimg.w $"; #include "ptexlib.h" @@ -141,7 +141,7 @@ static void check_type_by_header(image_dict * idict) for (i = 0; (unsigned) i < MAX_HEADER; i++) { header[i] = (char) xgetc(file); if (feof(file)) - pdftex_fail("reading image file failed"); + luatex_fail("reading image file failed"); } xfclose(file, img_filepath(idict)); /* tests */ @@ -292,7 +292,7 @@ void read_img(PDF pdf, int callback_id; assert(idict != NULL); if (img_filename(idict) == NULL) - pdftex_fail("image file name missing"); + luatex_fail("image file name missing"); callback_id = callback_defined(find_image_file_callback); if (img_filepath(idict) == NULL) { if (callback_id > 0 @@ -304,7 +304,7 @@ void read_img(PDF pdf, img_filepath(idict) = kpse_find_file(img_filename(idict), kpse_tex_format, true); if (img_filepath(idict) == NULL) - pdftex_fail("cannot find image file '%s'", img_filename(idict)); + luatex_fail("cannot find image file '%s'", img_filename(idict)); } recorder_record_input(img_filename(idict)); /* type checks */ @@ -328,14 +328,14 @@ void read_img(PDF pdf, break; case IMG_TYPE_JBIG2: if (minor_version < 4) { - pdftex_fail + luatex_fail ("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i", (int) minor_version); } read_jbig2_info(idict); break; default: - pdftex_fail("internal error: unknown image type (2)"); + luatex_fail("internal error: unknown image type (2)"); } cur_file_name = NULL; if (img_state(idict) < DICT_FILESCANNED) @@ -538,11 +538,11 @@ scaled_whd scale_img(image_dict * idict, scaled_whd alt_rule, int transform) xr = img_xres(idict); yr = img_yres(idict); if (x <= 0 || y <= 0 || xr < 0 || yr < 0) - pdftex_fail("ext1: invalid image dimensions"); + luatex_fail("ext1: invalid image dimensions"); if (xr > 65535 || yr > 65535) { xr = 0; yr = 0; - pdftex_warn("ext1: too large image resolution ignored"); + luatex_warn("ext1: too large image resolution ignored"); } if (((transform - img_rotation(idict)) & 1) == 1) { tmp = x; @@ -601,7 +601,7 @@ void write_img(PDF pdf, image_dict * idict) write_pdfstream(pdf, idict); break; default: - pdftex_fail("internal error: unknown image type (1)"); + luatex_fail("internal error: unknown image type (1)"); } if (tracefilenames) tex_printf(">"); @@ -625,7 +625,7 @@ void pdf_write_image(PDF pdf, int n) void check_pdfstream_dict(image_dict * idict) { if (!img_is_bbox(idict)) - pdftex_fail("image.stream: no bbox given"); + luatex_fail("image.stream: no bbox given"); if (img_state(idict) < DICT_FILESCANNED) img_state(idict) = DICT_FILESCANNED; } @@ -822,14 +822,14 @@ void undumpimagemeta(PDF pdf, int pdfversion, int pdfinclusionerrorlevel) break; case IMG_TYPE_JBIG2: if (pdfversion < 4) { - pdftex_fail + luatex_fail ("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i", (int) pdfversion); } undumpinteger(img_pagenum(idict)); break; default: - pdftex_fail("unknown type of image"); + luatex_fail("unknown type of image"); } read_img(pdf, idict, pdfversion, pdfinclusionerrorlevel); } diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.w b/Build/source/texk/web2c/luatexdir/image/writejbig2.w index 98d824fc782..371e5452776 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.w +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.w @@ -81,7 +81,7 @@ object exists, reference it. Else create fresh one. @ @c static const char _svn_version[] = - "$Id: writejbig2.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writejbig2.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejbig2.w $"; #undef DEBUG @@ -209,9 +209,9 @@ static int ygetc(FILE * stream) int c = getc(stream); if (c < 0) { if (c == EOF) - pdftex_fail("getc() failed; premature end of JBIG2 image file"); + luatex_fail("getc() failed; premature end of JBIG2 image file"); else - pdftex_fail("getc() failed (can't happen)"); + luatex_fail("getc() failed (can't happen)"); } return c; } @@ -384,7 +384,7 @@ static void readfilehdr(FILEINFO * fip) xfseek(fip->file, 0, SEEK_SET, fip->filepath); for (i = 0; i < 8; i++) if (ygetc(fip->file) != jbig2_id[i]) - pdftex_fail + luatex_fail ("readfilehdr(): reading JBIG2 image file failed: ID string missing"); /* Annex D.4.2 File header flags */ fip->filehdrflags = (unsigned int) ygetc(fip->file); @@ -441,7 +441,7 @@ static void checkseghdrflags(SEGINFO * sip) case M_Extension: break; default: - pdftex_fail + luatex_fail ("checkseghdrflags(): unknown segment type in JBIG2 image file"); break; } @@ -790,7 +790,7 @@ void read_jbig2_info(image_dict * idict) assert(idict != NULL); img_type(idict) = IMG_TYPE_JBIG2; if (img_pagenum(idict) < 1) - pdftex_fail + luatex_fail ("read_jbig2_info(): page %d not in JBIG2 image file; page must be > 0", (int) img_pagenum(idict)); if (file_tree == NULL) { @@ -816,7 +816,7 @@ void read_jbig2_info(image_dict * idict) } pip = find_pageinfo(&(fip->pages), (unsigned long) img_pagenum(idict)); if (pip == NULL) - pdftex_fail("read_jbig2_info(): page %d not found in JBIG2 image file", + luatex_fail("read_jbig2_info(): page %d not found in JBIG2 image file", (int) img_pagenum(idict)); img_totalpages(idict) = (int) fip->numofpages; img_xsize(idict) = (int) pip->width; diff --git a/Build/source/texk/web2c/luatexdir/image/writejp2.w b/Build/source/texk/web2c/luatexdir/image/writejp2.w index c71a6cea160..61549a67738 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejp2.w +++ b/Build/source/texk/web2c/luatexdir/image/writejp2.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writejp2.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writejp2.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejp2.w $"; @ Basic JPEG~2000 image support. Section and Table references below: @@ -69,7 +69,7 @@ static hdr_struct read_boxhdr(image_dict * idict) if (hdr.lbox == 1) hdr.lbox = read8bytes(img_file(idict)); if (hdr.lbox == 0 && hdr.tbox != BOX_JP2C) - pdftex_fail("reading JP2 image failed (LBox == 0)"); + luatex_fail("reading JP2 image failed (LBox == 0)"); return hdr; } @@ -125,20 +125,20 @@ static void scan_res(image_dict * idict, uint64_t epos_s) if (img_xres(idict) == 0 && img_yres(idict) == 0) { scan_resc_resd(idict); if (xftell(img_file(idict), img_filepath(idict)) != (long)epos) - pdftex_fail + luatex_fail ("reading JP2 image failed (resc box size inconsistent)"); } break; case (BOX_RESD): scan_resc_resd(idict); if (xftell(img_file(idict), img_filepath(idict)) != (long)epos) - pdftex_fail + luatex_fail ("reading JP2 image failed (resd box size inconsistent)"); break; default:; } if (epos > epos_s) - pdftex_fail("reading JP2 image failed (res box size inconsistent)"); + luatex_fail("reading JP2 image failed (res box size inconsistent)"); if (epos == epos_s) break; xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict)); @@ -160,7 +160,7 @@ static boolean scan_jp2h(image_dict * idict, uint64_t epos_s) case (BOX_IHDR): scan_ihdr(idict); if (xftell(img_file(idict), img_filepath(idict)) != (long)epos) - pdftex_fail + luatex_fail ("reading JP2 image failed (ihdr box size inconsistent)"); ihdr_found = true; break; @@ -170,7 +170,7 @@ static boolean scan_jp2h(image_dict * idict, uint64_t epos_s) default:; } if (epos > epos_s) - pdftex_fail + luatex_fail ("reading JP2 image failed (jp2h box size inconsistent)"); if (epos == epos_s) break; @@ -221,7 +221,7 @@ void read_jp2_info(image_dict * idict, img_readtype_e readtype) spos = epos; hdr = read_boxhdr(idict); if (hdr.tbox != BOX_FTYP) - pdftex_fail("reading JP2 image failed (missing ftyp box)"); + luatex_fail("reading JP2 image failed (missing ftyp box)"); epos = spos + hdr.lbox; xfseek(img_file(idict), (long) epos, SEEK_SET, img_filepath(idict)); @@ -235,7 +235,7 @@ void read_jp2_info(image_dict * idict, img_readtype_e readtype) break; case BOX_JP2C: if (!ihdr_found) - pdftex_fail("reading JP2 image failed (no ihdr box found)"); + luatex_fail("reading JP2 image failed (no ihdr box found)"); break; default:; } @@ -255,7 +255,7 @@ static void reopen_jp2(image_dict * idict) read_jp2_info(idict, IMG_KEEPOPEN); if (width != img_xsize(idict) || height != img_ysize(idict) || xres != img_xres(idict) || yres != img_yres(idict)) - pdftex_fail("writejp2: image dimensions have changed"); + luatex_fail("writejp2: image dimensions have changed"); } void write_jp2(PDF pdf, image_dict * idict) @@ -281,7 +281,7 @@ void write_jp2(PDF pdf, image_dict * idict) l = (long unsigned int) img_jp2_ptr(idict)->length; xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict)); if (read_file_to_buf(pdf, img_file(idict), l) != l) - pdftex_fail("writejp2: fread failed"); + luatex_fail("writejp2: fread failed"); pdf_end_stream(pdf); pdf_end_obj(pdf); close_and_cleanup_jp2(idict); diff --git a/Build/source/texk/web2c/luatexdir/image/writejpg.w b/Build/source/texk/web2c/luatexdir/image/writejpg.w index a48b3c73a45..82091660418 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejpg.w +++ b/Build/source/texk/web2c/luatexdir/image/writejpg.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: writejpg.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/image/writejpg.w $"; + "$Id: writejpg.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writejpg.w $"; #include "ptexlib.h" #include <assert.h> @@ -130,7 +130,7 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype) img_jpg_ptr(idict)->length = xftell(img_file(idict), img_filepath(idict)); xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict)); if ((unsigned int) read2bytes(img_file(idict)) != 0xFFD8) - pdftex_fail("reading JPEG image failed (no JPEG header found)"); + luatex_fail("reading JPEG image failed (no JPEG header found)"); /* currently only true JFIF files allow extracting |img_xres| and |img_yres| */ if ((unsigned int) read2bytes(img_file(idict)) == 0xFFE0) { /* check for JFIF */ (void) read2bytes(img_file(idict)); @@ -166,9 +166,9 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype) xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict)); while (1) { if (feof(img_file(idict))) - pdftex_fail("reading JPEG image failed (premature file end)"); + luatex_fail("reading JPEG image failed (premature file end)"); if (fgetc(img_file(idict)) != 0xFF) - pdftex_fail("reading JPEG image failed (no marker found)"); + luatex_fail("reading JPEG image failed (no marker found)"); i = xgetc(img_file(idict)); switch (i) { case M_SOF3: /* lossless */ @@ -181,11 +181,11 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype) case M_SOF13: case M_SOF14: case M_SOF15: /* lossless */ - pdftex_fail("unsupported type of compression (SOF_%d)", i - M_SOF0); + luatex_fail("unsupported type of compression (SOF_%d)", i - M_SOF0); break; case M_SOF2: if (pdf->minor_version <= 2) - pdftex_fail("cannot use progressive DCT with PDF-1.2"); + luatex_fail("cannot use progressive DCT with PDF-1.2"); case M_SOF0: case M_SOF1: (void) read2bytes(img_file(idict)); /* read segment length */ @@ -205,7 +205,7 @@ void read_jpg_info(PDF pdf, image_dict * idict, img_readtype_e readtype) img_procset(idict) |= PROCSET_IMAGE_C; break; default: - pdftex_fail("Unsupported color space %i", + luatex_fail("Unsupported color space %i", (int) img_jpg_color(idict)); } if (readtype == IMG_CLOSEINBETWEEN) @@ -243,7 +243,7 @@ static void reopen_jpg(PDF pdf, image_dict * idict) read_jpg_info(pdf, idict, IMG_KEEPOPEN); if (width != img_xsize(idict) || height != img_ysize(idict) || xres != img_xres(idict) || yres != img_yres(idict)) - pdftex_fail("writejpg: image dimensions have changed"); + luatex_fail("writejpg: image dimensions have changed"); } @ @c @@ -290,7 +290,7 @@ void write_jpg(PDF pdf, image_dict * idict) pdf_end_array(pdf); break; default: - pdftex_fail("Unsupported color space %i", + luatex_fail("Unsupported color space %i", (int) img_jpg_color(idict)); } } @@ -301,7 +301,7 @@ void write_jpg(PDF pdf, image_dict * idict) l = (size_t) img_jpg_ptr(idict)->length; xfseek(img_file(idict), 0, SEEK_SET, img_filepath(idict)); if (read_file_to_buf(pdf, img_file(idict), l) != l) - pdftex_fail("writejpg: fread failed"); + luatex_fail("writejpg: fread failed"); pdf_end_stream(pdf); pdf_end_obj(pdf); close_and_cleanup_jpg(idict); diff --git a/Build/source/texk/web2c/luatexdir/image/writepng.w b/Build/source/texk/web2c/luatexdir/image/writepng.w index b5f0cb82323..56c853b26bd 100644 --- a/Build/source/texk/web2c/luatexdir/image/writepng.w +++ b/Build/source/texk/web2c/luatexdir/image/writepng.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: writepng.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: writepng.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/image/writepng.w $"; #include "ptexlib.h" @@ -60,13 +60,13 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) img_png_ptr(idict) = xtalloc(1, png_img_struct); if ((png_p = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) == NULL) - pdftex_fail("libpng: png_create_read_struct() failed"); + luatex_fail("libpng: png_create_read_struct() failed"); img_png_png_ptr(idict) = png_p; if ((info_p = png_create_info_struct(png_p)) == NULL) - pdftex_fail("libpng: png_create_info_struct() failed"); + luatex_fail("libpng: png_create_info_struct() failed"); img_png_info_ptr(idict) = info_p; if (setjmp(png_jmpbuf(png_p))) - pdftex_fail("libpng: internal error"); + luatex_fail("libpng: internal error"); #if PNG_LIBPNG_VER >= 10603 /* ignore possibly incorrect CMF bytes */ png_set_option(png_p, PNG_MAXIMUM_INFLATE_WINDOW, PNG_OPTION_ON); @@ -95,7 +95,7 @@ void read_png_info(image_dict * idict, img_readtype_e readtype) img_procset(idict) |= PROCSET_IMAGE_C; break; default: - pdftex_fail("unsupported type of color_type <%i>", + luatex_fail("unsupported type of color_type <%i>", (int) png_get_color_type(png_p, info_p)); } img_colordepth(idict) = png_get_bit_depth(png_p, info_p); @@ -234,7 +234,7 @@ static void write_png_gray(PDF pdf, image_dict * idict) } else { if (png_get_image_height(png_p, info_p) * png_get_rowbytes(png_p, info_p) >= 10240000L) - pdftex_warn + luatex_warn ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); rows = xtalloc(png_get_image_height(png_p, info_p), png_bytep); for (i = 0; i < (int) png_get_image_height(png_p, info_p); i++) @@ -280,7 +280,7 @@ static void write_png_gray_alpha(PDF pdf, image_dict * idict) } else { if (png_get_image_height(png_p, info_p) * png_get_rowbytes(png_p, info_p) >= 10240000L) - pdftex_warn + luatex_warn ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); rows = xtalloc(png_get_image_height(png_p, info_p), png_bytep); for (i = 0; i < (int) png_get_image_height(png_p, info_p); i++) @@ -333,7 +333,7 @@ static void write_png_rgb_alpha(PDF pdf, image_dict * idict) } else { if (png_get_image_height(png_p, info_p) * png_get_rowbytes(png_p, info_p) >= 10240000L) - pdftex_warn + luatex_warn ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); rows = xtalloc(png_get_image_height(png_p, info_p), png_bytep); for (i = 0; i < (int) png_get_image_height(png_p, info_p); i++) @@ -371,7 +371,7 @@ static int spng_getint(FILE * f) { unsigned char buf[4]; if (fread(buf, 1, 4, f) != 4) - pdftex_fail("writepng: reading chunk type failed"); + luatex_fail("writepng: reading chunk type failed"); return ((((((int) buf[0] << 8) + buf[1]) << 8) + buf[2]) << 8) + buf[3]; } @@ -392,7 +392,7 @@ static void copy_png(PDF pdf, image_dict * idict) f = (FILE *) png_get_io_ptr(png_p); /* 1st pass to find overall stream /Length */ if (fseek(f, 8, SEEK_SET) != 0) - pdftex_fail("writepng: fseek in PNG file failed (1)"); + luatex_fail("writepng: fseek in PNG file failed (1)"); do { len = spng_getint(f); type = spng_getint(f); @@ -404,7 +404,7 @@ static void copy_png(PDF pdf, image_dict * idict) streamlength += len; default: if (fseek(f, len + 4, SEEK_CUR) != 0) - pdftex_fail("writepng: fseek in PNG file failed (2)"); + luatex_fail("writepng: fseek in PNG file failed (2)"); } } while (endflag == false); pdf_dict_add_int(pdf, "Length", streamlength); @@ -424,19 +424,19 @@ static void copy_png(PDF pdf, image_dict * idict) /* 2nd pass to copy data */ endflag = false; if (fseek(f, 8, SEEK_SET) != 0) - pdftex_fail("writepng: fseek in PNG file failed (3)"); + luatex_fail("writepng: fseek in PNG file failed (3)"); do { len = spng_getint(f); type = spng_getint(f); switch (type) { case SPNG_CHUNK_IDAT: /* do copy */ if (idat == 2) - pdftex_fail("writepng: IDAT chunk sequence broken"); + luatex_fail("writepng: IDAT chunk sequence broken"); idat = 1; if (read_file_to_buf(pdf, f, len) != len) - pdftex_fail("writepng: fread failed"); + luatex_fail("writepng: fread failed"); if (fseek(f, 4, SEEK_CUR) != 0) - pdftex_fail("writepng: fseek in PNG file failed (4)"); + luatex_fail("writepng: fseek in PNG file failed (4)"); break; case SPNG_CHUNK_IEND: /* done */ endflag = true; @@ -445,7 +445,7 @@ static void copy_png(PDF pdf, image_dict * idict) if (idat == 1) idat = 2; if (fseek(f, len + 4, SEEK_CUR) != 0) - pdftex_fail("writepng: fseek in PNG file failed (5)"); + luatex_fail("writepng: fseek in PNG file failed (5)"); } } while (endflag == false); pdf_end_stream(pdf); @@ -463,7 +463,7 @@ static void reopen_png(image_dict * idict) read_png_info(idict, IMG_KEEPOPEN); if (width != img_xsize(idict) || height != img_ysize(idict) || xres != img_xres(idict) || yres != img_yres(idict)) - pdftex_fail("writepng: image dimensions have changed"); + luatex_fail("writepng: image dimensions have changed"); } @ @c @@ -559,7 +559,7 @@ void write_png(PDF pdf, image_dict * idict) pdf_dict_add_name(pdf, "ColorSpace", "DeviceRGB"); break; default: - pdftex_fail("unsupported type of color_type <%i>", + luatex_fail("unsupported type of color_type <%i>", png_get_color_type(png_p, info_p)); } } diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w index 8d6a5b1cb2a..9ffe9f546a9 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.w +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: texlang.w 4634 2013-04-21 14:45:45Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/lang/texlang.w $"; + "$Id: texlang.w 4880 2014-03-14 12:01:16Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/lang/texlang.w $"; #include "ptexlib.h" #include <string.h> @@ -724,11 +724,15 @@ static halfword find_next_wordstart(halfword r) } break; case glyph_node: - if (start_ok && - is_simple_character(r) && - (l = get_lc_code(character(r))) > 0 && - (char_uchyph(r) || l == character(r))) - return r; + if (start_ok && + is_simple_character(r) && + (l = get_lc_code(character(r))) > 0) { + if (char_uchyph(r) || l == character(r)) { + return r; + } else { + start_ok = 0; + } + } break; default: start_ok = 0; 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" diff --git a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c index fe0d432a459..a0b967df193 100644 --- a/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c +++ b/Build/source/texk/web2c/luatexdir/luafilesystem/src/lfs.c @@ -74,7 +74,7 @@ #define getcwd_error strerror(errno) #endif -#define DIR_METATABLE "directory metatable" +#define DIR_METATABLE "lfs.directory" #define MAX_DIR_LENGTH 1023 typedef struct dir_data { int closed; @@ -86,7 +86,7 @@ typedef struct dir_data { #endif } dir_data; -#define LOCK_METATABLE "lock metatable" +#define LOCK_METATABLE "lfs.lock" #ifdef _WIN32 #ifdef __BORLANDC__ diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c index 339f99ffc29..92efbc7800f 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c +++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c @@ -4001,14 +4001,7 @@ static void readttfvwidths(FILE *ttf,struct ttfinfo *info) { tsb = getushort(ttf); if ( info->chars[i]!=NULL ) { /* can happen in ttc files */ info->chars[i]->vwidth = lastvwidth; -#if 0 /* this used to mean something once */ - /* At one point I stored the ymax of loading the glyph in lsidebearing*/ - /* I've removed that as it now seems pointless */ - if ( info->cff_start==0 ) { - voff += tsb + info->chars[i]->lsidebearing /* actually maxy */; - ++cnt; - } -#endif + info->chars[i]->tsb = tsb; } } if ( i==0 ) { @@ -5657,6 +5650,17 @@ static void PsuedoEncodeUnencoded(EncMap *map,struct ttfinfo *info) { if ( info->chars[i]!=NULL && !info->chars[i]->ticked ) ++extras; if ( extras!=0 ) { + /* UnicodeBmp has its own Private Use Areas */ + /* if (strcmp(map->enc_name","UnicodeBmp")==0) { */ + /* if ( (info->glyph_cnt < 0x18FF) && (map->enccount<0xE000)) */ + /* base = 0xE000 */ + /* else if ( map->enccount<0xF0000 ) */ + /* base = 0xF0000; */ + /* else if ( map->enccount<0x100000 ) */ + /* base = 0x100000; */ + /* else */ + /* base = map->enccount; */ + /* } else { */ if ( map->enccount<=256 ) base = 256; else if ( map->enccount<=65536 ) @@ -6050,6 +6054,11 @@ static SplineFont *SFFillFromTTFInfo(struct ttfinfo *info) { sf->units_per_em = info->emsize ; sf->pfminfo = info->pfminfo ; + free(info->savetab); + if ( sf->copyright==NULL ) + sf->copyright = info->copyright; + else + free( info->copyright ); return( sf ); } diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h index 6dc6cec2b8a..edb726e0657 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h +++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h @@ -1130,9 +1130,9 @@ typedef struct splinechar { char *name; int unicodeenc; int orig_pos; /* Original position in the glyph list */ - int16 width, vwidth; + int16 width, vwidth, tsb; int16 xmin, ymin, xmax, ymax; - int16 lsidebearing; /* only used when reading in a type1 font */ + int16 lsidebearing; /* only used when reading in a type1 font */ /* Or an otf font where it is the subr number of a refered character */ /* or a ttf font without bit 1 of head.flags set */ /* or (once upon a time, but no longer) a ttf font with vert metrics where it is the ymax value when we had a font-wide vertical offset */ diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c index 7163fb2f026..f8efad26e56 100644 --- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c +++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c @@ -33,7 +33,7 @@ #include <locale.h> static const char _svn_version[] = - "$Id: luafflib.c 4768 2014-01-28 15:38:54Z luigi $ " + "$Id: luafflib.c 4884 2014-03-14 13:21:17Z taco $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c $"; extern char **gww_errors; @@ -1001,8 +1001,11 @@ void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics) lua_rawset(L, -3); lua_setfield(L, -2, "boundingbox"); /*dump_intfield(L,"orig_pos", glyph->orig_pos); */ - if (hasvmetrics) + if (hasvmetrics) { dump_intfield(L, "vwidth", glyph->vwidth); + if (glyph->tsb != 0) + dump_intfield(L, "tsidebearing", glyph->tsb); + } dump_intfield(L, "width", glyph->width); if (glyph->lsidebearing != glyph->xmin) { @@ -3226,7 +3229,12 @@ static int ff_info(lua_State * L) fontname); return 2; } + + gww_error_count = 0; sf = ReadSplineFontInfo((char *) fontname, openflags); + if (gww_error_count > 0) + gwwv_errors_free(); + if (sf == NULL) { lua_pushnil(L); lua_pushfstring(L, "font loading failed for %s\n", fontname); diff --git a/Build/source/texk/web2c/luatexdir/luapeg/lpeg.h b/Build/source/texk/web2c/luatexdir/luapeg/lpeg.h index 456e8277c7d..fe61485993a 100644 --- a/Build/source/texk/web2c/luatexdir/luapeg/lpeg.h +++ b/Build/source/texk/web2c/luatexdir/luapeg/lpeg.h @@ -28,8 +28,8 @@ #define VERSION "0.12" -#define PATTERN_T "lpeg-pattern" -#define MAXSTACKIDX "lpeg-maxstack" +#define PATTERN_T "lpeg.pattern" +#define MAXSTACKIDX "lpeg.maxstack" /* diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/tcp.c b/Build/source/texk/web2c/luatexdir/luasocket/src/tcp.c index 6734dc0b497..e7334031478 100644 --- a/Build/source/texk/web2c/luatexdir/luasocket/src/tcp.c +++ b/Build/source/texk/web2c/luatexdir/luasocket/src/tcp.c @@ -99,13 +99,13 @@ static luaL_Reg func[] = { int tcp_open(lua_State *L) { /* create classes */ - auxiliar_newclass(L, "tcp{master}", tcp_methods); - auxiliar_newclass(L, "tcp{client}", tcp_methods); - auxiliar_newclass(L, "tcp{server}", tcp_methods); + auxiliar_newclass(L, "tcp.master", tcp_methods); + auxiliar_newclass(L, "tcp.client", tcp_methods); + auxiliar_newclass(L, "tcp.server", tcp_methods); /* create class groups */ - auxiliar_add2group(L, "tcp{master}", "tcp{any}"); - auxiliar_add2group(L, "tcp{client}", "tcp{any}"); - auxiliar_add2group(L, "tcp{server}", "tcp{any}"); + auxiliar_add2group(L, "tcp.master", "tcp{any}"); + auxiliar_add2group(L, "tcp.client", "tcp{any}"); + auxiliar_add2group(L, "tcp.server", "tcp{any}"); /* define library functions */ luaL_openlib(L, NULL, func, 0); return 0; @@ -118,22 +118,22 @@ int tcp_open(lua_State *L) * Just call buffered IO methods \*-------------------------------------------------------------------------*/ static int meth_send(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.client", 1); return buffer_meth_send(L, &tcp->buf); } static int meth_receive(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.client", 1); return buffer_meth_receive(L, &tcp->buf); } static int meth_getstats(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.client", 1); return buffer_meth_getstats(L, &tcp->buf); } static int meth_setstats(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.client", 1); return buffer_meth_setstats(L, &tcp->buf); } @@ -183,14 +183,14 @@ static int meth_dirty(lua_State *L) \*-------------------------------------------------------------------------*/ static int meth_accept(lua_State *L) { - p_tcp server = (p_tcp) auxiliar_checkclass(L, "tcp{server}", 1); + p_tcp server = (p_tcp) auxiliar_checkclass(L, "tcp.server", 1); p_timeout tm = timeout_markstart(&server->tm); t_socket sock; const char *err = inet_tryaccept(&server->sock, server->family, &sock, tm); /* if successful, push client socket */ if (err == NULL) { p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); - auxiliar_setclass(L, "tcp{client}", -1); + auxiliar_setclass(L, "tcp.client", -1); /* initialize structure fields */ memset(clnt, 0, sizeof(t_tcp)); socket_setnonblocking(&sock); @@ -213,7 +213,7 @@ static int meth_accept(lua_State *L) \*-------------------------------------------------------------------------*/ static int meth_bind(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{master}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.master", 1); const char *address = luaL_checkstring(L, 2); const char *port = luaL_checkstring(L, 3); const char *err; @@ -250,7 +250,7 @@ static int meth_connect(lua_State *L) timeout_markstart(&tcp->tm); err = inet_tryconnect(&tcp->sock, address, port, &tcp->tm, &connecthints); /* have to set the class even if it failed due to non-blocking connects */ - auxiliar_setclass(L, "tcp{client}", 1); + auxiliar_setclass(L, "tcp.client", 1); if (err) { lua_pushnil(L); lua_pushstring(L, err); @@ -291,7 +291,7 @@ static int meth_getfamily(lua_State *L) \*-------------------------------------------------------------------------*/ static int meth_listen(lua_State *L) { - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{master}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.master", 1); int backlog = (int) luaL_optnumber(L, 2, 32); int err = socket_listen(&tcp->sock, backlog); if (err != IO_DONE) { @@ -300,7 +300,7 @@ static int meth_listen(lua_State *L) return 2; } /* turn master object into a server object */ - auxiliar_setclass(L, "tcp{server}", 1); + auxiliar_setclass(L, "tcp.server", 1); lua_pushnumber(L, 1); return 1; } @@ -312,7 +312,7 @@ static int meth_shutdown(lua_State *L) { /* SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, so we can use method index directly */ static const char* methods[] = { "receive", "send", "both", NULL }; - p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); + p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp.client", 1); int how = luaL_checkoption(L, 2, "both", methods); socket_shutdown(&tcp->sock, how); lua_pushnumber(L, 1); @@ -358,7 +358,7 @@ static int tcp_create(lua_State *L, int family) { p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); memset(tcp, 0, sizeof(t_tcp)); /* set its type as master object */ - auxiliar_setclass(L, "tcp{master}", -1); + auxiliar_setclass(L, "tcp.master", -1); /* initialize remaining structure fields */ socket_setnonblocking(&sock); if (family == PF_INET6) { @@ -470,6 +470,6 @@ static int global_connect(lua_State *L) { lua_pushstring(L, err); return 2; } - auxiliar_setclass(L, "tcp{client}", -1); + auxiliar_setclass(L, "tcp.client", -1); return 1; } diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/udp.c b/Build/source/texk/web2c/luatexdir/luasocket/src/udp.c index 8e14fac290f..8e88b1784a2 100644 --- a/Build/source/texk/web2c/luatexdir/luasocket/src/udp.c +++ b/Build/source/texk/web2c/luatexdir/luasocket/src/udp.c @@ -101,13 +101,13 @@ static luaL_Reg func[] = { int udp_open(lua_State *L) { /* create classes */ - auxiliar_newclass(L, "udp{connected}", udp_methods); - auxiliar_newclass(L, "udp{unconnected}", udp_methods); + auxiliar_newclass(L, "udp.connected", udp_methods); + auxiliar_newclass(L, "udp.unconnected", udp_methods); /* create class groups */ - auxiliar_add2group(L, "udp{connected}", "udp{any}"); - auxiliar_add2group(L, "udp{unconnected}", "udp{any}"); - auxiliar_add2group(L, "udp{connected}", "select{able}"); - auxiliar_add2group(L, "udp{unconnected}", "select{able}"); + auxiliar_add2group(L, "udp.connected", "udp{any}"); + auxiliar_add2group(L, "udp.unconnected", "udp{any}"); + auxiliar_add2group(L, "udp.connected", "select{able}"); + auxiliar_add2group(L, "udp.unconnected", "select{able}"); /* define library functions */ luaL_openlib(L, NULL, func, 0); return 0; @@ -127,7 +127,7 @@ const char *udp_strerror(int err) { * Send data through connected udp socket \*-------------------------------------------------------------------------*/ static int meth_send(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{connected}", 1); + p_udp udp = (p_udp) auxiliar_checkclass(L, "udp.connected", 1); p_timeout tm = &udp->tm; size_t count, sent = 0; int err; @@ -147,7 +147,7 @@ static int meth_send(lua_State *L) { * Send data through unconnected udp socket \*-------------------------------------------------------------------------*/ static int meth_sendto(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); + p_udp udp = (p_udp) auxiliar_checkclass(L, "udp.unconnected", 1); size_t count, sent = 0; const char *data = luaL_checklstring(L, 2, &count); const char *ip = luaL_checkstring(L, 3); @@ -221,7 +221,7 @@ static int meth_receive(lua_State *L) { * Receives data and sender from a UDP socket \*-------------------------------------------------------------------------*/ static int meth_receivefrom(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); + p_udp udp = (p_udp) auxiliar_checkclass(L, "udp.unconnected", 1); char buffer[UDP_DATAGRAMSIZE]; size_t got, count = (size_t) luaL_optnumber(L, 2, sizeof(buffer)); int err; @@ -327,7 +327,7 @@ static int meth_dirty(lua_State *L) { * Just call inet methods \*-------------------------------------------------------------------------*/ static int meth_getpeername(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{connected}", 1); + p_udp udp = (p_udp) auxiliar_checkclass(L, "udp.connected", 1); return inet_meth_getpeername(L, &udp->sock, udp->family); } @@ -382,12 +382,12 @@ static int meth_setpeername(lua_State *L) { lua_pushstring(L, err); return 2; } - auxiliar_setclass(L, "udp{connected}", 1); + auxiliar_setclass(L, "udp.connected", 1); } else { /* we ignore possible errors because Mac OS X always * returns EAFNOSUPPORT */ inet_trydisconnect(&udp->sock, udp->family, tm); - auxiliar_setclass(L, "udp{unconnected}", 1); + auxiliar_setclass(L, "udp.unconnected", 1); } /* change class to connected or unconnected depending on address */ lua_pushnumber(L, 1); @@ -408,7 +408,7 @@ static int meth_close(lua_State *L) { * Turns a master object into a server object \*-------------------------------------------------------------------------*/ static int meth_setsockname(lua_State *L) { - p_udp udp = (p_udp) auxiliar_checkclass(L, "udp{unconnected}", 1); + p_udp udp = (p_udp) auxiliar_checkclass(L, "udp.unconnected", 1); const char *address = luaL_checkstring(L, 2); const char *port = luaL_checkstring(L, 3); const char *err; @@ -440,7 +440,7 @@ static int udp_create(lua_State *L, int family) { if (!err) { /* allocate udp object */ p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); - auxiliar_setclass(L, "udp{unconnected}", -1); + auxiliar_setclass(L, "udp.unconnected", -1); /* initialize remaining structure fields */ socket_setnonblocking(&sock); if (family == PF_INET6) { diff --git a/Build/source/texk/web2c/luatexdir/luatex-common.h b/Build/source/texk/web2c/luatexdir/luatex-common.h index a0b34b00476..12ea10be642 100644 --- a/Build/source/texk/web2c/luatexdir/luatex-common.h +++ b/Build/source/texk/web2c/luatexdir/luatex-common.h @@ -27,8 +27,8 @@ /* utils.c */ __attribute__ ((format(printf, 1, 2))) -extern void pdftex_warn(const char *fmt, ...); +extern void luatex_warn(const char *fmt, ...); __attribute__ ((noreturn, format(printf, 1, 2))) -extern void pdftex_fail(const char *fmt, ...); +extern void luatex_fail(const char *fmt, ...); #endif /* LUATEX_COMMON_H */ diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index d7f3bbfe13f..fccdd4a386e 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -16,16 +16,16 @@ #include "luatex_svnversion.h" static const char _svn_version[] = - "$Id: luatex.c 4746 2014-01-13 08:47:45Z taco $ " + "$Id: luatex.c 4890 2014-03-14 14:58:36Z taco $ " "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/luatex.c $"; #define TeX int luatex_svn = luatex_svn_revision; -int luatex_version = 78; /* \.{\\luatexversion} */ -int luatex_revision = '3'; /* \.{\\luatexrevision} */ +int luatex_version = 79; /* \.{\\luatexversion} */ +int luatex_revision = '0'; /* \.{\\luatexrevision} */ int luatex_date_info = -extra_version_info; /* the compile date is negated */ -const char *luatex_version_string = "beta-0.78.3"; +const char *luatex_version_string = "beta-0.79.0"; #ifdef LuajitTeX const char *engine_name = "luajittex"; /* the name of this engine */ #else diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h index 833c82b42ed..78ec29e3b34 100644 --- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1 +1 @@ -#define luatex_svn_revision 4804 +#define luatex_svn_revision 4903 diff --git a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h index 91841b6d89f..8a8b3baa253 100644 --- a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h +++ b/Build/source/texk/web2c/luatexdir/luatexcallbackids.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: luatexcallbackids.h 4544 2012-12-25 14:07:44Z oneiros $ */ +/* $Id: luatexcallbackids.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef LUATEXCALLBACKIDS_H #define LUATEXCALLBACKIDS_H @@ -58,6 +58,7 @@ typedef enum { post_linebreak_filter_callback, mlist_to_hlist_callback, finish_pdffile_callback, + finish_pdfpage_callback, pre_dump_callback, total_callbacks } callback_callback_types; diff --git a/Build/source/texk/web2c/luatexdir/luazip/src/luazip.c b/Build/source/texk/web2c/luatexdir/luazip/src/luazip.c index a7124498e20..eb731349f0d 100644 --- a/Build/source/texk/web2c/luatexdir/luazip/src/luazip.c +++ b/Build/source/texk/web2c/luatexdir/luazip/src/luazip.c @@ -14,8 +14,8 @@ #include "luazip.h" #include "lauxlib.h" -#define ZIPFILEHANDLE "lzipFile" -#define ZIPINTERNALFILEHANDLE "lzipInternalFile" +#define ZIPFILEHANDLE "lzip.File" +#define ZIPINTERNALFILEHANDLE "lzip.InternalFile" #define LUAZIP_MAX_EXTENSIONS 32 static int pushresult (lua_State *L, int i, const char *filename) { diff --git a/Build/source/texk/web2c/luatexdir/luazlib/lgzip.c b/Build/source/texk/web2c/luatexdir/luazlib/lgzip.c index db9ede71940..9a10e9242b6 100644 --- a/Build/source/texk/web2c/luatexdir/luazlib/lgzip.c +++ b/Build/source/texk/web2c/luatexdir/luazlib/lgzip.c @@ -45,7 +45,7 @@ Changes: */ -#define FILEHANDLE "zlib:gzFile" +#define FILEHANDLE "zlib.gzFile" static int pushresult (lua_State *L, int i, const char *filename) { diff --git a/Build/source/texk/web2c/luatexdir/luazlib/lzlib.c b/Build/source/texk/web2c/luatexdir/luazlib/lzlib.c index 263c6ba611d..a76f54ee0f6 100644 --- a/Build/source/texk/web2c/luatexdir/luazlib/lzlib.c +++ b/Build/source/texk/web2c/luatexdir/luazlib/lzlib.c @@ -47,7 +47,7 @@ Changes: ** zlib stream metamethods ** ========================================================================= */ -#define ZSTREAMMETA "zlib:zstream" +#define ZSTREAMMETA "zlib.zstream" #define LZANY (void*)-1 #define LZNONE (void*)0 diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w index 5b1c736e7dd..483db2a4c80 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfcolorstack.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; + "$Id: pdfcolorstack.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; #include "ptexlib.h" @@ -239,7 +239,7 @@ int colorstackpop(int colstack_no) if (global_shipping_mode == SHIPPING_PAGE) { if (colstack->page_used == 0) { - pdftex_warn("pop empty color page stack %u", + luatex_warn("pop empty color page stack %u", (unsigned int) colstack_no); return colstack->literal_mode; } @@ -248,7 +248,7 @@ int colorstackpop(int colstack_no) put_cstring_on_str_pool(colstack->page_current); } else { if (colstack->form_used == 0) { - pdftex_warn("pop empty color form stack %u", + luatex_warn("pop empty color form stack %u", (unsigned int) colstack_no); return colstack->literal_mode; } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 83e5a27e4c8..bfda9102e7b 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: pdfgen.w 4718 2014-01-02 15:35:31Z taco $" + "$Id: pdfgen.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; #include "ptexlib.h" @@ -34,7 +34,7 @@ static const char _svn_version[] = #define check_nprintf(size_get, size_want) \ if ((unsigned)(size_get) >= (unsigned)(size_want)) \ - pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); + luatex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); PDF static_pdf = NULL; @@ -254,8 +254,7 @@ void fix_o_mode(PDF pdf) if (pdf->o_mode == OMODE_NONE) pdf->o_mode = o_mode; else if (pdf->o_mode != o_mode) - pdf_error("setup", - "\\pdfoutput can only be changed before anything is written to the output"); + pdf_error("setup", "\\pdfoutput can only be changed before anything is written to the output"); } @ This ensures that |pdfminorversion| is set only before any bytes have @@ -268,14 +267,9 @@ void fix_pdf_minorversion(PDF pdf) { if (pdf->minor_version < 0) { /* unset */ if ((pdf_minor_version < 0) || (pdf_minor_version > 9)) { - const char *hlp[] = - { "The pdfminorversion must be between 0 and 9.", - "I changed this to 4.", NULL - }; + const char *hlp[] = { "The pdfminorversion must be between 0 and 9.", "I changed this to 4.", NULL }; char msg[256]; - (void) snprintf(msg, 255, - "LuaTeX error (illegal pdfminorversion %d)", - (int) pdf_minor_version); + (void) snprintf(msg, 255, "LuaTeX error (illegal pdfminorversion %d)", (int) pdf_minor_version); tex_error(msg, hlp); pdf_minor_version = 4; } @@ -283,11 +277,9 @@ void fix_pdf_minorversion(PDF pdf) } else { /* Check that variables for \.{PDF} output are unchanged */ if (pdf->minor_version != pdf_minor_version) - pdf_error("setup", - "\\pdfminorversion cannot be changed after data is written to the PDF file"); + pdf_error("setup", "\\pdfminorversion cannot be changed after data is written to the PDF file"); if (pdf->draftmode != pdf_draftmode) - pdf_error("setup", - "\\pdfdraftmode cannot be changed after data is written to the PDF file"); + pdf_error("setup", "\\pdfdraftmode cannot be changed after data is written to the PDF file"); } if (pdf->draftmode != 0) { pdf->compress_level = 0; /* re-fix it, might have been changed inbetween */ @@ -300,7 +292,7 @@ void fix_pdf_minorversion(PDF pdf) #define check_err(f, fn) \ if (f != Z_OK) \ - pdftex_fail("zlib: %s() failed (error code %d)", fn, f) + luatex_fail("zlib: %s() failed (error code %d)", fn, f) @ @c static void write_zip(PDF pdf) @@ -311,7 +303,7 @@ static void write_zip(PDF pdf) z_stream *s = pdf->c_stream; boolean finish = pdf->zip_write_state == ZIP_FINISH; assert(pdf->compress_level > 0); - /* This was just to suppress the filename report in |pdftex_fail| + /* This was just to suppress the filename report in |luatex_fail| but zlib errors are rare enough (especially now that the compress level is fixed) that I don't care about the slightly ugly error message that could result. @@ -361,7 +353,7 @@ static void write_zip(PDF pdf) } err = deflate(s, flush); if (err != Z_OK && err != Z_STREAM_END) - pdftex_fail("zlib: deflate() failed (error code %d)", err); + luatex_fail("zlib: deflate() failed (error code %d)", err); } pdf->stream_length = (off_t) s->total_out; } @@ -418,8 +410,7 @@ void pdf_flush(PDF pdf) pdf->zip_write_state = NO_ZIP; strbuf_seek(pdf->buf, 0); if (saved_pdf_gone > pdf->gone) - pdf_error("file size", - "File size exceeds architectural limits (pdf_gone wraps around)"); + pdf_error("file size", "File size exceeds architectural limits (pdf_gone wraps around)"); break; case LUASTM_BUF: luaL_addsize(&(os->b), strbuf_offset(pdf->buf)); @@ -852,7 +843,7 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k) re->resources_tree = avl_create(comp_page_resources, NULL, &avl_xallocator); if (re->resources_tree == NULL) - pdftex_fail + luatex_fail ("addto_page_resources(): avl_create() page_resource_tree failed"); } tmp.obj_type = t; @@ -863,7 +854,7 @@ void addto_page_resources(PDF pdf, pdf_obj_type t, int k) pr->list = NULL; pp = avl_probe(re->resources_tree, pr); if (pp == NULL) - pdftex_fail + luatex_fail ("addto_page_resources(): avl_probe() out of memory in insertion"); } if (pr->list == NULL) { @@ -1420,8 +1411,7 @@ char *convertStringToPDFString(const char *in, int len) check_buf((unsigned) j + sizeof(buf), MAX_PSTRING_LEN); if (((unsigned char) in[i] < '!') || ((unsigned char) in[i] > '~')) { /* convert control characters into oct */ - k = snprintf(buf, sizeof(buf), - "\\%03o", (unsigned int) (unsigned char) in[i]); + k = snprintf(buf, sizeof(buf), "\\%03o", (unsigned int) (unsigned char) in[i]); check_nprintf(k, sizeof(buf)); out[j++] = buf[0]; out[j++] = buf[1]; @@ -1455,8 +1445,7 @@ static void convertStringToHexString(const char *in, char *out, int lin) char buf[3]; j = 0; for (i = 0; i < lin; i++) { - k = snprintf(buf, sizeof(buf), - "%02X", (unsigned int) (unsigned char) in[i]); + k = snprintf(buf, sizeof(buf), "%02X", (unsigned int) (unsigned char) in[i]); check_nprintf(k, sizeof(buf)); out[j++] = buf[0]; out[j++] = buf[1]; @@ -1515,7 +1504,7 @@ static void print_ID(PDF pdf) md5_append(&state, (const md5_byte_t *) time_str, (int) size); /* get the file name */ if (getcwd(pwd, sizeof(pwd)) == NULL) - pdftex_fail("getcwd() failed (%s), (path too long?)", strerror(errno)); + luatex_fail("getcwd() failed (%s), (path too long?)", strerror(errno)); #ifdef WIN32 { char *p; @@ -1917,7 +1906,7 @@ void print_pdf_table_string(PDF pdf, const char *s) void pdf_end_page(PDF pdf) { char s[64], *p; - int j, annots = 0, beads = 0; + int j, annots = 0, beads = 0, callback_id; pdf_resource_struct *res_p = pdf->page_resources; pdf_resource_struct local_page_resources; pdf_object_list *annot_list, *bead_list, *link_list, *ol, *ol1; @@ -1928,7 +1917,7 @@ void pdf_end_page(PDF pdf) /* Finish stream of page/form contents */ pdf_goto_pagemode(pdf); if (pos_stack_used > 0) { - pdftex_fail("%u unmatched \\pdfsave after %s shipout", + luatex_fail("%u unmatched \\pdfsave after %s shipout", (unsigned int) pos_stack_used, ((global_shipping_mode == SHIPPING_PAGE) ? "page" : "form")); @@ -1936,7 +1925,13 @@ void pdf_end_page(PDF pdf) pdf_end_stream(pdf); pdf_end_obj(pdf); + /* hh-ls : new call back finish_pdfpage_callback */ + callback_id = callback_defined(finish_pdfpage_callback); + if (callback_id > 0) + run_callback(callback_id, "b->",(global_shipping_mode == SHIPPING_PAGE)); + if (global_shipping_mode == SHIPPING_PAGE) { + pdf->last_pages = pdf_do_page_divert(pdf, pdf->last_page, 0); /* Write out /Page object */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w index dab5bc741ae..a32d20490fd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfluaapi.w 4524 2012-12-20 15:38:02Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; + "$Id: pdfluaapi.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; #include "ptexlib.h" @@ -32,14 +32,14 @@ int new_pdflua(void) const zlib_struct *zp = pdflua_zlib_struct_ptr; uLong uncomprLen = zp->uncomprLen; if ((uncompr = xtalloc(zp->uncomprLen, Byte)) == NULL) - pdftex_fail("new_pdflua(): xtalloc()"); + luatex_fail("new_pdflua(): xtalloc()"); err = uncompress(uncompr, &uncomprLen, zp->compr, zp->comprLen); if (err != Z_OK) - pdftex_fail("new_pdflua(): uncompress()"); + luatex_fail("new_pdflua(): uncompress()"); assert(uncomprLen == zp->uncomprLen); if (luaL_loadbuffer(Luas, (const char *) uncompr, uncomprLen, "pdflua") || lua_pcall(Luas, 0, 1, 0)) - pdftex_fail("new_pdflua(): lua_pcall()"); + luatex_fail("new_pdflua(): lua_pcall()"); luaL_checktype(Luas, -1, LUA_TTABLE); /* t */ i = luaL_ref(Luas, LUA_REGISTRYINDEX); /* - */ xfree(uncompr); @@ -64,7 +64,7 @@ void pdflua_begin_page(PDF pdf) lua_setfield(Luas, -2, "resources_objnum"); /* t f t ... */ err = lua_pcall(Luas, 1, 0, 0); /* (e) t ... */ if (err != 0) - pdftex_fail("pdflua.lua: beginpage()"); + luatex_fail("pdflua.lua: beginpage()"); /* t ... */ lua_pop(Luas, 1); /* ... */ } @@ -97,7 +97,7 @@ void pdflua_end_page(PDF pdf, int annots, int beads) } err = lua_pcall(Luas, 1, 0, 0); /* (e) t ... */ if (err != 0) - pdftex_fail("pdflua.lua: endpage()"); + luatex_fail("pdflua.lua: endpage()"); /* t ... */ lua_pop(Luas, 1); /* ... */ } @@ -111,5 +111,5 @@ void pdflua_output_pages_tree(PDF pdf) lua_gettable(Luas, -2); /* f */ err = lua_pcall(Luas, 0, 0, 0); /* - */ if (err != 0) - pdftex_fail("pdflua.lua: outputpagestree()"); + luatex_fail("pdflua.lua: outputpagestree()"); } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w index f2d0647c00c..af7bc1d584f 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w @@ -19,15 +19,15 @@ @ @c static const char _svn_version[] = - "$Id: pdfobj.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; + "$Id: pdfobj.w 4877 2014-03-14 01:26:05Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" int pdf_last_obj; -@ write a raw PDF object +@ write a raw PDF object @c void pdf_write_obj(PDF pdf, int k) @@ -79,8 +79,7 @@ void pdf_write_obj(PDF pdf, int k) callback_id = callback_defined(read_data_file_callback); if (fnam && callback_id > 0) { boolean file_opened = false; - res = run_callback(callback_id, "S->bSd", fnam, - &file_opened, &data.s, &ll); + res = run_callback(callback_id, "S->bSd", fnam, &file_opened, &data.s, &ll); data.l = (size_t) ll; if (!file_opened) pdf_error("ext5", "cannot open file for embedding"); @@ -88,8 +87,7 @@ void pdf_write_obj(PDF pdf, int k) byte_file f; /* the data file's FILE* */ if (!fnam) fnam = st.s; - if (!luatex_open_input - (&f, fnam, kpse_tex_format, FOPEN_RBIN_MODE, true)) + if (!luatex_open_input(&f, fnam, kpse_tex_format, FOPEN_RBIN_MODE, true)) pdf_error("ext5", "cannot open file for embedding"); res = read_data_file(f, &data.s, &ll); data.l = (size_t) ll; @@ -102,19 +100,23 @@ void pdf_write_obj(PDF pdf, int k) tprint("<<"); tprint(st.s); pdf_out_block(pdf, (const char *) data.s, data.l); - if (!obj_obj_is_stream(pdf, k) && data.s[data.l - 1] != '\n') - pdf_out(pdf, '\n'); + /* already happens in pdf_end_obj: + if (!obj_obj_is_stream(pdf, k) && data.s[data.l - 1] != '\n') + pdf_out(pdf, '\n'); + */ xfree(data.s); tprint(">>"); } else { pdf_out_block(pdf, st.s, st.l); - if (!obj_obj_is_stream(pdf, k) && st.s[st.l - 1] != '\n') - pdf_out(pdf, '\n'); + /* already happens in pdf_end_obj: + if (!obj_obj_is_stream(pdf, k) && st.s[st.l - 1] != '\n') + pdf_out(pdf, '\n'); + */ } if (obj_obj_is_stream(pdf, k)) { pdf_end_stream(pdf); pdf_end_obj(pdf); - } else + } else /* here we do the \n */ pdf_end_obj(pdf); luaL_unref(Luas, LUA_REGISTRYINDEX, l); obj_obj_data(pdf, k) = LUA_NOREF; @@ -137,7 +139,7 @@ void init_obj_obj(PDF pdf, int k) out only when the object is referenced by \.{\\pdfrefobj}. When \.{\\pdfobj} is used with \.{\\immediate}, the object contents will be written out immediately. Objects referenced in the current page are appended into - |pdf_obj_list|. + |pdf_obj_list|. @c void scan_obj(PDF pdf) diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w index 1b6859566a3..92a642adeb0 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfsaverestore.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; + "$Id: pdfsaverestore.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; #include "ptexlib.h" @@ -55,14 +55,14 @@ static void checkpdfrestore(scaledpos pos) { scaledpos diff; if (pos_stack_used == 0) { - pdftex_warn("%s", "\\pdfrestore: missing \\pdfsave"); + luatex_warn("%s", "\\pdfrestore: missing \\pdfsave"); return; } pos_stack_used--; diff.h = pos.h - pos_stack[pos_stack_used].pos.h; diff.v = pos.v - pos_stack[pos_stack_used].pos.v; if (diff.h != 0 || diff.v != 0) { - pdftex_warn("Misplaced \\pdfrestore by (%dsp, %dsp)", (int) diff.h, + luatex_warn("Misplaced \\pdfrestore by (%dsp, %dsp)", (int) diff.h, (int) diff.v); } if (global_shipping_mode == SHIPPING_PAGE) { diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w index 34f3ead258c..d90dbf91a87 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfsetmatrix.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; + "$Id: pdfsetmatrix.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; #include "ptexlib.h" @@ -94,7 +94,7 @@ static void pdfsetmatrix(const char *in, scaledpos pos) if (global_shipping_mode == SHIPPING_PAGE) { if (sscanf((const char *) in, " %lf %lf %lf %lf ", &x.a, &x.b, &x.c, &x.d) != 4) { - pdftex_warn("Unrecognized format of \\pdfsetmatrix{%s}", in); + luatex_warn("Unrecognized format of \\pdfsetmatrix{%s}", in); return; } /* calculate this transformation matrix */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w index ba8495137a2..48330c72e4c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdftables.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdftables.w $"; + "$Id: pdftables.w 4847 2014-03-05 18:13:17Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdftables.w $"; #include "ptexlib.h" @@ -58,11 +58,11 @@ static void avl_put_obj(PDF pdf, int t, oentry * oe) if (pdf->obj_tree[t] == NULL) { pdf->obj_tree[t] = avl_create(compare_info, NULL, &avl_xallocator); if (pdf->obj_tree[t] == NULL) - pdftex_fail("avlstuff.c: avl_create() pdf->obj_tree failed"); + luatex_fail("avlstuff.c: avl_create() pdf->obj_tree failed"); } pp = avl_probe(pdf->obj_tree[t], oe); if (pp == NULL) - pdftex_fail("avlstuff.c: avl_probe() out of memory in insertion"); + luatex_fail("avlstuff.c: avl_probe() out of memory in insertion"); } static void avl_put_int_obj(PDF pdf, int int0, int objptr, int t) diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index 5dab5974e2d..994856533b4 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -18,7 +18,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: ptexlib.h 4718 2014-01-02 15:35:31Z taco $ */ +/* $Id: ptexlib.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef PTEXLIB_H # define PTEXLIB_H @@ -85,7 +85,7 @@ extern char **suffixlist; /* in luainit.w */ # define check_buf(size, buf_size) \ if ((unsigned)(size) > (unsigned)(buf_size)) \ - pdftex_fail("buffer overflow: %d > %d at file %s, line %d", \ + luatex_fail("buffer overflow: %d > %d at file %s, line %d", \ (int)(size), (int)(buf_size), __FILE__, __LINE__ ) # define append_char_to_buf(c, p, buf, buf_size) do { \ @@ -297,6 +297,9 @@ void vf_out_image(PDF pdf, unsigned i); /* lua/ltexiolib.c */ void flush_loggable_info(void); +/* lua/luastuff.w and lua/luajitstuff.w */ +void luafunctioncall(int slot); + /* lua/luastuff.c */ void luatokencall(int p, int nameptr); extern void late_lua(PDF pdf, halfword p); diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h index ee0407b0eb7..690823b7856 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.h +++ b/Build/source/texk/web2c/luatexdir/tex/commands.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: commands.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: commands.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef COMMANDS_H # define COMMANDS_H @@ -263,6 +263,7 @@ typedef enum { font_identifier_code, /* command code for \.{tex.fontidentifier} (virtual) */ font_id_code, /* command code for \.{\\fontid} */ uchar_code, /* command code for \.{\\Uchar} */ + lua_function_code, /* command code for \.{\\luafunction} */ } convert_codes; typedef enum { diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w index 75fdefda898..51d2112c1d5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.w +++ b/Build/source/texk/web2c/luatexdir/tex/commands.w @@ -21,8 +21,8 @@ @ @c static const char _svn_version[] = - "$Id: commands.w 4634 2013-04-21 14:45:45Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/commands.w $"; + "$Id: commands.w 4878 2014-03-14 10:48:03Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/commands.w $"; #include "ptexlib.h" @@ -490,6 +490,7 @@ void initialize_commands(void) 0); primitive_pdftex("pdfnormaldeviate", convert_cmd, normal_deviate_code, 0); primitive_core("directlua", convert_cmd, lua_code, 0); + primitive_luatex("luafunction", convert_cmd, lua_function_code, 0); primitive_luatex("luaescapestring", convert_cmd, lua_escape_string_code, 0); primitive_luatex("mathstyle", convert_cmd, math_style_code, 0); primitive_pdftex("expanded", convert_cmd, expanded_code, 0); diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index fd486c3367e..646676bcfa2 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: linebreak.w 4777 2014-02-10 10:09:39Z luigi $" + "$Id: linebreak.w 4775 2014-02-07 12:36:34Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/linebreak.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.w b/Build/source/texk/web2c/luatexdir/tex/mainbody.w index 8f0e3c47f4c..9aada03cf30 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mainbody.w +++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.w @@ -23,7 +23,7 @@ @ @c static const char _svn_version[] = - "$Id: mainbody.w 4722 2014-01-03 09:32:35Z taco $" + "$Id: mainbody.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/mainbody.w $"; #include "ptexlib.h" @@ -443,7 +443,7 @@ void main_body(void) if (pdf_draftmode_option != 0) pdf_draftmode = static_pdf->draftmode = pdf_draftmode_value; pdf_init_map_file((char *) pdftex_map); - if (end_line_char_inactive()) + if (end_line_char_inactive) decr(ilimit); else buffer[ilimit] = (packed_ASCII_code) int_par(end_line_char_code); diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w index 77d55a736b1..53bd0c79a8a 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.w +++ b/Build/source/texk/web2c/luatexdir/tex/printing.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: printing.w 4722 2014-01-03 09:32:35Z taco $" + "$Id: printing.w 4857 2014-03-07 00:01:41Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/printing.w $"; #include "ptexlib.h" @@ -477,6 +477,15 @@ void print_banner(const char *v, int ver) if (format_ident > 0) print(format_ident); print_ln(); + if (show_luahashchars){ + wterm(' '); +#ifdef LuajitTeX + fprintf(term_out,"Number of bits used by the hash function (luajittex): %d",LUAJITTEX_HASHCHARS); +#else + fprintf(term_out,"Number of bits used by the hash function (luatex): %d",LUATEX_HASHCHARS); +#endif + print_ln(); + } if (shellenabledp) { wterm(' '); if (restrictedshell) diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.h b/Build/source/texk/web2c/luatexdir/tex/scanning.h index 8c263404173..ca7804ea749 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.h +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.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: scanning.h 4085 2011-02-10 09:21:57Z taco $ */ +/* $Id: scanning.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef SCANNING_H # define SCANNING_H @@ -57,7 +57,6 @@ extern void scan_limited_int(int max, const char *name); extern void scan_fifteen_bit_int(void); extern void scan_fifty_one_bit_int(void); -extern void scan_string_argument(void); extern void scan_four_bit_int_or_18(void); # define octal_token (other_token+'\'') /* apostrophe, indicates an octal constant */ diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w index 6e1a423d173..f3cc9b29bb5 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.w +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: scanning.w 4562 2013-01-21 02:58:59Z khaled $" - "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/tex/scanning.w $"; + "$Id: scanning.w 4877 2014-03-14 01:26:05Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/scanning.w $"; #include "ptexlib.h" @@ -939,33 +939,6 @@ void scan_four_bit_int_or_18(void) } -@ @c -void scan_string_argument(void) -{ - int s; - scan_left_brace(); - get_x_token(); - while ((cur_cmd != right_brace_cmd)) { - if ((cur_cmd == letter_cmd) || (cur_cmd == other_char_cmd)) { - str_room(1); - append_char(cur_chr); - } else if (cur_cmd == spacer_cmd) { - str_room(1); - append_char(' '); - } else { - tprint("Bad token appearing in string argument"); - } - get_x_token(); - } - s = make_string(); - /* todo: this was just conserving the string pool: */ -#if 0 - if (str_eq_str("mi",s)) s="mi"; - if (str_eq_str("mo",s)) s="mo"; - if (str_eq_str("mn",s)) s="mn"; -#endif - cur_val = s; -} @ An integer number can be preceded by any number of spaces and `\.+' or diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w index 769dd3bd1c8..3a7ab5578c0 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w +++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: texfileio.w 4722 2014-01-03 09:32:35Z taco $" + "$Id: texfileio.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texfileio.w $"; #include "ptexlib.h" @@ -973,7 +973,7 @@ void start_input(void) ; } firm_up_the_line(); - if (end_line_char_inactive()) + if (end_line_char_inactive) decr(ilimit); else buffer[ilimit] = (packed_ASCII_code) end_line_char; diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h index bfc3a424091..d1015373909 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h @@ -1,5 +1,5 @@ /* texnodes.h - + Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -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: texnodes.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: texnodes.h 4847 2014-03-05 18:13:17Z luigi $ */ #include <stdarg.h> @@ -146,7 +146,7 @@ typedef enum { # define synctex_tag_glue(a) vinfo((a)+3) # define synctex_line_glue(a) vlink((a)+3) -/* disc nodes could eventually be smaller, because the indirect +/* disc nodes could eventually be smaller, because the indirect pointers are not really needed (8 instead of 10). */ @@ -691,7 +691,7 @@ extern void print_short_node_contents(halfword n); extern void show_node_list(int i); extern pointer actual_box_width(pointer r, scaled base_width); -/* TH: these two defines still need checking. The node ordering in luatex is not +/* TH: these two defines still need checking. The node ordering in luatex is not quite the same as in tex82 */ # define precedes_break(a) (type((a))<math_node && \ @@ -785,4 +785,9 @@ extern halfword new_skip_param(int n); extern halfword new_kern(scaled w); extern halfword new_penalty(int m); +extern int lua_properties_enabled ; +extern int lua_properties_level ; +extern int lua_properties_use_metatable ; + #endif + diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w index c087343b90c..73b39d08757 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: texnodes.w 4754 2014-01-23 10:01:21Z taco $" + "$Id: texnodes.w 4847 2014-03-05 18:13:17Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/texnodes.w $"; #include "ptexlib.h" @@ -334,6 +334,173 @@ node_info whatsit_node_data[] = { #define last_whatsit_node user_defined_node +/* hh: experiment */ + +/* + +When we copy a node list, there are several possibilities: we do the same as a new node, +we copy the entry to the table in properties (a reference), we do a deep copy of a table +in the properties, we create a new table and give it the original one as a metatable. +After some experiments (that also included timing) with these scenarios I decided that a +deep copy made no sense, nor did nilling. In the end both the shallow copy and the metatable +variant were both ok, although the second ons is slower. The most important aspect to keep +in mind is that references to other nodes in properties no longer can be valid for that +copy. We could use two tables (one unique and one shared) or metatables but that only +complicates matters. + +When defining a new node, we could already allocate a table but it is rather easy to do +that at the lua end e.g. using a metatable __index method. That way it is under macro +package control. + +When deleting a node, we could keep the slot (e.g. setting it to false) but it could make +memory consumption raise unneeded when we have temporary large node lists and after that +only small lists. + +So, in the end this is what we ended up with. For the record, I also experimented with the +following: + +- copy attributes to the properties so that we hav efast access at the lua end: in the end + the overhead is not compensated by speed and convenience, in fact, attributes are not + that slow when it comes to accessing them +- a bitset in the node but again the gain compared to attributes is neglectable and it also + demands a pretty string agreement over what bit represents what, and this is unlikely to + succeed in the tex community (I could use it for font handling, which is cross package, + but decided that it doesn't pay off + +In case one wonders why properties make sense then, well, it is not so much speed that we +gain, but more convenience: storing all kind of (temporary) data in attributes is no fun and +this mechanism makes sure that properties are cleaned up when a node is freed. Also, the +advantage of a more or less global properties table is that we stay at the lua end. An +alternative is to store a reference in the node itself but that is complicated by the fact +that the register has some limitations (no numeric keys) and we also don't want to mess with +it too much. + +*/ + +int lua_properties_level = 0 ; /* can be private */ +int lua_properties_enabled = 0 ; +int lua_properties_use_metatable = 0 ; + +/* We keep track of nesting so that we don't oveflow the stack, and, what is more important, +don't keep resolving the registry index. */ + +#define lua_properties_push do { \ + if (lua_properties_enabled) { \ + lua_properties_level = lua_properties_level + 1 ; \ + if (lua_properties_level == 1) { \ + lua_rawgeti(Luas, LUA_REGISTRYINDEX, luaS_index(node_properties)); \ + lua_gettable(Luas, LUA_REGISTRYINDEX); \ + } \ + } \ +} while(0) + +#define lua_properties_pop do { \ + if (lua_properties_enabled) { \ + if (lua_properties_level == 1) \ + lua_pop(Luas,1); \ + lua_properties_level = lua_properties_level - 1 ; \ + } \ +} while(0) + +/* No setting is needed: */ + +#define lua_properties_set(target) do { \ +} while(0) + +/* Resetting boils down to nilling. */ + +#define lua_properties_reset(target) do { \ + if (lua_properties_enabled) { \ + if (lua_properties_level == 0) { \ + lua_rawgeti(Luas, LUA_REGISTRYINDEX, luaS_index(node_properties)); \ + lua_gettable(Luas, LUA_REGISTRYINDEX); \ + lua_pushnil(Luas); \ + lua_rawseti(Luas,-2,target); \ + lua_pop(Luas,1); \ + } else { \ + lua_pushnil(Luas); \ + lua_rawseti(Luas,-2,target); \ + } \ + } \ +} while(0) + +/* For a moment I considered supporting all kind of data types but in practice +that makes no sense. So we stick to a cheap shallow copy with as option a +metatable. Btw, a deep copy would look like this: + +static void copy_lua_table(lua_State* L, int index) { + lua_newtable(L); + lua_pushnil(L); + while(lua_next(L, index-1) != 0) { + lua_pushvalue(L, -2); + lua_insert(L, -2); + if (lua_type(L,-1)==LUA_TTABLE) + copy_lua_table(L,-1); + lua_settable(L, -4); + } + lua_pop(L,1); +} + +#define lua_properties_copy(target, source) do { \ + if (lua_properties_enabled) { \ + lua_pushnumber(Luas,source); \ + lua_rawget(Luas,-2); \ + if (lua_type(Luas,-1)==LUA_TTABLE) { \ + copy_lua_table(Luas,-1); \ + lua_pushnumber(Luas,target); \ + lua_insert(Luas,-2); \ + lua_rawset(Luas,-3); \ + } else { \ + lua_pop(Luas,1); \ + } \ + } \ +} while(0) + +*/ + +/* isn't there a faster way to metatable? */ + +#define lua_properties_copy(target,source) do { \ + if (lua_properties_enabled) { \ + if (lua_properties_level == 0) { \ + lua_rawgeti(Luas, LUA_REGISTRYINDEX, luaS_index(node_properties)); \ + lua_gettable(Luas, LUA_REGISTRYINDEX); \ + lua_rawgeti(Luas,-1,source); \ + if (lua_type(Luas,-1)==LUA_TTABLE) { \ + if (lua_properties_use_metatable) { \ + lua_newtable(Luas); \ + lua_insert(Luas,-2); \ + lua_setfield(Luas,-2,"__index"); \ + lua_newtable(Luas); \ + lua_insert(Luas,-2); \ + lua_setmetatable(Luas,-2); \ + } \ + lua_rawseti(Luas,-2,target); \ + } else { \ + lua_pop(Luas,1); \ + } \ + lua_pop(Luas,1); \ + } else { \ + lua_rawgeti(Luas,-1,source); \ + if (lua_type(Luas,-1)==LUA_TTABLE) { \ + if (lua_properties_use_metatable) { \ + lua_newtable(Luas); \ + lua_insert(Luas,-2); \ + lua_setfield(Luas,-2,"__index"); \ + lua_newtable(Luas); \ + lua_insert(Luas,-2); \ + lua_setmetatable(Luas,-2); \ + } \ + lua_rawseti(Luas,-2,target); \ + } else { \ + lua_pop(Luas,1); \ + } \ + } \ + } \ +} while(0) + +/* Here end the property handlers. */ + @ @c halfword new_node(int i, int j) { @@ -408,7 +575,6 @@ halfword new_node(int i, int j) synctex_line_glue(n) = line; break; case kern_node: - /* synctex ignores implicit kerns */ if (j != 0) { synctex_tag_kern(n) = cur_input.synctex_tag_field; synctex_line_kern(n) = line; @@ -428,6 +594,7 @@ halfword new_node(int i, int j) /* take care of attributes */ if (nodetype_has_attributes(i)) { build_attribute_list(n); + /* lua_properties_set */ } type(n) = (quarterword) i; subtype(n) = (quarterword) j; @@ -458,20 +625,23 @@ halfword new_glyph_node(void) type(n) = glyph_node; subtype(n) = 0; build_attribute_list(n); + /* lua_properties_set */ return n; } @ makes a duplicate of the node list that starts at |p| and returns a - pointer to the new list + pointer to the new list @c halfword do_copy_node_list(halfword p, halfword end) { halfword q = null; /* previous position in new list */ halfword h = null; /* head of the list */ + register halfword s ; copy_error_seen = 0; + lua_properties_push; /* saves stack and time */ while (p != end) { - register halfword s = copy_node(p); + s = copy_node(p); if (h == null) { h = s; } else { @@ -480,6 +650,7 @@ halfword do_copy_node_list(halfword p, halfword end) q = s; p = vlink(p); } + lua_properties_pop; /* saves stack and time */ return h; } @@ -488,7 +659,50 @@ halfword copy_node_list(halfword p) return do_copy_node_list(p, null); } -@ make a dupe of a single node +/* There is no gain in using a temp var: + + #define copy_sub_list(target,source) do { \ + l = source; \ + if (l != null) { \ + s = copy_node_list(l); \ + target = s; \ + } else { \ + target = null; \ + } \ + } while (0) + + #define copy_sub_node(target,source) do { \ + l = source; \ + if (l != null) { \ + s = copy_node(l); \ + target = s ; \ + } else { \ + target = null; \ + } \ + } while (0) + + So we use: +*/ + +#define copy_sub_list(target,source) do { \ + if (source != null) { \ + s = do_copy_node_list(source, null); \ + target = s; \ + } else { \ + target = null; \ + } \ + } while (0) + +#define copy_sub_node(target,source) do { \ + if (source != null) { \ + s = copy_node(source); \ + target = s ; \ + } else { \ + target = null; \ + } \ +} while (0) + +@ make a dupe of a single node @c halfword copy_node(const halfword p) { @@ -506,7 +720,7 @@ halfword copy_node(const halfword p) (sizeof(memory_word) * (unsigned) i)); /* handle synctex extension */ - switch (type(p)) { + switch (type(p)) { case math_node: synctex_tag_math(r) = cur_input.synctex_tag_field; synctex_line_math(r) = line; @@ -516,38 +730,25 @@ halfword copy_node(const halfword p) synctex_line_kern(r) = line; break; } - if (nodetype_has_attributes(type(p))) { add_node_attr_ref(node_attr(p)); - alink(r) = null; /* needs checking */ + alink(r) = null; + lua_properties_copy(r,p); } vlink(r) = null; - switch (type(p)) { case glyph_node: - s = copy_node_list(lig_ptr(p)); - lig_ptr(r) = s; + copy_sub_list(lig_ptr(r),lig_ptr(p)) ; break; case glue_node: add_glue_ref(glue_ptr(p)); - s = copy_node_list(leader_ptr(p)); - leader_ptr(r) = s; + copy_sub_list(leader_ptr(r),leader_ptr(p)) ; break; case hlist_node: case vlist_node: case unset_node: - s = copy_node_list(list_ptr(p)); - list_ptr(r) = s; - break; - case ins_node: - add_glue_ref(split_top_ptr(p)); - s = copy_node_list(ins_ptr(p)); - ins_ptr(r) = s; - break; - case margin_kern_node: - s = copy_node(margin_char(p)); - margin_char(r) = s; + copy_sub_list(list_ptr(r),list_ptr(p)) ; break; case disc_node: pre_break(r) = pre_break_head(r); @@ -578,63 +779,51 @@ halfword copy_node(const halfword p) assert(tlink_no_break(r) == null); } break; + case ins_node: + add_glue_ref(split_top_ptr(p)); + copy_sub_list(ins_ptr(r),ins_ptr(p)) ; + break; + case margin_kern_node: + copy_sub_node(margin_char(r),margin_char(p)); + break; case mark_node: add_token_ref(mark_ptr(p)); break; case adjust_node: - s = copy_node_list(adjust_ptr(p)); - adjust_ptr(r) = s; + copy_sub_list(adjust_ptr(r),adjust_ptr(p)); break; - case choice_node: - s = copy_node_list(display_mlist(p)); - display_mlist(r) = s; - s = copy_node_list(text_mlist(p)); - text_mlist(r) = s; - s = copy_node_list(script_mlist(p)); - script_mlist(r) = s; - s = copy_node_list(script_script_mlist(p)); - script_script_mlist(r) = s; + copy_sub_list(display_mlist(r),display_mlist(p)) ; + copy_sub_list(text_mlist(r),text_mlist(p)) ; + copy_sub_list(script_mlist(r),script_mlist(p)) ; + copy_sub_list(script_script_mlist(r),script_script_mlist(p)) ; break; case simple_noad: case radical_noad: case accent_noad: - s = copy_node_list(nucleus(p)); - nucleus(r) = s; - s = copy_node_list(subscr(p)); - subscr(r) = s; - s = copy_node_list(supscr(p)); - supscr(r) = s; + copy_sub_list(nucleus(r),nucleus(p)) ; + copy_sub_list(subscr(r),subscr(p)) ; + copy_sub_list(supscr(r),supscr(p)) ; if (type(p) == accent_noad) { - s = copy_node_list(accent_chr(p)); - accent_chr(r) = s; - s = copy_node_list(bot_accent_chr(p)); - bot_accent_chr(r) = s; + copy_sub_list(accent_chr(r),accent_chr(p)) ; + copy_sub_list(bot_accent_chr(r),bot_accent_chr(p)) ; } else if (type(p) == radical_noad) { - s = copy_node(left_delimiter(p)); - left_delimiter(r) = s; - s = copy_node_list(degree(p)); - degree(r) = s; + copy_sub_node(left_delimiter(r),left_delimiter(p)) ; + copy_sub_list(degree(r),degree(p)) ; } break; case fence_noad: - s = copy_node(delimiter(p)); - delimiter(r) = s; + copy_sub_node(delimiter(r),delimiter(p)) ; break; case sub_box_node: case sub_mlist_node: - s = copy_node_list(math_list(p)); - math_list(r) = s; + copy_sub_list(math_list(r),math_list(p)) ; break; case fraction_noad: - s = copy_node_list(numerator(p)); - numerator(r) = s; - s = copy_node_list(denominator(p)); - denominator(r) = s; - s = copy_node(left_delimiter(p)); - left_delimiter(r) = s; - s = copy_node(right_delimiter(p)); - right_delimiter(r) = s; + copy_sub_list(numerator(r),numerator(p)) ; + copy_sub_list(denominator(r),denominator(p)) ; + copy_sub_node(left_delimiter(r),left_delimiter(p)) ; + copy_sub_node(right_delimiter(r),right_delimiter(p)) ; break; case glue_spec_node: glue_ref_count(r) = null; @@ -880,6 +1069,33 @@ int copy_error(halfword p) return 0; } +/* No gain in a helper: + + #define free_sub_list(source) do { \ + l = source; \ + if (l != null) \ + flush_node_list(l); \ + } while (0) + + #define free_sub_node(source) do { \ + l = source; \ + if (l != null) \ + flush_node(l); \ + } while (0) + + So: + +*/ + +#define free_sub_list(source) do { \ + if (source != null) \ + flush_node_list(source); \ +} while (0) + +#define free_sub_node(source) do { \ + if (source != null) \ + flush_node(source); \ +} while (0) @ @c void flush_node(halfword p) @@ -897,11 +1113,29 @@ void flush_node(halfword p) switch (type(p)) { case glyph_node: - flush_node_list(lig_ptr(p)); + free_sub_list(lig_ptr(p)); break; case glue_node: delete_glue_ref(glue_ptr(p)); - flush_node_list(leader_ptr(p)); + free_sub_list(leader_ptr(p)); + break; + case hlist_node: + case vlist_node: + case unset_node: + free_sub_list(list_ptr(p)); + break; + case disc_node: + free_sub_list(vlink(pre_break(p))); + free_sub_list(vlink(post_break(p))); + free_sub_list(vlink(no_break(p))); +// why not: free_sub_list(pre_break(p)); +// why not: free_sub_list(post_break(p)); +// why not: free_sub_list(no_break(p)); + break; + case rule_node: + case kern_node: + case math_node: + case penalty_node: break; case glue_spec_node: /* this allows free-ing of lua-allocated glue specs */ @@ -914,20 +1148,6 @@ void flush_node(halfword p) } return ; break ; - case attribute_node: - case attribute_list_node: - case temp_node: - case rule_node: - case kern_node: - case math_node: - case penalty_node: - break; - - case hlist_node: - case vlist_node: - case unset_node: - flush_node_list(list_ptr(p)); - break; case whatsit_node: switch (subtype(p)) { @@ -1039,38 +1259,33 @@ void flush_node(halfword p) case mark_node: delete_token_ref(mark_ptr(p)); break; - case disc_node: - flush_node_list(vlink(pre_break(p))); - flush_node_list(vlink(post_break(p))); - flush_node_list(vlink(no_break(p))); - break; case adjust_node: flush_node_list(adjust_ptr(p)); break; case style_node: /* nothing to do */ break; case choice_node: - flush_node_list(display_mlist(p)); - flush_node_list(text_mlist(p)); - flush_node_list(script_mlist(p)); - flush_node_list(script_script_mlist(p)); + free_sub_list(display_mlist(p)); + free_sub_list(text_mlist(p)); + free_sub_list(script_mlist(p)); + free_sub_list(script_script_mlist(p)); break; case simple_noad: case radical_noad: case accent_noad: - flush_node_list(nucleus(p)); - flush_node_list(subscr(p)); - flush_node_list(supscr(p)); + free_sub_list(nucleus(p)); + free_sub_list(subscr(p)); + free_sub_list(supscr(p)); if (type(p) == accent_noad) { - flush_node_list(accent_chr(p)); - flush_node_list(bot_accent_chr(p)); + free_sub_list(accent_chr(p)); + free_sub_list(bot_accent_chr(p)); } else if (type(p) == radical_noad) { - flush_node(left_delimiter(p)); - flush_node_list(degree(p)); + free_sub_node(left_delimiter(p)); + free_sub_list(degree(p)); } break; case fence_noad: - flush_node(delimiter(p)); + free_sub_list(delimiter(p)); break; case delim_node: /* nothing to do */ case math_char_node: @@ -1078,16 +1293,16 @@ void flush_node(halfword p) break; case sub_box_node: case sub_mlist_node: - flush_node_list(math_list(p)); + free_sub_list(math_list(p)); break; case fraction_noad: - flush_node_list(numerator(p)); - flush_node_list(denominator(p)); - flush_node(left_delimiter(p)); - flush_node(right_delimiter(p)); + free_sub_list(numerator(p)); + free_sub_list(denominator(p)); + free_sub_node(left_delimiter(p)); + free_sub_node(right_delimiter(p)); break; case pseudo_file_node: - flush_node_list(pseudo_lines(p)); + free_sub_list(pseudo_lines(p)); break; case pseudo_line_node: case shape_node: @@ -1107,14 +1322,19 @@ void flush_node(halfword p) case inserting_node: case split_up_node: case expr_node: + case attribute_node: + case attribute_list_node: + case temp_node: break; default: fprintf(stdout, "flush_node: type is %d\n", type(p)); return; } - if (nodetype_has_attributes(type(p))) + if (nodetype_has_attributes(type(p))) { delete_attribute_ref(node_attr(p)); + lua_properties_reset(p); + } free_node(p, get_node_size(type(p), subtype(p))); return; } @@ -1128,12 +1348,13 @@ void flush_node_list(halfword pp) return; if (free_error(p)) return; - + lua_properties_push; /* saves stack and time */ while (p != null) { register halfword q = vlink(p); flush_node(p); p = q; } + lua_properties_pop; /* saves stack and time */ } @ @c @@ -1423,7 +1644,7 @@ halfword get_node(int s) { register halfword r; #if 0 - check_static_node_mem(); + check_static_node_mem(); #endif assert(s < MAX_CHAIN_SIZE); @@ -2566,9 +2787,9 @@ static void show_whatsit_node(int p) clobbered or chosen at random. -@ |str_room| need not be checked; see |show_box| +@ |str_room| need not be checked; see |show_box| -@ Recursive calls on |show_node_list| therefore use the following pattern: +@ Recursive calls on |show_node_list| therefore use the following pattern: @c #define node_list_display(A) do { \ append_char('.'); \ diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h index c557012e7a2..f757612fc5d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.h +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.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: textoken.h 4634 2013-04-21 14:45:45Z hhenkel $ */ +/* $Id: textoken.h 4877 2014-03-14 01:26:05Z luigi $ */ #ifndef TEXTOKEN_H # define TEXTOKEN_H @@ -139,9 +139,9 @@ extern int get_char_cat_code(int); |get_next| if it wants to suppress expansion. */ -# define no_expand_flag special_char - -extern boolean end_line_char_inactive(void); +# define no_expand_flag special_char +# define end_line_char int_par(end_line_char_code) +# define end_line_char_inactive ((end_line_char < 0) || (end_line_char > 127)) extern halfword par_loc; extern halfword par_token; diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w index b12f54fa006..48f6e43d48b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.w +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w @@ -19,7 +19,7 @@ @ @c static const char _svn_version[] = - "$Id: textoken.w 4786 2014-02-10 13:17:44Z taco $" + "$Id: textoken.w 4877 2014-03-14 01:26:05Z luigi $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/tex/textoken.w $"; #include "ptexlib.h" @@ -28,7 +28,6 @@ static const char _svn_version[] = #define pausing int_par(pausing_code) #define cat_code_table int_par(cat_code_table_code) #define tracing_nesting int_par(tracing_nesting_code) -#define end_line_char int_par(end_line_char_code) #define suppress_outer_error int_par(suppress_outer_error_code) #define every_eof equiv(every_eof_loc) @@ -1238,14 +1237,6 @@ static boolean check_expanded_code(int *kk) return false; } -@ todo: this is a function because it is still used from the converted pascal. - once that is gone, it can be a \#define again - -@c -boolean end_line_char_inactive(void) -{ - return ((end_line_char < 0) || (end_line_char > 127)); -} @ All of the easy branches of |get_next| have now been taken care of. There is one more branch. @@ -1327,7 +1318,7 @@ static next_line_retval next_line(void) } return next_line_restart; } - if (inhibit_eol || end_line_char_inactive()) + if (inhibit_eol || end_line_char_inactive) ilimit--; else buffer[ilimit] = (packed_ASCII_code) end_line_char; @@ -1346,7 +1337,7 @@ static next_line_retval next_line(void) if (selector < log_only) open_log_file(); if (interaction > nonstop_mode) { - if (end_line_char_inactive()) + if (end_line_char_inactive) ilimit++; if (ilimit == istart) { /* previous line was empty */ tprint_nl("(Please type a command or say `\\end')"); @@ -1355,7 +1346,7 @@ static next_line_retval next_line(void) first = istart; prompt_input("*"); /* input on-line into |buffer| */ ilimit = last; - if (end_line_char_inactive()) + if (end_line_char_inactive) ilimit--; else buffer[ilimit] = (packed_ASCII_code) end_line_char; @@ -1718,29 +1709,30 @@ static boolean print_convert_string(halfword c, int i) } @ @c -int scan_lua_state(void) +int scan_lua_state(void) /* hh-ls: optional name or number (not optional name optional number) */ { - int sn = 0; - if (scan_keyword("name")) { - scan_pdf_ext_toks(); - sn = def_ref; - } /* Parse optional lua state integer, or an instance name to be stored in |sn| */ /* Get the next non-blank non-relax non-call token */ + int sn = 0; do { get_x_token(); } while ((cur_cmd == spacer_cmd) || (cur_cmd == relax_cmd)); - back_input(); /* have to push it back, whatever it is */ if (cur_cmd != left_brace_cmd) { - scan_register_num(); - if (get_lua_name(cur_val)) - sn = (cur_val - 65536); + if (scan_keyword("name")) { + (void) scan_toks(false, true); + sn = def_ref; + } else { + scan_register_num(); + if (get_lua_name(cur_val)) + sn = (cur_val - 65536); + } } return sn; } + @ The procedure |conv_toks| uses |str_toks| to insert the token list for |convert| functions into the scanner; `\.{\\outer}' control sequences are allowed to follow `\.{\\string}' and `\.{\\meaning}'. @@ -1840,7 +1832,7 @@ void conv_toks(void) save_warning_index = warning_index; save_def_ref = def_ref; u = save_cur_string(); - scan_pdf_ext_toks(); + scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/ s = tokens_to_string(def_ref); delete_token_ref(def_ref); def_ref = save_def_ref; @@ -1870,7 +1862,7 @@ void conv_toks(void) save_scanner_status = scanner_status; save_def_ref = def_ref; save_warning_index = warning_index; - scan_pdf_ext_toks(); + scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/ bool = in_lua_escape; in_lua_escape = true; escstr.s = (unsigned char *) tokenlist_to_cstring(def_ref, false, &l); @@ -1893,7 +1885,7 @@ void conv_toks(void) save_warning_index = warning_index; save_def_ref = def_ref; u = save_cur_string(); - scan_pdf_ext_toks(); + scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/ warning_index = save_warning_index; scanner_status = save_scanner_status; ins_list(token_link(def_ref)); @@ -1907,7 +1899,7 @@ void conv_toks(void) save_def_ref = def_ref; save_warning_index = warning_index; sn = scan_lua_state(); - scan_pdf_ext_toks(); + scan_toks(false, true); /*hh-ls was scan_pdf_ext_toks();*/ s = def_ref; warning_index = save_warning_index; def_ref = save_def_ref; @@ -1920,6 +1912,19 @@ void conv_toks(void) lua_string_start(); return; break; + case lua_function_code: + scan_int(); + if (cur_val <= 0) { + pdf_error("luafunction", "invalid number"); + } else { + u = save_cur_string(); + luacstrings = 0; + luafunctioncall(cur_val); + restore_cur_string(u); + if (luacstrings > 0) + lua_string_start(); + } + break; case pdf_insert_ht_code: scan_register_num(); break; @@ -2021,6 +2026,7 @@ void conv_toks(void) case pdf_creation_date_code: case lua_escape_string_code: case lua_code: + case lua_function_code: case expanded_code: break; default: @@ -2157,7 +2163,7 @@ void read_toks(int n, halfword r, halfword j) } ilimit = last; - if (end_line_char_inactive()) + if (end_line_char_inactive) decr(ilimit); else buffer[ilimit] = (packed_ASCII_code) int_par(end_line_char_code); diff --git a/Build/source/texk/web2c/luatexdir/utils/utils.w b/Build/source/texk/web2c/luatexdir/utils/utils.w index cf63c479097..10b4c5c687f 100644 --- a/Build/source/texk/web2c/luatexdir/utils/utils.w +++ b/Build/source/texk/web2c/luatexdir/utils/utils.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = - "$Id: utils.w 4720 2014-01-02 16:06:16Z taco $" + "$Id: utils.w 4882 2014-03-14 12:56:21Z taco $" "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/utils/utils.w $"; @ @c @@ -40,6 +40,7 @@ static const char _svn_version[] = #include "lua/luatex-api.h" /* for ptexbanner */ #include "png.h" +#include "mplib.h" /* POPPLER_VERSION is defined in poppler-config.h for poppler from * the TeX Live tree, or in the Makefile for an installed version. */ @@ -48,7 +49,7 @@ static const char _svn_version[] = @ @c #define check_nprintf(size_get, size_want) \ if ((unsigned)(size_get) >= (unsigned)(size_want)) \ - pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); + luatex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__); char *cur_file_name = NULL; static char print_buf[PRINTF_BUF_SIZE]; @@ -114,7 +115,7 @@ void make_subset_tag(fd_entry * fd) aa = avl_probe(st_tree, fd->subset_tag); assert(aa != NULL); if (j > 2) - pdftex_warn + luatex_warn ("\nmake_subset_tag(): subset-tag collision, resolved in round %d.\n", j); } @@ -131,7 +132,7 @@ void tex_printf(const char *fmt, ...) va_end(args); } -@ |pdftex_fail| may be called when a buffer overflow has happened/is +@ |luatex_fail| may be called when a buffer overflow has happened/is happening, therefore may not call mktexstring. However, with the current implementation it appears that error messages are misleading, possibly because pool overflows are detected too late. @@ -141,7 +142,7 @@ void tex_printf(const char *fmt, ...) @c __attribute__ ((noreturn, format(printf, 1, 2))) -void pdftex_fail(const char *fmt, ...) +void luatex_fail(const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -171,7 +172,7 @@ void pdftex_fail(const char *fmt, ...) pdftex.web! @c __attribute__ ((format(printf, 1, 2))) -void pdftex_warn(const char *fmt, ...) +void luatex_warn(const char *fmt, ...) { int old_selector = selector; va_list args; @@ -192,7 +193,7 @@ void pdftex_warn(const char *fmt, ...) @ @c void garbage_warning(void) { - pdftex_warn("dangling objects discarded, no output file produced."); + luatex_warn("dangling objects discarded, no output file produced."); remove_pdffile(static_pdf); } @@ -225,7 +226,7 @@ void make_pdftex_banner(void) size_t xfwrite(void *ptr, size_t size, size_t nmemb, FILE * stream) { if (fwrite(ptr, size, nmemb, stream) != nmemb) - pdftex_fail("fwrite() failed"); + luatex_fail("fwrite() failed"); return nmemb; } @@ -233,7 +234,7 @@ size_t xfwrite(void *ptr, size_t size, size_t nmemb, FILE * stream) int xfflush(FILE * stream) { if (fflush(stream) != 0) - pdftex_fail("fflush() failed (%s)", strerror(errno)); + luatex_fail("fflush() failed (%s)", strerror(errno)); return 0; } @@ -242,7 +243,7 @@ int xgetc(FILE * stream) { int c = getc(stream); if (c < 0 && c != EOF) - pdftex_fail("getc() failed (%s)", strerror(errno)); + luatex_fail("getc() failed (%s)", strerror(errno)); return c; } @@ -251,7 +252,7 @@ int xputc(int c, FILE * stream) { int i = putc(c, stream); if (i < 0) - pdftex_fail("putc() failed (%s)", strerror(errno)); + luatex_fail("putc() failed (%s)", strerror(errno)); return i; } @@ -264,7 +265,7 @@ scaled ext_xn_over_d(scaled x, scaled n, scaled d) else r -= 0.5; if (r >= (double) max_integer || r <= -(double) max_integer) - pdftex_warn("arithmetic: number too big"); + luatex_warn("arithmetic: number too big"); return (scaled) r; } @@ -346,11 +347,13 @@ void initversionstring(char **versions) const_string fmt = "Compiled with libpng %s; using %s\n" "Compiled with zlib %s; using %s\n" - "Compiled with poppler version %s\n"; + "Compiled with poppler version %s\n" + "Compiled with mplib version %s\n"; size_t len = strlen(fmt) + strlen(PNG_LIBPNG_VER_STRING) + strlen(png_libpng_ver) + strlen(ZLIB_VERSION) + strlen(zlib_version) + strlen(POPPLER_VERSION) + + strlen(mp_metapost_version()) + 1; /* len will be more than enough, because of the placeholder chars in fmt @@ -358,7 +361,7 @@ void initversionstring(char **versions) *versions = xmalloc(len); sprintf(*versions, fmt, PNG_LIBPNG_VER_STRING, png_libpng_ver, - ZLIB_VERSION, zlib_version, POPPLER_VERSION); + ZLIB_VERSION, zlib_version, POPPLER_VERSION, mp_metapost_version()); } @ @c |