From: John L. <jr...@us...> - 2008-01-31 05:09:23
|
Update of /cvsroot/wxlua/wxLua/bindings/wxlua In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1826/wxLua/bindings/wxlua Modified Files: override.hpp wxlua.i Log Message: Add functions to check if objects are gc, tracked, or refed in Lua. Index: wxlua.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/wxlua.i,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wxlua.i 26 Jan 2008 23:27:25 -0000 1.17 --- wxlua.i 31 Jan 2008 05:09:19 -0000 1.18 *************** *** 53,56 **** --- 53,65 ---- %function LuaTable GetTrackedWinDestroyCallbackInfo(bool as_string = false) + // Is the wxLua userdata object on the list to be garbage collected by Lua? + %function bool isgcobject(void* object) + + // Is the wxLua userdata object on the list of tracked objects? + %function bool istrackedobject(void* object) + + // Is the wxLua object refed by wxLua + %function bool isrefed(void* object) + // --------------------------------------------------------------------------- // Type information about the bindings or current userdata *************** *** 228,232 **** int RunString(const wxString &script, const wxString& name = "") bool IsRunning() const - */ %endclass --- 237,240 ---- Index: override.hpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxlua/override.hpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** override.hpp 24 Jan 2008 00:18:15 -0000 1.19 --- override.hpp 31 Jan 2008 05:09:19 -0000 1.20 *************** *** 103,106 **** --- 103,152 ---- %end + %override wxLua_function_isgcobject + // %function bool isgcobject(void* object) + static int LUACALL wxLua_function_isgcobject(lua_State *L) + { + bool ret = false; + if (wxlua_iswxuserdatatype(wxluaT_type(L, 1))) + { + void* obj_ptr = wxlua_touserdata(L, 1, false); + ret = wxluaO_isgcobject(L, obj_ptr); + } + + lua_pushboolean(L, ret); + return 1; + } + %end + + %override wxLua_function_istrackedobject + // %function bool istrackedobject(void* object) + static int LUACALL wxLua_function_istrackedobject(lua_State *L) + { + bool ret = false; + int wxl_type = wxluaT_type(L, 1); + + if (wxlua_iswxuserdatatype(wxl_type)) + { + void* obj_ptr = wxlua_touserdata(L, 1, false); + ret = wxluaO_istrackedweakobject(L, obj_ptr, wxl_type, false); + } + + lua_pushboolean(L, ret); + return 1; + } + %end + + %override wxLua_function_isrefed + // %function bool isrefed(void* object) + static int LUACALL wxLua_function_isrefed(lua_State *L) + { + bool ret = wxluaR_isrefed(L, 1, &wxlua_lreg_refs_key) != LUA_NOREF; + + lua_pushboolean(L, ret); + return 1; + } + %end + + %override wxLua_function_type // %function int type(int wxluaarg_tag) |