From: John L. <jr...@us...> - 2007-05-31 17:18:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14219/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h Log Message: Huge changes, overloaded functions by default replace wx.wxNull with wx.NULL change WXLUA_VERSION and others with wxLUA_VERSION class member enums are part of class table static class member functions are part of class table %properties are generated on the fly ... and more, see docs/changelog.txt Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wxldefs.h 4 May 2007 19:04:41 -0000 1.16 --- wxldefs.h 31 May 2007 17:18:54 -0000 1.17 *************** *** 26,42 **** //----------------------------------------------------------------------------- ! #define WXLUA_MAJOR_VERSION 2 ! #define WXLUA_MINOR_VERSION 8 ! #define WXLUA_RELEASE_VERSION 4 ! #define WXLUA_SUBRELEASE_VERSION 0 ! #define WXLUA_VERSION_STRING wxT("wxLua 2.8.4.0") // For non-Unix systems (i.e. when building without a configure script), // users of this component can use the following macro to check if the // current version is at least major.minor.release ! #define wxCHECK_WXLUA_VERSION(major,minor,release) \ ! (WXLUA_MAJOR_VERSION > (major) || \ ! (WXLUA_MAJOR_VERSION == (major) && WXLUA_MINOR_VERSION > (minor)) || \ ! (WXLUA_MAJOR_VERSION == (major) && WXLUA_MINOR_VERSION == (minor) && WXLUA_RELEASE_VERSION >= (release))) //----------------------------------------------------------------------------- --- 26,50 ---- //----------------------------------------------------------------------------- ! #define wxLUA_MAJOR_VERSION 2 ! #define wxLUA_MINOR_VERSION 8 ! #define wxLUA_RELEASE_NUMBER 4 ! #define wxLUA_SUBRELEASE_NUMBER 0 ! #define wxLUA_VERSION_STRING wxT("wxLua 2.8.4.0") // For non-Unix systems (i.e. when building without a configure script), // users of this component can use the following macro to check if the // current version is at least major.minor.release ! #define wxLUA_CHECK_VERSION(major,minor,release) \ ! (wxLUA_MAJOR_VERSION > (major) || \ ! (wxLUA_MAJOR_VERSION == (major) && wxLUA_MINOR_VERSION > (minor)) || \ ! (wxLUA_MAJOR_VERSION == (major) && wxLUA_MINOR_VERSION == (minor) && wxLUA_RELEASE_NUMBER >= (release))) ! ! // the same but check the subrelease also ! #define wxLUA_CHECK_VERSION_FULL(major,minor,release,subrel) \ ! (wxLUA_CHECK_VERSION(major, minor, release) && \ ! ((major) != wxLUA_MAJOR_VERSION || \ ! (minor) != wxLUA_MINOR_VERSION || \ ! (release) != wxLUA_RELEASE_NUMBER || \ ! (subrel) <= wxLUA_SUBRELEASE_NUMBER)) //----------------------------------------------------------------------------- *************** *** 49,53 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 6 // ---------------------------------------------------------------------------- --- 57,61 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 7 // ---------------------------------------------------------------------------- *************** *** 86,89 **** --- 94,101 ---- #endif // wxUSE_UNICODE + + #define WXLUA_HASBIT(value, bit) (((value) & (bit)) != 0) + #define WXLUA_SETBIT(value, bit, set) ((set) ? (value)|(bit) : (value)&(~(bit))) + // ---------------------------------------------------------------------------- // Lua defines for making the code more readable Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wxlbind.h 23 Mar 2007 04:27:23 -0000 1.39 --- wxlbind.h 31 May 2007 17:18:54 -0000 1.40 *************** *** 35,38 **** --- 35,42 ---- // lua 'get table' tag method handler, lua's __index WXDLLIMPEXP_WXLUA int LUACALL wxlua_getTableFunc(lua_State *L); + // If there is a cfunction upvalue, remove 1 value if !only_check + // (hack to remove the table lua pushes onto the stack when calling the + // __call metatable function) + WXDLLIMPEXP_WXLUA int wxlua_removetableforcall(lua_State* L, bool only_check = false); // ---------------------------------------------------------------------------- *************** *** 42,50 **** enum wxLuaMethod_Type // The type of a Lua method { ! LuaConstructor = 1, // constructor ! LuaMethod = 2, // class method ! LuaGlobal = 4, // global method (not really related to the class) ! LuaGetProp = 8, // Get %property funcName, read ! LuaSetProp = 16 // Set %property funcName, write }; --- 46,56 ---- enum wxLuaMethod_Type // The type of a Lua method { ! WXLUAMETHOD_CONSTRUCTOR = 0x0001, // constructor ! WXLUAMETHOD_METHOD = 0x0002, // class member function ! WXLUAMETHOD_CFUNCTION = 0x0004, // global C function (not part of a class) ! WXLUAMETHOD_GETPROP = 0x0008, // Get %property funcName, read ! WXLUAMETHOD_SETPROP = 0x0010, // Set %property funcName, write ! ! WXLUAMETHOD_STATIC = 0x0020 // Class member function is static }; *************** *** 52,63 **** extern WXDLLIMPEXP_DATA_WXLUA(wxLuaArgTag) s_wxluaargArray_None[1]; // = {0} struct WXDLLIMPEXP_WXLUA WXLUAMETHOD // defines a LUA method or property { ! wxLuaMethod_Type type; // type (one of the above enumeration values) ! const char* name; // name of the method or property ! lua_CFunction func; // function that implements the method or property ! int maxargs; // max number of function arguments ! int minargs; // min number of function arguments ! wxLuaArgTag* argtags; // array of lua tags representing each argument, zero terminated }; --- 58,75 ---- extern WXDLLIMPEXP_DATA_WXLUA(wxLuaArgTag) s_wxluaargArray_None[1]; // = {0} + struct WXDLLIMPEXP_WXLUA WXLUAMETHOD_CFUNC // defines a single C func for a LUA method + { + lua_CFunction func; // function that implements the method or property + int minargs; // min number of required args + int maxargs; // total number of args allowed + wxLuaArgTag* argtags; // array of lua tags representing each argument, zero terminated + }; + struct WXDLLIMPEXP_WXLUA WXLUAMETHOD // defines a LUA method or property { ! int type; // type (one of the above enumeration values) ! const char* name; // name of the method or property ! WXLUAMETHOD_CFUNC* funcs; // array of functions for this method ! int funcs_n; // number of functions (overloaded > 1) for this method }; *************** *** 73,91 **** extern WXDLLIMPEXP_DATA_WXLUA(int) s_wxluaarg_LuaFunction; - struct WXDLLIMPEXP_WXLUA WXLUACLASS // defines a LUA C++ class interface - { - const char *name; // name of the class - WXLUAMETHOD *methods; // pointer to methods for this class - int num_methods; // number of methods - wxClassInfo *pClassInfo; // pointer to the wxClassInfo associated with this class - int *class_tag; // lua tag for user data allocated by ourselves - const char *baseclassName; // name of base class - WXLUACLASS *baseclass; // Pointer to the base class or NULL for none. - // This member is set after all the bindings are - // registered since the base class may be from - // a different module (a library perhaps). - // See wxLuaBinding::SetBaseClass - }; - struct WXDLLIMPEXP_WXLUA WXLUADEFINE // defines a wxWidgets define for wxLua { --- 85,88 ---- *************** *** 94,97 **** --- 91,96 ---- }; + extern WXDLLIMPEXP_DATA_WXLUA(WXLUADEFINE) s_wxluadefineArray_None[1]; // = {{0,0}} + struct WXDLLIMPEXP_WXLUA WXLUASTRING // defines a wxWidgets string for wxLua { *************** *** 115,118 **** --- 114,134 ---- }; + struct WXDLLIMPEXP_WXLUA WXLUACLASS // defines a LUA C++ class interface + { + const char *name; // name of the class + WXLUAMETHOD *methods; // pointer to methods for this class + int methods_n; // number of methods + wxClassInfo *pClassInfo; // pointer to the wxClassInfo associated with this class + int *class_tag; // lua tag for user data allocated by ourselves + const char *baseclassName; // name of base class + WXLUACLASS *baseclass; // Pointer to the base class or NULL for none. + // This member is set after all the bindings are + // registered since the base class may be from + // a different module (a library perhaps). + // See wxLuaBinding::SetBaseClass + WXLUADEFINE* enums; // Class member enums + int enums_n; // number of enums + }; + // ---------------------------------------------------------------------------- // wxLuaFunction - a proxy class to store a reference to a Lua function. *************** *** 122,127 **** { public: ! wxLuaFunction(WXLUAMETHOD *pMethod, WXLUACLASS *pClass, void *pObject) ! : m_pMethod(pMethod), m_pClass(pClass), m_pObject(pObject) {} ~wxLuaFunction() {} --- 138,143 ---- { public: ! wxLuaFunction(WXLUAMETHOD *wxlMethod, WXLUACLASS *wxlClass, void *pObject) ! : m_wxlMethod(wxlMethod), m_wxlClass(wxlClass), m_pObject(pObject) {} ~wxLuaFunction() {} *************** *** 130,136 **** void *GetObject() const { return m_pObject; } ! private: ! WXLUAMETHOD *m_pMethod; ! WXLUACLASS *m_pClass; void *m_pObject; }; --- 146,151 ---- void *GetObject() const { return m_pObject; } ! WXLUAMETHOD *m_wxlMethod; ! WXLUACLASS *m_wxlClass; void *m_pObject; }; Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** wxlstate.h 21 May 2007 01:07:59 -0000 1.67 --- wxlstate.h 31 May 2007 17:18:54 -0000 1.68 *************** *** 676,680 **** // Return a pointer to the WXLUAMETHOD that corresponds to the property name, // else return NULL; ! // Find 'Set' properties if isLuaSetProp else return 'LuaGetProp' property WXLUAMETHOD* GetLuaProperty(const WXLUACLASS *pClass, const char *cpIndex, bool isLuaSetProp); --- 676,680 ---- // Return a pointer to the WXLUAMETHOD that corresponds to the property name, // else return NULL; ! // Find 'Set' properties if isLuaSetProp else return 'WXLUAMETHOD_GETPROP' property WXLUAMETHOD* GetLuaProperty(const WXLUACLASS *pClass, const char *cpIndex, bool isLuaSetProp); *************** *** 901,906 **** void GetGlobals(); // overloaded function call helper ! int LUACALL CallOverloadedFunction(struct WXLUAMETHOD* overloadedMethods, int overloadedMethodCount); // ----------------------------------------------------------------------- --- 901,908 ---- void GetGlobals(); + // Return a human readable string of the args for the functions in the method + wxString CreateMethodArgTagsMsg(struct WXLUAMETHOD* method); // overloaded function call helper ! int LUACALL CallOverloadedFunction(struct WXLUAMETHOD* method); // ----------------------------------------------------------------------- |