From ea87d7b4a5a50dafea3a8b93f529dc3e2af73787 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Fri, 18 Jul 2014 13:15:04 +0200 Subject: 2014-07-18 12:16:00 --- tex/context/base/back-exp.lua | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4444 -> 4430 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/core-sys.mkiv | 2 + tex/context/base/grph-inc.lua | 103 ++++++++++++++++++--- tex/context/base/l-table.lua | 25 +++-- tex/context/base/publ-ini.lua | 3 +- tex/context/base/publ-ini.mkiv | 6 +- tex/context/base/status-files.pdf | Bin 24971 -> 24943 bytes tex/context/base/status-lua.pdf | Bin 326426 -> 326485 bytes tex/context/base/x-mathml.mkiv | 18 +++- tex/generic/context/luatex/luatex-fonts-merged.lua | 23 +++-- 13 files changed, 147 insertions(+), 39 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index b82ba78c4..54a42085d 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -1569,7 +1569,7 @@ do if metadata then result[#result+1] = f_metadata_begin(depth) for k, v in table.sortedpairs(metadata) do - result[#result+1] = f_medatadata(depth+1,k,lpegmatch(p_entity,v)) + result[#result+1] = f_metadata(depth+1,k,lpegmatch(p_entity,v)) end result[#result+1] = f_metadata_end(depth) end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5bd79250a..8d9ffde49 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.07.17 13:24} +\newcontextversion{2014.07.18 12:14} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index fe0a62735..2edc76c21 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 6ce975ae7..6ac1f7588 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.07.17 13:24} +\edef\contextversion{2014.07.18 12:14} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv index c07722f56..b5c630be1 100644 --- a/tex/context/base/core-sys.mkiv +++ b/tex/context/base/core-sys.mkiv @@ -230,6 +230,8 @@ \dostoptagged \startstopparameter\c!inbetween}} +% \definestartstop[tracing][\c!style=\tt] + % \unexpanded\def\ignorestartstop[#1]% % {\unexpanded\expandafter\def\csname\e!start#1\expandafter\endcsname\expandafter % {\expandafter\gobbleuntil\csname\e!stop#1\endcsname}} diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index a32773ecb..04e2be410 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -47,7 +47,7 @@ local formatters = string.formatters local longtostring = string.longtostring local expandfilename = dir.expandname -local P, lpegmatch = lpeg.P, lpeg.match +local P, R, S, Cc, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.match local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -57,6 +57,9 @@ local replacetemplate = utilities.templates.replace local images = img +local hasscheme = url.hasscheme +local urlhashed = url.hashed + local texgetbox = tex.getbox local texsetbox = tex.setbox @@ -75,6 +78,8 @@ local trace_conversion = false trackers.register("graphics.conversion", functi local trace_inclusion = false trackers.register("graphics.inclusion", function(v) trace_inclusion = v end) local report_inclusion = logs.reporter("graphics","inclusion") +local report_figures = logs.reporter("system","graphics") +local report_figure = logs.reporter("used graphic") local f_hash_part = formatters["%s->%s->%s"] local f_hash_full = formatters["%s->%s->%s->%s->%s->%s->%s"] @@ -233,6 +238,50 @@ figures.formats = figures_formats -- frozen figures.magics = figures_magics -- frozen figures.order = figures_order -- frozen +-- name checker + +local pattern = (R("az","AZ") * P(":"))^-1 * ( -- a-z : | A-Z : + (R("az","09") + S("_/") - P("_")^2)^1 * P(".") * R("az")^1 + -- a-z | single _ | / + (R("az","09") + S("-/") - P("-")^2)^1 * P(".") * R("az")^1 + -- a-z | single - | / + (R("AZ","09") + S("_/") - P("_")^2)^1 * P(".") * R("AZ")^1 + -- A-Z | single _ | / + (R("AZ","09") + S("-/") - P("-")^2)^1 * P(".") * R("AZ")^1 -- A-Z | single - | / +) * P(-1) * Cc(false) + Cc(true) + +function figures.badname(name) + if name and not hasscheme(name) then + return lpegmatch(pattern,name) + else + return false + end +end + +local trace_names = false + +trackers.register("graphics.lognames", function(v) + if v and not trace_names then + luatex.registerstopactions(function() + if figures.nofprocessed > 0 then + local report_newline = logs.newline + logs.pushtarget("logfile") + report_newline() + report_figures("start names") + for _, data in table.sortedhash(figures_found) do + report_newline() + report_figure("asked : %s %s",data.askedname,data.badname and "(bad name)" or "") + report_figure("format : %s",data.format) + report_figure("found : %s",data.foundname) + report_figure("used : %s",data.fullname) + end + report_newline() + report_figures("stop names") + report_newline() + logs.poptarget() + end + end) + trace_names = true + end +end) + -- We can set the order but only indirectly so that we can check for support. function figures.setorder(list) -- can be table or string @@ -453,7 +502,7 @@ end function figures.push(request) statistics.starttiming(figures) - local figuredata = figures.initialize(request) + local figuredata = figures.initialize(request) -- we could use table.sparse but we set them later anyway insert(callstack,figuredata) lastfiguredata = figuredata return figuredata @@ -513,9 +562,9 @@ end local function register(askedname,specification) if not specification then - specification = { } + specification = { askedname = askedname, comment = "invalid specification" } elseif forbiddenname(specification.fullname) then - specification = { } + specification = { askedname = askedname, comment = "forbidden name" } else local format = specification.format if format then @@ -662,9 +711,13 @@ local function register(askedname,specification) end end end + else + specification.askedname = askedname + specification.found = false end end specification.foundname = specification.foundname or specification.fullname + specification.badname = figures.badname(askedname) local askedhash = f_hash_part(askedname,specification.conversion or "default",specification.resolution or "default") figures_found[askedhash] = specification return specification @@ -694,7 +747,7 @@ local function locate(request) -- name, format, cache request.format = nil end -- protocol check - local hashed = url.hashed(askedname) + local hashed = urlhashed(askedname) if not hashed then -- go on elseif internalschemes[hashed.scheme] then @@ -859,7 +912,7 @@ local function locate(request) -- name, format, cache for i=1,#figure_paths do local path = figure_paths[i] local check = path .. "/" .. name - local isfile = url.hashed(check).scheme == "file" + local isfile = urlhashed(check).scheme == "file" if not isfile then if trace_figures then report_inclusion("warning: skipping path %a",path) @@ -1018,7 +1071,7 @@ end function existers.generic(askedname,resolve) -- not findbinfile local result - if url.hasscheme(askedname) then + if hasscheme(askedname) then result = resolvers.findbinfile(askedname) elseif lfs.isfile(askedname) then result = askedname @@ -1281,16 +1334,30 @@ end -- programs.makeoptions = makeoptions local function runprogram(binary,argument,variables) - local binary = match(binary,"[%S]+") -- to be sure + -- os.which remembers found programs + local found = nil + if type(binary) == "table" then + for i=1,#binary do + found = os.which(binary[i]) + if found then + break + end + end + if not found then + binary = concat(binary, " | ") + end + elseif binary then + found = os.which(match(binary,"[%S]+")) + end if type(argument) == "table" then argument = concat(argument," ") -- for old times sake end - if not os.which(binary) then - report_inclusion("program %a is not installed, not running command: %s",binary,command) + if not found then + report_inclusion("program %a is not installed",binary or "?") elseif not argument or argument == "" then - report_inclusion("nothing to run, unknown program %a",binary) + report_inclusion("nothing to run, no arguments for program %a",binary) else - local command = format([["%s" %s]],binary,replacetemplate(longtostring(argument),variables)) + local command = format([["%s" %s]],found,replacetemplate(longtostring(argument),variables)) if trace_conversion or trace_programs then report_inclusion("running command: %s",command) end @@ -1315,7 +1382,7 @@ local epstopdf = { [v_medium] = "ebook", [v_high] = "prepress", }, - command = os.type == "windows" and "gswin32c" or "gs", + command = os.type == "windows" and { "gswin64c", "gswin32c" } or "gs", -- -dProcessDSCComments=false argument = [[ -q @@ -1577,7 +1644,15 @@ identifiers.list = { statistics.register("graphics processing time", function() local nofprocessed = figures.nofprocessed if nofprocessed > 0 then - return format("%s seconds including tex, %s processed images", statistics.elapsedtime(figures),nofprocessed) + local nofnames, nofbadnames = 0, 0 + for hash, data in next, figures_found do + nofnames = nofnames + 1 + if data.badname then + nofbadnames = nofbadnames + 1 + end + end + return format("%s seconds including tex, %s processed images, %s unique asked, %s bad names", + statistics.elapsedtime(figures),nofprocessed,nofnames,nofbadnames) else return nil end diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index ca067fb1e..e642106cc 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -922,16 +922,27 @@ end table.identical = identical table.are_equal = are_equal --- maybe also make a combined one - -function table.compact(t) -- remove empty tables, assumes subtables - if t then - for k, v in next, t do - if not next(v) then -- no type checking - t[k] = nil +local function sparse(old,nest,keeptables) + local new = { } + for k, v in next, old do + if not (v == "" or v == false) then + if nest and type(v) == "table" then + v = sparse(v,nest) + if keeptables or next(v) then + new[k] = v + end + else + new[k] = v end end end + return new +end + +table.sparse = sparse + +function table.compact(t) + return sparse(t,true,true) end function table.contains(t, v) diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 191e11db8..85362a80f 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -686,8 +686,9 @@ function commands.setbtxdataset(name,default) if dataset then context(name) elseif default and default ~= "" then - context(name) + context(default) else + context(v_standard) report("unknown dataset %a",name) end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 7f89e306e..18dabc8ec 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -313,9 +313,6 @@ \unexpanded\def\setbtxentry[#1]% {\edef\currentbtxtag{\ctxcommand{setbtxentry("\currentbtxdataset","#1")}}} -\setbtxdataset - [\v!standard] - % \let\btxsetdataset\setbtxdataset % \let\btxsetentry \setbtxentry @@ -1052,6 +1049,9 @@ %D Defaults: +\setbtxdataset + [\v!standard] + \setupbtxrendering [\c!dataset=\v!standard, \c!repeat=\v!no, diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 4cd7076d1..a1047ca10 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 0b0f756c7..419871069 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index 5335e5ca0..14cf583d1 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -2326,11 +2326,19 @@ \def\mmlextensible#1{\ctxmodulemathml{extensible(\!!bs#1\!!es)}} -\unexpanded\def\mmlunderuf#1{\mmlexecuteifdefined\mmlundercommand\relax {\mmlunexpandedfirst {#1}}\relax} -\unexpanded\def\mmlunderus#1{\mmlexecuteifdefined\mmlundercommand {\mmlunexpandedsecond{#1}}\relax} -\unexpanded\def\mmlunderbf#1{\mmlexecuteifdefined\mmlbasecommand {\mmlunexpandedfirst {#1}}\relax} -%unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax{}{\mmlunexpandedsecond{#1}}\relax} -\unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax {\mmlunexpandedsecond{#1}}\relax} +% \unexpanded\def\mmlunderuf#1{\mmlexecuteifdefined\mmlundercommand\relax {\mmlunexpandedfirst {#1}}\relax} +% \unexpanded\def\mmlunderus#1{\mmlexecuteifdefined\mmlundercommand {\mmlunexpandedsecond{#1}}\relax} +% \unexpanded\def\mmlunderbf#1{\mmlexecuteifdefined\mmlbasecommand {\mmlunexpandedfirst {#1}}\relax} +% %unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax{}{\mmlunexpandedsecond{#1}}\relax} +% \unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax {\mmlunexpandedsecond{#1}}\relax} + +% \MMLhack + +\unexpanded\def\mmlunderuf#1{\mmlexecuteifdefined\mmlundercommand\relax {\math_fences_checked_start\mmlunexpandedfirst {#1}\math_fences_checked_stop}\relax} +\unexpanded\def\mmlunderus#1{\mmlexecuteifdefined\mmlundercommand {\math_fences_checked_start\mmlunexpandedsecond{#1}\math_fences_checked_stop}\relax} +\unexpanded\def\mmlunderbf#1{\mmlexecuteifdefined\mmlbasecommand {\math_fences_checked_start\mmlunexpandedfirst {#1}\math_fences_checked_stop}\relax} +%unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax{}{\math_fences_checked_start\mmlunexpandedsecond{#1}\math_fences_checked_stop}\relax} +\unexpanded\def\mmlunderbs#1{\mmlexecuteifdefined\mmlbasecommand \relax {\math_fences_checked_start\mmlunexpandedsecond{#1}\math_fences_checked_stop}\relax} \startxmlsetups mml:munder \edef\mmlundertoken{\mmlextensible{\xmlraw{#1}{/mml:*[2]}}}% /text() diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 87e016321..f7825065e 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/17/14 13:24:59 +-- merge date : 07/18/14 12:14:41 do -- begin closure to overcome local limits and interference @@ -1603,14 +1603,25 @@ local function identical(a,b) end table.identical=identical table.are_equal=are_equal -function table.compact(t) - if t then - for k,v in next,t do - if not next(v) then - t[k]=nil +local function sparse(old,nest,keeptables) + local new={} + for k,v in next,old do + if not (v=="" or v==false) then + if nest and type(v)=="table" then + v=sparse(v,nest) + if keeptables or next(v) then + new[k]=v + end + else + new[k]=v end end end + return new +end +table.sparse=sparse +function table.compact(t) + return sparse(t,true,true) end function table.contains(t,v) if t then -- cgit v1.2.3