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
|
if not modules then modules = { } end modules ['bndr-ini'] = {
version = 1.001,
comment = "companion to bndr-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local context = context
local storage = storage
local implement = interfaces.implement
local sharedstorage = storage.shared
local boundaries = tex.boundaries or { } -- maybe different namespace
tex.boundaries = boundaries
boundaries.names = boundaries.names or { }
boundaries.numbers = boundaries.numbers or { }
local names = boundaries.names
local numbers = boundaries.numbers
storage.register("boundaries/names", names, "tex.boundaries.names")
storage.register("boundaries/numbers", numbers, "tex.boundaries.numbers")
sharedstorage.boundaries_last = sharedstorage.boundaries_last or 0 -- so zero is not used
function boundaries.system(name)
local number = numbers[name]
if not number then
local last = sharedstorage.boundaries_last
number = last + 1
sharedstorage.boundaries_last = number
numbers[name] = number
names[number] = name
end
return number
end
implement {
name = "defineboundary",
arguments = "string",
actions = { boundaries.system, context }
}
-- implement {
-- name = "newboundary",
-- arguments = "csname",
-- public = true,
-- protected = true,
-- actions = function(n) tex.setintegervalue(n,boundaries.system()) end,
-- }
|