diff options
author | Karl Berry <karl@freefriends.org> | 2013-06-23 23:38:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-06-23 23:38:05 +0000 |
commit | 60f28f85f2707b6a48c3b5aec0ea68b8ee21e466 (patch) | |
tree | ab34d8d573457bea6a804ee3d5de48dd500bf028 /Master/texmf-dist/tex/context/base/l-package.lua | |
parent | ac5882d0cb115e11b5cc2e62107ef5822f3507f5 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@30865 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/l-package.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/l-package.lua | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/context/base/l-package.lua b/Master/texmf-dist/tex/context/base/l-package.lua index 09e65f9c896..579fd3941c6 100644 --- a/Master/texmf-dist/tex/context/base/l-package.lua +++ b/Master/texmf-dist/tex/context/base/l-package.lua @@ -50,16 +50,18 @@ local function lualibfile(name) return lpegmatch(pattern,name) or name end +local offset = luarocks and 1 or 0 -- todo: also check other extras + local helpers = package.helpers or { cleanpath = cleanpath, lualibfile = lualibfile, trace = false, report = function(...) print(format(...)) end, builtin = { - ["preload table"] = searchers[1], -- special case, built-in libs - ["path specification"] = searchers[2], - ["cpath specification"] = searchers[3], - ["all in one fallback"] = searchers[4], -- special case, combined libs + ["preload table"] = searchers[1+offset], -- special case, built-in libs + ["path specification"] = searchers[2+offset], + ["cpath specification"] = searchers[3+offset], + ["all in one fallback"] = searchers[4+offset], -- special case, combined libs }, methods = { }, @@ -279,6 +281,9 @@ methods["not loaded"] = function(name) end local level = 0 +local used = { } + +helpers.traceused = false function helpers.loaded(name) local sequence = helpers.sequence @@ -293,6 +298,9 @@ function helpers.loaded(name) if helpers.trace then helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name) end + if helpers.traceused then + used[#used+1] = { level = level, name = name } + end level = level - 1 return result, rest end @@ -302,6 +310,19 @@ function helpers.loaded(name) return nil end +function helpers.showused() + local n = #used + if n > 0 then + helpers.report("%s libraries loaded:",n) + helpers.report() + for i=1,n do + local u = used[i] + helpers.report("%i %a",u.level,u.name) + end + helpers.report() + end +end + function helpers.unload(name) if helpers.trace then if package.loaded[name] then |