diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-02-03 21:33:11 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-02-03 21:33:11 +0000 |
commit | 85a5ab00705446693e236ee78a0be10f53e86377 (patch) | |
tree | dcc942a92ffb98bbb2731f58fa069a46a18f9dcb /Build/source/texk/web2c/luatexdir/lua | |
parent | b14c66510e21d60854c376a6d8cdfb3c48f5e2b8 (diff) |
luatexdir: sync with the upstream (1.0.3)
git-svn-id: svn://tug.org/texlive/trunk@43128 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/limglib.c | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lnodelib.c | 151 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lpdflib.c | 34 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/ltexlib.c | 209 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luatex-api.h | 9 |
6 files changed, 361 insertions, 45 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 812ad437b1a..988d1e40c51 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -73,6 +73,7 @@ static const char *const callbacknames[] = { "insert_local_par", "contribute_filter", "call_edit", + "build_page_insert", NULL }; diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c index 5723174b905..e82bf9d5184 100644 --- a/Build/source/texk/web2c/luatexdir/lua/limglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c @@ -394,6 +394,8 @@ static int m_img_get(lua_State * L) lua_pushinteger(L, img_yres(d)); } else if (lua_key_eq(s,rotation)) { lua_pushinteger(L, img_rotation(d)); + } else if (lua_key_eq(s,orientation)) { + lua_pushinteger(L, img_orientation(d)); } else if (lua_key_eq(s,colorspace)) { if (img_colorspace(d) == 0) { lua_pushnil(L); diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c index 80ac8a24e30..103e5f32479 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -618,6 +618,105 @@ static int lua_nodelib_getdiscretionary(lua_State * L) return 1; } +/* getwhd: only core nodes */ + +#define push_list_whd(n) \ + lua_pushinteger(L, width(n)); \ + lua_pushinteger(L, height(n)); \ + lua_pushinteger(L, depth(n)); \ + +#define push_char_whd(n) \ + lua_pushinteger(L, char_width(font(n),character(n))); \ + lua_pushinteger(L, char_height(font(n),character(n))); \ + lua_pushinteger(L, char_depth(font(n),character(n))); \ + +static int lua_nodelib_direct_getwhd(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if (n != null) { + halfword t = type(n); + if ((t == hlist_node) || (t == vlist_node) || (t == rule_node) || (t == unset_node)) { + push_list_whd(n); + return 3; + } else if (t == glyph_node) { + push_char_whd(n); + return 3; + } else if (t == glue_node) { + halfword l = leader_ptr(n); + if (l != null) { + t = type(l) ; + if ((t == hlist_node) || (t == vlist_node) || (t == rule_node)) { + push_list_whd(l); + return 3; + } + } + } + } + return 0; +} + +static int lua_nodelib_getwhd(lua_State * L) +{ + halfword *n = lua_touserdata(L, 1); + if (n != NULL) { + halfword t = type(*n); + if ((t == hlist_node) || (t == vlist_node) || (t == rule_node) || (t == unset_node)) { + push_list_whd(*n); + return 3; + } else if (t == glyph_node) { + push_char_whd(*n); + return 3; + } else if (t == glue_node) { + halfword l = leader_ptr(*n); + if (l != null) { + t = type(l) ; + if ((t == hlist_node) || (t == vlist_node) || (t == rule_node)) { + push_list_whd(l); + return 3; + } + } + } + } + return 0; +} + +static int lua_nodelib_direct_setwhd(lua_State * L) +{ + halfword n = lua_tointeger(L, 1); + if (n != null) { + halfword t = type(n); + if (t == glue_node) { + n = leader_ptr(n); + if (n == null) { + return 0; + } else { + t = type(n); + } + } + if ((t == hlist_node) || (t == vlist_node) || (t == rule_node) || (t == unset_node)) { + int t = lua_gettop(L) ; + if (t > 1) { + width(n) = (halfword) lua_roundnumber(L, 2); + if (t > 2) { + height(n) = (halfword) lua_roundnumber(L, 3); + if (t > 3) { + depth(n) = (halfword) lua_roundnumber(L, 4); + } else { + depth(n) = 0; + } + } else { + height(n) = 0; + depth(n) = 0; + } + } else { + width(n) = 0; + height(n) = 0; + depth(n) = 0; + } + } + } + return 0; +} /* node.getlist */ @@ -1355,7 +1454,6 @@ static int lua_nodelib_copy_list(lua_State * L) m = do_copy_node_list(n, s); lua_nodelib_push_fast(L,m); return 1; - } /* node.direct.copy_list */ @@ -2268,7 +2366,7 @@ static int lua_nodelib_find_attribute(lua_State * L) /* returns attr value and n break; } else { lua_pushinteger(L,ret); - lua_nodelib_push_fast(L, p); + lua_nodelib_push_fast(L, c ); return 2; } } else if (attribute_id(p) > i) { @@ -2337,7 +2435,7 @@ static int lua_nodelib_direct_find_attribute(lua_State * L) /* returns attr valu break; } else { lua_pushinteger(L,ret); - lua_pushinteger(L,p); + lua_pushinteger(L,c); return 2; } } else if (attribute_id(p) > i) { @@ -2446,7 +2544,7 @@ static int lua_nodelib_set_glue(lua_State * L) { halfword n = *check_isnode(L, 1); int top = lua_gettop(L) ; - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { width(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? lua_roundnumber(L,2) : 0; stretch(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_roundnumber(L,3) : 0; shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_roundnumber(L,4) : 0; @@ -2462,7 +2560,7 @@ static int lua_nodelib_direct_set_glue(lua_State * L) { halfword n = lua_tointeger(L, 1); int top = lua_gettop(L) ; - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { width(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? lua_roundnumber(L,2) : 0; stretch(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_roundnumber(L,3) : 0; shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_roundnumber(L,4) : 0; @@ -2477,8 +2575,14 @@ static int lua_nodelib_direct_set_glue(lua_State * L) static int lua_nodelib_get_glue(lua_State * L) { halfword n = *check_isnode(L, 1); - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { + int b = -1; /* false: only width, true or unset: 5 values */ + if (lua_gettop(L) == 2) { + b = lua_toboolean(L, 2); + } lua_pushinteger(L,width(n)); + if (b == 0) + return 1; lua_pushinteger(L,stretch(n)); lua_pushinteger(L,shrink(n)); lua_pushinteger(L,stretch_order(n)); @@ -2492,13 +2596,21 @@ static int lua_nodelib_get_glue(lua_State * L) static int lua_nodelib_direct_get_glue(lua_State * L) { halfword n = lua_tointeger(L, 1); - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { + int b = -1; + if (lua_gettop(L) == 2) { + b = lua_toboolean(L, 2); + } lua_pushinteger(L,width(n)); - lua_pushinteger(L,stretch(n)); - lua_pushinteger(L,shrink(n)); - lua_pushinteger(L,stretch_order(n)); - lua_pushinteger(L,shrink_order(n)); - return 5; + if (b == 0) { + return 1; + } else { + lua_pushinteger(L,stretch(n)); + lua_pushinteger(L,shrink(n)); + lua_pushinteger(L,stretch_order(n)); + lua_pushinteger(L,shrink_order(n)); + return 5; + } } else { return luaL_error(L, "glue (spec) expected"); } @@ -2507,7 +2619,7 @@ static int lua_nodelib_direct_get_glue(lua_State * L) static int lua_nodelib_is_zero_glue(lua_State * L) { halfword n = *check_isnode(L, 1); - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { lua_pushboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0)); return 1; } else { @@ -2518,7 +2630,7 @@ static int lua_nodelib_is_zero_glue(lua_State * L) static int lua_nodelib_direct_is_zero_glue(lua_State * L) { halfword n = lua_tointeger(L, 1); - if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node)) { + if ((n != null) && (type(n) == glue_node || type(n) == glue_spec_node || type(n) == math_node)) { lua_pushboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0)); return 1; } else { @@ -3953,7 +4065,8 @@ static int lua_nodelib_direct_getfield(lua_State * L) if (! nodetype_has_attributes(t)) { lua_pushnil(L); } else { - nodelib_pushattr(L, node_attr(n)); + /* nodelib_pushattr(L, node_attr(n)); */ + lua_pushinteger(L, node_attr(n)); } } else if (t == glyph_node) { if (lua_key_eq(s, font)) { @@ -6109,7 +6222,6 @@ static int lua_nodelib_direct_setdiscretionary(lua_State * L) return 0; } - static int lua_nodelib_direct_setfield(lua_State * L) { const char *s; @@ -6151,7 +6263,8 @@ static int lua_nodelib_direct_setfield(lua_State * L) alink(n) = x; } else if (lua_key_eq(s, attr)) { if (nodetype_has_attributes(type(n))) { - nodelib_setattr(L, 3, n); + /* nodelib_setattr(L, 3, n); */ + reassign_attribute(n,lua_tointeger(L, 3)); } } else if (t == glyph_node) { if (lua_key_eq(s, subtype)) { @@ -6701,7 +6814,6 @@ static int lua_nodelib_direct_setbox(lua_State * L) luaL_error(L, "setbox: incompatible node type (%s)\n",get_node_name(type(j), subtype(j))); return 0; } - } save_global_defs = global_defs_par; if (isglobal) { @@ -7047,6 +7159,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"getbox", lua_nodelib_direct_getbox}, {"getchar", lua_nodelib_direct_getcharacter}, {"getdisc", lua_nodelib_direct_getdiscretionary}, + {"getwhd", lua_nodelib_direct_getwhd}, {"getfield", lua_nodelib_direct_getfield}, {"getfont", lua_nodelib_direct_getfont}, {"getid", lua_nodelib_direct_getid}, @@ -7085,6 +7198,7 @@ static const struct luaL_Reg direct_nodelib_f[] = { {"setfield", lua_nodelib_direct_setfield}, {"setchar", lua_nodelib_direct_setcharacter}, {"setdisc", lua_nodelib_direct_setdiscretionary}, + {"setwhd", lua_nodelib_direct_setwhd}, {"setnext", lua_nodelib_direct_setnext}, {"setprev", lua_nodelib_direct_setprev}, {"setboth", lua_nodelib_direct_setboth}, @@ -7146,6 +7260,7 @@ static const struct luaL_Reg nodelib_f[] = { {"getprev", lua_nodelib_getprev}, {"getboth", lua_nodelib_getboth}, {"getdisc", lua_nodelib_getdiscretionary}, + {"getwhd", lua_nodelib_getwhd}, {"getlist", lua_nodelib_getlist}, {"getleader", lua_nodelib_getleader}, {"getid", lua_nodelib_getid}, diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 82508a2a9e2..f20604ead8f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -788,6 +788,36 @@ static int l_set_obj_compress_level(lua_State * L) return 0 ; } +/* fonts */ + +static int getpdfgentounicode(lua_State * L) +{ + lua_pushinteger(L, (pdf_gen_tounicode)); + return 1 ; +} + +static int getpdfomitcidset(lua_State * L) +{ + lua_pushinteger(L, (pdf_omit_cidset)); + return 1 ; +} + +static int setpdfgentounicode(lua_State * L) +{ + if (lua_type(L, 1) == LUA_TNUMBER) { + set_pdf_gen_tounicode(lua_tointeger(L, 1)); + } + return 0 ; +} + +static int setpdfomitcidset(lua_State * L) +{ + if (lua_type(L, 1) == LUA_TNUMBER) { + set_pdf_omit_cidset(lua_tointeger(L, 1)); + } + return 0 ; +} + /* accuracy */ static int l_get_decimal_digits(lua_State * L) @@ -1186,8 +1216,12 @@ static const struct luaL_Reg pdflib[] = { { "getxformmargin", getpdfxformmargin }, { "getinclusionerrorlevel", getpdfinclusionerrorlevel }, { "getignoreunknownimages", getpdfignoreunknownimages }, + { "getgentounicode", getpdfgentounicode }, + { "getomitcidset", getpdfomitcidset }, { "setinclusionerrorlevel", setpdfinclusionerrorlevel }, { "setignoreunknownimages", setpdfignoreunknownimages }, + { "setgentounicode", setpdfgentounicode }, + { "setomitcidset", setpdfomitcidset }, { "mapfile", l_mapfile }, { "mapline", l_mapline }, /* sentinel */ diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index 6fdb2ac4ec8..04ab2c8079d 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -866,7 +866,11 @@ static int setskip(lua_State * L) int top = lua_gettop(L); check_item_global(L,top,isglobal); value = check_isnode(L, top); - set_item_index_plus(L, top-1, skip_base, "skip", *value, isglobal, is_glue_assign, set_tex_skip_register, true); + if (type(*value) == glue_spec_node) { + set_item_index_plus(L, top-1, skip_base, "skip", *value, isglobal, is_glue_assign, set_tex_skip_register, true); + } else { + luaL_error(L, "glue_spec expected"); + } return 0; } @@ -916,18 +920,31 @@ static int setglue(lua_State * L) static int getglue(lua_State * L) { int value = 0; - get_item_index_plus(L, lua_gettop(L), skip_base, "skip", value, is_glue_assign, get_tex_skip_register, true); + int top = lua_gettop(L); + int b = -1; /* false: only width, true or unset: 5 values */ + if (lua_type(L, top) == LUA_TBOOLEAN) { + b = lua_toboolean(L, top); + top -= 1 ; + } + get_item_index_plus(L, top, skip_base, "skip", value, is_glue_assign, get_tex_skip_register, true); if (value == null) { - lua_pushnil(L); - return 1; + lua_pushinteger(L,0); + if (b == 0) + return 1; + lua_pushinteger(L,0); + lua_pushinteger(L,0); + lua_pushinteger(L,0); + lua_pushinteger(L,0); } else { lua_pushinteger(L,width(value)); + if (b == 0) + return 1; lua_pushinteger(L,stretch(value)); lua_pushinteger(L,shrink(value)); lua_pushinteger(L,stretch_order(value)); lua_pushinteger(L,shrink_order(value)); - return 5; } + return 5; } static int ismuskip(lua_State * L) @@ -1234,25 +1251,30 @@ static int isbox(lua_State * L) static int vsetbox(lua_State * L, int is_global) { - int j, k, err; - int save_global_defs = global_defs_par; - if (is_global) - global_defs_par = 1; + int j, k, err, t; + int save_global_defs; k = get_box_id(L, -2, true); check_index_range(k, "setbox"); - if (lua_isboolean(L, -1)) { + t = lua_type(L, -1); + if (t == LUA_TBOOLEAN) { j = lua_toboolean(L, -1); - if (j == 0) + if (j == 0) { j = null; - else + } else { return 0; + } + } else if (t == LUA_TNIL) { + j = null; } else { j = nodelist_from_lua(L); if (j != null && type(j) != hlist_node && type(j) != vlist_node) { luaL_error(L, "setbox: incompatible node type (%s)\n", get_node_name(type(j), subtype(j))); return 0; } - + } + save_global_defs = global_defs_par; + if (is_global) { + global_defs_par = 1; } err = set_tex_box_register(k, j); global_defs_par = save_global_defs; @@ -1686,11 +1708,27 @@ static int settex(lua_State * L) } assign_internal_value((isglobal ? 4 : 0), equiv(cur_cs1), j); } else if (is_glue_assign(cur_cmd1)) { - halfword *j1 = check_isnode(L, i); /* the value */ - { - int a = isglobal; - define(equiv(cur_cs1), assign_glue_cmd, *j1); + int a = isglobal; +if (lua_type(L, i) == LUA_TNUMBER) { + halfword value = copy_node(zero_glue); + width(value) = lua_roundnumber(L,i); + if (i > 1) { + stretch(value) = lua_roundnumber(L,i+1); + } + if (i > 3) { + shrink(value) = lua_roundnumber(L,i+2); + } + if (i > 4) { + stretch_order(value) = lua_tointeger(L,i+3); } + if (i > 5) { + shrink_order(value) = lua_tointeger(L,i+4); + } + define(equiv(cur_cs1), assign_glue_cmd, value); +} else { + halfword *j1 = check_isnode(L, i); /* the value */ + define(equiv(cur_cs1), assign_glue_cmd, *j1); +} } else if (is_toks_assign(cur_cmd1)) { if (lua_type(L,i) == LUA_TSTRING) { j = tokenlist_from_lua(L); /* uses stack -1 */ @@ -1771,7 +1809,7 @@ static int do_convert(lua_State * L, int cur_code) return 1; } -static int do_scan_internal(lua_State * L, int cur_cmd1, int cur_code) +static int do_scan_internal(lua_State * L, int cur_cmd1, int cur_code, int values) { int texstr; char *str = NULL; @@ -1787,7 +1825,18 @@ static int do_scan_internal(lua_State * L, int cur_cmd1, int cur_code) break; case glue_val_level: case mu_val_level: - lua_nodelib_push_fast(L, copy_node(cur_val)); + if (values == 0) { + lua_pushinteger(L,width(cur_val)); + } else if (values == 1) { + lua_pushinteger(L,width(cur_val)); + lua_pushinteger(L,stretch(cur_val)); + lua_pushinteger(L,shrink(cur_val)); + lua_pushinteger(L,stretch_order(cur_val)); + lua_pushinteger(L,shrink_order(cur_val)); + return 5; + } else { + lua_nodelib_push_fast(L, cur_val); + } break; default: texstr = the_scanned_result(); @@ -1864,7 +1913,7 @@ static int do_lastitem(lua_State * L, int cur_code) case current_if_level_code: case current_if_type_code: case current_if_branch_code: - retval = do_scan_internal(L, last_item_cmd, cur_code); + retval = do_scan_internal(L, last_item_cmd, cur_code, -1); break; default: lua_pushnil(L); @@ -1974,9 +2023,24 @@ static int get_parshape(lua_State * L) static int gettex(lua_State * L) { int cur_cs1 = -1; - int retval = 1; /* default is to return nil */ + int retval = 1; /* default is to return nil */ int t = lua_gettop(L); - if (lua_type(L,t) == LUA_TSTRING) { /* 1 == 'tex', 2 == 'boxmaxdepth', or 1 == 'boxmaxdepth' */ + int b = -1 ; + if (t > 1 && lua_type(L,t) == LUA_TBOOLEAN) { + /* + 0 == flush width only + 1 == flush all glue parameters + */ + b = lua_toboolean(L,t); + t = t - 1; + } + if (lua_type(L,t) == LUA_TSTRING) { + /* + 1 == tex + 2 == boxmaxdepth + or + 1 == boxmaxdepth + */ int texstr; size_t k; const char *st = lua_tolstring(L, t, &k); @@ -2009,15 +2073,17 @@ static int gettex(lua_State * L) case assign_attr_cmd: case assign_dir_cmd: case assign_dimen_cmd: - case assign_glue_cmd: - case assign_mu_glue_cmd: case set_aux_cmd: case set_prev_graf_cmd: case set_page_int_cmd: case set_page_dimen_cmd: case char_given_cmd: case math_given_cmd: - retval = do_scan_internal(L, cur_cmd1, cur_code); + retval = do_scan_internal(L, cur_cmd1, cur_code, -1); + break; + case assign_glue_cmd: + case assign_mu_glue_cmd: + retval = do_scan_internal(L, cur_cmd1, cur_code, b); break; case set_tex_shape_cmd: retval = get_parshape(L); @@ -2026,7 +2092,7 @@ static int gettex(lua_State * L) lua_pushnil(L); break; } - } else if (t == 2) { + } else if ((t == 2) && (lua_type(L,2) == LUA_TSTRING)) { lua_rawget(L, 1); } return retval; @@ -2368,6 +2434,7 @@ static int tex_definefont(lua_State * L) return 0; } +/* static int tex_hashpairs(lua_State * L) { int cmd, chr; @@ -2384,8 +2451,8 @@ static int tex_hashpairs(lua_State * L) chr = equiv(cs); make_token_table(L, cmd, chr, cs); lua_rawset(L, -3); + cs++; } - cs++; } return 1; } @@ -2454,6 +2521,88 @@ static int tex_extraprimitives(lua_State * L) return 1; } +*/ + +static int tex_hashpairs(lua_State * L) +{ + str_number s = 0; + int cs = 1; + int nt = 0; + lua_newtable(L); + while (cs < hash_size) { + s = hash_text(cs); + if (s > 0) { + char *ss = makecstring(s); + lua_pushstring(L, ss); + free(ss); + lua_rawseti(L, -2, ++nt); + } + cs++; + } + return 1; +} + +static int tex_primitives(lua_State * L) +{ + str_number s = 0; + int cs = 0; + int nt = 0; + lua_newtable(L); + while (cs < prim_size) { + s = get_prim_text(cs); + if (s > 0) { + char *ss = makecstring(s); + lua_pushstring(L, ss); + free(ss); + lua_rawseti(L, -2, ++nt); + } + cs++; + } + return 1; +} + +static int tex_extraprimitives(lua_State * L) +{ + int n, i; + int mask = 0; + int cs = 0; + int nt = 0; + n = lua_gettop(L); + if (n == 0) { + mask = etex_command + luatex_command; + } else { + for (i = 1; i <= n; i++) { + if (lua_type(L,i) == LUA_TSTRING) { + const char *s = lua_tostring(L, i); + if (lua_key_eq(s,etex)) { + mask |= etex_command; + } else if (lua_key_eq(s,tex)) { + mask |= tex_command; + } else if (lua_key_eq(s,core)) { + mask |= core_command; + } else if (lua_key_eq(s,luatex)) { + mask |= luatex_command; + } + } + } + } + lua_newtable(L); + while (cs < prim_size) { + str_number s = 0; + s = get_prim_text(cs); + if (s > 0) { + if (get_prim_origin(cs) & mask) { + char *ss = makecstring(s); + lua_pushstring(L, ss); + free(ss); + lua_rawseti(L, -2, ++nt); + } + } + cs++; + } + return 1; +} + static int tex_enableprimitives(lua_State * L) { int n = lua_gettop(L); @@ -2805,6 +2954,12 @@ static int tex_run_boot(lua_State * L) } zwclose(fmt_file); } + pdf_init_map_file("pdftex.map"); + /* */ + if (end_line_char_inactive) + decr(ilimit); + else + buffer[ilimit] = (packed_ASCII_code) end_line_char_par; fix_date_and_time(); random_seed = (microseconds * 1000) + (epochseconds % 1000000); init_randoms(random_seed); diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index b3d70a4e58d..4c8097a7ceb 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -607,6 +607,7 @@ make_lua_key(horiz_variants);\ make_lua_key(hsize);\ make_lua_key(hyphenchar);\ make_lua_key(id);\ +make_lua_key(identity);\ make_lua_key(image);\ make_lua_key(imagetype);\ make_lua_key(immediate);\ @@ -684,6 +685,7 @@ make_lua_key(objnum);\ make_lua_key(oldmath);\ make_lua_key(ordering);\ make_lua_key(options);\ +make_lua_key(orientation);\ make_lua_key(origin);\ make_lua_key(output);\ make_lua_key(overlay_accent);\ @@ -829,6 +831,7 @@ make_lua_key(xyz_zoom);\ make_lua_key(yoffset); \ make_lua_key(yres); \ make_lua_key(ysize); \ +make_lua_key(writingmode); \ make_lua_key(__index) #define set_init_keys \ @@ -974,6 +977,7 @@ init_lua_key(horiz_variants);\ init_lua_key(hsize);\ init_lua_key(hyphenchar);\ init_lua_key(id);\ +init_lua_key(identity);\ init_lua_key(image);\ init_lua_key(imagetype);\ init_lua_key(immediate);\ @@ -1046,6 +1050,7 @@ init_lua_key(objcompression);\ init_lua_key(objnum);\ init_lua_key(oldmath);\ init_lua_key(options);\ +init_lua_key(orientation);\ init_lua_key(origin);\ init_lua_key(ordering);\ init_lua_key(output);\ @@ -1186,6 +1191,7 @@ init_lua_key(xyz_zoom);\ init_lua_key(yoffset);\ init_lua_key(yres);\ init_lua_key(ysize);\ +init_lua_key(writingmode);\ init_lua_key(__index);\ init_lua_key_alias(empty_string,"");\ init_lua_key_alias(lua_bytecodes_indirect,"lua.bytecodes.indirect");\ @@ -1390,6 +1396,7 @@ use_lua_key(horiz_variants); use_lua_key(hsize); use_lua_key(hyphenchar); use_lua_key(id); +use_lua_key(identity); use_lua_key(image); use_lua_key(imagetype); use_lua_key(immediate); @@ -1466,6 +1473,7 @@ use_lua_key(objcompression); use_lua_key(objnum); use_lua_key(oldmath); use_lua_key(options); +use_lua_key(orientation); use_lua_key(origin); use_lua_key(ordering); use_lua_key(output); @@ -1612,4 +1620,5 @@ use_lua_key(xyz_zoom); use_lua_key(yoffset); use_lua_key(yres); use_lua_key(ysize); +use_lua_key(writingmode); use_lua_key(__index); |