summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
committerKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
commit974640d66e61e81cb197ad96fdff7b08343e4c5a (patch)
tree2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/scripts
parentb4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff)
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-context.lua146
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-context.xml13
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-epub.lua4
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-fonts.lua9
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-install.lua38
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-interface.lua61
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-kpse.lua124
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-patterns.lua50
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-scite.lua4
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-timing.lua218
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-unicode.lua27
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-update.lua7
-rwxr-xr-xMaster/texmf-dist/scripts/context/lua/mtxrun.lua1153
-rw-r--r--Master/texmf-dist/scripts/context/ruby/graphics/inkscape.rb3
-rw-r--r--Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua1153
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/unix/mtxrun1153
-rw-r--r--Master/texmf-dist/scripts/context/stubs/win64/mtxrun.lua1153
17 files changed, 2180 insertions, 3136 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-context.lua b/Master/texmf-dist/scripts/context/lua/mtx-context.lua
index 4e8c364d57f..7ae350111be 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-context.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-context.lua
@@ -11,7 +11,7 @@ if not modules then modules = { } end modules['mtx-context'] = {
local type, next, tostring, tonumber = type, next, tostring, tonumber
local format, gmatch, match, gsub, find = string.format, string.gmatch, string.match, string.gsub, string.find
-local quote, validstring = string.quote, string.valid
+local quote, validstring, splitstring = string.quote, string.valid, string.split
local sort, concat, insert, sortedhash, tohash = table.sort, table.concat, table.insert, table.sortedhash, table.tohash
local settings_to_array = utilities.parsers.settings_to_array
local appendtable = table.append
@@ -34,7 +34,7 @@ local formatters = string.formatters
local application = logs.application {
name = "mtx-context",
- banner = "ConTeXt Process Management 1.03",
+ banner = "ConTeXt Process Management 1.04",
-- helpinfo = helpinfo, -- table with { category_a = text_1, category_b = text_2 } or helpstring or xml_blob
helpinfo = "mtx-context.xml",
}
@@ -95,7 +95,9 @@ scripts.context = scripts.context or { }
if jit then -- already luajittex
setargument("engine","luajittex")
setargument("jit",nil)
-elseif getargument("jit") then -- relaunch luajittex
+elseif getargument("luatex") then -- relaunch luajittex
+ setargument("engine","luatex")
+elseif getargument("jit") or getargument("luajittex") then -- relaunch luajittex
-- bonus shortcut, we assume that --jit also indicates the engine
-- although --jit and --engine=luajittex are independent
setargument("engine","luajittex")
@@ -105,10 +107,11 @@ end
-- -- the platforms to use a similar approach to this.
local engine_new = file.nameonly(getargument("engine") or directives.value("system.engine"))
-local engine_old = file.nameonly(environment.ownbin)
+local engine_old = file.nameonly(environment.ownmain) or file.nameonly(environment.ownbin)
local function restart(engine_old,engine_new)
- local command = format("%s --luaonly %q %s --redirected",engine_new,environment.ownname,environment.reconstructcommandline())
+ local ownname = file.join(file.dirname(environment.ownname),"mtxrun.lua")
+ local command = format("%s --luaonly %q %s --redirected",engine_new,ownname,environment.reconstructcommandline())
report(format("redirect %s -> %s: %s",engine_old,engine_new,command))
local result = os.execute(command)
os.exit(result == 0 and 0 or 1)
@@ -124,6 +127,10 @@ end
-- setargument("engine",engine_new) -- later on we need this
-- end
+if environment.validengines[engine_new] and engine_new ~= environment.basicengines[engine_old] then
+ restart(engine_old,engine_new)
+end
+
-- so far
-- constants
@@ -213,6 +220,7 @@ local special_runfiles = {
}
local extra_runfiles = {
+ "^m_k_i_v_.-%.pdf$",
"^l_m_t_x_.-%.pdf$",
}
@@ -620,7 +628,7 @@ function scripts.context.run(ctxdata,filename)
-- files = { }
elseif #files > 0 then
-- the list of given files is processed using the stub file
- mainfile = usedfiles.yes
+ mainfile = usedfiles.yes -- this can become "" for luametatex/lmtx
filelist = files
files = { }
else
@@ -661,6 +669,7 @@ function scripts.context.run(ctxdata,filename)
local a_arrange = getargument("arrange")
local a_noarrange = getargument("noarrange")
local a_jithash = getargument("jithash")
+ local a_permitloadlib = getargument("permitloadlib")
local a_texformat = getargument("texformat")
local a_keeptuc = getargument("keeptuc")
local a_keeplog = getargument("keeplog")
@@ -706,7 +715,8 @@ function scripts.context.run(ctxdata,filename)
formatfile, scriptfile = resolvers.locateformat(formatname)
end
--
- a_jithash = validstring(a_jithash or analysis.jithash) or nil
+ a_jithash = validstring(a_jithash or analysis.jithash) or nil
+ a_permitloadlib = a_permitloadlib or analysis.permitloadlib or nil
--
if not formatfile or not scriptfile then
report("warning: no format found, forcing remake (source driven)")
@@ -732,6 +742,9 @@ function scripts.context.run(ctxdata,filename)
if formatfile and scriptfile then
local suffix = validstring(getargument("suffix"))
local resultname = validstring(getargument("result"))
+ if not resultname or resultname == "" then
+ resultname = validstring(analysis.result)
+ end
local resultpath = file.pathpart(resultname)
if resultpath ~= "" then
resultname = nil
@@ -810,24 +823,17 @@ function scripts.context.run(ctxdata,filename)
-- ["safer"] = a_safer, -- better use --sandbox
-- ["no-mktex"] = true,
-- ["file-line-error-style"] = true,
--- ["fmt"] = formatfile,
--- ["lua"] = scriptfile,
+-- ["fmt"] = formatfile,
+-- ["lua"] = scriptfile,
["jobname"] = jobname,
["jithash"] = a_jithash,
+ ["permitloadlib"] = a_permitloadlib,
}
--
- if not a_timing then
- -- okay
- elseif c_flags.usemodule then
- c_flags.usemodule = format("timing,%s",c_flags.usemodule)
- else
- c_flags.usemodule = "timing"
- end
- --
local directives = { }
--
if a_nodates then
- directives[#directives+1] = format("backend.date=%s",type(a_nodates) == "string" and a_nodates or " no")
+ directives[#directives+1] = format("backend.date=%s",type(a_nodates) == "string" and a_nodates or "no")
end
--
if type(a_trailerid) == "string" then
@@ -848,6 +854,11 @@ function scripts.context.run(ctxdata,filename)
--
-- kindofrun: 1:first run, 2:successive run, 3:once, 4:last of maxruns
--
+ local engine = analysis.engine or "luametatex"
+ if engine == "luametatex" and (mainfile == usedfiles.yes or mainfile == usedfiles.nop) then
+ mainfile = "" -- we don't need that
+ end
+ --
for currentrun=1,maxnofruns do
--
c_flags.final = false
@@ -859,6 +870,7 @@ function scripts.context.run(ctxdata,filename)
c_flags.profile = a_profile and (tonumber(a_profile) or 0) or nil
--
print("") -- cleaner, else continuation on same line
+ --
local returncode = environment.run_format(
formatfile,
scriptfile,
@@ -1001,7 +1013,7 @@ function scripts.context.run(ctxdata,filename)
report("you can process (timing) statistics with:",jobname)
report()
report("context --extra=timing '%s'",jobname)
- report("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname)
+ -- report("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname)
report()
end
else
@@ -1348,6 +1360,8 @@ end
-- touching files (signals regeneration of formats)
+local newversion = false
+
local function touch(path,name,versionpattern,kind,kindpattern)
if path and path ~= "" then
name = filejoinname(path,name)
@@ -1356,9 +1370,11 @@ local function touch(path,name,versionpattern,kind,kindpattern)
end
local olddata = io.loaddata(name)
if olddata then
- local oldkind, newkind = "", kind or ""
- local oldversion, newversion = "", os.date("%Y.%m.%d %H:%M")
+ local oldkind = ""
+ local newkind = kind or ""
+ local oldversion = ""
local newdata
+ newversion = newversion or os.date("%Y.%m.%d %H:%M")
if versionpattern then
newdata = gsub(olddata,versionpattern,function(pre,mid,post)
oldversion = mid
@@ -1419,6 +1435,79 @@ function scripts.context.touch()
end
end
+function scripts.context.pages()
+ local filename = environment.files[1]
+ if filename then
+ local u = table.load(file.addsuffix(filename,"tuc"))
+ if u then
+ local p = u.structures.pages.collected
+ local l = u.structures.lists.collected
+ local page = environment.arguments.page
+ local list = environment.arguments.list
+ if type(page) == "string" then
+ page = settings_to_array(page)
+ end
+ if type(list) == "string" then
+ list = settings_to_array(list)
+ end
+ if page or list then
+ if page then
+ for i=1,#page do
+ page[i] = string.topattern(page[i])
+ end
+ for i=1,#p do
+ local pi = p[i]
+ local m = pi.marked
+ if m then
+ local ml = #m
+ for j=1,#page do
+ local n = page[j]
+ for k=1,ml do
+ if find(m[k],n) then
+ report("page : %04i %s",i,m[k])
+ end
+ end
+ end
+ end
+ end
+ end
+ if list then
+ for i=1,#list do
+ list[i] = string.topattern(list[i])
+ end
+ for i=1,#l do
+ local li = l[i]
+ local r = li.references
+ if r then
+ local rr = r.reference
+ if rr then
+ rr = splitstring(rr,",")
+ local rrl = #rr
+ for j=1,#list do
+ local n = list[j]
+ for k=1,rrl do
+ if find(rr[k],n) then
+ report("list : %04i %s",r.realpage,rr[k])
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ else
+ for i=1,#p do
+ local pi = p[i]
+ local m = pi.marked
+ if m then
+ report("page : %04i % t",i,m)
+ end
+ end
+ end
+ end
+ end
+end
+
-- modules
local labels = { "title", "comment", "status" }
@@ -1645,6 +1734,8 @@ elseif getargument("version") then
scripts.context.version()
elseif getargument("touch") then
scripts.context.touch()
+elseif getargument("pages") then
+ scripts.context.pages()
elseif getargument("expert") then
application.help("expert", "special")
elseif getargument("showmodules") or getargument("modules") then
@@ -1678,6 +1769,19 @@ elseif getargument("purge") then
elseif getargument("purgeall") then
-- only when no filename given, supports --pattern
scripts.context.purge(true,nil,true)
+elseif getargument("pattern") then
+ environment.filenames = dir.glob(getargument("pattern"))
+ scripts.context.timed(scripts.context.autoctx)
else
application.help("basic")
end
+
+-- we can wipe a signal file when done
+
+do
+
+ if getargument("wipebusy") then
+ os.remove("context-is-busy.tmp")
+ end
+
+end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-context.xml b/Master/texmf-dist/scripts/context/lua/mtx-context.xml
index 0c7038d2680..98a75244b12 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-context.xml
+++ b/Master/texmf-dist/scripts/context/lua/mtx-context.xml
@@ -4,7 +4,7 @@
<metadata>
<entry name="name">mtx-context</entry>
<entry name="detail">ConTeXt Process Management</entry>
- <entry name="version">1.03</entry>
+ <entry name="version">1.04</entry>
<entry name="comment">external helpinfo file</entry>
</metadata>
<flags>
@@ -82,6 +82,9 @@
<flag name="noconsole">
<short>disable logging to the console (logfile only)</short>
</flag>
+ <flag name="nodummy">
+ <short>don't create a dummy file (can confuse pdf viewers that keep file in view)</short>
+ </flag>
<flag name="purgeresult">
<short>purge result file before run</short>
</flag>
@@ -109,6 +112,11 @@
</flag>
</subcategory>
<subcategory>
+ <flag name="pages">
+ <short>report pagenumbers of names pages and list references (<ref name="page"/>=... or <ref name="page"/>=...)</short>
+ </flag>
+ </subcategory>
+ <subcategory>
<flag name="jit">
<short>use luajittex with jit turned off (only use the faster virtual machine)</short>
</flag>
@@ -200,6 +208,9 @@
<flag name="lmtx">
<short>force lmtx mode (when available)</short>
</flag>
+ <flag name="overloadmode=error|warning|0--6|255">
+ <short>enable csname overload checking</short>
+ </flag>
</subcategory>
<subcategory>
<flag name="extra=name">
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-epub.lua b/Master/texmf-dist/scripts/context/lua/mtx-epub.lua
index 956ce4931a9..0109b15c4d2 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-epub.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-epub.lua
@@ -497,7 +497,7 @@ function scripts.epub.make(purge,rename,svgmath,svgstyle)
-- end of todo
- local pdftosvg = os.which("mudraw") and formatters[ [[mudraw -o "%s" "%s" %s]] ]
+ local pdftosvg = os.which("mutool") and formatters[ [[mutool draw -o "%s" "%s" %s]] ]
local f_svgpage = formatters["%s-page-%s.svg"]
local f_svgname = formatters["%s.svg"]
@@ -509,7 +509,7 @@ function scripts.epub.make(purge,rename,svgmath,svgstyle)
local newfiles = { }
if not pdftosvg then
- report("the %a binary is not present","mudraw")
+ report("the %a binary is not present","mutool")
end
-- a coverpage file has to be in the root of the export tree
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
index fcba696c43c..65a661ac40b 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-fonts.lua
@@ -16,7 +16,7 @@ local lower = string.lower
local concat = table.concat
local write_nl = (logs and logs.writer) or (texio and texio.write_nl) or print
-local otlversion = 3.111
+local otlversion = 3.113
local helpinfo = [[
<?xml version="1.0"?>
@@ -486,11 +486,16 @@ function scripts.fonts.convert() -- new save
if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' then
local data = fonts.handlers.otf.readers.loadfont(filename,sub)
if data then
+ local nofsubfonts = data and data.properties and data.properties.nofsubfonts or 0
fonts.handlers.otf.readers.compact(data)
fonts.handlers.otf.readers.rehash(data,getargument("names") and "names" or "unicodes")
local savename = replacesuffix(lower(data.metadata.fullname or filename),"lua")
table.save(savename,data)
- report("font: %a saved as %a",filename,savename)
+ if nofsubfonts == 0 then
+ report("font: %a saved as %a",filename,savename)
+ else
+ report("font: %a saved as %a, %i subfonts found, provide number if wanted",filename,savename,nofsubfonts)
+ end
else
report("font: %a not loaded",filename)
end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-install.lua b/Master/texmf-dist/scripts/context/lua/mtx-install.lua
index b9b4103531d..614d20e9294 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-install.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-install.lua
@@ -19,7 +19,7 @@ local helpinfo = [[
<flags>
<category name="basic">
<subcategory>
- <flag name="platform" value="string"><short>platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)</short></flag>
+ <flag name="platform" value="string"><short>platform</short></flag>
<flag name="server" value="string"><short>repository url (rsync://contextgarden.net)</short></flag>
<flag name="modules" value="string"><short>extra modules (can be list or 'all')</short></flag>
<flag name="fonts" value="string"><short>additional fonts (can be list or 'all')</short></flag>
@@ -79,6 +79,7 @@ local platforms = {
["mswin-64"] = "win64",
["windows-64"] = "win64",
["win64"] = "win64",
+ ["arm64"] = "windows-arm64",
--
["linux"] = "linux",
["linux-32"] = "linux",
@@ -87,13 +88,14 @@ local platforms = {
["linux-64"] = "linux-64",
["linux64"] = "linux-64",
--
- ["linuxmusl-64"] = "linuxmusl-64",
+ ["linuxmusl-64"] = "linuxmusl",
+ ["linuxmusl"] = "linuxmusl",
--
["linux-armhf"] = "linux-armhf",
--
- ["openbsd"] = "openbsd6.6",
- ["openbsd-i386"] = "openbsd6.6",
- ["openbsd-amd64"] = "openbsd6.6-amd64",
+ ["openbsd"] = "openbsd6.8",
+ ["openbsd-i386"] = "openbsd6.8",
+ ["openbsd-amd64"] = "openbsd6.8-amd64",
--
["freebsd"] = "freebsd",
["freebsd-i386"] = "freebsd",
@@ -119,6 +121,10 @@ local platforms = {
["macosx"] = "osx-64",
["osx"] = "osx-64",
["osx-64"] = "osx-64",
+-- ["osx-arm"] = "osx-arm64",
+-- ["osx-arm64"] = "osx-arm64",
+ ["osx-arm"] = "osx-64",
+ ["osx-arm64"] = "osx-64",
--
-- ["solaris-intel"] = "solaris-intel",
--
@@ -152,11 +158,16 @@ function install.identify()
local name = files[i]
local size = filesize(name)
local base = gsub(name,pattern,"")
- local stamp = hashdata(io.loaddata(name))
- details[i] = { base, size, stamp }
- total = total + size
+ local data = io.loaddata(name)
+ if data and #data > 0 then
+ local stamp = hashdata(data)
+ details[i] = { base, size, stamp }
+ total = total + size
+ else
+ report("%-24s : bad file %a",tree,name)
+ end
end
- report("%-20s : %4i files, %3.0f MB",tree,#files,total/(1000*1000))
+ report("%-24s : %4i files, %3.0f MB",tree,#files,total/(1000*1000))
savetable(path .. ".tma",details)
@@ -498,16 +509,19 @@ function install.update()
local binpath = joinfile(targetroot,"tex",texmfplatform,"bin")
local luametatex = "luametatex"
+ local luatex = "luatex"
local mtxrun = "mtxrun"
local context = "context"
if ostype == "windows" then
luametatex = addsuffix(luametatex,"exe")
+ luatex = addsuffix(luatex,"exe")
mtxrun = addsuffix(mtxrun,"exe")
context = addsuffix(context,"exe")
end
local luametatexbin = joinfile(binpath,luametatex)
+ local luatexbin = joinfile(binpath,luatex)
local mtxrunbin = joinfile(binpath,mtxrun)
local contextbin = joinfile(binpath,context)
@@ -552,6 +566,11 @@ function install.update()
else
-- report("xbit bad : %s",luametatexbin)
end
+ if lfs.setexecutable(luatexbin) then
+ report("xbit set : %s",luatexbin)
+ else
+ -- report("xbit bad : %s",luatexbin)
+ end
if lfs.setexecutable(mtxrunbin) then
report("xbit set : %s",mtxrunbin)
else
@@ -570,7 +589,6 @@ function install.update()
end
run("%s --make en", contextbin)
-
-- in calling script: update mtxrun.exe and mtxrun.lua
report("")
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-interface.lua b/Master/texmf-dist/scripts/context/lua/mtx-interface.lua
index 85ccb3ca0ad..a335560fa56 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-interface.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-interface.lua
@@ -36,6 +36,7 @@ local helpinfo = [[
<flag name="raw"><short>report commands to the console</short></flag>
<flag name="check"><short>generate check file</short></flag>
<flag name="meaning"><short>report the mening of commands</short></flag>
+ <flag name="tokens"><short>show the internal representation of commands</short></flag>
</subcategory>
<subcategory>
<flag name="toutf"><short>replace named characters by utf</short></flag>
@@ -168,6 +169,10 @@ function flushers.raw(collected)
end
end
+function flushers.data(collected)
+ return collected -- table.save("cont-en-filenames.lua",collected.filenames)
+end
+
local textpadcreator = "mtx-interface-textpad.lua"
function flushers.text(collected)
@@ -256,9 +261,10 @@ end
function scripts.interface.editor(editor,split,forcedinterfaces)
require("char-def")
- local interfaces = forcedinterfaces or environment.files
- if #interfaces == 0 then
- interfaces= userinterfaces
+ local interfaces = forcedinterfaces or environment.files or userinterfaces
+ if not interfaces.en then
+ -- loaded as script so we have "cont-yes.*" as name
+ interfaces = { "en" }
end
--
-- local filename = "i-context.xml"
@@ -376,13 +382,13 @@ function scripts.interface.editor(editor,split,forcedinterfaces)
end
-- skip (for now)
elseif type ~= "environment" then
- i_commands[n] = true
+ i_commands[n] = at.file or true
elseif split then
- i_environments[n] = true
+ i_environments[n] = at.file or true
else
-- variables ?
- i_commands[start..n] = true
- i_commands[stop ..n] = true
+ i_commands[start..n] = at.file or true
+ i_commands[stop ..n] = at.file or true
end
end
end
@@ -419,6 +425,19 @@ function scripts.interface.editor(editor,split,forcedinterfaces)
end
end
end
+ local filenames = { }
+ if collected.en then
+ for k, v in next, collected.en.commands do
+ if v ~= true then
+ filenames[k] = v
+ end
+ end
+ for k, v in next, collected.en.environments do
+ if v ~= true then
+ filenames[k] = v
+ end
+ end
+ end
for k, v in next, collected do
local c = v.commands
local e = v.environments
@@ -460,9 +479,13 @@ function scripts.interface.editor(editor,split,forcedinterfaces)
mathnames = sortedkeys(mathnames),
commands = sortedkeys(commoncommands),
environments = sortedkeys(commonenvironments),
+ filenames = filenames,
}
--
- flushers[editor](collected)
+ local flusher = flushers[editor]
+ if flusher then
+ return flusher(collected)
+ end
end
function scripts.interface.check()
@@ -690,6 +713,26 @@ function scripts.interface.meaning()
end
end
+function scripts.interface.tokens()
+ local runner = "mtxrun --silent --script context --extra=meaning --tokens --once --noconsole --nostatistics"
+ local pattern = environment.arguments.pattern
+ local files = environment.files
+ if type(pattern) == "string" then
+ runner = runner .. ' --pattern="' .. pattern .. '"'
+ elseif files and #files > 0 then
+ for i=1,#files do
+ runner = runner .. ' "' .. files[i] .. '"'
+ end
+ else
+ return
+ end
+ local r = os.resultof(runner)
+ if type(r) == "string" then
+ r = gsub(r,"^.-(tokens%s+>)","\n%1")
+ print(r)
+ end
+end
+
local ea = environment.argument
if ea("mkii") then
@@ -698,6 +741,8 @@ elseif ea("preprocess") then
scripts.interface.preprocess()
elseif ea("meaning") then
scripts.interface.meaning()
+elseif ea("tokens") then
+ scripts.interface.tokens()
elseif ea("toutf") then
scripts.interface.toutf()
elseif ea("bidi") then
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-kpse.lua b/Master/texmf-dist/scripts/context/lua/mtx-kpse.lua
new file mode 100644
index 00000000000..7542751ac5f
--- /dev/null
+++ b/Master/texmf-dist/scripts/context/lua/mtx-kpse.lua
@@ -0,0 +1,124 @@
+if not modules then modules = { } end modules ['mtx-kpse'] = {
+ version = 1.001,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- I decided to make this module after a report on the mailing list about
+-- a clash with texmf-var on a system that had texlive installed. One way
+-- to figure that out is to use kpse. We had the code anyway so next time
+-- there is some issue ...
+
+trackers.enable("resolvers.lib.silent")
+
+local kpse = LUATEXENGINE == "luametatex" and require("libs-imp-kpse.lmt")
+
+if type(kpse) ~= "table" then
+ return
+end
+
+local helpinfo = [[
+<?xml version="1.0"?>
+<application>
+ <metadata>
+ <entry name="name">mtx-kpse</entry>
+ <entry name="detail">ConTeXt KPSE checking utility</entry>
+ <entry name="version">1.00</entry>
+ </metadata>
+ <flags>
+ <category name="basic">
+ <subcategory>
+ <flag name="progname"><short>mandate, set the program name (e.g. pdftex)</short></flag>
+ <flag name="findfile"><short>report the fully qualified path of the given file</short></flag>
+ <flag name="findfiles"><short>report a list of all full names of the given file</short></flag>
+ <flag name="expandpath"><short>expand the given path variable</short></flag>
+ <flag name="expandvar"><short>expand a variable</short></flag>
+ <flag name="expandbraces"><short>expand a complex variable specification</short></flag>
+ <flag name="varvalue"><short>show the value of a variable</short></flag>
+ <flag name="readablefile"><short>report if a file is readable</short></flag>
+ <flag name="filetypes"><short>list all supported formats</short></flag>
+ </subcategory>
+ </category>
+ <category name="additional">
+ <subcategory>
+ <flag name="format"><short>format type</short></flag>
+ <flag name="path"><short>path variable</short></flag>
+ <flag name="split"><short>split result in lines</short></flag>
+ </subcategory>
+ </category>
+ </flags>
+ <examples>
+ <category>
+ <title>Examples</title>
+ <subcategory>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfile context.mkii</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfile context.mkii --format=tex</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --findfiles context.mkii --path=$TEXINPUTS</command></example>
+ </subcategory>
+ <subcategory>
+ <example><command>mtxrun --script kpse --progname=pdftex --expandpath $TEXMFVAR</command></example>
+ <example><command>mtxrun --script kpse --progname=pdftex --expandpath $TEXINPUTS -- split</command></example>
+ </subcategory>
+ </category>
+ </examples>
+</application>
+]]
+
+local application = logs.application {
+ name = "mtx-kpse",
+ banner = "ConTeXt KPSE checking utility",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+local argument = environment.argument
+local files = environment.files
+local target = files[1]
+
+if argument("progname") or argument("programname") then
+ kpse.set_program_name(argument("progname"))
+else
+ application.help()
+ return
+end
+
+local function printtable(result)
+ if type(result) == "table" then
+ for i=1,#result do
+ print(result[i])
+ end
+ end
+end
+
+if argument("exporthelp") then
+ application.export(environment.argument("exporthelp"),target)
+elseif argument("filetypes") or argument("formats") then
+ print(table.concat(kpse.get_file_types()," "))
+elseif type(target) == "string" and target ~= "" then
+ if argument("findfiles") or argument("find-files") then
+ printtable(kpse.find_files(argument("path"),target))
+ elseif argument("findfile") or argument("find-file") then
+ print(kpse.find_file(target,argument("format")))
+ elseif argument("expandpath") or argument("expand-path") then
+ local result = kpse.expand_path(target)
+ if result and argument("split") then
+ printtable(string.split(result,";"))
+ else
+ print(result)
+ end
+ elseif argument("expandvar") or argument("expand-var") then
+ print(kpse.expand_var(target))
+ elseif argument("expandbraces") or argument("expand-braces") then
+ print(kpse.expand_braces(target))
+ elseif argument("varvalue") or argument("var-value") then
+ print(kpse.var_value(target))
+ elseif argument("readablefile") or argument("readable-file") then
+ print(kpse.readable_file(target))
+ else
+ application.help()
+ end
+else
+ application.help()
+end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua
index 37843a6b604..36b60192d28 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua
@@ -107,7 +107,7 @@ scripts.patterns.list = {
{ "agr", "hyph-grc", "ancient greek", ignored_ancient_greek },
{ "gb", "hyph-en-gb", "british english" },
{ "us", "hyph-en-us", "american english" },
- -- { "eo", "hyph-eo", "esperanto" },
+ { "eo", "hyph-eo", "esperanto" },
{ "es", "hyph-es", "spanish" },
{ "et", "hyph-et", "estonian" },
{ "eu", "hyph-eu", "basque" },
@@ -150,7 +150,8 @@ scripts.patterns.list = {
-- { "sa", "hyph-sa", "sanskrit" },
{ "sk", "hyph-sk", "slovak" },
{ "sl", "hyph-sl", "slovenian" },
- { "sr", "hyph-sr-cyrl", "serbian" },
+ { "sr", "hyph-sr", "serbian", false, { "hyph-sr-cyrl", "hyph-sr-latn" }, },
+ -- { "sr", "hyph-sr-cyrl", "serbian", false },
-- { "sr", "hyph-sr-latn", "serbian" },
{ "sv", "hyph-sv", "swedish" },
-- { "ta", "hyph-ta", "tamil" },
@@ -171,23 +172,32 @@ end
-- *.tex
-- *.hyp.txt *.pat.txt *.lic.txt *.chr.txt
-function scripts.patterns.load(path,name,mnemonic,ignored)
- local basename = name
+function scripts.patterns.load(path,name,mnemonic,ignored, merged)
local fullname = file.join(path,name)
- local texfile = addsuffix(fullname,"tex")
- local hypfile = addsuffix(fullname,"hyp.txt")
- local patfile = addsuffix(fullname,"pat.txt")
- local licfile = addsuffix(fullname,"lic.txt")
- -- local chrfile = addsuffix(fullname,"chr.txt")
+ local basename = name
+ local texfile = addsuffix(fullname,"tex")
+ local hypfile = addsuffix(fullname,"hyp.txt")
+ local patfile = addsuffix(fullname,"pat.txt")
+ local licfile = addsuffix(fullname,"lic.txt")
+ -- local chrfile = addsuffix(fullname,"chr.txt")
local okay = true
local hyphenations, patterns, comment, stripset = "", "", "", ""
local splitpatternsnew, splithyphenationsnew = { }, { }
local splitpatternsold, splithyphenationsold = { }, { }
local usedpatterncharactersnew, usedhyphenationcharactersnew = { }, { }
- if lfs.isfile(patfile) then
+ if merged then
+ report("using merged txt files %s.[hyp|pat|lic].txt",name)
+ for i=1,#merged do
+ local fullname = file.join(path,merged[i])
+ comment = comment .. (io.loaddata(addsuffix(fullname,"lic.txt")) or "") .. "\n\n"
+ patterns = patterns .. (io.loaddata(addsuffix(fullname,"pat.txt")) or "") .. "\n\n"
+ hyphenations = hyphenations .. (io.loaddata(addsuffix(fullname,"hyp.txt")) or "") .. "\n\n"
+ end
+ elseif lfs.isfile(patfile) then
report("using txt files %s.[hyp|pat|lic].txt",name)
- comment, patterns, hyphenations = io.loaddata(licfile) or "", io.loaddata(patfile) or "", io.loaddata(hypfile) or ""
- hypfile, patfile, licfile = hypfile, patfile, licfile
+ comment = io.loaddata(licfile) or ""
+ patterns = io.loaddata(patfile) or ""
+ hyphenations = io.loaddata(hypfile) or ""
elseif lfs.isfile(texfile) then
report("using tex file %s.txt",name)
local data = io.loaddata(texfile) or ""
@@ -203,9 +213,9 @@ function scripts.patterns.load(path,name,mnemonic,ignored)
end)
data = gsub(data,"%%.-[\n\r]","")
data = gsub(data," *[\n\r]+","\n")
- patterns = match(data,"\\patterns[%s]*{[%s]*(.-)[%s]*}") or ""
+ patterns = match(data,"\\patterns[%s]*{[%s]*(.-)[%s]*}") or ""
hyphenations = match(data,"\\hyphenation[%s]*{[%s]*(.-)[%s]*}") or ""
- comment = match(data,"^(.-)[\n\r]\\patterns") or ""
+ comment = match(data,"^(.-)[\n\r]\\patterns") or ""
else
okay = false
end
@@ -514,10 +524,10 @@ function scripts.patterns.check()
only = table.tohash(files)
end
for k, v in next, scripts.patterns.list do
- local mnemonic, name, ignored = v[1], v[2], v[4]
+ local mnemonic, name, ignored, merged = v[1], v[2], v[4], v[5]
if not only or only[mnemonic] then
report("checking language %s, file %s", mnemonic, name)
- local okay = scripts.patterns.load(path,name,mnemonic,ignored)
+ local okay = scripts.patterns.load(path,name,mnemonic,ignored, merged)
if not okay then
report("there are errors that need to be fixed")
end
@@ -541,11 +551,11 @@ function scripts.patterns.convert()
only = table.tohash(files)
end
for k, v in next, scripts.patterns.list do
- local mnemonic, name, ignored = v[1], v[2], v[4]
+ local mnemonic, name, ignored, merged = v[1], v[2], v[4], v[5]
if not only or only[mnemonic] then
report("converting language %s, file %s", mnemonic, name)
local okay, patternsnew, hyphenationsnew, patternsold, hyphenationsold, comment, stripped,
- pusednew, husednew, pusedold, husedold = scripts.patterns.load(path,name,mnemonic,ignored)
+ pusednew, husednew, pusedold, husedold = scripts.patterns.load(path,name,mnemonic,ignored,merged)
if okay then
scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenationsnew,patternsold,hyphenationsold,comment,stripped,
pusednew,husednew,pusedold,husedold,ignored)
@@ -689,8 +699,8 @@ end
-- mtxrun --script pattern --check hyph-*.tex
-- mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns
--- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns
--- mtxrun --script pattern --convert --path=c:/data/repositories/tex-hyphen/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns
+-- mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns
+-- mtxrun --script pattern --convert --path=c:/data/repositories/tex-hyphen/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns
--
-- use this call:
--
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua
index 96020de3dba..b5360770e41 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-scite.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-scite.lua
@@ -251,11 +251,11 @@ function scripts.scite.tree()
local source = environment.argument("source")
local target = environment.argument("target")
local numbers = environment.argument("numbers")
- if not lfs.isdir(source) then
+ if not source or not lfs.isdir(source) then
report("you need to pass a valid source path with --source")
return
end
- if not lfs.isdir(target) then
+ if not target or not lfs.isdir(target) then
report("you need to pass a valid target path with --target")
return
end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua b/Master/texmf-dist/scripts/context/lua/mtx-timing.lua
deleted file mode 100644
index 5ba361e5f1a..00000000000
--- a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua
+++ /dev/null
@@ -1,218 +0,0 @@
-if not modules then modules = { } end modules ['mtx-timing'] = {
- version = 1.002,
- comment = "companion to mtxrun.lua",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
-local format, gsub, concat = string.format, string.gsub, table.concat
-
-local helpinfo = [[
-<?xml version="1.0"?>
-<application>
- <metadata>
- <entry name="name">mtx-timing</entry>
- <entry name="detail">ConTeXt Timing Tools</entry>
- <entry name="version">0.10</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="xhtml"><short>make xhtml file</short></flag>
- <flag name="launch"><short>launch after conversion</short></flag>
- <flag name="remove"><short>remove after launching</short></flag>
- </subcategory>
- </category>
- </flags>
-</application>
-]]
-
-local application = logs.application {
- name = "mtx-timing",
- banner = "ConTeXt Timing Tools 0.10",
- helpinfo = helpinfo,
-}
-
-local report = application.report
-
-dofile(resolvers.findfile("node-snp.lua","tex"))
-dofile(resolvers.findfile("trac-tim.lua","tex"))
-dofile(resolvers.findfile("trac-lmx.lua","tex"))
-
-local meta = [[
- beginfig(%s) ;
- begingroup ;
- save p, q, b, h, w ;
- path p, q, b ; numeric h, w ;
- linecap := butt ;
- h := 100 ;
- w := 800pt ;
- p := %s ;
- q := %s ;
- p := p shifted -llcorner p ;
- q := q shifted -llcorner q ;
- q := q xstretched w ;
- p := p xstretched w ;
- b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ;
- draw b withcolor white withpen pencircle scaled 4pt ;
- draw p withcolor red withpen pencircle scaled 4pt ;
- draw q withcolor blue withpen pencircle scaled 2pt ;
- endgroup ;
- endfig ;
-]]
-
-local html_graphic = [[
- <h1><a name='graphic-%s'>%s (red) %s (blue)</a></h1>
- <table>
- <tr>
- <td>%s</td>
- <td valign='top'>
- &nbsp;&nbsp;min: %s<br/>
- &nbsp;&nbsp;max: %s<br/>
- &nbsp;&nbsp;pages: %s<br/>
- &nbsp;&nbsp;average: %s<br/>
- </td>
- </tr>
- </table>
- <br/>
-]]
-
-local html_menu = [[
- <a href='#graphic-%s'>%s</a>
-]]
-
-local directrun = true
-
-local what = { "parameters", "nodes" }
-
-plugins = plugins or { progress = { } } -- brrr, will become moduledata as well
-
-function plugins.progress.make_svg(filename,other)
- local metadata, menudata, c = { }, { }, 0
- metadata[#metadata+1] = 'outputformat := "svg" ;'
- for i=1,#what do
- local kind, mdk = what[i], { }
- menudata[kind] = mdk
- for n, name in next, plugins.progress[kind](filename) do
- local first = plugins.progress.path(filename,name)
- local second = plugins.progress.path(filename,other)
- c = c + 1
- metadata[#metadata+1] = format(meta,c,first,second)
- mdk[#mdk+1] = { name, c }
- end
- end
- metadata[#metadata+1] = "end ."
- metadata = concat(metadata,"\n\n")
- if directrun then
- dofile(resolvers.findfile("mlib-run.lua","tex"))
- commands = commands or { }
- commands.writestatus = report
- local result = metapost.directrun("metafun","timing data","svg",true,metadata)
- return menudata, result
- else
- local mpname = file.replacesuffix(filename,"mp")
- io.savedata(mpname,metadata)
- os.execute(format("mpost --progname=context --mem=metafun.mem %s",mpname))
- os.remove(mpname)
- os.remove(file.removesuffix(filename).."-mpgraph.mpo") -- brr
- os.remove(file.removesuffix(filename)..".log") -- brr
- return menudata
- end
-end
-
-function plugins.progress.makehtml(filename,other,menudata,metadata)
- local graphics = { }
- local result = { graphics = graphics }
- for i=1,#what do
- local kind, menu = what[i], { }
- local md = menudata[kind]
- result[kind] = menu
- for k=1,#md do
- local v = md[k]
- local name, number = v[1], v[2]
- local min = plugins.progress.bot(filename,name)
- local max = plugins.progress.top(filename,name)
- local pages = plugins.progress.pages(filename)
- local average = math.round(max/pages)
- if directrun then
- local data = metadata[number]
- menu[#menu+1] = format(html_menu,name,name)
- graphics[#graphics+1] = format(html_graphic,name,name,other,data,min,max,pages,average)
- else
- local mpname = file.replacesuffix(filename,number)
- local data = io.loaddata(mpname) or ""
- -- data = gsub(data,"<!%-%-(.-)%-%->[\n\r]*","")
- data = gsub(data,"<%?xml.->","")
- menu[#menu+1] = format(html_menu,name,name)
- graphics[#graphics+1] = format(html_graphic,name,name,other,data,min,max,pages,average)
- os.remove(mpname)
- end
- end
- end
- return result
-end
-
-function plugins.progress.valid_file(name)
- return name and name ~= "" and lfs.isfile(name .. "-luatex-progress.lut")
-end
-
-function plugins.progress.make_lmx_page(name,launch,remove)
-
- local filename = name .. "-luatex-progress"
- local other = "elapsed_time"
- local template = 'context-timing.lmx'
-
- plugins.progress.convert(filename)
-
- local menudata, metadata = plugins.progress.make_svg(filename,other)
- local htmldata = plugins.progress.makehtml(filename,other,menudata,metadata)
-
- lmx.htmfile = function(name) return name .. "-timing.xhtml" end
- lmx.lmxfile = function(name) return resolvers.findfile(name,'tex') end
-
- local variables = {
- ['title-default'] = 'ConTeXt Timing Information',
- ['title'] = format('ConTeXt Timing Information: %s',file.basename(name)),
- ['parametersmenu'] = concat(htmldata.parameters, "&nbsp;&nbsp;"),
- ['nodesmenu'] = concat(htmldata.nodes, "&nbsp;&nbsp;"),
- ['graphics'] = concat(htmldata.graphics, "\n\n"),
- ['color-background-one'] = lmx.get('color-background-green'),
- ['color-background-two'] = lmx.get('color-background-blue'),
- }
-
- if launch then
- local htmfile = lmx.show(template,variables)
- if remove then
- os.sleep(1) -- give time to launch
- os.remove(htmfile)
- end
- else
- lmx.make(template,variables)
- end
-
-end
-
-scripts = scripts or { }
-scripts.timings = scripts.timings or { }
-
-function scripts.timings.xhtml(filename)
- if filename == "" then
- report("provide filename")
- elseif not plugins.progress.valid_file(filename) then
- report("first run context again with the --timing option")
- else
- local basename = file.removesuffix(filename)
- local launch = environment.argument("launch")
- local remove = environment.argument("remove")
- plugins.progress.make_lmx_page(basename,launch,remove)
- end
-end
-
-if environment.argument("xhtml") then
- scripts.timings.xhtml(environment.files[1] or "")
-elseif environment.argument("exporthelp") then
- application.export(environment.argument("exporthelp"),environment.files[1])
-else
- application.help()
-end
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-unicode.lua b/Master/texmf-dist/scripts/context/lua/mtx-unicode.lua
index 297807889e4..060e563c642 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-unicode.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-unicode.lua
@@ -146,6 +146,8 @@ function scripts.unicode.update()
local index = texttables.index
local characterdata = characters.data
--
+ local descriptions = { }
+ --
for unicode, ud in table.sortedpairs(unicodedata) do
if not skipped[unicode] then
local char = rawget(characterdata,unicode)
@@ -162,6 +164,7 @@ function scripts.unicode.update()
local cjkwd = ed and lower(ed[2] or "n")
local mirror = bd and tonumber(bd[2],16)
local arabic = nil
+ descriptions[description] = unicode
if sparse and direction == "l" then
direction = nil
end
@@ -382,6 +385,26 @@ function scripts.unicode.update()
end
end
end
+ -- we need the hash .. add missing specials
+ for unicode, data in table.sortedhash(characterdata) do
+ if not data.specials or data.comment and find(data.comment,"check special") then
+ local description = data.description
+ local b, m = match(description,"^(.+) WITH (.+)$")
+ if b and m and (find(b,"^LATIN") or find (b,"^CYRILLIC")) then
+ local base = descriptions[b]
+ local mark = descriptions[m]
+ if not mark and m == "STROKE" then
+ mark = descriptions["SOLIDUS"] -- SLASH
+ end
+ if base and mark then
+ report("adding extra char special for %a",description)
+ data.specials = { "with", base, mark }
+ data.comment = nil
+ end
+ end
+ end
+ end
+ --
for i=1,#standardizedvariants do
local si = standardizedvariants[i]
local pair, addendum = si[1], strip(si[2])
@@ -519,6 +542,10 @@ function scripts.unicode.load()
arabicshaping = splitdefinition(textdata.arabicshaping,true),
index = splitindex(textdata.index),
}
+ --
+ for k, v in table.sortedhash(textfiles) do
+ report("using: %s",v)
+ end
return true
else
preamble = nil
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-update.lua b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
index e03012901da..b0ed9aac7e2 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-update.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
@@ -238,9 +238,9 @@ update.platforms = {
--
["linux-armhf"] = "linux-armhf",
--
- ["openbsd"] = "openbsd6.5",
- ["openbsd-i386"] = "openbsd6.5",
- ["openbsd-amd64"] = "openbsd6.5-amd64",
+ ["openbsd"] = "openbsd6.8",
+ ["openbsd-i386"] = "openbsd6.8",
+ ["openbsd-amd64"] = "openbsd6.8-amd64",
--
["freebsd"] = "freebsd",
["freebsd-i386"] = "freebsd",
@@ -266,6 +266,7 @@ update.platforms = {
["macosx"] = "osx-64",
["osx"] = "osx-64",
["osx-64"] = "osx-64",
+ ["osx-arm64"] = "osx-64",
--
-- ["solaris-intel"] = "solaris-intel",
--
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index 6eaf5ff449f..6fc17adb022 100755
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -852,7 +849,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11605, stripped down to: 8299
+-- original size: 12566, stripped down to: 8937
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -861,7 +858,7 @@ if not modules then modules={} end modules ['l-package']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local type=type
+local type,unpack=type,unpack
local gsub,format,find=string.gsub,string.format,string.find
local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
@@ -891,6 +888,7 @@ local helpers=package.helpers or {
},
methods={},
sequence={
+ "reset loaded",
"already loaded",
"preload table",
"qualified path",
@@ -907,6 +905,7 @@ local methods=helpers.methods
local builtin=helpers.builtin
local extraluapaths={}
local extralibpaths={}
+local checkedfiles={}
local luapaths=nil
local libpaths=nil
local oldluapath=nil
@@ -1040,10 +1039,16 @@ end
local function loadedaslib(resolved,rawname)
local base=gsub(rawname,"%.","_")
local init="luaopen_"..gsub(base,"%.","_")
+ local data={ resolved,init,"" }
+ checkedfiles[#checkedfiles+1]=data
if helpers.trace then
helpers.report("calling loadlib with '%s' with init '%s'",resolved,init)
end
- return package.loadlib(resolved,init)
+ local a,b,c=package.loadlib(resolved,init)
+ if not a and type(b)=="string" then
+ data[3]=string.fullstrip(b or "unknown error")
+ end
+ return a,b,c
end
helpers.loadedaslib=loadedaslib
local function loadedbypath(name,rawname,paths,islib,what)
@@ -1082,11 +1087,18 @@ local function loadedbyname(name,rawname)
end
end
helpers.loadedbyname=loadedbyname
+methods["reset loaded"]=function(name)
+ checkedfiles={}
+ return false
+end
methods["already loaded"]=function(name)
return package.loaded[name]
end
methods["preload table"]=function(name)
- return builtin["preload table"](name)
+ local f=builtin["preload table"]
+ if f then
+ return f(name)
+ end
end
methods["qualified path"]=function(name)
return loadedbyname(addsuffix(lualibfile(name),"lua"),name)
@@ -1098,19 +1110,31 @@ methods["lib extra list"]=function(name)
return loadedbypath(addsuffix(lualibfile(name),os.libsuffix),name,getextralibpaths(),true,"lib")
end
methods["path specification"]=function(name)
- getluapaths()
- return builtin["path specification"](name)
+ local f=builtin["path specification"]
+ if f then
+ getluapaths()
+ return f(name)
+ end
end
methods["cpath specification"]=function(name)
- getlibpaths()
- return builtin["cpath specification"](name)
+ local f=builtin["cpath specification"]
+ if f then
+ getlibpaths()
+ return f(name)
+ end
end
methods["all in one fallback"]=function(name)
- return builtin["all in one fallback"](name)
+ local f=builtin["all in one fallback"]
+ if f then
+ return f(name)
+ end
end
methods["not loaded"]=function(name)
if helpers.trace then
helpers.report("unable to locate '%s'",name or "?")
+ for i=1,#checkedfiles do
+ helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i]))
+ end
end
return nil
end
@@ -1122,19 +1146,22 @@ function helpers.loaded(name)
level=level+1
for i=1,#sequence do
local method=sequence[i]
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
- end
- local result,rest=methods[method](name)
- if type(result)=="function" then
+ local lookup=method and methods[method]
+ if type(lookup)=="function" then
if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
end
- if helpers.traceused then
- used[#used+1]={ level=level,name=name }
+ local result,rest=lookup(name)
+ if type(result)=="function" then
+ if helpers.trace then
+ helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ end
+ if helpers.traceused then
+ used[#used+1]={ level=level,name=name }
+ end
+ level=level-1
+ return result,rest
end
- level=level-1
- return result,rest
end
end
level=level-1
@@ -1174,7 +1201,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 38440, stripped down to: 19316
+-- original size: 38703, stripped down to: 19489
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1272,11 +1299,13 @@ local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0)
local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0))
local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0)
local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0)
-local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0)
+local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
+local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0)
local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0)
-local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0)
+local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
+local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0)
patterns.stripper=stripper
patterns.fullstripper=fullstripper
patterns.collapser=collapser
@@ -1284,9 +1313,11 @@ patterns.nospacer=nospacer
patterns.b_collapser=b_collapser
patterns.m_collapser=m_collapser
patterns.e_collapser=e_collapser
+patterns.x_collapser=x_collapser
patterns.b_stripper=b_stripper
patterns.m_stripper=m_stripper
patterns.e_stripper=e_stripper
+patterns.x_stripper=x_stripper
patterns.lowercase=lowercase
patterns.uppercase=uppercase
patterns.letter=patterns.lowercase+patterns.uppercase
@@ -3806,7 +3837,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-os"] = package.loaded["l-os"] or true
--- original size: 19120, stripped down to: 10208
+-- original size: 19409, stripped down to: 10419
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -4029,6 +4060,8 @@ elseif name=="macosx" then
platform="osx-intel"
elseif find(architecture,"x86_64",1,true) then
platform="osx-64"
+ elseif find(architecture,"arm64",1,true) then
+ platform="osx-64"
else
platform="osx-ppc"
end
@@ -4200,11 +4233,19 @@ local function isleapyear(year)
end
os.isleapyear=isleapyear
local days={ 31,28,31,30,31,30,31,31,30,31,30,31 }
-local function nofdays(year,month)
+local function nofdays(year,month,day)
if not month then
return isleapyear(year) and 365 or 364
- else
+ elseif not day then
return month==2 and isleapyear(year) and 29 or days[month]
+ else
+ for i=1,month-1 do
+ day=day+days[i]
+ end
+ if month>2 and isleapyear(year) then
+ day=day+1
+ end
+ return day
end
end
os.nofdays=nofdays
@@ -5729,10 +5770,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 41281, stripped down to: 17261
+-- original size: 41303, stripped down to: 17277
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -6563,7 +6605,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 45153, stripped down to: 22734
+-- original size: 45129, stripped down to: 23525
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -6615,25 +6657,59 @@ local function points(n)
n=n*ptf
if n%1==0 then
return format("%ipt",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fpt",n))
+ end
+end
+local function nupoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*ptf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fpt",n))
end
local function basepoints(n)
if n==0 then
- return "0pt"
+ return "0bp"
end
n=tonumber(n)
if not n or n==0 then
- return "0pt"
+ return "0bp"
end
n=n*bpf
if n%1==0 then
return format("%ibp",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fbp",n))
+ end
+end
+local function nubasepoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*bpf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fbp",n))
end
number.points=points
+number.nupoints=nupoints
number.basepoints=basepoints
+number.nubasepoints=nubasepoints
local rubish=spaceortab^0*newline
local anyrubish=spaceortab+newline
local stripped=(spaceortab^1/"")*newline
@@ -6911,7 +6987,9 @@ local environment={
concat=table.concat,
signed=number.signed,
points=number.points,
+ nupoints=number.nupoints,
basepoints=number.basepoints,
+ nubasepoints=number.nubasepoints,
utfchar=utf.char,
utfbyte=utf.byte,
lpegmatch=lpeg.match,
@@ -7106,10 +7184,18 @@ local format_p=function()
n=n+1
return format("points(a%s)",n)
end
+local format_P=function()
+ n=n+1
+ return format("nupoints(a%s)",n)
+end
local format_b=function()
n=n+1
return format("basepoints(a%s)",n)
end
+local format_B=function()
+ n=n+1
+ return format("nubasepoints(a%s)",n)
+end
local format_t=function(f)
n=n+1
if f and f~="" then
@@ -7219,33 +7305,36 @@ local format_extension=function(extensions,f,name)
local extension=extensions[name] or "tostring(%s)"
local f=tonumber(f) or 1
local w=find(extension,"%.%.%.")
- if w then
- if f==0 then
+ if f==0 then
+ if w then
extension=gsub(extension,"%.%.%.","")
- return extension
- elseif f==1 then
+ end
+ return extension
+ elseif f==1 then
+ if w then
extension=gsub(extension,"%.%.%.","%%s")
- n=n+1
- local a="a"..n
- return format(extension,a,a)
- elseif f<0 then
+ end
+ n=n+1
+ local a="a"..n
+ return format(extension,a,a)
+ elseif f<0 then
+ if w then
+ extension=gsub(extension,"%.%.%.","")
+ return extension
+ else
local a="a"..(n+f+1)
return format(extension,a,a)
- else
- extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
- local t={}
- for i=1,f do
- n=n+1
- t[i]="a"..n
- end
- return format(extension,unpack(t))
end
else
- extension=gsub(extension,"%%s",function()
+ if w then
+ extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
+ end
+ local t={}
+ for i=1,f do
n=n+1
- return "a"..n
- end)
- return extension
+ t[i]="a"..n
+ end
+ return format(extension,unpack(t))
end
end
local builder=Cs { "start",
@@ -7259,7 +7348,7 @@ local builder=Cs { "start",
+V("n")
+V("N")
+V("k")
-+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("b")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
++V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
+V("W")
+V("a")
+V("A")
@@ -7297,7 +7386,9 @@ local builder=Cs { "start",
["u"]=(prefix_any*P("u"))/format_u,
["U"]=(prefix_any*P("U"))/format_U,
["p"]=(prefix_any*P("p"))/format_p,
+ ["P"]=(prefix_any*P("P"))/format_P,
["b"]=(prefix_any*P("b"))/format_b,
+ ["B"]=(prefix_any*P("B"))/format_B,
["t"]=(prefix_tab*P("t"))/format_t,
["T"]=(prefix_tab*P("T"))/format_T,
["l"]=(prefix_any*P("l"))/format_l,
@@ -7448,7 +7539,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 32649, stripped down to: 18257
+-- original size: 32815, stripped down to: 18257
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -8194,10 +8285,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fil"] = package.loaded["util-fil"] or true
--- original size: 11530, stripped down to: 9007
+-- original size: 11552, stripped down to: 9023
if not modules then modules={} end modules ['util-fil']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -8562,10 +8654,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 12946, stripped down to: 9507
+-- original size: 12968, stripped down to: 9523
if not modules then modules={} end modules ['util-sac']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -9215,7 +9308,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 24132, stripped down to: 16210
+-- original size: 24683, stripped down to: 16431
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9228,7 +9321,7 @@ local lpeg,table,string=lpeg,table,string
local P,R,V,S,C,Ct,Cs,Carg,Cc,Cg,Cf,Cp=lpeg.P,lpeg.R,lpeg.V,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cc,lpeg.Cg,lpeg.Cf,lpeg.Cp
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local concat,gmatch,find=table.concat,string.gmatch,string.find
-local tostring,type,next,rawset=tostring,type,next,rawset
+local tonumber,tostring,type,next,rawset=tonumber,tostring,type,next,rawset
local mod,div=math.mod,math.div
utilities=utilities or {}
local parsers=utilities.parsers or {}
@@ -9620,13 +9713,15 @@ function parsers.csvsplitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
local separator=specification.separator
local quotechar=specification.quote
+ local numbers=specification.numbers
local separator=S(separator~="" and separator or ",")
local whatever=C((1-separator-newline)^0)
if quotechar and quotechar~="" then
local quotedata=nil
for chr in gmatch(quotechar,".") do
local quotechar=P(chr)
- local quoteword=quotechar*C((1-quotechar)^0)*quotechar
+ local quoteitem=(1-quotechar)^0
+ local quoteword=quotechar*(numbers and (quoteitem/tonumber) or C(quoteitem))*quotechar
if quotedata then
quotedata=quotedata+quoteword
else
@@ -9642,12 +9737,14 @@ function parsers.csvsplitter(specification)
end
function parsers.rfc4180splitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
+ local numbers=specification.numbers
local separator=specification.separator
local quotechar=P(specification.quote)
local dquotechar=quotechar*quotechar
/specification.quote
local separator=S(separator~="" and separator or ",")
- local escaped=quotechar*Cs((dquotechar+(1-quotechar))^0)*quotechar
+ local whatever=(dquotechar+(1-quotechar))^0
+ local escaped=quotechar*(numbers and (whatever/tonumber) or Cs(whatever))*quotechar
local non_escaped=C((1-quotechar-newline-separator)^1)
local field=escaped+non_escaped+Cc("")
local record=Ct(field*(separator*field)^1)
@@ -11718,7 +11815,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-soc-imp-http"] = package.loaded["util-soc-imp-http"] or true
--- original size: 12577, stripped down to: 9577
+-- original size: 12624, stripped down to: 9598
local tostring,tonumber,setmetatable,next,type=tostring,tonumber,setmetatable,next,type
@@ -11763,7 +11860,7 @@ local function receiveheaders(sock,headers)
if not headers then
headers={}
end
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11773,13 +11870,13 @@ local function receiveheaders(sock,headers)
return nil,"malformed reponse headers"
end
name=lower(name)
- line,err=sock:receive()
+ line,err=sock:receive("*l")
if err then
return nil,err
end
while find(line,"^%s") do
value=value..line
- line=sock:receive()
+ line=sock:receive("*l")
if err then
return nil,err
end
@@ -11799,7 +11896,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
dirty=function() return sock:dirty() end,
},{
__call=function()
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11810,7 +11907,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
if size>0 then
local chunk,err,part=sock:receive(size)
if chunk then
- sock:receive()
+ sock:receive("*a")
end
return chunk,err
else
@@ -12712,7 +12809,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13394, stripped down to: 8882
+-- original size: 13901, stripped down to: 9175
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12735,7 +12832,7 @@ utilities.setters=setters
local data={}
local trace_initialize=false
local frozen=true
-function setters.initialize(filename,name,values)
+local function initialize_setter(filename,name,values)
local setter=data[name]
if setter then
local data=setter.data
@@ -12776,8 +12873,8 @@ function setters.initialize(filename,name,values)
end
end
local function set(t,what,newvalue)
- local data=t.data
- if not data.frozen then
+ local data=t.data
+ if data and not data.frozen then
local done=t.done
if type(what)=="string" then
what=settings_to_hash(what)
@@ -12813,7 +12910,7 @@ local function set(t,what,newvalue)
end
local function reset(t)
local data=t.data
- if not data.frozen then
+ if data and not data.frozen then
for name,functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
@@ -12834,7 +12931,7 @@ local function disable(t,what)
set(t,what,false)
end
end
-function setters.register(t,what,...)
+local function register_setter(t,what,...)
local data=t.data
what=lower(what)
local functions=data[what]
@@ -12869,23 +12966,24 @@ function setters.register(t,what,...)
end
return false
end
-function setters.enable(t,what)
+local function enable_setter(t,what)
local e=t.enable
t.enable,t.done=enable,{}
+ set(t,what,true)
enable(t,what)
t.enable,t.done=e,{}
end
-function setters.disable(t,what)
+local function disable_setter(t,what)
local e=t.disable
t.disable,t.done=disable,{}
disable(t,what)
t.disable,t.done=e,{}
end
-function setters.reset(t)
+local function reset_setter(t)
t.done={}
reset(t)
end
-function setters.list(t)
+local function list_setter(t)
local list=table.sortedkeys(t.data)
local user,system={},{}
for l=1,#list do
@@ -12898,8 +12996,8 @@ function setters.list(t)
end
return user,system
end
-function setters.show(t)
- local list=setters.list(t)
+local function show_setter(t)
+ local list=list_setter(t)
t.report()
for k=1,#list do
local name=list[k]
@@ -12930,39 +13028,50 @@ function setters.show(t)
end
end
end
-local enable,disable,register,list,show=setters.enable,setters.disable,setters.register,setters.list,setters.show
function setters.report(setter,fmt,...)
- print(formatters["%-15s : %s\n"](setter.name,formatters[fmt](...)))
+ if fmt then
+ print(formatters["%-15s : %s"](setter.name,formatters[fmt](...)))
+ else
+ print("")
+ end
end
-local function default(setter,name)
+local function setter_default(setter,name)
local d=setter.data[name]
return d and d.default
end
-local function value(setter,name)
+local function setter_value(setter,name)
local d=setter.data[name]
return d and (d.value or d.default)
end
-function setters.new(name)
+local function new_setter(name)
local setter
setter={
data=allocate(),
name=name,
- report=function(...) setters.report (setter,...) end,
- enable=function(...) enable (setter,...) end,
- disable=function(...) disable (setter,...) end,
- reset=function(...) reset (setter,...) end,
- register=function(...) register(setter,...) end,
- list=function(...) return list (setter,...) end,
- show=function(...) show (setter,...) end,
- default=function(...) return default (setter,...) end,
- value=function(...) return value (setter,...) end,
+ report=function(...) setters.report (setter,...) end,
+ enable=function(...) enable_setter (setter,...) end,
+ disable=function(...) disable_setter (setter,...) end,
+ reset=function(...) reset_setter (setter,...) end,
+ register=function(...) register_setter(setter,...) end,
+ list=function(...) return list_setter (setter,...) end,
+ show=function(...) show_setter (setter,...) end,
+ default=function(...) return setter_default (setter,...) end,
+ value=function(...) return setter_value (setter,...) end,
}
data[name]=setter
return setter
end
-trackers=setters.new("trackers")
-directives=setters.new("directives")
-experiments=setters.new("experiments")
+setters.enable=enable_setter
+setters.disable=disable_setter
+setters.register=register_setter
+setters.list=list_setter
+setters.show=show_setter
+setters.reset=reset_setter
+setters.new=new_setter
+setters.initialize=initialize_setter
+trackers=new_setter("trackers")
+directives=new_setter("directives")
+experiments=new_setter("experiments")
local t_enable,t_disable=trackers .enable,trackers .disable
local d_enable,d_disable=directives .enable,directives .disable
local e_enable,e_disable=experiments.enable,experiments.disable
@@ -13009,11 +13118,11 @@ if environment then
if engineflags then
local list=engineflags["c:trackers"] or engineflags["trackers"]
if type(list)=="string" then
- setters.initialize("commandline flags","trackers",settings_to_hash(list))
+ initialize_setter("commandline flags","trackers",settings_to_hash(list))
end
local list=engineflags["c:directives"] or engineflags["directives"]
if type(list)=="string" then
- setters.initialize("commandline flags","directives",settings_to_hash(list))
+ initialize_setter("commandline flags","directives",settings_to_hash(list))
end
end
end
@@ -13055,7 +13164,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 33003, stripped down to: 21667
+-- original size: 16017, stripped down to: 11045
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -13071,9 +13180,8 @@ local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
-local runningtex=tex and (tex.jobname or tex.formatname)
-local write_nl=runningtex and texio and texio.write_nl or print
-local write=runningtex and texio and texio.write or io.write
+local write_nl=print
+local write=io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -13109,273 +13217,7 @@ local function ansisupported(specification)
return false
end
end
-if runningtex and texio then
- if texio.setescape then
- texio.setescape(0)
- end
- if arg and ansisupported then
- for k,v in next,arg do
- if v=="--ansi" or v=="--c:ansi" then
- if ansisupported("ansi") then
- variant="ansi"
- end
- break
- elseif v=="--ansilog" or v=="--c:ansilog" then
- if ansisupported("ansilog") then
- variant="ansilog"
- end
- break
- end
- end
- end
- local function useluawrites()
- local texio_write_nl=texio.write_nl
- local texio_write=texio.write
- local io_write=io.write
- write_nl=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write_nl("log",...)
- texio_write_nl("term","")
- io_write(...)
- elseif target=="log" then
- texio_write_nl("log",...)
- elseif target=="term" then
- texio_write_nl("term","")
- io_write(...)
- elseif type(target)=="number" then
- texio_write_nl(target,...)
- elseif target~="none" then
- texio_write_nl("log",target,...)
- texio_write_nl("term","")
- io_write(target,...)
- end
- end
- write=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write("log",...)
- io_write(...)
- elseif target=="log" then
- texio_write("log",...)
- elseif target=="term" then
- io_write(...)
- elseif type(target)=="number" then
- texio_write(target,...)
- elseif target~="none" then
- texio_write("log",target,...)
- io_write(target,...)
- end
- end
- texio.write=write
- texio.write_nl=write_nl
- useluawrites=ignore
- end
- local whereto="both"
- local target=nil
- local targets=nil
- local formats=table.setmetatableindex("self")
- local translations=table.setmetatableindex("self")
- local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
- local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
- local variants={
- default={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- },
- },
- ansi={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="none",
- log="none",
- file="none",
- console="term",
- terminal="term",
- both="term",
- },
- }
- }
- variants.ansilog={
- formats=variants.ansi.formats,
- targets=variants.default.targets,
- }
- logs.flush=io.flush
- writer=function(...)
- write_nl(target,...)
- end
- newline=function()
- write_nl(target,"\n")
- end
- report=function(a,b,c,...)
- if c~=nil then
- write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,report_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,report_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- direct=function(a,b,c,...)
- if c~=nil then
- return direct_yes(translations[a],formatters[formats[b]](c,...))
- elseif b then
- return direct_yes(translations[a],formats[b])
- elseif a then
- return direct_nop(translations[a])
- else
- return ""
- end
- end
- subreport=function(a,s,b,c,...)
- if c~=nil then
- write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,subreport_yes(translations[a],translations[s],formats[b]))
- elseif a then
- write_nl(target,subreport_nop(translations[a],translations[s]))
- else
- write_nl(target,"\n")
- end
- end
- subdirect=function(a,s,b,c,...)
- if c~=nil then
- return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
- elseif b then
- return subdirect_yes(translations[a],translations[s],formats[b])
- elseif a then
- return subdirect_nop(translations[a],translations[s])
- else
- return ""
- end
- end
- status=function(a,b,c,...)
- if c~=nil then
- write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,status_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,status_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- settarget=function(askedwhereto)
- whereto=askedwhereto or whereto or "both"
- target=targets[whereto]
- if not target then
- whereto="both"
- target=targets[whereto]
- end
- if target=="term" or target=="term and log" then
- logs.flush=io.flush
- else
- logs.flush=ignore
- end
- end
- local stack={}
- pushtarget=function(newtarget)
- insert(stack,target)
- settarget(newtarget)
- end
- poptarget=function()
- if #stack>0 then
- settarget(remove(stack))
- end
- end
- setformats=function(f)
- formats=f
- end
- settranslations=function(t)
- translations=t
- end
- setprocessor=function(f)
- local writeline=write_nl
- write_nl=function(target,...)
- writeline(target,f(...))
- end
- end
- setformatters=function(specification)
- local t=nil
- local f=nil
- local d=variants.default
- if not specification then
- elseif type(specification)=="table" then
- t=specification.targets
- f=specification.formats or specification
- else
- if not ansisupported(specification) then
- specification="default"
- end
- local v=variants[specification]
- if v then
- t=v.targets
- f=v.formats
- variant=specification
- end
- end
- targets=t or d.targets
- target=targets[whereto] or target
- if f then
- d=d.formats
- else
- f=d.formats
- d=f
- end
- setmetatableindex(f,d)
- report_yes=f.report_yes
- report_nop=f.report_nop
- subreport_yes=f.subreport_yes
- subreport_nop=f.subreport_nop
- direct_yes=f.direct_yes
- direct_nop=f.direct_nop
- subdirect_yes=f.subdirect_yes
- subdirect_nop=f.subdirect_nop
- status_yes=f.status_yes
- status_nop=f.status_nop
- if variant=="ansi" or variant=="ansilog" then
- useluawrites()
- end
- settarget(whereto)
- end
- setformatters(variant)
- setlogfile=ignore
- settimedlog=ignore
-else
+do
local report_yes,subreport_yes,status_yes
local report_nop,subreport_nop,status_nop
local variants={
@@ -13675,46 +13517,6 @@ end)
directives.register("logs.target",function(v)
settarget(v)
end)
-if tex then
- local report=logs.reporter("pages")
- local texgetcount=tex and tex.getcount
- local real,user,sub=0,0,0
- function logs.start_page_number()
- real=texgetcount("realpageno")
- user=texgetcount("userpageno")
- sub=texgetcount("subpageno")
- end
- local timing=false
- local lasttime=nil
- trackers.register("pages.timing",function(v)
- timing=""
- end)
- function logs.stop_page_number()
- if timing then
- local elapsed=statistics.currenttime(statistics)
- local average,page
- if not lasttime or real<2 then
- average=elapsed
- page=elapsed
- else
- average=elapsed/(real-1)
- page=elapsed-lasttime
- end
- lasttime=elapsed
- timing=formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average)
- end
- if real<=0 then
- report("flushing page%s",timing)
- elseif user<=0 then
- report("flushing realpage %s%s",real,timing)
- elseif sub<=0 then
- report("flushing realpage %s, userpage %s%s",real,user,timing)
- else
- report("flushing realpage %s, userpage %s, subpage %s%s",real,user,sub,timing)
- end
- logs.flush()
- end
-end
local nesting=0
local verbose=false
local hasscheme=url.hasscheme
@@ -13826,133 +13628,12 @@ function logs.system(whereto,process,jobname,category,fmt,arg,...)
end
end
local report_system=logs.reporter("system","logs")
-function logs.obsolete(old,new)
- local o=loadstring("return "..new)()
- if type(o)=="function" then
- return function(...)
- report_system("function %a is obsolete, use %a",old,new)
- loadstring(old.."="..new.." return "..old)()(...)
- end
- elseif type(o)=="table" then
- local t,m={},{}
- m.__index=function(t,k)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- return o[k]
- end
- m.__newindex=function(t,k,v)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- o[k]=v
- end
- if libraries then
- libraries.obsolete[old]=t
- end
- setmetatable(t,m)
- return t
- end
-end
if utilities then
utilities.report=report_system
end
-if tex and tex.error then
- function logs.texerrormessage(...)
- tex.error(format(...))
- end
-else
- function logs.texerrormessage(...)
- print(format(...))
- end
-end
if package.helpers.report then
package.helpers.report=logs.reporter("package loader")
end
-if tex then
- local finalactions={}
- local fatalerrors={}
- local possiblefatal={}
- local loggingerrors=false
- function logs.loggingerrors()
- return loggingerrors
- end
- directives.register("logs.errors",function(v)
- loggingerrors=v
- if type(v)=="string" then
- fatalerrors=settings_to_hash(v)
- else
- fatalerrors={}
- end
- end)
- function logs.registerfinalactions(...)
- insert(finalactions,...)
- end
- local what=nil
- local report=nil
- local state=nil
- local target=nil
- local function startlogging(t,r,w,s)
- target=t
- state=force
- force=true
- report=type(r)=="function" and r or logs.reporter(r)
- what=w
- pushtarget(target)
- newline()
- if s then
- report("start %s: %s",what,s)
- else
- report("start %s",what)
- end
- if target=="logfile" then
- newline()
- end
- return report
- end
- local function stoplogging()
- if target=="logfile" then
- newline()
- end
- report("stop %s",what)
- if target=="logfile" then
- newline()
- end
- poptarget()
- state=oldstate
- end
- function logs.startfilelogging(...)
- return startlogging("logfile",...)
- end
- logs.stopfilelogging=stoplogging
- local done=false
- function logs.starterrorlogging(r,w,...)
- if not done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","start possible issues")
- poptarget()
- done=true
- end
- if fatalerrors[w] then
- possiblefatal[w]=true
- end
- return startlogging("terminal",r,w,...)
- end
- logs.stoperrorlogging=stoplogging
- function logs.finalactions()
- if #finalactions>0 then
- for i=1,#finalactions do
- finalactions[i]()
- end
- if done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","stop possible issues")
- poptarget()
- end
- return next(possiblefatal) and sortedkeys(possiblefatal) or false
- end
- end
-end
end -- of closure
@@ -13961,7 +13642,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10184, stripped down to: 7500
+-- original size: 9740, stripped down to: 7296
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14055,10 +13736,8 @@ local function stoptiming(instance)
timer.loadtime=timer.loadtime+loadtime
timer.timing=0
timer.starttime=0
- return loadtime
end
end
- return 0
end
local function benchmarktimer(instance)
local timer=timers[instance or "notimer"]
@@ -14135,18 +13814,11 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
- register("control sequences",function()
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
+ register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
register("callbacks",statistics.callbacks)
@@ -14160,15 +13832,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14224,6 +13891,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -15920,7 +15594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-env"] = package.loaded["luat-env"] or true
--- original size: 6551, stripped down to: 4315
+-- original size: 6267, stripped down to: 4115
if not modules then modules={} end modules ['luat-env']={
version=1.001,
@@ -15948,14 +15622,6 @@ local mt={
else
return "unknown"
end
- elseif k=="kind" then
- local kind=texgettoks and texgettoks("contextkindtoks")
- if kind and kind~="" then
- rawset(environment,"kind",kind)
- return kind
- else
- return "unknown"
- end
elseif k=="jobname" or k=="formatname" then
local name=tex and tex[k]
if name or name=="" then
@@ -16530,7 +16196,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 61191, stripped down to: 35864
+-- original size: 61808, stripped down to: 36227
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17523,12 +17189,25 @@ local function xmlconvert(data,settings)
end
end
xml.convert=xmlconvert
-function xml.inheritedconvert(data,xmldata)
+function xml.inheritedconvert(data,xmldata,cleanup)
local settings=xmldata.settings
if settings then
settings.parent_root=xmldata
end
- local xc=xmlconvert(data,settings)
+ local xc=xmlconvert(data,settings)
+ if cleanup then
+ local x=xc.dt
+ if x then
+ x=x[1]
+ if x and x.tg=="@pi@" then
+ local dt=x.dt
+ local pi=dt and dt[1]
+ if type(pi)=="string" and find(pi,"^xml") then
+ remove(dt,1)
+ end
+ end
+ end
+ end
return xc
end
function xml.is_valid(root)
@@ -17586,9 +17265,17 @@ local function copy(old,p)
new[k]=t
elseif k=="dt" then
v.__p__=nil
- v=copy(v,new)
- new[k]=v
- v.__p__=p
+ local t={}
+ for i=1,#v do
+ local vi=v[i]
+ if type(vi)=="table" then
+ t[i]=copy(vi,new)
+ else
+ t[i]=vi
+ end
+ end
+ new[k]=t
+ t.__p__=p
else
new[k]=v
end
@@ -17992,7 +17679,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54626, stripped down to: 31255
+-- original size: 54667, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -18487,7 +18174,7 @@ local builtin={
local lp_builtin=lpeg.utfchartabletopattern(builtin)/builtin*((spaces*P("(")*spaces*P(")"))/"")
local lp_attribute=(P("@")+P("attribute::"))/""*Cc("(ll.at and ll.at['")*((R("az","AZ")+S("-_:"))^1)*Cc("'])")
local lp_fastpos_p=P("+")^0*R("09")^1*P(-1)/"l==%0"
-local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0==l))"
+local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0+1==l))"
local lp_fastpos=lp_fastpos_n+lp_fastpos_p
local lp_reserved=C("and")+C("or")+C("not")+C("div")+C("mod")+C("true")+C("false")
local lp_lua_function=Cs((R("az","AZ","__")^1*(P(".")*R("az","AZ","__")^1)^1)*("("))/"%0"
@@ -19312,7 +18999,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 30771, stripped down to: 19680
+-- original size: 33708, stripped down to: 20953
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19330,7 +19017,7 @@ local xmlinheritedconvert=xml.inheritedconvert
local xmlapplylpath=xml.applylpath
local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable
local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat
-local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip
+local gmatch,gsub,format,find,strip,match=string.gmatch,string.gsub,string.format,string.find,string.strip,string.match
local utfbyte=utf.byte
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local striplinepatterns=utilities.strings.striplinepatterns
@@ -19461,7 +19148,7 @@ local function xmltoelement(whatever,root)
end
local element
if type(whatever)=="string" then
- element=xmlinheritedconvert(whatever,root)
+ element=xmlinheritedconvert(whatever,root,true)
else
element=whatever
end
@@ -19474,15 +19161,18 @@ local function xmltoelement(whatever,root)
end
xml.toelement=xmltoelement
local function copiedelement(element,newparent)
- if type(element)=="string" then
- return element
- else
+ if type(element)~="string" then
element=xmlcopy(element).dt
if newparent and type(element)=="table" then
- element.__p__=newparent
+ for i=1,#element do
+ local e=element[i]
+ if type(e)=="table" then
+ e.__p__=newparent
+ end
+ end
end
- return element
end
+ return element
end
function xml.delete(root,pattern)
if not pattern or pattern=="" then
@@ -19521,6 +19211,32 @@ function xml.delete(root,pattern)
end
end
end
+function xml.wipe(root,pattern)
+ local collected=xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ local d=p.dt
+ local ni=e.ni
+ if ni<=#d then
+ local dt=e.dt
+ if #dt==1 then
+ local d1=dt[1]
+ if type(d1)=="string" and match(d1,"^%s*$") then
+ if trace_manipulations then
+ report('wiping',pattern,c,e)
+ end
+ remove(d,ni)
+ redo_ni(d)
+ end
+ end
+ end
+ end
+ end
+ end
+end
function xml.replace(root,pattern,whatever)
local element=root and xmltoelement(whatever,root)
local collected=element and xmlapplylpath(root,pattern)
@@ -19690,10 +19406,10 @@ local function include(xmldata,pattern,attribute,recursive,loaddata,level)
elseif ekat["parse"]=="text" then
epdt[ek.ni]=xml.escaped(data)
else
-local settings=xmldata.settings
-local savedresource=settings.currentresource
-settings.currentresource=name
- local xi=xmlinheritedconvert(data,xmldata)
+ local settings=xmldata.settings
+ local savedresource=settings.currentresource
+ settings.currentresource=name
+ local xi=xmlinheritedconvert(data,xmldata,true)
if not xi then
epdt[ek.ni]=""
else
@@ -19703,7 +19419,7 @@ settings.currentresource=name
local child=xml.body(xi)
child.__p__=ekrt
child.__f__=name
-child.cf=name
+ child.cf=name
epdt[ek.ni]=child
local settings=xmldata.settings
local inclusions=settings and settings.inclusions
@@ -19771,28 +19487,47 @@ end
local b_collapser=lpegpatterns.b_collapser
local m_collapser=lpegpatterns.m_collapser
local e_collapser=lpegpatterns.e_collapser
+local x_collapser=lpegpatterns.x_collapser
local b_stripper=lpegpatterns.b_stripper
local m_stripper=lpegpatterns.m_stripper
local e_stripper=lpegpatterns.e_stripper
-local function stripelement(e,nolines,anywhere)
+local x_stripper=lpegpatterns.x_stripper
+local function stripelement(e,nolines,anywhere,everything)
local edt=e.dt
if edt then
local n=#edt
if n==0 then
return e
+ elseif everything then
+ local t={}
+ local m=0
+ for i=1,n do
+ local str=edt[i]
+ if type(str)~="string" then
+ m=m+1
+ t[m]=str
+ elseif str~="" then
+ str=lpegmatch(x_collapser,str)
+ if str~="" then
+ m=m+1
+ t[m]=str
+ end
+ end
+ end
+ e.dt=t
elseif anywhere then
local t={}
local m=0
- for e=1,n do
- local str=edt[e]
+ for i=1,n do
+ local str=edt[i]
if type(str)~="string" then
m=m+1
t[m]=str
elseif str~="" then
if nolines then
- str=lpegmatch((n==1 and b_collapser) or (n==m and e_collapser) or m_collapser,str)
+ str=lpegmatch((i==1 and b_collapser) or (i==m and e_collapser) or m_collapser,str)
else
- str=lpegmatch((n==1 and b_stripper) or (n==m and e_stripper) or m_stripper,str)
+ str=lpegmatch((i==1 and b_stripper) or (i==m and e_stripper) or m_stripper,str)
end
if str~="" then
m=m+1
@@ -19834,14 +19569,27 @@ local function stripelement(e,nolines,anywhere)
return e
end
xml.stripelement=stripelement
-function xml.strip(root,pattern,nolines,anywhere)
+function xml.strip(root,pattern,nolines,anywhere,everything)
local collected=xmlapplylpath(root,pattern)
if collected then
for i=1,#collected do
- stripelement(collected[i],nolines,anywhere)
+ stripelement(collected[i],nolines,anywhere,everything)
+ end
+ end
+end
+local function compactelement(e)
+ local edt=e.dt
+ if edt then
+ for e=1,#edt do
+ local str=edt[e]
+ if type(str)=="string" and not find(str,"%S") then
+ edt[e]=""
+ end
end
end
+ return e
end
+xml.compactelement=compactelement
local function renamespace(root,oldspace,newspace)
local ndt=#root.dt
for i=1,ndt or 0 do
@@ -20790,7 +20538,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-ini"] = package.loaded["data-ini"] or true
--- original size: 10847, stripped down to: 7086
+-- original size: 10947, stripped down to: 7176
if not modules then modules={} end modules ['data-ini']={
version=1.001,
@@ -20836,7 +20584,8 @@ do
ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//")
end
end
-do
+if not environment.homedir then
+ local oldhome=osgetenv('HOME')
local homedir=osgetenv(ostype=="windows" and 'USERPROFILE' or 'HOME') or ''
if not homedir or homedir=="" then
homedir=char(127)
@@ -20844,6 +20593,7 @@ do
homedir=file.collapsepath(homedir)
ossetenv("HOME",homedir)
ossetenv("USERPROFILE",homedir)
+ environment.oldhome=oldhome
environment.homedir=homedir
end
do
@@ -21449,7 +21199,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9400, stripped down to: 6347
+-- original size: 9501, stripped down to: 6411
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21540,7 +21290,9 @@ local relations=allocate {
mp={
names={ "mp" },
variable='MPINPUTS',
- suffixes={ 'mp','mpvi','mpiv','mpxl','mpii' },
+ suffixes=CONTEXTLMTXMODE>0
+ and { 'mp','mpxl','mpvi','mpiv','mpii' }
+ or { 'mp','mpvi','mpiv','mpii' },
usertype=true,
},
tex={
@@ -21734,7 +21486,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16099, stripped down to: 11379
+-- original size: 16409, stripped down to: 11591
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -21984,7 +21736,10 @@ caches.getwritablepath=getwritablepath
caches.setfirstwritablefile=setfirstwritablefile
caches.getfirstreadablefile=getfirstreadablefile
caches.setluanames=setluanames
+local checkmemory=utilities and utilities.lua and utilities.lua.checkmemory
+local threshold=100
function caches.loaddata(readables,name,writable)
+ local used=checkmemory and checkmemory()
if type(readables)=="string" then
readables={ readables }
end
@@ -22011,7 +21766,11 @@ function caches.loaddata(readables,name,writable)
end
if loader then
loader=loader()
- collectgarbage("step")
+ if checkmemory then
+ checkmemory(used,threshold)
+ else
+ collectgarbage("step")
+ end
return loader
end
end
@@ -24110,7 +23869,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-fil"] = package.loaded["data-fil"] or true
--- original size: 4365, stripped down to: 3588
+-- original size: 4365, stripped down to: 3452
if not modules then modules={} end modules ['data-fil']={
version=1.001,
@@ -24130,7 +23889,6 @@ local scanfiles=resolvers.scanfiles
local registerfilehash=resolvers.registerfilehash
local appendhash=resolvers.appendhash
local loadcachecontent=caches.loadcontent
-local checkgarbage=utilities.garbagecollector and utilities.garbagecollector.check
function resolvers.locators.file(specification)
local filename=specification.filename
local realname=resolveprefix(filename)
@@ -24220,10 +23978,7 @@ function loaders.file(specification,filetype)
if trace_locating then
report_files("file loader: %a loaded",filename)
end
- local s=f:read("*a")
- if checkgarbage then
- checkgarbage(#s)
- end
+ local s=f:read("*a")
f:close()
if s then
return true,s,#s
@@ -24371,7 +24126,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-use"] = package.loaded["data-use"] or true
--- original size: 5790, stripped down to: 2910
+-- original size: 5785, stripped down to: 2905
if not modules then modules={} end modules ['data-use']={
version=1.001,
@@ -24387,7 +24142,7 @@ local resolvers=resolvers
local findfile=resolvers.findfile
statistics.register("used config file",function() return caches.configfiles() end)
statistics.register("used cache path",function() return caches.usedpaths() end)
-function statistics.savefmtstatus(texname,formatbanner,sourcefile,kind,banner)
+function statistics.savefmtstatus(texname,formatbanner,sourcefile,banner)
local enginebanner=status.banner
if formatbanner and enginebanner and sourcefile then
local luvname=file.replacesuffix(texname,"luv")
@@ -25532,7 +25287,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5822, stripped down to: 3629
+-- original size: 6459, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25542,7 +25297,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25552,7 +25307,9 @@ local findfile=resolvers.findfile
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.silent",function(v) silent=v end)
local function findlib(required)
local suffix=os.libsuffix or "so"
if not qualifiedpath(required) then
@@ -25653,10 +25410,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
@@ -25674,6 +25431,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
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
end -- of closure
@@ -25785,7 +25555,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 13843, stripped down to: 9991
+-- original size: 11691, stripped down to: 8350
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25836,27 +25606,26 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
- luatex=sandbox.registerrunner {
- name="make luatex format",
- program="luatex",
+ luametatex=sandbox.registerrunner {
+ name="make luametatex format",
+ program="luametatex",
template=template,
checkers=checkers,
reporter=report_format,
},
- luametatex=sandbox.registerrunner {
- name="make luametatex format",
- program="luametatex",
+ luatex=sandbox.registerrunner {
+ name="make luatex format",
+ program="luatex",
template=template,
checkers=checkers,
reporter=report_format,
@@ -25869,6 +25638,16 @@ local runners={
reporter=report_format,
},
}
+local stubfiles={
+ luametatex="luat-cod.lmt",
+ luatex="luat-cod.lua",
+ luajittex="luat-cod.lua",
+}
+local suffixes={
+ luametatex="mkxl",
+ luatex="mkiv",
+ luajittex="mkiv",
+}
local function validbinarypath()
if not environment.arguments.nobinarypath then
local path=environment.ownpath or file.dirname(environment.ownname)
@@ -25880,101 +25659,50 @@ local function validbinarypath()
end
end
end
+local function fatalerror(startupdir,...)
+ report_format(...)
+ lfs.chdir(startupdir)
+end
function environment.make_format(formatname)
local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
local silent=arguments.silent
local errors=arguments.errors
- local texsourcename=""
- local texsourcepath=""
- local fulltexsourcename=""
- if engine=="luametatex" then
- texsourcename=file.addsuffix(formatname,"mkxl")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local runner=runners[engine]
+ local startupdir=dir.current()
+ if not runner then
+ return fatalerror(startupdir,"the format %a cannot be generated, no runner available for engine %a",name,engine)
end
- if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"mkiv")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local luasourcename=stubfiles[engine]
+ if not luasourcename then
+ return fatalerror(startupdir,"no lua stub file specified for %a",engine)
end
+ local texsourcename=file.addsuffix(formatname,suffixes[engine])
+ local fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"tex")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ return fatalerror(startupdir,"no tex source file with name %a (mkiv or tex)",formatname)
end
- if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",formatname)
- return
- end
- report_format("using tex source file %a",fulltexsourcename)
- fulltexsourcename=dir.expandname(fulltexsourcename)
- texsourcepath=file.dirname(fulltexsourcename)
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
- end
- local specificationname="context.lus"
- local specificationpath=""
- local fullspecificationname=resolvers.findfile(specificationname) or ""
- if fullspecificationname=="" then
- report_format("unable to locate specification file %a",specificationname)
- return
- end
- report_format("using specification file %a",fullspecificationname)
- fullspecificationname=dir.expandname(fullspecificationname)
- specificationpath=file.dirname(fullspecificationname)
- if texsourcepath~=specificationpath then
- report_format("tex source file and specification file are on different paths")
- return
- end
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
+ local fulltexsourcename=dir.expandname(fulltexsourcename)
+ local texsourcepath=file.dirname(fulltexsourcename)
+ if lfs.isfile(fulltexsourcename) then
+ report_format("using tex source file %a",fulltexsourcename)
+ else
+ return fatalerror(startupdir,"no accessible tex source file with name %a",fulltexsourcename)
end
- if not lfs.isfile(fullspecificationname) then
- report_format("no accessible specification file with name %a",fulltexsourcename)
- return
+ local fullluasourcename=dir.expandname(file.join(texsourcepath,luasourcename) or "")
+ if lfs.isfile(fullluasourcename) then
+ report_format("using lua stub file %a",fullluasourcename)
+ else
+ return fatalerror(startupdir,"no accessible lua stub file with name %a",fulltexsourcename)
end
- report_format("using tex source path %a",texsourcepath)
local validformatpath=caches.getwritablepath("formats",engine) or ""
- local startupdir=dir.current()
if validformatpath=="" then
- report_format("invalid format path, insufficient write access")
- return
+ return fatalerror(startupdir,"invalid format path, insufficient write access")
end
local binarypath=validbinarypath()
report_format("changing to format path %a",validformatpath)
- lfs.chdir(validformatpath)
- if dir.current()~=validformatpath then
- report_format("unable to change to format path %a",validformatpath)
- return
- end
- local usedluastub=nil
- local usedlualibs=dofile(fullspecificationname)
- if type(usedlualibs)=="string" then
- usedluastub=file.join(specificationpath,usedlualibs)
- elseif type(usedlualibs)=="table" then
- report_format("using stub specification %a",fullspecificationname)
- local texbasename=file.basename(name)
- local luastubname=file.addsuffix(texbasename,luasuffixes.lua)
- local lucstubname=file.addsuffix(texbasename,luasuffixes.luc)
- report_format("creating initialization file %a",luastubname)
- utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
- if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- report_format("using compiled initialization file %a",lucstubname)
- usedluastub=lucstubname
- else
- report_format("using uncompiled initialization file %a",luastubname)
- usedluastub=luastubname
- end
- else
- report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(startupdir)
- return
- end
- local runner=runners[engine]
- if not runner then
- report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
- lfs.chdir(startupdir)
- return
+ if not lfs.chdir(validformatpath) then
+ return fatalerror(startupdir,"unable to change to format path %a",validformatpath)
end
local primaryflags=primaryflags(arguments)
local secondaryflags=secondaryflags(arguments)
@@ -25982,9 +25710,8 @@ function environment.make_format(formatname)
binarypath=binarypath,
primaryflags=primaryflags,
secondaryflags=secondaryflags,
- luafile=quoted(usedluastub),
+ luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26001,7 +25728,7 @@ function environment.make_format(formatname)
end
report_format("format path : %s",validformatpath)
report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",usedluastub)
+ report_format("lua startup file : %s",fullluasourcename)
if primaryflags~="" then
report_format("primary flags : %s",primaryflags)
end
@@ -26083,9 +25810,9 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
luafile=quoted(scriptname),
texfile=filename~="" and quoted(filename) or "",
}
- statistics.starttiming()
+ statistics.starttiming("make format")
local result=runner(specification)
- local runtime=statistics.stoptiming()
+ statistics.stoptiming("make format")
if verbose then
report_format()
if binarypath and binarypath~="" then
@@ -26103,7 +25830,7 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
if secondaryflags~="" then
report_format("secondary flags : %s",secondaryflags)
end
- report_format("run time : %.3f seconds",runtime)
+ report_format("run time : %0.3f seconds",statistics.elapsed("make format"))
report_format("return value : %s",result==0 and "okay" or "error")
report_format()
end
@@ -26115,8 +25842,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1038373
--- stripped bytes : 409980
+-- original bytes : 1025947
+-- stripped bytes : 405652
-- end library merge
@@ -26771,12 +26498,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/Master/texmf-dist/scripts/context/ruby/graphics/inkscape.rb b/Master/texmf-dist/scripts/context/ruby/graphics/inkscape.rb
index 8d3b2646826..8f22d9b7954 100644
--- a/Master/texmf-dist/scripts/context/ruby/graphics/inkscape.rb
+++ b/Master/texmf-dist/scripts/context/ruby/graphics/inkscape.rb
@@ -70,7 +70,8 @@ class InkScape
if directpdf then
report("converting #{inpfilename} to #{outfilename}")
- resultpipe = "--without-gui --export-pdf=\"#{outfilename}\" 2>#{logfile}"
+ # resultpipe = "--without-gui --export-pdf=\"#{outfilename}\" 2>#{logfile}"
+ resultpipe = "--without-gui --export-filename=\"#{outfilename}\" 2>#{logfile}"
else
report("converting #{inpfilename} to #{tmpfilename}")
resultpipe = "--without-gui --print=\">#{tmpfilename}\" 2>#{logfile}"
diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
index 6eaf5ff449f..6fc17adb022 100644
--- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -852,7 +849,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11605, stripped down to: 8299
+-- original size: 12566, stripped down to: 8937
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -861,7 +858,7 @@ if not modules then modules={} end modules ['l-package']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local type=type
+local type,unpack=type,unpack
local gsub,format,find=string.gsub,string.format,string.find
local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
@@ -891,6 +888,7 @@ local helpers=package.helpers or {
},
methods={},
sequence={
+ "reset loaded",
"already loaded",
"preload table",
"qualified path",
@@ -907,6 +905,7 @@ local methods=helpers.methods
local builtin=helpers.builtin
local extraluapaths={}
local extralibpaths={}
+local checkedfiles={}
local luapaths=nil
local libpaths=nil
local oldluapath=nil
@@ -1040,10 +1039,16 @@ end
local function loadedaslib(resolved,rawname)
local base=gsub(rawname,"%.","_")
local init="luaopen_"..gsub(base,"%.","_")
+ local data={ resolved,init,"" }
+ checkedfiles[#checkedfiles+1]=data
if helpers.trace then
helpers.report("calling loadlib with '%s' with init '%s'",resolved,init)
end
- return package.loadlib(resolved,init)
+ local a,b,c=package.loadlib(resolved,init)
+ if not a and type(b)=="string" then
+ data[3]=string.fullstrip(b or "unknown error")
+ end
+ return a,b,c
end
helpers.loadedaslib=loadedaslib
local function loadedbypath(name,rawname,paths,islib,what)
@@ -1082,11 +1087,18 @@ local function loadedbyname(name,rawname)
end
end
helpers.loadedbyname=loadedbyname
+methods["reset loaded"]=function(name)
+ checkedfiles={}
+ return false
+end
methods["already loaded"]=function(name)
return package.loaded[name]
end
methods["preload table"]=function(name)
- return builtin["preload table"](name)
+ local f=builtin["preload table"]
+ if f then
+ return f(name)
+ end
end
methods["qualified path"]=function(name)
return loadedbyname(addsuffix(lualibfile(name),"lua"),name)
@@ -1098,19 +1110,31 @@ methods["lib extra list"]=function(name)
return loadedbypath(addsuffix(lualibfile(name),os.libsuffix),name,getextralibpaths(),true,"lib")
end
methods["path specification"]=function(name)
- getluapaths()
- return builtin["path specification"](name)
+ local f=builtin["path specification"]
+ if f then
+ getluapaths()
+ return f(name)
+ end
end
methods["cpath specification"]=function(name)
- getlibpaths()
- return builtin["cpath specification"](name)
+ local f=builtin["cpath specification"]
+ if f then
+ getlibpaths()
+ return f(name)
+ end
end
methods["all in one fallback"]=function(name)
- return builtin["all in one fallback"](name)
+ local f=builtin["all in one fallback"]
+ if f then
+ return f(name)
+ end
end
methods["not loaded"]=function(name)
if helpers.trace then
helpers.report("unable to locate '%s'",name or "?")
+ for i=1,#checkedfiles do
+ helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i]))
+ end
end
return nil
end
@@ -1122,19 +1146,22 @@ function helpers.loaded(name)
level=level+1
for i=1,#sequence do
local method=sequence[i]
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
- end
- local result,rest=methods[method](name)
- if type(result)=="function" then
+ local lookup=method and methods[method]
+ if type(lookup)=="function" then
if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
end
- if helpers.traceused then
- used[#used+1]={ level=level,name=name }
+ local result,rest=lookup(name)
+ if type(result)=="function" then
+ if helpers.trace then
+ helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ end
+ if helpers.traceused then
+ used[#used+1]={ level=level,name=name }
+ end
+ level=level-1
+ return result,rest
end
- level=level-1
- return result,rest
end
end
level=level-1
@@ -1174,7 +1201,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 38440, stripped down to: 19316
+-- original size: 38703, stripped down to: 19489
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1272,11 +1299,13 @@ local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0)
local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0))
local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0)
local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0)
-local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0)
+local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
+local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0)
local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0)
-local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0)
+local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
+local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0)
patterns.stripper=stripper
patterns.fullstripper=fullstripper
patterns.collapser=collapser
@@ -1284,9 +1313,11 @@ patterns.nospacer=nospacer
patterns.b_collapser=b_collapser
patterns.m_collapser=m_collapser
patterns.e_collapser=e_collapser
+patterns.x_collapser=x_collapser
patterns.b_stripper=b_stripper
patterns.m_stripper=m_stripper
patterns.e_stripper=e_stripper
+patterns.x_stripper=x_stripper
patterns.lowercase=lowercase
patterns.uppercase=uppercase
patterns.letter=patterns.lowercase+patterns.uppercase
@@ -3806,7 +3837,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-os"] = package.loaded["l-os"] or true
--- original size: 19120, stripped down to: 10208
+-- original size: 19409, stripped down to: 10419
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -4029,6 +4060,8 @@ elseif name=="macosx" then
platform="osx-intel"
elseif find(architecture,"x86_64",1,true) then
platform="osx-64"
+ elseif find(architecture,"arm64",1,true) then
+ platform="osx-64"
else
platform="osx-ppc"
end
@@ -4200,11 +4233,19 @@ local function isleapyear(year)
end
os.isleapyear=isleapyear
local days={ 31,28,31,30,31,30,31,31,30,31,30,31 }
-local function nofdays(year,month)
+local function nofdays(year,month,day)
if not month then
return isleapyear(year) and 365 or 364
- else
+ elseif not day then
return month==2 and isleapyear(year) and 29 or days[month]
+ else
+ for i=1,month-1 do
+ day=day+days[i]
+ end
+ if month>2 and isleapyear(year) then
+ day=day+1
+ end
+ return day
end
end
os.nofdays=nofdays
@@ -5729,10 +5770,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 41281, stripped down to: 17261
+-- original size: 41303, stripped down to: 17277
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -6563,7 +6605,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 45153, stripped down to: 22734
+-- original size: 45129, stripped down to: 23525
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -6615,25 +6657,59 @@ local function points(n)
n=n*ptf
if n%1==0 then
return format("%ipt",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fpt",n))
+ end
+end
+local function nupoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*ptf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fpt",n))
end
local function basepoints(n)
if n==0 then
- return "0pt"
+ return "0bp"
end
n=tonumber(n)
if not n or n==0 then
- return "0pt"
+ return "0bp"
end
n=n*bpf
if n%1==0 then
return format("%ibp",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fbp",n))
+ end
+end
+local function nubasepoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*bpf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fbp",n))
end
number.points=points
+number.nupoints=nupoints
number.basepoints=basepoints
+number.nubasepoints=nubasepoints
local rubish=spaceortab^0*newline
local anyrubish=spaceortab+newline
local stripped=(spaceortab^1/"")*newline
@@ -6911,7 +6987,9 @@ local environment={
concat=table.concat,
signed=number.signed,
points=number.points,
+ nupoints=number.nupoints,
basepoints=number.basepoints,
+ nubasepoints=number.nubasepoints,
utfchar=utf.char,
utfbyte=utf.byte,
lpegmatch=lpeg.match,
@@ -7106,10 +7184,18 @@ local format_p=function()
n=n+1
return format("points(a%s)",n)
end
+local format_P=function()
+ n=n+1
+ return format("nupoints(a%s)",n)
+end
local format_b=function()
n=n+1
return format("basepoints(a%s)",n)
end
+local format_B=function()
+ n=n+1
+ return format("nubasepoints(a%s)",n)
+end
local format_t=function(f)
n=n+1
if f and f~="" then
@@ -7219,33 +7305,36 @@ local format_extension=function(extensions,f,name)
local extension=extensions[name] or "tostring(%s)"
local f=tonumber(f) or 1
local w=find(extension,"%.%.%.")
- if w then
- if f==0 then
+ if f==0 then
+ if w then
extension=gsub(extension,"%.%.%.","")
- return extension
- elseif f==1 then
+ end
+ return extension
+ elseif f==1 then
+ if w then
extension=gsub(extension,"%.%.%.","%%s")
- n=n+1
- local a="a"..n
- return format(extension,a,a)
- elseif f<0 then
+ end
+ n=n+1
+ local a="a"..n
+ return format(extension,a,a)
+ elseif f<0 then
+ if w then
+ extension=gsub(extension,"%.%.%.","")
+ return extension
+ else
local a="a"..(n+f+1)
return format(extension,a,a)
- else
- extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
- local t={}
- for i=1,f do
- n=n+1
- t[i]="a"..n
- end
- return format(extension,unpack(t))
end
else
- extension=gsub(extension,"%%s",function()
+ if w then
+ extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
+ end
+ local t={}
+ for i=1,f do
n=n+1
- return "a"..n
- end)
- return extension
+ t[i]="a"..n
+ end
+ return format(extension,unpack(t))
end
end
local builder=Cs { "start",
@@ -7259,7 +7348,7 @@ local builder=Cs { "start",
+V("n")
+V("N")
+V("k")
-+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("b")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
++V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
+V("W")
+V("a")
+V("A")
@@ -7297,7 +7386,9 @@ local builder=Cs { "start",
["u"]=(prefix_any*P("u"))/format_u,
["U"]=(prefix_any*P("U"))/format_U,
["p"]=(prefix_any*P("p"))/format_p,
+ ["P"]=(prefix_any*P("P"))/format_P,
["b"]=(prefix_any*P("b"))/format_b,
+ ["B"]=(prefix_any*P("B"))/format_B,
["t"]=(prefix_tab*P("t"))/format_t,
["T"]=(prefix_tab*P("T"))/format_T,
["l"]=(prefix_any*P("l"))/format_l,
@@ -7448,7 +7539,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 32649, stripped down to: 18257
+-- original size: 32815, stripped down to: 18257
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -8194,10 +8285,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fil"] = package.loaded["util-fil"] or true
--- original size: 11530, stripped down to: 9007
+-- original size: 11552, stripped down to: 9023
if not modules then modules={} end modules ['util-fil']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -8562,10 +8654,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 12946, stripped down to: 9507
+-- original size: 12968, stripped down to: 9523
if not modules then modules={} end modules ['util-sac']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -9215,7 +9308,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 24132, stripped down to: 16210
+-- original size: 24683, stripped down to: 16431
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9228,7 +9321,7 @@ local lpeg,table,string=lpeg,table,string
local P,R,V,S,C,Ct,Cs,Carg,Cc,Cg,Cf,Cp=lpeg.P,lpeg.R,lpeg.V,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cc,lpeg.Cg,lpeg.Cf,lpeg.Cp
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local concat,gmatch,find=table.concat,string.gmatch,string.find
-local tostring,type,next,rawset=tostring,type,next,rawset
+local tonumber,tostring,type,next,rawset=tonumber,tostring,type,next,rawset
local mod,div=math.mod,math.div
utilities=utilities or {}
local parsers=utilities.parsers or {}
@@ -9620,13 +9713,15 @@ function parsers.csvsplitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
local separator=specification.separator
local quotechar=specification.quote
+ local numbers=specification.numbers
local separator=S(separator~="" and separator or ",")
local whatever=C((1-separator-newline)^0)
if quotechar and quotechar~="" then
local quotedata=nil
for chr in gmatch(quotechar,".") do
local quotechar=P(chr)
- local quoteword=quotechar*C((1-quotechar)^0)*quotechar
+ local quoteitem=(1-quotechar)^0
+ local quoteword=quotechar*(numbers and (quoteitem/tonumber) or C(quoteitem))*quotechar
if quotedata then
quotedata=quotedata+quoteword
else
@@ -9642,12 +9737,14 @@ function parsers.csvsplitter(specification)
end
function parsers.rfc4180splitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
+ local numbers=specification.numbers
local separator=specification.separator
local quotechar=P(specification.quote)
local dquotechar=quotechar*quotechar
/specification.quote
local separator=S(separator~="" and separator or ",")
- local escaped=quotechar*Cs((dquotechar+(1-quotechar))^0)*quotechar
+ local whatever=(dquotechar+(1-quotechar))^0
+ local escaped=quotechar*(numbers and (whatever/tonumber) or Cs(whatever))*quotechar
local non_escaped=C((1-quotechar-newline-separator)^1)
local field=escaped+non_escaped+Cc("")
local record=Ct(field*(separator*field)^1)
@@ -11718,7 +11815,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-soc-imp-http"] = package.loaded["util-soc-imp-http"] or true
--- original size: 12577, stripped down to: 9577
+-- original size: 12624, stripped down to: 9598
local tostring,tonumber,setmetatable,next,type=tostring,tonumber,setmetatable,next,type
@@ -11763,7 +11860,7 @@ local function receiveheaders(sock,headers)
if not headers then
headers={}
end
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11773,13 +11870,13 @@ local function receiveheaders(sock,headers)
return nil,"malformed reponse headers"
end
name=lower(name)
- line,err=sock:receive()
+ line,err=sock:receive("*l")
if err then
return nil,err
end
while find(line,"^%s") do
value=value..line
- line=sock:receive()
+ line=sock:receive("*l")
if err then
return nil,err
end
@@ -11799,7 +11896,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
dirty=function() return sock:dirty() end,
},{
__call=function()
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11810,7 +11907,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
if size>0 then
local chunk,err,part=sock:receive(size)
if chunk then
- sock:receive()
+ sock:receive("*a")
end
return chunk,err
else
@@ -12712,7 +12809,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13394, stripped down to: 8882
+-- original size: 13901, stripped down to: 9175
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12735,7 +12832,7 @@ utilities.setters=setters
local data={}
local trace_initialize=false
local frozen=true
-function setters.initialize(filename,name,values)
+local function initialize_setter(filename,name,values)
local setter=data[name]
if setter then
local data=setter.data
@@ -12776,8 +12873,8 @@ function setters.initialize(filename,name,values)
end
end
local function set(t,what,newvalue)
- local data=t.data
- if not data.frozen then
+ local data=t.data
+ if data and not data.frozen then
local done=t.done
if type(what)=="string" then
what=settings_to_hash(what)
@@ -12813,7 +12910,7 @@ local function set(t,what,newvalue)
end
local function reset(t)
local data=t.data
- if not data.frozen then
+ if data and not data.frozen then
for name,functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
@@ -12834,7 +12931,7 @@ local function disable(t,what)
set(t,what,false)
end
end
-function setters.register(t,what,...)
+local function register_setter(t,what,...)
local data=t.data
what=lower(what)
local functions=data[what]
@@ -12869,23 +12966,24 @@ function setters.register(t,what,...)
end
return false
end
-function setters.enable(t,what)
+local function enable_setter(t,what)
local e=t.enable
t.enable,t.done=enable,{}
+ set(t,what,true)
enable(t,what)
t.enable,t.done=e,{}
end
-function setters.disable(t,what)
+local function disable_setter(t,what)
local e=t.disable
t.disable,t.done=disable,{}
disable(t,what)
t.disable,t.done=e,{}
end
-function setters.reset(t)
+local function reset_setter(t)
t.done={}
reset(t)
end
-function setters.list(t)
+local function list_setter(t)
local list=table.sortedkeys(t.data)
local user,system={},{}
for l=1,#list do
@@ -12898,8 +12996,8 @@ function setters.list(t)
end
return user,system
end
-function setters.show(t)
- local list=setters.list(t)
+local function show_setter(t)
+ local list=list_setter(t)
t.report()
for k=1,#list do
local name=list[k]
@@ -12930,39 +13028,50 @@ function setters.show(t)
end
end
end
-local enable,disable,register,list,show=setters.enable,setters.disable,setters.register,setters.list,setters.show
function setters.report(setter,fmt,...)
- print(formatters["%-15s : %s\n"](setter.name,formatters[fmt](...)))
+ if fmt then
+ print(formatters["%-15s : %s"](setter.name,formatters[fmt](...)))
+ else
+ print("")
+ end
end
-local function default(setter,name)
+local function setter_default(setter,name)
local d=setter.data[name]
return d and d.default
end
-local function value(setter,name)
+local function setter_value(setter,name)
local d=setter.data[name]
return d and (d.value or d.default)
end
-function setters.new(name)
+local function new_setter(name)
local setter
setter={
data=allocate(),
name=name,
- report=function(...) setters.report (setter,...) end,
- enable=function(...) enable (setter,...) end,
- disable=function(...) disable (setter,...) end,
- reset=function(...) reset (setter,...) end,
- register=function(...) register(setter,...) end,
- list=function(...) return list (setter,...) end,
- show=function(...) show (setter,...) end,
- default=function(...) return default (setter,...) end,
- value=function(...) return value (setter,...) end,
+ report=function(...) setters.report (setter,...) end,
+ enable=function(...) enable_setter (setter,...) end,
+ disable=function(...) disable_setter (setter,...) end,
+ reset=function(...) reset_setter (setter,...) end,
+ register=function(...) register_setter(setter,...) end,
+ list=function(...) return list_setter (setter,...) end,
+ show=function(...) show_setter (setter,...) end,
+ default=function(...) return setter_default (setter,...) end,
+ value=function(...) return setter_value (setter,...) end,
}
data[name]=setter
return setter
end
-trackers=setters.new("trackers")
-directives=setters.new("directives")
-experiments=setters.new("experiments")
+setters.enable=enable_setter
+setters.disable=disable_setter
+setters.register=register_setter
+setters.list=list_setter
+setters.show=show_setter
+setters.reset=reset_setter
+setters.new=new_setter
+setters.initialize=initialize_setter
+trackers=new_setter("trackers")
+directives=new_setter("directives")
+experiments=new_setter("experiments")
local t_enable,t_disable=trackers .enable,trackers .disable
local d_enable,d_disable=directives .enable,directives .disable
local e_enable,e_disable=experiments.enable,experiments.disable
@@ -13009,11 +13118,11 @@ if environment then
if engineflags then
local list=engineflags["c:trackers"] or engineflags["trackers"]
if type(list)=="string" then
- setters.initialize("commandline flags","trackers",settings_to_hash(list))
+ initialize_setter("commandline flags","trackers",settings_to_hash(list))
end
local list=engineflags["c:directives"] or engineflags["directives"]
if type(list)=="string" then
- setters.initialize("commandline flags","directives",settings_to_hash(list))
+ initialize_setter("commandline flags","directives",settings_to_hash(list))
end
end
end
@@ -13055,7 +13164,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 33003, stripped down to: 21667
+-- original size: 16017, stripped down to: 11045
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -13071,9 +13180,8 @@ local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
-local runningtex=tex and (tex.jobname or tex.formatname)
-local write_nl=runningtex and texio and texio.write_nl or print
-local write=runningtex and texio and texio.write or io.write
+local write_nl=print
+local write=io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -13109,273 +13217,7 @@ local function ansisupported(specification)
return false
end
end
-if runningtex and texio then
- if texio.setescape then
- texio.setescape(0)
- end
- if arg and ansisupported then
- for k,v in next,arg do
- if v=="--ansi" or v=="--c:ansi" then
- if ansisupported("ansi") then
- variant="ansi"
- end
- break
- elseif v=="--ansilog" or v=="--c:ansilog" then
- if ansisupported("ansilog") then
- variant="ansilog"
- end
- break
- end
- end
- end
- local function useluawrites()
- local texio_write_nl=texio.write_nl
- local texio_write=texio.write
- local io_write=io.write
- write_nl=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write_nl("log",...)
- texio_write_nl("term","")
- io_write(...)
- elseif target=="log" then
- texio_write_nl("log",...)
- elseif target=="term" then
- texio_write_nl("term","")
- io_write(...)
- elseif type(target)=="number" then
- texio_write_nl(target,...)
- elseif target~="none" then
- texio_write_nl("log",target,...)
- texio_write_nl("term","")
- io_write(target,...)
- end
- end
- write=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write("log",...)
- io_write(...)
- elseif target=="log" then
- texio_write("log",...)
- elseif target=="term" then
- io_write(...)
- elseif type(target)=="number" then
- texio_write(target,...)
- elseif target~="none" then
- texio_write("log",target,...)
- io_write(target,...)
- end
- end
- texio.write=write
- texio.write_nl=write_nl
- useluawrites=ignore
- end
- local whereto="both"
- local target=nil
- local targets=nil
- local formats=table.setmetatableindex("self")
- local translations=table.setmetatableindex("self")
- local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
- local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
- local variants={
- default={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- },
- },
- ansi={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="none",
- log="none",
- file="none",
- console="term",
- terminal="term",
- both="term",
- },
- }
- }
- variants.ansilog={
- formats=variants.ansi.formats,
- targets=variants.default.targets,
- }
- logs.flush=io.flush
- writer=function(...)
- write_nl(target,...)
- end
- newline=function()
- write_nl(target,"\n")
- end
- report=function(a,b,c,...)
- if c~=nil then
- write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,report_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,report_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- direct=function(a,b,c,...)
- if c~=nil then
- return direct_yes(translations[a],formatters[formats[b]](c,...))
- elseif b then
- return direct_yes(translations[a],formats[b])
- elseif a then
- return direct_nop(translations[a])
- else
- return ""
- end
- end
- subreport=function(a,s,b,c,...)
- if c~=nil then
- write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,subreport_yes(translations[a],translations[s],formats[b]))
- elseif a then
- write_nl(target,subreport_nop(translations[a],translations[s]))
- else
- write_nl(target,"\n")
- end
- end
- subdirect=function(a,s,b,c,...)
- if c~=nil then
- return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
- elseif b then
- return subdirect_yes(translations[a],translations[s],formats[b])
- elseif a then
- return subdirect_nop(translations[a],translations[s])
- else
- return ""
- end
- end
- status=function(a,b,c,...)
- if c~=nil then
- write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,status_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,status_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- settarget=function(askedwhereto)
- whereto=askedwhereto or whereto or "both"
- target=targets[whereto]
- if not target then
- whereto="both"
- target=targets[whereto]
- end
- if target=="term" or target=="term and log" then
- logs.flush=io.flush
- else
- logs.flush=ignore
- end
- end
- local stack={}
- pushtarget=function(newtarget)
- insert(stack,target)
- settarget(newtarget)
- end
- poptarget=function()
- if #stack>0 then
- settarget(remove(stack))
- end
- end
- setformats=function(f)
- formats=f
- end
- settranslations=function(t)
- translations=t
- end
- setprocessor=function(f)
- local writeline=write_nl
- write_nl=function(target,...)
- writeline(target,f(...))
- end
- end
- setformatters=function(specification)
- local t=nil
- local f=nil
- local d=variants.default
- if not specification then
- elseif type(specification)=="table" then
- t=specification.targets
- f=specification.formats or specification
- else
- if not ansisupported(specification) then
- specification="default"
- end
- local v=variants[specification]
- if v then
- t=v.targets
- f=v.formats
- variant=specification
- end
- end
- targets=t or d.targets
- target=targets[whereto] or target
- if f then
- d=d.formats
- else
- f=d.formats
- d=f
- end
- setmetatableindex(f,d)
- report_yes=f.report_yes
- report_nop=f.report_nop
- subreport_yes=f.subreport_yes
- subreport_nop=f.subreport_nop
- direct_yes=f.direct_yes
- direct_nop=f.direct_nop
- subdirect_yes=f.subdirect_yes
- subdirect_nop=f.subdirect_nop
- status_yes=f.status_yes
- status_nop=f.status_nop
- if variant=="ansi" or variant=="ansilog" then
- useluawrites()
- end
- settarget(whereto)
- end
- setformatters(variant)
- setlogfile=ignore
- settimedlog=ignore
-else
+do
local report_yes,subreport_yes,status_yes
local report_nop,subreport_nop,status_nop
local variants={
@@ -13675,46 +13517,6 @@ end)
directives.register("logs.target",function(v)
settarget(v)
end)
-if tex then
- local report=logs.reporter("pages")
- local texgetcount=tex and tex.getcount
- local real,user,sub=0,0,0
- function logs.start_page_number()
- real=texgetcount("realpageno")
- user=texgetcount("userpageno")
- sub=texgetcount("subpageno")
- end
- local timing=false
- local lasttime=nil
- trackers.register("pages.timing",function(v)
- timing=""
- end)
- function logs.stop_page_number()
- if timing then
- local elapsed=statistics.currenttime(statistics)
- local average,page
- if not lasttime or real<2 then
- average=elapsed
- page=elapsed
- else
- average=elapsed/(real-1)
- page=elapsed-lasttime
- end
- lasttime=elapsed
- timing=formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average)
- end
- if real<=0 then
- report("flushing page%s",timing)
- elseif user<=0 then
- report("flushing realpage %s%s",real,timing)
- elseif sub<=0 then
- report("flushing realpage %s, userpage %s%s",real,user,timing)
- else
- report("flushing realpage %s, userpage %s, subpage %s%s",real,user,sub,timing)
- end
- logs.flush()
- end
-end
local nesting=0
local verbose=false
local hasscheme=url.hasscheme
@@ -13826,133 +13628,12 @@ function logs.system(whereto,process,jobname,category,fmt,arg,...)
end
end
local report_system=logs.reporter("system","logs")
-function logs.obsolete(old,new)
- local o=loadstring("return "..new)()
- if type(o)=="function" then
- return function(...)
- report_system("function %a is obsolete, use %a",old,new)
- loadstring(old.."="..new.." return "..old)()(...)
- end
- elseif type(o)=="table" then
- local t,m={},{}
- m.__index=function(t,k)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- return o[k]
- end
- m.__newindex=function(t,k,v)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- o[k]=v
- end
- if libraries then
- libraries.obsolete[old]=t
- end
- setmetatable(t,m)
- return t
- end
-end
if utilities then
utilities.report=report_system
end
-if tex and tex.error then
- function logs.texerrormessage(...)
- tex.error(format(...))
- end
-else
- function logs.texerrormessage(...)
- print(format(...))
- end
-end
if package.helpers.report then
package.helpers.report=logs.reporter("package loader")
end
-if tex then
- local finalactions={}
- local fatalerrors={}
- local possiblefatal={}
- local loggingerrors=false
- function logs.loggingerrors()
- return loggingerrors
- end
- directives.register("logs.errors",function(v)
- loggingerrors=v
- if type(v)=="string" then
- fatalerrors=settings_to_hash(v)
- else
- fatalerrors={}
- end
- end)
- function logs.registerfinalactions(...)
- insert(finalactions,...)
- end
- local what=nil
- local report=nil
- local state=nil
- local target=nil
- local function startlogging(t,r,w,s)
- target=t
- state=force
- force=true
- report=type(r)=="function" and r or logs.reporter(r)
- what=w
- pushtarget(target)
- newline()
- if s then
- report("start %s: %s",what,s)
- else
- report("start %s",what)
- end
- if target=="logfile" then
- newline()
- end
- return report
- end
- local function stoplogging()
- if target=="logfile" then
- newline()
- end
- report("stop %s",what)
- if target=="logfile" then
- newline()
- end
- poptarget()
- state=oldstate
- end
- function logs.startfilelogging(...)
- return startlogging("logfile",...)
- end
- logs.stopfilelogging=stoplogging
- local done=false
- function logs.starterrorlogging(r,w,...)
- if not done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","start possible issues")
- poptarget()
- done=true
- end
- if fatalerrors[w] then
- possiblefatal[w]=true
- end
- return startlogging("terminal",r,w,...)
- end
- logs.stoperrorlogging=stoplogging
- function logs.finalactions()
- if #finalactions>0 then
- for i=1,#finalactions do
- finalactions[i]()
- end
- if done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","stop possible issues")
- poptarget()
- end
- return next(possiblefatal) and sortedkeys(possiblefatal) or false
- end
- end
-end
end -- of closure
@@ -13961,7 +13642,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10184, stripped down to: 7500
+-- original size: 9740, stripped down to: 7296
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14055,10 +13736,8 @@ local function stoptiming(instance)
timer.loadtime=timer.loadtime+loadtime
timer.timing=0
timer.starttime=0
- return loadtime
end
end
- return 0
end
local function benchmarktimer(instance)
local timer=timers[instance or "notimer"]
@@ -14135,18 +13814,11 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
- register("control sequences",function()
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
+ register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
register("callbacks",statistics.callbacks)
@@ -14160,15 +13832,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14224,6 +13891,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -15920,7 +15594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-env"] = package.loaded["luat-env"] or true
--- original size: 6551, stripped down to: 4315
+-- original size: 6267, stripped down to: 4115
if not modules then modules={} end modules ['luat-env']={
version=1.001,
@@ -15948,14 +15622,6 @@ local mt={
else
return "unknown"
end
- elseif k=="kind" then
- local kind=texgettoks and texgettoks("contextkindtoks")
- if kind and kind~="" then
- rawset(environment,"kind",kind)
- return kind
- else
- return "unknown"
- end
elseif k=="jobname" or k=="formatname" then
local name=tex and tex[k]
if name or name=="" then
@@ -16530,7 +16196,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 61191, stripped down to: 35864
+-- original size: 61808, stripped down to: 36227
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17523,12 +17189,25 @@ local function xmlconvert(data,settings)
end
end
xml.convert=xmlconvert
-function xml.inheritedconvert(data,xmldata)
+function xml.inheritedconvert(data,xmldata,cleanup)
local settings=xmldata.settings
if settings then
settings.parent_root=xmldata
end
- local xc=xmlconvert(data,settings)
+ local xc=xmlconvert(data,settings)
+ if cleanup then
+ local x=xc.dt
+ if x then
+ x=x[1]
+ if x and x.tg=="@pi@" then
+ local dt=x.dt
+ local pi=dt and dt[1]
+ if type(pi)=="string" and find(pi,"^xml") then
+ remove(dt,1)
+ end
+ end
+ end
+ end
return xc
end
function xml.is_valid(root)
@@ -17586,9 +17265,17 @@ local function copy(old,p)
new[k]=t
elseif k=="dt" then
v.__p__=nil
- v=copy(v,new)
- new[k]=v
- v.__p__=p
+ local t={}
+ for i=1,#v do
+ local vi=v[i]
+ if type(vi)=="table" then
+ t[i]=copy(vi,new)
+ else
+ t[i]=vi
+ end
+ end
+ new[k]=t
+ t.__p__=p
else
new[k]=v
end
@@ -17992,7 +17679,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54626, stripped down to: 31255
+-- original size: 54667, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -18487,7 +18174,7 @@ local builtin={
local lp_builtin=lpeg.utfchartabletopattern(builtin)/builtin*((spaces*P("(")*spaces*P(")"))/"")
local lp_attribute=(P("@")+P("attribute::"))/""*Cc("(ll.at and ll.at['")*((R("az","AZ")+S("-_:"))^1)*Cc("'])")
local lp_fastpos_p=P("+")^0*R("09")^1*P(-1)/"l==%0"
-local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0==l))"
+local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0+1==l))"
local lp_fastpos=lp_fastpos_n+lp_fastpos_p
local lp_reserved=C("and")+C("or")+C("not")+C("div")+C("mod")+C("true")+C("false")
local lp_lua_function=Cs((R("az","AZ","__")^1*(P(".")*R("az","AZ","__")^1)^1)*("("))/"%0"
@@ -19312,7 +18999,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 30771, stripped down to: 19680
+-- original size: 33708, stripped down to: 20953
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19330,7 +19017,7 @@ local xmlinheritedconvert=xml.inheritedconvert
local xmlapplylpath=xml.applylpath
local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable
local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat
-local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip
+local gmatch,gsub,format,find,strip,match=string.gmatch,string.gsub,string.format,string.find,string.strip,string.match
local utfbyte=utf.byte
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local striplinepatterns=utilities.strings.striplinepatterns
@@ -19461,7 +19148,7 @@ local function xmltoelement(whatever,root)
end
local element
if type(whatever)=="string" then
- element=xmlinheritedconvert(whatever,root)
+ element=xmlinheritedconvert(whatever,root,true)
else
element=whatever
end
@@ -19474,15 +19161,18 @@ local function xmltoelement(whatever,root)
end
xml.toelement=xmltoelement
local function copiedelement(element,newparent)
- if type(element)=="string" then
- return element
- else
+ if type(element)~="string" then
element=xmlcopy(element).dt
if newparent and type(element)=="table" then
- element.__p__=newparent
+ for i=1,#element do
+ local e=element[i]
+ if type(e)=="table" then
+ e.__p__=newparent
+ end
+ end
end
- return element
end
+ return element
end
function xml.delete(root,pattern)
if not pattern or pattern=="" then
@@ -19521,6 +19211,32 @@ function xml.delete(root,pattern)
end
end
end
+function xml.wipe(root,pattern)
+ local collected=xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ local d=p.dt
+ local ni=e.ni
+ if ni<=#d then
+ local dt=e.dt
+ if #dt==1 then
+ local d1=dt[1]
+ if type(d1)=="string" and match(d1,"^%s*$") then
+ if trace_manipulations then
+ report('wiping',pattern,c,e)
+ end
+ remove(d,ni)
+ redo_ni(d)
+ end
+ end
+ end
+ end
+ end
+ end
+end
function xml.replace(root,pattern,whatever)
local element=root and xmltoelement(whatever,root)
local collected=element and xmlapplylpath(root,pattern)
@@ -19690,10 +19406,10 @@ local function include(xmldata,pattern,attribute,recursive,loaddata,level)
elseif ekat["parse"]=="text" then
epdt[ek.ni]=xml.escaped(data)
else
-local settings=xmldata.settings
-local savedresource=settings.currentresource
-settings.currentresource=name
- local xi=xmlinheritedconvert(data,xmldata)
+ local settings=xmldata.settings
+ local savedresource=settings.currentresource
+ settings.currentresource=name
+ local xi=xmlinheritedconvert(data,xmldata,true)
if not xi then
epdt[ek.ni]=""
else
@@ -19703,7 +19419,7 @@ settings.currentresource=name
local child=xml.body(xi)
child.__p__=ekrt
child.__f__=name
-child.cf=name
+ child.cf=name
epdt[ek.ni]=child
local settings=xmldata.settings
local inclusions=settings and settings.inclusions
@@ -19771,28 +19487,47 @@ end
local b_collapser=lpegpatterns.b_collapser
local m_collapser=lpegpatterns.m_collapser
local e_collapser=lpegpatterns.e_collapser
+local x_collapser=lpegpatterns.x_collapser
local b_stripper=lpegpatterns.b_stripper
local m_stripper=lpegpatterns.m_stripper
local e_stripper=lpegpatterns.e_stripper
-local function stripelement(e,nolines,anywhere)
+local x_stripper=lpegpatterns.x_stripper
+local function stripelement(e,nolines,anywhere,everything)
local edt=e.dt
if edt then
local n=#edt
if n==0 then
return e
+ elseif everything then
+ local t={}
+ local m=0
+ for i=1,n do
+ local str=edt[i]
+ if type(str)~="string" then
+ m=m+1
+ t[m]=str
+ elseif str~="" then
+ str=lpegmatch(x_collapser,str)
+ if str~="" then
+ m=m+1
+ t[m]=str
+ end
+ end
+ end
+ e.dt=t
elseif anywhere then
local t={}
local m=0
- for e=1,n do
- local str=edt[e]
+ for i=1,n do
+ local str=edt[i]
if type(str)~="string" then
m=m+1
t[m]=str
elseif str~="" then
if nolines then
- str=lpegmatch((n==1 and b_collapser) or (n==m and e_collapser) or m_collapser,str)
+ str=lpegmatch((i==1 and b_collapser) or (i==m and e_collapser) or m_collapser,str)
else
- str=lpegmatch((n==1 and b_stripper) or (n==m and e_stripper) or m_stripper,str)
+ str=lpegmatch((i==1 and b_stripper) or (i==m and e_stripper) or m_stripper,str)
end
if str~="" then
m=m+1
@@ -19834,14 +19569,27 @@ local function stripelement(e,nolines,anywhere)
return e
end
xml.stripelement=stripelement
-function xml.strip(root,pattern,nolines,anywhere)
+function xml.strip(root,pattern,nolines,anywhere,everything)
local collected=xmlapplylpath(root,pattern)
if collected then
for i=1,#collected do
- stripelement(collected[i],nolines,anywhere)
+ stripelement(collected[i],nolines,anywhere,everything)
+ end
+ end
+end
+local function compactelement(e)
+ local edt=e.dt
+ if edt then
+ for e=1,#edt do
+ local str=edt[e]
+ if type(str)=="string" and not find(str,"%S") then
+ edt[e]=""
+ end
end
end
+ return e
end
+xml.compactelement=compactelement
local function renamespace(root,oldspace,newspace)
local ndt=#root.dt
for i=1,ndt or 0 do
@@ -20790,7 +20538,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-ini"] = package.loaded["data-ini"] or true
--- original size: 10847, stripped down to: 7086
+-- original size: 10947, stripped down to: 7176
if not modules then modules={} end modules ['data-ini']={
version=1.001,
@@ -20836,7 +20584,8 @@ do
ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//")
end
end
-do
+if not environment.homedir then
+ local oldhome=osgetenv('HOME')
local homedir=osgetenv(ostype=="windows" and 'USERPROFILE' or 'HOME') or ''
if not homedir or homedir=="" then
homedir=char(127)
@@ -20844,6 +20593,7 @@ do
homedir=file.collapsepath(homedir)
ossetenv("HOME",homedir)
ossetenv("USERPROFILE",homedir)
+ environment.oldhome=oldhome
environment.homedir=homedir
end
do
@@ -21449,7 +21199,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9400, stripped down to: 6347
+-- original size: 9501, stripped down to: 6411
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21540,7 +21290,9 @@ local relations=allocate {
mp={
names={ "mp" },
variable='MPINPUTS',
- suffixes={ 'mp','mpvi','mpiv','mpxl','mpii' },
+ suffixes=CONTEXTLMTXMODE>0
+ and { 'mp','mpxl','mpvi','mpiv','mpii' }
+ or { 'mp','mpvi','mpiv','mpii' },
usertype=true,
},
tex={
@@ -21734,7 +21486,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16099, stripped down to: 11379
+-- original size: 16409, stripped down to: 11591
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -21984,7 +21736,10 @@ caches.getwritablepath=getwritablepath
caches.setfirstwritablefile=setfirstwritablefile
caches.getfirstreadablefile=getfirstreadablefile
caches.setluanames=setluanames
+local checkmemory=utilities and utilities.lua and utilities.lua.checkmemory
+local threshold=100
function caches.loaddata(readables,name,writable)
+ local used=checkmemory and checkmemory()
if type(readables)=="string" then
readables={ readables }
end
@@ -22011,7 +21766,11 @@ function caches.loaddata(readables,name,writable)
end
if loader then
loader=loader()
- collectgarbage("step")
+ if checkmemory then
+ checkmemory(used,threshold)
+ else
+ collectgarbage("step")
+ end
return loader
end
end
@@ -24110,7 +23869,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-fil"] = package.loaded["data-fil"] or true
--- original size: 4365, stripped down to: 3588
+-- original size: 4365, stripped down to: 3452
if not modules then modules={} end modules ['data-fil']={
version=1.001,
@@ -24130,7 +23889,6 @@ local scanfiles=resolvers.scanfiles
local registerfilehash=resolvers.registerfilehash
local appendhash=resolvers.appendhash
local loadcachecontent=caches.loadcontent
-local checkgarbage=utilities.garbagecollector and utilities.garbagecollector.check
function resolvers.locators.file(specification)
local filename=specification.filename
local realname=resolveprefix(filename)
@@ -24220,10 +23978,7 @@ function loaders.file(specification,filetype)
if trace_locating then
report_files("file loader: %a loaded",filename)
end
- local s=f:read("*a")
- if checkgarbage then
- checkgarbage(#s)
- end
+ local s=f:read("*a")
f:close()
if s then
return true,s,#s
@@ -24371,7 +24126,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-use"] = package.loaded["data-use"] or true
--- original size: 5790, stripped down to: 2910
+-- original size: 5785, stripped down to: 2905
if not modules then modules={} end modules ['data-use']={
version=1.001,
@@ -24387,7 +24142,7 @@ local resolvers=resolvers
local findfile=resolvers.findfile
statistics.register("used config file",function() return caches.configfiles() end)
statistics.register("used cache path",function() return caches.usedpaths() end)
-function statistics.savefmtstatus(texname,formatbanner,sourcefile,kind,banner)
+function statistics.savefmtstatus(texname,formatbanner,sourcefile,banner)
local enginebanner=status.banner
if formatbanner and enginebanner and sourcefile then
local luvname=file.replacesuffix(texname,"luv")
@@ -25532,7 +25287,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5822, stripped down to: 3629
+-- original size: 6459, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25542,7 +25297,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25552,7 +25307,9 @@ local findfile=resolvers.findfile
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.silent",function(v) silent=v end)
local function findlib(required)
local suffix=os.libsuffix or "so"
if not qualifiedpath(required) then
@@ -25653,10 +25410,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
@@ -25674,6 +25431,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
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
end -- of closure
@@ -25785,7 +25555,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 13843, stripped down to: 9991
+-- original size: 11691, stripped down to: 8350
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25836,27 +25606,26 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
- luatex=sandbox.registerrunner {
- name="make luatex format",
- program="luatex",
+ luametatex=sandbox.registerrunner {
+ name="make luametatex format",
+ program="luametatex",
template=template,
checkers=checkers,
reporter=report_format,
},
- luametatex=sandbox.registerrunner {
- name="make luametatex format",
- program="luametatex",
+ luatex=sandbox.registerrunner {
+ name="make luatex format",
+ program="luatex",
template=template,
checkers=checkers,
reporter=report_format,
@@ -25869,6 +25638,16 @@ local runners={
reporter=report_format,
},
}
+local stubfiles={
+ luametatex="luat-cod.lmt",
+ luatex="luat-cod.lua",
+ luajittex="luat-cod.lua",
+}
+local suffixes={
+ luametatex="mkxl",
+ luatex="mkiv",
+ luajittex="mkiv",
+}
local function validbinarypath()
if not environment.arguments.nobinarypath then
local path=environment.ownpath or file.dirname(environment.ownname)
@@ -25880,101 +25659,50 @@ local function validbinarypath()
end
end
end
+local function fatalerror(startupdir,...)
+ report_format(...)
+ lfs.chdir(startupdir)
+end
function environment.make_format(formatname)
local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
local silent=arguments.silent
local errors=arguments.errors
- local texsourcename=""
- local texsourcepath=""
- local fulltexsourcename=""
- if engine=="luametatex" then
- texsourcename=file.addsuffix(formatname,"mkxl")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local runner=runners[engine]
+ local startupdir=dir.current()
+ if not runner then
+ return fatalerror(startupdir,"the format %a cannot be generated, no runner available for engine %a",name,engine)
end
- if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"mkiv")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local luasourcename=stubfiles[engine]
+ if not luasourcename then
+ return fatalerror(startupdir,"no lua stub file specified for %a",engine)
end
+ local texsourcename=file.addsuffix(formatname,suffixes[engine])
+ local fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"tex")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ return fatalerror(startupdir,"no tex source file with name %a (mkiv or tex)",formatname)
end
- if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",formatname)
- return
- end
- report_format("using tex source file %a",fulltexsourcename)
- fulltexsourcename=dir.expandname(fulltexsourcename)
- texsourcepath=file.dirname(fulltexsourcename)
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
- end
- local specificationname="context.lus"
- local specificationpath=""
- local fullspecificationname=resolvers.findfile(specificationname) or ""
- if fullspecificationname=="" then
- report_format("unable to locate specification file %a",specificationname)
- return
- end
- report_format("using specification file %a",fullspecificationname)
- fullspecificationname=dir.expandname(fullspecificationname)
- specificationpath=file.dirname(fullspecificationname)
- if texsourcepath~=specificationpath then
- report_format("tex source file and specification file are on different paths")
- return
- end
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
+ local fulltexsourcename=dir.expandname(fulltexsourcename)
+ local texsourcepath=file.dirname(fulltexsourcename)
+ if lfs.isfile(fulltexsourcename) then
+ report_format("using tex source file %a",fulltexsourcename)
+ else
+ return fatalerror(startupdir,"no accessible tex source file with name %a",fulltexsourcename)
end
- if not lfs.isfile(fullspecificationname) then
- report_format("no accessible specification file with name %a",fulltexsourcename)
- return
+ local fullluasourcename=dir.expandname(file.join(texsourcepath,luasourcename) or "")
+ if lfs.isfile(fullluasourcename) then
+ report_format("using lua stub file %a",fullluasourcename)
+ else
+ return fatalerror(startupdir,"no accessible lua stub file with name %a",fulltexsourcename)
end
- report_format("using tex source path %a",texsourcepath)
local validformatpath=caches.getwritablepath("formats",engine) or ""
- local startupdir=dir.current()
if validformatpath=="" then
- report_format("invalid format path, insufficient write access")
- return
+ return fatalerror(startupdir,"invalid format path, insufficient write access")
end
local binarypath=validbinarypath()
report_format("changing to format path %a",validformatpath)
- lfs.chdir(validformatpath)
- if dir.current()~=validformatpath then
- report_format("unable to change to format path %a",validformatpath)
- return
- end
- local usedluastub=nil
- local usedlualibs=dofile(fullspecificationname)
- if type(usedlualibs)=="string" then
- usedluastub=file.join(specificationpath,usedlualibs)
- elseif type(usedlualibs)=="table" then
- report_format("using stub specification %a",fullspecificationname)
- local texbasename=file.basename(name)
- local luastubname=file.addsuffix(texbasename,luasuffixes.lua)
- local lucstubname=file.addsuffix(texbasename,luasuffixes.luc)
- report_format("creating initialization file %a",luastubname)
- utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
- if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- report_format("using compiled initialization file %a",lucstubname)
- usedluastub=lucstubname
- else
- report_format("using uncompiled initialization file %a",luastubname)
- usedluastub=luastubname
- end
- else
- report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(startupdir)
- return
- end
- local runner=runners[engine]
- if not runner then
- report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
- lfs.chdir(startupdir)
- return
+ if not lfs.chdir(validformatpath) then
+ return fatalerror(startupdir,"unable to change to format path %a",validformatpath)
end
local primaryflags=primaryflags(arguments)
local secondaryflags=secondaryflags(arguments)
@@ -25982,9 +25710,8 @@ function environment.make_format(formatname)
binarypath=binarypath,
primaryflags=primaryflags,
secondaryflags=secondaryflags,
- luafile=quoted(usedluastub),
+ luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26001,7 +25728,7 @@ function environment.make_format(formatname)
end
report_format("format path : %s",validformatpath)
report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",usedluastub)
+ report_format("lua startup file : %s",fullluasourcename)
if primaryflags~="" then
report_format("primary flags : %s",primaryflags)
end
@@ -26083,9 +25810,9 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
luafile=quoted(scriptname),
texfile=filename~="" and quoted(filename) or "",
}
- statistics.starttiming()
+ statistics.starttiming("make format")
local result=runner(specification)
- local runtime=statistics.stoptiming()
+ statistics.stoptiming("make format")
if verbose then
report_format()
if binarypath and binarypath~="" then
@@ -26103,7 +25830,7 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
if secondaryflags~="" then
report_format("secondary flags : %s",secondaryflags)
end
- report_format("run time : %.3f seconds",runtime)
+ report_format("run time : %0.3f seconds",statistics.elapsed("make format"))
report_format("return value : %s",result==0 and "okay" or "error")
report_format()
end
@@ -26115,8 +25842,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1038373
--- stripped bytes : 409980
+-- original bytes : 1025947
+-- stripped bytes : 405652
-- end library merge
@@ -26771,12 +26498,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
index 6eaf5ff449f..6fc17adb022 100755
--- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
+++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -852,7 +849,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11605, stripped down to: 8299
+-- original size: 12566, stripped down to: 8937
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -861,7 +858,7 @@ if not modules then modules={} end modules ['l-package']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local type=type
+local type,unpack=type,unpack
local gsub,format,find=string.gsub,string.format,string.find
local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
@@ -891,6 +888,7 @@ local helpers=package.helpers or {
},
methods={},
sequence={
+ "reset loaded",
"already loaded",
"preload table",
"qualified path",
@@ -907,6 +905,7 @@ local methods=helpers.methods
local builtin=helpers.builtin
local extraluapaths={}
local extralibpaths={}
+local checkedfiles={}
local luapaths=nil
local libpaths=nil
local oldluapath=nil
@@ -1040,10 +1039,16 @@ end
local function loadedaslib(resolved,rawname)
local base=gsub(rawname,"%.","_")
local init="luaopen_"..gsub(base,"%.","_")
+ local data={ resolved,init,"" }
+ checkedfiles[#checkedfiles+1]=data
if helpers.trace then
helpers.report("calling loadlib with '%s' with init '%s'",resolved,init)
end
- return package.loadlib(resolved,init)
+ local a,b,c=package.loadlib(resolved,init)
+ if not a and type(b)=="string" then
+ data[3]=string.fullstrip(b or "unknown error")
+ end
+ return a,b,c
end
helpers.loadedaslib=loadedaslib
local function loadedbypath(name,rawname,paths,islib,what)
@@ -1082,11 +1087,18 @@ local function loadedbyname(name,rawname)
end
end
helpers.loadedbyname=loadedbyname
+methods["reset loaded"]=function(name)
+ checkedfiles={}
+ return false
+end
methods["already loaded"]=function(name)
return package.loaded[name]
end
methods["preload table"]=function(name)
- return builtin["preload table"](name)
+ local f=builtin["preload table"]
+ if f then
+ return f(name)
+ end
end
methods["qualified path"]=function(name)
return loadedbyname(addsuffix(lualibfile(name),"lua"),name)
@@ -1098,19 +1110,31 @@ methods["lib extra list"]=function(name)
return loadedbypath(addsuffix(lualibfile(name),os.libsuffix),name,getextralibpaths(),true,"lib")
end
methods["path specification"]=function(name)
- getluapaths()
- return builtin["path specification"](name)
+ local f=builtin["path specification"]
+ if f then
+ getluapaths()
+ return f(name)
+ end
end
methods["cpath specification"]=function(name)
- getlibpaths()
- return builtin["cpath specification"](name)
+ local f=builtin["cpath specification"]
+ if f then
+ getlibpaths()
+ return f(name)
+ end
end
methods["all in one fallback"]=function(name)
- return builtin["all in one fallback"](name)
+ local f=builtin["all in one fallback"]
+ if f then
+ return f(name)
+ end
end
methods["not loaded"]=function(name)
if helpers.trace then
helpers.report("unable to locate '%s'",name or "?")
+ for i=1,#checkedfiles do
+ helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i]))
+ end
end
return nil
end
@@ -1122,19 +1146,22 @@ function helpers.loaded(name)
level=level+1
for i=1,#sequence do
local method=sequence[i]
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
- end
- local result,rest=methods[method](name)
- if type(result)=="function" then
+ local lookup=method and methods[method]
+ if type(lookup)=="function" then
if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
end
- if helpers.traceused then
- used[#used+1]={ level=level,name=name }
+ local result,rest=lookup(name)
+ if type(result)=="function" then
+ if helpers.trace then
+ helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ end
+ if helpers.traceused then
+ used[#used+1]={ level=level,name=name }
+ end
+ level=level-1
+ return result,rest
end
- level=level-1
- return result,rest
end
end
level=level-1
@@ -1174,7 +1201,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 38440, stripped down to: 19316
+-- original size: 38703, stripped down to: 19489
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1272,11 +1299,13 @@ local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0)
local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0))
local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0)
local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0)
-local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0)
+local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
+local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0)
local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0)
-local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0)
+local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
+local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0)
patterns.stripper=stripper
patterns.fullstripper=fullstripper
patterns.collapser=collapser
@@ -1284,9 +1313,11 @@ patterns.nospacer=nospacer
patterns.b_collapser=b_collapser
patterns.m_collapser=m_collapser
patterns.e_collapser=e_collapser
+patterns.x_collapser=x_collapser
patterns.b_stripper=b_stripper
patterns.m_stripper=m_stripper
patterns.e_stripper=e_stripper
+patterns.x_stripper=x_stripper
patterns.lowercase=lowercase
patterns.uppercase=uppercase
patterns.letter=patterns.lowercase+patterns.uppercase
@@ -3806,7 +3837,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-os"] = package.loaded["l-os"] or true
--- original size: 19120, stripped down to: 10208
+-- original size: 19409, stripped down to: 10419
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -4029,6 +4060,8 @@ elseif name=="macosx" then
platform="osx-intel"
elseif find(architecture,"x86_64",1,true) then
platform="osx-64"
+ elseif find(architecture,"arm64",1,true) then
+ platform="osx-64"
else
platform="osx-ppc"
end
@@ -4200,11 +4233,19 @@ local function isleapyear(year)
end
os.isleapyear=isleapyear
local days={ 31,28,31,30,31,30,31,31,30,31,30,31 }
-local function nofdays(year,month)
+local function nofdays(year,month,day)
if not month then
return isleapyear(year) and 365 or 364
- else
+ elseif not day then
return month==2 and isleapyear(year) and 29 or days[month]
+ else
+ for i=1,month-1 do
+ day=day+days[i]
+ end
+ if month>2 and isleapyear(year) then
+ day=day+1
+ end
+ return day
end
end
os.nofdays=nofdays
@@ -5729,10 +5770,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 41281, stripped down to: 17261
+-- original size: 41303, stripped down to: 17277
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -6563,7 +6605,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 45153, stripped down to: 22734
+-- original size: 45129, stripped down to: 23525
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -6615,25 +6657,59 @@ local function points(n)
n=n*ptf
if n%1==0 then
return format("%ipt",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fpt",n))
+ end
+end
+local function nupoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*ptf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fpt",n))
end
local function basepoints(n)
if n==0 then
- return "0pt"
+ return "0bp"
end
n=tonumber(n)
if not n or n==0 then
- return "0pt"
+ return "0bp"
end
n=n*bpf
if n%1==0 then
return format("%ibp",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fbp",n))
+ end
+end
+local function nubasepoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*bpf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fbp",n))
end
number.points=points
+number.nupoints=nupoints
number.basepoints=basepoints
+number.nubasepoints=nubasepoints
local rubish=spaceortab^0*newline
local anyrubish=spaceortab+newline
local stripped=(spaceortab^1/"")*newline
@@ -6911,7 +6987,9 @@ local environment={
concat=table.concat,
signed=number.signed,
points=number.points,
+ nupoints=number.nupoints,
basepoints=number.basepoints,
+ nubasepoints=number.nubasepoints,
utfchar=utf.char,
utfbyte=utf.byte,
lpegmatch=lpeg.match,
@@ -7106,10 +7184,18 @@ local format_p=function()
n=n+1
return format("points(a%s)",n)
end
+local format_P=function()
+ n=n+1
+ return format("nupoints(a%s)",n)
+end
local format_b=function()
n=n+1
return format("basepoints(a%s)",n)
end
+local format_B=function()
+ n=n+1
+ return format("nubasepoints(a%s)",n)
+end
local format_t=function(f)
n=n+1
if f and f~="" then
@@ -7219,33 +7305,36 @@ local format_extension=function(extensions,f,name)
local extension=extensions[name] or "tostring(%s)"
local f=tonumber(f) or 1
local w=find(extension,"%.%.%.")
- if w then
- if f==0 then
+ if f==0 then
+ if w then
extension=gsub(extension,"%.%.%.","")
- return extension
- elseif f==1 then
+ end
+ return extension
+ elseif f==1 then
+ if w then
extension=gsub(extension,"%.%.%.","%%s")
- n=n+1
- local a="a"..n
- return format(extension,a,a)
- elseif f<0 then
+ end
+ n=n+1
+ local a="a"..n
+ return format(extension,a,a)
+ elseif f<0 then
+ if w then
+ extension=gsub(extension,"%.%.%.","")
+ return extension
+ else
local a="a"..(n+f+1)
return format(extension,a,a)
- else
- extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
- local t={}
- for i=1,f do
- n=n+1
- t[i]="a"..n
- end
- return format(extension,unpack(t))
end
else
- extension=gsub(extension,"%%s",function()
+ if w then
+ extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
+ end
+ local t={}
+ for i=1,f do
n=n+1
- return "a"..n
- end)
- return extension
+ t[i]="a"..n
+ end
+ return format(extension,unpack(t))
end
end
local builder=Cs { "start",
@@ -7259,7 +7348,7 @@ local builder=Cs { "start",
+V("n")
+V("N")
+V("k")
-+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("b")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
++V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
+V("W")
+V("a")
+V("A")
@@ -7297,7 +7386,9 @@ local builder=Cs { "start",
["u"]=(prefix_any*P("u"))/format_u,
["U"]=(prefix_any*P("U"))/format_U,
["p"]=(prefix_any*P("p"))/format_p,
+ ["P"]=(prefix_any*P("P"))/format_P,
["b"]=(prefix_any*P("b"))/format_b,
+ ["B"]=(prefix_any*P("B"))/format_B,
["t"]=(prefix_tab*P("t"))/format_t,
["T"]=(prefix_tab*P("T"))/format_T,
["l"]=(prefix_any*P("l"))/format_l,
@@ -7448,7 +7539,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 32649, stripped down to: 18257
+-- original size: 32815, stripped down to: 18257
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -8194,10 +8285,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fil"] = package.loaded["util-fil"] or true
--- original size: 11530, stripped down to: 9007
+-- original size: 11552, stripped down to: 9023
if not modules then modules={} end modules ['util-fil']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -8562,10 +8654,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 12946, stripped down to: 9507
+-- original size: 12968, stripped down to: 9523
if not modules then modules={} end modules ['util-sac']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -9215,7 +9308,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 24132, stripped down to: 16210
+-- original size: 24683, stripped down to: 16431
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9228,7 +9321,7 @@ local lpeg,table,string=lpeg,table,string
local P,R,V,S,C,Ct,Cs,Carg,Cc,Cg,Cf,Cp=lpeg.P,lpeg.R,lpeg.V,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cc,lpeg.Cg,lpeg.Cf,lpeg.Cp
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local concat,gmatch,find=table.concat,string.gmatch,string.find
-local tostring,type,next,rawset=tostring,type,next,rawset
+local tonumber,tostring,type,next,rawset=tonumber,tostring,type,next,rawset
local mod,div=math.mod,math.div
utilities=utilities or {}
local parsers=utilities.parsers or {}
@@ -9620,13 +9713,15 @@ function parsers.csvsplitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
local separator=specification.separator
local quotechar=specification.quote
+ local numbers=specification.numbers
local separator=S(separator~="" and separator or ",")
local whatever=C((1-separator-newline)^0)
if quotechar and quotechar~="" then
local quotedata=nil
for chr in gmatch(quotechar,".") do
local quotechar=P(chr)
- local quoteword=quotechar*C((1-quotechar)^0)*quotechar
+ local quoteitem=(1-quotechar)^0
+ local quoteword=quotechar*(numbers and (quoteitem/tonumber) or C(quoteitem))*quotechar
if quotedata then
quotedata=quotedata+quoteword
else
@@ -9642,12 +9737,14 @@ function parsers.csvsplitter(specification)
end
function parsers.rfc4180splitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
+ local numbers=specification.numbers
local separator=specification.separator
local quotechar=P(specification.quote)
local dquotechar=quotechar*quotechar
/specification.quote
local separator=S(separator~="" and separator or ",")
- local escaped=quotechar*Cs((dquotechar+(1-quotechar))^0)*quotechar
+ local whatever=(dquotechar+(1-quotechar))^0
+ local escaped=quotechar*(numbers and (whatever/tonumber) or Cs(whatever))*quotechar
local non_escaped=C((1-quotechar-newline-separator)^1)
local field=escaped+non_escaped+Cc("")
local record=Ct(field*(separator*field)^1)
@@ -11718,7 +11815,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-soc-imp-http"] = package.loaded["util-soc-imp-http"] or true
--- original size: 12577, stripped down to: 9577
+-- original size: 12624, stripped down to: 9598
local tostring,tonumber,setmetatable,next,type=tostring,tonumber,setmetatable,next,type
@@ -11763,7 +11860,7 @@ local function receiveheaders(sock,headers)
if not headers then
headers={}
end
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11773,13 +11870,13 @@ local function receiveheaders(sock,headers)
return nil,"malformed reponse headers"
end
name=lower(name)
- line,err=sock:receive()
+ line,err=sock:receive("*l")
if err then
return nil,err
end
while find(line,"^%s") do
value=value..line
- line=sock:receive()
+ line=sock:receive("*l")
if err then
return nil,err
end
@@ -11799,7 +11896,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
dirty=function() return sock:dirty() end,
},{
__call=function()
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11810,7 +11907,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
if size>0 then
local chunk,err,part=sock:receive(size)
if chunk then
- sock:receive()
+ sock:receive("*a")
end
return chunk,err
else
@@ -12712,7 +12809,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13394, stripped down to: 8882
+-- original size: 13901, stripped down to: 9175
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12735,7 +12832,7 @@ utilities.setters=setters
local data={}
local trace_initialize=false
local frozen=true
-function setters.initialize(filename,name,values)
+local function initialize_setter(filename,name,values)
local setter=data[name]
if setter then
local data=setter.data
@@ -12776,8 +12873,8 @@ function setters.initialize(filename,name,values)
end
end
local function set(t,what,newvalue)
- local data=t.data
- if not data.frozen then
+ local data=t.data
+ if data and not data.frozen then
local done=t.done
if type(what)=="string" then
what=settings_to_hash(what)
@@ -12813,7 +12910,7 @@ local function set(t,what,newvalue)
end
local function reset(t)
local data=t.data
- if not data.frozen then
+ if data and not data.frozen then
for name,functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
@@ -12834,7 +12931,7 @@ local function disable(t,what)
set(t,what,false)
end
end
-function setters.register(t,what,...)
+local function register_setter(t,what,...)
local data=t.data
what=lower(what)
local functions=data[what]
@@ -12869,23 +12966,24 @@ function setters.register(t,what,...)
end
return false
end
-function setters.enable(t,what)
+local function enable_setter(t,what)
local e=t.enable
t.enable,t.done=enable,{}
+ set(t,what,true)
enable(t,what)
t.enable,t.done=e,{}
end
-function setters.disable(t,what)
+local function disable_setter(t,what)
local e=t.disable
t.disable,t.done=disable,{}
disable(t,what)
t.disable,t.done=e,{}
end
-function setters.reset(t)
+local function reset_setter(t)
t.done={}
reset(t)
end
-function setters.list(t)
+local function list_setter(t)
local list=table.sortedkeys(t.data)
local user,system={},{}
for l=1,#list do
@@ -12898,8 +12996,8 @@ function setters.list(t)
end
return user,system
end
-function setters.show(t)
- local list=setters.list(t)
+local function show_setter(t)
+ local list=list_setter(t)
t.report()
for k=1,#list do
local name=list[k]
@@ -12930,39 +13028,50 @@ function setters.show(t)
end
end
end
-local enable,disable,register,list,show=setters.enable,setters.disable,setters.register,setters.list,setters.show
function setters.report(setter,fmt,...)
- print(formatters["%-15s : %s\n"](setter.name,formatters[fmt](...)))
+ if fmt then
+ print(formatters["%-15s : %s"](setter.name,formatters[fmt](...)))
+ else
+ print("")
+ end
end
-local function default(setter,name)
+local function setter_default(setter,name)
local d=setter.data[name]
return d and d.default
end
-local function value(setter,name)
+local function setter_value(setter,name)
local d=setter.data[name]
return d and (d.value or d.default)
end
-function setters.new(name)
+local function new_setter(name)
local setter
setter={
data=allocate(),
name=name,
- report=function(...) setters.report (setter,...) end,
- enable=function(...) enable (setter,...) end,
- disable=function(...) disable (setter,...) end,
- reset=function(...) reset (setter,...) end,
- register=function(...) register(setter,...) end,
- list=function(...) return list (setter,...) end,
- show=function(...) show (setter,...) end,
- default=function(...) return default (setter,...) end,
- value=function(...) return value (setter,...) end,
+ report=function(...) setters.report (setter,...) end,
+ enable=function(...) enable_setter (setter,...) end,
+ disable=function(...) disable_setter (setter,...) end,
+ reset=function(...) reset_setter (setter,...) end,
+ register=function(...) register_setter(setter,...) end,
+ list=function(...) return list_setter (setter,...) end,
+ show=function(...) show_setter (setter,...) end,
+ default=function(...) return setter_default (setter,...) end,
+ value=function(...) return setter_value (setter,...) end,
}
data[name]=setter
return setter
end
-trackers=setters.new("trackers")
-directives=setters.new("directives")
-experiments=setters.new("experiments")
+setters.enable=enable_setter
+setters.disable=disable_setter
+setters.register=register_setter
+setters.list=list_setter
+setters.show=show_setter
+setters.reset=reset_setter
+setters.new=new_setter
+setters.initialize=initialize_setter
+trackers=new_setter("trackers")
+directives=new_setter("directives")
+experiments=new_setter("experiments")
local t_enable,t_disable=trackers .enable,trackers .disable
local d_enable,d_disable=directives .enable,directives .disable
local e_enable,e_disable=experiments.enable,experiments.disable
@@ -13009,11 +13118,11 @@ if environment then
if engineflags then
local list=engineflags["c:trackers"] or engineflags["trackers"]
if type(list)=="string" then
- setters.initialize("commandline flags","trackers",settings_to_hash(list))
+ initialize_setter("commandline flags","trackers",settings_to_hash(list))
end
local list=engineflags["c:directives"] or engineflags["directives"]
if type(list)=="string" then
- setters.initialize("commandline flags","directives",settings_to_hash(list))
+ initialize_setter("commandline flags","directives",settings_to_hash(list))
end
end
end
@@ -13055,7 +13164,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 33003, stripped down to: 21667
+-- original size: 16017, stripped down to: 11045
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -13071,9 +13180,8 @@ local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
-local runningtex=tex and (tex.jobname or tex.formatname)
-local write_nl=runningtex and texio and texio.write_nl or print
-local write=runningtex and texio and texio.write or io.write
+local write_nl=print
+local write=io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -13109,273 +13217,7 @@ local function ansisupported(specification)
return false
end
end
-if runningtex and texio then
- if texio.setescape then
- texio.setescape(0)
- end
- if arg and ansisupported then
- for k,v in next,arg do
- if v=="--ansi" or v=="--c:ansi" then
- if ansisupported("ansi") then
- variant="ansi"
- end
- break
- elseif v=="--ansilog" or v=="--c:ansilog" then
- if ansisupported("ansilog") then
- variant="ansilog"
- end
- break
- end
- end
- end
- local function useluawrites()
- local texio_write_nl=texio.write_nl
- local texio_write=texio.write
- local io_write=io.write
- write_nl=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write_nl("log",...)
- texio_write_nl("term","")
- io_write(...)
- elseif target=="log" then
- texio_write_nl("log",...)
- elseif target=="term" then
- texio_write_nl("term","")
- io_write(...)
- elseif type(target)=="number" then
- texio_write_nl(target,...)
- elseif target~="none" then
- texio_write_nl("log",target,...)
- texio_write_nl("term","")
- io_write(target,...)
- end
- end
- write=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write("log",...)
- io_write(...)
- elseif target=="log" then
- texio_write("log",...)
- elseif target=="term" then
- io_write(...)
- elseif type(target)=="number" then
- texio_write(target,...)
- elseif target~="none" then
- texio_write("log",target,...)
- io_write(target,...)
- end
- end
- texio.write=write
- texio.write_nl=write_nl
- useluawrites=ignore
- end
- local whereto="both"
- local target=nil
- local targets=nil
- local formats=table.setmetatableindex("self")
- local translations=table.setmetatableindex("self")
- local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
- local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
- local variants={
- default={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- },
- },
- ansi={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="none",
- log="none",
- file="none",
- console="term",
- terminal="term",
- both="term",
- },
- }
- }
- variants.ansilog={
- formats=variants.ansi.formats,
- targets=variants.default.targets,
- }
- logs.flush=io.flush
- writer=function(...)
- write_nl(target,...)
- end
- newline=function()
- write_nl(target,"\n")
- end
- report=function(a,b,c,...)
- if c~=nil then
- write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,report_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,report_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- direct=function(a,b,c,...)
- if c~=nil then
- return direct_yes(translations[a],formatters[formats[b]](c,...))
- elseif b then
- return direct_yes(translations[a],formats[b])
- elseif a then
- return direct_nop(translations[a])
- else
- return ""
- end
- end
- subreport=function(a,s,b,c,...)
- if c~=nil then
- write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,subreport_yes(translations[a],translations[s],formats[b]))
- elseif a then
- write_nl(target,subreport_nop(translations[a],translations[s]))
- else
- write_nl(target,"\n")
- end
- end
- subdirect=function(a,s,b,c,...)
- if c~=nil then
- return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
- elseif b then
- return subdirect_yes(translations[a],translations[s],formats[b])
- elseif a then
- return subdirect_nop(translations[a],translations[s])
- else
- return ""
- end
- end
- status=function(a,b,c,...)
- if c~=nil then
- write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,status_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,status_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- settarget=function(askedwhereto)
- whereto=askedwhereto or whereto or "both"
- target=targets[whereto]
- if not target then
- whereto="both"
- target=targets[whereto]
- end
- if target=="term" or target=="term and log" then
- logs.flush=io.flush
- else
- logs.flush=ignore
- end
- end
- local stack={}
- pushtarget=function(newtarget)
- insert(stack,target)
- settarget(newtarget)
- end
- poptarget=function()
- if #stack>0 then
- settarget(remove(stack))
- end
- end
- setformats=function(f)
- formats=f
- end
- settranslations=function(t)
- translations=t
- end
- setprocessor=function(f)
- local writeline=write_nl
- write_nl=function(target,...)
- writeline(target,f(...))
- end
- end
- setformatters=function(specification)
- local t=nil
- local f=nil
- local d=variants.default
- if not specification then
- elseif type(specification)=="table" then
- t=specification.targets
- f=specification.formats or specification
- else
- if not ansisupported(specification) then
- specification="default"
- end
- local v=variants[specification]
- if v then
- t=v.targets
- f=v.formats
- variant=specification
- end
- end
- targets=t or d.targets
- target=targets[whereto] or target
- if f then
- d=d.formats
- else
- f=d.formats
- d=f
- end
- setmetatableindex(f,d)
- report_yes=f.report_yes
- report_nop=f.report_nop
- subreport_yes=f.subreport_yes
- subreport_nop=f.subreport_nop
- direct_yes=f.direct_yes
- direct_nop=f.direct_nop
- subdirect_yes=f.subdirect_yes
- subdirect_nop=f.subdirect_nop
- status_yes=f.status_yes
- status_nop=f.status_nop
- if variant=="ansi" or variant=="ansilog" then
- useluawrites()
- end
- settarget(whereto)
- end
- setformatters(variant)
- setlogfile=ignore
- settimedlog=ignore
-else
+do
local report_yes,subreport_yes,status_yes
local report_nop,subreport_nop,status_nop
local variants={
@@ -13675,46 +13517,6 @@ end)
directives.register("logs.target",function(v)
settarget(v)
end)
-if tex then
- local report=logs.reporter("pages")
- local texgetcount=tex and tex.getcount
- local real,user,sub=0,0,0
- function logs.start_page_number()
- real=texgetcount("realpageno")
- user=texgetcount("userpageno")
- sub=texgetcount("subpageno")
- end
- local timing=false
- local lasttime=nil
- trackers.register("pages.timing",function(v)
- timing=""
- end)
- function logs.stop_page_number()
- if timing then
- local elapsed=statistics.currenttime(statistics)
- local average,page
- if not lasttime or real<2 then
- average=elapsed
- page=elapsed
- else
- average=elapsed/(real-1)
- page=elapsed-lasttime
- end
- lasttime=elapsed
- timing=formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average)
- end
- if real<=0 then
- report("flushing page%s",timing)
- elseif user<=0 then
- report("flushing realpage %s%s",real,timing)
- elseif sub<=0 then
- report("flushing realpage %s, userpage %s%s",real,user,timing)
- else
- report("flushing realpage %s, userpage %s, subpage %s%s",real,user,sub,timing)
- end
- logs.flush()
- end
-end
local nesting=0
local verbose=false
local hasscheme=url.hasscheme
@@ -13826,133 +13628,12 @@ function logs.system(whereto,process,jobname,category,fmt,arg,...)
end
end
local report_system=logs.reporter("system","logs")
-function logs.obsolete(old,new)
- local o=loadstring("return "..new)()
- if type(o)=="function" then
- return function(...)
- report_system("function %a is obsolete, use %a",old,new)
- loadstring(old.."="..new.." return "..old)()(...)
- end
- elseif type(o)=="table" then
- local t,m={},{}
- m.__index=function(t,k)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- return o[k]
- end
- m.__newindex=function(t,k,v)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- o[k]=v
- end
- if libraries then
- libraries.obsolete[old]=t
- end
- setmetatable(t,m)
- return t
- end
-end
if utilities then
utilities.report=report_system
end
-if tex and tex.error then
- function logs.texerrormessage(...)
- tex.error(format(...))
- end
-else
- function logs.texerrormessage(...)
- print(format(...))
- end
-end
if package.helpers.report then
package.helpers.report=logs.reporter("package loader")
end
-if tex then
- local finalactions={}
- local fatalerrors={}
- local possiblefatal={}
- local loggingerrors=false
- function logs.loggingerrors()
- return loggingerrors
- end
- directives.register("logs.errors",function(v)
- loggingerrors=v
- if type(v)=="string" then
- fatalerrors=settings_to_hash(v)
- else
- fatalerrors={}
- end
- end)
- function logs.registerfinalactions(...)
- insert(finalactions,...)
- end
- local what=nil
- local report=nil
- local state=nil
- local target=nil
- local function startlogging(t,r,w,s)
- target=t
- state=force
- force=true
- report=type(r)=="function" and r or logs.reporter(r)
- what=w
- pushtarget(target)
- newline()
- if s then
- report("start %s: %s",what,s)
- else
- report("start %s",what)
- end
- if target=="logfile" then
- newline()
- end
- return report
- end
- local function stoplogging()
- if target=="logfile" then
- newline()
- end
- report("stop %s",what)
- if target=="logfile" then
- newline()
- end
- poptarget()
- state=oldstate
- end
- function logs.startfilelogging(...)
- return startlogging("logfile",...)
- end
- logs.stopfilelogging=stoplogging
- local done=false
- function logs.starterrorlogging(r,w,...)
- if not done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","start possible issues")
- poptarget()
- done=true
- end
- if fatalerrors[w] then
- possiblefatal[w]=true
- end
- return startlogging("terminal",r,w,...)
- end
- logs.stoperrorlogging=stoplogging
- function logs.finalactions()
- if #finalactions>0 then
- for i=1,#finalactions do
- finalactions[i]()
- end
- if done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","stop possible issues")
- poptarget()
- end
- return next(possiblefatal) and sortedkeys(possiblefatal) or false
- end
- end
-end
end -- of closure
@@ -13961,7 +13642,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10184, stripped down to: 7500
+-- original size: 9740, stripped down to: 7296
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14055,10 +13736,8 @@ local function stoptiming(instance)
timer.loadtime=timer.loadtime+loadtime
timer.timing=0
timer.starttime=0
- return loadtime
end
end
- return 0
end
local function benchmarktimer(instance)
local timer=timers[instance or "notimer"]
@@ -14135,18 +13814,11 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
- register("control sequences",function()
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
+ register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
register("callbacks",statistics.callbacks)
@@ -14160,15 +13832,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14224,6 +13891,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -15920,7 +15594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-env"] = package.loaded["luat-env"] or true
--- original size: 6551, stripped down to: 4315
+-- original size: 6267, stripped down to: 4115
if not modules then modules={} end modules ['luat-env']={
version=1.001,
@@ -15948,14 +15622,6 @@ local mt={
else
return "unknown"
end
- elseif k=="kind" then
- local kind=texgettoks and texgettoks("contextkindtoks")
- if kind and kind~="" then
- rawset(environment,"kind",kind)
- return kind
- else
- return "unknown"
- end
elseif k=="jobname" or k=="formatname" then
local name=tex and tex[k]
if name or name=="" then
@@ -16530,7 +16196,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 61191, stripped down to: 35864
+-- original size: 61808, stripped down to: 36227
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17523,12 +17189,25 @@ local function xmlconvert(data,settings)
end
end
xml.convert=xmlconvert
-function xml.inheritedconvert(data,xmldata)
+function xml.inheritedconvert(data,xmldata,cleanup)
local settings=xmldata.settings
if settings then
settings.parent_root=xmldata
end
- local xc=xmlconvert(data,settings)
+ local xc=xmlconvert(data,settings)
+ if cleanup then
+ local x=xc.dt
+ if x then
+ x=x[1]
+ if x and x.tg=="@pi@" then
+ local dt=x.dt
+ local pi=dt and dt[1]
+ if type(pi)=="string" and find(pi,"^xml") then
+ remove(dt,1)
+ end
+ end
+ end
+ end
return xc
end
function xml.is_valid(root)
@@ -17586,9 +17265,17 @@ local function copy(old,p)
new[k]=t
elseif k=="dt" then
v.__p__=nil
- v=copy(v,new)
- new[k]=v
- v.__p__=p
+ local t={}
+ for i=1,#v do
+ local vi=v[i]
+ if type(vi)=="table" then
+ t[i]=copy(vi,new)
+ else
+ t[i]=vi
+ end
+ end
+ new[k]=t
+ t.__p__=p
else
new[k]=v
end
@@ -17992,7 +17679,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54626, stripped down to: 31255
+-- original size: 54667, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -18487,7 +18174,7 @@ local builtin={
local lp_builtin=lpeg.utfchartabletopattern(builtin)/builtin*((spaces*P("(")*spaces*P(")"))/"")
local lp_attribute=(P("@")+P("attribute::"))/""*Cc("(ll.at and ll.at['")*((R("az","AZ")+S("-_:"))^1)*Cc("'])")
local lp_fastpos_p=P("+")^0*R("09")^1*P(-1)/"l==%0"
-local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0==l))"
+local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0+1==l))"
local lp_fastpos=lp_fastpos_n+lp_fastpos_p
local lp_reserved=C("and")+C("or")+C("not")+C("div")+C("mod")+C("true")+C("false")
local lp_lua_function=Cs((R("az","AZ","__")^1*(P(".")*R("az","AZ","__")^1)^1)*("("))/"%0"
@@ -19312,7 +18999,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 30771, stripped down to: 19680
+-- original size: 33708, stripped down to: 20953
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19330,7 +19017,7 @@ local xmlinheritedconvert=xml.inheritedconvert
local xmlapplylpath=xml.applylpath
local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable
local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat
-local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip
+local gmatch,gsub,format,find,strip,match=string.gmatch,string.gsub,string.format,string.find,string.strip,string.match
local utfbyte=utf.byte
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local striplinepatterns=utilities.strings.striplinepatterns
@@ -19461,7 +19148,7 @@ local function xmltoelement(whatever,root)
end
local element
if type(whatever)=="string" then
- element=xmlinheritedconvert(whatever,root)
+ element=xmlinheritedconvert(whatever,root,true)
else
element=whatever
end
@@ -19474,15 +19161,18 @@ local function xmltoelement(whatever,root)
end
xml.toelement=xmltoelement
local function copiedelement(element,newparent)
- if type(element)=="string" then
- return element
- else
+ if type(element)~="string" then
element=xmlcopy(element).dt
if newparent and type(element)=="table" then
- element.__p__=newparent
+ for i=1,#element do
+ local e=element[i]
+ if type(e)=="table" then
+ e.__p__=newparent
+ end
+ end
end
- return element
end
+ return element
end
function xml.delete(root,pattern)
if not pattern or pattern=="" then
@@ -19521,6 +19211,32 @@ function xml.delete(root,pattern)
end
end
end
+function xml.wipe(root,pattern)
+ local collected=xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ local d=p.dt
+ local ni=e.ni
+ if ni<=#d then
+ local dt=e.dt
+ if #dt==1 then
+ local d1=dt[1]
+ if type(d1)=="string" and match(d1,"^%s*$") then
+ if trace_manipulations then
+ report('wiping',pattern,c,e)
+ end
+ remove(d,ni)
+ redo_ni(d)
+ end
+ end
+ end
+ end
+ end
+ end
+end
function xml.replace(root,pattern,whatever)
local element=root and xmltoelement(whatever,root)
local collected=element and xmlapplylpath(root,pattern)
@@ -19690,10 +19406,10 @@ local function include(xmldata,pattern,attribute,recursive,loaddata,level)
elseif ekat["parse"]=="text" then
epdt[ek.ni]=xml.escaped(data)
else
-local settings=xmldata.settings
-local savedresource=settings.currentresource
-settings.currentresource=name
- local xi=xmlinheritedconvert(data,xmldata)
+ local settings=xmldata.settings
+ local savedresource=settings.currentresource
+ settings.currentresource=name
+ local xi=xmlinheritedconvert(data,xmldata,true)
if not xi then
epdt[ek.ni]=""
else
@@ -19703,7 +19419,7 @@ settings.currentresource=name
local child=xml.body(xi)
child.__p__=ekrt
child.__f__=name
-child.cf=name
+ child.cf=name
epdt[ek.ni]=child
local settings=xmldata.settings
local inclusions=settings and settings.inclusions
@@ -19771,28 +19487,47 @@ end
local b_collapser=lpegpatterns.b_collapser
local m_collapser=lpegpatterns.m_collapser
local e_collapser=lpegpatterns.e_collapser
+local x_collapser=lpegpatterns.x_collapser
local b_stripper=lpegpatterns.b_stripper
local m_stripper=lpegpatterns.m_stripper
local e_stripper=lpegpatterns.e_stripper
-local function stripelement(e,nolines,anywhere)
+local x_stripper=lpegpatterns.x_stripper
+local function stripelement(e,nolines,anywhere,everything)
local edt=e.dt
if edt then
local n=#edt
if n==0 then
return e
+ elseif everything then
+ local t={}
+ local m=0
+ for i=1,n do
+ local str=edt[i]
+ if type(str)~="string" then
+ m=m+1
+ t[m]=str
+ elseif str~="" then
+ str=lpegmatch(x_collapser,str)
+ if str~="" then
+ m=m+1
+ t[m]=str
+ end
+ end
+ end
+ e.dt=t
elseif anywhere then
local t={}
local m=0
- for e=1,n do
- local str=edt[e]
+ for i=1,n do
+ local str=edt[i]
if type(str)~="string" then
m=m+1
t[m]=str
elseif str~="" then
if nolines then
- str=lpegmatch((n==1 and b_collapser) or (n==m and e_collapser) or m_collapser,str)
+ str=lpegmatch((i==1 and b_collapser) or (i==m and e_collapser) or m_collapser,str)
else
- str=lpegmatch((n==1 and b_stripper) or (n==m and e_stripper) or m_stripper,str)
+ str=lpegmatch((i==1 and b_stripper) or (i==m and e_stripper) or m_stripper,str)
end
if str~="" then
m=m+1
@@ -19834,14 +19569,27 @@ local function stripelement(e,nolines,anywhere)
return e
end
xml.stripelement=stripelement
-function xml.strip(root,pattern,nolines,anywhere)
+function xml.strip(root,pattern,nolines,anywhere,everything)
local collected=xmlapplylpath(root,pattern)
if collected then
for i=1,#collected do
- stripelement(collected[i],nolines,anywhere)
+ stripelement(collected[i],nolines,anywhere,everything)
+ end
+ end
+end
+local function compactelement(e)
+ local edt=e.dt
+ if edt then
+ for e=1,#edt do
+ local str=edt[e]
+ if type(str)=="string" and not find(str,"%S") then
+ edt[e]=""
+ end
end
end
+ return e
end
+xml.compactelement=compactelement
local function renamespace(root,oldspace,newspace)
local ndt=#root.dt
for i=1,ndt or 0 do
@@ -20790,7 +20538,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-ini"] = package.loaded["data-ini"] or true
--- original size: 10847, stripped down to: 7086
+-- original size: 10947, stripped down to: 7176
if not modules then modules={} end modules ['data-ini']={
version=1.001,
@@ -20836,7 +20584,8 @@ do
ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//")
end
end
-do
+if not environment.homedir then
+ local oldhome=osgetenv('HOME')
local homedir=osgetenv(ostype=="windows" and 'USERPROFILE' or 'HOME') or ''
if not homedir or homedir=="" then
homedir=char(127)
@@ -20844,6 +20593,7 @@ do
homedir=file.collapsepath(homedir)
ossetenv("HOME",homedir)
ossetenv("USERPROFILE",homedir)
+ environment.oldhome=oldhome
environment.homedir=homedir
end
do
@@ -21449,7 +21199,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9400, stripped down to: 6347
+-- original size: 9501, stripped down to: 6411
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21540,7 +21290,9 @@ local relations=allocate {
mp={
names={ "mp" },
variable='MPINPUTS',
- suffixes={ 'mp','mpvi','mpiv','mpxl','mpii' },
+ suffixes=CONTEXTLMTXMODE>0
+ and { 'mp','mpxl','mpvi','mpiv','mpii' }
+ or { 'mp','mpvi','mpiv','mpii' },
usertype=true,
},
tex={
@@ -21734,7 +21486,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16099, stripped down to: 11379
+-- original size: 16409, stripped down to: 11591
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -21984,7 +21736,10 @@ caches.getwritablepath=getwritablepath
caches.setfirstwritablefile=setfirstwritablefile
caches.getfirstreadablefile=getfirstreadablefile
caches.setluanames=setluanames
+local checkmemory=utilities and utilities.lua and utilities.lua.checkmemory
+local threshold=100
function caches.loaddata(readables,name,writable)
+ local used=checkmemory and checkmemory()
if type(readables)=="string" then
readables={ readables }
end
@@ -22011,7 +21766,11 @@ function caches.loaddata(readables,name,writable)
end
if loader then
loader=loader()
- collectgarbage("step")
+ if checkmemory then
+ checkmemory(used,threshold)
+ else
+ collectgarbage("step")
+ end
return loader
end
end
@@ -24110,7 +23869,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-fil"] = package.loaded["data-fil"] or true
--- original size: 4365, stripped down to: 3588
+-- original size: 4365, stripped down to: 3452
if not modules then modules={} end modules ['data-fil']={
version=1.001,
@@ -24130,7 +23889,6 @@ local scanfiles=resolvers.scanfiles
local registerfilehash=resolvers.registerfilehash
local appendhash=resolvers.appendhash
local loadcachecontent=caches.loadcontent
-local checkgarbage=utilities.garbagecollector and utilities.garbagecollector.check
function resolvers.locators.file(specification)
local filename=specification.filename
local realname=resolveprefix(filename)
@@ -24220,10 +23978,7 @@ function loaders.file(specification,filetype)
if trace_locating then
report_files("file loader: %a loaded",filename)
end
- local s=f:read("*a")
- if checkgarbage then
- checkgarbage(#s)
- end
+ local s=f:read("*a")
f:close()
if s then
return true,s,#s
@@ -24371,7 +24126,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-use"] = package.loaded["data-use"] or true
--- original size: 5790, stripped down to: 2910
+-- original size: 5785, stripped down to: 2905
if not modules then modules={} end modules ['data-use']={
version=1.001,
@@ -24387,7 +24142,7 @@ local resolvers=resolvers
local findfile=resolvers.findfile
statistics.register("used config file",function() return caches.configfiles() end)
statistics.register("used cache path",function() return caches.usedpaths() end)
-function statistics.savefmtstatus(texname,formatbanner,sourcefile,kind,banner)
+function statistics.savefmtstatus(texname,formatbanner,sourcefile,banner)
local enginebanner=status.banner
if formatbanner and enginebanner and sourcefile then
local luvname=file.replacesuffix(texname,"luv")
@@ -25532,7 +25287,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5822, stripped down to: 3629
+-- original size: 6459, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25542,7 +25297,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25552,7 +25307,9 @@ local findfile=resolvers.findfile
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.silent",function(v) silent=v end)
local function findlib(required)
local suffix=os.libsuffix or "so"
if not qualifiedpath(required) then
@@ -25653,10 +25410,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
@@ -25674,6 +25431,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
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
end -- of closure
@@ -25785,7 +25555,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 13843, stripped down to: 9991
+-- original size: 11691, stripped down to: 8350
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25836,27 +25606,26 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
- luatex=sandbox.registerrunner {
- name="make luatex format",
- program="luatex",
+ luametatex=sandbox.registerrunner {
+ name="make luametatex format",
+ program="luametatex",
template=template,
checkers=checkers,
reporter=report_format,
},
- luametatex=sandbox.registerrunner {
- name="make luametatex format",
- program="luametatex",
+ luatex=sandbox.registerrunner {
+ name="make luatex format",
+ program="luatex",
template=template,
checkers=checkers,
reporter=report_format,
@@ -25869,6 +25638,16 @@ local runners={
reporter=report_format,
},
}
+local stubfiles={
+ luametatex="luat-cod.lmt",
+ luatex="luat-cod.lua",
+ luajittex="luat-cod.lua",
+}
+local suffixes={
+ luametatex="mkxl",
+ luatex="mkiv",
+ luajittex="mkiv",
+}
local function validbinarypath()
if not environment.arguments.nobinarypath then
local path=environment.ownpath or file.dirname(environment.ownname)
@@ -25880,101 +25659,50 @@ local function validbinarypath()
end
end
end
+local function fatalerror(startupdir,...)
+ report_format(...)
+ lfs.chdir(startupdir)
+end
function environment.make_format(formatname)
local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
local silent=arguments.silent
local errors=arguments.errors
- local texsourcename=""
- local texsourcepath=""
- local fulltexsourcename=""
- if engine=="luametatex" then
- texsourcename=file.addsuffix(formatname,"mkxl")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local runner=runners[engine]
+ local startupdir=dir.current()
+ if not runner then
+ return fatalerror(startupdir,"the format %a cannot be generated, no runner available for engine %a",name,engine)
end
- if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"mkiv")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local luasourcename=stubfiles[engine]
+ if not luasourcename then
+ return fatalerror(startupdir,"no lua stub file specified for %a",engine)
end
+ local texsourcename=file.addsuffix(formatname,suffixes[engine])
+ local fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"tex")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ return fatalerror(startupdir,"no tex source file with name %a (mkiv or tex)",formatname)
end
- if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",formatname)
- return
- end
- report_format("using tex source file %a",fulltexsourcename)
- fulltexsourcename=dir.expandname(fulltexsourcename)
- texsourcepath=file.dirname(fulltexsourcename)
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
- end
- local specificationname="context.lus"
- local specificationpath=""
- local fullspecificationname=resolvers.findfile(specificationname) or ""
- if fullspecificationname=="" then
- report_format("unable to locate specification file %a",specificationname)
- return
- end
- report_format("using specification file %a",fullspecificationname)
- fullspecificationname=dir.expandname(fullspecificationname)
- specificationpath=file.dirname(fullspecificationname)
- if texsourcepath~=specificationpath then
- report_format("tex source file and specification file are on different paths")
- return
- end
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
+ local fulltexsourcename=dir.expandname(fulltexsourcename)
+ local texsourcepath=file.dirname(fulltexsourcename)
+ if lfs.isfile(fulltexsourcename) then
+ report_format("using tex source file %a",fulltexsourcename)
+ else
+ return fatalerror(startupdir,"no accessible tex source file with name %a",fulltexsourcename)
end
- if not lfs.isfile(fullspecificationname) then
- report_format("no accessible specification file with name %a",fulltexsourcename)
- return
+ local fullluasourcename=dir.expandname(file.join(texsourcepath,luasourcename) or "")
+ if lfs.isfile(fullluasourcename) then
+ report_format("using lua stub file %a",fullluasourcename)
+ else
+ return fatalerror(startupdir,"no accessible lua stub file with name %a",fulltexsourcename)
end
- report_format("using tex source path %a",texsourcepath)
local validformatpath=caches.getwritablepath("formats",engine) or ""
- local startupdir=dir.current()
if validformatpath=="" then
- report_format("invalid format path, insufficient write access")
- return
+ return fatalerror(startupdir,"invalid format path, insufficient write access")
end
local binarypath=validbinarypath()
report_format("changing to format path %a",validformatpath)
- lfs.chdir(validformatpath)
- if dir.current()~=validformatpath then
- report_format("unable to change to format path %a",validformatpath)
- return
- end
- local usedluastub=nil
- local usedlualibs=dofile(fullspecificationname)
- if type(usedlualibs)=="string" then
- usedluastub=file.join(specificationpath,usedlualibs)
- elseif type(usedlualibs)=="table" then
- report_format("using stub specification %a",fullspecificationname)
- local texbasename=file.basename(name)
- local luastubname=file.addsuffix(texbasename,luasuffixes.lua)
- local lucstubname=file.addsuffix(texbasename,luasuffixes.luc)
- report_format("creating initialization file %a",luastubname)
- utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
- if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- report_format("using compiled initialization file %a",lucstubname)
- usedluastub=lucstubname
- else
- report_format("using uncompiled initialization file %a",luastubname)
- usedluastub=luastubname
- end
- else
- report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(startupdir)
- return
- end
- local runner=runners[engine]
- if not runner then
- report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
- lfs.chdir(startupdir)
- return
+ if not lfs.chdir(validformatpath) then
+ return fatalerror(startupdir,"unable to change to format path %a",validformatpath)
end
local primaryflags=primaryflags(arguments)
local secondaryflags=secondaryflags(arguments)
@@ -25982,9 +25710,8 @@ function environment.make_format(formatname)
binarypath=binarypath,
primaryflags=primaryflags,
secondaryflags=secondaryflags,
- luafile=quoted(usedluastub),
+ luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26001,7 +25728,7 @@ function environment.make_format(formatname)
end
report_format("format path : %s",validformatpath)
report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",usedluastub)
+ report_format("lua startup file : %s",fullluasourcename)
if primaryflags~="" then
report_format("primary flags : %s",primaryflags)
end
@@ -26083,9 +25810,9 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
luafile=quoted(scriptname),
texfile=filename~="" and quoted(filename) or "",
}
- statistics.starttiming()
+ statistics.starttiming("make format")
local result=runner(specification)
- local runtime=statistics.stoptiming()
+ statistics.stoptiming("make format")
if verbose then
report_format()
if binarypath and binarypath~="" then
@@ -26103,7 +25830,7 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
if secondaryflags~="" then
report_format("secondary flags : %s",secondaryflags)
end
- report_format("run time : %.3f seconds",runtime)
+ report_format("run time : %0.3f seconds",statistics.elapsed("make format"))
report_format("return value : %s",result==0 and "okay" or "error")
report_format()
end
@@ -26115,8 +25842,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1038373
--- stripped bytes : 409980
+-- original bytes : 1025947
+-- stripped bytes : 405652
-- end library merge
@@ -26771,12 +26498,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)
diff --git a/Master/texmf-dist/scripts/context/stubs/win64/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/win64/mtxrun.lua
index 6eaf5ff449f..6fc17adb022 100644
--- a/Master/texmf-dist/scripts/context/stubs/win64/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/stubs/win64/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -852,7 +849,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-package"] = package.loaded["l-package"] or true
--- original size: 11605, stripped down to: 8299
+-- original size: 12566, stripped down to: 8937
if not modules then modules={} end modules ['l-package']={
version=1.001,
@@ -861,7 +858,7 @@ if not modules then modules={} end modules ['l-package']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local type=type
+local type,unpack=type,unpack
local gsub,format,find=string.gsub,string.format,string.find
local insert,remove=table.insert,table.remove
local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match
@@ -891,6 +888,7 @@ local helpers=package.helpers or {
},
methods={},
sequence={
+ "reset loaded",
"already loaded",
"preload table",
"qualified path",
@@ -907,6 +905,7 @@ local methods=helpers.methods
local builtin=helpers.builtin
local extraluapaths={}
local extralibpaths={}
+local checkedfiles={}
local luapaths=nil
local libpaths=nil
local oldluapath=nil
@@ -1040,10 +1039,16 @@ end
local function loadedaslib(resolved,rawname)
local base=gsub(rawname,"%.","_")
local init="luaopen_"..gsub(base,"%.","_")
+ local data={ resolved,init,"" }
+ checkedfiles[#checkedfiles+1]=data
if helpers.trace then
helpers.report("calling loadlib with '%s' with init '%s'",resolved,init)
end
- return package.loadlib(resolved,init)
+ local a,b,c=package.loadlib(resolved,init)
+ if not a and type(b)=="string" then
+ data[3]=string.fullstrip(b or "unknown error")
+ end
+ return a,b,c
end
helpers.loadedaslib=loadedaslib
local function loadedbypath(name,rawname,paths,islib,what)
@@ -1082,11 +1087,18 @@ local function loadedbyname(name,rawname)
end
end
helpers.loadedbyname=loadedbyname
+methods["reset loaded"]=function(name)
+ checkedfiles={}
+ return false
+end
methods["already loaded"]=function(name)
return package.loaded[name]
end
methods["preload table"]=function(name)
- return builtin["preload table"](name)
+ local f=builtin["preload table"]
+ if f then
+ return f(name)
+ end
end
methods["qualified path"]=function(name)
return loadedbyname(addsuffix(lualibfile(name),"lua"),name)
@@ -1098,19 +1110,31 @@ methods["lib extra list"]=function(name)
return loadedbypath(addsuffix(lualibfile(name),os.libsuffix),name,getextralibpaths(),true,"lib")
end
methods["path specification"]=function(name)
- getluapaths()
- return builtin["path specification"](name)
+ local f=builtin["path specification"]
+ if f then
+ getluapaths()
+ return f(name)
+ end
end
methods["cpath specification"]=function(name)
- getlibpaths()
- return builtin["cpath specification"](name)
+ local f=builtin["cpath specification"]
+ if f then
+ getlibpaths()
+ return f(name)
+ end
end
methods["all in one fallback"]=function(name)
- return builtin["all in one fallback"](name)
+ local f=builtin["all in one fallback"]
+ if f then
+ return f(name)
+ end
end
methods["not loaded"]=function(name)
if helpers.trace then
helpers.report("unable to locate '%s'",name or "?")
+ for i=1,#checkedfiles do
+ helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i]))
+ end
end
return nil
end
@@ -1122,19 +1146,22 @@ function helpers.loaded(name)
level=level+1
for i=1,#sequence do
local method=sequence[i]
- if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
- end
- local result,rest=methods[method](name)
- if type(result)=="function" then
+ local lookup=method and methods[method]
+ if type(lookup)=="function" then
if helpers.trace then
- helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ helpers.report("%s, level '%s', method '%s', name '%s'","locating",level,method,name)
end
- if helpers.traceused then
- used[#used+1]={ level=level,name=name }
+ local result,rest=lookup(name)
+ if type(result)=="function" then
+ if helpers.trace then
+ helpers.report("%s, level '%s', method '%s', name '%s'","found",level,method,name)
+ end
+ if helpers.traceused then
+ used[#used+1]={ level=level,name=name }
+ end
+ level=level-1
+ return result,rest
end
- level=level-1
- return result,rest
end
end
level=level-1
@@ -1174,7 +1201,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 38440, stripped down to: 19316
+-- original size: 38703, stripped down to: 19489
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -1272,11 +1299,13 @@ local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0)
local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0))
local nospacer=Cs((whitespace^1/""+nonwhitespace^1)^0)
local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0)
-local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0)
+local e_collapser=Cs((whitespace^1*endofstring/""+nonwhitespace^1+whitespace^1/" ")^0)
+local x_collapser=Cs((nonwhitespace^1+whitespace^1/"" )^0)
local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0)
-local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0)
+local e_stripper=Cs((spacer^1*endofstring/""+nonspacer^1+spacer^1/" ")^0)
+local x_stripper=Cs((nonspacer^1+spacer^1/"" )^0)
patterns.stripper=stripper
patterns.fullstripper=fullstripper
patterns.collapser=collapser
@@ -1284,9 +1313,11 @@ patterns.nospacer=nospacer
patterns.b_collapser=b_collapser
patterns.m_collapser=m_collapser
patterns.e_collapser=e_collapser
+patterns.x_collapser=x_collapser
patterns.b_stripper=b_stripper
patterns.m_stripper=m_stripper
patterns.e_stripper=e_stripper
+patterns.x_stripper=x_stripper
patterns.lowercase=lowercase
patterns.uppercase=uppercase
patterns.letter=patterns.lowercase+patterns.uppercase
@@ -3806,7 +3837,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-os"] = package.loaded["l-os"] or true
--- original size: 19120, stripped down to: 10208
+-- original size: 19409, stripped down to: 10419
if not modules then modules={} end modules ['l-os']={
version=1.001,
@@ -4029,6 +4060,8 @@ elseif name=="macosx" then
platform="osx-intel"
elseif find(architecture,"x86_64",1,true) then
platform="osx-64"
+ elseif find(architecture,"arm64",1,true) then
+ platform="osx-64"
else
platform="osx-ppc"
end
@@ -4200,11 +4233,19 @@ local function isleapyear(year)
end
os.isleapyear=isleapyear
local days={ 31,28,31,30,31,30,31,31,30,31,30,31 }
-local function nofdays(year,month)
+local function nofdays(year,month,day)
if not month then
return isleapyear(year) and 365 or 364
- else
+ elseif not day then
return month==2 and isleapyear(year) and 29 or days[month]
+ else
+ for i=1,month-1 do
+ day=day+days[i]
+ end
+ if month>2 and isleapyear(year) then
+ day=day+1
+ end
+ return day
end
end
os.nofdays=nofdays
@@ -5729,10 +5770,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-unicode"] = package.loaded["l-unicode"] or true
--- original size: 41281, stripped down to: 17261
+-- original size: 41303, stripped down to: 17277
if not modules then modules={} end modules ['l-unicode']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -6563,7 +6605,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-str"] = package.loaded["util-str"] or true
--- original size: 45153, stripped down to: 22734
+-- original size: 45129, stripped down to: 23525
if not modules then modules={} end modules ['util-str']={
version=1.001,
@@ -6615,25 +6657,59 @@ local function points(n)
n=n*ptf
if n%1==0 then
return format("%ipt",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fpt",n))
+ end
+end
+local function nupoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*ptf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fpt",n))
end
local function basepoints(n)
if n==0 then
- return "0pt"
+ return "0bp"
end
n=tonumber(n)
if not n or n==0 then
- return "0pt"
+ return "0bp"
end
n=n*bpf
if n%1==0 then
return format("%ibp",n)
+ else
+ return lpegmatch(stripzeros,format("%.5fbp",n))
+ end
+end
+local function nubasepoints(n)
+ if n==0 then
+ return "0"
+ end
+ n=tonumber(n)
+ if not n or n==0 then
+ return "0"
+ end
+ n=n*bpf
+ if n%1==0 then
+ return format("%i",n)
+ else
+ return format("%.5f",n)
end
- return lpegmatch(stripzeros,format("%.5fbp",n))
end
number.points=points
+number.nupoints=nupoints
number.basepoints=basepoints
+number.nubasepoints=nubasepoints
local rubish=spaceortab^0*newline
local anyrubish=spaceortab+newline
local stripped=(spaceortab^1/"")*newline
@@ -6911,7 +6987,9 @@ local environment={
concat=table.concat,
signed=number.signed,
points=number.points,
+ nupoints=number.nupoints,
basepoints=number.basepoints,
+ nubasepoints=number.nubasepoints,
utfchar=utf.char,
utfbyte=utf.byte,
lpegmatch=lpeg.match,
@@ -7106,10 +7184,18 @@ local format_p=function()
n=n+1
return format("points(a%s)",n)
end
+local format_P=function()
+ n=n+1
+ return format("nupoints(a%s)",n)
+end
local format_b=function()
n=n+1
return format("basepoints(a%s)",n)
end
+local format_B=function()
+ n=n+1
+ return format("nubasepoints(a%s)",n)
+end
local format_t=function(f)
n=n+1
if f and f~="" then
@@ -7219,33 +7305,36 @@ local format_extension=function(extensions,f,name)
local extension=extensions[name] or "tostring(%s)"
local f=tonumber(f) or 1
local w=find(extension,"%.%.%.")
- if w then
- if f==0 then
+ if f==0 then
+ if w then
extension=gsub(extension,"%.%.%.","")
- return extension
- elseif f==1 then
+ end
+ return extension
+ elseif f==1 then
+ if w then
extension=gsub(extension,"%.%.%.","%%s")
- n=n+1
- local a="a"..n
- return format(extension,a,a)
- elseif f<0 then
+ end
+ n=n+1
+ local a="a"..n
+ return format(extension,a,a)
+ elseif f<0 then
+ if w then
+ extension=gsub(extension,"%.%.%.","")
+ return extension
+ else
local a="a"..(n+f+1)
return format(extension,a,a)
- else
- extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
- local t={}
- for i=1,f do
- n=n+1
- t[i]="a"..n
- end
- return format(extension,unpack(t))
end
else
- extension=gsub(extension,"%%s",function()
+ if w then
+ extension=gsub(extension,"%.%.%.",rep("%%s,",f-1).."%%s")
+ end
+ local t={}
+ for i=1,f do
n=n+1
- return "a"..n
- end)
- return extension
+ t[i]="a"..n
+ end
+ return format(extension,unpack(t))
end
end
local builder=Cs { "start",
@@ -7259,7 +7348,7 @@ local builder=Cs { "start",
+V("n")
+V("N")
+V("k")
-+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("b")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
++V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w")
+V("W")
+V("a")
+V("A")
@@ -7297,7 +7386,9 @@ local builder=Cs { "start",
["u"]=(prefix_any*P("u"))/format_u,
["U"]=(prefix_any*P("U"))/format_U,
["p"]=(prefix_any*P("p"))/format_p,
+ ["P"]=(prefix_any*P("P"))/format_P,
["b"]=(prefix_any*P("b"))/format_b,
+ ["B"]=(prefix_any*P("B"))/format_B,
["t"]=(prefix_tab*P("t"))/format_t,
["T"]=(prefix_tab*P("T"))/format_T,
["l"]=(prefix_any*P("l"))/format_l,
@@ -7448,7 +7539,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-tab"] = package.loaded["util-tab"] or true
--- original size: 32649, stripped down to: 18257
+-- original size: 32815, stripped down to: 18257
if not modules then modules={} end modules ['util-tab']={
version=1.001,
@@ -8194,10 +8285,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-fil"] = package.loaded["util-fil"] or true
--- original size: 11530, stripped down to: 9007
+-- original size: 11552, stripped down to: 9023
if not modules then modules={} end modules ['util-fil']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -8562,10 +8654,11 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-sac"] = package.loaded["util-sac"] or true
--- original size: 12946, stripped down to: 9507
+-- original size: 12968, stripped down to: 9523
if not modules then modules={} end modules ['util-sac']={
version=1.001,
+ optimize=true,
comment="companion to luat-lib.mkiv",
author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright="PRAGMA ADE / ConTeXt Development Team",
@@ -9215,7 +9308,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-prs"] = package.loaded["util-prs"] or true
--- original size: 24132, stripped down to: 16210
+-- original size: 24683, stripped down to: 16431
if not modules then modules={} end modules ['util-prs']={
version=1.001,
@@ -9228,7 +9321,7 @@ local lpeg,table,string=lpeg,table,string
local P,R,V,S,C,Ct,Cs,Carg,Cc,Cg,Cf,Cp=lpeg.P,lpeg.R,lpeg.V,lpeg.S,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg,lpeg.Cc,lpeg.Cg,lpeg.Cf,lpeg.Cp
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local concat,gmatch,find=table.concat,string.gmatch,string.find
-local tostring,type,next,rawset=tostring,type,next,rawset
+local tonumber,tostring,type,next,rawset=tonumber,tostring,type,next,rawset
local mod,div=math.mod,math.div
utilities=utilities or {}
local parsers=utilities.parsers or {}
@@ -9620,13 +9713,15 @@ function parsers.csvsplitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
local separator=specification.separator
local quotechar=specification.quote
+ local numbers=specification.numbers
local separator=S(separator~="" and separator or ",")
local whatever=C((1-separator-newline)^0)
if quotechar and quotechar~="" then
local quotedata=nil
for chr in gmatch(quotechar,".") do
local quotechar=P(chr)
- local quoteword=quotechar*C((1-quotechar)^0)*quotechar
+ local quoteitem=(1-quotechar)^0
+ local quoteword=quotechar*(numbers and (quoteitem/tonumber) or C(quoteitem))*quotechar
if quotedata then
quotedata=quotedata+quoteword
else
@@ -9642,12 +9737,14 @@ function parsers.csvsplitter(specification)
end
function parsers.rfc4180splitter(specification)
specification=specification and setmetatableindex(specification,defaultspecification) or defaultspecification
+ local numbers=specification.numbers
local separator=specification.separator
local quotechar=P(specification.quote)
local dquotechar=quotechar*quotechar
/specification.quote
local separator=S(separator~="" and separator or ",")
- local escaped=quotechar*Cs((dquotechar+(1-quotechar))^0)*quotechar
+ local whatever=(dquotechar+(1-quotechar))^0
+ local escaped=quotechar*(numbers and (whatever/tonumber) or Cs(whatever))*quotechar
local non_escaped=C((1-quotechar-newline-separator)^1)
local field=escaped+non_escaped+Cc("")
local record=Ct(field*(separator*field)^1)
@@ -11718,7 +11815,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-soc-imp-http"] = package.loaded["util-soc-imp-http"] or true
--- original size: 12577, stripped down to: 9577
+-- original size: 12624, stripped down to: 9598
local tostring,tonumber,setmetatable,next,type=tostring,tonumber,setmetatable,next,type
@@ -11763,7 +11860,7 @@ local function receiveheaders(sock,headers)
if not headers then
headers={}
end
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11773,13 +11870,13 @@ local function receiveheaders(sock,headers)
return nil,"malformed reponse headers"
end
name=lower(name)
- line,err=sock:receive()
+ line,err=sock:receive("*l")
if err then
return nil,err
end
while find(line,"^%s") do
value=value..line
- line=sock:receive()
+ line=sock:receive("*l")
if err then
return nil,err
end
@@ -11799,7 +11896,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
dirty=function() return sock:dirty() end,
},{
__call=function()
- local line,err=sock:receive()
+ local line,err=sock:receive("*l")
if err then
return nil,err
end
@@ -11810,7 +11907,7 @@ socket.sourcet["http-chunked"]=function(sock,headers)
if size>0 then
local chunk,err,part=sock:receive(size)
if chunk then
- sock:receive()
+ sock:receive("*a")
end
return chunk,err
else
@@ -12712,7 +12809,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-set"] = package.loaded["trac-set"] or true
--- original size: 13394, stripped down to: 8882
+-- original size: 13901, stripped down to: 9175
if not modules then modules={} end modules ['trac-set']={
version=1.001,
@@ -12735,7 +12832,7 @@ utilities.setters=setters
local data={}
local trace_initialize=false
local frozen=true
-function setters.initialize(filename,name,values)
+local function initialize_setter(filename,name,values)
local setter=data[name]
if setter then
local data=setter.data
@@ -12776,8 +12873,8 @@ function setters.initialize(filename,name,values)
end
end
local function set(t,what,newvalue)
- local data=t.data
- if not data.frozen then
+ local data=t.data
+ if data and not data.frozen then
local done=t.done
if type(what)=="string" then
what=settings_to_hash(what)
@@ -12813,7 +12910,7 @@ local function set(t,what,newvalue)
end
local function reset(t)
local data=t.data
- if not data.frozen then
+ if data and not data.frozen then
for name,functions in sortedthash(data) do
for i=1,#functions do
functions[i](false)
@@ -12834,7 +12931,7 @@ local function disable(t,what)
set(t,what,false)
end
end
-function setters.register(t,what,...)
+local function register_setter(t,what,...)
local data=t.data
what=lower(what)
local functions=data[what]
@@ -12869,23 +12966,24 @@ function setters.register(t,what,...)
end
return false
end
-function setters.enable(t,what)
+local function enable_setter(t,what)
local e=t.enable
t.enable,t.done=enable,{}
+ set(t,what,true)
enable(t,what)
t.enable,t.done=e,{}
end
-function setters.disable(t,what)
+local function disable_setter(t,what)
local e=t.disable
t.disable,t.done=disable,{}
disable(t,what)
t.disable,t.done=e,{}
end
-function setters.reset(t)
+local function reset_setter(t)
t.done={}
reset(t)
end
-function setters.list(t)
+local function list_setter(t)
local list=table.sortedkeys(t.data)
local user,system={},{}
for l=1,#list do
@@ -12898,8 +12996,8 @@ function setters.list(t)
end
return user,system
end
-function setters.show(t)
- local list=setters.list(t)
+local function show_setter(t)
+ local list=list_setter(t)
t.report()
for k=1,#list do
local name=list[k]
@@ -12930,39 +13028,50 @@ function setters.show(t)
end
end
end
-local enable,disable,register,list,show=setters.enable,setters.disable,setters.register,setters.list,setters.show
function setters.report(setter,fmt,...)
- print(formatters["%-15s : %s\n"](setter.name,formatters[fmt](...)))
+ if fmt then
+ print(formatters["%-15s : %s"](setter.name,formatters[fmt](...)))
+ else
+ print("")
+ end
end
-local function default(setter,name)
+local function setter_default(setter,name)
local d=setter.data[name]
return d and d.default
end
-local function value(setter,name)
+local function setter_value(setter,name)
local d=setter.data[name]
return d and (d.value or d.default)
end
-function setters.new(name)
+local function new_setter(name)
local setter
setter={
data=allocate(),
name=name,
- report=function(...) setters.report (setter,...) end,
- enable=function(...) enable (setter,...) end,
- disable=function(...) disable (setter,...) end,
- reset=function(...) reset (setter,...) end,
- register=function(...) register(setter,...) end,
- list=function(...) return list (setter,...) end,
- show=function(...) show (setter,...) end,
- default=function(...) return default (setter,...) end,
- value=function(...) return value (setter,...) end,
+ report=function(...) setters.report (setter,...) end,
+ enable=function(...) enable_setter (setter,...) end,
+ disable=function(...) disable_setter (setter,...) end,
+ reset=function(...) reset_setter (setter,...) end,
+ register=function(...) register_setter(setter,...) end,
+ list=function(...) return list_setter (setter,...) end,
+ show=function(...) show_setter (setter,...) end,
+ default=function(...) return setter_default (setter,...) end,
+ value=function(...) return setter_value (setter,...) end,
}
data[name]=setter
return setter
end
-trackers=setters.new("trackers")
-directives=setters.new("directives")
-experiments=setters.new("experiments")
+setters.enable=enable_setter
+setters.disable=disable_setter
+setters.register=register_setter
+setters.list=list_setter
+setters.show=show_setter
+setters.reset=reset_setter
+setters.new=new_setter
+setters.initialize=initialize_setter
+trackers=new_setter("trackers")
+directives=new_setter("directives")
+experiments=new_setter("experiments")
local t_enable,t_disable=trackers .enable,trackers .disable
local d_enable,d_disable=directives .enable,directives .disable
local e_enable,e_disable=experiments.enable,experiments.disable
@@ -13009,11 +13118,11 @@ if environment then
if engineflags then
local list=engineflags["c:trackers"] or engineflags["trackers"]
if type(list)=="string" then
- setters.initialize("commandline flags","trackers",settings_to_hash(list))
+ initialize_setter("commandline flags","trackers",settings_to_hash(list))
end
local list=engineflags["c:directives"] or engineflags["directives"]
if type(list)=="string" then
- setters.initialize("commandline flags","directives",settings_to_hash(list))
+ initialize_setter("commandline flags","directives",settings_to_hash(list))
end
end
end
@@ -13055,7 +13164,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-log"] = package.loaded["trac-log"] or true
--- original size: 33003, stripped down to: 21667
+-- original size: 16017, stripped down to: 11045
if not modules then modules={} end modules ['trac-log']={
version=1.001,
@@ -13071,9 +13180,8 @@ local topattern=string.topattern
local utfchar=utf.char
local datetime=os.date
local openfile=io.open
-local runningtex=tex and (tex.jobname or tex.formatname)
-local write_nl=runningtex and texio and texio.write_nl or print
-local write=runningtex and texio and texio.write or io.write
+local write_nl=print
+local write=io.write
local setmetatableindex=table.setmetatableindex
local formatters=string.formatters
local settings_to_hash=utilities.parsers.settings_to_hash
@@ -13109,273 +13217,7 @@ local function ansisupported(specification)
return false
end
end
-if runningtex and texio then
- if texio.setescape then
- texio.setescape(0)
- end
- if arg and ansisupported then
- for k,v in next,arg do
- if v=="--ansi" or v=="--c:ansi" then
- if ansisupported("ansi") then
- variant="ansi"
- end
- break
- elseif v=="--ansilog" or v=="--c:ansilog" then
- if ansisupported("ansilog") then
- variant="ansilog"
- end
- break
- end
- end
- end
- local function useluawrites()
- local texio_write_nl=texio.write_nl
- local texio_write=texio.write
- local io_write=io.write
- write_nl=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write_nl("log",...)
- texio_write_nl("term","")
- io_write(...)
- elseif target=="log" then
- texio_write_nl("log",...)
- elseif target=="term" then
- texio_write_nl("term","")
- io_write(...)
- elseif type(target)=="number" then
- texio_write_nl(target,...)
- elseif target~="none" then
- texio_write_nl("log",target,...)
- texio_write_nl("term","")
- io_write(target,...)
- end
- end
- write=function(target,...)
- if not io_write then
- io_write=io.write
- end
- if target=="term and log" then
- texio_write("log",...)
- io_write(...)
- elseif target=="log" then
- texio_write("log",...)
- elseif target=="term" then
- io_write(...)
- elseif type(target)=="number" then
- texio_write(target,...)
- elseif target~="none" then
- texio_write("log",target,...)
- io_write(target,...)
- end
- end
- texio.write=write
- texio.write_nl=write_nl
- useluawrites=ignore
- end
- local whereto="both"
- local target=nil
- local targets=nil
- local formats=table.setmetatableindex("self")
- local translations=table.setmetatableindex("self")
- local report_yes,subreport_yes,direct_yes,subdirect_yes,status_yes
- local report_nop,subreport_nop,direct_nop,subdirect_nop,status_nop
- local variants={
- default={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="log",
- log="log",
- file="log",
- console="term",
- terminal="term",
- both="term and log",
- },
- },
- ansi={
- formats={
- report_yes=formatters["%-15s > %s\n"],
- report_nop=formatters["%-15s >\n"],
- direct_yes=formatters["%-15s > %s"],
- direct_nop=formatters["%-15s >"],
- subreport_yes=formatters["%-15s > %s > %s\n"],
- subreport_nop=formatters["%-15s > %s >\n"],
- subdirect_yes=formatters["%-15s > %s > %s"],
- subdirect_nop=formatters["%-15s > %s >"],
- status_yes=formatters["%-15s : %s\n"],
- status_nop=formatters["%-15s :\n"],
- },
- targets={
- logfile="none",
- log="none",
- file="none",
- console="term",
- terminal="term",
- both="term",
- },
- }
- }
- variants.ansilog={
- formats=variants.ansi.formats,
- targets=variants.default.targets,
- }
- logs.flush=io.flush
- writer=function(...)
- write_nl(target,...)
- end
- newline=function()
- write_nl(target,"\n")
- end
- report=function(a,b,c,...)
- if c~=nil then
- write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,report_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,report_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- direct=function(a,b,c,...)
- if c~=nil then
- return direct_yes(translations[a],formatters[formats[b]](c,...))
- elseif b then
- return direct_yes(translations[a],formats[b])
- elseif a then
- return direct_nop(translations[a])
- else
- return ""
- end
- end
- subreport=function(a,s,b,c,...)
- if c~=nil then
- write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,subreport_yes(translations[a],translations[s],formats[b]))
- elseif a then
- write_nl(target,subreport_nop(translations[a],translations[s]))
- else
- write_nl(target,"\n")
- end
- end
- subdirect=function(a,s,b,c,...)
- if c~=nil then
- return subdirect_yes(translations[a],translations[s],formatters[formats[b]](c,...))
- elseif b then
- return subdirect_yes(translations[a],translations[s],formats[b])
- elseif a then
- return subdirect_nop(translations[a],translations[s])
- else
- return ""
- end
- end
- status=function(a,b,c,...)
- if c~=nil then
- write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
- elseif b then
- write_nl(target,status_yes(translations[a],formats[b]))
- elseif a then
- write_nl(target,status_nop(translations[a]))
- else
- write_nl(target,"\n")
- end
- end
- settarget=function(askedwhereto)
- whereto=askedwhereto or whereto or "both"
- target=targets[whereto]
- if not target then
- whereto="both"
- target=targets[whereto]
- end
- if target=="term" or target=="term and log" then
- logs.flush=io.flush
- else
- logs.flush=ignore
- end
- end
- local stack={}
- pushtarget=function(newtarget)
- insert(stack,target)
- settarget(newtarget)
- end
- poptarget=function()
- if #stack>0 then
- settarget(remove(stack))
- end
- end
- setformats=function(f)
- formats=f
- end
- settranslations=function(t)
- translations=t
- end
- setprocessor=function(f)
- local writeline=write_nl
- write_nl=function(target,...)
- writeline(target,f(...))
- end
- end
- setformatters=function(specification)
- local t=nil
- local f=nil
- local d=variants.default
- if not specification then
- elseif type(specification)=="table" then
- t=specification.targets
- f=specification.formats or specification
- else
- if not ansisupported(specification) then
- specification="default"
- end
- local v=variants[specification]
- if v then
- t=v.targets
- f=v.formats
- variant=specification
- end
- end
- targets=t or d.targets
- target=targets[whereto] or target
- if f then
- d=d.formats
- else
- f=d.formats
- d=f
- end
- setmetatableindex(f,d)
- report_yes=f.report_yes
- report_nop=f.report_nop
- subreport_yes=f.subreport_yes
- subreport_nop=f.subreport_nop
- direct_yes=f.direct_yes
- direct_nop=f.direct_nop
- subdirect_yes=f.subdirect_yes
- subdirect_nop=f.subdirect_nop
- status_yes=f.status_yes
- status_nop=f.status_nop
- if variant=="ansi" or variant=="ansilog" then
- useluawrites()
- end
- settarget(whereto)
- end
- setformatters(variant)
- setlogfile=ignore
- settimedlog=ignore
-else
+do
local report_yes,subreport_yes,status_yes
local report_nop,subreport_nop,status_nop
local variants={
@@ -13675,46 +13517,6 @@ end)
directives.register("logs.target",function(v)
settarget(v)
end)
-if tex then
- local report=logs.reporter("pages")
- local texgetcount=tex and tex.getcount
- local real,user,sub=0,0,0
- function logs.start_page_number()
- real=texgetcount("realpageno")
- user=texgetcount("userpageno")
- sub=texgetcount("subpageno")
- end
- local timing=false
- local lasttime=nil
- trackers.register("pages.timing",function(v)
- timing=""
- end)
- function logs.stop_page_number()
- if timing then
- local elapsed=statistics.currenttime(statistics)
- local average,page
- if not lasttime or real<2 then
- average=elapsed
- page=elapsed
- else
- average=elapsed/(real-1)
- page=elapsed-lasttime
- end
- lasttime=elapsed
- timing=formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average)
- end
- if real<=0 then
- report("flushing page%s",timing)
- elseif user<=0 then
- report("flushing realpage %s%s",real,timing)
- elseif sub<=0 then
- report("flushing realpage %s, userpage %s%s",real,user,timing)
- else
- report("flushing realpage %s, userpage %s, subpage %s%s",real,user,sub,timing)
- end
- logs.flush()
- end
-end
local nesting=0
local verbose=false
local hasscheme=url.hasscheme
@@ -13826,133 +13628,12 @@ function logs.system(whereto,process,jobname,category,fmt,arg,...)
end
end
local report_system=logs.reporter("system","logs")
-function logs.obsolete(old,new)
- local o=loadstring("return "..new)()
- if type(o)=="function" then
- return function(...)
- report_system("function %a is obsolete, use %a",old,new)
- loadstring(old.."="..new.." return "..old)()(...)
- end
- elseif type(o)=="table" then
- local t,m={},{}
- m.__index=function(t,k)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- return o[k]
- end
- m.__newindex=function(t,k,v)
- report_system("table %a is obsolete, use %a",old,new)
- m.__index,m.__newindex=o,o
- o[k]=v
- end
- if libraries then
- libraries.obsolete[old]=t
- end
- setmetatable(t,m)
- return t
- end
-end
if utilities then
utilities.report=report_system
end
-if tex and tex.error then
- function logs.texerrormessage(...)
- tex.error(format(...))
- end
-else
- function logs.texerrormessage(...)
- print(format(...))
- end
-end
if package.helpers.report then
package.helpers.report=logs.reporter("package loader")
end
-if tex then
- local finalactions={}
- local fatalerrors={}
- local possiblefatal={}
- local loggingerrors=false
- function logs.loggingerrors()
- return loggingerrors
- end
- directives.register("logs.errors",function(v)
- loggingerrors=v
- if type(v)=="string" then
- fatalerrors=settings_to_hash(v)
- else
- fatalerrors={}
- end
- end)
- function logs.registerfinalactions(...)
- insert(finalactions,...)
- end
- local what=nil
- local report=nil
- local state=nil
- local target=nil
- local function startlogging(t,r,w,s)
- target=t
- state=force
- force=true
- report=type(r)=="function" and r or logs.reporter(r)
- what=w
- pushtarget(target)
- newline()
- if s then
- report("start %s: %s",what,s)
- else
- report("start %s",what)
- end
- if target=="logfile" then
- newline()
- end
- return report
- end
- local function stoplogging()
- if target=="logfile" then
- newline()
- end
- report("stop %s",what)
- if target=="logfile" then
- newline()
- end
- poptarget()
- state=oldstate
- end
- function logs.startfilelogging(...)
- return startlogging("logfile",...)
- end
- logs.stopfilelogging=stoplogging
- local done=false
- function logs.starterrorlogging(r,w,...)
- if not done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","start possible issues")
- poptarget()
- done=true
- end
- if fatalerrors[w] then
- possiblefatal[w]=true
- end
- return startlogging("terminal",r,w,...)
- end
- logs.stoperrorlogging=stoplogging
- function logs.finalactions()
- if #finalactions>0 then
- for i=1,#finalactions do
- finalactions[i]()
- end
- if done then
- pushtarget("terminal")
- newline()
- logs.report("error logging","stop possible issues")
- poptarget()
- end
- return next(possiblefatal) and sortedkeys(possiblefatal) or false
- end
- end
-end
end -- of closure
@@ -13961,7 +13642,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10184, stripped down to: 7500
+-- original size: 9740, stripped down to: 7296
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14055,10 +13736,8 @@ local function stoptiming(instance)
timer.loadtime=timer.loadtime+loadtime
timer.timing=0
timer.starttime=0
- return loadtime
end
end
- return 0
end
local function benchmarktimer(instance)
local timer=timers[instance or "notimer"]
@@ -14135,18 +13814,11 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
- register("control sequences",function()
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
+ register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
register("callbacks",statistics.callbacks)
@@ -14160,15 +13832,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14224,6 +13891,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -15920,7 +15594,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-env"] = package.loaded["luat-env"] or true
--- original size: 6551, stripped down to: 4315
+-- original size: 6267, stripped down to: 4115
if not modules then modules={} end modules ['luat-env']={
version=1.001,
@@ -15948,14 +15622,6 @@ local mt={
else
return "unknown"
end
- elseif k=="kind" then
- local kind=texgettoks and texgettoks("contextkindtoks")
- if kind and kind~="" then
- rawset(environment,"kind",kind)
- return kind
- else
- return "unknown"
- end
elseif k=="jobname" or k=="formatname" then
local name=tex and tex[k]
if name or name=="" then
@@ -16530,7 +16196,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 61191, stripped down to: 35864
+-- original size: 61808, stripped down to: 36227
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -17523,12 +17189,25 @@ local function xmlconvert(data,settings)
end
end
xml.convert=xmlconvert
-function xml.inheritedconvert(data,xmldata)
+function xml.inheritedconvert(data,xmldata,cleanup)
local settings=xmldata.settings
if settings then
settings.parent_root=xmldata
end
- local xc=xmlconvert(data,settings)
+ local xc=xmlconvert(data,settings)
+ if cleanup then
+ local x=xc.dt
+ if x then
+ x=x[1]
+ if x and x.tg=="@pi@" then
+ local dt=x.dt
+ local pi=dt and dt[1]
+ if type(pi)=="string" and find(pi,"^xml") then
+ remove(dt,1)
+ end
+ end
+ end
+ end
return xc
end
function xml.is_valid(root)
@@ -17586,9 +17265,17 @@ local function copy(old,p)
new[k]=t
elseif k=="dt" then
v.__p__=nil
- v=copy(v,new)
- new[k]=v
- v.__p__=p
+ local t={}
+ for i=1,#v do
+ local vi=v[i]
+ if type(vi)=="table" then
+ t[i]=copy(vi,new)
+ else
+ t[i]=vi
+ end
+ end
+ new[k]=t
+ t.__p__=p
else
new[k]=v
end
@@ -17992,7 +17679,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-lpt"] = package.loaded["lxml-lpt"] or true
--- original size: 54626, stripped down to: 31255
+-- original size: 54667, stripped down to: 31258
if not modules then modules={} end modules ['lxml-lpt']={
version=1.001,
@@ -18487,7 +18174,7 @@ local builtin={
local lp_builtin=lpeg.utfchartabletopattern(builtin)/builtin*((spaces*P("(")*spaces*P(")"))/"")
local lp_attribute=(P("@")+P("attribute::"))/""*Cc("(ll.at and ll.at['")*((R("az","AZ")+S("-_:"))^1)*Cc("'])")
local lp_fastpos_p=P("+")^0*R("09")^1*P(-1)/"l==%0"
-local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0==l))"
+local lp_fastpos_n=P("-")*R("09")^1*P(-1)/"(%0<0 and (#list+%0+1==l))"
local lp_fastpos=lp_fastpos_n+lp_fastpos_p
local lp_reserved=C("and")+C("or")+C("not")+C("div")+C("mod")+C("true")+C("false")
local lp_lua_function=Cs((R("az","AZ","__")^1*(P(".")*R("az","AZ","__")^1)^1)*("("))/"%0"
@@ -19312,7 +18999,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 30771, stripped down to: 19680
+-- original size: 33708, stripped down to: 20953
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19330,7 +19017,7 @@ local xmlinheritedconvert=xml.inheritedconvert
local xmlapplylpath=xml.applylpath
local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable
local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat
-local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip
+local gmatch,gsub,format,find,strip,match=string.gmatch,string.gsub,string.format,string.find,string.strip,string.match
local utfbyte=utf.byte
local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns
local striplinepatterns=utilities.strings.striplinepatterns
@@ -19461,7 +19148,7 @@ local function xmltoelement(whatever,root)
end
local element
if type(whatever)=="string" then
- element=xmlinheritedconvert(whatever,root)
+ element=xmlinheritedconvert(whatever,root,true)
else
element=whatever
end
@@ -19474,15 +19161,18 @@ local function xmltoelement(whatever,root)
end
xml.toelement=xmltoelement
local function copiedelement(element,newparent)
- if type(element)=="string" then
- return element
- else
+ if type(element)~="string" then
element=xmlcopy(element).dt
if newparent and type(element)=="table" then
- element.__p__=newparent
+ for i=1,#element do
+ local e=element[i]
+ if type(e)=="table" then
+ e.__p__=newparent
+ end
+ end
end
- return element
end
+ return element
end
function xml.delete(root,pattern)
if not pattern or pattern=="" then
@@ -19521,6 +19211,32 @@ function xml.delete(root,pattern)
end
end
end
+function xml.wipe(root,pattern)
+ local collected=xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ local d=p.dt
+ local ni=e.ni
+ if ni<=#d then
+ local dt=e.dt
+ if #dt==1 then
+ local d1=dt[1]
+ if type(d1)=="string" and match(d1,"^%s*$") then
+ if trace_manipulations then
+ report('wiping',pattern,c,e)
+ end
+ remove(d,ni)
+ redo_ni(d)
+ end
+ end
+ end
+ end
+ end
+ end
+end
function xml.replace(root,pattern,whatever)
local element=root and xmltoelement(whatever,root)
local collected=element and xmlapplylpath(root,pattern)
@@ -19690,10 +19406,10 @@ local function include(xmldata,pattern,attribute,recursive,loaddata,level)
elseif ekat["parse"]=="text" then
epdt[ek.ni]=xml.escaped(data)
else
-local settings=xmldata.settings
-local savedresource=settings.currentresource
-settings.currentresource=name
- local xi=xmlinheritedconvert(data,xmldata)
+ local settings=xmldata.settings
+ local savedresource=settings.currentresource
+ settings.currentresource=name
+ local xi=xmlinheritedconvert(data,xmldata,true)
if not xi then
epdt[ek.ni]=""
else
@@ -19703,7 +19419,7 @@ settings.currentresource=name
local child=xml.body(xi)
child.__p__=ekrt
child.__f__=name
-child.cf=name
+ child.cf=name
epdt[ek.ni]=child
local settings=xmldata.settings
local inclusions=settings and settings.inclusions
@@ -19771,28 +19487,47 @@ end
local b_collapser=lpegpatterns.b_collapser
local m_collapser=lpegpatterns.m_collapser
local e_collapser=lpegpatterns.e_collapser
+local x_collapser=lpegpatterns.x_collapser
local b_stripper=lpegpatterns.b_stripper
local m_stripper=lpegpatterns.m_stripper
local e_stripper=lpegpatterns.e_stripper
-local function stripelement(e,nolines,anywhere)
+local x_stripper=lpegpatterns.x_stripper
+local function stripelement(e,nolines,anywhere,everything)
local edt=e.dt
if edt then
local n=#edt
if n==0 then
return e
+ elseif everything then
+ local t={}
+ local m=0
+ for i=1,n do
+ local str=edt[i]
+ if type(str)~="string" then
+ m=m+1
+ t[m]=str
+ elseif str~="" then
+ str=lpegmatch(x_collapser,str)
+ if str~="" then
+ m=m+1
+ t[m]=str
+ end
+ end
+ end
+ e.dt=t
elseif anywhere then
local t={}
local m=0
- for e=1,n do
- local str=edt[e]
+ for i=1,n do
+ local str=edt[i]
if type(str)~="string" then
m=m+1
t[m]=str
elseif str~="" then
if nolines then
- str=lpegmatch((n==1 and b_collapser) or (n==m and e_collapser) or m_collapser,str)
+ str=lpegmatch((i==1 and b_collapser) or (i==m and e_collapser) or m_collapser,str)
else
- str=lpegmatch((n==1 and b_stripper) or (n==m and e_stripper) or m_stripper,str)
+ str=lpegmatch((i==1 and b_stripper) or (i==m and e_stripper) or m_stripper,str)
end
if str~="" then
m=m+1
@@ -19834,14 +19569,27 @@ local function stripelement(e,nolines,anywhere)
return e
end
xml.stripelement=stripelement
-function xml.strip(root,pattern,nolines,anywhere)
+function xml.strip(root,pattern,nolines,anywhere,everything)
local collected=xmlapplylpath(root,pattern)
if collected then
for i=1,#collected do
- stripelement(collected[i],nolines,anywhere)
+ stripelement(collected[i],nolines,anywhere,everything)
+ end
+ end
+end
+local function compactelement(e)
+ local edt=e.dt
+ if edt then
+ for e=1,#edt do
+ local str=edt[e]
+ if type(str)=="string" and not find(str,"%S") then
+ edt[e]=""
+ end
end
end
+ return e
end
+xml.compactelement=compactelement
local function renamespace(root,oldspace,newspace)
local ndt=#root.dt
for i=1,ndt or 0 do
@@ -20790,7 +20538,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-ini"] = package.loaded["data-ini"] or true
--- original size: 10847, stripped down to: 7086
+-- original size: 10947, stripped down to: 7176
if not modules then modules={} end modules ['data-ini']={
version=1.001,
@@ -20836,7 +20584,8 @@ do
ossetenv("OSFONTDIR","$HOME/Library/Fonts//;/Library/Fonts//;/System/Library/Fonts//")
end
end
-do
+if not environment.homedir then
+ local oldhome=osgetenv('HOME')
local homedir=osgetenv(ostype=="windows" and 'USERPROFILE' or 'HOME') or ''
if not homedir or homedir=="" then
homedir=char(127)
@@ -20844,6 +20593,7 @@ do
homedir=file.collapsepath(homedir)
ossetenv("HOME",homedir)
ossetenv("USERPROFILE",homedir)
+ environment.oldhome=oldhome
environment.homedir=homedir
end
do
@@ -21449,7 +21199,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9400, stripped down to: 6347
+-- original size: 9501, stripped down to: 6411
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21540,7 +21290,9 @@ local relations=allocate {
mp={
names={ "mp" },
variable='MPINPUTS',
- suffixes={ 'mp','mpvi','mpiv','mpxl','mpii' },
+ suffixes=CONTEXTLMTXMODE>0
+ and { 'mp','mpxl','mpvi','mpiv','mpii' }
+ or { 'mp','mpvi','mpiv','mpii' },
usertype=true,
},
tex={
@@ -21734,7 +21486,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-tmp"] = package.loaded["data-tmp"] or true
--- original size: 16099, stripped down to: 11379
+-- original size: 16409, stripped down to: 11591
if not modules then modules={} end modules ['data-tmp']={
version=1.100,
@@ -21984,7 +21736,10 @@ caches.getwritablepath=getwritablepath
caches.setfirstwritablefile=setfirstwritablefile
caches.getfirstreadablefile=getfirstreadablefile
caches.setluanames=setluanames
+local checkmemory=utilities and utilities.lua and utilities.lua.checkmemory
+local threshold=100
function caches.loaddata(readables,name,writable)
+ local used=checkmemory and checkmemory()
if type(readables)=="string" then
readables={ readables }
end
@@ -22011,7 +21766,11 @@ function caches.loaddata(readables,name,writable)
end
if loader then
loader=loader()
- collectgarbage("step")
+ if checkmemory then
+ checkmemory(used,threshold)
+ else
+ collectgarbage("step")
+ end
return loader
end
end
@@ -24110,7 +23869,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-fil"] = package.loaded["data-fil"] or true
--- original size: 4365, stripped down to: 3588
+-- original size: 4365, stripped down to: 3452
if not modules then modules={} end modules ['data-fil']={
version=1.001,
@@ -24130,7 +23889,6 @@ local scanfiles=resolvers.scanfiles
local registerfilehash=resolvers.registerfilehash
local appendhash=resolvers.appendhash
local loadcachecontent=caches.loadcontent
-local checkgarbage=utilities.garbagecollector and utilities.garbagecollector.check
function resolvers.locators.file(specification)
local filename=specification.filename
local realname=resolveprefix(filename)
@@ -24220,10 +23978,7 @@ function loaders.file(specification,filetype)
if trace_locating then
report_files("file loader: %a loaded",filename)
end
- local s=f:read("*a")
- if checkgarbage then
- checkgarbage(#s)
- end
+ local s=f:read("*a")
f:close()
if s then
return true,s,#s
@@ -24371,7 +24126,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-use"] = package.loaded["data-use"] or true
--- original size: 5790, stripped down to: 2910
+-- original size: 5785, stripped down to: 2905
if not modules then modules={} end modules ['data-use']={
version=1.001,
@@ -24387,7 +24142,7 @@ local resolvers=resolvers
local findfile=resolvers.findfile
statistics.register("used config file",function() return caches.configfiles() end)
statistics.register("used cache path",function() return caches.usedpaths() end)
-function statistics.savefmtstatus(texname,formatbanner,sourcefile,kind,banner)
+function statistics.savefmtstatus(texname,formatbanner,sourcefile,banner)
local enginebanner=status.banner
if formatbanner and enginebanner and sourcefile then
local luvname=file.replacesuffix(texname,"luv")
@@ -25532,7 +25287,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["libs-ini"] = package.loaded["libs-ini"] or true
--- original size: 5822, stripped down to: 3629
+-- original size: 6459, stripped down to: 4006
if not modules then modules={} end modules ['libs-ini']={
version=1.001,
@@ -25542,7 +25297,7 @@ if not modules then modules={} end modules ['libs-ini']={
license="see context related readme files"
}
local type,unpack=type,unpack
-local type=type
+local find=string.find
local nameonly=file.nameonly
local joinfile=file.join
local addsuffix=file.addsuffix
@@ -25552,7 +25307,9 @@ local findfile=resolvers.findfile
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.silent",function(v) silent=v end)
local function findlib(required)
local suffix=os.libsuffix or "so"
if not qualifiedpath(required) then
@@ -25653,10 +25410,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
@@ -25674,6 +25431,19 @@ if FFISUPPORTED and ffi and ffi.load then
end
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
end -- of closure
@@ -25785,7 +25555,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 13843, stripped down to: 9991
+-- original size: 11691, stripped down to: 8350
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25836,27 +25606,26 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
- luatex=sandbox.registerrunner {
- name="make luatex format",
- program="luatex",
+ luametatex=sandbox.registerrunner {
+ name="make luametatex format",
+ program="luametatex",
template=template,
checkers=checkers,
reporter=report_format,
},
- luametatex=sandbox.registerrunner {
- name="make luametatex format",
- program="luametatex",
+ luatex=sandbox.registerrunner {
+ name="make luatex format",
+ program="luatex",
template=template,
checkers=checkers,
reporter=report_format,
@@ -25869,6 +25638,16 @@ local runners={
reporter=report_format,
},
}
+local stubfiles={
+ luametatex="luat-cod.lmt",
+ luatex="luat-cod.lua",
+ luajittex="luat-cod.lua",
+}
+local suffixes={
+ luametatex="mkxl",
+ luatex="mkiv",
+ luajittex="mkiv",
+}
local function validbinarypath()
if not environment.arguments.nobinarypath then
local path=environment.ownpath or file.dirname(environment.ownname)
@@ -25880,101 +25659,50 @@ local function validbinarypath()
end
end
end
+local function fatalerror(startupdir,...)
+ report_format(...)
+ lfs.chdir(startupdir)
+end
function environment.make_format(formatname)
local arguments=environment.arguments
local engine=environment.ownmain or "luatex"
local silent=arguments.silent
local errors=arguments.errors
- local texsourcename=""
- local texsourcepath=""
- local fulltexsourcename=""
- if engine=="luametatex" then
- texsourcename=file.addsuffix(formatname,"mkxl")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local runner=runners[engine]
+ local startupdir=dir.current()
+ if not runner then
+ return fatalerror(startupdir,"the format %a cannot be generated, no runner available for engine %a",name,engine)
end
- if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"mkiv")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ local luasourcename=stubfiles[engine]
+ if not luasourcename then
+ return fatalerror(startupdir,"no lua stub file specified for %a",engine)
end
+ local texsourcename=file.addsuffix(formatname,suffixes[engine])
+ local fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
if fulltexsourcename=="" then
- texsourcename=file.addsuffix(formatname,"tex")
- fulltexsourcename=resolvers.findfile(texsourcename,"tex") or ""
+ return fatalerror(startupdir,"no tex source file with name %a (mkiv or tex)",formatname)
end
- if fulltexsourcename=="" then
- report_format("no tex source file with name %a (mkiv or tex)",formatname)
- return
- end
- report_format("using tex source file %a",fulltexsourcename)
- fulltexsourcename=dir.expandname(fulltexsourcename)
- texsourcepath=file.dirname(fulltexsourcename)
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
- end
- local specificationname="context.lus"
- local specificationpath=""
- local fullspecificationname=resolvers.findfile(specificationname) or ""
- if fullspecificationname=="" then
- report_format("unable to locate specification file %a",specificationname)
- return
- end
- report_format("using specification file %a",fullspecificationname)
- fullspecificationname=dir.expandname(fullspecificationname)
- specificationpath=file.dirname(fullspecificationname)
- if texsourcepath~=specificationpath then
- report_format("tex source file and specification file are on different paths")
- return
- end
- if not lfs.isfile(fulltexsourcename) then
- report_format("no accessible tex source file with name %a",fulltexsourcename)
- return
+ local fulltexsourcename=dir.expandname(fulltexsourcename)
+ local texsourcepath=file.dirname(fulltexsourcename)
+ if lfs.isfile(fulltexsourcename) then
+ report_format("using tex source file %a",fulltexsourcename)
+ else
+ return fatalerror(startupdir,"no accessible tex source file with name %a",fulltexsourcename)
end
- if not lfs.isfile(fullspecificationname) then
- report_format("no accessible specification file with name %a",fulltexsourcename)
- return
+ local fullluasourcename=dir.expandname(file.join(texsourcepath,luasourcename) or "")
+ if lfs.isfile(fullluasourcename) then
+ report_format("using lua stub file %a",fullluasourcename)
+ else
+ return fatalerror(startupdir,"no accessible lua stub file with name %a",fulltexsourcename)
end
- report_format("using tex source path %a",texsourcepath)
local validformatpath=caches.getwritablepath("formats",engine) or ""
- local startupdir=dir.current()
if validformatpath=="" then
- report_format("invalid format path, insufficient write access")
- return
+ return fatalerror(startupdir,"invalid format path, insufficient write access")
end
local binarypath=validbinarypath()
report_format("changing to format path %a",validformatpath)
- lfs.chdir(validformatpath)
- if dir.current()~=validformatpath then
- report_format("unable to change to format path %a",validformatpath)
- return
- end
- local usedluastub=nil
- local usedlualibs=dofile(fullspecificationname)
- if type(usedlualibs)=="string" then
- usedluastub=file.join(specificationpath,usedlualibs)
- elseif type(usedlualibs)=="table" then
- report_format("using stub specification %a",fullspecificationname)
- local texbasename=file.basename(name)
- local luastubname=file.addsuffix(texbasename,luasuffixes.lua)
- local lucstubname=file.addsuffix(texbasename,luasuffixes.luc)
- report_format("creating initialization file %a",luastubname)
- utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)
- if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then
- report_format("using compiled initialization file %a",lucstubname)
- usedluastub=lucstubname
- else
- report_format("using uncompiled initialization file %a",luastubname)
- usedluastub=luastubname
- end
- else
- report_format("invalid stub specification %a",fullspecificationname)
- lfs.chdir(startupdir)
- return
- end
- local runner=runners[engine]
- if not runner then
- report_format("the format %a cannot be generated, no runner available for engine %a",name,engine)
- lfs.chdir(startupdir)
- return
+ if not lfs.chdir(validformatpath) then
+ return fatalerror(startupdir,"unable to change to format path %a",validformatpath)
end
local primaryflags=primaryflags(arguments)
local secondaryflags=secondaryflags(arguments)
@@ -25982,9 +25710,8 @@ function environment.make_format(formatname)
binarypath=binarypath,
primaryflags=primaryflags,
secondaryflags=secondaryflags,
- luafile=quoted(usedluastub),
+ luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26001,7 +25728,7 @@ function environment.make_format(formatname)
end
report_format("format path : %s",validformatpath)
report_format("luatex engine : %s",engine)
- report_format("lua startup file : %s",usedluastub)
+ report_format("lua startup file : %s",fullluasourcename)
if primaryflags~="" then
report_format("primary flags : %s",primaryflags)
end
@@ -26083,9 +25810,9 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
luafile=quoted(scriptname),
texfile=filename~="" and quoted(filename) or "",
}
- statistics.starttiming()
+ statistics.starttiming("make format")
local result=runner(specification)
- local runtime=statistics.stoptiming()
+ statistics.stoptiming("make format")
if verbose then
report_format()
if binarypath and binarypath~="" then
@@ -26103,7 +25830,7 @@ function environment.run_format(formatname,scriptname,filename,primaryflags,seco
if secondaryflags~="" then
report_format("secondary flags : %s",secondaryflags)
end
- report_format("run time : %.3f seconds",runtime)
+ report_format("run time : %0.3f seconds",statistics.elapsed("make format"))
report_format("return value : %s",result==0 and "okay" or "error")
report_format()
end
@@ -26115,8 +25842,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1038373
--- stripped bytes : 409980
+-- original bytes : 1025947
+-- stripped bytes : 405652
-- end library merge
@@ -26771,12 +26498,14 @@ function runners.edit_script(filename) -- we assume that gvim is present on most
end
function runners.save_script_session(filename, list)
- local t = { }
- for i=1,#list do
- local key = list[i]
- t[key] = environment.arguments[key]
+ if type(list) == "table" then
+ local t = { }
+ for i=1,#list do
+ local key = list[i]
+ t[key] = environment.arguments[key]
+ end
+ io.savedata(filename,table.serialize(t,true))
end
- io.savedata(filename,table.serialize(t,true))
end
function runners.load_script_session(filename)