summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-lst.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-lst.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-lst.lua68
1 files changed, 35 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-lst.lua b/Master/texmf-dist/tex/context/base/data-lst.lua
index 82f6754867f..3f94253404f 100644
--- a/Master/texmf-dist/tex/context/base/data-lst.lua
+++ b/Master/texmf-dist/tex/context/base/data-lst.lua
@@ -6,12 +6,16 @@ if not modules then modules = { } end modules ['data-lst'] = {
license = "see context related readme files"
}
--- used in mtxrun
+-- used in mtxrun, can be loaded later .. todo
local find, concat, upper, format = string.find, table.concat, string.upper, string.format
resolvers.listers = resolvers.listers or { }
+local resolvers = resolvers
+
+local report_lists = logs.reporter("resolvers","lists")
+
local function tabstr(str)
if type(str) == 'table' then
return concat(str," | ")
@@ -20,44 +24,42 @@ local function tabstr(str)
end
end
-local function list(list,report)
- local instance = resolvers.instance
- local pat = upper(pattern or "","")
- local report = report or texio.write_nl
- local sorted = table.sortedkeys(list)
- for i=1,#sorted do
- local key = sorted[i]
- if instance.pattern == "" or find(upper(key),pat) then
- if instance.kpseonly then
- if instance.kpsevars[key] then
- report(format("%s=%s",key,tabstr(list[key])))
- end
- else
- report(format('%s %s=%s',(instance.kpsevars[key] and 'K') or 'E',key,tabstr(list[key])))
+function resolvers.listers.variables(pattern)
+ local instance = resolvers.instance
+ local environment = instance.environment
+ local variables = instance.variables
+ local expansions = instance.expansions
+ local pattern = upper(pattern or "")
+ local configured = { }
+ local order = instance.order
+ for i=1,#order do
+ for k, v in next, order[i] do
+ if v ~= nil and configured[k] == nil then
+ configured[k] = v
end
end
end
+ local env = table.fastcopy(environment)
+ local var = table.fastcopy(variables)
+ local exp = table.fastcopy(expansions)
+ for key, value in table.sortedpairs(configured) do
+ if key ~= "" and (pattern == "" or find(upper(key),pattern)) then
+ report_lists(key)
+ report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
+ report_lists(" var: %s",tabstr(configured[key]) or "unset")
+ report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
+ report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ end
+ end
+ instance.environment = table.fastcopy(env)
+ instance.variables = table.fastcopy(var)
+ instance.expansions = table.fastcopy(exp)
end
-function resolvers.listers.variables () list(resolvers.instance.variables ) end
-function resolvers.listers.expansions() list(resolvers.instance.expansions) end
-
function resolvers.listers.configurations(report)
+ local configurations = resolvers.instance.specification
local report = report or texio.write_nl
- local instance = resolvers.instance
- local sorted = table.sortedkeys(instance.kpsevars)
- for i=1,#sorted do
- local key = sorted[i]
- if not instance.pattern or (instance.pattern=="") or find(key,instance.pattern) then
- report(format("%s\n",key))
- local order = instance.order
- for i=1,#order do
- local str = order[i][key]
- if str then
- report(format("\t%s\t%s",i,str))
- end
- end
- report("")
- end
+ for i=1,#configurations do
+ report(resolvers.resolve(configurations[i]))
end
end