diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-pdf.lua | 183 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 25 | ||||
-rw-r--r-- | scripts/context/stubs/install/first-setup.sh | 22 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 25 | ||||
-rw-r--r-- | scripts/context/stubs/setup/setuptex | 18 | ||||
-rw-r--r-- | scripts/context/stubs/setup/setuptex.csh | 13 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 25 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 25 |
8 files changed, 234 insertions, 102 deletions
diff --git a/scripts/context/lua/mtx-pdf.lua b/scripts/context/lua/mtx-pdf.lua index 7e05a9f74..ca0d2ea6b 100644 --- a/scripts/context/lua/mtx-pdf.lua +++ b/scripts/context/lua/mtx-pdf.lua @@ -75,28 +75,30 @@ function scripts.pdf.info(filename) local pages = pdffile.pages local nofpages = pages.n -- no # yet. will be in 5.2 - report("filename > %s",filename) - report("pdf version > %s",catalog.Version) - report("number of pages > %s",nofpages) - report("title > %s",info.Title) - report("creator > %s",info.Creator) - report("producer > %s",info.Producer) - report("creation date > %s",info.CreationDate) + report("filename > %s",filename) + report("pdf version > %s",catalog.Version) + report("major version > %s",pdffile.majorversion or "?") + report("minor version > %s",pdffile.minorversion or "?") + report("number of pages > %s",nofpages) + report("title > %s",info.Title) + report("creator > %s",info.Creator) + report("producer > %s",info.Producer) + report("creation date > %s",info.CreationDate) report("modification date > %s",info.ModDate) local width, height, start for i=1, nofpages do local page = pages[i] - local bbox = page.CropBox or page.MediaBox + local bbox = page.CropBox or page.MediaBox or { 0, 0, 0, 0 } local w, h = bbox[4]-bbox[2],bbox[3]-bbox[1] if w ~= width or h ~= height then if start then - report("cropbox > pages: %s-%s, width: %s, height: %s",start,i-1,width,height) + report("cropbox > pages: %s-%s, width: %s, height: %s",start,i-1,width,height) end width, height, start = w, h, i end end - report("cropbox > pages: %s-%s, width: %s, height: %s",start,nofpages,width,height) + report("cropbox > pages: %s-%s, width: %s, height: %s",start,nofpages,width,height) end end @@ -117,17 +119,33 @@ function scripts.pdf.metadata(filename,pretty) end end +local expand = lpdf.epdf.expand + local function getfonts(pdffile) local usedfonts = { } - for i=1,pdffile.pages.n do - local page = pdffile.pages[i] - local fontlist = page.Resources.Font - if fontlist then - for k, v in next, lpdf.epdf.expand(fontlist) do - usedfonts[k] = lpdf.epdf.expand(v) + + local function collect(where,tag) + local resources = where.Resources + if resources then + local fontlist = resources.Font + if fontlist then + for k, v in next, expand(fontlist) do + usedfonts[tag and (tag .. "." .. k) or k] = expand(v,k) + end + end + local objects = resources.XObject + if objects then + for k, v in next, expand(objects) do + collect(v,tag and (tag .. "." .. k) or k) + end end end end + + for i=1,pdffile.pages.n do + collect(pdffile.pages[i]) + end + return usedfonts end @@ -135,7 +153,8 @@ local function getunicodes(font) local cid = font.ToUnicode if cid then cid = cid() - local counts = { } + local counts = { } + local indices = { } -- for s in gmatch(cid,"begincodespacerange%s*(.-)%s*endcodespacerange") do -- for a, b in gmatch(s,"<([^>]+)>%s+<([^>]+)>") do -- print(a,b) @@ -151,18 +170,20 @@ local function getunicodes(font) for i=first,last do local c = i + offset counts[c] = counts[c] + 1 + indices[i] = true end end end for s in gmatch(cid,"beginbfchar%s*(.-)%s*endbfchar") do for old, new in gmatch(s,"<([^>]+)>%s+<([^>]+)>") do + indices[old] = true for n in gmatch(new,"....") do local c = tonumber(n,16) counts[c] = counts[c] + 1 end end end - return counts + return counts, indices end end @@ -171,11 +192,17 @@ function scripts.pdf.fonts(filename) if pdffile then local usedfonts = getfonts(pdffile) local found = { } + local common = table.setmetatableindex("table") for k, v in table.sortedhash(usedfonts) do - local counts = getunicodes(v) - local codes = { } - local chars = { } - local freqs = { } + local basefont = v.BaseFont + local encoding = v.Encoding + local subtype = v.Subtype + local unicode = v.ToUnicode + local counts, + indices = getunicodes(v) + local codes = { } + local chars = { } + local freqs = { } if counts then codes = sortedkeys(counts) for i=1,#codes do @@ -184,30 +211,42 @@ function scripts.pdf.fonts(filename) chars[i] = c freqs[i] = format("U+%05X %s %s",k,counts[k] > 1 and "+" or " ", c) end + if basefont and unicode then + local b = gsub(basefont,"^.*%+","") + local c = common[b] + for k in next, indices do + c[k] = true + end + end for i=1,#codes do codes[i] = format("U+%05X",codes[i]) end end found[k] = { - basefont = v.BaseFont or "no basefont", - encoding = v.Encoding or "no encoding", - subtype = v.Subtype or "no subtype", - unicode = v.ToUnicode and "unicode" or "no unicode", + basefont = basefont or "no basefont", + encoding = encoding or "no encoding", + subtype = subtype or "no subtype", + unicode = tounicode and "unicode" or "no unicode", chars = chars, codes = codes, freqs = freqs, } end - if environment.argument("detail") then + if environment.argument("detail") or environment.argument("details") then for k, v in sortedhash(found) do - report("id : %s",k) - report("basefont : %s",v.basefont) - report("encoding : %s",v.encoding) - report("subtype : %s",v.subtype) - report("unicode : %s",v.unicode) - report("characters : %s", concat(v.chars," ")) - report("codepoints : %s", concat(v.codes," ")) + report("id : %s", k) + report("basefont : %s", v.basefont) + report("encoding : %s", v.encoding) + report("subtype : %s", v.subtype) + report("unicode : %s", v.unicode) + report("characters : % t", v.chars) + report("codepoints : % t", v.codes) + report("") + end + for k, v in sortedhash(common) do + report("basefont : %s",k) + report("indices : % t", sortedkeys(v)) report("") end else @@ -229,42 +268,42 @@ end -- this is a quick hack ... proof of concept .. will change (derived from luigi's example) ... -- i will make a ctx wrapper -local qpdf -- just call qpdf, no need for a lib here - -function scripts.pdf.linearize(filename) - qpdf = qpdf or swiglib("qpdf.core") - local oldfile = filename or environment.files[1] - if not oldfile then - return - end - file.addsuffix(oldfile,"pdf") - if not lfs.isfile(oldfile) then - return - end - local newfile = environment.files[2] - if not newfile or file.removesuffix(oldfile) == file.removesuffix(newfile)then - newfile = file.addsuffix(file.removesuffix(oldfile) .. "-linearized","pdf") - end - local password = environment.arguments.password - local instance = qpdf.qpdf_init() - if bit32.band(qpdf.qpdf_read(instance,oldfile,password),qpdf.QPDF_ERRORS) ~= 0 then - report("unable to open input file") - elseif bit32.band(qpdf.qpdf_init_write(instance,newfile),qpdf.QPDF_ERRORS) ~= 0 then - report("unable to open output file") - else - report("linearizing %a into %a",oldfile,newfile) - qpdf.qpdf_set_static_ID(instance,qpdf.QPDF_TRUE) - qpdf.qpdf_set_linearization(instance,qpdf.QPDF_TRUE) - qpdf.qpdf_write(instance) - end - while qpdf.qpdf_more_warnings(instance) ~= 0 do - report("warning: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_next_warning(qpdf))) - end - if qpdf.qpdf_has_error(instance) ~= 0 then - report("error: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_get_error(qpdf))) - end - qpdf.qpdf_cleanup_p(instance) -end +-- local qpdf -- just call qpdf, no need for a lib here +-- +-- function scripts.pdf.linearize(filename) +-- qpdf = qpdf or swiglib("qpdf.core") +-- local oldfile = filename or environment.files[1] +-- if not oldfile then +-- return +-- end +-- file.addsuffix(oldfile,"pdf") +-- if not lfs.isfile(oldfile) then +-- return +-- end +-- local newfile = environment.files[2] +-- if not newfile or file.removesuffix(oldfile) == file.removesuffix(newfile)then +-- newfile = file.addsuffix(file.removesuffix(oldfile) .. "-linearized","pdf") +-- end +-- local password = environment.arguments.password +-- local instance = qpdf.qpdf_init() +-- if bit32.band(qpdf.qpdf_read(instance,oldfile,password),qpdf.QPDF_ERRORS) ~= 0 then +-- report("unable to open input file") +-- elseif bit32.band(qpdf.qpdf_init_write(instance,newfile),qpdf.QPDF_ERRORS) ~= 0 then +-- report("unable to open output file") +-- else +-- report("linearizing %a into %a",oldfile,newfile) +-- qpdf.qpdf_set_static_ID(instance,qpdf.QPDF_TRUE) +-- qpdf.qpdf_set_linearization(instance,qpdf.QPDF_TRUE) +-- qpdf.qpdf_write(instance) +-- end +-- while qpdf.qpdf_more_warnings(instance) ~= 0 do +-- report("warning: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_next_warning(qpdf))) +-- end +-- if qpdf.qpdf_has_error(instance) ~= 0 then +-- report("error: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_get_error(qpdf))) +-- end +-- qpdf.qpdf_cleanup_p(instance) +-- end -- scripts.pdf.info("e:/tmp/oeps.pdf") -- scripts.pdf.metadata("e:/tmp/oeps.pdf") @@ -281,8 +320,8 @@ elseif environment.argument("metadata") then scripts.pdf.metadata(filename) elseif environment.argument("fonts") then scripts.pdf.fonts(filename) -elseif environment.argument("linearize") then - scripts.pdf.linearize(filename) +-- elseif environment.argument("linearize") then +-- scripts.pdf.linearize(filename) elseif environment.argument("exporthelp") then application.export(environment.argument("exporthelp"),filename) else diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 58a6175f5..927d3de0e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1946,7 +1946,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 40547, stripped down to: 23820 +-- original size: 40782, stripped down to: 23986 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2871,12 +2871,19 @@ end local function sequenced(t,sep,simple) if not t then return "" + elseif type(t)=="string" then + return t end local n=#t local s={} if n>0 then for i=1,n do - s[i]=tostring(t[i]) + local v=t[i] + if type(v)=="table" then + s[i]="{"..sequenced(v,sep,simple).."}" + else + s[i]=tostring(t[i]) + end end else n=0 @@ -6131,7 +6138,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 39663, stripped down to: 22608 +-- original size: 40074, stripped down to: 22776 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6691,6 +6698,10 @@ local format_L=function() n=n+1 return format("(a%s and 'TRUE' or 'FALSE')",n) end +local format_n=function() + n=n+1 + return format("((a%s %% 1 == 0) and format('%%i',a%s) or tostring(a%s))",n,n,n) +end local format_N=function() n=n+1 return format("tostring(tonumber(a%s) or a%s)",n,n) @@ -6791,6 +6802,7 @@ local builder=Cs { "start", +V("s")+V("q")+V("i")+V("d")+V("f")+V("F")+V("g")+V("G")+V("e")+V("E")+V("x")+V("X")+V("o") +V("c")+V("C")+V("S") +V("Q") ++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") @@ -6820,6 +6832,7 @@ local builder=Cs { "start", ["o"]=(prefix_any*P("o"))/format_o, ["S"]=(prefix_any*P("S"))/format_S, ["Q"]=(prefix_any*P("Q"))/format_Q, + ["n"]=(prefix_any*P("n"))/format_n, ["N"]=(prefix_any*P("N"))/format_N, ["k"]=(prefix_sub*P("k"))/format_k, ["c"]=(prefix_any*P("c"))/format_c, @@ -17779,7 +17792,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 68263, stripped down to: 47789 +-- original size: 68261, stripped down to: 47789 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -21430,8 +21443,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 881109 --- stripped bytes : 318732 +-- original bytes : 881753 +-- stripped bytes : 319042 -- end library merge diff --git a/scripts/context/stubs/install/first-setup.sh b/scripts/context/stubs/install/first-setup.sh index 11af49233..71fe32c16 100644 --- a/scripts/context/stubs/install/first-setup.sh +++ b/scripts/context/stubs/install/first-setup.sh @@ -17,9 +17,23 @@ cpu=`uname -m` case "$system" in # linux Linux) + if command -v ldd >/dev/null && ldd --version 2>&1 | grep -E '^musl' >/dev/null + then + libc=musl + else + libc=glibc + fi case "$cpu" in - i*86) platform="linux" ;; - x86_64|ia64) platform="linux-64" ;; + i*86) + case "$libc" in + glibc) platform="linux" ;; + musl) platform="linuxmusl" ;; + esac ;; + x86_64|ia64) + case "$libc" in + glibc) platform="linux-64" ;; + musl) platform="linuxmusl-64" ;; + esac ;; # a little bit of cheating with ppc64 (won't work on Gentoo) ppc|ppc64) platform="linux-ppc" ;; @@ -138,8 +152,8 @@ fi # download or update the distribution # you may remove the --context=beta switch if you want to use "current" # you can use --engine=luatex if you want just mkiv -env PATH="$PWD/bin:$CONTEXTROOT/texmf-$platform/bin:$PATH" \ -./bin/mtxrun --script ./bin/mtx-update.lua --force --update --make --context=beta --platform=$platform --texroot="$CONTEXTROOT" $@ +env PATH="$PWD/bin:$CONTEXTROOT/texmf-$platform/bin:$PATH" MTX_PLATFORM="$platform" \ +./bin/mtxrun --script ./bin/mtx-update.lua --force --update --make --context=beta --platform="$platform" --texroot="$CONTEXTROOT" $@ echo echo "When you want to use context, you need to initialize the tree by typing:" diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 58a6175f5..927d3de0e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1946,7 +1946,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 40547, stripped down to: 23820 +-- original size: 40782, stripped down to: 23986 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2871,12 +2871,19 @@ end local function sequenced(t,sep,simple) if not t then return "" + elseif type(t)=="string" then + return t end local n=#t local s={} if n>0 then for i=1,n do - s[i]=tostring(t[i]) + local v=t[i] + if type(v)=="table" then + s[i]="{"..sequenced(v,sep,simple).."}" + else + s[i]=tostring(t[i]) + end end else n=0 @@ -6131,7 +6138,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 39663, stripped down to: 22608 +-- original size: 40074, stripped down to: 22776 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6691,6 +6698,10 @@ local format_L=function() n=n+1 return format("(a%s and 'TRUE' or 'FALSE')",n) end +local format_n=function() + n=n+1 + return format("((a%s %% 1 == 0) and format('%%i',a%s) or tostring(a%s))",n,n,n) +end local format_N=function() n=n+1 return format("tostring(tonumber(a%s) or a%s)",n,n) @@ -6791,6 +6802,7 @@ local builder=Cs { "start", +V("s")+V("q")+V("i")+V("d")+V("f")+V("F")+V("g")+V("G")+V("e")+V("E")+V("x")+V("X")+V("o") +V("c")+V("C")+V("S") +V("Q") ++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") @@ -6820,6 +6832,7 @@ local builder=Cs { "start", ["o"]=(prefix_any*P("o"))/format_o, ["S"]=(prefix_any*P("S"))/format_S, ["Q"]=(prefix_any*P("Q"))/format_Q, + ["n"]=(prefix_any*P("n"))/format_n, ["N"]=(prefix_any*P("N"))/format_N, ["k"]=(prefix_sub*P("k"))/format_k, ["c"]=(prefix_any*P("c"))/format_c, @@ -17779,7 +17792,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 68263, stripped down to: 47789 +-- original size: 68261, stripped down to: 47789 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -21430,8 +21443,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 881109 --- stripped bytes : 318732 +-- original bytes : 881753 +-- stripped bytes : 319042 -- end library merge diff --git a/scripts/context/stubs/setup/setuptex b/scripts/context/stubs/setup/setuptex index 9808140e4..fb65788b6 100644 --- a/scripts/context/stubs/setup/setuptex +++ b/scripts/context/stubs/setup/setuptex @@ -24,9 +24,23 @@ cpu=`uname -m` case "$system" in # linux Linux) + if command -v ldd >/dev/null && ldd --version 2>&1 | grep -E '^musl' >/dev/null + then + libc=musl + else + libc=glibc + fi case "$cpu" in - i*86) platform="linux" ;; - x86_64|ia64) platform="linux-64" ;; + i*86) + case "$libc" in + glibc) platform="linux" ;; + musl) platform="linuxmusl" ;; + esac ;; + x86_64|ia64) + case "$libc" in + glibc) platform="linux-64" ;; + musl) platform="linuxmusl-64" ;; + esac ;; # a little bit of cheating with ppc64 (won't work on Gentoo) ppc|ppc64) platform="linux-ppc" ;; diff --git a/scripts/context/stubs/setup/setuptex.csh b/scripts/context/stubs/setup/setuptex.csh index c1160675f..62ca03569 100644 --- a/scripts/context/stubs/setup/setuptex.csh +++ b/scripts/context/stubs/setup/setuptex.csh @@ -82,6 +82,19 @@ switch ( $system ) set platform="unknown" endsw breaksw + # OpenBSD + case OpenBSD: + switch ( $cpu ) + case i*86: + set platform="openbsd" + breaksw + case amd64: + set platform="openbsd-amd64" + breaksw + default: + set platform="unknown" + endsw + breaksw # cygwin case CYGWIN: switch ( $cpu ) diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 58a6175f5..927d3de0e 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1946,7 +1946,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 40547, stripped down to: 23820 +-- original size: 40782, stripped down to: 23986 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2871,12 +2871,19 @@ end local function sequenced(t,sep,simple) if not t then return "" + elseif type(t)=="string" then + return t end local n=#t local s={} if n>0 then for i=1,n do - s[i]=tostring(t[i]) + local v=t[i] + if type(v)=="table" then + s[i]="{"..sequenced(v,sep,simple).."}" + else + s[i]=tostring(t[i]) + end end else n=0 @@ -6131,7 +6138,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 39663, stripped down to: 22608 +-- original size: 40074, stripped down to: 22776 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6691,6 +6698,10 @@ local format_L=function() n=n+1 return format("(a%s and 'TRUE' or 'FALSE')",n) end +local format_n=function() + n=n+1 + return format("((a%s %% 1 == 0) and format('%%i',a%s) or tostring(a%s))",n,n,n) +end local format_N=function() n=n+1 return format("tostring(tonumber(a%s) or a%s)",n,n) @@ -6791,6 +6802,7 @@ local builder=Cs { "start", +V("s")+V("q")+V("i")+V("d")+V("f")+V("F")+V("g")+V("G")+V("e")+V("E")+V("x")+V("X")+V("o") +V("c")+V("C")+V("S") +V("Q") ++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") @@ -6820,6 +6832,7 @@ local builder=Cs { "start", ["o"]=(prefix_any*P("o"))/format_o, ["S"]=(prefix_any*P("S"))/format_S, ["Q"]=(prefix_any*P("Q"))/format_Q, + ["n"]=(prefix_any*P("n"))/format_n, ["N"]=(prefix_any*P("N"))/format_N, ["k"]=(prefix_sub*P("k"))/format_k, ["c"]=(prefix_any*P("c"))/format_c, @@ -17779,7 +17792,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 68263, stripped down to: 47789 +-- original size: 68261, stripped down to: 47789 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -21430,8 +21443,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 881109 --- stripped bytes : 318732 +-- original bytes : 881753 +-- stripped bytes : 319042 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 58a6175f5..927d3de0e 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -1946,7 +1946,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 40547, stripped down to: 23820 +-- original size: 40782, stripped down to: 23986 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -2871,12 +2871,19 @@ end local function sequenced(t,sep,simple) if not t then return "" + elseif type(t)=="string" then + return t end local n=#t local s={} if n>0 then for i=1,n do - s[i]=tostring(t[i]) + local v=t[i] + if type(v)=="table" then + s[i]="{"..sequenced(v,sep,simple).."}" + else + s[i]=tostring(t[i]) + end end else n=0 @@ -6131,7 +6138,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 39663, stripped down to: 22608 +-- original size: 40074, stripped down to: 22776 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6691,6 +6698,10 @@ local format_L=function() n=n+1 return format("(a%s and 'TRUE' or 'FALSE')",n) end +local format_n=function() + n=n+1 + return format("((a%s %% 1 == 0) and format('%%i',a%s) or tostring(a%s))",n,n,n) +end local format_N=function() n=n+1 return format("tostring(tonumber(a%s) or a%s)",n,n) @@ -6791,6 +6802,7 @@ local builder=Cs { "start", +V("s")+V("q")+V("i")+V("d")+V("f")+V("F")+V("g")+V("G")+V("e")+V("E")+V("x")+V("X")+V("o") +V("c")+V("C")+V("S") +V("Q") ++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") @@ -6820,6 +6832,7 @@ local builder=Cs { "start", ["o"]=(prefix_any*P("o"))/format_o, ["S"]=(prefix_any*P("S"))/format_S, ["Q"]=(prefix_any*P("Q"))/format_Q, + ["n"]=(prefix_any*P("n"))/format_n, ["N"]=(prefix_any*P("N"))/format_N, ["k"]=(prefix_sub*P("k"))/format_k, ["c"]=(prefix_any*P("c"))/format_c, @@ -17779,7 +17792,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 68263, stripped down to: 47789 +-- original size: 68261, stripped down to: 47789 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -21430,8 +21443,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 881109 --- stripped bytes : 318732 +-- original bytes : 881753 +-- stripped bytes : 319042 -- end library merge |