From: John L. <jr...@us...> - 2007-12-04 05:20:32
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16657/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlcallb.h wxlstate.h Log Message: After separating the tags, refs, and debug refs in the Lua registry rename the wxluaT_XXX functions to match what they operate on wxluaR_ for generic ref functions wxluaT_ for tag functions wxluaO_ for object functions Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxlcallb.h 7 Aug 2007 20:23:25 -0000 1.21 --- wxlcallb.h 4 Dec 2007 05:20:28 -0000 1.22 *************** *** 63,67 **** protected: ! int m_routine; // ref to the Lua routine to call in the wxLuaReferences registry table wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. wxEvtHandler* m_evtHandler; --- 63,67 ---- protected: ! int m_routine; // ref to the Lua routine to call in the wxlua_lreg_refs_key registry table wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. wxEvtHandler* m_evtHandler; Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** wxlbind.h 30 Nov 2007 23:00:06 -0000 1.65 --- wxlbind.h 4 Dec 2007 05:20:28 -0000 1.66 *************** *** 258,263 **** public: // Wrap the item at the lua_State's stack index and create a reference to it ! // in the wxLuaReferences registy table ! wxLuaObject(const wxLuaState& wxlState, int stack_idx = 1); virtual ~wxLuaObject(); --- 258,263 ---- public: // Wrap the item at the lua_State's stack index and create a reference to it ! // in the wxlua_lreg_refs_key registy table ! wxLuaObject(const wxLuaState& wxlState, int stack_idx); virtual ~wxLuaObject(); *************** *** 292,296 **** private: wxLuaState* m_wxlState; // a pointer due to include recursion. ! int m_reference; // reference in wxLuaReferences registry table wxLuaObject_Type m_alloc_flag; // type of object for wxValidator interface --- 292,296 ---- private: wxLuaState* m_wxlState; // a pointer due to include recursion. ! int m_reference; // reference in wxlua_lreg_refs_key registry table wxLuaObject_Type m_alloc_flag; // type of object for wxValidator interface Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** wxlstate.h 3 Dec 2007 23:47:24 -0000 1.97 --- wxlstate.h 4 Dec 2007 05:20:28 -0000 1.98 *************** *** 71,77 **** // Special keys used by wxLua // ! // Note we do not push a human readable string for these because Lua always makes ! // a copy and hashes the string, this takes a considerable amount of time ! // when benchmarked using valgrind. // ---------------------------------------------------------------------------- --- 71,77 ---- // Special keys used by wxLua // ! // Note: We do not push a human readable string for these because Lua always ! // makes a copy and hashes the string, this takes a considerable amount of ! // time when benchmarked using valgrind. // ---------------------------------------------------------------------------- *************** *** 129,134 **** //---------------------------------------------------------------------------- ! // wxluaT_XXX - the 'T' stands for Tag which is a numerical index in the ! // Lua registry table for determining userdata type (it's class) //---------------------------------------------------------------------------- --- 129,137 ---- //---------------------------------------------------------------------------- ! // wxluaR_XXX - functions operate on tables in Lua's LUA_REGISTRYINDEX which ! // are keyed on lightuserdata. The 'R' stands for Registry or Reference. ! // ! // Possible values for the "void* lightuserdata_reg_key" are ! // wxlua_lreg_tags_key, wxlua_lreg_refs_key, wxlua_lreg_debug_refs_key //---------------------------------------------------------------------------- *************** *** 136,149 **** // lightuserdata_reg_key in the LUA_REGISTRYINDEX table. Does not pop the object. // 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, const void* lightuserdata_reg_key); // Remove a reference to the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_remove(lua_State* L, int wxlref_index, const void* lightuserdata_reg_key); // Push onto the top of the stack the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX 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, const void* lightuserdata_reg_key); // 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(L, tag, &wxlua_lreg_tags_key). // 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 --- 139,175 ---- // lightuserdata_reg_key in the LUA_REGISTRYINDEX table. Does not pop the object. // Returns the table index or LUA_REFNIL if the item on the stack is none or nil (an error). ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_ref(lua_State* L, int stack_idx, const void* lightuserdata_reg_key); // Remove a reference to the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX table, returns success. ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaR_unref(lua_State* L, int wxlref_index, const void* lightuserdata_reg_key); // Push onto the top of the stack the object at the index in a table with the key // lightuserdata_reg_key in the LUA_REGISTRYINDEX 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 wxluaR_getref(lua_State* L, int wxlref_index, const void* lightuserdata_reg_key); ! // Is the item at the stack_idx in the table with the key lightuserdata_reg_key ! // in the LUA_REGISTRYINDEX table. Returns the tag or LUA_NOREF if it's not. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaR_isrefed(lua_State* L, int stack_idx, const void* lightuserdata_reg_key); ! ! //---------------------------------------------------------------------------- ! // wxluaT_XXX - functions operate on the "Tags" which is a numerical index in the ! // wxlua_lreg_tags_key table in Lua's LUA_REGISTRYINDEX to determine the C++ ! // class for a Lua userdata. ! //---------------------------------------------------------------------------- ! ! // Allocate a new table (metatable) with a wxlua_metatable_tag_key key equal ! // to the number from wxluaR_ref() and store it in the wxlua_lreg_tags_key LUA_REGISTRYINDEX table. ! // Returns the index into the tags table, the return value from wxluaR_ref(). ! // Leaves the new table on the top of the stack. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); ! // Get the numeric tag of the object at the stack index using the metatable's wxlua_metatable_tag_key key. ! // Returns WXLUA_NOTAG if the metatable of the object doesn't have a wxlua_metatable_tag_key ! // key or it isn't a number. The tag is presumedly the index into the wxlua_lreg_tags_key ! // LUA_REGISTRYINDEX table and denotes what type of C++ object this is. ! WXDLLIMPEXP_WXLUA int LUACALL wxluaT_gettag(lua_State* L, int stack_idx); ! // Set the metatable of the object at top of stack to the table stored in the ! // wxlua_lreg_tags_key LUA_REGISTRYINDEX table using wxluaR_getref(tag). ! WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int tag); // Push the object u onto the top of the stack wrapped in a newuserdata ! // with it's metatable set to the table from wxluaR_getref(L, tag, &wxlua_lreg_tags_key). // 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 *************** *** 151,188 **** // 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_lreg_objects_key Lua LUA_REGISTRYINDEX 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_lreg_objects_key Lua LUA_REGISTRYINDEX 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 wxlua_metatable_tag_key key. ! // Returns WXLUA_NOTAG if the metatable of the object doesn't have a wxlua_metatable_tag_key ! // key or it isn't a number. The tag is presumedly the index into the wxlua_lreg_tags_key ! // LUA_REGISTRYINDEX table and denotes what type of C++ 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 wxlua_metatable_tag_key key equal - // to the number from wxluaT_insert and store it in the wxlua_lreg_tags_key LUA_REGISTRYINDEX table. - // Returns the index into the tags table, the return value from wxluaT_insert. - // Leaves the new table on the top of the stack. - WXDLLIMPEXP_WXLUA int LUACALL wxluaT_newtag(lua_State* L); - // Set the metatable of the object at top of stack to the table stored in the - // wxlua_lreg_tags_key LUA_REGISTRYINDEX table using wxluaT_get(tag). - WXDLLIMPEXP_WXLUA bool LUACALL wxluaT_settag(lua_State* L, int tag); - // 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, const void* lightuserdata_reg_key); // ---------------------------------------------------------------------------- ! // Functions to get info about the tags wxLua uses to determine type // ---------------------------------------------------------------------------- // Get the wxLuaBindClass* for this class_tag or NULL if the tag is invalid. ! // 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); --- 177,206 ---- // 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); + + //---------------------------------------------------------------------------- + // wxluaO_XXX - functions operate on the "Objects" which are userdata wrapping + // C++ class objects and are stored in the wxlua_lreg_objects_key table in + // Lua's LUA_REGISTRYINDEX. + //---------------------------------------------------------------------------- + // 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_lreg_objects_key Lua LUA_REGISTRYINDEX table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_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_lreg_objects_key Lua LUA_REGISTRYINDEX table. ! WXDLLIMPEXP_WXLUA void LUACALL wxluaO_cleartrackedmetatable(lua_State* L, const void* u); ! // 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); // ---------------------------------------------------------------------------- ! // Functions to get info about the tags wxLua uses to determine C++ class type // ---------------------------------------------------------------------------- // Get the wxLuaBindClass* for this class_tag or NULL if the tag is invalid. ! // Gets the wxLuaBindClass from the metatable stored in the wxlua_lreg_tags_key registry table // for the classes that have been installed into Lua. WXDLLIMPEXP_WXLUA const wxLuaBindClass* LUACALL wxluaT_getclass(lua_State* L, int class_tag); *************** *** 677,685 **** // wxLua Lua Registry Table Functions ! int wxluaT_Insert(int stack_idx, const void* lightuserdata_reg_key); ! bool wxluaT_Remove(int wxlref_index, const void* lightuserdata_reg_key); ! bool wxluaT_Get(int wxlref_index, const void* lightuserdata_reg_key); bool wxluaT_PushUserTag(const void *u, int tag, bool track); ! int wxluaT_Tag(int stack_idx) const; void* wxlua_ToUserdata(int stack_idx, bool null_ptr = false) const; int wxluaT_NewTag(); --- 695,703 ---- // wxLua Lua Registry Table Functions ! int wxluaR_Ref(int stack_idx, const void* lightuserdata_reg_key); ! bool wxluaR_Unref(int wxlref_index, const void* lightuserdata_reg_key); ! bool wxluaR_GetRef(int wxlref_index, const void* lightuserdata_reg_key); bool wxluaT_PushUserTag(const void *u, int tag, bool track); ! int wxluaT_GetTag(int stack_idx) const; void* wxlua_ToUserdata(int stack_idx, bool null_ptr = false) const; int wxluaT_NewTag(); |