summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/l-utils.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/l-utils.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/l-utils.lua30
1 files changed, 18 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/context/base/l-utils.lua b/Master/texmf-dist/tex/context/base/l-utils.lua
index 8d531711fb4..ebc27b8cfcd 100644
--- a/Master/texmf-dist/tex/context/base/l-utils.lua
+++ b/Master/texmf-dist/tex/context/base/l-utils.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['l-utils'] = {
version = 1.001,
- comment = "companion to luat-lib.tex",
+ 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"
@@ -8,6 +8,10 @@ if not modules then modules = { } end modules ['l-utils'] = {
-- hm, quite unreadable
+local gsub = string.gsub
+local concat = table.concat
+local type, next = type, next
+
if not utils then utils = { } end
if not utils.merger then utils.merger = { } end
if not utils.lua then utils.lua = { } end
@@ -45,7 +49,7 @@ function utils.merger._self_load_(name)
end
if data and utils.merger.strip_comment then
-- saves some 20K
- data = data:gsub("%-%-~[^\n\r]*[\r\n]", "")
+ data = gsub(data,"%-%-~[^\n\r]*[\r\n]", "")
end
return data or ""
end
@@ -63,7 +67,7 @@ end
function utils.merger._self_swap_(data,code)
if data ~= "" then
- return (data:gsub(utils.merger.pattern, function(s)
+ return (gsub(data,utils.merger.pattern, function(s)
return "\n\n" .. "-- "..utils.merger.m_begin .. "\n" .. code .. "\n" .. "-- "..utils.merger.m_end .. "\n\n"
end, 1))
else
@@ -73,8 +77,8 @@ end
--~ stripper:
--~
---~ data = string.gsub(data,"%-%-~[^\n]*\n","")
---~ data = string.gsub(data,"\n\n+","\n")
+--~ data = gsub(data,"%-%-~[^\n]*\n","")
+--~ data = gsub(data,"\n\n+","\n")
function utils.merger._self_libs_(libs,list)
local result, f, frozen = { }, nil, false
@@ -82,9 +86,10 @@ function utils.merger._self_libs_(libs,list)
if type(libs) == 'string' then libs = { libs } end
if type(list) == 'string' then list = { list } end
local foundpath = nil
- for _, lib in ipairs(libs) do
- for _, pth in ipairs(list) do
- pth = string.gsub(pth,"\\","/") -- file.clean_path
+ for i=1,#libs do
+ local lib = libs[i]
+ for j=1,#list do
+ local pth = gsub(list[j],"\\","/") -- file.clean_path
utils.report("checking library path %s",pth)
local name = pth .. "/" .. lib
if lfs.isfile(name) then
@@ -96,7 +101,8 @@ function utils.merger._self_libs_(libs,list)
if foundpath then
utils.report("using library path %s",foundpath)
local right, wrong = { }, { }
- for _, lib in ipairs(libs) do
+ for i=1,#libs do
+ local lib = libs[i]
local fullname = foundpath .. "/" .. lib
if lfs.isfile(fullname) then
-- right[#right+1] = lib
@@ -110,15 +116,15 @@ function utils.merger._self_libs_(libs,list)
end
end
if #right > 0 then
- utils.report("merged libraries: %s",table.concat(right," "))
+ utils.report("merged libraries: %s",concat(right," "))
end
if #wrong > 0 then
- utils.report("skipped libraries: %s",table.concat(wrong," "))
+ utils.report("skipped libraries: %s",concat(wrong," "))
end
else
utils.report("no valid library path found")
end
- return table.concat(result, "\n\n")
+ return concat(result, "\n\n")
end
function utils.merger.selfcreate(libs,list,target)