summaryrefslogtreecommitdiff
path: root/scripts/context/lua/mtxrun.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/context/lua/mtxrun.lua')
-rw-r--r--scripts/context/lua/mtxrun.lua64
1 files changed, 63 insertions, 1 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 815d97235..8e2524147 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -10114,6 +10114,68 @@ end -- of closure
do -- create closure to overcome 200 locals limit
+if not modules then modules = { } end modules ['data-lua'] = {
+ version = 1.001,
+ comment = "companion to luat-lib.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- some loading stuff ... we might move this one to slot 2 depending
+-- on the developments (the loaders must not trigger kpse); we could
+-- of course use a more extensive lib path spec
+
+local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
+
+local gsub = string.gsub
+
+local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' }
+local libpaths = file.split_path(package.path)
+
+package.loaders[2] = function(name) -- was [#package.loaders+1]
+--~ package.loaders[#package.loaders+1] = function(name) -- was
+ for i=1,#libformats do
+ local format = libformats[i]
+ local resolved = resolvers.find_file(name,format) or ""
+ if resolved ~= "" then
+ if trace_locating then
+ logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved)
+ end
+ return function() return dofile(resolved) end
+ end
+ end
+ local simple = file.removesuffix(name)
+ for i=1,#libpaths do -- package.path, might become option
+ local resolved = gsub(libpaths[i],"?",simple)
+ if resolvers.isreadable.file(resolved) then
+ if trace_locating then
+ logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved)
+ end
+ return function() return dofile(resolved) end
+ end
+ end
+ -- just in case the distribution is messed up
+ local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or ""
+ if resolved ~= "" then
+ if trace_locating then
+ logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved)
+ end
+ return function() return dofile(resolved) end
+ end
+ if trace_locating then
+ logs.report("fileio",'? unable to locate lib: %s',name)
+ end
+ return "unable to locate " .. name
+end
+
+resolvers.loadlualib = require
+
+
+end -- of closure
+
+do -- create closure to overcome 200 locals limit
+
if not modules then modules = { } end modules ['luat-kps'] = {
version = 1.001,
comment = "companion to luatools.lua",
@@ -10597,7 +10659,7 @@ own.libs = { -- todo: check which ones are really needed
-- 'data-bin.lua',
'data-zip.lua',
'data-crl.lua',
--- 'data-lua.lua',
+ 'data-lua.lua',
'data-kps.lua', -- so that we can replace kpsewhich
'data-aux.lua', -- updater
'data-tmf.lua', -- tree files