diff options
118 files changed, 670 insertions, 490 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 504db3377..452e828fe 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 ce676e1f8..30eb57de0 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 66ccb3842..1ebc5d003 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 05bdf89fd..deeaaa96e 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 e9a363f49..b0dc5fb85 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-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex af0e3b092..ef5f0744a 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 d9ebcff66..5e394010c 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index 60fc97ec6..5e8cfa8f7 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -1627,8 +1627,7 @@ node.setglue(<node> n) node.setglue(<node> n,width,stretch,shrink,stretch_order,shrink_order) \stopfunctioncall -When you pass values, only arguments that are numbers -are assigned so +When you pass values, only arguments that are numbers are assigned so \starttyping node.setglue(n,655360,false,65536) @@ -1636,6 +1635,8 @@ node.setglue(n,655360,false,65536) will only adapt the width and shrink. +When a list node is passed, you set the glue, order and sign instead. + \subsubsection{\type {node.getglue}} The next call will return 5 values (or northing when no glue is passed). @@ -1648,6 +1649,9 @@ The next call will return 5 values (or northing when no glue is passed). When the second argument is false, only the width is returned (this is consistent with \type {tex.get}). +When a list node is passed, you get back the glue that is set, the order of that +glue and the sign. + \subsubsection{\type {node.is_zero_glue}} This function returns \type {true} when the width, stretch and shrink properties diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 02447ad3a..34d0ecde4 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -766,7 +766,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 37748, stripped down to: 20111 +-- original size: 37804, stripped down to: 20128 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -775,7 +775,8 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -lpeg=require("lpeg") +lpeg=require("lpeg") +local lpeg=lpeg if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format @@ -1699,7 +1700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39726, stripped down to: 23243 +-- original size: 39674, stripped down to: 23227 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1708,7 +1709,7 @@ if not modules then modules={} end modules ['l-table']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring,tonumber,ipairs,select=type,next,tostring,tonumber,ipairs,select +local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select local table,string=table,string local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove local format,lower,dump=string.format,string.lower,string.dump @@ -2010,7 +2011,7 @@ function table.tohash(t,value) local h={} if t then if value==nil then value=true end - for _,v in next,t do + for _,v in next,t do h[v]=value end end @@ -2018,7 +2019,7 @@ function table.tohash(t,value) end function table.fromhash(t) local hsh,h={},0 - for k,v in next,t do + for k,v in next,t do if v then h=h+1 hsh[h]=k @@ -8474,7 +8475,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-set"] = package.loaded["trac-set"] or true --- original size: 12898, stripped down to: 9156 +-- original size: 12918, stripped down to: 9174 if not modules then modules={} end modules ['trac-set']={ version=1.001, @@ -8483,7 +8484,7 @@ if not modules then modules={} end modules ['trac-set']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring=type,next,tostring +local type,next,tostring,tonumber=type,next,tostring,tonumber local concat=table.concat local format,find,lower,gsub,topattern=string.format,string.find,string.lower,string.gsub,string.topattern local is_boolean=string.is_boolean @@ -14107,7 +14108,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true --- original size: 3684, stripped down to: 1957 +-- original size: 3574, stripped down to: 1863 if not modules then modules={} end modules ['lxml-mis']={ version=1.001, @@ -14117,8 +14118,8 @@ if not modules then modules={} end modules ['lxml-mis']={ license="see context related readme files" } local xml,lpeg,string=xml,lpeg,string +local type=type local concat=table.concat -local type,next,tonumber,tostring,setmetatable,loadstring=type,next,tonumber,tostring,setmetatable,loadstring local format,gsub,match=string.format,string.gsub,string.match local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,Cc,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.Cc,lpeg.Cs @@ -14176,7 +14177,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 30085, stripped down to: 21385 +-- original size: 30075, stripped down to: 21379 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -14196,7 +14197,7 @@ local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip local utfbyte=utf.byte -local lpegmatch=lpeg.match +local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local striplinepatterns=utilities.strings.striplinepatterns local function report(what,pattern,c,e) report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) @@ -14627,13 +14628,12 @@ end function xml.badinclusions(e,sorted) return getinclusions("badinclusions",e,sorted) end -local b_collapser=lpeg.patterns.b_collapser -local m_collapser=lpeg.patterns.m_collapser -local e_collapser=lpeg.patterns.e_collapser -local b_stripper=lpeg.patterns.b_stripper -local m_stripper=lpeg.patterns.m_stripper -local e_stripper=lpeg.patterns.e_stripper -local lpegmatch=lpeg.match +local b_collapser=lpegpatterns.b_collapser +local m_collapser=lpegpatterns.m_collapser +local e_collapser=lpegpatterns.e_collapser +local b_stripper=lpegpatterns.b_stripper +local m_stripper=lpegpatterns.m_stripper +local e_stripper=lpegpatterns.e_stripper local function stripelement(e,nolines,anywhere) local edt=e.dt if edt then @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10274, stripped down to: 7538 +-- original size: 10300, stripped down to: 7562 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15062,6 +15062,7 @@ if not modules then modules={} end modules ['lxml-xml']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local tonumber=tonumber local concat=table.concat local find,lower,upper=string.find,string.lower,string.upper local xml=xml @@ -19545,7 +19546,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-sch"] = package.loaded["data-sch"] or true --- original size: 6653, stripped down to: 5467 +-- original size: 6673, stripped down to: 5485 if not modules then modules={} end modules ['data-sch']={ version=1.001, @@ -19554,7 +19555,7 @@ if not modules then modules={} end modules ['data-sch']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local load=load +local load,tonumber=load,tonumber local gsub,concat,format=string.gsub,table.concat,string.format local finders,openers,loaders=resolvers.finders,resolvers.openers,resolvers.loaders local trace_schemes=false trackers.register("resolvers.schemes",function(v) trace_schemes=v end) @@ -20631,8 +20632,8 @@ end -- of closure -- used libraries : l-lua.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 : 848598 --- stripped bytes : 306920 +-- original bytes : 848548 +-- stripped bytes : 306909 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 02447ad3a..34d0ecde4 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -766,7 +766,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 37748, stripped down to: 20111 +-- original size: 37804, stripped down to: 20128 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -775,7 +775,8 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -lpeg=require("lpeg") +lpeg=require("lpeg") +local lpeg=lpeg if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format @@ -1699,7 +1700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39726, stripped down to: 23243 +-- original size: 39674, stripped down to: 23227 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1708,7 +1709,7 @@ if not modules then modules={} end modules ['l-table']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring,tonumber,ipairs,select=type,next,tostring,tonumber,ipairs,select +local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select local table,string=table,string local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove local format,lower,dump=string.format,string.lower,string.dump @@ -2010,7 +2011,7 @@ function table.tohash(t,value) local h={} if t then if value==nil then value=true end - for _,v in next,t do + for _,v in next,t do h[v]=value end end @@ -2018,7 +2019,7 @@ function table.tohash(t,value) end function table.fromhash(t) local hsh,h={},0 - for k,v in next,t do + for k,v in next,t do if v then h=h+1 hsh[h]=k @@ -8474,7 +8475,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-set"] = package.loaded["trac-set"] or true --- original size: 12898, stripped down to: 9156 +-- original size: 12918, stripped down to: 9174 if not modules then modules={} end modules ['trac-set']={ version=1.001, @@ -8483,7 +8484,7 @@ if not modules then modules={} end modules ['trac-set']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring=type,next,tostring +local type,next,tostring,tonumber=type,next,tostring,tonumber local concat=table.concat local format,find,lower,gsub,topattern=string.format,string.find,string.lower,string.gsub,string.topattern local is_boolean=string.is_boolean @@ -14107,7 +14108,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true --- original size: 3684, stripped down to: 1957 +-- original size: 3574, stripped down to: 1863 if not modules then modules={} end modules ['lxml-mis']={ version=1.001, @@ -14117,8 +14118,8 @@ if not modules then modules={} end modules ['lxml-mis']={ license="see context related readme files" } local xml,lpeg,string=xml,lpeg,string +local type=type local concat=table.concat -local type,next,tonumber,tostring,setmetatable,loadstring=type,next,tonumber,tostring,setmetatable,loadstring local format,gsub,match=string.format,string.gsub,string.match local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,Cc,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.Cc,lpeg.Cs @@ -14176,7 +14177,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 30085, stripped down to: 21385 +-- original size: 30075, stripped down to: 21379 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -14196,7 +14197,7 @@ local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip local utfbyte=utf.byte -local lpegmatch=lpeg.match +local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local striplinepatterns=utilities.strings.striplinepatterns local function report(what,pattern,c,e) report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) @@ -14627,13 +14628,12 @@ end function xml.badinclusions(e,sorted) return getinclusions("badinclusions",e,sorted) end -local b_collapser=lpeg.patterns.b_collapser -local m_collapser=lpeg.patterns.m_collapser -local e_collapser=lpeg.patterns.e_collapser -local b_stripper=lpeg.patterns.b_stripper -local m_stripper=lpeg.patterns.m_stripper -local e_stripper=lpeg.patterns.e_stripper -local lpegmatch=lpeg.match +local b_collapser=lpegpatterns.b_collapser +local m_collapser=lpegpatterns.m_collapser +local e_collapser=lpegpatterns.e_collapser +local b_stripper=lpegpatterns.b_stripper +local m_stripper=lpegpatterns.m_stripper +local e_stripper=lpegpatterns.e_stripper local function stripelement(e,nolines,anywhere) local edt=e.dt if edt then @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10274, stripped down to: 7538 +-- original size: 10300, stripped down to: 7562 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15062,6 +15062,7 @@ if not modules then modules={} end modules ['lxml-xml']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local tonumber=tonumber local concat=table.concat local find,lower,upper=string.find,string.lower,string.upper local xml=xml @@ -19545,7 +19546,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-sch"] = package.loaded["data-sch"] or true --- original size: 6653, stripped down to: 5467 +-- original size: 6673, stripped down to: 5485 if not modules then modules={} end modules ['data-sch']={ version=1.001, @@ -19554,7 +19555,7 @@ if not modules then modules={} end modules ['data-sch']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local load=load +local load,tonumber=load,tonumber local gsub,concat,format=string.gsub,table.concat,string.format local finders,openers,loaders=resolvers.finders,resolvers.openers,resolvers.loaders local trace_schemes=false trackers.register("resolvers.schemes",function(v) trace_schemes=v end) @@ -20631,8 +20632,8 @@ end -- of closure -- used libraries : l-lua.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 : 848598 --- stripped bytes : 306920 +-- original bytes : 848548 +-- stripped bytes : 306909 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 02447ad3a..34d0ecde4 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -766,7 +766,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 37748, stripped down to: 20111 +-- original size: 37804, stripped down to: 20128 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -775,7 +775,8 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -lpeg=require("lpeg") +lpeg=require("lpeg") +local lpeg=lpeg if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format @@ -1699,7 +1700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39726, stripped down to: 23243 +-- original size: 39674, stripped down to: 23227 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1708,7 +1709,7 @@ if not modules then modules={} end modules ['l-table']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring,tonumber,ipairs,select=type,next,tostring,tonumber,ipairs,select +local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select local table,string=table,string local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove local format,lower,dump=string.format,string.lower,string.dump @@ -2010,7 +2011,7 @@ function table.tohash(t,value) local h={} if t then if value==nil then value=true end - for _,v in next,t do + for _,v in next,t do h[v]=value end end @@ -2018,7 +2019,7 @@ function table.tohash(t,value) end function table.fromhash(t) local hsh,h={},0 - for k,v in next,t do + for k,v in next,t do if v then h=h+1 hsh[h]=k @@ -8474,7 +8475,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-set"] = package.loaded["trac-set"] or true --- original size: 12898, stripped down to: 9156 +-- original size: 12918, stripped down to: 9174 if not modules then modules={} end modules ['trac-set']={ version=1.001, @@ -8483,7 +8484,7 @@ if not modules then modules={} end modules ['trac-set']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring=type,next,tostring +local type,next,tostring,tonumber=type,next,tostring,tonumber local concat=table.concat local format,find,lower,gsub,topattern=string.format,string.find,string.lower,string.gsub,string.topattern local is_boolean=string.is_boolean @@ -14107,7 +14108,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true --- original size: 3684, stripped down to: 1957 +-- original size: 3574, stripped down to: 1863 if not modules then modules={} end modules ['lxml-mis']={ version=1.001, @@ -14117,8 +14118,8 @@ if not modules then modules={} end modules ['lxml-mis']={ license="see context related readme files" } local xml,lpeg,string=xml,lpeg,string +local type=type local concat=table.concat -local type,next,tonumber,tostring,setmetatable,loadstring=type,next,tonumber,tostring,setmetatable,loadstring local format,gsub,match=string.format,string.gsub,string.match local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,Cc,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.Cc,lpeg.Cs @@ -14176,7 +14177,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 30085, stripped down to: 21385 +-- original size: 30075, stripped down to: 21379 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -14196,7 +14197,7 @@ local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip local utfbyte=utf.byte -local lpegmatch=lpeg.match +local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local striplinepatterns=utilities.strings.striplinepatterns local function report(what,pattern,c,e) report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) @@ -14627,13 +14628,12 @@ end function xml.badinclusions(e,sorted) return getinclusions("badinclusions",e,sorted) end -local b_collapser=lpeg.patterns.b_collapser -local m_collapser=lpeg.patterns.m_collapser -local e_collapser=lpeg.patterns.e_collapser -local b_stripper=lpeg.patterns.b_stripper -local m_stripper=lpeg.patterns.m_stripper -local e_stripper=lpeg.patterns.e_stripper -local lpegmatch=lpeg.match +local b_collapser=lpegpatterns.b_collapser +local m_collapser=lpegpatterns.m_collapser +local e_collapser=lpegpatterns.e_collapser +local b_stripper=lpegpatterns.b_stripper +local m_stripper=lpegpatterns.m_stripper +local e_stripper=lpegpatterns.e_stripper local function stripelement(e,nolines,anywhere) local edt=e.dt if edt then @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10274, stripped down to: 7538 +-- original size: 10300, stripped down to: 7562 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15062,6 +15062,7 @@ if not modules then modules={} end modules ['lxml-xml']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local tonumber=tonumber local concat=table.concat local find,lower,upper=string.find,string.lower,string.upper local xml=xml @@ -19545,7 +19546,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-sch"] = package.loaded["data-sch"] or true --- original size: 6653, stripped down to: 5467 +-- original size: 6673, stripped down to: 5485 if not modules then modules={} end modules ['data-sch']={ version=1.001, @@ -19554,7 +19555,7 @@ if not modules then modules={} end modules ['data-sch']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local load=load +local load,tonumber=load,tonumber local gsub,concat,format=string.gsub,table.concat,string.format local finders,openers,loaders=resolvers.finders,resolvers.openers,resolvers.loaders local trace_schemes=false trackers.register("resolvers.schemes",function(v) trace_schemes=v end) @@ -20631,8 +20632,8 @@ end -- of closure -- used libraries : l-lua.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 : 848598 --- stripped bytes : 306920 +-- original bytes : 848548 +-- stripped bytes : 306909 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 02447ad3a..34d0ecde4 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -766,7 +766,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 37748, stripped down to: 20111 +-- original size: 37804, stripped down to: 20128 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -775,7 +775,8 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -lpeg=require("lpeg") +lpeg=require("lpeg") +local lpeg=lpeg if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format @@ -1699,7 +1700,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 39726, stripped down to: 23243 +-- original size: 39674, stripped down to: 23227 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1708,7 +1709,7 @@ if not modules then modules={} end modules ['l-table']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring,tonumber,ipairs,select=type,next,tostring,tonumber,ipairs,select +local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select local table,string=table,string local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove local format,lower,dump=string.format,string.lower,string.dump @@ -2010,7 +2011,7 @@ function table.tohash(t,value) local h={} if t then if value==nil then value=true end - for _,v in next,t do + for _,v in next,t do h[v]=value end end @@ -2018,7 +2019,7 @@ function table.tohash(t,value) end function table.fromhash(t) local hsh,h={},0 - for k,v in next,t do + for k,v in next,t do if v then h=h+1 hsh[h]=k @@ -8474,7 +8475,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-set"] = package.loaded["trac-set"] or true --- original size: 12898, stripped down to: 9156 +-- original size: 12918, stripped down to: 9174 if not modules then modules={} end modules ['trac-set']={ version=1.001, @@ -8483,7 +8484,7 @@ if not modules then modules={} end modules ['trac-set']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring=type,next,tostring +local type,next,tostring,tonumber=type,next,tostring,tonumber local concat=table.concat local format,find,lower,gsub,topattern=string.format,string.find,string.lower,string.gsub,string.topattern local is_boolean=string.is_boolean @@ -14107,7 +14108,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-mis"] = package.loaded["lxml-mis"] or true --- original size: 3684, stripped down to: 1957 +-- original size: 3574, stripped down to: 1863 if not modules then modules={} end modules ['lxml-mis']={ version=1.001, @@ -14117,8 +14118,8 @@ if not modules then modules={} end modules ['lxml-mis']={ license="see context related readme files" } local xml,lpeg,string=xml,lpeg,string +local type=type local concat=table.concat -local type,next,tonumber,tostring,setmetatable,loadstring=type,next,tonumber,tostring,setmetatable,loadstring local format,gsub,match=string.format,string.gsub,string.match local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local P,S,R,C,V,Cc,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.Cc,lpeg.Cs @@ -14176,7 +14177,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 30085, stripped down to: 21385 +-- original size: 30075, stripped down to: 21379 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -14196,7 +14197,7 @@ local type,next,setmetatable,getmetatable=type,next,setmetatable,getmetatable local insert,remove,fastcopy,concat=table.insert,table.remove,table.fastcopy,table.concat local gmatch,gsub,format,find,strip=string.gmatch,string.gsub,string.format,string.find,string.strip local utfbyte=utf.byte -local lpegmatch=lpeg.match +local lpegmatch,lpegpatterns=lpeg.match,lpeg.patterns local striplinepatterns=utilities.strings.striplinepatterns local function report(what,pattern,c,e) report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) @@ -14627,13 +14628,12 @@ end function xml.badinclusions(e,sorted) return getinclusions("badinclusions",e,sorted) end -local b_collapser=lpeg.patterns.b_collapser -local m_collapser=lpeg.patterns.m_collapser -local e_collapser=lpeg.patterns.e_collapser -local b_stripper=lpeg.patterns.b_stripper -local m_stripper=lpeg.patterns.m_stripper -local e_stripper=lpeg.patterns.e_stripper -local lpegmatch=lpeg.match +local b_collapser=lpegpatterns.b_collapser +local m_collapser=lpegpatterns.m_collapser +local e_collapser=lpegpatterns.e_collapser +local b_stripper=lpegpatterns.b_stripper +local m_stripper=lpegpatterns.m_stripper +local e_stripper=lpegpatterns.e_stripper local function stripelement(e,nolines,anywhere) local edt=e.dt if edt then @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10274, stripped down to: 7538 +-- original size: 10300, stripped down to: 7562 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15062,6 +15062,7 @@ if not modules then modules={} end modules ['lxml-xml']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +local tonumber=tonumber local concat=table.concat local find,lower,upper=string.find,string.lower,string.upper local xml=xml @@ -19545,7 +19546,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-sch"] = package.loaded["data-sch"] or true --- original size: 6653, stripped down to: 5467 +-- original size: 6673, stripped down to: 5485 if not modules then modules={} end modules ['data-sch']={ version=1.001, @@ -19554,7 +19555,7 @@ if not modules then modules={} end modules ['data-sch']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local load=load +local load,tonumber=load,tonumber local gsub,concat,format=string.gsub,table.concat,string.format local finders,openers,loaders=resolvers.finders,resolvers.openers,resolvers.loaders local trace_schemes=false trackers.register("resolvers.schemes",function(v) trace_schemes=v end) @@ -20631,8 +20632,8 @@ end -- of closure -- used libraries : l-lua.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 : 848598 --- stripped bytes : 306920 +-- original bytes : 848548 +-- stripped bytes : 306909 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index e16fe93de..9acd3d260 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{2017.07.30 19:30} +\newcontextversion{2017.08.01 18:10} %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 ab6dfc97f..630a19c49 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{2017.07.30 19:30} +\edef\contextversion{2017.08.01 18:10} %D For those who want to use this: diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua index 8a63c5b54..a30dc4497 100644 --- a/tex/context/base/mkiv/anch-pgr.lua +++ b/tex/context/base/mkiv/anch-pgr.lua @@ -16,6 +16,7 @@ if not modules then modules = { } end modules ['anch-pgr'] = { -- been replaced. Background code is still not perfect, but some day ... the details manual -- will discuss this issue. +local tonumber = tonumber local abs, div, floor, round, min, max = math.abs, math.div, math.floor, math.round, math.min, math.max local sort, concat = table.sort, table.concat local splitter = lpeg.splitat(":") diff --git a/tex/context/base/mkiv/back-pdf.lua b/tex/context/base/mkiv/back-pdf.lua index a3f7ffff7..5d93d019e 100644 --- a/tex/context/base/mkiv/back-pdf.lua +++ b/tex/context/base/mkiv/back-pdf.lua @@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['back-pdf'] = { -- we could do \pdfmatrix sx <> sy <> etc -local tonumber = tonumber local sind, cosd = math.sind, math.cosd local insert, remove = table.insert, table.remove diff --git a/tex/context/base/mkiv/buff-par.lua b/tex/context/base/mkiv/buff-par.lua index 9c75b90e7..33ed4baf0 100644 --- a/tex/context/base/mkiv/buff-par.lua +++ b/tex/context/base/mkiv/buff-par.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['buff-par'] = { license = "see context related readme files" } +local tonumber = tonumber local insert, remove, find, gmatch, match = table.insert, table.remove, string.find, string.gmatch, string.match local fullstrip, formatters = string.fullstrip, string.formatters diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv index 27535dba9..ba0591012 100644 --- a/tex/context/base/mkiv/buff-ver.mkiv +++ b/tex/context/base/mkiv/buff-ver.mkiv @@ -41,7 +41,7 @@ \resetcharacterspacing \to \everyinitializeverbatim -\def\setverbatimspaceskip % to be checked: must happen after font switch +\unexpanded\def\setverbatimspaceskip % to be checked: must happen after font switch {\spaceskip\fontcharwd\font`x\relax \xspaceskip\spaceskip} diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua index 3e0d02bc1..4ab906bd5 100644 --- a/tex/context/base/mkiv/char-tex.lua +++ b/tex/context/base/mkiv/char-tex.lua @@ -6,9 +6,8 @@ if not modules then modules = { } end modules ['char-tex'] = { license = "see context related readme files" } - local lpeg = lpeg -local next, type = next, type +local tonumber, next, type = tonumber, next, type local format, find, gmatch = string.format, string.find, string.gmatch local utfchar, utfbyte = utf.char, utf.byte local concat, tohash = table.concat, table.tohash diff --git a/tex/context/base/mkiv/chem-str.lua b/tex/context/base/mkiv/chem-str.lua index a40ca76b0..1ad16564c 100644 --- a/tex/context/base/mkiv/chem-str.lua +++ b/tex/context/base/mkiv/chem-str.lua @@ -32,6 +32,7 @@ local directive_strictindex = false directives.register("chemistry.strictindex" local report_chemistry = logs.reporter("chemistry") +local tonumber = tonumber local format, gmatch, match, lower, gsub = string.format, string.gmatch, string.match, string.lower, string.gsub local concat, insert, remove, unique, sorted = table.concat, table.insert, table.remove, table.unique, table.sorted local processor_tostring = typesetters and typesetters.processors.tostring diff --git a/tex/context/base/mkiv/cldf-bas.lua b/tex/context/base/mkiv/cldf-bas.lua index 2387793c8..070546637 100644 --- a/tex/context/base/mkiv/cldf-bas.lua +++ b/tex/context/base/mkiv/cldf-bas.lua @@ -22,6 +22,7 @@ if not modules then modules = { } end modules ['cldf-bas'] = { -- flush(ctxcatcodes,"}") -- end +local tonumber = tonumber local type = type local format = string.format local utfchar = utf.char diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua index 4a90c5b7e..beeb8c8c9 100644 --- a/tex/context/base/mkiv/cldf-scn.lua +++ b/tex/context/base/mkiv/cldf-scn.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['cldf-scn'] = { license = "see context related readme files" } -local load, type = load, type +local load, type, tostring = load, type, tostring local formatters = string.formatters local char = string.char diff --git a/tex/context/base/mkiv/cldf-stp.lua b/tex/context/base/mkiv/cldf-stp.lua index eeed47594..d548e6ac4 100644 --- a/tex/context/base/mkiv/cldf-stp.lua +++ b/tex/context/base/mkiv/cldf-stp.lua @@ -28,6 +28,8 @@ if not modules then modules = { } end modules ['cldf-stp'] = { -- ... -- end) +local context = context + local create = coroutine.create local yield = coroutine.yield local resume = coroutine.resume diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua index c074d3407..ca00ae72f 100644 --- a/tex/context/base/mkiv/colo-ini.lua +++ b/tex/context/base/mkiv/colo-ini.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['colo-ini'] = { license = "see context related readme files" } -local type, tonumber = type, tonumber +local type, tonumber, tostring = type, tonumber, tostring local concat, insert, remove = table.concat, table.insert, table.remove local format, gmatch, gsub, lower, match, find = string.format, string.gmatch, string.gsub, string.lower, string.match, string.find local P, R, C, Cc = lpeg.P, lpeg.R, lpeg.C, lpeg.Cc diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 8bf5e895c..9db1f59ae 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{2017.07.30 19:30} +\newcontextversion{2017.08.01 18:10} %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 945fb9c27..79d035edf 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.07.30 19:30} +\edef\contextversion{2017.08.01 18:10} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-ctx.lua b/tex/context/base/mkiv/core-ctx.lua index 3362e43b9..1c39b6581 100644 --- a/tex/context/base/mkiv/core-ctx.lua +++ b/tex/context/base/mkiv/core-ctx.lua @@ -33,6 +33,7 @@ millisecond it's not that much of a burden. local trace_prepfiles = false trackers.register("system.prepfiles", function(v) trace_prepfiles = v end) +local tostring = tostring local gsub, find, match, validstring = string.gsub, string.find, string.match, string.valid local concat = table.concat local xmltext = xml.text diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua index a2869e6ea..14a30aaf2 100644 --- a/tex/context/base/mkiv/core-uti.lua +++ b/tex/context/base/mkiv/core-uti.lua @@ -19,7 +19,7 @@ saves much runtime but at the cost of more memory usage.</p> local math = math local format, match = string.format, string.match -local next, type, tostring = next, type, tostring +local next, type, tostring, tonumber = next, type, tostring, tonumber local concat = table.concat local definetable = utilities.tables.definetable diff --git a/tex/context/base/mkiv/data-sch.lua b/tex/context/base/mkiv/data-sch.lua index 23ecdc122..9d36c882a 100644 --- a/tex/context/base/mkiv/data-sch.lua +++ b/tex/context/base/mkiv/data-sch.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['data-sch'] = { license = "see context related readme files" } -local load = load +local load, tonumber = load, tonumber local gsub, concat, format = string.gsub, table.concat, string.format local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders diff --git a/tex/context/base/mkiv/file-job.lua b/tex/context/base/mkiv/file-job.lua index 81f0753a0..2612821be 100644 --- a/tex/context/base/mkiv/file-job.lua +++ b/tex/context/base/mkiv/file-job.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['file-job'] = { -- in retrospect dealing it's not that bad to deal with the nesting -- and push/poppign at the tex end -local rawget = rawget +local rawget, tostring, tonumber = rawget, tostring, tonumber local gsub, match, find = string.gsub, string.match, string.find local insert, remove, concat = table.insert, table.remove, table.concat local validstring, formatters = string.valid, string.formatters diff --git a/tex/context/base/mkiv/file-res.lua b/tex/context/base/mkiv/file-res.lua index 531d365da..cf76d2d8b 100644 --- a/tex/context/base/mkiv/file-res.lua +++ b/tex/context/base/mkiv/file-res.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['file-res'] = { license = "see context related readme files" } +local tonumber = tonumber local format, find = string.format, string.find local isfile = lfs.isfile local is_qualified_path = file.is_qualified_path diff --git a/tex/context/base/mkiv/font-cft.lua b/tex/context/base/mkiv/font-cft.lua index fcc5d7b5a..30221cbaa 100644 --- a/tex/context/base/mkiv/font-cft.lua +++ b/tex/context/base/mkiv/font-cft.lua @@ -20,7 +20,7 @@ if not modules then modules = { } end modules ['font-cft'] = { -- -- Needs to be checked and updated. -local type = type +local type, tonumber = type, tonumber local fonts = fonts or { } local tables = fonts.tables or { } diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua index 3126a8fe8..bb3f3bbd3 100644 --- a/tex/context/base/mkiv/font-chk.lua +++ b/tex/context/base/mkiv/font-chk.lua @@ -11,6 +11,8 @@ if not modules then modules = { } end modules ['font-chk'] = { local next = next +local context = context + local formatters = string.formatters local bpfactor = number.dimenfactors.bp local fastcopy = table.fastcopy diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua index ff49ef854..3cef9fbae 100644 --- a/tex/context/base/mkiv/font-col.lua +++ b/tex/context/base/mkiv/font-col.lua @@ -13,7 +13,7 @@ local context, commands, trackers, logs = context, commands, trackers, logs local node, nodes, fonts, characters = node, nodes, fonts, characters local file, lpeg, table, string = file, lpeg, table, string -local type, next, toboolean = type, next, toboolean +local type, next, tonumber, toboolean = type, next, tonumber, toboolean local gmatch = string.gmatch local fastcopy = table.fastcopy diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 726004bd3..75d6b08a8 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-con'] = { -- some names of table entries will be changed (no _) -local next, tostring, rawget = next, tostring, rawget +local next, tostring, tonumber, rawget = next, tostring, tonumber, rawget local format, match, lower, gsub, find = string.format, string.match, string.lower, string.gsub, string.find local sort, insert, concat = table.sort, table.insert, table.concat local sortedkeys, sortedhash, serialize, fastcopy = table.sortedkeys, table.sortedhash, table.serialize, table.fastcopy diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua index 0df121a31..a4dec4f74 100644 --- a/tex/context/base/mkiv/font-nod.lua +++ b/tex/context/base/mkiv/font-nod.lua @@ -11,7 +11,6 @@ if not modules then modules = { } end modules ['font-nod'] = { might become a runtime module instead. This module will be cleaned up!</p> --ldx]]-- -local tonumber, tostring, rawget = tonumber, tostring, rawget local utfchar = utf.char local concat, fastcopy = table.concat, table.fastcopy local match, rep = string.match, string.rep diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index aca2c62bb..b9671ab18 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-ocl'] = { -- todo : user list of colors -local tostring, next, format = tostring, next, string.format +local tostring, tonumber, next = tostring, tonumber, next local round, max = math.round, math.round local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash local setmetatableindex = table.setmetatableindex diff --git a/tex/context/base/mkiv/font-off.lua b/tex/context/base/mkiv/font-off.lua index b8fadb634..7e509c2c3 100644 --- a/tex/context/base/mkiv/font-off.lua +++ b/tex/context/base/mkiv/font-off.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['font-off'] = { license = "see context related readme files" } +local tonumber = tonumber local lower = string.lower local round = math.round local setmetatableindex = table.setmetatableindex diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index f79e41b22..8f08dc5eb 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -65,7 +65,7 @@ if not modules then modules = { } end modules ['font-otr'] = { -- require("char-ini") -- end -local next, type = next, type +local next, type, tonumber = next, type, tonumber local byte, lower, char, gsub = string.byte, string.lower, string.char, string.gsub local floor, round = math.floor, math.round local P, R, S, C, Cs, Cc, Ct, Carg, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Carg, lpeg.Cmt diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 92c6b96bf..00fd3dc26 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -2914,45 +2914,42 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context last = getnext(last) end n = n + 1 - else - if discfound then - notmatchreplace[discfound] = true - if notmatchpre[discfound] then - goto next - end - else + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpre[discfound] then goto next + else + break end - break + else + goto next end - else - if seq[n][char] then - if n < l then - last = getnext(last) - end - n = n + 1 + elseif seq[n][char] then + if n < l then + last = getnext(last) + end + n = n + 1 + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpre[discfound] then + goto next else - if discfound then - notmatchreplace[discfound] = true - if notmatchpre[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char == false then if discfound then notmatchreplace[discfound] = true if notmatchpre[discfound] then goto next + else + break end else goto next end - break elseif id == disc_code then -- elseif id == disc_code and (not discs or discs[last]) then diskseen = true @@ -2994,8 +2991,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context notmatchreplace[last] = true if notmatchpre[last] then goto next + else + break end - break end end -- why here again @@ -3041,34 +3039,30 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context prev = getprev(prev) end n = n - 1 - else - if discfound then - notmatchreplace[discfound] = true - if notmatchpost[discfound] then - goto next - end - else + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpost[discfound] then goto next + else + break end - break + else + goto next end - else - if seq[n][char] then - if n > 1 then - prev = getprev(prev) - end - n = n - 1 + elseif seq[n][char] then + if n > 1 then + prev = getprev(prev) + end + n = n - 1 + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpost[discfound] then + goto next else - if discfound then - notmatchreplace[discfound] = true - if notmatchpost[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char == false then if discfound then @@ -3095,12 +3089,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context while posttail do if seq[n][getchar(posttail)] then n = n - 1 - if posttail == post then + if posttail == post or n < 1 then break else - if n < 1 then - break - end posttail = getprev(posttail) end else @@ -3119,20 +3110,18 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context while replacetail do if seq[n][getchar(replacetail)] then n = n - 1 - if replacetail == replace then + if replacetail == replace or n < 1 then break else - if n < 1 then - break - end replacetail = getprev(replacetail) end else notmatchreplace[prev] = true if notmatchpost[prev] then goto next + else + break end - break end end end @@ -3194,45 +3183,42 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context current = getnext(current) -- was absent end n = n + 1 - else - if discfound then - notmatchreplace[discfound] = true - if notmatchpre[discfound] then - goto next - end + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpre[discfound] then + break else goto next end - break + else + goto next end - else - if seq[n][char] then - if n < s then -- new test - current = getnext(current) -- was absent - end - n = n + 1 + elseif seq[n][char] then + if n < s then -- new test + current = getnext(current) -- was absent + end + n = n + 1 + elseif discfound then + notmatchreplace[discfound] = true + if notmatchpre[discfound] then + goto next else - if discfound then - notmatchreplace[discfound] = true - if notmatchpre[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char == false then if discfound then notmatchreplace[discfound] = true if notmatchpre[discfound] then goto next + else + break end else goto next end - break elseif id == disc_code then -- elseif id == disc_code and (not discs or discs[current]) then diskseen = true @@ -3248,8 +3234,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context n = n + 1 if n > s then break + else + pre = getnext(pre) end - pre = getnext(pre) else notmatchpre[current] = true break @@ -3268,15 +3255,17 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context n = n + 1 if n > s then break + else + replace = getnext(replace) end - replace = getnext(replace) else notmatchreplace[current] = true -- different than others, needs checking if "not" is okay if not notmatchpre[current] then goto next + else + break end - break end end else @@ -3560,13 +3549,10 @@ local function kernrun(disc,k_run,font,attr,...) done = true end if prev then --- local nest = getprev(pre) setlink(prev,pre) if k_run(prevmarks,"preinjections",pre,font,attr,...) then -- or prev? done = true end --- setprev(pre,nest) --- setnext(prev,disc) setprev(pre) setlink(prev,disc) end @@ -3582,7 +3568,6 @@ local function kernrun(disc,k_run,font,attr,...) done = true end setnext(posttail) --- setprev(next,disc) setlink(disc,next) end end @@ -3592,13 +3577,10 @@ local function kernrun(disc,k_run,font,attr,...) done = true end if prev then --- local nest = getprev(replace) setlink(prev,replace) if k_run(prevmarks,"replaceinjections",replace,font,attr,...) then -- getnext(replace)) done = true end --- setprev(replace,nest) --- setnext(prev,disc) setprev(replace) setlink(prev,disc) end @@ -3608,7 +3590,6 @@ local function kernrun(disc,k_run,font,attr,...) done = true end setnext(replacetail) --- setprev(next,disc) setlink(disc,next) end elseif prev and next then @@ -3698,7 +3679,6 @@ local function testrun(disc,t_run,c_run,...) if d_post > 0 or d_replace > 0 then local d = d_replace > d_post and d_replace or d_post local head = getnext(disc) - -- local tail = disc -- bug local tail = head for i=1,d do tail = getnext(tail) @@ -4657,12 +4637,9 @@ do else start = getnext(start) end - elseif char == false then - -- whatever glyph - start = getnext(start) - elseif id == glue_code then - -- happens often - start = getnext(start) + elseif char == false or id == glue_code then + -- a different font|state or glue (happens often) + start = getnext(start) elseif id == disc_code then if not discs or discs[start] == true then local ok @@ -4733,11 +4710,8 @@ do else start = getnext(start) end - elseif char == false then - -- whatever glyph - start = getnext(start) - elseif id == glue_code then - -- happens often + elseif char == false or id == glue_code then + -- a different font|state or glue (happens often) start = getnext(start) elseif id == disc_code then if not discs or discs[start] == true then @@ -4858,9 +4832,8 @@ do else start = getnext(start) end - elseif char == false then - start = getnext(start) - elseif id == glue_code then + elseif char == false or id == glue_code then + -- a different font|state or glue (happens often) start = getnext(start) elseif id == math_code then start = getnext(end_of_math(start)) diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index d9e367a2b..91906b454 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -415,6 +415,7 @@ \definecolor[trace:m][m=.75,t=.5,a=1] \definecolor[trace:y][y=.75,t=.5,a=1] \definecolor[trace:s][s=.75,t=.5,a=1] +\definecolor[trace:d][s=.25,t=.5,a=1] \definecolor[trace:o][r=1,g=.6,b=.1,t=.5,a=1] \definecolor[trace:dw][s=1] @@ -425,6 +426,7 @@ \definecolor[trace:dm][m=.75,t=.75,a=1] \definecolor[trace:dy][y=.75,t=.75,a=1] \definecolor[trace:ds][s=.75,t=.75,a=1] +\definecolor[trace:dd][s=.25,t=.75,a=1] \definecolor[trace:do][r=1,g=.6,b=.1,t=.75,a=1] \definecolor[font:0] [s=1] diff --git a/tex/context/base/mkiv/font-sol.lua b/tex/context/base/mkiv/font-sol.lua index 4e6604e12..8967d88e6 100644 --- a/tex/context/base/mkiv/font-sol.lua +++ b/tex/context/base/mkiv/font-sol.lua @@ -67,6 +67,7 @@ local getsubtype = nuts.getsubtype local getlist = nuts.getlist local getdir = nuts.getdir local getwidth = nuts.getwidth +local getboxglue = nuts.getboxglue local setattr = nuts.setattr local setlink = nuts.setlink @@ -724,9 +725,7 @@ variants[v_random] = function(words,list,best,width,badness,line,set,listdir) end local function show_quality(current,what,line) - local set = getfield(current,"glue_set") - local sign = getfield(current,"glue_sign") - local order = getfield(current,"glue_order") + local set, order, sign = getboxglue(current) local amount = set * ((sign == 2 and -1) or 1) report_optimizers("line %a, category %a, amount %a, set %a, sign %a, how %a, order %a",line,what,amount,set,sign,how,order) end diff --git a/tex/context/base/mkiv/grph-con.lua b/tex/context/base/mkiv/grph-con.lua index 49b5952df..f106e1036 100644 --- a/tex/context/base/mkiv/grph-con.lua +++ b/tex/context/base/mkiv/grph-con.lua @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['grph-con'] = { local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match +local tonumber = tonumber local longtostring = string.longtostring local formatters = string.formatters local expandfilename = dir.expandname diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 5f2fb88c9..8bf904489 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -40,6 +40,7 @@ run TeX code from within Lua. Some more functionality will move to Lua. -- todo: store loaded pages per pdf file someplace +local tonumber, tostring = tonumber, tostring local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub local longtostring = string.longtostring local contains = table.contains diff --git a/tex/context/base/mkiv/grph-pat.lua b/tex/context/base/mkiv/grph-pat.lua index c5e4b9f64..89b29906d 100644 --- a/tex/context/base/mkiv/grph-pat.lua +++ b/tex/context/base/mkiv/grph-pat.lua @@ -37,7 +37,7 @@ interfaces.implement { if not name or name == "" then return end - nodes.handlers.finalize(box) + nodes.handlers.finalize(box,"object") names[name] = lpdf.registerpattern { number = number, width = specification.width or box.width, diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua index 6d05270a4..1a1bf091f 100644 --- a/tex/context/base/mkiv/grph-rul.lua +++ b/tex/context/base/mkiv/grph-rul.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['grph-rul'] = { license = "see context related readme files" } +local tonumber = tonumber + local attributes = attributes local nodes = nodes local context = context diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index c34ba6ad4..5fef7439d 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -17,7 +17,9 @@ if not modules then modules = { } end modules ['l-lpeg'] = { -- move utf -> l-unicode -- move string -> l-string or keep it here -lpeg = require("lpeg") +lpeg = require("lpeg") -- does lpeg register itself global? + +local lpeg = lpeg -- The latest lpeg doesn't have print any more, and even the new ones are not -- available by default (only when debug mode is enabled), which is a pitty as diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua index 5bfc4bc47..e37c74f8b 100644 --- a/tex/context/base/mkiv/l-table.lua +++ b/tex/context/base/mkiv/l-table.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['l-table'] = { license = "see context related readme files" } -local type, next, tostring, tonumber, ipairs, select = type, next, tostring, tonumber, ipairs, select +local type, next, tostring, tonumber, select = type, next, tostring, tonumber, select local table, string = table, string local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove local format, lower, dump = string.format, string.lower, string.dump @@ -460,7 +460,7 @@ function table.tohash(t,value) local h = { } if t then if value == nil then value = true end - for _, v in next, t do -- no ipairs here + for _, v in next, t do h[v] = value end end @@ -469,7 +469,7 @@ end function table.fromhash(t) local hsh, h = { }, 0 - for k, v in next, t do -- no ipairs here + for k, v in next, t do if v then h = h + 1 hsh[h] = k diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index b1b9e605a..27bd8130e 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -79,6 +79,8 @@ local type, rawset, tonumber, next = type, rawset, tonumber, next local P, R, S, Cg, Cf, Ct, Cc, C, Carg, Cs = lpeg.P, lpeg.R, lpeg.S, lpeg.Cg, lpeg.Cf, lpeg.Ct, lpeg.Cc, lpeg.C, lpeg.Carg, lpeg.Cs local lpegmatch = lpeg.match +local context = context + local concat = table.concat local insert = table.insert local remove = table.remove diff --git a/tex/context/base/mkiv/lang-wrd.lua b/tex/context/base/mkiv/lang-wrd.lua index 2ec5d68eb..236fe89a3 100644 --- a/tex/context/base/mkiv/lang-wrd.lua +++ b/tex/context/base/mkiv/lang-wrd.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['lang-wrd'] = { license = "see context related readme files" } +local tonumber = tonumber local lower = string.lower local utfchar = utf.char local concat, setmetatableindex = table.concat, table.setmetatableindex diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua index bbafb299b..9456e2f08 100644 --- a/tex/context/base/mkiv/lpdf-fld.lua +++ b/tex/context/base/mkiv/lpdf-fld.lua @@ -55,7 +55,7 @@ if not modules then modules = { } end modules ['lpdf-fld'] = { -- for printing especially when highlighting (those colorfull foregrounds) is -- on. -local tostring, next = tostring, next +local tostring, tonumber, next = tostring, tonumber, next local gmatch, lower, format, formatters = string.gmatch, string.lower, string.format, string.formatters local lpegmatch = lpeg.match local bpfactor, todimen = number.dimenfactors.bp, string.todimen diff --git a/tex/context/base/mkiv/lpdf-fmt.lua b/tex/context/base/mkiv/lpdf-fmt.lua index 8bbd3374f..15cff9e4b 100644 --- a/tex/context/base/mkiv/lpdf-fmt.lua +++ b/tex/context/base/mkiv/lpdf-fmt.lua @@ -10,6 +10,7 @@ if not modules then modules = { } end modules ['lpdf-fmt'] = { -- context --directives="backend.format=PDF/X-1a:2001" --trackers=backend.format yourfile +local tonumber = tonumber local lower, gmatch, format, find = string.lower, string.gmatch, string.format, string.find local concat, serialize, sortedhash = table.concat, table.serialize, table.sortedhash diff --git a/tex/context/base/mkiv/lpdf-grp.lua b/tex/context/base/mkiv/lpdf-grp.lua index 1ebc9b23d..9122bd027 100644 --- a/tex/context/base/mkiv/lpdf-grp.lua +++ b/tex/context/base/mkiv/lpdf-grp.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['lpdf-grp'] = { license = "see context related readme files" } -local type = type +local type, tonumber = type, tonumber local formatters, gsub = string.formatters, string.gsub local concat = table.concat local round = math.round diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index c5480d548..cdac18a25 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -24,6 +24,8 @@ local report_blocked = logs.reporter("backend","blocked") local implement = interfaces.implement local two_strings = interfaces.strings[2] +local context = context + -- In ConTeXt MkIV we use utf8 exclusively so all strings get mapped onto a hex -- encoded utf16 string type between <>. We could probably save some bytes by using -- strings between () but then we end up with escaped ()\ too. diff --git a/tex/context/base/mkiv/lpdf-mov.lua b/tex/context/base/mkiv/lpdf-mov.lua index 87375e4ce..f28a47511 100644 --- a/tex/context/base/mkiv/lpdf-mov.lua +++ b/tex/context/base/mkiv/lpdf-mov.lua @@ -8,7 +8,8 @@ if not modules then modules = { } end modules ['lpdf-mov'] = { local format = string.format -local lpdf = lpdf +local lpdf = lpdf +local context = context local nodeinjections = backends.pdf.nodeinjections local pdfconstant = lpdf.constant diff --git a/tex/context/base/mkiv/lpdf-res.lua b/tex/context/base/mkiv/lpdf-res.lua index ac9478488..8a8f2b17b 100644 --- a/tex/context/base/mkiv/lpdf-res.lua +++ b/tex/context/base/mkiv/lpdf-res.lua @@ -22,7 +22,8 @@ local useboxresource = tex.useboxresource local getboxresource = tex.getboxresourcedimensions function codeinjections.registerboxresource(n) - return saveboxresource(n,nil,lpdf.collectedresources(),true) -- direct, todo: accept functions as attr/resources + local r = saveboxresource(n,nil,lpdf.collectedresources(),true) -- direct, todo: accept functions as attr/resources + return r end function codeinjections.restoreboxresource(index) diff --git a/tex/context/base/mkiv/lpdf-swf.lua b/tex/context/base/mkiv/lpdf-swf.lua index e40dc6378..751f9eab5 100644 --- a/tex/context/base/mkiv/lpdf-swf.lua +++ b/tex/context/base/mkiv/lpdf-swf.lua @@ -11,7 +11,9 @@ if not modules then modules = { } end modules ['lpdf-swf'] = { local format, gsub = string.format, string.gsub -local backends, lpdf = backends, lpdf +local backends = backends +local lpdf = lpdf +local context = context local pdfconstant = lpdf.constant local pdfstring = lpdf.string diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index fceae49cb..64cf1c3dc 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { license = "see context related readme files" } +local tonumber = tonumber local gmatch, gsub, find, lower, format = string.gmatch, string.gsub, string.find, string.lower, string.format local stripstring = string.strip local settings_to_array = utilities.parsers.settings_to_array diff --git a/tex/context/base/mkiv/lxml-aux.lua b/tex/context/base/mkiv/lxml-aux.lua index 3c0121448..59760cb94 100644 --- a/tex/context/base/mkiv/lxml-aux.lua +++ b/tex/context/base/mkiv/lxml-aux.lua @@ -24,7 +24,7 @@ local type, next, setmetatable, getmetatable = type, next, setmetatable, getmeta local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip local utfbyte = utf.byte -local lpegmatch = lpeg.match +local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local striplinepatterns = utilities.strings.striplinepatterns local function report(what,pattern,c,e) @@ -509,15 +509,13 @@ function xml.badinclusions(e,sorted) return getinclusions("badinclusions",e,sorted) end -local b_collapser = lpeg.patterns.b_collapser -local m_collapser = lpeg.patterns.m_collapser -local e_collapser = lpeg.patterns.e_collapser +local b_collapser = lpegpatterns.b_collapser +local m_collapser = lpegpatterns.m_collapser +local e_collapser = lpegpatterns.e_collapser -local b_stripper = lpeg.patterns.b_stripper -local m_stripper = lpeg.patterns.m_stripper -local e_stripper = lpeg.patterns.e_stripper - -local lpegmatch = lpeg.match +local b_stripper = lpegpatterns.b_stripper +local m_stripper = lpegpatterns.m_stripper +local e_stripper = lpegpatterns.e_stripper local function stripelement(e,nolines,anywhere) local edt = e.dt diff --git a/tex/context/base/mkiv/lxml-ent.lua b/tex/context/base/mkiv/lxml-ent.lua index 93f48046b..df80a7985 100644 --- a/tex/context/base/mkiv/lxml-ent.lua +++ b/tex/context/base/mkiv/lxml-ent.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['lxml-ent'] = { license = "see context related readme files" } -local type, next, tonumber = type, next, tonumber +local next = next local byte, format = string.byte, string.format local setmetatableindex = table.setmetatableindex diff --git a/tex/context/base/mkiv/lxml-inf.lua b/tex/context/base/mkiv/lxml-inf.lua index 8f1157c7d..8d99d6270 100644 --- a/tex/context/base/mkiv/lxml-inf.lua +++ b/tex/context/base/mkiv/lxml-inf.lua @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['lxml-inf'] = { -- This file will be loaded runtime by x-pending.tex. +local next, tostring, type = next, tostring, type local concat = table.concat local xmlwithelements = xml.withelements diff --git a/tex/context/base/mkiv/lxml-mis.lua b/tex/context/base/mkiv/lxml-mis.lua index 94a26b974..04ba7b35c 100644 --- a/tex/context/base/mkiv/lxml-mis.lua +++ b/tex/context/base/mkiv/lxml-mis.lua @@ -8,8 +8,8 @@ if not modules then modules = { } end modules ['lxml-mis'] = { local xml, lpeg, string = xml, lpeg, string +local type = type local concat = table.concat -local type, next, tonumber, tostring, setmetatable, loadstring = type, next, tonumber, tostring, setmetatable, loadstring local format, gsub, match = string.format, string.gsub, string.match local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, S, R, C, V, Cc, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Cs @@ -39,7 +39,7 @@ local function xmlgsub(t,old,new) -- will be replaced end end ---~ xml.gsub = xmlgsub +-- xml.gsub = xmlgsub function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual if d and k then @@ -51,12 +51,12 @@ function xml.stripleadingspaces(dk,d,k) -- cosmetic, for manual end end ---~ xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } ---~ xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end +-- xml.escapes = { ['&'] = '&', ['<'] = '<', ['>'] = '>', ['"'] = '"' } +-- xml.unescapes = { } for k,v in next, xml.escapes do xml.unescapes[v] = k end ---~ function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end ---~ function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end ---~ function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" +-- function xml.escaped (str) return (gsub(str,"(.)" , xml.escapes )) end +-- function xml.unescaped(str) return (gsub(str,"(&.-;)", xml.unescapes)) end +-- function xml.cleansed (str) return (gsub(str,"<.->" , '' )) end -- "%b<>" -- 100 * 2500 * "oeps< oeps> oeps&" : gsub:lpeg|lpeg|lpeg -- @@ -66,8 +66,8 @@ end -- -- 1559:0257:0288:0190 (last one suggested by roberto) --- escaped = Cs((S("<&>") / xml.escapes + 1)^0) --- escaped = Cs((S("<")/"<" + S(">")/">" + S("&")/"&" + 1)^0) +----- escaped = Cs((S("<&>") / xml.escapes + 1)^0) +----- escaped = Cs((S("<")/"<" + S(">")/">" + S("&")/"&" + 1)^0) local normal = (1 - S("<&>"))^0 local special = P("<")/"<" + P(">")/">" + P("&")/"&" local escaped = Cs(normal * (special * normal)^0) diff --git a/tex/context/base/mkiv/lxml-xml.lua b/tex/context/base/mkiv/lxml-xml.lua index d0e256078..6ec353310 100644 --- a/tex/context/base/mkiv/lxml-xml.lua +++ b/tex/context/base/mkiv/lxml-xml.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['lxml-xml'] = { license = "see context related readme files" } +local tonumber = tonumber local concat = table.concat local find, lower, upper = string.find, string.lower, string.upper diff --git a/tex/context/base/mkiv/math-frc.lua b/tex/context/base/mkiv/math-frc.lua index 639edc94b..5c4879527 100644 --- a/tex/context/base/mkiv/math-frc.lua +++ b/tex/context/base/mkiv/math-frc.lua @@ -6,15 +6,15 @@ if not modules then modules = { } end modules ['math-frc'] = { license = "see context related readme files" } -local utfchar = utf.char +local utfchar = utf.char -local context = context +local context = context local variables = interfaces.variables -local v_no = variables.no -local v_yes = variables.yes +local v_no = variables.no +local v_yes = variables.yes -local resolved = { +local resolved = { [0x007B] = "\\{", [0x007D] = "\\}", } diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua index 1e40d5ac4..4767ffa90 100644 --- a/tex/context/base/mkiv/math-vfu.lua +++ b/tex/context/base/mkiv/math-vfu.lua @@ -22,9 +22,8 @@ if not modules then modules = { } end modules ['math-vfu'] = { -- 20D6 -> 2190 -- 20D7 -> 2192 -local type, next = type, next +local type, next, tonumber = type, next, tonumber local max = math.max -local format = string.format local fastcopy = table.copy local fonts, nodes, mathematics = fonts, nodes, mathematics diff --git a/tex/context/base/mkiv/meta-fun.lua b/tex/context/base/mkiv/meta-fun.lua index 7aaaf2818..ddbbd9a52 100644 --- a/tex/context/base/mkiv/meta-fun.lua +++ b/tex/context/base/mkiv/meta-fun.lua @@ -10,7 +10,8 @@ if not modules then modules = { } end modules ['meta-fun'] = { local format, load, type = string.format, load, type -local metapost = metapost +local context = context +local metapost = metapost metapost.metafun = metapost.metafun or { } local metafun = metapost.metafun diff --git a/tex/context/base/mkiv/meta-ini.lua b/tex/context/base/mkiv/meta-ini.lua index d3865c433..114553c7a 100644 --- a/tex/context/base/mkiv/meta-ini.lua +++ b/tex/context/base/mkiv/meta-ini.lua @@ -11,9 +11,9 @@ local format = string.format local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, Cs, R, S, C, Cc = lpeg.P, lpeg.Cs, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc -local context = context - -metapost = metapost or { } +metapost = metapost or { } +local metapost = metapost +local context = context -- experimental diff --git a/tex/context/base/mkiv/meta-pdf.lua b/tex/context/base/mkiv/meta-pdf.lua index dfc00ed9e..10a089b9e 100644 --- a/tex/context/base/mkiv/meta-pdf.lua +++ b/tex/context/base/mkiv/meta-pdf.lua @@ -13,15 +13,19 @@ if not modules then modules = { } end modules ['meta-pdf'] = { -- We can make it even more efficient if needed, but as we don't use this -- code often in \MKIV\ it makes no sense. +local tonumber = tonumber local concat, unpack = table.concat, table.unpack local gsub, find, byte, gmatch, match = string.gsub, string.find, string.byte, string.gmatch, string.match local lpegmatch = lpeg.match local round = math.round local formatters, format = string.formatters, string.format -local report_mptopdf = logs.reporter("graphics","mptopdf") +local mplib = mplib +local metapost = metapost +local lpdf = lpdf +local context = context -local mplib, metapost, lpdf, context = mplib, metapost, lpdf, context +local report_mptopdf = logs.reporter("graphics","mptopdf") local texgetattribute = tex.getattribute diff --git a/tex/context/base/mkiv/meta-pdh.lua b/tex/context/base/mkiv/meta-pdh.lua index 5040715c4..2d58c64dd 100644 --- a/tex/context/base/mkiv/meta-pdh.lua +++ b/tex/context/base/mkiv/meta-pdh.lua @@ -30,7 +30,9 @@ local concat, format, find, gsub, gmatch = table.concat, string.format, string.f local tostring, tonumber, select = tostring, tonumber, select local lpegmatch = lpeg.match -local metapost = metapost +metapost = metapost or { } +local metapost = metapost +local context = context metapost.mptopdf = metapost.mptopdf or { } local mptopdf = metapost.mptopdf diff --git a/tex/context/base/mkiv/meta-tex.lua b/tex/context/base/mkiv/meta-tex.lua index 71207975d..0c5fedf30 100644 --- a/tex/context/base/mkiv/meta-tex.lua +++ b/tex/context/base/mkiv/meta-tex.lua @@ -6,12 +6,14 @@ if not modules then modules = { } end modules ['meta-tex'] = { license = "see context related readme files" } -local tostring = tostring +local tostring, tonumber = tostring, tonumber local format, gsub, find, match = string.format, string.gsub, string.find, string.match local formatters = string.formatters local P, S, R, C, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cs, lpeg.match -metapost = metapost or { } +metapost = metapost or { } +local metapost = metapost +local context = context local implement = interfaces.implement diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua index 96eb27cbd..b149c47f6 100644 --- a/tex/context/base/mkiv/mlib-ctx.lua +++ b/tex/context/base/mkiv/mlib-ctx.lua @@ -20,9 +20,8 @@ local stoptiming = statistics.stoptiming local mplib = mplib -metapost = metapost or {} +metapost = metapost or { } local metapost = metapost - local context = context local setters = tokens.setters diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua index 19585a7fa..f600c6111 100644 --- a/tex/context/base/mkiv/mult-ini.lua +++ b/tex/context/base/mkiv/mult-ini.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['mult-ini'] = { local format, gmatch, match, find, sub = string.format, string.gmatch, string.match, string.find, string.sub local lpegmatch = lpeg.match local serialize, concat = table.serialize, table.concat -local rawget, type = rawget, type +local rawget, type, tonumber = rawget, type, tonumber local context = context local commands = commands diff --git a/tex/context/base/mkiv/node-acc.lua b/tex/context/base/mkiv/node-acc.lua index 1cbf82b70..03f6d7476 100644 --- a/tex/context/base/mkiv/node-acc.lua +++ b/tex/context/base/mkiv/node-acc.lua @@ -16,7 +16,6 @@ local tonut = nodes.tonut local tonode = nodes.tonode local getid = nuts.getid -local getfield = nuts.getfield local getattr = nuts.getattr local getlist = nuts.getlist local getchar = nuts.getchar diff --git a/tex/context/base/mkiv/node-aux.lua b/tex/context/base/mkiv/node-aux.lua index c6b276337..7643e5e15 100644 --- a/tex/context/base/mkiv/node-aux.lua +++ b/tex/context/base/mkiv/node-aux.lua @@ -10,7 +10,8 @@ if not modules then modules = { } end modules ['node-aux'] = { local type, tostring = type, tostring -local nodes, node = nodes, node +local nodes = nodes +local context = context local utfvalues = utf.values @@ -39,6 +40,8 @@ local getboth = nuts.getboth local getcomponents = nuts.getcomponents local getwidth = nuts.getwidth local setwidth = nuts.setwidth +local getboxglue = nuts.getboxglue +local setboxglue = nuts.setboxglue local setfield = nuts.setfield local setattr = nuts.setattr @@ -456,9 +459,8 @@ local function rehpack(n,width) local size = width or getwidth(n) local temp = hpack_nodes(head,size,"exactly") setwidth(n,size) - setfield(n,"glue_set", getfield(temp,"glue_set")) - setfield(n,"glue_sign", getfield(temp,"glue_sign")) - setfield(n,"glue_order",getfield(temp,"glue_order")) + local set, order, sign = getboxglue(temp) + setboxglue(n,set,order,sign) setlist(temp) flush_node(temp) return n diff --git a/tex/context/base/mkiv/node-fin.lua b/tex/context/base/mkiv/node-fin.lua index 330d2fe31..975eb0bec 100644 --- a/tex/context/base/mkiv/node-fin.lua +++ b/tex/context/base/mkiv/node-fin.lua @@ -178,10 +178,8 @@ local function process(attribute,head,inheritance,default) -- one attribute local leader = nil while stack do local id = getid(stack) - if id == glyph_code then - check = true - elseif id == disc_code then - check = true -- no longer needed as we flatten replace + if id == glyph_code or id == disc_code then + check = true -- disc no longer needed as we flatten replace elseif id == glue_code then leader = getleader(stack) if leader then @@ -318,10 +316,8 @@ local function selective(attribute,head,inheritance,default) -- two attributes local leader = nil while stack do local id = getid(stack) - if id == glyph_code then - check = true - elseif id == disc_code then - check = true -- not needed when we flatten replace + if id == glyph_code or id == disc_code then + check = true -- disc no longer needed as we flatten replace elseif id == glue_code then leader = getleader(stack) if leader then diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua index 560e72878..2cd1d1a0a 100644 --- a/tex/context/base/mkiv/node-ltp.lua +++ b/tex/context/base/mkiv/node-ltp.lua @@ -134,6 +134,7 @@ if not modules then modules = { } end modules ['node-par'] = { ]]-- +local tonumber = tonumber local utfchar = utf.char local write, write_nl = texio.write, texio.write_nl local sub, formatters = string.sub, string.formatters diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index 54c3c7f9f..bbb629cd9 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -306,6 +306,8 @@ nuts.effective_glue = direct.effective_glue nuts.getglue = direct.getglue nuts.setglue = direct.setglue +nuts.getboxglue = direct.getglue +nuts.setboxglue = direct.setglue nuts.getdisc = direct.getdisc nuts.setdisc = direct.setdisc @@ -945,3 +947,21 @@ if not nuts.unprotect_glyph then end +if LUATEXFUNCTIONALITY < 6384 then + + local getfield = nuts.getfield + + function nuts.getboxglue(n,glue_set,glue_order,glue_sign) + return + getfield(n,"glue_set"), + getfield(n,"glue_order"), + getfield(h,"glue_sign") + end + + function nuts.setboxglue(n,glue_set,glue_order,glue_sign) + setfield(n,"glue_set", glue_set or 0) + setfield(n,"glue_order",glue_order or 0) + setfield(h,"glue_sign", glue_sign or 0) + end + +end diff --git a/tex/context/base/mkiv/node-ref.lua b/tex/context/base/mkiv/node-ref.lua index a0dc7e793..1ec77e83d 100644 --- a/tex/context/base/mkiv/node-ref.lua +++ b/tex/context/base/mkiv/node-ref.lua @@ -16,6 +16,7 @@ if not modules then modules = { } end modules ['node-ref'] = { -- is grouplevel still used? +local tonumber = tonumber local concat = table.concat local attributes, nodes, node = attributes, nodes, node @@ -68,6 +69,7 @@ local getsubtype = nuts.getsubtype local getwhd = nuts.getwhd local getdir = nuts.getdir local setshift = nuts.setshift +local getboxglue = nuts.getboxglue local hpack_list = nuts.hpack local vpack_list = nuts.vpack @@ -282,18 +284,16 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t reference,pardir or "---",txtdir or "---", tosequence(first,last,true),width,height,depth) end -if first == last and getid(parent) == vlist_code and getid(first) == hlist_code then - if trace_areas then - -- think of a button without \dontleavehmode in the mvl - report_area("compensating for link in vlist") - end - setlink(result,getlist(first)) - setlist(first,result) -else - -- setlink(getprev(first),result) - -- setlink(result,first) - setlink(getprev(first),result,first) -end + if first == last and getid(parent) == vlist_code and getid(first) == hlist_code then + if trace_areas then + -- think of a button without \dontleavehmode in the mvl + report_area("compensating for link in vlist") + end + setlink(result,getlist(first)) + setlist(first,result) + else + setlink(getprev(first),result,first) + end return head, last end else @@ -319,10 +319,11 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) if prev and getid(prev) == glue_code and getsubtype(prev) == parfillskip_code then width = dimensions(current,first,getprev(prev)) -- maybe not current as we already take care of it else + local set, order, sign = getboxglue(current) if moveright then - width = width - getfield(first,"stretch") * getfield(current,"glue_set") * getfield(current,"glue_sign") + width = width - getfield(first,"stretch") * set * sign end - width = width - getfield(last,"stretch") * getfield(current,"glue_set") * getfield(current,"glue_sign") + width = width - getfield(last,"stretch") * set * sign end end else @@ -350,8 +351,6 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir) setlist(current,result) elseif moveright then -- brr no prevs done -- result after first - -- setlink(result,getnext(first)) - -- setlink(first,result) setlink(first,result,getnext(first)) else -- first after result @@ -559,8 +558,6 @@ local function colorize(width,height,depth,n,reference,what,sr,offset) local text = addstring(what,sr,shift) if text then local kern = new_kern(-getwidth(text)) - -- setlink(kern,text) - -- setlink(text,rule) setlink(kern,text,rule) return kern end diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index 815ca2ca3..85c71a64d 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -7,7 +7,6 @@ if not modules then modules = { } end modules ['node-res'] = { } local gmatch, format = string.gmatch, string.format -local tonumber, round = tonumber, math.round --[[ldx-- <p>The next function is not that much needed but in <l n='context'/> we use diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index ad0a1d706..2b0368c2b 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -17,6 +17,9 @@ if not modules then modules = { } end modules ['node-rul'] = { -- fill s withcolor .5white ; -- draw boundingbox s withcolor yellow; +local tonumber = tonumber + +local context = context local attributes = attributes local nodes = nodes local properties = nodes.properties diff --git a/tex/context/base/mkiv/node-shp.lua b/tex/context/base/mkiv/node-shp.lua index 86d08098d..2e7a3529a 100644 --- a/tex/context/base/mkiv/node-shp.lua +++ b/tex/context/base/mkiv/node-shp.lua @@ -151,10 +151,10 @@ function handlers.cleanupbox(head) return tonode(cleanup_flushed(tonut(head))), true end -local actions = tasks.actions("shipouts") -- no extra arguments +local actions = tasks.actions("shipouts") -function handlers.finalize(head) -- problem, attr loaded before node, todo ... - return actions(head) +function handlers.finalize(head,where) -- problem, attr loaded before node, todo ... + return actions(head,where) end -- handlers.finalize = actions diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua index 1c070c45f..ee4387f00 100644 --- a/tex/context/base/mkiv/node-syn.lua +++ b/tex/context/base/mkiv/node-syn.lua @@ -40,6 +40,80 @@ if not modules then modules = { } end modules ['node-syn'] = { -- as it made no sense. Also, collecting output in a table was not faster than -- directly piping to the file, probably because the amount is not that large. We -- keep some left-overs commented. +-- +-- A significate reduction in file size can be realized when reusing the same +-- values. Actually that triggered the current approach in ConTeXt. In the latest +-- synctex parser vertical positions can be repeated by an "=" sign but for some +-- reason only for that field. It's probably trivial to do that for all of "w h d v +-- h" but it currently not the case so I'll delay that till all are supported. (We +-- could benefit a lot from such a repetition scheme but not much from a "v" alone +-- which -alas- indicates that synctex is still mostly a latex targeted story.) +-- +-- It's kind of hard to fight the parser because it really wants to go to some file +-- but maybe some day I can figure it out. Some untagged text (in the pdf) somehow +-- gets seen as part of the last box. Anonymous content is simply not part of the +-- concept. Using a dummy name doesn't help either as the editor gets a signal to +-- open that dummy. Even an empty filename doesn't work. +-- +-- We output really simple and compact code, like: +-- +-- SyncTeX Version:1 +-- Input:1:e:/tmp/oeps.tex +-- Input:2:c:/data/develop/context/sources/klein.tex +-- Output:pdf +-- Magnification:1000 +-- Unit:1 +-- X Offset:0 +-- Y Offset:0 +-- Content: +-- !160 +-- {1 +-- h0,0:0,0,0,0,0 +-- v0,0:0,55380990:39158276,55380990,0 +-- h2,1:4661756,9176901:27969941,655360,327680 +-- h2,2:4661756,10125967:26048041,655360,327680 +-- h2,3:30962888,10125967:1668809,655360,327680 +-- h2,3:4661756,11075033:23142527,655360,327680 +-- h2,4:28046650,11075033:4585047,655360,327680 +-- h2,4:4661756,12024099:22913954,655360,327680 +-- h2,5:27908377,12024099:4723320,655360,327680 +-- h2,5:4661756,12973165:22918783,655360,327680 +-- h2,6:27884864,12973165:4746833,655360,327680 +-- h2,6:4661756,13922231:18320732,655360,327680 +-- ) +-- ] +-- !533 +-- }1 +-- Input:3:c:/data/develop/context/sources/ward.tex +-- !57 +-- {2 +-- h0,0:0,0,0,0,0 +-- v0,0:0,55380990:39158276,55380990,0 +-- h3,1:4661756,9176901:18813145,655360,327680 +-- h3,2:23713999,9176901:8917698,655360,327680 +-- h3,2:4661756,10125967:10512978,655360,327680 +-- h3,3:15457206,10125967:17174491,655360,327680 +-- h3,3:4661756,11075033:3571223,655360,327680 +-- h3,4:8459505,11075033:19885281,655360,327680 +-- h3,5:28571312,11075033:4060385,655360,327680 +-- h3,5:4661756,12024099:15344870,655360,327680 +-- ) +-- ] +-- !441 +-- }2 +-- !8 +-- Postamble: +-- Count:22 +-- !23 +-- Post scriptum: +-- +-- But for some reason, when the pdf file has some extra content (like page numbers) +-- the main document is consulted. Bah. It would be nice to have a mode for *only* +-- looking at marked areas. It somehow works not but maybe depends on the parser. +-- +-- Supporting reuseable objects makes not much sense as these are often graphics or +-- ornamental. They can not have hyperlinks etc (at least not without some hackery +-- which I'm not willing to do) so basically they are sort of useless for text. local type, rawset = type, rawset local concat = table.concat @@ -110,18 +184,27 @@ local eol = "\010" ----- f_glyph = formatters["x%i,%i:%i,%i\010"] ----- f_kern = formatters["k%i,%i:%i,%i:%i\010"] ----- f_rule = formatters["r%i,%i:%i,%i:%i,%i,%i\010"] ------ f_hlist = formatters["[%i,%i:%i,%i:%i,%i,%i\010"] ------ f_vlist = formatters["(%i,%i:%i,%i:%i,%i,%i\010"] +----- f_form = formatters["f%i,%i,%i\010"] local z_hlist = "[0,0:0,0:0,0,0\010" local z_vlist = "(0,0:0,0:0,0,0\010" +----- z_xform = "<0,0:0,0,0\010" -- or so local s_hlist = "]\010" local s_vlist = ")\010" -local f_hvoid = formatters["h%i,%i:%i,%i:%i,%i,%i\010"] ------ f_vvoid = formatters["v%i,%i:%i,%i:%i,%i,%i\010"] +----- s_xform = ">\010" +local f_hlist_1 = formatters["h%i,%i:%i,%i:%i,%i,%i\010"] +local f_hlist_2 = formatters["h%i,%i:%i,%s:%i,%i,%i\010"] +local f_vlist_1 = formatters["v%i,%i:%i,%i:%i,%i,%i\010"] +local f_vlist_2 = formatters["v%i,%i:%i,%s:%i,%i,%i\010"] local synctex = luatex.synctex or { } luatex.synctex = synctex +-- status stuff + +local enabled = false +local paused = 0 +local used = false + -- the file name stuff local noftags = 0 @@ -137,7 +220,6 @@ local blockedsuffixes = { -- lfg = true, } - local sttags = table.setmetatableindex(function(t,name) if blockedsuffixes[suffixonly(name)] then -- Just so that I don't get the ones on my development tree. @@ -164,6 +246,7 @@ function synctex.blockfilename(name) end function synctex.setfilename(name,line) +if paused == 0 then if force_synctex_tag and name then force_synctex_tag(sttags[name]) if line then @@ -171,13 +254,16 @@ function synctex.setfilename(name,line) end end end +end function synctex.resetfilename() +if paused == 0 then if force_synctex_tag then force_synctex_tag(0) force_synctex_line(0) end end +end -- the node stuff @@ -186,10 +272,8 @@ local nofsheets = 0 local nofobjects = 0 local last = 0 local filesdone = 0 -local enabled = false local tmpfile = false local logfile = false -local used = false local function writeanchor() local size = filehandle:seek("end") @@ -281,21 +365,67 @@ end -- end -- -- local function x_vlist(head,current,t,l,w,h,d) --- return insert_before(head,current,new_latelua(function() doaction(f_vvoid,t,l,w,h,d) end)) +-- return insert_before(head,current,new_latelua(function() doaction(f_vlist_1,t,l,w,h,d) end)) -- end -- -- local function x_hlist(head,current,t,l,w,h,d) --- return insert_before(head,current,new_latelua(function() doaction(f_hvoid,t,l,w,h,d) end)) +-- return insert_before(head,current,new_latelua(function() doaction(f_hlist_1,t,l,w,h,d) end)) +-- end +-- +-- generic +-- +-- local function doaction(t,l,w,h,d) +-- local x, y = getpos() +-- filehandle:write(f_hlist_1(t,l,x,tex.pageheight-y,w,h,d)) +-- nofobjects = nofobjects + 1 -- end -local function doaction(t,l,w,h,d) - local x, y = getpos() - filehandle:write(f_hvoid(t,l,x,tex.pageheight-y,w,h,d)) - nofobjects = nofobjects + 1 -end +local x_hlist do + + local function doaction_1(t,l,w,h,d) + local x, y = getpos() + filehandle:write(f_hlist_1(t,l,x,tex.pageheight-y,w,h,d)) + nofobjects = nofobjects + 1 + end + + -- local lastx, lasty, lastw, lasth, lastd + -- + -- local function doaction_2(t,l,w,h,d) + -- local x, y = getpos() + -- y = tex.pageheight-y + -- filehandle:write(f_hlist_2(t,l, + -- x == lastx and "=" or x, + -- y == lasty and "=" or y, + -- w == lastw and "=" or w, + -- h == lasth and "=" or h, + -- d == lastd and "=" or d + -- )) + -- lastx, lasty, lastw, lasth, lastd = x, y, w, h, d + -- nofobjects = nofobjects + 1 + -- end + -- + -- but ... only y is supported: + + local lasty = false + + local function doaction_2(t,l,w,h,d) + local x, y = getpos() + y = tex.pageheight - y + filehandle:write(f_hlist_2(t,l,x,y == lasty and "=" or y,w,h,d)) + lasty = y + nofobjects = nofobjects + 1 + end + + local doaction = doaction_1 + + x_hlist = function(head,current,t,l,w,h,d) + return insert_before(head,current,new_latelua(function() doaction(t,l,w,h,d) end)) + end + + directives.register("system.synctex.compression", function(v) + doaction = tonumber(v) == 2 and doaction_2 or doaction_1 + end) -local function x_hlist(head,current,t,l,w,h,d) - return insert_before(head,current,new_latelua(function() doaction(t,l,w,h,d) end)) end -- color is already handled so no colors @@ -380,8 +510,6 @@ local function collect_min(head) return head end -collect = collect_max - local function inject(parent,head,first,last,tag,line) local w, h, d = getrangedimensions(parent,first,getnext(last)) if h < height then @@ -489,11 +617,17 @@ local function collect_max(head,parent) return head end -function synctex.collect(head) +collect = collect_max + +function synctex.collect(head,where) if enabled then - local h = tonut(head) - h = collect(h,h) - return tonode(h), true + if where == "object" then + return head, false + else + local h = tonut(head) + h = collect(h,h) + return tonode(h), true + end else return head, false end @@ -507,7 +641,11 @@ function synctex.start() if flushpreamble() then writeanchor() filehandle:write("{",nofsheets,eol) - filehandle:write(z_hlist,z_vlist) + -- this seems to work: + local h = tex.pageheight + local w = tex.pagewidth + filehandle:write(z_hlist) + filehandle:write(f_vlist_1(0,0,0,h,w,h,0)) end end end @@ -527,6 +665,7 @@ local disablers = { } function synctex.registerenabler(f) enablers[#enablers+1] = f end + function synctex.registerdisabler(f) disablers[#disablers+1] = f end @@ -568,15 +707,17 @@ function synctex.finish() end function synctex.pause() - if enabled then + paused = paused + 1 + if paused == 1 and enabled then set_synctex_mode(0) end end function synctex.resume() - if enabled then + if paused == 1 and enabled then set_synctex_mode(3) end + paused = paused - 1 end -- not the best place diff --git a/tex/context/base/mkiv/node-tsk.lua b/tex/context/base/mkiv/node-tsk.lua index c33f0e9f4..1ce7ab1dc 100644 --- a/tex/context/base/mkiv/node-tsk.lua +++ b/tex/context/base/mkiv/node-tsk.lua @@ -386,7 +386,7 @@ tasks.new { tasks.new { name = "shipouts", - arguments = 0, + arguments = 1, -- nostate = true, -- maybe but only for main ones so little gain processor = nodeprocessor, sequence = { diff --git a/tex/context/base/mkiv/pack-obj.lua b/tex/context/base/mkiv/pack-obj.lua index cba0dcf8f..8bbdbdefa 100644 --- a/tex/context/base/mkiv/pack-obj.lua +++ b/tex/context/base/mkiv/pack-obj.lua @@ -126,7 +126,7 @@ objects = { function objects.register(ns,id,b,referenced) objects.n = objects.n + 1 - nodes.handlers.finalize(gettexbox(b)) + nodes.handlers.finalize(gettexbox(b),"object") data[ns][id] = { codeinjections.registerboxresource(b), -- a box number gettexdimen("objectoff"), diff --git a/tex/context/base/mkiv/pack-obj.mkiv b/tex/context/base/mkiv/pack-obj.mkiv index 23608846d..a025abfba 100644 --- a/tex/context/base/mkiv/pack-obj.mkiv +++ b/tex/context/base/mkiv/pack-obj.mkiv @@ -55,10 +55,10 @@ % todo formmargin per obj -\unexpanded\def\setreferencedobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} -\unexpanded\def\settightreferencedobject #1#2{\begingroup\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} -\unexpanded\def\setunreferencedobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} -\unexpanded\def\settightunreferencedobject#1#2{\begingroup\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} +\unexpanded\def\setreferencedobject #1#2{\begingroup\synctexpause\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} +\unexpanded\def\settightreferencedobject #1#2{\begingroup\synctexpause\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_yes{#1}{#2}}} +\unexpanded\def\setunreferencedobject #1#2{\begingroup\synctexpause\objectoff\objectoffset\inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} +\unexpanded\def\settightunreferencedobject#1#2{\begingroup\synctexpause\objectoff\zeropoint \inobjecttrue\dowithnextbox{\pack_objects_set_nop{#1}{#2}}} \let\setobject \setreferencedobject \let\settightobject\settightreferencedobject @@ -70,6 +70,7 @@ \setbox\objectbox\box\nextbox \fi \clf_registerreferencedobject{#1}{#2}\objectbox + \synctexresume \endgroup} \unexpanded\def\pack_objects_set_nop#1#2% @@ -79,6 +80,7 @@ \setbox\objectbox\box\nextbox \fi \clf_registerobject{#1}{#2}\objectbox + \synctexresume \endgroup} \def\pack_objects_package @@ -105,11 +107,13 @@ \unexpanded\def\getobject#1#2% {\begingroup + \synctexpause \clf_restoreobject{#1}{#2}% \ifdim\objectoff>\zeropoint \pack_objects_repackage \fi \box\objectbox + \synctexresume \endgroup} %D If needed one can ask for the dimensions of an object with: diff --git a/tex/context/base/mkiv/pack-rul.lua b/tex/context/base/mkiv/pack-rul.lua index 30eda7dd2..c9771546c 100644 --- a/tex/context/base/mkiv/pack-rul.lua +++ b/tex/context/base/mkiv/pack-rul.lua @@ -20,6 +20,8 @@ if not modules then modules = { } end modules ['pack-rul'] = { local type = type +local context = context + local hlist_code = nodes.nodecodes.hlist local vlist_code = nodes.nodecodes.vlist local box_code = nodes.listcodes.box @@ -33,8 +35,6 @@ local implement = interfaces.implement local nuts = nodes.nuts -local getfield = nuts.getfield -local setfield = nuts.setfield local getnext = nuts.getnext local getprev = nuts.getprev local getlist = nuts.getlist @@ -47,6 +47,8 @@ local getdir = nuts.getdir local setshift = nuts.setshift local setwidth = nuts.setwidth local getwidth = nuts.getwidth +local setboxglue = nuts.setboxglue +local getboxglue = nuts.getboxglue local hpack = nuts.hpack local traverse_id = nuts.traverse_id @@ -125,9 +127,8 @@ local function doreshapeframedbox(n) local subtype = getsubtype(h) if subtype == box_code or subtype == line_code then local p = hpack(l,maxwidth,'exactly',getdir(h)) -- multiple return value - setfield(h,"glue_set",getfield(p,"glue_set")) - setfield(h,"glue_order",getfield(p,"glue_order")) - setfield(h,"glue_sign",getfield(p,"glue_sign")) + local set, order, sign = getboxglue(p) + setboxglue(h,set,order,sign) setlist(p) flush_node(p) elseif checkformath and subtype == equation_code then diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua index 3fa7f9d96..cc35de877 100644 --- a/tex/context/base/mkiv/page-cst.lua +++ b/tex/context/base/mkiv/page-cst.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ["page-cst"] = { -- todo: check what is used -local next, type = next, type +local next, type, tonumber = next, type, tonumber local ceil, floor, odd, round = math.ceil, math.floor, math.odd, math.round local lower = string.lower local copy = table.copy diff --git a/tex/context/base/mkiv/page-flt.lua b/tex/context/base/mkiv/page-flt.lua index 53780e420..30796f91d 100644 --- a/tex/context/base/mkiv/page-flt.lua +++ b/tex/context/base/mkiv/page-flt.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['page-flt'] = { -- floats -> managers.floats -- some functions are a tex/lua mix so we need a separation +local tostring = tostring local insert, remove = table.insert, table.remove local find = string.find diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua index 88e804abb..42435ed5b 100644 --- a/tex/context/base/mkiv/page-mix.lua +++ b/tex/context/base/mkiv/page-mix.lua @@ -24,6 +24,8 @@ local trace_detail = false trackers.register("mixedcolumns.detail", function(v) local report_state = logs.reporter("mixed columns") +local context = context + local nodecodes = nodes.nodecodes local hlist_code = nodecodes.hlist diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua index 6a8e52cb8..cbbdcd9e5 100644 --- a/tex/context/base/mkiv/publ-aut.lua +++ b/tex/context/base/mkiv/publ-aut.lua @@ -13,7 +13,7 @@ end local lpeg = lpeg -local type, next, tostring = type, next, tostring +local type, next, tostring, tonumber = type, next, tostring, tonumber local concat = table.concat local utfsub = utf.sub local formatters = string.formatters diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua index 8eb923407..e2a31354f 100644 --- a/tex/context/base/mkiv/publ-dat.lua +++ b/tex/context/base/mkiv/publ-dat.lua @@ -24,7 +24,7 @@ end local lower, find, sub = string.lower, string.find, string.sub local concat, copy, tohash = table.concat, table.copy, table.tohash -local next, type, rawget = next, type, rawget +local next, type, rawget, tonumber = next, type, rawget, tonumber local utfchar = utf.char local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local textoutf = characters and characters.tex.toutf diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua index 02b289137..a91a93970 100644 --- a/tex/context/base/mkiv/scrp-ini.lua +++ b/tex/context/base/mkiv/scrp-ini.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['scrp-ini'] = { -- We need to rewrite this a bit ... rather old code ... will be done when japanese -- is finished. -local attributes, nodes, node = attributes, nodes, node +local tonumber = tonumber local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end) local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end) @@ -22,6 +22,10 @@ local report_splitting = logs.reporter("scripts","splitting") local utfbyte, utfsplit = utf.byte, utf.split local gmatch = string.gmatch +local attributes = attributes +local nodes = nodes +local context = context + local texsetattribute = tex.setattribute local nodecodes = nodes.nodecodes diff --git a/tex/context/base/mkiv/spac-prf.lua b/tex/context/base/mkiv/spac-prf.lua index 130407edf..a28f30593 100644 --- a/tex/context/base/mkiv/spac-prf.lua +++ b/tex/context/base/mkiv/spac-prf.lua @@ -57,6 +57,7 @@ local getshift = nuts.getshift local getwidth = nuts.getwidth local getheight = nuts.getheight local getdepth = nuts.getdepth +local getboxglue = nuts.getboxglue local setlink = nuts.setlink local setlist = nuts.setlist @@ -117,9 +118,7 @@ local function getprofile(line,step) return end - local glue_sign = getfield(line,"glue_sign") - local glue_order = getfield(line,"glue_order") - local glue_set = getfield(line,"glue_set") + local glue_set, glue_order, glue_sign = getboxglue(line) local heights = { } local depths = { } @@ -473,8 +472,7 @@ local function inject(top,bot,amount) -- todo: look at penalties setattr(glue,a_profilemethod,0) setattr(glue,a_visual,getattr(top,a_visual)) -- - setlink(glue,bot) - setlink(top,glue) + setlink(top,glue,bot) end methods[v_none] = function() diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 1af2dbc5f..2a9b3c599 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 54431abc7..b06dabfea 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-num.lua b/tex/context/base/mkiv/strc-num.lua index 98db1b42d..e1a133f4a 100644 --- a/tex/context/base/mkiv/strc-num.lua +++ b/tex/context/base/mkiv/strc-num.lua @@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['strc-num'] = { } local format = string.format -local next, type = next, type +local next, type, tonumber = next, type, tonumber local min, max = math.min, math.max local insert, remove, copy = table.insert, table.remove, table.copy local texsetcount = tex.setcount @@ -15,6 +15,8 @@ local texsetcount = tex.setcount -- Counters are managed here. They can have multiple levels which makes it easier to synchronize -- them. Synchronization is sort of special anyway, as it relates to document structuring. +local context = context + local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex local setmetatablecall = table.setmetatablecall diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index a9a7c7121..41ebf353e 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -123,6 +123,8 @@ local currentreference = nil local txtcatcodes = catcodes.numbers.txtcatcodes -- or just use "txtcatcodes" +local context = context + local ctx_pushcatcodes = context.pushcatcodes local ctx_popcatcodes = context.popcatcodes local ctx_dofinishreference = context.dofinishreference diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua index 32924ad81..e4bf0852c 100644 --- a/tex/context/base/mkiv/strc-reg.lua +++ b/tex/context/base/mkiv/strc-reg.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['strc-reg'] = { license = "see context related readme files" } -local next, type = next, type +local next, type, tonumber = next, type, tonumber local format, gmatch = string.format, string.gmatch local equal, concat, remove = table.are_equal, table.concat, table.remove local lpegmatch, P, C, Ct = lpeg.match, lpeg.P, lpeg.C, lpeg.Ct diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua index 4d9ec6e3e..4fe062a1c 100644 --- a/tex/context/base/mkiv/supp-box.lua +++ b/tex/context/base/mkiv/supp-box.lua @@ -8,10 +8,12 @@ if not modules then modules = { } end modules ['supp-box'] = { -- this is preliminary code, use insert_before etc -local lpegmatch = lpeg.match - local report_hyphenation = logs.reporter("languages","hyphenation") +local tonumber = tonumber + +local lpegmatch = lpeg.match + local tex = tex local context = context local nodes = nodes diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index 34e5c4e88..f19dbfdb7 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -23,7 +23,7 @@ local formatters = string.formatters local setcatcode = tex.setcatcode local utf8character = lpeg.patterns.utf8character local settings_to_array = utilities.parsers.settings_to_array -local settings_to_set = utilities.parsers.settings_to_set +local settings_to_set = utilities.parsers.settings_to_set local setmacro = interfaces.setmacro local pattern = C(utf8character^-1) * C(P(1)^0) diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua index ee3b8c327..86a9a28f3 100644 --- a/tex/context/base/mkiv/syst-lua.lua +++ b/tex/context/base/mkiv/syst-lua.lua @@ -7,7 +7,6 @@ if not modules then modules = { } end modules ['syst-lua'] = { } local find, match = string.find, string.match -local tonumber = tonumber local S, C, P, lpegmatch, lpegtsplitat = lpeg.S, lpeg.C, lpeg.P, lpeg.match, lpeg.tsplitat commands = commands or { } diff --git a/tex/context/base/mkiv/trac-set.lua b/tex/context/base/mkiv/trac-set.lua index 77de85e8e..fccf52d3a 100644 --- a/tex/context/base/mkiv/trac-set.lua +++ b/tex/context/base/mkiv/trac-set.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['trac-set'] = { -- might become u -- maybe this should be util-set.lua -local type, next, tostring = type, next, tostring +local type, next, tostring, tonumber = type, next, tostring, tonumber local concat = table.concat local format, find, lower, gsub, topattern = string.format, string.find, string.lower, string.gsub, string.topattern local is_boolean = string.is_boolean diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index 42098f3f8..c4a9d90bb 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['trac-vis'] = { } local node, nodes, attributes, fonts, tex = node, nodes, attributes, fonts, tex -local type = type +local type, tonumber = type, tonumber local gmatch = string.gmatch local formatters = string.formatters local compactfloat = number.compactfloat @@ -368,7 +368,7 @@ local c_ligature = "trace:s" local c_white = "trace:w" local c_math = "trace:r" local c_origin = "trace:o" -local c_discretionary = "trace:o" +local c_discretionary = "trace:d" local c_expansion = "trace:o" local c_positive_d = "trace:db" @@ -383,7 +383,7 @@ local c_ligature_d = "trace:ds" local c_white_d = "trace:dw" local c_math_d = "trace:dr" local c_origin_d = "trace:do" -local c_discretionary_d = "trace:do" +local c_discretionary_d = "trace:dd" local c_expansion_d = "trace:do" local function sometext(str,layer,color,textcolor,lap) -- we can just paste verbatim together .. no typesteting needed @@ -976,11 +976,10 @@ local ruledkern do local k_cache_h = caches["hkern"] ruledkern = function(head,current,vertical) - local kern = getkern(current) - local info = (vertical and k_cache_v or k_cache_h)[kern] - if info then - -- print("kern hit") - else + local kern = getkern(current) + local cache = vertical and k_cache_v or k_cache_h + local info = cache[kern] + if not info then local amount = formatters["%s:%0.3f"](vertical and "VK" or "HK",kern*pt_factor) if kern > 0 then info = sometext(amount,l_kern,c_positive) @@ -989,7 +988,7 @@ local ruledkern do else info = sometext(amount,l_kern,c_zero) end - (vertical and k_cache_v or k_cache_h)[kern] = info + cache[kern] = info end info = copy_list(info) if vertical then @@ -1003,7 +1002,7 @@ end local ruleditalic do - local i_cache = caches["itatalic"] + local i_cache = caches["italic"] ruleditalic = function(head,current) local kern = getkern(current) diff --git a/tex/context/base/mkiv/typo-brk.lua b/tex/context/base/mkiv/typo-brk.lua index 40d1faa4c..51760bbf4 100644 --- a/tex/context/base/mkiv/typo-brk.lua +++ b/tex/context/base/mkiv/typo-brk.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['typo-brk'] = { -- this code dates from the beginning and is kind of experimental; it -- will be optimized and improved soon -local next, type, tonumber = next, type, tonumber +local next, type, tonumber, tostring = next, type, tonumber, tostring local utfbyte, utfchar = utf.byte, utf.char local format = string.format diff --git a/tex/context/base/mkiv/typo-cap.lua b/tex/context/base/mkiv/typo-cap.lua index 65357e233..9e4e9686a 100644 --- a/tex/context/base/mkiv/typo-cap.lua +++ b/tex/context/base/mkiv/typo-cap.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['typo-cap'] = { license = "see context related readme files" } -local next, type = next, type +local next, type, tonumber = next, type, tonumber local format, insert = string.format, table.insert local div, getrandom = math.div, utilities.randomizer.get diff --git a/tex/context/base/mkiv/typo-chr.lua b/tex/context/base/mkiv/typo-chr.lua index f6bcfde56..80497a492 100644 --- a/tex/context/base/mkiv/typo-chr.lua +++ b/tex/context/base/mkiv/typo-chr.lua @@ -88,6 +88,8 @@ if not modules then modules = { } end modules ['typo-chr'] = { local insert, remove = table.insert, table.remove +local context = context + local nodecodes = nodes.nodecodes local glyph_code = nodecodes.glyph local localpar_code = nodecodes.localpar diff --git a/tex/context/base/mkiv/typo-cln.lua b/tex/context/base/mkiv/typo-cln.lua index ecfdd8ff3..b7187eaeb 100644 --- a/tex/context/base/mkiv/typo-cln.lua +++ b/tex/context/base/mkiv/typo-cln.lua @@ -10,6 +10,7 @@ if not modules then modules = { } end modules ['typo-cln'] = { -- this case Dream Theaters' Octavium). Of course extensions will take -- more time. +local tonumber = tonumber local utfbyte = utf.byte local trace_cleaners = false trackers.register("typesetters.cleaners", function(v) trace_cleaners = v end) diff --git a/tex/context/base/mkiv/typo-dig.lua b/tex/context/base/mkiv/typo-dig.lua index cc9a91cd5..61e96c6b6 100644 --- a/tex/context/base/mkiv/typo-dig.lua +++ b/tex/context/base/mkiv/typo-dig.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['typo-dig'] = { -- we might consider doing this after the otf pass because now osf do not work -- out well in node mode. -local next, type = next, type +local next, type, tonumber = next, type, tonumber local format, insert = string.format, table.insert local round, div = math.round, math.div diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua index 6afec9816..4545dfe2b 100644 --- a/tex/context/base/mkiv/typo-itc.lua +++ b/tex/context/base/mkiv/typo-itc.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['typo-itc'] = { license = "see context related readme files" } +local tonumber = tonumber local trace_italics = false trackers.register("typesetters.italics", function(v) trace_italics = v end) diff --git a/tex/context/base/mkiv/typo-mar.lua b/tex/context/base/mkiv/typo-mar.lua index 6014260d9..bc9c408c1 100644 --- a/tex/context/base/mkiv/typo-mar.lua +++ b/tex/context/base/mkiv/typo-mar.lua @@ -13,18 +13,21 @@ if not modules then modules = { } end modules ['typo-mar'] = { local format, validstring = string.format, string.valid local insert, remove, sortedkeys, fastcopy = table.insert, table.remove, table.sortedkeys, table.fastcopy -local setmetatable, next = setmetatable, next +local setmetatable, next, tonumber = setmetatable, next, tonumber local formatters = string.formatters local toboolean = toboolean local settings_to_hash = utilities.parsers.settings_to_hash -local attributes, nodes, node, variables = attributes, nodes, node, variables +local attributes = attributes +local nodes = nodes +local variables = variables +local context = context -local trace_margindata = false trackers.register("typesetters.margindata", function(v) trace_margindata = v end) -local trace_marginstack = false trackers.register("typesetters.margindata.stack", function(v) trace_marginstack = v end) -local trace_margingroup = false trackers.register("typesetters.margindata.group", function(v) trace_margingroup = v end) +local trace_margindata = false trackers.register("typesetters.margindata", function(v) trace_margindata = v end) +local trace_marginstack = false trackers.register("typesetters.margindata.stack", function(v) trace_marginstack = v end) +local trace_margingroup = false trackers.register("typesetters.margindata.group", function(v) trace_margingroup = v end) -local report_margindata = logs.reporter("margindata") +local report_margindata = logs.reporter("margindata") local tasks = nodes.tasks local prependaction = tasks.prependaction diff --git a/tex/context/base/mkiv/typo-rub.lua b/tex/context/base/mkiv/typo-rub.lua index abe34731b..8c41a5611 100644 --- a/tex/context/base/mkiv/typo-rub.lua +++ b/tex/context/base/mkiv/typo-rub.lua @@ -298,9 +298,6 @@ local function whatever(current) else local left = new_kern(delta/2) local right = new_kern(delta/2) --- setlink(left,start) --- setlink(stop,right) --- setlink(text,left) setlink(text,left,start) setlink(stop,right) end @@ -352,17 +349,11 @@ local function whatever(current) elseif align == v_flushright then local left = new_kern(-delta) local right = new_kern(delta) --- setlink(left,text) --- setlink(text,right) --- setlink(right,start) - setlink(left,text,right,start) - setlist(current,left) + setlink(left,text,right,start) + setlist(current,left) else local left = new_kern(-delta/2) local right = new_kern(delta/2) --- setlink(left,text) --- setlink(text,right) --- setlink(right,start) setlink(left,text,right,start) setlist(current,left) end diff --git a/tex/context/base/mkiv/unic-ini.lua b/tex/context/base/mkiv/unic-ini.lua index 132c92efa..07e3a64c3 100644 --- a/tex/context/base/mkiv/unic-ini.lua +++ b/tex/context/base/mkiv/unic-ini.lua @@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['unic-ini'] = { license = "see context related readme files" } +local context = context local utfchar = utf.char -- Beware, initializing unicodechar happens at first usage and takes diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-opentype-math.lfg index 50d94f305..7596f139a 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-opentype-math.lfg @@ -35,8 +35,16 @@ return { -- }, dimensions = { default = { -- experimental values - [0x2044] = { xoffset = 275, width = 600 }, - -- [0x2032] = { yoffset = -10 }, + [0x02044] = { xoffset = 275, width = 600 }, + -- primes + [0xFE932] = { width = 200 }, + [0xFE933] = { width = 500 }, + [0xFE934] = { width = 800 }, + [0xFE935] = { width = 1100 }, + -- reverse primes + [0xFE935] = { width = 200 }, + [0xFE936] = { width = 500 }, + [0xFE937] = { width = 800 }, }, }, }, diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 66ccb3842..1ebc5d003 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 7f6e7a87c..2c67171b8 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua index 5a9311387..565a5e36d 100644 --- a/tex/context/modules/mkiv/m-chart.lua +++ b/tex/context/modules/mkiv/m-chart.lua @@ -16,6 +16,8 @@ local type, tonumber, rawget, next = type, tonumber, rawget, next local gsub, find, lower = string.gsub, string.find, string.lower local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match +local context = context + local formatters = string.formatters local setmetatableindex = table.setmetatableindex diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua index 757e843da..efecbeeb5 100644 --- a/tex/context/modules/mkiv/s-math-characters.lua +++ b/tex/context/modules/mkiv/s-math-characters.lua @@ -73,10 +73,11 @@ function moduledata.math.characters.showlist(specification) sorted = table.sortedkeys(characters) end if virtual then - for k, v in ipairs(tfmdata.fonts) do - local id = v.id + local fonts = tfmdata.fonts + for i=1,#fonts do + local id = fonts[i].id local name = fontdata[id].properties.name - names[k] = (name and file.basename(name)) or id + names[i] = (name and file.basename(name)) or id end end if check then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 803b31082..c713a5ca9 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 07/30/17 19:30:11 +-- merge date : 08/01/17 18:10:43 do -- begin closure to overcome local limits and interference @@ -130,7 +130,8 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -lpeg=require("lpeg") +lpeg=require("lpeg") +local lpeg=lpeg if not lpeg.print then function lpeg.print(...) print(lpeg.pcode(...)) end end local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format @@ -1048,7 +1049,7 @@ if not modules then modules={} end modules ['l-table']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type,next,tostring,tonumber,ipairs,select=type,next,tostring,tonumber,ipairs,select +local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select local table,string=table,string local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove local format,lower,dump=string.format,string.lower,string.dump @@ -1350,7 +1351,7 @@ function table.tohash(t,value) local h={} if t then if value==nil then value=true end - for _,v in next,t do + for _,v in next,t do h[v]=value end end @@ -1358,7 +1359,7 @@ function table.tohash(t,value) end function table.fromhash(t) local hsh,h={},0 - for k,v in next,t do + for k,v in next,t do if v then h=h+1 hsh[h]=k @@ -7573,7 +7574,7 @@ if not modules then modules={} end modules ['font-con']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local next,tostring,rawget=next,tostring,rawget +local next,tostring,tonumber,rawget=next,tostring,tonumber,rawget local format,match,lower,gsub,find=string.format,string.match,string.lower,string.gsub,string.find local sort,insert,concat=table.sort,table.insert,table.concat local sortedkeys,sortedhash,serialize,fastcopy=table.sortedkeys,table.sortedhash,table.serialize,table.fastcopy @@ -9637,7 +9638,7 @@ if not modules then modules={} end modules ['font-otr']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local next,type=next,type +local next,type,tonumber=next,type,tonumber local byte,lower,char,gsub=string.byte,string.lower,string.char,string.gsub local floor,round=math.floor,math.round local P,R,S,C,Cs,Cc,Ct,Carg,Cmt=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.Ct,lpeg.Carg,lpeg.Cmt @@ -24934,45 +24935,42 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context last=getnext(last) end n=n+1 - else - if discfound then - notmatchreplace[discfound]=true - if notmatchpre[discfound] then - goto next - end - else + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpre[discfound] then goto next + else + break end - break + else + goto next end - else - if seq[n][char] then - if n<l then - last=getnext(last) - end - n=n+1 + elseif seq[n][char] then + if n<l then + last=getnext(last) + end + n=n+1 + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpre[discfound] then + goto next else - if discfound then - notmatchreplace[discfound]=true - if notmatchpre[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char==false then if discfound then notmatchreplace[discfound]=true if notmatchpre[discfound] then goto next + else + break end else goto next end - break elseif id==disc_code then diskseen=true discfound=last @@ -25012,8 +25010,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context notmatchreplace[last]=true if notmatchpre[last] then goto next + else + break end - break end end if notmatchpre[last] then @@ -25055,34 +25054,30 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context prev=getprev(prev) end n=n-1 - else - if discfound then - notmatchreplace[discfound]=true - if notmatchpost[discfound] then - goto next - end - else + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpost[discfound] then goto next + else + break end - break + else + goto next end - else - if seq[n][char] then - if n>1 then - prev=getprev(prev) - end - n=n-1 + elseif seq[n][char] then + if n>1 then + prev=getprev(prev) + end + n=n-1 + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpost[discfound] then + goto next else - if discfound then - notmatchreplace[discfound]=true - if notmatchpost[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char==false then if discfound then @@ -25107,12 +25102,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context while posttail do if seq[n][getchar(posttail)] then n=n-1 - if posttail==post then + if posttail==post or n<1 then break else - if n<1 then - break - end posttail=getprev(posttail) end else @@ -25130,20 +25122,18 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context while replacetail do if seq[n][getchar(replacetail)] then n=n-1 - if replacetail==replace then + if replacetail==replace or n<1 then break else - if n<1 then - break - end replacetail=getprev(replacetail) end else notmatchreplace[prev]=true if notmatchpost[prev] then goto next + else + break end - break end end end @@ -25199,45 +25189,42 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context current=getnext(current) end n=n+1 - else - if discfound then - notmatchreplace[discfound]=true - if notmatchpre[discfound] then - goto next - end + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpre[discfound] then + break else goto next end - break + else + goto next end - else - if seq[n][char] then - if n<s then - current=getnext(current) - end - n=n+1 + elseif seq[n][char] then + if n<s then + current=getnext(current) + end + n=n+1 + elseif discfound then + notmatchreplace[discfound]=true + if notmatchpre[discfound] then + goto next else - if discfound then - notmatchreplace[discfound]=true - if notmatchpre[discfound] then - goto next - end - else - goto next - end break end + else + goto next end elseif char==false then if discfound then notmatchreplace[discfound]=true if notmatchpre[discfound] then goto next + else + break end else goto next end - break elseif id==disc_code then diskseen=true discfound=current @@ -25252,8 +25239,9 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context n=n+1 if n>s then break + else + pre=getnext(pre) end - pre=getnext(pre) else notmatchpre[current]=true break @@ -25271,14 +25259,16 @@ local function optimized_handle_contextchain(head,start,dataset,sequence,context n=n+1 if n>s then break + else + replace=getnext(replace) end - replace=getnext(replace) else notmatchreplace[current]=true if not notmatchpre[current] then goto next + else + break end - break end end else @@ -26140,9 +26130,7 @@ do else start=getnext(start) end - elseif char==false then - start=getnext(start) - elseif id==glue_code then + elseif char==false or id==glue_code then start=getnext(start) elseif id==disc_code then if not discs or discs[start]==true then @@ -26210,9 +26198,7 @@ do else start=getnext(start) end - elseif char==false then - start=getnext(start) - elseif id==glue_code then + elseif char==false or id==glue_code then start=getnext(start) elseif id==disc_code then if not discs or discs[start]==true then @@ -26305,9 +26291,7 @@ do else start=getnext(start) end - elseif char==false then - start=getnext(start) - elseif id==glue_code then + elseif char==false or id==glue_code then start=getnext(start) elseif id==math_code then start=getnext(end_of_math(start)) @@ -28509,7 +28493,7 @@ if not modules then modules={} end modules ['font-ocl']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local tostring,next,format=tostring,next,string.format +local tostring,tonumber,next=tostring,tonumber,next local round,max=math.round,math.round local sortedkeys,sortedhash=table.sortedkeys,table.sortedhash local setmetatableindex=table.setmetatableindex |