-local function init_var(mode)
- -- 1073741823: max_dimen
- Bp, widow_Bp, widow_Np = {}, {}, {first = nil}
- table_current_stack = ltjs.table_current_stack
-
- kanji_skip = node_new(id_glue)
- kanji_skip.spec = skip_table_to_spec('kanjiskip')
- set_attr(kanji_skip, attr_icflag, KANJI_SKIP)
- get_kanjiskip = (kanji_skip.spec.width == 1073741823)
- and get_kanjiskip_jfm or get_kanjiskip_normal
-
- xkanji_skip = node_new(id_glue)
- xkanji_skip.spec = skip_table_to_spec('xkanjiskip')
- set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP)
- get_xkanjiskip = (xkanji_skip.spec.width == 1073741823)
- and get_xkanjiskip_jfm or get_xkanjiskip_normal
-
- Np = {
- auto_kspc=nil, auto_xspc=nil, char=nil, class=nil,
- first=nil, id=nil, last=nil, met=nil, nuc=nil,
- post=nil, pre=nil, xspc=nil,
- }
- Nq = {
- auto_kspc=nil, auto_xspc=nil, char=nil, class=nil,
- first=nil, id=nil, last=nil, met=nil, nuc=nil,
- post=nil, pre=nil, xspc=nil,
- }
- if mode then
- -- the current list is to be line-breaked:
- -- hbox from \parindent is skipped.
- local lp, par_indented, lpi, lps = head, 'boxbdd', head.id, head.subtype
- while lp and ((lpi==id_whatsit and lps~=sid_user)
- or ((lpi==id_hlist) and (lps==3))) do
- if (lpi==id_hlist) and (lps==3) then par_indented = 'parbdd' end
- lp=node_next(lp); lpi, lps = lp.id, lp.subtype end
- return lp, node.tail(head), par_indented
- else
- -- the current list is the contents of a hbox:
- -- insert a sentinel
- local g = node_new(id_kern)
- node.insert_after(head, node.tail(head), g); last = g
- return head, g, 'boxbdd'
+local init_var
+do
+ local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP
+ local XKANJI_SKIP = luatexja.icflag_table.XKANJI_SKIP
+ local KSK = luatexja.stack_table_index.KSK
+ local XSK = luatexja.stack_table_index.XSK
+ local dir_yoko = luatexja.dir_table.dir_yoko
+ init_var = function (mode)
+ -- 1073741823: max_dimen
+ Bp, widow_Bp, widow_Np = {}, {}, {first = nil}
+ table_current_stack = ltjs.table_current_stack
+
+ list_dir = ltjs.list_dir or dir_yoko
+ kanji_skip = node_new(id_glue)
+ setfield(kanji_skip, 'spec', skip_table_to_spec(KSK))
+ set_attr(kanji_skip, attr_icflag, KANJI_SKIP)
+ get_kanjiskip = (getfield(getfield(kanji_skip, 'spec'), 'width') == 1073741823)
+ and get_kanjiskip_jfm or get_kanjiskip_normal
+
+ xkanji_skip = node_new(id_glue)
+ setfield(xkanji_skip, 'spec', skip_table_to_spec(XSK))
+ set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP)
+ get_xkanjiskip = (getfield(getfield(xkanji_skip, 'spec'), 'width') == 1073741823)
+ and get_xkanjiskip_jfm or get_xkanjiskip_normal
+
+ Np = {
+ auto_kspc=nil, auto_xspc=nil, char=nil, class=nil,
+ first=nil, id=nil, last=nil, met=nil, nuc=nil,
+ post=nil, pre=nil, xspc=nil,
+ }
+ Nq = {
+ auto_kspc=nil, auto_xspc=nil, char=nil, class=nil,
+ first=nil, id=nil, last=nil, met=nil, nuc=nil,
+ post=nil, pre=nil, xspc=nil,
+ }
+ if mode then
+ -- the current list is to be line-breaked:
+ -- hbox from \parindent is skipped.
+ local lp, par_indented, lpi, lps = head, 'boxbdd', getid(head), getsubtype(head)
+ while lp and ((lpi==id_whatsit and lps~=sid_user)
+ or ((lpi==id_hlist) and (lps==3))) do
+ if (lpi==id_hlist) and (lps==3) then
+ Np.char, par_indented = 'parbdd', 'parbdd'
+ Np.width = getfield(lp, 'width')
+ end
+ lp=node_next(lp); lpi, lps = getid(lp), getsubtype(lp) end
+ return lp, node_tail(head), par_indented
+ else
+ return head, nil, 'boxbdd'
+ end