summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2008-04-15 22:29:00 +0200
committerHans Hagen <pragma@wxs.nl>2008-04-15 22:29:00 +0200
commitfda067d65d105a9c168c6d1428ac2f2ae053ed21 (patch)
treeb86097a41bb2dd9d96787eccc61ce49faba05bef
parent84c5ae8992fff7184ebc669a1eb654a92d55951c (diff)
downloadcontext-fda067d65d105a9c168c6d1428ac2f2ae053ed21.tar.gz
stable 2008.04.15 22:29
-rw-r--r--scripts/context/lua/luatools.lua95
-rw-r--r--scripts/context/ruby/ctxtools.rb2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-bar.tex17
-rw-r--r--tex/context/base/core-box.tex14
-rw-r--r--tex/context/base/core-buf.lua2
-rw-r--r--tex/context/base/core-ctx.tex2
-rw-r--r--tex/context/base/core-fnt.tex11
-rw-r--r--tex/context/base/core-grd.tex6
-rw-r--r--tex/context/base/core-inc.lua2
-rw-r--r--tex/context/base/core-itm.tex274
-rw-r--r--tex/context/base/core-job.tex24
-rw-r--r--tex/context/base/core-lnt.tex2
-rw-r--r--tex/context/base/core-not.tex20
-rw-r--r--tex/context/base/core-pgr.tex85
-rw-r--r--tex/context/base/core-reg.lua68
-rw-r--r--tex/context/base/core-spa.mkiv6
-rw-r--r--tex/context/base/core-spa.tex38
-rw-r--r--tex/context/base/core-tbl.tex98
-rw-r--r--tex/context/base/core-ver.tex2
-rw-r--r--tex/context/base/font-fbk.lua17
-rw-r--r--tex/context/base/font-otf.lua4
-rw-r--r--tex/context/base/font-syn.lua69
-rw-r--r--tex/context/base/font-tfm.lua5
-rw-r--r--tex/context/base/l-file.lua2
-rw-r--r--tex/context/base/l-tex.lua52
-rw-r--r--tex/context/base/l-utils.lua6
-rw-r--r--tex/context/base/lang-url.tex6
-rw-r--r--tex/context/base/luat-tex.lua69
-rw-r--r--tex/context/base/m-chemic.tex18
-rw-r--r--tex/context/base/m-steps.tex4
-rw-r--r--tex/context/base/math-ini.lua5
-rw-r--r--tex/context/base/meta-ini.mkiv2
-rw-r--r--tex/context/base/meta-pag.tex22
-rw-r--r--tex/context/base/meta-tex.mkii14
-rw-r--r--tex/context/base/mlib-pdf.lua148
-rw-r--r--tex/context/base/mlib-pps.lua18
-rw-r--r--tex/context/base/mlib-run.lua43
-rw-r--r--tex/context/base/page-lyr.tex22
-rw-r--r--tex/context/base/page-mar.tex10
-rw-r--r--tex/context/base/page-str.tex4
-rw-r--r--tex/context/base/spec-dpx.tex30
-rw-r--r--tex/context/base/spec-fdf.tex42
-rw-r--r--tex/context/base/spec-tpd.tex39
-rw-r--r--tex/context/base/supp-fil.tex130
-rw-r--r--tex/context/base/type-cow.tex2
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
54 files changed, 730 insertions, 839 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index b38d0c4c1..a810b16d6 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -27,7 +27,6 @@ texlua = true
-- when (windows) suffix binding is active.
-- begin library merge
-
-- filename : l-string.lua
-- comment : split off from luat-lib
-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
@@ -162,7 +161,7 @@ end
--~ split = lpeg.Ct(c*(p*c)^0)
--~ splitters[separator] = split
--~ end
---~ return lpeg.match(split,self) -- split:match(self)
+--~ return split:match(self)
--~ else
--~ return { }
--~ end
@@ -415,6 +414,8 @@ if not versions then versions = { } end versions['l-lpeg'] = 1.001
--~ lpeg.whitespace = lpeg.S(' \r\n\f\t')^1
--~ lpeg.nonwhitespace = lpeg.P(1-lpeg.whitespace)^1
+local hash = { }
+
function lpeg.anywhere(pattern) --slightly adapted from website
return lpeg.P { lpeg.P(pattern) + 1 * lpeg.V(1) }
end
@@ -430,6 +431,20 @@ function lpeg.splitter(pattern, action)
end
+local crlf = lpeg.P("\r\n")
+local cr = lpeg.P("\r")
+local lf = lpeg.P("\n")
+local space = lpeg.S(" \t\f\v")
+local newline = crlf + cr + lf
+local spacing = space^0 * newline
+local content = lpeg.Cs((1-spacing)^1) * spacing^-1 * (spacing * lpeg.Cc(""))^0
+
+local capture = lpeg.Ct(content^0)
+
+function string:splitlines()
+ return capture:match(self)
+end
+
-- filename : l-table.lua
-- comment : split off from luat-lib
@@ -503,15 +518,6 @@ function table.prepend(t, list)
end
end
---~ function table.merge(t, ...)
---~ for _, list in ipairs({...}) do
---~ for k,v in pairs(list) do
---~ t[k] = v
---~ end
---~ end
---~ return t
---~ end
-
function table.merge(t, ...) -- first one is target
t = t or {}
local lst = {...}
@@ -523,16 +529,6 @@ function table.merge(t, ...) -- first one is target
return t
end
---~ function table.merged(...)
---~ local tmp = { }
---~ for _, list in ipairs({...}) do
---~ for k,v in pairs(list) do
---~ tmp[k] = v
---~ end
---~ end
---~ return tmp
---~ end
-
function table.merged(...)
local tmp, lst = { }, {...}
for i=1,#lst do
@@ -543,15 +539,6 @@ function table.merged(...)
return tmp
end
---~ function table.imerge(t, ...)
---~ for _, list in ipairs({...}) do
---~ for _, v in ipairs(list) do
---~ t[#t+1] = v
---~ end
---~ end
---~ return t
---~ end
-
function table.imerge(t, ...)
local lst = {...}
for i=1,#lst do
@@ -563,16 +550,6 @@ function table.imerge(t, ...)
return t
end
---~ function table.imerged(...)
---~ local tmp = { }
---~ for _, list in ipairs({...}) do
---~ for _,v in pairs(list) do
---~ tmp[#tmp+1] = v
---~ end
---~ end
---~ return tmp
---~ end
-
function table.imerged(...)
local tmp, lst = { }, {...}
for i=1,#lst do
@@ -720,7 +697,6 @@ do
end
if n == #t then
local tt = { }
- -- for _,v in ipairs(t) do
for i=1,#t do
local v = t[i]
local tv = type(v)
@@ -775,7 +751,7 @@ do
local inline = compact and table.serialize_inline
local first, last = nil, 0 -- #root cannot be trusted here
if compact then
- for k,v in ipairs(root) do -- NOT: for k=1,#root do
+ for k,v in ipairs(root) do -- NOT: for k=1,#root do (why)
if not first then first = k end
last = last + 1
end
@@ -957,7 +933,8 @@ end
do
local function flatten(t,f,complete)
- for _,v in ipairs(t) do
+ for i=1,#t do
+ local v = t[i]
if type(v) == "table" then
if complete or type(v[1]) == "table" then
flatten(v,f,complete)
@@ -1403,7 +1380,7 @@ do
local one = lpeg.C(1-lpeg.S(''))^1
function number.toset(n)
- return lpeg.match(one,tostring(n))
+ return one:match(tostring(n))
end
end
@@ -2460,7 +2437,7 @@ function utils.merger._self_swap_(data,code)
end
function utils.merger._self_libs_(libs,list)
- local result, f = "", nil
+ local result, f = { }, nil
if type(libs) == 'string' then libs = { libs } end
if type(list) == 'string' then list = { list } end
for _, lib in ipairs(libs) do
@@ -2469,7 +2446,7 @@ function utils.merger._self_libs_(libs,list)
f = io.open(name)
if f then
-- utils.report("merging library",name)
- result = result .. "\n" .. f:read("*all") .. "\n"
+ result[#result+1] = f:read("*all")
f:close()
list = { pth } -- speed up the search
break
@@ -2478,7 +2455,7 @@ function utils.merger._self_libs_(libs,list)
end
end
end
- return result or ""
+ return table.concat(result, "\n\n")
end
function utils.merger.selfcreate(libs,list,target)
@@ -3924,6 +3901,8 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+-- get rid of piecewise here, just a gmatch is ok
+
function input.aux.splitpathexpr(str, t, validate)
-- no need for optimization, only called a few times, we can use lpeg for the sub
t = t or { }
@@ -3931,7 +3910,7 @@ function input.aux.splitpathexpr(str, t, validate)
while true do
local done = false
while true do
- ok = false
+ local ok = false
str = str:gsub("([^{},]+){([^{}]-)}", function(a,b)
local t = { }
b:piecewise(",", function(s) t[#t+1] = a .. s end)
@@ -3941,7 +3920,7 @@ function input.aux.splitpathexpr(str, t, validate)
if not ok then break end
end
while true do
- ok = false
+ local ok = false
str = str:gsub("{([^{}]-)}([^{},]+)", function(a,b)
local t = { }
a:piecewise(",", function(s) t[#t+1] = s .. b end)
@@ -3951,7 +3930,7 @@ function input.aux.splitpathexpr(str, t, validate)
if not ok then break end
end
while true do
- ok = false
+ local ok = false
str = str:gsub("([,{]){([^{}]+)}([,}])", function(a,b,c)
ok, done = true, true
return a .. b .. c
@@ -3961,7 +3940,7 @@ function input.aux.splitpathexpr(str, t, validate)
if not done then break end
end
while true do
- ok = false
+ local ok = false
str = str:gsub("{([^{}]-)}{([^{}]-)}", function(a,b)
local t = { }
a:piecewise(",", function(sa)
@@ -3975,7 +3954,7 @@ function input.aux.splitpathexpr(str, t, validate)
if not ok then break end
end
while true do
- ok = false
+ local ok = false
str = str:gsub("{([^{}]-)}", function(a)
ok = true
return a
@@ -4844,7 +4823,7 @@ do
resolvers.file = resolvers.filename
resolvers.path = resolvers.pathname
- function resolve(instance,str)
+ local function resolve(instance,str)
if type(str) == "table" then
for k, v in pairs(str) do
str[k] = resolve(instance,v) or v
@@ -5773,7 +5752,7 @@ if texconfig and not texlua then do
ws("fonts load time - %s seconds", input.loadtime(fonts))
end
if xml then
- ws("xml load time - %s seconds", input.loadtime(lxml))
+ ws("xml load time - %s seconds (backreferences: %i, outer filtering time: %s)", input.loadtime(xml), #lxml.self, input.loadtime(lxml))
end
if mptopdf then
ws("mps conversion time - %s seconds", input.loadtime(mptopdf))
@@ -5811,6 +5790,10 @@ if texconfig and not texlua then do
if fonts then
ws("loaded fonts - %s", fonts.logger.report()) -- last because it is often a long list
end
+ if xml then -- so we are in mkiv, we need a different check
+ -- todo: \nofshipouts
+ ws("shipped out pages - %i (of %i processed pages)", tex.count['nofshipouts'], tex.count['realpageno']-1) -- last because we want to see this
+ end
end
end end
@@ -6155,7 +6138,6 @@ input.formats['texmfscripts'] = 'TEXMFSCRIPTS'
input.formats['bitmap font'] = ''
input.formats['lig files'] = 'LIGFONTS'
-
-- end library merge
-- We initialize some characteristics of this program. We need to
@@ -6243,8 +6225,7 @@ utils.report = input.report
input.defaultlibs = { -- not all are needed
'l-string.lua', 'l-lpeg.lua', 'l-table.lua', 'l-boolean.lua', 'l-number.lua', 'l-set.lua', 'l-unicode.lua',
'l-md5.lua', 'l-os.lua', 'l-io.lua', 'l-file.lua', 'l-url.lua', 'l-dir.lua', 'l-utils.lua', 'l-tex.lua',
-'luat-env.lua',
- 'luat-lib.lua', 'luat-inp.lua', 'luat-tmp.lua', 'luat-zip.lua', 'luat-tex.lua'
+ 'luat-env.lua', 'luat-lib.lua', 'luat-inp.lua', 'luat-tmp.lua', 'luat-zip.lua', 'luat-tex.lua'
}
-- todo: use environment.argument() instead of environment.arguments[]
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index de64679ac..00d2b494b 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -2277,7 +2277,7 @@ class TexDeps
report('')
n = 0
@files.each do |filename|
- if f = File.open(filename) then
+ if File.file?(filename) and f = File.open(filename) then
defs, uses, l = 0, 0, 0
n += 1
report("#{n.to_s.rjust(5,' ')} #{filename}")
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 070b6e214..4304bfc8b 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2008.04.11 00:07}
+\newcontextversion{2008.04.15 22:29}
%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/context.tex b/tex/context/base/context.tex
index 324c874e2..0bbda991d 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -42,7 +42,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2008.04.11 00:07}
+\edef\contextversion{2008.04.15 22:29}
%D For those who want to use this:
diff --git a/tex/context/base/core-bar.tex b/tex/context/base/core-bar.tex
index eeb3de630..9b7acf17f 100644
--- a/tex/context/base/core-bar.tex
+++ b/tex/context/base/core-bar.tex
@@ -53,8 +53,8 @@
%D \stopsidebar
%D \stoptyping
-\newcounter\currentsidebar
-\newdimen \sidebardistance
+\newcount\currentsidebar
+\newdimen\sidebardistance
\def\setupsidebars
{\dodoubleargument\dosetupsidebars}
@@ -94,7 +94,7 @@
{\bgroup
\dontleavehmode
\checktextbackgrounds
- \doglobal\increment\currentsidebar
+ \global\advance\currentsidebar\plusone
\doifelsenothing{#1}
{\advance\sidebardistance\@@brdistance}
{\doifelsevaluenothing{\??br#1\c!distance}
@@ -102,22 +102,21 @@
{\sidebardistance\getvalue{\??br#1\c!distance}}}%
\startpositionoverlay{text-1}%
\expanded{\setMPpositiongraphicrange
- {b:side:\currentsidebar}%
- {e:side:\currentsidebar}%
+ {b:side:\the\currentsidebar}%
+ {e:side:\the\currentsidebar}%
{mpos:bar}%
- {self=side:\currentsidebar,
+ {self=side:\the\currentsidebar,
linewidth=\getvalue{\??br#1\c!rulethickness},
linecolor=\getvalue{\??br#1\c!rulecolor},
distance=\the\sidebardistance}}%
\stoppositionoverlay
-% \edef\stopsidebar{\noexpand\dostopsidebar{\currentsidebar}}%
- \bpos{side:\currentsidebar}\ignorespaces}
+ \bpos{side:\the\currentsidebar}\ignorespaces}
% \def\dostopsidebar#1%
% {\removelastspace\tpos{side:#1}\carryoverpar\egroup}
\def\stopsidebar
- {\removelastspace\tpos{side:\currentsidebar}\carryoverpar\egroup}
+ {\removelastspace\tpos{side:\the\currentsidebar}\carryoverpar\egroup}
\startMPpositionmethod{mpos:bar}
\startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}%
diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex
index e3e2d6330..dd84fbc1a 100644
--- a/tex/context/base/core-box.tex
+++ b/tex/context/base/core-box.tex
@@ -430,7 +430,7 @@
% pas op: aanpassen aan nieuwe layer hoek ankers en columnset
-\newcounter\nofbleeds % per pag
+\newcount\nofbleeds % per pag
\def\setupbleeding
{\dodoubleempty\getparameters[\??bg]}
@@ -456,7 +456,7 @@
{\hbox\bgroup
\xdef\bleedwidth {\the\hsize}%
\xdef\bleedheight{\the\vsize}%
- \doglobal\increment\nofbleeds
+ \global\advance\nofbleeds\plusone
\getparameters[\??bg][#1]%
\!!doneafalse % left
\!!donebfalse % right
@@ -481,10 +481,10 @@
\scratchdimen\@@bgwidth
\ifdone
\if!!donea
- \advance\scratchdimen\MPx{\??bg:\nofbleeds}%
+ \advance\scratchdimen\MPx{\??bg:\number\nofbleeds}%
\else\if!!doneb
\scratchdimen\paperwidth
- \advance\scratchdimen-\MPx{\??bg:\nofbleeds}%
+ \advance\scratchdimen-\MPx{\??bg:\number\nofbleeds}%
\fi\fi
\fi
\advance\scratchdimen\@@bghoffset
@@ -493,9 +493,9 @@
\ifdone
\if!!donec
\scratchdimen\paperheight
- \advance\scratchdimen-\MPy{\??bg:\nofbleeds}%
+ \advance\scratchdimen-\MPy{\??bg:\number\nofbleeds}%
\else\if!!doned
- \advance\scratchdimen\MPy{\??bg:\nofbleeds}%
+ \advance\scratchdimen\MPy{\??bg:\number\nofbleeds}%
\fi\fi
\fi
\advance\scratchdimen\@@bgvoffset
@@ -515,7 +515,7 @@
\ht\scratchbox\@@bgheight
\dp\scratchbox\zeropoint
\ifdone
- \hpos{\??bg:\nofbleeds}{\box\scratchbox}%
+ \hpos{\??bg:\number\nofbleeds}{\box\scratchbox}%
\else
\box\scratchbox
\fi
diff --git a/tex/context/base/core-buf.lua b/tex/context/base/core-buf.lua
index 33ca8ebbf..b1e956603 100644
--- a/tex/context/base/core-buf.lua
+++ b/tex/context/base/core-buf.lua
@@ -145,7 +145,7 @@ function buffers.save(name)
name = tex.jobname
end
local b, f = buffers.data[name], tex.jobname .. "-" .. name .. ".tmp"
- b = (b and type(b) == "table" and table.join(b)) or b or ""
+ b = (b and type(b) == "table" and table.join(b,"\n")) or b or ""
io.savedata(f,b)
end
diff --git a/tex/context/base/core-ctx.tex b/tex/context/base/core-ctx.tex
index 18db42d93..22f2ded4a 100644
--- a/tex/context/base/core-ctx.tex
+++ b/tex/context/base/core-ctx.tex
@@ -167,7 +167,7 @@
\iftracefiles\writestatus\m!systems{#1 located}\fi
\def\next{#2\dodoreadfile}}%
{\iftracefiles\writestatus\m!systems{cannot locate #1}\fi
- \decrement\readlevel\relax
+ \advance\readlevel\minusone
\ifnum\readlevel>\zerocount
\edef\readfilename{\pathplusfile{\f!parentpath}{\readfilename}}%
\def\next{\redoreadfile\readfilename{#2}{#3}}%
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
index 920f1288b..15f9f0e5c 100644
--- a/tex/context/base/core-fnt.tex
+++ b/tex/context/base/core-fnt.tex
@@ -445,7 +445,7 @@
%D or whatever. Because \type{\overstrike} uses the same
%D method, the settings also apply to that macro.
-\newcounter\underbarlevel
+\newcount\underbarlevel
\def\underbarmethoda#1#2#3% RULE
{\hbox to #1{\vrule\!!width#1\!!height#2\!!depth#3}}
@@ -481,7 +481,6 @@
\dimen0=\@@onbottomoffset
\dimen0=\underbarlevel\dimen0
\ifdone \else
- %\advance\dimen0 -1pt
\advance\dimen0 -\strutht
\fi
\dimen2\dimen0
@@ -507,7 +506,7 @@
\unexpanded\def\underbar
{\bgroup
- \increment\underbarlevel
+ \advance\underbarlevel\plusone
\donetrue
\dounderbar\betweenunderbarwords}
@@ -522,19 +521,19 @@
\unexpanded\def\underbars
{\bgroup
- \increment\underbarlevel
+ \advance\underbarlevel\plusone
\donetrue
\dounderbar\betweenunderbarspaces}
\unexpanded\def\overbar
{\bgroup
- \decrement\underbarlevel
+ \advance\underbarlevel\minusone
\donefalse
\dounderbar\betweenunderbarwords}
\unexpanded\def\overbars
{\bgroup
- \decrement\underbarlevel
+ \advance\underbarlevel\minusone
\donefalse
\dounderbar\betweenunderbarspaces}
diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex
index 575ec4c2d..5db966455 100644
--- a/tex/context/base/core-grd.tex
+++ b/tex/context/base/core-grd.tex
@@ -304,12 +304,14 @@
\let\presnapskip \!!zeropoint \def\presnap {-}
\let\postsnapskip\!!zeropoint \let\postsnap\presnap
+\newcount\currentgridsnap
+
\def\tracedsnapping
{\iftracegridsnapping
\llap
{\startlayoutcomponent{gridsnaps}{grid snaps}%
\infofont
- \doglobal\increment\currentsnap
+ \global\advance\currentgridsnap\plusone
\color[grid:three]{\vl\presnapskip
\vl\presnap
\vl\postsnap
@@ -320,7 +322,7 @@
\extrasnapsign\extrasnapsign\or
0\extrasnapsign\fi
\fi
- \vl\currentsnap\vl}%
+ \vl\the\currentgridsnap\vl}%
\stoplayoutcomponent}%
\fi}
diff --git a/tex/context/base/core-inc.lua b/tex/context/base/core-inc.lua
index e81b28abd..94b9ff329 100644
--- a/tex/context/base/core-inc.lua
+++ b/tex/context/base/core-inc.lua
@@ -430,7 +430,7 @@ do
-- type given
for _, path in ipairs(figures.paths) do
local check = path .. "/" .. askedname
- if figures.exists(askedname,askedformat) then
+ if figures.exists(check,askedformat) then
return register(check, {
askedname = askedname,
fullname = check,
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index 97b102e4e..336d8a1e0 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -73,19 +73,20 @@
\newconditional\continuelistitems \setfalse\continuelistitems
\newconditional\fittinglistitems \setfalse\fittinglistitems
-\newcounter\noflists
-\newcounter\itemlevel
-\newcounter\itemcolumndepth
-\newcounter\maxitemlevel
+\newcount\noflists
+\newcount\itemcolumndepth
+\newcount\itemdepth
+\newcount\maxitemdepth
\definetwopasslist\s!list
+\let\currentitemlevel \!!zerocount
\let\currentitemgroup \empty
\let\currentnofitems \!!zerocount
\let\currentmaxnofitems\!!zerocount
\let\currentminnofitems\!!zerocount
\let\currentitemoffset \!!zerocount
-\def\currentitemnumber{\countervalue{\@@itemcounter\itemlevel}}
+\def\currentitemnumber{\countervalue{\@@itemcounter\currentitemlevel}}
% tricky ... we cannot use trialtypesetting here because there can be
% multiple itemizes in e.g. a table, so we need something more advanced
@@ -93,9 +94,11 @@
\def\dolistreference
{\ifconditional\continuelistitems
- \savetaggedtwopassdata\s!list\currentlist\currentlist{\itemlevel:\noflistelements:c:\getitemparameter\itemlevel\c!maxwidth}%
+ \savetaggedtwopassdata\s!list{\number\noflists}{\number\noflists}%
+ {\currentitemlevel:\noflistelements:c:\getitemparameter\currentitemlevel\c!maxwidth}%
\else
- \savetaggedtwopassdata\s!list\currentlist\currentlist{\itemlevel:\noflistelements:n:\getitemparameter\itemlevel\c!maxwidth}%
+ \savetaggedtwopassdata\s!list{\number\noflists}{\number\noflists}%
+ {\currentitemlevel:\noflistelements:n:\getitemparameter\currentitemlevel\c!maxwidth}%
\fi}
\def\splititemtwopassdata#1%
@@ -119,7 +122,7 @@
\doloop
{\splititemtwopassdata{\numexpr\noflists+\recurselevel\relax}%
\iftwopassdatafound
- \ifnum\itemdatal=\itemlevel\relax
+ \ifnum\itemdatal=\currentitemlevel\relax
\doifelse{c}\itemdatat
{\advance\scratchcounter\itemdatan\relax}
{\exitloop}%
@@ -133,7 +136,7 @@
{\doloop
{\splititemtwopassdata{\numexpr\noflists-\recurselevel\relax}%
\iftwopassdatafound
- \ifnum\itemdatal=\itemlevel\relax
+ \ifnum\itemdatal=\currentitemlevel\relax
\doifelse{c}\itemdatat
{\advance\scratchcounter\itemdatan\relax}
{\advance\scratchcounter\itemdatan\exitloop}%
@@ -230,13 +233,13 @@
\def\dosetupitemgroups[#1]% still undocumented
{\getparameters[\??oo][\c!levels=4,#1]%
% will change (remove)
- \ifnum\@@oolevels>\maxitemlevel
- \edef\maxitemlevel{\@@oolevels}%
- \dorecurse\maxitemlevel{\initializeitemgroupslevel\recurselevel}%
+ \ifnum\@@oolevels>\maxitemdepth
+ \maxitemdepth\@@oolevels\relax
+ \dorecurse\maxitemdepth{\initializeitemgroupslevel\recurselevel}%
\fi}
\def\doitemreference#1,#2,#3\\%
- {\ifnum\itemlevel>#1\relax
+ {\ifnum\currentitemlevel>#1\relax
\ifnum#1>\zerocount \tempsymbol \fi
\getvalue{\@@currentitemsymbol{#2}}%
\doitemreference#2,#3\\%
@@ -246,17 +249,17 @@
{\expandafter\doitemreference\itemreferences,,\\}
\def\packitems
- {\ifcase\itemlevel \else \settrue\packlistitem \fi}
+ {\ifcase\currentitemlevel \else \settrue\packlistitem \fi}
\def\dosetupitemgroupvariable[#1]% [#2]% niveau instellingen
{\doifelsenothing{#1}
- {\getparameters[\??op\currentitemgroup\itemlevel]}% [#2]}%
+ {\getparameters[\??op\currentitemgroup\currentitemlevel]}% [#2]}%
{\getparameters[\??op\currentitemgroup#1]}}% [#2]}}
\newconditional\inlinelistitem \setfalse\inlinelistitem
\def\dododosetupitemgroupconstant[#1][#2#3#4]% * permits [2]
- {\global\setitemparameter\itemlevel\c!maxwidth{0}%
+ {\global\setitemparameter\currentitemlevel\c!maxwidth{0}%
\processaction
[#2#3#4]
[ \v!packed*=>\packitems,
@@ -320,27 +323,27 @@
\def\itembeforecommand
{\ifconditional\nowhitelistitem
\ifconditional\beforelistitem
- \ifcase\itemlevel\or\getitemparameter\itemlevel\c!before\fi
+ \ifcase\currentitemlevel\or\getitemparameter\currentitemlevel\c!before\fi
\else
\nowhitespace
\fi
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!before
+ \getitemparameter\currentitemlevel\c!before
\fi\fi}
\def\itemaftercommand
{\ifconditional\nowhitelistitem
\ifconditional\afterlistitem
- \ifcase\itemlevel\or\getitemparameter\itemlevel\c!after\fi
+ \ifcase\currentitemlevel\or\getitemparameter\currentitemlevel\c!after\fi
\else
\nowhitespace
\fi
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!after
+ \getitemparameter\currentitemlevel\c!after
\fi\fi}
\def\iteminbetweencommand
@@ -349,7 +352,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!inbetween
+ \getitemparameter\currentitemlevel\c!inbetween
\fi\fi}
\def\itembeforeheadcommand
@@ -358,7 +361,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!beforehead
+ \getitemparameter\currentitemlevel\c!beforehead
\fi\fi}
\def\itemafterheadcommand
@@ -367,7 +370,7 @@
\else\ifconditional\joinedlistitem
% \empty
\else
- \getitemparameter\itemlevel\c!afterhead
+ \getitemparameter\currentitemlevel\c!afterhead
\fi\fi}
% \def\dosetuppackeditemgroup#1%
@@ -390,18 +393,18 @@
\def\dodododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifnot{#2}{}
{\doifelse{#1}\v!each
- {\dorecurse\maxitemlevel{\ExpandFirstAfter\dododododosetupitemgroup[\recurselevel][#2]}}
+ {\dorecurse\maxitemdepth{\ExpandFirstAfter\dododododosetupitemgroup[\recurselevel][#2]}}
{\ExpandFirstAfter\dododododosetupitemgroup[#1][#2]}}}
\def\dododosetupitemgroup[#1][#2]%
{\ConvertToConstant\doifelse{#2}{}
- {\ifcase\itemlevel\relax
+ {\ifcase\currentitemlevel\relax
\dodododosetupitemgroup[\v!each][#1]%
\else
- \dodododosetupitemgroup[\itemlevel][#1]%
+ \dodododosetupitemgroup[\currentitemlevel][#1]%
\fi}
{\doifelsenothing{#1}
- {\dodododosetupitemgroup[\itemlevel][#2]}
+ {\dodododosetupitemgroup[\currentitemlevel][#2]}
{\dodododosetupitemgroup[#1][#2]}}}
\def\dodosetupitemgroup[#1][#2][#3][#4]%
@@ -421,41 +424,25 @@
\def\doadvanceitem
{\ifconditional\sublistitem\else\ifconditional\symbollistitem\else
- \pluscounter{\@@itemcounter\itemlevel}%
+ \pluscounter{\@@itemcounter\currentitemlevel}%
\fi\fi}
-% \def\setitemlevel#1%
-% {\ifnum\itemlevel>\zerocount
-% \settrue\firstlistitem
-% \doifnotinset\v!continue{#1}
-% {\doifinset{0}{#1}{\setitemparameter\itemlevel\c!start{0}}%
-% \doifsomething{\getitemparameter\itemlevel\c!start}
-% {\setcounter{\@@itemcounter\itemlevel}{\getitemparameter\itemlevel\c!start}%
-% \minuscounter{\@@itemcounter\itemlevel}%
-% \letitemparameter\itemlevel\c!start\empty}}%
-% \def\tempnumber
-% {\countervalue{\@@itemcounter\itemlevel}}%
-% \doifelse{\getitemparameter\itemlevel\c!placestopper}\v!yes
-% {\def\tempsymbol{\getitemparameter\itemlevel\c!stopper}}
-% {\let\tempsymbol\empty}%
-% \fi}
-
\def\setitemlevel#1%
- {\ifnum\itemlevel>\zerocount
+ {\ifnum\currentitemlevel>\zerocount
\settrue\firstlistitem
%
- \expanded{\setitemparameter{\itemlevel}{\c!start}{1}}%
- \doifinset{0}{#1}{\setitemparameter\itemlevel\c!start{0}}%
- \setcounter{\@@itemcounter\itemlevel}{0}%
- \doifelsenothing{\getitemparameter\itemlevel\c!start}
+ \expanded{\setitemparameter{\currentitemlevel}{\c!start}{1}}%
+ \doifinset{0}{#1}{\setitemparameter\currentitemlevel\c!start{0}}%
+ \setcounter{\@@itemcounter\currentitemlevel}{0}%
+ \doifelsenothing{\getitemparameter\currentitemlevel\c!start}
{\def\currentitemoffset{1}}
- {\def\currentitemoffset{\getitemparameter\itemlevel\c!start}%
- \letitemparameter\itemlevel\c!start\empty}%
+ {\def\currentitemoffset{\getitemparameter\currentitemlevel\c!start}%
+ \letitemparameter\currentitemlevel\c!start\empty}%
%
\def\tempnumber
- {\countervalue{\@@itemcounter\itemlevel}}%
- \doifelse{\getitemparameter\itemlevel\c!placestopper}\v!yes
- {\def\tempsymbol{\getitemparameter\itemlevel\c!stopper}}
+ {\countervalue{\@@itemcounter\currentitemlevel}}%
+ \doifelse{\getitemparameter\currentitemlevel\c!placestopper}\v!yes
+ {\def\tempsymbol{\getitemparameter\currentitemlevel\c!stopper}}
{\let\tempsymbol\empty}%
\fi}
@@ -473,23 +460,23 @@
\def\setitemmark#1% % en pas op: resets \docommand
{\doifsymboldefinedelse{#1}
{\edef\currentitemsymbol{#1}%
- \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
- \setgvalue{\@@localitemsymbol \itemlevel}{\unknownitemsymbol}%
+ \setxvalue{\@@globalitemsymbol\currentitemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol \currentitemlevel}{\unknownitemsymbol}%
\def\listitem{\symbol[\currentitemsymbol]}%
\let\@@opsymbol\empty}% \let\docommand\gobbleoneargument}
{\doifconversiondefinedelse{#1}
{\edef\currentitemsymbol{#1}%
- \setxvalue{\@@globalitemsymbol\itemlevel}{\currentitemsymbol}%
- \setgvalue{\@@localitemsymbol\itemlevel }{\actualitemnumber }%
+ \setxvalue{\@@globalitemsymbol\currentitemlevel}{\currentitemsymbol}%
+ \setgvalue{\@@localitemsymbol\currentitemlevel }{\actualitemnumber }%
\ifconditional\textlistitem
- \doifsomething{\getitemparameter\itemlevel\c!lefttext}
+ \doifsomething{\getitemparameter\currentitemlevel\c!lefttext}
{\let\tempsymbol\empty}%
\fi
\def\listitem
- {\getitemparameter\itemlevel
+ {\getitemparameter\currentitemlevel
{\ifconditional\textlistitem\c!lefttext\else\c!left\fi}%
- \getvalue{\@@localitemsymbol\itemlevel}\tempsymbol
- \getitemparameter\itemlevel
+ \getvalue{\@@localitemsymbol\currentitemlevel}\tempsymbol
+ \getitemparameter\currentitemlevel
{\ifconditional\textlistitem\c!righttext\else\c!right\fi}}%
\let\@@opsymbol\empty}%\let\docommand\gobbleoneargument}
{}}}
@@ -527,15 +514,16 @@
\def\dodostartitemgroup[#1]% [#2]%
{\relax % prevents lookahead
- \ifnum\itemlevel=\maxitemlevel\relax
- \showmessage\m!layouts9\maxitemlevel
+ \ifnum\currentitemlevel=\maxitemdepth\relax
+ \showmessage\m!layouts9{\number\maxitemdepth}%
\let\itemincrement\zerocount
\else
\let\itemincrement\plusone
\fi
- \doglobal\increment(\itemlevel,\itemincrement)%
- \initializeitemgrouplevel\itemlevel % safeguard
- \edef\itemgroupoptions{\getitemparameter\itemlevel\c!option}%
+ \global\advance\itemdepth\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
+ \initializeitemgrouplevel\currentitemlevel % safeguard
+ \edef\itemgroupoptions{\getitemparameter\currentitemlevel\c!option}%
\ifx\itemgroupoptions\empty
\edef\itemgroupoptions{#1}%
\else
@@ -643,8 +631,7 @@
\doifinsetelse\v!random {#1}{\settrue\randomizeitems }{\setfalse\randomizeitems }%
\doifinsetelse\v!continue{#1}{\settrue\continuelistitems}{\setfalse\continuelistitems}%
% == \doifinsetelse\v!intro{#1}\settrue\setfalse\introlistitem
- \doglobal\increment\noflists
- \let\currentlist\noflists
+ \global\advance\noflists\plusone
\newcounter\noflistelements
\setfalse\headlistitem
\setfalse\sublistitem
@@ -655,60 +642,60 @@
\let\symalignleft\relax
\the\itemgroupcommands
\checkcurrentnofitems
- % \getitemparameter\itemlevel\empty
+ % \getitemparameter\currentitemlevel\empty
\let\listitem\empty % ** start value
\doifelsenothing{#1} % iffirstargument
- {\edef\@@opsymbol{\getitemparameter\itemlevel\c!symbol}%
- \letgvalueempty{\@@globalitemsymbol\itemlevel}%
- \global\letitemparameter\itemlevel\v!continue\empty
+ {\edef\@@opsymbol{\getitemparameter\currentitemlevel\c!symbol}%
+ \letgvalueempty{\@@globalitemsymbol\currentitemlevel}%
+ \global\letitemparameter\currentitemlevel\v!continue\empty
% \setitemmark\@@opsymbol % ** default value
- \dosetupitemgroupvariable[\itemlevel][#2]}
- {\dosetupitemgroupconstant[\itemlevel][#1]%
- \dosetupitemgroupvariable[\itemlevel][#2]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]}
+ {\dosetupitemgroupconstant[\currentitemlevel][#1]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]%
\doifinsetelse\v!continue{#1}% \noexpand, else problems in non-etex with chinese
- {\edef\@@opsymbol{\noexpand\getvalue{\@@globalitemsymbol\itemlevel}}%
- \getitemparameter\itemlevel\v!continue}
- {\edef\@@opsymbol{\noexpand\getitemparameter{\itemlevel}{\c!symbol}}%
- \global\setitemparameter\itemlevel\v!continue
- {\dosetupitemgroupconstant[\itemlevel][#1]%
- \dosetupitemgroupvariable[\itemlevel][#2]}}%
+ {\edef\@@opsymbol{\noexpand\getvalue{\@@globalitemsymbol\currentitemlevel}}%
+ \getitemparameter\currentitemlevel\v!continue}
+ {\edef\@@opsymbol{\noexpand\getitemparameter{\currentitemlevel}{\c!symbol}}%
+ \global\setitemparameter\currentitemlevel\v!continue
+ {\dosetupitemgroupconstant[\currentitemlevel][#1]%
+ \dosetupitemgroupvariable[\currentitemlevel][#2]}}%
\def\docommand##1% \setitemmark resets \docommand
{\doifnot{##1}{0}{\setitemmark{##1}}}%
% \processcommalist[#1,\@@opsymbol]\docommand
\processcommalist[#1]\docommand}% ** preset sequence or provided sequence
% moved to here, after settings
- \ifnum\itemlevel=\plusone % NIEUW
+ \ifnum\currentitemlevel=\plusone % NIEUW
\doadaptleftskip {\getitemparameter1\c!margin}%
\doadaptleftskip {\getitemparameter1\c!leftmargin}%
\doadaptrightskip{\getitemparameter1\c!rightmargin}%
\fi
- \dosetraggedcommand{\getitemparameter\itemlevel\c!align}\raggedcommand
- \dosetsymalign{\getitemparameter\itemlevel\c!symalign}%
- \doifsomething{\getitemparameter\itemlevel\c!indenting}
+ \dosetraggedcommand{\getitemparameter\currentitemlevel\c!align}\raggedcommand
+ \dosetsymalign{\getitemparameter\currentitemlevel\c!symalign}%
+ \doifsomething{\getitemparameter\currentitemlevel\c!indenting}
{% is \expanded needed?
- \expanded{\setupindenting[\getitemparameter\itemlevel\c!indenting]}}%
+ \expanded{\setupindenting[\getitemparameter\currentitemlevel\c!indenting]}}%
%
\setitemlevel{#1}% moved to here
\ifx\listitem\empty
\setitemmark\@@opsymbol % ** default value
\ifx\listitem\empty
- \edef\currentitemsymbol{\itemlevel}% ** fall back
+ \edef\currentitemsymbol{\currentitemlevel}% ** fall back
\fi
\fi
\ifconditional\autointrolistitem\ifnum\prevgraf<3
\settrue\introlistitem
\fi\fi
\ifconditional\paragraphlistitem
- \ifnum\itemlevel>\plusone
- \letitemparameter\itemlevel\c!inbetween\empty
+ \ifnum\currentitemlevel>\plusone
+ \letitemparameter\currentitemlevel\c!inbetween\empty
\fi
\fi
\ifconditional\packlistitem
- \letitemparameter\itemlevel\c!inbetween\empty
+ \letitemparameter\currentitemlevel\c!inbetween\empty
\fi
\doifinset\v!columns{#1}%
- {\ifinsidecolumns\else\ifnum\itemcolumndepth=\zerocount
- \globallet\itemcolumndepth\itemlevel
+ {\ifinsidecolumns\else\ifcase\itemcolumndepth
+ \global\itemcolumndepth\currentitemlevel\relax
\itembeforecommand
\processfirstactioninset
[#1]
@@ -717,9 +704,9 @@
\v!three=>\!!counta3\relax,
\v!four=>\!!counta4\relax,
\v!five=>\!!counta5\relax,
- \s!unknown=>\@EA\!!counta\getitemparameter\itemlevel\c!n]%
+ \s!unknown=>\@EA\!!counta\getitemparameter\currentitemlevel\c!n]%
\startcolumns
- [\c!n=\!!counta, % netter \??op\itemlevel\c!n
+ [\c!n=\!!counta, % netter \??op\currentitemlevel\c!n
\c!height=,
\c!rule=\v!off,
\c!balance=\v!yes,
@@ -728,10 +715,10 @@
\ifconditional\fittinglistitems
\splititemtwopassdata\noflists
\ifdim\itemdataw sp>\zeropoint
- \expanded{\setitemparameter{\itemlevel}{\c!width}{\itemdataw sp}}%
+ \expanded{\setitemparameter{\currentitemlevel}{\c!width}{\itemdataw sp}}%
\fi
\fi
- \calculatelistwidth\itemlevel{\dimen0}%
+ \calculatelistwidth\currentitemlevel{\dimen0}%
\ifdim\dimen0>\zeropoint\relax
\ifconditional\inlinelistitem\else
\advance\leftskip \dimen0\relax
@@ -760,20 +747,19 @@
\else
\par
\fi
- %\ifnum\itemcolumndepth=\zerocount \dolistreference \fi % beware !
\dolistreference
\ifconditional\firstlistitem \else \endgroup \fi % toegevoegd, eerste \som opent groep
- \ifnum\itemcolumndepth=\itemlevel\relax
+ \ifnum\itemcolumndepth=\currentitemlevel\relax
\stopcolumns
- \doglobal\newcounter\itemcolumndepth
+ \global\itemcolumndepth\zerocount
\itemaftercommand
\dontrechecknextindentation
\else
- \ifnum\itemlevel=\plusone
+ \ifnum\currentitemlevel=\plusone
\doitembreak\allowbreak % toegevoegd
- \itemaftercommand % \getitemparameter\itemlevel\c!after
+ \itemaftercommand % \getitemparameter\currentitemlevel\c!after
% was: \dochecknextindentation\??oo, is now:
- \dochecknextindentation{\??op\currentitemgroup\itemlevel}%
+ \dochecknextindentation{\??op\currentitemgroup\currentitemlevel}%
\else
% nieuw, not yet nobreak handling
\ifcase\autoitemgroupspacing
@@ -787,11 +773,13 @@
% new test, needed in sidefloats (surfaced in volker's proceedings)
\ifconditional\textlistitem % else forgotten
\endgroup
- \doglobal\decrement(\itemlevel,\itemincrement)%
+ \global\advance\itemdepth-\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
\egroup
\else
\endgroup
- \doglobal\decrement(\itemlevel,\itemincrement)%
+ \global\advance\itemdepth-\itemincrement
+ \xdef\currentitemlevel{\number\itemdepth}%
\egroup
\par
\fi
@@ -814,15 +802,15 @@
\itemgroupitem}
\def\itemgroupsymbol#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!symstyle\c!symcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!symstyle\c!symcolor{#1}}%
\settrue\symbollistitem
\itemgroupitem}
\def\itemgroupedge#1%
{\itemgroupsymbol
- {\calculatelistwidth\itemlevel{\dimen0}%
+ {\calculatelistwidth\currentitemlevel{\dimen0}%
\hbox to \dimen0
- {#1\hskip\getitemparameter\itemlevel\c!distance}}}
+ {#1\hskip\getitemparameter\currentitemlevel\c!distance}}}
\def\itemgrouphead
{\settrue\headlistitem\doitemgrouphead}
@@ -832,13 +820,13 @@
\def\doitemgroupitems[#1]%
{\itemgroupedge
- {\dorecurse{0\getitemparameter\itemlevel\c!items}{\listitem\hss}%
+ {\dorecurse{0\getitemparameter\currentitemlevel\c!items}{\listitem\hss}%
\unskip}}
\def\itemgroupmargin#1%
{\def\marsymbol
{\llap
- {\doitemattributes\itemlevel\c!marstyle\c!marcolor{#1}%
+ {\doitemattributes\currentitemlevel\c!marstyle\c!marcolor{#1}%
\hskip\leftskip\hskip\leftmargindistance}}%
\itemgroupitem}
@@ -896,7 +884,7 @@
\appendtoks \let\headsym \itemgroupheadsym \to \itemgroupcommands
\def\itemgroupheadsym#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!symstyle\c!symcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!symstyle\c!symcolor{#1}}%
\settrue\symbollistitem
\settrue\headlistitem
\doitemgrouphead}
@@ -916,7 +904,7 @@
\newconditional\txtlistitem \setfalse\txtlistitem
\def\itemgrouptext#1%
- {\def\symsymbol{\doitemattributes\itemlevel\c!headstyle\c!headcolor{#1}}%
+ {\def\symsymbol{\doitemattributes\currentitemlevel\c!headstyle\c!headcolor{#1}}%
\settrue\symbollistitem
\settrue\txtlistitem
\itemgroupitem}
@@ -929,7 +917,7 @@
\def\dodotxtitem
{\scratchdimen\wd8
- \advance \scratchdimen \getitemparameter\itemlevel\c!distance\relax
+ \advance \scratchdimen \getitemparameter\currentitemlevel\c!distance\relax
\ifdim\scratchdimen>\dimen0
\advance\scratchdimen -\dimen0
\else
@@ -939,7 +927,7 @@
\hskip\scratchdimen}
\def\optimizelistitemsbreak
- {\ifnum\itemcolumndepth=\zerocount \ifconditional\optimizelistitem
+ {\ifcase\itemcolumndepth \ifconditional\optimizelistitem
\ifcase \currentnofitems \else
\ifnum\currentnofitems=\plusthree
\ifnum\noflistelements>\plusone
@@ -978,28 +966,28 @@
\ifconditional\symbollistitem
\symsymbol
\else
- \doitemattributes\itemlevel\c!headstyle\c!headcolor{\listitem}%
+ \doitemattributes\currentitemlevel\c!headstyle\c!headcolor{\listitem}%
\fi
\else
\ifconditional\symbollistitem
\symsymbol % no attributes, why?
\else
- \doitemattributes\itemlevel\c!style\c!color{\listitem}%
+ \doitemattributes\currentitemlevel\c!style\c!color{\listitem}%
\fi
\fi}%
\ifconditional\fittinglistitems
- \ifdim\wd8>\getitemparameter\itemlevel\c!maxwidth sp\relax
- \expanded{\global\noexpand\setitemparameter{\itemlevel}{\c!maxwidth}{\number\wd8}}%
+ \ifdim\wd8>\getitemparameter\currentitemlevel\c!maxwidth sp\relax
+ \expanded{\global\noexpand\setitemparameter{\currentitemlevel}{\c!maxwidth}{\number\wd8}}%
\fi
\splititemtwopassdata\noflists
\ifdim\itemdataw sp>\zeropoint
- \setbox8\simplealignedbox{\getitemparameter\itemlevel\c!itemalign}{\itemdataw sp}{\box8}%
+ \setbox8\simplealignedbox{\getitemparameter\currentitemlevel\c!itemalign}{\itemdataw sp}{\box8}%
\fi
\fi
\doifsomething\doitemdestination
{\setbox8\hbox{\goto{\box8}[\doitemdestination]}}%
\globallet\doitemdestination\empty
- \dimen2=\getitemparameter\itemlevel\c!width\relax
+ \dimen2=\getitemparameter\currentitemlevel\c!width\relax
% new, prevents loops when symbol is (not yet found) graphic
\ht8=\strutheight
\dp8=\strutdepth
@@ -1011,7 +999,7 @@
\ifdim\dimen2=\zeropoint\relax
\calculatelistwidth1{\dimen0}%
\else
- \calculatelistwidth\itemlevel{\dimen0}%
+ \calculatelistwidth\currentitemlevel{\dimen0}%
\fi
\ifconditional\textlistitem
\hbox{\ifconditional\sublistitem+\fi\box8\hskip\interwordspace}\nobreak
@@ -1025,14 +1013,14 @@
\llap{\hbox to \dimen0{\ifconditional\sublistitem\llap{+}\fi
\symalignleft
\box8\hfil
- \hskip\getitemparameter\itemlevel\c!distance% T h
+ \hskip\getitemparameter\currentitemlevel\c!distance% T h
}}%
\fi\fi\fi
\fi
\forceunexpanded % needed for m conversion (\os) / i need to look into this
- \setevalue{\@@currentitemsymbol\itemlevel}%
- {\getvalue{\@@localitemsymbol\itemlevel}}% still problems with \uchar ?
- %{\noexpand\getvalue{\@@localitemsymbol\itemlevel}}% no, spoils subrefs
+ \setevalue{\@@currentitemsymbol\currentitemlevel}%
+ {\getvalue{\@@localitemsymbol\currentitemlevel}}% still problems with \uchar ?
+ %{\noexpand\getvalue{\@@localitemsymbol\currentitemlevel}}% no, spoils subrefs
\resetunexpanded
\setfalse\headlistitem
\setfalse\sublistitem
@@ -1045,17 +1033,17 @@
\newconditional\repeatlistitem
\def\checkforrepeatedlistitem
- {\ifnum\itemlevel=\plusone
+ {\ifnum\currentitemlevel=\plusone
\initializeboxstack{item}%
\fi
\ifconditional\repeatlistitem
- \savebox{item}{\itemlevel}{\hbox{\copy8}}%
+ \savebox{item}{\currentitemlevel}{\hbox{\copy8}}%
\setbox8\hbox to \wd8
{\setbox\scratchbox\hbox
- {\scratchcounter\itemlevel
+ {\scratchcounter\currentitemlevel
\advance\scratchcounter\minusone
\dorecurse\scratchcounter{\foundbox{item}{\recurselevel}}}%
- \ifnum\itemlevel>\plusone
+ \ifnum\currentitemlevel>\plusone
\ifdim\wd\scratchbox>\zeropoint
\hskip-\dimen2
\box\scratchbox
@@ -1098,22 +1086,22 @@
\doitembreak\nobreak % new, concat
\fi % new, concat
\doadvanceitem
- \ifnum\itemcolumndepth=0\relax\ifnum\noflistelements>0\relax
+ \ifcase\itemcolumndepth \ifnum\noflistelements>0\relax
\doitembreak\nobreak
\fi\fi
\ifconditional\firstlistitem
\setfalse\firstlistitem
\begingroup
- \ifcase\itemlevel
+ \ifcase\currentitemlevel
\or % 1
- \ifnum\itemcolumndepth=0\relax
+ \ifcase\itemcolumndepth
\ifconditional\introlistitem\doitembreak\nobreak\fi
- \itembeforecommand % \getitemparameter\itemlevel\c!before
+ \itembeforecommand % \getitemparameter\currentitemlevel\c!before
\ifconditional\introlistitem\doitembreak\nobreak\fi
\fi
\else % 2 en hoger
\ifconditional\paragraphlistitem \else
- \let\previtemlevel\itemlevel
+ \let\previtemlevel\currentitemlevel
\decrement\previtemlevel
\ifcase\autoitemgroupspacing\relax % nieuw
\itembeforecommand
@@ -1145,7 +1133,7 @@
\ifconditional\packlistitem
\setupwhitespace[\v!none]%
\fi
- \getitemparameter\itemlevel\c!inner
+ \getitemparameter\currentitemlevel\c!inner
\marsymbol
\let\marsymbol\relax
\doifsomething{#1}
@@ -1158,7 +1146,7 @@
\setfalse\concatnextitem % new, concat
\nobreak % else problems with intext items
\hskip\itemsignal % new, concat
- \getitemparameter\itemlevel\c!command} % \defaultitemcommand
+ \getitemparameter\currentitemlevel\c!command} % \defaultitemcommand
\def\defaultitemcommand
{\EveryPar{\ignorespaces}% needed ?
@@ -1192,10 +1180,10 @@
% \def\complexdoitemgrouphead[#1]#2\par% % beter in \complexdosom hangen met een if
% {\ifconditional\firstlistitem\else\doitembreak\allowbreak\fi
% \ifconditional\packlistitem\else\itembeforeheadcommand\fi
-% \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\itemlevel % incr in \complexdosom
+% \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\currentitemlevel % incr in \complexdosom
% \doitembreak\allowbreak
% \fi\fi\fi
-% \complexdoitemgroupitem[#1]{\doitemattributes\itemlevel\c!headstyle\c!headcolor
+% \complexdoitemgroupitem[#1]{\doitemattributes\currentitemlevel\c!headstyle\c!headcolor
% {\ignorespaces#2}}%
% \ifconditional\textlistitem
% \removeunwantedspaces\space\ignorespaces
@@ -1215,12 +1203,12 @@
\def\complexdoitemgrouphead[#1]% beter in \complexdosom hangen met een if
{\ifconditional\firstlistitem\else\doitembreak\allowbreak\fi
\ifconditional\packlistitem\else\itembeforeheadcommand\fi
- \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\itemlevel % incr in \complexdosom
+ \ifconditional\firstlistitem\ifconditional\introlistitem\else\ifcase\currentitemlevel % incr in \complexdosom
\doitembreak\allowbreak
\fi\fi\fi
\complexdoitemgroupitem[#1]%
\bgroup
- \dostartitemattributes\itemlevel\c!headstyle\c!headcolor\empty
+ \dostartitemattributes\currentitemlevel\c!headstyle\c!headcolor\empty
\ignorespaces
\let\par\enditemhead} % brrrr but simple anyway
@@ -1298,7 +1286,7 @@
\c!start=1,
\c!option=,
\c!command=\defaultitemcommand,
- \c!symbol=\itemlevel] % \v!niveau
+ \c!symbol=\currentitemlevel] % \v!niveau
\def\defineitemgroup
{\dodoubleempty\dodefineitemgroup}
@@ -1311,8 +1299,8 @@
\setvalue{\e!stop#1}{\stopitemgroup}%
\setvalue{\e!setup#1\e!endsetup}{\setupitemgroup[#1]}%
\getparameters[\??ig#1][\c!levels=3,#2]%
- \ifnum\getvalue{\??ig#1\c!levels}<\maxitemlevel\relax
- \letvalue{\??ig#1\c!levels}\maxitemlevel
+ \ifnum\getvalue{\??ig#1\c!levels}<\maxitemdepth\relax
+ \setevalue{\??ig#1\c!levels}{\number\maxitemdepth}%
\fi
\dorecurse{\getvalue{\??ig#1\c!levels}}{\initializeitemgrouplevel\recurselevel}%
\popmacro\currentitemgroup}}
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
index 526e015aa..13b829d39 100644
--- a/tex/context/base/core-job.tex
+++ b/tex/context/base/core-job.tex
@@ -32,21 +32,21 @@
\let \allinputpaths \empty
\let \locatedfilepath \empty
-\newcounter\textlevel
-\newcounter\fileprocesslevel
+\newcount\textlevel
+\newcount\fileprocesslevel
\setvalue{\c!file::0}{\jobname}
\def\processedfile % is used in styles, don't change !
- {\getvalue{\c!file::\fileprocesslevel}}
+ {\getvalue{\c!file::\number\fileprocesslevel}}
\def\dostarttextfile#1%
- {\doglobal\increment\fileprocesslevel
- \setxvalue{\c!file::\fileprocesslevel}{#1}%
+ {\global\advance\fileprocesslevel\plusone
+ \setxvalue{\c!file::\number\fileprocesslevel}{#1}%
\@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles}
\def\dostoptextfile
- {\doglobal\decrement\fileprocesslevel}
+ {\global\advance\fileprocesslevel\minusone}
\def\processlocalfile#1#2%
{#1{#2}\donothing{\readfile{#2}\donothing\donothing}}
@@ -150,14 +150,14 @@
\def\starttext
{\doateverystarttext
- \ifnum\textlevel=\zerocount
+ \ifcase\textlevel
\registerfileinfo[begin]\jobname
\expandafter\startcopyingblocks
\fi
- \doglobal\increment\textlevel\relax}
+ \global\advance\textlevel\plusone}
\def\stoptext
- {\doglobal\decrement\textlevel\relax
+ {\global\advance\textlevel\minusone
\ifnum\textlevel>\zerocount \else
\the\everystoptext
%\the\everybye %
@@ -221,7 +221,7 @@
\processfile{#1}%
\dostoptextfile}
-\newcounter\filelevel
+\newcount\filelevel
\let\currentcomponent \v!text
\let\currentcomponentpath\f!currentpath
@@ -245,7 +245,7 @@
\def\product ##1 {#5{##1}}%
\def\component ##1 {#6{##1}}%
\fi
- \increment\filelevel\relax
+ \advance\filelevel\plusone
\fullexpandoneargafter\addtocommalist{#1}\loadedfiles}
\def\doprevlevel
@@ -255,7 +255,7 @@
\ifnum\filelevel=\plusone
\expandafter\stoptext
\else
- \decrement\filelevel\relax
+ \advance\filelevel\minusone
\expandafter\endinput
\fi}
diff --git a/tex/context/base/core-lnt.tex b/tex/context/base/core-lnt.tex
index 29e8a97f0..0d960decd 100644
--- a/tex/context/base/core-lnt.tex
+++ b/tex/context/base/core-lnt.tex
@@ -35,7 +35,7 @@
\ifnum\linenotelinenumber=\linenumber\relax
% todo: \onlyfootnote{#2}{#3}% == configurable
% \setupnote[#1][\c!numbercommand=\gobbleoneargument]%
- % \setnotetext[#1]{\rawreference\s!fnt{\s!fnt:f:\internalfootreference}{}#2: #3}%
+ % \setnotetext[#1]{\rawreference\s!fnt{\s!fnt:f:\number\internalnotereference}{}#2: #3}%
\def\linenotelinenumber##1{#2}%
\setupnote[#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]%
\setnote[#1]{#3}%
diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex
index 500a28893..b74ba9403 100644
--- a/tex/context/base/core-not.tex
+++ b/tex/context/base/core-not.tex
@@ -570,9 +570,9 @@
\def\domovednote#1#2%
{\ifconditional\pagewisenotes
- \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
+ \doifreferencefoundelse{\s!fnt:t:\number\internalnotereference}
{\let\savedrealreference\currentrealreference
- \doifreferencefoundelse{\s!fnt:f:\internalfootreference}
+ \doifreferencefoundelse{\s!fnt:f:\number\internalnotereference}
{\ifnum\savedrealreference<\currentrealreference\relax\symbol[#1]\else
\ifnum\savedrealreference>\currentrealreference\relax\symbol[#2]\fi\fi}
\donothing}
@@ -599,7 +599,7 @@
\long\def\nododonote#1#2%
{\doifnot{#1}{-}
{\ifconditional\pagewisenotes
- \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
+ \doifreferencefoundelse{\s!fnt:t:\number\internalnotereference}
{\ifnum\currentrealreference>\lastnotepage\relax
\globallet\lastnotepage\currentrealreference
\resetnumber[\currentnote]%
@@ -613,14 +613,14 @@
\decrementnumber[\currentnote]}}
\def\dododonote#1%
- {\doglobal\increment\internalfootreference
+ {\global\advance\internalnotereference\plusone
\doifelse{\noteparameter\c!way}{\v!by\v!page}
{\settrue\pagewisenotes}
{\setfalse\pagewisenotes}%
\doifelse{#1}{-}
{\let\lastnotenumber\empty}
{\ifconditional\pagewisenotes
- \doifreferencefoundelse{\s!fnt:t:\internalfootreference}
+ \doifreferencefoundelse{\s!fnt:t:\number\internalnotereference}
{\ifnum\currentrealreference>\lastnotepage\relax
\globallet\lastnotepage\currentrealreference
\resetnumber[\currentnote]%
@@ -661,7 +661,7 @@
%D mainly because endnotes had to be supported.} that is,
%D automatically (vise versa) and by user supplied reference.
-\newcounter\internalfootreference
+\newcount\internalnotereference
\let\startpushnote=\relax
\let\stoppushnote =\relax
@@ -674,11 +674,11 @@
\newconditional\processingnote
\def\footnotereferencefrom
- {\rawreference\s!fnt{\s!fnt:f:\internalfootreference}{}}
+ {\rawreference\s!fnt{\s!fnt:f:\number\internalnotereference}{}}
\def\footnotereferenceto
{\global\advance\crossreferencenumber\minusone\relax % else problem, needs further testing
- \rawreference\s!fnt{\s!fnt:t:\internalfootreference}{}}
+ \rawreference\s!fnt{\s!fnt:t:\number\internalnotereference}{}}
\def\dostartnote% nog gobble als in pagebody
{\pushsomestates
@@ -715,7 +715,7 @@
{\preparednumber\domovednote\v!nextpage\v!previouspage}}%
{\gotobox{\noteparameter\c!command % was \c!numbercommand, but compatible
{\preparednumber\domovednote\v!nextpage\v!previouspage}}%
- [\s!fnt:f:\internalfootreference]}%
+ [\s!fnt:f:\number\internalnotereference]}%
\fi
\doifelse{\noteparameter\c!interaction}\v!no
{\ifconditional\pagewisenotes
@@ -750,7 +750,7 @@
\fi}
{\gotobox
{\dodonotesymbol{\lastnotenumber\domovednote\v!previouspage\v!nextpage}}%
- [\s!fnt:t:\internalfootreference]%
+ [\s!fnt:t:\number\internalnotereference]%
\footnotereferencefrom}%
\globallet\lastnotesymbol\relax}
diff --git a/tex/context/base/core-pgr.tex b/tex/context/base/core-pgr.tex
index 145599cc3..c218842b0 100644
--- a/tex/context/base/core-pgr.tex
+++ b/tex/context/base/core-pgr.tex
@@ -630,7 +630,7 @@
%D So far for the trickery.
-\newcounter\textbackgrounddepth
+\newcount\textbackgrounddepth
\appendtoks
\expanded{\savecurrentvalue\noexpand\totalnofparbackgrounds{\number\nofparbackgrounds}}%
@@ -651,7 +651,7 @@
\unexpanded\def\starttextbackground
{\bgroup
- \increment\textbackgrounddepth
+ \advance\textbackgrounddepth\plusone
\dodoubleempty\dostarttextbackground}
\let\dodostarttextbackground\relax
@@ -1102,18 +1102,18 @@
\def\stackposdistance{.5em}
-\newcounter\currentautopos
+\newcount\currentautopos
+\newcount\previousautopos
\def\POSstackprefix{stack:}
\def\dostackposbox#1#2%
{\dowithnextbox
- {#2{\let\previousautopos\currentautopos
- \doglobal\increment\currentautopos
- \hpos{\POSstackprefix\currentautopos}
- {\doifoverlappingelse{\POSstackprefix\currentautopos}{\POSstackprefix\previousautopos}
- {#1}
- {\flushnextbox}}}}%
+ {#2{\previousautopos\currentautopos
+ \global\advance\currentautopos\plusone
+ \edef\currentposition {\POSstackprefix\number\currentautopos}%
+ \edef\previousposition{\POSstackprefix\number\previousautopos}%
+ \hpos\currentposition{\doifoverlappingelse\currentposition\previousposition{#1}{\flushnextbox}}}}%
\hbox}
\def\stackposup {\dostackposbox{\raise\lineheight\flushnextbox}}
@@ -1129,30 +1129,6 @@
%D margin settings. When set to \type {yes}, this macro comes
%D into action.
-% \def\stackeddown
-% {\dowithnextbox
-% {\doglobal\increment\currentautopos
-% \hpos{\POSstackprefix\currentautopos}
-% {\edef\next
-% {\nextboxht\the\nextboxht
-% \nextboxdp\the\nextboxdp
-% \nextboxwd\the\nextboxwd}%
-% \let\previousautopos\currentautopos
-% \scratchdimen\zeropoint
-% \doloop
-% {\decrement\previousautopos
-% \doifoverlappingelse{\POSstackprefix\currentautopos}{\POSstackprefix\previousautopos}
-% {\advance\scratchdimen\MPh{\POSstackprefix\previousautopos}%
-% \advance\scratchdimen\MPd{\POSstackprefix\previousautopos}}%
-% \exitloop
-% \ifnum\previousautopos<\zerocount\exitloop\fi}%
-% % \ifdim\scratchdimen>\zeropoint
-% \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi
-% {\lower\scratchdimen\flushnextbox}%
-% \next
-% % \fi
-% \flushnextbox}}}
-
% Because there can be many stacked items in a line and successive lines, we
% play dirty and adapt the position and height of the current node so that
% this becomes visible to a next pass.
@@ -1206,30 +1182,31 @@
{\bgroup
% this macro assumes a few things and is meant to work for margin notes
\dowithnextbox
- {\doglobal\increment\currentautopos
+ {\global\advance\currentautopos\plusone
\global\laststackvmove\zeropoint
- \hpos{\POSstackprefix\currentautopos}
+ \hpos{\POSstackprefix\number\currentautopos}
{\edef\next
{\nextboxht\the\nextboxht
\nextboxdp\the\nextboxdp
\nextboxwd\the\nextboxwd}%
- \let\previousautopos\currentautopos
+ \previousautopos\currentautopos
\scratchdimen\zeropoint
\scratchcounter\zerocount
\doloop
- {\decrement\previousautopos\relax
- \edef\currentposition {\POSstackprefix\currentautopos}%
- \edef\previousposition{\POSstackprefix\previousautopos}%
+ {\advance\previousautopos\minusone
+ \edef\currentposition {\POSstackprefix\number\currentautopos}%
+ \edef\previousposition{\POSstackprefix\number\previousautopos}%
\ifnum\MPp\currentposition=\MPp\previousposition\relax
- %\registerstatus{doing \currentautopos/\previousautopos}%
+ %\registerstatus{doing \number\currentautopos/\number\previousautopos}%
\doifoverlappingelse\currentposition\previousposition
- {\scratchskip \MPy\currentposition
- \advance\scratchskip-\MPy\previousposition
- \advance\scratchskip-\MPd\currentposition % untested
- \advance\scratchskip \MPd\previousposition % untested
- \advance\scratchskip \MPh\currentposition
- % todo: also take depth into account
+ {\scratchskip\dimexpr
+ \MPy\currentposition
+ -\MPy\previousposition
+ -\MPd\currentposition % untested
+ +\MPd\previousposition % untested
+ +\MPh\currentposition
\relax
+ % todo: also take depth into account
\ifdim\scratchskip<\scratchdimen
%\registerstatus{no \the\scratchskip}%
\else
@@ -1243,16 +1220,16 @@
\fi}%
\ifdim\scratchdimen=\zeropoint \else
\bgroup
- \edef\currentposition{\POSstackprefix\currentautopos}%
+ \edef\currentposition{\POSstackprefix\number\currentautopos}%
\scratchskip\scratchdimen
\advance\scratchskip\MPh\currentposition
\scratchdimen-\scratchdimen
\advance\scratchdimen\MPy\currentposition
- %\registerstatus{old \currentautopos: \MPy\currentposition/\MPh\currentposition}%
+ %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}%
\expanded{\replacepospxywhd
{\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}%
{\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}%
- %\registerstatus{new \currentautopos: \MPy\currentposition/\MPh\currentposition}%
+ %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}%
\egroup
\global\laststackvmove\scratchdimen % new
\setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi
@@ -1375,11 +1352,11 @@
%D specified with symbolic names, and symbolic references to
%D the graphics involved. Each table has its own namespace.
-\newcounter\noftabpositions
-\newtoks \posXCtoks
+\newcount\noftabpositions
+\newtoks \posXCtoks
\def\tbPOSprefix
- {tbp:\noftabpositions:}
+ {tbp:\number\noftabpositions:}
\def\tablepos
{\scratchtoks\posXCtoks
@@ -1471,7 +1448,7 @@
&\global\chardef\tabulatetype#1&}
\appendtoks
- \doglobal\increment\noftabpositions
+ \global\advance\noftabpositions\plusone
\to \everytabulate
%D In order to prevent potential clashes with abbreviations,
@@ -1518,7 +1495,7 @@
\def\normalTABLEquote {\unskip\!ttRightGlue&\omit\tablepos&} % "
\appendtoks
- \doglobal\increment\noftabpositions
+ \global\advance\noftabpositions\plusone
\to \everytable
%D Since we don't want nameclashes:
diff --git a/tex/context/base/core-reg.lua b/tex/context/base/core-reg.lua
index 22a75945b..f490f2cca 100644
--- a/tex/context/base/core-reg.lua
+++ b/tex/context/base/core-reg.lua
@@ -83,70 +83,14 @@ do
return split
end
---~ local template = {
---~ page = "\\pageentry{%s}{%s}{%s}{%s}",
---~ start = {
---~ [0] = "\\startletter{%s}",
---~ [1] = "\\startentry{%s}",
---~ [2] = "\\startsubentry{%s}",
---~ [3] = "\\startsubsubentry{%s}"
---~ },
---~ stop = {
---~ [0] = "\\stopletter",
---~ [1] = "\\stopentry",
---~ [2] = "\\stopsubentry",
---~ [3] = "\\stopsubsubentry"
---~ }
---~ }
-
---~ function sorters.index.flush(sorted,class,flush)
---~ flush = flush or print
---~ class = class or 'index'
---~ local function flushpage(v)
---~ flush(string.format(template.page,v[2],v[3] or "",v[4] or "",v[5] or ""))
---~ end
---~ for _,v in ipairs(table.sortedkeys(sorted)) do
---~ local s = sorted[v]
---~ flush(string.format(template.start[0],s.tag))
---~ local done = { false, false, false }
---~ for kk,vv in ipairs(s.data) do
---~ if vv[1][1] then
---~ local e = { false, false, false }
---~ for i=1,3,1 do
---~ if vv[1][i] then e[i] = vv[1][i][1] end
---~ end
---~ for i=3,1,-1 do
---~ if done[i] and e[i] ~= done[i] then
---~ flush(template.stop[i])
---~ end
---~ end
---~ for i=1,3,1 do
---~ if e[i] ~= done[i] then
---~ if e[i] and e[i] ~= "" then
---~ done[i] = e[i]
---~ flush(string.format(template.start[i],e[i]))
---~ else
---~ done[i] = false
---~ end
---~ end
---~ end
---~ flushpage(vv)
---~ end
---~ end
---~ for i=3,1,-1 do
---~ if done[i] then flush(template.stop[i]) end
---~ end
---~ flush(template.stop[0])
---~ end
---~ end
-
-- \registerpage{index}{,}{6}{2--0-0-0-0-0-0-0--1}{1}
- -- for the moment we use the old structure, some day mmiv code
+ -- for the moment we use the old structure, some day mkiv code
-- will be different: more structure, less mess
local template = {
page = "\\registerpage{%s}{%s}{%s}{%s}{%s}",
+ see = "\\registersee{%s}{%s}{%s}{%s}",
letter = "\\registerentry{%s}{%s}",
entry = {
"\\registerentrya{%s}{%s}",
@@ -161,7 +105,7 @@ do
class = class or 'index'
for k,v in ipairs(table.sortedkeys(sorted)) do
local s = sorted[v]
- flush(string.format(template.letter,class,s.tag))
+ flush(template.letter:format(class,s.tag))
local done = { false, false, false }
for kk,vv in ipairs(s.data) do
if vv[2][1] then
@@ -173,7 +117,7 @@ do
if e[i] ~= done[i] then
if e[i] and e[i] ~= "" then
done[i] = e[i]
- flush(string.format(template.entry[i],class,e[i]))
+ flush(template.entry[i]:format(class,e[i]))
else
done[i] = false
end
@@ -181,7 +125,9 @@ do
end
if vv[1] == 'e' then
-- format reference pagespec realpage
- flush(string.format(template.page,class,",",vv[4],vv[5],vv[3]))
+ flush(template.page:format(class,",",vv[4],vv[5],vv[3]))
+ elseif vv[1] == 's' then
+ flush(template.see:format(class,",",vv[5],vv[3]))
end
end
end
diff --git a/tex/context/base/core-spa.mkiv b/tex/context/base/core-spa.mkiv
index e3e91c145..6eb99c1f9 100644
--- a/tex/context/base/core-spa.mkiv
+++ b/tex/context/base/core-spa.mkiv
@@ -305,6 +305,12 @@
% \vspacing[2*big,disable]
% \vspacing[2*big,back]
+\def\enablevspacing{\ctxlua{
+ callback.register('vpack_filter', nodes.handle_vbox_spacing)
+ callback.register('buildpage_filter', nodes.handle_page_spacing)
+}}
+
+
\protect \endinput
\starttext
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index d4cda2431..fae78327f 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -2990,10 +2990,10 @@
\fi
\relax}
-\newcounter \noftrackedpagestates
-\newif \ifpagestatemismatch
-\let \realpagestateno \realfolio
-\chardef \frozenpagestate \zerocount
+\newcount \noftrackedpagestates
+\newif \ifpagestatemismatch
+\newcount \realpagestateno
+\chardef \frozenpagestate \zerocount
\def\dotrackpagestate#1#2%
{\ifdoublesided \ifinpagebody \else
@@ -3002,16 +3002,16 @@
\def\doforcedtrackpagestate#1#2%
{\ifcase\frozenpagestate
- \doglobal\increment\noftrackedpagestates\relax
- \doglobal\increment#2\relax
- \lazysavetaggedtwopassdata{#1}{\noftrackedpagestates}{#2}{\noexpand\realfolio}%
- %\llap{\infofont\noftrackedpagestates/#2}% tracing
+ \global\advance\noftrackedpagestates\plusone
+ \global\advance#2\plusone
+ \lazysavetaggedtwopassdata{#1}{\number\noftrackedpagestates}{\number#2}{\noexpand\realfolio}%
+ %\llap{\infofont\number\noftrackedpagestates/\number#2}% tracing
\fi}
\def\doifrightpagestateelse#1#2%
{\ifcase\frozenpagestate
\pagestatemismatchfalse
- \let\realpagestateno\realfolio
+ \realpagestateno\realfolio
\ifinpagebody
\ifdoublesided
\ifodd\realpageno\relax
@@ -3021,9 +3021,9 @@
\twopassdatafoundtrue
\fi
\else\ifdoublesided
- \findtwopassdata{#1}{#2}%
+ \findtwopassdata{#1}{\number#2}%
\iftwopassdatafound
- \let\realpagestateno\twopassdata
+ \realpagestateno\twopassdata\relax
\ifnum\twopassdata=\realpageno \else
\pagestatemismatchtrue
\fi
@@ -3052,10 +3052,10 @@
\def\doifforcedrightpagestateelse#1#2%
{\ifcase\frozenpagestate
\pagestatemismatchfalse
- \let\realpagestateno\realfolio
- \findtwopassdata{#1}{#2}%
+ \realpagestateno\realfolio
+ \findtwopassdata{#1}{\number#2}%
\iftwopassdatafound
- \let\realpagestateno\twopassdata
+ \realpagestateno\twopassdata\relax
\ifnum\twopassdata=\realpageno \else
\pagestatemismatchtrue
\fi
@@ -3083,15 +3083,15 @@
% we can make more of these on top, but how to deal with mixed frozen states
-\definetwopasslist\s!paragraph \newcounter\nofraggedparagraphs
+\definetwopasslist\s!paragraph \newcount \nofraggedparagraphs
\def\signalrightpage {\dotrackpagestate \s!paragraph\nofraggedparagraphs}
\def\doifrightpageelse{\doifrightpagestateelse\s!paragraph\nofraggedparagraphs}
-\newcounter\pagesignallevel
+\newcount\pagesignallevel
\def\startsignalrightpage % one may do a \postsignalrightplace
- {\increment\pagesignallevel
+ {\advance\pagesignallevel\plusone
\presignalrightpage
\let\signalrightpage\relax
\let\presignalrightpage\relax
@@ -3101,7 +3101,7 @@
\def\stopsignalrightpage
{\ifcase\pagesignallevel\or\postsignalrightpage\fi
- \decrement\pagesignallevel}
+ \advance\pagesignallevel\minusone}
\def\setraggedparagraphmode
{\signalrightpage\doifrightpageelse} % move it there
@@ -3142,7 +3142,7 @@
\def\docheckpagestatechange#1#2#3%
{\pagechangedfalse
\doforcedtrackpagestate{#2}{#3}%
- \findtwopassdata{#2}{#3}%
+ \findtwopassdata{#2}{\number#3}%
\iftwopassdatafound
\ifnum\twopassdata>0\getvalue{#2:p:#1}\relax
\pagechangedtrue
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index 55f40ecc7..843e92662 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -142,43 +142,44 @@
% \NC 500 \NC \NC 20 \NC \NC 100 \NC \NR
% \stoptabulate
-\newtoks \tabulatepreamble
-\newtoks \tabulatebefore
-\newtoks \tabulateafter
-\newtoks \tabulatebmath
-\newtoks \tabulateemath
-\newtoks \tabulatefont
-\newtoks \tabulatesettings
-\newtoks \tabulatedummy
+\newtoks \tabulatepreamble
+\newtoks \tabulatebefore
+\newtoks \tabulateafter
+\newtoks \tabulatebmath
+\newtoks \tabulateemath
+\newtoks \tabulatefont
+\newtoks \tabulatesettings
+\newtoks \tabulatedummy
-\newcount \nofautotabulate % \newcounter \nofautotabulate
-\newcount \tabulatecolumns % \newcounter \tabulatecolumns
+\newcount \nofautotabulate
+\newcount \tabulatecolumns
+\newcount \tabulatecolumn
-\newcounter \tabulateminplines
-\newcounter \tabulatemaxplines
+\newcount \tabulateminplines
+\newcount \tabulatemaxplines
-\newif \ifautotabulate
-\newif \ifsplittabulate \splittabulatetrue
+\newif \ifautotabulate
+\newif \ifsplittabulate \splittabulatetrue
-\newif \ifhandletabulatepbreak \handletabulatepbreaktrue
-\newif \iftabulatenopbreak \tabulatenopbreakfalse
+\newif \ifhandletabulatepbreak \handletabulatepbreaktrue
+\newif \iftabulatenopbreak \tabulatenopbreakfalse
-\newif \iftabulateequal
-\newif \iftracetabulate
-\newif \ifframedtabulate
+\newif \iftabulateequal
+\newif \iftracetabulate
+\newif \ifframedtabulate
-\newdimen \tabulatepwidth
-\newdimen \tabulatewidth
-\newdimen \tabulateunit
-\newdimen \tabulatemaxpheight
+\newdimen \tabulatepwidth
+\newdimen \tabulatewidth
+\newdimen \tabulateunit
+\newdimen \tabulatemaxpheight
-\newbox \tabulatebox
+\newbox \tabulatebox
% [|lg{.}|] => \NG 12.34 \NC
\gdef\handletabulatecharalign#1 % space delimited !
- {\edef\alignmentclass{\tabulatecolumn}%
- \edef\alignmentcharacter{\getvalue{\@@tabalign@@\tabulatecolumn}}%
+ {\edef\alignmentclass{\the\tabulatecolumn}%
+ \edef\alignmentcharacter{\getvalue{\@@tabalign@@\the\tabulatecolumn}}%
\ifcase\tabulatepass\or
\setfirstpasscharacteralign\checkalignment{#1}%
\fi % force hsize
@@ -234,7 +235,7 @@
\fi}
\def\checktabulatesetups
- {\getvalue{\@@tabsetups@@\tabulatecolumn}}
+ {\getvalue{\@@tabsetups@@\the\tabulatecolumn}}
\let\pretabrule \donothing
\let\posttabrule\donothing
@@ -269,8 +270,8 @@
% some entries can be left out if we test for them being set
\@EA\appendtoks \@EA&\@EA\hskip\pretabskip\pretabrule##&\to\!!toksa
\appendtoks \ignorespaces\to\!!toksa
- %\@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa
- \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa
+% \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa
+ \@EA\appendtoks\@EA\global\@EA\tabulatecolumn\the\tabulatecolumns\relax\to\!!toksa
\appendtoks \checktabulatesetups\to\!!toksa
\appendtoks \checktabulatehook\to\!!toksa
\@EA\appendtoks \preamblebox\to\!!toksa
@@ -517,13 +518,13 @@
\dp\tabulatebox\strutdp
\box\tabulatebox}
-\def\dotabulatehook {\getvalue{\@@tabhook@@ \tabulatecolumn}}
-\def\dotabulatealign {\getvalue{\@@tabalign@@ \tabulatecolumn}}
+\def\dotabulatehook {\getvalue{\@@tabhook@@ \the\tabulatecolumn}}
+\def\dotabulatealign {\getvalue{\@@tabalign@@ \the\tabulatecolumn}}
\def\resettabulatepheight
- {\globallet\tabulateminplines\!!plusone
+ {\global\tabulateminplines\plusone
\getnoflines\tabulatemaxpheight
- \xdef\tabulatemaxplines{\the\noflines}%
+ \global\tabulatemaxplines\noflines
\global\tabulatemaxpheight\zeropoint}
\def\settabulatepheight
@@ -541,7 +542,7 @@
\ifnum\tabulateminplines=\plusone
\dotabulatenobreak
\fi
- \doglobal\increment\tabulateminplines
+ \global\advance\tabulateminplines\plusone
\ifnum\tabulateminplines=\tabulatemaxplines\relax
\dotabulatenobreak
\fi
@@ -757,7 +758,7 @@
{\appendtoks{##1}\to\!!toksb\do}%
\def\dodododo##1%
{\appendtoks##1\to\!!toksb\do}%
- \globallet\tabulatecolumn\!!zerocount
+ \global\tabulatecolumn\zerocount
% \do#3\relax
\bgroup\@@useotherbar\expanded{\egroup\noexpand\do#3\relax}%
\processcontent
@@ -903,6 +904,10 @@
\chardef\tabulaterepeathead\zerocount
+\newcount\noftabulatelines
+\newcount\totalnoftabulatelines
+\newcount\minusnoftabulatelines
+
\bgroup \catcode`\|=\@@other
\gdef\processtabulate[|#1|]% in the process of optimizing
@@ -922,9 +927,9 @@
\def\postabskip{.5\tabulateunit}%
\global\tabulatecolumns\zerocount
\global\nofautotabulate\zerocount
- \doglobal\newcounter\noftabulatelines
- \let\totalnoftabulatelines\noftabulatelines
- \let\minusnoftabulatelines\noftabulatelines
+ \global\noftabulatelines\zerocount
+ \totalnoftabulatelines\noftabulatelines
+ \minusnoftabulatelines\noftabulatelines
\global\tabulatepwidth\zeropoint
\global\tabulateequalfalse
\resettabulatepheight
@@ -957,10 +962,10 @@
\def\HR{\doHR\zerocount}
\def\HL{\doHL\zerocount}
\unexpanded \def\NR % next row
- {\doglobal\increment\noftabulatelines
+ {\global\advance\noftabulatelines\plusone
\global\tabulatefirstflushedfalse
\global\tabulateequalfalse
- \globallet\tabulatecolumn\!!zerocount
+ \global\tabulatecolumn\zerocount
\resettabulatepheight
\unskip\unskip\crcr\flushtabulated
\TABLEnoalign
@@ -1013,9 +1018,9 @@
% {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}%
\initializetableboxes\tabulatecolumns
\appendtoks&##\to\!!toksa
- \appendtoks\doglobal\increment\tabulatecolumn\to\!!toksa
+ \appendtoks\global\advance\tabulatecolumn\plusone\to\!!toksa
\appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count
- \globallet\tabulatecolumn\!!zerocount
+ \global\tabulatecolumn\zerocount
\resettabulatepheight
\def\bskip
{\setbox\tabulatebox\vbox\bgroup
@@ -1088,7 +1093,7 @@
\gdef\flushtabulated
{\TABLEnoalign % noalign % no interference !
{\global\let\flushtabulatedindeed\empty
- \globallet\tabulatecolumn\!!zerocount
+ \global\tabulatecolumn\zerocount
\handletabulatepbreak
\dorecurse\tabulatecolumns % was: \noftabcolumns
{\ifvoid\tablebox\recurselevel\else
@@ -1107,10 +1112,9 @@
\def\eskip % vertical strut added august 2003
{\par\verticalstrut\vskip-\struttotal\egroup}%
\fi
- \let\totalnoftabulatelines\noftabulatelines
- \let\minusnoftabulatelines\noftabulatelines
- \decrement\minusnoftabulatelines
- \doglobal\newcounter\noftabulatelines
+ \totalnoftabulatelines\noftabulatelines
+ \minusnoftabulatelines\numexpr\noftabulatelines+\minusone\relax
+ \global\noftabulatelines\zerocount
% not satisfying
% \def\doHL##1%
% {\TABLEnoalign
diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex
index 745c578d5..93fa96944 100644
--- a/tex/context/base/core-ver.tex
+++ b/tex/context/base/core-ver.tex
@@ -826,7 +826,7 @@
%D
%D The definition is not that spectacular.
-\unexpanded\def\filename#1{{\tttf\hyphenatedfile{#1}}}
+\unexpanded\def\filename#1{{\tttf\hyphenatedfilename{#1}}}
%D This leaves some settings:
diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua
index 50650b60f..960c96a14 100644
--- a/tex/context/base/font-fbk.lua
+++ b/tex/context/base/font-fbk.lua
@@ -10,7 +10,8 @@ if not modules then modules = { } end modules ['font-fbk'] = {
<p>This is very experimental code!</p>
--ldx]]--
-fonts.fallbacks = { }
+fonts = fonts or { }
+fonts.fallbacks = fonts.fallbacks or { }
fonts.vf.aux.combine.trace = false
fonts.vf.aux.combine.commands["enable-tracing"] = function(g,v)
@@ -52,7 +53,7 @@ fonts.fallbacks['textcent'] = function (g)
local c = string.byte("c")
local t = table.fastcopy(g.characters[c])
local s = fonts.tfm.scaled(g.specification.size or g.size)
- local a = - math.tan(math.rad(g.italicangle))
+ local a = - math.tan(math.rad(g.italicangle or 0))
local special, red, green, blue, black = fonts.vf.aux.combine.initialize_trace()
if a == 0 then
t.commands = {
@@ -88,7 +89,7 @@ fonts.fallbacks['texteuro'] = function (g)
local c = string.byte("C")
local t = table.fastcopy(g.characters[c])
local s = fonts.tfm.scaled(g.specification.size or g.size)
- local d = math.cos(math.rad(90+g.italicangle))
+ local d = math.cos(math.rad(90+(g.italicangle)))
local special, red, green, blue, black = fonts.vf.aux.combine.initialize_trace()
t.width = 1.05*t.width
t.commands = {
@@ -109,13 +110,17 @@ fonts.vf.aux.combine.force_composed = false
function fonts.vf.aux.compose_characters(g) -- todo: scaling depends on call location
local chars = g.characters
+ local fastcopy = table.fastcopy
local xchar = chars[string.byte("X")]
- if xchar.description then
+ if xchar and xchar.description then
local cap_lly = xchar.description.boundingbox[4]
- local ita_cor = math.cos(math.rad(90+g.italicangle))
+ local ita_cor = math.cos(math.rad(90+(g.italicangle or 0)))
local force = fonts.vf.aux.combine.force_composed
local fallbacks = characters.context.fallbacks
local special, red, green, blue, black = fonts.vf.aux.combine.initialize_trace()
+if not g.fonts then
+ g.fonts = { { name = g.name, size = g.size or -1000 } } -- fallback
+end
for i,c in pairs(characters.data) do
if force or not chars[i] then
local s = c.specials
@@ -126,7 +131,7 @@ function fonts.vf.aux.compose_characters(g) -- todo: scaling depends on call loc
local cc = c.category
if cc == 'll' or cc == 'lu' or cc == 'lt' then
local acc = s[3]
- local t = table.fastcopy(charschr)
+ local t = fastcopy(charschr)
local d = t.description
d.name = c.adobename or "unknown"
d.unicode = i
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 92f545e15..486bb413c 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -4378,7 +4378,7 @@ do
local zwj = 0x200D
local isol = {
- [0x0621] = true,
+ [0x0621] = true, [zwnj] = true,
}
local isol_fina = {
@@ -4394,7 +4394,7 @@ do
[0x0640] = true, -- tadwil
[0x0641] = true, [0x0642] = true, [0x0643] = true, [0x0644] = true, [0x0645] = true, [0x0646] = true, [0x0647] = true, [0x0649] = true, [0x064A] = true,
[0x067E] = true,
- [0x0686] = true,
+ [0x0686] = true, [zwj] = true,
}
local arab_warned = { }
diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua
index 460330525..f751947b8 100644
--- a/tex/context/base/font-syn.lua
+++ b/tex/context/base/font-syn.lua
@@ -23,6 +23,7 @@ fonts.names.saved = false
fonts.names.loaded = false
fonts.names.be_clever = true
fonts.names.enabled = true
+fonts.names.autoreload = toboolean(os.env['MTX.FONTS.AUTOLOAD'] or os.env['MTX_FONTS_AUTOLOAD'] or "no")
fonts.names.cache = containers.define("fonts","data",fonts.names.version,true)
--[[ldx--
@@ -75,28 +76,37 @@ fonts.names.filters.fixes = {
{ "cond$", "condensed", },
}
---~ todo
---~
---~ function getosfontdirs()
---~ local hash, result = { }, { }
---~ local function collect(t)
---~ for _, v in ipairs(t) do
---~ v = input.clean_path(v)
---~ v = v:gsub("/+$","")
---~ local key = v:lower()
---~ if not hash[key] then
---~ hash[key], result[#result+1] = true, v
---~ end
---~ end
---~ end
---~ collect(input.expanded_path_list(instance,"osfontdir"))
---~ local name = input.find_file(instance,"fonts.conf","other")
---~ if name ~= "" then
---~ local root = xml.load(name)
---~ collect(xml.all_texts(root,"dir",true))
---~ end
---~ return result
---~ end
+fonts.names.xml_configuration_file = "fonts.conf" -- a bit weird format, bonus feature
+fonts.names.environment_path_variable = "osfontdir" -- the official way, in minimals etc
+
+function fonts.names.getpaths(instance)
+ local hash, result = { }, { }
+ local function collect(t)
+ for i=1, #t do
+ local v = input.clean_path(t[i])
+ v = v:gsub("/+$","")
+ local key = v:lower()
+ if not hash[key] then
+ hash[key], result[#result+1] = true, v
+ end
+ end
+ end
+ local path = fonts.names.environment_path_variable
+ if path and path ~= "" then
+ collect(input.expanded_path_list(instance,path))
+ end
+ local name = fonts.names.xml_configuration_file
+ if name and not name == "" then
+ local name = input.find_file(instance,name,"other")
+ if name ~= "" then
+ collect(xml.collect_texts(xml.load(name),"dir",true))
+ end
+ end
+ function fonts.names.getpaths()
+ return result
+ end
+ return result
+end
function fonts.names.identify()
fonts.names.data = {
@@ -159,12 +169,12 @@ function fonts.names.identify()
end)
end)
traverse("system", function(suffix)
- local pathlist = input.expanded_path_list(texmf.instance,"osfontdir")
+ local pathlist = fonts.names.getpaths(texmf.instance) -- input.expanded_path_list(texmf.instance,"osfontdir")
if pathlist then
for _, path in ipairs(pathlist) do
-- not that much needed
- path = input.clean_path(path .. "/")
- path = path:gsub("/+","/")
+ -- path = input.clean_path(path .. "/")
+ -- path = path:gsub("/+","/")
local pattern = path .. "*." .. suffix
logs.info("fontnames", "globbing path " .. pattern)
local t = dir.glob(pattern)
@@ -270,12 +280,21 @@ do
return nil, nil, nil
end
+ local reloaded = false
+
function fonts.names.resolve(name, sub)
if not name then
return nil, nil
elseif fonts.names.enabled then
fonts.names.load()
local name, filename, is_sub = found(name:lower())
+ if not filename and not reloaded and fonts.name.autoreload then
+ fonts.names.loaded = false
+ reloaded = true
+ io.flush()
+ fonts.names.load(true)
+ name, filename, is_sub = found(name:lower())
+ end
if is_sub then
return filename, name
else
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 1b0ed65d5..8efc01b52 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -191,6 +191,9 @@ function fonts.tfm.do_scale(tfmtable, scaledpoints)
for k,v in pairs(tfmtable) do
t[k] = (type(v) == "table" and { }) or v
end
+ if tfmtable.fonts then
+ t.fonts = table.fastcopy(tfmtable.fonts)
+ end
-- local zerobox = { 0, 0, 0, 0 }
local tp = t.parameters
for k,v in pairs(tfmtable.parameters) do
@@ -266,7 +269,7 @@ function fonts.tfm.do_scale(tfmtable, scaledpoints)
local key = ivc[1]
if key == "right" or key == "left" or key == "down" or key == "up" then
tt[#tt+1] = { key, ivc[2]*delta }
- else
+ else -- not comment
tt[#tt+1] = ivc -- shared since in cache and untouched
end
end
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index 291c06707..8795bf03f 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -44,6 +44,8 @@ function file.extname(name)
return name:match("^.+%.([^/\\]-)$") or ""
end
+file.suffix = file.extname
+
function file.stripsuffix(name)
return (name:gsub("%.[%a%d]+$",""))
end
diff --git a/tex/context/base/l-tex.lua b/tex/context/base/l-tex.lua
index 89925f602..1a23c183e 100644
--- a/tex/context/base/l-tex.lua
+++ b/tex/context/base/l-tex.lua
@@ -8,7 +8,7 @@ if not versions then versions = { } end versions['l-tex'] = 1.001
if not number then number = { } end
-number.dimenfactors = {
+local dimenfactors = {
["pt"] = 1/65536,
["in"] = ( 100/ 7227)/65536,
["cm"] = ( 254/ 7227)/65536,
@@ -22,32 +22,36 @@ number.dimenfactors = {
["nc"] = ( 5080/65043)/65536
}
-function number.todimen(n,unit,fmt)
+local function todimen(n,unit,fmt)
if type(n) == 'string' then
return n
else
- return string.format(fmt or "%.5g%s",n*number.dimenfactors[unit or 'pt'],unit or 'pt')
+ unit = unit or 'pt'
+ return string.format(fmt or "%.5g%s", n*dimenfactors[unit], unit)
end
end
-function number.topoints (n) return number.todimen(n,"pt") end
-function number.toinches (n) return number.todimen(n,"in") end
-function number.tocentimeters (n) return number.todimen(n,"cm") end
-function number.tomillimeters (n) return number.todimen(n,"mm") end
-function number.toscaledpoints(n) return number.todimen(n,"sp") end
-function number.toscaledpoints(n) return n .. "sp" end
-function number.tobasepoints (n) return number.todimen(n,"bp") end
-function number.topicas (n) return number.todimen(n "pc") end
-function number.todidots (n) return number.todimen(n,"dd") end
-function number.tociceros (n) return number.todimen(n,"cc") end
-function number.tonewdidots (n) return number.todimen(n,"nd") end
-function number.tonewciceros (n) return number.todimen(n,"nc") end
+number.todimen = todimen
+number.dimenfactors = dimenfactors
+
+function number.topoints (n) return todimen(n,"pt") end
+function number.toinches (n) return todimen(n,"in") end
+function number.tocentimeters (n) return todimen(n,"cm") end
+function number.tomillimeters (n) return todimen(n,"mm") end
+function number.toscaledpoints(n) return todimen(n,"sp") end
+function number.toscaledpoints(n) return n .. "sp" end
+function number.tobasepoints (n) return todimen(n,"bp") end
+function number.topicas (n) return todimen(n "pc") end
+function number.todidots (n) return todimen(n,"dd") end
+function number.tociceros (n) return todimen(n,"cc") end
+function number.tonewdidots (n) return todimen(n,"nd") end
+function number.tonewciceros (n) return todimen(n,"nc") end
--~ for k,v in pairs{nil, "%.5f%s", "%.8g%s", "%.8f%s"} do
---~ print(number.todimen(65536))
---~ print(number.todimen( 256))
---~ print(number.todimen(65536,'pt',v))
---~ print(number.todimen( 256,'pt',v))
+--~ print(todimen(65536))
+--~ print(todimen( 256))
+--~ print(todimen(65536,'pt',v))
+--~ print(todimen( 256,'pt',v))
--~ end
-- todo: use different scratchdimen
@@ -64,7 +68,7 @@ function string.todimen(str)
else
local n, u = str:match("([%d%-%+%.]+)(%a%a)")
if n and u then
- return n/number.dimenfactors[u]
+ return n/dimenfactors[u]
else
return 0
end
@@ -89,7 +93,7 @@ end
if lua then do
- local delayed = { } -- could also be done with closures
+ local delayed = { }
function lua.delay(f)
delayed[#delayed+1] = f
@@ -98,13 +102,13 @@ if lua then do
function lua.flush_delayed(...)
local t = delayed
delayed = { }
- for _, fun in ipairs(t) do
- fun(...)
+ for i=1, #t do
+ t[i](...)
end
end
function lua.flush(...)
- tex.sprint("\\directlua 0 {lua.flush_delayed(" .. table.concat({...},',') .. ")}")
+ tex.sprint("\\directlua0{lua.flush_delayed(" .. table.concat({...},',') .. ")}")
end
end end
diff --git a/tex/context/base/l-utils.lua b/tex/context/base/l-utils.lua
index fbc05a26a..d1faa4f34 100644
--- a/tex/context/base/l-utils.lua
+++ b/tex/context/base/l-utils.lua
@@ -60,7 +60,7 @@ function utils.merger._self_swap_(data,code)
end
function utils.merger._self_libs_(libs,list)
- local result, f = "", nil
+ local result, f = { }, nil
if type(libs) == 'string' then libs = { libs } end
if type(list) == 'string' then list = { list } end
for _, lib in ipairs(libs) do
@@ -69,7 +69,7 @@ function utils.merger._self_libs_(libs,list)
f = io.open(name)
if f then
-- utils.report("merging library",name)
- result = result .. "\n" .. f:read("*all") .. "\n"
+ result[#result+1] = f:read("*all")
f:close()
list = { pth } -- speed up the search
break
@@ -78,7 +78,7 @@ function utils.merger._self_libs_(libs,list)
end
end
end
- return result or ""
+ return table.concat(result, "\n\n")
end
function utils.merger.selfcreate(libs,list,target)
diff --git a/tex/context/base/lang-url.tex b/tex/context/base/lang-url.tex
index 552dae571..3eb891914 100644
--- a/tex/context/base/lang-url.tex
+++ b/tex/context/base/lang-url.tex
@@ -45,15 +45,15 @@
\ifx\hyphenatedurl\undefined \let\hyphenatedurl\firstofoneargument \fi
%D \macros
-%D {hyphenatedfile}
+%D {hyphenatedfilename}
%D
%D For the moment we treat filenames in a similar way,
%D
%D \starttyping
-%D \hyphenatedfile{here/there/filename.suffix}
+%D \hyphenatedfilename{here/there/filename.suffix}
%D \stoptyping
-\ifx\hyphenatedfile\undefined \let\hyphenatedfile\hyphenatedurl \fi
+\ifx\hyphenatedfilename\undefined \let\hyphenatedfilename\hyphenatedurl \fi
% \def\test#1%
% {\dontleavehmode
diff --git a/tex/context/base/luat-tex.lua b/tex/context/base/luat-tex.lua
index 894160bb6..78e4501a1 100644
--- a/tex/context/base/luat-tex.lua
+++ b/tex/context/base/luat-tex.lua
@@ -189,65 +189,79 @@ if texconfig and not texlua then do
-- this will become: ctx.install_statistics(fnc() return ..,.. end) etc
- function ctx.show_statistics()
- local function ws(...)
- ctx.writestatus("mkiv lua stats",string.format(...))
- end
+ local statusinfo, n = { }, 0
+
+ function ctx.register_statistics(tag,pattern,fnc)
+ statusinfo[#statusinfo+1] = { tag, pattern, fnc }
+ if #tag > n then n = #tag end
+ end
+
+ function ctx.show_statistics() -- todo: move calls
if caches then
- ws("used config path - %s", caches.configpath(texmf.instance))
- ws("used cache path - %s", caches.path)
+ ctx.register_statistics("used config path", "%s", function() return caches.configpath(texmf.instance) end)
+ ctx.register_statistics("used cache path", "%s", function() return caches.path end)
end
if status.luabytecodes > 0 and input.storage and input.storage.done then
- ws("modules/dumps/instances - %s/%s/%s", status.luabytecodes-500, input.storage.done, status.luastates)
+ ctx.register_statistics("modules/dumps/instances", "%s/%s/%s", function() return status.luabytecodes-500, input.storage.done, status.luastates end)
end
if texmf.instance then
- ws("input load time - %s seconds", input.loadtime(texmf.instance))
+ ctx.register_statistics("input load time", "%s seconds", function() return input.loadtime(texmf.instance) end)
end
if fonts then
- ws("fonts load time - %s seconds", input.loadtime(fonts))
+ ctx.register_statistics("fonts load time","%s seconds", function() return input.loadtime(fonts) end)
end
if xml then
- ws("xml load time - %s seconds (backreferences: %i, outer filtering time: %s)", input.loadtime(xml), #lxml.self, input.loadtime(lxml))
+ ctx.register_statistics("xml load time", "%s seconds, backreferences: %i, outer filtering time: %s", function() return input.loadtime(xml), #lxml.self, input.loadtime(lxml) end)
end
if mptopdf then
- ws("mps conversion time - %s seconds", input.loadtime(mptopdf))
+ ctx.register_statistics("mps conversion time", "%s seconds", function() return input.loadtime(mptopdf) end)
end
if nodes then
- ws("node processing time - %s seconds (including kernel)", input.loadtime(nodes))
+ ctx.register_statistics("node processing time", "%s seconds (including kernel)", function() return input.loadtime(nodes) end)
end
if kernel then
- ws("kernel processing time - %s seconds", input.loadtime(kernel))
+ ctx.register_statistics("kernel processing time", "%s seconds", function() return input.loadtime(kernel) end)
end
if attributes then
- ws("attribute processing time - %s seconds", input.loadtime(attributes))
+ ctx.register_statistics("attribute processing time", "%s seconds", function() return input.loadtime(attributes) end)
end
if languages then
- ws("language load time - %s seconds (n=%s)", input.loadtime(languages), languages.hyphenation.n())
+ ctx.register_statistics("language load time", "%s seconds, n=%s", function() return input.loadtime(languages), languages.hyphenation.n() end)
end
if figures then
- ws("graphics processing time - %s seconds (n=%s) (including tex)", input.loadtime(figures), figures.n or "?")
+ ctx.register_statistics("graphics processing time", "%s seconds, n=%s (including tex)", function() return input.loadtime(figures), figures.n or "?" end)
end
if metapost then
- ws("metapost processing time - %s seconds (loading: %s seconds, execution: %s seconds, n: %s)", input.loadtime(metapost), input.loadtime(mplib), input.loadtime(metapost.exectime), metapost.n)
+ ctx.register_statistics("metapost processing time", "%s seconds, loading: %s seconds, execution: %s seconds, n: %s", function() return input.loadtime(metapost), input.loadtime(mplib), input.loadtime(metapost.exectime), metapost.n end)
end
if status.luastate_bytes then
- ws("current memory usage - %s bytes", status.luastate_bytes)
+ ctx.register_statistics("current memory usage", "%s bytes", function() return status.luastate_bytes end)
end
if nodes then
- ws("cleaned up reserved nodes - %s nodes, %s lists (of %s)", nodes.cleanup_reserved(tex.count[24])) -- \topofboxstack
- end
- if languages then
- ws("loaded patterns - %s", languages.logger.report())
+ ctx.register_statistics("cleaned up reserved nodes", "%s nodes, %s lists of %s", function() return nodes.cleanup_reserved(tex.count[24]) end) -- \topofboxstack
end
if status.node_mem_usage then
- ws("node memory usage - %s", status.node_mem_usage)
+ ctx.register_statistics("node memory usage", "%s", function() return status.node_mem_usage end)
+ end
+ if languages then
+ ctx.register_statistics("loaded patterns", "%s", function() return languages.logger.report() end)
end
if fonts then
- ws("loaded fonts - %s", fonts.logger.report()) -- last because it is often a long list
+ ctx.register_statistics("loaded fonts", "%s", function() return fonts.logger.report() end)
end
if xml then -- so we are in mkiv, we need a different check
- -- todo: \nofshipouts
- ws("shipped out pages - %i (of %i processed pages)", tex.count['nofshipouts'], tex.count['realpageno']-1) -- last because we want to see this
+ ctx.register_statistics("runtime", "%s seconds, %i processed pages, %i shipped pages, %.3f pages/second", function()
+ input.stoptiming(texmf)
+ local runtime = input.loadtime(texmf)
+ local shipped = tex.count['nofshipouts']
+ local pages = tex.count['realpageno'] - 1
+ local persecond = shipped / runtime
+ return runtime, pages, shipped, persecond
+ end)
+ end
+ for _, t in ipairs(statusinfo) do
+ local tag, pattern, fnc = t[1], t[2], t[3]
+ ctx.writestatus("mkiv lua stats", string.format("%s - %s", tag:rpadd(n," "), pattern:format(fnc())))
end
end
@@ -263,10 +277,13 @@ if texconfig and not texlua then
if not texmf then texmf = { } end
+ input.starttiming(texmf)
+
if not texmf.instance then
if not texmf.instance then -- prevent a second loading
+
texmf.instance = input.reset()
texmf.instance.progname = environment.progname or 'context'
texmf.instance.engine = environment.engine or 'luatex'
diff --git a/tex/context/base/m-chemic.tex b/tex/context/base/m-chemic.tex
index cfefdf83f..21cabe8b3 100644
--- a/tex/context/base/m-chemic.tex
+++ b/tex/context/base/m-chemic.tex
@@ -9,17 +9,15 @@
%D suggestions={Tobias Burnus, Dirk Kuypers \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-\ifx\beginpicture\undefined
- \let\normalgrid\grid
- \let\normalaxis\axis
- \input pictex.tex \relax
- \let\pictexgrid\grid
- \let\pictexaxis\axis
- \let\grid\normalgrid
- \let\axis\normalaxis
+\ifx\directlua\undefined
+ \ifx\psaxes\undefined \ifx\beginpicture\undefined
+   \usemodule[pictex]
+ \fi \fi
+\else
+ \usemodule[pictex]
\fi
\input ppchtex.tex \relax
diff --git a/tex/context/base/m-steps.tex b/tex/context/base/m-steps.tex
index 8129d6699..1e2f5d97d 100644
--- a/tex/context/base/m-steps.tex
+++ b/tex/context/base/m-steps.tex
@@ -218,7 +218,7 @@
%D \def\startSTEPchart%
%D {\bgroup
%D \resetMPdrawing
-%D \increment\noftabpositions % begin of preroll
+%D \advance\noftabpositions\plusone % begin of preroll
%D \startMPdrawing
%D input mp-step ;
%D begin_step_chart ;
@@ -252,7 +252,7 @@
%D anchor_box(\MPpos{\tbPOSprefix origin}) ;
%D \stopMPdrawing
%D \MPdrawingdonetrue
-%D \decrement\noftabpositions % end of preroll
+%D \advance\noftabpositions\minusone % end of preroll
%D \setbox0=\vbox
%D {\getMPdrawing}
%D \resetMPdrawing
diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua
index c02be7455..d3f2b87ae 100644
--- a/tex/context/base/math-ini.lua
+++ b/tex/context/base/math-ini.lua
@@ -275,11 +275,12 @@ mathematics.slots.traditional = {
[0x03F1] = { "vargreek", 0x25 }, -- varrho
[0x03C2] = { "vargreek", 0x26 }, -- varsigma
+ -- varphi is part of the alphabet, contrary to the other var*s'
+
[0x03C6] = { "vargreek", 0x27 }, -- varphi
[0x03D5] = { "lcgreek", 0x1E }, -- phi
--- [0x03F0] = { "", 0x00 }, -- varkappa
-
+ [0x03F0] = { "lcgreek", 0x14 }, -- varkappa, not in tex fonts
[0x0021] = { "mr", 0x21 }, -- !
[0x0028] = { "mr", 0x28 }, -- (
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index a73c92911..aa9e64e80 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -65,6 +65,8 @@
\let\runMPTEXgraphicstrue \relax \let\runMPTEXgraphicsfalse\relax
\let \MPstaticgraphictrue \relax \let \MPstaticgraphicfalse\relax
+\let \obeyMPlines\relax
+\let \forceMPTEXcheck\gobbleoneargument
\let\maxnofMPgraphics\scratchcounter
\newtoks \MPextensions % mp, once
diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex
index 1ed7db7f9..000e56a2e 100644
--- a/tex/context/base/meta-pag.tex
+++ b/tex/context/base/meta-pag.tex
@@ -136,7 +136,7 @@
%D The \type {TextArea*} macros can be used to determine
%D overlap.
-\newcounter\currentMPtextareadata
+\newcount\currentMPtextareadata
\newtoks\MPsavedtextareadata
\newtoks\MPtextareadata
@@ -147,11 +147,11 @@
\def\registerMPtextarea#1%
{\ifpositioning
\bgroup
- \doglobal\increment\currentMPtextareadata
- %\hpos{gbd:\currentMPtextareadata}{#1}%
- \hpos{gbd:\currentMPtextareadata}%
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
{\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#1}}%
- \edef\!!stringa{gbd:\currentMPtextareadata}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
\edef\!!stringa{RegisterTextArea(%
\MPx\!!stringa,\MPy\!!stringa,%
\MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
@@ -164,11 +164,11 @@
\def\registerMPlocaltextarea#1%
{\ifpositioning
\bgroup
- \doglobal\increment\currentMPtextareadata
- %\hpos{gbd:\currentMPtextareadata}{#1}%
- \hpos{gbd:\currentMPtextareadata}%
+ \global\advance\currentMPtextareadata\plusone
+ %\hpos{gbd:\the\currentMPtextareadata}{#1}%
+ \hpos{gbd:\the\currentMPtextareadata}%
{\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
- \edef\!!stringa{gbd:\currentMPtextareadata}%
+ \edef\!!stringa{gbd:\the\currentMPtextareadata}%
\edef\!!stringa{RegisterLocalTextArea(%
\MPx\!!stringa,\MPy\!!stringa,%
\MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}%
@@ -186,8 +186,8 @@
% {\ifpositioning
% \bgroup
% \ifx\namedtextarea\empty
-% \doglobal\increment\currentMPtextareadata
-% \edef\namedtextarea{gbd:\currentMPtextareadata}%
+% \global\advance\currentMPtextareadata\plusone
+% \edef\namedtextarea{gbd:\the\currentMPtextareadata}%
% \fi
% \hpos\namedtextarea{\iftracetextareas\boxrulewidth3pt\ruledhbox\fi{#1}}%
% \edef\ascii{RegisterLocalTextArea(%
diff --git a/tex/context/base/meta-tex.mkii b/tex/context/base/meta-tex.mkii
index 720de6fb3..5766f659f 100644
--- a/tex/context/base/meta-tex.mkii
+++ b/tex/context/base/meta-tex.mkii
@@ -175,17 +175,19 @@
string txtpref ; txtpref := "00001::::" ;
\stopMPextensions
+\newcount\metatxtcounter
+
\long\def\dodofiltersometxt#1#2#3%
{\ifx#2\empty
\else
- \increment\txtcounter
- \TeXtext\txtcounter{#1}%
+ \advance\metatxtcounter\plusone
+ \TeXtext{\the\metatxtcounter}{#1}%
\expandafter\filtersometxt
\fi#2#3}
\long\def\redofiltersometxt[#1]#2%
- {\increment\txtcounter
- \TeXtext[#1]\txtcounter{#2}%
+ {\advance\metatxtcounter\plusone
+ \TeXtext[#1]{\the\metatxtcounter}{#2}%
\filtersometxt}
\long\def\filtersometxt#1\sometxt
@@ -196,7 +198,7 @@
% \filtersometxt abc\sometxt{def};hij\sometxt{klm};\sometxt{}\empty\relax
\long\def\flushTeXtexts#1%
- {\newcounter\txtcounter
+ {\metatxtcounter\zerocount
\dostartTeXtexts
\the\collectedmptexts
\filtersometxt#1\sometxt{}\empty\relax
@@ -205,7 +207,7 @@
\immediate\write\MPwrite{loadtxts ; txtnext := 0 ;}%
\global\collectedmptexts\emptytoks
\fi
- \newcounter\txtcounter}
+ \metatxtcounter\zerocount}
% \long\def\sometxt#1{sometxt(nexttxt)} % to be used in mp definitions, no ; here
diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua
index 8b4cbdb19..c3f2307e4 100644
--- a/tex/context/base/mlib-pdf.lua
+++ b/tex/context/base/mlib-pdf.lua
@@ -12,11 +12,11 @@ local abs, sqrt, round = math.abs, math.sqrt, math.round
metapost = metapost or { }
-function metapost.convert(result, trialrun)
+function metapost.convert(result, trialrun, flusher)
if trialrun then
- metapost.parse(result)
+ metapost.parse(result, flusher)
else
- metapost.flush(result)
+ metapost.flush(result, flusher)
end
end
@@ -28,24 +28,27 @@ function metapost.comment(message)
end
end
-function metapost.startfigure(llx,lly,urx,ury,message)
+metapost.flushers = { }
+metapost.flushers.pdf = { }
+
+function metapost.flushers.pdf.startfigure(n,llx,lly,urx,ury,message)
metapost.n = metapost.n + 1
sprint(tex.ctxcatcodes,format("\\startMPLIBtoPDF{%s}{%s}{%s}{%s}",llx,lly,urx,ury))
if message then metapost.comment(message) end
end
-function metapost.stopfigure(message)
+function metapost.flushers.pdf.stopfigure(message)
if message then metapost.comment(message) end
sprint(tex.ctxcatcodes,"\\stopMPLIBtoPDF")
end
-function metapost.flushfigure(pdfliterals) -- table
+function metapost.flushers.pdf.flushfigure(pdfliterals) -- table
if #pdfliterals > 0 then
sprint(tex.ctxcatcodes,"\\MPLIBtoPDF{",join(pdfliterals,"\n"),"}")
end
end
-function metapost.textfigure(font,size,text,width,height,depth)
+function metapost.flushers.pdf.textfigure(font,size,text,width,height,depth) -- we could save the factor
text = text:gsub(".","\\hbox{%1}") -- kerning happens in metapost (i have to check if this is true for mplib)
sprint(tex.ctxcatcodes,format("\\MPLIBtextext{%s}{%s}{%s}{%s}{%s}",font,size,text,0,-number.dimenfactors.bp*depth))
end
@@ -109,6 +112,7 @@ local function pen_characteristics(object)
width = wx
end
sx, rx, ry, sy, tx, ty = left_x, left_y, right_x, right_y, x_coord, y_coord
+ sx, rx, ry, sy = (sx-tx), (rx-ty), (ry-tx), (sy-ty) -- combine with previous
if width ~= 1 then
if width == 0 then
sx, sy = 1, 1
@@ -152,9 +156,8 @@ local function pen_characteristics(object)
return not (sx==1 and rx==0 and ry==0 and sy==1 and tx==0 and ty==0), width
end
-local function concat(px, py)
- local dx, dy = px-tx, py-ty
- return (sy*dx-ry*dy)/divider,(sx*dy-rx*dx)/divider
+local function concat(px, py) -- no tx, ty here
+ return (sy*px-ry*py)/divider,(sx*py-rx*px)/divider
end
local function curved(ith,pth)
@@ -225,25 +228,30 @@ metapost.specials = metapost.specials or { }
-- we have two extension handlers, one for pre and postscripts, and one for colors
-function metapost.flush(result) -- pdf flusher, table en dan concat is sneller, 1 literal
+-- the flusher is pdf based, if another backend is used, we need to overload the
+-- flusher; this is beta code, the organization will change
+
+function metapost.flush(result,flusher) -- pdf flusher, table en dan concat is sneller, 1 literal
if result then
local figures = result.fig
if figures then
+ flusher = flusher or metapost.flushers.pdf
local colorconverter = metapost.colorconverter() -- function !
local colorhandler = metapost.colorhandler
for f=1, #figures do
local figure = figures[f]
local objects = figure:objects()
+ local fignum = tonumber((figure:filename()):match("([%d]+)$") or 0)
local t = { }
local miterlimit, linecap, linejoin, dashed = -1, -1, -1, false
local bbox = figure:boundingbox()
local llx, lly, urx, ury = bbox[1], bbox[2], bbox[3], bbox[4] -- faster than unpack
if urx < llx then
-- invalid
- metapost.startfigure(0,0,0,0,"invalid")
- metapost.stopfigure()
+ flusher.startfigure(fignum,0,0,0,0,"invalid")
+ flusher.stopfigure()
else
- metapost.startfigure(llx,lly,urx,ury,"begin")
+ flusher.startfigure(fignum,llx,lly,urx,ury,"begin")
t[#t+1] = "q"
if objects then
for o=1,#objects do
@@ -264,9 +272,9 @@ function metapost.flush(result) -- pdf flusher, table en dan concat is sneller,
t[#t+1] = "q"
local ot = object.transform -- 3,4,5,6,1,2
t[#t+1] = format("%f %f %f %f %f %f cm",ot[3],ot[4],ot[5],ot[6],ot[1],ot[2]) -- TH: format("%f %f m %f %f %f %f 0 0 cm",unpack(ot))
- metapost.flushfigure(t)
+ flusher.flushfigure(t)
t = { }
- metapost.textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
+ flusher.textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
t[#t+1] = "Q"
else
-- alternatively we can pass on the stack, could be a helper
@@ -288,7 +296,7 @@ function metapost.flush(result) -- pdf flusher, table en dan concat is sneller,
--
local cs, cr = currentobject.color, nil
-- todo document why ...
- if cs and colorhandler and round(cs[1]*10000) == 123 then -- test in function
+ if cs and colorhandler and #cs > 0 and round(cs[1]*10000) == 123 then -- test in function
currentobject, cr = colorhandler(cs,currentobject,t,colorconverter)
objecttype = currentobject.type
end
@@ -298,13 +306,13 @@ function metapost.flush(result) -- pdf flusher, table en dan concat is sneller,
-- move test to function
local special = metapost.specials[prescript]
if special then
- currentobject, before, inbetween, after = special(currentobject.postscript,currentobject,t)
+ currentobject, before, inbetween, after = special(currentobject.postscript,currentobject,t,flusher)
objecttype = currentobject.type
end
end
--
cs = currentobject.color
- if cs then
+ if cs and #cs > 0 then
t[#t+1], cr = colorconverter(cs,objecttype)
end
--
@@ -339,31 +347,59 @@ function metapost.flush(result) -- pdf flusher, table en dan concat is sneller,
local path = currentobject.path
local transformed, penwidth = false, 1
local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point"
- if path then
- local pen = currentobject.pen
- if pen and #pen==1 then
+ local pen = currentobject.pen
+ if pen then
+ if pen.type=='elliptical' then
transformed, penwidth = pen_characteristics(object) -- boolean, value
t[#t+1] = format("%f w",penwidth) -- todo: only if changed
- end
+ if objecttype == 'fill' then
+ objecttype = 'both'
+ end
+ else -- calculated by mplib itself
+ objecttype = 'fill'
+ end
+ end
+ if transformed then
+ t[#t+1] = "q"
+ end
+ if path then
if transformed then
- t[#t+1] = "q"
flushconcatpath(path,t,open)
else
flushnormalpath(path,t,open)
end
- end
- local path = currentobject.htap
- if path then
- flushnormalpath(path,t,open)
- end
- if objecttype == "fill" then
- t[#t+1] = "h f"
- elseif objecttype == "outline" then
- t[#t+1] = (open and "S") or "h S"
+ if objecttype == "fill" then
+ t[#t+1] = "h f"
+ elseif objecttype == "outline" then
+ t[#t+1] = (open and "S") or "h S"
+ elseif objecttype == "both" then
+ t[#t+1] = "h B"
+ end
end
if transformed then
t[#t+1] = "Q"
end
+ local path = currentobject.htap
+ if path then
+ if transformed then
+ t[#t+1] = "q"
+ end
+ if transformed then
+ flushconcatpath(path,t,open)
+ else
+ flushnormalpath(path,t,open)
+ end
+ if objecttype == "fill" then
+ t[#t+1] = "h f"
+ elseif objecttype == "outline" then
+ t[#t+1] = (open and "S") or "h S"
+ elseif objecttype == "both" then
+ t[#t+1] = "h B"
+ end
+ if transformed then
+ t[#t+1] = "Q"
+ end
+ end
if cr and currentobject.color then -- and o < #objects
t[#t+1] = cr
end
@@ -372,8 +408,8 @@ function metapost.flush(result) -- pdf flusher, table en dan concat is sneller,
end
end
t[#t+1] = "Q"
- metapost.flushfigure(t)
- metapost.stopfigure("end")
+ flusher.flushfigure(t)
+ flusher.stopfigure("end")
end
end
end
@@ -406,28 +442,32 @@ function metapost.parse(result)
end
end
-function metapost.pdfliterals(result)
- -- only simple graphics, tracing
- local start = metapost.startfigure
- local stop = metapost.stopfigure
- local flush = metapost.flushfigure
+do
+
+ -- just tracing
+
local t = { }
- function metapost.flushfigure(literals)
- for i=1, #literals do
- t[#t+1] = literals[i]
+
+ local flusher = {
+ startfigure = function()
+ t = { }
+ tex.sprint(tex.ctxcatcodes,"\\startnointerference")
+ end,
+ flushfigure = function(literals)
+ for i=1, #literals do
+ t[#t+1] = literals[i]
+ end
+ end,
+ stopfigure = function()
+ tex.sprint(tex.ctxcatcodes,"\\stopnointerference")
end
+ }
+
+ function metapost.pdfliterals(result)
+ metapost.flush(result,flusher)
+ return t
end
- function metapost.startfigure()
- tex.sprint(tex.ctxcatcodes,"\\startnointerference")
- end
- function metapost.stopfigure()
- tex.sprint(tex.ctxcatcodes,"\\stopnointerference")
- end
- metapost.flush(result)
- metapost.startfigure = start
- metapost.stopfigure = stop
- metapost.flushfigure = flush
- return t
+
end
function metapost.totable(result)
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index de658d21b..b2d65e7cb 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -152,7 +152,7 @@ end
-- x' = sx * x + ry * y + tx
-- y' = rx * x + sy * y + ty
-function metapost.specials.fg(specification,object,result)
+function metapost.specials.fg(specification,object,result,flusher)
local op = object.path
local first, second, fourth = op[1], op[2], op[4]
local tx, ty = first.x_coord , first.y_coord
@@ -161,7 +161,7 @@ function metapost.specials.fg(specification,object,result)
if sx == 0 then sx = 0.00001 end
if sy == 0 then sy = 0.00001 end
local before = specification and function()
- metapost.flushfigure(result)
+ flusher.flushfigure(result)
sprint(tex.ctxcatcodes,format("\\MPLIBfigure{%f}{%f}{%f}{%f}{%f}{%f}{%s}",sx,rx,ry,sy,tx,ty,specification))
return object, { }
end
@@ -186,9 +186,9 @@ local function normalize(ca,cb)
end
end
-function metapost.specials.cs(specification,object,result) -- spot colors?
+function metapost.specials.cs(specification,object,result,flusher) -- spot colors?
nofshades = nofshades + 1
- metapost.flushfigure(result)
+ flusher.flushfigure(result)
result = { }
local t = specification:split(" ")
-- we need a way to move/scale
@@ -263,9 +263,9 @@ function metapost.specials.cs(specification,object,result) -- spot colors?
return object, before, nil, after
end
-function metapost.specials.ls(specification,object,result)
+function metapost.specials.ls(specification,object,result,flusher)
nofshades = nofshades + 1
- metapost.flushfigure(result)
+ flusher.flushfigure(result)
result = { }
local t = specification:split(" ")
-- we need a way to move/scale
@@ -357,7 +357,7 @@ function metapost.specials.tf(specification,object)
return { }, nil, nil, nil
end
-function metapost.specials.ts(specification,object,result)
+function metapost.specials.ts(specification,object,result,flusher)
-- print("getting", metapost.textext_current)
local op = object.path
local first, second, fourth = op[1], op[2], op[4]
@@ -367,11 +367,11 @@ function metapost.specials.ts(specification,object,result)
if sx == 0 then sx = 0.00001 end
if sy == 0 then sy = 0.00001 end
local before = function()
- --~ metapost.flushfigure(result)
+ --~ flusher.flushfigure(result)
--~ sprint(tex.ctxcatcodes,format("\\MPLIBgettext{%f}{%f}{%f}{%f}{%f}{%f}{%s}",sx,rx,ry,sy,tx,ty,metapost.textext_current))
--~ result = { }
result[#result+1] = format("q %f %f %f %f %f %f cm", sx,rx,ry,sy,tx,ty)
- metapost.flushfigure(result)
+ flusher.flushfigure(result)
local b = metapost.textext_current
sprint(tex.ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",b, metapost.sxsy(tex.wd[b],tex.ht[b],tex.dp[b])))
result = { "Q" }
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua
index aac7e030e..0e60c9639 100644
--- a/tex/context/base/mlib-run.lua
+++ b/tex/context/base/mlib-run.lua
@@ -74,7 +74,7 @@ function metapost.make(name, target, version)
) )
if mpx then
input.starttiming(metapost.exectime)
- local result = mpx:execute(format('\\ ; boolean mplib ; mplib := true ; string mp_parent_version ; mp_parent_version := "%s" ; show mp_parent_version ; input %s ;', version or "unknown", name))
+ local result = mpx:execute(format('\\ ; boolean mplib ; mplib := true ; string mp_parent_version ; mp_parent_version := "%s" ; show mp_parent_version ; input %s ; dump ;', version or "unknown", name))
input.stoptiming(metapost.exectime)
if mpx then
mpx:finish()
@@ -162,7 +162,28 @@ function metapost.format(name)
return mpx
end
-function metapost.process(mpx, data, trialrun, showlog)
+function metapost.reset(mpx)
+ if not mpx then
+ -- nothing
+ elseif type(mpx) == "string" then
+ if mpxformats[mpx] then
+ mpxformats[mpx]:finish()
+ mpxformats[mpx] = nil
+ end
+ else
+ for name=1,#mpxformats do
+ if mpxformats[name] == mpx then
+ mpxformats[name] = nil
+ break
+ end
+ end
+ mpx:finish()
+ end
+end
+
+metapost.showlog = false
+
+function metapost.process(mpx, data, trialrun, flusher)
local result
if type(mpx) == "string" then
mpx = metapost.format(mpx) -- goody
@@ -175,16 +196,15 @@ function metapost.process(mpx, data, trialrun, showlog)
if d then
input.starttiming(metapost.exectime)
result = mpx:execute(d)
---~ print(">>>",d)
input.stoptiming(metapost.exectime)
if not result then
metapost.report("error", "no result object returned")
elseif result.status > 0 then
- metapost.report("error",result.error or result.term or result.log or "unknown")
- elseif showlog then
- metapost.report("info",result.term or "unknown")
+ metapost.report("error",(result.term or "no-term") .. "\n" .. (result.error or "no-error"))
+ elseif metapost.showlog then
+ metapost.report("info",result.term or "no-term")
elseif result.fig then
- metapost.convert(result, trialrun)
+ metapost.convert(result, trialrun, flusher)
end
else
metapost.report("error", "invalid graphic component " .. i)
@@ -194,15 +214,14 @@ function metapost.process(mpx, data, trialrun, showlog)
input.starttiming(metapost.exectime)
result = mpx:execute(data)
input.stoptiming(metapost.exectime)
---~ print(">>>",data)
if not result then
metapost.report("error", "no result object returned")
elseif result.status > 0 then
- metapost.report("error",result.error or result.term or result.log or "unknown")
- elseif showlog then
- metapost.report("info",result.term or "unknown")
+ metapost.report("error",(result.term or "no-term") .. "\n" .. (result.error or "no-error"))
+ elseif metapost.showlog then
+ metapost.report("info",result.term or "no-term")
elseif result.fig then
- metapost.convert(result, trialrun)
+ metapost.convert(result, trialrun, flusher)
end
end
input.stoptiming(metapost)
diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex
index cd8f6acc7..a1af3adc9 100644
--- a/tex/context/base/page-lyr.tex
+++ b/tex/context/base/page-lyr.tex
@@ -125,7 +125,7 @@
%D \setlayer [identifier] [optional parameters] {data}
%D \stoptyping
-\def\currentlayerdata{0}
+\newcount\currentlayerdata
\let\currentlayerwidth \!!zeropoint
\let\currentlayerheight\!!zeropoint
@@ -156,7 +156,7 @@
{\bgroup
\recalculatebackgrounds
\recalculatelogos
- \doglobal\increment\currentlayerdata
+ \global\advance\currentlayerdata\plusone
\forgetall
\dontcomplain
\doifvalue{\??ll#1\c!option}\v!test\tracelayerstrue
@@ -199,20 +199,10 @@
% todo left/right
-% \def\setlastlayerpos#1%
-% {\edef\layerpage{\MPp{lyr:\currentlayerdata}}%
-% \scratchdimen\MPx{lyr:#1:\layerpage}%
-% \scratchdimen-\scratchdimen
-% \advance\scratchdimen\MPx{lyr:\currentlayerdata}%
-% \xdef\lastlayerxpos{\the\scratchdimen}%
-% \scratchdimen\MPy{lyr:#1:\layerpage}%
-% \advance\scratchdimen-\MPy{lyr:\currentlayerdata}%
-% \xdef\lastlayerypos{\the\scratchdimen}}
-
\def\setlastlayerpos#1%
- {\edef\layerpage{\MPp{lyr:\currentlayerdata}}%
- \xdef\lastlayerxpos{\the\dimexpr-\MPx{lyr:#1:\layerpage}+\MPx{lyr:\currentlayerdata}\relax}%
- \xdef\lastlayerypos{\the\dimexpr \MPy{lyr:#1:\layerpage}-\MPy{lyr:\currentlayerdata}\relax}}
+ {\edef\layerpage{\MPp{lyr:\the\currentlayerdata}}%
+ \xdef\lastlayerxpos{\the\dimexpr-\MPx{lyr:#1:\layerpage}+\MPx{lyr:\the\currentlayerdata}\relax}%
+ \xdef\lastlayerypos{\the\dimexpr \MPy{lyr:#1:\layerpage}-\MPy{lyr:\the\currentlayerdata}\relax}}
\def\definelayerpreset
{\dodoubleargument\dodefinelayerpreset}
@@ -290,7 +280,7 @@
\letgvalue{\??ll\currentlayer\layerpage\c!position}\v!yes
\letgvalue{\??ll\currentlayer\c!state}\v!start % needed ?
\setbox\layerbox\vbox to \@@layerysiz
- {\hbox to \@@layerxsiz{\xypos{lyr:\currentlayerdata}\hss}\vss}}
+ {\hbox to \@@layerxsiz{\xypos{lyr:\the\currentlayerdata}\hss}\vss}}
{\setbox\layerbox\emptybox
\globallet\lastlayerxpos\!!zeropoint
\globallet\lastlayerypos\!!zeropoint
diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex
index 5a7ce9d24..c6804704b 100644
--- a/tex/context/base/page-mar.tex
+++ b/tex/context/base/page-mar.tex
@@ -193,8 +193,8 @@
\let \margincontentseparator \empty
\def \margincontentstrutheight {\strutht}
-\newcounter\margincontentlevel
-\newdimen \margincontentheight
+\newcount\margincontentlevel
+\newdimen\margincontentheight
\def\setupinmargin
{\dodoubleempty\dosetupinmargin}
@@ -700,8 +700,8 @@
{\global\chardef\margintextcollected\plusone
\edef\margincontenttag{#1}%
\ifx\margincontenttag\empty
- \doglobal\increment\margincontentlevel
- \let\margincontenttag\margincontentlevel
+ \global\advance\margincontentlevel\plusone
+ \edef\margincontenttag{\number\margincontentlevel}%
\fi
\checkinmargin[\margincontenttag]%
\doglobal \appendetoks
@@ -790,7 +790,7 @@
% Yet undocumented, for a manual flush in for instance headers.
\def\resetmargincontent
- {\doglobal\newcounter\margincontentlevel
+ {\global\margincontentlevel\zerocount
\global\chardef\margintextcollected\zerocount
\global\collectedmargintexts\emptytoks}
diff --git a/tex/context/base/page-str.tex b/tex/context/base/page-str.tex
index ed1638029..1a68adf52 100644
--- a/tex/context/base/page-str.tex
+++ b/tex/context/base/page-str.tex
@@ -145,8 +145,8 @@
\def\setmarknote[#1]#2%
{\doglobal\incrementvalue{mn:#1:n}%
- \setgvalue{mn:#1:t:\getvalue{mn:#1:n}}{#1}%
- \expanded{\marking[#1]{\getvalue{mn:#1:n}}}}
+ \setgvalue{mn:#1:t:\getvalue{mn:#1:n}}{#2}%
+ \expanded{\marking[mn:#1]{\getvalue{mn:#1:n}}}}
\def\flushmarknotes[#1]% assumes split
{\begingroup
diff --git a/tex/context/base/spec-dpx.tex b/tex/context/base/spec-dpx.tex
index 6c4d8e447..3dc82d49e 100644
--- a/tex/context/base/spec-dpx.tex
+++ b/tex/context/base/spec-dpx.tex
@@ -623,22 +623,20 @@
\def\doPDFcheckedDPXobject#1{\ifundefined{r:pdx:d:#1}object\else put\fi\space @#1\space}
-% new, experimental, can save a run
-
-\def\doreservePDFobject#1#2%
- {\dosetobjectreference{#1}{#2}{@#1::#2}}
-
-\def\doPDFreserveddictionaryobject#1#2#3%
- {\flushatshipout{\special{pdf:object @#1::#2 << #3 >>}}}
-
-\def\doPDFreservedarrayobject#1#2#3%
- {\flushatshipout{\special{pdf:object @#1::#2 [ #3 ]}}}
-
-% maybe this is not needed
-
-\doreservePDFobject{FDF}{docuextgstates}
-\doreservePDFobject{FDF}{colorspaces}
-\doreservePDFobject{FDF}{docushades}
+% new, experimental, can save a run, bugged, too many xforms now
+%
+% \def\doreservePDFobject#1#2%
+% {\dosetobjectreference{#1}{#2}{@#1::#2}}
+%
+% \def\doPDFreserveddictionaryobject#1#2#3%
+% {\flushatshipout{\special{pdf:object @#1::#2 << #3 >>}}}
+%
+% \def\doPDFreservedarrayobject#1#2#3%
+% {\flushatshipout{\special{pdf:object @#1::#2 [ #3 ]}}}
+%
+% \doreservePDFobject{FDF}{docuextgstates}
+% \doreservePDFobject{FDF}{colorspaces}
+% \doreservePDFobject{FDF}{docushades}
% so this is to be checked
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index 0e7c62ec4..51da45ff7 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -177,8 +177,8 @@
\def\checkPDFextgstates
{\ifx\docuPDFextgstates\empty \else
\ifnum\realpageno=\lastpage\relax
- %\doreservePDFobject{FDF}{docuextgstates}%
- \doPDFreserveddictionaryobject{FDF}{docuextgstates}{\docuPDFextgstates}%
+ %\doPDFreserveddictionaryobject{FDF}{docuextgstates}{\docuPDFextgstates}%
+ \doPDFdictionaryobject{FDF}{docuextgstates}{\docuPDFextgstates}%
\fi
\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
\doPDFpageresource{/ExtGState \PDFobjectreference}%
@@ -191,28 +191,6 @@
\def\appendtoPDFdocumentextgstates#1%
{\xdef\docuPDFextgstates{\docuPDFextgstates\space#1}}
-% this can save a pass, but we need to handle dpx then first; for
-% that we need a 'direct special'
-%
-% \def\checkPDFextgstates
-% {\ifx\docuPDFextgstates\empty \else
-% \doreservePDFobject{FDF}{docuextgstates}%
-% \gdef\checkPDFextgstates
-% {\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
-% \doPDFpageresource{/ExtGState \PDFobjectreference}}%
-% \checkPDFextgstates
-% \fi}
-%
-% \appendtoksonce
-% \ifx\docuPDFextgstates\empty \else
-% \doPDFreserveddictionaryobject{FDF}{docuextgstates}\docuPDFextgstates
-% \fi
-% \to \everybye
-%
-% \appendtoksonce
-% \checkPDFextgstates
-% \to \everyshipout
-
%D Another special mechanism (needed for color separation):
\let\docuPDFcolorspaces\empty
@@ -220,8 +198,8 @@
\def\checkPDFcolorspaces
{\ifx\docuPDFcolorspaces\empty \else
\ifnum\realpageno=\lastpage\relax
- %\doreservePDFobject{FDF}{colorspaces}%
- \doPDFreserveddictionaryobject{FDF}{colorspaces}{\docuPDFcolorspaces}%
+ %\doPDFreserveddictionaryobject{FDF}{colorspaces}{\docuPDFcolorspaces}%
+ \doPDFdictionaryobject{FDF}{colorspaces}{\docuPDFcolorspaces}%
\fi
\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
\doPDFpageresource{/ColorSpace \PDFobjectreference}%
@@ -241,8 +219,8 @@
\def\checkPDFshades
{\ifx\docuPDFshades\empty \else
\ifnum\realpageno=\lastpage\relax
- %\doreservePDFobject{FDF}{docushades}%
- \doPDFreserveddictionaryobject{FDF}{docushades}{\docuPDFshades}%
+ %\doPDFreserveddictionaryobject{FDF}{docushades}{\docuPDFshades}%
+ \doPDFdictionaryobject{FDF}{docushades}{\docuPDFshades}%
\fi
\doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference
\doPDFpageresource{/Shading \PDFobjectreference}%
@@ -3304,13 +3282,13 @@
\let\collectedPDFresources\empty
-\def\collectPDFresources
- {\doifobjectreferencefoundelse{FDF}{docushades}
+\def\collectPDFresources % suboptimal
+ {\doifobjectreferencefoundelse{FDF}{docushades} % redundant, we have an reserved object now
{\doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference
- \xdef\collectedPDFresources{\collectedPDFresources/Shading \PDFobjectreference}}\donothing
+ \xdef\collectedPDFresources{\collectedPDFresources/Shading \PDFobjectreference}}\donothing
\doifobjectreferencefoundelse{FDF}{docuextgstates}
{\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
- \xdef\collectedPDFresources{\collectedPDFresources/ExtGState \PDFobjectreference}}\donothing
+ \xdef\collectedPDFresources{\collectedPDFresources/ExtGState \PDFobjectreference}}\donothing
\doifobjectreferencefoundelse{FDF}{colorspaces}
{\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
\xdef\collectedPDFresources{\collectedPDFresources/ColorSpace \PDFobjectreference}}\donothing
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 65fbcb06a..b6d2bddf0 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -1235,30 +1235,23 @@
{\immediate\pdfobj{[ #3 ]}%
\dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
-% no, we sometimes need to keep track of the page number too
+% tricky .. too many xforms now
%
-% \def\doPDFdictionaryobject#1#2#3%
-% {\immediate\pdfobj{<< #3 >>}%
-% \dosetobjectreference{#1}{#2}{\the\pdflastobj}}
-% \def\doPDFarrayobject#1#2#3%
-% {\immediate\pdfobj{[ #3 ]}%
-% \dosetobjectreference{#1}{#2}{\the\pdflastobj}}
-
-\def\doreservePDFobject#1#2%
- {\pdfobj reserveobjnum{}%
- \driverreferenced\dosetobjectreference{#1}{#2}{\the\pdflastobj}}
-
-\def\doPDFreserveddictionaryobject#1#2#3%
- {\doPDFgetobjectnumber{#1}{#2}\PDFobjectnumber
- \immediate\pdfobj useobjnum \PDFobjectnumber {<< #3 >>}}
-
-\def\doPDFreservedarrayobject#1#2#3%
- {\doPDFgetobjectnumber{#1}{#2}\PDFobjectnumber
- \immediate\pdfobj useobjnum \PDFobjectnumber {[ #3 ]}}
-
-\doreservePDFobject{FDF}{docuextgstates}
-\doreservePDFobject{FDF}{colorspaces}
-\doreservePDFobject{FDF}{docushades}
+% \def\doreservePDFobject#1#2%
+% {\pdfobj reserveobjnum{}%
+% \driverreferenced\dosetobjectreference{#1}{#2}{\the\pdflastobj}}
+%
+% \def\doPDFreserveddictionaryobject#1#2#3%
+% {\doPDFgetobjectnumber{#1}{#2}\PDFobjectnumber
+% \immediate\pdfobj useobjnum \PDFobjectnumber {<< #3 >>}}
+%
+% \def\doPDFreservedarrayobject#1#2#3%
+% {\doPDFgetobjectnumber{#1}{#2}\PDFobjectnumber
+% \immediate\pdfobj useobjnum \PDFobjectnumber {[ #3 ]}}
+
+% \doreservePDFobject{FDF}{docuextgstates}
+% \doreservePDFobject{FDF}{colorspaces}
+% \doreservePDFobject{FDF}{docushades}
%D \macros
%D {defaultobjectreference,doPDFgetobjectreference}
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index 5e0ff4d94..4d31bfd28 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -81,18 +81,18 @@
%
% support for nested usage:
-\newcounter \endoflinelevel
+\newcount \endoflinelevel
\ifx\newlinecode\undefined \chardef\newlinecode=`\^^M \fi
\def\pushendofline
- {\fastincrement\endoflinelevel
- \expandafter\chardef\csname :eol:\endoflinelevel\endcsname\catcode\newlinecode
+ {\advance\endoflinelevel\plusone
+ \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\newlinecode
\catcode\newlinecode\@@comment\relax}
\def\popendofline
- {\catcode\newlinecode\csname :eol:\endoflinelevel\endcsname
- \fastdecrement\endoflinelevel}
+ {\catcode\newlinecode\csname :eol:\number\endoflinelevel\endcsname
+ \advance\endoflinelevel\minusone}
\def\restoreendofline
{\catcode\newlinecode\@@endofline}
@@ -286,6 +286,8 @@
\newif\iftracefiles
+\newcount\readlevel
+
\def\maxreadlevel{3}
\newconditional\trackfilenames
@@ -338,7 +340,7 @@
\iftracefiles\writestatus\m!systems{#1 located}\fi
\def\next{#2\dodoreadfile}}%
{\iftracefiles\writestatus\m!systems{cannot locate #1}\fi
- \decrement\readlevel\relax
+ \advance\readlevel\minusone
\ifnum\readlevel>\zerocount
\edef\readfilename{\pathplusfile{\f!parentpath}{\readfilename}}%
\def\next{\redoreadfile\readfilename{#2}{#3}}%
@@ -359,7 +361,7 @@
% too less:
%
% \unexpanded\def\readfile% #1%
-% {\let\readlevel\maxreadlevel
+% {\readlevel\maxreadlevel
% \doreadfile\empty} % {#1}
%
% too much:
@@ -398,15 +400,15 @@
%D Due to different needs, we decided to offer four alternative
%D loading commands. With \type{\readjobfile} we load a local
%D file and do no backtracking, while \type{\readlocfile}
-%D backtracks~\readlevel\ directories, including the current
+%D backtracks~\number\readlevel\ directories, including the current
%D one.
\unexpanded\def\readjobfile % #1% current path, no backtracking
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile\f!currentpath} % {#1}}
\unexpanded\def\readlocfile % #1% current path, backtracking
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doreadfile\f!currentpath} % {#1}}
%D System files can be anywhere and therefore
@@ -414,7 +416,7 @@
%D and obeys the \TEX\ implementation.
\unexpanded\def\readsysfile % #1% current path, obeys tex search
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile\empty} % {#1}}
%D Of the last two, \type{\readfixfile} searches on the
@@ -422,11 +424,11 @@
%D \type{\readsetfile} does only search on the specified path.
\unexpanded\def\readfixfile % #1#2% specified path, backtracking
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doreadfile} % {#1}{#2}}
\unexpanded\def\readsetfile % #1#2% specified path, no backtracking
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile} % {#1}{#2}}
%D After having defined this commands, we reconsidered the
@@ -461,7 +463,7 @@
{\sanitizefilename#2\to\readfilename
\checkfilename\readfilename
\ifcase\kindoffile
- \increment\readlevel
+ \advance\readlevel\plusone
\openinputfile{#1}\readfilename
\ifeof#1% \relax
\ifnum\readlevel>\maxreadlevel % \relax
@@ -473,19 +475,19 @@
\fi}
\def\openjobin#1#2%
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doopenin{#1}{\pathplusfile\f!currentpath{#2}}}
\def\opensysin % #1#2%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin} % {#1}{#2}}
\def\openlocin#1#2%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin{#1}{\pathplusfile\f!currentpath{#2}}}
\def\openfixin#1#2#3%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin{#1}{\pathplusfile{#2}{#3}}}
%D \macros
@@ -576,7 +578,7 @@
\def\normalequal {=} % geen \let !
\def\normaldblquote{"} % geen \let !
-\newcounter\readingfilelevel
+\newcount\readingfilelevel
\def\popfilecharacter#1#2%
{\ifnum\catcode`#1=\@@other \ifnum#2=\@@other \else
@@ -596,43 +598,8 @@
\newtoks \everystartreadingfile
\newtoks \everystopreadingfile
-% \def\startreadingfile% beter een every en \setnormalcatcodes
-% {\doglobal\increment\readingfilelevel
-% \the\everystartreadingfile
-% \setxvalue{\string\readingfilelevel::\readingfilelevel}%
-% {\catcode`/ =\the\catcode`/%
-% %\catcode`_ =\the\catcode`_% math ! ! !
-% \catcode`" =\the\catcode`"%
-% \catcode`: =\the\catcode`:%
-% \catcode`; =\the\catcode`;%
-% \catcode`< =\the\catcode`<%
-% \catcode`> =\the\catcode`>%
-% \catcode`\noexpand\\=\the\catcode`\\%
-% \catcode`\noexpand\{=\the\catcode`\{%
-% \catcode`\noexpand\}=\the\catcode`\}%
-% \catcode`\noexpand\%=\the\catcode`\%}%
-% \catcode`/ =\@@other
-% %\catcode`_ =\@@other
-% \catcode`" =\@@other
-% \catcode`: =\@@other
-% \catcode`; =\@@other
-% \catcode`< =\@@other
-% \catcode`> =\@@other
-% \catcode`\\=\@@escape
-% \catcode`\{=\@@begingroup
-% \catcode`\}=\@@endgroup
-% \catcode`\%=\@@comment
-% \pushendofline
-% \restoreendofline}
-
-% \def\stopreadingfile
-% {\popendofline
-% \getvalue{\string\readingfilelevel::\readingfilelevel}%
-% \the\everystopreadingfile
-% \doglobal\decrement\readingfilelevel}
-
\def\startreadingfile% beter een every en \setnormalcatcodes
- {\doglobal\increment\readingfilelevel
+ {\global\advance\readingfilelevel\plusone
\the\everystartreadingfile
\beginrestorecatcodes
\setcatcodetable\prtcatcodes}
@@ -640,7 +607,7 @@
\def\stopreadingfile
{\endrestorecatcodes
\the\everystopreadingfile
- \doglobal\decrement\readingfilelevel}
+ \global\advance\readingfilelevel\minusone}
\let\normalstartreadingfile\startreadingfile
\let\normalstopreadingfile \stopreadingfile
@@ -682,57 +649,6 @@
\let\splitfilename\gobbleoneargument % defined in mk
\let\splitfiletype\gobbleoneargument % defined in mk
-
-%% % gebruikt voor normale (!) files, will change to proper
-%% % installer maybe combined with verb module push/popper
-%%
-%% \def\startreadingfile% beter een every
-%% {\doglobal\increment\readingfilelevel
-%% \setxvalue{popfilecharacters::\readingfilelevel}%
-%% {%\expnormalcatcodes
-%% \expspecialcatcodes}%
-%% %\setnormalcatcodes
-%% \setspecialcatcodes}
-%%
-%% \def\stopreadingfile%
-%% {\getvalue{popfilecharacters::\readingfilelevel}%
-%% \doglobal\decrement\readingfilelevel}
-%%
-%% \ifx\\\undefined \let\\\relax \fi
-%% \ifx\!\undefined \let\!\relax \fi
-%% \ifx\?\undefined \let\?\relax \fi
-%%
-%% \def\expnormalcatcodes%
-%% {\catcode`\noexpand\!=\the\catcode`\! \catcode`\noexpand\?=\the\catcode`\?%
-%% \catcode`\noexpand\&=\the\catcode`\&
-%% \catcode`\noexpand\#=\the\catcode`\# \catcode`\noexpand\$=\the\catcode`\$%
-%% \catcode`\noexpand\%=\the\catcode`\% \catcode`\noexpand\\=\the\catcode`\\%
-%% \catcode`\noexpand\^=\the\catcode`\^ \catcode`\noexpand\_=\the\catcode`\_%
-%% \catcode`\noexpand\{=\the\catcode`\{ \catcode`\noexpand\}=\the\catcode`\}}
-%%
-%% \def\setnormalcatcodes%
-%% {%\ifcase\protectionlevel
-%% \catcode`\!=\@@other \catcode`\?=\@@other
-%% %\else
-%% % \catcode`\!=\@@letter \catcode`\?=\@@letter
-%% %\fi
-%% \catcode`\&=\@@alignment
-%% \catcode`\#=\@@parameter \catcode`\$=\@@mathshift
-%% \catcode`\%=\@@comment \catcode`\\=\@@escape
-%% \catcode`\^=\@@superscript \catcode`\_=\@@subscript
-%% \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup}
-%%
-%% \def\expspecialcatcodes%
-%% {\catcode`\noexpand/=\the\catcode`/%
-%% \catcode`\noexpand"=\the\catcode`"%
-%% \catcode`\noexpand<=\the\catcode`<%
-%% \catcode`\noexpand>=\the\catcode`>}
-%%
-%% \def\setspecialcatcodes%
-%% {\catcode`/=\@@other
-%% \catcode`"=\@@other
-%% \catcode`<=\@@other
-%% \catcode`>=\@@other}
\loadmarkfile{supp-fil}
diff --git a/tex/context/base/type-cow.tex b/tex/context/base/type-cow.tex
index 027f6b6b7..bda8489a5 100644
--- a/tex/context/base/type-cow.tex
+++ b/tex/context/base/type-cow.tex
@@ -67,12 +67,14 @@
\stoptypescript
\starttypescript [cow] [default]
+ \definetypeface [cow] [rm][serif][cow] [default][encoding=default]
\definetypeface [cow] [ss][serif][cow] [default][encoding=default]
\definetypeface [cow] [mm][math] [cow] [default][encoding=default]
\definetypeface [cow] [tt][mono] [modern][default][encoding=default,rscale=.85]
\stoptypescript
\starttypescript [sheep] [default]
+ \definetypeface [sheep][rm][serif][sheep] [default][encoding=default]
\definetypeface [sheep][ss][serif][sheep] [default][encoding=default]
\definetypeface [sheep][mm][math] [sheep] [default][encoding=default]
\definetypeface [sheep][tt][mono] [modern][default][encoding=default,rscale=.85]
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 894d25657..bda7c06bd 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 4ca09a22d..52db3de60 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index 102fcf0e6..1a199b682 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index d843caba6..5630bfa35 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index a97d897a6..df32ab3ac 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index cc340e462..5360c60ac 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index bdc1a3358..cfdc9424d 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.11 00:07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.15 22:29">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>