diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-09-02 00:04:51 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-09-02 00:04:51 +0200 |
commit | fd9c4ecd4421d087de21bef1e53d8ffb016285b0 (patch) | |
tree | 64606204adcabe2f197984ca8d063891b770bace /tex/context/base/mkiv/node-ppt.lua | |
parent | 2106beefbc854f77a92264c815d3cf2b3460f0b6 (diff) | |
download | context-fd9c4ecd4421d087de21bef1e53d8ffb016285b0.tar.gz |
2018-09-01 23:20:00
Diffstat (limited to 'tex/context/base/mkiv/node-ppt.lua')
-rw-r--r-- | tex/context/base/mkiv/node-ppt.lua | 259 |
1 files changed, 78 insertions, 181 deletions
diff --git a/tex/context/base/mkiv/node-ppt.lua b/tex/context/base/mkiv/node-ppt.lua index e26d1690e..df2986a4e 100644 --- a/tex/context/base/mkiv/node-ppt.lua +++ b/tex/context/base/mkiv/node-ppt.lua @@ -318,207 +318,102 @@ table.setmetatableindex(anchored,function(t,k) return v end) --- function properties.attach(head) --- --- if nofslots <= 0 then --- return head --- end --- --- local last = nil --- --- starttiming(properties) --- --- for source in nextwhatsit, head do --- if getsubtype(source) == userdefined_code then --- if last then --- removenode(head,last,true) --- last = nil --- end --- if getfield(source,"user_id") == property_id then --- local slot = getdata(source) --- local data = cache[slot] --- if data then --- cache[slot] = nil --- local where = data[1] --- local target = anchored[where](source) --- if target then --- local first = data[2] --- local method = type(first) --- local p_target = propertydata[target] --- local p_source = propertydata[source] --- if p_target then --- if p_source then --- for k, v in next, p_source do --- p_target[k] = v --- end --- end --- if method == "table" then --- for k, v in next, first do --- p_target[k] = v --- end --- elseif method == "function" then --- first(target,head,where,p_target,unpack(data,3)) --- elseif method == "string" then --- actions[first](target,head,where,p_target,unpack(data,3)) --- end --- elseif p_source then --- if method == "table" then --- propertydata[target] = p_source --- for k, v in next, first do --- p_source[k] = v --- end --- elseif method == "function" then --- propertydata[target] = p_source --- first(target,head,where,p_source,unpack(data,3)) --- elseif method == "string" then --- propertydata[target] = p_source --- actions[first](target,head,where,p_source,unpack(data,3)) --- end --- else --- if method == "table" then --- propertydata[target] = first --- elseif method == "function" then --- local t = { } --- propertydata[target] = t --- first(target,head,where,t,unpack(data,3)) --- elseif method == "string" then --- local t = { } --- propertydata[target] = t --- actions[first](target,head,where,t,unpack(data,3)) --- end --- end --- if trace_setting then --- report_setting("node %i, id %s, data %s", --- target,nodecodes[getid(target)],serialize(propertydata[target],false)) --- end --- end --- if nofslots == 1 then --- nofslots = 0 --- last = source --- break --- else --- nofslots = nofslots - 1 --- end --- end --- last = source --- end --- end --- end --- --- if last then --- removenode(head,last,true) --- end --- --- stoptiming(properties) --- --- return head --- --- end +function properties.attach(head) -if LUATEXVERSION >= 1.080 then - - function properties.attach(head) - - if nofslots <= 0 then - return head - end + if nofslots <= 0 then + return head + end - local last = nil + local last = nil - starttiming(properties) + starttiming(properties) - for source, subtype in nextwhatsit, head do - if subtype == userdefined_code then - if last then - removenode(head,last,true) - last = nil - end - if getfield(source,"user_id") == property_id then - local slot = getdata(source) - local data = cache[slot] - if data then - cache[slot] = nil - local where = data[1] - local target = anchored[where](source) - if target then - local first = data[2] - local method = type(first) - local p_target = propertydata[target] - local p_source = propertydata[source] - if p_target then - if p_source then - for k, v in next, p_source do - p_target[k] = v - end - end - if method == "table" then - for k, v in next, first do - p_target[k] = v - end - elseif method == "function" then - first(target,head,where,p_target,unpack(data,3)) - elseif method == "string" then - actions[first](target,head,where,p_target,unpack(data,3)) + for source, subtype in nextwhatsit, head do + if subtype == userdefined_code then + if last then + removenode(head,last,true) + last = nil + end + if getfield(source,"user_id") == property_id then + local slot = getdata(source) + local data = cache[slot] + if data then + cache[slot] = nil + local where = data[1] + local target = anchored[where](source) + if target then + local first = data[2] + local method = type(first) + local p_target = propertydata[target] + local p_source = propertydata[source] + if p_target then + if p_source then + for k, v in next, p_source do + p_target[k] = v end - elseif p_source then - if method == "table" then - propertydata[target] = p_source - for k, v in next, first do - p_source[k] = v - end - elseif method == "function" then - propertydata[target] = p_source - first(target,head,where,p_source,unpack(data,3)) - elseif method == "string" then - propertydata[target] = p_source - actions[first](target,head,where,p_source,unpack(data,3)) + end + if method == "table" then + for k, v in next, first do + p_target[k] = v end - else - if method == "table" then - propertydata[target] = first - elseif method == "function" then - local t = { } - propertydata[target] = t - first(target,head,where,t,unpack(data,3)) - elseif method == "string" then - local t = { } - propertydata[target] = t - actions[first](target,head,where,t,unpack(data,3)) + elseif method == "function" then + first(target,head,where,p_target,unpack(data,3)) + elseif method == "string" then + actions[first](target,head,where,p_target,unpack(data,3)) + end + elseif p_source then + if method == "table" then + propertydata[target] = p_source + for k, v in next, first do + p_source[k] = v end + elseif method == "function" then + propertydata[target] = p_source + first(target,head,where,p_source,unpack(data,3)) + elseif method == "string" then + propertydata[target] = p_source + actions[first](target,head,where,p_source,unpack(data,3)) end - if trace_setting then - report_setting("node %i, id %s, data %s", - target,nodecodes[getid(target)],serialize(propertydata[target],false)) + else + if method == "table" then + propertydata[target] = first + elseif method == "function" then + local t = { } + propertydata[target] = t + first(target,head,where,t,unpack(data,3)) + elseif method == "string" then + local t = { } + propertydata[target] = t + actions[first](target,head,where,t,unpack(data,3)) end end - if nofslots == 1 then - nofslots = 0 - last = source - break - else - nofslots = nofslots - 1 + if trace_setting then + report_setting("node %i, id %s, data %s", + target,nodecodes[getid(target)],serialize(propertydata[target],false)) end end - last = source + if nofslots == 1 then + nofslots = 0 + last = source + break + else + nofslots = nofslots - 1 + end end + last = source end end + end - if last then - removenode(head,last,true) - end - - stoptiming(properties) - - return head - + if last then + removenode(head,last,true) end -local tasks = nodes.tasks + stoptiming(properties) -end + return head -local tasks = nodes.tasks +end -- maybe better hard coded in-place @@ -528,6 +423,8 @@ end) -- only for development +-- local tasks = nodes.tasks +-- -- local function show(head,level,report) -- for target in nextnode, head do -- local p = propertydata[target] |