summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/lua/luatools.lua128
-rw-r--r--scripts/context/lua/mtx-tools.lua40
-rw-r--r--scripts/context/lua/mtxrun.lua126
-rw-r--r--scripts/context/stubs/mswin/luatools.lua128
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua126
-rwxr-xr-xscripts/context/stubs/unix/luatools128
-rwxr-xr-xscripts/context/stubs/unix/mtxrun126
-rw-r--r--tex/context/base/back-pdf.mkiv21
-rw-r--r--tex/context/base/buff-ini.lua2
-rw-r--r--tex/context/base/colo-ext.mkiv16
-rw-r--r--tex/context/base/colo-ini.lua21
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.mkiv6
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-def.mkiv4
-rw-r--r--tex/context/base/data-res.lua56
-rw-r--r--tex/context/base/font-ctx.lua8
-rw-r--r--tex/context/base/font-gds.lua4
-rw-r--r--tex/context/base/font-ini.mkiv2
-rw-r--r--tex/context/base/font-map.lua12
-rw-r--r--tex/context/base/font-tfm.lua4
-rw-r--r--tex/context/base/l-dir.lua70
-rw-r--r--tex/context/base/lpdf-ini.lua31
-rw-r--r--tex/context/base/math-ini.lua25
-rw-r--r--tex/context/base/math-noa.lua2
-rw-r--r--tex/context/base/math-scr.mkiv5
-rw-r--r--tex/context/base/math-vfu.lua23
-rw-r--r--tex/context/base/meta-txt.tex24
-rw-r--r--tex/context/base/mlib-pps.lua90
-rw-r--r--tex/context/base/mlib-pps.mkiv42
-rw-r--r--tex/context/base/page-ini.mkiv2
-rw-r--r--tex/context/base/page-lay.mkiv2
-rw-r--r--tex/context/base/pret-lua.lua52
-rw-r--r--tex/context/base/pret-tex.lua4
-rw-r--r--tex/context/base/strc-des.mkiv9
-rw-r--r--tex/context/base/strc-flt.mkiv28
-rw-r--r--tex/context/base/strc-not.mkiv25
-rw-r--r--tex/context/base/syst-aux.mkiv2
-rw-r--r--tex/context/base/tabl-tab.mkiv2
-rw-r--r--tex/context/base/tabl-tbl.mkiv4
-rw-r--r--tex/context/base/type-otf.mkiv7
-rw-r--r--tex/context/base/typo-cap.mkiv4
-rw-r--r--tex/context/sample/sample.tex68
43 files changed, 733 insertions, 750 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index 36c6c6e38..afff8a535 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -2548,6 +2548,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2626,29 +2632,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
+ local t = t or { }
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2780,8 +2805,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2791,15 +2815,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -5253,64 +5275,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -5348,7 +5323,7 @@ function resolvers.getownpath()
if not ownpath or ownpath == "" then
ownpath = "."
logs.report("fileio","forcing fallback ownpath .")
- else
+ elseif trace_locating then
logs.report("fileio","using ownpath '%s'",ownpath)
end
end
@@ -5362,7 +5337,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -5729,7 +5704,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/scripts/context/lua/mtx-tools.lua b/scripts/context/lua/mtx-tools.lua
index 5c90df071..5614b3c14 100644
--- a/scripts/context/lua/mtx-tools.lua
+++ b/scripts/context/lua/mtx-tools.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['mtx-tools'] = {
license = "see context related readme files"
}
-local find, format, sub, rep, gsub = string.find, string.format, string.sub, string.rep, string.gsub
+local find, format, sub, rep, gsub, lower = string.find, string.format, string.sub, string.rep, string.gsub, string.lower
scripts = scripts or { }
scripts.tools = scripts.tools or { }
@@ -42,6 +42,35 @@ function scripts.tools.disarmutfbomb()
end
end
+function scripts.tools.downcase()
+ local pattern = environment.argument('pattern') or "*"
+ local recurse = environment.argument('recurse')
+ local force = environment.argument('force')
+ local n = 0
+ if recurse and not find(pattern,"^%*%*%/") then
+ pattern = "**/*" .. pattern
+ end
+ dir.glob(pattern,function(name)
+ local basename = file.basename(name)
+ if lower(basename) ~= basename then
+ n = n + 1
+ if force then
+ os.rename(name,lower(name))
+ end
+ end
+ end)
+ if n > 0 then
+ if force then
+ logs.simple("%s files renamed",n)
+ else
+ logs.simple("use --force to do a real rename (%s files involved)",n)
+ end
+ else
+ logs.simple("nothing to do")
+ end
+end
+
+
function scripts.tools.dirtoxml()
local join, removesuffix, extname, date = file.join, file.removesuffix, file.extname, os.date
@@ -120,19 +149,26 @@ messages.help = [[
--force remove indeed
--dirtoxml glob directory into xml
- --pattern glob pattern (default: .*)
+ --pattern glob pattern (default: *)
--url url attribute (no processing)
--root the root of the globbed path (default: .)
--output output filename (console by default)
--recurse recurse into subdirecories
--stripname take pathpart of given pattern
--longname set name attributes to full path name
+
+--downcase
+ --pattern glob pattern (default: *)
+ --recurse recurse into subdirecories
+ --force downcase indeed
]]
if environment.argument("disarmutfbomb") then
scripts.tools.disarmutfbomb()
elseif environment.argument("dirtoxml") then
scripts.tools.dirtoxml()
+elseif environment.argument("downcase") then
+ scripts.tools.downcase()
else
logs.help(messages.help)
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index d940eae46..d3942f7b3 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -2557,6 +2557,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2635,29 +2641,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
+ local t = t or { }
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2789,8 +2814,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2800,15 +2824,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -8343,64 +8365,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -8452,7 +8427,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -8819,7 +8794,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/scripts/context/stubs/mswin/luatools.lua b/scripts/context/stubs/mswin/luatools.lua
index 36c6c6e38..afff8a535 100644
--- a/scripts/context/stubs/mswin/luatools.lua
+++ b/scripts/context/stubs/mswin/luatools.lua
@@ -2548,6 +2548,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2626,29 +2632,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
+ local t = t or { }
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2780,8 +2805,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2791,15 +2815,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -5253,64 +5275,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -5348,7 +5323,7 @@ function resolvers.getownpath()
if not ownpath or ownpath == "" then
ownpath = "."
logs.report("fileio","forcing fallback ownpath .")
- else
+ elseif trace_locating then
logs.report("fileio","using ownpath '%s'",ownpath)
end
end
@@ -5362,7 +5337,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -5729,7 +5704,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index d940eae46..d3942f7b3 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -2557,6 +2557,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2635,29 +2641,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
+ local t = t or { }
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2789,8 +2814,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2800,15 +2824,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -8343,64 +8365,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -8452,7 +8427,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -8819,7 +8794,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools
index 36c6c6e38..afff8a535 100755
--- a/scripts/context/stubs/unix/luatools
+++ b/scripts/context/stubs/unix/luatools
@@ -2548,6 +2548,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2626,29 +2632,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
+ local t = t or { }
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2780,8 +2805,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2791,15 +2815,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -5253,64 +5275,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -5348,7 +5323,7 @@ function resolvers.getownpath()
if not ownpath or ownpath == "" then
ownpath = "."
logs.report("fileio","forcing fallback ownpath .")
- else
+ elseif trace_locating then
logs.report("fileio","using ownpath '%s'",ownpath)
end
end
@@ -5362,7 +5337,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -5729,7 +5704,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index d940eae46..d3942f7b3 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -2557,6 +2557,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -2635,29 +2641,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
+ local t = t or { }
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -2789,8 +2814,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -2800,15 +2824,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
@@ -8343,64 +8365,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -8452,7 +8427,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -8819,7 +8794,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv
index 28c5bde53..4201a5fce 100644
--- a/tex/context/base/back-pdf.mkiv
+++ b/tex/context/base/back-pdf.mkiv
@@ -44,13 +44,13 @@
%D These are the only official methods to add stuff to the resources.
-\def\pdfbackendsetcatalog #1#2{\ctxlua{lpdf.addtocatalog ("#1",\!!bs#2\!!es)}} \newtoks\pdfcatalog
-\def\pdfbackendsetinfo #1#2{\ctxlua{lpdf.addtoinfo ("#1",\!!bs#2\!!es)}} \newtoks\pdfinfo
-\def\pdfbackendsetname #1#2{\ctxlua{lpdf.addtonames ("#1",\!!bs#2\!!es)}} \newtoks\pdfnames
+\def\pdfbackendsetcatalog #1#2{\ctxlua{lpdf.addtocatalog ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetinfo #1#2{\ctxlua{lpdf.addtoinfo ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetname #1#2{\ctxlua{lpdf.addtonames ("#1",\!!bs#2\!!es)}}
-\def\pdfbackendsetpageattribute #1#2{\ctxlua{lpdf.addtopageattributes ("#1",\!!bs#2\!!es)}} \newtoks\pdfpageresources
-\def\pdfbackendsetpagesattribute#1#2{\ctxlua{lpdf.addtopagesattributes("#1",\!!bs#2\!!es)}} \newtoks\pdfpageattr
-\def\pdfbackendsetpageresource #1#2{\ctxlua{lpdf.addtopageresources ("#1",\!!bs#2\!!es)}} \newtoks\pdfpagesattr
+\def\pdfbackendsetpageattribute #1#2{\ctxlua{lpdf.addtopageattributes ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetpagesattribute#1#2{\ctxlua{lpdf.addtopagesattributes("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetpageresource #1#2{\ctxlua{lpdf.addtopageresources ("#1",\!!bs#2\!!es)}}
\def\pdfbackendsetextgstate #1#2{\ctxlua{lpdf.adddocumentextgstate ("#1",lpdf.verbose(\!!bs#2\!!es))}}
\def\pdfbackendsetcolorspace #1#2{\ctxlua{lpdf.adddocumentcolorspace("#1",lpdf.verbose(\!!bs#2\!!es))}}
@@ -59,6 +59,15 @@
\def\pdfbackendcurrentresources {\ctxlua{lpdf.collectedresources()}}
+%D Let's block these:
+
+\let\pdfcatalog \relax \newtoks\pdfcatalog
+\let\pdfinfo \relax \newtoks\pdfinfo
+\let\pdfnames \relax \newtoks\pdfnames
+\let\pdfpageresources\relax \newtoks\pdfpageresources
+\let\pdfpageattr \relax \newtoks\pdfpageattr
+\let\pdfpagesattr \relax \newtoks\pdfpagesattr
+
%D An example of usage is:
\appendtoks
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 43bb9feba..74096b0b3 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -410,7 +410,7 @@ function buffers.loadvisualizer(name)
if not hn then
-- hn = buffers.newvisualizer(name)
hn = handlers[visualizers.defaultname]
- handlers[name] = n
+ handlers[name] = hn
if trace_visualize then
logs.report("buffers","mapping '%s' visualizer onto '%s'",name,visualizers.defaultname)
end
diff --git a/tex/context/base/colo-ext.mkiv b/tex/context/base/colo-ext.mkiv
index 3483c1536..00a4b1bf4 100644
--- a/tex/context/base/colo-ext.mkiv
+++ b/tex/context/base/colo-ext.mkiv
@@ -86,12 +86,18 @@
% test {\mycolorb OEPS} test
% \stoptext
-\def\defineintermediatecolor[#1]#2[#3,#4,#5]#6[#7]% no checking: \dotripleempty adds {} inside []
+\def\defineintermediatecolor
+ {\dotripleempty\dodefineintermediatecolor}
+
+\def\dodefineintermediatecolor[#1][#2][#3]% \dotripleempty adds {} inside []
+ {\dododefineintermediatecolor[#1][#2][#3]}
+
+\def\dododefineintermediatecolor[#1][#2,#3,#4][#5]%
{\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxlua{colors.defineintermediatecolor("#1",0#3,
- \thecolorattribute{#4},\thecolorattribute{#5},
- \thetransparencyattribute{#4},\thetransparencyattribute{#5},
- "#7",false,\iffreezecolors true\else false\fi)}% not global
+ \ctxlua{colors.defineintermediatecolor("#1","#2",
+ \thecolorattribute{#3},\thecolorattribute{#4},
+ \thetransparencyattribute{#3},\thetransparencyattribute{#4},
+ "#5",false,\iffreezecolors true\else false\fi)}% not global
\dodefinecolorcommand\setvalue{#1}}
\protect \endinput
diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua
index ac68df495..4546f5279 100644
--- a/tex/context/base/colo-ini.lua
+++ b/tex/context/base/colo-ini.lua
@@ -415,18 +415,21 @@ end
-- experiment (a bit of a hack, as we need to get the attribute number)
-local min, abs = math.min, math.abs
+local min = math.min
+
+-- a[b,c] -> b+a*(c-b)
local function f(one,two,i,fraction)
- local a, b = one[i], two[i]
- if a > b then
- return min(fraction*(a+b),1)
- else
- return min(1-fraction*(a+b),1)
+ local o, t = one[i], two[i]
+ local otf = o + fraction * (t - o)
+ if otf > 1 then
+ otf = 1
end
+ return otf
end
function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,specs,global,freeze)
+ fraction = tonumber(fraction) or 1
local one, two = colors.value(c_one), colors.value(c_two)
if one and two then
local csone, cstwo = one[1], two[1]
@@ -448,10 +451,10 @@ function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,sp
end
local one, two = transparencies.value(a_one), transparencies.value(a_two)
local t = settings_to_hash_strict(specs)
- local ta = (t and t.a) or (one and one[1]) or (two and two[1])
- local tt = (t and t.t) or (one and two and f(one,two,2,fraction))
---~ print(t,table.serialize(t),ta,tt)
+ local ta = tonumber((t and t.a) or (one and one[1]) or (two and two[1]))
+ local tt = tonumber((t and t.t) or (one and two and f(one,two,2,fraction)))
if ta and tt then
+--~ print(ta,tt)
definetransparent(name,transparencies.register(name,ta,tt),global)
end
end
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 6f3ecbc03..448da9f1a 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{2010.03.30 18:56}
+\newcontextversion{2010.04.07 17:58}
%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.mkiv b/tex/context/base/context.mkiv
index 4aa0d2cb9..12cd3d747 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,8 +20,8 @@
\loadcorefile{syst-ini}
-\ifnum\luatexversion<47 % also change message
- \writestatus{!!!!}{Your luatex binary is too old, you need at least version 0.47!}
+\ifnum\luatexversion<60 % also change message
+ \writestatus{!!!!}{Your luatex binary is too old, you need at least version 0.60!}
\expandafter\end
\fi
@@ -89,6 +89,8 @@
\loadmarkfile{trac-lmx}
\loadmarkfile{trac-deb}
+%loadmarkfile{blob-ini} % not yet public (typesetting in pure lua)
+
\loadcorefile{supp-box}
\loadcorefile{supp-vis}
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index da3a55aad..0806a0f40 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2010.03.30 18:56}
+\edef\contextversion{2010.04.07 17:58}
%D For those who want to use this:
diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv
index 38c467a55..d94a46405 100644
--- a/tex/context/base/core-def.mkiv
+++ b/tex/context/base/core-def.mkiv
@@ -37,7 +37,7 @@
\appendtoks \preloadspecials \to \everyjob
\appendtoks \initializeMPgraphics \to \everyjob % after loading system files
\appendtoks \initializemainlanguage \to \everyjob
-\appendtoks \MPLIBregister \to \everyjob
+%appendtoks \MPLIBregister \to \everyjob
\appendtoks \xmlinitialize \to \everyjob
\appendtoks \newbackgroundfalse \to \everyjob % global
\appendtoks \initializepagecounters \to \everyjob
@@ -49,7 +49,7 @@
\appendtoks \ifarrangingpages\poparrangedpages\fi \to \everybye
%appendtoks \registerfileinfo[end]\jobfilename \to \everybye
-\appendtoks \MPLIBallocate{1000} \to \everydump
+%appendtoks \MPLIBallocate{1000} \to \everydump
\prependtoks \resetallattributes \to \everybeforeoutput
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index f67fbd62d..60c6eb32d 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -471,64 +471,17 @@ end
local args = environment and environment.original_arguments or arg -- this needs a cleanup
---~ resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg [0] or "luatex"
---~ resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
---~ resolvers.ownpath = resolvers.ownpath or file.dirname(resolvers.ownbin)
-
---~ resolvers.autoselfdir = true -- false may be handy for debugging
-
---~ function resolvers.getownpath()
---~ if not resolvers.ownpath then
---~ if resolvers.autoselfdir and os.selfdir and os.selfdir ~= "" then
---~ resolvers.ownpath = os.selfdir
---~ else
---~ local binary = resolvers.ownbin
---~ if os.binsuffix ~= "" then
---~ binary = file.replacesuffix(binary,os.binsuffix)
---~ end
---~ for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do
---~ local b = file.join(p,binary)
---~ if lfs.isfile(b) then
---~ -- we assume that after changing to the path the currentdir function
---~ -- resolves to the real location and use this side effect here; this
---~ -- trick is needed because on the mac installations use symlinks in the
---~ -- path instead of real locations
---~ local olddir = lfs.currentdir()
---~ if lfs.chdir(p) then
---~ local pp = lfs.currentdir()
---~ if trace_locating and p ~= pp then
---~ logs.report("fileio","following symlink '%s' to '%s'",p,pp)
---~ end
---~ resolvers.ownpath = pp
---~ lfs.chdir(olddir)
---~ else
---~ if trace_locating then
---~ logs.report("fileio","unable to check path '%s'",p)
---~ end
---~ resolvers.ownpath = p
---~ end
---~ break
---~ end
---~ end
---~ end
---~ if not resolvers.ownpath then resolvers.ownpath = '.' end
---~ end
---~ return resolvers.ownpath
---~ end
-
-local args = environment and environment.original_arguments or arg -- this needs a cleanup
-
resolvers.ownbin = resolvers.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
-resolvers.ownbin = string.gsub(resolvers.ownbin,"\\","/")
+resolvers.ownbin = gsub(resolvers.ownbin,"\\","/")
function resolvers.getownpath()
local ownpath = resolvers.ownpath or os.selfdir
if not ownpath or ownpath == "" then
ownpath = args[-1] or arg[-1]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
if not ownpath or ownpath == "" then
ownpath = args[-0] or arg[-0]
- ownpath = ownpath and file.dirname(string.gsub(ownpath,"\\","/"))
+ ownpath = ownpath and file.dirname(gsub(ownpath,"\\","/"))
end
local binary = resolvers.ownbin
if not ownpath or ownpath == "" then
@@ -580,7 +533,7 @@ end
local own_places = { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF" }
local function identify_own()
- local ownpath = resolvers.getownpath() or lfs.currentdir()
+ local ownpath = resolvers.getownpath() or dir.current()
local ie = instance.environment
if ownpath then
if resolvers.env('SELFAUTOLOC') == "" then os.env['SELFAUTOLOC'] = file.collapse_path(ownpath) end
@@ -947,7 +900,6 @@ end
-- we join them and split them after the expansion has taken place. This
-- is more convenient.
-
local checkedsplit = string.checkedsplit
local normalsplit = string.split
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index 9bcfdb46b..95a02265e 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -499,21 +499,21 @@ local loaded = { -- prevent loading
function fonts.map.loadfile(name)
name = file.addsuffix(name,"map")
if not loaded[name] then
- pdf.pdfmapfile = name
+ pdf.mapfile(name)
loaded[name] = true
end
end
function fonts.map.loadline(how,line)
- pdf.pdfmapline = how .. " " .. line
+ pdf.mapline(how .. " " .. line)
end
function fonts.map.reset()
- pdf.pdfmapfile = ""
+ pdf.mapfile("")
end
fonts.map.reset() -- resets the default file
-- we need an 'do after the banner hook'
--- pdf.pdfmapfile = "mkiv-base.map" -- loads the default file
+-- pdf.mapfile("mkiv-base.map") -- loads the default file
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index e8407d019..601e139ee 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -272,12 +272,12 @@ local function initialize(goodies)
end
if mapfiles then
for i=1,#mapfiles do
- pdf.pdfmapfile = mapfiles[i]
+ pdf.mapfile(mapfiles[i]) -- todo: backend function
end
end
if maplines then
for i=1,#maplines do
- pdf.pdfmapline = maplines[i]
+ pdf.mapline(maplines[i]) -- todo: backend function
end
end
end
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index 158676770..5ceeb70a9 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -2922,7 +2922,7 @@
[mode=node,onum=yes]
% \def\sc{\setfontfeature{smallcaps}}
-\def\os{\setfontfeature{just-os}}
+\unexpanded\def\os{\setfontfeature{just-os}}
%D Code for switching to fraktur and script has also been
%D changed. We now have an alphabet switcher.
diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua
index c0c3112e7..208ad50a8 100644
--- a/tex/context/base/font-map.lua
+++ b/tex/context/base/font-map.lua
@@ -278,21 +278,21 @@ end
-- local fullname = e.fullname or ""
-- if e.slant and e.slant ~= 0 then
-- if e.encoding then
--- pdf.pdfmapline = format('= %s %s "%g SlantFont" <%s <%s',e.name,fullname,e.slant,e.encoding,e.fontfile))
+-- pdf.mapline(format('= %s %s "%g SlantFont" <%s <%s',e.name,fullname,e.slant,e.encoding,e.fontfile)))
-- else
--- pdf.pdfmapline = format('= %s %s "%g SlantFont" <%s',e.name,fullname,e.slant,e.fontfile))
+-- pdf.mapline(format('= %s %s "%g SlantFont" <%s',e.name,fullname,e.slant,e.fontfile)))
-- end
-- elseif e.extend and e.extend ~= 1 and e.extend ~= 0 then
-- if e.encoding then
--- pdf.pdfmapline = format('= %s %s "%g ExtendFont" <%s <%s',e.name,fullname,e.extend,e.encoding,e.fontfile))
+-- pdf.mapline(format('= %s %s "%g ExtendFont" <%s <%s',e.name,fullname,e.extend,e.encoding,e.fontfile)))
-- else
--- pdf.pdfmapline = format('= %s %s "%g ExtendFont" <%s',e.name,fullname,e.extend,e.fontfile))
+-- pdf.mapline(format('= %s %s "%g ExtendFont" <%s',e.name,fullname,e.extend,e.fontfile)))
-- end
-- else
-- if e.encoding then
--- pdf.pdfmapline = format('= %s %s <%s <%s',e.name,fullname,e.encoding,e.fontfile))
+-- pdf.mapline(format('= %s %s <%s <%s',e.name,fullname,e.encoding,e.fontfile)))
-- else
--- pdf.pdfmapline = format('= %s %s <%s',e.name,fullname,e.fontfile))
+-- pdf.mapline(format('= %s %s <%s',e.name,fullname,e.fontfile)))
-- end
-- end
-- else
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index ea1b409e6..4b217a3c4 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -494,6 +494,8 @@ t.colorscheme = tfmtable.colorscheme
local vc = v.commands
if vc then
-- we assume non scaled commands here
+ -- tricky .. we need to scale pseudo math glyphs too
+ -- which is why we deal with rules too
local ok = false
for i=1,#vc do
local key = vc[i][1]
@@ -511,6 +513,8 @@ t.colorscheme = tfmtable.colorscheme
tt[#tt+1] = { key, ivc[2]*hdelta }
elseif key == "down" then
tt[#tt+1] = { key, ivc[2]*vdelta }
+ elseif key == "rule" then
+ tt[#tt+1] = { key, ivc[2]*vdelta, ivc[3]*hdelta }
else -- not comment
tt[#tt+1] = ivc -- shared since in cache and untouched
end
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 0d08362b1..5828d9968 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -14,6 +14,12 @@ local lpegmatch = lpeg.match
dir = dir or { }
+-- handy
+
+function dir.current()
+ return (gsub(lfs.currentdir(),"\\","/"))
+end
+
-- optimizing for no string.find (*) does not save time
local attributes = lfs.attributes
@@ -92,29 +98,48 @@ local filter = Cs ( (
)^0 )
local function glob(str,t)
- if type(str) == "table" then
- local t = t or { }
- for s=1,#str do
- glob(str[s],t)
+ if type(t) == "function" then
+ if type(str) == "table" then
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ elseif lfs.isfile(str) then
+ t(str)
+ else
+ local split = lpegmatch(pattern,str)
+ if split then
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,t)
+ end
end
- return t
- elseif lfs.isfile(str) then
- local t = t or { }
- t[#t+1] = str
- return t
else
- local split = lpegmatch(pattern,str)
- if split then
+ if type(str) == "table" then
local t = t or { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = find(base,"%*%*")
- local start = root .. path
- local result = lpegmatch(filter,start .. base)
- glob_pattern(start,result,recurse,action)
+ for s=1,#str do
+ glob(str[s],t)
+ end
+ return t
+ elseif lfs.isfile(str) then
+ local t = t or { }
+ t[#t+1] = str
return t
else
- return { }
+ local split = lpegmatch(pattern,str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = find(base,"%*%*")
+ local start = root .. path
+ local result = lpegmatch(filter,start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end
end
@@ -246,8 +271,7 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
function dir.expand_name(str) -- will be merged with cleanpath and collapsepath
local first, nothing, last = match(str,"^(//)(//*)(.*)$")
if first then
- first = lfs.currentdir() .. "/"
- first = gsub(first,"\\","/")
+ first = dir.current() .. "/"
end
if not first then
first, last = match(str,"^(//)/*(.*)$")
@@ -257,15 +281,13 @@ if string.find(os.getenv("PATH"),";") then -- os.type == "windows"
if first and not find(last,"^/") then
local d = lfs.currentdir()
if lfs.chdir(first) then
- first = lfs.currentdir()
- first = gsub(first,"\\","/")
+ first = dir.current()
end
lfs.chdir(d)
end
end
if not first then
- first, last = lfs.currentdir(), str
- first = gsub(first,"\\","/")
+ first, last = dir.current(), str
end
last = gsub(last,"//","/")
last = gsub(last,"/%./","/")
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index ab63d50e8..887ab4db6 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['lpdf-ini'] = {
license = "see context related readme files"
}
--- This code is very experimental !
-
local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset
local char, byte, format, gsub, concat, match, sub = string.char, string.byte, string.format, string.gsub, table.concat, string.match, string.sub
local utfvalues = string.utfvalues
@@ -436,9 +434,12 @@ local function resetpageproperties()
end
local function setpageproperties()
- texset("global", "pdfpageresources", pageresources ())
- texset("global", "pdfpageattr", pageattributes ())
- texset("global", "pdfpagesattr", pagesattributes())
+--~ texset("global", "pdfpageresources", pageresources ())
+--~ texset("global", "pdfpageattr", pageattributes ())
+--~ texset("global", "pdfpagesattr", pagesattributes())
+ pdf.pageresources = pageresources ()
+ pdf.pageattributes = pageattributes ()
+ pdf.pagesattributes = pagesattributes()
end
function lpdf.addtopageresources (k,v) pageresources [k] = v end
@@ -505,23 +506,13 @@ local function trace_flush(what)
end
end
-local catalog, info, names = pdfdictionary(), pdfdictionary(), pdfdictionary()
-
-local function flushcatalog() if not environment.initex then trace_flush("catalog") pdf.pdfcatalog = catalog() end end
-local function flushinfo () if not environment.initex then trace_flush("info") pdf.pdfinfo = info () end end
-local function flushnames () if not environment.initex then trace_flush("names") pdf.pdfnames = names () end end
-
-if pdf and not pdf.pdfcatalog then
-
- local c_template, i_template, n_template = "\\normalpdfcatalog{%s}", "\\normalpdfinfo{%s}", "\\normalpdfnames{%s}"
-
- flushcatalog = function() if not environment.initex then texsprint(ctxcatcodes,format(c_template,catalog())) end end
- flushinfo = function() if not environment.initex then texsprint(ctxcatcodes,format(i_template,info ())) end end
- flushnames = function() if not environment.initex then texsprint(ctxcatcodes,format(n_template,names ())) end end
+lpdf.protectresources = true
-end
+local catalog, info, names = pdfdictionary(), pdfdictionary(), pdfdictionary()
-lpdf.protectresources = true
+local function flushcatalog() if not environment.initex then trace_flush("catalog") pdf.catalog = catalog() end end
+local function flushinfo () if not environment.initex then trace_flush("info") pdf.info = info () end end
+local function flushnames () if not environment.initex then trace_flush("names") pdf.names = names () end end
function lpdf.addtocatalog(k,v) if not (lpdf.protectresources and catalog[k]) then trace_set("catalog",k) catalog[k] = v end end
function lpdf.addtoinfo (k,v) if not (lpdf.protectresources and info [k]) then trace_set("info", k) info [k] = v end end
diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua
index add198b21..0ecec8634 100644
--- a/tex/context/base/math-ini.lua
+++ b/tex/context/base/math-ini.lua
@@ -287,13 +287,24 @@ function mathematics.big(tfmdata,unicode,n)
local t = tfmdata.characters
local c = t[unicode]
if c then
- local next = c.next
- while next do
- if n <= 1 then
- return next
- else
- n = n - 1
- next = t[next].next
+ local vv = c.vert_variants or c.next and t[c.next].vert_variants
+ if vv then
+ local vvn = vv[n]
+ return vvn and vvn.glyph or vv[#vv].glyph or unicode
+ else
+ local next = c.next
+ while next do
+ if n <= 1 then
+ return next
+ else
+ n = n - 1
+ local tn = t[next].next
+ if tn then
+ next = tn
+ else
+ return next
+ end
+ end
end
end
end
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 87fb8a38a..02bbe0a62 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -16,7 +16,7 @@ local set_attribute = node.set_attribute
local has_attribute = node.has_attribute
local mlist_to_hlist = node.mlist_to_hlist
local font_of_family = node.family_font
-local fontdata = fonts.ids
+local fontdata = fonts.identifiers
local format, rep = string.format, string.rep
local utfchar, utfbyte = utf.char, utf.byte
diff --git a/tex/context/base/math-scr.mkiv b/tex/context/base/math-scr.mkiv
index a8e381e73..eb1db4714 100644
--- a/tex/context/base/math-scr.mkiv
+++ b/tex/context/base/math-scr.mkiv
@@ -28,9 +28,8 @@
\global\let\normalsuper=^
\global\let\normalsuber=_
-\newcount\supersubmode
-
-\newevery\everysupersub \EverySuperSub
+\ifdefined\supersubmode \else \newcount\supersubmode \fi
+\ifdefined\newevery \else \everysupersub \EverySuperSub \fi
\appendtoks \advance\supersubmode \plusone \to \everysupersub
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index bb35e2f83..4d5d9d613 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -205,6 +205,25 @@ local function dots(main,id,size,unicode)
end
end
+local function vertbar(main,id,size,parent,scale,unicode)
+ local characters = main.characters
+ local cp = characters[parent]
+ local sc = scale * size
+ local pc = { "slot", id, parent }
+ characters[unicode] = {
+ width = cp.width,
+ height = cp.height + sc,
+ depth = cp.depth + sc,
+ commands = {
+ push, { "down", -sc }, pc, pop,
+ push, { "down", sc }, pc, pop,
+ pc,
+ },
+ next = cp.next -- can be extensible
+ }
+ cp.next = unicode
+end
+
function fonts.vf.math.alas(main,id,size)
for i=0x7A,0x7D do
make(main,id,size,i,1)
@@ -222,6 +241,10 @@ function fonts.vf.math.alas(main,id,size)
minus(main,id,size,0xFF501)
arrow(main,0x2190,0xFE190,0xFF501,true) -- left
arrow(main,0x2192,0xFE192,0xFF501,false) -- right
+ vertbar(main,id,size,0x0007C,0.10,0xFF601) -- big : 0.85 bodyfontsize
+ vertbar(main,id,size,0xFF601,0.30,0xFF602) -- Big : 1.15 bodyfontsize
+ vertbar(main,id,size,0xFF602,0.30,0xFF603) -- bigg : 1.45 bodyfontsize
+ vertbar(main,id,size,0xFF603,0.30,0xFF604) -- Bigg : 1.75 bodyfontsize
end
local unique = 0 -- testcase: \startTEXpage \math{!\text{-}\text{-}\text{-}} \stopTEXpage
diff --git a/tex/context/base/meta-txt.tex b/tex/context/base/meta-txt.tex
index 18b6d2069..9a16a5bce 100644
--- a/tex/context/base/meta-txt.tex
+++ b/tex/context/base/meta-txt.tex
@@ -24,9 +24,6 @@
% textext ipv btex ... etex
-\ifx\undefined\MPtoks \newtoks\MPtoks \fi
-\ifx\undefined\MPnox \newbox \MPbox \fi
-
\unprotect
\startMPextensions
@@ -37,15 +34,18 @@
% \def\newchar#1{\chardef#1=0 }
-\newdimen\parwidth
-\newdimen\parheight
-\newdimen\parvoffset
-\newdimen\parhoffset
-\newcount\parlines
-\newtoks \partoks
-\newbox \shapetextbox
-\newif \ifparseries
-\chardef \parfirst=0
+\ifdefined\MPtoks \else \newtoks\MPtoks \fi
+\ifdefined\MPnox \else \newbox \MPbox \fi
+
+\ifdefined\newdimen \else \newdimen\parwidth \fi
+\ifdefined\newdimen \else \newdimen\parheight \fi
+\ifdefined\newdimen \else \newdimen\parvoffset \fi
+\ifdefined\newdimen \else \newdimen\parhoffset \fi
+\ifdefined\newcount \else \newcount\parlines \fi
+\ifdefined\newtoks \else \newtoks \partoks \fi
+\ifdefined\newbox \else \newbox \shapetextbox \fi
+\ifdefined\newif \else \newif \ifparseries \fi
+\ifdefined\chardef \else \chardef \parfirst=0 \fi
\def\startshapetext[#1]%
{\global\newcounter\currentshapetext
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index d1e1e2e4a..36bf45c2b 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['mlib-pps'] = { -- prescript, pos
-- current limitation: if we have textext as well as a special color then due to
-- prescript/postscript overload we can have problems
+--
+-- todo: report max textexts
local format, gmatch, concat, round, match = string.format, string.gmatch, table.concat, math.round, string.match
local sprint = tex.sprint
@@ -421,33 +423,59 @@ end
local current_format, current_graphic
-metapost.first_box = metapost.first_box or 1000
-metapost.last_box = metapost.last_box or 1100
-metapost.textext_current = metapost.first_box
+-- metapost.first_box = metapost.first_box or 1000
+-- metapost.last_box = metapost.last_box or 1100
+--~ metapost.textext_current = metapost.first_box
metapost.multipass = false
+local textexts = { }
+
function metapost.free_boxes() -- todo: mp direct list ipv box
- for i = metapost.first_box,metapost.last_box do
- local b = texbox[i]
- if b then
- texbox[i] = nil -- no node.flush_list(b) needed, else double free error
- else
- break
+ -- for i = metapost.first_box,metapost.last_box do
+ -- local b = texbox[i]
+ -- if b then
+ -- texbox[i] = nil -- no node.flush_list(b) needed, else double free error
+ -- else
+ -- break
+ -- end
+ -- end
+ for n, box in next, textexts do
+ local tn = textexts[n]
+ if tn then
+ -- somehow not flushed (used)
+ textexts[n] = nil
end
end
+ textexts = { }
+end
+
+function metapost.settext(box,slot)
+ textexts[slot] = node.copy_list(texbox[box])
+ texbox[box] = nil
+ -- this will become
+ -- textexts[slot] = texbox[box]
+ -- unsetbox(box)
+end
+
+function metapost.gettext(box,slot)
+ texbox[box] = textexts[slot]
+ textexts[slot] = nil
end
function metapost.specials.tf(specification,object)
--~ print("setting", metapost.textext_current)
local n, str = match(specification,"^(%d+):(.+)$")
if n and str then
- if metapost.textext_current < metapost.last_box then
- metapost.textext_current = metapost.first_box + n - 1
- end
+ n = tonumber(n)
+ -- if metapost.textext_current < metapost.last_box then
+ -- metapost.textext_current = metapost.first_box + n - 1
+ -- end
if trace_textexts then
- logs.report("metapost","first pass: order %s, box %s",n,metapost.textext_current)
+ -- logs.report("metapost","first pass: order %s, box %s",n,metapost.textext_current)
+ logs.report("metapost","first pass: order %s",n)
end
- sprint(ctxcatcodes,format("\\MPLIBsettext{%s}{%s}",metapost.textext_current,str))
+ -- sprint(ctxcatcodes,format("\\MPLIBsettext{%s}{%s}",metapost.textext_current,str))
+ sprint(ctxcatcodes,format("\\MPLIBsettext{%s}{%s}",n,str))
metapost.multipass = true
end
return { }, nil, nil, nil
@@ -457,8 +485,10 @@ function metapost.specials.ts(specification,object,result,flusher)
-- print("getting", metapost.textext_current)
local n, str = match(specification,"^(%d+):(.+)$")
if n and str then
+ n = tonumber(n)
if trace_textexts then
- logs.report("metapost","second pass: order %s, box %s",n,metapost.textext_current)
+ -- logs.report("metapost","second pass: order %s, box %s",n,metapost.textext_current)
+ logs.report("metapost","second pass: order %s",n)
end
local op = object.path
local first, second, fourth = op[1], op[2], op[4]
@@ -470,18 +500,24 @@ function metapost.specials.ts(specification,object,result,flusher)
if not trace_textexts then
object.path = nil
end
- local before = function() -- no need for function
+ local before = function() -- no need for before function (just do it directly)
--~ flusher.flushfigure(result)
--~ sprint(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)
flusher.flushfigure(result)
- if metapost.textext_current < metapost.last_box then
- metapost.textext_current = metapost.first_box + n - 1
+ -- if metapost.textext_current < metapost.last_box then
+ -- metapost.textext_current = metapost.first_box + n - 1
+ -- end
+ -- local b = metapost.textext_current
+ -- local box = texbox[b]
+ local box = textexts[n]
+ if box then
+ -- sprint(ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",b,metapost.sxsy(box.width,box.height,box.depth)))
+ sprint(ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",n,metapost.sxsy(box.width,box.height,box.depth)))
+ else
+ -- error
end
- local b = metapost.textext_current
- local box = texbox[b]
- sprint(ctxcatcodes,format("\\MPLIBgettextscaled{%s}{%s}{%s}",b, metapost.sxsy(box.width,box.height,box.depth)))
result = { "Q" }
return object, result
end
@@ -693,12 +729,13 @@ end
function metapost.text_texts_data()
local t, n = { }, 0
- for i = metapost.first_box, metapost.last_box do
- n = n + 1
+--~ for i = metapost.first_box, metapost.last_box do
+--~ n = n + 1
+--~ local box = texbox[i]
+ for n, box in next, textexts do
if trace_textexts then
logs.report("metapost","passed data: order %s, box %s",n,i)
end
- local box = texbox[i]
if box then
t[#t+1] = format("_tt_w_[%i]:=%f;_tt_h_[%i]:=%f;_tt_d_[%i]:=%f;",
n,box.width/factor,n,box.height/factor,n,box.depth/factor)
@@ -706,6 +743,7 @@ function metapost.text_texts_data()
break
end
end
+--~ print(table.serialize(t))
return t
end
@@ -724,7 +762,7 @@ function metapost.graphic_base_pass(mpsformat,str,preamble,askedfig)
else
preamble, done_2, forced_2 = "", false, false
end
- metapost.textext_current = metapost.first_box
+ -- metapost.textext_current = metapost.first_box
metapost.intermediate.needed = false
metapost.multipass = false -- no needed here
current_format, current_graphic = mpsformat, str
@@ -763,7 +801,7 @@ end
function metapost.graphic_extra_pass(askedfig)
local nofig = (askedfig and "") or false
- metapost.textext_current = metapost.first_box
+ -- metapost.textext_current = metapost.first_box
metapost.process(current_format, {
nofig or "beginfig(1); ",
"_trial_run_ := false ;",
diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv
index fd9a3c29e..72a3c0bb0 100644
--- a/tex/context/base/mlib-pps.mkiv
+++ b/tex/context/base/mlib-pps.mkiv
@@ -26,6 +26,12 @@
% this will move !
+% Instead of preallocated boxes we now use a table of lists so that we
+% have no limitation. Typically an example of a next version solution
+% due to \LUATEX\ evolving.
+
+\newbox\MPtextbox
+
\def\MPLIBfigure#1#2#3#4#5#6#7% todo: move Q q to lua
{\setbox\scratchbox\hbox{\externalfigure[#7]}%
\ctxlua{metapost.edefsxsy(\number\wd\scratchbox,\number\ht\scratchbox,0)}%
@@ -33,25 +39,31 @@
\vbox to \zeropoint{\vss\hbox to \zeropoint{\scale[sx=\sx,sy=\sy]{\box\scratchbox}\hss}}%
\pdfliteral direct{Q}}
-\def\MPLIBsettext#1% #2% we could as well store in hlists at the lua end i.e. just one box
- {\global\setbox#1\hbox}
-% {\global\setbox#1\hbox\bgroup\the\everyMPLIBtext\let\next}
-
-\def\MPLIBfreetext#1%
- {\global\setbox#1\emptybox}
+\def\MPLIBsettext#1% #2%
+ {\dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
\def\MPLIBgettextscaled#1#2#3% why a copy
- {\vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp#1\copy#1}\hss}}}
-
-\def\MPLIBallocate#1%
- {\newbox\MPLIBfirst
- \dorecurse{\numexpr#1-1\relax}{\let\MPLIBlast\relax\newbox\MPLIBlast}%
- \MPLIBregister}
-
-\def\MPLIBregister % after allocate!
- {\ctxlua{metapost.first_box, metapost.last_box = \number\MPLIBfirst, \number\MPLIBlast}}
+ {\ctxlua{metapost.gettext(\number\MPtextbox,#1)}%
+ \vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp\MPtextbox\box\MPtextbox}\hss}}}
\def\MPLIBgraphictext#1%
{\startTEXpage[\c!scale=10000]#1\stopTEXpage}
\protect \endinput
+
+% \def\MPLIBsettext#1% #2% we could as well store in hlists at the lua end i.e. just one box
+% {\global\setbox#1\hbox}
+%
+% \def\MPLIBfreetext#1%
+% {\global\setbox#1\emptybox}
+%
+% \def\MPLIBgettextscaled#1#2#3% why a copy
+% {\vbox to \zeropoint{\vss\hbox to \zeropoint{\black\scale[sx=#2,sy=#3]{\raise\dp#1\copy#1}\hss}}}
+%
+% \def\MPLIBallocate#1%
+% {\newbox\MPLIBfirst
+% \dorecurse{\numexpr#1-1\relax}{\let\MPLIBlast\relax\newbox\MPLIBlast}%
+% \MPLIBregister}
+%
+% \def\MPLIBregister % after allocate!
+% {\ctxlua{metapost.first_box, metapost.last_box = \number\MPLIBfirst, \number\MPLIBlast}}
diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv
index ae53abd8c..568314ff8 100644
--- a/tex/context/base/page-ini.mkiv
+++ b/tex/context/base/page-ini.mkiv
@@ -1067,7 +1067,9 @@
\executepagebreakhandler\v!yes
\fi
\ifnum\prevrealpageno<\realpageno
+\ifcase\pageornamentstate\or
\global\chardef\pageornamentstate\zerocount
+\fi
\fi
\egroup}
diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv
index 16a405c08..4fb3e04a2 100644
--- a/tex/context/base/page-lay.mkiv
+++ b/tex/context/base/page-lay.mkiv
@@ -1188,7 +1188,7 @@
\c!leftedgedistance=\layoutparameter\c!edgedistance,
\c!leftmargin=\layoutparameter\c!margin,
\c!leftmargindistance=\layoutparameter\c!margindistance,
- \c!width=.71428571429\paperwidth, % 15.0cm
+ \c!width=.71428571429\paperwidth, % 15.0cm \dimexpr\
\c!rightmargindistance=\layoutparameter\c!margindistance,
\c!rightmargin=\layoutparameter\c!margin,
\c!rightedgedistance=\layoutparameter\c!edgedistance,
diff --git a/tex/context/base/pret-lua.lua b/tex/context/base/pret-lua.lua
index 67fc85368..b8553db07 100644
--- a/tex/context/base/pret-lua.lua
+++ b/tex/context/base/pret-lua.lua
@@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['pret-lua'] = {
license = "see context related readme files"
}
+-- this is not a real parser as we also want to typeset wrong output
+-- and a real parser would choke on that
+
local utf = unicode.utf8
local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues
@@ -136,6 +139,22 @@ end
-- we will also provide a proper parser based pretty printer although normaly
-- a pretty printer should handle faulty code too (educational purposes)
+local function written(state,c,i)
+ if c == " " then
+ state = finish_state(state)
+ texsprint(ctxcatcodes,"\\obs")
+ elseif c == "\t" then
+ state = finish_state(state)
+ texsprint(ctxcatcodes,"\\obs")
+ if buffers.visualizers.enabletab then
+ texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength))
+ end
+ else
+ texwrite(c)
+ end
+ return state, 0
+end
+
function visualizer.flush_line(str, nested)
local state, instr, inesc, word = 0, false, false, nil
buffers.currentcolors = colors
@@ -167,8 +186,9 @@ function visualizer.flush_line(str, nested)
if pre then
code = pre
end
- local p, s = nil, nil
+ local p, s, i = nil, nil, 0
for c in utfcharacters(code) do
+ i = i + 1
if instr then
if p then
texwrite(p)
@@ -191,7 +211,7 @@ function visualizer.flush_line(str, nested)
else
inesc = false
end
- texwrite(c)
+ state, i = written(state,c,i)
end
elseif c == "[" then
if word then
@@ -206,7 +226,7 @@ function visualizer.flush_line(str, nested)
p = nil
else
if p then
- texwrite(p)
+ state, i = written(state,p,i)
end
p = c
end
@@ -223,7 +243,7 @@ function visualizer.flush_line(str, nested)
p = nil
else
if p then
- texwrite(p)
+ state, i = written(state,p,i)
end
p = c
end
@@ -234,18 +254,18 @@ function visualizer.flush_line(str, nested)
state = finish_state(state)
p = nil
end
- if c == " " then
+ if c == " " or c == "\t" then
if word then
state = flush_lua_word(state,word)
word = nil
end
- texsprint(ctxcatcodes,"\\obs")
+ state, i = written(state,c,i)
elseif inlongstring then
- texwrite(c)
+ state, i = written(state,c,i)
elseif c == '"' or c == "'" then
instr = true
state = change_state(states[c],state)
- texwrite(c)
+ state, i = written(state,c,i)
state = finish_state(state)
s = c
elseif find(c,"^[%a]$") then
@@ -262,17 +282,18 @@ function visualizer.flush_line(str, nested)
end
end
end
-if p then
- texwrite(p)
- p = nil
-end
+ if p then
+ texwrite(p)
+ -- state, i = written(state,p,i)
+ p = nil
+ end
state = flush_lua_word(state,word)
if post then
state = change_state(states['--'], state)
texwrite("--")
state = finish_state(state)
for c in utfcharacters(post) do
- if c == " " then texsprint(ctxcatcodes,"\\obs") else texwrite(c) end
+ state, i = written(state,c,i)
end
end
end
@@ -281,7 +302,10 @@ end
state = change_state(states['--'], state)
texwrite("[[")
state = finish_state(state)
- texwrite(comment)
+ -- texwrite(comment) -- maybe also split and
+ for c in utfcharacters(comment) do
+ state, i = written(state,c,i)
+ end
end
state = finish_state(state)
end
diff --git a/tex/context/base/pret-tex.lua b/tex/context/base/pret-tex.lua
index 475cd6c8c..5d128fa3b 100644
--- a/tex/context/base/pret-tex.lua
+++ b/tex/context/base/pret-tex.lua
@@ -37,9 +37,10 @@ local chardata = characters.data
local is_letter = characters.is_letter
function visualizer.flush_line(str,nested)
- local state, first = 0, false
+ local state, first, i = 0, false, 0
buffers.currentcolors = colors
for c in utfcharacters(str) do
+ i = i + 1
if c == " " then
state = finish_state(state)
texsprint(ctxcatcodes,"\\obs")
@@ -49,6 +50,7 @@ function visualizer.flush_line(str,nested)
texsprint(ctxcatcodes,"\\obs")
if buffers.visualizers.enabletab then
texsprint(ctxcatcodes,rep("\\obs ",i%buffers.visualizers.tablength))
+ i = 0
end
first = false
elseif first then
diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv
index c457f812c..535d63ac1 100644
--- a/tex/context/base/strc-des.mkiv
+++ b/tex/context/base/strc-des.mkiv
@@ -424,10 +424,11 @@
\csname @@description\currentdescriptionlocation\endcsname} % args not needed
\def\@@makedescription[#1]#2%
- {\postponenotes % new, assumes grouping
- \doenumerationcheckconditions
- \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]%
- \@@dostartdescriptionindeed}
+ {\postponenotes % new, assumes grouping
+ \edef\currentdescriptionreference{#1}%
+ \doenumerationcheckconditions
+ \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]%
+ \@@dostartdescriptionindeed}
\def\dostartstoreddescription
{\@@dostartdescriptionindeed}
diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv
index 6af0a1434..40df985df 100644
--- a/tex/context/base/strc-flt.mkiv
+++ b/tex/context/base/strc-flt.mkiv
@@ -71,8 +71,8 @@
% todo: everysetupfloat everysetupcaption for all floats
-\def\setupfloats {\dosingleargument\dosetupfloats} % was \??bk
-\def\setupcaptions{\dosingleargument\dosetupcaptions}
+\unexpanded\def\setupfloats {\dosingleargument\dosetupfloats} % was \??bk
+\unexpanded\def\setupcaptions{\dosingleargument\dosetupcaptions}
\let\alldefinedfloats\empty
@@ -208,8 +208,8 @@
%D Individial settings:
-\def\setupfloat {\dodoubleargument\dosetupfloat}
-\def\setupcaption{\dodoubleargument\dosetupcaption}
+\unexpanded\def\setupfloat {\dodoubleargument\dosetupfloat}
+\unexpanded\def\setupcaption{\dodoubleargument\dosetupcaption}
\newtoks\everysetupfloat
\newtoks\everysetupcaption
@@ -337,7 +337,7 @@
% NOT YET REDONE ! ! ! ! !
- \def\placefloatcaption
+ \unexpanded\def\placefloatcaption
{\dodoubleempty\doplacefloatcaption}
\long\def\doplacefloatcaption[#1][#2]#3%
@@ -345,7 +345,7 @@
\placefloatcaptiontext[#1]%
\placefloatcaptionreference[#1]}
- \def\setfloatcaption % \dosetfloatcaption already in use
+ \unexpanded\def\setfloatcaption % \dosetfloatcaption already in use
{\dodoubleempty\dodosetfloatcaption} % beware, name clash
\long\def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
@@ -1007,6 +1007,7 @@
\newdimen\floatwidth
\newdimen\floatheight
+\newdimen\floatdepth
\def\dosavefloatinfo {\showmessage\m!floatblocks2{\the\totalnoffloats}}
\def\doinsertfloatinfo {\showmessage\m!floatblocks4{\the\totalnoffloats}}
@@ -1979,29 +1980,24 @@
\newif\ifparfloat
-\long\def\dosetfloatbox#1#2#3% todo : \global\setbox
+\long\def\dosetfloatbox#1#2#3% todo : \global\setbox, currently messy
{\ifvisible
\par
\edef\floatcaptiondirectives{\floatparameter\c!location,\floatcaptionparameter\c!location}%
\ifparfloat\@EA\dosetparfloat\else\@EA\dosetpagfloat\fi{#1}{#2}{#3}%
\setlocalfloatdimensions{#1}%
+ \global\advance\totalnoffloats\plusone
\setbox\floatbox\hbox{\dosavefloatdata\box\floatbox}% still needed? we will do renumbering differently
- \global\floatheight\ht\floatbox
- \global\advance\floatheight \dp\floatbox
+ \global\floatheight\htdp\floatbox
\global\floatwidth\wd\floatbox
- \global\advance\totalnoffloats \plusone
\doifnotinset\v!margin{#1} % gaat namelijk nog fout
{\setbox\floatbox\vbox
{\parindent\zeropoint
\doifconcepttracing{\inleftmargin{\framed{\infofont\the\totalnoffloats}}}%
\box\floatbox}}%
\wd\floatbox\floatwidth
- \dimen0=\floatheight
- \advance\dimen0 \lineheight
- \ifdim\dimen0<\textheight
- \else
- \global\floatheight\textheight
- \global\advance\floatheight -\lineheight
+ \ifdim\dimexpr\floatheight+\lineheight\relax<\textheight \else
+ \global\floatheight\dimexpr\textheight-\lineheight\relax
\ht\floatbox\floatheight
\dp\floatbox\zeropoint
\showmessage\m!floatblocks{10}{\the\totalnoffloats}%
diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv
index 4f89ac4d6..fd146d4cd 100644
--- a/tex/context/base/strc-not.mkiv
+++ b/tex/context/base/strc-not.mkiv
@@ -294,15 +294,15 @@
\dochecknote}
\appendtoks
- \letvalue{\??vn\c!rule:c:\currentnote}\normalnoterule % hm
+ \setvalue{\??vn\c!rule:c:\currentnote}{\normalnoterule}% hm
\letvalue{\??vn\c!rule:a:\currentnote}\v!left
\to \everysetupnote
\appendtoks
\expanded{\processallactionsinset
[\noteparameter\c!rule]}
- [ \v!on=>\letvalue{\??vn\c!rule:c:\currentnote}\normalnoterule,
- \v!normal=>\letvalue{\??vn\c!rule:c:\currentnote}\normalnoterule,
+ [ \v!on=>\setvalue{\??vn\c!rule:c:\currentnote}{\normalnoterule}, % no let as it can be changed afterwards
+ \v!normal=>\setvalue{\??vn\c!rule:c:\currentnote}{\normalnoterule},
\v!left=>\setvalue{\??vn\c!rule:a:\currentnote}{l2r},
\v!right=>\setvalue{\??vn\c!rule:a:\currentnote}{r2l},
\v!off=>\letvalue{\??vn\c!rule:c:\currentnote}\relax,
@@ -593,14 +593,13 @@
\def\@@somenotedescription {\@@notemakedescription}
\def\@@startsomenotedescription{\@@notemakedescription}
-\def\@@notemakedescription[#1]#2#3% todo ... proper [key=value] etc
+\def\@@notemakedescription[#1]#2#3%
{\ifnotesenabled
+ \edef\currentdescriptionreference{#1}%
\iftrialtypesetting
- % some day a roll back
-% temp hack
-\doenumerationcheckconditions
-\let\currentnote\currentdescriptionmain
-\typesetdummynotesymbol
+ \doenumerationcheckconditions
+ \let\currentnote\currentdescriptionmain
+ \typesetdummynotesymbol
\else
\begingroup
\doenumerationcheckconditions
@@ -631,14 +630,6 @@
\endgroup
\fi
\fi
-% \ifconditional\skipnoteplacement \else
-% \kern\notesignal\relax % \relax is needed to honor spaces
-% \iftrialtypesetting
-% % todo: reserve some space for symbol, in that case we need to be able to roll back notes
-% \else
-% \global\setfalse\skipnoteplacement
-% \fi
-% \fi}
\ifconditional\skipnoteplacement
\global\setfalse\skipnoteplacement
\else
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index dbc679672..080ff1b95 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -3614,7 +3614,7 @@
\csname t\strippedcsname#1\endcsname}
\def\newevery#1#2%
- {\newtoks#1% we test for redefinition elsewhere
+ {\ifx#1\everypar\else\newtoks#1\fi% we test for redefinition elsewhere
\ifx#2\relax\else\ifdefined#2\else
\expandafter\newtoks\csname t\strippedcsname#1\endcsname
\def#2{\dowithevery#1}%
diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv
index 5015473e0..7f9373678 100644
--- a/tex/context/base/tabl-tab.mkiv
+++ b/tex/context/base/tabl-tab.mkiv
@@ -2376,7 +2376,7 @@
% De macro's t.b.v. instellingen.
-\def\setuptables
+\unexpanded\def\setuptables
{\dosingleargument\dosetuptables}
\def\dosetuptables[#1]%
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 6d7eb16ae..5718e6db4 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -15,6 +15,8 @@
% \processbetween gebruiken in head/tail macros
+% todo: \aligntab \alignmark (after 0.60 is out)
+
\unprotect
%D I can probably reimplement this using a \LUA||\TEX\ combination
@@ -1462,7 +1464,7 @@
% \NC \digits $@@@.@@1,@@$ \NC\NR
% \stoptabulatie
-\def\setuptabulate
+\unexpanded\def\setuptabulate
{\dotripleempty\dosetuptabulate}
\def\dosetuptabulate[#1][#2][#3]%
diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv
index 836256b39..3d41371b7 100644
--- a/tex/context/base/type-otf.mkiv
+++ b/tex/context/base/type-otf.mkiv
@@ -1683,4 +1683,11 @@
\stoptypescriptcollection
+
+% \starttypescript [math] [hvmath]
+% \definefontsynonym[MathRoman][hvmath@hvmath-math]
+% \loadfontgoodies[hvmath-math]
+% \stoptypescript
+
+
\protect \endinput
diff --git a/tex/context/base/typo-cap.mkiv b/tex/context/base/typo-cap.mkiv
index bc4b9a00c..f03841322 100644
--- a/tex/context/base/typo-cap.mkiv
+++ b/tex/context/base/typo-cap.mkiv
@@ -56,6 +56,8 @@
\gdef\setcharactercasing[##1]{\attribute\caseattribute##1\relax}%
\setcharactercasing}
+% todo: names casings
+
\unexpanded\def\WORD {\groupedcommand{\setcharactercasing[\plusone ]}{}}
\unexpanded\def\word {\groupedcommand{\setcharactercasing[\plustwo ]}{}}
\unexpanded\def\Word {\groupedcommand{\setcharactercasing[\plusthree]}{}}
@@ -177,7 +179,7 @@
\def\setupcapitals
{\dosingleempty\dosetupcapitals}
-\def\dosetupcapitals[#1]%
+\def\dosetupcapitals[#1]% todo: don't use grouping just a switch
{\getparameters[\??kk][#1]%
\doifelse\@@kktitle\v!yes
{\definealternativestyle[\v!capital][\normalsmallcapped][\normalsmallcapped]%
diff --git a/tex/context/sample/sample.tex b/tex/context/sample/sample.tex
index d54d8b747..5f97ea009 100644
--- a/tex/context/sample/sample.tex
+++ b/tex/context/sample/sample.tex
@@ -9,39 +9,40 @@ If someone makes a nice bibtex file of these, the quotes can also be
used in testing bibliographic references and citations.
\starttabulate[|l|l|p|]
-\NC \bf file \NC \bf author \NC \bf source \NC \NR
+\NC \bf file \NC \bf author \NC \bf source \NC \NR
\HL
-%NC stork.tex \NC David F. Stork \NC \NC \NR
-\NC knuth.tex \NC Donald E. Knuth \NC \NC \NR
-\NC tufte.tex \NC Edward R. Tufte \NC \NC \NR
-\NC reich.tex \NC Steve Reich \NC \NC \NR
-\NC materie.tex \NC Louis Andriessen \NC De Materie \NC \NR
-\NC douglas.tex \NC Douglas R. Hofstadter \NC \NC \NR
-\NC dawkins.tex \NC Dawkins \NC \NC \NR
-\NC ward.tex \NC Peter D. Ward \NC The Life and Death of Planet Earth \NC \NR
-\NC zapf.tex \NC Hermann Zapf \NC About micro-typography and the hz-program, \endgraf
- Electronic Publishing, vol. 6(3), \endgraf
- 283-288 (September 1993) \NC \NR
-\NC bryson.tex \NC Bill Bryson \NC A Short History of Nearly Everything, \endgraf
- Random House, 2003 \NC \NR
-\NC davis.tex \NC Kenneth C. Davis \NC Don't Know Much About History, \endgraf
- Everything You Need to Know About American
- History but Never Learned, \endgraf
- HarperCollins, 2003 \NC \NR
-\NC thuan.tex \NC Trinh Xuan Thuan \NC Chaos and Harmony, Perspectives on Scientific
- Revolutions of the Twentieth Century, \endgraf
- Oxford University Press, 2001 \NC \NR
-\NC hawking.tex \NC Steve W. Hawking \NC The Universe in a Nutshell, Bantam Books
- Random House, 2001 \NC \NR
-\NC linden.tex \NC Eugene Linden \NC The Winds of Change, Climate, Weather, and the
- Destruction of Civilizations, \endgraf
- Simon \& Schuster, 2006, p.106 \NC \NR
-\NC weisman.tex \NC Alan Weisman \NC The World Without Us, \endgraf
- Thomas Dunne Books, 2007, p.160 \NC \NR
-\NC montgomery.tex \NC David R Montgomery \NC Dirt, The Erosion of Civilizations, \endgraf
- University of California Press, 2007, p.199 \NC \NR
-\NC carrol.tex \NC Sean B. Carrol \NC The Making of the Fittest, \endgraf
- Quercus, London, 2006 \NC \NR
+%NC stork.tex \NC David F. Stork \NC \NC \NR
+\NC knuth.tex \NC Donald E. Knuth \NC \NC \NR
+\NC tufte.tex \NC Edward R. Tufte \NC \NC \NR
+\NC reich.tex \NC Steve Reich \NC \NC \NR
+\NC materie.tex \NC Louis Andriessen \NC De Materie \NC \NR
+\NC douglas.tex \NC Douglas R. Hofstadter \NC \NC \NR
+\NC dawkins.tex \NC Dawkins \NC \NC \NR
+\NC ward.tex \NC Peter D. Ward \NC The Life and Death of Planet Earth \NC \NR
+\NC zapf.tex \NC Hermann Zapf \NC About micro-typography and the hz-program, \endgraf
+ Electronic Publishing, vol. 6(3), \endgraf
+ 283-288 (September 1993) \NC \NR
+\NC bryson.tex \NC Bill Bryson \NC A Short History of Nearly Everything, \endgraf
+ Random House, 2003 \NC \NR
+\NC davis.tex \NC Kenneth C. Davis \NC Don't Know Much About History, \endgraf
+ Everything You Need to Know About American
+ History but Never Learned, \endgraf
+ HarperCollins, 2003 \NC \NR
+\NC thuan.tex \NC Trinh Xuan Thuan \NC Chaos and Harmony, Perspectives on Scientific
+ Revolutions of the Twentieth Century, \endgraf
+ Oxford University Press, 2001 \NC \NR
+\NC hawking.tex \NC Steve W. Hawking \NC The Universe in a Nutshell, Bantam Books
+ Random House, 2001 \NC \NR
+\NC linden.tex \NC Eugene Linden \NC The Winds of Change, Climate, Weather, and the
+ Destruction of Civilizations, \endgraf
+ Simon \& Schuster, 2006, p.106 \NC \NR
+\NC weisman.tex \NC Alan Weisman \NC The World Without Us, \endgraf
+ Thomas Dunne Books, 2007, p.160 \NC \NR
+\NC montgomery.tex \NC David R Montgomery \NC Dirt, The Erosion of Civilizations, \endgraf
+ University of California Press, 2007, p.199 \NC \NR
+\NC carrol.tex \NC Sean B. Carrol \NC The Making of the Fittest, \endgraf
+ Quercus, London, 2006 \NC \NR
+%NC schwarzenegger.tex \NC Arnold Schwarzenegger \NC Several place on the World Wide Web. \NC \NR
\stoptabulate
% Tufte: This quote will always produce hyphenated text, apart from the content,
@@ -68,4 +69,7 @@ used in testing bibliographic references and citations.
% The Making of the Fittest: nice sample for color ans subsentence testing. A very
% readable book but unfortunately it has inter-character spacing.
+% The Schwarzenegger letter was originally typeset at a width equivalent to 16.1cm in
+% a default ConTeXt setup.
+
\stoptext