summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/util-lib.lua
diff options
context:
space:
mode:
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, 13 insertions, 49 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 fb65a566e24..714cfd4c77c 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 or nil
+ return library
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 state, library = pcall(savedffiload,nameonly(name))
+ -- local message, 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 state, library = pcall(savedffiload,name)
- if type(library) == "userdata" then
+ local message, library = pcall(savedffiload,name)
+ if type(message) == "userdata" then
+ l = message
+ elseif type(library) == "userdata" then
l = library
- elseif type(state) == "userdata" then
- l = state
else
l = false
end
@@ -376,20 +376,6 @@ 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]
@@ -398,45 +384,23 @@ We use the same lookup logic for ffi loading.
report_ffilib("reusing already loaded %a",name)
end
return l
- 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
+ elseif version == "system" then
+ return locateindeed(name)
else
- 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
+ return locate(name,version,trace_ffilib,report_ffilib,locateindeed)
end
end
function ffi.load(name)
- local list = getlist(name)
- for i=1,#list do
- local library = ffilib(list[i])
- if type(library) == "userdata" then
- return library
- end
+ local library = ffilib(name)
+ if type(library) == "userdata" then
+ return library
end
if trace_ffilib then
report_ffilib("trying to load %a using normal loader",name)
end
-- so here we don't store
- 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
+ return savedffiload(name)
end
end