diff options
25 files changed, 118 insertions, 226 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 4f0705c25..a0a4fcd64 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 6357aa4b7..a22944ab4 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 52980cfbd..3a86b8090 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 3d4e175b2..316da9f0b 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 70a6427d1..ccb938124 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 fb3ece5f3..bea7af36d 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 9378cf85d..59181e36f 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index f85c8eba0..c025e7188 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 6883, stripped down to: 2843 +-- original size: 5347, stripped down to: 2946 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -162,17 +162,15 @@ if flush then local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end end -if ffi and ffi.number then -else - local okay - okay,ffi=pcall(require,"ffi") - if not ffi then - elseif ffi.os=="" or ffi.arch=="" then - ffi=nil - elseif ffi.number then - else - ffi.number=tonumber - end +FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +if not FFISUPPORTED then + local okay;okay,ffi=pcall(require,"ffi") + FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +end +if not FFISUPPORTED then + ffi=nil +elseif not ffi.number then + ffi.number=tonumber end @@ -182,7 +180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-sandbox"] = package.loaded["l-sandbox"] or true --- original size: 10855, stripped down to: 6942 +-- original size: 9979, stripped down to: 6901 if not modules then modules={} end modules ['l-sandbox']={ version=1.001, @@ -326,7 +324,9 @@ function require(name) local n=gsub(name,"^.*[\\/]","") local n=gsub(n,"[%.].*$","") local b=blocked[n] - if b then + if b==false then + return nil + elseif b then if trace then report("using blocked: %s",n) end @@ -342,11 +342,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name]=lib or _G[name] -end -if TEXENGINE=="luajittex" or not ffi then - local ok - ok,ffi=pcall(require,"ffi") + blocked[name]=lib or _G[name] or false end function sandbox.enable() if not sandboxed then @@ -9324,7 +9320,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 8320, stripped down to: 5709 +-- original size: 8290, stripped down to: 5709 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -10048,7 +10044,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20222, stripped down to: 13792 +-- original size: 20239, stripped down to: 13809 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -10456,7 +10452,7 @@ end function sandbox.disablelibraries() validlibraries=false end -if ffi then +if FFISUPPORTED and ffi then function sandbox.disablelibraries() validlibraries=false for k,v in next,ffi do @@ -19970,8 +19966,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 : 848946 --- stripped bytes : 309630 +-- original bytes : 846521 +-- stripped bytes : 307126 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index f85c8eba0..c025e7188 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 6883, stripped down to: 2843 +-- original size: 5347, stripped down to: 2946 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -162,17 +162,15 @@ if flush then local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end end -if ffi and ffi.number then -else - local okay - okay,ffi=pcall(require,"ffi") - if not ffi then - elseif ffi.os=="" or ffi.arch=="" then - ffi=nil - elseif ffi.number then - else - ffi.number=tonumber - end +FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +if not FFISUPPORTED then + local okay;okay,ffi=pcall(require,"ffi") + FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +end +if not FFISUPPORTED then + ffi=nil +elseif not ffi.number then + ffi.number=tonumber end @@ -182,7 +180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-sandbox"] = package.loaded["l-sandbox"] or true --- original size: 10855, stripped down to: 6942 +-- original size: 9979, stripped down to: 6901 if not modules then modules={} end modules ['l-sandbox']={ version=1.001, @@ -326,7 +324,9 @@ function require(name) local n=gsub(name,"^.*[\\/]","") local n=gsub(n,"[%.].*$","") local b=blocked[n] - if b then + if b==false then + return nil + elseif b then if trace then report("using blocked: %s",n) end @@ -342,11 +342,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name]=lib or _G[name] -end -if TEXENGINE=="luajittex" or not ffi then - local ok - ok,ffi=pcall(require,"ffi") + blocked[name]=lib or _G[name] or false end function sandbox.enable() if not sandboxed then @@ -9324,7 +9320,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 8320, stripped down to: 5709 +-- original size: 8290, stripped down to: 5709 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -10048,7 +10044,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20222, stripped down to: 13792 +-- original size: 20239, stripped down to: 13809 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -10456,7 +10452,7 @@ end function sandbox.disablelibraries() validlibraries=false end -if ffi then +if FFISUPPORTED and ffi then function sandbox.disablelibraries() validlibraries=false for k,v in next,ffi do @@ -19970,8 +19966,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 : 848946 --- stripped bytes : 309630 +-- original bytes : 846521 +-- stripped bytes : 307126 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index f85c8eba0..c025e7188 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 6883, stripped down to: 2843 +-- original size: 5347, stripped down to: 2946 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -162,17 +162,15 @@ if flush then local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end end -if ffi and ffi.number then -else - local okay - okay,ffi=pcall(require,"ffi") - if not ffi then - elseif ffi.os=="" or ffi.arch=="" then - ffi=nil - elseif ffi.number then - else - ffi.number=tonumber - end +FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +if not FFISUPPORTED then + local okay;okay,ffi=pcall(require,"ffi") + FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +end +if not FFISUPPORTED then + ffi=nil +elseif not ffi.number then + ffi.number=tonumber end @@ -182,7 +180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-sandbox"] = package.loaded["l-sandbox"] or true --- original size: 10855, stripped down to: 6942 +-- original size: 9979, stripped down to: 6901 if not modules then modules={} end modules ['l-sandbox']={ version=1.001, @@ -326,7 +324,9 @@ function require(name) local n=gsub(name,"^.*[\\/]","") local n=gsub(n,"[%.].*$","") local b=blocked[n] - if b then + if b==false then + return nil + elseif b then if trace then report("using blocked: %s",n) end @@ -342,11 +342,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name]=lib or _G[name] -end -if TEXENGINE=="luajittex" or not ffi then - local ok - ok,ffi=pcall(require,"ffi") + blocked[name]=lib or _G[name] or false end function sandbox.enable() if not sandboxed then @@ -9324,7 +9320,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 8320, stripped down to: 5709 +-- original size: 8290, stripped down to: 5709 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -10048,7 +10044,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20222, stripped down to: 13792 +-- original size: 20239, stripped down to: 13809 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -10456,7 +10452,7 @@ end function sandbox.disablelibraries() validlibraries=false end -if ffi then +if FFISUPPORTED and ffi then function sandbox.disablelibraries() validlibraries=false for k,v in next,ffi do @@ -19970,8 +19966,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 : 848946 --- stripped bytes : 309630 +-- original bytes : 846521 +-- stripped bytes : 307126 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index f85c8eba0..c025e7188 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 6883, stripped down to: 2843 +-- original size: 5347, stripped down to: 2946 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -162,17 +162,15 @@ if flush then local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end end -if ffi and ffi.number then -else - local okay - okay,ffi=pcall(require,"ffi") - if not ffi then - elseif ffi.os=="" or ffi.arch=="" then - ffi=nil - elseif ffi.number then - else - ffi.number=tonumber - end +FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +if not FFISUPPORTED then + local okay;okay,ffi=pcall(require,"ffi") + FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +end +if not FFISUPPORTED then + ffi=nil +elseif not ffi.number then + ffi.number=tonumber end @@ -182,7 +180,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-sandbox"] = package.loaded["l-sandbox"] or true --- original size: 10855, stripped down to: 6942 +-- original size: 9979, stripped down to: 6901 if not modules then modules={} end modules ['l-sandbox']={ version=1.001, @@ -326,7 +324,9 @@ function require(name) local n=gsub(name,"^.*[\\/]","") local n=gsub(n,"[%.].*$","") local b=blocked[n] - if b then + if b==false then + return nil + elseif b then if trace then report("using blocked: %s",n) end @@ -342,11 +342,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name]=lib or _G[name] -end -if TEXENGINE=="luajittex" or not ffi then - local ok - ok,ffi=pcall(require,"ffi") + blocked[name]=lib or _G[name] or false end function sandbox.enable() if not sandboxed then @@ -9324,7 +9320,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 8320, stripped down to: 5709 +-- original size: 8290, stripped down to: 5709 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -10048,7 +10044,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20222, stripped down to: 13792 +-- original size: 20239, stripped down to: 13809 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -10456,7 +10452,7 @@ end function sandbox.disablelibraries() validlibraries=false end -if ffi then +if FFISUPPORTED and ffi then function sandbox.disablelibraries() validlibraries=false for k,v in next,ffi do @@ -19970,8 +19966,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 : 848946 --- stripped bytes : 309630 +-- original bytes : 846521 +-- stripped bytes : 307126 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 360538e07..e3b49959a 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.02.17 13:41} +\newcontextversion{2017.02.18 11:47} %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 48aec809e..c505ce092 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.02.17 13:41} +\edef\contextversion{2017.02.18 11:47} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index dbbb8154a..5f849dd69 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.02.17 13:41} +\newcontextversion{2017.02.18 11:47} %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 e4bf79f0b..5bda44eea 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.02.17 13:41} +\edef\contextversion{2017.02.18 11:47} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/l-lua.lua b/tex/context/base/mkiv/l-lua.lua index adc2c97a8..88cde6d1e 100644 --- a/tex/context/base/mkiv/l-lua.lua +++ b/tex/context/base/mkiv/l-lua.lua @@ -201,83 +201,22 @@ end -- new -if ffi and ffi.number then - -- already loaded -else - local okay - - okay, ffi = pcall(require,"ffi") - - if not ffi then - -- an old version - elseif ffi.os == "" or ffi.arch == "" then - -- no ffi support - ffi = nil - elseif ffi.number then - -- luatex - else - -- luajittex - ffi.number = tonumber - end +FFISUPPORTED = type(ffi) == "table" and ffi.os ~= "" and ffi.arch ~= "" and ffi.load + +if not FFISUPPORTED then + + -- Maybe we should check for LUATEXENGINE but that's also a bti tricky as we still + -- can have a weird ffi library laying around. Checking for presence of 'jit' is + -- also not robust. So for now we hope for the best. + + local okay ; okay, ffi = pcall(require,"ffi") + + FFISUPPORTED = type(ffi) == "table" and ffi.os ~= "" and ffi.arch ~= "" and ffi.load + end --- done differently in context --- --- if ffi then --- local load = ffi.load --- local select = select --- local type = type --- local next = next --- local sort = table.sort --- local gmatch = string.gmatch --- local okay = true --- local control = { } --- function ffi.load(name,...) --- if okay == true or okay[name] then --- return load(name,...) --- else --- return nil --- end --- end --- function control.permit(...) --- if okay == true then --- okay = { } --- end --- for i=1,select("#",...) do --- local n = select(i,...) --- local t = type(n) --- if t == "table" then --- for i=1,#n do --- control.permit(n[i]) --- end --- elseif t == "string" then --- for s in gmatch(n,"[^,%s]+") do --- okay[n] = true --- end --- end --- end --- end --- function control.freeze(none) --- control.permit = function() end --- control.freeze = function() end --- if none then --- okay = { } --- end --- end --- function control.permitted(name) --- if okay == true then --- return true --- elseif type(name) == "string" then --- return okay[name] or false --- else --- -- no helpers yet --- local t = { } --- for k, v in next, okay do --- t[#t+1] = k --- end --- sort(t) --- return t --- end --- end --- ffi.control = control --- end +if not FFISUPPORTED then + ffi = nil +elseif not ffi.number then + ffi.number = tonumber +end diff --git a/tex/context/base/mkiv/l-sandbox.lua b/tex/context/base/mkiv/l-sandbox.lua index a95e70395..7a89aa8cd 100644 --- a/tex/context/base/mkiv/l-sandbox.lua +++ b/tex/context/base/mkiv/l-sandbox.lua @@ -166,7 +166,9 @@ function require(name) local n = gsub(name,"^.*[\\/]","") local n = gsub(n,"[%.].*$","") local b = blocked[n] - if b then + if b == false then + return nil -- e.g. ffi + elseif b then if trace then report("using blocked: %s",n) end @@ -183,12 +185,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name] = lib or _G[name] -end - -if TEXENGINE == "luajittex" or not ffi then - local ok - ok, ffi = pcall(require,"ffi") + blocked[name] = lib or _G[name] or false end function sandbox.enable() @@ -242,31 +239,6 @@ function sandbox.enable() report("not overloaded redefined: %s",concat(skip," | ")) end -- - -- if ffi then - -- report("disabling ffi") - -- -- for k, v in next, ffi do - -- -- if k ~= "gc" then - -- -- local t = type(v) - -- -- if t == "function" then - -- -- ffi[k] = function() report("accessing ffi.%s",k) end - -- -- elseif t == "number" then - -- -- ffi[k] = 0 - -- -- elseif t == "string" then - -- -- ffi[k] = "" - -- -- elseif t == "table" then - -- -- ffi[k] = { } - -- -- else - -- -- ffi[k] = false - -- -- end - -- -- end - -- -- end - -- for k, v in next, ffi do - -- if k ~= "gc" then - -- ffi[k] = nil - -- end - -- end - -- end - -- initializers = nil finalizers = nil originals = nil diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index bc8cf4dbd..93ce1fec2 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -240,6 +240,7 @@ function metapost.load(name,method) script_error = metapost.scripterror, make_text = metapost.maketext, extensions = 1, + -- random_seed = seed, } report_metapost("initializing number mode %a",method) local result diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex b70fcf6f0..de32cee5f 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 c47682fe6..584d6e654 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index 2aecb6703..f66485015 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -45,9 +45,7 @@ end local ticks = clock local seconds = function(n) return n or 0 end --- local okay, ffi = pcall(require,"ffi") --- --- if ffi and os.type == "windows" then +-- if FFISUPPORTED and ffi and os.type == "windows" then -- -- local okay, kernel = pcall(ffi.load,"kernel32") -- diff --git a/tex/context/base/mkiv/util-sbx.lua b/tex/context/base/mkiv/util-sbx.lua index 9cedcc1a6..48c424f00 100644 --- a/tex/context/base/mkiv/util-sbx.lua +++ b/tex/context/base/mkiv/util-sbx.lua @@ -530,7 +530,7 @@ function sandbox.disablelibraries() validlibraries = false end -if ffi then +if FFISUPPORTED and ffi then function sandbox.disablelibraries() validlibraries = false diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 52980cfbd..3a86b8090 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 5c51ce0b6..374b0ec39 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 952ed19ac..8df4c966b 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 : 02/17/17 13:41:40 +-- merge date : 02/18/17 11:47:12 do -- begin closure to overcome local limits and interference @@ -108,17 +108,15 @@ if flush then local spawn=os.spawn if spawn then function os.spawn (...) flush() return spawn (...) end end local popen=io.popen if popen then function io.popen (...) flush() return popen (...) end end end -if ffi and ffi.number then -else - local okay - okay,ffi=pcall(require,"ffi") - if not ffi then - elseif ffi.os=="" or ffi.arch=="" then - ffi=nil - elseif ffi.number then - else - ffi.number=tonumber - end +FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +if not FFISUPPORTED then + local okay;okay,ffi=pcall(require,"ffi") + FFISUPPORTED=type(ffi)=="table" and ffi.os~="" and ffi.arch~="" and ffi.load +end +if not FFISUPPORTED then + ffi=nil +elseif not ffi.number then + ffi.number=tonumber end end -- closure |