blob: 79370d2ce8dd341c207b33d2af81960d88887500 (
plain)
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
|
if not modules then modules = { } end modules ['mlib-lmp'] = {
version = 1.001,
comment = "companion to mlib-ctx.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files",
}
-- path relates stuff ... todo: use a stack (or numeric index to list)
local type = type
local aux = mp.aux
local mpnumeric = aux.numeric
local mppair = aux.pair
local p = nil
local n = 0
local function mf_path_reset()
p = nil
n = 0
end
local get = mp.get
local mpgetpath = get.path
local function mf_path_length(name)
p = mpgetpath(name)
n = p and #p or 0
mpnumeric(n)
end
local function mf_path_point(i)
if i > 0 and i <= n then
local pi = p[i]
mppair(pi[1],pi[2])
end
end
local function mf_path_left(i)
if i > 0 and i <= n then
local pi = p[i]
mppair(pi[5],pi[6])
end
end
local function mf_path_right(i)
if i > 0 and i <= n then
local pn
if i == 1 then
pn = p[2] or p[1]
else
pn = p[i+1] or p[1]
end
mppair(pn[3],pn[4])
end
end
mp.mf_path_length = mf_path_length mp.pathlength = mf_path_length
mp.mf_path_point = mf_path_point mp.pathpoint = mf_path_point
mp.mf_path_left = mf_path_left mp.pathleft = mf_path_left
mp.mf_path_right = mf_path_right mp.pathright = mf_path_right
mp.mf_path_reset = mf_path_reset mp.pathreset = mf_path_reset
|