From 66a814af45f6ebe7ff0210238b2b9eba7dd3a499 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 18 Mar 2010 14:42:00 +0100 Subject: beta 2010.03.18 14:42 --- scripts/context/lua/mtx-fonts.lua | 84 +++++++++++++++++++--------------- scripts/context/lua/mtx-patterns.lua | 1 + scripts/context/lua/mtx-timing.lua | 30 ++++++------ scripts/context/lua/mtxrun.lua | 22 +++++++-- scripts/context/stubs/mswin/mtxrun.lua | 22 +++++++-- scripts/context/stubs/unix/mtxrun | 22 +++++++-- 6 files changed, 121 insertions(+), 60 deletions(-) (limited to 'scripts') diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 30ee177f2..e5264fb41 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -57,11 +57,34 @@ function scripts.fonts.reload() end end +local function subfont(sf) + if sf then + return string.format("index: % 2s", sf) + else + return "" + end +end + +local function fontweight(fw) + if fw then + return string.format("conflict: %s", fw) + else + return "" + end +end + local function showfeatures(tag,specification) logs.simple("mapping : %s",tag) logs.simple("fontname: %s",specification.fontname) logs.simple("fullname: %s",specification.fullname) logs.simple("filename: %s",specification.filename) + logs.simple("family : %s",specification.familyname or "") + logs.simple("weight : %s",specification.weight or "") + logs.simple("style : %s",specification.style or "") + logs.simple("width : %s",specification.width or "") + logs.simple("variant : %s",specification.variant or "") + logs.simple("subfont : %s",subfont(specification.subfont)) + logs.simple("fweight : %s",fontweight(specification.fontweight)) -- maybe more local features = fonts.get_features(specification.filename,specification.format) if features then @@ -104,44 +127,33 @@ local function reloadbase(reload) end end -local function subfont(sf) - if sf then - return string.format("index: % 2s", sf) - else - return "" - end -end -local function fontweight(fw) - if fw then - return string.format("conflict: %s", fw) - else - return "" - end -end - local function list_specifications(t,info) if t then - local s, w = table.sortedkeys(t), { 0, 0, 0 } - for k,v in ipairs(s) do - local entry = t[v] - s[k] = { - entry.familyname or "", - entry.weight or "", - entry.style or "", - entry.width or "", - entry.variant or "", - entry.fontname, - entry.filename, - subfont(entry.subfont), - fontweight(entry.fontweight), - } ---~ if info then ---~ showfeatures(v,t[v]) ---~ end - end - table.formatcolumns(s) - for k,v in ipairs(s) do - texio.write_nl(v) + local s = table.sortedkeys(t) + if info then + for k,v in ipairs(s) do + showfeatures(v,t[v]) + end + else + for k,v in ipairs(s) do + local entry = t[v] + s[k] = { + entry.familyname or "", + entry.weight or "", + entry.style or "", + entry.width or "", + entry.variant or "", + entry.fontname, + entry.filename, + subfont(entry.subfont), + fontweight(entry.fontweight), + } + e[k] = entry + end + table.formatcolumns(s) + for k,v in ipairs(s) do + texio.write_nl(v) + end end end end diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua index 0c7ecd221..9d5c2eb74 100644 --- a/scripts/context/lua/mtx-patterns.lua +++ b/scripts/context/lua/mtx-patterns.lua @@ -61,6 +61,7 @@ scripts.patterns.list = { { "??", "hyph-sr-cyrl.tex", "serbian" }, { "sv", "hyph-sv.tex", "swedish" }, { "tr", "hyph-tr.tex", "turkish" }, + { "tk", "hyph-tk.tex", "turkman" }, { "uk", "hyph-uk.tex", "ukrainian" }, { "??", "hyph-zh-latn.tex", "zh-latn, chinese Pinyin" }, } diff --git a/scripts/context/lua/mtx-timing.lua b/scripts/context/lua/mtx-timing.lua index a9a0c8745..e0ea670f3 100644 --- a/scripts/context/lua/mtx-timing.lua +++ b/scripts/context/lua/mtx-timing.lua @@ -55,15 +55,15 @@ local html_menu = [[ local directrun = true -function goodies.progress.make_svg(filename,other) +function plugins.progress.make_svg(filename,other) local metadata, menudata, c = { }, { }, 0 metadata[#metadata+1] = 'outputformat := "svg" ;' for _, kind in pairs { "parameters", "nodes" } do local mdk = { } menudata[kind] = mdk - for n, name in pairs(goodies.progress[kind](filename)) do - local first = goodies.progress.path(filename,name) - local second = goodies.progress.path(filename,other) + for n, name in pairs(plugins.progress[kind](filename)) do + local first = plugins.progress.path(filename,name) + local second = plugins.progress.path(filename,other) c = c + 1 metadata[#metadata+1] = format(meta,c,first,second) mdk[#mdk+1] = { name, c } @@ -88,7 +88,7 @@ function goodies.progress.make_svg(filename,other) end end -function goodies.progress.makehtml(filename,other,menudata,metadata) +function plugins.progress.makehtml(filename,other,menudata,metadata) local graphics = { } local result = { graphics = graphics } for _, kind in pairs { "parameters", "nodes" } do @@ -97,9 +97,9 @@ function goodies.progress.makehtml(filename,other,menudata,metadata) result[kind] = menu for k, v in ipairs(md) do local name, number = v[1], v[2] - local min = goodies.progress.bot(filename,name) - local max = goodies.progress.top(filename,name) - local pages = goodies.progress.pages(filename) + local min = plugins.progress.bot(filename,name) + local max = plugins.progress.top(filename,name) + local pages = plugins.progress.pages(filename) local average = math.round(max/pages) if directrun then local data = metadata[number] @@ -119,20 +119,20 @@ function goodies.progress.makehtml(filename,other,menudata,metadata) return result end -function goodies.progress.valid_file(name) +function plugins.progress.valid_file(name) return name and name ~= "" and lfs.isfile(name .. "-luatex-progress.lut") end -function goodies.progress.make_lmx_page(name,launch,remove) +function plugins.progress.make_lmx_page(name,launch,remove) local filename = name .. "-luatex-progress" local other = "elapsed_time" local template = 'context-timing.lmx' - goodies.progress.convert(filename) + plugins.progress.convert(filename) - local menudata, metadata = goodies.progress.make_svg(filename,other) - local htmldata = goodies.progress.makehtml(filename,other,menudata,metadata) + local menudata, metadata = plugins.progress.make_svg(filename,other) + local htmldata = plugins.progress.makehtml(filename,other,menudata,metadata) lmx.htmfile = function(name) return name .. "-timing.xhtml" end lmx.lmxfile = function(name) return resolvers.find_file(name,'tex') end @@ -165,13 +165,13 @@ scripts.timings = scripts.timings or { } function scripts.timings.xhtml(filename) if filename == "" then logs.simple("provide filename") - elseif not goodies.progress.valid_file(filename) then + elseif not plugins.progress.valid_file(filename) then logs.simple("first run context again with the --timing option") else local basename = file.removesuffix(filename) local launch = environment.argument("launch") local remove = environment.argument("remove") - goodies.progress.make_lmx_page(basename,launch,remove) + plugins.progress.make_lmx_page(basename,launch,remove) end end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 447d958b2..2f203c3bc 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8359,7 +8359,7 @@ function resolvers.getownpath() if os.binsuffix ~= "" then binary = file.replacesuffix(binary,os.binsuffix) end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do -- can be helper local b = file.join(p,binary) if lfs.isfile(b) then -- we assume that after changing to the path the currentdir function @@ -11801,8 +11801,24 @@ function runners.execute_script(fullname,internal,nosplit) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn - return code == 0 + -- no os.exec because otherwise we get the wrong return value + local code = os.execute(command) -- maybe spawn + if code == 0 then + return true + else + if binary then + binary = file.addsuffix(binary,os.binsuffix) + for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + if lfs.isfile(file.join(p,binary)) then + return false + end + end + logs.simpleline() + logs.simple("This script needs '%s' which seems not to be installed.",binary) + logs.simpleline() + end + return false + end end end end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 447d958b2..2f203c3bc 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8359,7 +8359,7 @@ function resolvers.getownpath() if os.binsuffix ~= "" then binary = file.replacesuffix(binary,os.binsuffix) end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do -- can be helper local b = file.join(p,binary) if lfs.isfile(b) then -- we assume that after changing to the path the currentdir function @@ -11801,8 +11801,24 @@ function runners.execute_script(fullname,internal,nosplit) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn - return code == 0 + -- no os.exec because otherwise we get the wrong return value + local code = os.execute(command) -- maybe spawn + if code == 0 then + return true + else + if binary then + binary = file.addsuffix(binary,os.binsuffix) + for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + if lfs.isfile(file.join(p,binary)) then + return false + end + end + logs.simpleline() + logs.simple("This script needs '%s' which seems not to be installed.",binary) + logs.simpleline() + end + return false + end end end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 447d958b2..2f203c3bc 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8359,7 +8359,7 @@ function resolvers.getownpath() if os.binsuffix ~= "" then binary = file.replacesuffix(binary,os.binsuffix) end - for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + for p in gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do -- can be helper local b = file.join(p,binary) if lfs.isfile(b) then -- we assume that after changing to the path the currentdir function @@ -11801,8 +11801,24 @@ function runners.execute_script(fullname,internal,nosplit) logs.simpleline() io.flush() end - local code = os.exec(command) -- maybe spawn - return code == 0 + -- no os.exec because otherwise we get the wrong return value + local code = os.execute(command) -- maybe spawn + if code == 0 then + return true + else + if binary then + binary = file.addsuffix(binary,os.binsuffix) + for p in string.gmatch(os.getenv("PATH"),"[^"..io.pathseparator.."]+") do + if lfs.isfile(file.join(p,binary)) then + return false + end + end + logs.simpleline() + logs.simple("This script needs '%s' which seems not to be installed.",binary) + logs.simpleline() + end + return false + end end end end -- cgit v1.2.3