diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-06-24 21:49:41 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-06-24 21:49:41 +0200 |
commit | 00e28123f9c3e7393ea0a49052bc0a3b91a0db4f (patch) | |
tree | 7fecbc23e4f5a783d6d26d58edaf0481d4a17feb | |
parent | a80891cbf45f9705865ea2774b4e1abdcd36dbf9 (diff) | |
download | context-00e28123f9c3e7393ea0a49052bc0a3b91a0db4f.tar.gz |
2018-06-24 18:36:00
35 files changed, 372 insertions, 209 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex fb1002ab0..4fc459e67 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 6f6e22c9b..cea9c9a2f 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 69bc9732b..dcf89c5c7 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex d4cf15d98..bff209d0b 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 11a3f9d1e..55c8e4d54 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex b08d610ee..665b03df9 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex 087f93955..dd377b217 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex dc850aa90..18aeab939 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 3d21a9dcd..fecd3c806 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex ad74b2856..e7b774bc7 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex cdd600c13..cc5a8ba81 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex a74c753c2..eb6f8ab90 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex ad5f6728a..ac5244b94 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 54dadbd89..1fdfb1f1c 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/metapost/context/base/mpiv/mp-blob.mpiv b/metapost/context/base/mpiv/mp-blob.mpiv index 1d8a205f1..d6773db21 100644 --- a/metapost/context/base/mpiv/mp-blob.mpiv +++ b/metapost/context/base/mpiv/mp-blob.mpiv @@ -128,7 +128,6 @@ if mfun_use_one_pass : fi ; draw fullcircle scaled 100bp withprescript "mf_object=followtext" - withprescript "ft_stage=final" withprescript "ft_category=" & decimal mfun_blob_n ; ) enddef ; diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index b0dfffe42..16ae091e4 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1005,7 +1005,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 39415, stripped down to: 21143 +-- original size: 39717, stripped down to: 21361 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -1103,10 +1103,10 @@ 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*P(-1)/""+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 b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) -local e_stripper=Cs((spacer^1*P(-1)/""+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) patterns.stripper=stripper patterns.fullstripper=fullstripper @@ -1173,7 +1173,7 @@ patterns.decafloat=sign^-1*(digit^0*period*digits+digits*period*digit^0+digits)* patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) -patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(P(-1)+Cc(" ")))^0)) +patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(endofstring+Cc(" ")))^0)) function anywhere(pattern) return (1-P(pattern))^0*P(pattern) end @@ -1738,12 +1738,21 @@ end function lpeg.times(pattern,n) return P(nextstep(n,2^16,{ "start",["1"]=pattern })) end -local trailingzeros=zero^0*-digit -local case_1=period*trailingzeros/"" -local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") -local number=digits*(case_1+case_2) -local stripper=Cs((number+1)^0) -lpeg.patterns.stripzeros=stripper +do + local trailingzeros=zero^0*-digit + local stripper=Cs(( + digits*( + period*trailingzeros/""+period*(digit-trailingzeros)^1*(trailingzeros/"") + )+1 + )^0) + lpeg.patterns.stripzeros=stripper + local nonzero=digit-zero + local trailingzeros=zero^1*endofstring + local stripper=Cs((1-period)^0*( + (period*trailingzeros/"")+period*(nonzero^1+(trailingzeros/"")+zero^1)^0 + )) + lpeg.patterns.stripzero=stripper +end local byte_to_HEX={} local byte_to_hex={} local byte_to_dec={} @@ -1807,7 +1816,7 @@ local patterns={} local function containsws(what) local p=patterns[what] if not p then - local p1=P(what)*(whitespace+P(-1))*Cc(true) + local p1=P(what)*(whitespace+endofstring)*Cc(true) local p2=whitespace*P(p1) p=P(p1)+P(1-p2)^0*p2+Cc(false) patterns[what]=p @@ -6171,7 +6180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 41277, stripped down to: 23383 +-- original size: 41303, stripped down to: 23381 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6207,7 +6216,7 @@ else end end if not number then number={} end -local stripper=patterns.stripzeros +local stripper=patterns.stripzero local newline=patterns.newline local endofstring=patterns.endofstring local whitespace=patterns.whitespace @@ -6524,7 +6533,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else environment={ @@ -6550,7 +6559,7 @@ else formattednumber=number.formatted, sparseexponent=number.sparseexponent, formattedfloat=number.formattedfloat, - stripper=lpeg.patterns.stripzeros, + stripper=lpeg.patterns.stripzero, } end local arguments={ "a1" } @@ -6759,7 +6768,7 @@ 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() +local format_N=function(f) n=n+1 if not f or f=="" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) @@ -21646,8 +21655,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 : 889689 --- stripped bytes : 321468 +-- original bytes : 890017 +-- stripped bytes : 321580 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index b0dfffe42..16ae091e4 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1005,7 +1005,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 39415, stripped down to: 21143 +-- original size: 39717, stripped down to: 21361 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -1103,10 +1103,10 @@ 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*P(-1)/""+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 b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) -local e_stripper=Cs((spacer^1*P(-1)/""+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) patterns.stripper=stripper patterns.fullstripper=fullstripper @@ -1173,7 +1173,7 @@ patterns.decafloat=sign^-1*(digit^0*period*digits+digits*period*digit^0+digits)* patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) -patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(P(-1)+Cc(" ")))^0)) +patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(endofstring+Cc(" ")))^0)) function anywhere(pattern) return (1-P(pattern))^0*P(pattern) end @@ -1738,12 +1738,21 @@ end function lpeg.times(pattern,n) return P(nextstep(n,2^16,{ "start",["1"]=pattern })) end -local trailingzeros=zero^0*-digit -local case_1=period*trailingzeros/"" -local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") -local number=digits*(case_1+case_2) -local stripper=Cs((number+1)^0) -lpeg.patterns.stripzeros=stripper +do + local trailingzeros=zero^0*-digit + local stripper=Cs(( + digits*( + period*trailingzeros/""+period*(digit-trailingzeros)^1*(trailingzeros/"") + )+1 + )^0) + lpeg.patterns.stripzeros=stripper + local nonzero=digit-zero + local trailingzeros=zero^1*endofstring + local stripper=Cs((1-period)^0*( + (period*trailingzeros/"")+period*(nonzero^1+(trailingzeros/"")+zero^1)^0 + )) + lpeg.patterns.stripzero=stripper +end local byte_to_HEX={} local byte_to_hex={} local byte_to_dec={} @@ -1807,7 +1816,7 @@ local patterns={} local function containsws(what) local p=patterns[what] if not p then - local p1=P(what)*(whitespace+P(-1))*Cc(true) + local p1=P(what)*(whitespace+endofstring)*Cc(true) local p2=whitespace*P(p1) p=P(p1)+P(1-p2)^0*p2+Cc(false) patterns[what]=p @@ -6171,7 +6180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 41277, stripped down to: 23383 +-- original size: 41303, stripped down to: 23381 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6207,7 +6216,7 @@ else end end if not number then number={} end -local stripper=patterns.stripzeros +local stripper=patterns.stripzero local newline=patterns.newline local endofstring=patterns.endofstring local whitespace=patterns.whitespace @@ -6524,7 +6533,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else environment={ @@ -6550,7 +6559,7 @@ else formattednumber=number.formatted, sparseexponent=number.sparseexponent, formattedfloat=number.formattedfloat, - stripper=lpeg.patterns.stripzeros, + stripper=lpeg.patterns.stripzero, } end local arguments={ "a1" } @@ -6759,7 +6768,7 @@ 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() +local format_N=function(f) n=n+1 if not f or f=="" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) @@ -21646,8 +21655,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 : 889689 --- stripped bytes : 321468 +-- original bytes : 890017 +-- stripped bytes : 321580 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index b0dfffe42..16ae091e4 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1005,7 +1005,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 39415, stripped down to: 21143 +-- original size: 39717, stripped down to: 21361 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -1103,10 +1103,10 @@ 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*P(-1)/""+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 b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) -local e_stripper=Cs((spacer^1*P(-1)/""+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) patterns.stripper=stripper patterns.fullstripper=fullstripper @@ -1173,7 +1173,7 @@ patterns.decafloat=sign^-1*(digit^0*period*digits+digits*period*digit^0+digits)* patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) -patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(P(-1)+Cc(" ")))^0)) +patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(endofstring+Cc(" ")))^0)) function anywhere(pattern) return (1-P(pattern))^0*P(pattern) end @@ -1738,12 +1738,21 @@ end function lpeg.times(pattern,n) return P(nextstep(n,2^16,{ "start",["1"]=pattern })) end -local trailingzeros=zero^0*-digit -local case_1=period*trailingzeros/"" -local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") -local number=digits*(case_1+case_2) -local stripper=Cs((number+1)^0) -lpeg.patterns.stripzeros=stripper +do + local trailingzeros=zero^0*-digit + local stripper=Cs(( + digits*( + period*trailingzeros/""+period*(digit-trailingzeros)^1*(trailingzeros/"") + )+1 + )^0) + lpeg.patterns.stripzeros=stripper + local nonzero=digit-zero + local trailingzeros=zero^1*endofstring + local stripper=Cs((1-period)^0*( + (period*trailingzeros/"")+period*(nonzero^1+(trailingzeros/"")+zero^1)^0 + )) + lpeg.patterns.stripzero=stripper +end local byte_to_HEX={} local byte_to_hex={} local byte_to_dec={} @@ -1807,7 +1816,7 @@ local patterns={} local function containsws(what) local p=patterns[what] if not p then - local p1=P(what)*(whitespace+P(-1))*Cc(true) + local p1=P(what)*(whitespace+endofstring)*Cc(true) local p2=whitespace*P(p1) p=P(p1)+P(1-p2)^0*p2+Cc(false) patterns[what]=p @@ -6171,7 +6180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 41277, stripped down to: 23383 +-- original size: 41303, stripped down to: 23381 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6207,7 +6216,7 @@ else end end if not number then number={} end -local stripper=patterns.stripzeros +local stripper=patterns.stripzero local newline=patterns.newline local endofstring=patterns.endofstring local whitespace=patterns.whitespace @@ -6524,7 +6533,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else environment={ @@ -6550,7 +6559,7 @@ else formattednumber=number.formatted, sparseexponent=number.sparseexponent, formattedfloat=number.formattedfloat, - stripper=lpeg.patterns.stripzeros, + stripper=lpeg.patterns.stripzero, } end local arguments={ "a1" } @@ -6759,7 +6768,7 @@ 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() +local format_N=function(f) n=n+1 if not f or f=="" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) @@ -21646,8 +21655,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 : 889689 --- stripped bytes : 321468 +-- original bytes : 890017 +-- stripped bytes : 321580 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index b0dfffe42..16ae091e4 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -1005,7 +1005,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 39415, stripped down to: 21143 +-- original size: 39717, stripped down to: 21361 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -1103,10 +1103,10 @@ 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*P(-1)/""+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 b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) -local e_stripper=Cs((spacer^1*P(-1)/""+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) patterns.stripper=stripper patterns.fullstripper=fullstripper @@ -1173,7 +1173,7 @@ patterns.decafloat=sign^-1*(digit^0*period*digits+digits*period*digit^0+digits)* patterns.propername=(uppercase+lowercase+underscore)*(uppercase+lowercase+underscore+digit)^0*endofstring patterns.somecontent=(anything-newline-space)^1 patterns.beginline=#(1-newline) -patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(P(-1)+Cc(" ")))^0)) +patterns.longtostring=Cs(whitespace^0/""*((patterns.quoted+nonwhitespace^1+whitespace^1/""*(endofstring+Cc(" ")))^0)) function anywhere(pattern) return (1-P(pattern))^0*P(pattern) end @@ -1738,12 +1738,21 @@ end function lpeg.times(pattern,n) return P(nextstep(n,2^16,{ "start",["1"]=pattern })) end -local trailingzeros=zero^0*-digit -local case_1=period*trailingzeros/"" -local case_2=period*(digit-trailingzeros)^1*(trailingzeros/"") -local number=digits*(case_1+case_2) -local stripper=Cs((number+1)^0) -lpeg.patterns.stripzeros=stripper +do + local trailingzeros=zero^0*-digit + local stripper=Cs(( + digits*( + period*trailingzeros/""+period*(digit-trailingzeros)^1*(trailingzeros/"") + )+1 + )^0) + lpeg.patterns.stripzeros=stripper + local nonzero=digit-zero + local trailingzeros=zero^1*endofstring + local stripper=Cs((1-period)^0*( + (period*trailingzeros/"")+period*(nonzero^1+(trailingzeros/"")+zero^1)^0 + )) + lpeg.patterns.stripzero=stripper +end local byte_to_HEX={} local byte_to_hex={} local byte_to_dec={} @@ -1807,7 +1816,7 @@ local patterns={} local function containsws(what) local p=patterns[what] if not p then - local p1=P(what)*(whitespace+P(-1))*Cc(true) + local p1=P(what)*(whitespace+endofstring)*Cc(true) local p2=whitespace*P(p1) p=P(p1)+P(1-p2)^0*p2+Cc(false) patterns[what]=p @@ -6171,7 +6180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 41277, stripped down to: 23383 +-- original size: 41303, stripped down to: 23381 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6207,7 +6216,7 @@ else end end if not number then number={} end -local stripper=patterns.stripzeros +local stripper=patterns.stripzero local newline=patterns.newline local endofstring=patterns.endofstring local whitespace=patterns.whitespace @@ -6524,7 +6533,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else environment={ @@ -6550,7 +6559,7 @@ else formattednumber=number.formatted, sparseexponent=number.sparseexponent, formattedfloat=number.formattedfloat, - stripper=lpeg.patterns.stripzeros, + stripper=lpeg.patterns.stripzero, } end local arguments={ "a1" } @@ -6759,7 +6768,7 @@ 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() +local format_N=function(f) n=n+1 if not f or f=="" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) @@ -21646,8 +21655,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 : 889689 --- stripped bytes : 321468 +-- original bytes : 890017 +-- stripped bytes : 321580 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index f1169ed0a..c0d945f51 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.06.23 12:12} +\newcontextversion{2018.06.24 18:28} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 280407900..245d8dd30 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.06.23 12:12} +\edef\contextversion{2018.06.24 18:28} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index f621d7969..618004649 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.06.23 12:12} +\newcontextversion{2018.06.24 18:28} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 73ec727ac..bb9a949b4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.06.23 12:12} +\edef\contextversion{2018.06.24 18:28} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 7c6035d0a..ce37c7c62 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -372,22 +372,30 @@ function figures.setorder(list) -- can be table or string end end +local function guessfromstring(str) + if str then + for i=1,#figures_magics do + local pattern = figures_magics[i] + if lpegmatch(pattern.pattern,str) then + local format = pattern.format + if trace_figures then + report_inclusion("file %a has format %a",filename,format) + end + return format + end + end + end +end + +figures.guessfromstring = guessfromstring + function figures.guess(filename) local f = io.open(filename,'rb') if f then local str = f:read(100) f:close() if str then - for i=1,#figures_magics do - local pattern = figures_magics[i] - if lpegmatch(pattern.pattern,str) then - local format = pattern.format - if trace_figures then - report_inclusion("file %a has format %a",filename,format) - end - return format - end - end + return guessfromstring(str) end end end @@ -2079,11 +2087,10 @@ local function pdf_checker(data) local pdfdoc = nil request.scanimage = function(t) pdfdoc = openpdf(t.filename,request.userpassword,request.ownerpassword) - -- if pdfdoc then - -- used.pdfdoc = pdfdoc - -- -- nofpages - -- end if pdfdoc then + -- + pdfdoc.nofcopiedpages = 0 + -- local info = querypdf(pdfdoc,request.page) local bbox = info and info.boundingbox or { 0, 0, 0, 0 } return { @@ -2105,14 +2112,15 @@ local function pdf_checker(data) end request.copyimage = function(t) if pdfdoc then - -- local pdfdoc = used.pdfdoc local result = copypage(pdfdoc,request.page) - if pdfdoc.nofpages == 1 then -- and object usage + pdfdoc.nofcopiedpages = pdfdoc.nofcopiedpages + 1 + if pdfdoc.nofcopiedpages >= pdfdoc.nofpages then closepdf(pdfdoc) - -- used.pdfdoc = nil pdfdoc = nil end return result + else + -- message, should not happen as we always first scan so that reopens end end end diff --git a/tex/context/base/mkiv/grph-mem.lua b/tex/context/base/mkiv/grph-mem.lua index bb48ae8d5..ff3548350 100644 --- a/tex/context/base/mkiv/grph-mem.lua +++ b/tex/context/base/mkiv/grph-mem.lua @@ -20,67 +20,143 @@ local gsub = string.gsub local report = logs.reporter("memstream") local trace = false trackers.register ("graphics.memstreams", function(v) trace = v end) local data = { } -local opened = { } -local function setmemstream(name,stream,once) - if once and data[name] then +if pdfe then + + local function setmemstream(name,stream,once) + if once and data[name] then + if trace then + report("not overloading %a",name) -- + end + return data[name] + end + local kind = figures.guessfromstring(stream) + local identifier = false + if kind == "pdf" then + identifier = pdfe.new(stream,#stream,name) + if not identifier then + report("no valid pdf stream %a",name) + elseif trace then + report("setting %a with identifier %a",name,identifier) + end + else + identifier = "m_k_i_v_memstream_" .. name .. "." .. kind + io.savedata(identifier,stream) + end + if not identifier then + identifier = "invalid-memstream" + end + data[name] = identifier + return identifier + end + + resolvers.setmemstream = setmemstream + + function resolvers.finders.memstream(specification) + local name = specification.path + local identifier = data[name] + if identifier then + if trace then + report("reusing %a with identifier %a",name,identifier) + end + return identifier + end + local stream = io.loaddata(name) + if stream and stream ~= "" then + return setmemstream(name,stream) + end if trace then - report("not overloading %a",name) -- + report("no valid memstream %a",name) end - return data[name] + return resolvers.finders.notfound() end - local memstream, identifier = epdf.openMemStream(stream,#stream,name) - if not identifier then - report("no valid stream %a",name) - identifier = "invalid-memstream" - elseif trace then - report("setting %a with identifier %a",name,identifier) + + local flush = { } + + function resolvers.resetmemstream(name,afterpage) + if afterpage then + flush[#flush+1] = name + end end - data [name] = identifier - opened[name] = memstream - return identifier -end -resolvers.setmemstream = setmemstream + luatex.registerpageactions(function() + if #flush > 0 then + for i=1,#flush do + local identifier = data[name] + if identifier then + os.remove(identifier) + data[name] = nil + end + end + flush = { } + end + end) + +else -function resolvers.finders.memstream(specification) - local name = specification.path - local identifier = data[name] - if identifier then - if trace then - report("reusing %a with identifier %a",name,identifier) + local opened = { } + + local function setmemstream(name,stream,once) + if once and data[name] then + if trace then + report("not overloading %a",name) -- + end + return data[name] end + local memstream, identifier = epdf.openMemStream(stream,#stream,name) + if not identifier then + report("no valid stream %a",name) + identifier = "invalid-memstream" + elseif trace then + report("setting %a with identifier %a",name,identifier) + end + data [name] = identifier + opened[name] = memstream return identifier end - local stream = io.loaddata(name) - if not stream or stream == "" then - if trace then - report("no valid file %a",name) + + resolvers.setmemstream = setmemstream + + function resolvers.finders.memstream(specification) + local name = specification.path + local identifier = data[name] + if identifier then + if trace then + report("reusing %a with identifier %a",name,identifier) + end + return identifier + end + local stream = io.loaddata(name) + if not stream or stream == "" then + if trace then + report("no valid file %a",name) + end + return resolvers.finders.notfound() + else + return setmemstream(name,stream) end - return resolvers.finders.notfound() - else - return setmemstream(name,stream) end -end -local flush = { } + local flush = { } -function resolvers.resetmemstream(name,afterpage) - if afterpage then - flush[#flush+1] = name - else - opened[name] = nil + function resolvers.resetmemstream(name,afterpage) + if afterpage then + flush[#flush+1] = name + else + opened[name] = nil + end end -end -luatex.registerpageactions(function() - if #flush > 0 then - for i=1,#flush do - opened[flush[i]] = nil -- we keep of course data[name] because of reuse + luatex.registerpageactions(function() + if #flush > 0 then + for i=1,#flush do + opened[flush[i]] = nil -- we keep of course data[name] because of reuse + end + flush = { } end - flush = { } - end -end) + end) + +end figures.identifiers.list[#figures.identifiers.list+1] = function(specification) local name = specification.request.name diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index 45d254724..827564464 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -202,13 +202,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 * P(-1)/"" + nonwhitespace^1 + whitespace^1/" ")^0) -local m_collapser = Cs( (nonwhitespace^1 + whitespace^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 b_stripper = Cs( spacer^0 /"" * (nonspacer^1 + spacer^1/" ")^0) -local e_stripper = Cs((spacer^1 * P(-1)/"" + nonspacer^1 + spacer^1/" ")^0) -local m_stripper = Cs( (nonspacer^1 + spacer^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) patterns.stripper = stripper patterns.fullstripper = fullstripper @@ -289,7 +289,7 @@ patterns.propername = (uppercase + lowercase + underscore) * (uppercase + low patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 patterns.beginline = #(1-newline) -patterns.longtostring = Cs(whitespace^0/"" * ((patterns.quoted + nonwhitespace^1 + whitespace^1/"" * (P(-1) + Cc(" ")))^0)) +patterns.longtostring = Cs(whitespace^0/"" * ((patterns.quoted + nonwhitespace^1 + whitespace^1/"" * (endofstring + Cc(" ")))^0)) -- local function anywhere(pattern) -- slightly adapted from website -- return P { P(pattern) + 1 * V(1) } @@ -1133,23 +1133,36 @@ end -- moved here (before util-str) ------ digit = R("09") ------ period = P(".") ------ zero = P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digits * (case_1 + case_2) -local stripper = Cs((number + 1)^0) +do -lpeg.patterns.stripzeros = stripper + local trailingzeros = zero^0 * -digit -- suggested by Roberto R + local stripper = Cs(( + digits * ( + period * trailingzeros / "" + + period * (digit - trailingzeros)^1 * (trailingzeros / "") + ) + 1 + )^0) --- local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" --- collectgarbage("collect") --- str = string.rep(sample,10000) --- local ts = os.clock() --- lpegmatch(stripper,str) --- print(#str, os.clock()-ts, lpegmatch(stripper,sample)) + lpeg.patterns.stripzeros = stripper -- multiple in string + + local nonzero = digit - zero + + local trailingzeros = zero^1 * endofstring + local stripper = Cs( (1-period)^0 * ( + (period * trailingzeros/"") + + period * (nonzero^1 + (trailingzeros/"") + zero^1)^0 + )) + + lpeg.patterns.stripzero = stripper -- slightly more efficient + + -- local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" + -- collectgarbage("collect") + -- str = string.rep(sample,10000) + -- local ts = os.clock() + -- lpegmatch(stripper,str) + -- print(#str, os.clock()-ts, lpegmatch(stripper,sample)) + +end -- for practical reasone we keep this here: @@ -1229,7 +1242,7 @@ local patterns = { } -- can be made weak local function containsws(what) local p = patterns[what] if not p then - local p1 = P(what) * (whitespace + P(-1)) * Cc(true) + local p1 = P(what) * (whitespace + endofstring) * Cc(true) local p2 = whitespace * P(p1) p = P(p1) + P(1-p2)^0 * p2 + Cc(false) patterns[what] = p diff --git a/tex/context/base/mkiv/lpdf-pde.lua b/tex/context/base/mkiv/lpdf-pde.lua index 3f12edd90..bc252b87c 100644 --- a/tex/context/base/mkiv/lpdf-pde.lua +++ b/tex/context/base/mkiv/lpdf-pde.lua @@ -793,8 +793,8 @@ if img then do -- recompress d.Filter = nil d.Length = nil - d.DecodeParms = nil - d.DL = nil + d.DecodeParms = nil -- not relevant + d.DL = nil -- needed? local s = entry() -- get uncompressed stream pdfflushstreamobject(s,d,true,usednum) -- compress stream else @@ -835,6 +835,9 @@ if img then do end local function copyobject(xref,copied,object,key,value) + if not value then + value = object.__raw__[key] + end local t = type(value) if t == "string" then return pdfconstant(value) @@ -949,7 +952,6 @@ if img then do local xobject = pdfdictionary { Group = copyobject(xref,copied,page,"Group"), LastModified = copyobject(xref,copied,page,"LastModified"), - MetaData = copyobject(xref,copied,root,"MetaData"), Metadata = copyobject(xref,copied,page,"Metadata"), PieceInfo = copyobject(xref,copied,page,"PieceInfo"), Resources = copyresources(pdfdoc,xref,copied,page), @@ -960,12 +962,26 @@ if img then do page[k] = v -- maybe nested end end - local content = "" - local ctype = contents.__type__ + local content = "" + local nolength = nil + local ctype = contents.__type__ -- we always recompress because image object streams can not be -- influenced (yet) if ctype == stream_code then - content = contents() -- uncompressed + if recompress then + content = contents() -- uncompressed + else + local Filter = copyobject(xref,copied,contents,"Filter") + local Length = copyobject(xref,copied,contents,"Length") + if Length and Filter then + nolength = true + xobject.Length = Length + xobject.Filter = Filter + content = contents(false) -- uncompressed + else + content = contents() -- uncompressed + end + end elseif ctype == array_code then content = { } for i=1,#contents do @@ -975,9 +991,10 @@ if img then do end -- still not nice: we double wrap now return newimage { - bbox = pageinfo.boundingbox, - stream = content, - attr = xobject(), + bbox = pageinfo.boundingbox, + nolength = nolength, + stream = content, -- todo: no compress, pass directly also length, filter etc + attr = xobject(), } end end diff --git a/tex/context/base/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua index d3418199c..639e22052 100644 --- a/tex/context/base/mkiv/meta-blb.lua +++ b/tex/context/base/mkiv/meta-blb.lua @@ -306,10 +306,12 @@ local ft_reset, ft_analyze, ft_process do } ft_process = function(object,prescript,before,after) - object.path = false - object.color = false - object.grouped = true - object.istext = true + if prescript.ft_category then + object.path = false + object.color = false + object.grouped = true + object.istext = true + end end diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua index 791d36607..ce4fd8817 100644 --- a/tex/context/base/mkiv/mlib-pdf.lua +++ b/tex/context/base/mkiv/mlib-pdf.lua @@ -48,19 +48,6 @@ local experiment = true -- uses context(node) that already does delayed nod local savedliterals = nil -- needs checking local mpsliteral = nodes.pool.register(node.new("whatsit",nodes.whatsitcodes.pdfliteral)) -- pdfliteral.mode = 1 --- we can have "withaccuracy 3" and then change formatters on the fly - --- local f_f = formatters["%F"] --- local f_m = formatters["%F %F m"] --- local f_c = formatters["%F %F %F %F %F %F c"] --- local f_l = formatters["%F %F l"] --- local f_cm = formatters["%F %F %F %F %F %F cm"] --- local f_M = formatters["%F M"] --- local f_j = formatters["%i j"] --- local f_J = formatters["%i J"] --- local f_d = formatters["[%s] %F d"] --- local f_w = formatters["%F w"] - local f_f = formatters["%.6F"] local f_m = formatters["%.6F %.6F m"] local f_c = formatters["%.6F %.6F %.6F %.6F %.6F %.6F c"] @@ -72,6 +59,19 @@ local f_J = formatters["%i J"] local f_d = formatters["[%s] %.6F d"] local f_w = formatters["%.3F w"] +directives.register("metapost.stripzeros",function() + f_f = formatters["%.6N"] + f_m = formatters["%.6N %.6N m"] + f_c = formatters["%.6N %.6N %.6N %.6N %.6N %.6N c"] + f_l = formatters["%.6N %.6N l"] + f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"] + f_M = formatters["%.6N M"] + f_j = formatters["%i j"] + f_J = formatters["%i J"] + f_d = formatters["[%s] %.6N d"] + f_w = formatters["%.3N w"] +end) + directives.register("metapost.savetable",function(v) if type(v) == "string" then save_table = file.addsuffix(v,"mpl") @@ -560,14 +560,14 @@ function metapost.flush(result,flusher,askedfig,incontext) local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point" local pen = object.pen if pen then - if pen.type == 'elliptical' then + if pen.type == "elliptical" then transformed, penwidth = pen_characteristics(original) -- boolean, value result[#result+1] = f_w(penwidth) -- todo: only if changed - if objecttype == 'fill' then - objecttype = 'both' + if objecttype == "fill" then + objecttype = "both" end else -- calculated by mplib itself - objecttype = 'fill' + objecttype = "fill" end end if transformed then diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index da1e9c4f7..6c2dfe4cd 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -97,13 +97,22 @@ end local f_f = formatters["%F"] local f_f3 = formatters["%.3F"] - local f_gray = formatters["%.3F g %.3F G"] local f_rgb = formatters["%.3F %.3F %.3F rg %.3F %.3F %.3F RG"] local f_cmyk = formatters["%.3F %.3F %.3F %.3F k %.3F %.3F %.3F %.3F K"] local f_cm = formatters["q %F %F %F %F %F %F cm"] local f_shade = formatters["MpSh%s"] +directives.register("metapost.stripzeros",function() + f_f = formatters["%N"] + f_f3 = formatters["%.3N"] + f_gray = formatters["%.3N g %.3N G"] + f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"] + f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"] + f_cm = formatters["q %N %N %N %N %N %N cm"] + f_shade = formatters["MpSh%s"] +end) + local f_spot = formatters["/%s cs /%s CS %s SCN %s scn"] local function checked_color_pair(color,...) @@ -998,19 +1007,21 @@ local tx_reset, tx_analyze, tx_process do ----- pat = tsplitat(":") local pat = lpeg.tsplitter(":",tonumber) -- so that %F can do its work - -- local f_gray_yes = formatters["s=%F,a=%F,t=%F"] - -- local f_gray_nop = formatters["s=%F"] - -- local f_rgb_yes = formatters["r=%F,g=%F,b=%F,a=%F,t=%F"] - -- local f_rgb_nop = formatters["r=%F,g=%F,b=%F"] - -- local f_cmyk_yes = formatters["c=%F,m=%F,y=%F,k=%F,a=%F,t=%F"] - -- local f_cmyk_nop = formatters["c=%F,m=%F,y=%F,k=%F"] - - local f_gray_yes = formatters["s=%n,a=%n,t=%n"] - local f_gray_nop = formatters["s=%n"] - local f_rgb_yes = formatters["r=%n,g=%n,b=%n,a=%n,t=%n"] - local f_rgb_nop = formatters["r=%n,g=%n,b=%n"] - local f_cmyk_yes = formatters["c=%n,m=%n,y=%n,k=%n,a=%n,t=%n"] - local f_cmyk_nop = formatters["c=%n,m=%n,y=%n,k=%n"] + local f_gray_yes = formatters["s=%.3F,a=%i,t=%.3F"] + local f_gray_nop = formatters["s=%.3F"] + local f_rgb_yes = formatters["r=%.3F,g=%.3F,b=%.3F,a=%.3F,t=%.3F"] + local f_rgb_nop = formatters["r=%.3F,g=%.3F,b=%.3F"] + local f_cmyk_yes = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F,a=%.3F,t=%.3F"] + local f_cmyk_nop = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F"] + + directives.register("metapost.stripzeros",function() + f_gray_yes = formatters["s=%.3N,a=%i,t=%.3N"] + f_gray_nop = formatters["s=%.3N"] + f_rgb_yes = formatters["r=%.3N,g=%.3N,b=%.3N,a=%.3N,t=%.3N"] + f_rgb_nop = formatters["r=%.3N,g=%.3N,b=%.3N"] + f_cmyk_yes = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N,a=%.3N,t=%.3N"] + f_cmyk_nop = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N"] + end) if metapost.use_one_pass then diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex ae6be34a3..3c7be3c0b 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 062c3635a..466bd7c4c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index f575050ff..576e1f491 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -47,7 +47,7 @@ end if not number then number = { } end -- temp hack for luatex-fonts -local stripper = patterns.stripzeros +local stripper = patterns.stripzero local newline = patterns.newline local endofstring = patterns.endofstring local whitespace = patterns.whitespace @@ -368,6 +368,7 @@ end -- automatic %...a 'whatever' (string, table, ...) -- automatic %...A "whatever" (string, table, ...) -- zap %...z skip +-- stripped %...N %...N -- comma/period real %...m -- period/comma real %...M -- formatted float %...k n.m @@ -612,7 +613,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else @@ -640,7 +641,7 @@ else formattednumber = number.formatted, sparseexponent = number.sparseexponent, formattedfloat = number.formattedfloat, - stripper = lpeg.patterns.stripzeros, + stripper = lpeg.patterns.stripzero, } end @@ -914,7 +915,7 @@ end -- return format("tostring(tonumber(a%s) or a%s)",n,n) -- end -local format_N = function() -- strips leading and trailing zeros (also accepts string) +local format_N = function(f) -- strips leading and trailing zeros (also accepts string) n = n + 1 if not f or f == "" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 69bc9732b..dcf89c5c7 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 7d2466788..59f8e297a 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf |