summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/trac-deb.lua
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-05-24 14:05:02 +0000
commit57ea7dad48fbf2541c04e434c31bde655ada3ac4 (patch)
tree1f8b43bc7cb92939271e1f5bec610710be69097f /Master/texmf-dist/tex/context/base/trac-deb.lua
parent6ee41e1f1822657f7f23231ec56c0272de3855e3 (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/trac-deb.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/trac-deb.lua73
1 files changed, 27 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/context/base/trac-deb.lua b/Master/texmf-dist/tex/context/base/trac-deb.lua
index f476169c395..97753f3e921 100644
--- a/Master/texmf-dist/tex/context/base/trac-deb.lua
+++ b/Master/texmf-dist/tex/context/base/trac-deb.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['trac-deb'] = {
version = 1.001,
- comment = "companion to luat-lib.tex",
+ 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"
@@ -9,19 +9,6 @@ if not modules then modules = { } end modules ['trac-deb'] = {
if not lmx then lmx = { } end
if not lmx.variables then lmx.variables = { } end
-lmx.variables['color-background-green'] = '#4F6F6F'
-lmx.variables['color-background-blue'] = '#6F6F8F'
-lmx.variables['color-background-yellow'] = '#8F8F6F'
-lmx.variables['color-background-purple'] = '#8F6F8F'
-
-lmx.variables['color-background-body'] = '#808080'
-lmx.variables['color-background-main'] = '#3F3F3F'
-lmx.variables['color-background-one'] = lmx.variables['color-background-green']
-lmx.variables['color-background-two'] = lmx.variables['color-background-blue']
-
-lmx.variables['title-default'] = 'ConTeXt Status Information'
-lmx.variables['title'] = lmx.variables['title-default']
-
lmx.htmfile = function(name) return environment.jobname .. "-status.html" end
lmx.lmxfile = function(name) return resolvers.find_file(name,'tex') end
@@ -31,8 +18,11 @@ if not tracers.strings then tracers.strings = { } end
tracers.strings.undefined = "undefined"
+local splitter = lpeg.splitat(":")
+local lpegmatch = lpeg.match
+
function tracers.split(csname)
- return csname:match("^(.+):(.+)$")
+ return lpegmatch(splitter,csname)
end
function tracers.type(csname)
@@ -82,30 +72,30 @@ function tracers.knownlist(name)
end
function tracers.showdebuginfo()
- lmx.set('title', 'ConTeXt Debug Information')
- lmx.set('color-background-one', lmx.get('color-background-green'))
- lmx.set('color-background-two', lmx.get('color-background-blue'))
- lmx.show('context-debug.lmx')
- lmx.restore()
+ local variables = {
+ ['title'] = 'ConTeXt Debug Information',
+ ['color-background-one'] = lmx.get('color-background-green'),
+ ['color-background-two'] = lmx.get('color-background-blue'),
+ }
+ lmx.show('context-debug.lmx',variables)
end
function tracers.showerror()
- lmx.set('title', 'ConTeXt Error Information')
- lmx.set('errormessage', status.lasterrorstring)
- lmx.set('linenumber', status.linenumber)
- lmx.set('color-background-one', lmx.get('color-background-yellow'))
- lmx.set('color-background-two', lmx.get('color-background-purple'))
local filename = status.filename
local linenumber = tonumber(status.linenumber or "0")
+ local variables = {
+ ['title'] = 'ConTeXt Error Information',
+ ['errormessage'] = status.lasterrorstring,
+ ['linenumber'] = status.linenumber,
+ ['color-background-one'] = lmx.get('color-background-yellow'),
+ ['color-background-two'] = lmx.get('color-background-purple'),
+ }
if not filename then
- lmx.set('filename', 'unknown')
- lmx.set('errorcontext', 'error in filename')
+ variables.filename, variables.errorcontext = 'unknown', 'error in filename'
elseif type(filename) == "number" then
- lmx.set('filename', "<read " .. filename .. ">")
- lmx.set('errorcontext', 'unknown error')
+ variables.filename, variables.errorcontext = "<read " .. filename .. ">", 'unknown error'
elseif io.exists(filename) then
-- todo: use an input opener so that we also catch utf16 an reencoding
- lmx.set('filename', filename)
lines = io.lines(filename)
if lines then
local context = { }
@@ -124,16 +114,14 @@ function tracers.showerror()
end
n = n + 1
end
- lmx.set('errorcontext', table.concat(context,"\n"))
+ variables.filename, variables.errorcontext = filename, table.concat(context,"\n")
else
- lmx.set('errorcontext', "")
+ variables.filename, variables.errorcontext = filename, ""
end
else
- lmx.set('filename', filename)
- lmx.set('errorcontext', 'file not found')
+ variables.filename, variables.errorcontext = filename, 'file not found'
end
- lmx.show('context-error.lmx')
- lmx.restore()
+ lmx.show('context-error.lmx',variables)
end
function tracers.overloaderror()
@@ -171,7 +159,7 @@ function tracers.dump_hash(filename,delta)
local list = { }
local hash = tex.hashtokens()
local command_name = token.command_name
- for name, token in pairs(hash) do
+ 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)
@@ -195,12 +183,5 @@ function tracers.register_dump_hash(delta)
main.register_stop_actions(1,function() tracers.dump_hash(nil,true) end) -- at front
end
--- trackers (maybe group the show by class)
-
-function trackers.show()
- commands.writestatus("","")
- for k,v in ipairs(trackers.list()) do
- commands.writestatus("tracker",v)
- end
- commands.writestatus("","")
-end
+directives.register("system.dumphash", function() tracers.register_dump_hash(false) end)
+directives.register("system.dumpdelta", function() tracers.register_dump_hash(true ) end)