summaryrefslogtreecommitdiff
path: root/tex/context/base/trac-tex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/trac-tex.lua')
-rw-r--r--tex/context/base/trac-tex.lua112
1 files changed, 54 insertions, 58 deletions
diff --git a/tex/context/base/trac-tex.lua b/tex/context/base/trac-tex.lua
index 5fe4754cb..24dc3f1bd 100644
--- a/tex/context/base/trac-tex.lua
+++ b/tex/context/base/trac-tex.lua
@@ -13,79 +13,75 @@ local next = next
local texhashtokens = tex.hashtokens
local trackers = trackers
-
-local saved = { }
+local newtoken = newtoken or token
+local saved = { }
function trackers.savehash()
saved = texhashtokens()
end
-if newtoken then
-
- function trackers.dumphashtofile(filename,delta)
- local list = { }
- local hash = tex.hashtokens()
- local create = newtoken.create
- for name, token in next, hash do
- if not delta or not saved[name] then
- if token[2] ~= 0 then -- still old interface
- local token = create(name)
- -- inspect(token)
- local category = token.cmdname
- local dk = list[category]
- if not dk then
- dk = {
- names = { },
- found = 0,
- -- code = token[1],
- }
- list[category] = dk
- end
- if token.protected then
- if token.expandable then
- dk.names[name] = "ep"
- else
- dk.names[name] = "-p"
- end
- else
- if token.expandable then
- dk.names[name] = "ep"
- else
- dk.names[name] = "--"
- end
- end
- dk.found = dk.found + 1
- end
- end
- end
- table.save(filename or tex.jobname .. "-hash.log",list)
- end
-
-else
-
- function trackers.dumphashtofile(filename,delta)
- local list = { }
- local hash = texhashtokens()
- local getname = 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 = getname(token)
+function trackers.dumphashtofile(filename,delta)
+ local list = { }
+ local hash = tex.hashtokens()
+ local create = newtoken.create
+ for name, token in next, hash do
+ if not delta or not saved[name] then
+ if token[2] ~= 0 then -- still old interface
+ local token = create(name)
+ -- inspect(token)
+ local category = token.cmdname
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] }
+ dk = {
+ names = { },
+ found = 0,
+ -- code = token[1],
+ }
list[category] = dk
end
- dk.names[name] = { token[2], token[3] }
+ if token.protected then
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "-p"
+ end
+ else
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "--"
+ end
+ end
dk.found = dk.found + 1
end
end
- table.save(filename or tex.jobname .. "-hash.log",list)
end
-
+ table.save(filename or tex.jobname .. "-hash.log",list)
end
+-- -- old token code
+--
+-- function trackers.dumphashtofile(filename,delta)
+-- local list = { }
+-- local hash = texhashtokens()
+-- local getname = 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 = getname(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
+-- table.save(filename or tex.jobname .. "-hash.log",list)
+-- end
+
local delta = nil
local function dump_hash(wanteddelta)