diff options
author | Marius <mariausol@gmail.com> | 2013-05-20 03:20:28 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-05-20 03:20:28 +0300 |
commit | 5fc5cfb5014ddcc2942e13a559f4082fb66aa6e7 (patch) | |
tree | 53f81e99fac8c80ddd2fb70e233a7e5d5735722f /tex/context/base/trac-tex.lua | |
parent | 13ec4b540e0d46c97fd7b089e0b7413da81e0a9f (diff) | |
download | context-5fc5cfb5014ddcc2942e13a559f4082fb66aa6e7.tar.gz |
beta 2013.05.20 02:00
Diffstat (limited to 'tex/context/base/trac-tex.lua')
-rw-r--r-- | tex/context/base/trac-tex.lua | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua index aecf1799b..7e3406073 100644 --- a/tex/context/base/trac-tex.lua +++ b/tex/context/base/trac-tex.lua @@ -1,75 +1,75 @@ -if not modules then modules = { } end modules ['trac-tex'] = {
- version = 1.001,
- comment = "companion to trac-deb.mkiv",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
--- moved from trac-deb.lua
-
-local format = string.format
-
-local texhashtokens = tex.hashtokens
-
-local trackers = trackers
-
-local saved = { }
-
-function trackers.savehash()
- saved = texhashtokens()
-end
-
-function trackers.dumphashtofile(filename,delta)
- local list, hash, command_name = { }, texhashtokens(), token.command_name
- for name, token in next, hash do
- if not delta or not saved[name] then
- -- token: cmd, chr, csid -- combination cmd,chr determines name
- local category = command_name(token)
- local dk = list[category]
- if not dk then
- -- a bit funny names but this sorts better (easier to study)
- dk = { names = { }, found = 0, code = token[1] }
- list[category] = dk
- end
- dk.names[name] = { token[2], token[3] }
- dk.found = dk.found + 1
- end
- end
- io.savedata(filename or tex.jobname .. "-hash.log",table.serialize(list,true))
-end
-
-local delta = nil
-
-local function dump_hash(wanteddelta)
- if delta == nil then
- saved = saved or texhashtokens() -- no need for trackers.dump_hash
- luatex.registerstopactions(1,function() dump_hash(nil,wanteddelta) end) -- at front
- end
- delta = wanteddelta
-end
-
-directives.register("system.dumphash", function() dump_hash(false) end)
-directives.register("system.dumpdelta", function() dump_hash(true ) end)
-
-local report_dump = logs.reporter("resolvers","dump")
-
-local function saveusedfilesintrees(format)
- local data = {
- jobname = environment.jobname or "?",
- version = environment.version or "?",
- kind = environment.kind or "?",
- files = resolvers.instance.foundintrees
- }
- local filename = file.replacesuffix(environment.jobname or "context-job",'jlg')
- if format == "lua" then
- io.savedata(filename,table.serialize(data,true))
- else
- io.savedata(filename,table.toxml(data,"job"))
- end
-end
-
-directives.register("system.dumpfiles", function(v)
- luatex.registerstopactions(function() saveusedfilesintrees(v) end)
-end)
-
+if not modules then modules = { } end modules ['trac-tex'] = { + version = 1.001, + comment = "companion to trac-deb.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- moved from trac-deb.lua + +local format = string.format + +local texhashtokens = tex.hashtokens + +local trackers = trackers + +local saved = { } + +function trackers.savehash() + saved = texhashtokens() +end + +function trackers.dumphashtofile(filename,delta) + local list, hash, command_name = { }, texhashtokens(), token.command_name + for name, token in next, hash do + if not delta or not saved[name] then + -- token: cmd, chr, csid -- combination cmd,chr determines name + local category = command_name(token) + local dk = list[category] + if not dk then + -- a bit funny names but this sorts better (easier to study) + dk = { names = { }, found = 0, code = token[1] } + list[category] = dk + end + dk.names[name] = { token[2], token[3] } + dk.found = dk.found + 1 + end + end + io.savedata(filename or tex.jobname .. "-hash.log",table.serialize(list,true)) +end + +local delta = nil + +local function dump_hash(wanteddelta) + if delta == nil then + saved = saved or texhashtokens() -- no need for trackers.dump_hash + luatex.registerstopactions(1,function() dump_hash(nil,wanteddelta) end) -- at front + end + delta = wanteddelta +end + +directives.register("system.dumphash", function() dump_hash(false) end) +directives.register("system.dumpdelta", function() dump_hash(true ) end) + +local report_dump = logs.reporter("resolvers","dump") + +local function saveusedfilesintrees(format) + local data = { + jobname = environment.jobname or "?", + version = environment.version or "?", + kind = environment.kind or "?", + files = resolvers.instance.foundintrees + } + local filename = file.replacesuffix(environment.jobname or "context-job",'jlg') + if format == "lua" then + io.savedata(filename,table.serialize(data,true)) + else + io.savedata(filename,table.toxml(data,"job")) + end +end + +directives.register("system.dumpfiles", function(v) + luatex.registerstopactions(function() saveusedfilesintrees(v) end) +end) + |