From: John L. <jr...@us...> - 2008-01-25 23:51:00
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1159/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlstate.h wxlua_bind.h Log Message: - Removed the wxLuaBinding::PreRegister() and PostRegister() functions and made RegisterBinding() virtual Note: wxLuaBinding::RegisterBinding() now leaves the Lua table that the binding objects were installed into on the stack. You must pop it. * The rules.lua for genwxbind.lua now uses wxLuaBinding_class_declaration and wxLuaBinding_class_implementation to replace wxLuaBinding_preregister and wxLuaBinding_postregister. You may now add whatever you like to the class declaration and implementation source code. Updated to Lua 5.1.3 official Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** wxlbind.h 24 Jan 2008 00:18:17 -0000 1.81 --- wxlbind.h 25 Jan 2008 23:50:52 -0000 1.82 *************** *** 19,22 **** --- 19,23 ---- class WXDLLIMPEXP_WXLUA wxLuaBinding; class WXDLLIMPEXP_WXLUA wxLuaState; + struct WXDLLIMPEXP_WXLUA wxLuaBindClass; // ---------------------------------------------------------------------------- *************** *** 51,62 **** #define WXLUA_TCFUNCTION 12 // LUA_TFUNCTION & lua_iscfunction(), not a LUA_TXXX ! #define WXLUA_TNULL 13 // C++ NULL ! #define WXLUA_T_MAX 13 // Max of the WXLUA_TXXX values ! #define WXLUA_T_MIN 0 // Min of the WXLUA_TXXX values ! // Blindly convert the lua_type to the wxlua_type. Note: WXLUA_TXXX = LUA_TXXX - 2 // *** See wxlua_luatowxluatype() for a better function *** ! #define LUAT_TO_WXLUAT(luatype) ((luatype) - 2) // Returns true if the wxLua type is for a wxLua binding type and not a --- 52,63 ---- #define WXLUA_TCFUNCTION 12 // LUA_TFUNCTION & lua_iscfunction(), not a LUA_TXXX ! #define WXLUA_T_MAX 12 // Max of the Lua WXLUA_TXXX values ! #define WXLUA_T_MIN 0 // Min of the Lua WXLUA_TXXX values ! #define WXLUA_TNULL 13 // C++ NULL, has metatable ! // Blindly convert the lua_type to the wxlua_type. Note: WXLUA_TXXX = LUA_TXXX + 2 // *** See wxlua_luatowxluatype() for a better function *** ! #define LUAT_TO_WXLUAT(luatype) ((luatype) + 2) // Returns true if the wxLua type is for a wxLua binding type and not a *************** *** 81,85 **** extern WXDLLIMPEXP_DATA_WXLUA(int) wxluatype_TCFUNCTION; ! extern WXDLLIMPEXP_DATA_WXLUA(int) wxluatype_NULL; // wxLua type for NULL pointer // Copies of wxLua types that are used very often. --- 82,87 ---- extern WXDLLIMPEXP_DATA_WXLUA(int) wxluatype_TCFUNCTION; ! extern WXDLLIMPEXP_DATA_WXLUA(int) wxluatype_NULL; // wxLua type for NULL pointer ! extern WXDLLIMPEXP_DATA_WXLUA(wxLuaBindClass) wxLuaBindClass_NULL; // for NULL pointer // Copies of wxLua types that are used very often. *************** *** 489,498 **** virtual ~wxLuaBinding() {} ! // override this to generate a "new" version of subclassed bindings ! virtual wxLuaBinding* Clone() const { return new wxLuaBinding; } ! ! // Binds C Functions/Defines/Object/Events to namespace Lua Table virtual bool RegisterBinding(const wxLuaState& wxlState); // ----------------------------------------------------------------------- --- 491,505 ---- virtual ~wxLuaBinding() {} ! // Binds C Functions/Defines/Object/Events to a Lua table with binding's namespace. ! // The Lua table that the bindings were installed into is left on the top ! // of the stack and you must pop it when done. virtual bool RegisterBinding(const wxLuaState& wxlState); + // Create the metatable for the class and install it into the Lua registry. + static bool InstallClassMetatable(lua_State* L, const wxLuaBindClass* wxlClass); + // Install a single wxLuaBindClass struct into the table at the top + // of the stack. + static bool InstallClass(lua_State* L, const wxLuaBindClass* wxlClass); + // ----------------------------------------------------------------------- *************** *** 602,614 **** // to sort the bindings appropriately ! // Register the classes, defines, strings, events, objects, and functions generated by the binding ! virtual void DoRegisterBinding(const wxLuaState& wxlState, int bind_table_idx); ! ! // Before registering anything from this binding this function is called ! // at the beginning of RegisterBinding(...) ! virtual void PreRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(bind_table_idx)) {} ! // After registering everything from this binding this function is called ! // at the end of RegisterBinding(...) ! virtual void PostRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(bind_table_idx)) {} // binding objects --- 609,616 ---- // to sort the bindings appropriately ! // Register the classes, defines, strings, events, objects, and functions ! // stored in the binding arrays. The Lua table to install them into ! // must be at the top of the stack. ! virtual void DoRegisterBinding(const wxLuaState& wxlState) const; // binding objects Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** wxlstate.h 24 Jan 2008 00:18:17 -0000 1.118 --- wxlstate.h 25 Jan 2008 23:50:52 -0000 1.119 *************** *** 864,868 **** wxLUA_UNICODE_ONLY(void RegisterFunction(lua_CFunction func, const wxString &funcName) { RegisterFunction(func, wx2lua(funcName)); }) ! // Register a single wxLuaBinding. bool RegisterBinding(wxLuaBinding* binding); // Register all the bindings in the wxLuaBinding::GetBindingList(), this is done --- 864,869 ---- wxLUA_UNICODE_ONLY(void RegisterFunction(lua_CFunction func, const wxString &funcName) { RegisterFunction(func, wx2lua(funcName)); }) ! // Register a single wxLuaBinding, returns true on success. Nothing is ! // left on the stack. bool RegisterBinding(wxLuaBinding* binding); // Register all the bindings in the wxLuaBinding::GetBindingList(), this is done Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** wxlua_bind.h 24 Jan 2008 00:18:17 -0000 1.12 --- wxlua_bind.h 25 Jan 2008 23:50:53 -0000 1.13 *************** *** 27,36 **** public: wxLuaBinding_wxlua(); - virtual wxLuaBinding* Clone() const { return new wxLuaBinding_wxlua; } ! protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) }; --- 27,34 ---- public: wxLuaBinding_wxlua(); ! virtual bool RegisterBinding(const wxLuaState& wxlState); + private: DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) }; |