diff options
21 files changed, 248 insertions, 37 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 815d97235..8e2524147 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -10114,6 +10114,68 @@ end -- of closure do -- create closure to overcome 200 locals limit +if not modules then modules = { } end modules ['data-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- some loading stuff ... we might move this one to slot 2 depending +-- on the developments (the loaders must not trigger kpse); we could +-- of course use a more extensive lib path spec + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local gsub = string.gsub + +local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } +local libpaths = file.split_path(package.path) + +package.loaders[2] = function(name) -- was [#package.loaders+1] +--~ package.loaders[#package.loaders+1] = function(name) -- was + for i=1,#libformats do + local format = libformats[i] + local resolved = resolvers.find_file(name,format) or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + local simple = file.removesuffix(name) + for i=1,#libpaths do -- package.path, might become option + local resolved = gsub(libpaths[i],"?",simple) + if resolvers.isreadable.file(resolved) then + if trace_locating then + logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + -- just in case the distribution is messed up + local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + if trace_locating then + logs.report("fileio",'? unable to locate lib: %s',name) + end + return "unable to locate " .. name +end + +resolvers.loadlualib = require + + +end -- of closure + +do -- create closure to overcome 200 locals limit + if not modules then modules = { } end modules ['luat-kps'] = { version = 1.001, comment = "companion to luatools.lua", @@ -10597,7 +10659,7 @@ own.libs = { -- todo: check which ones are really needed -- 'data-bin.lua', 'data-zip.lua', 'data-crl.lua', --- 'data-lua.lua', + 'data-lua.lua', 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater 'data-tmf.lua', -- tree files diff --git a/scripts/context/stubs/mswin/context.exe b/scripts/context/stubs/mswin/context.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/context.exe +++ b/scripts/context/stubs/mswin/context.exe diff --git a/scripts/context/stubs/mswin/luatools.exe b/scripts/context/stubs/mswin/luatools.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/luatools.exe +++ b/scripts/context/stubs/mswin/luatools.exe diff --git a/scripts/context/stubs/mswin/metatex.exe b/scripts/context/stubs/mswin/metatex.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/metatex.exe +++ b/scripts/context/stubs/mswin/metatex.exe diff --git a/scripts/context/stubs/mswin/mtxrun.dll b/scripts/context/stubs/mswin/mtxrun.dll Binary files differindex 12d38d5ca..4c4dfbf66 100644 --- a/scripts/context/stubs/mswin/mtxrun.dll +++ b/scripts/context/stubs/mswin/mtxrun.dll diff --git a/scripts/context/stubs/mswin/mtxrun.exe b/scripts/context/stubs/mswin/mtxrun.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/mtxrun.exe +++ b/scripts/context/stubs/mswin/mtxrun.exe diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 815d97235..8e2524147 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -10114,6 +10114,68 @@ end -- of closure do -- create closure to overcome 200 locals limit +if not modules then modules = { } end modules ['data-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- some loading stuff ... we might move this one to slot 2 depending +-- on the developments (the loaders must not trigger kpse); we could +-- of course use a more extensive lib path spec + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local gsub = string.gsub + +local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } +local libpaths = file.split_path(package.path) + +package.loaders[2] = function(name) -- was [#package.loaders+1] +--~ package.loaders[#package.loaders+1] = function(name) -- was + for i=1,#libformats do + local format = libformats[i] + local resolved = resolvers.find_file(name,format) or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + local simple = file.removesuffix(name) + for i=1,#libpaths do -- package.path, might become option + local resolved = gsub(libpaths[i],"?",simple) + if resolvers.isreadable.file(resolved) then + if trace_locating then + logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + -- just in case the distribution is messed up + local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + if trace_locating then + logs.report("fileio",'? unable to locate lib: %s',name) + end + return "unable to locate " .. name +end + +resolvers.loadlualib = require + + +end -- of closure + +do -- create closure to overcome 200 locals limit + if not modules then modules = { } end modules ['luat-kps'] = { version = 1.001, comment = "companion to luatools.lua", @@ -10597,7 +10659,7 @@ own.libs = { -- todo: check which ones are really needed -- 'data-bin.lua', 'data-zip.lua', 'data-crl.lua', --- 'data-lua.lua', + 'data-lua.lua', 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater 'data-tmf.lua', -- tree files diff --git a/scripts/context/stubs/mswin/mtxworks.exe b/scripts/context/stubs/mswin/mtxworks.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/mtxworks.exe +++ b/scripts/context/stubs/mswin/mtxworks.exe diff --git a/scripts/context/stubs/mswin/texexec.exe b/scripts/context/stubs/mswin/texexec.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/texexec.exe +++ b/scripts/context/stubs/mswin/texexec.exe diff --git a/scripts/context/stubs/mswin/texmfstart.exe b/scripts/context/stubs/mswin/texmfstart.exe Binary files differindex a05675280..8f3ad2eea 100755 --- a/scripts/context/stubs/mswin/texmfstart.exe +++ b/scripts/context/stubs/mswin/texmfstart.exe diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 815d97235..8e2524147 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -10114,6 +10114,68 @@ end -- of closure do -- create closure to overcome 200 locals limit +if not modules then modules = { } end modules ['data-lua'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- some loading stuff ... we might move this one to slot 2 depending +-- on the developments (the loaders must not trigger kpse); we could +-- of course use a more extensive lib path spec + +local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) + +local gsub = string.gsub + +local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } +local libpaths = file.split_path(package.path) + +package.loaders[2] = function(name) -- was [#package.loaders+1] +--~ package.loaders[#package.loaders+1] = function(name) -- was + for i=1,#libformats do + local format = libformats[i] + local resolved = resolvers.find_file(name,format) or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + local simple = file.removesuffix(name) + for i=1,#libpaths do -- package.path, might become option + local resolved = gsub(libpaths[i],"?",simple) + if resolvers.isreadable.file(resolved) then + if trace_locating then + logs.report("fileio","! lib '%s' located via 'package.path': '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + end + -- just in case the distribution is messed up + local resolved = resolvers.find_file(file.basename(name),'luatexlibs') or "" + if resolved ~= "" then + if trace_locating then + logs.report("fileio","! lib '%s' located by basename via environment: '%s'",name,resolved) + end + return function() return dofile(resolved) end + end + if trace_locating then + logs.report("fileio",'? unable to locate lib: %s',name) + end + return "unable to locate " .. name +end + +resolvers.loadlualib = require + + +end -- of closure + +do -- create closure to overcome 200 locals limit + if not modules then modules = { } end modules ['luat-kps'] = { version = 1.001, comment = "companion to luatools.lua", @@ -10597,7 +10659,7 @@ own.libs = { -- todo: check which ones are really needed -- 'data-bin.lua', 'data-zip.lua', 'data-crl.lua', --- 'data-lua.lua', + 'data-lua.lua', 'data-kps.lua', -- so that we can replace kpsewhich 'data-aux.lua', -- updater 'data-tmf.lua', -- tree files diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 93aff94ce..0a5bbb163 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -61,11 +61,11 @@ %D An example of usage is: -\appendtoks % will change ... not here the () - \pdfbackendsetinfo{ConTeXt.Version}{(\contextversion)}% - \pdfbackendsetinfo{ConTeXt.Time} {(\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute)}% - \pdfbackendsetinfo{ConTeXt.Jobname}{(\jobname)}% - \pdfbackendsetinfo{ConTeXt.Url} {(www.pragma-ade.com)}% +\appendtoks + \pdfbackendsetinfo{ConTeXt.Version}{\contextversion}% + \pdfbackendsetinfo{ConTeXt.Time} {\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute}% + \pdfbackendsetinfo{ConTeXt.Jobname}{\jobname}% + \pdfbackendsetinfo{ConTeXt.Url} {www.pragma-ade.com}% \to \everylastbackendshipout %D Unfortunately this is still needed (also for \METAPOST\ to diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 2824ce6c4..67d2d13ac 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2009.11.30 23:27} +\newcontextversion{2009.12.01 17:09} %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/context.mkiv b/tex/context/base/context.mkiv index 23d578469..347beb0b3 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,6 +25,8 @@ \expandafter\end \fi +\newtoks\contextversiontoks \contextversiontoks\expandafter{\contextversion} % at the lua end + \loadcorefile{norm-ctx} \loadcorefile{syst-pln} diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index e0af24721..9c9b58f83 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.11.30 23:27} +\edef\contextversion{2009.12.01 17:09} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 6d1936c2f..f5cab00c2 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -377,6 +377,8 @@ end local pdfreference = lpdf.reference local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfverbose = lpdf.verbose local pdfreserveobj = pdf.reserveobj local pdfimmediateobj = pdf.immediateobj @@ -469,13 +471,25 @@ function lpdf.finalizedocument() end end -local c_template = "\\normalpdfcatalog{/%s %s}" -local i_template = "\\normalpdfinfo{/%s %s}" -local n_template = "\\normalpdfnames{/%s %s}" +local catalog, info, names = pdfdictionary(), pdfdictionary(), pdfdictionary() -function lpdf.addtocatalog(k,v) if not environment.initex then texsprint(ctxcatcodes,format(c_template,k,tostring(v))) end end -function lpdf.addtoinfo (k,v) if not environment.initex then texsprint(ctxcatcodes,format(i_template,k,tostring(v))) end end -function lpdf.addtonames (k,v) if not environment.initex then texsprint(ctxcatcodes,format(n_template,k,tostring(v))) end end +local function flushcatalog() if not environment.initex then pdf.pdfcatalog = catalog() end end +local function flushinfo () if not environment.initex then pdf.pdfinfo = info () end end +local function flushnames () if not environment.initex then pdf.pdfnames = names () end end + +if not pdf.pdfcatalog then + + local c_template, i_template, n_template = "\\normalpdfcatalog{%s}", "\\normalpdfinfo{%s}", "\\normalpdfnames{%s}" + + flushcatalog = function() if not environment.initex then texsprint(ctxcatcodes,format(c_template,catalog())) end end + flushinfo = function() if not environment.initex then texsprint(ctxcatcodes,format(i_template,info ())) end end + flushnames = function() if not environment.initex then texsprint(ctxcatcodes,format(n_template,names ())) end end + +end + +function lpdf.addtocatalog(k,v) catalog[k] = v end +function lpdf.addtoinfo (k,v) info [k] = v end +function lpdf.addtonames (k,v) names [k] = v end local r_extgstates, d_extgstates = pdfreserveobj(), pdfdictionary() local p_extgstates = pdfreference(r_extgstates) local r_colorspaces, d_colorspaces = pdfreserveobj(), pdfdictionary() local p_colorspaces = pdfreference(r_colorspaces) @@ -513,6 +527,10 @@ lpdf.registerdocumentfinalizer(flushcolorspaces,3) lpdf.registerdocumentfinalizer(flushpatterns,3) lpdf.registerdocumentfinalizer(flushshades,3) +lpdf.registerdocumentfinalizer(flushcatalog,3) +lpdf.registerdocumentfinalizer(flushinfo,3) +lpdf.registerdocumentfinalizer(flushnames,3) + lpdf.registerpagefinalizer(checkextgstates,3) lpdf.registerpagefinalizer(checkcolorspaces,3) lpdf.registerpagefinalizer(checkpatterns,3) @@ -524,3 +542,8 @@ function lpdf.rotationcm(a) local s, c = sind(a), cosd(a) texwrite(format("%s %s %s %s 0 0 cm",c,s,-s,c)) end + +-- lpdf.addtoinfo("ConTeXt.Version", tex.contextversiontoks) +-- lpdf.addtoinfo("ConTeXt.Time", os.date("%Y.%m.%d %H:%M")) -- :%S +-- lpdf.addtoinfo("ConTeXt.Jobname", tex.jobname) +-- lpdf.addtoinfo("ConTeXt.Url", "www.pragma-ade.com") diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 4167eb2f8..80607f9ca 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -125,7 +125,7 @@ sorters.defaultlanguage = 'en' function sorters.splitters.utf(str) -- brrr, todo: language local r = sorters.replacements[sorters.language] or sorters.replacements[sorters.defaultlanguage] or { } ---~ local m = sorters.mappings [sorters.language] or sorters.mappings [sorters.defaultlanguage] or { } + -- local m = sorters.mappings [sorters.language] or sorters.mappings [sorters.defaultlanguage] or { } local u = characters.uncompose local b = utf.byte local t = { } diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 917ba1894..4c3fd2f22 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -185,9 +185,9 @@ \c!interaction=\v!yes, %\c!factor=, %\c!scope=, % \v!text \v!page -\c!prefixconnector=., -\c!prefix=\v!no, - \c!next=\autoinsertnextspace, % new, experimental with startnotes + \c!prefixconnector=., + %\c!next=\autoinsertnextspace + \c!prefix=\v!no, \c!n=1] \setupnotes diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index 721d4300b..ba9c239c0 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -221,13 +221,13 @@ local function preprocessentries(rawdata) for k=1,#et do entries[k] = { et[k] or "", kt[k] or "" } end -for k=#et,1,-1 do - if entries[k][1] ~= "" then - break - else - entries[k] = nil - end -end + for k=#et,1,-1 do + if entries[k][1] ~= "" then + break + else + entries[k] = nil + end + end rawdata.list = entries rawdata.entries = nil else @@ -307,7 +307,6 @@ function jobregisters.compare(a,b) elseif a.metadata.kind == 'entry' then -- e/f/t local page_a, page_b = a.references.realpage, b.references.realpage if not page_a or not page_b then ---~ print(table.serialize(a),table.serialize(b)) return 0 elseif page_a < page_b then return -1 @@ -473,13 +472,13 @@ function jobregisters.flush(data,options,prefixspec,pagespec) texsprint(ctxcatcodes,format("\\startregisterentries{%s}",n)) end end -if metadata then - texsprint(ctxcatcodes,"\\registerentry{") - helpers.title(e[i],metadata) - texsprint(ctxcatcodes,"}") -else - texsprint(ctxcatcodes,format("\\registerentry{%s}",e[i])) -end + if metadata then + texsprint(ctxcatcodes,"\\registerentry{") + helpers.title(e[i],metadata) + texsprint(ctxcatcodes,"}") + else + texsprint(ctxcatcodes,format("\\registerentry{%s}",e[i])) + end else done[i] = false end diff --git a/tex/context/base/strc-reg.mkii b/tex/context/base/strc-reg.mkii index 8d824bd9d..b088246d3 100644 --- a/tex/context/base/strc-reg.mkii +++ b/tex/context/base/strc-reg.mkii @@ -98,7 +98,8 @@ \doifelse{\registerparameter\c!ownnumber}\v!yes \donetrue\donefalse \expanded{\writeutility{r % spaces are essential - {\ifcase\registerpagestatus\space\or e\or f\or t\fi} {\currentregister} % + \ifcase\registerpagestatus\space\or e\or f\or t\fi\space + {\currentregister} % {\nextinternalreference} % {\asciiregisterentryA} % {\asciiregisterentryB} % diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 09587b4bd..e9a57d93b 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 11/30/09 23:32:01 +-- merge date : 12/01/09 17:16:42 do -- begin closure to overcome local limits and interference |