1if not modules then modules = { } end modules ['data-lst'] = {
2 version = 1.001,
3 comment = "companion to luat-lib.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11local type = type
12local sortedhash = table.sortedhash
13local isdir = lfs.isdir
14
15local resolvers = resolvers
16local listers = resolvers.listers or { }
17resolvers.listers = listers
18
19local resolveprefix = resolvers.resolve
20local configurationfiles = resolvers.configurationfiles
21local expandedpathfromlist = resolvers.expandedpathfromlist
22local splitpath = resolvers.splitpath
23local knownvariables = resolvers.knownvariables
24
25local report_lists = logs.reporter("resolvers","lists")
26local report_resolved = logs.reporter("system","resolved")
27
28local function tabstr(str)
29 if not str then
30 return "unset"
31 elseif type(str) == 'table' then
32 return concat(str," | ")
33 else
34 return str
35 end
36end
37
38function listers.variables(pattern)
39 local result = resolvers.knownvariables(pattern)
40 for key, value in sortedhash(result) do
41 report_lists(key)
42 report_lists(" env: %s",tabstr(value.environment))
43 report_lists(" var: %s",tabstr(value.variable))
44 report_lists(" exp: %s",tabstr(value.expansion))
45 report_lists(" res: %s",tabstr(value.resolved))
46 end
47end
48
49function listers.configurations()
50 local configurations = configurationfiles()
51 for i=1,#configurations do
52 report_resolved("file : %s",resolveprefix(configurations[i]))
53 end
54 report_resolved("")
55 local list = expandedpathfromlist(splitpath(resolvers.luacnfspec))
56 for i=1,#list do
57 local li = resolveprefix(list[i])
58 if isdir(li) then
59 report_resolved("path - %s",li)
60 else
61 report_resolved("path + %s",li)
62 end
63 end
64end
65 |