summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-02-28 15:11:56 +0000
committerKarl Berry <karl@freefriends.org>2019-02-28 15:11:56 +0000
commitcc17ad601696f5cf966c8a0b9d79144cd42828a6 (patch)
treef6007b9b2f886d942f9b30b4797e8718001f65bd /Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
parente298746bb92cdf7e87bc3b5b9bd973b6c429a47f (diff)
context for tl19
git-svn-id: svn://tug.org/texlive/trunk@50165 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/util-lib.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-lib.lua62
1 files changed, 49 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua b/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
index 714cfd4c77c..fb65a566e24 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
@@ -237,7 +237,7 @@ local function locate(required,version,trace,report,action)
report("stored library: %a",required)
end
end
- return library
+ return library or nil
end
do
@@ -352,7 +352,7 @@ We use the same lookup logic for ffi loading.
trackers.register("resolvers.ffilib", function(v) trace_ffilib = v end)
-- pushlibpath(pathpart(name))
- -- local message, library = pcall(savedffiload,nameonly(name))
+ -- local state, library = pcall(savedffiload,nameonly(name))
-- poplibpath()
local loaded = { }
@@ -361,11 +361,11 @@ We use the same lookup logic for ffi loading.
name = removesuffix(name)
local l = loaded[name]
if l == nil then
- local message, library = pcall(savedffiload,name)
- if type(message) == "userdata" then
- l = message
- elseif type(library) == "userdata" then
+ local state, library = pcall(savedffiload,name)
+ if type(library) == "userdata" then
l = library
+ elseif type(state) == "userdata" then
+ l = state
else
l = false
end
@@ -376,6 +376,20 @@ We use the same lookup logic for ffi loading.
return l
end
+ local function getlist(required)
+ local list = directives.value("system.librarynames" )
+ if type(list) == "table" then
+ list = list[required]
+ if type(list) == "table" then
+ if trace then
+ report("using lookup list for library %a: % | t",required,list)
+ end
+ return list
+ end
+ end
+ return { required }
+ end
+
function ffilib(name,version)
name = removesuffix(name)
local l = loaded[name]
@@ -384,23 +398,45 @@ We use the same lookup logic for ffi loading.
report_ffilib("reusing already loaded %a",name)
end
return l
- elseif version == "system" then
- return locateindeed(name)
+ end
+ local list = getlist(name)
+ if version == "system" then
+ for i=1,#list do
+ local library = locateindeed(list[i])
+ if type(library) == "userdata" then
+ return library
+ end
+ end
else
- return locate(name,version,trace_ffilib,report_ffilib,locateindeed)
+ for i=1,#list do
+ local library = locate(list[i],version,trace_ffilib,report_ffilib,locateindeed)
+ if type(library) == "userdata" then
+ return library
+ end
+ end
end
end
function ffi.load(name)
- local library = ffilib(name)
- if type(library) == "userdata" then
- return library
+ local list = getlist(name)
+ for i=1,#list do
+ local library = ffilib(list[i])
+ if type(library) == "userdata" then
+ return library
+ end
end
if trace_ffilib then
report_ffilib("trying to load %a using normal loader",name)
end
-- so here we don't store
- return savedffiload(name)
+ for i=1,#list do
+ local state, library = pcall(savedffiload,list[i])
+ if type(library) == "userdata" then
+ return library
+ elseif type(state) == "userdata" then
+ return library
+ end
+ end
end
end