local proto = self:gen_proto()
s:write(" ", proto.name, proto.suffix or "", " = function(",
table.concat(proto.args, ", "), ")\n")
- s:write( " self:__do_start(__class)\n")
+ s:write( " eo.__do_start(self, __class)\n")
for i, v in ipairs(proto.allocs) do
s:write(" local ", v[2], " = ffi.new(\"", v[1], "[1]\")\n")
end
local genv = (proto.ret_type ~= "void")
s:write(" ", genv and "local v = " or "", "__lib.",
proto.full_name, "(", table.concat(proto.vargs, ", "), ")\n")
- s:write(" self:__do_end()\n")
+ s:write(" eo.__do_end()\n")
if #proto.rets > 0 then
s:write(" return ", table.concat(proto.rets, ", "), "\n")
end
local genv = (proto.ret_type ~= "void")
local cvargs = table.concat(proto.vargs, ", ")
if cvargs ~= "" then cvargs = ", " .. cvargs end
- s:write(" ", genv and "local v = " or "", "self:__ctor_common(",
- "__class, parent, __lib.", proto.full_name, cvargs, ")\n")
+ s:write(" ", genv and "local v = " or "", "eo.__ctor_common(",
+ "self, __class, parent, __lib.", proto.full_name, cvargs, ")\n")
if not defctor then
table.insert(proto.rets, 1, "self")
end
s:write( " __ctor = function(self, parent)\n")
s:write(" self:__define_properties(self.__proto.__proto)\n")
- s:write(" self:__ctor_common(__class, parent)\n")
+ s:write(" eo.__ctor_common(self, __class, parent)\n")
s:write(" end", last and "" or ",", last and "\n" or "\n\n")
end,
classes[name] = val
end
-M.Eo_Base = util.Object:clone {
- __ctor_common = function(self, klass, parent, ctor, loff, ...)
- local info = getinfo(2 + (loff or 0), "nlSf")
- local source = info.source
- local func = getfuncname(info)
- local line = info.currentline
- local tmp_obj = eo._eo_add_internal_start(source, line, klass,
- parent.__obj)
- local retval
- if eo._eo_do_start(tmp_obj, nil, false, source, func, line) ~= 0 then
- if ctor then
- retval = ctor(...)
- else
- eo.eo_constructor()
- end
- tmp_obj = eo.eo_finalize()
- eo._eo_do_end(nil)
- end
- self.__obj = tmp_obj
- self.__parent = parent
- return retval
- end,
-
- __do_start = function(self, klass)
- if eo.eo_isa(self.__obj, klass) == 0 then
- error("method call on an invalid object", 3)
+M.__ctor_common = function(self, klass, parent, ctor, loff, ...)
+ local info = getinfo(2 + (loff or 0), "nlSf")
+ local source = info.source
+ local func = getfuncname(info)
+ local line = info.currentline
+ local tmp_obj = eo._eo_add_internal_start(source, line, klass,
+ parent.__obj)
+ local retval
+ if eo._eo_do_start(tmp_obj, nil, false, source, func, line) ~= 0 then
+ if ctor then
+ retval = ctor(...)
+ else
+ eo.eo_constructor()
end
- local info = getinfo(3, "nlSf")
- return eo._eo_do_start(self.__obj, nil, false, info.source,
- getfuncname(info), info.currentline) ~= 0
- end,
-
- __do_end = function(self)
- eo._eo_do_end(nil) -- the parameter is unused and originally there
- -- only for cleanup (dtor)
+ tmp_obj = eo.eo_finalize()
+ eo._eo_do_end(nil)
+ end
+ self.__obj = tmp_obj
+ self.__parent = parent
+ return retval
+end
+
+M.__do_start = function(self, klass)
+ if eo.eo_isa(self.__obj, klass) == 0 then
+ error("method call on an invalid object", 3)
end
+ local info = getinfo(3, "nlSf")
+ return eo._eo_do_start(self.__obj, nil, false, info.source,
+ getfuncname(info), info.currentline) ~= 0
+end
+
+M.__do_end = function()
+ eo._eo_do_end(nil) -- the parameter is unused and originally there
+ -- only for cleanup (dtor)
+end
+
+M.Eo_Base = util.Object:clone {
}
return M
\ No newline at end of file