From: John L. <jr...@us...> - 2007-11-17 00:16:55
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13186/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxldefs.h wxlstate.h wxlua_bind.h Log Message: Streamlined wxLuaBinding::RegisterBinding(...) and remove the bool "registerClasses" since it didn't do anything useful anyway. If there needs to be a way to reregister the wxLua functions it should to be implemented from the ground up. Renamed the functions wxlua_txxx to wxluaT_xxx to make it easier to search for their usage. The functions in the wxLuaState used to be called just "txxx" and are now called wxluaT_Xxx where the first letter or each word is capitalized (camel-case); again for searching. * This is the beginning of the separation between the "wxLuaReferences" being used for both the "tags" for identifying classes and for just having references to objects so Lua won't GC them. Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wxldefs.h 7 Aug 2007 20:23:25 -0000 1.33 --- wxldefs.h 17 Nov 2007 00:15:00 -0000 1.34 *************** *** 67,71 **** //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 17 // ---------------------------------------------------------------------------- --- 67,71 ---- //----------------------------------------------------------------------------- ! #define WXLUA_BINDING_VERSION 18 // ---------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** wxlbind.h 8 Nov 2007 23:47:15 -0000 1.62 --- wxlbind.h 17 Nov 2007 00:15:00 -0000 1.63 *************** *** 67,71 **** #define WXLUAARG_TO_POSINDEX(wxlua_arg) (-(wxlua_arg)) ! // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for // common types. The binding generator will use these and generate others // as specified in the bindings. --- 67,71 ---- #define WXLUAARG_TO_POSINDEX(wxlua_arg) (-(wxlua_arg)) ! // Variables used in the wxLuaArgTag member of the wxLuaBindCFunc for // common types. The binding generator will use these and generate others // as specified in the bindings. *************** *** 121,125 **** }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc { lua_CFunction func; // C function that implements the method or property --- 121,125 ---- }; ! struct WXDLLIMPEXP_WXLUA wxLuaBindCFunc { lua_CFunction func; // C function that implements the method or property *************** *** 137,141 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindMethod { const char *name; // name of the method or property --- 137,141 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindMethod { const char *name; // name of the method or property *************** *** 152,156 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindDefine { const char *name; // name --- 152,156 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindDefine { const char *name; // name *************** *** 164,168 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindString { const char *name; // name --- 164,168 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindString { const char *name; // name *************** *** 174,178 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindEvent { const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" --- 174,178 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindEvent { const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" *************** *** 185,189 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindObject { const char *name; // the name of the object or pointer --- 185,189 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindObject { const char *name; // the name of the object or pointer *************** *** 197,201 **** // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char *name; // name of the class --- 197,201 ---- // ---------------------------------------------------------------------------- ! struct WXDLLIMPEXP_WXLUA wxLuaBindClass { const char *name; // name of the class *************** *** 394,398 **** // Binds C Functions/Defines/Object/Events to namespace Lua Table ! virtual void RegisterBinding(const wxLuaState& wxlState, bool registerTypes); // Unbinds C Functions/Defines/Object/Events by clearing namespace Lua table virtual void UnRegisterBinding(const wxLuaState& wxlState); --- 394,398 ---- // Binds C Functions/Defines/Object/Events to namespace Lua Table ! virtual bool RegisterBinding(const wxLuaState& wxlState); // Unbinds C Functions/Defines/Object/Events by clearing namespace Lua table virtual void UnRegisterBinding(const wxLuaState& wxlState); *************** *** 478,489 **** // to sort the bindings appropriately ! // Registers binding, returns Lua table reference to binding ! virtual int LUACALL RegisterFunctions(const wxLuaState& wxlState, bool registerTypes); ! // Register the classes, definitions, objects and pointers generated by the binding ! // Sort the event list into order for faster event handler processing. ! virtual void LUACALL RegisterGeneratedClasses(const wxLuaState& wxlState, int tableOffset, bool registerTypes); ! virtual void PreRegister(const wxLuaState& WXUNUSED(wxlState), bool WXUNUSED(registerTypes), int WXUNUSED(luaTable)) {} ! virtual void PostRegister(const wxLuaState& WXUNUSED(wxlState), bool WXUNUSED(registerTypes), int WXUNUSED(luaTable)) {} // binding objects --- 478,490 ---- // 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 tableOffset); ! // Before registering anything from this binding this function is called ! // at the beginning of RegisterBinding(...) ! virtual void PreRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(luaTable)) {} ! // After registering everything from this binding this function is called ! // at the end of RegisterBinding(...) ! virtual void PostRegister(const wxLuaState& WXUNUSED(wxlState), int WXUNUSED(luaTable)) {} // binding objects Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** wxlstate.h 4 Sep 2007 22:21:10 -0000 1.94 --- wxlstate.h 17 Nov 2007 00:15:00 -0000 1.95 *************** *** 82,87 **** #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 ! #define WXLUA_METATABLE_TAG 8 ! #define WXLUA_METATABLE_CLASS 9 // Light user data used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. --- 82,87 ---- #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 ! #define WXLUA_METATABLE_TAG 7 ! #define WXLUA_METATABLE_CLASS 8 // Light user data used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. *************** *** 127,134 **** #define wxlua_pushkey_metatableClass(L) lua_pushlightuserdata(L, &wxlua_lreg_metatable_class_key) - //---------------------------------------------------------------------------- - // C functions for Lua used by the wxLuaState - //---------------------------------------------------------------------------- - // ---------------------------------------------------------------------------- // Lua C helper functions - These functions are also part of the wxLuaState --- 127,130 ---- *************** *** 139,196 **** // ---------------------------------------------------------------------------- // Create a reference to the object at stack index in the ! // wxLuaReferences registry table, returns the table index. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tinsert(lua_State* L, int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tremove(lua_State* L, int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tget(lua_State* L, int wxlref_index); ! // Push the errorMsg on the stack and call lua_error ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const char* errorMsg); ! wxLUA_UNICODE_ONLY(inline WXDLLIMPEXP_WXLUA void LUACALL wxlua_terror(lua_State* L, const wxString& errorMsg) { wxlua_terror(L, wx2lua(errorMsg)); }) // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the // tag is known and the metatable was set. If track=true then push the // object as a lightuser data key into the wxlua_pushkey_wxLuaObjects table of // the Lua registry so that if we need to push it again we just push the full // userdata value. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tpushusertag(lua_State* L, const void* u, int tag, bool track); ! // If an object was pushed into Lua using wxlua_tpushusertag with track=true // then this function will remove the object from being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tuntrackuserdata(lua_State* L, const void* u); ! // If an object was pushed into Lua using wxlua_tpushusertag with track=true // then this function will remove the metable of the object being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxlua_tcleartrackedmetatable(lua_State* L, const void* u); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_ttag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the pointer wrapped // by Lua's userdata to NULL to clear it. ! WXDLLIMPEXP_WXLUA void* LUACALL wxlua_ttouserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from tinsert // and store it in the wxLuaReferences registry table. ! // Returns the index into the ref table, the "tag" from tinsert. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is tinsert into the wxLuaReferences // registry table. Returns the created index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tnewweaktag(lua_State* L, bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to the table stored in the ! // wxLuaReferences registry table using tget(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // If pClass is non-null set the upvalue of the function to the supplied wxLuaBindClass. ! WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettagmethod(lua_State* L, int tag, const char* method, lua_CFunction func, void* pClass = NULL); // Is the item at the stack_idx in the wxLuaReferences table already? // returns the tag or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxlua_tisrefed(lua_State* L, int stack_idx); // ---------------------------------------------------------------------------- --- 135,199 ---- // ---------------------------------------------------------------------------- + // Push the errorMsg on the stack and call luaL_error + WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const char* errorMsg); + wxLUA_UNICODE_ONLY(inline WXDLLIMPEXP_WXLUA void LUACALL wxlua_error(lua_State* L, const wxString& errorMsg) { wxlua_error(L, wx2lua(errorMsg)); }) + + //---------------------------------------------------------------------------- + // wxluaT_XXX - the 'T' stands for Tag which is a numerical index in the + // Lua registry table for determining userdata type (it's class) + //---------------------------------------------------------------------------- + // Create a reference to the object at stack index in the ! // wxLuaReferences registry table, returns the table index or LUA_REFNIL ! // if the item on the stack is none or nil (an error). ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_insert(lua_State* L, int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_remove(lua_State* L, int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_get(lua_State* L, int wxlref_index); // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from wxluaT_get(tag). Returns true if the // tag is known and the metatable was set. If track=true then push the // object as a lightuser data key into the wxlua_pushkey_wxLuaObjects table of // the Lua registry so that if we need to push it again we just push the full // userdata value. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_pushusertag(lua_State* L, const void* u, int tag, bool track); ! // If an object was pushed into Lua using wxluaT_pushusertag with track=true // then this function will remove the object from being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaT_untrackuserdata(lua_State* L, const void* u); ! // If an object was pushed into Lua using wxluaT_pushusertag with track=true // then this function will remove the metable of the object being tracked in the // wxlua_pushkey_wxLuaObjects Lua registry table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaT_cleartrackedmetatable(lua_State* L, const void* u); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_tag(lua_State* L, int stack_idx); // Get the userdata at the stack index, if null_ptr then set the pointer wrapped // by Lua's userdata to NULL to clear it. ! WXDLLIMPEXP_WXLUA void* LUACALL wxlua_touserdata(lua_State* L, int stack_idx, bool null_ptr = false); ! // Allocate a new table (metatable) with a "tag" key equal to the number from wxluaT_insert // and store it in the wxLuaReferences registry table. ! // Returns the index into the ref table, the "tag" from wxluaT_insert. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is wxluaT_insert into the wxLuaReferences // registry table. Returns the created index into the ref table. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newweaktag(lua_State* L, bool weak_keys, bool weak_values); // Set the metatable of the object at top of stack to the table stored in the ! // wxLuaReferences registry table using wxluaT_get(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // If pClass is non-null set the upvalue of the function to the supplied wxLuaBindClass. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settagmethod(lua_State* L, int tag, const char* method, lua_CFunction func, void* pClass = NULL); // Is the item at the stack_idx in the wxLuaReferences table already? // returns the tag or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_isrefed(lua_State* L, int stack_idx); // ---------------------------------------------------------------------------- *************** *** 201,208 **** // Gets the wxLuaBindClass from the metatable stored in the wxLuaReferences registry table // for the classes that have been installed into Lua. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, int class_tag); // Get the wxLuaBindClass* for this class_name or NULL if the name is invalid. // Gets the wxLuaBindClass from the "wxLuaClasses" table in the Lua registry. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxlua_tgetclass(lua_State* L, const char* class_name); // Is a class with the class_tag equal to or derived from a class with the base_class_tag. // 0 means same class, +1 means base is parent, +2 base is grandparent, ... --- 204,211 ---- // Gets the wxLuaBindClass from the metatable stored in the wxLuaReferences registry table // for the classes that have been installed into Lua. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, int class_tag); // Get the wxLuaBindClass* for this class_name or NULL if the name is invalid. // Gets the wxLuaBindClass from the "wxLuaClasses" table in the Lua registry. ! WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, const char* class_name); // Is a class with the class_tag equal to or derived from a class with the base_class_tag. // 0 means same class, +1 means base is parent, +2 base is grandparent, ... *************** *** 248,252 **** // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_terror with a message that is appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) // Note: The function wxLuaState::GetwxStringType does automatic conversion --- 251,255 ---- // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_error with a message that is appropriate for stack_idx to be a // parameter to a function call. (These are used in the bindings) // Note: The function wxLuaState::GetwxStringType does automatic conversion *************** *** 449,454 **** // ----------------------------------------------------------------------- ! // Destroy the refed data, use this instead of wxObject::UnRef(). ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. // Note: if you have a top level window (wxFrame) open in Lua and exit the --- 452,457 ---- // ----------------------------------------------------------------------- ! // Destroy the refed data, use this instead of wxObject::UnRef(). ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. // Note: if you have a top level window (wxFrame) open in Lua and exit the *************** *** 461,465 **** // Close the lua_State and if 'force' close all attached wxWindows // if !force then popup a dialog to ask if windows should be destroyed. ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. bool CloseLuaState(bool force); --- 464,468 ---- // Close the lua_State and if 'force' close all attached wxWindows // if !force then popup a dialog to ask if windows should be destroyed. ! // Only calls lua_close(L) if this is the last refed state and this was // created without the wxLUASTATE_STATICSTATE flag. bool CloseLuaState(bool force); *************** *** 546,550 **** // Break a currently running Lua program by setting the Lua debug hook to // be called for anything and breaking as soon as possible by calling ! // terror() with the message void DebugHookBreak(const wxString &message = wxT("Lua interpreter stopped")); // Clear a previously set DebugHookBreak(), resetting the debug hook --- 549,553 ---- // Break a currently running Lua program by setting the Lua debug hook to // be called for anything and breaking as soon as possible by calling ! // wxlua_error() with the message void DebugHookBreak(const wxString &message = wxT("Lua interpreter stopped")); // Clear a previously set DebugHookBreak(), resetting the debug hook *************** *** 584,588 **** // Register all the bindings in the wxLuaStateData, this is done // automatically by default on creation. (internal use) ! void RegisterBindings(bool registerTypes); // Get the installed wxLuaBinding with the given --- 587,591 ---- // Register all the bindings in the wxLuaStateData, this is done // automatically by default on creation. (internal use) ! void RegisterBindings(); // Get the installed wxLuaBinding with the given *************** *** 610,614 **** // Get the wxLuaBinding list of classes/objects installed into Lua. ! // You may add or remove bindings before the creation of any wxLuaStates // or once they have all been Destroy()ed. However, while any wxLuaStates // are created they must have the same bindings in the same order! --- 613,617 ---- // Get the wxLuaBinding list of classes/objects installed into Lua. ! // You may add or remove bindings before the creation of any wxLuaStates // or once they have all been Destroy()ed. However, while any wxLuaStates // are created they must have the same bindings in the same order! *************** *** 684,726 **** // ----------------------------------------------------------------------- // wxLua Lua Registry Table Functions // Create a reference to the object at stack index in the // wxLuaReferences registry table, returns the table index. ! int tinsert(int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! bool tremove(int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! bool tget(int wxlref_index); ! // Push the errorMsg on the stack and call lua_error ! void terror(const char *errorMsg) const; ! wxLUA_UNICODE_ONLY(void terror(const wxString& errorMsg) const { terror(wx2lua(errorMsg)); }) // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from tget(tag). Returns true if the // tag is known and the metatable was set. ! bool tpushusertag(const void *u, int tag, bool track); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! int ttag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in Lua to NULL so that Lua won't gc it. ! void* ttouserdata(int stack_idx, bool null_ptr = false) const; ! // Create a new table (metatable) tinsert it into the wxLuaReferences registry table // and return its index into the ref table. ! int tnewtag(); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is tinsert into the wxLuaReferences // registry table and return its index into the ref table. ! int tnewweaktag(bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to tget(tag) ! bool tsettag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class ! bool tsettagmethod(int tag, const char *method, lua_CFunction func, void *pClass = NULL); // ----------------------------------------------------------------------- --- 687,732 ---- // ----------------------------------------------------------------------- + + // Push the errorMsg on the stack and call wxlua_error() + void wxlua_Error(const char *errorMsg) const; + wxLUA_UNICODE_ONLY(void wxlua_Error(const wxString& errorMsg) const { wxlua_Error(wx2lua(errorMsg)); }) + + // ----------------------------------------------------------------------- // wxLua Lua Registry Table Functions // Create a reference to the object at stack index in the // wxLuaReferences registry table, returns the table index. ! int wxluaT_Insert(int stack_idx); // Remove a reference to the object at the index in the // wxLuaReferences registry table, returns success. ! bool wxluaT_Remove(int wxlref_index); // Push onto the top of the stack the object at the index in the // wxLuaReferences registry table, if the index is LUA_REFNIL or the // value is nil return false and don't leave anything on the stack. ! bool wxluaT_Get(int wxlref_index); // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from wxluaT_Get(tag). Returns true if the // tag is known and the metatable was set. ! bool wxluaT_PushUserTag(const void *u, int tag, bool track); // Get the numeric tag of the object at the stack index using the metatable's "tag" key. // returns WXLUA_NOTAG if the metatable of the object doesn't have a "tag" // key or it isn't a number. The tag is presumedly the index into the wxLuaReferences // registry table and denotes what type of object this is. ! int wxluaT_Tag(int stack_idx) const; // Get the userdata at the stack index, if null_ptr then set the userdata pointer // in Lua to NULL so that Lua won't gc it. ! void* wxlua_ToUserdata(int stack_idx, bool null_ptr = false) const; ! // Create a new table (metatable) wxluaT_Insert it into the wxLuaReferences registry table // and return its index into the ref table. ! int wxluaT_NewTag(); // Create a new table and its metatable with weak keys and/or values by setting the ! // metatable's __weak index to [k/v]. The table is wxluaT_Insert into the wxLuaReferences // registry table and return its index into the ref table. ! int wxluaT_NewWeakTag(bool weak_keys, bool weak_values); ! // Set the metatable of the object at top of stack to wxluaT_Get(tag) ! bool wxluaT_SetTag(int tag); // Set a metamethod for the metatable referenced by tag with the supplied name and function. // if pClass is non-null set the upvalue of the function to the supplied class ! bool wxluaT_SetTagMethod(int tag, const char *method, lua_CFunction func, void *pClass = NULL); // ----------------------------------------------------------------------- *************** *** 739,743 **** // system allocated tag. // If the data type does not have the correct tag, or if the parameter ! // stack_idx is nil, NULL is returned, otherwise terror is called. void* GetUserDataType(int stack_idx, int iTag) const; // Push a data type onto the stack and set its tag --- 745,749 ---- // system allocated tag. // If the data type does not have the correct tag, or if the parameter ! // stack_idx is nil, NULL is returned, otherwise wxlua_error is called. void* GetUserDataType(int stack_idx, int iTag) const; // Push a data type onto the stack and set its tag *************** *** 748,752 **** // Validate that the object at the stack index specified is a string object // or that the object can be converted to a string and return the string, ! // calls terror if the value is not of the right type. const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be --- 754,758 ---- // Validate that the object at the stack index specified is a string object // or that the object can be converted to a string and return the string, ! // calls wxlua_error if the value is not of the right type. const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be *************** *** 755,767 **** // Validate that the object at the stack index specified is a boolean object // or that the object can be converted to a boolean and return the boolean. ! // calls terror if the value is not of the right type. bool GetBooleanType(int stack_idx); // Validate that the object at the stack index specified is an integer object // or that the object can be converted to an integer and return the integer value. ! // calls terror if the value is not of the right type. long GetIntegerType(int stack_idx); // Validate that the object at the stack index specified is a number object // or that the object can be converted to a number and return the number value. ! // calls terror if the value is not of the right type. double GetNumberType(int stack_idx); --- 761,773 ---- // Validate that the object at the stack index specified is a boolean object // or that the object can be converted to a boolean and return the boolean. ! // calls wxlua_error if the value is not of the right type. bool GetBooleanType(int stack_idx); // Validate that the object at the stack index specified is an integer object // or that the object can be converted to an integer and return the integer value. ! // calls wxlua_error if the value is not of the right type. long GetIntegerType(int stack_idx); // Validate that the object at the stack index specified is a number object // or that the object can be converted to a number and return the number value. ! // calls wxlua_error if the value is not of the right type. double GetNumberType(int stack_idx); Index: wxlua_bind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlua_bind.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxlua_bind.h 1 Aug 2007 19:15:37 -0000 1.5 --- wxlua_bind.h 17 Nov 2007 00:15:01 -0000 1.6 *************** *** 17,23 **** // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 17 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 17 // --------------------------------------------------------------------------- --- 17,23 ---- // the current version of the bindings. // See 'bindings/genwxbind.lua' and 'modules/wxlua/include/wxldefs.h' ! #if WXLUA_BINDING_VERSION > 18 # error "The WXLUA_BINDING_VERSION in the bindings is too old, regenerate bindings." ! #endif //WXLUA_BINDING_VERSION > 18 // --------------------------------------------------------------------------- *************** *** 30,35 **** protected: ! virtual void PreRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, bool registerTypes, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) --- 30,35 ---- protected: ! virtual void PreRegister(const wxLuaState& wxlState, int luaTable); ! virtual void PostRegister(const wxLuaState& wxlState, int luaTable); DECLARE_DYNAMIC_CLASS(wxLuaBinding_wxlua) |