summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/trac-set.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/trac-set.lua')
-rw-r--r--tex/context/base/mkiv/trac-set.lua41
1 files changed, 30 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/trac-set.lua b/tex/context/base/mkiv/trac-set.lua
index d0047650f..530915fe0 100644
--- a/tex/context/base/mkiv/trac-set.lua
+++ b/tex/context/base/mkiv/trac-set.lua
@@ -8,8 +8,8 @@ if not modules then modules = { } end modules ['trac-set'] = { -- might become u
-- maybe this should be util-set.lua
-local type, next, tostring = type, next, tostring
-local concat = table.concat
+local type, next, tostring, tonumber = type, next, tostring, tonumber
+local concat, sortedhash = table.concat, table.sortedhash
local format, find, lower, gsub, topattern = string.format, string.find, string.lower, string.gsub, string.topattern
local is_boolean = string.is_boolean
local settings_to_hash = utilities.parsers.settings_to_hash
@@ -26,6 +26,8 @@ local data = { }
-- We can initialize from the cnf file. This is sort of tricky as
-- later defined setters also need to be initialized then. If set
-- this way, we need to ensure that they are not reset later on.
+--
+-- The sorting is needed to get a predictable setters in case of *.
local trace_initialize = false -- only for testing during development
@@ -36,7 +38,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti
-- trace_initialize = true
local data = setter.data
if data then
- for key, newvalue in next, values do
+ for key, newvalue in sortedhash(values) do
local newvalue = is_boolean(newvalue,newvalue,true) -- strict
local functions = data[key]
if functions then
@@ -91,7 +93,7 @@ local function set(t,what,newvalue)
done = { }
t.done = done
end
- for w, value in next, what do
+ for w, value in sortedhash(what) do
if value == "" then
value = newvalue
elseif not value then
@@ -100,7 +102,7 @@ local function set(t,what,newvalue)
value = is_boolean(value,value,true) -- strict
end
w = topattern(w,true,true)
- for name, functions in next, data do
+ for name, functions in sortedhash(data) do
if done[name] then
-- prevent recursion due to wildcards
elseif find(name,w) then
@@ -118,7 +120,7 @@ end
local function reset(t)
local data = t.data
if not data.frozen then
- for name, functions in next, data do
+ for name, functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
end
@@ -219,13 +221,30 @@ function setters.show(t)
local name = list[k]
local functions = t.data[name]
if functions then
- local value, default, modules = functions.value, functions.default, #functions
- value = value == nil and "unset" or tostring(value)
- default = default == nil and "unset" or tostring(default)
- t.report("%-50s modules: %2i default: %-12s value: %-12s",name,modules,default,value)
+ local value = functions.value
+ local default = functions.default
+ local modules = #functions
+ if default == nil then
+ default = "unset"
+ elseif type(default) == "table" then
+ default = concat(default,"|")
+ else
+ default = tostring(default)
+ end
+ if value == nil then
+ value = "unset"
+ elseif type(value) == "table" then
+ value = concat(value,"|")
+ else
+ value = tostring(value)
+ end
+ t.report(name)
+ t.report(" modules : %i",modules)
+ t.report(" default : %s",default)
+ t.report(" value : %s",value)
+ t.report()
end
end
- t.report()
end
-- we could have used a bit of oo and the trackers:enable syntax but