summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-09-24 13:49:39 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-09-24 13:49:58 +0100
commit15d9fec0e00cc4b2a632f43711f629c8f9683da3 (patch)
tree004aadf02bf702d03f1f4571f17bce10dd49337c
parentd74943f24788102ce085b553a615d4b8e5f6eb1a (diff)
elua: class unregister + keep track of Eo_Class
-rw-r--r--src/bindings/luajit/eo.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index a74bee43d8..741c4bcee7 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -104,6 +104,8 @@ ffi.cdef [[
104 void eo_key_data_del(const char *key); 104 void eo_key_data_del(const char *key);
105 105
106 Eina_Iterator *eo_children_iterator_new(void); 106 Eina_Iterator *eo_children_iterator_new(void);
107
108 const Eo_Class *eo_base_class_get(void);
107]] 109]]
108 110
109local cutil = require("cutil") 111local cutil = require("cutil")
@@ -116,9 +118,11 @@ local eo
116local init = function() 118local init = function()
117 eo = util.lib_load("eo") 119 eo = util.lib_load("eo")
118 eo.eo_init() 120 eo.eo_init()
121 M.class_register("Eo.Base", M.Base, eo.eo_base_class_get())
119end 122end
120 123
121local shutdown = function() 124local shutdown = function()
125 M.class_unregister("Eo.Base")
122 eo.eo_shutdown() 126 eo.eo_shutdown()
123 util.lib_unload("eo") 127 util.lib_unload("eo")
124end 128end
@@ -132,16 +136,27 @@ local getfuncname = function(info)
132end 136end
133 137
134local classes = {} 138local classes = {}
139local eo_classes = {}
135 140
136M.class_get = function(name) 141M.class_get = function(name)
137 return classes[name] 142 return classes[name]
138end 143end
139 144
140M.class_register = function(name, val) 145M.eo_class_get = function(name)
146 return eo_classes[name]
147end
148
149M.class_register = function(name, val, addr)
141 classes[name] = val 150 classes[name] = val
151 eo_classes[name] = addr
142 return val 152 return val
143end 153end
144 154
155M.class_unregister = function(name)
156 classes[name] = nil
157 eo_classes[name] = nil
158end
159
145M.__ctor_common = function(self, klass, parent, ctor, loff, ...) 160M.__ctor_common = function(self, klass, parent, ctor, loff, ...)
146 local info = getinfo(2 + (loff or 0), "nlSf") 161 local info = getinfo(2 + (loff or 0), "nlSf")
147 local source = info.source 162 local source = info.source
@@ -192,6 +207,5 @@ ffi.metatype("Eo", {
192 207
193M.Base = util.Object:clone { 208M.Base = util.Object:clone {
194} 209}
195M.class_register("Eo.Base", M.Base)
196 210
197return M 211return M