summaryrefslogtreecommitdiff
path: root/tex/context/base/typo-dub.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-05-03 13:55:34 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-05-03 13:55:34 +0200
commit624cbb5da392e9403984dd1cf368c0d408b1c2a8 (patch)
tree489c049ac849bb5bbce7d32e4df477872c58373d /tex/context/base/typo-dub.lua
parent088de88944c1f2254250bb448c7371a87ff7ee39 (diff)
downloadcontext-624cbb5da392e9403984dd1cf368c0d408b1c2a8.tar.gz
2014-01-03 00:42:00
Diffstat (limited to 'tex/context/base/typo-dub.lua')
-rw-r--r--tex/context/base/typo-dub.lua79
1 files changed, 32 insertions, 47 deletions
diff --git a/tex/context/base/typo-dub.lua b/tex/context/base/typo-dub.lua
index 4dc0f21fb..3ecfce364 100644
--- a/tex/context/base/typo-dub.lua
+++ b/tex/context/base/typo-dub.lua
@@ -54,25 +54,11 @@ local directiondata = characters.directions
local mirrordata = characters.mirrors
local textclassdata = characters.textclasses
-local nuts = nodes.nuts
-local tonut = nuts.tonut
-local tonode = nuts.tonode
-local nutstring = nuts.tostring
-
-local getnext = nuts.getnext
-local getchar = nuts.getchar
-local getid = nuts.getid
-local getsubtype = nuts.getsubtype
-local getlist = nuts.getlist
-local getattr = nuts.getattr
-local getfield = nuts.getfield
-local setfield = nuts.setfield
-
-local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-
-local nodepool = nuts.pool
+local remove_node = nodes.remove
+local insert_node_after = nodes.insert_after
+local insert_node_before = nodes.insert_before
+
+local nodepool = nodes.pool
local new_textdir = nodepool.textdir
local nodecodes = nodes.nodecodes
@@ -256,17 +242,17 @@ local function build_list(head) -- todo: store node pointer ... saves loop
local size = 0
while current do
size = size + 1
- local id = getid(current)
+ local id = current.id
if id == glyph_code then
- local chr = getchar(current)
+ local chr = current.char
local dir = directiondata[chr]
list[size] = { char = chr, direction = dir, original = dir, level = 0 }
- current = getnext(current)
+ current = current.next
elseif id == glue_code then
list[size] = { char = 0x0020, direction = "ws", original = "ws", level = 0 }
- current = getnext(current)
- elseif id == whatsit_code and getsubtype(current) == dir_code then
- local dir = getfield(current,"dir")
+ current = current.next
+ elseif id == whatsit_code and current.subtype == dir_code then
+ local dir = current.dir
if dir == "+TLT" then
list[size] = { char = 0x202A, direction = "lre", original = "lre", level = 0 }
elseif dir == "+TRT" then
@@ -276,27 +262,27 @@ local function build_list(head) -- todo: store node pointer ... saves loop
else
list[size] = { char = 0xFFFC, direction = "on", original = "on", level = 0, id = id } -- object replacement character
end
- current = getnext(current)
+ current = current.next
elseif id == math_code then
local skip = 0
- current = getnext(current)
- while getid(current) ~= math_code do
+ current = current.next
+ while current.id ~= math_code do
skip = skip + 1
- current = getnext(current)
+ current = current.next
end
skip = skip + 1
- current = getnext(current)
+ current = current.next
list[size] = { char = 0xFFFC, direction = "on", original = "on", level = 0, skip = skip, id = id }
else
local skip = 0
local last = id
- current = getnext(current)
+ current = current.next
while n do
- local id = getid(current)
- if id ~= glyph_code and id ~= glue_code and not (id == whatsit_code and getsubtype(current) == dir_code) then
+ local id = current.id
+ if id ~= glyph_code and id ~= glue_code and not (id == whatsit_code and current.subtype == dir_code) then
skip = skip + 1
last = id
- current = getnext(current)
+ current = current.next
else
break
end
@@ -379,8 +365,8 @@ end
-- the action
local function get_baselevel(head,list,size) -- todo: skip if first is object (or pass head and test for local_par)
- if getid(head) == whatsit_code and getsubtype(head) == localpar_code then
- if getfield(head,"dir") == "TRT" then
+ if head.id == whatsit_code and head.subtype == localpar_code then
+ if head.dir == "TRT" then
return 1, "TRT", true
else
return 0, "TLT", true
@@ -799,30 +785,30 @@ local function apply_to_list(list,size,head,pardir)
report_directions("fatal error, size mismatch")
break
end
- local id = getid(current)
+ local id = current.id
local entry = list[index]
local begindir = entry.begindir
local enddir = entry.enddir
if id == glyph_code then
local mirror = entry.mirror
if mirror then
- setfield(current,"char",mirror)
+ current.char = mirror
end
if trace_directions then
local direction = entry.direction
setcolor(current,direction,direction ~= entry.original,mirror)
end
elseif id == hlist_code or id == vlist_code then
- setfield(current,"dir",pardir) -- is this really needed?
+ current.dir = pardir -- is this really needed?
elseif id == glue_code then
- if enddir and getsubtype(current) == parfillskip_code then
+ if enddir and current.subtype == parfillskip_code then
-- insert the last enddir before \parfillskip glue
head = insert_node_before(head,current,new_textdir(enddir))
enddir = false
done = true
end
elseif id == whatsit_code then
- if begindir and getsubtype(current) == localpar_code then
+ if begindir and current.subtype == localpar_code then
-- local_par should always be the 1st node
head, current = insert_node_after(head,current,new_textdir(begindir))
begindir = nil
@@ -836,7 +822,7 @@ local function apply_to_list(list,size,head,pardir)
local skip = entry.skip
if skip and skip > 0 then
for i=1,skip do
- current = getnext(current)
+ current = current.next
end
end
if enddir then
@@ -844,13 +830,13 @@ local function apply_to_list(list,size,head,pardir)
done = true
end
if not entry.remove then
- current = getnext(current)
+ current = current.next
elseif remove_controls then
-- X9
head, current = remove_node(head,current,true)
done = true
else
- current = getnext(current)
+ current = current.next
end
index = index + 1
end
@@ -858,9 +844,8 @@ local function apply_to_list(list,size,head,pardir)
end
local function process(head)
- head = tonut(head)
-- for the moment a whole paragraph property
- local attr = getattr(head,a_directions)
+ local attr = head[a_directions]
local analyze_fences = getfences(attr)
--
local list, size = build_list(head)
@@ -879,7 +864,7 @@ local function process(head)
report_directions("result : %s",show_done(list,size))
end
head, done = apply_to_list(list,size,head,pardir)
- return tonode(head), done
+ return head, done
end
directions.installhandler(interfaces.variables.two,process)