1if not modules then modules = { } end modules ['bndr-ini'] = {
2 version = 1.001,
3 comment = "companion to bndr-ini.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9local context = context
10local storage = storage
11local implement = interfaces.implement
12local sharedstorage = storage.shared
13
14local boundaries = tex.boundaries or { }
15tex.boundaries = boundaries
16
17boundaries.names = boundaries.names or { }
18boundaries.numbers = boundaries.numbers or { }
19
20local names = boundaries.names
21local numbers = boundaries.numbers
22
23storage.register("boundaries/names", names, "tex.boundaries.names")
24storage.register("boundaries/numbers", numbers, "tex.boundaries.numbers")
25
26sharedstorage.boundaries_last = sharedstorage.boundaries_last or 0
27
28function boundaries.system(name)
29 local number = numbers[name]
30 if not number then
31 local last = sharedstorage.boundaries_last
32 number = last + 1
33 sharedstorage.boundaries_last = number
34 numbers[name] = number
35 names[number] = name
36 end
37 return number
38end
39
40implement {
41 name = "defineboundary",
42 arguments = "string",
43 actions = { boundaries.system, context }
44}
45
46
47
48
49
50
51
52
53 |