summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-05 00:48:46 +0000
committerKarl Berry <karl@freefriends.org>2020-03-05 00:48:46 +0000
commitf210bce174e1f2f05305ab03e88e120a1cbfc4da (patch)
tree5c4e2ad096b5c745e859516ac3196fa0864292d5 /Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua
parent35fd641a3546acc0c62e0aa7f134888e36da30d4 (diff)
context (from cont-tmf.zip of Feb 17 16:00, size 116339406)
git-svn-id: svn://tug.org/texlive/trunk@54086 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua')
-rw-r--r--Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua137
1 files changed, 35 insertions, 102 deletions
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua
index 879da4bc792..be82277bd49 100644
--- a/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua
+++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua
@@ -12,7 +12,7 @@ end
-- Don't depend on code here as it is only needed to complement the font handler
-- code. I will move some to another namespace as I don't see other macro packages
--- use the context logic. It's a subset anyway.
+-- use the context logic. It's a subset anyway. More will be stripped.
-- Attributes:
@@ -73,80 +73,12 @@ nodes.disccodes = disccodes
nodes.handlers.protectglyphs = node.protect_glyphs -- beware: nodes!
nodes.handlers.unprotectglyphs = node.unprotect_glyphs -- beware: nodes!
--- These are now gone in generic as they are context specific.
-
--- local flush_node = node.flush_node
--- local remove_node = node.remove
--- local traverse_id = node.traverse_id
---
--- function nodes.remove(head, current, free_too)
--- local t = current
--- head, current = remove_node(head,current)
--- if t then
--- if free_too then
--- flush_node(t)
--- t = nil
--- else
--- t.next, t.prev = nil, nil
--- end
--- end
--- return head, current, t
--- end
---
--- function nodes.delete(head,current)
--- return nodes.remove(head,current,true)
--- end
-
------ getfield = node.getfield
------ setfield = node.setfield
-
------.getfield = getfield
------.setfield = setfield
------.getattr = getfield
------.setattr = setfield
-
------.tostring = node.tostring or tostring
------.copy = node.copy
------.copy_node = node.copy
------.copy_list = node.copy_list
------.delete = node.delete
------.dimensions = node.dimensions
------.end_of_math = node.end_of_math
------.flush_list = node.flush_list
------.flush_node = node.flush_node
------.flush = node.flush_node
------.free = node.free
------.insert_after = node.insert_after
------.insert_before = node.insert_before
------.hpack = node.hpack
------.new = node.new
------.tail = node.tail
------.traverse = node.traverse
------.traverse_id = node.traverse_id
------.slide = node.slide
------.vpack = node.vpack
-
------.first_glyph = node.first_glyph
------.has_glyph = node.has_glyph or node.first_glyph
------.current_attr = node.current_attr
------.has_field = node.has_field
------.usedlist = node.usedlist
------.protrusion_skippable = node.protrusion_skippable
------.write = node.write
-
------.has_attribute = node.has_attribute
------.set_attribute = node.set_attribute
------.unset_attribute = node.unset_attribute
-
------.protect_glyphs = node.protect_glyphs
------.unprotect_glyphs = node.unprotect_glyphs
------.mlist_to_hlist = node.mlist_to_hlist
-
-- in generic code, at least for some time, we stay nodes, while in context
-- we can go nuts (e.g. experimental); this split permits us us keep code
-- used elsewhere stable but at the same time play around in context
--- much of this will go away
+-- much of this will go away .. it's part of the context interface and not
+-- officially in luatex-*.lua
local direct = node.direct
local nuts = { }
@@ -165,16 +97,13 @@ nuts.getattr = direct.get_attribute
nuts.getboth = direct.getboth
nuts.getchar = direct.getchar
nuts.getcomponents = direct.getcomponents
-----.getdepth = direct.getdepth
-----.getdir = direct.getdir
nuts.getdirection = direct.getdirection
nuts.getdisc = direct.getdisc
+nuts.getreplace = direct.getreplace
nuts.getfield = direct.getfield
nuts.getfont = direct.getfont
-----.getheight = direct.getheight
nuts.getid = direct.getid
nuts.getkern = direct.getkern
-----.getleader = direct.getleader
nuts.getlist = direct.getlist
nuts.getnext = direct.getnext
nuts.getoffsets = direct.getoffsets
@@ -185,15 +114,11 @@ nuts.setattr = direct.setfield
nuts.setboth = direct.setboth
nuts.setchar = direct.setchar
nuts.setcomponents = direct.setcomponents
-----.setdepth = direct.setdepth
-nuts.setdir = direct.setdir
nuts.setdirection = direct.setdirection
nuts.setdisc = direct.setdisc
+nuts.setreplace = direct.setreplace
nuts.setfield = setfield
-----.setfont = direct.setfont
-----.setheight = direct.setheight
nuts.setkern = direct.setkern
-----.setleader = direct.setleader
nuts.setlink = direct.setlink
nuts.setlist = direct.setlist
nuts.setnext = direct.setnext
@@ -203,8 +128,9 @@ nuts.setsplit = direct.setsplit
nuts.setsubtype = direct.setsubtype
nuts.setwidth = direct.setwidth
-nuts.is_char = direct.is_char
-nuts.is_glyph = direct.is_glyph
+nuts.getglyphdata = nuts.getattr
+nuts.setglyphdata = nuts.setattr
+
nuts.ischar = direct.is_char
nuts.isglyph = direct.is_glyph
@@ -230,26 +156,6 @@ nuts.traverse_char = direct.traverse_char
nuts.traverse_glyph = direct.traverse_glyph
nuts.traverse_id = direct.traverse_id
--- for now
-
-if not nuts.getdirection then
-
- local getdir = direct.getdir
-
- function nuts.getdirection(n)
- local d = getdir(n)
- if d == "TLT" then return 0
- elseif d == "TRT" then return 1
- elseif d == "+TLT" then return 0, false
- elseif d == "+TRT" then return 1, false
- elseif d == "-TLT" then return 0, true
- elseif d == "-TRT" then return 1, true
- else return 0
- end
- end
-
-end
-
-- properties as used in the (new) injector:
local propertydata = direct.get_properties_table()
@@ -357,3 +263,30 @@ do
}
end
+
+if not nuts.setreplace then
+
+ local getdisc = nuts.getdisc
+ local setfield = nuts.setfield
+
+ function nuts.getreplace(n)
+ local _, _, h, _, _, t = getdisc(n,true)
+ return h, t
+ end
+
+ function nuts.setreplace(n,h)
+ setfield(n,"replace",h)
+ end
+
+end
+
+do
+
+ local getsubtype = nuts.getsubtype
+
+ function nuts.start_of_par(n)
+ local s = getsubtype(n)
+ return s == 0 or s == 2 -- sorry, hardcoded, won't change anyway
+ end
+
+end