diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-09-11 12:15:06 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-09-11 12:15:06 +0200 |
commit | 31cd4d643836f69279b399acf864474c1283b8f5 (patch) | |
tree | 7e59492e32ef06e57bad0d4a4a953f7e7ba5b058 /tex/context/base/node-nut.lua | |
parent | f28043b96635a0845521fe0094a3863d7ff13b6d (diff) | |
download | context-31cd4d643836f69279b399acf864474c1283b8f5.tar.gz |
2015-09-11 11:05:00
Diffstat (limited to 'tex/context/base/node-nut.lua')
-rw-r--r-- | tex/context/base/node-nut.lua | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua index de03fd433..14ee29a45 100644 --- a/tex/context/base/node-nut.lua +++ b/tex/context/base/node-nut.lua @@ -777,64 +777,57 @@ local propertydata = direct.get_properties_table and direct.get_properties_table local getattr = nuts.getattr local setattr = nuts.setattr -if propertydata then - - nodes.properties = { - data = propertydata, - } +nodes.properties = { + data = propertydata, +} - -- direct.set_properties_mode(true,false) -- shallow copy ... problem: in fonts we then affect the originals too - direct.set_properties_mode(true,true) -- create metatable, slower but needed for font-inj.lua (unless we use an intermediate table) +------.set_properties_mode(true,false) -- shallow copy ... problem: in fonts we then affect the originals too +direct.set_properties_mode(true,true) -- create metatable, slower but needed for font-inj.lua (unless we use an intermediate table) - -- todo: - -- - -- function direct.set_properties_mode() - -- -- we really need the set modes - -- end +-- todo: +-- +-- function direct.set_properties_mode() +-- -- we really need the set modes +-- end - -- experimental code with respect to copying attributes has been removed - -- as it doesn't pay of (most attributes are only accessed once anyway) +-- experimental code with respect to copying attributes has been removed +-- as it doesn't pay of (most attributes are only accessed once anyway) - nuts.getprop = function(n,k) - local p = propertydata[n] - if p then - return p[k] - end +nuts.getprop = function(n,k) + local p = propertydata[n] + if p then + return p[k] end +end - nuts.setprop = function(n,k,v) - local p = propertydata[n] - if p then - p[k] = v - else - propertydata[n] = { [k] = v } - end +nuts.rawprop = function(n,k) + local p = rawget(propertydata,n) + if p then + return p[k] end +end - nuts.theprop = function(n) - local p = propertydata[n] - if not p then - p = { } - propertydata[n] = p - end - return p +nuts.setprop = function(n,k,v) + local p = propertydata[n] + if p then + p[k] = v + else + propertydata[n] = { [k] = v } end +end - nodes.setprop = nodes.setproperty - nodes.getprop = nodes.getproperty - -else - - -- for testing and simple cases - - nuts.getprop = getattr - nuts.setprop = setattr - - nodes.setprop = getattr - nodes.getprop = setattr - +nuts.theprop = function(n) + local p = propertydata[n] + if not p then + p = { } + propertydata[n] = p + end + return p end +nodes.setprop = nodes.setproperty +nodes.getprop = nodes.getproperty + function nuts.copy_properties(source,target,what) local newprops = propertydata[source] if not newprops then |