summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-04-04 15:54:37 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-04-04 15:54:37 +0000
commit6594e56570ac8f430ea4c0681812e2e8103881db (patch)
tree3912cb8c0fffe05096078d42905c7862a59d2443 /Build/source/texk/web2c/luatexdir/lua
parent2bec95b8ba68b5b743535e19a4ca1c32231eaec3 (diff)
web2c/luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@40233 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c575
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c102
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h9
3 files changed, 389 insertions, 297 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index 3a8982604c6..e5863c61ad9 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -21,11 +21,6 @@
/*
- The node getter and setter are adapted a bit by Hans and Luigi so blame
- them! On the agenda: check all keys, maybe hide some fields that are not
- supposed to be seen and set (scratch fields for the backend and par
- builder).
-
After doing lots of tests with luatex and luajittex, with and without jit,
and with and without ffi, we came to the conclusion that userdata prevents
a speedup. We also found that the checking of metatables as well as assignment
@@ -45,19 +40,7 @@
So the advice is: use the indexed approach when possible and investigate the
direct one when speed might be an issue. For that reason we also provide the
get* and set* functions in the top level node namespace. There is a limited set
- of getters.
-
- getnext : parsing nodelist always involves this one
- getprev : used less but is logical companion to getnext
- getid : consulted a lot
- getsubtype : consulted less but also a topper
- getfont : used a lot in otf handling (glyph nodes are consulted a lot)
- getchar : idem and also in other places
- getlist : we often parse nested lists so this is a convenient one too (only hlist/vlist !)
- getleader : comparable to list, seldom used in tex (but needs consulting
- like lists)
- getfield : generic getter, sufficient for the rest (other field names are
- often shared so a specific getter makes no sense then)
+ of getters and a generic getfield to complement them.
Keep in mind that these only make sense when we're calling them millions of
times (which happens in font processing for instance). Setters are less important
@@ -66,7 +49,7 @@
Another change is that __index and __newindex are (as expected) exposed to
users but do no checking. The getfield and setfield functions do check. In
- fact, fast mode can be simulated by fast_getfield = __index but the (measured)
+ fact, a fast mode can be simulated by fast_getfield = __index but the (measured)
benefit on average runs is not that large (some 5% when we also use the other
fast ones) which is easily nilled by inefficient coding. The direct variants
on the other hand can be significantly faster but with the drawback of lack
@@ -74,28 +57,6 @@
a speedup on these functions is not representative for a normal run, where
much more happens.
- todo : check and optimize the direct function when possible
-
- todo : once the direct ones are proven we can redefine some of the less
- critical normal ones to call the direct ones after checking for
- a first argument being a node (like protect/unprotect)
-
- The code below has quite some duplicated code but this is also a prelude
- to light userdata for diretc nodes so we prefer this method. Some userdata
- variants could call the direct functions but not now (also because we don't
- want to touch the originals too much). As usual: blame Luigi and Hans for
- issues with this code. You can blame HH for weird or inaccurate comments.
-
- Todo: as a prelude to lua 5.3 we should use integer instead of number when
- possible. A boring job. We can use the direct variants for testing this.
-
- Remark: when a direct node is set, and an invalid one is passed (or nil) we
- normally get zero and that is a predefined glue, so we get a message about
- assigning to a glue which is fine. What we should do some day is make node
- zero a dummy so that null then can be used as test.
-
- Hans Hagen, Luigi Scarso (2011-2013)
-
*/
#include "ptexlib.h"
@@ -172,7 +133,7 @@
if (n==null) { \
lua_pushnil(L); \
} else { \
- lua_pushinteger(L,n); \
+ lua_pushinteger(L,n); \
} \
} while (0)
@@ -185,30 +146,6 @@
} \
} while (0)
-#define nodelib_check_glue_spec(n,g,field) do { \
- g = glue_ptr(n); \
- v = (halfword) lua_tointeger(L, 3); \
- if (!g) { \
- g = new_node(glue_spec_node,0); \
- add_glue_ref(g); \
- glue_ptr(n) = g; \
- field(g) = v; \
- } else if (field(g) != v) { \
- if (valid_node(g)) { \
- int c = new_spec(g); \
- delete_glue_ref(g); \
- add_glue_ref(c); \
- glue_ptr(n) = c; \
- field(c) = v; \
- } else { \
- g = new_spec(g); \
- add_glue_ref(g); \
- glue_ptr(n) = g; \
- field(g) = v; \
- } \
- } \
-} while (0)
-
#define nodelib_setattr(L, s, n) reassign_attribute(n,nodelib_getlist(L,s))
#define nodelib_gettoks(L,a) tokenlist_from_lua(L)
@@ -220,7 +157,6 @@
#define nodelib_pushlist(L,n) { lua_pushinteger(L,n); lua_nodelib_push(L); } /* can be: fast_metatable_or_nil(n) */
#define nodelib_pushattr(L,n) { lua_pushinteger(L,n); lua_nodelib_push(L); } /* can be: fast_metatable_or_nil(n) */
-#define nodelib_pushspec(L,n) { lua_pushinteger(L,n); lua_nodelib_push_spec(L); } /* can be: fast_metatable_or_nil(n) - different criterium? */
#define nodelib_pushaction(L,n) { lua_pushinteger(L,n); lua_nodelib_push(L); } /* can be: fast_metatable_or_nil(n) */
#define nodelib_pushstring(L,n) { char *ss=makecstring(n); lua_pushstring(L,ss); free(ss); }
@@ -357,19 +293,6 @@ static int lua_nodelib_prev(lua_State * L)
/*
- static void lua_nodelib_push_simple(lua_State * L, halfword p)
- {
- halfword *a;
- a = (halfword *) lua_newuserdata(L, sizeof(halfword));
- *a = p;
- lua_get_metatablelua(luatex_node);
- lua_setmetatable(L, -2);
- }
-
-*/
-
-/*
-
Creates a userdata object for a number found at the stack top, if it is
representing a node (i.e. an pointer into |varmem|). It replaces the
stack entry with the new userdata, or pushes |nil| if the number is |null|,
@@ -396,27 +319,6 @@ void lua_nodelib_push(lua_State * L)
return;
}
-/* |spec_ptr| fields can legally be zero, which is why there is a special function. */
-
-static void lua_nodelib_push_spec(lua_State * L)
-{
- halfword n;
- halfword *a;
- n = -1;
- if (lua_type(L, -1) == LUA_TNUMBER)
- n = (halfword) lua_tointeger(L, -1);
- lua_pop(L, 1);
- if ((n < 0) || (n > var_mem_max)) {
- lua_pushnil(L);
- } else {
- a = lua_newuserdata(L, sizeof(halfword));
- *a = n;
- lua_get_metatablelua(luatex_node);
- lua_setmetatable(L, -2);
- }
- return;
-}
-
void lua_nodelib_push_fast(lua_State * L, halfword n)
{
halfword *a;
@@ -2398,14 +2300,13 @@ static int lua_nodelib_unset_attribute(lua_State * L)
static int lua_nodelib_direct_unset_attribute(lua_State * L)
{
- int i, val, ret;
halfword n = lua_tointeger(L, 1);
if (n == null) {
lua_pushnil(L);
} else if (lua_gettop(L) <= 3) { /* a useless test, we never test for that elsewhere */
- i=(int)luaL_checknumber(L, 2);
- val=(int)luaL_optnumber(L, 3, UNUSED_ATTRIBUTE);
- ret = unset_attribute(n, i, val);
+ int i = (int)luaL_checknumber(L, 2);
+ int val = (int)luaL_optnumber(L, 3, UNUSED_ATTRIBUTE);
+ int ret = unset_attribute(n, i, val);
if (ret > UNUSED_ATTRIBUTE) {
lua_pushinteger(L, ret);
} else {
@@ -2417,6 +2318,92 @@ static int lua_nodelib_direct_unset_attribute(lua_State * L)
return 1;
}
+/* glue */
+
+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)) {
+ width(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? lua_tointeger(L,2) : 0;
+ stretch(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_tointeger(L,3) : 0;
+ shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_tointeger(L,4) : 0;
+ stretch_order(n) = ((top > 4 && lua_type(L, 5) == LUA_TNUMBER)) ? lua_tointeger(L,5) : 0;
+ shrink_order(n) = ((top > 5 && lua_type(L, 6) == LUA_TNUMBER)) ? lua_tointeger(L,6) : 0;
+ return 0;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
+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)) {
+ width(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? lua_tointeger(L,2) : 0;
+ stretch(n) = ((top > 2 && lua_type(L, 3) == LUA_TNUMBER)) ? lua_tointeger(L,3) : 0;
+ shrink(n) = ((top > 3 && lua_type(L, 4) == LUA_TNUMBER)) ? lua_tointeger(L,4) : 0;
+ stretch_order(n) = ((top > 4 && lua_type(L, 5) == LUA_TNUMBER)) ? lua_tointeger(L,5) : 0;
+ shrink_order(n) = ((top > 5 && lua_type(L, 6) == LUA_TNUMBER)) ? lua_tointeger(L,6) : 0;
+ return 0;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
+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)) {
+ 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;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
+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)) {
+ 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;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
+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)) {
+ lua_toboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0));
+ return 1;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
+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)) {
+ lua_toboolean(L,(width(n) == 0 && stretch(n) == 0 && shrink(n) == 0));
+ return 1;
+ } else {
+ return luaL_error(L, "glue (spec) expected");
+ }
+}
+
/* iteration */
static int nodelib_aux_nil(lua_State * L)
@@ -2504,9 +2491,6 @@ static int lua_nodelib_direct_traverse_filtered(lua_State * L)
n = (halfword) lua_tointeger(L, 2);
if (n == null)
return 0;
- /* funny duplicate check
- n = (halfword) lua_tointeger(L, 2);
- */
lua_pop(L, 1);
lua_pushcclosure(L, nodelib_direct_aux_next_filtered, 1);
lua_pushinteger(L,n);
@@ -2518,9 +2502,8 @@ static int lua_nodelib_direct_traverse_filtered(lua_State * L)
static int nodelib_direct_aux_next_char(lua_State * L)
{
- halfword t; /* traverser */
- /*int i = (int) lua_tointeger(L, lua_upvalueindex(1));*/
- if (lua_isnil(L, 2)) { /* first call */
+ halfword t; /* traverser */
+ if (lua_isnil(L, 2)) { /* first call */
t = lua_tointeger(L,1) ;
lua_settop(L,1);
} else {
@@ -2564,9 +2547,9 @@ static int lua_nodelib_direct_traverse_char(lua_State * L)
static int nodelib_aux_next(lua_State * L)
{
- halfword t; /* traverser */
- halfword *a; /* a or *a */
- if (lua_isnil(L, 2)) { /* first call */
+ halfword t; /* traverser */
+ halfword *a; /* a or *a */
+ if (lua_isnil(L, 2)) { /* first call */
t = *check_isnode(L, 1);
lua_settop(L,1);
} else {
@@ -2600,9 +2583,9 @@ static int lua_nodelib_traverse(lua_State * L)
static int nodelib_aux_next_char(lua_State * L)
{
- halfword t; /* traverser */
+ halfword t; /* traverser */
halfword *a;
- if (lua_isnil(L, 2)) { /* first call */
+ if (lua_isnil(L, 2)) { /* first call */
t = *check_isnode(L, 1);
lua_settop(L,1);
} else {
@@ -2641,9 +2624,8 @@ static int lua_nodelib_traverse_char(lua_State * L)
static int nodelib_direct_aux_next(lua_State * L)
{
- halfword t; /* traverser */
- /*int i = (int) lua_tointeger(L, lua_upvalueindex(1));*/
- if (lua_isnil(L, 2)) { /* first call */
+ halfword t; /* traverser */
+ if (lua_isnil(L, 2)) { /* first call */
t = lua_tointeger(L,1) ;
lua_settop(L,1);
} else {
@@ -2745,7 +2727,7 @@ static int lua_nodelib_direct_count(lua_State * L)
{
return do_lua_nodelib_count(L,
(halfword) lua_tointeger(L, 3), /* m */
- (int) lua_tointeger(L, 1), /* i */
+ (int) lua_tointeger(L, 1), /* i */
(halfword) lua_tointeger(L, 2) /* n */
);
}
@@ -2790,12 +2772,6 @@ static int nodelib_cantset(lua_State * L, int n, const char *s)
return 0;
}
-static int nodelib_nonwritable(lua_State * L, int n, const char *s)
-{
- luaL_error(L,"You cannot set field %s in a non writable node of type %s",s,node_data[type(n)].name);
- return 0;
-}
-
/* node.direct.getfield */
static void lua_nodelib_getfield_whatsit(lua_State * L, int n, const char *s)
@@ -3161,31 +3137,6 @@ static int lua_nodelib_fast_getfield(lua_State * L)
} else if (t == glue_node) {
if (lua_key_eq(s, subtype)) {
lua_pushinteger(L, subtype(n));
- } else if (lua_key_eq(s, spec)) {
- nodelib_pushspec(L, glue_ptr(n));
- } else if (lua_key_eq(s, leader)) {
- fast_metatable_or_nil(leader_ptr(n));
- } else {
- n = glue_ptr(n);
- if (!n) {
- lua_pushinteger(L, 0); /* zero skip constant */
- } else if (lua_key_eq(s, width)) {
- lua_pushinteger(L, width(n));
- } else if (lua_key_eq(s, stretch)) {
- lua_pushinteger(L, stretch(n));
- } else if (lua_key_eq(s, shrink)) {
- lua_pushinteger(L, shrink(n));
- } else if (lua_key_eq(s, stretch_order)) {
- lua_pushinteger(L, stretch_order(n));
- } else if (lua_key_eq(s, shrink_order)) {
- lua_pushinteger(L, shrink_order(n));
- } else {
- lua_pushnil(L);
- }
- }
- } else if (t == glue_spec_node) {
- if (lua_key_eq(s, subtype)) {
- lua_pushinteger(L, 0); /* dummy, the only one that prevents move up */
} else if (lua_key_eq(s, width)) {
lua_pushinteger(L, width(n));
} else if (lua_key_eq(s, stretch)) {
@@ -3196,10 +3147,8 @@ static int lua_nodelib_fast_getfield(lua_State * L)
lua_pushinteger(L, stretch_order(n));
} else if (lua_key_eq(s, shrink_order)) {
lua_pushinteger(L, shrink_order(n));
- } else if (lua_key_eq(s, ref_count)) {
- lua_pushinteger(L, glue_ref_count(n));
- } else if (lua_key_eq(s, writable)) {
- lua_pushboolean(L, valid_node(n));
+ } else if (lua_key_eq(s, leader)) {
+ fast_metatable_or_nil(leader_ptr(n));
} else {
lua_pushnil(L);
}
@@ -3245,10 +3194,8 @@ static int lua_nodelib_fast_getfield(lua_State * L)
lua_push_dir_text(L, dir_dir(n));
} else if (lua_key_eq(s, level)) {
lua_pushinteger(L, dir_level(n));
- } else if (lua_key_eq(s, dvi_ptr)) {
- lua_pushinteger(L, dir_dvi_ptr(n));
- } else if (lua_key_eq(s, dir_h)) {
- lua_pushinteger(L, dir_dvi_h(n));
+ } else if (lua_key_eq(s, subtype)) { /* can be used for anything */
+ lua_pushinteger(L, subtype(n));
} else {
lua_pushnil(L);
}
@@ -3272,6 +3219,20 @@ static int lua_nodelib_fast_getfield(lua_State * L)
} else {
lua_pushnil(L);
}
+ } else if (t == glue_spec_node) {
+ if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
+ } else {
+ lua_pushnil(L);
+ }
} else if (t == whatsit_node) {
if (lua_key_eq(s, subtype)) {
lua_pushinteger(L, subtype(n));
@@ -3322,10 +3283,19 @@ static int lua_nodelib_fast_getfield(lua_State * L)
lua_pushinteger(L, depth(n));
} else if (lua_key_eq(s, height)) {
lua_pushinteger(L, height(n));
- } else if (lua_key_eq(s, spec)) {
- nodelib_pushspec(L, split_top_ptr(n));
- } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) {
+ } else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) { /* already mapped */
fast_metatable_or_nil_alink(ins_ptr(n));
+ /* glue parameters */
+ } else if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
} else {
lua_pushnil(L);
}
@@ -3334,6 +3304,17 @@ static int lua_nodelib_fast_getfield(lua_State * L)
lua_pushinteger(L, subtype(n));
} else if (lua_key_eq(s, surround)) {
lua_pushinteger(L, surround(n));
+ /* glue parameters */
+ } else if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
} else {
lua_pushnil(L);
}
@@ -3900,29 +3881,6 @@ static int lua_nodelib_direct_getfield(lua_State * L)
lua_pushnil(L);
}
} else if (t == glue_node) {
- if (lua_key_eq(s, spec)) {
- nodelib_pushdirect(glue_ptr(n));
- } else if (lua_key_eq(s, leader)) {
- nodelib_pushdirect_or_nil(leader_ptr(n));
- } else {
- n = glue_ptr(n);
- if (!n) {
- lua_pushinteger(L, 0); /* zero skip constant */
- } else if (lua_key_eq(s, width)) {
- lua_pushinteger(L, width(n));
- } else if (lua_key_eq(s, stretch)) {
- lua_pushinteger(L, stretch(n));
- } else if (lua_key_eq(s, shrink)) {
- lua_pushinteger(L, shrink(n));
- } else if (lua_key_eq(s, stretch_order)) {
- lua_pushinteger(L, stretch_order(n));
- } else if (lua_key_eq(s, shrink_order)) {
- lua_pushinteger(L, shrink_order(n));
- } else {
- lua_pushnil(L);
- }
- }
- } else if (t == glue_spec_node) {
if (lua_key_eq(s, width)) {
lua_pushinteger(L, width(n));
} else if (lua_key_eq(s, stretch)) {
@@ -3933,10 +3891,8 @@ static int lua_nodelib_direct_getfield(lua_State * L)
lua_pushinteger(L, stretch_order(n));
} else if (lua_key_eq(s, shrink_order)) {
lua_pushinteger(L, shrink_order(n));
- } else if (lua_key_eq(s, ref_count)) {
- lua_pushinteger(L, glue_ref_count(n));
- } else if (lua_key_eq(s, writable)) {
- lua_pushboolean(L, valid_node(n));
+ } else if (lua_key_eq(s, leader)) {
+ nodelib_pushdirect_or_nil(leader_ptr(n));
} else {
lua_pushnil(L);
}
@@ -3973,13 +3929,11 @@ static int lua_nodelib_direct_getfield(lua_State * L)
}
} else if (t == dir_node) {
if (lua_key_eq(s, dir)) {
- lua_push_dir_text(L, dir_dir(n));
+ lua_push_dir_text(L, dir_dir(n));
} else if (lua_key_eq(s, level)) {
lua_pushinteger(L, dir_level(n));
- } else if (lua_key_eq(s, dvi_ptr)) {
- lua_pushinteger(L, dir_dvi_ptr(n));
- } else if (lua_key_eq(s, dir_h)) {
- lua_pushinteger(L, dir_dvi_h(n));
+ } else if (lua_key_eq(s, subtype)) { /* can be used for anything */
+ lua_pushinteger(L, subtype(n));
} else {
lua_pushnil(L);
}
@@ -4038,16 +3992,36 @@ static int lua_nodelib_direct_getfield(lua_State * L)
lua_pushinteger(L, depth(n));
} else if (lua_key_eq(s, height)) {
lua_pushinteger(L, height(n));
- } else if (lua_key_eq(s, spec)) {
- nodelib_pushdirect_or_nil(split_top_ptr(n));
} else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) {
nodelib_pushdirect_or_nil_alink(ins_ptr(n));
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
} else {
lua_pushnil(L);
}
} else if (t == math_node) {
if (lua_key_eq(s, surround)) {
lua_pushinteger(L, surround(n));
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
} else {
lua_pushnil(L);
}
@@ -4213,6 +4187,20 @@ static int lua_nodelib_direct_getfield(lua_State * L)
} else {
lua_pushnil(L);
}
+ } else if (t == glue_spec_node) {
+ if (lua_key_eq(s, width)) {
+ lua_pushinteger(L, width(n));
+ } else if (lua_key_eq(s, stretch)) {
+ lua_pushinteger(L, stretch(n));
+ } else if (lua_key_eq(s, shrink)) {
+ lua_pushinteger(L, shrink(n));
+ } else if (lua_key_eq(s, stretch_order)) {
+ lua_pushinteger(L, stretch_order(n));
+ } else if (lua_key_eq(s, shrink_order)) {
+ lua_pushinteger(L, shrink_order(n));
+ } else {
+ lua_pushnil(L);
+ }
} else {
lua_pushnil(L);
}
@@ -4585,17 +4573,6 @@ static int lua_nodelib_direct_first_glyph(lua_State * L)
/* new, fast and dumb ones: only signals that something needs to be processed */
-/* #define do_has_glyph(h) do { \ */
-/* while (h != null) { \ */
-/* if (type(h) == glyph_node) { \ */
-/* return h; \ */
-/* } else { \ */
-/* h = vlink(h); \ */
-/* } \ */
-/* } \ */
-/* return null; \ */
-/* } while (0) */
-
/* node.has_glyph */
static int lua_nodelib_has_glyph(lua_State * L)
@@ -4803,8 +4780,6 @@ static int lua_nodelib_direct_tonode(lua_State * L)
/* node.setfield */
-/* ls-hh: normally a value will not be reassigned */
-
#define cleanup_late_lua(n) do { \
if (late_lua_data(n) != 0) { \
if (late_lua_type(n) == normal) { \
@@ -5058,7 +5033,6 @@ static int lua_nodelib_setfield_whatsit(lua_State * L, int n, const char *s)
static int lua_nodelib_fast_setfield(lua_State * L)
{
- halfword g, v;
const char *s;
halfword n = *((halfword *) lua_touserdata(L, 1));
int t = type(n);
@@ -5172,28 +5146,6 @@ static int lua_nodelib_fast_setfield(lua_State * L)
} else if (t == glue_node) {
if (lua_key_eq(s, subtype)) {
subtype(n) = (quarterword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, spec)) {
- glue_ptr(n) = nodelib_getspec(L, 3);
- } else if (lua_key_eq(s, leader)) {
- leader_ptr(n) = nodelib_getlist(L, 3);
- } else if (lua_key_eq(s, width)) {
- nodelib_check_glue_spec(n, g, width);
- } else if (lua_key_eq(s, stretch)) {
- nodelib_check_glue_spec(n, g, stretch);
- } else if (lua_key_eq(s, shrink)) {
- nodelib_check_glue_spec(n, g, shrink);
- } else if (lua_key_eq(s, stretch_order)) {
- nodelib_check_glue_spec(n, g, stretch_order);
- } else if (lua_key_eq(s, shrink_order)) {
- nodelib_check_glue_spec(n, g, shrink_order);
- } else {
- return nodelib_cantset(L, n, s);
- }
- } else if (t == glue_spec_node) {
- if (!valid_node(n)) {
- return nodelib_nonwritable(L, n, s);
- } else if (lua_key_eq(s, subtype)) {
- subtype(n) = (quarterword) lua_tointeger(L, 3); /* dummy, the only one that prevents move up */
} else if (lua_key_eq(s, width)) {
width(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, stretch)) {
@@ -5204,6 +5156,8 @@ static int lua_nodelib_fast_setfield(lua_State * L)
stretch_order(n) = (quarterword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, shrink_order)) {
shrink_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, leader)) {
+ leader_ptr(n) = nodelib_getlist(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -5248,10 +5202,8 @@ static int lua_nodelib_fast_setfield(lua_State * L)
dir_dir(n) = nodelib_getdir(L, 3, 0);
} else if (lua_key_eq(s, level)) {
dir_level(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, dvi_ptr)) {
- dir_dvi_ptr(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, dir_h)) {
- dir_dvi_h(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, subtype)) { /* can be used for anything */
+ subtype(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -5320,10 +5272,19 @@ static int lua_nodelib_fast_setfield(lua_State * L)
depth(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, height)) {
height(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, spec)) {
- split_top_ptr(n) = nodelib_getspec(L, 3);
} else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) {
ins_ptr(n) = nodelib_getlist(L, 3);
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -5332,6 +5293,17 @@ static int lua_nodelib_fast_setfield(lua_State * L)
subtype(n) = (quarterword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, surround)) {
surround(n) = (halfword) lua_tointeger(L, 3);
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -5529,6 +5501,20 @@ static int lua_nodelib_fast_setfield(lua_State * L)
} else {
return nodelib_cantset(L, n, s);
}
+ } else if (t == glue_spec_node) {
+ if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else {
+ return nodelib_cantset(L, n, s);
+ }
} else {
return luaL_error(L, "You can't assign to this %s node (%d)\n", node_data[t].name, n);
}
@@ -5730,8 +5716,6 @@ static int lua_nodelib_direct_setfield_whatsit(lua_State * L, int n, const char
pdf_action_new_window(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, data)) {
pdf_action_tokens(n) = nodelib_gettoks(L, 3);
- /* } else if (lua_key_eq(s, ref_count)) {
- pdf_action_refcount(n) = (halfword) lua_tointeger(L, 3); */
} else {
return nodelib_cantset(L, n, s);
}
@@ -5934,7 +5918,6 @@ static int lua_nodelib_direct_setdiscretionary(lua_State * L)
static int lua_nodelib_direct_setfield(lua_State * L)
{
- halfword g, v;
const char *s;
halfword n = lua_tointeger(L, 1);
@@ -5989,12 +5972,6 @@ static int lua_nodelib_direct_setfield(lua_State * L)
y_displace(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, xadvance)) {
x_advance(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, width)) {
- /* not yet */
- } else if (lua_key_eq(s, height)) {
- /* not yet */
- } else if (lua_key_eq(s, depth)) {
- /* not yet */
} else if (lua_key_eq(s, expansion_factor)) {
ex_glyph(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, components)) {
@@ -6007,6 +5984,12 @@ static int lua_nodelib_direct_setfield(lua_State * L)
set_char_rhmin(n, (halfword) lua_tointeger(L, 3));
} else if (lua_key_eq(s, uchyph)) {
set_char_uchyph(n, (halfword) lua_tointeger(L, 3));
+ } else if (lua_key_eq(s, width)) {
+ /* not yet */
+ } else if (lua_key_eq(s, height)) {
+ /* not yet */
+ } else if (lua_key_eq(s, depth)) {
+ /* not yet */
} else {
return nodelib_cantset(L, n, s);
}
@@ -6049,28 +6032,6 @@ static int lua_nodelib_direct_setfield(lua_State * L)
} else if (t == glue_node) {
if (lua_key_eq(s, subtype)) {
subtype(n) = (quarterword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, spec)) {
- glue_ptr(n) = nodelib_popdirect(3);
- } else if (lua_key_eq(s, leader)) {
- leader_ptr(n) = nodelib_popdirect(3);
- } else if (lua_key_eq(s, width)) {
- nodelib_check_glue_spec(n, g, width);
- } else if (lua_key_eq(s, stretch)) {
- nodelib_check_glue_spec(n, g, stretch);
- } else if (lua_key_eq(s, shrink)) {
- nodelib_check_glue_spec(n, g, shrink);
- } else if (lua_key_eq(s, stretch_order)) {
- nodelib_check_glue_spec(n, g, stretch_order);
- } else if (lua_key_eq(s, shrink_order)) {
- nodelib_check_glue_spec(n, g, shrink_order);
- } else {
- return nodelib_cantset(L, n, s);
- }
- } else if (t == glue_spec_node) {
- if (!valid_node(n)) {
- return nodelib_nonwritable(L, n, s);
- } else if (lua_key_eq(s, subtype)) {
- subtype(n) = (quarterword) lua_tointeger(L, 3); /* dummy, the only one that prevents move up */
} else if (lua_key_eq(s, width)) {
width(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, stretch)) {
@@ -6081,6 +6042,8 @@ static int lua_nodelib_direct_setfield(lua_State * L)
stretch_order(n) = (quarterword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, shrink_order)) {
shrink_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, leader)) {
+ leader_ptr(n) = nodelib_popdirect(3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -6125,14 +6088,12 @@ static int lua_nodelib_direct_setfield(lua_State * L)
dir_dir(n) = nodelib_getdir(L, 3, 0);
} else if (lua_key_eq(s, level)) {
dir_level(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, dvi_ptr)) {
- dir_dvi_ptr(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, dir_h)) {
- dir_dvi_h(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, subtype)) { /* can be used for anything */
+ subtype(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
- } else if (t == whatsit_node) {
+ } else if (t == whatsit_node) {
if (lua_key_eq(s, subtype)) {
subtype(n) = (quarterword) lua_tointeger(L, 3);
} else {
@@ -6197,10 +6158,19 @@ static int lua_nodelib_direct_setfield(lua_State * L)
depth(n) = (halfword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, height)) {
height(n) = (halfword) lua_tointeger(L, 3);
- } else if (lua_key_eq(s, spec)) {
- split_top_ptr(n) = nodelib_popdirect(3);
} else if ((lua_key_eq(s, list)) || (lua_key_eq(s, head))) {
ins_ptr(n) = nodelib_popdirect(3);
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -6209,6 +6179,17 @@ static int lua_nodelib_direct_setfield(lua_State * L)
subtype(n) = (quarterword) lua_tointeger(L, 3);
} else if (lua_key_eq(s, surround)) {
surround(n) = (halfword) lua_tointeger(L, 3);
+ /* glue */
+ } else if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
} else {
return nodelib_cantset(L, n, s);
}
@@ -6406,6 +6387,20 @@ static int lua_nodelib_direct_setfield(lua_State * L)
} else {
return nodelib_cantset(L, n, s);
}
+ } else if (t == glue_spec_node) {
+ if (lua_key_eq(s, width)) {
+ width(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch)) {
+ stretch(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink)) {
+ shrink(n) = (halfword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, stretch_order)) {
+ stretch_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else if (lua_key_eq(s, shrink_order)) {
+ shrink_order(n) = (quarterword) lua_tointeger(L, 3);
+ } else {
+ return nodelib_cantset(L, n, s);
+ }
} else {
return luaL_error(L, "You can't assign to this %s node (%d)\n", node_data[t].name, n);
}
@@ -6689,17 +6684,16 @@ static int lua_nodelib_effective_glue(lua_State * L)
if ((glue == NULL) || (type(*glue) != glue_node)) {
lua_pushnil(L) ;
} else {
- halfword s = glue_ptr(*glue);
- int w = width(s) ;
+ int w = width(*glue) ;
parent = lua_touserdata(L, 2);
if ((parent != NULL) && ((type(*parent) == hlist_node) || (type(*parent) == vlist_node))) {
if ((int)glue_sign(*parent) == 1) {
- if (stretch_order(s) == glue_order(*parent)) {
- w += stretch(s) * glue_set(*parent);
+ if (stretch_order(*glue) == glue_order(*parent)) {
+ w += stretch(*glue) * glue_set(*parent);
}
} else if (glue_sign(*parent) == 2) {
- if (shrink_order(s) == glue_order(*parent)) {
- w -= shrink(s) * glue_set(*parent);
+ if (shrink_order(*glue) == glue_order(*parent)) {
+ w -= shrink(*glue) * glue_set(*parent);
}
}
}
@@ -6715,17 +6709,16 @@ static int lua_nodelib_direct_effective_glue(lua_State * L)
if ((glue == null) || (type(glue) != glue_node)) {
lua_pushnil(L) ;
} else {
- halfword s = glue_ptr(glue);
- int w = width(s) ;
+ int w = width(glue) ;
halfword parent = lua_tointeger(L, 2);
if ((parent != null) && ((type(parent) == hlist_node) || (type(parent) == vlist_node))) {
if ((int)glue_sign(parent) == 1) {
- if (stretch_order(s) == glue_order(parent)) {
- w += stretch(s) * glue_set(parent);
+ if (stretch_order(glue) == glue_order(parent)) {
+ w += stretch(glue) * glue_set(parent);
}
} else if (glue_sign(parent) == 2) {
- if (shrink_order(s) == glue_order(parent)) {
- w -= shrink(s) * glue_set(parent);
+ if (shrink_order(glue) == glue_order(parent)) {
+ w -= shrink(glue) * glue_set(parent);
}
}
}
@@ -6830,6 +6823,9 @@ static const struct luaL_Reg direct_nodelib_f[] = {
/* {"types", lua_nodelib_types}, */ /* no node argument */
{"unprotect_glyphs", lua_nodelib_direct_unprotect_glyphs},
{"unset_attribute", lua_nodelib_direct_unset_attribute},
+ {"setglue",lua_nodelib_direct_set_glue},
+ {"getglue",lua_nodelib_direct_get_glue},
+ {"is_zero_glue",lua_nodelib_direct_is_zero_glue},
{"usedlist", lua_nodelib_direct_usedlist},
{"vpack", lua_nodelib_direct_vpack},
/* {"whatsits", lua_nodelib_whatsits}, */ /* no node argument */
@@ -6910,6 +6906,9 @@ static const struct luaL_Reg nodelib_f[] = {
{"types", lua_nodelib_types},
{"unprotect_glyphs", lua_nodelib_unprotect_glyphs},
{"unset_attribute", lua_nodelib_unset_attribute},
+ {"setglue",lua_nodelib_set_glue},
+ {"getglue",lua_nodelib_get_glue},
+ {"is_zero_glue",lua_nodelib_is_zero_glue},
{"usedlist", lua_nodelib_usedlist},
{"vpack", lua_nodelib_vpack},
{"whatsits", lua_nodelib_whatsits},
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index b4bd9a3a63c..84627b2dc3f 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -890,6 +890,54 @@ static int getskip(lua_State * L)
return 1;
}
+static int setglue(lua_State * L)
+{
+ int isglobal = 0;
+ int index = 1;
+ halfword value = copy_node(zero_glue);
+ int top = lua_gettop(L);
+ check_item_global(L,top,isglobal);
+ if (isglobal) {
+ index = 2;
+ top -= 1;
+ }
+ /* [global] slot [width] [stretch] [shrink] [stretch_order] [shrink_order] */
+ if (top > 1) {
+ width(value) = lua_tointeger(L,index+1);
+ }
+ if (top > 2) {
+ stretch(value) = lua_tointeger(L,index+2);
+ }
+ if (top > 3) {
+ shrink(value) = lua_tointeger(L,index+3);
+ }
+ if (top > 4) {
+ stretch_order(value) = lua_tointeger(L,index+4);
+ }
+ if (top > 5) {
+ shrink_order(value) = lua_tointeger(L,index+5);
+ }
+ set_item_index_plus(L, index, skip_base, "skip", value, isglobal, is_glue_assign, set_tex_skip_register, true);
+ return 0;
+}
+
+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);
+ if (value == null) {
+ lua_pushnil(L);
+ return 1;
+ } else {
+ lua_pushinteger(L,width(value));
+ lua_pushinteger(L,stretch(value));
+ lua_pushinteger(L,shrink(value));
+ lua_pushinteger(L,stretch_order(value));
+ lua_pushinteger(L,shrink_order(value));
+ return 5;
+ }
+}
+
static int ismuskip(lua_State * L)
{
check_register(mu_skip_base);
@@ -914,6 +962,54 @@ static int getmuskip(lua_State * L)
return 1;
}
+static int setmuglue(lua_State * L)
+{
+ int isglobal = 0;
+ int index = 1;
+ halfword value = copy_node(zero_glue);
+ int top = lua_gettop(L);
+ check_item_global(L,top,isglobal);
+ if (isglobal) {
+ index = 2;
+ top -= 1;
+ }
+ /* [global] slot [width] [stretch] [shrink] [stretch_order] [shrink_order] */
+ if (top > 1) {
+ width(value) = lua_tointeger(L,index+1);
+ }
+ if (top > 2) {
+ stretch(value) = lua_tointeger(L,index+2);
+ }
+ if (top > 3) {
+ shrink(value) = lua_tointeger(L,index+3);
+ }
+ if (top > 4) {
+ stretch_order(value) = lua_tointeger(L,index+4);
+ }
+ if (top > 5) {
+ shrink_order(value) = lua_tointeger(L,index+5);
+ }
+ set_item_index_plus(L, index, mu_skip_base, "muskip", value, isglobal, is_mu_glue_assign, set_tex_mu_skip_register, true);
+ return 0;
+}
+
+static int getmuglue(lua_State * L)
+{
+ int value = 0;
+ get_item_index_plus(L, lua_gettop(L), mu_skip_base, "muskip", value, is_mu_glue_assign, get_tex_mu_skip_register, true);
+ if (value == null) {
+ lua_pushnil(L);
+ return 1;
+ } else {
+ lua_pushinteger(L,width(value));
+ lua_pushinteger(L,stretch(value));
+ lua_pushinteger(L,shrink(value));
+ lua_pushinteger(L,stretch_order(value));
+ lua_pushinteger(L,shrink_order(value));
+ return 5;
+ }
+}
+
static int iscount(lua_State * L)
{
check_register(count_base);
@@ -2869,9 +2965,13 @@ static const struct luaL_Reg texlib[] = {
{ "isskip", isskip },
{ "setskip", setskip },
{ "getskip", getskip },
+ { "setglue", setglue },
+ { "getglue", getglue },
{ "ismuskip", ismuskip },
{ "setmuskip", setmuskip },
{ "getmuskip", getmuskip },
+ { "setmuglue", setmuglue },
+ { "getmuglue", getmuglue },
{ "isattribute", isattribute },
{ "setattribute", setattribute },
{ "getattribute", getattribute },
@@ -2945,7 +3045,9 @@ int luaopen_tex(lua_State * L)
/* *INDENT-OFF* */
make_table(L, "attribute", "tex.attribute", "getattribute", "setattribute");
make_table(L, "skip", "tex.skip", "getskip", "setskip");
+ make_table(L, "glue", "tex.glue", "getglue", "setglue");
make_table(L, "muskip", "tex.muskip", "getmuskip", "setmuskip");
+ make_table(L, "muglue", "tex.muglue", "getmuglue", "setmuglue");
make_table(L, "dimen", "tex.dimen", "getdimen", "setdimen");
make_table(L, "count", "tex.count", "getcount", "setcount");
make_table(L, "toks", "tex.toks", "gettoks", "settoks");
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index 8802253c199..07bfcba5a70 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -556,7 +556,6 @@ make_lua_key(disc);\
make_lua_key(display);\
make_lua_key(doublehyphendemerits);\
make_lua_key(down);\
-make_lua_key(dvi_ptr);\
make_lua_key(embedding);\
make_lua_key(emergencystretch);\
make_lua_key(empty_string);\
@@ -756,7 +755,6 @@ 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(split_discards_head);\
make_lua_key(split_keep);\
@@ -815,7 +813,6 @@ make_lua_key(visiblefilename);\
make_lua_key(vtop);\
make_lua_key(widowpenalty);\
make_lua_key(width);\
-make_lua_key(writable);\
make_lua_key(x_height);\
make_lua_key(xadvance);\
make_lua_key(xformresources);\
@@ -922,7 +919,6 @@ init_lua_key(disc);\
init_lua_key(display);\
init_lua_key(doublehyphendemerits);\
init_lua_key(down);\
-init_lua_key(dvi_ptr);\
init_lua_key(embedding);\
init_lua_key(emergencystretch);\
init_lua_key(encodingbytes);\
@@ -1112,7 +1108,6 @@ 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(split_discards_head);\
init_lua_key(split_keep);\
@@ -1170,7 +1165,6 @@ init_lua_key(visiblefilename);\
init_lua_key(vtop);\
init_lua_key(widowpenalty);\
init_lua_key(width);\
-init_lua_key(writable);\
init_lua_key(x_height);\
init_lua_key(xadvance);\
init_lua_key(xformresources);\
@@ -1334,7 +1328,6 @@ use_lua_key(disc);
use_lua_key(display);
use_lua_key(doublehyphendemerits);
use_lua_key(down);
-use_lua_key(dvi_ptr);
use_lua_key(embedding);
use_lua_key(emergencystretch);
use_lua_key(empty_string);
@@ -1534,7 +1527,6 @@ 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(split_discards_head);
use_lua_key(split_keep);
@@ -1593,7 +1585,6 @@ use_lua_key(visiblefilename);
use_lua_key(vtop);
use_lua_key(widowpenalty);
use_lua_key(width);
-use_lua_key(writable);
use_lua_key(x_height);
use_lua_key(xadvance);
use_lua_key(xformresources);