summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua81
1 files changed, 47 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
index 57c57687067..cd282009e0a 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sbx.lua
@@ -241,6 +241,10 @@ table.setmetatableindex(validators,function(t,k)
return readable
end)
+-- function validators.verbose(s)
+-- return s
+-- end
+
function validators.string(s,finalized)
-- can be used to prevent filename checking (todo: only when registered)
if finalized and suspicious(s) then
@@ -307,8 +311,8 @@ end
-- runners can be strings or tables
--
-- os.execute : string
--- os.exec : string or table with program in [0|1]
--- os.spawn : string or table with program in [0|1]
+-- os.exec : string or table with program in [0|1] -- no longer there
+-- os.spawn : string or table with program in [0|1] -- no longer there
--
-- our execute: registered program with specification
@@ -318,39 +322,56 @@ local reported = { }
local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict)
if validbinaries ~= false and (validbinaries == true or validbinaries[program]) then
+ local binpath = nil
if variables then
for variable, value in next, variables do
- local checker = validators[checkers[variable]]
- if checker then
- value = checker(unquoted(value),strict)
- if value then
- variables[variable] = optionalquoted(value)
+ local chktype = checkers[variable]
+ if chktype == "verbose" then
+ -- for now, we will have a "flags" checker
+ else
+ local checker = validators[chktype]
+ if checker then
+ value = checker(unquoted(value),strict)
+ if value then
+ variables[variable] = optionalquoted(value)
+ else
+ report("variable %a with value %a fails the check",variable,value)
+ return
+ end
else
- report("variable %a with value %a fails the check",variable,value)
+ report("variable %a has no checker",variable)
return
end
- else
- report("variable %a has no checker",variable)
- return
end
end
for variable, default in next, defaults do
local value = variables[variable]
if not value or value == "" then
- local checker = validators[checkers[variable]]
- if checker then
- default = checker(unquoted(default),strict)
- if default then
- variables[variable] = optionalquoted(default)
- else
- report("variable %a with default %a fails the check",variable,default)
- return
+ local chktype = checkers[variable]
+ if chktype == "verbose" then
+ -- for now, we will have a "flags" checker
+ else
+ local checker = validators[chktype]
+ if checker then
+ default = checker(unquoted(default),strict)
+ if default then
+ variables[variable] = optionalquoted(default)
+ else
+ report("variable %a with default %a fails the check",variable,default)
+ return
+ end
end
end
end
end
+ binpath = variables.binarypath
+ end
+ if type(binpath) == "string" and binpath ~= "" then
+ -- this works on the console but not from e.g. scite
+ -- program = '"' .. binpath .. "/" .. program .. '"'
+ program = binpath .. "/" .. program
end
- local command = program .. " " .. replace(template,variables)
+ local command = program .. " " .. replace(template,variables)
if reporter then
reporter("executing runner %a: %s",name,command)
elseif trace then
@@ -387,7 +408,8 @@ local runners = {
if trace then
report("execute: %s",command)
end
- return osexecute(command)
+ local okay = osexecute(command)
+ return okay
end
end,
pipeto = function(...)
@@ -422,7 +444,7 @@ function sandbox.registerrunner(specification)
return
end
if validrunners[name] then
- report("invalid name, runner %a already defined")
+ report("invalid name, runner %a already defined",name)
return
end
local program = specification.program
@@ -609,8 +631,8 @@ end
if os then
overload(os.execute, binaryrunner, "os.execute")
- overload(os.spawn, dummyrunner, "os.spawn")
- overload(os.exec, dummyrunner, "os.exec")
+ overload(os.spawn, dummyrunner, "os.spawn") -- no longer there
+ overload(os.exec, dummyrunner, "os.exec") -- no longer there
overload(os.resultof, binaryrunner, "os.resultof")
overload(os.pipeto, binaryrunner, "os.pipeto")
overload(os.rename, filehandlertwo,"os.rename")
@@ -637,16 +659,7 @@ end
-- these are used later on
if zip then
- zip.open = register(zip.open, filehandlerone,"zip.open")
-end
-
-if fontloader then
- fontloader.open = register(fontloader.open,filehandlerone,"fontloader.open")
- fontloader.info = register(fontloader.info,filehandlerone,"fontloader.info")
-end
-
-if epdf then
- epdf.open = register(epdf.open, filehandlerone,"epdf.open")
+ zip.open = register(zip.open, filehandlerone,"zip.open")
end
sandbox.registerroot = registerroot