summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-18 13:39:16 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-18 13:39:16 +0100
commit601e63e757d4cf40d5923cee4b6b3debff57364c (patch)
tree90d3a5f505508efd67ca33b3c157c59d797bb989 /tex/context
parentfcd7cdd22ff42dab791f9f825b642caa3cc63300 (diff)
downloadcontext-601e63e757d4cf40d5923cee4b6b3debff57364c.tar.gz
2017-02-18 11:52:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/l-lua.lua95
-rw-r--r--tex/context/base/mkiv/l-sandbox.lua36
-rw-r--r--tex/context/base/mkiv/mlib-run.lua1
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25656 -> 25660 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin372480 -> 372464 bytes
-rw-r--r--tex/context/base/mkiv/trac-inf.lua4
-rw-r--r--tex/context/base/mkiv/util-sbx.lua2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin804334 -> 804328 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60764 -> 60764 bytes
13 files changed, 28 insertions, 118 deletions
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
index b70fcf6f0..de32cee5f 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index c47682fe6..584d6e654 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
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
index 52980cfbd..3a86b8090 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 5c51ce0b6..374b0ec39 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ