summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-07-06 22:05:18 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-07-06 22:05:18 +0200
commit82c674fdcf5bcff4ad0dc0936d638fc729145616 (patch)
tree6ab4ee4417aa22180cd5b3c50ede6a031f8ce3f9 /scripts
parent3a55e11c7295abf8f2dfe5e9d1c8b153f4518824 (diff)
downloadcontext-82c674fdcf5bcff4ad0dc0936d638fc729145616.tar.gz
2022-07-06 21:35:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-cache.lua3
-rw-r--r--scripts/context/lua/mtx-context.lua2
-rw-r--r--scripts/context/lua/mtx-patterns.lua4
-rw-r--r--scripts/context/lua/mtx-unicode.lua18
-rw-r--r--scripts/context/lua/mtx-vscode.lua280
-rw-r--r--scripts/context/lua/mtxrun.lua74
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua74
-rw-r--r--scripts/context/stubs/unix/mtxrun74
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua74
9 files changed, 537 insertions, 66 deletions
diff --git a/scripts/context/lua/mtx-cache.lua b/scripts/context/lua/mtx-cache.lua
index 4f378ff0a..79b9a118c 100644
--- a/scripts/context/lua/mtx-cache.lua
+++ b/scripts/context/lua/mtx-cache.lua
@@ -78,7 +78,8 @@ local function erase(banner,path,list)
local kept = 0
for i=1,#list do
local filename = list[i]
- if find(filename,"luatex%-cache") then
+ -- if find(filename,"luatex%-cache") then
+ if find(filename,LUATEXENGINE .. "%-cache") then
remove(filename)
if isfile(filename) then
kept = kept + 1
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 125750c26..014a7d4ef 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -379,7 +379,7 @@ local function backup(jobname,run,kind,filename)
end
end
if validfile(filename) then
- local tmpname = f_tempfile(jobname,kind,run or 1)
+ local tmpname = f_tempfile_i(jobname,kind,run or 1)
report("copying %a into %a",filename,tmpname)
file.copy(filename,tmpname)
else
diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua
index bcc8c0861..7f5c1c556 100644
--- a/scripts/context/lua/mtx-patterns.lua
+++ b/scripts/context/lua/mtx-patterns.lua
@@ -102,8 +102,8 @@ scripts.patterns.list = {
{ "deo", "hyph-de-1901", "german, old spelling" },
{ "de", "hyph-de-1996", "german, new spelling" },
-- { "??", "hyph-de-ch-1901", "swiss german" },
- -- { "??", "hyph-el-monoton", "greek" },
- -- { "gr", "hyph-el-polyton", "greek" },
+ -- { "??", "hyph-el-polyton", "greek" },
+ { "gr", "hyph-el-monoton", "greek" },
{ "agr", "hyph-grc", "ancient greek", ignored_ancient_greek },
{ "gb", "hyph-en-gb", "british english" },
{ "us", "hyph-en-us", "american english" },
diff --git a/scripts/context/lua/mtx-unicode.lua b/scripts/context/lua/mtx-unicode.lua
index 8dc0a8607..3866fd86b 100644
--- a/scripts/context/lua/mtx-unicode.lua
+++ b/scripts/context/lua/mtx-unicode.lua
@@ -500,7 +500,7 @@ end
local preamble
-local function splitdefinition(str,index)
+local function splitdefinition(filename,str,index)
local l = splitlines(str)
local t = { }
if index then
@@ -522,7 +522,7 @@ local function splitdefinition(str,index)
t[k] = d
end
else
- report("problem: %s",s)
+ report("problem: %i %s => %s",i,filename,s)
end
end
end
@@ -599,13 +599,13 @@ function scripts.unicode.load()
index = textfiles.index ~= "" and io.loaddata(textfiles.index) or "",
}
texttables = {
- unicodedata = splitdefinition(textdata.unicodedata,true),
- bidimirroring = splitdefinition(textdata.bidimirroring,true),
- linebreak = splitdefinition(textdata.linebreak,true),
- eastasianwidth = splitdefinition(textdata.eastasianwidth,true),
- standardizedvariants = splitdefinition(textdata.standardizedvariants,false),
- arabicshaping = splitdefinition(textdata.arabicshaping,true),
- casefolding = splitdefinition(textdata.casefolding,true),
+ unicodedata = splitdefinition(textfiles.unicodedata,textdata.unicodedata,true),
+ bidimirroring = splitdefinition(textfiles.bidimirroring,textdata.bidimirroring,true),
+ linebreak = splitdefinition(textfiles.linebreak,textdata.linebreak,true),
+ eastasianwidth = splitdefinition(textfiles.eastasianwidth,textdata.eastasianwidth,true),
+ standardizedvariants = splitdefinition(textfiles.standardizedvariants,textdata.standardizedvariants,false),
+ arabicshaping = splitdefinition(textfiles.arabicshaping,textdata.arabicshaping,true),
+ casefolding = splitdefinition(textfiles.casefolding,textdata.casefolding,true),
index = splitindex(textdata.index),
}
--
diff --git a/scripts/context/lua/mtx-vscode.lua b/scripts/context/lua/mtx-vscode.lua
index 309bff69c..474ce97d4 100644
--- a/scripts/context/lua/mtx-vscode.lua
+++ b/scripts/context/lua/mtx-vscode.lua
@@ -142,6 +142,7 @@ local helpinfo = [[
<flag name="generate"><short>generate extension in sync with current version</short></flag>
<flag name="program"><short>use the given binary (e.g. codium, default: code)</short></flag>
<flag name="start"><short>start vscode with extension context</short></flag>
+ <flag name="lsfile"><short>generate language server file (work in progress)</short></flag>
</subcategory>
</category>
</flags>
@@ -165,6 +166,8 @@ local application = logs.application {
helpinfo = helpinfo,
}
+local concat = table.concat
+
local report = application.report
require("util-jsn")
@@ -730,7 +733,7 @@ function scripts.vscode.generate(targetpath)
for i=1,#t do
result[i] = string.gsub(t[i],".",escapes)
end
- return table.concat(result,"|")
+ return concat(result,"|")
end
local function capture(str)
@@ -902,12 +905,12 @@ function scripts.vscode.generate(targetpath)
-- mp argument {...text}
local function words(list)
table.sort(list,sorter)
- return "\\\\(" .. table.concat(list,"|") .. ")" .. "(?=[^a-zA-Z])"
+ return "\\\\(" .. concat(list,"|") .. ")" .. "(?=[^a-zA-Z])"
end
local function bwords(list)
table.sort(list,sorter)
- return "(\\\\(" .. table.concat(list,"|") .. "))\\s*(\\{)"
+ return "(\\\\(" .. concat(list,"|") .. "))\\s*(\\{)"
end
local function ewords()
@@ -916,7 +919,7 @@ function scripts.vscode.generate(targetpath)
local function environments(list)
table.sort(list,sorter)
- last = table.concat(list,"|")
+ last = concat(list,"|")
if #list > 1 then
last = "(?:" .. last .. ")"
end
@@ -1221,7 +1224,7 @@ function scripts.vscode.generate(targetpath)
local function words(list)
table.sort(list,sorter)
- return "(" .. table.concat(list,"|") .. ")" .. "(?=[^a-zA-Z\\_@!?\127-\255])"
+ return "(" .. concat(list,"|") .. ")" .. "(?=[^a-zA-Z\\_@!?\127-\255])"
end
local capturedshortcuts = oneof(mergedshortcuts)
@@ -1434,7 +1437,7 @@ function scripts.vscode.generate(targetpath)
local function words(list)
table.sort(list,sorter)
- return "(" .. table.concat(list,"|") .. ")" .. "(?=[^a-zA-Z])"
+ return "(" .. concat(list,"|") .. ")" .. "(?=[^a-zA-Z])"
end
local capturedkeywords = words {
@@ -2151,7 +2154,7 @@ function scripts.vscode.generate(targetpath)
local function words(list)
table.sort(list,sorter)
- local str = table.concat(list,"|")
+ local str = concat(list,"|")
return "(" .. str .. "|" .. string.upper(str) .. ")" .. "(?=[^a-zA-Z])"
end
@@ -2534,7 +2537,7 @@ function scripts.vscode.generate(targetpath)
local function words(list)
table.sort(list,sorter)
- return "\\b(" .. table.concat(list,"|") .. ")\\b"
+ return "\\b(" .. concat(list,"|") .. ")\\b"
end
local capturedkeywords = words { -- copied from cpp.lua
@@ -3190,6 +3193,261 @@ function scripts.vscode.generate(targetpath)
end
+-- {name: 'inherits: \\setupframed'}
+
+function scripts.vscode.ls(forcedinterface)
+
+ 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 = "context-en.xml"
+ local xmlfile = resolvers.findfile(filename) or ""
+ if xmlfile == "" then
+ report("unable to locate %a",filename)
+ return
+ end
+ --
+ local filename = "mult-def.lua"
+ local deffile = resolvers.findfile(filename) or ""
+ if deffile == "" then
+ report("unable to locate %a",filename)
+ return
+ end
+ local interface = dofile(deffile)
+ if not interface or not next(interface) then
+ report("invalid file %a",filename)
+ return
+ end
+ local variables = interface.variables
+ local constants = interface.constants
+ local commands = interface.commands
+ local elements = interface.elements
+ --
+ local collected = { }
+ --
+ report("loading %a",xmlfile)
+ local xmlroot = xml.load(xmlfile)
+
+ local interfaces = { "en" }
+
+-- <cd:keywords list="yes">
+-- <cd:inherit name="setupalign"/>
+-- </cd:keywords>
+
+ local function arguments(e)
+ local p = { }
+ for e in xml.collected(e,"/cd:arguments/*") do
+ local tg = e.tg
+ if tg == "keywords" then
+ local a = { }
+ for e in xml.collected(e,"/*") do
+ a[#a+1] = {
+ name = e.at.type
+ }
+ end
+ p[#p+1] = {
+ type = tg,
+ attributes = #a > 0 and a or nil,
+ optional = e.at.optional == "yes" or nil
+ }
+ elseif tg == "assignments" then
+ local a = { }
+ for e in xml.collected(e,"/parameter") do
+ local c = { e.at.name, "=" }
+ for e in xml.collected(e,"/constant") do
+ c[#c+1] = e.at.type
+ end
+ if #c > 0 then
+ a[#a+1] = {
+ name = concat(c, " ")
+ }
+ end
+ end
+ p[#p+1] = {
+ type = tg,
+ attributes = #a > 0 and a or nil,
+ optional = e.at.optional == "yes" or nil
+ }
+ else -- e.g. "content"
+ p[#p+1] = {
+ type = tg,
+ optional = e.at.optional == "yes" or nil
+ }
+ end
+ end
+ return p
+ end
+
+ local function details(e, f)
+ local d = { "\\" .. f }
+ local n = 0
+ for e in xml.collected(e,"/cd:arguments/*") do
+ local tg = e.tg
+ if tg == "keywords" then
+ n = n + 1
+ if e.at.optional == "yes" then
+ d[#d+1] = "[optional " .. n .. ":..,..]"
+ else
+ d[#d+1] = "[mandate " .. n .. ":..,..]"
+ end
+ elseif tg == "assignments" then
+ n = n + 1
+ if e.at.optional == "yes" then
+ d[#d+1] = "[optional " .. n .. ":key=val,key=val,..]"
+ else
+ d[#d+1] = "[mandate " .. n .. ":key=val,key=val,..]"
+ end
+ else
+ d[#d+1] = "{ content }"
+ end
+ end
+ return concat(d, " ")
+ end
+
+ -- this one is a bit weird as it could be assembled in the languages server on the fly and
+ -- it bloats the file
+
+ local function documentation(c)
+ local d = { c.detail }
+ local p = c.params
+ if p then
+ local n = 0
+ for i=1,#p do
+ local pi = p[i]
+ local ti = pi.type
+ local ai = pi.attributes
+ if ti == "keywords" then
+ n = n + 1
+ if pi.optional then
+ d[#d+1] = "[optional keywords " .. n .. "]"
+ else
+ d[#d+1] = "[mandate keywords " .. n .. "]"
+ end
+ if ai then
+ local t = { }
+ for j=1,#ai do
+ t[#t+1] = ai[j].name
+ end
+ if #t > 0 then
+ d[#d+1] = concat(t," ")
+ end
+ end
+ elseif ti == "assignments" then
+ n = n + 1
+ if pi.optional then
+ d[#d+1] = "[optional assignments " .. n .. "]"
+ else
+ d[#d+1] = "[mandate assignments " .. n .. "]"
+ end
+ if ai then
+ local t = { }
+ for j=1,#ai do
+ t[#t+1] = ai[j].name
+ end
+ if #t > 0 then
+ d[#d+1] = concat(t,"\n")
+ end
+ end
+ else
+ if pi.optional then
+ d[#d+1] = "{ optional content }"
+ else
+ d[#d+1] = "{ mandate content }"
+ end
+ end
+ end
+ end
+ c.documentation = concat(d,"\n")
+-- inspect(c.documentation)
+ end
+
+ if not xml.expand then
+ -- will be in next version
+ function xml.expand(root,pattern,whatever)
+ local collected = xml.applylpath(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 n = e.ni
+ local t = whatever(e,p)
+ if type(t) == "table" then
+ d[n] = t[1]
+ for i=2,#t do
+ n = n + 1
+ table.insert(d,n,t[i])
+ end
+ elseif t then
+ d[n] = t
+ end
+ end
+ end
+ end
+ end
+ end
+
+ do
+ local c = { }
+ xml.expand(xmlroot,"/cd:interface/cd:interface/cd:command/**/inherit",function(e)
+ local f = c[e.at.name]
+ if not f then
+ f = xml.first(xmlroot,"/cd:interface/cd:interface/cd:command[@name='" .. e.at.name .. "']/cd:arguments")
+ c[e.at.name] = f
+ end
+ return f and f.dt
+ end)
+ end
+
+ for i=1,#interfaces do
+ local interface = interfaces[i]
+ local start = elements.start[interface] or elements.start.en
+ local stop = elements.stop [interface] or elements.stop .en
+ for e in xml.collected(xmlroot,"cd:interface/cd:command") do
+ local at = e.at
+ local name = at["name"] or ""
+ local type = at["type"]
+ if name ~= "" then
+ local c = commands[name]
+ local n = (c and (c[interface] or c.en)) or c or name
+ local sequence = xml.all(e,"/cd:sequence/*")
+ if at.generated == "yes" then
+ -- skip (for now)
+ elseif type ~= "environment" then
+ collected[#collected+1] = {
+ name = n,
+ detail = details(e, n),
+ params = arguments(e), -- why not "parameters"
+ }
+ else
+ local f = start .. n
+ collected[#collected+1] = {
+ name = f,
+ start = f,
+ stop = stop .. n,
+ detail = details(e, f),
+ params = arguments(e), -- why not "parameters"
+ }
+ end
+ end
+ end
+ end
+ for i=1,#collected do
+ documentation(collected[i])
+ end
+ local jsonname = "vscode-context-ls.json"
+ -- local exmlname = "vscode-context-ls.xml"
+ report("")
+ report("vscode ls file saved: %s",jsonname)
+ report("")
+ io.savedata(jsonname,utilities.json.tojson(collected))
+ -- io.savedata(exmlname,tostring(xmlroot))
+end
+
function scripts.vscode.start()
local path = locate()
if path then
@@ -3203,6 +3461,8 @@ end
if environment.arguments.generate then
scripts.vscode.generate()
+elseif environment.vscodels then
+ scripts.vscode.ls()
elseif environment.arguments.start then
scripts.vscode.start()
elseif environment.arguments.exporthelp then
@@ -3211,4 +3471,6 @@ else
application.help()
end
-scripts.vscode.generate([[t:/vscode/data/context/extensions]])
+scripts.vscode.ls()
+
+-- scripts.vscode.generate([[t:/vscode/data/context/extensions]])
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 12104b82c..042ef82c7 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -6433,7 +6433,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-math"] = package.loaded["l-math"] or true
--- original size: 2549, stripped down to: 1825
+-- original size: 2679, stripped down to: 1909
if not modules then modules={} end modules ['l-math']={
version=1.001,
@@ -6446,8 +6446,14 @@ if not math.ceiling then
math.ceiling=math.ceil
end
if not math.round then
- local floor=math.floor
- function math.round(x) return floor(x+0.5) end
+ if xmath then
+ math.round=xmath.round
+ else
+ local floor=math.floor
+ function math.round(x)
+ return x<0 and -floor(-x+0.5) or floor(x+0.5)
+ end
+ end
end
if not math.div then
local floor=math.floor
@@ -14220,7 +14226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-deb"] = package.loaded["util-deb"] or true
--- original size: 10136, stripped down to: 6832
+-- original size: 10593, stripped down to: 7102
if not modules then modules={} end modules ['util-deb']={
version=1.001,
@@ -14514,6 +14520,22 @@ local function showtraceback(rep)
end
end
debugger.showtraceback=showtraceback
+if luac then
+ local show,dump=luac.print,string.dump
+ function luac.inspect(v)
+ if type(v)=="function" then
+ local ok,str=xpcall(dump,function() end,v)
+ if ok then
+ v=str
+ end
+ end
+ if type(v)=="string" then
+ show(v,true)
+ else
+ print(v)
+ end
+ end
+end
end -- of closure
@@ -16310,7 +16332,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62809, stripped down to: 36225
+-- original size: 62810, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -19111,7 +19133,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 33708, stripped down to: 20953
+-- original size: 34661, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19377,6 +19399,36 @@ function xml.replace(root,pattern,whatever)
end
end
end
+function xml.expand(root,pattern,whatever)
+ local collected=root and xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ if trace_manipulations then
+ report('expanding',pattern,c,e)
+ end
+ local d=p.dt
+ local n=e.ni
+ local t=whatever(e,p)
+ if t then
+ if type(t)=="table" then
+ t=xmlcopy(t)
+ d[n]=t[1]
+ for i=2,#t do
+ n=n+1
+ insert(d,n,t[i])
+ end
+ else
+ d[n]=t
+ end
+ redo_ni(d)
+ end
+ end
+ end
+ end
+end
local function wrap(e,wrapper)
local t={
rn=e.rn,
@@ -21311,7 +21363,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9501, stripped down to: 6411
+-- original size: 9501, stripped down to: 6413
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21403,8 +21455,8 @@ local relations=allocate {
names={ "mp" },
variable='MPINPUTS',
suffixes=CONTEXTLMTXMODE>0
- and { 'mp','mpxl','mpvi','mpiv','mpii' }
- or { 'mp','mpvi','mpiv','mpii' },
+ and { 'mpxl','mpvi','mpiv','mpii','mp' }
+ or { 'mpvi','mpiv','mpii','mp' },
usertype=true,
},
tex={
@@ -25986,8 +26038,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 : 1031629
--- stripped bytes : 406052
+-- original bytes : 1033170
+-- stripped bytes : 406679
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 12104b82c..042ef82c7 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -6433,7 +6433,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-math"] = package.loaded["l-math"] or true
--- original size: 2549, stripped down to: 1825
+-- original size: 2679, stripped down to: 1909
if not modules then modules={} end modules ['l-math']={
version=1.001,
@@ -6446,8 +6446,14 @@ if not math.ceiling then
math.ceiling=math.ceil
end
if not math.round then
- local floor=math.floor
- function math.round(x) return floor(x+0.5) end
+ if xmath then
+ math.round=xmath.round
+ else
+ local floor=math.floor
+ function math.round(x)
+ return x<0 and -floor(-x+0.5) or floor(x+0.5)
+ end
+ end
end
if not math.div then
local floor=math.floor
@@ -14220,7 +14226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-deb"] = package.loaded["util-deb"] or true
--- original size: 10136, stripped down to: 6832
+-- original size: 10593, stripped down to: 7102
if not modules then modules={} end modules ['util-deb']={
version=1.001,
@@ -14514,6 +14520,22 @@ local function showtraceback(rep)
end
end
debugger.showtraceback=showtraceback
+if luac then
+ local show,dump=luac.print,string.dump
+ function luac.inspect(v)
+ if type(v)=="function" then
+ local ok,str=xpcall(dump,function() end,v)
+ if ok then
+ v=str
+ end
+ end
+ if type(v)=="string" then
+ show(v,true)
+ else
+ print(v)
+ end
+ end
+end
end -- of closure
@@ -16310,7 +16332,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62809, stripped down to: 36225
+-- original size: 62810, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -19111,7 +19133,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 33708, stripped down to: 20953
+-- original size: 34661, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19377,6 +19399,36 @@ function xml.replace(root,pattern,whatever)
end
end
end
+function xml.expand(root,pattern,whatever)
+ local collected=root and xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ if trace_manipulations then
+ report('expanding',pattern,c,e)
+ end
+ local d=p.dt
+ local n=e.ni
+ local t=whatever(e,p)
+ if t then
+ if type(t)=="table" then
+ t=xmlcopy(t)
+ d[n]=t[1]
+ for i=2,#t do
+ n=n+1
+ insert(d,n,t[i])
+ end
+ else
+ d[n]=t
+ end
+ redo_ni(d)
+ end
+ end
+ end
+ end
+end
local function wrap(e,wrapper)
local t={
rn=e.rn,
@@ -21311,7 +21363,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9501, stripped down to: 6411
+-- original size: 9501, stripped down to: 6413
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21403,8 +21455,8 @@ local relations=allocate {
names={ "mp" },
variable='MPINPUTS',
suffixes=CONTEXTLMTXMODE>0
- and { 'mp','mpxl','mpvi','mpiv','mpii' }
- or { 'mp','mpvi','mpiv','mpii' },
+ and { 'mpxl','mpvi','mpiv','mpii','mp' }
+ or { 'mpvi','mpiv','mpii','mp' },
usertype=true,
},
tex={
@@ -25986,8 +26038,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 : 1031629
--- stripped bytes : 406052
+-- original bytes : 1033170
+-- stripped bytes : 406679
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 12104b82c..042ef82c7 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -6433,7 +6433,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-math"] = package.loaded["l-math"] or true
--- original size: 2549, stripped down to: 1825
+-- original size: 2679, stripped down to: 1909
if not modules then modules={} end modules ['l-math']={
version=1.001,
@@ -6446,8 +6446,14 @@ if not math.ceiling then
math.ceiling=math.ceil
end
if not math.round then
- local floor=math.floor
- function math.round(x) return floor(x+0.5) end
+ if xmath then
+ math.round=xmath.round
+ else
+ local floor=math.floor
+ function math.round(x)
+ return x<0 and -floor(-x+0.5) or floor(x+0.5)
+ end
+ end
end
if not math.div then
local floor=math.floor
@@ -14220,7 +14226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-deb"] = package.loaded["util-deb"] or true
--- original size: 10136, stripped down to: 6832
+-- original size: 10593, stripped down to: 7102
if not modules then modules={} end modules ['util-deb']={
version=1.001,
@@ -14514,6 +14520,22 @@ local function showtraceback(rep)
end
end
debugger.showtraceback=showtraceback
+if luac then
+ local show,dump=luac.print,string.dump
+ function luac.inspect(v)
+ if type(v)=="function" then
+ local ok,str=xpcall(dump,function() end,v)
+ if ok then
+ v=str
+ end
+ end
+ if type(v)=="string" then
+ show(v,true)
+ else
+ print(v)
+ end
+ end
+end
end -- of closure
@@ -16310,7 +16332,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62809, stripped down to: 36225
+-- original size: 62810, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -19111,7 +19133,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 33708, stripped down to: 20953
+-- original size: 34661, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19377,6 +19399,36 @@ function xml.replace(root,pattern,whatever)
end
end
end
+function xml.expand(root,pattern,whatever)
+ local collected=root and xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ if trace_manipulations then
+ report('expanding',pattern,c,e)
+ end
+ local d=p.dt
+ local n=e.ni
+ local t=whatever(e,p)
+ if t then
+ if type(t)=="table" then
+ t=xmlcopy(t)
+ d[n]=t[1]
+ for i=2,#t do
+ n=n+1
+ insert(d,n,t[i])
+ end
+ else
+ d[n]=t
+ end
+ redo_ni(d)
+ end
+ end
+ end
+ end
+end
local function wrap(e,wrapper)
local t={
rn=e.rn,
@@ -21311,7 +21363,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9501, stripped down to: 6411
+-- original size: 9501, stripped down to: 6413
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21403,8 +21455,8 @@ local relations=allocate {
names={ "mp" },
variable='MPINPUTS',
suffixes=CONTEXTLMTXMODE>0
- and { 'mp','mpxl','mpvi','mpiv','mpii' }
- or { 'mp','mpvi','mpiv','mpii' },
+ and { 'mpxl','mpvi','mpiv','mpii','mp' }
+ or { 'mpvi','mpiv','mpii','mp' },
usertype=true,
},
tex={
@@ -25986,8 +26038,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 : 1031629
--- stripped bytes : 406052
+-- original bytes : 1033170
+-- stripped bytes : 406679
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 12104b82c..042ef82c7 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -6433,7 +6433,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-math"] = package.loaded["l-math"] or true
--- original size: 2549, stripped down to: 1825
+-- original size: 2679, stripped down to: 1909
if not modules then modules={} end modules ['l-math']={
version=1.001,
@@ -6446,8 +6446,14 @@ if not math.ceiling then
math.ceiling=math.ceil
end
if not math.round then
- local floor=math.floor
- function math.round(x) return floor(x+0.5) end
+ if xmath then
+ math.round=xmath.round
+ else
+ local floor=math.floor
+ function math.round(x)
+ return x<0 and -floor(-x+0.5) or floor(x+0.5)
+ end
+ end
end
if not math.div then
local floor=math.floor
@@ -14220,7 +14226,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-deb"] = package.loaded["util-deb"] or true
--- original size: 10136, stripped down to: 6832
+-- original size: 10593, stripped down to: 7102
if not modules then modules={} end modules ['util-deb']={
version=1.001,
@@ -14514,6 +14520,22 @@ local function showtraceback(rep)
end
end
debugger.showtraceback=showtraceback
+if luac then
+ local show,dump=luac.print,string.dump
+ function luac.inspect(v)
+ if type(v)=="function" then
+ local ok,str=xpcall(dump,function() end,v)
+ if ok then
+ v=str
+ end
+ end
+ if type(v)=="string" then
+ show(v,true)
+ else
+ print(v)
+ end
+ end
+end
end -- of closure
@@ -16310,7 +16332,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true
--- original size: 62809, stripped down to: 36225
+-- original size: 62810, stripped down to: 36225
if not modules then modules={} end modules ['lxml-tab']={
version=1.001,
@@ -19111,7 +19133,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true
--- original size: 33708, stripped down to: 20953
+-- original size: 34661, stripped down to: 21511
if not modules then modules={} end modules ['lxml-aux']={
version=1.001,
@@ -19377,6 +19399,36 @@ function xml.replace(root,pattern,whatever)
end
end
end
+function xml.expand(root,pattern,whatever)
+ local collected=root and xmlapplylpath(root,pattern)
+ if collected then
+ for c=1,#collected do
+ local e=collected[c]
+ local p=e.__p__
+ if p then
+ if trace_manipulations then
+ report('expanding',pattern,c,e)
+ end
+ local d=p.dt
+ local n=e.ni
+ local t=whatever(e,p)
+ if t then
+ if type(t)=="table" then
+ t=xmlcopy(t)
+ d[n]=t[1]
+ for i=2,#t do
+ n=n+1
+ insert(d,n,t[i])
+ end
+ else
+ d[n]=t
+ end
+ redo_ni(d)
+ end
+ end
+ end
+ end
+end
local function wrap(e,wrapper)
local t={
rn=e.rn,
@@ -21311,7 +21363,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-env"] = package.loaded["data-env"] or true
--- original size: 9501, stripped down to: 6411
+-- original size: 9501, stripped down to: 6413
if not modules then modules={} end modules ['data-env']={
version=1.001,
@@ -21403,8 +21455,8 @@ local relations=allocate {
names={ "mp" },
variable='MPINPUTS',
suffixes=CONTEXTLMTXMODE>0
- and { 'mp','mpxl','mpvi','mpiv','mpii' }
- or { 'mp','mpvi','mpiv','mpii' },
+ and { 'mpxl','mpvi','mpiv','mpii','mp' }
+ or { 'mpvi','mpiv','mpii','mp' },
usertype=true,
},
tex={
@@ -25986,8 +26038,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 : 1031629
--- stripped bytes : 406052
+-- original bytes : 1033170
+-- stripped bytes : 406679
-- end library merge