summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-03-24 19:41:20 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-03-24 19:41:20 +0100
commitdc54cea46e02502b4474a0fa132466974a9cc19c (patch)
tree403096f7ba8345b5dea1f925765523f7d52bd645 /tex
parent576286d4c1349c644bea833c99ec5364668ffc8a (diff)
downloadcontext-dc54cea46e02502b4474a0fa132466974a9cc19c.tar.gz
2017-03-24 19:13: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/buff-ini.lua72
-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/grph-fig.mkiv9
-rw-r--r--tex/context/base/mkiv/math-fen.mkiv7
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25647 -> 25637 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin422616 -> 422699 bytes
-rw-r--r--tex/context/base/mkiv/util-sbx.lua13
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin804366 -> 804374 bytes
-rw-r--r--tex/context/interface/mkiv/i-mathfence.xml2
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60772 -> 60772 bytes
-rw-r--r--tex/context/modules/mkiv/m-asymptote.lua38
-rw-r--r--tex/context/modules/mkiv/m-asymptote.mkiv130
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
16 files changed, 255 insertions, 26 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 74e8c6681..2dd5d3783 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.23 17:20}
+\newcontextversion{2017.03.24 19:06}
%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 e4c100754..5c88b9193 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.23 17:20}
+\edef\contextversion{2017.03.24 19:06}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua
index 2b3270300..a2f8914ff 100644
--- a/tex/context/base/mkiv/buff-ini.lua
+++ b/tex/context/base/mkiv/buff-ini.lua
@@ -14,6 +14,9 @@ local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match
local utfchar = utf.char
local nameonly = file.nameonly
local totable = string.totable
+local md5hex = md5.hex
+local isfile = lfs.isfile
+local savedata = io.savedata
local trace_run = false trackers.register("buffers.run", function(v) trace_run = v end)
local trace_grab = false trackers.register("buffers.grab", function(v) trace_grab = v end)
@@ -62,6 +65,9 @@ local catcodenumbers = catcodes.numbers
local ctxcatcodes = catcodenumbers.ctxcatcodes
local txtcatcodes = catcodenumbers.txtcatcodes
+local setdata = job.datasets.setdata
+local getdata = job.datasets.getdata
+
buffers = buffers or { }
local buffers = buffers
@@ -486,6 +492,7 @@ implement {
local oldhashes = nil
local newhashes = nil
+local getrunner = sandbox.getrunner
local runner = sandbox.registerrunner {
name = "run buffer",
@@ -498,23 +505,46 @@ local runner = sandbox.registerrunner {
}
}
-local function runbuffer(name,encapsulate)
+local function runbuffer(name,encapsulate,runnername,suffix,extra)
+ if not runnername or runnername == "" then
+ runnername = "run buffer"
+ end
+ if not suffix or suffix == "" then
+ suffix = "pdf"
+ end
+ local runner = getrunner(runnername)
+ if not runner then
+ report_typeset("unknown runner %a",runnername)
+ return
+ end
if not oldhashes then
- oldhashes = job.datasets.getdata("typeset buffers","hashes") or { }
- for hash, n in next, oldhashes do
- local tag = formatters["%s-t-b-%s"](tex.jobname,hash)
- registertempfile(addsuffix(tag,"tmp")) -- to be sure
- registertempfile(addsuffix(tag,"pdf"))
- end
+ oldhashes = getdata("typeset buffers","hashes") or { }
+ end
+ if not newhashes then
newhashes = {
- version = environment.version,
+ version = environment.version
}
- job.datasets.setdata {
+ setdata {
name = "typeset buffers",
tag = "hashes",
data = newhashes,
}
end
+ local old = oldhashes[suffix]
+ local new = newhashes[suffix]
+ if not old then
+ old = { }
+ oldhashes[suffix] = old
+ for hash, n in next, old do
+ local tag = formatters["%s-t-b-%s"](tex.jobname,hash)
+ registertempfile(addsuffix(tag,"tmp")) -- to be sure
+ registertempfile(addsuffix(tag,suffix))
+ end
+ end
+ if not new then
+ new = { }
+ newhashes[suffix] = new
+ end
local names = getnames(name)
local content = collectcontent(names,nil) or ""
if content == "" then
@@ -524,23 +554,23 @@ local function runbuffer(name,encapsulate)
content = formatters["\\starttext\n%s\n\\stoptext\n"](content)
end
--
- local hash = md5.hex(content)
+ local hash = md5hex(content)
local tag = formatters["%s-t-b-%s"](nameonly(tex.jobname),hash) -- make sure we run on the local path
--
local filename = addsuffix(tag,"tmp")
- local resultname = addsuffix(tag,"pdf")
+ local resultname = addsuffix(tag .. (extra or ""),suffix)
--
- if newhashes[hash] then
+ if new[hash] then
-- done
- elseif not oldhashes[hash] or oldhashes.version ~= newhashes.version or not lfs.isfile(resultname) then
+ elseif not old[hash] or oldhashes.version ~= newhashes.version or not isfile(resultname) then
if trace_run then
report_typeset("changes in %a, processing forced",name)
end
- io.savedata(filename,content)
+ savedata(filename,content)
report_typeset("processing saved buffer %a\n",filename)
runner { filename = filename }
end
- newhashes[hash] = (newhashes[hash] or 0) + 1
+ new[hash] = (new[hash] or 0) + 1
report_typeset("no changes in %a, processing skipped",name)
registertempfile(filename)
registertempfile(resultname,nil,true)
@@ -575,18 +605,26 @@ local function gettexbuffer(name)
end
end
+buffers.run = runbuffer
+
implement { name = "getbufferctxlua", actions = loadcontent, arguments = "string" }
implement { name = "getbuffer", actions = getbuffer, arguments = "string" }
implement { name = "getbuffermkvi", actions = getbuffermkvi, arguments = "string" }
implement { name = "gettexbuffer", actions = gettexbuffer, arguments = "string" }
implement {
- name = "runbuffer",
+ name = "typesetbuffer",
actions = { runbuffer, context },
arguments = { "string", true }
}
implement {
+ name = "runbuffer",
+ actions = { runbuffer, context },
+ arguments = { "string", false, "string" }
+}
+
+implement {
name = "doifelsebuffer",
actions = { exists, commands.doifelse },
arguments = "string"
@@ -623,4 +661,4 @@ do
stopcollecting()
end
- end
+end
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index ae8d8b1f0..e382b6282 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.23 17:20}
+\newcontextversion{2017.03.24 19:06}
%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 940c5de76..4012e29dd 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.23 17:20}
+\edef\contextversion{2017.03.24 19:06}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/grph-fig.mkiv b/tex/context/base/mkiv/grph-fig.mkiv
index 80b094d83..1fdc0caa0 100644
--- a/tex/context/base/mkiv/grph-fig.mkiv
+++ b/tex/context/base/mkiv/grph-fig.mkiv
@@ -53,7 +53,7 @@
\fi\fi}
\def\grph_buffers_typeset_indeed[#1][#2]% we could use the via files
- {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\clf_runbuffer{#1}}}%
+ {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\clf_typesetbuffer{#1}}}%
\ifcase\c_grph_buffers_mode
% typesetonly
\or
@@ -61,6 +61,13 @@
\fi
\egroup}
+\unexpanded\def\runbuffer % for now
+ {\dotripleempty\grph_buffers_run_indeed}
+
+\def\grph_buffers_run_indeed[#1][#2]%
+ {\xdef\lasttypesetbuffer{\clf_runbuffer{#1}{#2}}}
+
+
% For manuals and such:
%
% \definetypesetting [name] [options] [settings-a]
diff --git a/tex/context/base/mkiv/math-fen.mkiv b/tex/context/base/mkiv/math-fen.mkiv
index 9c856904e..320dffeb8 100644
--- a/tex/context/base/mkiv/math-fen.mkiv
+++ b/tex/context/base/mkiv/math-fen.mkiv
@@ -44,7 +44,7 @@
\c!mathstyle=,
\c!color=,
\c!command=,
- \c!factor=] % == auto == none
+ \c!factor=\v!auto]
\appendtoks
\edef\p_command{\mathfenceparameter\c!command}%
@@ -64,10 +64,11 @@
\edef\p_factor{\mathfenceparameter\c!factor}%
\ifx\p_factor\empty
#2%
- \else\ifx\p_factor\v!none
- #2%
\else\ifx\p_factor\v!auto
#2%
+ \else\ifx\p_factor\v!none
+ #3\s!height\zeropoint\s!depth\zeropoint\s!axis
+ #2%
\else
\scratchdimen\dimexpr\p_factor\bodyfontsize/2\relax
#3\s!height\scratchdimen\s!depth\scratchdimen\s!axis
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 0490d86ec..9fdfe1ddd 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 61a645e8a..b5e8cb4fd 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/util-sbx.lua b/tex/context/base/mkiv/util-sbx.lua
index 0db2e0295..66a650875 100644
--- a/tex/context/base/mkiv/util-sbx.lua
+++ b/tex/context/base/mkiv/util-sbx.lua
@@ -369,6 +369,9 @@ local runners = {
resultof = function(...)
local command = validcommand(...)
if command then
+ if trace then
+ report("resultof: %s",command)
+ end
local handle = iopopen(command,"r") -- already has flush
if handle then
local result = handle:read("*all") or ""
@@ -380,12 +383,18 @@ local runners = {
execute = function(...)
local command = validcommand(...)
if command then
+ if trace then
+ report("execute: %s",command)
+ end
return osexecute(command)
end
end,
pipeto = function(...)
local command = validcommand(...)
if command then
+ if trace then
+ report("pipeto: %s",command)
+ end
return iopopen(command,"w") -- already has flush
end
end,
@@ -447,6 +456,10 @@ function sandbox.registerrunner(specification)
end
end
+function sandbox.getrunner(name)
+ return name and validrunners[name]
+end
+
local function suspicious(str)
return (find(str,"[/\\]") or find(command,"%.%.")) and true or false
end
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index f52cf52d3..62445fb29 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-mathfence.xml b/tex/context/interface/mkiv/i-mathfence.xml
index f20f57057..9676e2a37 100644
--- a/tex/context/interface/mkiv/i-mathfence.xml
+++ b/tex/context/interface/mkiv/i-mathfence.xml
@@ -41,6 +41,8 @@
<cd:constant type="auto"/>
</cd:parameter>
<cd:parameter name="factor">
+ <cd:constant type="auto" default="yes"/>
+ <cd:constant type="none"/>
<cd:constant type="number"/>
</cd:parameter>
</cd:assignments>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index e224afca9..8648be396 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua
new file mode 100644
index 000000000..99efc4910
--- /dev/null
+++ b/tex/context/modules/mkiv/m-asymptote.lua
@@ -0,0 +1,38 @@
+if not modules then modules = { } end modules ['m-asymptote'] = {
+ version = 1.001,
+ comment = "companion to m-pstricks.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- See m-asymptote.mkiv for some comment.
+
+local context = context
+local replacesuffix = file.replacesuffix
+
+moduledata.asymptote = { }
+
+sandbox.registerrunner {
+ name = "asymptote",
+ program = "asy",
+ method = "execute",
+ template = '-noV -config="" -tex=pdflatex -outformat="prc" "%filename%"',
+ -- template = '-noV -config="" -tex=context -outformat="prc" "%filename%"',
+ checkers = {
+ filename = "readable",
+ }
+}
+
+function moduledata.asympote.process(name)
+ local result = buffers.run( -- experimental
+ name, -- name of the buffer
+ false, -- no wrapping
+ "asymptote", -- name of the process
+ "prc" -- suffix of result
+ )
+ parametersets[name] = {
+ js = replacesuffix(result,"js")
+ }
+ context(result)
+end
diff --git a/tex/context/modules/mkiv/m-asymptote.mkiv b/tex/context/modules/mkiv/m-asymptote.mkiv
new file mode 100644
index 000000000..adeb7700f
--- /dev/null
+++ b/tex/context/modules/mkiv/m-asymptote.mkiv
@@ -0,0 +1,130 @@
+%D \module
+%D [ file=m-asymptote,
+%D version=2017.03.24,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Asymptote,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% \enabletrackers[sandbox,buffers.run]
+
+%D Currently asymptote assumes \MKII\ but better is to only support \MKIV. A problem
+%D is that asymptote has this hard coded while for \CONTEXT\ it's better to stick to
+%D something simple:
+%D
+%D \starttyping
+%D \starttext
+%D
+%D \startasymptotepage
+%D some label
+%D \stopasymptotepage
+%D
+%D \startasymptotepage
+%D some label
+%D \stopasymptotepage
+%D
+%D \stoptext
+%D \stoptyping
+%D
+%D Which is then run with:
+%D
+%D \starttyping
+%D context --nonstopmode --purge somefile.tex
+%D \stoptyping
+%D
+%D Another issue is that prc output only works when we use pdflatex as \TEX\ engine
+%D but I might miss some magic flag here.
+%D
+%D For some reason \type {//} comments don't work, maybe because of some newline
+%D issue so one should use \type {/* ... */} instead.
+
+\registerctxluafile{m-asymptote}{}
+
+\unprotect
+
+\unexpanded\def\asymptote
+ {\dodoubleempty\module_asymptote}
+
+\unexpanded\def\module_asymptote[#1][#2]%
+ {\iffirstargument
+ \edef\lasttypesetbuffer{\ctxlua{moduledata.asympote.process("asymptote:#1")}}%
+ \externalfigure
+ [\lasttypesetbuffer]%
+ [\c!controls=\lasttypesetbuffer,#2]%
+ \fi}
+
+\unexpanded\def\startasymptote[#1]%
+ {\begingroup
+ \dostartbuffer[asymptote:#1][startasymptote][stopasymptote]}
+
+\unexpanded\def\stopasymptote
+ {\endgroup}
+
+\definefittingpage
+ [asymptotepage]
+ [\c!align=\v!normal]
+
+\protect
+
+\continueifinputfile{m-asymptote.mkiv}
+
+\starttext
+
+\startasymptote[demo]
+/* settings.inlineimage=true; */
+/* settings.embed=true; */
+/* settings.toolbar=false; */
+
+import graph3;
+import palette;
+
+size(6cm,6cm);
+size3(5cm,0);
+
+currentprojection=orthographic(3,-6,12);
+currentlight=light(8,10,2);
+
+real g(pair z) {return 1-z.x^2-z.y^2;}
+real f(pair z) {return -2z.x+2;}
+
+real x(real t) {return t;}
+real y(real t) {return 0;}
+real z(real t) {return 1-t^2;}
+real a(real t) {return 1;}
+real b(real t) {return t;}
+real c(real t) {return -t^2;}
+
+path3 p=graph(x,y,z,-2,2,operator ..);
+path3 o=graph(a,b,c,-2,2,operator ..);
+
+surface r=surface(f,(0,-1),(2,1),nx=3,Spline);
+surface s=surface(g,(-2,-2),(2,2),nx=5,Spline);
+
+path3 q=(-2,-2,-7)--(2,-2,-7)--(2,2,-7)--(-2,2,-7)--cycle;
+
+draw(q);
+
+draw(p,blue+thick(),Arrow3);
+draw(o,blue+thick(),Arrow3);
+
+draw(s,lightgray+opacity(0.8),nolight,meshpen=black+thick());
+draw(r,lightgray+opacity(0.8),nolight,meshpen=black+thick());
+
+draw((1,0,0)--(2,0,-2),black,Arrow3);
+draw((1,0,0)--(1,1,0),black,Arrow3);
+\stopasymptote
+
+% \typebuffer[asymptote:demo]
+
+\asymptote[demo][width=4cm,frame=on]
+
+\startasymptotepage
+ test
+\stopasymptotepage
+
+\stoptext
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5443b4e42..bb9728c7c 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/23/17 17:20:25
+-- merge date : 03/24/17 19:06:17
do -- begin closure to overcome local limits and interference