summaryrefslogtreecommitdiff
path: root/tex/context/base/page-ins.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/page-ins.lua')
-rw-r--r--tex/context/base/page-ins.lua38
1 files changed, 34 insertions, 4 deletions
diff --git a/tex/context/base/page-ins.lua b/tex/context/base/page-ins.lua
index 1b8b8583b..44de95ea1 100644
--- a/tex/context/base/page-ins.lua
+++ b/tex/context/base/page-ins.lua
@@ -27,6 +27,13 @@ local report_inserts = logs.reporter("inserts")
inserts.stored = inserts.stored or { } -- combining them in one is inefficient in the
inserts.data = inserts.data or { } -- bytecode storage pool
+local variables = interfaces.variables
+local v_page = variables.page
+local v_columns = variables.columns
+local v_firstcolumn = variables.firstcolumn
+local v_lastcolumn = variables.lastcolumn
+local v_text = variables.text
+
storage.register("structures/inserts/stored", inserts.stored, "structures.inserts.stored")
local data = inserts.data
@@ -37,13 +44,34 @@ for name, specification in next, stored do
data[name] = specification
end
-function inserts.define(specification)
- local name = specification.name or "unknown"
+function inserts.define(name,specification)
+ specification.name= name
local number = specification.number or 0
data[name] = specification
data[number] = specification
-- only needed at runtime as this get stored in a bytecode register
stored[name] = specification
+ if not specification.location then
+ specification.location = v_page
+ end
+ return specification
+end
+
+function inserts.setup(name,settings)
+ local specification = data[name]
+ for k, v in next, settings do
+ -- maybe trace change
+ specification[k] = v
+ end
+ return specification
+end
+
+function inserts.setlocation(name,location) -- a practical fast one
+ data[name].location = location
+end
+
+function inserts.getlocation(name,location)
+ return data[name].location or v_page
end
function inserts.getdata(name) -- or number
@@ -60,6 +88,8 @@ end
-- interface
-commands.defineinsertion = inserts.define
-commands.insertionnumber = function(name) context(data[name].number or 0) end
+commands.defineinsertion = inserts.define
+commands.setupinsertion = inserts.setup
+commands.setinsertionlocation = inserts.setlocation
+commands.insertionnumber = function(name) context(data[name].number or 0) end