diff options
author | Hans Hagen <pragma@wxs.nl> | 2014-02-13 11:27:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2014-02-13 11:27:00 +0100 |
commit | f4f8db5c9230c293f454b335b777d211840463a7 (patch) | |
tree | e7af0732d45e2dd651aad1bd62fabe36c2d57768 | |
parent | b1d9ab946dc387c58a5575a360754fa04ebcad42 (diff) | |
download | context-f4f8db5c9230c293f454b335b777d211840463a7.tar.gz |
beta 2014.02.13 11:27
35 files changed, 659 insertions, 258 deletions
diff --git a/metapost/context/base/mp-base.mpiv b/metapost/context/base/mp-base.mpiv index 638be4628..0b655ef47 100644 --- a/metapost/context/base/mp-base.mpiv +++ b/metapost/context/base/mp-base.mpiv @@ -323,7 +323,7 @@ primarydef w dotprod z = enddef ; primarydef x**y = - if y=2 : + if y = 2 : x*x else : takepower y of x @@ -348,11 +348,46 @@ def takepower expr y of x = endfor fi else : - hide(errmessage "Undefined power: " & decimal x&"**"&decimal y) + hide(errmessage "Undefined power: " & decimal x & "**" & decimal y) fi fi enddef ; +% for big number systems: +% +% primarydef x**y = +% if y = 1 : +% x +% elseif y = 2 : +% x*x +% elseif y = 3 : +% x*x*x +% else : +% takepower y of x +% fi +% enddef ; +% +% vardef takepower expr y of x = +% if (x=0) and (y>0) : +% 0 +% else : +% 1 +% if y = floor y : +% if y >= 0 : +% for n=1 upto y : +% *x +% endfor +% else : +% for n=-1 downto y : +% /x +% endfor +% fi +% else : +% hide(errmessage "Undefined power: " & decimal x & "**" & decimal y) +% fi +% fi +% enddef ; + vardef direction expr t of p = postcontrol t of p - precontrol t of p enddef ; diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 1a40059de..502cdb47e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 3123, stripped down to: 1694 +-- original size: 3227, stripped down to: 1745 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -136,6 +136,7 @@ function optionalrequire(...) return result end end +lua.mask=load([[τεχ = 1]]) and "utf" or "ascii" end -- of closure @@ -434,7 +435,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29680, stripped down to: 16076 +-- original size: 29808, stripped down to: 16182 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -521,9 +522,11 @@ patterns.spacer=spacer patterns.whitespace=whitespace patterns.nonspacer=nonspacer patterns.nonwhitespace=nonwhitespace -local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper +patterns.fullstripper=fullstripper patterns.collapser=collapser patterns.lowercase=lowercase patterns.uppercase=uppercase @@ -1077,7 +1080,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-string"] = package.loaded["l-string"] or true --- original size: 5547, stripped down to: 2708 +-- original size: 5671, stripped down to: 2827 if not modules then modules={} end modules ['l-string']={ version=1.001, @@ -1113,11 +1116,15 @@ function string.limit(str,n,sentinel) end end local stripper=patterns.stripper +local fullstripper=patterns.fullstripper local collapser=patterns.collapser local longtostring=patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end @@ -3726,7 +3733,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 14229, stripped down to: 8740 +-- original size: 14768, stripped down to: 9107 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3749,6 +3756,7 @@ local isdir=lfs.isdir local isfile=lfs.isfile local currentdir=lfs.currentdir local chdir=lfs.chdir +local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";") if not isdir then function isdir(name) @@ -3921,16 +3929,27 @@ end local make_indeed=true if onwindows then function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s=="" then - elseif str=="" then - str=s - else - str=str.."/"..s + local n=select("#",...) + local str + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + local s=select(i,...) + if s=="" then + elseif str=="" then + str=s + else + str=str.."/"..s + end end end + local pth="" local drive=false local first,middle,last=match(str,"^(//)(//*)(.*)$") if first then @@ -3965,21 +3984,30 @@ if onwindows then pth=pth.."/"..s end if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end return pth,(isdir(pth)==true) end else function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s and s~="" then - if str~="" then - str=str.."/"..s - else - str=s + local n=select("#",...) + local str,pth + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + if s and s~="" then + if str~="" then + str=str.."/"..s + else + str=s + end end end end @@ -3994,7 +4022,7 @@ else pth=pth.."/"..s end if make_indeed and not first and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end else @@ -4002,7 +4030,7 @@ else for s in gmatch(str,"[^/]+") do pth=pth.."/"..s if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end end @@ -7672,7 +7700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6501, stripped down to: 5156 +-- original size: 6643, stripped down to: 5272 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -7773,7 +7801,10 @@ function statistics.show() if statistics.enable then local register=statistics.register register("used platform",function() - return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown",environment.texos or "unknown") + local mask=lua.mask or "ascii" + return format("%s, type: %s, binary subtree: %s, symbol mask: %s (%s)", + os.platform or "unknown",os.type or "unknown",environment.texos or "unknown", + mask,mask=="utf" and "τεχ" or "tex") end) register("luatex banner",function() return lower(status.banner) @@ -7852,7 +7883,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-pro"] = package.loaded["trac-pro"] or true --- original size: 5773, stripped down to: 3453 +-- original size: 5829, stripped down to: 3501 if not modules then modules={} end modules ['trac-pro']={ version=1.001, @@ -7869,14 +7900,16 @@ local namespaces=namespaces local registered={} local function report_index(k,name) if trace_namespaces then - report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("reference to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("reference to %a in protected namespace %a",k,name) end end local function report_newindex(k,name) if trace_namespaces then - report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("assignment to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("assignment to %a in protected namespace %a",k,name) end @@ -8127,7 +8160,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-deb"] = package.loaded["util-deb"] or true --- original size: 3708, stripped down to: 2568 +-- original size: 3898, stripped down to: 2644 if not modules then modules={} end modules ['util-deb']={ version=1.001, @@ -8207,20 +8240,22 @@ end function debugger.disable() debug.sethook() end -function traceback() - local level=1 +local function showtraceback(rep) + local level=2 + local reporter=rep or report while true do - local info=debug.getinfo(level,"Sl") + local info=getinfo(level,"Sl") if not info then break elseif info.what=="C" then - print(format("%3i : C function",level)) + reporter("%2i : %s",level-1,"C function") else - print(format("%3i : [%s]:%d",level,info.short_src,info.currentline)) + reporter("%2i : %s : %s",level-1,info.short_src,info.currentline) end level=level+1 end end +debugger.showtraceback=showtraceback end -- of closure @@ -8886,7 +8921,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42549, stripped down to: 26643 +-- original size: 42614, stripped down to: 26694 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -9412,8 +9447,11 @@ local function _xmlconvert_(data,settings) end if errorstr and errorstr~="" then result.error=true + else + errorstr=nil end result.statistics={ + errormessage=errorstr, entities={ decimals=dcache, hexadecimals=hcache, @@ -16706,8 +16744,8 @@ end -- of closure -- used libraries : l-lua.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-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-mrg.lua util-tpl.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 : 688201 --- stripped bytes : 245099 +-- original bytes : 689549 +-- stripped bytes : 245513 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 1a40059de..502cdb47e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 3123, stripped down to: 1694 +-- original size: 3227, stripped down to: 1745 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -136,6 +136,7 @@ function optionalrequire(...) return result end end +lua.mask=load([[τεχ = 1]]) and "utf" or "ascii" end -- of closure @@ -434,7 +435,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29680, stripped down to: 16076 +-- original size: 29808, stripped down to: 16182 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -521,9 +522,11 @@ patterns.spacer=spacer patterns.whitespace=whitespace patterns.nonspacer=nonspacer patterns.nonwhitespace=nonwhitespace -local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper +patterns.fullstripper=fullstripper patterns.collapser=collapser patterns.lowercase=lowercase patterns.uppercase=uppercase @@ -1077,7 +1080,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-string"] = package.loaded["l-string"] or true --- original size: 5547, stripped down to: 2708 +-- original size: 5671, stripped down to: 2827 if not modules then modules={} end modules ['l-string']={ version=1.001, @@ -1113,11 +1116,15 @@ function string.limit(str,n,sentinel) end end local stripper=patterns.stripper +local fullstripper=patterns.fullstripper local collapser=patterns.collapser local longtostring=patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end @@ -3726,7 +3733,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 14229, stripped down to: 8740 +-- original size: 14768, stripped down to: 9107 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3749,6 +3756,7 @@ local isdir=lfs.isdir local isfile=lfs.isfile local currentdir=lfs.currentdir local chdir=lfs.chdir +local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";") if not isdir then function isdir(name) @@ -3921,16 +3929,27 @@ end local make_indeed=true if onwindows then function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s=="" then - elseif str=="" then - str=s - else - str=str.."/"..s + local n=select("#",...) + local str + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + local s=select(i,...) + if s=="" then + elseif str=="" then + str=s + else + str=str.."/"..s + end end end + local pth="" local drive=false local first,middle,last=match(str,"^(//)(//*)(.*)$") if first then @@ -3965,21 +3984,30 @@ if onwindows then pth=pth.."/"..s end if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end return pth,(isdir(pth)==true) end else function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s and s~="" then - if str~="" then - str=str.."/"..s - else - str=s + local n=select("#",...) + local str,pth + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + if s and s~="" then + if str~="" then + str=str.."/"..s + else + str=s + end end end end @@ -3994,7 +4022,7 @@ else pth=pth.."/"..s end if make_indeed and not first and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end else @@ -4002,7 +4030,7 @@ else for s in gmatch(str,"[^/]+") do pth=pth.."/"..s if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end end @@ -7672,7 +7700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6501, stripped down to: 5156 +-- original size: 6643, stripped down to: 5272 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -7773,7 +7801,10 @@ function statistics.show() if statistics.enable then local register=statistics.register register("used platform",function() - return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown",environment.texos or "unknown") + local mask=lua.mask or "ascii" + return format("%s, type: %s, binary subtree: %s, symbol mask: %s (%s)", + os.platform or "unknown",os.type or "unknown",environment.texos or "unknown", + mask,mask=="utf" and "τεχ" or "tex") end) register("luatex banner",function() return lower(status.banner) @@ -7852,7 +7883,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-pro"] = package.loaded["trac-pro"] or true --- original size: 5773, stripped down to: 3453 +-- original size: 5829, stripped down to: 3501 if not modules then modules={} end modules ['trac-pro']={ version=1.001, @@ -7869,14 +7900,16 @@ local namespaces=namespaces local registered={} local function report_index(k,name) if trace_namespaces then - report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("reference to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("reference to %a in protected namespace %a",k,name) end end local function report_newindex(k,name) if trace_namespaces then - report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("assignment to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("assignment to %a in protected namespace %a",k,name) end @@ -8127,7 +8160,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-deb"] = package.loaded["util-deb"] or true --- original size: 3708, stripped down to: 2568 +-- original size: 3898, stripped down to: 2644 if not modules then modules={} end modules ['util-deb']={ version=1.001, @@ -8207,20 +8240,22 @@ end function debugger.disable() debug.sethook() end -function traceback() - local level=1 +local function showtraceback(rep) + local level=2 + local reporter=rep or report while true do - local info=debug.getinfo(level,"Sl") + local info=getinfo(level,"Sl") if not info then break elseif info.what=="C" then - print(format("%3i : C function",level)) + reporter("%2i : %s",level-1,"C function") else - print(format("%3i : [%s]:%d",level,info.short_src,info.currentline)) + reporter("%2i : %s : %s",level-1,info.short_src,info.currentline) end level=level+1 end end +debugger.showtraceback=showtraceback end -- of closure @@ -8886,7 +8921,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42549, stripped down to: 26643 +-- original size: 42614, stripped down to: 26694 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -9412,8 +9447,11 @@ local function _xmlconvert_(data,settings) end if errorstr and errorstr~="" then result.error=true + else + errorstr=nil end result.statistics={ + errormessage=errorstr, entities={ decimals=dcache, hexadecimals=hcache, @@ -16706,8 +16744,8 @@ end -- of closure -- used libraries : l-lua.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-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-mrg.lua util-tpl.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 : 688201 --- stripped bytes : 245099 +-- original bytes : 689549 +-- stripped bytes : 245513 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 1a40059de..502cdb47e 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 3123, stripped down to: 1694 +-- original size: 3227, stripped down to: 1745 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -136,6 +136,7 @@ function optionalrequire(...) return result end end +lua.mask=load([[τεχ = 1]]) and "utf" or "ascii" end -- of closure @@ -434,7 +435,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29680, stripped down to: 16076 +-- original size: 29808, stripped down to: 16182 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -521,9 +522,11 @@ patterns.spacer=spacer patterns.whitespace=whitespace patterns.nonspacer=nonspacer patterns.nonwhitespace=nonwhitespace -local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper +patterns.fullstripper=fullstripper patterns.collapser=collapser patterns.lowercase=lowercase patterns.uppercase=uppercase @@ -1077,7 +1080,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-string"] = package.loaded["l-string"] or true --- original size: 5547, stripped down to: 2708 +-- original size: 5671, stripped down to: 2827 if not modules then modules={} end modules ['l-string']={ version=1.001, @@ -1113,11 +1116,15 @@ function string.limit(str,n,sentinel) end end local stripper=patterns.stripper +local fullstripper=patterns.fullstripper local collapser=patterns.collapser local longtostring=patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end @@ -3726,7 +3733,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 14229, stripped down to: 8740 +-- original size: 14768, stripped down to: 9107 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3749,6 +3756,7 @@ local isdir=lfs.isdir local isfile=lfs.isfile local currentdir=lfs.currentdir local chdir=lfs.chdir +local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";") if not isdir then function isdir(name) @@ -3921,16 +3929,27 @@ end local make_indeed=true if onwindows then function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s=="" then - elseif str=="" then - str=s - else - str=str.."/"..s + local n=select("#",...) + local str + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + local s=select(i,...) + if s=="" then + elseif str=="" then + str=s + else + str=str.."/"..s + end end end + local pth="" local drive=false local first,middle,last=match(str,"^(//)(//*)(.*)$") if first then @@ -3965,21 +3984,30 @@ if onwindows then pth=pth.."/"..s end if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end return pth,(isdir(pth)==true) end else function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s and s~="" then - if str~="" then - str=str.."/"..s - else - str=s + local n=select("#",...) + local str,pth + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + if s and s~="" then + if str~="" then + str=str.."/"..s + else + str=s + end end end end @@ -3994,7 +4022,7 @@ else pth=pth.."/"..s end if make_indeed and not first and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end else @@ -4002,7 +4030,7 @@ else for s in gmatch(str,"[^/]+") do pth=pth.."/"..s if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end end @@ -7672,7 +7700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6501, stripped down to: 5156 +-- original size: 6643, stripped down to: 5272 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -7773,7 +7801,10 @@ function statistics.show() if statistics.enable then local register=statistics.register register("used platform",function() - return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown",environment.texos or "unknown") + local mask=lua.mask or "ascii" + return format("%s, type: %s, binary subtree: %s, symbol mask: %s (%s)", + os.platform or "unknown",os.type or "unknown",environment.texos or "unknown", + mask,mask=="utf" and "τεχ" or "tex") end) register("luatex banner",function() return lower(status.banner) @@ -7852,7 +7883,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-pro"] = package.loaded["trac-pro"] or true --- original size: 5773, stripped down to: 3453 +-- original size: 5829, stripped down to: 3501 if not modules then modules={} end modules ['trac-pro']={ version=1.001, @@ -7869,14 +7900,16 @@ local namespaces=namespaces local registered={} local function report_index(k,name) if trace_namespaces then - report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("reference to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("reference to %a in protected namespace %a",k,name) end end local function report_newindex(k,name) if trace_namespaces then - report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("assignment to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("assignment to %a in protected namespace %a",k,name) end @@ -8127,7 +8160,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-deb"] = package.loaded["util-deb"] or true --- original size: 3708, stripped down to: 2568 +-- original size: 3898, stripped down to: 2644 if not modules then modules={} end modules ['util-deb']={ version=1.001, @@ -8207,20 +8240,22 @@ end function debugger.disable() debug.sethook() end -function traceback() - local level=1 +local function showtraceback(rep) + local level=2 + local reporter=rep or report while true do - local info=debug.getinfo(level,"Sl") + local info=getinfo(level,"Sl") if not info then break elseif info.what=="C" then - print(format("%3i : C function",level)) + reporter("%2i : %s",level-1,"C function") else - print(format("%3i : [%s]:%d",level,info.short_src,info.currentline)) + reporter("%2i : %s : %s",level-1,info.short_src,info.currentline) end level=level+1 end end +debugger.showtraceback=showtraceback end -- of closure @@ -8886,7 +8921,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42549, stripped down to: 26643 +-- original size: 42614, stripped down to: 26694 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -9412,8 +9447,11 @@ local function _xmlconvert_(data,settings) end if errorstr and errorstr~="" then result.error=true + else + errorstr=nil end result.statistics={ + errormessage=errorstr, entities={ decimals=dcache, hexadecimals=hcache, @@ -16706,8 +16744,8 @@ end -- of closure -- used libraries : l-lua.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-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-mrg.lua util-tpl.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 : 688201 --- stripped bytes : 245099 +-- original bytes : 689549 +-- stripped bytes : 245513 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 1a40059de..502cdb47e 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 3123, stripped down to: 1694 +-- original size: 3227, stripped down to: 1745 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -136,6 +136,7 @@ function optionalrequire(...) return result end end +lua.mask=load([[τεχ = 1]]) and "utf" or "ascii" end -- of closure @@ -434,7 +435,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29680, stripped down to: 16076 +-- original size: 29808, stripped down to: 16182 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -521,9 +522,11 @@ patterns.spacer=spacer patterns.whitespace=whitespace patterns.nonspacer=nonspacer patterns.nonwhitespace=nonwhitespace -local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper +patterns.fullstripper=fullstripper patterns.collapser=collapser patterns.lowercase=lowercase patterns.uppercase=uppercase @@ -1077,7 +1080,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-string"] = package.loaded["l-string"] or true --- original size: 5547, stripped down to: 2708 +-- original size: 5671, stripped down to: 2827 if not modules then modules={} end modules ['l-string']={ version=1.001, @@ -1113,11 +1116,15 @@ function string.limit(str,n,sentinel) end end local stripper=patterns.stripper +local fullstripper=patterns.fullstripper local collapser=patterns.collapser local longtostring=patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end @@ -3726,7 +3733,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-dir"] = package.loaded["l-dir"] or true --- original size: 14229, stripped down to: 8740 +-- original size: 14768, stripped down to: 9107 if not modules then modules={} end modules ['l-dir']={ version=1.001, @@ -3749,6 +3756,7 @@ local isdir=lfs.isdir local isfile=lfs.isfile local currentdir=lfs.currentdir local chdir=lfs.chdir +local mkdir=lfs.mkdir local onwindows=os.type=="windows" or find(os.getenv("PATH"),";") if not isdir then function isdir(name) @@ -3921,16 +3929,27 @@ end local make_indeed=true if onwindows then function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s=="" then - elseif str=="" then - str=s - else - str=str.."/"..s + local n=select("#",...) + local str + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + local s=select(i,...) + if s=="" then + elseif str=="" then + str=s + else + str=str.."/"..s + end end end + local pth="" local drive=false local first,middle,last=match(str,"^(//)(//*)(.*)$") if first then @@ -3965,21 +3984,30 @@ if onwindows then pth=pth.."/"..s end if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end return pth,(isdir(pth)==true) end else function dir.mkdirs(...) - local str,pth="","" - for i=1,select("#",...) do - local s=select(i,...) - if s and s~="" then - if str~="" then - str=str.."/"..s - else - str=s + local n=select("#",...) + local str,pth + if n==1 then + str=select(1,...) + if isdir(str) then + return str,true + end + else + str="" + for i=1,n do + local s=select(i,...) + if s and s~="" then + if str~="" then + str=str.."/"..s + else + str=s + end end end end @@ -3994,7 +4022,7 @@ else pth=pth.."/"..s end if make_indeed and not first and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end else @@ -4002,7 +4030,7 @@ else for s in gmatch(str,"[^/]+") do pth=pth.."/"..s if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end end @@ -7672,7 +7700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 6501, stripped down to: 5156 +-- original size: 6643, stripped down to: 5272 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -7773,7 +7801,10 @@ function statistics.show() if statistics.enable then local register=statistics.register register("used platform",function() - return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown",environment.texos or "unknown") + local mask=lua.mask or "ascii" + return format("%s, type: %s, binary subtree: %s, symbol mask: %s (%s)", + os.platform or "unknown",os.type or "unknown",environment.texos or "unknown", + mask,mask=="utf" and "τεχ" or "tex") end) register("luatex banner",function() return lower(status.banner) @@ -7852,7 +7883,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-pro"] = package.loaded["trac-pro"] or true --- original size: 5773, stripped down to: 3453 +-- original size: 5829, stripped down to: 3501 if not modules then modules={} end modules ['trac-pro']={ version=1.001, @@ -7869,14 +7900,16 @@ local namespaces=namespaces local registered={} local function report_index(k,name) if trace_namespaces then - report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("reference to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("reference to %a in protected namespace %a",k,name) end end local function report_newindex(k,name) if trace_namespaces then - report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("assignment to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("assignment to %a in protected namespace %a",k,name) end @@ -8127,7 +8160,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-deb"] = package.loaded["util-deb"] or true --- original size: 3708, stripped down to: 2568 +-- original size: 3898, stripped down to: 2644 if not modules then modules={} end modules ['util-deb']={ version=1.001, @@ -8207,20 +8240,22 @@ end function debugger.disable() debug.sethook() end -function traceback() - local level=1 +local function showtraceback(rep) + local level=2 + local reporter=rep or report while true do - local info=debug.getinfo(level,"Sl") + local info=getinfo(level,"Sl") if not info then break elseif info.what=="C" then - print(format("%3i : C function",level)) + reporter("%2i : %s",level-1,"C function") else - print(format("%3i : [%s]:%d",level,info.short_src,info.currentline)) + reporter("%2i : %s : %s",level-1,info.short_src,info.currentline) end level=level+1 end end +debugger.showtraceback=showtraceback end -- of closure @@ -8886,7 +8921,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42549, stripped down to: 26643 +-- original size: 42614, stripped down to: 26694 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -9412,8 +9447,11 @@ local function _xmlconvert_(data,settings) end if errorstr and errorstr~="" then result.error=true + else + errorstr=nil end result.statistics={ + errormessage=errorstr, entities={ decimals=dcache, hexadecimals=hcache, @@ -16706,8 +16744,8 @@ end -- of closure -- used libraries : l-lua.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-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-mrg.lua util-tpl.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 : 688201 --- stripped bytes : 245099 +-- original bytes : 689549 +-- stripped bytes : 245513 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 63bf53a9e..6058b3e1b 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.02.07 00:57} +\newcontextversion{2014.02.13 11:27} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex be0d634a3..cdb6bdceb 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index abfc44390..c5708f2dd 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.02.07 00:57} +\edef\contextversion{2014.02.13 11:27} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 38b35c023..75e95749c 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['font-otn'] = { license = "see context related readme files", } +-- this is a context version which can contain experimental code, but when we +-- have serious patches we also need to change the other two font-otn files + -- preprocessors = { "nodes" } -- anchor class : mark, mkmk, curs, mklg (todo) diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 40081cc3b..b658b7c75 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -25,6 +25,7 @@ local isdir = lfs.isdir local isfile = lfs.isfile local currentdir = lfs.currentdir local chdir = lfs.chdir +local mkdir = lfs.mkdir local onwindows = os.type == "windows" or find(os.getenv("PATH"),";") @@ -284,17 +285,28 @@ local make_indeed = true -- false if onwindows then function dir.mkdirs(...) - local str, pth = "", "" - for i=1,select("#",...) do - local s = select(i,...) - if s == "" then - -- skip - elseif str == "" then - str = s - else - str = str .. "/" .. s + local n = select("#",...) + local str + if n == 1 then + str = select(1,...) + if isdir(str) then + return str, true + end + else + str = "" + for i=1,n do + local s = select(i,...) + local s = select(i,...) + if s == "" then + -- skip + elseif str == "" then + str = s + else + str = str .. "/" .. s + end end end + local pth = "" local drive = false local first, middle, last = match(str,"^(//)(//*)(.*)$") if first then @@ -330,7 +342,7 @@ if onwindows then pth = pth .. "/" .. s end if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end return pth, (isdir(pth) == true) @@ -351,14 +363,23 @@ if onwindows then else function dir.mkdirs(...) - local str, pth = "", "" - for i=1,select("#",...) do - local s = select(i,...) - if s and s ~= "" then -- we catch nil and false - if str ~= "" then - str = str .. "/" .. s - else - str = s + local n = select("#",...) + local str, pth + if n == 1 then + str = select(1,...) + if isdir(str) then + return str, true + end + else + str = "" + for i=1,n do + local s = select(i,...) + if s and s ~= "" then -- we catch nil and false + if str ~= "" then + str = str .. "/" .. s + else + str = s + end end end end @@ -373,7 +394,7 @@ else pth = pth .. "/" .. s end if make_indeed and not first and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end else @@ -381,7 +402,7 @@ else for s in gmatch(str,"[^/]+") do pth = pth .. "/" .. s if make_indeed and not isdir(pth) then - lfs.mkdir(pth) + mkdir(pth) end end end diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 6d3acd753..6feb7089c 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -176,12 +176,14 @@ patterns.whitespace = whitespace patterns.nonspacer = nonspacer patterns.nonwhitespace = nonwhitespace -local stripper = spacer^0 * C((spacer^0 * nonspacer^1)^0) -- from example by roberto +local stripper = spacer ^0 * C((spacer ^0 * nonspacer ^1)^0) -- from example by roberto +local fullstripper = whitespace^0 * C((whitespace^0 * nonwhitespace^1)^0) ----- collapser = Cs(spacer^0/"" * ((spacer^1 * endofstring / "") + (spacer^1/" ") + P(1))^0) local collapser = Cs(spacer^0/"" * nonspacer^0 * ((spacer^0/" " * nonspacer^1)^0)) patterns.stripper = stripper +patterns.fullstripper = fullstripper patterns.collapser = collapser patterns.lowercase = lowercase diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua index fc05afa67..233e1aa0f 100644 --- a/tex/context/base/l-lua.lua +++ b/tex/context/base/l-lua.lua @@ -148,3 +148,7 @@ function optionalrequire(...) return result end end + +-- nice for non ascii scripts (this might move): + +lua.mask = load([[τεχ = 1]]) and "utf" or "ascii" diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua index 9b079b00a..3b1a0003f 100644 --- a/tex/context/base/l-string.lua +++ b/tex/context/base/l-string.lua @@ -70,6 +70,7 @@ function string.limit(str,n,sentinel) -- not utf proof end local stripper = patterns.stripper +local fullstripper = patterns.fullstripper local collapser = patterns.collapser local longtostring = patterns.longtostring @@ -77,6 +78,10 @@ function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end + function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua index 2a36f5e9a..afddec345 100644 --- a/tex/context/base/lpdf-tag.lua +++ b/tex/context/base/lpdf-tag.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['lpdf-tag'] = { license = "see context related readme files" } +local next = next local format, match, concat = string.format, string.match, table.concat local lpegmatch = lpeg.match local utfchar = utf.char @@ -213,7 +214,7 @@ local function makecontent(parent,start,stop,slist,id) -- local bliteral = pdfliteral(format("/%s <</MCID %s>>BDC",tag,last)) local eliteral = pdfliteral("EMC") - -- + -- use insert instead: local prev = getprev(start) if prev then setfield(prev,"next",bliteral) @@ -221,7 +222,7 @@ local function makecontent(parent,start,stop,slist,id) end setfield(start,"prev",bliteral) setfield(bliteral,"next",start) - -- + -- use insert instead: local next = getnext(stop) if next then setfield(next,"prev",eliteral) diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 23734d970..8b34a96a3 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -746,8 +746,11 @@ local function _xmlconvert_(data, settings) end if errorstr and errorstr ~= "" then result.error = true + else + errorstr = nil end result.statistics = { + errormessage = errorstr, entities = { decimals = dcache, hexadecimals = hcache, diff --git a/tex/context/base/math-dir.lua b/tex/context/base/math-dir.lua index ec64e6787..525d07831 100644 --- a/tex/context/base/math-dir.lua +++ b/tex/context/base/math-dir.lua @@ -105,6 +105,13 @@ local function processmath(head) end elseif not start then -- nothing +if id == hlist_code or id == vlist_code then + local list, d = processmath(getlist(current)) + setfield(current,"list",list) + if d then + done = true + end +end elseif start == stop then start = nil else diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index e7977a307..7f4b0342a 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -46,7 +46,7 @@ local unset_attribute = nuts.unset_attribute local first_glyph = nuts.first_glyph local copy_node = nuts.copy local copy_node_list = nuts.copy_list -local slide_nodes = nuts.slide +local find_tail = nuts.tail local insert_node_after = nuts.insert_after local isnode = nuts.is_node @@ -374,7 +374,7 @@ end -- end -- elseif not head then -- head = n --- tail = slide_nodes(n) +-- tail = find_tail(n) -- elseif getid(n) == attributelist_code then -- -- weird case -- report_error("weird node type in list at index %s:",i) @@ -387,7 +387,7 @@ end -- setfield(tail,"next",n) -- setfield(n,"prev",tail) -- if getnext(n) then --- tail = slide_nodes(n) +-- tail = find_tail(n) -- else -- tail = n -- end @@ -429,7 +429,7 @@ local function link(list,currentfont,currentattr,head,tail) -- an oldie, might b end elseif not head then head = n - tail = slide_nodes(n) + tail = find_tail(n) elseif getid(n) == attributelist_code then -- weird case report_error("weird node type in list at index %s:",i) @@ -442,7 +442,7 @@ local function link(list,currentfont,currentattr,head,tail) -- an oldie, might b setfield(tail,"next",n) setfield(n,"prev",tail) if getnext(n) then - tail = slide_nodes(n) + tail = find_tail(n) else tail = n end diff --git a/tex/context/base/node-fin.lua b/tex/context/base/node-fin.lua index 0d095cbde..8476b47a6 100644 --- a/tex/context/base/node-fin.lua +++ b/tex/context/base/node-fin.lua @@ -31,7 +31,6 @@ local setfield = nuts.setfield local setattr = nuts.setattr local copy_node = nuts.copy -local find_tail = nuts.slide local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after diff --git a/tex/context/base/node-ltp.lua b/tex/context/base/node-ltp.lua index 2ccb47f16..9f2491cfa 100644 --- a/tex/context/base/node-ltp.lua +++ b/tex/context/base/node-ltp.lua @@ -202,13 +202,13 @@ local getfont = nuts.getfont local getchar = nuts.getchar local getattr = nuts.getattr -local slide_nodes = nuts.slide +local slide_nodelist = nuts.slide -- get rid of this, probably ok > 78.2 local find_tail = nuts.tail local new_node = nuts.new local copy_node = nuts.copy -local copy_node_list = nuts.copy_list +local copy_nodelist = nuts.copy_list local flush_node = nuts.free -local flush_node_list = nuts.flush_list +local flush_nodelist = nuts.flush_list local hpack_nodes = nuts.hpack local xpack_nodes = nuts.hpack local replace_node = nuts.replace @@ -824,7 +824,7 @@ local function append_to_vlist(par, b) -- end local head_field = par.head_field if head_field then - local n = slide_nodes(head_field) + local n = slide_nodelist(head_field) -- todo: find_tail setfield(n,"next",s) setfield(s,"prev",n) else @@ -834,7 +834,7 @@ local function append_to_vlist(par, b) end local head_field = par.head_field if head_field then - local n = slide_nodes(head_field) + local n = slide_nodelist(head_field) -- todo: find_tail setfield(n,"next",b) setfield(b,"prev",n) else @@ -850,7 +850,7 @@ end local function append_list(par, b) local head_field = par.head_field if head_field then - local n = slide_nodes(head_field) + local n = slide_nodelist(head_field) -- todo: find_tail setfield(n,"next",b) setfield(b,"prev",n) else @@ -956,7 +956,7 @@ local function initialize_line_break(head,display) prev_depth = texnest[texnest.ptr].prevdepth, - final_par_glue = slide_nodes(head), -- todo: we know tail already, slow + final_par_glue = slide_nodelist(head), -- todo: we know tail already, slow par_break_dir = tex.pardir, line_break_dir = tex.pardir, @@ -1189,7 +1189,7 @@ local function post_line_break(par) if not lastnode then -- only at the end - lastnode = slide_nodes(head) + lastnode = slide_nodelist(head) -- todo: find_tail if lastnode == par.final_par_glue then lineend = lastnode lastnode = getprev(lastnode) @@ -1214,7 +1214,7 @@ local function post_line_break(par) report_parbuilders('unsupported disc at location %a',3) end if pre then - flush_node_list(pre) + flush_nodelist(pre) setfield(lastnode,"pre",nil) pre = nil -- signal end @@ -1231,15 +1231,15 @@ local function post_line_break(par) local post = getfield(prevlast,"post") local replace = getfield(prevlast,"replace") if pre then - flush_node_list(pre) + flush_nodelist(pre) setfield(prevlast,"pre",nil) end if replace then - flush_node_list(replace) + flush_nodelist(replace) setfield(prevlast,"replace",nil) end if post then - flush_node_list(post) + flush_nodelist(post) setfield(prevlast,"post",nil) end elseif subtype == first_disc_code then @@ -1252,7 +1252,7 @@ local function post_line_break(par) end if replace then setfield(lastnode,"replace",nil) -- free - flush_node_list(replace) + flush_nodelist(replace) end if pre then local n = find_tail(pre) @@ -1447,7 +1447,7 @@ local function post_line_break(par) end if current ~= head then setfield(current,"next",nil) - flush_node_list(getnext(head)) + flush_nodelist(getnext(head)) setfield(head,"next",next) if next then setfield(next,"prev",head) @@ -2815,8 +2815,8 @@ local function hpack(head,width,method,direction,firstline,line) -- fast version local adjust_head = texlists.adjust_head local pre_adjust_head = texlists.pre_adjust_head - local adjust_tail = adjust_head and slide_nodes(adjust_head) - local pre_adjust_tail = pre_adjust_head and slide_nodes(pre_adjust_head) + local adjust_tail = adjust_head and slide_nodelist(adjust_head) -- todo: find_tail + local pre_adjust_tail = pre_adjust_head and slide_nodelist(pre_adjust_head) -- todo: find_tail new_dir_stack(hpack_dir) @@ -2969,7 +2969,7 @@ local function hpack(head,width,method,direction,firstline,line) -- fast version else adjust_head = list end - adjust_tail = slide_nodes(list) -- find_tail(list) + adjust_tail = slide_nodelist(list) -- find_tail(list) elseif id == whatsit_code then local subtype = getsubtype(current) if subtype == dir_code then @@ -3137,7 +3137,7 @@ local function hpack(head,width,method,direction,firstline,line) -- fast version local overfullrule = tex.overfullrule if fuzz > hfuzz and overfullrule > 0 then -- weird, is always called and no rules shows up - setfield(slide_nodes(list),"next",new_rule(overfullrule,nil,nil,hlist.dir)) + setfield(slide_nodelist(list),"next",new_rule(overfullrule,nil,nil,hlist.dir)) -- todo: find_tail end diagnostics.overfull_hbox(hlist,line,-delta) end diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua index 33116d1b1..4732b09eb 100644 --- a/tex/context/base/node-nut.lua +++ b/tex/context/base/node-nut.lua @@ -101,6 +101,10 @@ end local texget = tex.get +local nodecodes = nodes.nodecodes +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist + local nuts = nodes.nuts or { } nodes.nuts = nuts @@ -233,6 +237,7 @@ local d_insert_after = direct.insert_after local d_insert_before = direct.insert_before local d_slide = direct.slide local d_copy_node = direct.copy +local d_traverse = direct.traverse local function remove(head,current,free_too) local t = current @@ -532,3 +537,114 @@ function nuts.insert_list_after(h,c,n) end return n, t end + +-- test code only + +-- collectranges and mix + +local report = logs.reporter("sliding") + +local function message(detail,head,current,previous) + report("error: %s, current: %s:%s, previous: %s:%s, list: %s, text: %s", + detail, + nodecodes[d_getid(current)], + current, + nodecodes[d_getid(previous)], + previous, + nodes.idstostring(head), + nodes.listtoutf(head) + ) + utilities.debugger.showtraceback(report) +end + +local function warn() + report() + report("warning: the slide tracer is enabled") + report() + warn = false +end + +local function tracedslide(head) + if head then + if warn then + warn() + end + local next = d_getnext(head) + if next then + local prev = head + for n in d_traverse(next) do + local p = d_getprev(n) + if not p then + message("unset",head,n,prev) + -- break + elseif p ~= prev then + message("wrong",head,n,prev) + -- break + end + prev = n + end + end + return d_slide(head) + end +end + +local function nestedtracedslide(head,level) -- no sliding ! + if head then + if warn then + warn() + end + local id = d_getid(head) + local next = d_getnext(head) + if next then + report("%whead:%s",level or 0,nodecodes[id]) + local prev = head + for n in d_traverse(next) do + local p = d_getprev(n) + if not p then + message("unset",head,n,prev) + -- break + elseif p ~= prev then + message("wrong",head,n,prev) + -- break + end + prev = n + local id = d_getid(n) + if id == hlist_code or id == vlist_code then + nestedtracedslide(d_getlist(n),(level or 0) + 1) + end + end + elseif id == hlist_code or id == vlist_code then + report("%wlist:%s",level or 0,nodecodes[id]) + nestedtracedslide(d_getlist(head),(level or 0) + 1) + end + -- return d_slide(head) + end +end + +local function untracedslide(head) + if head then + if warn then + warn() + end + local next = d_getnext(head) + if next then + local prev = head + for n in d_traverse(next) do + local p = d_getprev(n) + if not p then + return "unset", d_getid(n) + elseif p ~= prev then + return "wrong", d_getid(n) + end + prev = n + end + end + return d_slide(head) + end +end + +nuts.tracedslide = tracedslide +nuts.untracedslide = untracedslide +nuts.nestedtracedslide = nestedtracedslide + +-- nuts.slide = tracedslide diff --git a/tex/context/base/page-mak.mkvi b/tex/context/base/page-mak.mkvi index 17269b174..c910f281d 100644 --- a/tex/context/base/page-mak.mkvi +++ b/tex/context/base/page-mak.mkvi @@ -91,10 +91,32 @@ \def\page_makeup_start_yes[#name]% [#settings]% {\doifelsecommandhandler\??makeup{#name}\page_makeup_start_indeed\page_makeup_start_nop[#name]}% +% case 1: +% +% \setuplayout[height=5cm] +% +% case 2: +% +% \definelayout[crap][height=10cm] +% \definelayout[standard][crap] +% +% case 3: +% +% \setuplayout[standard][height=15cm] +% +% case 4: +% +% \definelayout[whatever][height=2cm] +% \setuplayout[whatever] + \def\page_makeup_start_indeed[#name][#settings]% {% the next grouping hack is somewhat messy: \begingroup - \edef\currentmakeup{#name}% + % we need to figure out the current layout + \xdef\m_page_makeup_name{#name}% + \let\currentmakeup\m_page_makeup_name + \let\currentlayout\m_page_makeup_name + \xdef\m_page_makeup_layout_parent{\layoutparameter\s!parent}% \setupcurrentmakeup[#settings]% \edef\p_page{\makeupparameter\c!page}% \ifx\p_page\empty @@ -107,9 +129,22 @@ \endgroup \page[\p_page]% \fi\fi + % some dirty trickery (sorry) for determining if we have + % - a layout definition at all + % - inherit from the parent of that definition + % - inherit from the current layout otherwise + \ifx\m_page_makeup_name\currentlayout + % we already use the layout + \else\ifx\m_page_makeup_layout_parent\??layout + % we inherit from the current layout + \normalexpanded{\setuplayout[#name][\s!parent=\??layout\currentlayout]}% is remembered but checked later anyway + % \else + % we have an inherited layout + \fi\fi \startlayout[#name]% includes \page \bgroup - \edef\currentmakeup{#name}% + %\edef\currentmakeup{#name}% + \let\currentmakeup\m_page_makeup_name \setupcurrentmakeup[#settings]% \setsystemmode\v!makeup \the\t_page_makeup_every_setup @@ -149,7 +184,12 @@ \fi \fi \strc_pagenumbers_page_state_pop % new \egroup - \stoplayout} % includes \page + \stoplayout % includes \page + \ifx\m_page_makeup_name\currentlayout + \else\ifx\m_page_makeup_layout_parent\??layout + \normalexpanded{\setuplayout[\m_page_makeup_name][\s!parent=\??layout]}% is remembered but checked later anyway + % \else + \fi\fi} \setvalue{\??makeupdoublesided\v!yes}% {\emptyhbox diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 5b6ff2b74..30a1fdccd 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -46,7 +46,7 @@ local hpack = nuts.hpack local vpack = nuts.vpack local freenode = nuts.free local concatnodes = nuts.concat -local slidenodes = nuts.slide +local slidenodes = nuts.slide -- ok here as we mess with prev links intermediately local traversenodes = nuts.traverse local getfield = nuts.getfield @@ -89,19 +89,6 @@ local mixedcolumns = pagebuilders.mixedcolumns local a_checkedbreak = attributes.private("checkedbreak") local forcedbreak = -123 --- local function slidenodes(head) --- local last = nil --- for current in traversenodes(head) do --- local prev = getprev(current) --- if not prev and last then --- logs.report("slide","setting prev of %a",nodecodes[getid(current)]) --- setfield(current,"prev",last) --- end --- last = current --- end --- return last or head --- end - -- initializesplitter(specification) -- cleanupsplitter() diff --git a/tex/context/base/page-str.lua b/tex/context/base/page-str.lua index 35ce85609..f2ac27cd9 100644 --- a/tex/context/base/page-str.lua +++ b/tex/context/base/page-str.lua @@ -20,7 +20,7 @@ local tasks = nodes.tasks local new_kern = nodepool.kern local new_glyph = nodepool.glyph -local find_tail = node.slide +local slide_nodelist = node.slide local write_node = node.write local free_node = node.free local copy_nodelist = node.copy_list @@ -73,7 +73,7 @@ function streams.collect(head,where) end local last = dana[#dana] if last then - local tail = find_tail(last) + local tail = slide_nodelist(last) tail.next, head.prev = head, tail elseif last == false then dana[#dana] = head @@ -202,7 +202,7 @@ function streams.synchronize(list) -- this is an experiment ! else -- this is not yet ok as we also need to keep an eye on vertical spacing -- so we might need to do some splitting or whatever - local tail = vbox.list and find_tail(vbox.list) + local tail = vbox.list and slide_nodelist(vbox.list) local n, delta = 0, delta_height -- for tracing while delta > 0 do -- we need to add some interline penalties diff --git a/tex/context/base/s-languages-hyphenation.lua b/tex/context/base/s-languages-hyphenation.lua index 660392f80..c16c5bd2d 100644 --- a/tex/context/base/s-languages-hyphenation.lua +++ b/tex/context/base/s-languages-hyphenation.lua @@ -24,7 +24,7 @@ local newglue = nodepool.glue local insert_node_after = node.insert_after local traverse_by_id = node.traverse_id local hyphenate = lang.hyphenate -local find_tail = node.slide +local find_tail = node.tail local remove_node = nodes.remove local tracers = nodes.tracers diff --git a/tex/context/base/spac-ali.lua b/tex/context/base/spac-ali.lua index eb93458e0..08e33c5b8 100644 --- a/tex/context/base/spac-ali.lua +++ b/tex/context/base/spac-ali.lua @@ -28,7 +28,6 @@ local getattr = nuts.getattr local setattr = nuts.setattr local getsubtype = nuts.getsubtype -local slide_nodes = nuts.slide local hpack_nodes = nuts.hpack -- nodes.fasthpack not really faster here local linked_nodes = nuts.linked diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 3050b0acb..299d73213 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex fab84e1ba..e8ef5d9f1 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index cd5efa7f7..82d1be893 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -429,7 +429,8 @@ \aligntab \tabl_tabulate_column_vrule_inject \tabl_tabulate_color_side_left - \tabl_tabulate_inject_pre_skip{\the\s_tabl_tabulate_pre}% +% \tabl_tabulate_inject_pre_skip{\the\s_tabl_tabulate_pre}% + \tabl_tabulate_inject_pre_skip{\the\dimexpr\s_tabl_tabulate_pre}% get rid of plus \alignmark\alignmark \aligntab \tabl_tabulate_color_side_both @@ -496,7 +497,7 @@ \egroup \aligntab \noexpand\dostoptagged - \tabl_tabulate_inject_post_skip{\the\s_tabl_tabulate_post}% + \tabl_tabulate_inject_post_skip{\the\dimexpr\s_tabl_tabulate_post}% get rid of plus \alignmark\alignmark }}% \t_tabl_tabulate_dummy\expandafter{\the\t_tabl_tabulate_dummy\NC}% diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index fcf89a2cd..fa9b0cf10 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -117,8 +117,8 @@ appendaction("vboxbuilders", "normalizers", "builders.vspacing.vboxhandler") -- experimental too -appendaction("mvlbuilders", "normalizers","typesetters.checkers.handler") -appendaction("vboxbuilders","normalizers","typesetters.checkers.handler") +appendaction("mvlbuilders", "normalizers", "typesetters.checkers.handler") +appendaction("vboxbuilders", "normalizers", "typesetters.checkers.handler") -- speedup: only kick in when used diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua index 802f2e667..067cff27c 100644 --- a/tex/context/base/trac-inf.lua +++ b/tex/context/base/trac-inf.lua @@ -123,7 +123,10 @@ function statistics.show() -- this code will move local register = statistics.register register("used platform", function() - return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown", environment.texos or "unknown") + local mask = lua.mask or "ascii" + return format("%s, type: %s, binary subtree: %s, symbol mask: %s (%s)", + os.platform or "unknown",os.type or "unknown", environment.texos or "unknown", + mask,mask == "utf" and "τεχ" or "tex") end) register("luatex banner", function() return lower(status.banner) diff --git a/tex/context/base/trac-pro.lua b/tex/context/base/trac-pro.lua index d6e0d0339..897b6a15c 100644 --- a/tex/context/base/trac-pro.lua +++ b/tex/context/base/trac-pro.lua @@ -26,7 +26,8 @@ local registered = { } local function report_index(k,name) if trace_namespaces then - report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("reference to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("reference to %a in protected namespace %a",k,name) end @@ -34,7 +35,8 @@ end local function report_newindex(k,name) if trace_namespaces then - report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback()) + report_system("assignment to %a in protected namespace %a: %s",k,name) + debugger.showtraceback(report_system) else report_system("assignment to %a in protected namespace %a",k,name) end diff --git a/tex/context/base/typo-bld.lua b/tex/context/base/typo-bld.lua index b5668d362..ad37c36f4 100644 --- a/tex/context/base/typo-bld.lua +++ b/tex/context/base/typo-bld.lua @@ -229,7 +229,16 @@ local function report(groupcode,head) report_page_builder(" list : %s",head and nodeidstostring(head) or "<empty>") end +-- use tex.[sg]etlist + function builders.buildpage_filter(groupcode) + -- -- this needs checking .. gets called too often + -- if group_code ~= "after_output" then + -- if trace_page_builder then + -- report(groupcode) + -- end + -- return nil, false + -- end local head, done = texlists.contrib_head, false if head then starttiming(builders) @@ -241,13 +250,15 @@ function builders.buildpage_filter(groupcode) -- -- doesn't work here (not passed on?) -- tex.pagegoal = tex.vsize - tex.dimen.d_page_floats_inserted_top - tex.dimen.d_page_floats_inserted_bottom texlists.contrib_head = head or nil -- needs checking - return done and head or true +-- tex.setlist("contrib_head",head,head and nodes.tail(head)) + return done and head or true -- no return value needed else if trace_page_builder then report(groupcode) end - return nil, false + return nil, false -- no return value needed end + end callbacks.register('vpack_filter', builders.vpack_filter, "vertical spacing etc") diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 7c03bf0a9..4bfc107ad 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -122,7 +122,6 @@ local tonode = nuts.tonode local tonut = nuts.tonut local copy_node_list = nuts.copy_list -local slide_nodes = nuts.slide local hpack_nodes = nuts.hpack -- nodes.fasthpack not really faster here local traverse_id = nuts.traverse_id local free_node_list = nuts.flush_list diff --git a/tex/context/base/util-deb.lua b/tex/context/base/util-deb.lua index 785373f86..ee732b3b5 100644 --- a/tex/context/base/util-deb.lua +++ b/tex/context/base/util-deb.lua @@ -92,37 +92,41 @@ end function debugger.disable() debug.sethook() ---~ counters[debug.getinfo(2,"f").func] = nil + -- counters[debug.getinfo(2,"f").func] = nil end ---~ debugger.enable() - ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) ---~ print(math.sin(1*.5)) - ---~ debugger.disable() - ---~ print("") ---~ debugger.showstats() ---~ print("") ---~ debugger.showstats(print,3) - +-- debugger.enable() +-- +-- print(math.sin(1*.5)) +-- print(math.sin(1*.5)) +-- print(math.sin(1*.5)) +-- print(math.sin(1*.5)) +-- print(math.sin(1*.5)) +-- +-- debugger.disable() +-- +-- print("") +-- debugger.showstats() +-- print("") +-- debugger.showstats(print,3) +-- -- from the lua book: -function traceback() - local level = 1 +local function showtraceback(rep) -- from lua site / adapted + local level = 2 -- we don't want this function to be reported + local reporter = rep or report while true do - local info = debug.getinfo(level, "Sl") + local info = getinfo(level, "Sl") if not info then break elseif info.what == "C" then - print(format("%3i : C function",level)) + reporter("%2i : %s",level-1,"C function") else - print(format("%3i : [%s]:%d",level,info.short_src,info.currentline)) + reporter("%2i : %s : %s",level-1,info.short_src,info.currentline) end level = level + 1 end end + +debugger.showtraceback = showtraceback +-- debug.showtraceback = showtraceback diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 8c31750c8..d475be6d7 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 02/07/14 00:57:35 +-- merge date : 02/13/14 11:27:58 do -- begin closure to overcome local limits and interference @@ -82,6 +82,7 @@ function optionalrequire(...) return result end end +lua.mask=load([[τεχ = 1]]) and "utf" or "ascii" end -- closure @@ -172,9 +173,11 @@ patterns.spacer=spacer patterns.whitespace=whitespace patterns.nonspacer=nonspacer patterns.nonwhitespace=nonwhitespace -local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) +local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) patterns.stripper=stripper +patterns.fullstripper=fullstripper patterns.collapser=collapser patterns.lowercase=lowercase patterns.uppercase=uppercase @@ -754,11 +757,15 @@ function string.limit(str,n,sentinel) end end local stripper=patterns.stripper +local fullstripper=patterns.fullstripper local collapser=patterns.collapser local longtostring=patterns.longtostring function string.strip(str) return lpegmatch(stripper,str) or "" end +function string.fullstrip(str) + return lpegmatch(fullstripper,str) or "" +end function string.collapsespaces(str) return lpegmatch(collapser,str) or "" end |