diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/data-pre.lua | 33 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-fil.lua | 15 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-inc.lua | 5 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-fun.lua | 1 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 23589 -> 23576 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 248533 -> 248572 bytes | |||
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/grph-inc.lmt | 5 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-lmt.lmt | 6 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-scn.lmt | 34 | ||||
-rw-r--r-- | tex/context/base/mkxl/mlib-svg.lmt | 15 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
17 files changed, 112 insertions, 16 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index c85382380..7a36f2d34 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.07.22 19:11} +\newcontextversion{2021.07.23 18:50} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 4c02f23df..f03ce574b 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.07.22 19:11} +\edef\contextversion{2021.07.23 18:50} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index bc2a91dcf..f1fa1e266 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.22 19:11} +\newcontextversion{2021.07.23 18:50} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 061a6651d..c54db1589 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.07.22 19:11} +\edef\contextversion{2021.07.23 18:50} %D Kind of special: diff --git a/tex/context/base/mkiv/data-pre.lua b/tex/context/base/mkiv/data-pre.lua index f7df8b918..cab297d19 100644 --- a/tex/context/base/mkiv/data-pre.lua +++ b/tex/context/base/mkiv/data-pre.lua @@ -25,6 +25,8 @@ if not modules then modules = { } end modules ['data-pre'] = { -- version : operating system version -- release : operating system release + +local ipairs = ipairs local insert, remove = table.insert, table.remove local resolvers = resolvers @@ -40,6 +42,7 @@ local dirname = file.dirname local joinpath = file.join local isfile = lfs.isfile +local isdir = lfs.isdir prefixes.environment = function(str) return cleanpath(expansion(str)) @@ -92,6 +95,8 @@ prefixes.pathname = function(str) return cleanpath(dirname((fullname ~= "" and fullname) or str)) end +-- we can actually freeze these + prefixes.selfautoloc = function(str) local pth = getenv('SELFAUTOLOC') return cleanpath(str and joinpath(pth,str) or pth) @@ -112,6 +117,34 @@ prefixes.home = function(str) return cleanpath(str and joinpath(pth,str) or pth) end +do + local tmppth + + prefixes.temp = function(str) + if not tmppth then + for _, s in ipairs { "TMP", "TEMP", "TMPDIR", "TEMPDIR" } do + tmppth = getenv(s) + if tmppth ~= "" and isdir(tmppth) then + break + end + end + if not tmppth or tmppth == "" then + tmppth = "." + end + end + return cleanpath(str and joinpath(tmppth,str) or tmppth) + end + + prefixes.texruns = function(str) + local pth = getenv('TEXRUNS') + if pth == "" then + pth = tmppth + end + return cleanpath(str and joinpath(pth,str) or pth) + end + +end + prefixes.env = prefixes.environment prefixes.rel = prefixes.relative prefixes.loc = prefixes.locate diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua index b39807830..e40420125 100644 --- a/tex/context/base/mkiv/grph-fil.lua +++ b/tex/context/base/mkiv/grph-fil.lua @@ -42,13 +42,20 @@ end job.register('job.files.collected', tobesaved, initializer) +-- When there is a runpath specified, we're already there, so then we only need to +-- pass the orginal path. But we pass it because it will prevent prepending the +-- current direction to the given name. + local runner = sandbox.registerrunner { name = "hashed context run", program = "context", - template = [[%options% %filename%]], + template = [[%options% --path=%path% %filename%]], + template = [[%options% %?path: --path=%path% ?% %?runpath: --runpath=%runpath% ?% %filename%]], checkers = { options = "string", filename = "readable", + path = "string", + runpath = "string", } } @@ -90,7 +97,13 @@ function jobfiles.run(name,action) -- can be anything but we assume it gets checked by the sandbox os.execute(action) elseif ta == "table" then + local path = action.path + local runpath = action.runpath + action.path = environment.arguments.path + action.runpath = environment.arguments.runpath runner(action) + action.path = path + action.runpath = runpath else report_run("processing file, no action given for processing %a",name) end diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index c27dade9d..3789191f1 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -555,6 +555,11 @@ function figures.setpaths(locationset,pathlist) end end end + -- new + if environment.arguments.path then + table.insert(t,1,environment.arguments.path) + end + -- figure_paths = t last_pathlist = pathlist figures.paths = figure_paths diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index f049422bf..50ced6ead 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -36,6 +36,7 @@ return { "applyparameters", "pushparameters", "popparameters", + "setluaparameter", "definecolor", -- "record", "newrecord", "setrecord", "getrecord", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 96866e655..6cc175fa2 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 8013acd66..95162e960 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 3fedf6b5b..c4718ba92 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.22 19:11} +\newcontextversion{2021.07.23 18:50} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index b517cf7b9..c8c14a6b1 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.07.22 19:11} +\immutable\edef\contextversion{2021.07.23 18:50} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt index 4ac980682..d6cfb0d6c 100644 --- a/tex/context/base/mkxl/grph-inc.lmt +++ b/tex/context/base/mkxl/grph-inc.lmt @@ -555,6 +555,11 @@ function figures.setpaths(locationset,pathlist) end end end + -- new + if environment.arguments.path then + table.insert(t,1,environment.arguments.path) + end + -- figure_paths = t last_pathlist = pathlist figures.paths = figure_paths diff --git a/tex/context/base/mkxl/mlib-lmt.lmt b/tex/context/base/mkxl/mlib-lmt.lmt index 55485e5f8..61d390dc0 100644 --- a/tex/context/base/mkxl/mlib-lmt.lmt +++ b/tex/context/base/mkxl/mlib-lmt.lmt @@ -79,6 +79,9 @@ end function mp.lmt_svg_include() local labelfile = metapost.getparameter { "labelfile" } if labelfile and labelfile ~= "" then + labelfile = resolvers.findbinfile(labelfile) + end + if labelfile and labelfile ~= "" then local labels = table.load(labelfile) -- todo: same path as svg file if type(labels) == "table" then for i=1,#labels do @@ -103,8 +106,9 @@ function mp.lmt_svg_include() end local filename = metapost.getparameter { "filename" } if filename and filename ~= "" then + local ok, data = resolvers.loadbinfile(filename) mpdirect ( metapost.svgtomp { - data = io.loaddata(filename), + data = data, remap = true, colormap = colormap, id = filename, diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt index 6032fd861..56fdce0fb 100644 --- a/tex/context/base/mkxl/mlib-scn.lmt +++ b/tex/context/base/mkxl/mlib-scn.lmt @@ -550,7 +550,6 @@ local function getparameterdefault() -- return injectnumeric(0) return 0 else - print("LAST",last) -- return get(last) return last end @@ -765,6 +764,30 @@ function metapost.setparameterset(namespace,t) namespaces[namespace] = t end +function metapost.getparameterpreset(namespace,t) + return namespace and presets[namespace] or presets +end + +local function setluaparameter() + local namespace = scanstring() + local name = scanstring() + local value = scanstring() + local code = load("return " .. value) + if type(code) == "function" then + local result = code() + if result then + local data = namespace and namespaces[namespace] or namespaces + data[name] = result + else + report("no result from lua code: %s",value) + end + else + report("invalid lua code: %s",value) + end +end + +registerdirect("setluaparameter", setluaparameter) + -- This is an experiment for Alan and me. do @@ -890,6 +913,15 @@ do end end + function metapost.setrecord(name,data) + if type(data) == "table" then + local index = names[name] + if index then + records[index] = data + end + end + end + function metapost.runinternal(action,index,kind,name) if action == 0 then -- allocate diff --git a/tex/context/base/mkxl/mlib-svg.lmt b/tex/context/base/mkxl/mlib-svg.lmt index 3e6d68099..862bd1cad 100644 --- a/tex/context/base/mkxl/mlib-svg.lmt +++ b/tex/context/base/mkxl/mlib-svg.lmt @@ -1595,9 +1595,10 @@ do local filename = ref.filename local fragment = ref.fragment if filename and filename ~= "" then - if lfs.isfile(filename) then - report("loading use file: %s",filename) - local root = xml.load(filename) + local fullname = resolvers.findbinfile(filename) + if lfs.isfile(fullname) then + report("loading use file: %s",fullname) + local root = xml.load(fullname) res = xmlfirst(root,"**[@id='"..fragment.."']") if res then xmlinheritattributes(res,c) -- tricky @@ -3525,7 +3526,8 @@ do local bpfactor = number.dimenfactors.bp function metapost.includesvgfile(filename,offset) -- offset in sp - if lfs.isfile(filename) then + local fullname = resolvers.findbinfile(filename) + if lfs.isfile(fullname) then context.startMPcode("doublefun") context('draw lmt_svg [ filename = "%s", offset = %N ] ;',filename,(offset or 0)*bpfactor) context.stopMPcode() @@ -3553,8 +3555,9 @@ do function metapost.showsvgpage(data) local dd = data.data if not dd then - local fn = data.filename - dd = fn and table.load(fn) + local filename = data.filename + local fullname = filename and resolvers.findbinfile(filename) + dd = fullname and table.load(fullname) end if type(dd) == "table" then local comment = data.comment diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 3864fbc99..c7caa519a 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-07-22 19:11 +-- merge date : 2021-07-23 18:50 do -- begin closure to overcome local limits and interference |