diff options
author | Marius <mariausol@gmail.com> | 2010-07-04 15:35:28 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-07-04 15:35:28 +0300 |
commit | b0f61c557fa27bddb54ad085c9dc9beefc851a30 (patch) | |
tree | a69dff7e9ee8d0022554603e8715fd482d4ac01c /tex/context/base/trac-tex.lua | |
parent | 85b7bc695629926641c7cb752fd478adfdf374f3 (diff) | |
download | context-b0f61c557fa27bddb54ad085c9dc9beefc851a30.tar.gz |
beta 2010-06-23 12:49
Diffstat (limited to 'tex/context/base/trac-tex.lua')
-rw-r--r-- | tex/context/base/trac-tex.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua new file mode 100644 index 000000000..914769c7f --- /dev/null +++ b/tex/context/base/trac-tex.lua @@ -0,0 +1,47 @@ +if not modules then modules = { } end modules ['trac-hsh'] = { + 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 saved = { } + +function trackers.save_hash() + saved = tex.hashtokens() +end + +function trackers.dump_hash(filename,delta) + local list, hash, command_name = { }, tex.hashtokens(), 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 kind = command_name(token) + local dk = list[kind] + if not dk then + -- a bit funny names but this sorts better (easier to study) + dk = { names = { }, found = 0, code = token[1] } + list[kind] = 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 tex.hashtokens() + luatex.register_stop_actions(1,function() trackers.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) |