summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/trac-deb.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/trac-deb.lmt')
-rw-r--r--tex/context/base/mkiv/trac-deb.lmt198
1 files changed, 47 insertions, 151 deletions
diff --git a/tex/context/base/mkiv/trac-deb.lmt b/tex/context/base/mkiv/trac-deb.lmt
index 88d686462..b9827c3a9 100644
--- a/tex/context/base/mkiv/trac-deb.lmt
+++ b/tex/context/base/mkiv/trac-deb.lmt
@@ -13,147 +13,53 @@ local status = status
local tonumber, tostring, type = tonumber, tostring, type
local format, concat, match, find, gsub = string.format, table.concat, string.match, string.find, string.gsub
-local lpegmatch = lpeg.match
--- maybe tracers -> tracers.tex (and tracers.lua for current debugger)
+local report_nl = logs.newline
+local report_str = logs.writer
------ report_tex = logs.reporter("tex error")
------ report_lua = logs.reporter("lua error")
-local report_nl = logs.newline
-local report_str = logs.writer
+tracers = tracers or { }
+local tracers = tracers
-tracers = tracers or { }
-local tracers = tracers
+local implement = interfaces.implement
--- this is old tracing stuff ... will go to its own module
+local ioflush = io.flush
+local ioread = io.read
+local writenl = texio.write_nl
+local write = texio.write
-tracers.lists = { }
-local lists = tracers.lists
+local runlocal = tex.runlocal
+local terminaldata = false
+local context = context
-tracers.strings = { }
-local strings = tracers.strings
-
-local texgetdimen = tex.getdimen
-local texgettoks = tex.gettoks
-local texgetcount = tex.getcount
-local texgethelp = tex.gethelptext or function() end
-local fatalerror = tex.fatalerror
-
-local implement = interfaces.implement
-
--- this is used in lmx files but needs to be redone
-
-strings.undefined = "undefined"
-
-function tracers.dimen(name)
- local d = texgetdimen(name)
- return d and number.topoints(d) or strings.undefined
-end
-
-function tracers.count(name)
- return texgetcount(name) or strings.undefined
-end
-
-function tracers.toks(name,limit)
- local t = texgettoks(name)
- return t and string.limit(t,tonumber(limit) or 40) or strings.undefined
-end
-
-function tracers.primitive(name)
- return tex[name] or strings.undefined
-end
-
-lists.scratch = {
- 0, 2, 4, 6, 8
-}
-
-lists.internals = {
- 'p:hsize', 'p:parindent', 'p:leftskip','p:rightskip',
- 'p:vsize', 'p:parskip', 'p:baselineskip', 'p:lineskip', 'p:topskip'
-}
-
-lists.context = {
- 'd:lineheight',
- 'c:realpageno', 'c:userpageno', 'c:pageno', 'c:subpageno'
-}
-
-local types = {
- ['d'] = tracers.dimen,
- ['c'] = tracers.count,
- ['t'] = tracers.toks,
- ['p'] = tracers.primitive
+interfaces.implement {
+ name = "fetchterminaldata",
+ actions = function()
+ context(terminaldata)
+ end,
}
-local splitboth = lpeg.splitat(":")
-
-function tracers.type(csname)
- local tag, name = lpegmatch(splitboth,csname)
- return tag or ""
-end
-
-function tracers.name(csname)
- local tag, name = lpegmatch(splitboth,csname)
- return name or csname
-end
-
-function tracers.cs(csname)
- local tag, name = lpegmatch(splitboth,csname)
- if name and types[tag] then
- return types[tag](name)
- else
- return tracers.primitive(csname)
- end
-end
-
-function tracers.knownlist(name)
- local l = lists[name]
- return l and #l > 0
-end
-
--- till here
-
-do
-
- local ioflush = io.flush
- local ioread = io.read
- local writenl = texio.write_nl
- local write = texio.write
-
- local runlocal = tex.runlocal
- local terminaldata = false
- local context = context
-
- interfaces.implement {
- name = "fetchterminaldata",
- actions = function()
- context(terminaldata)
- end,
- }
-
- function texio.terminal()
- writenl("\n" .. "entering interactive mode, use \\quit to abort reading" .."\n\n")
- while true do
- write(">")
- ioflush()
- terminaldata = ioread()
- if terminaldata == "\\quit" then
- terminaldata = false
- break
- else
- runlocal("t_syst_terminal_data",nil,nil,true) -- obeymode
- end
+function texio.terminal()
+ writenl("\n" .. "entering interactive mode, use \\quit to abort reading" .."\n\n")
+ while true do
+ write(">")
+ ioflush()
+ terminaldata = ioread()
+ if terminaldata == "\\quit" then
+ terminaldata = false
+ break
+ else
+ runlocal("t_syst_terminal_data",nil,nil,true) -- obeymode
end
end
-
- interfaces.implement {
- name = "readfromterminal",
- public = true,
- protected = true,
- actions = texio.terminal,
- }
-
end
+interfaces.implement {
+ name = "readfromterminal",
+ public = true,
+ protected = true,
+ actions = texio.terminal,
+}
+
local savedluaerror = nil
local usescitelexer = nil
local quitonerror = true
@@ -408,15 +314,6 @@ local function reportback(lmxname,default,variables)
end
end
-function lmx.showdebuginfo(lmxname)
- local variables = {
- ['title'] = 'ConTeXt Debug Information',
- ['color-background-one'] = lmx.get('color-background-green'),
- ['color-background-two'] = lmx.get('color-background-blue'),
- }
- reportback(lmxname,"context-debug.lmx",variables)
-end
-
local function showerror(lmxname)
local readstate = status.readstate()
local filename = readstate.filename
@@ -491,22 +388,21 @@ directives.register("system.showerror", lmx.overloaderror)
local implement = interfaces.implement
-implement { name = "showtrackers", actions = trackers.show }
-implement { name = "enabletrackers", actions = trackers.enable, arguments = "string" }
-implement { name = "disabletrackers", actions = trackers.disable, arguments = "string" }
-implement { name = "resettrackers", actions = trackers.reset }
+implement { name = "showtrackers", public = true, protected = true, actions = trackers.show }
+implement { name = "enabletrackers", public = true, protected = true, actions = trackers.enable, arguments = "optional" }
+implement { name = "disabletrackers", public = true, protected = true, actions = trackers.disable, arguments = "optional" }
+implement { name = "resettrackers", public = true, protected = true, actions = trackers.reset }
-implement { name = "showdirectives", actions = directives.show }
-implement { name = "enabledirectives", actions = directives.enable, arguments = "string" }
-implement { name = "disabledirectives", actions = directives.disable, arguments = "string" }
+implement { name = "showdirectives", public = true, protected = true, actions = directives.show }
+implement { name = "enabledirectives", public = true, protected = true, actions = directives.enable, arguments = "optional" }
+implement { name = "disabledirectives", public = true, protected = true, actions = directives.disable, arguments = "optional" }
-implement { name = "showexperiments", actions = experiments.show }
-implement { name = "enableexperiments", actions = experiments.enable, arguments = "string" }
-implement { name = "disableexperiments", actions = experiments.disable, arguments = "string" }
+implement { name = "showexperiments", public = true, protected = true, actions = experiments.show }
+implement { name = "enableexperiments", public = true, protected = true, actions = experiments.enable, arguments = "optional" }
+implement { name = "disableexperiments", public = true, protected = true, actions = experiments.disable, arguments = "optional" }
-implement { name = "showdebuginfo", actions = lmx.showdebuginfo }
-implement { name = "overloaderror", actions = lmx.overloaderror }
-implement { name = "showlogcategories", actions = logs.show }
+implement { name = "overloaderror", public = true, protected = true, actions = lmx.overloaderror }
+implement { name = "showlogcategories", public = true, protected = true, actions = logs.show }
local debugger = utilities.debugger