From: John L. <jr...@us...> - 2009-12-21 04:06:25
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10162/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h wxlua_bind.h Log Message: Use a wxArray instead of a wxList for the wxLuaBindingArray (was List) Simplify and cleanup initializing the bindings, linking base class wxLuaBindMethods Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** wxldefs.h 1 Oct 2009 04:21:01 -0000 1.50 --- wxldefs.h 21 Dec 2009 04:06:13 -0000 1.51 *************** *** 65,69 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 29 // ---------------------------------------------------------------------------- --- 65,69 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 30 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** wxlbind.h 5 Oct 2009 02:51:29 -0000 1.91 --- wxlbind.h 21 Dec 2009 04:06:13 -0000 1.92 *************** *** 128,132 **** enum wxLuaMethod_Type { ! WXLUAMETHOD_CONSTRUCTOR = 0x0001, // constructor WXLUAMETHOD_METHOD = 0x0002, // class member function WXLUAMETHOD_CFUNCTION = 0x0004, // global C function (not part of a class) --- 128,132 ---- enum wxLuaMethod_Type { ! WXLUAMETHOD_CONSTRUCTOR = 0x0001, // class constructor WXLUAMETHOD_METHOD = 0x0002, // class member function WXLUAMETHOD_CFUNCTION = 0x0004, // global C function (not part of a class) *************** *** 140,151 **** // original class. ! WXLUAMETHOD_CHECKED_OVERLOAD = 0x10000, // Class method has been checked to see if it is ! // overloaded function from the base class by ! // wxLuaBinding::InitAllBindings(). ! // wxLuaBindMethod::basemethod is !NULL ! // if an overloaded function was found. ! ! WXLUAMETHOD_SEARCH_MASK = 0xFFFF, // Helper for wxLuaBinding::GetClassMethod(), ignore WXLUAMETHOD_CHECKED_OVERLOAD ! WXLUAMETHOD_SORT_MASK = 0xFFFF, // Helper for wxLuaBinding::InitAllBindings(), ignore WXLUAMETHOD_CHECKED_OVERLOAD }; --- 140,144 ---- // original class. ! WXLUAMETHOD_MASK = 0xFFFF // Match any type for searching }; *************** *** 175,179 **** int wxluacfuncs_n; // Number of C functions (overloaded > 1) for this method wxLuaBindMethod* basemethod; // Overloaded method from the base class, else NULL. - // See comments for WXLUAMETHOD_CHECKED_OVERLOAD }; --- 168,171 ---- *************** *** 485,490 **** // ---------------------------------------------------------------------------- ! // list of wxLua Bindings ! WX_DECLARE_USER_EXPORTED_LIST(wxLuaBinding, wxLuaBindingList, WXDLLIMPEXP_WXLUA); class WXDLLIMPEXP_WXLUA wxLuaBinding : public wxObject --- 477,482 ---- // ---------------------------------------------------------------------------- ! // wxArray of wxLua Bindings ! WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxLuaBinding*, wxLuaBindingArray, class WXDLLIMPEXP_WXLUA); class WXDLLIMPEXP_WXLUA wxLuaBinding : public wxObject *************** *** 494,497 **** --- 486,493 ---- virtual ~wxLuaBinding() {} + // Register all the bindings added to the static member wxLuaBindingArray. + // Leaves nothing on the stack. + static bool RegisterBindings(const wxLuaState& wxlState); + // 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 *************** *** 556,560 **** // ----------------------------------------------------------------------- ! // These functions search through the static wxLuaBinding::GetBindingList() // for the items. --- 552,556 ---- // ----------------------------------------------------------------------- ! // These functions search through the static wxLuaBinding::GetBindingArray() // for the items. *************** *** 600,617 **** // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). ! // You can adjust the list *only* if you do not have any wxLuaStates // created, otherwise the wxLua types will be out of sync. ! static wxLuaBindingList* GetBindingList() { return &sm_bindingList; } // ----------------------------------------------------------------------- ! // Initialize all of the bindings by iterating the GetBindingList() and // setting the base classes and base class functions. This function ! // is automatically run by the wxLuaState and should not need to be called. static void InitAllBindings(bool force_update = false); protected: ! void InitBinding(); // must called after subclassed version is created ! // to sort the bindings appropriately // Register the classes, defines, strings, events, objects, and functions --- 596,615 ---- // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). ! // You can adjust the array *only* if you do not have any wxLuaStates // created, otherwise the wxLua types will be out of sync. ! static wxLuaBindingArray& GetBindingArray() { return sm_bindingArray; } // ----------------------------------------------------------------------- ! // Initialize all of the bindings by iterating the GetBindingArray() and // setting the base classes and base class functions. This function ! // is automatically run by the wxLuaState and should not need to be called ! // unless you later add a new binding to the array, in which case force it to be rerun. static void InitAllBindings(bool force_update = false); protected: ! ! // Call only once after subclassed version is created to sort the bindings appropriately ! void InitBinding(); // Register the classes, defines, strings, events, objects, and functions *************** *** 639,645 **** int m_last_wxluatype; // The last wxLua type of registered classes ! static wxLuaBindingList sm_bindingList; ! static bool sm_bindingList_initialized; ! static int sm_wxluatype_max; DECLARE_ABSTRACT_CLASS(wxLuaBinding) --- 637,643 ---- int m_last_wxluatype; // The last wxLua type of registered classes ! static wxLuaBindingArray sm_bindingArray; ! static int sm_bindingArray_initialized; ! static int sm_wxluatype_max; DECLARE_ABSTRACT_CLASS(wxLuaBinding) Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** wxlstate.h 5 Oct 2009 02:51:29 -0000 1.127 --- wxlstate.h 21 Dec 2009 04:06:13 -0000 1.128 *************** *** 417,421 **** WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, const char* class_name); ! // Is the item at stack_idx of the userdata type with or derived from the the given wxLua type. WXDLLIMPEXP_WXLUA bool wxluaT_isuserdatatype(lua_State* L, int stack_idx, int wxl_type); // Get the userdata object at the stack_idx that is of the wxLua class type or a --- 417,421 ---- WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, const char* class_name); ! // Is the item at stack_idx of the userdata type or derived from the the given wxLua type. WXDLLIMPEXP_WXLUA bool wxluaT_isuserdatatype(lua_State* L, int stack_idx, int wxl_type); // Get the userdata object at the stack_idx that is of the wxLua class type or a *************** *** 914,921 **** // See wxluaT_isderivedtype(). int IsDerivedType(int wxl_type, int base_wxl_type, int* baseclass_n) const; - // Get wxLuaBindEvent for given wxEventType (wxEvent::GetEventType()) by finding - // the matching wxLuaBindEvent::eventType. - // See wxLuaBinding::GetBindEvent(). - const wxLuaBindEvent* GetBindEvent(wxEventType eventType) const; // See wxlua_setcallbaseclassfunction() and wxlua_getcallbaseclassfunction(). --- 914,917 ---- Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wxlua_bind.h 1 Oct 2009 04:21:01 -0000 1.20 --- wxlua_bind.h 21 Dec 2009 04:06:13 -0000 1.21 *************** *** 17,23 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 29 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 29 // --------------------------------------------------------------------------- --- 17,23 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 30 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 30 // --------------------------------------------------------------------------- *************** *** 36,40 **** // initialize wxLuaBinding_wxlua for all wxLuaStates ! extern WXDLLIMPEXP_WXLUA bool wxLuaBinding_wxlua_init(); // --------------------------------------------------------------------------- --- 36,40 ---- // initialize wxLuaBinding_wxlua for all wxLuaStates ! extern WXDLLIMPEXP_WXLUA wxLuaBinding* wxLuaBinding_wxlua_init(); // --------------------------------------------------------------------------- |