diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua index 2bac3201d28..5b8390df2a1 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/libs-ini.lua @@ -13,10 +13,10 @@ if not modules then modules = { } end modules ['libs-ini'] = { -- is doing. local type, unpack = type, unpack +local find = string.find -- here we implement the resolver -local type = type local nameonly = file.nameonly local joinfile = file.join @@ -30,8 +30,10 @@ local expandpaths = resolvers.expandedpathlistfromvariable local report = logs.reporter("resolvers","libraries") local trace = false +local silent = false -trackers.register("resolvers.lib", function(v) trace = v end) +trackers.register("resolvers.lib", function(v) trace = v end) +trackers.register("resolvers.lib.silent", function(v) silent = v end) local function findlib(required) -- todo: cache local suffix = os.libsuffix or "so" @@ -143,10 +145,10 @@ function libraries.optionalloaded(name,libnames) end end local initialized = thelib_initialize(unpack(libnames)) - if initialized then - report("using library '% + t'",libnames) - else + if not initialized then report("unable to initialize library '% + t'",libnames) + elseif not silent then + report("using library '% + t'",libnames) end return initialized end @@ -154,6 +156,9 @@ function libraries.optionalloaded(name,libnames) end end +-- For the moment the next blob is needed when we run \MTXRUN\ on top of \LUATEX\ and +-- \LUAJITTEX\ but at some point we will {\em always} assume \LUAMETATEX\ as runner. + if FFISUPPORTED and ffi and ffi.load then local ffiload = ffi.load @@ -194,3 +199,19 @@ end -- } -- end -- } + +local dofile = dofile +local savedrequire = require + +function require(name,version) + if find(name,"%.lua$") or find(name,"%.lmt$") then + local m = dofile(findfile(name)) + if m then + package.loaded[name] = m + return m + end + else + return savedrequire(name) + end +end + |