summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-03-02 10:57:49 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-03-02 10:57:49 +0100
commit6c9a5085dc2cee2c277d69d2dfcb397dab7aeb19 (patch)
tree8b2f4caaae13e3e138fe474ce7888b9e30e374c0 /tex
parent0da55392b876cef55845157c4bfb8244d84c6450 (diff)
downloadcontext-6c9a5085dc2cee2c277d69d2dfcb397dab7aeb19.tar.gz
2017-03-02 10:11:00
Diffstat (limited to 'tex')
-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-io.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25656 -> 25657 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin420944 -> 421009 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin804051 -> 804052 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60771 -> 60771 bytes
-rw-r--r--tex/generic/context/luatex/luatex-core.lua180
-rw-r--r--tex/generic/context/luatex/luatex-core.tex30
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
12 files changed, 217 insertions, 7 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index ffee0b4d9..49b0f149f 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.03.01 13:40}
+\newcontextversion{2017.03.02 10:05}
%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 55f420e79..b70b3dbc2 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.03.01 13:40}
+\edef\contextversion{2017.03.02 10:05}
%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 8578cd188..51e03207c 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.03.01 13:40}
+\newcontextversion{2017.03.02 10:05}
%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 bd4fbb462..8123bc4ed 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.03.01 13:40}
+\edef\contextversion{2017.03.02 10:05}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/l-io.lua b/tex/context/base/mkiv/l-io.lua
index 75976b858..75e704a34 100644
--- a/tex/context/base/mkiv/l-io.lua
+++ b/tex/context/base/mkiv/l-io.lua
@@ -169,7 +169,7 @@ end
-- ffi.readline
-if fio.readline then
+if fio and fio.readline then
local readline = fio.readline
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 7389dfad5..81b4701a9 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 0adbb8f77..5e2155247 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/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 1418c1aea..d861de701 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 d05ac8701..3ab1ec48f 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-core.lua b/tex/generic/context/luatex/luatex-core.lua
new file mode 100644
index 000000000..ac552e70a
--- /dev/null
+++ b/tex/generic/context/luatex/luatex-core.lua
@@ -0,0 +1,180 @@
+-- if not modules then modules = { } end modules ['luatex-core'] = {
+-- version = 1.001,
+-- comment = 'companion to luatex',
+-- author = 'Hans Hagen & Luigi Scarso',
+-- copyright = 'LuaTeX Development Team',
+-- }
+
+LUATEXCOREVERSION = 1.001
+
+-- This file overloads some Lua functions. The readline variants provide the same
+-- functionality as LuaTeX <= 1.04 and doing it this way permits us to keep the
+-- original io libraries clean. Performance is probably even a bit better now.
+
+local type, next, getmetatable, require = type, next, getmetatable, require
+local find, gsub = string.find, string.gsub
+
+local io_open = io.open
+local io_popen = io.popen
+local io_line = io.lines
+
+local fio_readline = fio.readline
+local fio_checkpermission = fio.checkpermission
+local fio_recordfilename = fio.recordfilename
+
+local mt = getmetatable(io.stderr)
+local mt_lines = mt.lines
+
+local saferoption = status.safer_option
+local shellescape = status.shell_escape -- 0 (disabled) 1 (restricted) 2 (everything)
+local kpseused = status.kpse_used -- 0 1
+
+io.saved_open = io_open -- can be protected
+io.saved_popen = io_popen -- can be protected
+io.saved_lines = io_lines -- always readonly
+mt.saved_lines = mt_lines -- always readonly
+
+local function luatex_io_open(name,how)
+ if not how then
+ how = 'r'
+ end
+ local f = io_open(name,how)
+ if f then
+ if type(how) == 'string' and find(how,'w') then
+ fio_recordfilename(name,'w')
+ else
+ fio_recordfilename(name,'r')
+ end
+ end
+ return f
+end
+
+local function luatex_io_open_readonly(name,how)
+ if how then
+ how = 'r'
+ else
+ how = gsub(how,'[^rb]','')
+ if how == '' then
+ how = 'r'
+ end
+ end
+ local f = io_open(name,how)
+ if f then
+ fio_recordfilename(name,'r')
+ end
+ return f
+end
+
+local function luatex_io_popen(name,...)
+ local okay, found = fio_checkpermission(name)
+ if okay and found then
+ return io_popen(found,...)
+ end
+end
+
+local function luatex_io_lines(name)
+ local f = io_open(name,'r')
+ if f then
+ return function()
+ return fio_readline(f)
+ end
+ end
+end
+
+local function luatex_io_readline(f)
+ return function()
+ return fio_readline(f)
+ end
+end
+
+io.lines = luatex_io_lines
+mt.lines = luatex_io_readline
+
+-- We assume management to be provided by the replacement of kpse. This is the
+-- case in ConTeXt.
+
+if kpseused == 1 then
+
+ io.open = luatex_io_open
+ io.popen = luatex_io_popen
+
+ if saferoption then
+
+ os.execute = nil
+ os.spawn = nil
+ os.exec = nil
+ os.setenv = nil
+ os.tempdir = nil
+
+ io.popen = nil
+ io.open = nil
+
+ os.rename = nil
+ os.remove = nil
+
+ io.tmpfile = nil
+ io.output = nil
+
+ lfs.chdir = nil
+ lfs.lock = nil
+ lfs.touch = nil
+ lfs.rmdir = nil
+ lfs.mkdir = nil
+
+ io.saved_popen = nil
+ io.saved_open = luatex_io_open_readonly
+
+ end
+
+ if saferoption or shellescape ~= 2 then
+ local ffi = require('ffi')
+ for k, v in next, ffi do
+ if k ~= 'gc' then
+ ffi[k] = nil
+ end
+ ffi = nil
+ end
+ end
+
+ -- os.[execute|os.spawn|os.exec] already are shellescape aware)
+
+end
+
+if utilities and utilities.merger and utilities.merger.compact then
+
+ local byte, format, gmatch = string.byte, string.format, string.gmatch
+ local concat = table.concat
+
+ local data = gsub(io.loaddata('luatex-core.lua'),'if%s+utilities.*','')
+ local t = { }
+ local r = { }
+ local n = 0
+ local d = gsub(data,'\r\n','\n') -- be nice for unix
+ local s = utilities.merger.compact(d) -- no comments and less spaces
+
+ -- t[#t+1] = format('/*\n\n%s\n\n*/',d)
+ t[#t+1] = 'int load_luatex_core_lua (lua_State * L)'
+ t[#t+1] = '{'
+ t[#t+1] = ' /* generated from and by luatex-core.lua */'
+ t[#t+1] = ' static unsigned char luatex_core_lua[] = {'
+ for c in gmatch(d,'.') do
+ if n == 16 then
+ n = 1
+ t[#t+1] = ' ' .. concat(r,', ') .. ','
+ else
+ n = n + 1
+ end
+ r[n] = format('0x%02x',byte(c))
+ end
+ n = n + 1
+ r[n] = '0x00'
+ t[#t+1] = ' ' .. concat(r,', ',1,n)
+ t[#t+1] = ' };'
+ -- t[#t+1] = format('unsigned int luatex_core_lua_len = 0x%x;',#d+1)
+ t[#t+1] = ' return luaL_dostring(L, (const char*) luatex_core_lua);'
+ t[#t+1] = '}'
+
+ io.savedata('luatex-core.c',concat(t,'\n'))
+ io.savedata('luatex-core-stripped.lua',s)
+
+end
diff --git a/tex/generic/context/luatex/luatex-core.tex b/tex/generic/context/luatex/luatex-core.tex
new file mode 100644
index 000000000..2e7c7d5d4
--- /dev/null
+++ b/tex/generic/context/luatex/luatex-core.tex
@@ -0,0 +1,30 @@
+\starttext
+
+\startluacode
+
+ local report = logs.reporter("core")
+
+ report("kpse used : %i",status.kpse_used)
+ report("shell escape : %i",status.shell_escape)
+ report("shell restricted : %i",status.shell_restricted)
+ report("safer option : %i",status.safer_option)
+
+ if false then
+
+ for l in io.open("luatex-core.lua"):lines() do
+ print(l)
+ end
+
+ for l in io.lines("luatex-core.lua") do
+ print(l)
+ end
+
+ end
+
+\stopluacode
+
+\startTEXpage[foregroundstyle=mono,offset=10pt]
+ LUATEXCOREVERSION: \cldcontext{LUATEXCOREVERSION}
+\stopTEXpage
+
+\stoptext
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2690045cf..90077e8f7 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 : 03/01/17 13:40:58
+-- merge date : 03/02/17 10:05:26
do -- begin closure to overcome local limits and interference
@@ -2124,7 +2124,7 @@ function io.savedata(filename,data,joiner)
return false
end
end
-if fio.readline then
+if fio and fio.readline then
local readline=fio.readline
function io.loadlines(filename,n)
local f=open(filename,'r')