summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-10-29 16:50:11 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-10-29 16:50:11 +0100
commit7fc4b935d045c84e89459e726ff54ae331e4c574 (patch)
tree0a4587b2e4f72ccb5feff81c348c5138f4ece7e7 /tex/context/base
parentd91c37679b13162a4ead85abbe564090b2e1b51c (diff)
downloadcontext-7fc4b935d045c84e89459e726ff54ae331e4c574.tar.gz
2017-10-29 15:50:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-cs.mkii1
-rw-r--r--tex/context/base/mkii/mult-de.mkii1
-rw-r--r--tex/context/base/mkiv/anch-pgr.lua1
-rw-r--r--tex/context/base/mkiv/char-def.lua1
-rw-r--r--tex/context/base/mkiv/colo-icc.lua1
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/cont-run.lua4
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/core-con.lua182
-rw-r--r--tex/context/base/mkiv/core-env.lua4
-rw-r--r--tex/context/base/mkiv/font-chk.lua5
-rw-r--r--tex/context/base/mkiv/font-con.lua11
-rw-r--r--tex/context/base/mkiv/font-ctx.lua39
-rw-r--r--tex/context/base/mkiv/font-def.lua2
-rw-r--r--tex/context/base/mkiv/font-ext.lua10
-rw-r--r--tex/context/base/mkiv/font-ini.mkvi2
-rw-r--r--tex/context/base/mkiv/font-map.lua2
-rw-r--r--tex/context/base/mkiv/font-mps.lua16
-rw-r--r--tex/context/base/mkiv/font-ocl.lua4
-rw-r--r--tex/context/base/mkiv/grph-inc.lua2
-rw-r--r--tex/context/base/mkiv/l-io.lua10
-rw-r--r--tex/context/base/mkiv/l-lua.lua52
-rw-r--r--tex/context/base/mkiv/l-table.lua23
-rw-r--r--tex/context/base/mkiv/l-unicode.lua245
-rw-r--r--tex/context/base/mkiv/lpdf-col.lua5
-rw-r--r--tex/context/base/mkiv/lpdf-epa.lua4
-rw-r--r--tex/context/base/mkiv/lpdf-fld.lua60
-rw-r--r--tex/context/base/mkiv/lpdf-grp.lua4
-rw-r--r--tex/context/base/mkiv/lpdf-ini.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-mis.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-u3d.lua2
-rw-r--r--tex/context/base/mkiv/luat-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/math-ini.lua11
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv7
-rw-r--r--tex/context/base/mkiv/math-map.lua1
-rw-r--r--tex/context/base/mkiv/meta-fnt.lua4
-rw-r--r--tex/context/base/mkiv/meta-tex.lua2
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua4
-rw-r--r--tex/context/base/mkiv/mult-prm.lua1
-rw-r--r--tex/context/base/mkiv/node-ltp.lua1
-rw-r--r--tex/context/base/mkiv/page-cst.lua2
-rw-r--r--tex/context/base/mkiv/page-mix.lua2
-rw-r--r--tex/context/base/mkiv/publ-dat.lua19
-rw-r--r--tex/context/base/mkiv/publ-ini.lua33
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25756 -> 25838 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin246783 -> 249883 bytes
-rw-r--r--tex/context/base/mkiv/supp-ran.lua2
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv1
-rw-r--r--tex/context/base/mkiv/toks-ini.lua40
-rw-r--r--tex/context/base/mkiv/trac-inf.lua3
-rw-r--r--tex/context/base/mkiv/typo-cap.lua2
-rw-r--r--tex/context/base/mkiv/typo-del.mkiv4
-rw-r--r--tex/context/base/mkiv/typo-dha.lua1
-rw-r--r--tex/context/base/mkiv/typo-dir.lua7
-rw-r--r--tex/context/base/mkiv/util-dim.lua2
-rw-r--r--tex/context/base/mkiv/util-lua.lua1
-rw-r--r--tex/context/base/mkiv/util-sto.lua23
-rw-r--r--tex/context/base/mkiv/util-str.lua16
60 files changed, 526 insertions, 372 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 54acbd16e..fb24a8705 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.10.24 10:30}
+\newcontextversion{2017.10.29 15:44}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 99243fd9d..9bdd54063 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.10.24 10:30}
+\edef\contextversion{2017.10.29 15:44}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii
index 85297dd12..61ddaa391 100644
--- a/tex/context/base/mkii/mult-cs.mkii
+++ b/tex/context/base/mkii/mult-cs.mkii
@@ -796,6 +796,7 @@
\setinterfaceconstant{fieldoffset}{offsetpole}
\setinterfaceconstant{file}{soubor}
\setinterfaceconstant{filler}{filler}
+\setinterfaceconstant{filter}{filter}
\setinterfaceconstant{filtercommand}{filtercommand}
\setinterfaceconstant{finalnamesep}{finalnamesep}
\setinterfaceconstant{finalpagesep}{finalpagesep}
diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii
index 3fd291e1e..5f8545a90 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -796,6 +796,7 @@
\setinterfaceconstant{fieldoffset}{feldoffset}
\setinterfaceconstant{file}{datei}
\setinterfaceconstant{filler}{filler}
+\setinterfaceconstant{filter}{filter}
\setinterfaceconstant{filtercommand}{filtercommand}
\setinterfaceconstant{finalnamesep}{finalnamesep}
\setinterfaceconstant{finalpagesep}{finalpagesep}
diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua
index ba767ccab..18a915692 100644
--- a/tex/context/base/mkiv/anch-pgr.lua
+++ b/tex/context/base/mkiv/anch-pgr.lua
@@ -17,7 +17,6 @@ if not modules then modules = { } end modules ['anch-pgr'] = {
-- will discuss this issue.
local tonumber = tonumber
-local abs, div, floor, round, min, max = math.abs, math.div, math.floor, math.round, math.min, math.max
local sort, concat = table.sort, table.concat
local splitter = lpeg.splitat(":")
local lpegmatch = lpeg.match
diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua
index c35832cc3..58e1f2c44 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -64078,7 +64078,6 @@ characters.data={
direction="on",
linebreak="al",
mathclass="binary",
- mathname="bullet",
unicodeslot=0x2219,
},
[0x221A]={
diff --git a/tex/context/base/mkiv/colo-icc.lua b/tex/context/base/mkiv/colo-icc.lua
index f7ed561c1..638c6c4c4 100644
--- a/tex/context/base/mkiv/colo-icc.lua
+++ b/tex/context/base/mkiv/colo-icc.lua
@@ -8,7 +8,6 @@ if not modules then modules = { } end modules ['colo-icc'] = {
local char, byte, gsub, match, format, strip = string.char, string.byte, string.gsub, string.match, string.format, string.strip
local readstring, readnumber = io.readstring, io.readnumber
-local formatters = string.formatters
local colors = attributes and attributes.colors or { } -- when used in mtxrun
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 7127cfc4c..596562074 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.10.24 10:30}
+\newcontextversion{2017.10.29 15:44}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua
index 657973f59..73620adb6 100644
--- a/tex/context/base/mkiv/cont-run.lua
+++ b/tex/context/base/mkiv/cont-run.lua
@@ -34,9 +34,9 @@ local logfilename = "sandbox.log"
local function registerstats()
statistics.register("sandboxing", function()
if trace_files then
- return string.format("%s calls, %s rejected, logdata in '%s'",nofcalls,nofrejected,logfilename)
+ return string.format("%i calls, %i rejected, logdata in '%s'",nofcalls,nofrejected,logfilename)
else
- return string.format("%s calls, %s rejected",nofcalls,nofrejected)
+ return string.format("%i calls, %i rejected",nofcalls,nofrejected)
end
end)
registerstats = false
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index a2cf1f308..34a8d186c 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.10.24 10:30}
+\edef\contextversion{2017.10.29 15:44}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/core-con.lua b/tex/context/base/mkiv/core-con.lua
index 41d0956cd..edba24f10 100644
--- a/tex/context/base/mkiv/core-con.lua
+++ b/tex/context/base/mkiv/core-con.lua
@@ -901,39 +901,39 @@ converters.verbose = verbose
-- verbose english
local words = {
- [0] = "zero",
- [1] = "one",
- [2] = "two",
- [3] = "three",
- [4] = "four",
- [5] = "five",
- [6] = "six",
- [7] = "seven",
- [8] = "eight",
- [9] = "nine",
- [10] = "ten",
- [11] = "eleven",
- [12] = "twelve",
- [13] = "thirteen",
- [14] = "fourteen",
- [15] = "fifteen",
- [16] = "sixteen",
- [17] = "seventeen",
- [18] = "eighteen",
- [19] = "nineteen",
- [20] = "twenty",
- [30] = "thirty",
- [40] = "forty",
- [50] = "fifty",
- [60] = "sixty",
- [70] = "seventy",
- [80] = "eighty",
- [90] = "ninety",
- [100] = "hundred",
- [1000] = "thousand",
- [1000^2] = "million",
- [1000^3] = "billion",
- [1000^4] = "trillion",
+ [0] = "zero",
+ [1] = "one",
+ [2] = "two",
+ [3] = "three",
+ [4] = "four",
+ [5] = "five",
+ [6] = "six",
+ [7] = "seven",
+ [8] = "eight",
+ [9] = "nine",
+ [10] = "ten",
+ [11] = "eleven",
+ [12] = "twelve",
+ [13] = "thirteen",
+ [14] = "fourteen",
+ [15] = "fifteen",
+ [16] = "sixteen",
+ [17] = "seventeen",
+ [18] = "eighteen",
+ [19] = "nineteen",
+ [20] = "twenty",
+ [30] = "thirty",
+ [40] = "forty",
+ [50] = "fifty",
+ [60] = "sixty",
+ [70] = "seventy",
+ [80] = "eighty",
+ [90] = "ninety",
+ [100] = "hundred",
+ [1000] = "thousand",
+ [1000000] = "million",
+ [1000000000] = "billion",
+ [1000000000000] = "trillion",
}
local function translate(n)
@@ -979,10 +979,10 @@ local function translate(n)
end
return n
end
- n = compose_two(n,1000^4)
- n = compose_two(n,1000^3)
- n = compose_two(n,1000^2)
- n = compose_two(n,1000^1)
+ n = compose_two(n,1000000000000)
+ n = compose_two(n,1000000000)
+ n = compose_two(n,1000000)
+ n = compose_two(n,1000)
if n > 0 then
compose_one(n)
end
@@ -1007,55 +1007,55 @@ data.en = data.english
-- verbose spanish (unchecked)
local words = {
- [1] = "uno",
- [2] = "dos",
- [3] = "tres",
- [4] = "cuatro",
- [5] = "cinco",
- [6] = "seis",
- [7] = "siete",
- [8] = "ocho",
- [9] = "nueve",
- [10] = "diez",
- [11] = "once",
- [12] = "doce",
- [13] = "trece",
- [14] = "catorce",
- [15] = "quince",
- [16] = "dieciséis",
- [17] = "diecisiete",
- [18] = "dieciocho",
- [19] = "diecinueve",
- [20] = "veinte",
- [21] = "veintiuno",
- [22] = "veintidós",
- [23] = "veintitrés",
- [24] = "veinticuatro",
- [25] = "veinticinco",
- [26] = "veintiséis",
- [27] = "veintisiete",
- [28] = "veintiocho",
- [29] = "veintinueve",
- [30] = "treinta",
- [40] = "cuarenta",
- [50] = "cincuenta",
- [60] = "sesenta",
- [70] = "setenta",
- [80] = "ochenta",
- [90] = "noventa",
- [100] = "ciento",
- [200] = "doscientos",
- [300] = "trescientos",
- [400] = "cuatrocientos",
- [500] = "quinientos",
- [600] = "seiscientos",
- [700] = "setecientos",
- [800] = "ochocientos",
- [900] = "novecientos",
- [1000] = "mil",
- [1000^2] = "millón",
- [1000^3] = "mil millones",
- [1000^4] = "billón",
+ [1] = "uno",
+ [2] = "dos",
+ [3] = "tres",
+ [4] = "cuatro",
+ [5] = "cinco",
+ [6] = "seis",
+ [7] = "siete",
+ [8] = "ocho",
+ [9] = "nueve",
+ [10] = "diez",
+ [11] = "once",
+ [12] = "doce",
+ [13] = "trece",
+ [14] = "catorce",
+ [15] = "quince",
+ [16] = "dieciséis",
+ [17] = "diecisiete",
+ [18] = "dieciocho",
+ [19] = "diecinueve",
+ [20] = "veinte",
+ [21] = "veintiuno",
+ [22] = "veintidós",
+ [23] = "veintitrés",
+ [24] = "veinticuatro",
+ [25] = "veinticinco",
+ [26] = "veintiséis",
+ [27] = "veintisiete",
+ [28] = "veintiocho",
+ [29] = "veintinueve",
+ [30] = "treinta",
+ [40] = "cuarenta",
+ [50] = "cincuenta",
+ [60] = "sesenta",
+ [70] = "setenta",
+ [80] = "ochenta",
+ [90] = "noventa",
+ [100] = "ciento",
+ [200] = "doscientos",
+ [300] = "trescientos",
+ [400] = "cuatrocientos",
+ [500] = "quinientos",
+ [600] = "seiscientos",
+ [700] = "setecientos",
+ [800] = "ochocientos",
+ [900] = "novecientos",
+ [1000] = "mil",
+ [1000000] = "millón",
+ [1000000000] = "mil millones",
+ [1000000000000] = "billón",
}
local function translate(n)
@@ -1078,7 +1078,7 @@ local function translate(n)
t[#t+1] = words[1000]
-- x hundred (n.b. this will not give thirteen hundred because
-- compose_one(n) is only called after
- -- `n = compose(two(n, 1000^1))`.
+ -- n = compose(two(n, 1000))
elseif a > 0 then
t[#t+1] = words[a*100]
end
@@ -1106,10 +1106,10 @@ local function translate(n)
end
return n
end
- n = compose_two(n,1000^4)
- n = compose_two(n,1000^3)
- n = compose_two(n,1000^2)
- n = compose_two(n,1000^1)
+ n = compose_two(n,1000000000000)
+ n = compose_two(n,1000000000)
+ n = compose_two(n,1000000)
+ n = compose_two(n,1000)
if n > 0 then
compose_one(n)
end
diff --git a/tex/context/base/mkiv/core-env.lua b/tex/context/base/mkiv/core-env.lua
index 583a6ed1e..0ef37a6d6 100644
--- a/tex/context/base/mkiv/core-env.lua
+++ b/tex/context/base/mkiv/core-env.lua
@@ -57,7 +57,7 @@ setmetatableindex(texmodes, function(t,k)
local m = modes[k]
if m then
return m()
- else
+ elseif k then
local n = "mode>" .. k
if cache[n].mode == 0 then
return false
@@ -65,6 +65,8 @@ setmetatableindex(texmodes, function(t,k)
rawset(modes,k, function() return texgetcount(n) == 1 end)
return texgetcount(n) == 1 -- 2 is prevented
end
+ else
+ return false
end
end)
setmetatablenewindex(texmodes, function(t,k)
diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua
index d9bb497ad..106749078 100644
--- a/tex/context/base/mkiv/font-chk.lua
+++ b/tex/context/base/mkiv/font-chk.lua
@@ -10,6 +10,7 @@ if not modules then modules = { } end modules ['font-chk'] = {
-- move to the nodes namespace
local next = next
+local floor = math.floor
local context = context
@@ -190,7 +191,7 @@ local variants = allocate {
{ tag = "yellow", r = .6, g = .6, b = 0 },
}
-local pdf_blob = "pdf: q %0.6F 0 0 %0.6F 0 0 cm %s %s %s rg %s %s %s RG 10 M 1 j 1 J 0.05 w %s Q"
+local pdf_blob = "pdf: q %.6F 0 0 %.6F 0 0 cm %s %s %s rg %s %s %s RG 10 M 1 j 1 J 0.05 w %s Q"
local cache = { } -- saves some tables but not that impressive
@@ -217,7 +218,7 @@ local function addmissingsymbols(tfmdata) -- we can have an alternative with rul
local name = fake.name
local privatename = formatters["placeholder %s %s"](name,tag)
if not hasprivate(tfmdata,privatename) then
- local hash = formatters["%s_%s_%s_%s_%s_%s"](name,tag,r,g,b,size)
+ local hash = formatters["%s_%s_%1.3f_%1.3f_%1.3f_%i"](name,tag,r,g,b,floor(size))
local char = cache[hash]
if not char then
char = {
diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua
index 75d6b08a8..2dce9b6e4 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -14,6 +14,7 @@ local sort, insert, concat = table.sort, table.insert, table.concat
local sortedkeys, sortedhash, serialize, fastcopy = table.sortedkeys, table.sortedhash, table.serialize, table.fastcopy
local derivetable = table.derive
local ioflush = io.flush
+local round = math.round
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
local trace_scaling = false trackers.register("fonts.scaling", function(v) trace_scaling = v end)
@@ -1037,13 +1038,15 @@ function constructors.hashinstance(specification,force)
specification.hash = hash
end
if size < 1000 and designsizes[hash] then
- size = math.round(constructors.scaled(size,designsizes[hash]))
- specification.size = size
+ size = round(constructors.scaled(size,designsizes[hash]))
+ else
+ size = round(size)
end
+ specification.size = size
if fallbacks then
- return hash .. ' @ ' .. tostring(size) .. ' @ ' .. fallbacks
+ return hash .. ' @ ' .. size .. ' @ ' .. fallbacks
else
- return hash .. ' @ ' .. tostring(size)
+ return hash .. ' @ ' .. size
end
end
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 89466eca8..ec7eabb53 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -158,7 +158,7 @@ helpers.name = getfontname
local addformatter = utilities.strings.formatters.add
-if _LUAVERSION < 5.2 then
+if LUAVERSION < 5.2 then
addformatter(formatters,"font:name", [["'"..fontname(%s).."'"]], "local fontname = fonts.helpers.name")
addformatter(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],"local sequenced = table.sequenced")
@@ -1056,7 +1056,6 @@ do -- else too many locals
local scanboolean = scanners.boolean
local setmacro = tokens.setters.macro
-
local scanners = interfaces.scanners
-- function commands.definefont_one(str)
@@ -1456,7 +1455,7 @@ do -- else too many locals
name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,2)
end
-- resolved (when designsize is used):
- local size = tfmdata.parameters.size or 655360
+ local size = round(tfmdata.parameters.size or 655360)
setmacro("somefontsize",size.."sp")
-- ctx_setsomefontsize(size .. "sp")
texsetcount("scaledfontsize",size)
@@ -1493,7 +1492,7 @@ do -- else too many locals
name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-")
end
-- resolved (when designsize is used):
- local size = tfmdata.parameters.size or 655360
+ local size = round(tfmdata.parameters.size or 655360)
setmacro("somefontsize",size.."sp")
-- ctx_setsomefontsize(size .. "sp")
texsetcount("scaledfontsize",size)
@@ -1507,7 +1506,7 @@ do -- else too many locals
csnames[tfmdata] = specification.cs
texdefinefont(global,cs,tfmdata)
-- resolved (when designsize is used):
- local size = fontdata[tfmdata].parameters.size or 0
+ local size = round(fontdata[tfmdata].parameters.size or 0)
-- ctx_setsomefontsize(size .. "sp")
setmacro("somefontsize",size.."sp")
texsetcount("scaledfontsize",size)
@@ -1668,7 +1667,7 @@ do -- else too many locals
function fonts.infofont()
if infofont == 0 then
- infofont = definers.define { name = "dejavusansmono", size = tex.sp("6pt") }
+ infofont = definers.define { name = "dejavusansmono", size = texsp("6pt") }
end
return infofont
end
@@ -1726,7 +1725,7 @@ function constructors.calculatescale(tfmdata,scaledpoints,relativeid,specificati
-- scaledpoints = rscale * scaledpoints
-- end
-- end
- return scaledpoints, delta
+ return round(scaledpoints), round(delta)
end
local designsizes = constructors.designsizes
@@ -1744,17 +1743,19 @@ function constructors.hashinstance(specification,force)
end
if size < 1000 and designsizes[hash] then
size = round(constructors.scaled(size,designsizes[hash]))
- specification.size = size
+ else
+ size = round(size)
end
+ specification.size = size
if fallbacks then
- return hash .. ' @ ' .. tostring(size) .. ' @ ' .. fallbacks
+ return hash .. ' @ ' .. size .. ' @ ' .. fallbacks
else
local scalemode = specification.scalemode
local special = scalemode and specialscale[scalemode]
if special then
- return hash .. ' @ ' .. tostring(size) .. ' @ ' .. special
+ return hash .. ' @ ' .. size .. ' @ ' .. special
else
- return hash .. ' @ ' .. tostring(size)
+ return hash .. ' @ ' .. size
end
end
end
@@ -2116,14 +2117,14 @@ function loggers.reportdefinedfonts()
local parameters = data.parameters or { }
tn = tn + 1
t[tn] = {
- format("%03i",id or 0),
- format("%09i",parameters.size or 0),
- properties.type or "real",
- properties.format or "unknown",
- properties.name or "",
- properties.psname or "",
- properties.fullname or "",
- properties.sharedwith or "",
+ formatters["%03i"](id or 0),
+ formatters["%p" ](parameters.size or 0),
+ properties.type or "real",
+ properties.format or "unknown",
+ properties.name or "",
+ properties.psname or "",
+ properties.fullname or "",
+ properties.sharedwith or "",
}
end
formatcolumns(t," ")
diff --git a/tex/context/base/mkiv/font-def.lua b/tex/context/base/mkiv/font-def.lua
index 19d980e48..97d25f180 100644
--- a/tex/context/base/mkiv/font-def.lua
+++ b/tex/context/base/mkiv/font-def.lua
@@ -512,7 +512,7 @@ function definers.read(specification,size,id) -- id can be optional, name can al
local properties = tfmdata.properties or { }
local parameters = tfmdata.parameters or { }
report_defining("using %a font with id %a, name %a, size %a, bytes %a, encoding %a, fullname %a, filename %a",
- properties.format or "unknown", id, properties.name, parameters.size, properties.encodingbytes,
+ properties.format or "unknown", id or "-", properties.name, parameters.size, properties.encodingbytes,
properties.encodingname, properties.fullname, basename(properties.filename))
end
statistics.stoptiming(fonts)
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index 6020d6374..a393b18fe 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -772,7 +772,7 @@ local pop = { "pop" }
-- local h = h * bp
-- local v = setmetatableindex(function(t,w)
-- -- local v = { "rule", h, w }
--- local v = { "pdf", "origin", formatters["0 0 %0.6F %0.6F re F"](w*bp,h) }
+-- local v = { "pdf", "origin", formatters["0 0 %.6F %.6F re F"](w*bp,h) }
-- t[w] = v
-- return v
-- end)
@@ -783,7 +783,7 @@ local pop = { "pop" }
-- local forecache = setmetatableindex(function(t,h)
-- local h = h * bp
-- local v = setmetatableindex(function(t,w)
--- local v = { "pdf", "origin", formatters["%0.6F w 0 0 %0.6F %0.6F re S"](0.25*65536*bp,w*bp,h) }
+-- local v = { "pdf", "origin", formatters["%.6F w 0 0 %.6F %.6F re S"](0.25*65536*bp,w*bp,h) }
-- t[w] = v
-- return v
-- end)
@@ -799,7 +799,7 @@ local backcache = setmetatableindex(function(t,h)
local v = setmetatableindex(function(t,d)
local d = d * bp
local v = setmetatableindex(function(t,w)
- local v = { "pdf", "origin", formatters["%0.6F w 0 %0.6F %0.6F %0.6F re f"](r,-d,w*bp,h+d) }
+ local v = { "pdf", "origin", formatters["%.6F w 0 %.6F %.6F %.6F re f"](r,-d,w*bp,h+d) }
t[w] = v
return v
end)
@@ -816,8 +816,8 @@ local forecache = setmetatableindex(function(t,h)
local d = d * bp
local v = setmetatableindex(function(t,w)
-- the frame goes through the boundingbox
- -- local v = { "pdf", "origin", formatters["[] 0 d 0 J %0.6F w 0 %0.6F %0.6F %0.6F re S"](r,-d,w*bp,h+d) }
- local v = { "pdf", "origin", formatters["[] 0 d 0 J %0.6F w %0.6F %0.6F %0.6F %0.6F re S"](r,r/2,-d+r/2,w*bp-r,h+d-r) }
+ -- local v = { "pdf", "origin", formatters["[] 0 d 0 J %.6F w %.6F %.6F %.6F re S"](r,-d,w*bp,h+d) }
+ local v = { "pdf", "origin", formatters["[] 0 d 0 J %.6F w %.6F %.6F %.6F %.6F re S"](r,r/2,-d+r/2,w*bp-r,h+d-r) }
t[w] = v
return v
end)
diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi
index c0121c18b..c4445b7b9 100644
--- a/tex/context/base/mkiv/font-ini.mkvi
+++ b/tex/context/base/mkiv/font-ini.mkvi
@@ -835,7 +835,7 @@
\fi
\font_helpers_update_font_parameters
\font_helpers_update_font_class_parameters
- % \writestatus{fonts}{low level define: #csname/\somefontfile/\number\d_font_scaled_font_size/\fontface/\number\d_font_scaled_text_face}%
+ %\writestatus{fonts}{low level define: #csname/\somefontfile/\number\d_font_scaled_font_size/\fontface/\number\d_font_scaled_text_face}%
\clf_definefont_two
\ifx\fontclass\empty\s!false\else\s!true\fi
{#csname}%
diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua
index 0fc525805..ebc74b1d0 100644
--- a/tex/context/base/mkiv/font-map.lua
+++ b/tex/context/base/mkiv/font-map.lua
@@ -165,7 +165,7 @@ local function tounicode16sequence(unicodes)
return concat(t)
end
-local function tounicode(unicode,name)
+local function tounicode(unicode)
if type(unicode) == "table" then
local t = { }
for l=1,#unicode do
diff --git a/tex/context/base/mkiv/font-mps.lua b/tex/context/base/mkiv/font-mps.lua
index 69b2af68c..cde34f2ae 100644
--- a/tex/context/base/mkiv/font-mps.lua
+++ b/tex/context/base/mkiv/font-mps.lua
@@ -21,9 +21,9 @@ fonts = fonts or { }
local metapost = fonts.metapost or { }
fonts.metapost = metapost
-local f_moveto = formatters["(%F,%F)"]
-local f_lineto = formatters["--(%F,%F)"]
-local f_curveto = formatters["..controls(%F,%F)and(%F,%F)..(%F,%F)"]
+local f_moveto = formatters["(%.6F,%.6F)"]
+local f_lineto = formatters["--(%.6F,%.6F)"]
+local f_curveto = formatters["..controls(%.6F,%.6F)and(%.6F,%.6F)..(%.6F,%.6F)"]
local s_cycle = "--cycle"
local f_nofill = formatters["nofill %s;"]
@@ -32,8 +32,8 @@ local f_dofill = formatters["fill %s;"]
local f_draw_trace = formatters["drawpathonly %s;"]
local f_draw = formatters["draw %s;"]
-local f_boundingbox = formatters["((%F,%F)--(%F,%F)--(%F,%F)--(%F,%F)--cycle)"]
-local f_vertical = formatters["((%F,%F)--(%F,%F))"]
+local f_boundingbox = formatters["((%.6F,%.6F)--(%.6F,%.6F)--(%.6F,%.6F)--(%.6F,%.6F)--cycle)"]
+local f_vertical = formatters["((%.6F,%.6F)--(%.6F,%.6F))"]
function metapost.boundingbox(d,factor)
local bounds = d.boundingbox
@@ -275,9 +275,9 @@ local parameters = fonts.hashes.parameters
local shapes = fonts.hashes.shapes
local topaths = metapost.paths
-local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%F,%F)(%,t);"]
-local f_rule = formatters["mfun_do_outline_rule_flush(%q,%F,%F,%F,%F);"]
-local f_bounds = formatters["checkbounds(%F,%F,%F,%F);"]
+local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%.6F,%.6F)(%,t);"]
+local f_rule = formatters["mfun_do_outline_rule_flush(%q,%.6F,%.6F,%.6F,%.6F);"]
+local f_bounds = formatters["checkbounds(%.6F,%.6F,%.6F,%.6F);"]
local s_nothing = "(origin scaled 10)"
local sc = 10
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index b9671ab18..872247d43 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -18,8 +18,8 @@ local tounicode = fonts.mappings.tounicode
local otf = fonts.handlers.otf
-local f_color = formatters["%f %f %f rg"]
-local f_gray = formatters["%f g"]
+local f_color = formatters["%.3f %.3f %.3f rg"]
+local f_gray = formatters["%.3f g"]
if context then
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index 70f5e528f..be6d365f1 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -103,7 +103,7 @@ local v_local = variables["local"]
local v_default = variables.default
local v_auto = variables.auto
-local maxdimen = 2^30-1
+local maxdimen = 0x3FFFFFFF -- 2^30-1
local ctx_doscalefigure = context.doscalefigure
local ctx_relocateexternalfigure = context.relocateexternalfigure
diff --git a/tex/context/base/mkiv/l-io.lua b/tex/context/base/mkiv/l-io.lua
index 75e704a34..fa3ad3c4c 100644
--- a/tex/context/base/mkiv/l-io.lua
+++ b/tex/context/base/mkiv/l-io.lua
@@ -10,7 +10,7 @@ local io = io
local open, flush, write, read = io.open, io.flush, io.write, io.read
local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format
local concat = table.concat
-local floor = math.floor
+----- floor = math.floor
local type = type
if string.find(os.getenv("PATH"),";",1,true) then
@@ -27,9 +27,9 @@ end
-- to less intermediate large allocations. This phenomena was discussed on the
-- luatex dev list.
-local large = 2^24 -- 16 MB
-local medium = large / 16 -- 1 MB
-local small = medium / 8
+local large = 0x01000000 -- 2^24 16.777.216
+local medium = 0x00100000 -- 2^20 1.048.576
+local small = 0x00020000 -- 2^17 131.072
-- local function readall(f)
-- local size = f:seek("end")
@@ -54,7 +54,7 @@ local small = medium / 8
-- end
local function readall(f)
--- return f:read("*all")
+ -- return f:read("*all")
local size = f:seek("end")
if size > 0 then
f:seek("set",0)
diff --git a/tex/context/base/mkiv/l-lua.lua b/tex/context/base/mkiv/l-lua.lua
index 88cde6d1e..aa2644b9f 100644
--- a/tex/context/base/mkiv/l-lua.lua
+++ b/tex/context/base/mkiv/l-lua.lua
@@ -17,28 +17,35 @@ if not modules then modules = { } end modules ['l-lua'] = {
-- utf.*
-- bit32
--- compatibility hacksand helpers
+-- compatibility hacks and helpers
-_MAJORVERSION, _MINORVERSION = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
+LUAMAJORVERSION, LUAMINORVERSION = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
-_MAJORVERSION = tonumber(_MAJORVERSION) or 5
-_MINORVERSION = tonumber(_MINORVERSION) or 1
-_LUAVERSION = _MAJORVERSION + _MINORVERSION/10
+LUAMAJORVERSION = tonumber(LUAMAJORVERSION) or 5
+LUAMINORVERSION = tonumber(LUAMINORVERSION) or 1
+LUAVERSION = LUAMAJORVERSION + LUAMINORVERSION/10
-if _LUAVERSION < 5.2 and jit then
+if LUAVERSION < 5.2 and jit then
--
-- we want loadstring cum suis to behave like 5.2
--
- _MINORVERSION = 2
- _LUAVERSION = 5.2
+ MINORVERSION = 2
+ LUAVERSION = 5.2
end
+_LUAVERSION = LUAVERSION -- for old times sake, will go away
+
-- lpeg
if not lpeg then
lpeg = require("lpeg")
end
+-- if utf8 then
+-- utf8lua = utf8
+-- utf8 = nil
+-- end
+
-- basics:
if loadstring then
@@ -220,3 +227,32 @@ if not FFISUPPORTED then
elseif not ffi.number then
ffi.number = tonumber
end
+
+-- if not bit32 then
+-- bit32 = load ( [[ return {
+-- band = function(a,b)
+-- return (a & b)
+-- end,
+-- bnot = function(a)
+-- return ~a & 0xFFFFFFFF
+-- end,
+-- bor = function(a,b)
+-- return (a | b) & 0xFFFFFFFF
+-- end,
+-- btest = function(a,b)
+-- return (a & b) ~= 0
+-- end,
+-- bxor = function(a,b)
+-- return (a ~ b) & 0xFFFFFFFF
+-- end,
+-- extract = function(a,b,c)
+-- return (a >> b) & ~(-1 << (c or 1))
+-- end,
+-- lshift = function(a,b)
+-- return (a << b) & 0xFFFFFFFF
+-- end,
+-- rshift = function(a,b)
+-- return (a >> b)
+-- end,
+-- } ]] ) ()
+-- end
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index e37c74f8b..ba8712ddb 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -1392,3 +1392,26 @@ function table.filtered(t,pattern,sort,cmp)
return nothing
end
end
+
+-- lua 5.3:
+
+if not table.move then
+
+ function table.move(a1,f,e,t,a2)
+ if a2 and a1 ~= a2 then
+ for i=f,e do
+ a2[t] = a1[i]
+ t = t + 1
+ end
+ return a2
+ else
+ t = t + e - f
+ for i=e,f,-1 do
+ a1[t] = a1[i]
+ t = t - 1
+ end
+ return a1
+ end
+ end
+
+end
diff --git a/tex/context/base/mkiv/l-unicode.lua b/tex/context/base/mkiv/l-unicode.lua
index b913d0cfc..e4a182980 100644
--- a/tex/context/base/mkiv/l-unicode.lua
+++ b/tex/context/base/mkiv/l-unicode.lua
@@ -29,6 +29,9 @@ utf.values = utf.values or string.utfvalues
-- string.characterpairs
-- string.bytes
-- string.bytepairs
+-- string.utflength
+-- string.utfvalues
+-- string.utfcharacters
local type = type
local char, byte, format, sub, gmatch = string.char, string.byte, string.format, string.sub, string.gmatch
@@ -64,53 +67,67 @@ end
if not utf.char then
- local floor, char = math.floor, string.char
-
- function utf.char(n)
- if n < 0x80 then
- -- 0aaaaaaa : 0x80
- return char(n)
- elseif n < 0x800 then
- -- 110bbbaa : 0xC0 : n >> 6
- -- 10aaaaaa : 0x80 : n & 0x3F
- return char(
- 0xC0 + floor(n/0x40),
- 0x80 + (n % 0x40)
- )
- elseif n < 0x10000 then
- -- 1110bbbb : 0xE0 : n >> 12
- -- 10bbbbaa : 0x80 : (n >> 6) & 0x3F
- -- 10aaaaaa : 0x80 : n & 0x3F
- return char(
- 0xE0 + floor(n/0x1000),
- 0x80 + (floor(n/0x40) % 0x40),
- 0x80 + (n % 0x40)
- )
- elseif n < 0x200000 then
- -- 11110ccc : 0xF0 : n >> 18
- -- 10ccbbbb : 0x80 : (n >> 12) & 0x3F
- -- 10bbbbaa : 0x80 : (n >> 6) & 0x3F
- -- 10aaaaaa : 0x80 : n & 0x3F
- -- dddd : ccccc - 1
- return char(
- 0xF0 + floor(n/0x40000),
- 0x80 + (floor(n/0x1000) % 0x40),
- 0x80 + (floor(n/0x40) % 0x40),
- 0x80 + (n % 0x40)
- )
- else
- return ""
+ utf.char = string.utfcharacter or (utf8 and utf8.char)
+
+ if not utf.char then
+
+ -- no multiples
+
+ local floor, char = math.floor, string.char
+
+ function utf.char(n)
+ if n < 0x80 then
+ -- 0aaaaaaa : 0x80
+ return char(n)
+ elseif n < 0x800 then
+ -- 110bbbaa : 0xC0 : n >> 6
+ -- 10aaaaaa : 0x80 : n & 0x3F
+ return char(
+ 0xC0 + floor(n/0x40),
+ 0x80 + (n % 0x40)
+ )
+ elseif n < 0x10000 then
+ -- 1110bbbb : 0xE0 : n >> 12
+ -- 10bbbbaa : 0x80 : (n >> 6) & 0x3F
+ -- 10aaaaaa : 0x80 : n & 0x3F
+ return char(
+ 0xE0 + floor(n/0x1000),
+ 0x80 + (floor(n/0x40) % 0x40),
+ 0x80 + (n % 0x40)
+ )
+ elseif n < 0x200000 then
+ -- 11110ccc : 0xF0 : n >> 18
+ -- 10ccbbbb : 0x80 : (n >> 12) & 0x3F
+ -- 10bbbbaa : 0x80 : (n >> 6) & 0x3F
+ -- 10aaaaaa : 0x80 : n & 0x3F
+ -- dddd : ccccc - 1
+ return char(
+ 0xF0 + floor(n/0x40000),
+ 0x80 + (floor(n/0x1000) % 0x40),
+ 0x80 + (floor(n/0x40) % 0x40),
+ 0x80 + (n % 0x40)
+ )
+ else
+ return ""
+ end
end
+
end
end
if not utf.byte then
- local utf8byte = patterns.utf8byte
+ utf.byte = string.utfvalue or (utf8 and utf8.codepoint)
+
+ if not utf.byte then
+
+ local utf8byte = patterns.utf8byte
+
+ function utf.byte(c)
+ return lpegmatch(utf8byte,c)
+ end
- function utf.byte(c)
- return lpegmatch(utf8byte,c)
end
end
@@ -253,83 +270,89 @@ end
if not utf.len then
- -- -- alternative 1: 0.77
- --
- -- local utfcharcounter = utfbom^-1 * Cs((p_utf8char/'!')^0)
- --
- -- function utf.len(str)
- -- return #lpegmatch(utfcharcounter,str or "")
- -- end
- --
- -- -- alternative 2: 1.70
- --
- -- local n = 0
- --
- -- local utfcharcounter = utfbom^-1 * (p_utf8char/function() n = n + 1 end)^0 -- slow
- --
- -- function utf.length(str)
- -- n = 0
- -- lpegmatch(utfcharcounter,str or "")
- -- return n
- -- end
- --
- -- -- alternative 3: 0.24 (native unicode.utf8.len: 0.047)
-
- -- local n = 0
- --
- -- -- local utfcharcounter = lpeg.patterns.utfbom^-1 * P ( ( Cp() * (
- -- -- patterns.utf8one ^1 * Cc(1)
- -- -- + patterns.utf8two ^1 * Cc(2)
- -- -- + patterns.utf8three^1 * Cc(3)
- -- -- + patterns.utf8four ^1 * Cc(4) ) * Cp() / function(f,d,t) n = n + (t - f)/d end
- -- -- )^0 ) -- just as many captures as below
- --
- -- -- local utfcharcounter = lpeg.patterns.utfbom^-1 * P ( (
- -- -- (Cmt(patterns.utf8one ^1,function(_,_,s) n = n + #s return true end))
- -- -- + (Cmt(patterns.utf8two ^1,function(_,_,s) n = n + #s/2 return true end))
- -- -- + (Cmt(patterns.utf8three^1,function(_,_,s) n = n + #s/3 return true end))
- -- -- + (Cmt(patterns.utf8four ^1,function(_,_,s) n = n + #s/4 return true end))
- -- -- )^0 ) -- not interesting as it creates strings but sometimes faster
- --
- -- -- The best so far:
- --
- -- local utfcharcounter = utfbom^-1 * P ( (
- -- Cp() * (patterns.utf8one )^1 * Cp() / function(f,t) n = n + t - f end
- -- + Cp() * (patterns.utf8two )^1 * Cp() / function(f,t) n = n + (t - f)/2 end
- -- + Cp() * (patterns.utf8three)^1 * Cp() / function(f,t) n = n + (t - f)/3 end
- -- + Cp() * (patterns.utf8four )^1 * Cp() / function(f,t) n = n + (t - f)/4 end
- -- )^0 )
-
- -- function utf.len(str)
- -- n = 0
- -- lpegmatch(utfcharcounter,str or "")
- -- return n
- -- end
-
- local n, f = 0, 1
+ utf.len = string.utflength or (utf8 and utf8.len)
+
+ if not utf.len then
+
+ -- -- alternative 1: 0.77
+ --
+ -- local utfcharcounter = utfbom^-1 * Cs((p_utf8char/'!')^0)
+ --
+ -- function utf.len(str)
+ -- return #lpegmatch(utfcharcounter,str or "")
+ -- end
+ --
+ -- -- alternative 2: 1.70
+ --
+ -- local n = 0
+ --
+ -- local utfcharcounter = utfbom^-1 * (p_utf8char/function() n = n + 1 end)^0 -- slow
+ --
+ -- function utf.length(str)
+ -- n = 0
+ -- lpegmatch(utfcharcounter,str or "")
+ -- return n
+ -- end
+ --
+ -- -- alternative 3: 0.24 (native unicode.utf8.len: 0.047)
+
+ -- local n = 0
+ --
+ -- -- local utfcharcounter = lpeg.patterns.utfbom^-1 * P ( ( Cp() * (
+ -- -- patterns.utf8one ^1 * Cc(1)
+ -- -- + patterns.utf8two ^1 * Cc(2)
+ -- -- + patterns.utf8three^1 * Cc(3)
+ -- -- + patterns.utf8four ^1 * Cc(4) ) * Cp() / function(f,d,t) n = n + (t - f)/d end
+ -- -- )^0 ) -- just as many captures as below
+ --
+ -- -- local utfcharcounter = lpeg.patterns.utfbom^-1 * P ( (
+ -- -- (Cmt(patterns.utf8one ^1,function(_,_,s) n = n + #s return true end))
+ -- -- + (Cmt(patterns.utf8two ^1,function(_,_,s) n = n + #s/2 return true end))
+ -- -- + (Cmt(patterns.utf8three^1,function(_,_,s) n = n + #s/3 return true end))
+ -- -- + (Cmt(patterns.utf8four ^1,function(_,_,s) n = n + #s/4 return true end))
+ -- -- )^0 ) -- not interesting as it creates strings but sometimes faster
+ --
+ -- -- The best so far:
+ --
+ -- local utfcharcounter = utfbom^-1 * P ( (
+ -- Cp() * (patterns.utf8one )^1 * Cp() / function(f,t) n = n + t - f end
+ -- + Cp() * (patterns.utf8two )^1 * Cp() / function(f,t) n = n + (t - f)/2 end
+ -- + Cp() * (patterns.utf8three)^1 * Cp() / function(f,t) n = n + (t - f)/3 end
+ -- + Cp() * (patterns.utf8four )^1 * Cp() / function(f,t) n = n + (t - f)/4 end
+ -- )^0 )
+
+ -- function utf.len(str)
+ -- n = 0
+ -- lpegmatch(utfcharcounter,str or "")
+ -- return n
+ -- end
+
+ local n, f = 0, 1
+
+ local utfcharcounter = patterns.utfbom^-1 * Cmt (
+ Cc(1) * patterns.utf8one ^1
+ + Cc(2) * patterns.utf8two ^1
+ + Cc(3) * patterns.utf8three^1
+ + Cc(4) * patterns.utf8four ^1,
+ function(_,t,d) -- due to Cc no string captures, so faster
+ n = n + (t - f)/d
+ f = t
+ return true
+ end
+ )^0
- local utfcharcounter = patterns.utfbom^-1 * Cmt (
- Cc(1) * patterns.utf8one ^1
- + Cc(2) * patterns.utf8two ^1
- + Cc(3) * patterns.utf8three^1
- + Cc(4) * patterns.utf8four ^1,
- function(_,t,d) -- due to Cc no string captures, so faster
- n = n + (t - f)/d
- f = t
- return true
+ function utf.len(str)
+ n, f = 0, 1
+ lpegmatch(utfcharcounter,str or "")
+ return n
end
- )^0
- function utf.len(str)
- n, f = 0, 1
- lpegmatch(utfcharcounter,str or "")
- return n
- end
+ -- -- these are quite a bit slower:
- -- -- these are quite a bit slower:
+ -- utfcharcounter = utfbom^-1 * (Cmt(P(1) * R("\128\191")^0, function() n = n + 1 return true end))^0 -- 50+ times slower
+ -- utfcharcounter = utfbom^-1 * (Cmt(P(1), function() n = n + 1 return true end) * R("\128\191")^0)^0 -- 50- times slower
- -- utfcharcounter = utfbom^-1 * (Cmt(P(1) * R("\128\191")^0, function() n = n + 1 return true end))^0 -- 50+ times slower
- -- utfcharcounter = utfbom^-1 * (Cmt(P(1), function() n = n + 1 return true end) * R("\128\191")^0)^0 -- 50- times slower
+ end
end
diff --git a/tex/context/base/mkiv/lpdf-col.lua b/tex/context/base/mkiv/lpdf-col.lua
index fc251fddc..d1a1af97d 100644
--- a/tex/context/base/mkiv/lpdf-col.lua
+++ b/tex/context/base/mkiv/lpdf-col.lua
@@ -16,7 +16,6 @@ local formatters = string.formatters
local backends, lpdf, nodes = backends, lpdf, nodes
local allocate = utilities.storage.allocate
-local formatters = string.formatters
local nodeinjections = backends.pdf.nodeinjections
local codeinjections = backends.pdf.codeinjections
@@ -64,7 +63,7 @@ local f_rgb = formatters["%.3F %.3F %.3F rg %.3F %.3F %.3F RG"]
local f_cmyk = formatters["%.3F %.3F %.3F %.3F k %.3F %.3F %.3F %.3F K"]
local f_spot = formatters["/%s cs /%s CS %s SCN %s scn"]
local f_tr = formatters["Tr%s"]
-local f_cm = formatters["q %F %F %F %F %F %F cm"]
+local f_cm = formatters["q %.6F %.6F %.6F %.6F %.6F %.6F cm"]
local f_effect = formatters["%s Tc %s w %s Tr"]
local f_tr_gs = formatters["/Tr%s gs"]
local f_num_1 = tostring
@@ -716,7 +715,7 @@ do
local pdfcolor = lpdf.color
local pdftransparency = lpdf.transparency
- local f_slant = formatters["q 1 0 %F 1 0 0 cm"]
+ local f_slant = formatters["q 1 0 %.6F 1 0 0 cm"]
-- local fillcolors = {
-- red = { "pdf", "origin", "1 0 0 rg" },
diff --git a/tex/context/base/mkiv/lpdf-epa.lua b/tex/context/base/mkiv/lpdf-epa.lua
index d615f2bef..ac0ca3c92 100644
--- a/tex/context/base/mkiv/lpdf-epa.lua
+++ b/tex/context/base/mkiv/lpdf-epa.lua
@@ -40,7 +40,7 @@ local escapetex = characters.filters.utf.private.escape
local bookmarks = structures.bookmarks
-local maxdimen = 2^30-1
+local maxdimen = 0x3FFFFFFF -- 2^30-1
local layerspec = { -- predefining saves time
"epdflinks"
@@ -231,7 +231,7 @@ function codeinjections.mergereferences(specification)
if not a then
report_link("missing link annotation")
elseif w > width or h > height or w < 0 or h < 0 or abs(x) > (maxdimen/2) or abs(y) > (maxdimen/2) then
- report_link("broken link rectangle [%f %f %f %f] (max: %f)",a_llx,a_lly,a_urx,a_ury,maxdimen/2)
+ report_link("broken link rectangle [%.6F %.6F %.6F %.6F] (max: %.6F)",a_llx,a_lly,a_urx,a_ury,maxdimen/2)
else
local linktype = a.S
if linktype == "GoTo" then
diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua
index e8a968713..29a520790 100644
--- a/tex/context/base/mkiv/lpdf-fld.lua
+++ b/tex/context/base/mkiv/lpdf-fld.lua
@@ -121,39 +121,39 @@ function codeinjections.setformsmethod(name)
end
local flag = { -- /Ff
- ReadOnly = 2^ 0, -- 1
- Required = 2^ 1, -- 2
- NoExport = 2^ 2, -- 3
- MultiLine = 2^12, -- 13
- Password = 2^13, -- 14
- NoToggleToOff = 2^14, -- 15
- Radio = 2^15, -- 16
- PushButton = 2^16, -- 17
- PopUp = 2^17, -- 18
- Edit = 2^18, -- 19
- Sort = 2^19, -- 20
- FileSelect = 2^20, -- 21
- DoNotSpellCheck = 2^22, -- 23
- DoNotScroll = 2^23, -- 24
- Comb = 2^24, -- 25
- RichText = 2^25, -- 26
- RadiosInUnison = 2^25, -- 26
- CommitOnSelChange = 2^26, -- 27
+ ReadOnly = 0x00000001, -- 2^ 0
+ Required = 0x00000002, -- 2^ 1
+ NoExport = 0x00000004, -- 2^ 2
+ MultiLine = 0x00001000, -- 2^12
+ Password = 0x00002000, -- 2^13
+ NoToggleToOff = 0x00004000, -- 2^14
+ Radio = 0x00008000, -- 2^15
+ PushButton = 0x00010000, -- 2^16
+ PopUp = 0x00020000, -- 2^17
+ Edit = 0x00040000, -- 2^18
+ Sort = 0x00080000, -- 2^19
+ FileSelect = 0x00100000, -- 2^20
+ DoNotSpellCheck = 0x00400000, -- 2^22
+ DoNotScroll = 0x00800000, -- 2^23
+ Comb = 0x01000000, -- 2^24
+ RichText = 0x02000000, -- 2^25
+ RadiosInUnison = 0x02000000, -- 2^25
+ CommitOnSelChange = 0x04000000, -- 2^26
}
local plus = { -- /F
- Invisible = 2^0, -- 1
- Hidden = 2^1, -- 2
- Printable = 2^2, -- 3
- Print = 2^2, -- 3
- NoZoom = 2^3, -- 4
- NoRotate = 2^4, -- 5
- NoView = 2^5, -- 6
- ReadOnly = 2^6, -- 7
- Locked = 2^7, -- 8
- ToggleNoView = 2^8, -- 9
- LockedContents = 2^9, -- 10,
- AutoView = 2^8, -- 6 + 9 ?
+ Invisible = 0x00000001, -- 2^0
+ Hidden = 0x00000002, -- 2^1
+ Printable = 0x00000004, -- 2^2
+ Print = 0x00000004, -- 2^2
+ NoZoom = 0x00000008, -- 2^3
+ NoRotate = 0x00000010, -- 2^4
+ NoView = 0x00000020, -- 2^5
+ ReadOnly = 0x00000040, -- 2^6
+ Locked = 0x00000080, -- 2^7
+ ToggleNoView = 0x00000100, -- 2^8
+ LockedContents = 0x00000200, -- 2^9
+ AutoView = 0x00000100, -- 2^8
}
-- todo: check what is interfaced
diff --git a/tex/context/base/mkiv/lpdf-grp.lua b/tex/context/base/mkiv/lpdf-grp.lua
index 9122bd027..34925fddd 100644
--- a/tex/context/base/mkiv/lpdf-grp.lua
+++ b/tex/context/base/mkiv/lpdf-grp.lua
@@ -270,7 +270,7 @@ function img.package(image) -- see lpdf-u3d **
local height = boundingbox[4]
local xform = img.scan {
attr = resources(),
- stream = formatters["%F 0 0 %F 0 0 cm /%s Do"](width,height,imagetag),
+ stream = formatters["%.6F 0 0 %.6F 0 0 cm /%s Do"](width,height,imagetag),
bbox = { 0, 0, width/basepoints, height/basepoints },
}
img.immediatewrite(xform)
@@ -280,7 +280,7 @@ end
-- experimental
local nofpatterns = 0
-local f_pattern = formatters["q /Pattern cs /%s scn 0 0 %F %F re f Q"] -- q Q is not really needed
+local f_pattern = formatters["q /Pattern cs /%s scn 0 0 %.6F %.6F re f Q"] -- q Q is not really needed
local texsavebox = tex.saveboxresource
diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua
index 1d59175ca..3e05bff77 100644
--- a/tex/context/base/mkiv/lpdf-ini.lua
+++ b/tex/context/base/mkiv/lpdf-ini.lua
@@ -1074,7 +1074,7 @@ end
function lpdf.rotationcm(a)
local s, c = sind(a), cosd(a)
- return format("%0.6F %0.6F %0.6F %0.6F 0 0 cm",c,s,-s,c)
+ return format("%.6F %.6F %.6F %.6F 0 0 cm",c,s,-s,c)
end
-- ! -> universaltime
diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua
index 2b2fd81e3..5fe064030 100644
--- a/tex/context/base/mkiv/lpdf-mis.lua
+++ b/tex/context/base/mkiv/lpdf-mis.lua
@@ -455,7 +455,7 @@ end
-- temp hack: the mediabox is not under our control and has a precision of 5 digits
local factor = number.dimenfactors.bp
-local f_value = formatters["%0.5F"]
+local f_value = formatters["%0.6F"]
local function boxvalue(n) -- we could share them
return pdfverbose(f_value(factor * n))
diff --git a/tex/context/base/mkiv/lpdf-u3d.lua b/tex/context/base/mkiv/lpdf-u3d.lua
index c9f4a0369..dfd4c1b06 100644
--- a/tex/context/base/mkiv/lpdf-u3d.lua
+++ b/tex/context/base/mkiv/lpdf-u3d.lua
@@ -461,7 +461,7 @@ local function insert3d(spec) -- width, height, factor, display, controls, label
},
ProcSet = pdfarray { pdfconstant("PDF"), pdfconstant("ImageC") },
}
- local pwd = pdfflushstreamobject(formatters["q /GS gs %F 0 0 %F 0 0 cm /IM Do Q"](factor*width,factor*height),pw)
+ local pwd = pdfflushstreamobject(formatters["q /GS gs %.6F 0 0 %.6F 0 0 cm /IM Do Q"](factor*width,factor*height),pw)
annot.AP = pdfdictionary {
N = pdfreference(pwd)
}
diff --git a/tex/context/base/mkiv/luat-ini.mkiv b/tex/context/base/mkiv/luat-ini.mkiv
index e19b72d14..25ad7e139 100644
--- a/tex/context/base/mkiv/luat-ini.mkiv
+++ b/tex/context/base/mkiv/luat-ini.mkiv
@@ -98,8 +98,8 @@
{\setcatcodetable\luacatcodes
\the\everyluacode}
-\edef\luamajorversion{\ctxwrite{_MINORVERSION}}
-\edef\luaminorversion{\ctxwrite{_MAJORVERSION}}
+\edef\luamajorversion{\ctxwrite{LUAMINORVERSION}}
+\edef\luaminorversion{\ctxwrite{LUAMAJORVERSION}}
%D We need a way to pass strings safely to \LUA\ without the
%D need for tricky escaping. Compare:
diff --git a/tex/context/base/mkiv/math-ini.lua b/tex/context/base/mkiv/math-ini.lua
index c4bb822d6..5c495dbd7 100644
--- a/tex/context/base/mkiv/math-ini.lua
+++ b/tex/context/base/mkiv/math-ini.lua
@@ -17,7 +17,8 @@ if not modules then modules = { } end modules ['math-ini'] = {
local formatters, find = string.formatters, string.find
local utfchar, utfbyte, utflength = utf.char, utf.byte, utf.length
-local floor = math.floor
+----- floor = math.floor
+local sortedhash = table.sortedhash
local toboolean = toboolean
local context = context
@@ -285,7 +286,7 @@ function mathematics.define(family)
family = family or 0
family = families[family] or family
local data = characters.data
- for unicode, character in next, data do
+ for unicode, character in sortedhash(data) do
local symbol = character.mathsymbol
local mset, dset = true, true
if symbol then
@@ -300,7 +301,8 @@ function mathematics.define(family)
end
local spec = other.mathspec
if spec then
- for i, m in next, spec do
+ for i=1,#spec do
+ local m = spec[i]
local class = m.class
if class then
class = classes[class] or class -- no real checks needed
@@ -312,7 +314,8 @@ function mathematics.define(family)
local mathclass = character.mathclass
local mathspec = character.mathspec
if mathspec then
- for i, m in next, mathspec do
+ for i=1,#mathspec do
+ local m = mathspec[i]
local name = m.name
local class = m.class
if not class then
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index 03197162d..0dbee83bf 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -2343,6 +2343,13 @@
% \ruledhbox{$\mathtext{abc ffi}$}
% \ruledhbox{$\mathword{abc ffi}$}
+% I need to decide:
+%
+%mathscriptboxmode\zerocount % no kerning
+%mathscriptboxmode\plusone % lists
+\mathscriptboxmode\plustwo % lists and boxes
+%mathscriptboxmode\plusthree % lists and boxes with \boundary=1 (also for testing and demo)
+
\unexpanded\def\mathtext {\mathortext{\math_text_choice_font\relax}\hbox}
\unexpanded\def\mathword {\mathortext{\math_text_choice_word\relax}\hbox}
diff --git a/tex/context/base/mkiv/math-map.lua b/tex/context/base/mkiv/math-map.lua
index cf9353e95..f1b0c14e3 100644
--- a/tex/context/base/mkiv/math-map.lua
+++ b/tex/context/base/mkiv/math-map.lua
@@ -33,7 +33,6 @@ if not modules then modules = { } end modules ['math-map'] = {
-- plus add them to the regular vectors below so that they honor \it etc
local type, next = type, next
-local floor, div = math.floor, math.div
local merged, sortedhash = table.merged, table.sortedhash
local extract = bit32.extract
diff --git a/tex/context/base/mkiv/meta-fnt.lua b/tex/context/base/mkiv/meta-fnt.lua
index e7e83c694..1f5670c66 100644
--- a/tex/context/base/mkiv/meta-fnt.lua
+++ b/tex/context/base/mkiv/meta-fnt.lua
@@ -190,7 +190,7 @@ statistics.register("metapost font generation", function()
if total > 0 then
local time = statistics.elapsedtime(flusher)
if total > 0 then
- return format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time)
+ return format("%i glyphs, %.3f seconds runtime, %.1f glyphs/second", total, time, total/time)
else
return format("%i glyphs, %.3f seconds runtime", total, time)
end
@@ -201,7 +201,7 @@ statistics.register("metapost font loading",function()
if variants > 0 then
local time = statistics.elapsedtime(metapost.fonts)
if variants > 0 then
- return format("%.3f seconds, %i instances, %0.3f instances/second", time, variants, variants/time)
+ return format("%.3f seconds, %i instances, %.3f instances/second", time, variants, variants/time)
else
return format("%.3f seconds, %i instances", time, variants)
end
diff --git a/tex/context/base/mkiv/meta-tex.lua b/tex/context/base/mkiv/meta-tex.lua
index 3c31e3e1e..d66eab069 100644
--- a/tex/context/base/mkiv/meta-tex.lua
+++ b/tex/context/base/mkiv/meta-tex.lua
@@ -126,7 +126,7 @@ do
arguments = { "string", "string" }
}
- if _LUAVERSION < 5.2 then
+ if LUAVERSION < 5.2 then
utilities.strings.formatters.add(formatters,"texexp", [[texexp(...)]], "local texexp = metapost.texexp")
else
utilities.strings.formatters.add(formatters,"texexp", [[texexp(...)]], { texexp = metapost.texexp })
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index 83c1e49ee..b2d97226a 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -68,7 +68,7 @@ local f_pair = formatters["(%.16f,%.16f)"]
local f_triplet = formatters["(%.16f,%.16f,%.16f)"]
local f_quadruple = formatters["(%.16f,%.16f,%.16f,%.16f)"]
-local function mpprint(...)
+local function mpprint(...) -- we can optimize for n=1
for i=1,select("#",...) do
local value = select(i,...)
if value ~= nil then
@@ -258,7 +258,7 @@ local function mpquoted(fmt,s,...)
buffer[n] = lpegmatch(p,formatters[fmt](s,...))
elseif fmt then
-- buffer[n] = '"' .. fmt .. '"'
- buffer[n] = '"' .. lpegmatch(p,fmt) .. '"'
+ buffer[n] = lpegmatch(p,fmt)
else
-- something is wrong
end
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index b0826425f..4542c1e85 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -292,6 +292,7 @@ return {
"mathrulesfam",
"mathrulesmode",
"mathscriptsmode",
+ "mathscriptboxmode",
"mathstyle",
"mathsurroundmode",
"mathsurroundskip",
diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua
index 2cd1d1a0a..865f69c2c 100644
--- a/tex/context/base/mkiv/node-ltp.lua
+++ b/tex/context/base/mkiv/node-ltp.lua
@@ -138,7 +138,6 @@ local tonumber = tonumber
local utfchar = utf.char
local write, write_nl = texio.write, texio.write_nl
local sub, formatters = string.sub, string.formatters
-local round, floor = math.round, math.floor
local insert, remove = table.insert, table.remove
-- local fonts, nodes, node = fonts, nodes, node -- too many locals
diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua
index cc35de877..1b537b288 100644
--- a/tex/context/base/mkiv/page-cst.lua
+++ b/tex/context/base/mkiv/page-cst.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ["page-cst"] = {
-- todo: check what is used
local next, type, tonumber = next, type, tonumber
-local ceil, floor, odd, round = math.ceil, math.floor, math.odd, math.round
+local ceil, odd, round = math.ceil, math.odd, math.round
local lower = string.lower
local copy = table.copy
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua
index 42435ed5b..0d8e64cea 100644
--- a/tex/context/base/mkiv/page-mix.lua
+++ b/tex/context/base/mkiv/page-mix.lua
@@ -17,7 +17,7 @@ if not modules then modules = { } end modules ["page-mix"] = {
local next, type = next, type
local concat = table.concat
-local ceil, floor = math.ceil, math.floor
+local ceil = math.ceil
local trace_state = false trackers.register("mixedcolumns.trace", function(v) trace_state = v end)
local trace_detail = false trackers.register("mixedcolumns.detail", function(v) trace_detail = v end)
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index 2cebb4379..fce69b158 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -138,14 +138,15 @@ local virtuals = allocate {
}
local defaulttypes = allocate {
- author = "author",
- editor = "author",
- -- publisher = "author",
- page = "pagenumber",
- pages = "pagenumber",
- keywords = "keyword",
- doi = "url",
- url = "url",
+ author = "author",
+ editor = "author",
+ translator = "author",
+ -- publisher = "author",
+ page = "pagenumber",
+ pages = "pagenumber",
+ keywords = "keyword",
+ doi = "url",
+ url = "url",
}
local defaultsets = allocate {
@@ -265,11 +266,13 @@ local specifications = setmetatableindex(function(t,name)
local fullname = resolvers.findfile(filename) or ""
if fullname == "" then
report("no data definition file %a for %a",filename,name)
+ t[name] = default
return default
end
local specification = table.load(fullname)
if not specification then
report("invalid data definition file %a for %a",fullname,name)
+ t[name] = default
return default
end
--
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 07160ec57..ed3050f35 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -2361,10 +2361,26 @@ do
local citevariants = { }
publications.citevariants = citevariants
+ local function btxvalidcitevariant(dataset,variant)
+ local citevariant = rawget(citevariants,variant)
+ if citevariant then
+ return variant, citevariant
+ end
+ local variant = specifications[dataset].types[variant]
+ if variant then
+ citevariant = rawget(citevariants,variant)
+ end
+ if citevariant then
+ return variant, citevariant
+ end
+ return "default", citevariants.default
+ end
+
local function btxhandlecite(specification)
local dataset = specification.dataset or v_default
local reference = specification.reference
local variant = specification.variant
+ --
if not variant or variant == "" then
variant = "default"
end
@@ -2403,7 +2419,10 @@ do
--
ctx_btxsetdataset(dataset)
--
- citevariants[variant](specification) -- we always fall back on default
+ local variant, citevariant = btxvalidcitevariant(dataset,variant)
+ specification.variant = variant -- the used one
+ --
+ citevariant(specification) -- we always fall back on default
end
local function btxhandlenocite(specification)
@@ -2745,11 +2764,15 @@ do
local function simplegetter(first,last,field,specification)
local value = first[field]
if value then
- ctx_btxsetfirst(value)
- if last then
- ctx_btxsetsecond(last[field])
+ if type(value) == "string" then
+ ctx_btxsetfirst(value)
+ if last then
+ ctx_btxsetsecond(last[field])
+ end
+ return true
+ else
+ report("missing data type definition for %a",field)
end
- return true
end
end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 92cff15e3..9cd88d681 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 9d368f7b8..4f6c0e8cb 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/supp-ran.lua b/tex/context/base/mkiv/supp-ran.lua
index 8bfc09e58..1ad9293ee 100644
--- a/tex/context/base/mkiv/supp-ran.lua
+++ b/tex/context/base/mkiv/supp-ran.lua
@@ -24,7 +24,7 @@ local randomseed = math.randomseed
local round = math.round
local stack = { }
local last = 1
-local maxcount = 2^30-1 -- 1073741823
+local maxcount = 0x3FFFFFFF -- 2^30-1
math.random = function(...)
local n = random(...)
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index 03b6d0759..2c8263962 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -1188,6 +1188,7 @@
\ifdefined\mathsurroundmode \else \newcount\mathsurroundmode \fi
\ifdefined\mathitalicsmode \else \newcount\mathitalicsmode \fi
\ifdefined\mathdelimitersmode \else \newcount\mathdelimitersmode \fi
+\ifdefined\mathscriptboxmode \else \newcount\mathscriptboxmode \fi
\ifdefined\hyphenpenaltymode \else \newcount\hyphenpenaltymode \fi
\ifdefined\automatichyphenpenalty \else \newcount\automatichyphenpenalty \fi
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 0ce7b4836..312a8b318 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -101,28 +101,28 @@ end
-- end
local bits = {
- escape = 2^ 0,
- begingroup = 2^ 1,
- endgroup = 2^ 2,
- mathshift = 2^ 3,
- alignment = 2^ 4,
- endofline = 2^ 5,
- parameter = 2^ 6,
- superscript = 2^ 7,
- subscript = 2^ 8,
- ignore = 2^ 9,
- space = 2^10, -- 1024
- letter = 2^11,
- other = 2^12,
- active = 2^13,
- comment = 2^14,
- invalid = 2^15,
+ escape = 0x00000001, -- 2^00
+ begingroup = 0x00000002, -- 2^01
+ endgroup = 0x00000004, -- 2^02
+ mathshift = 0x00000008, -- 2^03
+ alignment = 0x00000010, -- 2^04
+ endofline = 0x00000020, -- 2^05
+ parameter = 0x00000040, -- 2^06
+ superscript = 0x00000080, -- 2^07
+ subscript = 0x00000100, -- 2^08
+ ignore = 0x00000200, -- 2^09
+ space = 0x00000400, -- 2^10 -- 1024
+ letter = 0x00000800, -- 2^11
+ other = 0x00001000, -- 2^12
+ active = 0x00002000, -- 2^13
+ comment = 0x00004000, -- 2^14
+ invalid = 0x00008000, -- 2^15
--
- character = 2^11 + 2^12,
- whitespace = 2^13 + 2^10, -- / needs more checking
+ character = 0x00001800, -- 2^11 + 2^12
+ whitespace = 0x00002400, -- 2^13 + 2^10 -- / needs more checking
--
- open = 2^10 + 2^1, -- space + begingroup
- close = 2^10 + 2^2, -- space + endgroup
+ open = 0x00000402, -- 2^10 + 2^01 -- space + begingroup
+ close = 0x00000404, -- 2^10 + 2^02 -- space + endgroup
}
-- for k, v in next, bits do bits[v] = k end
diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua
index 99fe30a6e..5810e2059 100644
--- a/tex/context/base/mkiv/trac-inf.lua
+++ b/tex/context/base/mkiv/trac-inf.lua
@@ -196,8 +196,9 @@ function statistics.show()
local hashchar = tonumber(status.luatex_hashchars)
local hashtype = status.luatex_hashtype
local mask = lua.mask or "ascii"
- return format("engine: %s, used memory: %s, hash type: %s, hash chars: min(%s,40), symbol mask: %s (%s)",
+ return format("engine: %s %s, used memory: %s, hash type: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
jit and "luajit" or "lua",
+ LUAVERSION,
statistics.memused(),
hashtype or "default",
hashchar and 2^hashchar or "unknown",
diff --git a/tex/context/base/mkiv/typo-cap.lua b/tex/context/base/mkiv/typo-cap.lua
index 9e4e9686a..ea0aad422 100644
--- a/tex/context/base/mkiv/typo-cap.lua
+++ b/tex/context/base/mkiv/typo-cap.lua
@@ -82,7 +82,7 @@ local run = 0 -- a trick to make neighbouring ranges work
local blocked = { }
local function set(tag,font)
- if run == 2^6 then
+ if run == 0x40 then -- 2^6
run = 1
else
run = run + 1
diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv
index afd446258..1ef7f74c6 100644
--- a/tex/context/base/mkiv/typo-del.mkiv
+++ b/tex/context/base/mkiv/typo-del.mkiv
@@ -790,7 +790,8 @@
\dostarttaggedchained\t!delimited\currentdelimitedtext\??delimitedtext
\usedelimitedtextstyleandcolor\c!style\c!color
\typo_delimited_start_content
- \typo_delimited_attributed_e
+ \bgroup
+ \aftergroup\typo_delimited_attributed_e
\let\next=}
\def\typo_delimited_attributed_e
@@ -806,6 +807,7 @@
\usedlanguageparameter{\c!left\currentparentdelimitedtext}% was: \currentdelimitedtext
\usedelimitedtextstyleandcolor\c!style\c!color
\typo_delimited_start_content
+ \bgroup
\aftergroup\typo_delimited_fontdriven_e
\let\next=}
diff --git a/tex/context/base/mkiv/typo-dha.lua b/tex/context/base/mkiv/typo-dha.lua
index c75fdbc3f..f7f3dee2e 100644
--- a/tex/context/base/mkiv/typo-dha.lua
+++ b/tex/context/base/mkiv/typo-dha.lua
@@ -85,7 +85,6 @@ local parfillskip_code = skipcodes.parfillskip
local new_textdir = nodepool.textdir
local hasbit = number.hasbit
-local formatters = string.formatters
local insert = table.insert
local fonthashes = fonts.hashes
diff --git a/tex/context/base/mkiv/typo-dir.lua b/tex/context/base/mkiv/typo-dir.lua
index 8a9ec978e..5645cd433 100644
--- a/tex/context/base/mkiv/typo-dir.lua
+++ b/tex/context/base/mkiv/typo-dir.lua
@@ -28,7 +28,6 @@ if not modules then modules = { } end modules ['typo-dir'] = {
local next, type = next, type
local format, insert, sub, find, match = string.format, table.insert, string.sub, string.find, string.match
-local formatters = string.formatters
local nodes, node = nodes, node
@@ -67,9 +66,9 @@ local v_local = variables["local"]
local v_on = variables.on
local v_yes = variables.yes
-local m_enabled = 2^6 -- 64
-local m_global = 2^7
-local m_fences = 2^8
+local m_enabled = 0x00000040 -- 2^6 64
+local m_global = 0x00000080 -- 2^7
+local m_fences = 0x00000100 -- 2^8
local handlers = { }
local methods = { }
diff --git a/tex/context/base/mkiv/util-dim.lua b/tex/context/base/mkiv/util-dim.lua
index 2bdb870e7..fd9351a28 100644
--- a/tex/context/base/mkiv/util-dim.lua
+++ b/tex/context/base/mkiv/util-dim.lua
@@ -429,7 +429,7 @@ end
stringtodimen = string.todimen -- local variable defined earlier
function number.toscaled(d)
- return format("%0.5f",d/2^16)
+ return format("%0.5f",d/0x10000) -- 2^16
end
--[[ldx--
diff --git a/tex/context/base/mkiv/util-lua.lua b/tex/context/base/mkiv/util-lua.lua
index 6481435bd..27daa516f 100644
--- a/tex/context/base/mkiv/util-lua.lua
+++ b/tex/context/base/mkiv/util-lua.lua
@@ -21,7 +21,6 @@ local report_mem = logs.reporter("system","lua memory")
local tracestripping = false
local tracememory = false
-local forcestupidcompile = true -- use internal bytecode compiler
luautilities.stripcode = true -- support stripping when asked for
luautilities.alwaysstripcode = false -- saves 1 meg on 7 meg compressed format file (2012.08.12)
luautilities.nofstrippedchunks = 0
diff --git a/tex/context/base/mkiv/util-sto.lua b/tex/context/base/mkiv/util-sto.lua
index bcd8c85a3..5b6915eaf 100644
--- a/tex/context/base/mkiv/util-sto.lua
+++ b/tex/context/base/mkiv/util-sto.lua
@@ -158,6 +158,29 @@ function table.setmetatablecall(t,f)
return t
end
+-- the manual is somewhat fuzzy about this but suggests that one can best
+-- set all fields before assigning a metatable
+
+function table.setmetatableindices(t,f,n,c)
+ if type(t) ~= "table" then
+ f, t = t, { }
+ end
+ local m = getmetatable(t)
+ local i = f_index[f] or f
+ if m then
+ m.__index = i
+ m.__newindex = n
+ m.__call = c
+ else
+ setmetatable(t,{
+ __index = i,
+ __newindex = n,
+ __call = c,
+ })
+ end
+ return t
+end
+
function table.setmetatablekey(t,key,value)
local m = getmetatable(t)
if not m then
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 6d8f198ab..d938ee449 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -22,7 +22,7 @@ local utfchar, utfbyte = utf.char, utf.byte
local loadstripped = nil
-if _LUAVERSION < 5.2 then
+if LUAVERSION < 5.2 then
loadstripped = function(str,shortcuts)
return load(str)
@@ -504,7 +504,7 @@ return function(%s) return %s end
local preamble, environment = "", { }
-if _LUAVERSION < 5.2 then
+if LUAVERSION < 5.2 then
preamble = [[
local lpeg=lpeg
@@ -1007,6 +1007,14 @@ local direct = Cs (
* P(-1) / [[local format = string.format return function(str) return format("%0",str) end]]
)
+-- local direct = Cs (
+-- P("%")
+-- * (S("+- .") + R("09"))^0
+-- * S("sqidfgGeExXo")
+-- * (1-P("%"))^0
+-- * P(-1) / [[local format = string.format return function(str) return format([==[%0]==],str) end]]
+-- )
+
local function make(t,str)
local f
local p
@@ -1079,7 +1087,7 @@ strings.formatters = { }
-- _connector_ is an experiment
-if _LUAVERSION < 5.2 then
+if LUAVERSION < 5.2 then
function strings.formatters.new(noconcat)
local t = { _type_ = "formatter", _connector_ = noconcat and "," or "..", _extensions_ = { }, _preamble_ = preamble, _environment_ = { } }
@@ -1139,7 +1147,7 @@ patterns.luaquoted = Cs(Cc('"') * ((1-S('"\n'))^1 + P('"')/'\\"' + P('\n')/'\\n"
-- escaping by lpeg is faster for strings without quotes, slower on a string with quotes, but
-- faster again when other q-escapables are found (the ones we don't need to escape)
-if _LUAVERSION < 5.2 then
+if LUAVERSION < 5.2 then
add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],"local xmlescape = lpeg.patterns.xmlescape")
add(formatters,"tex",[[lpegmatch(texescape,%s)]],"local texescape = lpeg.patterns.texescape")