summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex/texnodes.w
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex/texnodes.w')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.w33
1 files changed, 26 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
index de718139923..698fb76e82d 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w
@@ -473,8 +473,7 @@ important, don't keep resolving the registry index.
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); \
+ lua_get_metatablelua_l(Luas,node_properties); \
} \
} \
} while(0)
@@ -497,8 +496,7 @@ important, don't keep resolving the registry index.
#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_get_metatablelua_l(Luas,node_properties); \
lua_pushnil(Luas); \
lua_rawseti(Luas,-2,target); \
lua_pop(Luas,1); \
@@ -549,8 +547,7 @@ important, don't keep resolving the registry index.
#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_get_metatablelua_l(Luas,node_properties); \
lua_rawgeti(Luas,-1,source); \
if (lua_type(Luas,-1)==LUA_TTABLE) { \
if (lua_properties_use_metatable) { \
@@ -3708,8 +3705,9 @@ the \.{WEB} macro definitions above, so that format changes will leave
@c
-halfword make_local_par_node(void)
+halfword make_local_par_node(int mode)
{
+ int callback_id;
halfword q;
halfword p = new_node(local_par_node,0);
local_pen_inter(p) = local_inter_line_penalty;
@@ -3725,5 +3723,26 @@ halfword make_local_par_node(void)
local_box_right_width(p) = width(local_right_box);
}
local_par_dir(p) = par_direction;
+ /* callback with node passed */
+ callback_id = callback_defined(insert_local_par_callback);
+ if (callback_id > 0) {
+ int sfix = lua_gettop(Luas);
+ if (!get_callback(Luas, callback_id)) {
+ lua_settop(Luas, sfix);
+ return p;
+ }
+ nodelist_to_lua(Luas, p);
+ lua_push_local_par_mode(Luas,mode)
+ if (lua_pcall(Luas, 2, 0, 0) != 0) { /* 2 arg, 0 result */
+ char errmsg[256]; /* temp hack ... we will have a formatted error */
+ snprintf(errmsg, 255, "error: %s\n", lua_tostring(Luas, -1));
+ errmsg[255]='\0';
+ lua_settop(Luas, sfix);
+ normal_error("insert_local_par",errmsg); /* to be done */
+ return p;
+ }
+ lua_settop(Luas, sfix);
+ }
+ /* done */
return p;
}