summaryrefslogtreecommitdiff
path: root/scripts/context/lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-16 16:00:40 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-16 16:00:40 +0200
commit008292817580eba8a0f0cf83d8e2d08df8fc8c3f (patch)
tree7e47d035cc5d1f54d20f556476c439844f1956e0 /scripts/context/lua
parent5e668aa418d6d082446e9369ae06625b50e49943 (diff)
downloadcontext-008292817580eba8a0f0cf83d8e2d08df8fc8c3f.tar.gz
2017-06-15 22:16:00
Diffstat (limited to 'scripts/context/lua')
-rw-r--r--scripts/context/lua/mtx-context.lua43
-rw-r--r--scripts/context/lua/mtx-fonts.lua2
-rw-r--r--scripts/context/lua/mtxrun.lua102
3 files changed, 109 insertions, 38 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 37101665a..a0d7ea145 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -192,10 +192,15 @@ local temporary_runfiles = {
local temporary_suffixes = {
"prep", -- context preprocessed
}
+
local synctex_runfiles = {
"synctex", "synctex.gz", "syncctx" -- synctex
}
+-- local synctex_runfiles = {
+-- "synctex", "synctex.gz",
+-- }
+
local persistent_runfiles = {
"tuo", -- mkii two pass file
"tub", -- mkii buffer file
@@ -583,14 +588,14 @@ end
-- context mode will become the only method some day
-local function check_synctex(a_synctex) -- context is intercepted elsewhere
- return a_synctex and (
- tonumber(a_synctex) or
- (toboolean(a_synctex,true) and 1) or
- (a_synctex == "zipped" and 1) or
- (a_synctex == "unzipped" and -1)
- ) or nil
-end
+-- local function check_synctex(a_synctex) -- context is intercepted elsewhere
+-- return a_synctex and (
+-- tonumber(a_synctex) or
+-- (toboolean(a_synctex,true) and 1) or
+-- (a_synctex == "zipped" and 1) or
+-- (a_synctex == "unzipped" and -1)
+-- ) or nil
+-- end
function scripts.context.run(ctxdata,filename)
--
@@ -649,7 +654,8 @@ function scripts.context.run(ctxdata,filename)
local a_nonstopmode = getargument("nonstopmode")
local a_scollmode = getargument("scrollmode")
local a_once = getargument("once")
- local a_synctex = getargument("syncctx") and "context" or getargument("synctex")
+-- local a_synctex = getargument("syncctx") and "context" or getargument("synctex")
+ local a_synctex = getargument("synctex")
local a_backend = getargument("backend")
local a_arrange = getargument("arrange")
local a_noarrange = getargument("noarrange")
@@ -675,7 +681,6 @@ function scripts.context.run(ctxdata,filename)
--
a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or (a_scrollmode and "scrollmode") or nil
- -- a_synctex = check_synctex(a_synctex)
--
for i=1,#filelist do
--
@@ -810,7 +815,7 @@ function scripts.context.run(ctxdata,filename)
--
local l_flags = {
["interaction"] = a_batchmode,
- ["synctex"] = check_synctex(a_synctex), -- otherwise not working
+ -- ["synctex"] = check_synctex(a_synctex), -- otherwise not working
["no-parse-first-line"] = true, -- obsolete
["safer"] = a_safer, -- better use --sandbox
-- ["no-mktex"] = true,
@@ -848,7 +853,7 @@ function scripts.context.run(ctxdata,filename)
removefile(fileaddsuffix(jobname,synctex_runfiles[i]))
end
if a_synctex then
- directives[#directives+1] = format("system.synctex=%s",a_synctex)
+ directives[#directives+1] = format("system.synctex")
end
--
if #directives > 0 then
@@ -905,6 +910,8 @@ function scripts.context.run(ctxdata,filename)
--
end
--
+ -- this will go away after we update luatex
+ --
local syncctx = fileaddsuffix(jobname,"syncctx")
if a_synctex == "context" or validfile(syncctx) then
renamefile(syncctx,fileaddsuffix(jobname,"synctex"))
@@ -1318,12 +1325,12 @@ function scripts.context.purge_job(jobname,all,mkiitoo,fulljobname)
deleted[#deleted+1] = purge_file(fileaddsuffix(fulljobname,temporary_suffixes[i],true))
end
end
- if not environment.argument("synctex") then
- -- special case: not deleted when --synctex is given, but what if given in preamble
- for i=1,#synctex_runfiles do
- deleted[#deleted+1] = purge_file(fileaddsuffix(filebase,synctex_runfiles[i]))
- end
- end
+ -- if not environment.argument("synctex") then
+ -- -- special case: not deleted when --synctex is given, but what if given in preamble
+ -- for i=1,#synctex_runfiles do
+ -- deleted[#deleted+1] = purge_file(fileaddsuffix(filebase,synctex_runfiles[i]))
+ -- end
+ -- end
if all then
for i=1,#persistent_runfiles do
deleted[#deleted+1] = purge_file(fileaddsuffix(filebase,persistent_runfiles[i]))
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index a5752daed..3c86125b5 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -16,7 +16,7 @@ local lower = string.lower
local concat = table.concat
local write_nl = texio.write_nl
-local otlversion = 3.029
+local otlversion = 3.030
local helpinfo = [[
<?xml version="1.0"?>
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 7589a5c95..cf46273ca 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -9541,7 +9541,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 8036, stripped down to: 5567
+-- original size: 8263, stripped down to: 5685
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -9648,8 +9648,9 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- register("luatex banner",function()
- return lower(status.banner)
+ register("used engine",function()
+ return format("%s version %s with functionality level %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
end)
register("control sequences",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
@@ -11104,7 +11105,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-env"] = package.loaded["util-env"] or true
--- original size: 9246, stripped down to: 5038
+-- original size: 9400, stripped down to: 5499
if not modules then modules={} end modules ['util-env']={
version=1.001,
@@ -11119,8 +11120,21 @@ local unquoted,quoted,optionalquoted=string.unquoted,string.quoted,string.option
local concat,insert,remove=table.concat,table.insert,table.remove
environment=environment or {}
local environment=environment
-os.setlocale(nil,nil)
-function os.setlocale()
+local setlocale=os.setlocale
+setlocale(nil,nil)
+local report=logs.reporter("system")
+function os.setlocale(a,b)
+ if a or b then
+ if report then
+ report()
+ report("You're messing with os.locale in a supposedly locale neutral enviroment. From")
+ report("now on are on your own and without support. Crashes or unexpected side effects")
+ report("can happen but don't bother the luatex and context developer team with it.")
+ report()
+ report=nil
+ end
+ setlocale(a,b)
+ end
end
local validengines=allocate {
["luatex"]=true,
@@ -19949,7 +19963,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lib"] = package.loaded["util-lib"] or true
--- original size: 13595, stripped down to: 7500
+-- original size: 14040, stripped down to: 7818
if not modules then modules={} end modules ['util-lib']={
version=1.001,
@@ -19968,6 +19982,7 @@ local pathpart=file.pathpart
local nameonly=file.nameonly
local joinfile=file.join
local removesuffix=file.removesuffix
+local addsuffix=file.addsuffix
local findfile=resolvers.findfile
local findfiles=resolvers.findfiles
local expandpaths=resolvers.expandedpathlistfromvariable
@@ -19987,13 +20002,20 @@ local function locate(required,version,trace,report,action)
local required_path=pathpart(required_full)
local required_base=nameonly(required_full)
if qualifiedpath(required) then
- if isfile(required) then
+ if isfile(addsuffix(required,os.libsuffix)) then
+ if trace then
+ report("qualified name %a found",required)
+ end
found_library=required
+ else
+ if trace then
+ report("qualified name %a not found",required)
+ end
end
else
local required_name=required_base.."."..os.libsuffix
local version=type(version)=="string" and version~="" and version or false
- local engine=environment.ownmain or false
+ local engine="luatex"
if trace and not done then
local list=expandpaths("lib")
for i=1,#list do
@@ -20053,8 +20075,9 @@ local function locate(required,version,trace,report,action)
package.extralibpath(environment.ownpath)
local paths=package.libpaths()
for i=1,#paths do
+ required_path=paths[i]
local found=check(lfs.isfile)
- if found and (not checkpattern or find(found,checkpattern)) then
+ if type(found)=="string" and (not checkpattern or find(found,checkpattern)) then
return found
end
end
@@ -20084,18 +20107,18 @@ local function locate(required,version,trace,report,action)
if trace then
report("found: %a",found_library)
end
- local message,result=action(found_library,required_base)
+ local result,message=action(found_library,required_base)
if result then
library=result
else
library=false
- report("load error: message %a, library %a",tostring(message),found_library or "no library")
+ report("load error: message %a, library %a",tostring(message or "unknown"),found_library or "no library")
end
end
if not library then
- report("unknown: %a",required)
+ report("unknown library: %a",required)
elseif trace then
- report("stored: %a",required)
+ report("stored library: %a",required)
end
return library
end
@@ -20122,13 +20145,12 @@ do
local libtype=type(library)
if libtype=="function" then
library=library()
- message=true
else
report_swiglib("load error: %a returns %a, message %a, library %a",opener,libtype,(string.gsub(message or "no message","[%s]+$","")),found_library or "no library")
library=false
end
popdir()
- return message,library
+ return library
end)
loadedlibs[required]=library or false
end
@@ -20174,7 +20196,9 @@ if FFISUPPORTED and ffi and ffi.load then
trackers.register("resolvers.ffilib",function(v) trace_ffilib=v end)
local function locateindeed(name)
local message,library=pcall(savedffiload,removesuffix(name))
- if type(library)=="userdata" then
+ if type(message)=="userdata" then
+ return message
+ elseif type(library)=="userdata" then
return library
else
return false
@@ -20540,8 +20564,8 @@ end -- of closure
-- used libraries : l-lua.lua l-sandbox.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-gzip.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-fil.lua util-sac.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-tpl.lua util-sbx.lua util-mrg.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 : 845305
--- stripped bytes : 306232
+-- original bytes : 846131
+-- stripped bytes : 306161
-- end library merge
@@ -21600,6 +21624,42 @@ end
-- joke .. reminds me of messing with gigi terminals
+do
+
+ local a_locale = e_argument("locale")
+
+ if a_locale then
+
+ -- I really hate this crap but am too tired of discussing it over and over
+ -- again so for the sake of usiage outside context we will provide ways to
+ -- use locales in an otherwise supposed to be locale agnostic system. And
+ -- forget about support in case of interferences.
+
+ report()
+ report(what == "force" and "forcing locale:" or "original locale:")
+ report()
+ report(" collate : %s",status.lc_collate or "<unset>")
+ report(" ctype : %s",status.lc_ctype or "<unset>")
+ report(" monetary : %s",status.lc_monetary or "<unset>")
+ report(" numeric : %s",status.lc_numeric or "<unset>")
+ report(" time : %s",status.lc_time or "<unset>")
+ report()
+
+ end
+
+ if a_locale == "force" then
+ os.setlocale(status.lc_collate ,"collate")
+ os.setlocale(status.lc_ctype ,"ctype")
+ os.setlocale(status.lc_monetary,"monetary")
+ os.setlocale(status.lc_numeric ,"numeric")
+ os.setlocale(status.lc_time ,"time")
+ else
+ function os.setlocale()
+ end
+ end
+
+end
+
if e_argument("ansi") then
logs.setformatters("ansi")
@@ -21934,6 +21994,10 @@ elseif e_argument("systeminfo") then
runners.systeminfo()
+elseif e_argument("locale") then
+
+ -- already done
+
elseif e_argument("help") or filename=='help' or filename == "" then
application.help()