From: John L. <jr...@us...> - 2009-10-01 04:21:09
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4255/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h wxlua_bind.h Log Message: Removed %encapsulate and %noclassinfo tags for %classes in the bindings. No longer encapsulating non wxObjects in a wxObject class for deletion. We now provide delete functions for each class in the wxLuaBindClass structs to be called on the void* we get from Lua. Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** wxldefs.h 27 Sep 2009 03:13:55 -0000 1.49 --- wxldefs.h 1 Oct 2009 04:21:01 -0000 1.50 *************** *** 65,69 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 28 // ---------------------------------------------------------------------------- --- 65,69 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 29 // ---------------------------------------------------------------------------- *************** *** 93,96 **** --- 93,104 ---- // ---------------------------------------------------------------------------- + // Blank dummy defines that may be used in the bindings to not import or export + // a class or data in a DLL. + // ---------------------------------------------------------------------------- + + #define WXLUA_NO_DLLIMPEXP // use if you don't want to export class + #define WXLUA_NO_DLLIMPEXP_DATA(x) x // use if you don't want to export data + + // ---------------------------------------------------------------------------- // Useful macros to make coding easier // ---------------------------------------------------------------------------- *************** *** 120,136 **** // ---------------------------------------------------------------------------- - // Convert from wxWidgets wxT('') to wxT(""), a string. Copied from wx/filefn.h - - // platform independent versions - #if defined(__UNIX__) && !defined(__OS2__) - // CYGWIN also uses UNIX settings - #define wxLua_FILE_SEP_PATH wxT("/") - #elif defined(__MAC__) - #define wxLua_FILE_SEP_PATH wxT(":") - #else // Windows and OS/2 - #define wxLua_FILE_SEP_PATH wxT("\\") - #endif // Unix/Windows - - // ---------------------------------------------------------------------------- // wxWidgets compatibility defines // ---------------------------------------------------------------------------- --- 128,131 ---- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** wxlbind.h 27 Sep 2009 03:13:55 -0000 1.89 --- wxlbind.h 1 Oct 2009 04:21:01 -0000 1.90 *************** *** 59,65 **** // Check that the Lua LUA_TXXX types are what they used to be ! #if (LUA_TNONE != -1) || (LUA_TNIL != 0) || (LUA_TBOOLEAN != 1) || (LUA_TLIGHTUSERDATA != 2) || \ ! (LUA_TNUMBER != 3) || (LUA_TSTRING != 4) || (LUA_TTABLE != 5) || (LUA_TFUNCTION != 6) || \ ! (LUA_TUSERDATA != 7) || (LUA_TTHREAD != 8) # error "Lua has changed it's LUA_TXXX defines." #endif --- 59,67 ---- // Check that the Lua LUA_TXXX types are what they used to be ! #if (LUA_TNONE != -1) || (LUA_TNIL != 0) || \ ! (LUA_TBOOLEAN != 1) || (LUA_TLIGHTUSERDATA != 2) || \ ! (LUA_TNUMBER != 3) || (LUA_TSTRING != 4) || \ ! (LUA_TTABLE != 5) || (LUA_TFUNCTION != 6) || \ ! (LUA_TUSERDATA != 7) || (LUA_TTHREAD != 8) # error "Lua has changed it's LUA_TXXX defines." #endif *************** *** 103,106 **** --- 105,110 ---- // Note that we do not use the original since we may not be linked // to the binding library that defines them. + // Their values are set at compile time if linked to library, + // see wxbase_rules.lua and wxcore_rules.lua extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxEvent; // wxLua type for wxEvent extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxWindow; // wxLua type for wxWindow *************** *** 134,139 **** // original class. - WXLUAMETHOD_ENCAPSULATE = 0x4000, // This class is not derived from a wxObject - WXLUAMETHOD_CHECKED_OVERLOAD = 0x10000, // Class method has been checked to see if it is // overloaded function from the base class by --- 138,141 ---- *************** *** 223,230 **** // ---------------------------------------------------------------------------- struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char* name; // Name of the class or struct ! wxLuaBindMethod* wxluamethods; // Pointer to methods for this class int wxluamethods_n; // Number of methods wxClassInfo* classInfo; // Pointer to the wxClassInfo associated with this class or NULL. --- 225,234 ---- // ---------------------------------------------------------------------------- + typedef void (*wxlua_delete_function) (void** o); + struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char* name; // Name of the class or struct ! wxLuaBindMethod* wxluamethods; // Pointer to array of methods for this class int wxluamethods_n; // Number of methods wxClassInfo* classInfo; // Pointer to the wxClassInfo associated with this class or NULL. *************** *** 249,252 **** --- 253,259 ---- wxLuaBindNumber* enums; // Class member enums or NULL if none int enums_n; // number of enums + + wxlua_delete_function delete_fn; // Function that will cast the void* pointer + // to the class type and then call delete on it. }; *************** *** 353,389 **** // ---------------------------------------------------------------------------- - // wxLUA_DECLARE_ENCAPSULATION and wxLUA_IMPLEMENT_ENCAPSULATION - // Declare the macros used to define and implement classes that - // wrap non-wxObject derived pointers used by wxLua in the bindings. - // - // IMPEXPSYMBOL : similiar to WXDLLIMPEXP_WXBIND, you cannot leave this - // parameter empty, but you may use WXLUA_NO_DLLIMPEXP and - // WXLUA_NO_DLLIMPEXP_DATA(x) if you don't want DLL export symbols. - // className : name of the class to encapsulate (may be NameSpace::MyClass) - // objName : name to use in naming the encapsulation class (NameSpace_MyClass) - // ---------------------------------------------------------------------------- - - #define WXLUA_NO_DLLIMPEXP // use if you don't want to export class - #define WXLUA_NO_DLLIMPEXP_DATA(x) x // use if you don't want to export data - - #define wxLUA_DECLARE_ENCAPSULATION(IMPEXPSYMBOL, className, objName) \ - class IMPEXPSYMBOL wxLua_wxObject_##objName : public wxObject \ - { \ - public: \ - wxLua_wxObject_##objName(className *p_##objName) : m_p##objName(p_##objName) {} \ - virtual ~wxLua_wxObject_##objName(); \ - className *m_p##objName; \ - DECLARE_ABSTRACT_CLASS(wxLua_wxObject_##objName) \ - }; - - // we may not have fully defined the class/object in header so delete it in src. - #define wxLUA_IMPLEMENT_ENCAPSULATION(className, objName) \ - IMPLEMENT_ABSTRACT_CLASS(wxLua_wxObject_##objName, wxObject) \ - wxLua_wxObject_##objName::~wxLua_wxObject_##objName() \ - { \ - delete m_p##objName; \ - } - - // ---------------------------------------------------------------------------- // wxLuaSmartStringArray - Wraps a "new" array of wxStrings with an automatic // destructor that deletes them to make binding easier. --- 360,363 ---- Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** wxlstate.h 25 Sep 2009 18:47:58 -0000 1.125 --- wxlstate.h 1 Oct 2009 04:21:01 -0000 1.126 *************** *** 141,149 **** // The key in the LUA_REGISTRYINDEX table that is a table of all // objects to delete that were added using wxluaO_addgcobject(). - // Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so - // the key is the object pointer and the value is the wxObject encapsulation. - // Both the key and the value are the same if not encapsulated. // LUA_REGISTRYINDEX[&wxlua_lreg_gcobjects_key][lightuserdata(obj_ptr)] = ! // lightuserdata(wxObject derived class) extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_gcobjects_key; // The key in the LUA_REGISTRYINDEX table that is a table of all --- 141,146 ---- // The key in the LUA_REGISTRYINDEX table that is a table of all // objects to delete that were added using wxluaO_addgcobject(). // LUA_REGISTRYINDEX[&wxlua_lreg_gcobjects_key][lightuserdata(obj_ptr)] = ! // integer wxLua type extern WXDLLIMPEXP_DATA_WXLUA(const char*) wxlua_lreg_gcobjects_key; // The key in the LUA_REGISTRYINDEX table that is a table of all *************** *** 293,310 **** }; ! // Track this wxObject and delete it when Lua calls the __gc method for it. // The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX. ! // The second version is used when a non-wxObject class is encapsulated and ! // the obj_ptr points to the actual object that the wxObject encapsulates. ! // Note that the lua userdata internal pointer is the obj_ptr and the ! // wxobj is *only* stored in the wxlua_lreg_gcobjects_key. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, wxObject* wxobj); ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, void* obj_ptr, wxObject* wxobj); ! // Remove this obj_ptr wrapped in a Lua userdata, udata, from the // wxlua_lreg_gcobjects_key table of the LUA_REGISTRYINDEX. // It is deleted depending on the flags enum wxLuaGCObject_Flags. // If flags = WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all // wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, void* udata, void *obj_ptr, int flags); // Remove this obj_ptr from the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. The Lua userdata for the object stays in Lua and it's --- 290,303 ---- }; ! // Track this object and delete it when Lua calls the __gc method for it. // The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX. ! // Note that the Lua userdata internal pointer is to the obj_ptr. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_addgcobject(lua_State* L, void* obj_ptr, int wxl_type); ! // Remove the wxLua object wrapped in a Lua userdata at the stack index from the // wxlua_lreg_gcobjects_key table of the LUA_REGISTRYINDEX. // It is deleted depending on the flags enum wxLuaGCObject_Flags. // If flags = WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all // wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaO_deletegcobject(lua_State *L, int stack_idx, int flags); // Remove this obj_ptr from the wxlua_lreg_gcobjects_key table of the // LUA_REGISTRYINDEX. The Lua userdata for the object stays in Lua and it's *************** *** 928,936 **** // See wxluaO_addgcobject(). ! void AddGCObject(wxObject *wxobj); ! // See wxluaO_addgcobject(). ! void AddGCObject(void* obj_ptr, wxObject *wxobj); // See wxluaO_deletegcobject(). ! bool DeleteGCObject(void* udata, void *obj_ptr, int flags); // See wxluaO_isgcobject(). bool IsGCObject(void *obj_ptr) const; --- 921,927 ---- // See wxluaO_addgcobject(). ! void AddGCObject(void* obj_ptr, int wxl_type); // See wxluaO_deletegcobject(). ! bool DeleteGCObject(int stack_idx, int flags); // See wxluaO_isgcobject(). bool IsGCObject(void *obj_ptr) const; Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlua_bind.h 25 Sep 2009 18:47:58 -0000 1.19 --- wxlua_bind.h 1 Oct 2009 04:21:01 -0000 1.20 *************** *** 17,23 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 28 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 28 // --------------------------------------------------------------------------- --- 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 // --------------------------------------------------------------------------- *************** *** 52,59 **** - // --------------------------------------------------------------------------- - // Encapsulation Declarations - need to be public for other bindings. - // --------------------------------------------------------------------------- - #endif // __HOOK_WXLUA_wxlua_H__ --- 52,55 ---- |