From: John L. <jr...@us...> - 2007-06-06 23:43:21
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4156/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h Log Message: Rename structs WXLUACLASS, WXLUAMETHOD, WXLUADEFINE, WXLUASTRING, WXLUAEVENT to wxLuaBindClass, wxLuaBindMethod, wxLuaBindDefine, wxLuaBindString, wxLuaBindEvent Fix %renamed listCtrl:SetItemString to now use overload SetItem Fix recursion in traversing the base class methods Add IntArray_FromLuaTable for binding generator to do (int n, int* items) from a table Use NULL in bindings for items that are *pointers for clarity Use sizeof(struct name) instead of sizeof(array[0]) in bindings Rename wxLuaBinding GetLuaClassList to just GetClassArray since it's a C array Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wxldefs.h 5 Jun 2007 21:07:25 -0000 1.18 --- wxldefs.h 6 Jun 2007 23:43:16 -0000 1.19 *************** *** 57,61 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 8 // ---------------------------------------------------------------------------- --- 57,61 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 9 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** wxlbind.h 6 Jun 2007 03:53:40 -0000 1.42 --- wxlbind.h 6 Jun 2007 23:43:16 -0000 1.43 *************** *** 30,42 **** // memory deallocation function, lua's __gc ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_garbageCollect(lua_State *L); // lua 'set table' tag method handler, lua's __newindex ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_setTableFunc(lua_State *L); // 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); // ---------------------------------------------------------------------------- --- 30,42 ---- // memory deallocation function, lua's __gc ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind_garbageCollect(lua_State *L); // lua 'set table' tag method handler, lua's __newindex ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind_setTableFunc(lua_State *L); // lua 'get table' tag method handler, lua's __index ! WXDLLIMPEXP_WXLUA int LUACALL wxluabind_getTableFunc(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 ! // __call metatable function for class constructors) ! WXDLLIMPEXP_WXLUA int wxluabind_removetableforcall(lua_State* L, bool only_check = false); // ---------------------------------------------------------------------------- *************** *** 66,70 **** 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 --- 66,70 ---- extern WXDLLIMPEXP_DATA_WXLUA(wxLuaArgTag) s_wxluaargArray_None[1]; // = {0} ! struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc // defines a single C func for a LUA method { lua_CFunction func; // function that implements the method or property *************** *** 75,86 **** }; ! struct WXDLLIMPEXP_WXLUA WXLUAMETHOD // defines a LUA method or property { ! int type; // wxLuaMethod_Type flags for this method ! // note each func has own type, this is ored values of them ! 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 ! WXLUAMETHOD *basemethod; // overloaded methods from base class, else NULL }; --- 75,86 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindMethod // defines a LUA method or property { ! int type; // wxLuaMethod_Type flags for this method ! // note each func has own type, this is ored values of them ! const char *name; // name of the method or property ! wxLuaBindCFunc *funcs; // array of functions for this method ! int funcs_n; // number of functions (overloaded > 1) for this method ! wxLuaBindMethod *basemethod; // overloaded methods from base class, else NULL }; *************** *** 111,115 **** ! struct WXDLLIMPEXP_WXLUA WXLUADEFINE // defines a wxWidgets define for wxLua { const char *name; // name --- 111,115 ---- ! struct WXDLLIMPEXP_WXLUA wxLuaBindDefine // defines a numeric define for wxLua { const char *name; // name *************** *** 117,123 **** }; ! extern WXDLLIMPEXP_DATA_WXLUA(WXLUADEFINE) s_wxluadefineArray_None[1]; // = {{0,0}} ! struct WXDLLIMPEXP_WXLUA WXLUASTRING // defines a wxWidgets string for wxLua { const char *name; // name --- 117,123 ---- }; ! extern WXDLLIMPEXP_DATA_WXLUA(wxLuaBindDefine) s_wxluadefineArray_None[1]; // = {{0,0}} ! struct WXDLLIMPEXP_WXLUA wxLuaBindString // defines a wxWidgets string for wxLua { const char *name; // name *************** *** 125,129 **** }; ! struct WXDLLIMPEXP_WXLUA WXLUAEVENT // defines a wxWidgets Event for wxLua { const int *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED --- 125,129 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindEvent // defines a wxWidgets Event for wxLua { const int *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED *************** *** 132,136 **** }; ! struct WXDLLIMPEXP_WXLUA WXLUAOBJECT // Defines a wxWidgets object or pointer for wxLua { const char *name; // the name of the object or pointer --- 132,136 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindObject // Defines an object or pointer for wxLua { const char *name; // the name of the object or pointer *************** *** 140,158 **** }; ! 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 }; --- 140,159 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindClass // defines a LUA C++ class interface { ! const char *name; // name of the class ! wxLuaBindMethod *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 ! wxLuaBindClass *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 ! ! wxLuaBindDefine* enums; // Class member enums ! int enums_n; // number of enums }; *************** *** 164,168 **** { public: ! wxLuaFunction(WXLUAMETHOD *wxlMethod, WXLUACLASS *wxlClass, void *pObject) : m_wxlMethod(wxlMethod), m_wxlClass(wxlClass), m_pObject(pObject) {} --- 165,169 ---- { public: ! wxLuaFunction(wxLuaBindMethod *wxlMethod, wxLuaBindClass *wxlClass, void *pObject) : m_wxlMethod(wxlMethod), m_wxlClass(wxlClass), m_pObject(pObject) {} *************** *** 172,178 **** void *GetObject() const { return m_pObject; } ! WXLUAMETHOD *m_wxlMethod; ! WXLUACLASS *m_wxlClass; ! void *m_pObject; }; --- 173,179 ---- void *GetObject() const { return m_pObject; } ! wxLuaBindMethod *m_wxlMethod; ! wxLuaBindClass *m_wxlClass; ! void *m_pObject; }; *************** *** 338,375 **** void SetLuaNamespace(const wxString& nameSpace) { m_nameSpace = nameSpace; } ! size_t GetLuaClassCount() const { return m_classCount; } ! WXLUACLASS* GetLuaClassList() { return m_classList; } ! size_t GetLuaDefineCount() const { return m_defineCount; } ! WXLUADEFINE* GetLuaDefineList() { return m_defineList; } ! size_t GetLuaStringCount() const { return m_stringCount; } ! WXLUASTRING* GetLuaStringList() { return m_stringList; } ! size_t GetLuaEventCount() { return m_eventCount; } ! WXLUAEVENT* GetLuaEventList() { return m_eventList; } ! size_t GetLuaObjectCount() { return m_objectCount; } ! WXLUAOBJECT* GetLuaObjectList() { return m_objectList; } ! size_t GetLuaFunctionCount() { return m_functionCount; } ! WXLUAMETHOD* GetLuaFunctionList() { return m_functionList; } bool IsTag(int tag) { return (tag >= m_startTag) && (tag <= m_lastTag); } ! // Look for the base class of the input WXLUACLASS in this binding using the ! // baseclassName of the input and if found, set the WXLUACLASS::baseclass // member of the input. ! bool SetBaseClass(WXLUACLASS *pClass); ! // Find the WXLUAEVENT with the wxEventType, returns NULL if not found. ! const WXLUAEVENT* GetEvent(wxEventType eventType) const; // Look up the event type name as a string, from the wxEventType number ! // in the WXLUAEVENT* struct list of this binding. wxString GetEventTypeName(wxEventType eventType) const; ! // Get the first WXLUACLASS that has this WXLUAMETHOD ! const WXLUACLASS* GetLuaClass(const WXLUAMETHOD* wxlMethod) const; ! // Get the first WXLUACLASS that has this WXLAMETHOD_CFUNC ! const WXLUACLASS* GetLuaClass(const WXLUAMETHOD_CFUNC* wxlMethod_cfunc) const; // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). --- 339,376 ---- void SetLuaNamespace(const wxString& nameSpace) { m_nameSpace = nameSpace; } ! size_t GetClassCount() const { return m_classCount; } ! wxLuaBindClass* GetClassArray() { return m_classArray; } ! size_t GetDefineCount() const { return m_defineCount; } ! wxLuaBindDefine* GetDefineArray() { return m_defineArray; } ! size_t GetStringCount() const { return m_stringCount; } ! wxLuaBindString* GetStringArray() { return m_stringArray; } ! size_t GetEventCount() { return m_eventCount; } ! wxLuaBindEvent* GetEventArray() { return m_eventArray; } ! size_t GetObjectCount() { return m_objectCount; } ! wxLuaBindObject* GetObjectArray() { return m_objectArray; } ! size_t GetFunctionCount() { return m_functionCount; } ! wxLuaBindMethod* GetFunctionArray() { return m_functionArray; } bool IsTag(int tag) { return (tag >= m_startTag) && (tag <= m_lastTag); } ! // Look for the base class of the input wxLuaBindClass in this binding using the ! // baseclassName of the input and if found, set the wxLuaBindClass::baseclass // member of the input. ! bool SetBaseClass(wxLuaBindClass *pClass); ! // Find the wxLuaBindEvent with the wxEventType, returns NULL if not found. ! const wxLuaBindEvent* GetEvent(wxEventType eventType) const; // Look up the event type name as a string, from the wxEventType number ! // in the wxLuaBindEvent* struct list of this binding. wxString GetEventTypeName(wxEventType eventType) const; ! // Get the first wxLuaBindClass that has this wxLuaBindMethod ! const wxLuaBindClass* GetLuaClass(const wxLuaBindMethod* wxlMethod) const; ! // Get the first wxLuaBindClass that has this wxLuaBindCFunc ! const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* wxlMethod_cfunc) const; // Get all the bindings that were initialized using the generated binding // function wxLuaBinding_[binding name]_init(). *************** *** 389,404 **** // binding objects ! size_t m_classCount; ! WXLUACLASS* m_classList; ! size_t m_defineCount; ! WXLUADEFINE* m_defineList; ! size_t m_stringCount; ! WXLUASTRING* m_stringList; ! size_t m_eventCount; ! WXLUAEVENT* m_eventList; ! size_t m_objectCount; ! WXLUAOBJECT* m_objectList; ! size_t m_functionCount; ! WXLUAMETHOD* m_functionList; wxString m_bindingName; // A unique name of the binding --- 390,405 ---- // binding objects ! size_t m_classCount; ! wxLuaBindClass* m_classArray; ! size_t m_defineCount; ! wxLuaBindDefine* m_defineArray; ! size_t m_stringCount; ! wxLuaBindString* m_stringArray; ! size_t m_eventCount; ! wxLuaBindEvent* m_eventArray; ! size_t m_objectCount; ! wxLuaBindObject* m_objectArray; ! size_t m_functionCount; ! wxLuaBindMethod* m_functionArray; wxString m_bindingName; // A unique name of the binding Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** wxlstate.h 6 Jun 2007 18:03:48 -0000 1.71 --- wxlstate.h 6 Jun 2007 23:43:16 -0000 1.72 *************** *** 150,165 **** // Push the "wxLuaClasses" string onto the stack. This is the name of a ! // table in the LUA_REGISTRYINDEX that is t[WXLUACLASS.name] = WXLUACLASS ! // where the WXLUACLASS is a lightuserdata. #define wxlua_pushstring_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_type which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. ! // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_type is not known. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_type); ! // Get a human readable name for the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. // returns empty string if the tag was not one of the predefined types. ! WXDLLIMPEXP_WXLUA wxString wxlua_getwxluatypename(int wxluaarg_type); // Helper functions to get numbers, booleans and strings safer. --- 150,165 ---- // Push the "wxLuaClasses" string onto the stack. This is the name of a ! // table in the LUA_REGISTRYINDEX that is t[wxLuaBindClass.name] = wxLuaBindClass ! // where the wxLuaBindClass is a lightuserdata. #define wxlua_pushstring_wxLuaClasses(L) lua_pushlstring(L, "wxLuaClasses", 12) // Verify if the luatype = lua_type(L, stack_idx) is valid for the ! // wxluaarg_tag which is one of the predefined WXLUAARG_XXX or s_wxluaarg_XXX types. ! // Returns 1 if it matches, 0 if it doesn't, -1 if the wxluaarg_tag is not known. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_iswxluatype(int luatype, int wxluaarg_tag); ! // Get a human readable name for the predefined WXLUAARG_XXX or s_wxluaarg_XXX tags. // returns empty string if the tag was not one of the predefined types. ! WXDLLIMPEXP_WXLUA wxString wxlua_getwxluatypename(int wxluaarg_tag); // Helper functions to get numbers, booleans and strings safer. *************** *** 486,506 **** wxLuaBinding* GetLuaBinding(const wxString& bindingName) const; ! // Get WXLUACLASS for given lua Tag using WXLUACLASS::class_tag, // returns NULL on failure. ! const WXLUACLASS* GetLuaClass(int iClassTag) const; ! // Get WXLUACLASS for given class name using WXLUACLASS::name, // returns NULL on failure. ! const WXLUACLASS* GetLuaClass(const char* className) const; ! // Get the first WXLUACLASS that has this particular WXLUAMETHOD ! const WXLUACLASS* GetLuaClass(const WXLUAMETHOD* method) const; ! // Get the first WXLUACLASS that has this particular WXLUAMETHOD_CFUNC in it's methods ! const WXLUACLASS* GetLuaClass(const WXLUAMETHOD_CFUNC* method_cfunc) const; // returns true if iClassTag is derived or equal to iBaseClassTag by using ! // WXLUACLASS::class_tag and WXLUACLASS::baseclass_tag. // returns NULL on failure. bool IsDerivedClass(int iClassTag, int iBaseClassTag) const; ! // Get WXLUAEVENT for given wxEventType (wxEvent::GetEventType()) by finding ! // the matching WXLUAEVENT::eventType. ! const WXLUAEVENT* GetLuaEvent(wxEventType eventType) const; // Get the binding list used to initialize this class --- 486,506 ---- wxLuaBinding* GetLuaBinding(const wxString& bindingName) const; ! // Get wxLuaBindClass for given lua Tag using wxLuaBindClass::class_tag, // returns NULL on failure. ! const wxLuaBindClass* GetLuaClass(int iClassTag) const; ! // Get wxLuaBindClass for given class name using wxLuaBindClass::name, // returns NULL on failure. ! const wxLuaBindClass* GetLuaClass(const char* className) const; ! // Get the first wxLuaBindClass that has this particular wxLuaBindMethod ! const wxLuaBindClass* GetLuaClass(const wxLuaBindMethod* method) const; ! // Get the first wxLuaBindClass that has this particular wxLuaBindCFunc in it's methods ! const wxLuaBindClass* GetLuaClass(const wxLuaBindCFunc* method_cfunc) const; // returns true if iClassTag is derived or equal to iBaseClassTag by using ! // wxLuaBindClass::class_tag and wxLuaBindClass::baseclass_tag. // returns NULL on failure. bool IsDerivedClass(int iClassTag, int iBaseClassTag) const; ! // Get wxLuaBindEvent for given wxEventType (wxEvent::GetEventType()) by finding ! // the matching wxLuaBindEvent::eventType. ! const wxLuaBindEvent* GetLuaEvent(wxEventType eventType) const; // Get the binding list used to initialize this class *************** *** 673,690 **** wxString GetLuaTagName(int tag) const; ! // Lookup a lua method or get property called cpIndex in the WXLUACLASS array pClass // Ensure that the lookup is of the required type. If the lua method // can not be found on the current class recurse through base classes ! // Return a pointer to the WXLUAMETHOD that corresponds to the method name, // else return NULL; ! // Set isProperty to true if a property is found else it is a method. ! WXLUAMETHOD* GetLuaMethod(const WXLUACLASS *wxlClass, const char *methodName); ! // Lookup a lua property function named cpIndex in the WXLUACLASS pClass // Ensure that the lookup is of the required type. If the lua property // can not be found on the current class recurse through base classes ! // 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 *wxlClass, const char *propName, bool isLuaSetProp); // Is there a derived method given an object and and a method name. --- 673,689 ---- wxString GetLuaTagName(int tag) const; ! // Lookup a lua method or get property called cpIndex in the wxLuaBindClass array pClass // Ensure that the lookup is of the required type. If the lua method // can not be found on the current class recurse through base classes ! // Return a pointer to the wxLuaBindMethod that corresponds to the method name, // else return NULL; ! wxLuaBindMethod* GetLuaMethod(const wxLuaBindClass *wxlClass, const char *methodName, bool search_baseclasses = true); ! // Lookup a lua property function named cpIndex in the wxLuaBindClass pClass // Ensure that the lookup is of the required type. If the lua property // can not be found on the current class recurse through base classes ! // Return a pointer to the wxLuaBindMethod that corresponds to the property name, // else return NULL; // Find 'Set' properties if isLuaSetProp else return 'WXLUAMETHOD_GETPROP' property ! wxLuaBindMethod* GetLuaProperty(const wxLuaBindClass *wxlClass, const char *propName, bool isLuaSetProp); // Is there a derived method given an object and and a method name. *************** *** 911,917 **** // Return a human readable string of the args for the functions in the method ! wxArrayString CreateMethodArgTagsMsg(struct WXLUAMETHOD* method); // overloaded function call helper ! int LUACALL CallOverloadedFunction(struct WXLUAMETHOD* method); // ----------------------------------------------------------------------- --- 910,916 ---- // Return a human readable string of the args for the functions in the method ! wxArrayString CreateMethodArgTagsMsg(struct wxLuaBindMethod* method); // overloaded function call helper ! int LUACALL CallOverloadedFunction(struct wxLuaBindMethod* method); // ----------------------------------------------------------------------- |