summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-24 20:38:29 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-24 20:38:29 +0000
commit8b6aa4917f960304df746f97e8861cc422c7990a (patch)
tree78288b0dd7fc5c159ec1df6c6ddc1c00f72b5bbf /Master/texmf-dist/scripts/context
parent2e0afd608a5d9a2bd37c7b1db5fa2f1b4d2ce976 (diff)
ConTeXt 2012.05.24 19:36
git-svn-id: svn://tug.org/texlive/trunk@26637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-update.lua4
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-watch.lua35
-rwxr-xr-xMaster/texmf-dist/scripts/context/lua/mtxrun.lua45
-rw-r--r--Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua45
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/unix/mtxrun45
5 files changed, 113 insertions, 61 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-update.lua b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
index 52c72da6d4d..037de8650ff 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-update.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-update.lua
@@ -67,8 +67,8 @@ scripts.update.texformats = {
}
scripts.update.mpformats = {
- "metafun",
- "mpost",
+ -- "metafun",
+ -- "mpost",
}
-- experimental is not functional at the moment
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
index 118d1a8154e..36a3176c41a 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-watch.lua
@@ -70,7 +70,6 @@ local function noset(t)
end
end
-
-- todo: split order (o-name.luj) and combine with atime to determine sort order.
local function glob(files,path) -- some day: sort by name (order prefix) and atime
@@ -89,8 +88,10 @@ local function glob(files,path) -- some day: sort by name (order prefix) and ati
glob(files,name)
end
elseif name:find(".%luj$") then
- -- files[name] = a.change or a.ctime or a.modification or a.mtime
- files[#files+1] = { dirname(name), basename(name) }
+ local bname = basename(name)
+ local dname = dirname(name)
+ local order = tonumber(bname:match("^(%d+)")) or 0
+ files[#files+1] = { dname, bname, order }
end
end
end
@@ -98,13 +99,31 @@ end
local clock = os.gettimeofday or os.time -- we cannot trust os.clock on linux
+-- local function filenamesort(a,b)
+-- local fa, da = a[1], a[2]
+-- local fb, db = b[1], b[2]
+-- if da == db then
+-- return fa < fb
+-- else
+-- return da < db
+-- end
+-- end
+
local function filenamesort(a,b)
- local fa, da = a[1], a[2]
- local fb, db = b[1], b[2]
- if da == db then
- return fa < fb
+ local fa, oa = a[2], a[3]
+ local fb, ob = b[2], b[3]
+ if fa == fb then
+ if oa == ob then
+ return a[1] < b[1] -- order file dir
+ else
+ return oa < ob -- order file
+ end
else
- return da < db
+ if oa == ob then
+ return fa < fb -- order file
+ else
+ return oa < ob -- order file
+ end
end
end
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index e8f229572cc..51cbb95f269 100755
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -11004,27 +11004,30 @@ local function f_second(a,b)
return concat(t,",")
end
+-- old {a,b}{c,d} => ac ad bc bd
+--
-- local function f_both(a,b)
-- local t, n = { }, 0
--- for sb in gmatch(b,"[^,]+") do -- and not sa
--- for sa in gmatch(a,"[^,]+") do -- sb
+-- for sa in gmatch(a,"[^,]+") do
+-- for sb in gmatch(b,"[^,]+") do
-- n = n + 1 ; t[n] = sa .. sb
-- end
-- end
-- return concat(t,",")
-- end
+--
+-- new {a,b}{c,d} => ac bc ad bd
local function f_both(a,b)
local t, n = { }, 0
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do -- and not sa
+ for sa in gmatch(a,"[^,]+") do -- sb
n = n + 1 ; t[n] = sa .. sb
end
end
return concat(t,",")
end
-
local left = P("{")
local right = P("}")
local var = P((1 - S("{}" ))^0)
@@ -11039,9 +11042,6 @@ local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right
local stripper_1 = lpeg.stripper ("{}@")
local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
--- old {a,b}{c,d} => ac ad bc bd
--- new {a,b}{c,d} => ac bc ad bd
-
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
report_expansions("expanding variable '%s'",str)
@@ -11169,7 +11169,7 @@ local stripper = Cs(
)
function resolvers.checkedvariable(str) -- assumes str is a string
- return lpegmatch(stripper,str) or str
+ return type(str) == "string" and lpegmatch(stripper,str) or str
end
-- The path splitter:
@@ -12333,8 +12333,10 @@ resolvers.luacnfstate = "unknown"
-- selfautoparent:texmf/web2c
if environment.default_texmfcnf then
+ -- unfortunately we now have quite some overkill in the spec (not so nice on a network)
resolvers.luacnfspec = environment.default_texmfcnf
else
+ -- resolvers.luacnfspec = "selfautoparent:texmf{-local,-context,}/web2c"
resolvers.luacnfspec = "{selfautoloc:,selfautodir:,selfautoparent:}{,/texmf{-local,}/web2c}"
end
@@ -12673,7 +12675,7 @@ local function load_configuration_files()
instance.loaderror = true
end
elseif trace_locating then
- report_resolving("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no valid format)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -14028,13 +14030,21 @@ function resolvers.resetresolve(str)
end
local function resolve(str) -- use schemes, this one is then for the commandline only
- local res = resolved[str]
- if not res then
- res = gsub(str,"([a-z][a-z]+):([^ \"\';]*)",_resolve_) -- home:xx;selfautoparent:xx; etc
- resolved[str] = res
- abstract[res] = str
+ if type(str) == "table" then
+ local t = { }
+ for i=1,#str do
+ t[i] = resolve(str[i])
+ end
+ return t
+ else
+ local res = resolved[str]
+ if not res then
+ res = gsub(str,"([a-z][a-z]+):([^ \"\';,]*)",_resolve_) -- home:xx;selfautoparent:xx; etc (comma added)
+ resolved[str] = res
+ abstract[res] = str
+ end
+ return res
end
- return res
end
local function unresolve(str)
@@ -15223,6 +15233,7 @@ function resolvers.load_tree(tree,resolve)
-- local AUTOPARENT etc. although these are alwasy set new.
if resolve then
+ -- resolvers.luacnfspec = resolvers.joinpath(resolvers.resolve(resolvers.expandedpathfromlist(resolvers.splitpath(resolvers.luacnfspec))))
resolvers.luacnfspec = resolvers.resolve(resolvers.luacnfspec)
end
@@ -15298,7 +15309,7 @@ function resolvers.listers.variables(pattern)
report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
report_lists(" var: %s",tabstr(configured[key]) or "unset")
report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
- report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(" res: %s",tabstr(resolvers.resolve(expansions[key])) or "unset")
end
end
instance.environment = fastcopy(env)
diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
index e8f229572cc..51cbb95f269 100644
--- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
@@ -11004,27 +11004,30 @@ local function f_second(a,b)
return concat(t,",")
end
+-- old {a,b}{c,d} => ac ad bc bd
+--
-- local function f_both(a,b)
-- local t, n = { }, 0
--- for sb in gmatch(b,"[^,]+") do -- and not sa
--- for sa in gmatch(a,"[^,]+") do -- sb
+-- for sa in gmatch(a,"[^,]+") do
+-- for sb in gmatch(b,"[^,]+") do
-- n = n + 1 ; t[n] = sa .. sb
-- end
-- end
-- return concat(t,",")
-- end
+--
+-- new {a,b}{c,d} => ac bc ad bd
local function f_both(a,b)
local t, n = { }, 0
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do -- and not sa
+ for sa in gmatch(a,"[^,]+") do -- sb
n = n + 1 ; t[n] = sa .. sb
end
end
return concat(t,",")
end
-
local left = P("{")
local right = P("}")
local var = P((1 - S("{}" ))^0)
@@ -11039,9 +11042,6 @@ local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right
local stripper_1 = lpeg.stripper ("{}@")
local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
--- old {a,b}{c,d} => ac ad bc bd
--- new {a,b}{c,d} => ac bc ad bd
-
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
report_expansions("expanding variable '%s'",str)
@@ -11169,7 +11169,7 @@ local stripper = Cs(
)
function resolvers.checkedvariable(str) -- assumes str is a string
- return lpegmatch(stripper,str) or str
+ return type(str) == "string" and lpegmatch(stripper,str) or str
end
-- The path splitter:
@@ -12333,8 +12333,10 @@ resolvers.luacnfstate = "unknown"
-- selfautoparent:texmf/web2c
if environment.default_texmfcnf then
+ -- unfortunately we now have quite some overkill in the spec (not so nice on a network)
resolvers.luacnfspec = environment.default_texmfcnf
else
+ -- resolvers.luacnfspec = "selfautoparent:texmf{-local,-context,}/web2c"
resolvers.luacnfspec = "{selfautoloc:,selfautodir:,selfautoparent:}{,/texmf{-local,}/web2c}"
end
@@ -12673,7 +12675,7 @@ local function load_configuration_files()
instance.loaderror = true
end
elseif trace_locating then
- report_resolving("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no valid format)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -14028,13 +14030,21 @@ function resolvers.resetresolve(str)
end
local function resolve(str) -- use schemes, this one is then for the commandline only
- local res = resolved[str]
- if not res then
- res = gsub(str,"([a-z][a-z]+):([^ \"\';]*)",_resolve_) -- home:xx;selfautoparent:xx; etc
- resolved[str] = res
- abstract[res] = str
+ if type(str) == "table" then
+ local t = { }
+ for i=1,#str do
+ t[i] = resolve(str[i])
+ end
+ return t
+ else
+ local res = resolved[str]
+ if not res then
+ res = gsub(str,"([a-z][a-z]+):([^ \"\';,]*)",_resolve_) -- home:xx;selfautoparent:xx; etc (comma added)
+ resolved[str] = res
+ abstract[res] = str
+ end
+ return res
end
- return res
end
local function unresolve(str)
@@ -15223,6 +15233,7 @@ function resolvers.load_tree(tree,resolve)
-- local AUTOPARENT etc. although these are alwasy set new.
if resolve then
+ -- resolvers.luacnfspec = resolvers.joinpath(resolvers.resolve(resolvers.expandedpathfromlist(resolvers.splitpath(resolvers.luacnfspec))))
resolvers.luacnfspec = resolvers.resolve(resolvers.luacnfspec)
end
@@ -15298,7 +15309,7 @@ function resolvers.listers.variables(pattern)
report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
report_lists(" var: %s",tabstr(configured[key]) or "unset")
report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
- report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(" res: %s",tabstr(resolvers.resolve(expansions[key])) or "unset")
end
end
instance.environment = fastcopy(env)
diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
index e8f229572cc..51cbb95f269 100755
--- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
+++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
@@ -11004,27 +11004,30 @@ local function f_second(a,b)
return concat(t,",")
end
+-- old {a,b}{c,d} => ac ad bc bd
+--
-- local function f_both(a,b)
-- local t, n = { }, 0
--- for sb in gmatch(b,"[^,]+") do -- and not sa
--- for sa in gmatch(a,"[^,]+") do -- sb
+-- for sa in gmatch(a,"[^,]+") do
+-- for sb in gmatch(b,"[^,]+") do
-- n = n + 1 ; t[n] = sa .. sb
-- end
-- end
-- return concat(t,",")
-- end
+--
+-- new {a,b}{c,d} => ac bc ad bd
local function f_both(a,b)
local t, n = { }, 0
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do -- and not sa
+ for sa in gmatch(a,"[^,]+") do -- sb
n = n + 1 ; t[n] = sa .. sb
end
end
return concat(t,",")
end
-
local left = P("{")
local right = P("}")
local var = P((1 - S("{}" ))^0)
@@ -11039,9 +11042,6 @@ local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right
local stripper_1 = lpeg.stripper ("{}@")
local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }
--- old {a,b}{c,d} => ac ad bc bd
--- new {a,b}{c,d} => ac bc ad bd
-
local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).
if trace_expansions then
report_expansions("expanding variable '%s'",str)
@@ -11169,7 +11169,7 @@ local stripper = Cs(
)
function resolvers.checkedvariable(str) -- assumes str is a string
- return lpegmatch(stripper,str) or str
+ return type(str) == "string" and lpegmatch(stripper,str) or str
end
-- The path splitter:
@@ -12333,8 +12333,10 @@ resolvers.luacnfstate = "unknown"
-- selfautoparent:texmf/web2c
if environment.default_texmfcnf then
+ -- unfortunately we now have quite some overkill in the spec (not so nice on a network)
resolvers.luacnfspec = environment.default_texmfcnf
else
+ -- resolvers.luacnfspec = "selfautoparent:texmf{-local,-context,}/web2c"
resolvers.luacnfspec = "{selfautoloc:,selfautodir:,selfautoparent:}{,/texmf{-local,}/web2c}"
end
@@ -12673,7 +12675,7 @@ local function load_configuration_files()
instance.loaderror = true
end
elseif trace_locating then
- report_resolving("skipping configuration file '%s' (no file)",filename)
+ report_resolving("skipping configuration file '%s' (no valid format)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
@@ -14028,13 +14030,21 @@ function resolvers.resetresolve(str)
end
local function resolve(str) -- use schemes, this one is then for the commandline only
- local res = resolved[str]
- if not res then
- res = gsub(str,"([a-z][a-z]+):([^ \"\';]*)",_resolve_) -- home:xx;selfautoparent:xx; etc
- resolved[str] = res
- abstract[res] = str
+ if type(str) == "table" then
+ local t = { }
+ for i=1,#str do
+ t[i] = resolve(str[i])
+ end
+ return t
+ else
+ local res = resolved[str]
+ if not res then
+ res = gsub(str,"([a-z][a-z]+):([^ \"\';,]*)",_resolve_) -- home:xx;selfautoparent:xx; etc (comma added)
+ resolved[str] = res
+ abstract[res] = str
+ end
+ return res
end
- return res
end
local function unresolve(str)
@@ -15223,6 +15233,7 @@ function resolvers.load_tree(tree,resolve)
-- local AUTOPARENT etc. although these are alwasy set new.
if resolve then
+ -- resolvers.luacnfspec = resolvers.joinpath(resolvers.resolve(resolvers.expandedpathfromlist(resolvers.splitpath(resolvers.luacnfspec))))
resolvers.luacnfspec = resolvers.resolve(resolvers.luacnfspec)
end
@@ -15298,7 +15309,7 @@ function resolvers.listers.variables(pattern)
report_lists(" env: %s",tabstr(rawget(environment,key)) or "unset")
report_lists(" var: %s",tabstr(configured[key]) or "unset")
report_lists(" exp: %s",tabstr(expansions[key]) or "unset")
- report_lists(" res: %s",resolvers.resolve(expansions[key]) or "unset")
+ report_lists(" res: %s",tabstr(resolvers.resolve(expansions[key])) or "unset")
end
end
instance.environment = fastcopy(env)