local sid_save = node.subtype 'pdf_save'
local sid_user = node.subtype 'user_defined'
+local getnest = tex.getnest
local tex_nest = tex.nest
local tex_getcount = tex.getcount
local ensure_tex_attr = ltjb.ensure_tex_attr
end
function get_dir_count()
for i=tex_nest.ptr, 1, -1 do
- local h = tex_nest[i].head.next
+ local h = getnest(i).head.next
if h then
local t = get_dir_count_inner(h)
if t~=0 then return t end
end
function get_adjust_dir_count()
for i=tex_nest.ptr, 1, -1 do
- local v = tex_nest[i]
+ local v = getnest(i)
local h, m = v.head.next, v.mode
if abs(m)== ltjs.vmode and h then
local t = get_dir_count_inner(h)
local node_next_node, node_tail_node = node.next, node.tail
local insert_after_node = node.insert_after
function luatexja.direction.set_list_direction_hook(v)
- local lv = tex_nest.ptr -- must be >= 1
if not v then
v = get_dir_count()
- if abs(tex_nest[lv-1].mode) == ltjs.mmode and v == dir_tate then
+ if abs(getnest(tex_nest.ptr-1).mode) == ltjs.mmode and v == dir_tate then
v = dir_utod
end
elseif v=='adj' then
v = get_adjust_dir_count()
end
- local h = tex_nest[lv].head
+ local h = getnest().head
local hn = node.next(h)
hn = (hn and hn.id==id_local) and hn or h
local w = to_node(dir_pool[v]())
insert_after_node(h, hn, w)
- tex_nest[lv].tail = node_tail_node(w)
+ getnest().tail = node_tail_node(w)
ensure_tex_attr(attr_icflag, 0)
ensure_tex_attr(attr_dir, 0)
end
local lv = tex_nest.ptr
if not v then
v,name = get_dir_count(), nil
- if lv>=1 and abs(tex_nest[lv-1].mode) == ltjs.mmode and v == dir_tate then
+ if lv>=1 and abs(getnest(lv-1).mode) == ltjs.mmode and v == dir_tate then
v = dir_utod
end
elseif v=='adj' then
v,name = get_adjust_dir_count(), nil
end
- local current_nest = tex_nest[lv]
+ local current_nest = getnest()
if tex.currentgrouptype==6 then
ltjb.package_error(
'luatexja',
local id_glue = node.id 'glue'
local function lastbox_hook()
start_time_measure 'box_primitive_hook'
- local bn = tex_nest[tex_nest.ptr].tail
+ local bn = getnest().tail
if bn then
- local b, head = to_direct(bn), to_direct(tex_nest[tex_nest.ptr].head)
+ local b, head = to_direct(bn), to_direct(getnest().head)
local bid = getid(b)
if bid==id_hlist or bid==id_vlist then
local p = getlist(b)
if box_dir>= dir_node_auto then -- unwrap dir_node
local p = node_prev(b)
local dummy1, dummy2, nb = unwrap_dir_node(b, nil, box_dir)
- setnext(p, nb); tex_nest[tex_nest.ptr].tail = to_node(nb)
+ setnext(p, nb); getnest().tail = to_node(nb)
setnext(b, nil); setlist(b, nil)
node_free(b); b = nb
end
function luatexja.direction.check_adjust_direction()
start_time_measure 'box_primitive_hook'
local list_dir = get_adjust_dir_count()
- local a = tex_nest[tex_nest.ptr].tail
+ local a = getnest().tail
local ad = to_direct(a)
if a and getid(ad)==id_adjust then
local adj_dir = get_box_dir(ad)
function luatexja.direction.populate_insertion_dir_whatsit()
start_time_measure 'box_primitive_hook'
local list_dir = get_dir_count()
- local a = tex_nest[tex_nest.ptr].tail
+ local a = getnest().tail
local ad = to_direct(a)
if (not a) or getid(ad)~=id_ins then
a = node.tail(tex.lists.page_head); ad = to_direct(a)
local attr_yablshift = luatexbase.attributes['ltj@yablshift']
local attr_tablshift = luatexbase.attributes['ltj@tablshift']
local getcount, abs, scan_keyword = tex.getcount, math.abs, token.scan_keyword
- local tex_nest = tex.nest
+ local getnest = tex.getnest
local tex_getattr = tex.getattribute
local get_current_jfont
do
-- * (X)KANJI_SKIP(_JFM): その場で値が決まっている
-- * PROCESSED_BEGIN_FLAG + (X)KANJI_SKIP: 段落終了時に決める
local function insert_k_skip_common(ind, name, ica, icb)
- if abs(tex_nest[tex_nest.ptr].mode) ~= ltjs.hmode then return end
+ if abs(getnest().mode) ~= ltjs.hmode then return end
local g = node_new(id_glue); set_attr(g, attr_icflag, SPECIAL_JAGLUE)
local is_late = scan_keyword("late")
if not is_late then
local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
local ensure_tex_attr = ltjb.ensure_tex_attr
local node_write = node.direct.write
- local fonts, tex_nest = font.fonts, tex.nest
+ local fonts, getnest = font.fonts, tex.getnest
local new_ic_kern = function(g) return node_new(id_kern,3) end
local dir_tate = luatexja.dir_table.dir_tate
-- EXT: italic correction
function luatexja.jfont.append_italic()
- local p = to_direct(tex_nest[tex_nest.ptr].tail)
+ local p = to_direct(getnest().tail)
local TEMP = node_new(id_kern)
if p and getid(p)==id_glyph then
if is_ucs_in_japanese_char(p) then
local get_dir_count = luatexja.direction.get_dir_count
local getwhd = node.direct.getwhd
local setnext = node.direct.setnext
-local tex_nest = tex.nest
+local getnest = tex.getnest
local function dir_adjust_append_vlist(b, loc, prev, mirrored)
local old_b = to_direct(b)
local bw = texget('baselineskip', false)
local normal = bw - prev - (mirrored and dp or ht)
local lmin, adj = nil, 0
- local tail = to_direct(tex_nest[tex_nest.ptr].tail)
+ local tail = to_direct(getnest().tail)
if p_dummy~=ltj_profiler then
while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do
tail = node_prev(tail)
--
luatexbase.provides_module({
name = 'luatexja.stack',
- date = '2022-08-17',
+ date = '2022-08-20',
description = 'LuaTeX-ja stack system',
})
luatexja.stack = {}
local fastcopy = table.fastcopy
local setcount, getcount = tex.setcount, tex.getcount
local scan_int, scan_keyword = token.scan_int, token.scan_keyword
-local tex_nest = tex.nest
+local getnest = tex.getnest
ltjs.hmode = 0 -- dummy
local charprop_stack_table={}
charprop_stack_table[i] = fastcopy(charprop_stack_table[i-1])
setcount('ltj@@stack', i)
if gd~=0 then tex.globaldefs = gd end
- if tex_nest[tex_nest.ptr].mode == -ltjs.hmode then -- rest. hmode のみ
+ if getnest().mode == -ltjs.hmode then -- rest. hmode のみ
local g = node_new(id_whatsit, sid_user)
g.user_id=STCK; g.type=100; g.value=j; node.write(g)
end
\setbox\z@\hbox{%
\directlua{% This value depends on the version of LuaTeX.
- luatexja.stack.hmode = -tex.nest[tex.nest.ptr].mode
+ luatexja.stack.hmode = -tex.getnest().mode
}%
}
\setbox\z@\vbox{%
\directlua{% This value depends on the version of LuaTeX.
- luatexja.stack.vmode = -tex.nest[tex.nest.ptr].mode
+ luatexja.stack.vmode = -tex.getnest().mode
}%
}
\setbox\z@\box\voidb@x
\setbox\z@\hbox{%
\primitive\everymath{}%
$\directlua{% This value depends on the version of LuaTeX.
- luatexja.stack.mmode = -tex.nest[tex.nest.ptr].mode
+ luatexja.stack.mmode = -tex.getnest().mode
}$%
}
\setbox\z@\box\voidb@x
end,
direction = function()
local v = ltjd.get_dir_count()
- if math.abs(tex.nest[tex.nest.ptr].mode) == ltjs.mmode and v == dir_table.dir_tate then
+ if math.abs(tex.getnest().mode) == ltjs.mmode and v == dir_table.dir_tate then
v = dir_table.dir_utod
end
return v
-- lastnodechar
do
+ local getnest = tex.getnest
local id_glyph = node.id('glyph')
function luatexja.pltx_composite_last_node_char()
- local n = tex.nest[tex.nest.ptr].tail
+ local n = getnest()
local r = '-1'
if n then
if n.id==id_glyph then
- while n.componetns and n.subtype and n.subtype%4 >= 2 do
+ while n.components and n.subtype and n.subtype%4 >= 2 do
n = node.tail(n)
end
r = tostring(n.char)