OSDN Git Service

Compatibility with LuaTeX 0.76.0
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 1 Feb 2014 23:06:22 +0000 (08:06 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 1 Feb 2014 23:06:22 +0000 (08:06 +0900)
src/ltj-adjust.lua
src/ltj-jfmglue.lua
src/ltj-math.lua
src/ltj-otf.lua
src/ltj-pretreat.lua
src/ltj-setwidth.lua
src/luatexja.lua

index 09125a1..5c0a781 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.adjust',
-  date = '2014/02/01',
+  date = '2014/02/02',
   description = 'Advanced line adjustment for LuaTeX-ja',
 })
 module('luatexja.adjust', package.seeall)
@@ -29,9 +29,9 @@ local node_traverse_id = Dnode.traverse_id
 local node_new = Dnode.new
 local node_copy = Dnode.copy
 local node_hpack = Dnode.hpack
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local node_free = Dnode.free
-local node_prev = Dnode.getprev
+local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev
 local node_tail = Dnode.tail
 local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
index 8946027..bd308a5 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfmglue',
-  date = '2014/02/01',
+  date = '2014/02/02',
   description = 'Insertion process of JFM glues and kanjiskip',
 })
 module('luatexja.jfmglue', package.seeall)
@@ -31,7 +31,7 @@ local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
 local insert_before = Dnode.insert_before
 local insert_after = Dnode.insert_after
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local round = tex.round
 local ltjf_font_metric_table = ltjf.font_metric_table
 local ltjf_find_char_class = ltjf.find_char_class
@@ -271,7 +271,7 @@ local function set_attr_icflag_processed(p)
 end
 
 local function check_next_ickern(lp)
-   if getid(lp) == id_kern and ITALIC == get_attr_icflag(lp) then
+   if lp and getid(lp) == id_kern and ITALIC == get_attr_icflag(lp) then
       set_attr(lp, attr_icflag, IC_PROCESSED)
       Np.last = lp; return node_next(lp)
    else 
@@ -284,7 +284,7 @@ local function calc_np_pbox(lp)
    local lpa, nc = KINSOKU, nil
    set_attr(lp, attr_icflag, get_attr_icflag(lp));
    while lp and (lpa>=PACKED) and (lpa<BOXBDD) do
-      nc, lp = lp, node_next(lp); lpa = has_attr(lp, attr_icflag) or 0
+      nc, lp = lp, node_next(lp); lpa = lp and has_attr(lp, attr_icflag) or 0
      -- get_attr_icflag() ではいけない!
    end
    Np.nuc = nc
@@ -974,7 +974,7 @@ end
 function main(ahead, mode)
    if not ahead then return ahead end
    head = ahead;
-   local lp, par_indented = init_var(mode)
+   local lp, par_indented = init_var(mode)
    lp = calc_np(lp, last)
    if Np then 
       extract_np(); handle_list_head(par_indented)
@@ -1006,7 +1006,7 @@ end
 do
    local IHB  = luatexja.userid_table.IHB
    local BPAR = luatexja.userid_table.BPAR
-   local node_prev = Dnode.getprev
+   local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev
    local node_write = Dnode.write
 
    -- \inhibitglue
index 6bf7031..04b5b92 100644 (file)
@@ -22,7 +22,7 @@ local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc
 
 local node_traverse = Dnode.traverse
 local node_new = Dnode.new
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local node_free = Dnode.free
 local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
index 0904854..f84faa4 100644 (file)
@@ -29,7 +29,7 @@ local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc
 
 local node_new = Dnode.new
 local node_remove = luatexja.Dnode_remove -- Dnode.remove
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local node_free = Dnode.free
 local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
index 387fcc8..14cec98 100644 (file)
@@ -25,7 +25,7 @@ local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
 local node_traverse = Dnode.traverse
 local node_remove =luatexja.Dnode_remove -- Dnode.remove
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local node_free = Dnode.free
 local node_end_of_math = Dnode.end_of_math
 local tex_getcount = tex.getcount
index ebd7393..30389e2 100644 (file)
@@ -18,7 +18,7 @@ local node_traverse = Dnode.traverse
 local node_new = Dnode.new
 local node_remove = luatexja.Dnode_remove -- Dnode.remove
 local node_tail = Dnode.tail
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
 local has_attr = Dnode.has_attribute
 local set_attr = Dnode.set_attribute
 local node_insert_before = Dnode.insert_before
index 075b3f1..f99d076 100644 (file)
@@ -74,21 +74,25 @@ do
    end
 
    local Dnode = node.direct or node
-   local Dnode_remove, Dnode_next, Dnode_prev = Dnode.remove, Dnode.getnext, Dnode.getprev
-   local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end
-   local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end
-   function luatexja.Dnode_remove (head, current)
-      if head==current then
-        local q, r = Dnode_next(current), Dnode_prev(current)
-        setfield(current, 'next', nil)
-        if q then setfield(q, 'prev', r) end
-        if r and Dnode_next(r) == current then -- r is "real prev"
-           setfield(r, 'next', q)
+   if Dnode~=node then
+      local Dnode_remove = Dnode.remove
+      local Dnode_next, Dnode_prev = Dnode.getnext, node.getprev
+      local getfield, setfield = Dnode.getfield, Dnode.setfield
+      function luatexja.Dnode_remove (head, current)
+        if head==current then
+           local q, r = Dnode_next(current), Dnode_prev(current)
+           setfield(current, 'next', nil)
+           if q then setfield(q, 'prev', r) end
+           if r and Dnode_next(r) == current then -- r is "real prev"
+              setfield(r, 'next', q)
+           end
+           return q, q
+        else
+           return Dnode_remove(head, current)
         end
-        return q, q
-      else
-        return Dnode_remove(head, current)
       end
+   else
+      luatexja.Dnode_remove = luatexja.node_remove 
    end
 
 end