diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2010-05-24 14:05:02 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2010-05-24 14:05:02 +0000 |
commit | 57ea7dad48fbf2541c04e434c31bde655ada3ac4 (patch) | |
tree | 1f8b43bc7cb92939271e1f5bec610710be69097f /Master/texmf-dist/tex/context/base/core-uti.lua | |
parent | 6ee41e1f1822657f7f23231ec56c0272de3855e3 (diff) |
here is context 2010.05.24 13:05
git-svn-id: svn://tug.org/texlive/trunk@18445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-uti.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/core-uti.lua | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-uti.lua b/Master/texmf-dist/tex/context/base/core-uti.lua index 98e60be2e66..01fd8522b10 100644 --- a/Master/texmf-dist/tex/context/base/core-uti.lua +++ b/Master/texmf-dist/tex/context/base/core-uti.lua @@ -1,6 +1,6 @@ if not modules then modules = { } end modules ['core-uti'] = { version = 1.001, - comment = "companion to core-uti.tex", + comment = "companion to core-uti.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" @@ -17,8 +17,9 @@ utility file under different setups, we now load a table once. This saves much runtime but at the cost of more memory usage.</p> --ldx]]-- -local sort, concat, format = table.sort, table.concat, string.format +local sort, concat, format, match = table.sort, table.concat, string.format, string.match local next, type, tostring = next, type, tostring +local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes if not jobs then jobs = { } end if not job then jobs['main'] = { } end job = jobs['main'] @@ -39,8 +40,6 @@ end job.comment(format("version: %1.2f",jobs.version)) -job._save_, job._load_ = { }, { } - function job.initialize(loadname,savename) job.load(loadname) main.register_stop_actions(function() @@ -59,11 +58,10 @@ end jobvariables = jobvariables or { } jobvariables.collected = jobvariables.collected or { } jobvariables.tobesaved = jobvariables.tobesaved or { } - jobvariables.checksums = jobvariables.checksums or { } -if not jobvariables.checksums.old then jobvariables.checksums.old = md5.HEX("old") end -if not jobvariables.checksums.new then jobvariables.checksums.new = md5.HEX("new") end +if not jobvariables.checksums.old then jobvariables.checksums.old = md5.HEX("old") end -- used in experiment +if not jobvariables.checksums.new then jobvariables.checksums.new = md5.HEX("new") end -- used in experiment job.register('jobvariables.checksums', jobvariables.checksums) @@ -71,11 +69,13 @@ local function initializer() local r = jobvariables.collected.randomseed if not r then r = math.random() + math.setrandomseedi(r,"initialize") + else + math.setrandomseedi(r,"previous run") end - math.randomseed(r) jobvariables.tobesaved.randomseed = r for cs, value in next, jobvariables.collected do - tex.sprint(format("\\xdef\\%s{%s}",cs,value)) + texsprint(ctxcatcodes,format("\\xdef\\%s{%s}",cs,value)) end end @@ -185,7 +185,6 @@ function packer.strip(p) p.hash = nil end - local packlist = { "numbers", "metadata", @@ -195,13 +194,16 @@ local packlist = { "pagedata", "directives", "specification", ---~ "references", + "processors", -- might become key under directives or metadata +-- "references", -- we need to rename of them as only one packs (not structure.lists.references) } local jobpacker = packer.new(packlist,1.01) job.pack = true +job._save_, job._load_ = { }, { } -- registers timing + function job.save(filename) statistics.starttiming(job._save_) local f = io.open(filename,'w') @@ -235,7 +237,7 @@ function job.load(filename) statistics.starttiming(job._load_) local data = io.loaddata(filename) if data and data ~= "" then - local version = tonumber(data:match("^-- version: ([%d%.]+)")) + local version = tonumber(match(data,"^-- version: ([%d%.]+)")) if version ~= jobs.version then logs.report("job","version mismatch with jobfile: %s <> %s", version or "?", jobs.version) else @@ -246,7 +248,7 @@ function job.load(filename) for l=1,#savelist do local list = savelist[l] local target, initializer = list[1], list[3] - packer.unpack(aux.accesstable(target),job.packer,true) + packer.unpack(aux.accesstable(target),job.packer,true) if type(initializer) == "function" then initializer(aux.accesstable(target)) end @@ -260,9 +262,7 @@ end -- eventually this will end up in strc-ini statistics.register("startup time", function() - if statistics.elapsedindeed(ctx) then - return format("%s seconds (including runtime option file processing)", statistics.elapsedtime(ctx)) - end + return statistics.elapsedseconds(ctx,"including runtime option file processing") end) statistics.register("jobdata time",function() @@ -286,6 +286,7 @@ function statistics.formatruntime(runtime) local pages = tex.count['realpageno'] - 1 if shipped > 0 or pages > 0 then local persecond = shipped / runtime + if pages == 0 then pages = shipped end return format("%s seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond) else return format("%s seconds",runtime) |