summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-flt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-flt.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/page-flt.lua128
1 files changed, 103 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-flt.lua b/Master/texmf-dist/tex/context/base/page-flt.lua
index 7b1afc55cf3..e91285d0a64 100644
--- a/Master/texmf-dist/tex/context/base/page-flt.lua
+++ b/Master/texmf-dist/tex/context/base/page-flt.lua
@@ -242,10 +242,14 @@ function floats.checkedpagefloat(packed)
end
end
-function floats.nofstacked()
+function floats.nofstacked(which)
return #stacks[which or default] or 0
end
+function floats.hasstacked(which)
+ return (#stacks[which or default] or 0) > 0
+end
+
-- todo: check for digits !
local method = C((1-S(", :"))^1)
@@ -273,27 +277,101 @@ end
-- interface
-local context = context
-local context_setvalue = context.setvalue
-
-commands.flushfloat = floats.flush
-commands.savefloat = floats.save
-commands.resavefloat = floats.resave
-commands.pushfloat = floats.push
-commands.popfloat = floats.pop
-commands.consultfloat = floats.consult
-commands.collectfloat = floats.collect
-
-function commands.getfloatvariable (...) local v = floats.getvariable(...) if v then context(v) end end
-function commands.checkedpagefloat (...) local v = floats.checkedpagefloat(...) if v then context(v) end end
-
-function commands.nofstackedfloats (...) context(floats.nofstacked(...)) end
-function commands.doifelsesavedfloat(...) commands.doifelse(floats.nofstacked(...)>0) end
-
-function commands.analysefloatmethod(str) -- currently only one method
- local method, label, row, column = floats.analysemethod(str)
- context_setvalue("floatmethod",method or "")
- context_setvalue("floatlabel", label or "")
- context_setvalue("floatrow", row or "")
- context_setvalue("floatcolumn",column or "")
-end
+local context = context
+local commands = commands
+local implement = interfaces.implement
+local setmacro = interfaces.setmacro
+
+implement {
+ name = "flushfloat",
+ actions = floats.flush,
+ arguments = { "string", "integer" },
+}
+
+implement {
+ name = "flushlabeledfloat",
+ actions = floats.flush,
+ arguments = { "string", "string", true },
+}
+
+implement {
+ name = "savefloat",
+ actions = floats.save,
+ arguments = "string"
+}
+
+implement {
+ name = "savespecificfloat",
+ actions = floats.save,
+ arguments = {
+ "string",
+ {
+ { "specification" },
+ { "label" },
+ }
+ }
+}
+
+implement {
+ name = "resavefloat",
+ actions = floats.resave,
+ arguments = "string"
+}
+
+implement {
+ name = "pushfloat",
+ actions = floats.push
+}
+
+implement {
+ name = "popfloat",
+ actions = floats.pop
+}
+
+implement {
+ name = "consultfloat",
+ actions = floats.consult,
+ arguments = "string",
+}
+
+implement {
+ name = "collectfloat",
+ actions = floats.collect,
+ arguments = { "string", "dimen", "dimen" }
+}
+
+implement {
+ name = "getfloatvariable",
+ actions = { floats.getvariable, context },
+ arguments = "string"
+}
+
+implement {
+ name = "checkedpagefloat",
+ actions = { floats.checkedpagefloat, context },
+ arguments = "string"
+}
+
+implement {
+ name = "nofstackedfloats",
+ actions = { floats.nofstacked, context },
+ arguments = "string"
+}
+
+implement {
+ name = "doifelsestackedfloats",
+ actions = { floats.hasstacked, commands.doifelse },
+ arguments = "string"
+}
+
+implement {
+ name = "analysefloatmethod",
+ actions = function(str)
+ local method, label, row, column = floats.analysemethod(str)
+ setmacro("floatmethod",method or "")
+ setmacro("floatlabel", label or "")
+ setmacro("floatrow", row or "")
+ setmacro("floatcolumn",column or "")
+ end,
+ arguments = "string"
+}