1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
if not modules then modules = { } end modules ['trac-ctx'] = {
version = 1.001,
comment = "companion to trac-ctx.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local next = next
local context = context
local implement = interfaces.implement
local register = trackers.register
local textrackers = tex.trackers or { }
local texdirectives = tex.directives or { }
local texexperiments = tex.experiments or { }
tex.trackers = textrackers
tex.directives = texdirectives
tex.experiments = texexperiments
storage.register("tex/trackers", textrackers, "tex.trackers")
storage.register("tex/directives", texdirectives, "tex.directives")
storage.register("tex/experiments",texexperiments,"tex.experiments")
local function doit(category,tag,v)
local tt = category[tag]
if tt then
context.unprotect()
context(v and tt[1] or tt[2]) -- could be one call
context.protect()
end
end
local function initialize(category,register)
for tag, commands in next, category do
register(tag, function(v) doit(category,tag,v) end) -- todo: v,tag in caller
end
end
local function install(category,register,tag,enable,disable)
category[tag] = { enable, disable }
register(tag, function(v) doit(category,tag,v) end) -- todo: v,tag in caller
end
implement {
name = "initializetextrackers",
actions = function()
initialize(textrackers,trackers.register)
end
}
implement {
name = "initializetexdirectives",
actions = function()
initialize(texdirectives,directives.register)
end
}
implement {
name = "initializetexexperiments",
actions = function()
initialize(texexperiments,experiments.register)
end
}
implement {
name = "installtextracker",
arguments = "3 strings",
actions = function(tag,enable,disable)
install(textrackers,trackers.register,tag,enable,disable)
end,
}
implement {
name = "installtexdirective",
arguments = "3 strings",
actions = function(tag,enable,disable)
install(texdirectives,directives.register,tag,enable,disable)
end,
}
implement {
name = "installtexexperiment",
arguments = "3 strings",
actions = function(tag,enable,disable)
install(texexperiments,experiments.register,tag,enable,disable)
end,
}
-- this one might move
interfaces.implement {
name = "unsupportedcs",
public = true,
actions = function()
logs.newline()
logs.report("fatal error","unsupported cs \\%s",tokens.scanners.csname())
logs.newline()
luatex.abort()
end
}
|