From: John L. <jr...@us...> - 2007-06-25 23:04:07
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10540/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h Log Message: Replace wxLuaState::GetCallBaseClassfunction with wxlua_getcallbaseclassfunction so we no longer need a wxLuaState in the __index func for class objects Better names for the metatable C functions Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wxlbind.h 25 Jun 2007 19:44:50 -0000 1.54 --- wxlbind.h 25 Jun 2007 23:04:00 -0000 1.55 *************** *** 23,32 **** // ---------------------------------------------------------------------------- ! // memory deallocation function for created wxLuaBindClass defined objects, lua's __gc ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind_gc_wxLuaBindClass(lua_State *L); ! // lua 'set table' function for created wxLuaBindClass defined objects, lua's __newindex WXDLLIMPEXP_WXLUA int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L); ! // lua 'get table' function for created wxLuaBindClass defined objects, lua's __index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind_index_wxLuaBindClass(lua_State *L); // If there is a special userdata upvalue, remove 1 value if !only_check // (hack to remove the table lua pushes onto the stack when calling the --- 23,35 ---- // ---------------------------------------------------------------------------- ! // memory deallocation function for created wxLuaBindClass defined objects, lua's __gc metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L); ! // lua 'set table' function for created wxLuaBindClass defined objects, lua's __newindex metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L); ! // lua 'get table' function for created wxLuaBindClass defined objects, lua's __index metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__index_wxLuaBindClass(lua_State *L); ! // lua 'tostring' function for created wxLuaBindClass defined objects, lua's __tostring metatable index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind__tostring_wxLuaBindClass(lua_State *L); ! // If there is a special userdata upvalue, remove 1 value if !only_check // (hack to remove the table lua pushes onto the stack when calling the *************** *** 183,188 **** { public: ! wxLuaFunction(wxLuaBindMethod *wxlMethod, wxLuaBindClass *wxlClass, void *pObject) ! : m_wxlMethod(wxlMethod), m_wxlClass(wxlClass), m_pObject(pObject) {} ~wxLuaFunction() {} --- 186,191 ---- { public: ! wxLuaFunction(wxLuaBindMethod *wxlMethod, void *pObject) ! : m_wxlMethod(wxlMethod), m_pObject(pObject) {} ~wxLuaFunction() {} *************** *** 192,196 **** wxLuaBindMethod *m_wxlMethod; - wxLuaBindClass *m_wxlClass; void *m_pObject; }; --- 195,198 ---- *************** *** 198,204 **** // Garbage collect and free memory associated with the wxLuaFunction class // lua's __gc metatable function. ! int LUACALL wxlua_gc_wxLuaFunction(lua_State *L); // call a wxLuaFunction, lua's __call metatable function. ! int LUACALL wxlua_call_wxLuaFunction(lua_State *L); // ---------------------------------------------------------------------------- --- 200,206 ---- // Garbage collect and free memory associated with the wxLuaFunction class // lua's __gc metatable function. ! int LUACALL wxlua__gc_wxLuaFunction(lua_State *L); // call a wxLuaFunction, lua's __call metatable function. ! int LUACALL wxlua__call_wxLuaFunction(lua_State *L); // ---------------------------------------------------------------------------- Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** wxlstate.h 25 Jun 2007 19:44:50 -0000 1.83 --- wxlstate.h 25 Jun 2007 23:04:00 -0000 1.84 *************** *** 48,57 **** if (luastr == NULL) return wxEmptyString; // check for NULL - wxString str; - #if wxUSE_UNICODE ! str = wxString(luastr, wxConvUTF8); #else ! str = wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent); #endif // wxUSE_UNICODE --- 48,55 ---- if (luastr == NULL) return wxEmptyString; // check for NULL #if wxUSE_UNICODE ! wxString str(luastr, wxConvUTF8); #else ! wxString str(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent); #endif // wxUSE_UNICODE *************** *** 99,104 **** #define WXLUA_LREG_DERIVED_METHODS 3 #define WXLUA_LREG_WXLUASTATEREFDATA 4 ! #define WXLUA_METATABLE_TAG 5 ! #define WXLUA_METATABLE_CLASS 6 // Light user data used as keys in the lua registry table for wxLua items. --- 97,103 ---- #define WXLUA_LREG_DERIVED_METHODS 3 #define WXLUA_LREG_WXLUASTATEREFDATA 4 ! #define WXLUA_LREG_CALLBASECLASSFUNC 5 ! #define WXLUA_METATABLE_TAG 6 ! #define WXLUA_METATABLE_CLASS 7 // Light user data used as keys in the lua registry table for wxLua items. *************** *** 108,111 **** --- 107,111 ---- extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_derivedmethods_key; // WXLUA_LREG_DERIVED_METHODS extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_wxluastaterefdata_key; // WXLUA_LREG_WXLUASTATEREFDATA + extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_callbaseclassfunc_key; // WXLUA_LREG_CALLBASECLASSFUNC // Light user data used as keys in the metatables created for the class userdata objects. *************** *** 124,130 **** // t[lightuserdata object] = {["derived func/value name"] = wxLuaObject(lua function/value), ...} #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) ! // Push a key of an index of the LUA_REGISTRYINDEX table that is a lightuserdata of the // wxLuaStateRefData for this lua_State. #define wxlua_pushkey_wxLuaStateRefData(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastaterefdata_key) // Push a key of an index into the metatable of a wxLua userdata for the "tag" --- 124,133 ---- // t[lightuserdata object] = {["derived func/value name"] = wxLuaObject(lua function/value), ...} #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) ! // Push a key that is an index of the LUA_REGISTRYINDEX table that is a lightuserdata of the // wxLuaStateRefData for this lua_State. #define wxlua_pushkey_wxLuaStateRefData(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastaterefdata_key) + // Push a key that is an index of the LUA_REGISTRYINDEX table that is boolean value + // of whether the lua code has prepended a '_' to indicate they want the base class function called. + #define wxlua_pushkey_CallBaseClassFunc(L) lua_pushlightuserdata(L, &wxlua_lreg_callbaseclassfunc_key) // Push a key of an index into the metatable of a wxLua userdata for the "tag" *************** *** 286,297 **** // The derived methods are stored in the "wxLuaDerivedMethods" table in the // lua registry table. ! bool wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. // If push_method then push the method onto the stack. // A derived method is when a function or value is set to a wxLua userdata. ! bool wxlua_hasderivedmethod(lua_State* L, void *pObject, const char *method_name, bool push_method); // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! bool wxlua_removederivedmethod(lua_State* L, void *pObject); //---------------------------------------------------------------------------- --- 289,307 ---- // The derived methods are stored in the "wxLuaDerivedMethods" table in the // lua registry table. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. // If push_method then push the method onto the stack. // A derived method is when a function or value is set to a wxLua userdata. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_hasderivedmethod(lua_State* L, void *pObject, const char *method_name, bool push_method); // When an object is being garbage collected and we call RemoveTrackedObject // object on it, we should also remove any derived functions or values it may have. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_removederivedmethod(lua_State* L, void *pObject); ! ! // Get the value of the flag set to determine if a virtual C++ class member ! // function should call it's own base class function or a wxLua derived method. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_getcallbaseclassfunction(lua_State*L); ! // Set if the class member function call has a prepended '_' to imply that ! // the user wants the base class function and not the derived method. ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_setcallbaseclassfunction(lua_State*L, bool call_base); //---------------------------------------------------------------------------- *************** *** 310,315 **** bool m_bindings_registered; // Are the bindings registered into the lua_State - bool m_callbase_func; // call the base class function instead of derived func - wxEventType m_inEventType; // wxEventType set when in event, else wxEVT_NULL --- 320,323 ---- |