+userid_table.DIR = luatexbase.newuserwhatsitid('direction', 'luatexja') -- 組方向
+
+local dir_table = {}
+luatexja.dir_table = dir_table
+dir_table.dir_dtou = 1
+dir_table.dir_tate = 3
+dir_table.dir_yoko = 4
+dir_table.dir_node_auto = 16 -- 組方向を合わせるために自動で作られたもの
+dir_table.dir_node_manual = 32 -- 寸法代入によって作られたもの
+
+
+------------------------------------------------------------------------
+-- FIX node.remove
+------------------------------------------------------------------------
+do
+ local node_remove, node_next, node_prev = node.remove, node.next, node.prev
+ function luatexja.node_remove (head, current)
+ if head==current then
+ local q, r = node_next(current), node_prev(current)
+ if q then q.prev = r end
+ if r and node_next(r)==current then
+ r.next = q
+ end
+ return q, q
+ else
+ return node_remove(head, current)
+ end
+ end
+ local Dnode = node.direct or node
+ if Dnode~=node then
+ local Dnode_remove, setfield = Dnode.remove, Dnode.setfield
+ local Dnode_next, Dnode_prev = Dnode.getnext, Dnode.getprev
+ function luatexja.Dnode_remove (head, current)
+ if head==current then
+ local q, r = Dnode_next(current), Dnode_prev(current)
+ if q then setfield(q, 'prev', r) end
+ if r and Dnode_next(r) == current then
+ setfield(r, 'next', q)
+ end
+ return q, q
+ else
+ return Dnode_remove(head, current)
+ end
+ end
+ else
+ luatexja.Dnode_remove = luatexja.node_remove
+ end
+end