From: John L. <jr...@us...> - 2008-01-31 05:09:23
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1826/wxLua/modules/wxlua/src Modified Files: wxlua_bind.cpp Log Message: Add functions to check if objects are gc, tracked, or refed in Lua. Index: wxlua_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlua_bind.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wxlua_bind.cpp 29 Jan 2008 04:22:54 -0000 1.27 --- wxlua_bind.cpp 31 Jan 2008 05:09:19 -0000 1.28 *************** *** 930,933 **** --- 930,984 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_GetTrackedWindowInfo[1] = {{ wxLua_function_GetTrackedWindowInfo, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatypeArray_wxLua_function_GetTrackedWindowInfo }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_isgcobject[] = { &wxluatype_TLIGHTUSERDATA, NULL }; + // %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; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_isgcobject[1] = {{ wxLua_function_isgcobject, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_isgcobject }}; + + static wxLuaArgType s_wxluatypeArray_wxLua_function_isrefed[] = { &wxluatype_TLIGHTUSERDATA, NULL }; + // %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; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_isrefed[1] = {{ wxLua_function_isrefed, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_isrefed }}; + + static wxLuaArgType s_wxluatypeArray_wxLua_function_istrackedobject[] = { &wxluatype_TLIGHTUSERDATA, NULL }; + // %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; + } + + static wxLuaBindCFunc s_wxluafunc_wxLua_function_istrackedobject[1] = {{ wxLua_function_istrackedobject, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatypeArray_wxLua_function_istrackedobject }}; + static wxLuaArgType s_wxluatypeArray_wxLua_function_iswxluatype[] = { &wxluatype_TNUMBER, &wxluatype_TNUMBER, NULL }; // %rename iswxluatype %function int wxlua_iswxluatype(int luatype, int wxluaarg_tag) *************** *** 1042,1045 **** --- 1093,1099 ---- { "GetTrackedWinDestroyCallbackInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWinDestroyCallbackInfo, 1, NULL }, { "GetTrackedWindowInfo", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_GetTrackedWindowInfo, 1, NULL }, + { "isgcobject", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_isgcobject, 1, NULL }, + { "isrefed", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_isrefed, 1, NULL }, + { "istrackedobject", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_istrackedobject, 1, NULL }, { "iswxluatype", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_iswxluatype, 1, NULL }, { "type", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_type, 1, NULL }, |