From 4833d4fc12d57cde9d0b70ff60ff6417b722b38d Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 17 Apr 2012 22:37:00 +0200 Subject: beta 2012.04.17 22:37 --- .../data/scite/lexers/scite-context-lexer-cld.lua | 7 +- .../lexers/scite-context-lexer-lua-longstring.lua | 3 +- .../data/scite/lexers/scite-context-lexer-lua.lua | 4 +- .../data/scite/lexers/scite-context-lexer-mps.lua | 4 +- .../lexers/scite-context-lexer-pdf-object.lua | 4 +- .../scite/lexers/scite-context-lexer-pdf-xref.lua | 7 +- .../data/scite/lexers/scite-context-lexer-pdf.lua | 4 +- .../data/scite/lexers/scite-context-lexer-tex.lua | 10 +- .../data/scite/lexers/scite-context-lexer-txt.lua | 6 +- .../scite/lexers/scite-context-lexer-xml-cdata.lua | 16 +- .../lexers/scite-context-lexer-xml-comment.lua | 8 +- .../data/scite/lexers/scite-context-lexer-xml.lua | 68 +++--- context/data/scite/lexers/scite-context-lexer.lua | 1 + .../scite/lexers/themes/scite-context-theme.lua | 3 + .../data/scite/scite-context-external.properties | 24 ++ scripts/context/lua/mtx-context.lua | 1 + scripts/context/lua/mtxrun.lua | 12 + scripts/context/stubs/mswin/mtxrun.lua | 12 + scripts/context/stubs/unix/mtxrun | 12 + tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4070 -> 4073 bytes tex/context/base/context-version.png | Bin 105445 -> 106054 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 3 +- tex/context/base/core-dat.lua | 197 ++++++++++++++++ tex/context/base/core-dat.mkiv | 98 ++++++++ tex/context/base/core-uti.lua | 2 +- tex/context/base/lpdf-ini.lua | 14 ++ tex/context/base/m-steps.mkvi | 10 +- tex/context/base/spac-pag.mkiv | 251 +++++++++++++-------- tex/context/base/status-files.pdf | Bin 24326 -> 24323 bytes tex/context/base/status-lua.pdf | Bin 172421 -> 173014 bytes tex/context/base/status-mkiv.lua | 5 + tex/context/base/strc-flt.mkvi | 74 ++++-- tex/context/base/strc-not.mkvi | 25 +- tex/context/base/trac-log.lua | 8 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 38 files changed, 713 insertions(+), 188 deletions(-) create mode 100644 tex/context/base/core-dat.lua create mode 100644 tex/context/base/core-dat.mkiv diff --git a/context/data/scite/lexers/scite-context-lexer-cld.lua b/context/data/scite/lexers/scite-context-lexer-cld.lua index 9623e2efe..4d235b1af 100644 --- a/context/data/scite/lexers/scite-context-lexer-cld.lua +++ b/context/data/scite/lexers/scite-context-lexer-cld.lua @@ -9,8 +9,10 @@ local info = { local lexer = lexer local token = lexer.token -local cldlexer = { _NAME = "cld" } -local lualexer = lexer.load('scite-context-lexer-lua') +-- local cldlexer = { _NAME = "cld" } +local cldlexer = { _NAME = "lua" } -- get whitespace right +local whitespace = lexer.WHITESPACE +local lualexer = lexer.load('scite-context-lexer-lua') cldlexer._rules = lualexer._rules_cld cldlexer._tokenstyles = lualexer._tokenstyles @@ -18,3 +20,4 @@ cldlexer._foldsymbols = lualexer._foldsymbols cldlexer._directives = lualexer._directives return cldlexer + diff --git a/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua index 6cc79aeb9..f4ac2cff0 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua @@ -2,8 +2,7 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local stringlexer = { _NAME = "string" } - +local stringlexer = { _NAME = "lua-longstring" } local whitespace = lexer.WHITESPACE local space = lexer.space diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index 248672b06..473e45bb2 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -17,10 +17,10 @@ local setmetatable = setmetatable -- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer local lualexer = { _NAME = "lua" } -local stringlexer = lexer.load("scite-context-lexer-lua-longstring") - local whitespace = lexer.WHITESPACE +local stringlexer = lexer.load("scite-context-lexer-lua-longstring") + local directives = { } -- communication channel -- this will be extended diff --git a/context/data/scite/lexers/scite-context-lexer-mps.lua b/context/data/scite/lexers/scite-context-lexer-mps.lua index 4dd498b53..5e8a440fa 100644 --- a/context/data/scite/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/lexers/scite-context-lexer-mps.lua @@ -14,10 +14,8 @@ local token, exact_match = lexer.token, lexer.exact_match local P, R, S, V, C, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cmt local type = type -local metafunlexer = { _NAME = "metafun" } - +local metafunlexer = { _NAME = "mps" } local whitespace = lexer.WHITESPACE - local context = lexer.context local metapostprimitives = { } diff --git a/context/data/scite/lexers/scite-context-lexer-pdf-object.lua b/context/data/scite/lexers/scite-context-lexer-pdf-object.lua index ec950c26c..e98be07a7 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf-object.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf-object.lua @@ -10,10 +10,8 @@ local lexer = lexer local token = lexer.token local P, R, S, C, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.V -local pdfobjectlexer = { _NAME = "pdfobject" } - +local pdfobjectlexer = { _NAME = "pdf-object" } local whitespace = lexer.WHITESPACE -- triggers states - local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua b/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua index 9fd6df992..e250d3b84 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua @@ -10,13 +10,12 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local pdfxreflexer = { _NAME = "pdfxref" } -local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") - +local pdfxreflexer = { _NAME = "pdf-xref" } +local whitespace = lexer.WHITESPACE -- triggers states local context = lexer.context local patterns = context.patterns -local whitespace = lexer.WHITESPACE -- triggers states +local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") local spacing = patterns.spacing diff --git a/context/data/scite/lexers/scite-context-lexer-pdf.lua b/context/data/scite/lexers/scite-context-lexer-pdf.lua index 61cf819f0..6ed7d1ecd 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf.lua @@ -13,11 +13,11 @@ local token = lexer.token local P, R, S = lpeg.P, lpeg.R, lpeg.S local pdflexer = { _NAME = "pdf" } +local whitespace = lexer.WHITESPACE -- triggers states + local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") local pdfxreflexer = lexer.load("scite-context-lexer-pdf-xref") -local whitespace = lexer.WHITESPACE -- triggers states - local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/lexers/scite-context-lexer-tex.lua b/context/data/scite/lexers/scite-context-lexer-tex.lua index 3408d1eb4..e5fbf5900 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -44,12 +44,12 @@ local find, match, lower = string.find, string.match, string.lower -- module(...) -local contextlexer = { _NAME = "context" } +local contextlexer = { _NAME = "tex" } +local whitespace = lexer.WHITESPACE + local cldlexer = lexer.load('scite-context-lexer-cld') local mpslexer = lexer.load('scite-context-lexer-mps') --- local cldlexer = lexer.load('scite-context-lexer-lua') -- test - local commands = { en = { } } local primitives = { } local helpers = { } @@ -189,8 +189,6 @@ end) local commentline = P('%') * (1-S("\n\r"))^0 local endline = S("\n\r")^1 -local whitespace = lexer.WHITESPACE - local space = lexer.space -- S(" \n\r\t\f\v") local any = lexer.any local backslash = P("\\") @@ -405,7 +403,7 @@ local stoplua = P("\\stop") * Cmt(luaenvironment,stopdisplaylua) + Cmt(P("}"),stopinlinelua_e) local startluacode = token("embedded", startlua) -local stopluacode = token("embedded", stoplua) +local stopluacode = #stoplua * token("embedded", stoplua) local metafuncall = ( P("use") + P("reusable") + P("unique") ) * ("MPgraphic") diff --git a/context/data/scite/lexers/scite-context-lexer-txt.lua b/context/data/scite/lexers/scite-context-lexer-txt.lua index 2f476a6a8..f607ee1eb 100644 --- a/context/data/scite/lexers/scite-context-lexer-txt.lua +++ b/context/data/scite/lexers/scite-context-lexer-txt.lua @@ -13,11 +13,9 @@ local token = lexer.token local P, S, Cmt = lpeg.P, lpeg.S, lpeg.Cmt local find, match = string.find, string.match -local textlexer = { _NAME = "text" } - -local context = lexer.context - +local textlexer = { _NAME = "txt" } local whitespace = lexer.WHITESPACE +local context = lexer.context local space = lexer.space local any = lexer.any diff --git a/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua index 511465b01..7dfaed5bc 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua @@ -10,21 +10,21 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local xmlcdatalexer = { _NAME = "xmlcdata" } +local xmlcdatalexer = { _NAME = "xml-cdata" } +local whitespace = lexer.WHITESPACE -- triggers states +local context = lexer.context -local whitespace = lexer.WHITESPACE -- triggers states +local space = lexer.space +local nospace = 1 - space - P("]]>") -local space = lexer.space -local nospace = 1 - space - P("]]>") - -local p_spaces = token(whitespace, space ^1) -local p_cdata = token("comment", nospace^1) +local p_spaces = token(whitespace, space ^1) +local p_cdata = token("comment", nospace^1) xmlcdatalexer._rules = { { "whitespace", p_spaces }, { "cdata", p_cdata }, } -xmlcdatalexer._tokenstyles = lexer.context.styleset +xmlcdatalexer._tokenstyles = context.styleset return xmlcdatalexer diff --git a/context/data/scite/lexers/scite-context-lexer-xml-comment.lua b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua index 151270091..f2e24fa90 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml-comment.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua @@ -10,9 +10,9 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local xmlcommentlexer = { _NAME = "xmlcomment" } - -local whitespace = lexer.WHITESPACE +local xmlcommentlexer = { _NAME = "xml-comment" } +local whitespace = lexer.WHITESPACE +local context = lexer.context local space = lexer.space local nospace = 1 - space - P("-->") @@ -25,7 +25,7 @@ xmlcommentlexer._rules = { { "comment", p_comment }, } -xmlcommentlexer._tokenstyles = lexer.context.styleset +xmlcommentlexer._tokenstyles = context.styleset xmlcommentlexer._foldsymbols = { _patterns = { diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua index b74a43cc7..d938840c0 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml.lua @@ -22,12 +22,12 @@ local type = type local match, find = string.match, string.find local xmllexer = { _NAME = "xml" } -local xmlcommentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework) -local xmlcdatalexer = lexer.load("scite-context-lexer-xml-cdata") -- indirect (some issue with the lexer framework) - local whitespace = lexer.WHITESPACE -- triggers states local context = lexer.context +local xmlcommentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework) +local xmlcdatalexer = lexer.load("scite-context-lexer-xml-cdata") -- indirect (some issue with the lexer framework) + local space = lexer.space -- S(" \t\n\r\v\f") local any = lexer.any -- P(1) @@ -95,7 +95,8 @@ local p_word = if validwords then return checkedword(validwords,s,i) else - return true, { "text", i } + return true, { "text", i } -- or default +-- return true, { "invisible", i } end end) @@ -107,6 +108,7 @@ local p_text = local p_spacing = token(whitespace, space^1) +-- token("whitespace", space^1) local p_optionalwhitespace = p_spacing^0 @@ -225,23 +227,29 @@ local p_doctype = token("command",P("This module provides a (multipass) container for arbitrary data. It +replaces the twopass data mechanism.

+--ldx]]-- + +local tonumber = tonumber + +local context, commands = context, commands + +local allocate = utilities.storage.allocate +local settings_to_hash = utilities.parsers.settings_to_hash +local format = string.format +local texcount = tex.count + +local v_yes = interfaces.variables.yes + +local new_latelua = nodes.pool.latelua + +local collected = allocate() +local tobesaved = allocate() + +local datasets = { + collected = collected, + tobesaved = tobesaved, +} + +job.datasets = datasets + +local function initializer() + collected = datasets.collected + tobesaved = datasets.tobesaved +end + +job.register('job.datasets.collected', tobesaved, initializer, nil) + +local sets = { } + +table.setmetatableindex(tobesaved, function(t,k) + local v = { } + t[k] = v + return v +end) + +table.setmetatableindex(sets, function(t,k) + local v = { + index = 0, + order = 0, + } + t[k] = v + return v +end) + +local function setdata(settings) + local name = settings.name + local tag = settings.tag + local data = settings.data + local list = tobesaved[name] + data = settings_to_hash(data) or { } + if not tag then + tag = #list + 1 + else + tag = tonumber(tag) or tag -- autonumber saves keys + end + list[tag] = data + if settings.delay == v_yes then + local set = sets[name] + local index = set.index + 1 + set.index = index + data.index = index + data.order = index + data.realpage = texcount.realpageno + end + return name, tag, data +end + +datasets.setdata = setdata + +function datasets.extend(name,tag) + local set = sets[name] + local order = set.order + 1 + set.order = order + local t = tobesaved[name][tag] + t.realpage = texcount.realpageno + t.order = order +end + +function datasets.getdata(name,tag,key,default) + local t = collected[name] + t = t and (t[tag] or t[tonumber(tag)]) + if not t then + -- back luck + elseif key then + return t[key] or default + else + return t + end +end + +function commands.setdataset(settings) + local name, tag, data = setdata(settings) + if settings.delay ~= v_yes then + -- + elseif type(tag) == "number" then + context(new_latelua(format("job.datasets.extend(%q,%i)",name,tag))) + else + context(new_latelua(format("job.datasets.extend(%q,%q)",name,tag))) + end +end + +function commands.datasetvariable(name,tag,key) + local t = collected[name] + t = t and (t[tag] or t[tonumber(tag)]) + if t then + local s = t[key] + if s then + context(s) + end + end +end + +--[[ldx-- +

We also provide an efficient variant for page states.

+--ldx]]-- + +local collected = allocate() +local tobesaved = allocate() + +local pagestates = { + collected = collected, + tobesaved = tobesaved, +} + +job.pagestates = pagestates + +local function initializer() + collected = pagestates.collected + tobesaved = pagestates.tobesaved +end + +job.register('job.pagestates.collected', tobesaved, initializer, nil) + +table.setmetatableindex(tobesaved, function(t,k) + local v = { } + t[k] = v + return v +end) + +local function setstate(settings) + local name = settings.name + local tag = settings.tag + local list = tobesaved[name] + if not tag then + tag = #list + 1 + else + tag = tonumber(tag) or tag -- autonumber saves keys + end + local data = texcount.realpageno + list[tag] = data + return name, tag, data +end + +pagestates.setstate = setstate + +function pagestates.extend(name,tag) + tobesaved[name][tag] = texcount.realpageno +end + +function pagestates.realpage(name,tag,default) + local t = collected[name] + t = t and (t[tag] or t[tonumber(tag)]) + return tonumber(t or default) +end + +function commands.setpagestate(settings) + local name, tag, data = setstate(settings) + if type(tag) == "number" then + context(new_latelua(format("job.pagestates.extend(%q,%i)",name,tag))) + else + context(new_latelua(format("job.pagestates.extend(%q,%q)",name,tag))) + end +end + +function commands.pagestaterealpage(name,tag) + local t = collected[name] + t = t and (t[tag] or t[tonumber(tag)]) + if t then + context(t) + end +end diff --git a/tex/context/base/core-dat.mkiv b/tex/context/base/core-dat.mkiv new file mode 100644 index 000000000..f1d2a52cb --- /dev/null +++ b/tex/context/base/core-dat.mkiv @@ -0,0 +1,98 @@ +%D \module +%D [ file=core-dat, +%D version=20122.04.17, % replaces core-two from 1997.03.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Multipass Datasets, +%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. + +\writestatus{loading}{ConTeXt Core Macros / Multipass Datasets} + +%D \starttyping +%D \definedataset[test-1] +%D \definedataset[test-2][delay=yes] +%D +%D \startlines +%D set 1: \setdataset[test-1][whatever=this-or-that-1] +%D set 2: \setdataset[test-2][whatever=this-or-that-2] +%D set 3: \setdataset[test-2][whatever=this-or-that-3] +%D \stoplines +%D +%D \startlines +%D get 1: \datasetvariable{test-1}{1}{whatever} / \datasetvariable{test-1}{1}{realpage} +%D get 2: \datasetvariable{test-2}{1}{whatever} / \datasetvariable{test-2}{1}{realpage} +%D get 3: \datasetvariable{test-2}{2}{whatever} / \datasetvariable{test-2}{2}{realpage} +%D \stoplines +%D \stoptyping + +\unprotect + +\registerctxluafile{core-dat}{1.001} + +\installcorenamespace{dataset} + +\installcommandhandler \??dataset {dataset} \??dataset + +\unexpanded\def\setdataset + {\dotripleempty\syst_datasets_set} + +\def\syst_datasets_set + {\ifthirdargument + \expandafter\syst_datasets_set_named + \else + \expandafter\syst_datasets_set_indexed + \fi} + +\def\syst_datasets_set_named[#1][#2][#3]% + {\begingroup + \edef\currentdataset{#1}% + \ctxcommand{setdataset{ + name = "\currentdataset", + tag = \!!bs#2\!!es, + delay = "\datasetparameter\c!delay", + data = \!!bs#3\!!es + }}% + \endgroup} + +\def\syst_datasets_set_indexed[#1][#2][#3]% + {\begingroup + \edef\currentdataset{#1}% + \ctxcommand{setdataset{ + name = "\currentdataset", + delay = "\datasetparameter\c!delay", + data = \!!bs#2\!!es + }}% + \endgroup} + +\def\datasetvariable#1#2#3% + {\ctxcommand{datasetvariable("#1","#2","#3")}} + +\installcorenamespace{pagestate} + +\installcommandhandler \??pagestate {pagestate} \??pagestate + +\setuppagestate + [\c!delay=\v!yes] + +\unexpanded\def\setpagestate + {\dodoubleempty\syst_pagestates_set} + +\def\syst_pagestates_set[#1][#2]% + {\begingroup + \edef\currentpagestate{#1}% + \ctxcommand{setpagestate{ + name = "\currentpagestate", + tag = \!!bs#2\!!es, + delay = "\pagestateparameter\c!delay", + }}% + \endgroup} + +\def\pagestaterealpage#1#2% + {\ctxcommand{pagestaterealpage("#1","#2")}} + +\protect diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index cfe95a6bb..1657a75e2 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -34,7 +34,7 @@ local report_jobcontrol = logs.reporter("jobcontrol") job = job or { } local job = job -job.version = 1.18 +job.version = 1.19 -- some day we will implement loading of other jobs and then we need -- job.jobs diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 88999358c..8e54666be 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -806,3 +806,17 @@ if not pdfreferenceobject then end end + +-- -- Maybe this will be an option (suggested on the mailing list by Peter Rolf): +-- +-- function backends.codeinjections.rgbtransparencygroup() +-- local d = lpdf.dictionary { +-- S = lpdf.constant("Transparency"), +-- CS = lpdf.constant("DeviceRGB"), +-- I = true +-- } +-- lpdf.registerpagefinalizer(function() +-- lpdf.addtopageattributes("Group",d) end) +-- end +-- +-- backends.codeinjections.rgbtransparencygroup() diff --git a/tex/context/base/m-steps.mkvi b/tex/context/base/m-steps.mkvi index de861e619..a07ece3ae 100644 --- a/tex/context/base/m-steps.mkvi +++ b/tex/context/base/m-steps.mkvi @@ -17,11 +17,11 @@ \unprotect -\definecorenamespace {stepcharts} -\definecorenamespace {steptables} -\definecorenamespace {stepcells} -\definecorenamespace {steptexts} -\definecorenamespace {steplines} +\installcorenamespace {stepcharts} +\installcorenamespace {steptables} +\installcorenamespace {stepcells} +\installcorenamespace {steptexts} +\installcorenamespace {steplines} \installsimplecommandhandler \??stepcharts {STEPchart} \??stepcharts \installsimplecommandhandler \??steptables {STEPtable} \??steptables diff --git a/tex/context/base/spac-pag.mkiv b/tex/context/base/spac-pag.mkiv index e44411fba..10b5d1acd 100644 --- a/tex/context/base/spac-pag.mkiv +++ b/tex/context/base/spac-pag.mkiv @@ -18,6 +18,8 @@ %D The code here has evolved over time and might not be the best %D around. Maybe much will be gone a some point. +%D The pagestate code will be redone. + \installcorenamespace {alignswitch} \letvalue{\??alignswitch\v!left }\zerocount @@ -27,7 +29,6 @@ \def\setalignmentswitch#1% {\chardef\alignmentswitch\csname\??alignswitch\ifcsname\??alignswitch#1\endcsname#1\else\v!left\fi\endcsname} -\newcount \noftrackedpagestates \newif \ifpagestatemismatch \newcount \realpagestateno \newconstant\frozenpagestate @@ -37,14 +38,106 @@ \doforcedtrackpagestate{#1}{#2}% \fi \fi} +% \def\doforcedtrackpagestate#1#2% +% {\ifcase\frozenpagestate +% \global\advance#2\plusone +% \lazysavetaggedtwopassdata{#1}{0}{\number#2}{\noexpand\realfolio}% +% \fi} + \def\doforcedtrackpagestate#1#2% {\ifcase\frozenpagestate - \global\advance\noftrackedpagestates\plusone \global\advance#2\plusone - \lazysavetaggedtwopassdata{#1}{\number\noftrackedpagestates}{\number#2}{\noexpand\realfolio}% - %\llap{\infofont\number\noftrackedpagestates/\number#2}% tracing + \setpagestate[#1][\number#2]% \fi} +% \def\doifrightpagestateelse#1#2% not expandable ! +% {\ifcase\frozenpagestate +% \pagestatemismatchfalse +% \realpagestateno\realfolio +% \ifinpagebody +% \ifdoublesided +% \ifodd\realpageno\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \else +% \syst_twopass_set_found +% \fi +% \else\ifdoublesided +% \findtwopassdata{#1}{\number#2}% +% \ifconditional\twopassdatafound +% \realpagestateno\twopassdata\relax +% \ifnum\twopassdata=\realpageno \else +% \pagestatemismatchtrue +% \fi +% \ifodd\twopassdata\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \else +% \ifodd\realpageno\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \fi +% \else +% \syst_twopass_set_found +% \fi\fi +% \else +% \ifodd\realpagestateno\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \fi +% \ifconditional\twopassdatafound +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} + +% \def\doifforcedrightpagestateelse#1#2% +% {\ifcase\frozenpagestate +% \pagestatemismatchfalse +% \realpagestateno\realfolio +% \findtwopassdata{#1}{\number#2}% +% \ifconditional\twopassdatafound +% \realpagestateno\twopassdata\relax +% \ifnum\twopassdata=\realpageno \else +% \pagestatemismatchtrue +% \fi +% \ifodd\twopassdata\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \else +% \ifodd\realpageno\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \fi +% \else +% \ifodd\realpagestateno\relax +% \syst_twopass_set_found +% \else +% \syst_twopass_set_not_found +% \fi +% \fi +% \ifconditional\twopassdatafound +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} + +\let\m_spac_pagestates_realpage\empty + +\newconditional\c_spac_pagestates_found + \def\doifrightpagestateelse#1#2% not expandable ! {\ifcase\frozenpagestate \pagestatemismatchfalse @@ -52,43 +145,43 @@ \ifinpagebody \ifdoublesided \ifodd\realpageno\relax - \syst_twopass_set_found + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \else - \syst_twopass_set_found + \settrue\c_spac_pagestates_found \fi \else\ifdoublesided - \findtwopassdata{#1}{\number#2}% - \ifconditional\twopassdatafound - \realpagestateno\twopassdata\relax - \ifnum\twopassdata=\realpageno \else - \pagestatemismatchtrue - \fi - \ifodd\twopassdata\relax - \syst_twopass_set_found + \edef\m_spac_pagestates_realpage{\pagestaterealpage{#1}{\number#2}}% + \ifx\m_spac_pagestates_realpage\empty + \ifodd\realpageno\relax + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \else - \ifodd\realpageno\relax - \syst_twopass_set_found + \realpagestateno\m_spac_pagestates_realpage\relax + \ifnum\realpagestateno=\realpageno \else + \pagestatemismatchtrue + \fi + \ifodd\realpagestateno\relax + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \fi \else - \syst_twopass_set_found + \settrue\c_spac_pagestates_found \fi\fi \else \ifodd\realpagestateno\relax - \syst_twopass_set_found + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \fi - \ifconditional\twopassdatafound + \ifconditional\c_spac_pagestates_found \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -98,32 +191,32 @@ {\ifcase\frozenpagestate \pagestatemismatchfalse \realpagestateno\realfolio - \findtwopassdata{#1}{\number#2}% - \ifconditional\twopassdatafound - \realpagestateno\twopassdata\relax - \ifnum\twopassdata=\realpageno \else - \pagestatemismatchtrue - \fi - \ifodd\twopassdata\relax - \syst_twopass_set_found + \edef\m_spac_pagestates_realpage{\pagestaterealpage{#1}{\number#2}}% + \ifx\m_spac_pagestates_realpage\empty + \ifodd\realpageno\relax + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \else - \ifodd\realpageno\relax - \syst_twopass_set_found + \realpagestateno\m_spac_pagestates_realpage\relax + \ifnum\realpagestateno=\realpageno \else + \pagestatemismatchtrue + \fi + \ifodd\realpagestateno\relax + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \fi \else \ifodd\realpagestateno\relax - \syst_twopass_set_found + \settrue\c_spac_pagestates_found \else - \syst_twopass_set_not_found + \setfalse\c_spac_pagestates_found \fi \fi - \ifconditional\twopassdatafound + \ifconditional\c_spac_pagestates_found \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -134,73 +227,49 @@ % we can make more of these on top, but how to deal with mixed frozen states -\definetwopasslist\s!paragraph \newcount\nofraggedparagraphs +% \dorecurse{500}{\dontleavehmode\signalrightpage\doifrightpageelse{right}{left}\par} % given doublesided -\def\signalrightpage {\dotrackpagestate \s!paragraph\nofraggedparagraphs} -\def\doifrightpageelse{\doifrightpagestateelse\s!paragraph\nofraggedparagraphs} +% \definetwopasslist\s!paragraph + +\newcount\nofraggedparagraphs -% no longer used -% -% \newcount\pagesignallevel -% -% \unexpanded\def\startsignalrightpage % one may do a \postsignalrightplace -% {\advance\pagesignallevel\plusone -% \presignalrightpage -% \let\signalrightpage\relax -% \let\presignalrightpage\relax -% \let\startsignalrightpage\relax -% \doifrightpageelse\donothing\donothing -% \freezepagestate} -% -% \unexpanded\def\stopsignalrightpage -% {\ifcase\pagesignallevel\or\postsignalrightpage\fi -% \advance\pagesignallevel\minusone} -% -% \ifx\swapmargins\undefined \let\swapmargins\undefined \fi % todo -% -% \def\doifswappedrightpageelse#1#2% alleen in box construction ! -% {\doifrightpageelse -% {#1} -% {\scratchcounter\realpageno -% \realpageno\realpagestateno\relax -% \swapmargins -% \realpageno\scratchcounter -% #2}} -% -% \newbox\signaledrightpage % this way we can avoid interference, i.e. postpone placement -% -% \def\presignalrightpage {\global\setbox\signaledrightpage\hbox{\signalrightpage}} -% \def\postsignalrightpage{\ifvoid\signaledrightpage\else\box\signaledrightpage\fi} -% -% % The next feature is is used in: -% % -% % \definenumber[test][way=bypage] -% % -% % \def\Test -% % {\incrementnumber[test]\rawnumber[test]/% -% % \incrementnumber[test]\rawnumber[test]/% -% % \incrementnumber[test]\rawnumber[test]\space -% % \checkpagechange{oeps}\changedpage{oeps}\space -% % \ifpagechanged TRUE\else FALSE\fi} -% % -% % \Test\page \Test\par \Test\page \Test\par \Test\page \Test\page +\definepagestate[\s!paragraph] + +\def\signalrightpage {\dotrackpagestate \s!paragraph\nofraggedparagraphs} % use \dontleavehmode if needed +\def\doifrightpageelse{\doifrightpagestateelse\s!paragraph\nofraggedparagraphs} \installcorenamespace{pagechanges} \newif\ifpagechanged \let\lastchangedpage\empty +% \def\spac_pagechanges_check#1#2#3% +% {\pagechangedfalse +% \doforcedtrackpagestate{#2}{#3}% +% \findtwopassdata{#2}{\number#3}% +% \ifconditional\twopassdatafound +% \ifnum\twopassdata>0\getvalue{\??pagechanges#2:#1}\relax +% \pagechangedtrue +% \fi +% \fi +% \ifpagechanged +% \letgvalue{\??pagechanges#2:#1}\twopassdata +% \globallet\lastchangedpage\twopassdata +% \else +% \globallet\lastchangedpage\realfolio +% \fi} + \def\spac_pagechanges_check#1#2#3% {\pagechangedfalse \doforcedtrackpagestate{#2}{#3}% - \findtwopassdata{#2}{\number#3}% - \ifconditional\twopassdatafound - \ifnum\twopassdata>0\getvalue{\??pagechanges#2:#1}\relax + \edef\m_spac_pagestates_realpage{\pagestaterealpage{#2}{\number#3}}% + \ifx\m_spac_pagestates_realpage\empty \else + \ifnum\m_spac_pagestates_realpage>0\getvalue{\??pagechanges#2:#1}\relax \pagechangedtrue \fi \fi \ifpagechanged - \letgvalue{\??pagechanges#2:#1}\twopassdata - \globallet\lastchangedpage\twopassdata + \letgvalue{\??pagechanges#2:#1}\m_spac_pagestates_realpage + \globallet\lastchangedpage\m_spac_pagestates_realpage \else \globallet\lastchangedpage\realfolio \fi} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index ff117e85e..c022049d5 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index e15816a17..850e11e23 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 86af98fbd..5c54b079f 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -384,6 +384,11 @@ return { status = "okay", comment = "maybe rename to core-two", }, + { + filename = "core-dat", + marktype = "mkiv", + status = "okay", + }, { filename = "colo-ini", marktype = "mkiv", diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index ba1f4e29c..05cfa40e3 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -355,26 +355,66 @@ \fi \fi} -% the tricky part of getting float related two pass data is +% The tricky part of getting float related two pass data is % that we should fetch is early but can only save it with % the composed float box; this determines the order: get it -% before saving it +% before saving it. -\definetwopasslist{\s!float\s!data} \newcounter\noffloatdata +% We had this: +% +% \definetwopasslist{\s!float\s!data} \newcounter\noffloatdata +% +% \let\strc_float_realpage\realpageno % used for odd/even determination, can be combined with nodelocation +% +% \def\strc_float_save_data % \expanded ... will change in mkiv +% {\doglobal\increment\noffloatdata +% \lazysavetaggedtwopassdata{\s!float\s!data}{\noffloatdata}{\noffloatpages}{\noexpand\realfolio}}% later {}{}{}{} and \getfirst... +% +% \def\strc_float_load_data % precedes save ! +% {\doglobal\increment\noffloatpages +% \findtwopassdata{\s!float\s!data}{\noffloatpages}% +% \ifconditional\twopassdatafound +% \globallet\strc_float_realpage\twopassdata +% \else +% \globallet\strc_float_realpage\realpageno % \realfolio +% \fi} + +%D We can do this ... +%D +%D \starttyping +%D \newcount\c_strc_floats_n +%D +%D \definedataset[\s!float][\c!delay=\v!yes] +%D +%D \let\strc_float_realpage\realpageno +%D +%D \def\strc_float_save_data +%D {\setdataset[\s!float][\number\c_strc_floats_n][]} +%D +%D \def\strc_float_load_data % precedes save ! +%D {\global\advance\c_strc_floats_n\plusone +%D \xdef\strc_float_realpage{\datasetvariable\s!float{\number\c_strc_floats_n}\s!page}% +%D \ifx\strc_float_realpage\empty +%D \globallet\strc_float_realpage\realpageno % \realfolio +%D \fi} +%D \stoptyping +%D +%D ... but this is more efficient: -\let\twopassfloatdata\realpageno % used for odd/even determination, can be combined with nodelocation +\definepagestate[\s!float][\c!delay=\v!yes] -\def\dosavefloatdata % \expanded ... will change in mkiv - {\doglobal\increment\noffloatdata - \lazysavetaggedtwopassdata{\s!float\s!data}{\noffloatdata}{\noffloatpages}{\noexpand\realfolio}}% later {}{}{}{} and \getfirst... +\newcount\c_strc_floats_n -\def\dogetfloatdata % precedes save ! - {\doglobal\increment\noffloatpages - \findtwopassdata{\s!float\s!data}{\noffloatpages}% - \ifconditional\twopassdatafound - \globallet\twopassfloatdata\twopassdata - \else - \globallet\twopassfloatdata\realpageno % \realfolio +\let\strc_float_realpage\realpageno + +\def\strc_float_save_data + {\setpagestate[\s!float][\number\c_strc_floats_n]} + +\def\strc_float_load_data % precedes save ! + {\global\advance\c_strc_floats_n\plusone + \xdef\strc_float_realpage{\pagestaterealpage\s!float{\number\c_strc_floats_n}}% + \ifx\strc_float_realpage\empty + \globallet\strc_float_realpage\realpageno % \realfolio \fi} %D test case: @@ -807,7 +847,7 @@ \appendtoks \everyinsidefloat\emptytoks % in case it's called earlier - \dogetfloatdata + \strc_float_load_data \to \everyinsidefloat \def\doifrightpagefloatelse @@ -822,7 +862,7 @@ \fi} \def\doifoddfloatpageelse - {\ifodd\purenumber\twopassfloatdata\space + {\ifodd\purenumber\strc_float_realpage\space \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -1816,7 +1856,7 @@ \fi \strc_floats_set_local_dimensions \global\advance\totalnoffloats\plusone - \setbox\floatbox\hbox{\dosavefloatdata\box\floatbox}% still needed? we will do renumbering differently + \setbox\floatbox\hbox{\strc_float_save_data\box\floatbox}% still needed? we will do renumbering differently \global\floatheight\htdp\floatbox \global\floatwidth\wd\floatbox \doifnotinset\v!margin\floatlocation % gaat namelijk nog fout diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index f8f25900f..5f1f041e3 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -332,8 +332,9 @@ \c!rulethickness=\linewidth, \c!frame=\v!off, \c!distance=.125em, % in the text between symbols + % \c!textseparator={,}, % optional separator \c!columndistance=1em, -% \c!margindistance=.5em, + % \c!margindistance=.5em, \c!align=, % also use instead of \c!tolerance \c!split=\v!tolerant, \c!width=\makeupwidth, % \ifdim\hsize<\makeupwidth\hsize\else\makeupwidth\fi @@ -608,7 +609,8 @@ {\removeunwantedspaces \doifitalicelse\/\donothing % Charles IV \footnote{the fourth} \ifdim\lastkern=\notesignal - \kern\noteparameter\c!distance % yes or no note font? or main text + % \kern\noteparameter\c!distance % yes or no note font? or main text + \strc_notes_inject_separator \fi \nobreak \begingroup @@ -632,12 +634,29 @@ {\removeunwantedspaces \doifitalicelse\/\donothing % Charles IV \footnote{the fourth} \ifdim\lastkern=\notesignal - \kern\noteparameter\c!distance % yes or no note font? or main text + % \kern\noteparameter\c!distance % yes or no note font? or main text + \strc_notes_inject_separator \fi \nobreak \hbox to .5em{}% \globallet\lastnotesymbol\relax} +\unexpanded\def\strc_notes_inject_separator % patch by WS due to request on list + {\edef\p_textseparator{\noteparameter\c!textseparator}% + \ifx\p_textseparator\empty + \kern\noteparameter\c!distance + \else + % skip or kern + \nobreak + \hbox\bgroup + \strc_notes_interaction_check_inline + \strc_notes_set_style_color_inline\c!textstyle\c!textcolor + \noteparameter\c!textcommand{\p_textseparator}% + \kern\noteparameter\c!distance + \egroup + \nobreak + \fi} + % this needs a further cleanup ... soon as it's a slow mechanism % % -- set breakpoint in descriptions diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index c1d890276..44de8ebe6 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -536,6 +536,13 @@ local function reportbanner(t) end end +local function reportversion(t) + local banner = t.banner + if banner then + t.report(banner) + end +end + local function reporthelp(t,...) local helpinfo = t.helpinfo if type(helpinfo) == "string" then @@ -562,6 +569,7 @@ function logs.application(t) t.report = logs.reporter(t.name) t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end t.identify = function() reportbanner(t) end + t.version = function() reportversion(t) end return t end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index df477dd17..7808e2cea 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 : 04/14/12 00:10:51 +-- merge date : 04/17/12 22:37:22 do -- begin closure to overcome local limits and interference -- cgit v1.2.3