summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/attr-ini.lua43
-rw-r--r--tex/context/base/mkiv/back-out.lmt6
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua11
-rw-r--r--tex/context/base/mkiv/cldf-lmt.lmt1
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl3
-rw-r--r--tex/context/base/mkiv/lang-ini.mkxl24
-rw-r--r--tex/context/base/mkiv/math-ini.mkxl1
-rw-r--r--tex/context/base/mkiv/math-toy.mkxl55
-rw-r--r--tex/context/base/mkiv/mlib-lua.lmt9
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua6
-rw-r--r--tex/context/base/mkiv/mlib-run.lua7
-rw-r--r--tex/context/base/mkiv/mlib-scn.lmt4
-rw-r--r--tex/context/base/mkiv/mult-low.lua5
-rw-r--r--tex/context/base/mkiv/node-aux.lmt4
-rw-r--r--tex/context/base/mkiv/node-ini.lmt8
-rw-r--r--tex/context/base/mkiv/node-ini.lua14
-rw-r--r--tex/context/base/mkiv/node-ltp.lua13
-rw-r--r--tex/context/base/mkiv/node-met.lua2
-rw-r--r--tex/context/base/mkiv/node-nut.lmt10
-rw-r--r--tex/context/base/mkiv/node-syn.lua48
-rw-r--r--tex/context/base/mkiv/node-typ.lua45
-rw-r--r--tex/context/base/mkiv/spac-hor.mkxl4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin28149 -> 28146 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256247 -> 256179 bytes
-rw-r--r--tex/context/base/mkiv/syst-aux.mkxl10
-rw-r--r--tex/context/base/mkiv/toks-ini.lmt320
-rw-r--r--tex/context/base/mkiv/toks-ini.lua109
-rw-r--r--tex/context/base/mkiv/toks-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/trac-deb.lmt2
-rw-r--r--tex/context/base/mkiv/trac-inf.lmt6
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
35 files changed, 558 insertions, 224 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index e31e763e6..a07e70f47 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{2020.08.28 13:55}
+\newcontextversion{2020.08.31 22:01}
%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 ae452602c..c0b5201c2 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{2020.08.28 13:55}
+\edef\contextversion{2020.08.31 22:01}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/attr-ini.lua b/tex/context/base/mkiv/attr-ini.lua
index 6145fa08d..5507f2a70 100644
--- a/tex/context/base/mkiv/attr-ini.lua
+++ b/tex/context/base/mkiv/attr-ini.lua
@@ -14,32 +14,33 @@ local osexit = os.exit
symbolic names later on.</p>
--ldx]]--
-local nodes = nodes
-local context = context
-local storage = storage
-local commands = commands
+local nodes = nodes
+local context = context
+local storage = storage
+local commands = commands
-local implement = interfaces.implement
+local implement = interfaces.implement
-attributes = attributes or { }
-local attributes = attributes
+attributes = attributes or { }
+local attributes = attributes
-local sharedstorage = storage.shared
+local sharedstorage = storage.shared
-local texsetattribute = tex.setattribute
+local texsetattribute = tex.setattribute
-attributes.names = attributes.names or { }
-attributes.numbers = attributes.numbers or { }
-attributes.list = attributes.list or { }
-attributes.states = attributes.states or { }
-attributes.handlers = attributes.handlers or { }
-attributes.unsetvalue = -0x7FFFFFFF
+attributes.names = attributes.names or { }
+attributes.numbers = attributes.numbers or { }
+attributes.list = attributes.list or { }
+attributes.states = attributes.states or { }
+attributes.handlers = attributes.handlers or { }
+attributes.unsetvalue = -0x7FFFFFFF
-local currentfont = font.current
+local currentfont = font.current -- mabe nicer is attributes.current
+local currentattributes = node.current_attributes -- mabe nicer is fonts .current
-local names = attributes.names
-local numbers = attributes.numbers
-local list = attributes.list
+local names = attributes.names
+local numbers = attributes.numbers
+local list = attributes.list
storage.register("attributes/names", names, "attributes.names")
storage.register("attributes/numbers", numbers, "attributes.numbers")
@@ -127,7 +128,7 @@ local function showlist(what,list)
end
function attributes.showcurrent()
- showlist("current",node.current_attr())
+ showlist("current",currentattributes())
end
function attributes.ofnode(n)
@@ -140,7 +141,7 @@ local store = { }
function attributes.save(name)
name = name or ""
- local n = node.current_attr()
+ local n = currentattributes()
n = n and n.next
local t = { }
while n do
diff --git a/tex/context/base/mkiv/back-out.lmt b/tex/context/base/mkiv/back-out.lmt
index 968617ecc..acf004634 100644
--- a/tex/context/base/mkiv/back-out.lmt
+++ b/tex/context/base/mkiv/back-out.lmt
@@ -20,7 +20,7 @@ local scanstring = scanners.string
local scankeyword = scanners.keyword
local scantokenlist = scanners.tokenlist
-local tokentostring = token.to_string
+local serialize = token.serialize
local logwriter = logs.writer
local openfile = io.open
@@ -123,7 +123,7 @@ function backends.writeout(n)
local p = nodeproperties[n]
if p then
local handle = channels[p.channel]
- local content = tokentostring(p.data)
+ local content = serialize(p.data)
if handle then
handle:write(content,"\n")
else
@@ -193,7 +193,7 @@ function backends.latelua(current,pos_h,pos_v) -- todo: pass pos_h and pos_v (mo
data()
else
if kind ~= "string" then
- data = tokentostring(data)
+ data = serialize(data)
end
if #data ~= "" then
local code = loadstring(data)
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index e64381f49..aa713485f 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -678,8 +678,7 @@ end
local containseol = patterns.containseol
------ t_cldl_luafunction = newtoken("luafunctioncall",0)
-local lua_expandable_call_token_code = token.command_id and token.command_id("lua_expandable_call")
+local lua_expandable_call_code = tokens.commands.lua_expandable_call
local sortedhashindeed = false
@@ -776,7 +775,7 @@ local function writer(parent,command,...) -- already optimized before call
local tj = ti[1]
if type(tj) == "function" then
tj = storefunction(tj)
- flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),"]")
+ flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_code),"]")
else
flush(currentcatcodes,"[",tj,"]")
end
@@ -786,7 +785,7 @@ local function writer(parent,command,...) -- already optimized before call
local tj = ti[j]
if type(tj) == "function" then
tj = storefunction(tj)
- flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),j == tn and "]" or ",")
+ flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_code),j == tn and "]" or ",")
else
if j == tn then
flush(currentcatcodes,tj,"]")
@@ -799,7 +798,7 @@ local function writer(parent,command,...) -- already optimized before call
elseif typ == "function" then
-- todo: ctx|prt|texcatcodes
ti = storefunction(ti)
- flush(currentcatcodes,"{",newtoken(ti,lua_expandable_call_token_code),"}")
+ flush(currentcatcodes,"{",newtoken(ti,lua_expandable_call_code),"}")
elseif typ == "boolean" then
if ti then
flushdirect(currentcatcodes,"\r")
@@ -955,7 +954,7 @@ local caller = function(parent,f,a,...)
elseif typ == "function" then
-- ignored: a ...
f = storefunction(f)
- flush(currentcatcodes,"{",newtoken(f,lua_expandable_call_token_code),"}")
+ flush(currentcatcodes,"{",newtoken(f,lua_expandable_call_code),"}")
elseif typ == "boolean" then
if f then
if a ~= nil then
diff --git a/tex/context/base/mkiv/cldf-lmt.lmt b/tex/context/base/mkiv/cldf-lmt.lmt
index c60c75deb..9889131a5 100644
--- a/tex/context/base/mkiv/cldf-lmt.lmt
+++ b/tex/context/base/mkiv/cldf-lmt.lmt
@@ -947,4 +947,3 @@ interfaces.implement {
return none_code
end,
}
-
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 47a7e253c..70709ab75 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.08.28 13:55}
+\newcontextversion{2020.08.31 22:01}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index d7bc0b818..ae883f927 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.08.28 13:55}
+\edef\contextversion{2020.08.31 22:01}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 000d9f77c..2022db971 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.08.28 13:55}
+\edef\contextversion{2020.08.31 22:01}
%D Kind of special:
@@ -491,6 +491,7 @@
\loadmarkfile{math-inl}
\loadmarkfile{math-dis}
%loadmarkfile{math-lan}
+\loadmkxlfile{math-toy}
%loadmarkfile{phys-dim} % moved to after typo-scr
diff --git a/tex/context/base/mkiv/lang-ini.mkxl b/tex/context/base/mkiv/lang-ini.mkxl
index 87b3f3064..f5831a5ea 100644
--- a/tex/context/base/mkiv/lang-ini.mkxl
+++ b/tex/context/base/mkiv/lang-ini.mkxl
@@ -418,17 +418,19 @@
% \uchyph\plusone :
\chardef \completehyphenationmodecode \numexpr
- \normalhyphenationmodecode % \discretionary
- + \automatichyphenationmodecode % -
- + \explicithyphenationmodecode % \-
- + \syllablehyphenationmodecode % pattern driven
- + \uppercasehyphenationmodecode % replaces \uchyph
- + \compoundhyphenationmodecode % replaces \compoundhyphenmode
- % \strictstarthyphenationmodecode % replaces \hyphenationbounds (strict = original tex)
- % \strictendhyphenationmodecode % replaces \hyphenationbounds (strict = original tex)
- + \automaticpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
- + \explicitpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
- + \permitgluehyphenationmodecode % turn glue into kern in \discretionary
+ \normalhyphenationmodecode % \discretionary
+ + \automatichyphenationmodecode % -
+ + \explicithyphenationmodecode % \-
+ + \syllablehyphenationmodecode % pattern driven
+ + \uppercasehyphenationmodecode % replaces \uchyph
+ + \compoundhyphenationmodecode % replaces \compoundhyphenmode
+ % \strictstarthyphenationmodecode % replaces \hyphenationbounds (strict = original tex)
+ % \strictendhyphenationmodecode % replaces \hyphenationbounds (strict = original tex)
+ + \automaticpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
+ + \explicitpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
+ + \permitgluehyphenationmodecode % turn glue into kern in \discretionary
+ + \permitallhyphenationmodecode % okay, let's be even more tolerant
+ + \permitmathreplacehyphenationmodecode % and again we're more permissive
\relax
\unexpanded\def\dohyphens{\hyphenationmode\completehyphenationmodecode}
diff --git a/tex/context/base/mkiv/math-ini.mkxl b/tex/context/base/mkiv/math-ini.mkxl
index 672ef04cc..427d79d45 100644
--- a/tex/context/base/mkiv/math-ini.mkxl
+++ b/tex/context/base/mkiv/math-ini.mkxl
@@ -665,6 +665,7 @@
\def\mathcodenumber #1{\the\csname math#1code\endcsname}
\unexpanded\def\mathcodecommand#1{\csname\??mathcodecommand#1\endcsname}
+ \def\mathcodechecked#1{\ifcsname math#1code\endcsname\lastnamedcs\else#1\fi}
% \startlines
% $\mathopnolimits{\rm d}x$
diff --git a/tex/context/base/mkiv/math-toy.mkxl b/tex/context/base/mkiv/math-toy.mkxl
new file mode 100644
index 000000000..4cc65aaa6
--- /dev/null
+++ b/tex/context/base/mkiv/math-toy.mkxl
@@ -0,0 +1,55 @@
+%D \module
+%D [ file=math-toy,
+%D version=2020.08.31,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Toy math,
+%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 Math Macros / Toy}
+
+\unprotect
+
+%D Just an example:
+%D
+%D \starttyping
+%D \enabletrackers[math.toysymbol]
+%D
+%D \definemathtoysymbol[Plus] [bin][+]
+%D \definemathtoysymbol[Minus][bin][-]
+%D \definemathtoysymbol[Equal][rel][=]
+%D
+%D $\dorecurse{199}{x_{#1} \ifodd#1\relax\Plus\else\Minus\fi} x_{200} \Equal n$ \blank
+%D \stoptyping
+
+\unexpanded\def\definemathtoysymbol
+ {\dotripleargument\math_toy_define_symbol}
+
+\def\math_toy_define_symbol[#1][#2][#3]%
+ {\setuevalue{#1}{\math_toy_define_symbol_indeed{\mathcodechecked{#2}}{#3}}}
+
+\unexpanded\def\math_toy_define_symbol_traced#1#2%
+ {\normalexpanded{\discretionary class #1 %
+ {$\Ustyle\number\mathstyle \darkred #2$}%
+ {$\Ustyle\number\mathstyle \darkblue #2$}%
+ {$\Ustyle\number\mathstyle \darkgreen #2$}}}
+
+\unexpanded\def\math_toy_define_symbol_normal#1#2%
+ {\normalexpanded{\discretionary class #1 %
+ {$\Ustyle\number\mathstyle #2$}%
+ {$\Ustyle\number\mathstyle #2$}%
+ {$\Ustyle\number\mathstyle #2$}}}
+
+\installtextracker
+ {math.toysymbol}
+ {\let\math_toy_define_symbol_indeed\math_toy_define_symbol_traced}
+ {\let\math_toy_define_symbol_indeed\math_toy_define_symbol_normal}
+
+\let\math_toy_define_symbol_indeed\math_toy_define_symbol_normal
+
+\protect
diff --git a/tex/context/base/mkiv/mlib-lua.lmt b/tex/context/base/mkiv/mlib-lua.lmt
index 366a8bca7..8721ed60c 100644
--- a/tex/context/base/mkiv/mlib-lua.lmt
+++ b/tex/context/base/mkiv/mlib-lua.lmt
@@ -45,10 +45,11 @@ scan.transform = function(t) return scan_transform (currentmpx,t) end
scan.path = function(t) return scan_path (currentmpx,t) end
scan.pen = function(t) return scan_pen (currentmpx,t) end
-local solve_path = mplib.solve_path
+local solvepath = mplib.solvepath
+local getstatus = mplib.getstatus
mp.solve = function(...)
- return solve_path(currentmpx,...)
+ return solvepath(currentmpx,...)
end
local inject_path = mplib.inject_path
@@ -160,8 +161,8 @@ function metapost.currentmpx()
return currentmpx
end
-local status = mplib.status
+-- mplib.getstates(): zero is "normal"
function metapost.currentmpxstatus()
- return status and status(currentmpx) or 0
+ return getstatus(currentmpx) or 0
end
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index 44e78ba91..3945ffcfe 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -27,7 +27,7 @@ local copy_node = node.copy
local write_node = node.write
local pen_info = mplib.pen_info
-local object_fields = mplib.fields
+local getfields = mplib.getfields or mplib.fields -- todo: in lmtx get them once and then use gettype
local save_table = false
local force_stroke = false
@@ -744,9 +744,9 @@ function metapost.totable(result,askedfig)
for o=1,#objects do
local object = objects[o]
local result = { }
- local fields = object_fields(object) -- hm, is this the whole list, if so, we can get it once
+ local fields = getfields(object) -- hm, is this the whole list, if so, we can get it once
for f=1,#fields do
- local field = fields[f]
+ local field = fields[f]
result[field] = object[field]
end
results[o] = result
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 5aa9c78d0..602d6f36c 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -661,20 +661,21 @@ do
end
+local getstatistics = mplib.getstatistics or mplib.statistics
+
function metapost.getstatistics(memonly)
if memonly then
local n, m = 0, 0
for name, mpx in next, mpxformats do
n = n + 1
- m = m + mpx:statistics().memory
+ m = m + getstatistics(mpx).memory
end
return n, m
else
local t = { }
for name, mpx in next, mpxformats do
- t[name] = mpx:statistics()
+ t[name] = getstatistics(mpx)
end
return t
end
end
-
diff --git a/tex/context/base/mkiv/mlib-scn.lmt b/tex/context/base/mkiv/mlib-scn.lmt
index 4497dffc8..8b0cd730a 100644
--- a/tex/context/base/mkiv/mlib-scn.lmt
+++ b/tex/context/base/mkiv/mlib-scn.lmt
@@ -33,8 +33,8 @@ local insert, remove = table.insert, table.remove
local mplib = mplib
local metapost = metapost
-local codes = mplib.codes()
-local types = mplib.types()
+local codes = mplib.getcodes()
+local types = mplib.gettypes()
table.hashed(codes)
table.hashed(types)
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index bc9913595..51bb9e052 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -162,7 +162,8 @@ return {
"normalhyphenationmodecode", "automatichyphenationmodecode", "explicithyphenationmodecode",
"syllablehyphenationmodecode", "uppercasehyphenationmodecode", "completehyphenationmodecode",
"compoundhyphenationmodecode", "strictstarthyphenationmodecode", "strictendhyphenationmodecode",
- "automaticpenaltyhyphenationmodecode", "explicitpenaltyhyphenationmodecode", "permitgluehyphenationmodecode",
+ "automaticpenaltyhyphenationmodecode", "explicitpenaltyhyphenationmodecode",
+ "permitgluehyphenationmodecode", "permitallhyphenationmodecode", "permitmathreplacehyphenationmodecode",
--
"normalizelinemodecode", "indentskipmodecode", "swaphangindentmodecode", "swapparskipmodecode", "breakafterdirmodecode",
},
@@ -376,7 +377,7 @@ return {
"gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals",
--
"dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith",
- "doloopovermatch", "doloopoverlist",
+ "doloopovermatch", "doloopovermatched", "doloopoverlist",
--
"newconstant", "setnewconstant", "setconstant", "setconstantvalue",
"newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue",
diff --git a/tex/context/base/mkiv/node-aux.lmt b/tex/context/base/mkiv/node-aux.lmt
index 9e7c02028..ada376556 100644
--- a/tex/context/base/mkiv/node-aux.lmt
+++ b/tex/context/base/mkiv/node-aux.lmt
@@ -365,8 +365,8 @@ end
do
local localparcodes = nodes.localparcodes
- local hmodepar_code = localparcodes.vmode_par
- local vmodepar_code = localparcodes.hmode_par
+ local hmodepar_code = localparcodes.hmode_par
+ local vmodepar_code = localparcodes.vmode_par
local getnest = tex.getnest
local getsubtype = nuts.getsubtype
diff --git a/tex/context/base/mkiv/node-ini.lmt b/tex/context/base/mkiv/node-ini.lmt
index 2f0b98e88..f43896d79 100644
--- a/tex/context/base/mkiv/node-ini.lmt
+++ b/tex/context/base/mkiv/node-ini.lmt
@@ -54,11 +54,7 @@ local radicalcodes = mark(getsubtypes("radical"))
local accentcodes = mark(getsubtypes("accent"))
local fencecodes = mark(getsubtypes("fence"))
----- fractioncodes = mark(getsubtypes("fraction"))
-local localparcodes = CONTEXTLMTXMODE > 0 and mark(getsubtypes("localpar"))
-
-if not localparcodes then
- localparcodes = allocate { [0] = "new_graf", "local_box", "hmode_par", "penalty", "math" }
-end
+local localparcodes = mark(getsubtypes("localpar"))
local function simplified(t)
local r = { }
@@ -208,8 +204,6 @@ nodes.literalvalues = literalvalues
glyphcodes.glyph = glyphcodes.character
-localparcodes.vmode_par = localparcodes.new_graf
-
listcodes.row = listcodes.alignment
listcodes.column = listcodes.alignment
diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua
index 5c2fc3809..ccbd726d9 100644
--- a/tex/context/base/mkiv/node-ini.lua
+++ b/tex/context/base/mkiv/node-ini.lua
@@ -83,22 +83,14 @@ local fillcodes = mark(getsubtypes("fill"))
local boundarycodes = mark(getsubtypes("boundary"))
local penaltycodes = mark(getsubtypes("penalty"))
local kerncodes = mark(getsubtypes("kern"))
-local margincodes = CONTEXTLMTXMODE > 0 and { }
+local margincodes = mark(getsubtypes("marginkern"))
local mathcodes = mark(getsubtypes("math"))
local noadcodes = mark(getsubtypes("noad"))
local radicalcodes = mark(getsubtypes("radical"))
local accentcodes = mark(getsubtypes("accent"))
local fencecodes = mark(getsubtypes("fence"))
----- fractioncodes = mark(getsubtypes("fraction"))
-local localparcodes = CONTEXTLMTXMODE > 0 and mark(getsubtypes("localpar"))
-
-if not margincodes then
- margincodes = mark(getsubtypes("marginkern"))
-end
-
-if not localparcodes then
- localparcodes = allocate { [0] = "new_graf", "local_box", "hmode_par", "penalty", "math" }
-end
+local localparcodes = allocate { [0] = "vmode_par", "local_box", "hmode_par", "penalty", "math" }
local function simplified(t)
local r = { }
@@ -276,8 +268,6 @@ nodes.literalvalues = literalvalues
glyphcodes.glyph = glyphcodes.character
-localparcodes.vmode_par = localparcodes.new_graf
-
listcodes.row = listcodes.alignment
listcodes.column = listcodes.alignment
diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua
index 87a19de34..6a36adf68 100644
--- a/tex/context/base/mkiv/node-ltp.lua
+++ b/tex/context/base/mkiv/node-ltp.lua
@@ -346,6 +346,11 @@ local new_hlist = nodepool.hlist
local getnormalizeline = nodes.getnormalizeline
+local packing_exactly = "exactly"
+local packing_additional = "additional"
+local packing_expanded = CONTEXTLMTXMODE > 0 and "expanded" or "cal_expand_ratio"
+local packing_substitute = CONTEXTLMTXMODE > 0 and "substiture" or "subst_ex_font"
+
-- helpers --
-- It makes more sense to move the somewhat messy dir state tracking
@@ -1648,9 +1653,9 @@ do
local finished_line = nil
if adjust_spacing > 0 then
statistics.nofadjustedlines = statistics.nofadjustedlines + 1
- finished_line = xpack_nodes(start,cur_width,"cal_expand_ratio",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis)
+ finished_line = xpack_nodes(start,cur_width,packing_expanded,par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis)
else
- finished_line = xpack_nodes(start,cur_width,"exactly",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis)
+ finished_line = xpack_nodes(start,cur_width,packing_exactly,par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis)
end
if protrude_chars > 0 then
statistics.nofprotrudedlines = statistics.nofprotrudedlines + 1
@@ -2958,7 +2963,7 @@ do
setlist(hlist,head)
end
- local cal_expand_ratio = method == "cal_expand_ratio" or method == "subst_ex_font"
+ local cal_expand_ratio = method == packing_expanded or method == packing_substitute
direction = direction or texget("textdir")
@@ -3133,7 +3138,7 @@ do
if pre_adjust_tail then
pre_adjust_tail.next = nil -- todo
end
- if method == "additional" then
+ if method == packing_additional then
width = width + natural
end
setwhd(hlist,width,height,depth)
diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua
index feaff70eb..31f9a16b2 100644
--- a/tex/context/base/mkiv/node-met.lua
+++ b/tex/context/base/mkiv/node-met.lua
@@ -102,7 +102,7 @@ nodes.uses_font = node.uses_font
nodes.first_glyph = node.first_glyph
nodes.has_glyph = node.has_glyph or node.first_glyph
-nodes.current_attr = node.current_attr
+nodes.current_attributes = node.current_attributes or node.current_attr
nodes.has_field = node.has_field
nodes.last_node = node.last_node
nodes.usedlist = node.usedlist
diff --git a/tex/context/base/mkiv/node-nut.lmt b/tex/context/base/mkiv/node-nut.lmt
index 004729a3c..d9edf2114 100644
--- a/tex/context/base/mkiv/node-nut.lmt
+++ b/tex/context/base/mkiv/node-nut.lmt
@@ -50,7 +50,7 @@ local nuts = {
copy_node = direct.copy,
copy_only = direct.copy_only or direct.copy,
count = direct.count,
- current_attr = direct.current_attr,
+ current_attributes = direct.current_attributes,
delete = direct.delete,
dimensions = direct.dimensions,
effective_glue = direct.effective_glue,
@@ -64,7 +64,7 @@ local nuts = {
flush_list = direct.flush_list,
flush_node = direct.flush_node,
free = direct.free,
- get_synctex_fields = direct.get_synctex_fields,
+ getsynctexfields = direct.get_synctex_fields,
getattr = direct.get_attribute,
getattributelist = direct.getattributelist,
getattrlist = direct.getattributelist,
@@ -102,7 +102,7 @@ local nuts = {
getpre = direct.getpre,
getprev = d_getprev,
getreplace = direct.getreplace,
- getruledata = direct.getglyphdata,
+ getruledata = direct.getdata, -- obsolete when we have the split
getscript = direct.setscript,
getshift = direct.getshift,
getstate = direct.getstate,
@@ -144,7 +144,7 @@ local nuts = {
remove = d_remove_node,
reverse = direct.reverse,
set_attribute = direct.set_attribute,
- set_synctex_fields = direct.set_synctex_fields,
+ setsynctexfields = direct.set_synctex_fields,
setattr = direct.set_attribute,
setattributelist = direct.setattributelist,
setattrlist = direct.setattributelist,
@@ -181,7 +181,7 @@ local nuts = {
setpre = direct.setpre,
setprev = direct.setprev,
setreplace = direct.setreplace,
- setruledata = direct.setglyphdata,
+ setruledata = direct.setdata, -- obsolete when we have the split
setscript = direct.getscript,
setshift = direct.setshift,
setsplit = direct.setsplit,
diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua
index c1c62f407..b3ce4a7e3 100644
--- a/tex/context/base/mkiv/node-syn.lua
+++ b/tex/context/base/mkiv/node-syn.lua
@@ -170,15 +170,11 @@ local new_kern = nodepool.kern
local getdimensions = nuts.dimensions
local getrangedimensions = nuts.rangedimensions
-local get_synctex_fields = nuts.get_synctex_fields
------ set_synctex_fields = nuts.set_synctex_fields
-local set_synctex_line = tex.set_synctex_line
-local set_synctex_tag = tex.set_synctex_tag
-local force_synctex_tag = tex.force_synctex_tag
-local force_synctex_line = tex.force_synctex_line
------ get_synctex_tag = tex.get_synctex_tag
-local get_synctex_line = tex.get_synctex_line
-local set_synctex_mode = tex.set_synctex_mode
+local getsynctexfields = nuts.getsynctexfields or nuts.get_synctex_fields
+local forcesynctextag = tex.forcesynctextag or tex.force_synctex_tag
+local forcesynctexline = tex.forcesynctexline or tex.force_synctex_line
+local getsynctexline = tex.getsynctexline or tex.get_synctex_line
+local setsynctexmode = tex.setsynctexmode or tex.set_synctex_mode
local foundintree = resolvers.foundintree
@@ -212,7 +208,7 @@ local paused = 0
local used = false
local never = false
--- get rid of overhead
+-- get rid of overhead in mkiv
if tex.set_synctex_no_files then
tex.set_synctex_no_files(1)
@@ -261,18 +257,18 @@ function synctex.blockfilename(name)
end
function synctex.setfilename(name,line)
- if paused == 0 and force_synctex_tag and name then
- force_synctex_tag(sttags[name])
+ if paused == 0 and name then
+ forcesynctextag(sttags[name])
if line then
- force_synctex_line(line)
+ forcesynctexline(line)
end
end
end
function synctex.resetfilename()
- if paused == 0 and force_synctex_tag then
- force_synctex_tag(0)
- force_synctex_line(0)
+ if paused == 0 then
+ forcesynctextag(0)
+ forcesynctexline(0)
end
end
@@ -284,10 +280,10 @@ do
function synctex.pushline()
nesting = nesting + 1
if nesting == 1 then
- local l = get_synctex_line()
+ local l = getsynctexline()
ignored = l and l > 0
if not ignored then
- force_synctex_line(texget("inputlineno"))
+ forcesynctexline(texget("inputlineno"))
end
end
end
@@ -295,7 +291,7 @@ do
function synctex.popline()
if nesting == 1 then
if not ignored then
- force_synctex_line()
+ forcesynctexline()
ignored = false
end
end
@@ -524,7 +520,7 @@ local function collect_min(head)
local line = 0
while true do
if id == glyph_code then
- local tc, lc = get_synctex_fields(current)
+ local tc, lc = getsynctexfields(current)
if tc and tc > 0 then
tag = tc
line = lc
@@ -591,7 +587,7 @@ local function collect_max(head,parent)
local line = 0
while true do
if id == glyph_code then
- local tc, lc = get_synctex_fields(current)
+ local tc, lc = getsynctexfields(current)
if tc and tc > 0 then
if tag > 0 and (tag ~= tc or line ~= lc) then
head = inject(parent,head,first,last,tag,line)
@@ -619,7 +615,7 @@ local function collect_max(head,parent)
end
elseif id == glue_code then
if tag > 0 then
- local tc, lc = get_synctex_fields(current)
+ local tc, lc = getsynctexfields(current)
if tc and tc > 0 then
if tag ~= tc or line ~= lc then
head = inject(parent,head,first,last,tag,line)
@@ -734,7 +730,7 @@ end
function synctex.enable()
if not never and not enabled then
enabled = true
- set_synctex_mode(3) -- we want details
+ setsynctexmode(3) -- we want details
if not used then
nodes.tasks.enableaction("shipouts","luatex.synctex.collect")
report_system("synctex functionality is enabled, expect 5-10 pct runtime overhead!")
@@ -748,7 +744,7 @@ end
function synctex.disable()
if enabled then
- set_synctex_mode(0)
+ setsynctexmode(0)
report_system("synctex functionality is disabled!")
enabled = false
for i=1,#disablers do
@@ -772,13 +768,13 @@ local filename = nil
function synctex.pause()
paused = paused + 1
if enabled and paused == 1 then
- set_synctex_mode(0)
+ setsynctexmode(0)
end
end
function synctex.resume()
if enabled and paused == 1 then
- set_synctex_mode(3)
+ setsynctexmode(3)
end
paused = paused - 1
end
diff --git a/tex/context/base/mkiv/node-typ.lua b/tex/context/base/mkiv/node-typ.lua
index 021bfefc2..adf0d18c0 100644
--- a/tex/context/base/mkiv/node-typ.lua
+++ b/tex/context/base/mkiv/node-typ.lua
@@ -8,33 +8,36 @@ if not modules then modules = { } end modules ['node-typ'] = {
-- code has been moved to blob-ini.lua
-local typesetters = nodes.typesetters or { }
-nodes.typesetters = typesetters
+local typesetters = nodes.typesetters or { }
+nodes.typesetters = typesetters
-local nuts = nodes.nuts
-local tonode = nuts.tonode
-local tonut = nuts.tonut
+local nuts = nodes.nuts
+local tonode = nuts.tonode
+local tonut = nuts.tonut
-local setlink = nuts.setlink
-local setchar = nuts.setchar
-local setattrlist = nuts.setattrlist
+local setlink = nuts.setlink
+local setchar = nuts.setchar
+local setattrlist = nuts.setattrlist
-local getfont = nuts.getfont
-local getattrlist = nuts.getattrlist
+local getfont = nuts.getfont
+local getattrlist = nuts.getattrlist
-local hpack_node_list = nuts.hpack
-local vpack_node_list = nuts.vpack
-local full_hpack_list = nuts.fullhpack
+local hpack_node_list = nuts.hpack
+local vpack_node_list = nuts.vpack
+local full_hpack_list = nuts.fullhpack
-local nodepool = nuts.pool
-local new_glyph = nodepool.glyph
-local new_glue = nodepool.glue
+local nodepool = nuts.pool
+local new_glyph = nodepool.glyph
+local new_glue = nodepool.glue
-local utfvalues = utf.values
+local utfvalues = utf.values
-local currentfont = font.current -- mabe nicer is fonts .current
-local currentattr = node.current_attr -- mabe nicer is attributes.current
-local fontparameters = fonts.hashes.parameters
+local currentfont = font.current -- mabe nicer is fonts .current
+local currentattributes = node.current_attributes -- mabe nicer is attributes.current
+
+local fontparameters = fonts.hashes.parameters
+
+if not currentattributes then currentattributes = node.current_attr end -- CONTEXTLMTXMODE == 0
-- when attrid == true then take from glyph or current else use the given value
@@ -51,7 +54,7 @@ local function tonodes(str,fontid,spacing,templateglyph,attrid) -- quick and dir
if templateglyph then
attrid = false -- we copy with the glyph
else
- attrid = currentattr()
+ attrid = currentattributes()
end
end
local fp = fontparameters[fontid]
diff --git a/tex/context/base/mkiv/spac-hor.mkxl b/tex/context/base/mkiv/spac-hor.mkxl
index c3bcccf93..e0fb9e407 100644
--- a/tex/context/base/mkiv/spac-hor.mkxl
+++ b/tex/context/base/mkiv/spac-hor.mkxl
@@ -652,8 +652,8 @@
\newskip\s_spac_neg_fill \s_spac_neg_fill = \zeropoint \s!plus-1\s!fill \relax
\newskip\s_spac_neg_filll \s_spac_neg_filll = \zeropoint \s!plus-1\s!filll\relax
-\unexpanded\def\hfilll {\hskip\s_spac_fill\relax}
-\unexpanded\def\vfilll {\vskip\s_spac_fill\relax}
+\unexpanded\def\hfilll {\hskip\s_spac_filll\relax}
+\unexpanded\def\vfilll {\vskip\s_spac_filll\relax}
\unexpanded\def\hfillneg {\hskip\s_spac_neg_fill \relax}
\unexpanded\def\hfilllneg{\hskip\s_spac_neg_filll\relax}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index fc2fa9524..2ddcb6e4b 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 864d7e5ac..ab31e3e72 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl
index 0c5ff3f76..85d578ff3 100644
--- a/tex/context/base/mkiv/syst-aux.mkxl
+++ b/tex/context/base/mkiv/syst-aux.mkxl
@@ -3316,6 +3316,16 @@
\ctxluamatch\matchloopcommand{#1}{#2}%
\popmacro\matchloopcommand}
+\def\doloopovermatched#1#2#3%
+ {\beginlocalcontrol
+ \pushmacro\matchloopcommand
+ \def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}%
+ \endlocalcontrol
+ \the\ctxluamatch\matchloopcommand{#1}{#2}%
+ \beginlocalcontrol
+ \popmacro\matchloopcommand
+ \endlocalcontrol}
+
%D \macros
%D {newevery,everyline,EveryLine,EveryPar}
%D
diff --git a/tex/context/base/mkiv/toks-ini.lmt b/tex/context/base/mkiv/toks-ini.lmt
new file mode 100644
index 000000000..cf1edd272
--- /dev/null
+++ b/tex/context/base/mkiv/toks-ini.lmt
@@ -0,0 +1,320 @@
+if not modules then modules = { } end modules ['toks-ini'] = {
+ version = 1.001,
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+tokens = tokens or { }
+
+local tokens = tokens
+local token = token -- the built in one
+local next = next
+local tonumber = tonumber
+local tostring = tostring
+local utfchar = utf.char
+local char = string.char
+local printtable = table.print
+local concat = table.concat
+local format = string.format
+
+local commands = token.getcommandvalues()
+local values = token.getfunctionvalues()
+values.dimen = values.dimension
+values.count = values.integer
+tokens.values = utilities.storage.allocate(table.swapped(values, values))
+tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
+
+local scan_toks = token.scan_toks
+local scan_string = token.scan_string
+local scan_argument = token.scan_argument
+local scan_delimited = token.scan_delimited
+local scan_tokenlist = token.scan_tokenlist or scan_string
+local scan_integer = token.scan_integer or token.scan_int
+local scan_cardinal = token.scan_cardinal
+local scan_code = token.scan_code
+local scan_token_code = token.scan_token_code
+local scan_dimen = token.scan_dimen
+local scan_glue = token.scan_glue
+local scan_skip = token.scan_skip
+local scan_keyword = token.scan_keyword
+local scan_keyword_cs = token.scan_keyword_cs or scan_keyword
+local scan_token = token.scan_token
+local scan_box = token.scan_box
+local scan_word = token.scan_word
+local scan_letters = token.scan_letters or scan_word -- lmtx
+local scan_key = token.scan_key
+local scan_value = token.scan_value
+local scan_char = token.scan_char
+local scan_number = token.scan_number -- not defined
+local scan_csname = token.scan_csname
+local scan_real = token.scan_real
+local scan_float = token.scan_float
+local scan_luanumber = token.scan_luanumber or scan_float -- only lmtx
+local scan_luainteger = token.scan_luainteger or scan_integer -- only lmtx
+local scan_luacardinal = token.scan_luacardinal or scan_cardinal -- only lmtx
+
+-- todo: gobble_integer -- might go away
+-- todo: gobble_dimension -- might go away
+
+local set_macro = token.set_macro
+local set_char = token.set_char
+local set_lua = token.set_lua
+
+local create_token = token.create
+local new_token = token.new
+local is_defined = token.is_defined
+local is_token = token.is_token
+
+tokens.new = new_token
+tokens.create = create_token
+tokens.istoken = is_token
+tokens.isdefined = is_defined
+tokens.defined = is_defined
+
+tokens.getdata = token.get_data -- only lmtx
+tokens.setdata = token.set_data -- only lmtx
+
+local bits = {
+ escape = 0x00000001, -- 2^00
+ begingroup = 0x00000002, -- 2^01
+ endgroup = 0x00000004, -- 2^02
+ mathshift = 0x00000008, -- 2^03
+ alignment = 0x00000010, -- 2^04
+ endofline = 0x00000020, -- 2^05
+ parameter = 0x00000040, -- 2^06
+ superscript = 0x00000080, -- 2^07
+ subscript = 0x00000100, -- 2^08
+ ignore = 0x00000200, -- 2^09
+ space = 0x00000400, -- 2^10 -- 1024
+ letter = 0x00000800, -- 2^11
+ other = 0x00001000, -- 2^12
+ active = 0x00002000, -- 2^13
+ comment = 0x00004000, -- 2^14
+ invalid = 0x00008000, -- 2^15
+ --
+ character = 0x00001800, -- 2^11 + 2^12
+ whitespace = 0x00002400, -- 2^13 + 2^10 -- / needs more checking
+ --
+ open = 0x00000402, -- 2^10 + 2^01 -- space + begingroup
+ close = 0x00000404, -- 2^10 + 2^02 -- space + endgroup
+}
+
+-- for k, v in next, bits do bits[v] = k end
+
+tokens.bits = bits
+
+-- words are space or \relax terminated and the trailing space is gobbled; a word
+-- can contain any non-space letter/other (see archive for implementation in lua)
+
+if not scan_number then
+
+ scan_number = function(base)
+ local s = scan_word()
+ if not s then
+ return nil
+ elseif base then
+ return tonumber(s,base)
+ else
+ return tonumber(s)
+ end
+ end
+
+end
+
+local function scan_boolean()
+ local kw = scan_word()
+ if kw == "true" then
+ return true
+ elseif kw == "false" then
+ return false
+ else
+ return nil
+ end
+end
+
+local function scan_verbatim()
+ return scan_argument(false)
+end
+
+if not scan_box then
+
+ local scan_list = token.scan_list
+ local put_next = token.put_next
+
+ scan_box = function(s)
+ if s == "hbox" or s == "vbox" or s == "vtop" then
+ put_next(create_token(s))
+ end
+ return scan_list()
+ end
+
+ token.scan_box = scan_box
+
+end
+
+tokens.scanners = { -- these expand
+ token = scan_token,
+ toks = scan_toks,
+ tokens = scan_toks,
+ box = scan_box,
+ hbox = function() return scan_box("hbox") end,
+ vbox = function() return scan_box("vbox") end,
+ vtop = function() return scan_box("vtop") end,
+ dimen = scan_dimen,
+ dimension = scan_dimen,
+ glue = scan_glue,
+ gluevalues = function() return scan_glue(false,false,true) end,
+ gluespec = scan_skip,
+ integer = scan_integer,
+ cardinal = scan_cardinal,
+ real = scan_real,
+ float = scan_float,
+ luanumber = scan_luanumber,
+ luainteger = scan_luainteger,
+ luacardinal = scan_luacardinal,
+ count = scan_integer,
+ string = scan_string,
+ argument = scan_argument,
+ delimited = scan_delimited,
+ tokenlist = scan_tokenlist,
+ verbatim = scan_verbatim, -- detokenize
+ code = scan_code,
+ tokencode = scan_token_code,
+ word = scan_word,
+ letters = scan_letters,
+ key = scan_key,
+ value = scan_value,
+ char = scan_char,
+ number = scan_number,
+ boolean = scan_boolean,
+ keyword = scan_keyword,
+ keywordcs = scan_keyword_cs,
+ csname = scan_csname,
+
+ next = token.scan_next,
+ nextexpanded = token.scan_next_expanded,
+
+ peek = token.peek_next,
+ peekexpanded = token.peek_next_expanded,
+ peekchar = token.peek_next_char,
+
+ skip = token.skip_next,
+ skipexpanded = token.skip_next_expanded,
+
+ cmdchr = token.scan_cmdchr,
+ cmdchrexpanded = token.scan_cmdchr_expanded,
+
+ ischar = token.is_next_char,
+}
+
+tokens.getters = { -- these don't expand
+ meaning = token.get_meaning,
+ macro = token.get_macro,
+ token = token.scan_next or token.get_next, -- not here, use scanners.next or token
+ cstoken = token.get_cstoken,
+ count = tex.getcount,
+ dimen = tex.getdimen,
+ skip = tex.getglue,
+ glue = tex.getglue,
+ skip = tex.getmuglue,
+ glue = tex.getmuglue,
+ box = tex.getbox,
+}
+
+tokens.setters = {
+ macro = set_macro,
+ char = set_char,
+ lua = set_lua,
+ count = tex.setcount,
+ dimen = tex.setdimen,
+ skip = tex.setglue,
+ glue = tex.setglue,
+ skip = tex.setmuglue,
+ glue = tex.setmuglue,
+ box = tex.setbox,
+}
+
+token.accessors = {
+ command = token.get_command,
+ cmd = token.get_command,
+ cmdname = token.get_cmdname,
+ name = token.get_cmdname,
+ csname = token.get_csname,
+ index = token.get_index,
+ active = token.get_active,
+ frozen = token.get_frozen,
+ protected = token.get_protected,
+ expandable = token.get_protected,
+ user = token.get_user,
+ cmdchrcs = token.get_cmdchrcs,
+ active = token.get_active,
+ range = token.get_range,
+}
+
+-- static int run_scan_token(lua_State * L)
+-- {
+-- saved_tex_scanner texstate;
+-- save_tex_scanner(texstate);
+-- get_x_token();
+-- make_new_token(L, cur_cmd, cur_chr, cur_cs);
+-- unsave_tex_scanner(texstate);
+-- return 1;
+-- }
+--
+-- static int run_get_future(lua_State * L)
+-- {
+-- /* saved_tex_scanner texstate; */
+-- /* save_tex_scanner(texstate); */
+-- get_token();
+-- make_new_token(L, cur_cmd, cur_chr, cur_cs);
+-- back_input();
+-- /* unsave_tex_scanner(texstate); */
+-- return 1;
+-- }
+
+if setinspector then
+
+ local simple = { letter = "letter", other_char = "other" }
+
+ local astable = function(t)
+ if t and is_token(t) then
+ local cmdname = t.cmdname
+ local simple = simple[cmdname]
+ if simple then
+ return {
+ id = t.id,
+ category = simple,
+ character = utfchar(t.index) or nil,
+ }
+ else
+ return {
+ id = t.id,
+ command = t.command,
+ index = t.index,
+ csname = t.csname,
+ cmdname = cmdname,
+ active = t.active,
+ expandable = t.expandable,
+ protected = t.protected,
+ frozen = t.frozen,
+ user = t.user,
+ }
+ end
+ end
+ end
+
+ tokens.astable = astable
+
+ setinspector("token",function(v) local t = astable(v) if t then printtable(t,tostring(v)) return true end end)
+
+end
+
+tokens.cache = table.setmetatableindex(function(t,k)
+ if not is_defined(k) then
+ set_macro(k,"","global")
+ end
+ local v = create_token(k)
+ t[k] = v
+ return v
+end)
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 3696364b9..7f3254dde 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -18,27 +18,9 @@ local printtable = table.print
local concat = table.concat
local format = string.format
-if token.values then
-
- local commands = token.values("command")
- local values = token.values("value")
- values.dimen = values.dimension
- values.count = values.integer
- tokens.values = utilities.storage.allocate(table.swapped(values, values))
- tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
-
-elseif token.commands then
-
- local commands = token.commands()
- tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
- tokens.values = { }
-
-else
-
- tokens.commands = { }
- tokens.values = { }
-
-end
+local commands = token.commands()
+tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
+tokens.values = { }
local scan_toks = token.scan_toks
local scan_string = token.scan_string
@@ -289,65 +271,34 @@ if setinspector then
local simple = { letter = "letter", other_char = "other" }
- local astable = CONTEXTLMTXMODE == 0 and
-
- function(t)
- if t and is_token(t) then
- local cmdname = t.cmdname
- local simple = simple[cmdname]
- if simple then
- return {
- id = t.id,
- category = simple,
- character = utfchar(t.mode) or nil,
- }
- else
- return {
- command = t.command,
- id = t.id,
- tok = t.tok,
- csname = t.csname,
- active = t.active,
- expandable = t.expandable,
- protected = t.protected,
- frozen = t.frozen,
- mode = t.mode,
- index = t.index,
- user = t.user,
- cmdname = cmdname,
- }
- end
- end
- end
-
- or
-
- function(t)
- if t and is_token(t) then
- local cmdname = t.cmdname
- local simple = simple[cmdname]
- if simple then
- return {
- id = t.id,
- category = simple,
- character = utfchar(t.index) or nil,
- }
- else
- return {
- id = t.id,
- command = t.command,
- index = t.index,
- csname = t.csname,
- cmdname = cmdname,
- active = t.active,
- expandable = t.expandable,
- protected = t.protected,
- frozen = t.frozen,
- user = t.user,
- }
- end
+ local astable = function(t)
+ if t and is_token(t) then
+ local cmdname = t.cmdname
+ local simple = simple[cmdname]
+ if simple then
+ return {
+ id = t.id,
+ category = simple,
+ character = utfchar(t.mode) or nil,
+ }
+ else
+ return {
+ command = t.command,
+ id = t.id,
+ tok = t.tok,
+ csname = t.csname,
+ active = t.active,
+ expandable = t.expandable,
+ protected = t.protected,
+ frozen = t.frozen,
+ mode = t.mode,
+ index = t.index,
+ user = t.user,
+ cmdname = cmdname,
+ }
end
end
+ end
tokens.astable = astable
@@ -364,7 +315,7 @@ tokens.cache = table.setmetatableindex(function(t,k)
return v
end)
-if LUATEXVERSION < 114 and CONTEXTLMTXMODE == 0 then
+if LUATEXVERSION < 114 then
local d = tokens.defined
local c = tokens.create
diff --git a/tex/context/base/mkiv/toks-ini.mkiv b/tex/context/base/mkiv/toks-ini.mkiv
index af22d5393..c7d7bceb3 100644
--- a/tex/context/base/mkiv/toks-ini.mkiv
+++ b/tex/context/base/mkiv/toks-ini.mkiv
@@ -15,6 +15,6 @@
\unprotect
-\registerctxluafile{toks-ini}{}
+\registerctxluafile{toks-ini}{autosuffix}
\protect \endinput
diff --git a/tex/context/base/mkiv/trac-deb.lmt b/tex/context/base/mkiv/trac-deb.lmt
index 381fce073..7a2eba2a0 100644
--- a/tex/context/base/mkiv/trac-deb.lmt
+++ b/tex/context/base/mkiv/trac-deb.lmt
@@ -327,7 +327,7 @@ function tracers.printerror(specification)
report_nl()
else
report_nl()
- -- tex.show_context()
+ -- tex.showcontext()
end
if lastluaerror and not match(lastluaerror,"^%s*[%?]*%s*$") then
print("\nlua error:\n\n",lastluaerror,"\n")
diff --git a/tex/context/base/mkiv/trac-inf.lmt b/tex/context/base/mkiv/trac-inf.lmt
index de1f50051..7cb168760 100644
--- a/tex/context/base/mkiv/trac-inf.lmt
+++ b/tex/context/base/mkiv/trac-inf.lmt
@@ -181,7 +181,7 @@ function statistics.show()
local t = status.gethashstate()
local m = status.gettexstate()
return format("%s of %s with base %s, approximate memory usage: %i MB",
- t.cnt, t.max, status.tex_hash_size, m.approximate // (1024 * 1024))
+ t.top, t.max, status.tex_hash_size, m.approximate // (1024 * 1024))
end)
register("callbacks", statistics.callbacks)
-- so far
@@ -279,6 +279,8 @@ function statistics.showusage(when)
--
local iocode = status.iocodes[rstatus.iocode]
--
+ local mpinstances, mpmemory = metapost.getstatistics(true)
+ --
report("")
if when == "finish" then
report("status after finishing run")
@@ -342,6 +344,8 @@ function statistics.showusage(when)
report(" message callbacks : %s", c.message)
report(" bytecode callbacks : %s", c.bytecode)
report("")
+ report(" mp instances : %s", mpinstances)
+ report(" mp estimated memory : %s (%s MB)", mpmemory, mpmemory // 1048576)
report(" mp file callbacks : %s", m.file)
report(" mp text callbacks : %s", m.text)
report(" mp script callbacks : %s", m.script)
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 751624e93..df4f3593c 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2020-08-28 13:55
+-- merge date : 2020-08-31 22:01
do -- begin closure to overcome local limits and interference