-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpr-interface.lua
More file actions
86 lines (77 loc) · 1.78 KB
/
Copy pathcpr-interface.lua
File metadata and controls
86 lines (77 loc) · 1.78 KB
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
--[[Method = Class("Method", {
prototype = function(self, wt, indent)
wt:add(indent)
if self.rctype.reg ~= "c" then
if self.spec then
for k, v in ipairs(self.spec) do
if k > 1 then
wt:add(" ", v)
else
wt:add(v)
end
end
wt:add(" ")
end
self.rctype:cpr(wt, indent, self.rctype)
wt:add(" ", self.cid or self.id, "(")
self.cself.ctype:cpr(wt, indent, self)
wt:add(" ")
self.cself:cpr(wt, indent, self)
for k, v in ipairs(self.params) do
if k > 1 then
wt:add(", ")
end
v.ctype:cpr(wt, indent, self)
wt:add(" ")
v:cpr(wt, indent, self)
end
if self.vararg then
wt:add(",", "...")
end
wt:add(")")
else
self.ctype:cpr(wt, indent, self)
end
wt:add(";\n")
end
},
function(M, self)
--idump(self)
disown(self.rctype)
disown(self.ctype)
disown(self.cself)
for k, v in ipairs(self.params) do
disown(v)
end
if self.block then
disown(self.block)
end
return self
end)]]
Interface = Class("Interface", {
cpr = function(self, wt, indent)
local indent2 = indent .. " "
wt:add(indent, "/* start interface ", self.cid or self.id, " */\n")
wt:add(indent2)
self.struct:cpr(wt, indent2)
wt:add(";\n")
--self:structify(wt, indent2, self.cid or self.id) -- emit full prototype
for k, v in ipairs(self.methods) do
v:cpr(wt, indent2)
end
wt:add(indent, "/* end interface ", self.cid or self.id, " */\n")
end,
},
function(I, self)
--idump(self)
for k, v in ipairs(self) do
disown(v)
end
disown(self.ctype)
disown(self.env)
disown(self.struct)
for k, v in ipairs(self.methods) do
disown(v)
end
return self
end)