From dd5032a09171599e1094af93db0d11e19bba3e1b Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Sun, 28 Apr 2013 18:31:00 +0200
Subject: beta 2013.04.28 18:31

---
 scripts/context/lua/mtx-fonts.lua      | 13 ++++++++++
 scripts/context/lua/mtx-plain.lua      | 45 ++++++++++++++++++++++++++++------
 scripts/context/lua/mtxrun.lua         |  8 +++---
 scripts/context/stubs/mswin/mtxrun.lua |  8 +++---
 scripts/context/stubs/unix/mtxrun      |  8 +++---
 5 files changed, 63 insertions(+), 19 deletions(-)

(limited to 'scripts')

diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 506556483..d2ce5087a 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -378,6 +378,17 @@ function scripts.fonts.list()
 
 end
 
+function scripts.fonts.justload()
+    local fullname = environment.files[1]
+    if fullname then
+        local result = fontloader.open(fullname)
+        if type(result) == "table" then
+            report("loading %s: %s","succeeded",fullname)
+        end
+    end
+    report("loading %s: %s","failed",fullname)
+end
+
 function scripts.fonts.unpack()
     local name = file.removesuffix(file.basename(givenfiles[1] or ""))
     if name and name ~= "" then
@@ -447,6 +458,8 @@ elseif getargument("reload") then
     scripts.fonts.reload()
 elseif getargument("save") then
     scripts.fonts.save()
+elseif getargument("justload") then
+    scripts.fonts.justload()
 elseif getargument("unpack") then
     scripts.fonts.unpack()
 elseif getargument("statistics") then
diff --git a/scripts/context/lua/mtx-plain.lua b/scripts/context/lua/mtx-plain.lua
index 918e9de8c..663664bae 100644
--- a/scripts/context/lua/mtx-plain.lua
+++ b/scripts/context/lua/mtx-plain.lua
@@ -17,8 +17,6 @@ if not modules then modules = { } end modules ['mtx-plain'] = {
 --  "c:/data/develop/tex-context/tex/texmf/web2c",
 -- }
 
-local format = string.format
-
 local helpinfo = [[
 <?xml version="1.0"?>
 <application>
@@ -52,9 +50,40 @@ local report = application.report
 scripts       = scripts       or { }
 scripts.plain = scripts.plain or { }
 
+local function execute(...)
+    local command = string.format(...)
+    report("running command %a",command)
+    report()
+    os.execute(command)
+    report()
+end
+
+local function resultof(...)
+    local command = string.format(...)
+    report("running command %a",command)
+    return string.strip(os.resultof(command) or "")
+end
+
 function scripts.plain.make(texengine,texformat)
-    os.execute("mktexlsr") -- better play safe and use this one
-    local fmtpathspec = os.resultof(format("kpsewhich --expand-path=$TEXFORMATS --engine=%s",texengine))
+    report("generating kpse file database")
+    execute("mktexlsr") -- better play safe and use this one
+    local fmtpathspec = resultof("kpsewhich --var-value=TEXFORMATS --engine=%s",texengine)
+    if fmtpathspec ~= "" then
+        report("using path specification %a",fmtpathspec)
+        fmtpathspec = resultof('kpsewhich -expand-path="%s"',fmtpathspec)
+    end
+    if fmtpathspec ~= "" then
+        report("using path expansion %a",fmtpathspec)
+    else
+        report("no valid path reported, trying alternative")
+        fmtpathspec = resultof("kpsewhich --show-path=fmt --engine=%s",texengine)
+        if fmtpathspec ~= "" then
+            report("using path expansion %a",fmtpathspec)
+        else
+            report("no valid path reported, falling back to current path")
+            fmtpathspec = "."
+        end
+    end
     fmtpathspec = string.splitlines(fmtpathspec)[1] or fmtpathspec
     fmtpathspec = file.splitpath(fmtpathspec)
     local fmtpath = nil
@@ -69,13 +98,15 @@ function scripts.plain.make(texengine,texformat)
         -- message
     else
         lfs.chdir(fmtpath)
-        os.execute(format('%s --ini %s',texengine,file.addsuffix(texformat,"tex")))
-        os.execute("mktexlsr")
+        execute('%s --ini %s',texengine,file.addsuffix(texformat,"tex"))
+        report("generating kpse file database")
+        execute("mktexlsr")
     end
+    report("format saved on path %a",fmtpath)
 end
 
 function scripts.plain.run(texengine,texformat,filename)
-    os.execute(format('%s --fmt=%s "%s"',texengine,file.removesuffix(texformat),filename))
+    execute('%s --fmt=%s "%s"',texengine,file.removesuffix(texformat),filename)
 end
 
 local texformat = environment.arguments.texformat or environment.arguments.format
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 80489902b..2700b6b9f 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -14575,7 +14575,7 @@ do -- create closure to overcome 200 locals limit
 
 package.loaded["data-con"] = package.loaded["data-con"] or true
 
--- original size: 4940, stripped down to: 3580
+-- original size: 5012, stripped down to: 3588
 
 if not modules then modules={} end modules ['data-con']={
   version=1.100,
@@ -14684,7 +14684,7 @@ function containers.content(container,name)
   return container.storage[name]
 end
 function containers.cleanname(name)
-  return (gsub(lower(name),"[^%w%d]+","-"))
+  return (gsub(lower(name),"[^%w\128-\255]+","-")) 
 end
 
 
@@ -15991,8 +15991,8 @@ end -- of closure
 
 -- used libraries    : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
 -- skipped libraries : -
--- original bytes    : 667202
--- stripped bytes    : 244308
+-- original bytes    : 667274
+-- stripped bytes    : 244372
 
 -- end library merge
 
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 80489902b..2700b6b9f 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -14575,7 +14575,7 @@ do -- create closure to overcome 200 locals limit
 
 package.loaded["data-con"] = package.loaded["data-con"] or true
 
--- original size: 4940, stripped down to: 3580
+-- original size: 5012, stripped down to: 3588
 
 if not modules then modules={} end modules ['data-con']={
   version=1.100,
@@ -14684,7 +14684,7 @@ function containers.content(container,name)
   return container.storage[name]
 end
 function containers.cleanname(name)
-  return (gsub(lower(name),"[^%w%d]+","-"))
+  return (gsub(lower(name),"[^%w\128-\255]+","-")) 
 end
 
 
@@ -15991,8 +15991,8 @@ end -- of closure
 
 -- used libraries    : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
 -- skipped libraries : -
--- original bytes    : 667202
--- stripped bytes    : 244308
+-- original bytes    : 667274
+-- stripped bytes    : 244372
 
 -- end library merge
 
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 80489902b..2700b6b9f 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -14575,7 +14575,7 @@ do -- create closure to overcome 200 locals limit
 
 package.loaded["data-con"] = package.loaded["data-con"] or true
 
--- original size: 4940, stripped down to: 3580
+-- original size: 5012, stripped down to: 3588
 
 if not modules then modules={} end modules ['data-con']={
   version=1.100,
@@ -14684,7 +14684,7 @@ function containers.content(container,name)
   return container.storage[name]
 end
 function containers.cleanname(name)
-  return (gsub(lower(name),"[^%w%d]+","-"))
+  return (gsub(lower(name),"[^%w\128-\255]+","-")) 
 end
 
 
@@ -15991,8 +15991,8 @@ end -- of closure
 
 -- used libraries    : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
 -- skipped libraries : -
--- original bytes    : 667202
--- stripped bytes    : 244308
+-- original bytes    : 667274
+-- stripped bytes    : 244372
 
 -- end library merge
 
-- 
cgit v1.2.3