From cb218b728af372a1ed6c9188765022dc057799ac Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 19 Oct 2017 14:39:05 +0200 Subject: 2017-10-19 13:56:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-it.mkii | 1 + tex/context/base/mkii/mult-ro.mkii | 1 + tex/context/base/mkiv/colo-imp-rgb.mkiv | 12 + tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/mlib-ctx.lua | 34 ++ tex/context/base/mkiv/mult-def.lua | 3 + tex/context/base/mkiv/publ-ini.lua | 47 +- tex/context/base/mkiv/publ-ini.mkiv | 6 + tex/context/base/mkiv/status-files.pdf | Bin 25727 -> 25749 bytes tex/context/base/mkiv/status-lua.pdf | Bin 246064 -> 246130 bytes tex/context/interface/mkii/keys-it.xml | 1 + tex/context/interface/mkii/keys-ro.xml | 1 + tex/context/interface/mkiv/context-en.xml | 3 + tex/context/interface/mkiv/i-context.pdf | Bin 803258 -> 803333 bytes tex/context/interface/mkiv/i-publication.xml | 3 + tex/context/interface/mkiv/i-readme.pdf | Bin 60767 -> 60767 bytes tex/context/modules/mkiv/m-chart.lua | 660 +++++++++++++++++---------- tex/context/modules/mkiv/m-chart.mkvi | 210 ++++----- 21 files changed, 640 insertions(+), 350 deletions(-) (limited to 'tex/context') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index a9ec6541c..f9b37ed76 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.10.18 21:16} +\newcontextversion{2017.10.19 13:50} %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 9322b41a4..1f6d45f19 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.10.18 21:16} +\edef\contextversion{2017.10.19 13:50} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index 422b2dac8..7cc5b6524 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -796,6 +796,7 @@ \setinterfaceconstant{fieldoffset}{offsetcampo} \setinterfaceconstant{file}{file} \setinterfaceconstant{filler}{filler} +\setinterfaceconstant{filter}{filter} \setinterfaceconstant{filtercommand}{filtercommand} \setinterfaceconstant{finalnamesep}{finalnamesep} \setinterfaceconstant{finalpagesep}{finalpagesep} diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index c7fbc8a40..cb9781e80 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -796,6 +796,7 @@ \setinterfaceconstant{fieldoffset}{offsetcamp} \setinterfaceconstant{file}{fisier} \setinterfaceconstant{filler}{filler} +\setinterfaceconstant{filter}{filter} \setinterfaceconstant{filtercommand}{filtercommand} \setinterfaceconstant{finalnamesep}{finalnamesep} \setinterfaceconstant{finalpagesep}{finalpagesep} diff --git a/tex/context/base/mkiv/colo-imp-rgb.mkiv b/tex/context/base/mkiv/colo-imp-rgb.mkiv index 6e7e44f8c..85122cb44 100644 --- a/tex/context/base/mkiv/colo-imp-rgb.mkiv +++ b/tex/context/base/mkiv/colo-imp-rgb.mkiv @@ -61,6 +61,18 @@ \definecolor [lightgray] [s=.85] \definecolor [palegray] [s=.75] +% new per 2017-10-15 (for mp named colors) + +\definecolor [gray-1] [s=.1] +\definecolor [gray-2] [s=.2] +\definecolor [gray-3] [s=.3] +\definecolor [gray-4] [s=.4] +\definecolor [gray-5] [s=.5] +\definecolor [gray-6] [s=.6] +\definecolor [gray-7] [s=.7] +\definecolor [gray-8] [s=.8] +\definecolor [gray-9] [s=.9] + %D These colors are mapped to interface dependant colornames. \startinterface dutch diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index be616e21d..9b956c756 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.10.18 21:16} +\newcontextversion{2017.10.19 13:50} %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 3c0ff4c51..65f779e19 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.10.18 21:16} +\edef\contextversion{2017.10.19 13:50} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua index b149c47f6..baa08384f 100644 --- a/tex/context/base/mkiv/mlib-ctx.lua +++ b/tex/context/base/mkiv/mlib-ctx.lua @@ -12,6 +12,7 @@ if not modules then modules = { } end modules ['mlib-ctx'] = { local type, tostring = type, tostring local format, concat = string.format, table.concat local settings_to_hash = utilities.parsers.settings_to_hash +local formatters = string.formatters local report_metapost = logs.reporter("metapost") @@ -201,6 +202,39 @@ function metapost.graphic(specification) metapost.graphic_base_pass(setmpsformat(specification)) end +function metapost.startgraphic(t) + if not t then + t = { } + end + if not t.instance then + t.instance = metapost.defaultinstance + end + if not t.format then + t.format = metapost.defaultformat + end + if not t.method then + t.method = metapost.defaultmethod + end + if not t.definitions then + t.definitions = "" + end + t.data = { } + return t +end + +function metapost.stopgraphic(t) + if t then + t.data = concat(t.data or { },"\n") + metapost.graphic(t) + t.data = "" + end +end + +function metapost.tographic(t,f,s,...) + local d = t.data + d[#d+1] = s and formatters[f](s,...) or f +end + implement { name = "mpgraphic", actions = metapost.graphic, diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 05b6a0387..bbb079cc8 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -7871,6 +7871,9 @@ return { ["filler"]={ ["en"]="filler", }, + ["filter"]={ + ["en"]="filter", + }, ["filtercommand"]={ ["en"]="filtercommand", }, diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 5ff701c37..07160ec57 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -489,7 +489,7 @@ end local findallused do local reported = { } - local finder = publications.finder + ----- finder = publications.finder findallused = function(dataset,reference,internal,forcethem) local current = datasets[dataset] @@ -642,6 +642,29 @@ local findallused do return okay, todo, tags end + local firstoftwoarguments = context.firstoftwoarguments + local secondoftwoarguments = context.secondoftwoarguments + + implement { + name = "btxdoifelsematches", + arguments = { "string", "string", "string" }, + actions = function(dataset,tag,expression) + local find = publications.finder(dataset,expression) + local okay = false + if find then + local d = datasets[dataset] + if d then + local e = d.luadata[tag] + if e and find(e) then + firstoftwoarguments() + return + end + end + end + secondoftwoarguments() + end + } + end local function unknowncite(reference) @@ -1813,6 +1836,7 @@ do end local method = specification.method or v_none local ignored = specification.ignored or "" + local filter = specification.filter or "" rendering.method = method rendering.ignored = ignored ~= "" and settings_to_set(ignored) or nil rendering.list = { } @@ -1837,6 +1861,24 @@ do end filtermethod(dataset,rendering,keyword) local list = rendering.list + if list and filter ~= "" then + local find = publications.finder(dataset,filter) + if find then + local luadata = datasets[dataset].luadata + local matched = 0 + for i=1,#list do + local found = list[i] + local entry = luadata[found[1]] + if find(entry) then + matched = matched + 1 + list[matched] = found + end + end + for i=#list,matched + 1,-1 do + list[i] = nil + end + end + end ctx_btxsetnoflistentries(list and #list or 0) end @@ -2265,6 +2307,7 @@ do { "repeated" }, { "ignored" }, { "group" }, + { "filter" }, } } } @@ -3343,7 +3386,7 @@ do -- local lpegmatch = lpeg.match local splitter = lpeg.tsplitat(":") - interfaces.implement { + implement { name = "checkinterfacechain", arguments = { "string", "string" }, actions = function(str,command) diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index e029f0564..4a31076c1 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -826,6 +826,7 @@ repeated {\btxrenderingparameter\c!repeat}% ignored {\btxrenderingparameter\c!ignore}% group {\btxrenderingparameter\c!group}% + filter {\btxrenderingparameter\c!filter}% \relax \ifnum\nofbtxlistentries>\zerocount \forgetall @@ -1893,6 +1894,11 @@ \unexpanded\def\stopbtxrunningstyleandcolor {\endgroup} +%D Maybe handy: + +\unexpanded\def\btxdoifelsematches#1#2#3% + {\clf_btxdoifelsematches{#1}{#2}{#3}} + %D Defaults: \setupbtxrendering diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index a402e1936..6927d71f2 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 849fb1351..8e423d993 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index ed7bbadfb..b70b455d8 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -802,6 +802,7 @@ + diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index 81846b72e..3e868e1aa 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -802,6 +802,7 @@ + diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 8c8b78389..56cdbf3e9 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -28740,6 +28740,9 @@ + + + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index f96e85df1..b9522e0b8 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-publication.xml b/tex/context/interface/mkiv/i-publication.xml index 4da08d270..b8f322625 100644 --- a/tex/context/interface/mkiv/i-publication.xml +++ b/tex/context/interface/mkiv/i-publication.xml @@ -229,6 +229,9 @@ + + + diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 357a365d5..ee51a22b9 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua index 565a5e36d..92ee0d969 100644 --- a/tex/context/modules/mkiv/m-chart.lua +++ b/tex/context/modules/mkiv/m-chart.lua @@ -18,14 +18,20 @@ local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match local context = context +local ctx_startgraphic = metapost.startgraphic +local ctx_stopgraphic = metapost.stopgraphic +local ctx_tographic = metapost.tographic + local formatters = string.formatters local setmetatableindex = table.setmetatableindex +local settings_to_hash = utilities.parsers.settings_to_hash moduledata.charts = moduledata.charts or { } local report_chart = logs.reporter("chart") local variables = interfaces.variables +local implement = interfaces.implement local v_yes = variables.yes local v_no = variables.no @@ -173,22 +179,29 @@ local charts = { } local data, hash, temp, last_x, last_y, name -function commands.flow_start_chart(chartname) - data = { } - hash = { } - last_x, last_y = 0, 0 - name = chartname -end +implement { + name = "flow_start_chart", + arguments = "string", + actions = function(chartname) + data = { } + hash = { } + last_x, last_y = 0, 0 + name = chartname + end +} -function commands.flow_stop_chart() - charts[name] = { - data = data, - hash = hash, - last_x = last_x, - last_y = last_y, - } - data, hash, temp = nil, nil, nil -end +implement { + name = "flow_stop_chart", + actions = function() + charts[name] = { + data = data, + hash = hash, + last_x = last_x, + last_y = last_y, + } + data, hash, temp = nil, nil, nil + end +} -- function commands.flow_set(chartname,chartdata) -- local hash = { } @@ -216,103 +229,187 @@ end -- end -- end -function commands.flow_reset(chartname) - charts[name] = nil -end +implement { + name = "flow_reset", + actions = function() + charts[name] = nil + end +} -function commands.flow_set_current_cell(n) - temp = data[tonumber(n)] or { } -end +implement { + name = "flow_set_current_cell", + arguments = "integer", + actions = function(n) + temp = data[n] or { } + end +} -function commands.flow_start_cell(settings) - temp = { - texts = { }, - labels = { }, - exits = { }, - connections = { }, - settings = settings, - x = 1, - y = 1, - realx = 1, - realy = 1, - name = "", - } -end +implement { + name = "flow_start_cell", + arguments = { + { + { "shape", { + { "rulethickness", "dimension" }, + { "default" }, + { "framecolor" }, + { "backgroundcolor" }, + }, + }, + { "focus", { + { "rulethickness", "dimension" }, + { "framecolor" }, + { "backgroundcolor" }, + }, + }, + { "line", { + { "rulethickness", "dimension" }, + { "radius", "dimension" }, + { "color" }, + { "corner" }, + { "dash" }, + { "arrow" }, + { "offset", "dimension" }, + }, + }, + }, + }, + actions = function(settings) + temp = { + texts = { }, + labels = { }, + exits = { }, + connections = { }, + settings = settings, + x = 1, + y = 1, + realx = 1, + realy = 1, + name = "", + } + end +} -function commands.flow_stop_cell() - data[#data+1] = temp - hash[temp.name or #data] = temp -end +implement { + name = "flow_stop_cell", + actions = function() + data[#data+1] = temp + hash[temp.name or #data] = temp + end +} -function commands.flow_set_name(str) - temp.name = str -end +implement { + name = "flow_set_name", + arguments = "string", + actions = function(str) + temp.name = str + end +} -function commands.flow_set_shape(str) - temp.shape = str -end +implement { + name = "flow_set_shape", + arguments = "string", + actions = function(str) + temp.shape = str + end +} -function commands.flow_set_destination(str) - temp.destination = str -end +implement { + name = "flow_set_destination", + arguments = "string", + actions = function(str) + temp.destination = str + end +} -function commands.flow_set_text(align,str) - temp.texts[#temp.texts+1] = { - align = align, - text = str, - } -end +implement { + name = "flow_set_text", + arguments = { "string", "string" }, + actions = function(align,str) + temp.texts[#temp.texts+1] = { + align = align, + text = str, + } + end +} -function commands.flow_set_overlay(str) - temp.overlay = str -end +implement { + name = "flow_set_overlay", + arguments = "string", + actions = function(str) + temp.overlay = str + end +} -function commands.flow_set_focus(str) - temp.focus = str -end +implement { + name = "flow_set_focus", + arguments = "string", + actions = function(str) + temp.focus = str + end +} -function commands.flow_set_figure(str) - temp.figure = str -end +implement { + name = "flow_set_figure", + arguments = "string", + actions = function(str) + temp.figure = str + end +} -function commands.flow_set_label(location,text) - temp.labels[#temp.labels+1] = { - location = location, - text = text, - } -end +implement { + name = "flow_set_label", + arguments = { "string", "string" }, + actions = function(location,text) + temp.labels[#temp.labels+1] = { + location = location, + text = text, + } + end +} -function commands.flow_set_comment(location,text) - local connections = temp.connections - if connections then - local connection = connections[#connections] - if connection then - local comments = connection.comments - if comments then - comments[#comments+1] = { - location = location, - text = text, - } +implement { + name = "flow_set_comment", + arguments = { "string", "string" }, + actions = function(location,text) + local connections = temp.connections + if connections then + local connection = connections[#connections] + if connection then + local comments = connection.comments + if comments then + comments[#comments+1] = { + location = location, + text = text, + } + end end end end -end +} -function commands.flow_set_exit(location,text) - temp.exits[#temp.exits+1] = { - location = location, - text = text, - } -end +implement { + name = "flow_set_exit", + arguments = { "string", "string" }, + actions = function(location,text) + temp.exits[#temp.exits+1] = { + location = location, + text = text, + } + end +} -function commands.flow_set_include(name,x,y,settings) - data[#data+1] = { - include = name, - x = x, - y = y, - -- settings = settings, - } -end +implement { + name = "flow_set_include", + arguments = { "string", "dimension", "dimension", "string" }, + actions = function(name,x,y,settings) + data[#data+1] = { + include = name, + x = x, + y = y, + -- settings = settings, + } + end +} local function inject(includedata,data,hash) local subchart = charts[includedata.include] @@ -431,66 +528,74 @@ end local splitter = lpeg.splitat(",") -function commands.flow_set_location(x,y) - if type(x) == "string" and not y then - x, y = lpegmatch(splitter,x) - end - local oldx, oldy = x, y - if not x or x == "" then - x = last_x - elseif type(x) == "number" then - -- ok - elseif x == "+" then - x = last_x + 1 - elseif x == "-" then - x = last_x - 1 - elseif find(x,"^[%+%-]") then - x = last_x + (tonumber(x) or 0) - else - x = tonumber(x) - end - if not y or y == "" then - y = last_y - elseif type(y) == "number" then - -- ok - elseif y == "+" then - y = last_y + 1 - elseif x == "-" then - y = last_y - 1 - elseif find(y,"^[%+%-]") then - y = last_y + (tonumber(y) or 0) - else - y = tonumber(y) - end - if x < 1 or y < 1 then - report_chart("the cell (%s,%s) ends up at (%s,%s) and gets relocated to (1,1)",oldx or"?", oldy or "?", x,y) - if x < 1 then - x = 1 +implement { + name = "flow_set_location", + arguments = "string", + actions = function(x,y) + if type(x) == "string" and not y then + x, y = lpegmatch(splitter,x) end - if y < 1 then - y = 1 + local oldx, oldy = x, y + if not x or x == "" then + x = last_x + elseif type(x) == "number" then + -- ok + elseif x == "+" then + x = last_x + 1 + elseif x == "-" then + x = last_x - 1 + elseif find(x,"^[%+%-]") then + x = last_x + (tonumber(x) or 0) + else + x = tonumber(x) + end + if not y or y == "" then + y = last_y + elseif type(y) == "number" then + -- ok + elseif y == "+" then + y = last_y + 1 + elseif x == "-" then + y = last_y - 1 + elseif find(y,"^[%+%-]") then + y = last_y + (tonumber(y) or 0) + else + y = tonumber(y) end + if x < 1 or y < 1 then + report_chart("the cell (%s,%s) ends up at (%s,%s) and gets relocated to (1,1)",oldx or"?", oldy or "?", x,y) + if x < 1 then + x = 1 + end + if y < 1 then + y = 1 + end + end + temp.x = x or 1 + temp.y = y or 1 + temp.realx = x or 1 + temp.realy = y or 1 + last_x = x or last_x + last_y = y or last_y end - temp.x = x or 1 - temp.y = y or 1 - temp.realx = x or 1 - temp.realy = y or 1 - last_x = x or last_x - last_y = y or last_y -end +} -function commands.flow_set_connection(location,displacement,name) - local dx, dy = lpegmatch(splitter,displacement) - dx = tonumber(dx) - dy = tonumber(dy) - temp.connections[#temp.connections+1] = { - location = location, - dx = dx or 0, - dy = dy or 0, - name = name, - comments = { }, - } -end +implement { + name = "flow_set_connection", + arguments = { "string", "string", "string" }, + actions = function(location,displacement,name) + local dx, dy = lpegmatch(splitter,displacement) + dx = tonumber(dx) + dy = tonumber(dy) + temp.connections[#temp.connections+1] = { + location = location, + dx = dx or 0, + dy = dy or 0, + name = name, + comments = { }, + } + end +} local function visible(chart,cell) local x, y = cell.x, cell.y @@ -499,12 +604,12 @@ local function visible(chart,cell) y >= chart.from_y and y <= chart.to_y and cell end -local function process_cells(chart,xoffset,yoffset) +local function process_cells(g,chart,xoffset,yoffset) local data = chart.data if not data then return end - local focus = utilities.parsers.settings_to_hash(chart.settings.chart.focus or "") + local focus = settings_to_hash(chart.settings.chart.focus or "") for i=1,#data do local cell = visible(chart,data[i]) if cell then @@ -516,26 +621,26 @@ local function process_cells(chart,xoffset,yoffset) end if shape ~= v_none then local shapedata = validshapes[shape] - context("flow_begin_sub_chart ;") -- when is this needed + ctx_tographic(g,"flow_begin_sub_chart ;") -- when is this needed if shapedata.kind == "line" then local linesettings = settings.line - context("flow_shape_line_color := \\MPcolor{%s} ;", linesettings.color) - context("flow_shape_fill_color := black ;") - context("flow_shape_line_width := %p ; ", linesettings.rulethickness) + ctx_tographic(g,"flow_shape_line_color := %q ;", linesettings.color) + ctx_tographic(g,"flow_shape_fill_color := %q ;","black") + ctx_tographic(g,"flow_shape_line_width := %p ; ",linesettings.rulethickness) elseif focus[cell.focus] or focus[cell.name] then local focussettings = settings.focus - context("flow_shape_line_color := \\MPcolor{%s} ;", focussettings.framecolor) - context("flow_shape_fill_color := \\MPcolor{%s} ;", focussettings.backgroundcolor) - context("flow_shape_line_width := %p ; ", focussettings.rulethickness) + ctx_tographic(g,"flow_shape_line_color := %q ;", focussettings.framecolor) + ctx_tographic(g,"flow_shape_fill_color := %q ;", focussettings.backgroundcolor) + ctx_tographic(g,"flow_shape_line_width := %p ; ",focussettings.rulethickness) else local shapesettings = settings.shape - context("flow_shape_line_color := \\MPcolor{%s} ;", shapesettings.framecolor) - context("flow_shape_fill_color := \\MPcolor{%s} ;", shapesettings.backgroundcolor) - context("flow_shape_line_width := %p ; " , shapesettings.rulethickness) + ctx_tographic(g,"flow_shape_line_color := %q ;", shapesettings.framecolor) + ctx_tographic(g,"flow_shape_fill_color := %q ;", shapesettings.backgroundcolor) + ctx_tographic(g,"flow_shape_line_width := %p ; ",shapesettings.rulethickness) end - context("flow_peepshape := false ;") -- todo - context("flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number) - context("flow_end_sub_chart ;") + ctx_tographic(g,"flow_peepshape := false ;") -- todo + ctx_tographic(g,"flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number) + ctx_tographic(g,"flow_end_sub_chart ;") end end end @@ -574,7 +679,7 @@ local what = space -- print(lpegmatch(what,"+l")) -- print(lpegmatch(what,"+ left+r ")) -local function process_connections(chart,xoffset,yoffset) +local function process_connections(g,chart,xoffset,yoffset) local data = chart.data local hash = chart.hash if not data then @@ -583,7 +688,6 @@ local function process_connections(chart,xoffset,yoffset) local settings = chart.settings for i=1,#data do local cell = visible(chart,data[i]) --- local cell = data[i] if cell then local connections = cell.connections for j=1,#connections do @@ -597,15 +701,15 @@ local function process_connections(chart,xoffset,yoffset) local what_cell, where_cell, what_other, where_other = lpegmatch(what,location) if what_cell and where_cell and what_other and where_other then local linesettings = settings.line - context("flow_smooth := %s ;", linesettings.corner == v_round and "true" or "false") - context("flow_dashline := %s ;", linesettings.dash == v_yes and "true" or "false") - context("flow_arrowtip := %s ;", linesettings.arrow == v_yes and "true" or "false") - context("flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false") - context("flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0) - context("flow_connection_line_color := \\MPcolor{%s} ;",linesettings.color) - context("flow_connection_line_width := %p ;",linesettings.rulethickness) - context("flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other) - context("flow_dsp_x := 0 ; flow_dsp_y := 0 ;") + ctx_tographic(g,"flow_smooth := %s ;", linesettings.corner == v_round and "true" or "false") + ctx_tographic(g,"flow_dashline := %s ;", linesettings.dash == v_yes and "true" or "false") + ctx_tographic(g,"flow_arrowtip := %s ;", linesettings.arrow == v_yes and "true" or "false") + ctx_tographic(g,"flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false") + ctx_tographic(g,"flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0) + ctx_tographic(g,"flow_connection_line_color := %q ;",linesettings.color) + ctx_tographic(g,"flow_connection_line_width := %p ;",linesettings.rulethickness) + ctx_tographic(g,"flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other) + ctx_tographic(g,"flow_dsp_x := 0 ; flow_dsp_y := 0 ;") end end end @@ -620,13 +724,17 @@ local f_texttemplate_l = formatters["\\doFLOWlabel{%i}{%i}{%i}"] local splitter = lpeg.splitat(":") local charttexts = { } -- permits " etc in mp -function commands.flow_get_text(n) - if n > 0 then - context(charttexts[n]) +implement { + name = "flow_get_text", + arguments = "integer", + actions = function(n) + if n > 0 then + context(charttexts[n]) + end end -end +} -local function process_texts(chart,xoffset,yoffset) +local function process_texts(g,chart,xoffset,yoffset) local data = chart.data local hash = chart.hash if not data then @@ -650,7 +758,7 @@ local function process_texts(chart,xoffset,yoffset) local align = text.align or "" local align = validlabellocations[align] or align charttexts[#charttexts+1] = data - context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination)) + ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination)) if i == 1 then figure = "" overlay = "" @@ -658,7 +766,7 @@ local function process_texts(chart,xoffset,yoffset) end end elseif figure ~= "" or overlay ~= "" or destination ~= "" then - context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination)) + ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination)) end local labels = cell.labels for i=1,#labels do @@ -668,7 +776,7 @@ local function process_texts(chart,xoffset,yoffset) local location = validlabellocations[location] or location if text and text ~= "" then charttexts[#charttexts+1] = text - context('flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) end end local exits = cell.exits @@ -684,7 +792,7 @@ local function process_texts(chart,xoffset,yoffset) location == "t" and y == chart.to_y - 1 or location == "b" and y == chart.from_y + 1 then charttexts[#charttexts+1] = text - context('flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) end end end @@ -713,7 +821,7 @@ local function process_texts(chart,xoffset,yoffset) end if text and text ~= "" then charttexts[#charttexts+1] = text - context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts)) + ctx_tographic(g,'flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts)) end end end @@ -740,7 +848,7 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny) local chartsettings = chart.settings.chart local autofocus = chart.settings.chart.autofocus if autofocus then - autofocus = utilities.parsers.settings_to_hash(autofocus) + autofocus = settings_to_hash(autofocus) if not next(autofocus) then autofocus = false end @@ -764,17 +872,15 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny) if miny == 0 or y > maxy then maxy = y end end end --- optional: -if x + nx > maxx then - nx = maxx - x + 1 -end -if y + ny > maxy then - ny = maxy - y + 1 -end + -- optional: + if x + nx > maxx then + nx = maxx - x + 1 + end + if y + ny > maxy then + ny = maxy - y + 1 + end -- - -- print("1>",x,y,nx,ny) - -- print("2>",minx, miny, maxx, maxy) - -- check of window should be larger (maybe autofocus + nx/ny?) + -- check if window should be larger (maybe autofocus + nx/ny?) if autofocus then -- x and y are ignored if nx and nx > 0 then @@ -827,21 +933,27 @@ local function makechart(chart) context.begingroup() context.forgetall() -- - context.startMPcode() - context("if unknown context_flow : input mp-char.mpiv ; fi ;") - context("flow_begin_chart(0,%s,%s);",chart.nx,chart.ny) + local g = ctx_startgraphic { + instance = "metafun", + format = "metafun", + method = "scaled", + definitions = "", + } + -- + ctx_tographic(g,"if unknown context_flow : input mp-char.mpiv ; fi ;") + ctx_tographic(g,"flow_begin_chart(0,%s,%s);",chart.nx,chart.ny) -- 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 ;") + ctx_tographic(g,"flow_show_con_points := true ;") + ctx_tographic(g,"flow_show_mid_points := true ;") + ctx_tographic(g,"flow_show_all_points := true ;") elseif chartsettings.dot ~= "" then -- no checking done, private option - context("flow_show_%s_points := true ;",chartsettings.dot) + ctx_tographic(g,"flow_show_%s_points := true ;",chartsettings.dot) end -- local backgroundcolor = chartsettings.backgroundcolor if backgroundcolor and backgroundcolor ~= "" then - context("flow_chart_background_color := \\MPcolor{%s} ;",backgroundcolor) + ctx_tographic(g,"flow_chart_background_color := %q ;",backgroundcolor) end -- local shapewidth = chartsettings.width @@ -852,14 +964,14 @@ local function makechart(chart) local labeloffset = chartsettings.labeloffset local exitoffset = chartsettings.exitoffset local commentoffset = chartsettings.commentoffset - context("flow_grid_width := %p ;", gridwidth) - context("flow_grid_height := %p ;", gridheight) - context("flow_shape_width := %p ;", shapewidth) - context("flow_shape_height := %p ;", shapeheight) - context("flow_chart_offset := %p ;", chartoffset) - context("flow_label_offset := %p ;", labeloffset) - context("flow_exit_offset := %p ;", exitoffset) - context("flow_comment_offset := %p ;", commentoffset) + ctx_tographic(g,"flow_grid_width := %p ;", gridwidth) + ctx_tographic(g,"flow_grid_height := %p ;", gridheight) + ctx_tographic(g,"flow_shape_width := %p ;", shapewidth) + ctx_tographic(g,"flow_shape_height := %p ;", shapeheight) + ctx_tographic(g,"flow_chart_offset := %p ;", chartoffset) + ctx_tographic(g,"flow_label_offset := %p ;", labeloffset) + ctx_tographic(g,"flow_exit_offset := %p ;", exitoffset) + ctx_tographic(g,"flow_comment_offset := %p ;", commentoffset) -- local radius = settings.line.radius local rulethickness = settings.line.rulethickness @@ -874,10 +986,10 @@ local function makechart(chart) radius = dy end end - context("flow_connection_line_width := %p ;", rulethickness) - context("flow_connection_smooth_size := %p ;", radius) - context("flow_connection_arrow_size := %p ;", radius) - context("flow_connection_dash_size := %p ;", radius) + ctx_tographic(g,"flow_connection_line_width := %p ;", rulethickness) + ctx_tographic(g,"flow_connection_smooth_size := %p ;", radius) + ctx_tographic(g,"flow_connection_arrow_size := %p ;", radius) + ctx_tographic(g,"flow_connection_dash_size := %p ;", radius) -- local offset = chartsettings.offset -- todo: pass string if offset == v_none or offset == v_overlay or offset == "" then @@ -885,18 +997,21 @@ local function makechart(chart) elseif offset == v_standard then offset = radius -- or rulethickness? end - context("flow_chart_offset := %p ;",offset) + ctx_tographic(g,"flow_chart_offset := %p ;",offset) -- - context("flow_reverse_y := true ;") + ctx_tographic(g,"flow_reverse_y := true ;") if chartsettings.option == v_test then - context("flow_draw_test_shapes ;") - end - process_cells(chart,0,0) - process_connections(chart,0,0) - process_texts(chart,0,0) - -- context("clip_chart(%s,%s,%s,%s) ;",x,y,nx,ny) -- todo: draw lines but not shapes - context("flow_end_chart ;") - context.stopMPcode() + ctx_tographic(g,"flow_draw_test_shapes ;") + end + -- + process_cells(g,chart,0,0) + process_connections(g,chart,0,0) + process_texts(g,chart,0,0) + -- + -- ctx_tographic(g,"clip_chart(%s,%s,%s,%s) ;",x,y,nx,ny) -- todo: draw lines but not shapes + ctx_tographic(g,"flow_end_chart ;") + ctx_stopgraphic(g) + -- context.endgroup() end @@ -981,19 +1096,86 @@ local function splitchart(chart) end end -function commands.flow_make_chart(settings) - local chart = getchart(settings) - if chart then - local settings = chart.settings - if settings then - local chartsettings = settings.chart - if chartsettings and chartsettings.split == v_yes then - splitchart(chart) +implement { + name = "flow_make_chart", + arguments = { + { + { "chart", { + { "name" }, + { "option" }, + { "backgroundcolor" }, + { "width", "dimension" }, + { "height", "dimension" }, + { "dx", "dimension" }, + { "dy", "dimension" }, + { "offset", "dimension" }, + -- { "bodyfont" }, + { "dot" }, + { "hcompact" }, + { "vcompact" }, + { "focus" }, + { "autofocus" }, + { "nx", "integer" }, + { "ny", "integer" }, + { "x", "integer" }, + { "y", "integer" }, + { "labeloffset", "dimension" }, + { "commentoffset", "dimension" }, + { "exitoffset", "dimension" }, + { "split" }, + }, + }, + { "shape", { + { "rulethickness", "dimension" }, + { "default" }, + { "framecolor" }, + { "backgroundcolor" }, + }, + }, + { "focus", { + { "rulethickness", "dimension" }, + { "framecolor" }, + { "backgroundcolor" }, + }, + }, + { "line", { + { "rulethickness", "dimension" }, + { "radius", "dimension" }, + { "color" }, + { "corner" }, + { "dash" }, + { "arrow" }, + { "offset" }, + }, + }, + { "split", { + { "nx", "integer" }, + { "ny", "integer" }, + { "dx", "integer" }, + { "dy", "integer" }, + { "command" }, + { "marking" }, + { "before" }, + { "after" }, + }, + }, + -- { "set" }, + } + }, + actions = function(settings) + local chart = getchart(settings) + if chart then + local settings = chart.settings + 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 - else - makechart(chart) end end -end +} diff --git a/tex/context/modules/mkiv/m-chart.mkvi b/tex/context/modules/mkiv/m-chart.mkvi index 69d90f47b..37b48f6eb 100644 --- a/tex/context/modules/mkiv/m-chart.mkvi +++ b/tex/context/modules/mkiv/m-chart.mkvi @@ -29,12 +29,12 @@ % todo: figure out a nice way to define the lot: share current and % support current as name (nb: we need to set parent then) -\installcorenamespace {flowchart} % \def\??flch{@@flch} % chart -\installcorenamespace {flowline} % \def\??flln{@@flln} % line -\installcorenamespace {flowshape} % \def\??flsh{@@flsh} % shape -\installcorenamespace {flowfocus} % \def\??flfc{@@flfc} % focus -\installcorenamespace {flowsets} % \def\??flst{@@flst} % sets -\installcorenamespace {flowsplit} % \def\??flsp{@@flsp} % split +\installcorenamespace {flowchart} % chart +\installcorenamespace {flowline} % line +\installcorenamespace {flowshape} % shape +\installcorenamespace {flowfocus} % focus +\installcorenamespace {flowsets} % sets +\installcorenamespace {flowsplit} % split \installsimplecommandhandler \??flowchart {FLOWchart} \??flowchart % maybe just a setuphandler \installsimplecommandhandler \??flowline {FLOWline} \??flowline % maybe just a setuphandler @@ -118,7 +118,7 @@ \newtoks\everyFLOWchart \unexpanded\def\module_charts_process[#name]% - {\ctxcommand{flow_start_chart("#name")}} + {\clf_flow_start_chart{#name}} \unexpanded\def\startFLOWchart {\startnointerference @@ -126,10 +126,10 @@ \dosingleempty\module_charts_start_chart} \unexpanded\def\module_charts_start_chart[#name]% - {\ctxcommand{flow_start_chart("#name")}} + {\clf_flow_start_chart{#name}} \unexpanded\def\stopFLOWchart - {\ctxcommand{flow_stop_chart()}% + {\clf_flow_stop_chart \stopnointerference} \unexpanded\def\defineFLOWchart % for old times sake @@ -138,9 +138,9 @@ \unexpanded\def\module_charts_FLOW_define[#name][#settings]#cells% todo: save settings {\startnointerference \the\everyFLOWchart - \ctxcommand{flow_start_chart("#name")}% + \clf_flow_start_chart{#name}% #cells% - \ctxcommand{flow_stop_chart()}% + \clf_flow_stop_chart \stopnointerference} \unexpanded\def\startFLOWcell @@ -154,32 +154,32 @@ \ifsecondargument \setupFLOWline[#2]% \fi - \ctxcommand{flow_start_cell { - shape = { - rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness, - default = "\FLOWshapeparameter\c!default", - framecolor = "\FLOWshapeparameter\c!framecolor", - backgroundcolor = "\FLOWshapeparameter\c!backgroundcolor", - }, - focus = { - rulethickness = \number\dimexpr\FLOWfocusparameter\c!rulethickness, - framecolor = "\FLOWfocusparameter\c!framecolor", - backgroundcolor = "\FLOWfocusparameter\c!backgroundcolor", - }, - line = { - rulethickness = \number\dimexpr\FLOWlineparameter\c!rulethickness, - radius = \number\dimexpr\FLOWlineparameter\c!radius, - color = "\FLOWlineparameter\c!color", - corner = "\FLOWlineparameter\c!corner", - dash = "\FLOWlineparameter\c!dash", - arrow = "\FLOWlineparameter\c!arrow", - offset = \number\dimexpr\FLOWlineparameter\c!offset, - }, - } }% + \clf_flow_start_cell + shape { + rulethickness \dimexpr\FLOWshapeparameter\c!rulethickness\relax + default {\FLOWshapeparameter\c!default} + framecolor {\FLOWshapeparameter\c!framecolor} + backgroundcolor {\FLOWshapeparameter\c!backgroundcolor} + } + focus { + rulethickness \dimexpr\FLOWfocusparameter\c!rulethickness\relax + framecolor {\FLOWfocusparameter\c!framecolor} + backgroundcolor {\FLOWfocusparameter\c!backgroundcolor} + } + line { + rulethickness \dimexpr\FLOWlineparameter\c!rulethickness\relax + radius \dimexpr\FLOWlineparameter\c!radius\relax + color {\FLOWlineparameter\c!color} + corner {\FLOWlineparameter\c!corner} + dash {\FLOWlineparameter\c!dash} + arrow {\FLOWlineparameter\c!arrow} + offset \dimexpr\FLOWlineparameter\c!offset\relax + } + \relax \endgroup} \unexpanded\def\stopFLOWcell - {\ctxcommand{flow_stop_cell()}} + {\clf_flow_stop_cell} \unexpanded\def\FLOWchart {\dodoubleempty\module_charts_process} @@ -190,64 +190,64 @@ \dontcomplain \setupFLOWchart[#settings]% \usebodyfontparameter\FLOWchartparameter - \ctxcommand{flow_make_chart { - chart = { - name = "#name", - option = "\FLOWchartparameter\c!option", - backgroundcolor = "\FLOWchartparameter\c!backgroundcolor", - width = \number\dimexpr\FLOWchartparameter\c!width, - height = \number\dimexpr\FLOWchartparameter\c!height, - dx = \number\dimexpr\FLOWchartparameter\c!dx, - dy = \number\dimexpr\FLOWchartparameter\c!dy, - offset = \number\dimexpr\FLOWchartparameter\c!offset, - % bodyfont = "\FLOWchartparameter\c!bodyfont", - dot = "\FLOWchartparameter\c!dot", % private option - hcompact = "\FLOWchartparameter\c!hcompact", % undocumented option - vcompact = "\FLOWchartparameter\c!vcompact", % undocumented option - focus = "\FLOWchartparameter\c!focus", - autofocus = "\FLOWchartparameter\c!autofocus", - nx = "\FLOWchartparameter\c!nx", - ny = "\FLOWchartparameter\c!ny", - x = "\FLOWchartparameter\c!x", - y = "\FLOWchartparameter\c!y", - 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, - default = "\FLOWshapeparameter\c!default", - framecolor = "\FLOWshapeparameter\c!framecolor", - backgroundcolor = "\FLOWshapeparameter\c!backgroundcolor", - }, - focus = { - rulethickness = \number\dimexpr\FLOWfocusparameter\c!rulethickness, - framecolor = "\FLOWfocusparameter\c!framecolor", - backgroundcolor = "\FLOWfocusparameter\c!backgroundcolor", - }, - line = { - rulethickness = \number\dimexpr\FLOWlineparameter\c!rulethickness, - radius = \number\dimexpr\FLOWlineparameter\c!radius, - color = "\FLOWlineparameter\c!color", - corner = "\FLOWlineparameter\c!corner", - dash = "\FLOWlineparameter\c!dash", - arrow = "\FLOWlineparameter\c!arrow", - offset = "\FLOWlineparameter\c!offset", - }, - set = { - }, - split = { - 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 = "", - after = "", + \clf_flow_make_chart + chart { + name {#name} + option {\FLOWchartparameter\c!option} + backgroundcolor {\FLOWchartparameter\c!backgroundcolor} + width \dimexpr\FLOWchartparameter\c!width\relax + height \dimexpr\FLOWchartparameter\c!height\relax + dx \dimexpr\FLOWchartparameter\c!dx\relax + dy \dimexpr\FLOWchartparameter\c!dy\relax + offset \dimexpr\FLOWchartparameter\c!offset\relax + % bodyfont {\FLOWchartparameter\c!bodyfont} + dot {\FLOWchartparameter\c!dot} % private option + hcompact {\FLOWchartparameter\c!hcompact} % undocumented option + vcompact {\FLOWchartparameter\c!vcompact} % undocumented option + focus {\FLOWchartparameter\c!focus} + autofocus {\FLOWchartparameter\c!autofocus} + nx \numexpr\FLOWchartparameter\c!nx\relax + ny \numexpr\FLOWchartparameter\c!ny\relax + x \numexpr\FLOWchartparameter\c!x\relax + y \numexpr\FLOWchartparameter\c!y\relax + labeloffset \dimexpr\FLOWchartparameter\c!labeloffset\relax + commentoffset \dimexpr\FLOWchartparameter\c!commentoffset\relax + exitoffset \dimexpr\FLOWchartparameter\c!exitoffset\relax + split {\FLOWchartparameter\c!split} + } + shape { + rulethickness \dimexpr\FLOWshapeparameter\c!rulethickness\relax + default {\FLOWshapeparameter\c!default} + framecolor {\FLOWshapeparameter\c!framecolor} + backgroundcolor {\FLOWshapeparameter\c!backgroundcolor} + } + focus { + rulethickness \dimexpr\FLOWfocusparameter\c!rulethickness\relax + framecolor {\FLOWfocusparameter\c!framecolor} + backgroundcolor {\FLOWfocusparameter\c!backgroundcolor} + } + line { + rulethickness \dimexpr\FLOWlineparameter\c!rulethickness\relax + radius \dimexpr\FLOWlineparameter\c!radius\relax + color {\FLOWlineparameter\c!color} + corner {\FLOWlineparameter\c!corner} + dash {\FLOWlineparameter\c!dash} + arrow {\FLOWlineparameter\c!arrow} + offset {\FLOWlineparameter\c!offset} + } + % set { + % } + split { + nx \numexpr\FLOWsplitparameter\c!nx\relax + ny \numexpr\FLOWsplitparameter\c!ny\relax + dx \numexpr\FLOWsplitparameter\c!dx\relax + dy \numexpr\FLOWsplitparameter\c!dy\relax + command {} + marking {\FLOWsplitparameter\c!marking} + before {} + after {} } - } }% + \relax \egroup} \unexpanded\def\FLOWcharts @@ -281,13 +281,13 @@ \let\includeFLOWchart\include \to \everyFLOWchart -\unexpanded\def\FLOW_name #name{\ctxcommand{flow_set_name("#name")}\ignorespaces} -\unexpanded\def\FLOW_shape #shape{\ctxcommand{flow_set_shape("#shape")}\ignorespaces} -\unexpanded\def\FLOW_destination#destination{\ctxcommand{flow_set_destination("#destination")}\ignorespaces} -\unexpanded\def\FLOW_focus #focus{\ctxcommand{flow_set_focus("#focus")}\ignorespaces} -\unexpanded\def\FLOW_overlay #overlay{\ctxcommand{flow_set_overlay("#overlay")}\ignorespaces} -\unexpanded\def\FLOW_location #location{\ctxcommand{flow_set_location("#location")}\ignorespaces} -\unexpanded\def\FLOW_figure #figure{\ctxcommand{flow_set_figure("#figure")}\ignorespaces} +\unexpanded\def\FLOW_name #name{\clf_flow_set_name{#name}\ignorespaces} +\unexpanded\def\FLOW_shape #shape{\clf_flow_set_shape{#shape}\ignorespaces} +\unexpanded\def\FLOW_destination#destination{\clf_flow_set_destination{#destination}\ignorespaces} +\unexpanded\def\FLOW_focus #focus{\clf_flow_set_focus{#focus}\ignorespaces} +\unexpanded\def\FLOW_overlay #overlay{\clf_flow_set_overlay{#overlay}\ignorespaces} +\unexpanded\def\FLOW_location #location{\clf_flow_set_location{#location}\ignorespaces} +\unexpanded\def\FLOW_figure #figure{\clf_flow_set_figure{#figure}\ignorespaces} \unexpanded\def\FLOW_text {\dosingleempty\module_charts_FLOW_text} \unexpanded\def\FLOW_label {\dosingleempty\module_charts_FLOW_label} @@ -296,16 +296,16 @@ \unexpanded\def\FLOW_connection{\dodoubleempty\module_charts_FLOW_connection} \unexpanded\def\FLOW_include {\dodoubleempty\module_charts_FLOW_include} -\unexpanded\def\module_charts_FLOW_text [#align]#text{\ctxcommand{flow_set_text("#align",\!!bs\detokenize{#text}\!!es)}\ignorespaces} -\unexpanded\def\module_charts_FLOW_label [#location]#text{\ctxcommand{flow_set_label("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces} -\unexpanded\def\module_charts_FLOW_comment [#location]#text{\ctxcommand{flow_set_comment("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces} -\unexpanded\def\module_charts_FLOW_exit [#location]#text{\ctxcommand{flow_set_exit("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces} -\unexpanded\def\module_charts_FLOW_connection[#location][#offset]#name{\ctxcommand{flow_set_connection("#location","#offset","#name")}\ignorespaces} +\unexpanded\def\module_charts_FLOW_text [#align]#text{\clf_flow_set_text{#align}{\detokenize{#text}}\ignorespaces} +\unexpanded\def\module_charts_FLOW_label [#location]#text{\clf_flow_set_label{#location}{\detokenize{#text}}\ignorespaces} +\unexpanded\def\module_charts_FLOW_comment [#location]#text{\clf_flow_set_comment{#location}{\detokenize{#text}}\ignorespaces} +\unexpanded\def\module_charts_FLOW_exit [#location]#text{\clf_flow_set_exit{#location}{\detokenize{#text}}\ignorespaces} +\unexpanded\def\module_charts_FLOW_connection[#location][#offset]#name{\clf_flow_set_connection{#location}{#offset}{#name}\ignorespaces} \unexpanded\def\module_charts_FLOW_include [#name][#settings]{% \begingroup \getparameters[FLOWi][\c!x=1,\c!y=1,#settings]% - \ctxcommand{flow_set_include("#name",\number\FLOWix,\number\FLOWiy,\!!bs\detokenize{#settings}\!!es)}% + \clf_flow_set_include{#name}\numexpr\FLOWix\relax\numexpr\FLOWiy\relax{\detokenize{#settings}}% \endgroup \ignorespaces } @@ -382,7 +382,7 @@ \endgroup} \unexpanded\def\getFLOWtext#1% - {\ifcase#1\else\ctxcommand{flow_get_text(#1)}\fi} + {\ifcase#1\else\clf_flow_get_text\numexpr#1\relax\fi} \defineframed % to be discussed: shape or global [flowcell:base] -- cgit v1.2.3