summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-05-27 13:47:00 +0200
committerHans Hagen <pragma@wxs.nl>2010-05-27 13:47:00 +0200
commit37850ef35f93a14936b4d7d33790d14c050bbbb4 (patch)
tree74e469e150bd989ced66e107bd1d73a640149521 /tex
parente08195a7149edffddb4b69b480676fad336a7613 (diff)
downloadcontext-37850ef35f93a14936b4d7d33790d14c050bbbb4.tar.gz
beta 2010.05.27 13:47
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/buff-ini.lua11
-rw-r--r--tex/context/base/buff-ini.mkiv23
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-env.mkiv4
-rw-r--r--tex/context/base/data-res.lua32
-rw-r--r--tex/context/base/data-use.lua4
-rw-r--r--tex/context/base/font-def.lua25
-rw-r--r--tex/context/base/font-ini.lua5
-rw-r--r--tex/context/base/font-ini.mkiv84
-rw-r--r--tex/context/base/font-syn.lua3
-rw-r--r--tex/context/base/l-file.lua79
-rw-r--r--tex/context/base/luat-exe.lua22
-rw-r--r--tex/context/base/lxml-tex.lua9
-rw-r--r--tex/context/base/math-int.mkiv41
-rw-r--r--tex/context/base/mult-ini.mkiv138
-rw-r--r--tex/context/fonts/informal-math.lfg2
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua111
18 files changed, 422 insertions, 175 deletions
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 6b1af8f96..fa95eaae4 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['buff-ini'] = {
license = "see context related readme files"
}
+-- todo: deal with jobname here, or actually, "" is valid as well
+
-- ctx lua reference model / hooks and such
-- to be optimized
@@ -337,6 +339,15 @@ end
buffers.content = content
+function buffers.evaluate(name)
+ local ok = loadstring(content(name))
+ if ok then
+ ok()
+ else
+ logs.report("buffers","invalid lua code in buffer '%s'",name)
+ end
+end
+
function buffers.collect(names,separator) -- no print
-- maybe we should always store a buffer as table so
-- that we can pass it directly
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index 86b0fa3c5..13f69554f 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -15,6 +15,10 @@
\registerctxluafile{buff-ini}{1.001}
+% todo: move all to lua, also before and after, just context.beforebuffer()
+% todo: commalist to lua end
+% todo: jobname == "" so no need for testing
+
% todo:
%
% \startluacode
@@ -352,4 +356,23 @@
\def\dosavebuffer[#1][#2]{\ctxlua{commands.savebuffer("#1","#2")}}
+%D Experimental: no expansion of commands in buffer!
+
+% \startbuffer[what]
+% tex.print("WHAT")
+% \stopbuffer
+% \startbuffer
+% tex.print("JOBNAME")
+% \stopbuffer
+%
+% \ctxluabuffer[what] \ctxluabuffer
+
+\def\ctxluabuffer
+ {\dosingleempty\doctxluabuffer}
+
+\def\doctxluabuffer[#1]%
+ {\doifelsenothing{#1}
+ {\ctxlua{buffers.evaluate("\jobname")}}
+ {\ctxlua{buffers.evaluate("#1")}}}
+
\protect \endinput
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 9c4fdba18..1a8984843 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.05.24 13:05}
+\newcontextversion{2010.05.27 13:47}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 47489658e..bea8f5212 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.05.24 13:05}
+\edef\contextversion{2010.05.27 13:47}
%D For those who want to use this:
diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv
index d927ff3ad..16ac5c43b 100644
--- a/tex/context/base/core-env.mkiv
+++ b/tex/context/base/core-env.mkiv
@@ -171,7 +171,7 @@
\unexpanded\def\startsetups{} % to please dep checker
\unexpanded\def\stopsetups {} % to please dep checker
-\expanded
+\expanded % will become obsolete
{\long\def\@EA\noexpand\csname\e!start\v!setups\endcsname
{\begingroup\noexpand\doifnextoptionalelse
{\noexpand\dostartsetupsA\@EA\noexpand\csname\e!stop\v!setups\endcsname}
@@ -241,7 +241,7 @@
\def\dostartsetups
{\ifthirdargument\@EA\dostartsetupsC\else\@EA\dostartsetupsD\fi}
-\long\def\dodostartsetups#1#2#3%
+\long\def\dodostartsetups#1#2#3% needs a speedup
{\long\def\dododostartsetups##1#1%
{\endgroup
\dodoglobal % bah
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index ecef14188..6e04ae518 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -1223,8 +1223,11 @@ function resolvers.expand_variables()
local expansions, environment, variables = { }, instance.environment, instance.variables
local env = resolvers.env
instance.expansions = expansions
- if instance.engine ~= "" then environment['engine'] = instance.engine end
- if instance.progname ~= "" then environment['progname'] = instance.progname end
+ local engine, progname = instance.engine, instance.progname
+ if type(engine) ~= "string" then instance.engine, engine = "", "" end
+ if type(progname) ~= "string" then instance.progname, progname = "", "" end
+ if engine ~= "" then environment['engine'] = engine end
+ if progname ~= "" then environment['progname'] = progname end
for k,v in next, environment do
local a, b = match(k,"^(%a+)%_(.*)%s*$")
if a and b then
@@ -1628,7 +1631,8 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
end
else
local suffixes = resolvers.suffixes_of_format(instance.format)
- for _, s in next, suffixes do
+ for i=1,#suffixes do
+ local s = suffixes[i]
forcedname = filename .. "." .. s
if resolvers.isreadable.file(forcedname) then
if trace_locating then
@@ -1690,6 +1694,10 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
else
-- search spec
local filetype, extra, done, wantedfiles, ext = '', nil, false, { }, file.extname(filename)
+ -- tricky as filename can be bla.1.2.3
+--~ if not suffixmap[ext] then --- probably needs to be done elsewhere too
+--~ wantedfiles[#wantedfiles+1] = filename
+--~ end
if ext == "" then
if not instance.force_suffixes then
wantedfiles[#wantedfiles+1] = filename
@@ -1698,7 +1706,7 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
wantedfiles[#wantedfiles+1] = filename
end
if instance.format == "" then
- if ext == "" then
+ if ext == "" or not suffixmap[ext] then
local forcedname = filename .. '.tex'
wantedfiles[#wantedfiles+1] = forcedname
filetype = resolvers.format_of_suffix(forcedname)
@@ -1712,10 +1720,10 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
end
end
else
- if ext == "" then
- local suffixes = resolvers.suffixes_of_format(instance.format)
- for _, s in next, suffixes do
- wantedfiles[#wantedfiles+1] = filename .. "." .. s
+ local suffixes = resolvers.suffixes_of_format(instance.format)
+ if ext == "" or not suffixmap[ext] then
+ for i=1,#suffixes do
+ wantedfiles[#wantedfiles+1] = filename .. "." .. suffixes[i]
end
end
filetype = instance.format
@@ -1792,16 +1800,16 @@ local function collect_instance_files(filename,collected) -- todo : plugin (scan
done = true
if instance.allresults then
if trace_detail then
- logs.report("fileio","match in hash for file '%s' on path '%s', continue scanning",f,d)
+ logs.report("fileio","match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d)
end
else
if trace_detail then
- logs.report("fileio","match in hash for file '%s' on path '%s', quit scanning",f,d)
+ logs.report("fileio","match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d)
end
break
end
elseif trace_detail then
- logs.report("fileio","no match in hash for file '%s' on path '%s'",f,d)
+ logs.report("fileio","no match to '%s' in hash for file '%s' and path '%s'",expression,f,d)
end
end
end
@@ -1999,6 +2007,8 @@ function resolvers.load(option)
resolvers.automount()
end
statistics.stoptiming(instance)
+ local files = instance.files
+ return files and next(files)
end
function resolvers.for_files(command, files, filetype, mustexist)
diff --git a/tex/context/base/data-use.lua b/tex/context/base/data-use.lua
index 5ecd7805f..adc4b9063 100644
--- a/tex/context/base/data-use.lua
+++ b/tex/context/base/data-use.lua
@@ -112,11 +112,11 @@ function statistics.check_fmt_status(texname)
local sourcehash = md5.hex(io.loaddata(resolvers.find_file(luv.sourcefile)) or "unknown")
local luvbanner = luv.enginebanner or "?"
if luvbanner ~= enginebanner then
- return string.format("engine mismatch (luv:%s <> bin:%s)",luvbanner,enginebanner)
+ return format("engine mismatch (luv: %s <> bin: %s)",luvbanner,enginebanner)
end
local luvhash = luv.sourcehash or "?"
if luvhash ~= sourcehash then
- return string.format("source mismatch (luv:%s <> bin:%s)",luvhash,sourcehash)
+ return format("source mismatch (luv: %s <> bin: %s)",luvhash,sourcehash)
end
else
return "invalid status file"
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index c3b10162c..01dca866c 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -233,18 +233,29 @@ end
define.resolvers = resolvers
+-- todo: reporter
+
function define.resolvers.file(specification)
- specification.forced = file.extname(specification.name)
- specification.name = file.removesuffix(specification.name)
+ local suffix = file.suffix(specification.name)
+ if fonts.formats[suffix] then
+ specification.forced = suffix
+ specification.name = file.removesuffix(specification.name)
+ end
end
function define.resolvers.name(specification)
local resolve = fonts.names.resolve
if resolve then
- specification.resolved, specification.sub = fonts.names.resolve(specification.name,specification.sub)
- if specification.resolved then
- specification.forced = file.extname(specification.resolved)
- specification.name = file.removesuffix(specification.resolved)
+ local resolved, sub = fonts.names.resolve(specification.name,specification.sub)
+ specification.resolved, specification.sub = resolved, sub
+ if resolved then
+ local suffix = file.suffix(resolved)
+ if fonts.formats[suffix] then
+ specification.forced = suffix
+ specification.name = file.removesuffix(resolved)
+ else
+ specification.name = resolved
+ end
end
else
define.resolvers.file(specification)
@@ -456,7 +467,7 @@ end
local function check_otf(forced,specification,suffix,what)
local name = specification.name
if forced then
- name = file.addsuffix(name,suffix)
+ name = file.addsuffix(name,suffix,true)
end
local fullname, tfmtable = resolvers.findbinfile(name,suffix) or "", nil -- one shot
if fullname == "" then
diff --git a/tex/context/base/font-ini.lua b/tex/context/base/font-ini.lua
index e45149781..c695ec4ae 100644
--- a/tex/context/base/font-ini.lua
+++ b/tex/context/base/font-ini.lua
@@ -13,6 +13,7 @@ if not modules then modules = { } end modules ['font-ini'] = {
local utf = unicode.utf8
local format, serialize = string.format, table.serialize
local write_nl = texio.write_nl
+local lower = string.lower
if not fontloader then fontloader = fontforge end
@@ -84,12 +85,12 @@ end
fonts.formats = { }
function fonts.fontformat(filename,default)
- local extname = file.extname(filename)
+ local extname = lower(file.extname(filename))
local format = fonts.formats[extname]
if format then
return format
else
- logs.report("fonts define","unable to detemine font format for '%s'",filename)
+ logs.report("fonts define","unable to determine font format for '%s'",filename)
return default
end
end
diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv
index c7d515cca..43af620fc 100644
--- a/tex/context/base/font-ini.mkiv
+++ b/tex/context/base/font-ini.mkiv
@@ -1334,24 +1334,81 @@
\newcount\@@fontdefhack % check if this is still needed
+% \def\@@beginfontdef
+% {\ifcase\@@fontdefhack
+% \let\k!savedtext \k!text \let\k!text \s!text
+% \let\k!saveddefault \k!default \let\k!default \s!default
+% \fi
+% \advance\@@fontdefhack \plusone }
+
+% \def\@@endfontdef
+% {\advance\@@fontdefhack \minusone
+% \ifcase\@@fontdefhack
+% \let\k!default \k!saveddefault
+% \let\k!text \k!savedtext
+% \fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%
+
+% The problem is that the key in a getparameters is resolved
+% to the underlying interface language (english). But values
+% are kept as they are. However, some of the keys in a font
+% definition are used as values later on.
+%
+% The only place where this happens (for historical reason mostly)
+% is in the bodyfont definitions and setup, so we can use a limited
+% case.
+%
+% \let \c!big \v!big : expansion time (user)
+% \let \c!small \v!small : expansion time (user)
+% \let \c!text \s!text : definition time
+% % \c!script \s!script : definition time
+% % \c!scriptscript \s!scriptscript : definition time
+% % \c!em : definition time
+% % \c!interlineskip : definition time
+% \let \c!default \s!default : definition time
+% \let \k!default \s!default : definition time
+%
+% Doing the k! definitions local will save us 500 has entries.
+
+\letvalue{\k!prefix!\v!big }\c!big
+\letvalue{\k!prefix!\v!small }\c!small
+\letvalue{\k!prefix!\v!text }\s!text
+\letvalue{\k!prefix!\v!default}\s!default
+
+\let\normalc!big \c!big
+\let\normalc!small \c!small
+\let\normalc!text \c!text % should not happen as we expect text
+\let\normalc!default \c!default
+\let\normalk!default \k!default
+
+\newtoks\everybeginfontdef
+\newtoks\everyendfontdef
+
+\appendtoks
+ \let\c!text \s!text
+ \let\c!default\s!default
+\to \everybeginfontdef
+
+\appendtoks
+ \let\c!text \normalc!text
+ \let\c!default\normalc!default
+\to \everyendfontdef
+
\def\@@beginfontdef
{\ifcase\@@fontdefhack
- \let\k!savedtext \k!text \let\k!text \s!text
- \let\k!k!savedtext \k!k!text \let\k!k!text \!!plusone
- \let\k!saveddefault \k!default \let\k!default \s!default
- \let\k!k!saveddefault\k!k!default \let\k!k!default \!!plusone
+ \the\everybeginfontdef
\fi
- \advance\@@fontdefhack \plusone }
+ \advance\@@fontdefhack\plusone}
\def\@@endfontdef
{\advance\@@fontdefhack \minusone
\ifcase\@@fontdefhack
- \let\k!k!default\k!k!saveddefault
- \let\k!default \k!saveddefault
- \let\k!k!text \k!k!savedtext
- \let\k!text \k!savedtext
+ \the\everyendfontdef
\fi}
+%%%%%%%%%%%%%%%%%%%%%%%%
+
\unexpanded\def\definebodyfontenvironment
{\dotripleempty\dodefinebodyfontenvironment}
@@ -1375,7 +1432,7 @@
\fi}
\def\dododefinebodyfontenvironment[#1][#2][#3]% size class settings
- {\@@beginfontdef % \s!text goes wrong in testing because the 12pt alternative will called when typesetting the test (or so)
+ {%\@@beginfontdef % \s!text goes wrong in testing because the 12pt alternative will called when typesetting the test (or so)
\ifcsname\??ft#2#1\c!em\endcsname
% we test for em as we assume it to be set
\else
@@ -1389,7 +1446,7 @@
[\c!interlinespace,\c!em]%
\fi
\getparameters[\??ft#2#1][#3]%
- \@@endfontdef
+ %\@@endfontdef
% new code, see remark
\ifloadingfonts
% only runtime
@@ -1705,9 +1762,10 @@
\defineunknownfont{\csname\??ft#1#2\endcsname}%
\fi}
+\let\c!savedtext\c!text
+
\unexpanded\def\defineunknownfont#1%
- {\let\c!savedtext\c!text
- \let\c!text\s!text
+ {\let\c!text\s!text
\donefalse
\processcommacommand[\fontrelativesizelist]{\dodefineunknownfont{#1}}%
\let\c!text\c!savedtext
diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua
index 5ad92e002..42b9d5d74 100644
--- a/tex/context/base/font-syn.lua
+++ b/tex/context/base/font-syn.lua
@@ -921,6 +921,9 @@ local function foundname(name,sub) -- sub is not used currently
return found
end
end
+ if trace_names then
+ logs.report("fonts","font with name '%s' cannot be found",name)
+ end
end
function names.resolvedspecification(askedname,sub)
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index 2bfc07090..749d98191 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -14,41 +14,76 @@ local concat = table.concat
local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char
local lpegmatch = lpeg.match
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+local function dirname(name,default)
+ return match(name,"^(.+)[/\\].-$") or (default or "")
end
-function file.addsuffix(filename, suffix)
- if not suffix or suffix == "" then
- return filename
- elseif not find(filename,"%.[%a%d]+$") then
- return filename .. "." .. suffix
- else
- return filename
- end
+local function basename(name)
+ return match(name,"^.+[/\\](.-)$") or name
end
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+local function nameonly(name)
+ return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
end
-function file.dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local function extname(name,default)
+ return match(name,"^.+%.([^/\\]-)$") or default or ""
end
-function file.basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+local function splitname(name)
+ local n, s = match(name,"^(.+)%.([^/\\]-)$")
+ return n or name, s or ""
end
-function file.nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
+file.basename = basename
+file.dirname = dirname
+file.nameonly = nameonly
+file.extname = extname
+file.suffix = extname
+
+function file.removesuffix(filename)
+ return (gsub(filename,"%.[%a%d]+$",""))
end
-function file.extname(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
+function file.addsuffix(filename, suffix, criterium)
+ if not suffix or suffix == "" then
+ return filename
+ elseif criterium == true then
+ return filename .. "." .. suffix
+ else
+ local n, s = splitname(filename)
+ if s and s ~= "" then
+ local t = type(criterium)
+ if t == "table" then
+ -- keep if in criterium
+ for i=1,#criterium do
+ if s == criterium[i] then
+ return filename
+ end
+ end
+ elseif t == "string" then
+ -- keep if criterium
+ if s == criterium then
+ return filename
+ end
+ end
+ end
+ return n .. "." .. suffix
+ end
end
-file.suffix = file.extname
+--~ print(file.addsuffix("name","new") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new") .. "-> name.old")
+--~ print(file.addsuffix("name.old","new",true) .. "-> name.old.new")
+--~ print(file.addsuffix("name.old","new","new") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new","old") .. "-> name.old")
+--~ print(file.addsuffix("name.old","new","foo") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new",{"foo","bar"}) .. "-> name.new")
+--~ print(file.addsuffix("name.old","new",{"old","bar"}) .. "-> name.old")
+
+function file.replacesuffix(filename, suffix)
+ return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+end
--~ function file.join(...)
--~ local pth = concat({...},"/")
@@ -101,7 +136,7 @@ end
--~ print(file.join("//nas-1","/y"))
function file.iswritable(name)
- local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,"."))
+ local a = lfs.attributes(name) or lfs.attributes(dirname(name,"."))
return a and sub(a.permissions,2,2) == "w"
end
diff --git a/tex/context/base/luat-exe.lua b/tex/context/base/luat-exe.lua
index ca3b75162..9bd706676 100644
--- a/tex/context/base/luat-exe.lua
+++ b/tex/context/base/luat-exe.lua
@@ -26,18 +26,20 @@ end
function executer.finalize() -- todo: os.exec, todo: report ipv print
local execute = os.execute
function executer.execute(...)
- local t, name, arguments = {...}, "", ""
+ -- todo: make more clever first split
+ local t, name, arguments = { ... }, "", ""
+ local one = t[1]
if #t == 1 then
- if type(t[1]) == 'table' then
- name, arguments = t[1], concat(t," ",2,#t)
+ if type(one) == 'table' then
+ name, arguments = one, concat(t," ",2,#t)
else
- name, arguments = match(t[1],"^(.-)%s+(.+)$")
+ name, arguments = match(one,"^(.-)%s+(.+)$")
if not (name and arguments) then
- name, arguments = t[1], ""
+ name, arguments = one, ""
end
end
else
- name, arguments = t[1], concat(t," ",2,#t)
+ name, arguments = one, concat(t," ",2,#t)
end
local permitted = executer.permitted
for k=1,#permitted do
@@ -46,16 +48,14 @@ function executer.finalize() -- todo: os.exec, todo: report ipv print
execute(name .. " " .. arguments)
-- print("executed: " .. name .. " " .. arguments)
else
- print("not permitted: " .. name .. " " .. arguments)
+ logs.report("executer","not permitted: %s %s"name,arguments)
end
end
end
function executer.finalize()
- print("executer is already finalized")
- end
- function executer.register(name)
- print("executer is already finalized")
+ logs.report("executer","already finalized")
end
+ executer.register = executer.finalize
os.execute = executer.execute
end
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index aaa90217f..b397768fb 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -932,9 +932,10 @@ local function index(collected,n)
end
end
-local function command(collected,cmd)
- if collected then
- for c=1,#collected do
+local function command(collected,cmd,otherwise)
+ local n = collected and #collected
+ if n and n > 0 then
+ for c=1,n do
local e = collected[c]
local ix = e.ix
if not ix then
@@ -943,6 +944,8 @@ local function command(collected,cmd)
end
texsprint(ctxcatcodes,"\\xmlw{",cmd,"}{",e.name,"::",ix,"}")
end
+ elseif otherwise then
+ texsprint(ctxcatcodes,"\\xmlw{",otherwise,"}{#1}")
end
end
diff --git a/tex/context/base/math-int.mkiv b/tex/context/base/math-int.mkiv
index 2af471b5c..9bb7b1a14 100644
--- a/tex/context/base/math-int.mkiv
+++ b/tex/context/base/math-int.mkiv
@@ -53,22 +53,45 @@
%D More integrals (AM):
-\definemathcommand [iint] {\repeatintegral\plusone }
-\definemathcommand [iiint] {\repeatintegral\plustwo }
-\definemathcommand [iiiint] {\repeatintegral\plusthree}
-
%def\integralrepeatsymbol{\intop}
\def\integralrepeatsymbol{{\int}}
-\def\repeatintegral#1%
+% \def\repeatintegral#1%
+% {\scratchtoks\emptytoks
+% \let\dointlimits\donothing
+% \let\dodointlimits\intlimits
+% \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}%
+% \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks
+% \edef\dodorepeatintegral{\the\scratchtoks}%
+% \futurelet\next\dorepeatintegral}
+
+% \definemathcommand [iint] {\repeatintegral\plusone }
+% \definemathcommand [iiint] {\repeatintegral\plustwo }
+% \definemathcommand [iiiint] {\repeatintegral\plusthree}
+
+\def\fakerepeatintegral#1%
{\scratchtoks\emptytoks
- \let\dointlimits\donothing
- \let\dodointlimits\intlimits
- \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}
+ \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}%
\appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks
- \edef\dodorepeatintegral{\the\scratchtoks}%
+ \edef\dodorepeatintegral{\the\scratchtoks}}
+
+\def\repeatintegral#1#2#3%
+ {\let\dointlimits\donothing
+ \let\dodointlimits\intlimits
+ \iffontchar\textfont\zerocount#1\relax
+ %\edef\dodorepeatintegral{\utfchar{#1}}%
+ \let\dodorepeatintegral#2%
+ \else
+ \fakerepeatintegral{#3}%
+ \fi
\futurelet\next\dorepeatintegral}
+% This is a temporary solution, as we will make a virtual glyph in lm.
+
+\definemathcommand [iint] {\repeatintegral{"222B}\normaliint \plusone }
+\definemathcommand [iiint] {\repeatintegral{"222C}\normaliiint \plustwo }
+\definemathcommand [iiiint] {\repeatintegral{"222D}\normaliiiint\plusthree}
+
%D If the \type{\limits} option is used after \type{\iint}, use
%D \type{\mathop} and fudge the left hand space a bit to make the
%D subscript visually centered.
diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv
index e20548f9b..493a04cea 100644
--- a/tex/context/base/mult-ini.mkiv
+++ b/tex/context/base/mult-ini.mkiv
@@ -437,56 +437,74 @@
\def\doignorevalue#1#2#3%
{\dosetvalue{#1}{#2}{}}
-\def\dosetvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetevalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\edef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\edef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetgvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\gdef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\dosetxvalue#1#2%
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#2\endcsname
- \let\c!internal!\c!internal!y
- \@EA\xdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
- \else
- \let\c!internal!\c!internal!y
- \@EA\xdef\csname#1#2%\endcsname
- \fi\endcsname}
-
-\def\docopyvalue#1#2#3% real tricky expansion, quite unreadable
- {\let\c!internal!\c!internal!n
- \ifcsname\k!prefix!#3\endcsname
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1\csname\k!prefix!#3\endcsname
- \@EA\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
- \else
- \let\c!internal!\c!internal!y
- \@EA\def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}%
- \fi}
+% \def\dosetvalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EA\def\csname#1\csname\k!prefix!#2\endcsname%\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EA\def\csname#1#2%\endcsname
+% \fi\endcsname}
+
+% \def\dosetevalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EA\edef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EA\edef\csname#1#2%\endcsname
+% \fi\endcsname}
+
+% \def\dosetgvalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EA\gdef\csname#1#2%\endcsname
+% \fi\endcsname}
+
+% \def\dosetxvalue#1#2%
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#2\endcsname
+% \let\c!internal!\c!internal!y
+% \@EA\xdef\csname#1\csname\k!prefix!#2\endcsname%\endcsname
+% \else
+% \let\c!internal!\c!internal!y
+% \@EA\xdef\csname#1#2%\endcsname
+% \fi\endcsname}
+
+% \def\docopyvalue#1#2#3% real tricky expansion, quite unreadable
+% {\let\c!internal!\c!internal!n
+% \ifcsname\k!prefix!#3\endcsname
+% \let\c!internal!\c!internal!y
+% \@EA\def\csname#1\csname\k!prefix!#3\endcsname
+% \@EA\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
+% \else
+% \let\c!internal!\c!internal!y
+% \@EA\def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}%
+% \fi}
+
+% \def\dosetvalue #1#2{\@EA \def\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+% \def\dosetevalue#1#2{\@EA\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+% \def\dosetgvalue#1#2{\@EA\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+% \def\dosetxvalue#1#2{\@EA\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+
+% \def\docopyvalue#1#2#3% real tricky expansion, quite unreadable
+% {\ifcsname\k!prefix!#3\endcsname
+% \@EA\def\csname#1\csname\k!prefix!#3\endcsname\@EA\endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
+% \else
+% \@EA\def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}%
+% \fi}
+
+\def\dosetvalue #1#2{\@EA \def\csname#1#2\endcsname}
+\def\dosetevalue #1#2{\@EA\edef\csname#1#2\endcsname}
+\def\dosetgvalue #1#2{\@EA\gdef\csname#1#2\endcsname}
+\def\dosetxvalue #1#2{\@EA\xdef\csname#1#2\endcsname}
+\def\docopyvalue#1#2#3{\@EA \def\csname#1#3\@EA\endcsname\@EA{\csname#2#3\endcsname}}
%D We can now redefine some messages that will be
%D introduced in the multi||lingual system module.
@@ -744,22 +762,26 @@
%D user constants (keywords) become system variables
%D \stopnarrower
-%D Anno 2003 I've forgotten why the \type {\c!internal} is
-%D still in there; it's probably a left over from the time that
+%D The \type {\c!internal} is a left over from the time that
%D the user interface documents were not using a specification
%D alongside a keyword specification but used a shared file in
%D which case we need to go in both directions.
-\let\c!internal!y \string
-\def\c!internal!n {-}
-\let\c!internal! \c!internal!y
-
% temporary mkiv hack (we can best just store the whole table in memory)
+% \let\c!internal!y \string
+% \def\c!internal!n {-}
+% \let\c!internal! \c!internal!y
+
+% \def\setinterfaceconstant#1#2%
+% {\ctxlua{interfaces.setconstant("#1","#2")}%
+% \setvalue{\c!prefix!#1}{\c!internal!#1}%
+% \setvalue{\k!prefix!#2}{#1}}
+
\def\setinterfaceconstant#1#2%
{\ctxlua{interfaces.setconstant("#1","#2")}%
- \setvalue{\c!prefix!#1}{\c!internal!#1}%
- \setvalue{\k!prefix!#2}{#1}}
+ %\setvalue{\k!prefix!#2}{#1}%
+ \setvalue{\c!prefix!#1}{#1}}
\def\setinterfacevariable#1#2%
{\ctxlua{interfaces.setvariable("#1","#2")}%
diff --git a/tex/context/fonts/informal-math.lfg b/tex/context/fonts/informal-math.lfg
index 67fb73b39..4bb0c7f90 100644
--- a/tex/context/fonts/informal-math.lfg
+++ b/tex/context/fonts/informal-math.lfg
@@ -9,7 +9,7 @@ return {
"original-micropress-informal.map",
},
virtuals = {
- ["hvmath-math"] = {
+ ["informal-math"] = {
{ name = "file:ifrg.afm", features = "virtualmath", main = true },
{ name = "ifrm10cm.tfm", vector="tex-mr" },
{ name = "ifmi10", vector = "tex-mi", skewchar=0x7F },
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index da81735ff..b1b6eef29 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 05/24/10 13:05:12
+-- merge date : 05/27/10 13:47:06
do -- begin closure to overcome local limits and interference
@@ -1504,41 +1504,76 @@ local concat = table.concat
local find, gmatch, match, gsub, sub, char = string.find, string.gmatch, string.match, string.gsub, string.sub, string.char
local lpegmatch = lpeg.match
-function file.removesuffix(filename)
- return (gsub(filename,"%.[%a%d]+$",""))
+local function dirname(name,default)
+ return match(name,"^(.+)[/\\].-$") or (default or "")
end
-function file.addsuffix(filename, suffix)
- if not suffix or suffix == "" then
- return filename
- elseif not find(filename,"%.[%a%d]+$") then
- return filename .. "." .. suffix
- else
- return filename
- end
+local function basename(name)
+ return match(name,"^.+[/\\](.-)$") or name
end
-function file.replacesuffix(filename, suffix)
- return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+local function nameonly(name)
+ return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
end
-function file.dirname(name,default)
- return match(name,"^(.+)[/\\].-$") or (default or "")
+local function extname(name,default)
+ return match(name,"^.+%.([^/\\]-)$") or default or ""
end
-function file.basename(name)
- return match(name,"^.+[/\\](.-)$") or name
+local function splitname(name)
+ local n, s = match(name,"^(.+)%.([^/\\]-)$")
+ return n or name, s or ""
end
-function file.nameonly(name)
- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$",""))
+file.basename = basename
+file.dirname = dirname
+file.nameonly = nameonly
+file.extname = extname
+file.suffix = extname
+
+function file.removesuffix(filename)
+ return (gsub(filename,"%.[%a%d]+$",""))
end
-function file.extname(name,default)
- return match(name,"^.+%.([^/\\]-)$") or default or ""
+function file.addsuffix(filename, suffix, criterium)
+ if not suffix or suffix == "" then
+ return filename
+ elseif criterium == true then
+ return filename .. "." .. suffix
+ else
+ local n, s = splitname(filename)
+ if s and s ~= "" then
+ local t = type(criterium)
+ if t == "table" then
+ -- keep if in criterium
+ for i=1,#criterium do
+ if s == criterium[i] then
+ return filename
+ end
+ end
+ elseif t == "string" then
+ -- keep if criterium
+ if s == criterium then
+ return filename
+ end
+ end
+ end
+ return n .. "." .. suffix
+ end
end
-file.suffix = file.extname
+--~ print(file.addsuffix("name","new") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new") .. "-> name.old")
+--~ print(file.addsuffix("name.old","new",true) .. "-> name.old.new")
+--~ print(file.addsuffix("name.old","new","new") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new","old") .. "-> name.old")
+--~ print(file.addsuffix("name.old","new","foo") .. "-> name.new")
+--~ print(file.addsuffix("name.old","new",{"foo","bar"}) .. "-> name.new")
+--~ print(file.addsuffix("name.old","new",{"old","bar"}) .. "-> name.old")
+
+function file.replacesuffix(filename, suffix)
+ return (gsub(filename,"%.[%a%d]+$","")) .. "." .. suffix
+end
--~ function file.join(...)
--~ local pth = concat({...},"/")
@@ -1591,7 +1626,7 @@ end
--~ print(file.join("//nas-1","/y"))
function file.iswritable(name)
- local a = lfs.attributes(name) or lfs.attributes(file.dirname(name,"."))
+ local a = lfs.attributes(name) or lfs.attributes(dirname(name,"."))
return a and sub(a.permissions,2,2) == "w"
end
@@ -3533,6 +3568,7 @@ if not modules then modules = { } end modules ['font-ini'] = {
local utf = unicode.utf8
local format, serialize = string.format, table.serialize
local write_nl = texio.write_nl
+local lower = string.lower
if not fontloader then fontloader = fontforge end
@@ -3604,12 +3640,12 @@ end
fonts.formats = { }
function fonts.fontformat(filename,default)
- local extname = file.extname(filename)
+ local extname = lower(file.extname(filename))
local format = fonts.formats[extname]
if format then
return format
else
- logs.report("fonts define","unable to detemine font format for '%s'",filename)
+ logs.report("fonts define","unable to determine font format for '%s'",filename)
return default
end
end
@@ -11536,18 +11572,29 @@ end
define.resolvers = resolvers
+-- todo: reporter
+
function define.resolvers.file(specification)
- specification.forced = file.extname(specification.name)
- specification.name = file.removesuffix(specification.name)
+ local suffix = file.suffix(specification.name)
+ if fonts.formats[suffix] then
+ specification.forced = suffix
+ specification.name = file.removesuffix(specification.name)
+ end
end
function define.resolvers.name(specification)
local resolve = fonts.names.resolve
if resolve then
- specification.resolved, specification.sub = fonts.names.resolve(specification.name,specification.sub)
- if specification.resolved then
- specification.forced = file.extname(specification.resolved)
- specification.name = file.removesuffix(specification.resolved)
+ local resolved, sub = fonts.names.resolve(specification.name,specification.sub)
+ specification.resolved, specification.sub = resolved, sub
+ if resolved then
+ local suffix = file.suffix(resolved)
+ if fonts.formats[suffix] then
+ specification.forced = suffix
+ specification.name = file.removesuffix(resolved)
+ else
+ specification.name = resolved
+ end
end
else
define.resolvers.file(specification)
@@ -11759,7 +11806,7 @@ end
local function check_otf(forced,specification,suffix,what)
local name = specification.name
if forced then
- name = file.addsuffix(name,suffix)
+ name = file.addsuffix(name,suffix,true)
end
local fullname, tfmtable = resolvers.findbinfile(name,suffix) or "", nil -- one shot
if fullname == "" then