summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-10-16 18:23:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-10-16 18:23:00 +0200
commit5f5f059b294f1cd20c306d1c7b03ff211740c814 (patch)
treecc4be05f3409d4247a29067240e8cc53fc2e2d4f
parent14c9c4a29887284d2a4756e418be08352ccb5184 (diff)
downloadcontext-5f5f059b294f1cd20c306d1c7b03ff211740c814.tar.gz
beta 2012.10.16 18:23
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4141 -> 4147 bytes
-rw-r--r--tex/context/base/context-version.pngbin105420 -> 106541 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/m-chart.lua159
-rw-r--r--tex/context/base/m-chart.mkii2
-rw-r--r--tex/context/base/m-chart.mkvi70
-rw-r--r--tex/context/base/status-files.pdfbin24569 -> 24568 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin195391 -> 195391 bytes
-rw-r--r--tex/context/base/tabl-tbl.mkiv64
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 218 insertions, 87 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 5ccc3660b..2d4158df1 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.16 11:04}
+\newcontextversion{2012.10.16 18:23}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 658b87e80..6b172c1b3 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.16 11:04}
+\newcontextversion{2012.10.16 18:23}
%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/context-version.pdf b/tex/context/base/context-version.pdf
index 6022563a9..4aab958f5 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index ce6516c92..6a484eaa7 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index a758b0554..b609ea75f 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.16 11:04}
+\edef\contextversion{2012.10.16 18:23}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 630bd4425..20c77c44d 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.16 11:04}
+\edef\contextversion{2012.10.16 18:23}
%D For those who want to use this:
diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua
index 32de8a5ba..a00f246a9 100644
--- a/tex/context/base/m-chart.lua
+++ b/tex/context/base/m-chart.lua
@@ -15,11 +15,11 @@ moduledata.charts = moduledata.charts or { }
local gsub, match, find, format, lower = string.gsub, string.match, string.find, string.format, string.lower
local setmetatableindex = table.setmetatableindex
+local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match
-local P, S, C, Cc = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc
-local lpegmatch = lpeg.match
+local report_chart = logs.reporter("chart")
-local points = number.points
+local points = number.points
local variables = interfaces.variables
@@ -27,7 +27,6 @@ local v_yes = variables.yes
local v_no = variables.no
local v_none = variables.none
local v_standard = variables.standard
-local v_start = variables.start
local v_overlay = variables.overlay
local v_round = variables.round
local v_test = variables.test
@@ -672,7 +671,7 @@ local function process_texts(chart,xoffset,yoffset)
end
end
-local function getchart(settings)
+local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
if not settings then
print("no settings given")
return
@@ -688,7 +687,7 @@ local function getchart(settings)
return
end
chart = expanded(chart,settings)
- local cc_settings = chart.settings.chart
+ local chartsettings = chart.settings.chart
local autofocus = chart.settings.chart.autofocus
if autofocus then
autofocus = utilities.parsers.settings_to_hash(autofocus)
@@ -697,10 +696,10 @@ local function getchart(settings)
end
end
-- check natural window
- local x = tonumber(cc_settings.x)
- local y = tonumber(cc_settings.y)
- local nx = tonumber(cc_settings.nx)
- local ny = tonumber(cc_settings.ny)
+ local x = forced_x or tonumber(chartsettings.x)
+ local y = forced_y or tonumber(chartsettings.y)
+ local nx = forced_nx or tonumber(chartsettings.nx)
+ local ny = forced_ny or tonumber(chartsettings.ny)
--
local minx, miny, maxx, maxy = 0, 0, 0, 0
local data = chart.data
@@ -715,8 +714,8 @@ local function getchart(settings)
if miny == 0 or y > maxy then maxy = y end
end
end
--- print("1>",x,y,nx,ny)
--- print("2>",minx, miny, maxx, maxy)
+ -- print("1>",x,y,nx,ny)
+ -- print("2>",minx, miny, maxx, maxy)
-- check of window should be larger (maybe autofocus + nx/ny?)
if autofocus then
-- x and y are ignored
@@ -762,7 +761,9 @@ local function getchart(settings)
end
local function makechart(chart)
- local settings = chart.settings
+ local settings = chart.settings
+ local chartsettings = settings.chart
+ --
context.begingroup()
context.forgetall()
--
@@ -770,27 +771,27 @@ local function makechart(chart)
context("if unknown context_flow : input mp-char.mpiv ; fi ;")
context("flow_begin_chart(0,%s,%s);",chart.nx,chart.ny)
--
- if settings.chart.option == v_test or settings.chart.dot == v_yes then
+ if chartsettings.option == v_test or chartsettings.dot == v_yes then
context("flow_show_con_points := true ;")
context("flow_show_mid_points := true ;")
context("flow_show_all_points := true ;")
- elseif settings.chart.dot ~= "" then -- no checking done, private option
- context("flow_show_%s_points := true ;",settings.chart.dot)
+ elseif chartsettings.dot ~= "" then -- no checking done, private option
+ context("flow_show_%s_points := true ;",chartsettings.dot)
end
--
- local backgroundcolor = settings.chart.backgroundcolor
+ local backgroundcolor = chartsettings.backgroundcolor
if backgroundcolor and backgroundcolor ~= "" then
context("flow_chart_background_color := \\MPcolor{%s} ;",backgroundcolor)
end
--
- local shapewidth = settings.chart.width
- local gridwidth = shapewidth + 2*settings.chart.dx
- local shapeheight = settings.chart.height
- local gridheight = shapeheight + 2*settings.chart.dy
- local chartoffset = settings.chart.offset
- local labeloffset = settings.chart.labeloffset
- local exitoffset = settings.chart.exitoffset
- local commentoffset = settings.chart.commentoffset
+ local shapewidth = chartsettings.width
+ local gridwidth = shapewidth + 2*chartsettings.dx
+ local shapeheight = chartsettings.height
+ local gridheight = shapeheight + 2*chartsettings.dy
+ local chartoffset = chartsettings.offset
+ local labeloffset = chartsettings.labeloffset
+ local exitoffset = chartsettings.exitoffset
+ local commentoffset = chartsettings.commentoffset
context("flow_grid_width := %s ;", points(gridwidth))
context("flow_grid_height := %s ;", points(gridheight))
context("flow_shape_width := %s ;", points(shapewidth))
@@ -802,8 +803,8 @@ local function makechart(chart)
--
local radius = settings.line.radius
local rulethickness = settings.line.rulethickness
- local dx = settings.chart.dx
- local dy = settings.chart.dy
+ local dx = chartsettings.dx
+ local dy = chartsettings.dy
if radius < rulethickness then
radius = 2.5*rulethickness
if radius > dx then
@@ -818,7 +819,7 @@ local function makechart(chart)
context("flow_connection_arrow_size := %s ;", points(radius))
context("flow_connection_dash_size := %s ;", points(radius))
--
- local offset = settings.chart.offset -- todo: pass string
+ local offset = chartsettings.offset -- todo: pass string
if offset == v_none or offset == v_overlay or offset == "" then
offset = -2.5 * radius -- or rulethickness?
elseif offset == v_standard then
@@ -836,42 +837,80 @@ local function makechart(chart)
context.endgroup()
end
+local function splitchart(chart)
+ local settings = chart.settings
+ local splitsettings = settings.split
+ local chartsettings = settings.chart
+ --
+ local name = chartsettings.name
+ --
+ local from_x = chart.from_x
+ local from_y = chart.from_y
+ local to_x = chart.to_x
+ local to_y = chart.to_y
+ --
+ local step_x = splitsettings.nx or to_x
+ local step_y = splitsettings.ny or to_y
+ local delta_x = splitsettings.dx or 0
+ local delta_y = splitsettings.dy or 0
+ --
+ report_chart("spliting %q: from (%s,%s) upto (%s,%s) into (%s,%s) with overlap (%s,%s)",
+ name,from_x,from_y,to_x,to_y,step_x,step_y,delta_x,delta_y)
+ --
+ local part_x = 0
+ local first_x = from_x
+ while true do
+ part_x = part_x + 1
+ local last_x = first_x + step_x - 1
+ local done = last_x >= to_x
+ if done then
+ last_x = to_x
+ end
+ local part_y = 0
+ local first_y = from_y
+ while true do
+ part_y = part_y + 1
+ local last_y = first_y + step_y - 1
+ local done = last_y >= to_y
+ if done then
+ last_y = to_y
+ end
+ --
+ report_chart("part (%s,%s) of %q: (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y)
+ local x, y, nx, ny = first_x, first_y, last_x - first_x + 1,last_y - first_y + 1
+ context.beforeFLOWsplit()
+ context.handleFLOWsplit(function()
+ makechart(getchart(settings,x,y,nx,ny)) -- we need to pass frozen settings !
+ end)
+ context.afterFLOWsplit()
+ --
+ if done then
+ break
+ else
+ first_y = last_y + 1 - delta_y
+ end
+ end
+ if done then
+ break
+ else
+ first_x = last_x + 1 - delta_x
+ end
+ end
+end
+
function commands.flow_make_chart(settings)
local chart = getchart(settings)
if chart then
local settings = chart.settings
--- if settings.split.state == v_start then
--- local nx = chart.settings.split.nx
--- local ny = chart.settings.split.ny
--- local x = 1
--- while true do
--- local y = 1
--- while true do
--- -- FLOTbefore
--- -- doif @@FLOTmarking on -> cuthbox
--- -- @@FLOTcommand
--- chart.from_x = x
--- chart.from_y = y
--- chart.to_x = math.min(x + nx - 1,chart.nx)
--- chart.to_y = math.min(x + ny - 1,chart.ny)
--- makechart(chart)
--- -- FLOTafter
--- y = y + ny
--- if y > chart.max_y then
--- break
--- else
--- y = y - dy
--- end
--- end
--- x = x + nx
--- if x > chart.max_x then
--- break
--- else
--- x = x - dx
--- end
--- end
--- else
+ if settings then
+ local chartsettings = settings.chart
+ if chartsettings and chartsettings.split == v_yes then
+ splitchart(chart)
+ else
+ makechart(chart)
+ end
+ else
makechart(chart)
--- end
+ end
end
end
diff --git a/tex/context/base/m-chart.mkii b/tex/context/base/m-chart.mkii
index 13403966b..8a5f480ee 100644
--- a/tex/context/base/m-chart.mkii
+++ b/tex/context/base/m-chart.mkii
@@ -1094,7 +1094,7 @@
\def\FLOWsplitnx{1}
\def\FLOWsplitny{1}
-\def\FLOWcharts%
+\def\FLOWcharts
{\dodoubleempty\doFLOWcharts}
%D While splitting, the following variables are available:
diff --git a/tex/context/base/m-chart.mkvi b/tex/context/base/m-chart.mkvi
index be9890239..4fb57af97 100644
--- a/tex/context/base/m-chart.mkvi
+++ b/tex/context/base/m-chart.mkvi
@@ -76,6 +76,7 @@
\c!labeloffset=.5\bodyfontsize,
\c!commentoffset=.5\bodyfontsize,
\c!exitoffset=\zeropoint,
+ % \c!split=\v!no,
% \c!maxwidth=,
% \c!maxheight=,
% \c!option=,
@@ -115,13 +116,17 @@
\c!offset=\FLOWshapeparameter\c!offset]
\setupFLOWsplit
- [\c!state=\v!stop,
- \c!marking=\v!on,
+ [\c!dx=0,
+ \c!dy=0,
% \c!command=,
% \c!before=,
% \c!after=,
\c!nx=3,
- \c!ny=3]
+ \c!ny=4]
+
+\unexpanded\def\beforeFLOWsplit{\FLOWsplitparameter\c!before}
+\unexpanded\def\afterFLOWsplit {\FLOWsplitparameter\c!after}
+\unexpanded\def\handleFLOWsplit{\FLOWsplitparameter\c!command}
\definecolor [FLOWfocuscolor] [s=.2]
\definecolor [FLOWlinecolor] [s=.5]
@@ -198,7 +203,7 @@
{\dodoubleempty\module_charts_process}
\def\module_charts_process[#name][#settings]%
- {\vbox\bgroup
+ {\bgroup % \vbox removed
\insidefloattrue
\dontcomplain
\setupFLOWchart[#settings]%
@@ -226,6 +231,7 @@
labeloffset = \number\dimexpr\FLOWchartparameter\c!labeloffset,
commentoffset = \number\dimexpr\FLOWchartparameter\c!commentoffset,
exitoffset = \number\dimexpr\FLOWchartparameter\c!exitoffset,
+ split = "\FLOWchartparameter\c!split",
},
shape = {
rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness,
@@ -250,9 +256,10 @@
set = {
},
split = {
- state = "\FLOWsplitparameter\c!state",
nx = \number\FLOWsplitparameter\c!nx,
ny = \number\FLOWsplitparameter\c!ny,
+ dx = \number\FLOWsplitparameter\c!dx,
+ dy = \number\FLOWsplitparameter\c!dy,
command = "",
marking = "\FLOWsplitparameter\c!marking",
before = "",
@@ -328,11 +335,14 @@
align=,
set=\setups{flowcell:text:place}]
+\def\FLOWx{\getvariable{flowcell:text}{x}} % compatibility (for Willi)
+\def\FLOWy{\getvariable{flowcell:text}{y}} % compatibility (for Willi)
+
% \c!background={\@@FLOWbackground,\FLOWoverlay},
\defineoverlay
- [flowcell:figure]
- [\overlayfigure{\getvariable{flowcell:text}{figure}}]
+ [flowcell:figure]
+ [\overlayfigure{\getvariable{flowcell:text}{figure}}]
\startsetups flowcell:text:place
\begingroup
@@ -401,18 +411,42 @@
\defineframed[flowcell:mb][flowcell:base][\c!bottom=,\c!align=\v!middle]
\defineframed[flowcell:cb][flowcell:base][\c!bottom=,\c!align=\v!middle]
-% todo: each cell its own setup
+% \startsetups flowcell:text:user
+% \setupframed
+% [flowcell:base]
+% [background=flowcell]
+% \definelayer
+% [flowcell]
+% [width=\namedframedparameter{flowcell:base}{width},
+% height=\namedframedparameter{flowcell:base}{height}]
+% \setlayerframed
+% [flowcell]
+% [preset=rightbottom,offset=-2.75ex]
+% [frame=off]
+% {\tx\FLOWx.\FLOWy}
+% \stopsetups
+%
+% % or:
+%
+% \setupframed
+% [flowcell:base]
+% [background={flowcell-1,flowcell-2}]
+%
+% \defineoverlay
+% [flowcell-1]
+% [\directsetup{flowcell-1}]
+%
+% \definelayer
+% [flowcell-2]
+% [width=\overlaywidth,
+% height=\overlayheight]
%
-% \startsetups flowcell
-% \definelayer
-% [flowcell]
-% [width=\FLOWshapewidth,
-% height=\FLOWshapeheight]
-% \setlayerframed
-% [flowcell]
-% [preset=rightbottom,offset=1ex]
-% [frame=off]
-% {\tx(\FLOWx,\FLOWy)}
+% \startsetups flowcell-1
+% \setlayerframed
+% [flowcell-2]
+% [preset=rightbottom,offset=-2.75ex]
+% [frame=off]
+% {\tx\FLOWx.\FLOWy}
% \stopsetups
%D \starttyping
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index b0d903207..24398b8a5 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 92f76ea34..e7f6dfacc 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 90fba1e69..0bd2fb05e 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -1046,17 +1046,48 @@
\def\tabl_tabulate_start_head_nop{\tabl_tabulate_start_head_yes[]}
\def\tabl_tabulate_start_foot_nop{\tabl_tabulate_start_foot_yes[]}
+% \unexpanded\def\tabl_start_defined[#1]%
+% {\bgroup
+% \edef\currenttabulationparent{#1}%
+% \let\currenttabulation\currenttabulationparent
+% \doifnextoptionalelse\tabl_start_defined_yes\tabl_start_defined_nop}
+%
+% \def\tabl_start_defined_yes[#1]%
+% {\edef\currenttabulation{\currenttabulation:#1}%
+% \tabl_tabulate_start_building}
+%
+% \def\tabl_start_defined_nop
+% {\tabl_tabulate_start_building}
+
\unexpanded\def\tabl_start_defined[#1]%
{\bgroup
\edef\currenttabulationparent{#1}%
\let\currenttabulation\currenttabulationparent
- \doifnextoptionalelse\tabl_start_defined_yes\tabl_start_defined_nop}
+ \dodoubleargument\tabl_start_defined_indeed}
+
+\def\tabl_start_defined_indeed
+ {\iffirstargument
+ \ifsecondargument
+ \doubleexpandafter\tabl_start_defined_two
+ \else
+ \doubleexpandafter\tabl_start_defined_one
+ \fi
+ \else
+ \singleexpandafter\tabl_start_defined_zero
+ \fi}
-\def\tabl_start_defined_yes[#1]%
+\def\tabl_start_defined_one[#1][#2]%
+ {\doifassignmentelse{#1}
+ {\setuptabulation[\currenttabulation][#1]}%
+ {\edef\currenttabulation{\currenttabulation:#1}}%
+ \tabl_tabulate_start_building}
+
+\def\tabl_start_defined_two[#1][#2]%
{\edef\currenttabulation{\currenttabulation:#1}%
+ \setuptabulation[\currenttabulation][#2]%
\tabl_tabulate_start_building}
-\def\tabl_start_defined_nop
+\def\tabl_start_defined_zero[#1][#2]%
{\tabl_tabulate_start_building}
% \definetabulate[\v!tabulate][|l|p|] % we need to get rid of this one
@@ -2282,4 +2313,31 @@
[\v!fact]
[\c!unit=.75em,\c!inner=\setquicktabulate\fact,EQ={=}]
+%D Another example:
+%D
+%D \starttyping
+%D \definetabulate
+%D [whatever]
+%D [|l|r|]
+%D
+%D \definetabulate
+%D [whatever][else]
+%D [|l|c|r|]
+%D
+%D \startwhatever
+%D \NC l \NC r \NC \NR
+%D \NC left \NC right \NC \NR
+%D \stopwhatever
+%D
+%D \startwhatever[else]
+%D \NC l \NC m \NC r \NC \NR
+%D \NC left \NC middle \NC right \NC \NR
+%D \stopwhatever
+%D
+%D \startwhatever[else][format={|c|c|c|c|}]
+%D \NC l \NC m \NC m \NC r \NC \NR
+%D \NC left \NC middle \NC middle \NC right \NC \NR
+%D \stopwhatever
+%D \stoptyping
+
\protect \endinput
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 8def78b9d..e515cb588 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 : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/16/12 11:04:02
+-- merge date : 10/16/12 18:23:55
do -- begin closure to overcome local limits and interference