You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(191) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(238) |
Dec
(68) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(104) |
Feb
(518) |
Mar
(302) |
Apr
(211) |
May
(311) |
Jun
(55) |
Jul
(6) |
Aug
(35) |
Sep
(76) |
Oct
(50) |
Nov
(37) |
Dec
(340) |
2007 |
Jan
(23) |
Feb
(107) |
Mar
(98) |
Apr
(60) |
May
(136) |
Jun
(371) |
Jul
(175) |
Aug
(74) |
Sep
(3) |
Oct
(2) |
Nov
(53) |
Dec
(129) |
2008 |
Jan
(337) |
Feb
(23) |
Mar
(18) |
Apr
(4) |
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(33) |
Nov
|
Dec
(26) |
2009 |
Jan
(4) |
Feb
(1) |
Mar
(15) |
Apr
|
May
(35) |
Jun
(11) |
Jul
|
Aug
|
Sep
(19) |
Oct
(26) |
Nov
(11) |
Dec
(11) |
2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
(8) |
Dec
(7) |
2011 |
Jan
|
Feb
|
Mar
(4) |
Apr
(8) |
May
(5) |
Jun
(8) |
Jul
(1) |
Aug
|
Sep
|
Oct
(5) |
Nov
(13) |
Dec
|
From: John L. <jr...@us...> - 2007-08-10 21:23:42
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23945/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: Streamline the creation of a wxLuaState Changed the enums WXLUASTATE_ATTACH/SETSTATE for clarity and completeness. Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** wxlstate.h 10 Aug 2007 01:41:08 -0000 1.92 --- wxlstate.h 10 Aug 2007 21:23:39 -0000 1.93 *************** *** 401,408 **** enum wxLuaState_Type { ! WXLUASTATE_ATTACH = 1, // Attach to a previously created wxLuaState's // lua_State refing the existing wxLuaStateRefData ! WXLUASTATE_SETSTATE = 2 // Set the lua_State, register the bindings, ! // and don't close it when destroyed }; --- 401,412 ---- enum wxLuaState_Type { ! wxLUASTATE_GETSTATE = 1, // Attach to a previously created wxLuaState's // lua_State refing the existing wxLuaStateRefData ! wxLUASTATE_USESTATE = 2, // Set the lua_State and register the bindings. ! wxLUASTATE_SETSTATE = 3, // Set the lua_State, but don't register the bindings. ! ! wxLUASTATE_STATICSTATE = 0x1000 // The lua_State is static and the wxLuaState ! // will not lua_close() it when Destroy()ed. ! // Use with wxLUASTATE_USESTATE/SETSTATE only. }; *************** *** 417,426 **** wxLuaState(bool create = false) { if (create) Create(); } // Create a new lua_State, add the bindings in wxLuaBinding::GetBindingList() ! // sets the wxEvtHandler and wxWindowID to send the wxLuaEvents to wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) { Create(handler, id); } ! // Create a wxLuaState from an existing lua_State ! inline wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } // Copy constructor, refs existing wxLuaState ! inline wxLuaState(const wxLuaState& wxlState) { Create(wxlState); } // ALWAYS destroy lua_State instead of calling UnRef, else circular --- 421,431 ---- wxLuaState(bool create = false) { if (create) Create(); } // Create a new lua_State, add the bindings in wxLuaBinding::GetBindingList() ! // sets the wxEvtHandler and wxWindowID to send the wxLuaEvents to. wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) { Create(handler, id); } ! // Create a wxLuaState from an existing lua_State. ! // state_type is enum wxLuaState_Type. ! inline wxLuaState(lua_State* L, int state_type = wxLUASTATE_GETSTATE) { Create(L, state_type); } // Copy constructor, refs existing wxLuaState ! inline wxLuaState(const wxLuaState& wxlState) { Ref(wxlState); } // ALWAYS destroy lua_State instead of calling UnRef, else circular *************** *** 433,439 **** // handler may be NULL to not send events to anyone bool Create(wxEvtHandler *handler = NULL, wxWindowID id = wxID_ANY); ! // Create a new lua_State if L = NULL or just attach to the ! // input lua_State ! bool Create(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH); // ----------------------------------------------------------------------- --- 438,444 ---- // handler may be NULL to not send events to anyone bool Create(wxEvtHandler *handler = NULL, wxWindowID id = wxID_ANY); ! // Create a wxLuaState from an existing lua_State. ! // state_type is enum wxLuaState_Type. ! bool Create(lua_State* L, int state_type = wxLUASTATE_GETSTATE); // ----------------------------------------------------------------------- *************** *** 479,484 **** // ----------------------------------------------------------------------- ! // Set the event handler that the wxLuaEvents from this will be sent to, can be NULL ! // see wxEVT_LUA_XXX for a list of possible events that may be sent. void SetEventHandler(wxEvtHandler *evtHandler); wxEvtHandler *GetEventHandler() const; --- 484,489 ---- // ----------------------------------------------------------------------- ! // Set the event handler that the wxLuaEvents from this will be sent to, can be NULL. ! // See wxEVT_LUA_XXX for a list of possible events that may be sent. void SetEventHandler(wxEvtHandler *evtHandler); wxEvtHandler *GetEventHandler() const; |
From: John L. <jr...@us...> - 2007-08-10 21:23:42
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23945/wxLua/docs Modified Files: changelog.txt Log Message: Streamline the creation of a wxLuaState Changed the enums WXLUASTATE_ATTACH/SETSTATE for clarity and completeness. Index: changelog.txt =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/changelog.txt,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** changelog.txt 1 Aug 2007 19:15:31 -0000 1.44 --- changelog.txt 10 Aug 2007 21:23:38 -0000 1.45 *************** *** 15,18 **** --- 15,22 ---- - Applied patch to lparser.c "Too many variables in an assignment may cause a C stack overflow" + - Streamline creation of a wxLuaState and finding the wxLuaState from + an existing lua_State, + See wxlstate.h for changes to the enum WXLUASTATE_ATTACH/SETSTATE + to be more complete. version 2.8.4.1 |
From: John L. <jr...@us...> - 2007-08-10 01:41:11
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10860/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp Log Message: Push the wxLuaState into Lua instead of the wxLuaStateRefData Also Hash the wxLuaState instead of the wxLuaStateRefData Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** wxldebug.cpp 8 Aug 2007 22:49:32 -0000 1.44 --- wxldebug.cpp 10 Aug 2007 01:41:08 -0000 1.45 *************** *** 458,463 **** else if (udata == &wxlua_lreg_derivedmethods_key) s += wxT(" - wxLua Derived Class Methods"); ! else if (udata == &wxlua_lreg_wxluastaterefdata_key) ! s += wxT(" - wxLuaStateRefData"); else if (udata == &wxlua_lreg_objects_key) s += wxT(" - wxLua Pushed Userdata"); --- 458,463 ---- else if (udata == &wxlua_lreg_derivedmethods_key) s += wxT(" - wxLua Derived Class Methods"); ! else if (udata == &wxlua_lreg_wxluastate_key) ! s += wxT(" - wxLuaState"); else if (udata == &wxlua_lreg_objects_key) s += wxT(" - wxLua Pushed Userdata"); |
From: John L. <jr...@us...> - 2007-08-10 01:41:11
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10860/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: Push the wxLuaState into Lua instead of the wxLuaStateRefData Also Hash the wxLuaState instead of the wxLuaStateRefData Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** wxlstate.h 7 Aug 2007 20:23:25 -0000 1.91 --- wxlstate.h 10 Aug 2007 01:41:08 -0000 1.92 *************** *** 79,83 **** #define WXLUA_LREG_CLASSES 2 #define WXLUA_LREG_DERIVED_METHODS 3 ! #define WXLUA_LREG_WXLUASTATEREFDATA 4 #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 --- 79,83 ---- #define WXLUA_LREG_CLASSES 2 #define WXLUA_LREG_DERIVED_METHODS 3 ! #define WXLUA_LREG_WXLUASTATE 4 #define WXLUA_LREG_OBJECTS 5 #define WXLUA_LREG_CALLBASECLASSFUNC 6 *************** *** 90,94 **** extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_classes_key; // WXLUA_LREG_CLASSES extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_derivedmethods_key; // WXLUA_LREG_DERIVED_METHODS ! extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_wxluastaterefdata_key; // WXLUA_LREG_WXLUASTATEREFDATA extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_objects_key; // WXLUA_LREG_OBJECTS extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_callbaseclassfunc_key; // WXLUA_LREG_CALLBASECLASSFUNC --- 90,94 ---- extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_classes_key; // WXLUA_LREG_CLASSES extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_derivedmethods_key; // WXLUA_LREG_DERIVED_METHODS ! extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_wxluastate_key; // WXLUA_LREG_WXLUASTATE extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_objects_key; // WXLUA_LREG_OBJECTS extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_callbaseclassfunc_key; // WXLUA_LREG_CALLBASECLASSFUNC *************** *** 111,116 **** #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) // Push a key that is an index of the LUA_REGISTRYINDEX table who's value is a ! // lightuserdata of the wxLuaStateRefData for this lua_State. ! #define wxlua_pushkey_wxLuaStateRefData(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastaterefdata_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is table of all // objects that we've pushed into Lua using t[lightuserdata] = [weak valued full userdata] --- 111,116 ---- #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) // Push a key that is an index of the LUA_REGISTRYINDEX table who's value is a ! // lightuserdata of the wxLuaState for this lua_State. ! #define wxlua_pushkey_wxLuaState(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastate_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is table of all // objects that we've pushed into Lua using t[lightuserdata] = [weak valued full userdata] *************** *** 358,362 **** #include "wx/hashmap.h" ! WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxLuaStateRefData *, wxHashMapLuaStateRefData, class WXDLLIMPEXP_WXLUA); class WXDLLIMPEXP_WXLUA wxLuaStateRefData : public wxObjectRefData --- 358,362 ---- #include "wx/hashmap.h" ! WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxLuaState *, wxHashMapLuaState, class WXDLLIMPEXP_WXLUA); class WXDLLIMPEXP_WXLUA wxLuaStateRefData : public wxObjectRefData *************** *** 369,374 **** // if 'force' = true then make sure all wxWindows are destroyed. bool CloseLuaState(bool force); - // Free up the tracked resources list. - void CleanupWxLua(bool closeLua = true); // clear all wxLuaCallbacks on destruction void ClearCallbacks(); --- 369,372 ---- *************** *** 385,395 **** bool m_own_stateData; // not a coroutine when true, so delete it when done ! // Get the wxLuaStateRefData from the corresponding lua_State ! // returns NULL if none found. ! static wxLuaStateRefData* GetLuaStateRefData(lua_State* L); ! // A mapping between hashmap[lua_State* L] = *wxLuaStateRefData // Note: The coroutine lua_States are not hashed since we cannot know when // they are deleted. We create wxLuaStates for them on the fly. ! static wxHashMapLuaStateRefData s_wxHashMapLuaStateRefData; }; --- 383,396 ---- bool m_own_stateData; // not a coroutine when true, so delete it when done ! // Get the wxLuaState from the corresponding lua_State ! // returns wxNullLuaState if none found. ! static wxLuaState GetLuaState(lua_State* L); ! // A mapping between hashmap[lua_State* L] = *wxLuaState ! // Note: The hashed new wxLuaState is not Refed since we want to know when ! // the ref count goes to 1 for cleanup and it is deleted when ! // it's wxLuaStateRefData is finally deleted. // Note: The coroutine lua_States are not hashed since we cannot know when // they are deleted. We create wxLuaStates for them on the fly. ! static wxHashMapLuaState s_wxHashMapLuaState; }; *************** *** 419,427 **** wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) { Create(handler, id); } // Create a wxLuaState from an existing lua_State ! wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } // Copy constructor, refs existing wxLuaState ! wxLuaState(const wxLuaState& wxlState) { Create(wxlState); } ! // Copy constructor, refs existing wxLuaStateRefData (internal use) ! wxLuaState(wxLuaStateRefData* refData, lua_State* L) { Create(refData, L); } // ALWAYS destroy lua_State instead of calling UnRef, else circular --- 420,426 ---- wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) { Create(handler, id); } // Create a wxLuaState from an existing lua_State ! inline wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } // Copy constructor, refs existing wxLuaState ! inline wxLuaState(const wxLuaState& wxlState) { Create(wxlState); } // ALWAYS destroy lua_State instead of calling UnRef, else circular *************** *** 437,442 **** // input lua_State bool Create(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH); - // attach to the refData (internal use) - bool Create(wxLuaStateRefData* refData, lua_State* L); // ----------------------------------------------------------------------- --- 436,439 ---- |
From: John L. <jr...@us...> - 2007-08-10 01:41:11
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10860/wxLua/modules/wxlua/src Modified Files: wxlstate.cpp Log Message: Push the wxLuaState into Lua instead of the wxLuaStateRefData Also Hash the wxLuaState instead of the wxLuaStateRefData Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** wxlstate.cpp 8 Aug 2007 02:55:33 -0000 1.131 --- wxlstate.cpp 10 Aug 2007 01:41:08 -0000 1.132 *************** *** 26,30 **** int wxlua_lreg_classes_key = WXLUA_LREG_CLASSES; int wxlua_lreg_derivedmethods_key = WXLUA_LREG_DERIVED_METHODS; ! int wxlua_lreg_wxluastaterefdata_key = WXLUA_LREG_WXLUASTATEREFDATA; int wxlua_lreg_objects_key = WXLUA_LREG_OBJECTS; int wxlua_lreg_callbaseclassfunc_key = WXLUA_LREG_CALLBASECLASSFUNC; --- 26,30 ---- int wxlua_lreg_classes_key = WXLUA_LREG_CLASSES; int wxlua_lreg_derivedmethods_key = WXLUA_LREG_DERIVED_METHODS; ! int wxlua_lreg_wxluastate_key = WXLUA_LREG_WXLUASTATE; int wxlua_lreg_objects_key = WXLUA_LREG_OBJECTS; int wxlua_lreg_callbaseclassfunc_key = WXLUA_LREG_CALLBASECLASSFUNC; *************** *** 1246,1250 **** //---------------------------------------------------------------------------- ! wxHashMapLuaStateRefData wxLuaStateRefData::s_wxHashMapLuaStateRefData; wxLuaStateRefData::wxLuaStateRefData(bool create_data) --- 1246,1250 ---- //---------------------------------------------------------------------------- ! wxHashMapLuaState wxLuaStateRefData::s_wxHashMapLuaState; wxLuaStateRefData::wxLuaStateRefData(bool create_data) *************** *** 1317,1334 **** ClearCallbacks(); - CleanupWxLua(!m_lua_State_static); ! return true; ! } ! ! void wxLuaStateRefData::CleanupWxLua(bool closeLua) ! { ! if (closeLua && (m_lua_State != NULL)) { UnRegisterBindings(); lua_close(m_lua_State); - s_wxHashMapLuaStateRefData.erase(m_lua_State); - m_lua_State = NULL; } } --- 1317,1345 ---- ClearCallbacks(); ! if ((m_lua_State != NULL) && !m_lua_State_static) { UnRegisterBindings(); lua_close(m_lua_State); } + + // Clear out the wxLuaState we hashed, note it's not refed so we have + // NULL it's ref data. Note: even though the lua_State is closed the pointer + // value is still good. + if (m_lua_State != NULL) + { + wxHashMapLuaState::iterator it = s_wxHashMapLuaState.find(m_lua_State); + if (it != s_wxHashMapLuaState.end()) + { + wxLuaState* wxlState = it->second; + wxlState->SetRefData(NULL); + delete wxlState; + s_wxHashMapLuaState.erase(m_lua_State); + } + } + + m_lua_State = NULL; + + return true; } *************** *** 1388,1416 **** } ! wxLuaStateRefData* wxLuaStateRefData::GetLuaStateRefData(lua_State* L) { // try our hashtable for faster lookup ! wxHashMapLuaStateRefData::iterator it = s_wxHashMapLuaStateRefData.find(L); ! if (it != s_wxHashMapLuaStateRefData.end()) { //wxPrintf(wxT("GetLuaStateRefData L %d data %d\n"), (int)L, (int)it->second); ! return it->second; } - else // it's a coroutine? look up the state data from Lua - { - wxLuaStateRefData* d = NULL; ! // try to get the state we've stored ! wxlua_pushkey_wxLuaStateRefData(L); ! lua_rawget( L, LUA_REGISTRYINDEX ); ! // if nothing was returned or it wasn't a ptr, abort ! if ( lua_islightuserdata(L, -1) ) ! d = (wxLuaStateRefData*)lua_touserdata( L, -1 ); ! lua_pop(L, 1); // pop the wxLuaStateRefData or nil on failure ! return d; } } --- 1399,1447 ---- } ! wxLuaState wxLuaStateRefData::GetLuaState(lua_State* L) { // try our hashtable for faster lookup ! wxHashMapLuaState::iterator it = s_wxHashMapLuaState.find(L); ! if (it != s_wxHashMapLuaState.end()) { //wxPrintf(wxT("GetLuaStateRefData L %d data %d\n"), (int)L, (int)it->second); ! return wxLuaState(*it->second); } ! // else it's a coroutine? look up the state data from Lua ! wxLuaState* wxlState = NULL; ! // try to get the state we've stored ! wxlua_pushkey_wxLuaState(L); ! lua_rawget( L, LUA_REGISTRYINDEX ); ! // if nothing was returned or it wasn't a ptr, abort ! if ( lua_islightuserdata(L, -1) ) ! wxlState = (wxLuaState*)lua_touserdata( L, -1 ); ! lua_pop(L, 1); // pop the wxLuaStateRefData or nil on failure ! ! if (wxlState && (wxlState->GetLuaState() != L)) ! { ! // Create a new wxLuaState for the coroutine and set the wxLuaStateData ! // to the original wxLuaState's data ! wxLuaStateRefData* refData = new wxLuaStateRefData(false); ! refData->m_lua_State = L; ! refData->m_lua_State_static = true; ! refData->m_lua_State_coroutine = true; ! ! refData->m_wxlStateData = wxlState->GetLuaStateData(); ! refData->m_own_stateData = false; ! ! wxLuaState wxlState2(false); ! wxlState2.SetRefData(refData); ! return wxlState2; } + else if (wxlState) + { + return wxLuaState(*wxlState); + } + + return wxNullLuaState; } *************** *** 1456,1464 **** // track this newly created lua_State in our hashtable to help us // find the wxLuaStateRefData from the lua_State quickly ! wxLuaStateRefData::s_wxHashMapLuaStateRefData[L] = M_WXLSTATEDATA; // Stick us into the lua_State - push key, value ! wxlua_pushkey_wxLuaStateRefData(L); ! lua_pushlightuserdata( L, (void*)m_refData ); lua_rawset( L, LUA_REGISTRYINDEX ); // set the value --- 1487,1497 ---- // track this newly created lua_State in our hashtable to help us // find the wxLuaStateRefData from the lua_State quickly ! wxLuaState* hashState = new wxLuaState(false); ! hashState->SetRefData(m_refData); ! wxLuaStateRefData::s_wxHashMapLuaState[L] = hashState; // Stick us into the lua_State - push key, value ! wxlua_pushkey_wxLuaState(L); ! lua_pushlightuserdata( L, (void*)hashState ); lua_rawset( L, LUA_REGISTRYINDEX ); // set the value *************** *** 1484,1490 **** if (type == WXLUASTATE_ATTACH) { ! wxLuaStateRefData *refData = wxLuaStateRefData::GetLuaStateRefData(L); ! wxCHECK_MSG(refData != NULL, false, wxT("Unable to find lua_State")); ! return Create(refData, L); } else if (type == WXLUASTATE_SETSTATE) --- 1517,1522 ---- if (type == WXLUASTATE_ATTACH) { ! Ref(wxLuaStateRefData::GetLuaState(L)); ! return Ok(); } else if (type == WXLUASTATE_SETSTATE) *************** *** 1493,1501 **** M_WXLSTATEDATA->m_lua_State = L; M_WXLSTATEDATA->m_lua_State_static = true; ! wxLuaStateRefData::s_wxHashMapLuaStateRefData[L] = M_WXLSTATEDATA; // Stick us into the lua_State - push key, value ! wxlua_pushkey_wxLuaStateRefData(L); ! lua_pushlightuserdata( L, (void*)m_refData ); lua_rawset( L, LUA_REGISTRYINDEX ); // set the value --- 1525,1536 ---- M_WXLSTATEDATA->m_lua_State = L; M_WXLSTATEDATA->m_lua_State_static = true; ! ! wxLuaState* hashState = new wxLuaState(false); ! hashState->SetRefData(m_refData); ! wxLuaStateRefData::s_wxHashMapLuaState[L] = hashState; // Stick us into the lua_State - push key, value ! wxlua_pushkey_wxLuaState(L); ! lua_pushlightuserdata( L, (void*)hashState ); lua_rawset( L, LUA_REGISTRYINDEX ); // set the value *************** *** 1518,1555 **** } - bool wxLuaState::Create(wxLuaStateRefData* refData, lua_State* L) - { - // nothing to be done - if (m_refData == refData) - return true; - - // delete reference to old data - Destroy(); - - // reference new data - if ( refData && (L == refData->m_lua_State)) - { - // we need to increment the ref count, but it's private in wxObjectRefData - wxLuaState lS(false); - lS.SetRefData(refData); - Ref(lS); - lS.SetRefData(NULL); - } - else - { - // Create a new wxLuaState for the coroutine and set the wxLuaStateData - // to the original wxLuaState's data - m_refData = new wxLuaStateRefData(false); - M_WXLSTATEDATA->m_lua_State = L; - M_WXLSTATEDATA->m_lua_State_static = true; - M_WXLSTATEDATA->m_lua_State_coroutine = true; - - M_WXLSTATEDATA->m_wxlStateData = refData->m_wxlStateData; - M_WXLSTATEDATA->m_own_stateData = false; - } - - return true; - } - bool wxLuaState::Ok() const { --- 1553,1556 ---- *************** *** 1957,1966 **** lua_State* L = M_WXLSTATEDATA->m_lua_State; - // Stick us into the lua_State - push key, value - // make sure we're there, even though we might have already done this. - wxlua_pushkey_wxLuaStateRefData(L); - lua_pushlightuserdata( L, (void*)m_refData ); - lua_rawset( L, LUA_REGISTRYINDEX ); // set the value - // create the wxLuaReferences table in registry wxlua_pushkey_wxLuaReferences(L); --- 1958,1961 ---- *************** *** 3023,3031 **** wxCHECK_MSG(pObject, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); ! wxHashMapLuaStateRefData::iterator it; ! for (it = wxLuaStateRefData::s_wxHashMapLuaStateRefData.begin(); ! it != wxLuaStateRefData::s_wxHashMapLuaStateRefData.end(); ++it) { ! wxLuaState wxlState((wxLuaStateRefData*)it->second, ((wxLuaStateRefData*)it->second)->m_lua_State); if (wxlState.HasDerivedMethod(pObject, method, false)) return wxlState; --- 3018,3026 ---- wxCHECK_MSG(pObject, wxNullLuaState, wxT("Invalid object to wxLuaState::GetDerivedMethod")); ! wxHashMapLuaState::iterator it; ! for (it = wxLuaStateRefData::s_wxHashMapLuaState.begin(); ! it != wxLuaStateRefData::s_wxHashMapLuaState.end(); ++it) { ! wxLuaState wxlState((wxLuaState*)it->second); if (wxlState.HasDerivedMethod(pObject, method, false)) return wxlState; |
From: John L. <jr...@us...> - 2007-08-08 22:49:36
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22031/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Use lowercase "table" in stack dialog/debug data remove < wx2.6 pre wxComboBox::Insert code Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxlstack.cpp 7 Aug 2007 20:23:26 -0000 1.14 --- wxlstack.cpp 8 Aug 2007 22:49:32 -0000 1.15 *************** *** 381,385 **** // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), wxT("Table"), wxString::Format(wxT("Count %d"), (int)debugData.GetCount()), wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED); --- 381,385 ---- // Add the locals, fake a debug item to get it setup right ! wxLuaDebugItem* localItem = new wxLuaDebugItem(_("Locals"), wxT("table"), wxString::Format(wxT("Count %d"), (int)debugData.GetCount()), wxT(""), LUA_NOREF, 0, WXLUA_DEBUGITEM_EXPANDED); *************** *** 637,664 **** combo->Delete(pos); - #if wxCHECK_VERSION(2,5,0) combo->Insert(str, 0); - #else - // note: can use SetString in MSW, but not in GTK - int n, count = combo->GetCount(); - wxArrayString strings; - strings.Alloc(count); - for (n = 0; n < count; n++) - strings.Add(combo->GetString(n)); - - combo->Clear(); - combo->Append(str); // put new string first - - for (n = 0; n < count; n++) - combo->Append(strings[n]); - #endif - combo->SetSelection(0); ! if (max_strings > 0) ! { ! while ((int)combo->GetCount() > max_strings) ! combo->Delete(combo->GetCount()-1); ! } } --- 637,645 ---- combo->Delete(pos); combo->Insert(str, 0); combo->SetSelection(0); ! while ((max_strings > 0) && ((int)combo->GetCount() > max_strings)) ! combo->Delete(combo->GetCount()-1); } Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wxldebug.cpp 7 Aug 2007 20:23:26 -0000 1.43 --- wxldebug.cpp 8 Aug 2007 22:49:32 -0000 1.44 *************** *** 265,269 **** GetTypeValue(wxlState, -1, type, value, &flag_type); int nRef = wxlua_tinsert(L, -1); ! Add(new wxLuaDebugItem(wxT("Globals"), wxT("Table"), value, wxT(""), nRef, 0, WXLUA_DEBUGITEM_TTABLE|WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); } --- 265,269 ---- GetTypeValue(wxlState, -1, type, value, &flag_type); int nRef = wxlua_tinsert(L, -1); ! Add(new wxLuaDebugItem(wxT("Globals"), wxT("table"), value, wxT(""), nRef, 0, WXLUA_DEBUGITEM_TTABLE|WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); } *************** *** 273,277 **** GetTypeValue(wxlState, -1, type, value, &flag_type); int nRef = wxlua_tinsert(L, -1); ! Add(new wxLuaDebugItem(wxT("Lua Registry"), wxT("Table"), value, wxT(""), nRef, 0, WXLUA_DEBUGITEM_TTABLE|WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); } --- 273,277 ---- GetTypeValue(wxlState, -1, type, value, &flag_type); int nRef = wxlua_tinsert(L, -1); ! Add(new wxLuaDebugItem(wxT("Lua Registry"), wxT("table"), value, wxT(""), nRef, 0, WXLUA_DEBUGITEM_TTABLE|WXLUA_DEBUGITEM_LUAREFED)); references.Add(nRef); } *************** *** 576,580 **** if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == wxT("Table")) { wxString tname = wxString::Format(wxT("%s.%s"), tablename.c_str(), indexValue.c_str()); --- 576,580 ---- if (tableArray.Index(value) == wxNOT_FOUND) { ! if (valueType == wxT("table")) { wxString tname = wxString::Format(wxT("%s.%s"), tablename.c_str(), indexValue.c_str()); |
From: John L. <jr...@us...> - 2007-08-08 02:55:37
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5489/wxLua/samples Modified Files: unittest.wx.lua Log Message: Better check for wxlua.XXX binding wxLuaState lS(false) to show that we're not creating it Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** unittest.wx.lua 30 Jun 2007 00:12:27 -0000 1.15 --- unittest.wx.lua 8 Aug 2007 02:55:34 -0000 1.16 *************** *** 66,70 **** a = wx.wxEVT_NULL ! PrintOk(a == wx.wxEVT_NULL, "Test %define_event wxEVT_NULL == -1") a = wx.wxIMAGE_OPTION_CUR_HOTSPOT_X --- 66,70 ---- a = wx.wxEVT_NULL ! PrintOk(a == wx.wxEVT_NULL and a ~= nil, "Test %define_event wxEVT_NULL") a = wx.wxIMAGE_OPTION_CUR_HOTSPOT_X *************** *** 90,99 **** end ! if wxlua.wxLuaDebuggerServer then ! PrintOk(type(wxlua.wxLuaDebuggerServer) == "table", "Test wxstc bindings type(wxlua.wxLuaDebuggerServer) == \"table\"") ! else ! print("\nWARNING - unable to test wxluasocket bindings? Should they be here?\n\n") ! warnings = warnings + 1 ! end -- --------------------------------------------------------------------------- --- 90,94 ---- end ! PrintOk(wxlua.WXLUAARG_Nil == -2, "Test wxlua bindings wxlua.WXLUAARG_Nil == -2") -- --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-08-08 02:55:37
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5489/wxLua/modules/wxlua/src Modified Files: wxlstate.cpp Log Message: Better check for wxlua.XXX binding wxLuaState lS(false) to show that we're not creating it Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** wxlstate.cpp 7 Aug 2007 20:23:25 -0000 1.130 --- wxlstate.cpp 8 Aug 2007 02:55:33 -0000 1.131 *************** *** 1531,1535 **** { // we need to increment the ref count, but it's private in wxObjectRefData ! wxLuaState lS; lS.SetRefData(refData); Ref(lS); --- 1531,1535 ---- { // we need to increment the ref count, but it's private in wxObjectRefData ! wxLuaState lS(false); lS.SetRefData(refData); Ref(lS); |
From: John L. <jr...@us...> - 2007-08-07 20:23:29
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlcallb.cpp wxlstate.cpp Log Message: Add wxShutdown() Rename lua -> Lua Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** wxlstate.cpp 6 Aug 2007 22:00:34 -0000 1.129 --- wxlstate.cpp 7 Aug 2007 20:23:25 -0000 1.130 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood (Reuben Thomas for bitlib at bottom) // Created: 14/11/2001 *************** *** 35,42 **** wxLuaState wxNullLuaState(false); ! int LUACALL luaopen_bit(lua_State *L); // ---------------------------------------------------------------------------- ! // C functions for lua used in wxLuaState // ---------------------------------------------------------------------------- --- 35,42 ---- wxLuaState wxNullLuaState(false); ! int LUACALL luaopen_bit(lua_State *L); // implemented at bottom of file // ---------------------------------------------------------------------------- ! // C functions for Lua used in wxLuaState // ---------------------------------------------------------------------------- *************** *** 53,57 **** { // code copied from luaB_print in lbaselib.c ! if (i > 1) msg.Append(wxT("\t")); // lua uses a tab too in luaB_print const char *s; --- 53,57 ---- { // code copied from luaB_print in lbaselib.c ! if (i > 1) msg.Append(wxT("\t")); // Lua uses a tab too in luaB_print const char *s; *************** *** 68,86 **** msg += lua2wx(s); lua_pop(L, 1); /* pop result */ - /* - // we do this now in wxluabind__tostring_wxLuaBindClass - - // if we know the type, add it - if (lua_isuserdata(L, i) && wxlState.Ok()) - { - int nTag = wxlua_ttag(L, i); - if (nTag != WXLUA_NOTAG) - { - wxString name = wxlState.GetLuaTagName(nTag); - if (!name.IsEmpty()) - msg += wxString::Format(wxT(" (%s)"), name.c_str()); - } - } - */ } --- 68,71 ---- *************** *** 202,206 **** wxlState.SendEvent( event ); if (event.m_debug_hook_break) ! wxlState.terror("Interpreter stopped"); } --- 187,191 ---- wxlState.SendEvent( event ); if (event.m_debug_hook_break) ! wxlState.terror("Lua interpreter stopped."); } *************** *** 217,222 **** wxlState.SetLastLuaDebugHookTime( cur_time ); ! bool painting = false; wxLongToLongHashMap::iterator it; wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_trackedObjects; --- 202,208 ---- wxlState.SetLastLuaDebugHookTime( cur_time ); ! bool painting = (evtType == wxEVT_PAINT); + /* wxLongToLongHashMap::iterator it; wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_trackedObjects; *************** *** 230,233 **** --- 216,220 ---- } } + */ if (!painting) *************** *** 261,275 **** lua_pushvalue(L, stack_idx); // push a copy of value to store to top - int nTop = lua_gettop(L); // this is where the value is wxlua_pushkey_wxLuaReferences(L); // push name of table to get as key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the refs table) ! lua_pushvalue(L, nTop); // push value to store int table_idx = luaL_ref(L, -2); // create unique integer reference // in our refs table ! lua_pop(L, 3); // pop value, table, value return table_idx; --- 248,261 ---- lua_pushvalue(L, stack_idx); // push a copy of value to store to top wxlua_pushkey_wxLuaReferences(L); // push name of table to get as key lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the refs table) ! lua_pushvalue(L, -2); // push value to store int table_idx = luaL_ref(L, -2); // create unique integer reference // in our refs table ! lua_pop(L, 3); // pop value, refs table, value return table_idx; *************** *** 340,344 **** { wxlua_pushkey_wxLuaObjects(L); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the obj table) lua_pushlightuserdata(L, (void*)u); // key on Lua's userdata lua_rawget(L, -2); --- 326,330 ---- { wxlua_pushkey_wxLuaObjects(L); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the obj table) lua_pushlightuserdata(L, (void*)u); // key on Lua's userdata lua_rawget(L, -2); *************** *** 371,375 **** lua_pushlightuserdata(L, (void*)u); // key on the object since we can reuse the userdata ! lua_pushvalue(L, -3); // push the lua userdata as the value (note: weak valued table) lua_rawset(L, -3); --- 357,361 ---- lua_pushlightuserdata(L, (void*)u); // key on the object since we can reuse the userdata ! lua_pushvalue(L, -3); // push the Lua userdata as the value (note: weak valued table) lua_rawset(L, -3); *************** *** 407,410 **** --- 393,397 ---- lua_pushlightuserdata(L, (void*)u); lua_rawget(L, -2); + if (lua_isuserdata(L, -1)) { *************** *** 439,443 **** { pdata = *ptr; // get the pointer the userdata holds ! if (null_ptr) // NULL ptr so lua won't try to gc it *ptr = NULL; } --- 426,430 ---- { pdata = *ptr; // get the pointer the userdata holds ! if (null_ptr) // NULL ptr so Lua won't try to gc it *ptr = NULL; } *************** *** 597,601 **** const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata ! lua_pop(L, 2); // pop wxLuaClasses table and lightuserdata return wxlClass; --- 584,588 ---- const wxLuaBindClass* wxlClass = (wxLuaBindClass *)lua_touserdata(L, -1); // actually lightuserdata ! lua_pop(L, 2); // pop wxLuaClasses table and lightuserdata (or nil if none) return wxlClass; *************** *** 792,801 **** } ! double num = 0; // we also allow 0 = false and !0 = true (Lua thinks 0 == true, i.e. !nil) if (l_type == LUA_TNUMBER) ! num = (double)lua_tonumber(L, stack_idx); else ! num = (double)lua_toboolean(L, stack_idx); return (num != 0); --- 779,788 ---- } ! int num = 0; // we also allow 0 = false and !0 = true (Lua thinks 0 == true, i.e. !nil) if (l_type == LUA_TNUMBER) ! num = (int)lua_tonumber(L, stack_idx); else ! num = (int)lua_toboolean(L, stack_idx); return (num != 0); *************** *** 1000,1004 **** lua_pop(L, 1); // pop the nil reg table wxlua_terror(L, "wxLua: The wxLuaDerivedMethods table in the registry is missing!"); - return false; } --- 987,990 ---- *************** *** 1267,1271 **** m_lua_State_coroutine(false), m_wxlStateData(NULL), ! m_own_stateData(true) { if (create_data) --- 1253,1257 ---- m_lua_State_coroutine(false), m_wxlStateData(NULL), ! m_own_stateData(false) { if (create_data) *************** *** 1338,1345 **** void wxLuaStateRefData::CleanupWxLua(bool closeLua) { - // from lua50/lib/lbaselib.c, the collectgarbage lua function - // see int luaB_collectgarbage(lua_State *L); - //lua_setgcthreshold(L, luaL_optint(L, 1, 0)); // = luaB_collectgarbage(L); - if (closeLua && (m_lua_State != NULL)) { --- 1324,1327 ---- *************** *** 1415,1419 **** return it->second; } ! else // it's a coroutine? look up the state data from lua { wxLuaStateRefData* d = NULL; --- 1397,1401 ---- return it->second; } ! else // it's a coroutine? look up the state data from Lua { wxLuaStateRefData* d = NULL; *************** *** 1661,1674 **** int wxLuaState::RunFile(const wxString &filename) { ! wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("lua interpreter not created")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("lua interpreter is already running")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_gettop(L); ! int status = luaL_loadfile(L, wx2lua(filename)); if (status == 0) { --- 1643,1654 ---- int wxLuaState::RunFile(const wxString &filename) { ! wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Lua interpreter not created")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("Lua interpreter is already running")); M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_GetTop(); ! int status = luaL_LoadFile(wx2lua(filename)); if (status == 0) { *************** *** 1696,1708 **** { wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("lua interpreter is already running")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_gettop(L); ! int status = luaL_loadbuffer(L, (const char*)buf, size, wx2lua(name)); if (status == 0) { --- 1676,1686 ---- { wxCHECK_MSG(Ok(), LUA_ERRRUN, wxT("Invalid wxLuaState")); ! wxCHECK_MSG(!M_WXLSTATEDATA->m_wxlStateData->m_is_running, LUA_ERRRUN, wxT("Lua interpreter is already running")); M_WXLSTATEDATA->m_wxlStateData->m_debug_hook_break = false; M_WXLSTATEDATA->m_wxlStateData->m_is_running = true; ! int top = lua_GetTop(); ! int status = luaL_LoadBuffer((const char*)buf, size, wx2lua(name)); if (status == 0) { *************** *** 1885,1889 **** { wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxCHECK_RET(M_WXLSTATEDATA->m_wxlStateData->m_is_running, wxT("lua interpreter not running")); // Lua likes to be stopped within the debug hook, you get funny wxYield --- 1863,1867 ---- { wxCHECK_RET(Ok(), wxT("Invalid wxLuaState")); ! wxCHECK_RET(M_WXLSTATEDATA->m_wxlStateData->m_is_running, wxT("Lua interpreter not running")); // Lua likes to be stopped within the debug hook, you get funny wxYield *************** *** 2000,2004 **** lua_rawset( L, LUA_REGISTRYINDEX ); // set the value ! // Create a table for the userdata that we've pushed into lua // Use weak values so the gc works on them wxlua_pushkey_wxLuaObjects(L); --- 1978,1982 ---- lua_rawset( L, LUA_REGISTRYINDEX ); // set the value ! // Create a table for the userdata that we've pushed into Lua // Use weak values so the gc works on them wxlua_pushkey_wxLuaObjects(L); *************** *** 2116,2128 **** const wxLuaBindClass* wxlClass = NULL; wxlClass = GetLuaClass("wxEvent"); ! wxCHECK_RET(wxlClass, wxT("wxEvent lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxEvent = *wxlClass->class_tag; wxlClass = GetLuaClass("wxString"); ! wxCHECK_RET(wxlClass, wxT("wxString lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxString = *wxlClass->class_tag; wxlClass = GetLuaClass("wxWindow"); ! wxCHECK_RET(wxlClass, wxT("wxWindow lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxWindow = *wxlClass->class_tag; } --- 2094,2106 ---- const wxLuaBindClass* wxlClass = NULL; wxlClass = GetLuaClass("wxEvent"); ! wxCHECK_RET(wxlClass, wxT("wxEvent Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxEvent = *wxlClass->class_tag; wxlClass = GetLuaClass("wxString"); ! wxCHECK_RET(wxlClass, wxT("wxString Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxString = *wxlClass->class_tag; wxlClass = GetLuaClass("wxWindow"); ! wxCHECK_RET(wxlClass, wxT("wxWindow Lua tag is missing in wxLuaState, forgot to add wxWidgets binding?")); g_wxluatag_wxWindow = *wxlClass->class_tag; } *************** *** 2146,2152 **** wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState")); ! // try to get the wxLuaBindClass from the lua registry table first ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! const wxLuaBindClass* wxlClass = wxlua_tgetclass(L, class_tag); // we shouldn't ever need this code --- 2124,2129 ---- wxCHECK_MSG(Ok(), NULL, wxT("Invalid wxLuaState")); ! // try to get the wxLuaBindClass from the Lua registry table first ! const wxLuaBindClass* wxlClass = wxlua_tgetclass(M_WXLSTATEDATA->m_lua_State, class_tag); // we shouldn't ever need this code *************** *** 2169,2175 **** { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_tgetclass(L, className); } --- 2146,2150 ---- { wxCHECK_MSG(GetRefData() != NULL, NULL, wxT("Invalid wxLuaState")); ! return wxlua_tgetclass(M_WXLSTATEDATA->m_lua_State, className); } *************** *** 2206,2212 **** { wxCHECK_MSG(Ok(), -1, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_isderivedclass(L, iClassTag, iBaseClassTag); } --- 2181,2185 ---- { wxCHECK_MSG(Ok(), -1, wxT("Invalid wxLuaState")); ! return wxlua_isderivedclass(M_WXLSTATEDATA->m_lua_State, iClassTag, iBaseClassTag); } *************** *** 2741,2745 **** } ! // push the object into lua by wrapping it with a Lua userdata // or if it's already wrapped, return a copy of the userdata wxlua_tpushusertag(L, data, tag, true); --- 2714,2718 ---- } ! // push the object into Lua by wrapping it with a Lua userdata // or if it's already wrapped, return a copy of the userdata wxlua_tpushusertag(L, data, tag, true); *************** *** 3031,3037 **** { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_setderivedmethod(L, pObject, method_name, wxlObj); } --- 3004,3008 ---- { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to set derived method for.")); ! return wxlua_setderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, wxlObj); } *************** *** 3039,3045 **** { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_hasderivedmethod(L, pObject, method_name, push_method); } --- 3010,3014 ---- { wxCHECK_MSG(Ok(), false, wxT("Invalid wxLuaState")); ! return wxlua_hasderivedmethod(M_WXLSTATEDATA->m_lua_State, pObject, method_name, push_method); } *************** *** 3047,3053 **** { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to remove.")); ! ! lua_State* L = M_WXLSTATEDATA->m_lua_State; ! return wxlua_removederivedmethod(L, pObject); } --- 3016,3020 ---- { wxCHECK_MSG(Ok() && pObject, false, wxT("Invalid wxLuaState or object to remove.")); ! return wxlua_removederivedmethod(M_WXLSTATEDATA->m_lua_State, pObject); } *************** *** 3069,3073 **** // ---------------------------------------------------------------------------- ! // Raw basic lua stack functions. int wxLuaState::lua_GetTop() const --- 3036,3040 ---- // ---------------------------------------------------------------------------- ! // Raw basic Lua stack functions. int wxLuaState::lua_GetTop() const *************** *** 3224,3228 **** // ---------------------------------------------------------------------------- ! // Raw lua push functions (C -> stack) void wxLuaState::lua_PushNil() --- 3191,3195 ---- // ---------------------------------------------------------------------------- ! // Raw Lua push functions (C -> stack) void wxLuaState::lua_PushNil() *************** *** 3268,3272 **** // ---------------------------------------------------------------------------- ! // Raw lua get functions (Lua -> stack) void wxLuaState::lua_GetTable(int idx) --- 3235,3239 ---- // ---------------------------------------------------------------------------- ! // Raw Lua get functions (Lua -> stack) void wxLuaState::lua_GetTable(int idx) *************** *** 3317,3321 **** // ----------------------------------------------------------------------- ! // Raw lua set functions (stack -> Lua) void wxLuaState::lua_SetTable(int idx) --- 3284,3288 ---- // ----------------------------------------------------------------------- ! // Raw Lua set functions (stack -> Lua) void wxLuaState::lua_SetTable(int idx) *************** *** 3351,3355 **** // ---------------------------------------------------------------------------- ! // Raw lua `load' and `call' functions (load and run Lua code) void wxLuaState::lua_Call(int nargs, int nresults) --- 3318,3322 ---- // ---------------------------------------------------------------------------- ! // Raw Lua `load' and `call' functions (load and run Lua code) void wxLuaState::lua_Call(int nargs, int nresults) *************** *** 3380,3384 **** // ---------------------------------------------------------------------------- ! // Raw lua coroutine functions int wxLuaState::lua_Yield(int nresults) --- 3347,3351 ---- // ---------------------------------------------------------------------------- ! // Raw Lua coroutine functions int wxLuaState::lua_Yield(int nresults) *************** *** 3399,3403 **** // ---------------------------------------------------------------------------- ! // Raw lua garbage-collection functions int wxLuaState::lua_GetGCCount() --- 3366,3370 ---- // ---------------------------------------------------------------------------- ! // Raw Lua garbage-collection functions int wxLuaState::lua_GetGCCount() *************** *** 3408,3412 **** // ---------------------------------------------------------------------------- ! // Raw lua miscellaneous functions wxString wxLuaState::lua_Version() const --- 3375,3379 ---- // ---------------------------------------------------------------------------- ! // Raw Lua miscellaneous functions wxString wxLuaState::lua_Version() const *************** *** 3431,3435 **** // ----------------------------------------------------------------------- ! // Raw lua some useful "macros", lua.h void wxLuaState::lua_Register(const char* funcName, lua_CFunction f) --- 3398,3402 ---- // ----------------------------------------------------------------------- ! // Raw Lua some useful "macros", lua.h void wxLuaState::lua_Register(const char* funcName, lua_CFunction f) *************** *** 3497,3501 **** // ---------------------------------------------------------------------------- ! // Raw lua Debug functions, lua.h int wxLuaState::lua_GetStack(int level, lua_Debug* ar) --- 3464,3468 ---- // ---------------------------------------------------------------------------- ! // Raw Lua Debug functions, lua.h int wxLuaState::lua_GetStack(int level, lua_Debug* ar) *************** *** 3552,3556 **** // ---------------------------------------------------------------------------- ! // Raw lua auxlib functions, lauxlib.h void wxLuaState::luaI_OpenLib(const char *libname, const luaL_reg *l, int nup) --- 3519,3523 ---- // ---------------------------------------------------------------------------- ! // Raw Lua auxlib functions, lauxlib.h void wxLuaState::luaI_OpenLib(const char *libname, const luaL_reg *l, int nup) *************** *** 3864,3868 **** } ! // Redirect lua function call to 1 method from a list of overloaded functions int LUACALL wxLuaState::CallOverloadedFunction(struct wxLuaBindMethod* wxlMethod) { --- 3831,3835 ---- } ! // Redirect Lua function call to 1 method from a list of overloaded functions int LUACALL wxLuaState::CallOverloadedFunction(struct wxLuaBindMethod* wxlMethod) { *************** *** 3872,3876 **** int invalidArg = 0; ! // get number of arguments called from lua int argCount = lua_GetTop(); int lua_argStart = 0; --- 3839,3843 ---- int invalidArg = 0; ! // get number of arguments called from Lua int argCount = lua_GetTop(); int lua_argStart = 0; *************** *** 3909,3913 **** for (arg = 0; (arg < argCount) && (funcArray.GetCount() != 0); arg++) { ! int arg_lua = arg+1+lua_argStart; // arg N in lua int ltype = lua_Type(arg_lua); --- 3876,3880 ---- for (arg = 0; (arg < argCount) && (funcArray.GetCount() != 0); arg++) { ! int arg_lua = arg+1+lua_argStart; // arg N in Lua int ltype = lua_Type(arg_lua); *************** *** 3933,3937 **** //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the lua type match the wxlua arg tag type int is_ok = IswxLuaType(ltype, tag); --- 3900,3904 ---- //wxPrintf(wxT("ARG '%s' type %d argCount %d arg %d arg_lua %d arg_wxlua %d ltype %d wxtype %d func_count %d/%d\n"), lua2wx(wxlMethod->name).c_str(), func->type, argCount, arg, arg_lua, arg_wxlua, ltype, tag, i, funcArray.GetCount()); ! // Does the Lua type match the wxlua arg tag type int is_ok = IswxLuaType(ltype, tag); Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** wxlbind.cpp 3 Aug 2007 22:17:16 -0000 1.91 --- wxlbind.cpp 7 Aug 2007 20:23:25 -0000 1.92 *************** *** 110,114 **** delete m_arrayInt; ! // If a refererence exists, remove it, but don't bother if lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) m_wxlState->tremove(m_reference); --- 110,114 ---- delete m_arrayInt; ! // If a refererence exists, remove it, but don't bother if Lua is being closed if ((m_reference != LUA_NOREF) && m_wxlState->Ok() && !m_wxlState->IsClosing()) m_wxlState->tremove(m_reference); *************** *** 263,267 **** // The class to lookup is in an upvalue. (gettable tag method). // If the method is a function method push a wxLuaFunction object ! // onto the lua stack, setting its metatable so that when lua calls __call // the wxLuaFunction will run the actual method we set for it. // ---------------------------------------------------------------------------- --- 263,267 ---- // The class to lookup is in an upvalue. (gettable tag method). // If the method is a function method push a wxLuaFunction object ! // onto the Lua stack, setting its metatable so that when Lua calls __call // the wxLuaFunction will run the actual method we set for it. // ---------------------------------------------------------------------------- *************** *** 276,280 **** // See below, if _XXX is called then we set this flag so that // the called function knows to call the base class instead of recalling ! // the lua function and recursing. wxlua_setcallbaseclassfunction(L, false); --- 276,280 ---- // See below, if _XXX is called then we set this flag so that // the called function knows to call the base class instead of recalling ! // the Lua function and recursing. wxlua_setcallbaseclassfunction(L, false); *************** *** 288,292 **** { void *pObject = wxlua_ttouserdata(L, 1, false); ! name = lua_tostring(L, 2); // name of the __index method called in lua callbase = (name[0] == '_'); --- 288,292 ---- { void *pObject = wxlua_ttouserdata(L, 1, false); ! name = lua_tostring(L, 2); // name of the __index method called in Lua callbase = (name[0] == '_'); *************** *** 300,304 **** { found = true; ! result = 1; // the function for lua to call } } --- 300,304 ---- { found = true; ! result = 1; // the function for Lua to call } } *************** *** 447,451 **** // Use the pointer to this int as a special tag to know that __call has been // made on a table and that we want to remove the table for the bindings to ! // work. This is because lua always pushes the table on the stack if '.' or ':' // is used for the __call metamethod. // ---------------------------------------------------------------------------- --- 447,451 ---- // Use the pointer to this int as a special tag to know that __call has been // made on a table and that we want to remove the table for the bindings to ! // work. This is because Lua always pushes the table on the stack if '.' or ':' // is used for the __call metamethod. // ---------------------------------------------------------------------------- *************** *** 645,649 **** wxlState.tsettag(m_luaTable_tag); ! // prevent changes from lua scripts //wxlState.tsettagmethod(m_luaTable_tag, "__newindex", wxlua_tableErrorHandler); // FIXME allow this? } --- 645,649 ---- wxlState.tsettag(m_luaTable_tag); ! // prevent changes from Lua scripts //wxlState.tsettagmethod(m_luaTable_tag, "__newindex", wxlua_tableErrorHandler); // FIXME allow this? } *************** *** 682,686 **** void LUACALL wxLuaBinding::RegisterGeneratedClasses(const wxLuaState& wxlState_, int tableOffset, bool registerTypes) { ! // Replace the metatable functions for the classes we push into lua static const luaL_reg s_funcTable[] = { --- 682,686 ---- void LUACALL wxLuaBinding::RegisterGeneratedClasses(const wxLuaState& wxlState_, int tableOffset, bool registerTypes) { ! // Replace the metatable functions for the classes we push into Lua static const luaL_reg s_funcTable[] = { Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** wxlcallb.cpp 7 Aug 2007 03:06:12 -0000 1.40 --- wxlcallb.cpp 7 Aug 2007 20:23:25 -0000 1.41 *************** *** 50,54 **** } ! // create a reference to the lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) m_routine = m_wxlState.tinsert(lua_func_stack_idx); --- 50,54 ---- } ! // create a reference to the Lua event handler function if (lua_func_stack_idx != WXLUACALLBACK_NOROUTINE) m_routine = m_wxlState.tinsert(lua_func_stack_idx); *************** *** 194,199 **** event.Skip(); ! // FIXME - Is it an error to receive an event after you've deleted lua? ! // probably not if lua is getting shutdown // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor if (m_wxlState.Ok()) --- 194,199 ---- event.Skip(); ! // FIXME - Is it an error to receive an event after you've deleted Lua? ! // probably not if Lua is getting shutdown // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor if (m_wxlState.Ok()) |
From: John L. <jr...@us...> - 2007-08-07 20:23:29
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxluasocket/include Modified Files: wxldserv.h wxldtarg.h Log Message: Add wxShutdown() Rename lua -> Lua Index: wxldserv.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldserv.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxldserv.h 26 Jul 2007 18:56:39 -0000 1.38 --- wxldserv.h 7 Aug 2007 20:23:26 -0000 1.39 *************** *** 268,272 **** // ---------------------------------------------------------------------------- ! // wxLuaDebuggerCServer - a socket server for a lua program to communicate with a // wxLuaDebugTarget run in C++. // ---------------------------------------------------------------------------- --- 268,272 ---- // ---------------------------------------------------------------------------- ! // wxLuaDebuggerCServer - a socket server for a Lua program to communicate with a // wxLuaDebugTarget run in C++. // ---------------------------------------------------------------------------- *************** *** 329,333 **** // ---------------------------------------------------------------------------- ! // wxLuaDebuggerwxServer - a socket server for a lua program to communicate with a // wxLuaDebugTarget run in C++. // ---------------------------------------------------------------------------- --- 329,333 ---- // ---------------------------------------------------------------------------- ! // wxLuaDebuggerwxServer - a socket server for a Lua program to communicate with a // wxLuaDebugTarget run in C++. // ---------------------------------------------------------------------------- *************** *** 393,397 **** wxString GetMessage() const { return m_strMessage; } // check HasMessage bool HasMessage() const { return m_has_message; } ! long GetReference() const { return m_lua_ref; } // lua reference wxLuaDebugData GetDebugData() const { return m_debugData; } bool GetEnabledFlag() const { return m_enabled_flag; } --- 393,397 ---- wxString GetMessage() const { return m_strMessage; } // check HasMessage bool HasMessage() const { return m_has_message; } ! long GetReference() const { return m_lua_ref; } // Lua reference wxLuaDebugData GetDebugData() const { return m_debugData; } bool GetEnabledFlag() const { return m_enabled_flag; } Index: wxldtarg.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldtarg.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wxldtarg.h 26 Jul 2007 18:56:40 -0000 1.24 --- wxldtarg.h 7 Aug 2007 20:23:26 -0000 1.25 *************** *** 18,22 **** // ---------------------------------------------------------------------------- ! // wxLuaDebugTarget - a C++ socket target that the wxLuaDebuggerServer run in lua // communicates with. Handles the Debugger/Debuggee IO // ---------------------------------------------------------------------------- --- 18,22 ---- // ---------------------------------------------------------------------------- ! // wxLuaDebugTarget - a C++ socket target that the wxLuaDebuggerServer run in Lua // communicates with. Handles the Debugger/Debuggee IO // ---------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-08-07 20:23:29
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxluadebug/src Modified Files: wxldebug.cpp wxlstack.cpp Log Message: Add wxShutdown() Rename lua -> Lua Index: wxlstack.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxlstack.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wxlstack.cpp 26 Jul 2007 18:56:39 -0000 1.13 --- wxlstack.cpp 7 Aug 2007 20:23:26 -0000 1.14 *************** *** 1,5 **** ///////////////////////////////////////////////////////////////////////////// // Name: StackTree.cpp ! // Purpose: Display the lua stack in a dialog. // Author: J. Winwood, John Labenski // Created: February 2002 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// // Name: StackTree.cpp ! // Purpose: Display the Lua stack in a dialog. // Author: J. Winwood, John Labenski // Created: February 2002 *************** *** 136,140 **** wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator ); // help GCC find which fn to call ! m_stackChoice->SetToolTip(wxT("Select lua stack to display.")); wxButton* expandButton = new wxButton(panel, ID_WXLUA_STACK_EXPAND_BUTTON, --- 136,140 ---- wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator ); // help GCC find which fn to call ! m_stackChoice->SetToolTip(wxT("Select Lua stack to display.")); wxButton* expandButton = new wxButton(panel, ID_WXLUA_STACK_EXPAND_BUTTON, *************** *** 1026,1030 **** m_luaReferences.RemoveAt(idx); else ! wxPrintf(wxT("Missing lua reference in listctrl #%d ok %d ref %d count %d idx %d\n"), i, ok, debugItem->GetReference(), m_luaReferences.GetCount(), idx); } } --- 1026,1030 ---- m_luaReferences.RemoveAt(idx); else ! wxPrintf(wxT("Missing Lua reference in listctrl #%d ok %d ref %d count %d idx %d\n"), i, ok, debugItem->GetReference(), m_luaReferences.GetCount(), idx); } } *************** *** 1034,1039 **** { bool ok = m_wxlState.tremove(m_luaReferences[i]); ! wxCHECK_RET(ok, wxT("Unable to remove a reference in lua")); ! //wxPrintf(wxT("Extra lua reference in listctrl #%d ok %d ref %d count %d\n"), i, ok, m_luaReferences[i], m_luaReferences.GetCount()); } --- 1034,1039 ---- { bool ok = m_wxlState.tremove(m_luaReferences[i]); ! wxCHECK_RET(ok, wxT("Unable to remove a reference in Lua")); ! //wxPrintf(wxT("Extra Lua reference in listctrl #%d ok %d ref %d count %d\n"), i, ok, m_luaReferences[i], m_luaReferences.GetCount()); } Index: wxldebug.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/wxldebug.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** wxldebug.cpp 3 Aug 2007 22:17:17 -0000 1.42 --- wxldebug.cpp 7 Aug 2007 20:23:26 -0000 1.43 *************** *** 80,84 **** m_refData = new wxLuaDebugDataRefData; ! // Sanity check to make sure that lua hasn't changed the items on us wxCHECK_RET((WXLUA_DEBUGITEM_TNONE == WXLUA_DEBUGITEM_T_SHIFT + LUA_TNONE) || (WXLUA_DEBUGITEM_TNIL == WXLUA_DEBUGITEM_T_SHIFT + LUA_TNIL) || --- 80,84 ---- m_refData = new wxLuaDebugDataRefData; ! // Sanity check to make sure that Lua hasn't changed the items on us wxCHECK_RET((WXLUA_DEBUGITEM_TNONE == WXLUA_DEBUGITEM_T_SHIFT + LUA_TNONE) || (WXLUA_DEBUGITEM_TNIL == WXLUA_DEBUGITEM_T_SHIFT + LUA_TNIL) || |
From: John L. <jr...@us...> - 2007-08-07 20:23:28
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h wxlstack.h Log Message: Add wxShutdown() Rename lua -> Lua Index: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxldebug.h 25 Jun 2007 16:07:58 -0000 1.38 --- wxldebug.h 7 Aug 2007 20:23:25 -0000 1.39 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: lua and wxLua debugging code // Author: J. Winwood, John Labenski // Created: June 2003 --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// ! // Purpose: Lua and wxLua debugging code // Author: J. Winwood, John Labenski // Created: June 2003 *************** *** 142,146 **** // These functions are static to allow them to be used in other places to ! // give a consistent feel to the display of lua values. // Get a human readable string name of the lua_type(L, index), the --- 142,146 ---- // These functions are static to allow them to be used in other places to ! // give a consistent feel to the display of Lua values. // Get a human readable string name of the lua_type(L, index), the *************** *** 152,158 **** // Convert the number to either "true" or "false" (eg !0 or 0) static wxString MakeBoolean(int num); ! // Get a wxString description about the table at the index in the lua stack static wxString GetTableInfo(const wxLuaState& wxlState, int index); ! // Get a wxString description about user data at the index in the lua stack // if full then try to look up the name of the user data from the bindings static wxString GetUserDataInfo(const wxLuaState& wxlState, int index, bool full = true); --- 152,158 ---- // Convert the number to either "true" or "false" (eg !0 or 0) static wxString MakeBoolean(int num); ! // Get a wxString description about the table at the index in the Lua stack static wxString GetTableInfo(const wxLuaState& wxlState, int index); ! // Get a wxString description about user data at the index in the Lua stack // if full then try to look up the name of the user data from the bindings static wxString GetUserDataInfo(const wxLuaState& wxlState, int index, bool full = true); Index: wxlstack.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxlstack.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wxlstack.h 26 Jul 2007 18:56:39 -0000 1.5 --- wxlstack.h 7 Aug 2007 20:23:25 -0000 1.6 *************** *** 1,5 **** ///////////////////////////////////////////////////////////////////////////// // Name: wxLuaStackTree.h ! // Purpose: Interface to display the lua stack in wxLua // Author: J. Winwood, John Labenski // Created: April 2002 --- 1,5 ---- ///////////////////////////////////////////////////////////////////////////// // Name: wxLuaStackTree.h ! // Purpose: Interface to display the Lua stack in wxLua // Author: J. Winwood, John Labenski // Created: April 2002 |
From: John L. <jr...@us...> - 2007-08-07 20:23:28
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxlua/include Modified Files: wxlbind.h wxlcallb.h wxldefs.h wxlstate.h Log Message: Add wxShutdown() Rename lua -> Lua Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wxlcallb.h 6 Aug 2007 22:00:33 -0000 1.20 --- wxlcallb.h 7 Aug 2007 20:23:25 -0000 1.21 *************** *** 58,67 **** void EventHandler(wxEvent& event); ! // Handle the event by calling the lua function to handle the event. ! // The lua function will receive a single parameter, the type of event. virtual void CallFunction(wxEvent *event); 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; --- 58,67 ---- void EventHandler(wxEvent& event); ! // Handle the event by calling the Lua function to handle the event. ! // The Lua function will receive a single parameter, the type of event. virtual void CallFunction(wxEvent *event); 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; Index: wxldefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxldefs.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** wxldefs.h 1 Aug 2007 19:15:37 -0000 1.32 --- wxldefs.h 7 Aug 2007 20:23:25 -0000 1.33 *************** *** 14,18 **** //----------------------------------------------------------------------------- ! // Include the lua headers //----------------------------------------------------------------------------- --- 14,18 ---- //----------------------------------------------------------------------------- ! // Include the Lua headers //----------------------------------------------------------------------------- Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** wxlbind.h 7 Aug 2007 03:06:12 -0000 1.59 --- wxlbind.h 7 Aug 2007 20:23:25 -0000 1.60 *************** *** 23,37 **** // ---------------------------------------------------------------------------- ! // memory deallocation function for created wxLuaBindClass defined objects, lua's __gc metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L); ! // lua 'set table' function for created wxLuaBindClass defined objects, lua's __newindex metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L); ! // lua 'get table' function for created wxLuaBindClass defined objects, lua's __index metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__index_wxLuaBindClass(lua_State *L); ! // lua 'tostring' function for created wxLuaBindClass defined objects, lua's __tostring metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__tostring_wxLuaBindClass(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); --- 23,37 ---- // ---------------------------------------------------------------------------- ! // memory deallocation function for created wxLuaBindClass defined objects, Lua's __gc metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__gc_wxLuaBindClass(lua_State *L); ! // Lua 'set table' function for created wxLuaBindClass defined objects, Lua's __newindex metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__newindex_wxLuaBindClass(lua_State *L); ! // Lua 'get table' function for created wxLuaBindClass defined objects, Lua's __index metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__index_wxLuaBindClass(lua_State *L); ! // Lua 'tostring' function for created wxLuaBindClass defined objects, Lua's __tostring metatable index WXDLLIMPEXP_WXLUA int LUACALL wxluabind__tostring_wxLuaBindClass(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); *************** *** 42,46 **** // Binding tags are generated as positive tag id automatically when bound ! // so we set the inbuilt lua arg tags to negative values // // note that -1 is use as initialiser for class tags --- 42,46 ---- // Binding tags are generated as positive tag id automatically when bound ! // so we set the inbuilt Lua arg tags to negative values // // note that -1 is use as initialiser for class tags *************** *** 48,52 **** // represents function prototype argument types. ! // wxlua arg tags for common lua types #define WXLUAARG_None 0 #define WXLUAARG_Nil -2 --- 48,52 ---- // represents function prototype argument types. ! // wxlua arg tags for common Lua types #define WXLUAARG_None 0 #define WXLUAARG_Nil -2 *************** *** 74,82 **** // copies of wxlua arg tags for binding types that are used very often ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxLuaFunction; // The lua tag for wxLuaFunctions. ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // The lua tag for NULL pointer ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxEvent; // The lua tag for wxEvents ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxWindow; // The lua tag for wxWindows ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxString; // The lua tag for wxStrings --- 74,82 ---- // copies of wxlua arg tags for binding types that are used very often ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxLuaFunction; // The Lua tag for wxLuaFunctions. ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_NULL; // The Lua tag for NULL pointer ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxEvent; // The Lua tag for wxEvents ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxWindow; // The Lua tag for wxWindows ! extern WXDLLIMPEXP_DATA_WXLUA(int) g_wxluatag_wxString; // The Lua tag for wxStrings *************** *** 114,118 **** 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 // NOTE: there may be less argtags than minargs if this is an // overloaded function since the argtags == s_wxluaargArray_None --- 114,118 ---- 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 // NOTE: there may be less argtags than minargs if this is an // overloaded function since the argtags == s_wxluaargArray_None *************** *** 149,153 **** const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" const wxEventType *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED ! int *class_tag; // lua class tag, e.g. &s_wxluatag_wxCommandEvent }; --- 149,153 ---- const char *name; // name of the event, e.g. "wxEVT_COMMAND_MENU_SELECTED" const wxEventType *eventType; // wxWidgets event type, e.g. &wxEVT_COMMAND_MENU_SELECTED ! int *class_tag; // Lua class tag, e.g. &s_wxluatag_wxCommandEvent }; *************** *** 155,159 **** { const char *name; // the name of the object or pointer ! int *class_tag; // lua class tag of the object or pointer. const void *objPtr; // pointer to the object, e.g. &wxDefaultPosition const void **pObjPtr; // pointer to the object pointer, e.g. (const void **)&wxThePenList --- 155,159 ---- { const char *name; // the name of the object or pointer ! int *class_tag; // Lua class tag of the object or pointer. const void *objPtr; // pointer to the object, e.g. &wxDefaultPosition const void **pObjPtr; // pointer to the object pointer, e.g. (const void **)&wxThePenList *************** *** 166,170 **** int methods_n; // number of methods wxClassInfo *classInfo; // 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. --- 166,170 ---- int methods_n; // number of methods wxClassInfo *classInfo; // 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. *************** *** 198,204 **** // Garbage collect and free memory associated with the wxLuaFunction class ! // lua's __gc metatable function. int LUACALL wxlua__gc_wxLuaFunction(lua_State *L); ! // call a wxLuaFunction, lua's __call metatable function. int LUACALL wxlua__call_wxLuaFunction(lua_State *L); --- 198,204 ---- // Garbage collect and free memory associated with the wxLuaFunction class ! // Lua's __gc metatable function. int LUACALL wxlua__gc_wxLuaFunction(lua_State *L); ! // call a wxLuaFunction, Lua's __call metatable function. int LUACALL wxlua__call_wxLuaFunction(lua_State *L); *************** *** 369,373 **** void SetBindingName(const wxString& name) { m_bindingName = name; } ! // Get/Set the namespace table in lua that this binding will be installed to wxString GetLuaNamespace() const { return m_nameSpace; } void SetLuaNamespace(const wxString& nameSpace) { m_nameSpace = nameSpace; } --- 369,373 ---- void SetBindingName(const wxString& name) { m_bindingName = name; } ! // Get/Set the namespace table in Lua that this binding will be installed to wxString GetLuaNamespace() const { return m_nameSpace; } void SetLuaNamespace(const wxString& nameSpace) { m_nameSpace = nameSpace; } *************** *** 417,429 **** // ----------------------------------------------------------------------- ! // Lookup a lua method or get property called methodName in the wxLuaBindClass array wxlClass. // Ensure that the lookup is of WXLUAMETHOD_METHOD|WXLUAMETHOD_GETPROP type. ! // If the lua method cannot 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; static wxLuaBindMethod* GetClassMethod(const wxLuaBindClass *wxlClass, const char *methodName, bool search_baseclasses = true); ! // Lookup a lua property function named propName in the wxLuaBindClass wxlClass // Ensure that the lookup is of WXLUAMETHOD_GETPROP|WXLUAMETHOD_SETPROP type. ! // If the lua property cannot 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; --- 417,429 ---- // ----------------------------------------------------------------------- ! // Lookup a Lua method or get property called methodName in the wxLuaBindClass array wxlClass. // Ensure that the lookup is of WXLUAMETHOD_METHOD|WXLUAMETHOD_GETPROP type. ! // If the Lua method cannot 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; static wxLuaBindMethod* GetClassMethod(const wxLuaBindClass *wxlClass, const char *methodName, bool search_baseclasses = true); ! // Lookup a Lua property function named propName in the wxLuaBindClass wxlClass // Ensure that the lookup is of WXLUAMETHOD_GETPROP|WXLUAMETHOD_SETPROP type. ! // If the Lua property cannot 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; *************** *** 441,445 **** // 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 --- 441,445 ---- // 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 *************** *** 465,473 **** wxString m_bindingName; // A unique name of the binding ! wxString m_nameSpace; // lua table namespace e.g. "wx" bool m_bindings_registered; // Is the binding registered ! int m_start_tag; // The first wxLua allocated lua tag ! int m_last_tag; // The last wxLua lua tag of registered classes ! int m_luaTable_tag; // The lua tag for the wxLua private tables static wxLuaBindingList sm_bindingList; --- 465,473 ---- wxString m_bindingName; // A unique name of the binding ! wxString m_nameSpace; // Lua table namespace e.g. "wx" bool m_bindings_registered; // Is the binding registered ! int m_start_tag; // The first wxLua allocated Lua tag ! int m_last_tag; // The last wxLua Lua tag of registered classes ! int m_luaTable_tag; // The Lua tag for the wxLua private tables static wxLuaBindingList sm_bindingList; Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** wxlstate.h 3 Aug 2007 22:17:16 -0000 1.90 --- wxlstate.h 7 Aug 2007 20:23:25 -0000 1.91 *************** *** 1,4 **** ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to lua // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 --- 1,4 ---- ///////////////////////////////////////////////////////////////////////////// ! // Purpose: wxWidgets interface to Lua // Author: Ray Gilbert, John Labenski, J Winwood // Created: 14/11/2001 *************** *** 69,75 **** // ---------------------------------------------------------------------------- ! // Push a special key into lua, defines to make sure it's always done the same. // ! // Note we do not push a human readable string for these because lua always makes // a copy of the string and the copying takes a considerable amount of time // when benchmarked using valgrind. --- 69,75 ---- // ---------------------------------------------------------------------------- ! // Push a special key into Lua, defines to make sure it's always done the same. // ! // Note we do not push a human readable string for these because Lua always makes // a copy of the string and the copying takes a considerable amount of time // when benchmarked using valgrind. *************** *** 85,89 **** #define WXLUA_METATABLE_CLASS 9 ! // Light user data used as keys in the lua registry table for wxLua items. // Note that even though these have values, they're not used, just the memory address. extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_references_key; // WXLUA_LREG_REFERENCES --- 85,89 ---- #define WXLUA_METATABLE_CLASS 9 ! // Light user data used as keys in the Lua LUA_REGISTRYINDEX table for wxLua items. // Note that even though these have values, they're not used, just the memory address. extern WXDLLIMPEXP_DATA_WXLUA(int) wxlua_lreg_references_key; // WXLUA_LREG_REFERENCES *************** *** 107,135 **** #define wxlua_pushkey_wxLuaClasses(L) lua_pushlightuserdata(L, &wxlua_lreg_classes_key) // Push a key that is an index in the LUA_REGISTRYINDEX table that is a table ! // t[lightuserdata object] = {["derived func/value name"] = wxLuaObject(lua function/value), ...} #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) ! // Push a key that is an index of the LUA_REGISTRYINDEX table that is a lightuserdata of the ! // wxLuaStateRefData for this lua_State. #define wxlua_pushkey_wxLuaStateRefData(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastaterefdata_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into lua using [lightuserdata] = tag #define wxlua_pushkey_wxLuaObjects(L) lua_pushlightuserdata(L, &wxlua_lreg_objects_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is boolean value ! // of whether the lua code has prepended a '_' to indicate they want the base class function called. #define wxlua_pushkey_CallBaseClassFunc(L) lua_pushlightuserdata(L, &wxlua_lreg_callbaseclassfunc_key) ! // Push a key of an index into the metatable of a wxLua userdata for the "tag" ! // in the wxLuaReferences table. #define wxlua_pushkey_metatableTag(L) lua_pushlightuserdata(L, &wxlua_lreg_metatable_tag_key) ! // Push a key of an index into the metatable of a wxLua userdata for the wxLuaBindClass ! // in the wxLuaReferences table. #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 // and you are recommended to use those if the wxLuaState is required. However // in some cases it may not be necessary to create a wxLuaState and just --- 107,136 ---- #define wxlua_pushkey_wxLuaClasses(L) lua_pushlightuserdata(L, &wxlua_lreg_classes_key) // Push a key that is an index in the LUA_REGISTRYINDEX table that is a table ! // of Lua functions assigned to wxLua userdata programatically in Lua. ! // t[lightuserdata object] = {["derived func/value name"] = wxLuaObject(Lua function/value), ...} #define wxlua_pushkey_wxLuaDerivedMethods(L) lua_pushlightuserdata(L, &wxlua_lreg_derivedmethods_key) ! // Push a key that is an index of the LUA_REGISTRYINDEX table who's value is a ! // lightuserdata of the wxLuaStateRefData for this lua_State. #define wxlua_pushkey_wxLuaStateRefData(L) lua_pushlightuserdata(L, &wxlua_lreg_wxluastaterefdata_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is table of all ! // objects that we've pushed into Lua using t[lightuserdata] = [weak valued full userdata] #define wxlua_pushkey_wxLuaObjects(L) lua_pushlightuserdata(L, &wxlua_lreg_objects_key) // Push a key that is an index of the LUA_REGISTRYINDEX table that is boolean value ! // of whether the Lua code has prepended a '_' to function name to indicate ! // that they want the base class function called. #define wxlua_pushkey_CallBaseClassFunc(L) lua_pushlightuserdata(L, &wxlua_lreg_callbaseclassfunc_key) ! // Push a key of an index into the metatable of a wxLua userdata for the "tag" number. #define wxlua_pushkey_metatableTag(L) lua_pushlightuserdata(L, &wxlua_lreg_metatable_tag_key) ! // Push a key of an index into the metatable of a wxLua userdata for the ! // lightuserdata of the wxLuaBindClass struct. #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 // and you are recommended to use those if the wxLuaState is required. However // in some cases it may not be necessary to create a wxLuaState and just *************** *** 171,176 **** // 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 userdata pointer ! // in lua to NULL so that lua won't gc 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 --- 172,177 ---- // 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 *************** *** 180,190 **** // 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. 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 class WXDLLIMPEXP_WXLUA bool LUACALL wxlua_tsettagmethod(lua_State* L, int tag, const char* method, lua_CFunction func, void* pClass = NULL); --- 181,191 ---- // 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); *************** *** 194,206 **** // ---------------------------------------------------------------------------- ! // 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 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. --- 195,207 ---- // ---------------------------------------------------------------------------- ! // 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 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. *************** *** 215,219 **** // Note that this function does not do a direct mapping between wxlua_getwxluatype() // and wxlua_getluatype() since it allows a small amount of coersion between types. ! // It also doesn't account for the automatic conversion of certain lua types // to wxluatypes, (wxString, wxArrayString, wxArrayInt) // see wxLuaState::IswxLuaType which is more complete. --- 216,220 ---- // Note that this function does not do a direct mapping between wxlua_getwxluatype() // and wxlua_getluatype() since it allows a small amount of coersion between types. ! // It also doesn't account for the automatic conversion of certain Lua types // to wxluatypes, (wxString, wxArrayString, wxArrayInt) // see wxLuaState::IswxLuaType which is more complete. *************** *** 229,233 **** WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); ! // Is this data a userdata object that wxLua has pushed into lua? // This should be the same as // (lua_isuserdata(L, stack_idx) && !lua_islightuserdata(L, stack_idx)) --- 230,234 ---- WXDLLIMPEXP_WXLUA int wxlua_getluatype(int wxluatype); ! // Is this data a userdata object that wxLua has pushed into Lua? // This should be the same as // (lua_isuserdata(L, stack_idx) && !lua_islightuserdata(L, stack_idx)) *************** *** 237,243 **** // These validate that the object at the stack index specified is a string, bool, // int, or double number object or that the object can be converted to it. ! // Note: wxLua has a stricter sense of type than lua and we don't want to // always allow coersion between types since oftentimes there's an error. ! // Note: The wxLuaState::IsStringType function takes both a lua string and a wxString // userdata as valid strings. #define wxlua_isstringtype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_String) == 1) --- 238,244 ---- // These validate that the object at the stack index specified is a string, bool, // int, or double number object or that the object can be converted to it. ! // Note: wxLua has a stricter sense of type than Lua and we don't want to // always allow coersion between types since oftentimes there's an error. ! // Note: The wxLuaState::IsStringType function takes both a Lua string and a wxString // userdata as valid strings. #define wxlua_isstringtype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUAARG_String) == 1) *************** *** 247,254 **** // After verifying using wxlua_isXXXtype return the value, else call ! // wxlua_terror with a message that's 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 ! // of both a lua string and a userdata wxString to a wxString. WXDLLIMPEXP_WXLUA const char* LUACALL wxlua_getstringtype(lua_State* L, int stack_idx); WXDLLIMPEXP_WXLUA bool LUACALL wxlua_getbooleantype(lua_State* L, int stack_idx); --- 248,255 ---- // 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 ! // of both a Lua string and a userdata wxString to a wxString. WXDLLIMPEXP_WXLUA const char* LUACALL wxlua_getstringtype(lua_State* L, int stack_idx); WXDLLIMPEXP_WXLUA bool LUACALL wxlua_getbooleantype(lua_State* L, int stack_idx); *************** *** 264,268 **** // Convert the table at stack index to a "new" array of const char* strings. // Return a pointer to the array of strings. You need to delete the array, but not ! // the individual strings since lua should still have them during the life of the // returned array, if not you will need to copy them. // returns the number of character strings in the array in count. --- 265,269 ---- // Convert the table at stack index to a "new" array of const char* strings. // Return a pointer to the array of strings. You need to delete the array, but not ! // the individual strings since Lua should still have them during the life of the // returned array, if not you will need to copy them. // returns the number of character strings in the array in count. *************** *** 270,277 **** WXDLLIMPEXP_WXLUA const char** LUACALL wxlua_getchararray(lua_State* L, int stack_idx, int& count); ! // Creates a lua table and pushes the strings into it, returns the number of items added // The table is left on the stack WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayStringtable(lua_State* L, const wxArrayString& strArray); ! // Creates a lua table and pushes the ints into it, returns the number of items added // The table is left on the stack WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayInttable(lua_State* L, const wxArrayInt& intArray); --- 271,278 ---- WXDLLIMPEXP_WXLUA const char** LUACALL wxlua_getchararray(lua_State* L, int stack_idx, int& count); ! // Creates a Lua table and pushes the strings into it, returns the number of items added // The table is left on the stack WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayStringtable(lua_State* L, const wxArrayString& strArray); ! // Creates a Lua table and pushes the ints into it, returns the number of items added // The table is left on the stack WXDLLIMPEXP_WXLUA int LUACALL wxlua_pushwxArrayInttable(lua_State* L, const wxArrayInt& intArray); *************** *** 281,291 **** //---------------------------------------------------------------------------- ! // Add this derived method, a lua function or value the user has set to a // wxLua userdata object that we will push onto the stack when they access // the index of the object with the "method_name". The pObject is the ! // userdata and the new wxLuaObject wraps the lua function or value // which will be deleted by this. // The derived methods are stored in the "wxLuaDerivedMethods" table in the ! // lua registry table. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. --- 282,292 ---- //---------------------------------------------------------------------------- ! // Add this derived method, a Lua function or value the user has set to a // wxLua userdata object that we will push onto the stack when they access // the index of the object with the "method_name". The pObject is the ! // userdata and the new wxLuaObject wraps the Lua function or value // which will be deleted by this. // The derived methods are stored in the "wxLuaDerivedMethods" table in the ! // Lua registry table. WXDLLIMPEXP_WXLUA bool LUACALL wxlua_setderivedmethod(lua_State* L, void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. *************** *** 307,310 **** --- 308,313 ---- // wxLuaStateData - the internal data for the wxLuaState. // All members of this class should be accessed through the wxLuaState. + // It is public only for people who need to get at the internals, there are + // absolutely no guarantees that things won't change. //---------------------------------------------------------------------------- *************** *** 315,320 **** ~wxLuaStateData(); ! wxLuaBindingList m_bindingList; // A wxList of generated lua bindings ! // that are loaded into lua on startup bool m_bindings_registered; // Are the bindings registered into the lua_State --- 318,323 ---- ~wxLuaStateData(); ! wxLuaBindingList m_bindingList; // A wxList of generated Lua bindings ! // that are loaded into Lua on startup bool m_bindings_registered; // Are the bindings registered into the lua_State *************** *** 322,332 **** wxLongToLongHashMap m_trackedObjects; // tracked wxObjects that we will delete when the ! // wxLuaState is closed or lua gc them. // key is (long)object* and value is the wxObject // Note that non wxObject classes use // wxLUA_DECLARE_ENCAPSULATION so the key is the object pointer // and the value is the wxObject encapsulation. ! wxList m_callbackList; // event objects for wxLuaCallback ! wxList m_winDestroyCallbackList; // wxLuaWinDestroyCallback installed wxWindowList m_windowList; // all wxWindow objects, wxWidgets will delete these // but for an embedded program they must be deleted before --- 325,335 ---- wxLongToLongHashMap m_trackedObjects; // tracked wxObjects that we will delete when the ! // wxLuaState is closed or Lua gc them. // key is (long)object* and value is the wxObject // Note that non wxObject classes use // wxLUA_DECLARE_ENCAPSULATION so the key is the object pointer // and the value is the wxObject encapsulation. ! wxList m_callbackList; // installed wxLuaCallbacks ! wxList m_winDestroyCallbackList; // installed wxLuaWinDestroyCallbacks wxWindowList m_windowList; // all wxWindow objects, wxWidgets will delete these // but for an embedded program they must be deleted before *************** *** 375,379 **** // ------------------------------------------------------------------------ ! lua_State* m_lua_State; // the lua_State that "is" lua bool m_lua_State_static; // lua_close() the lua_State if !static bool m_lua_State_coroutine; // this is a coroutine, don't close it --- 378,382 ---- // ------------------------------------------------------------------------ ! lua_State* m_lua_State; // the lua_State that "is" Lua bool m_lua_State_static; // lua_close() the lua_State if !static bool m_lua_State_coroutine; // this is a coroutine, don't close it *************** *** 392,396 **** //---------------------------------------------------------------------------- ! // wxLuaState - a ref counted class to interface between C++ and lua's C lua_State //---------------------------------------------------------------------------- --- 395,399 ---- //---------------------------------------------------------------------------- ! // wxLuaState - a ref counted class to interface between C++ and Lua's C lua_State //---------------------------------------------------------------------------- *************** *** 411,418 **** // Default constructor or if create=true then create a new lua_State // and add all the bindings in wxLuaBinding::GetBindingList() ! wxLuaState(bool create = false) : wxObject() { if (create) Create(); } // Create a new lua_State, add the bindings in wxLuaBinding::GetBindingList() // sets the wxEvtHandler and wxWindowID to send the wxLuaEvents to ! wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) : wxObject() { Create(handler, id); } // Create a wxLuaState from an existing lua_State wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } --- 414,421 ---- // Default constructor or if create=true then create a new lua_State // and add all the bindings in wxLuaBinding::GetBindingList() ! wxLuaState(bool create = false) { if (create) Create(); } // Create a new lua_State, add the bindings in wxLuaBinding::GetBindingList() // sets the wxEvtHandler and wxWindowID to send the wxLuaEvents to ! wxLuaState(wxEvtHandler *handler, wxWindowID id = wxID_ANY) { Create(handler, id); } // Create a wxLuaState from an existing lua_State wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } *************** *** 437,449 **** bool Create(wxLuaStateRefData* refData, lua_State* L); // Is this wxLuaState valid, has refed data and it's lua_State is created bool Ok() const; ! // Destroy the refed data (only closes lua if this is the last refed state) ! // Note: if you have a top level window (wxFrame) open in lua and exit the // C++ program your program will seem to "hang" because wxApp doesn't // exit with a top level window open. Call CloseLuaState(true) to ensure // all non parented (top level) windows are destroyed. ! // You must always call CloseLuaState() when you want to close lua instead // of hoping that when you call Destroy() you have the last refed instance. void Destroy(); --- 440,456 ---- bool Create(wxLuaStateRefData* refData, lua_State* L); + // ----------------------------------------------------------------------- + // Is this wxLuaState valid, has refed data and it's lua_State is created bool Ok() const; ! // ----------------------------------------------------------------------- ! ! // Destroy the refed data (only closes Lua if this is the last refed state) ! // Note: if you have a top level window (wxFrame) open in Lua and exit the // C++ program your program will seem to "hang" because wxApp doesn't // exit with a top level window open. Call CloseLuaState(true) to ensure // all non parented (top level) windows are destroyed. ! // You must always call CloseLuaState() when you want to close Lua instead // of hoping that when you call Destroy() you have the last refed instance. void Destroy(); *************** *** 452,459 **** bool CloseLuaState(bool force); // Are we currently being closed, the garbage collector is running, but ! // we don't care about cleaning up lua itself so just delete the data // (internal use) bool IsClosing() const; // Get the lua_State lua_State* GetLuaState() const; --- 459,468 ---- bool CloseLuaState(bool force); // Are we currently being closed, the garbage collector is running, but ! // we don't care about cleaning up Lua itself so just delete the data // (internal use) bool IsClosing() const; + // ----------------------------------------------------------------------- + // Get the lua_State lua_State* GetLuaState() const; *************** *** 463,470 **** wxLuaStateData* GetLuaStateData() const; ! // Get the wxEventType that lua may currently be in, wxEVT_NULL if not in an ! // event handler. Be careful about destroying lua when in an event handler. wxEventType GetInEventType() const; ! // Set the wxEventType that the lua code is currently running (internal use) void SetInEventType(wxEventType eventType); --- 472,481 ---- wxLuaStateData* GetLuaStateData() const; ! // ----------------------------------------------------------------------- ! ! // Get the wxEventType that Lua may currently be in, wxEVT_NULL if not in an ! // event handler. Be careful about destroying Lua when in an event handler. wxEventType GetInEventType() const; ! // Set the wxEventType that the Lua code is currently running (internal use) void SetInEventType(wxEventType eventType); *************** *** 475,479 **** void SetEventHandler(wxEvtHandler *evtHandler); wxEvtHandler *GetEventHandler() const; ! // Get/Set the wxWindowID that the wxLuaEvents will be sent with void SetId(wxWindowID id); wxWindowID GetId() const; --- 486,490 ---- void SetEventHandler(wxEvtHandler *evtHandler); wxEvtHandler *GetEventHandler() const; ! // Get/Set the wxWindowID that the wxLuaEvents will be sent with. void SetId(wxWindowID id); wxWindowID GetId() const; *************** *** 485,494 **** // ----------------------------------------------------------------------- ! // Run a lua file from disk using lua_loadfile, returns lua's error code int RunFile(const wxString &fileName); ! // Run a string that contains lua code using luaL_loadbuffer, returns lua's error code int RunString(const wxString &script, const wxString& name = wxEmptyString); // Run a char array #included from bin2c compilation or something else ! // using luaL_loadbuffer, returns lua's error code int RunBuffer(const unsigned char buf[], size_t size, const wxString &name = wxT("= lua")); --- 496,505 ---- // ----------------------------------------------------------------------- ! // Run a Lua file from disk using lua_loadfile, returns Lua's error code int RunFile(const wxString &fileName); ! // Run a string that contains Lua code using luaL_loadbuffer, returns Lua's error code int RunString(const wxString &script, const wxString& name = wxEmptyString); // Run a char array #included from bin2c compilation or something else ! // using luaL_loadbuffer, returns Lua's error code int RunBuffer(const unsigned char buf[], size_t size, const wxString &name = wxT("= lua")); *************** *** 498,502 **** // Replacement for lua_pcall that sends a wxEVT_LUA_ERROR on error // narg is the number of args to the function to call. ! // nresults is the number of values returned which lua will adjust to match // use LUA_MULTRET for nresults to leave all of them on the stack int LuaPCall(int narg, int nresults); --- 509,513 ---- // Replacement for lua_pcall that sends a wxEVT_LUA_ERROR on error // narg is the number of args to the function to call. ! // nresults is the number of values returned which Lua will adjust to match // use LUA_MULTRET for nresults to leave all of them on the stack int LuaPCall(int narg, int nresults); *************** *** 505,509 **** int LuaDoBuffer(const char *buffer, size_t len, const char *name) { return RunBuffer((const unsigned char*)buffer, len, lua2wx(name)); } ! // Try to compile the lua program. Creates new lua_State to test for syntax // errors and sends error events. See LuaError() for errMsg and line_num. int CompileString(const wxString &script, const wxString& name = wxEmptyString, --- 516,520 ---- int LuaDoBuffer(const char *buffer, size_t len, const char *name) { return RunBuffer((const unsigned char*)buffer, len, lua2wx(name)); } ! // Try to compile the Lua program. Creates new lua_State to test for syntax // errors and sends error events. See LuaError() for errMsg and line_num. int CompileString(const wxString &script, const wxString& name = wxEmptyString, *************** *** 512,516 **** wxString* errMsg_ = NULL, int* line_num = NULL); ! // checks the status with CheckRunError and tries to get lua's error string // from the top of the stack and sends a wxEVT_LUA_ERROR. // If the lua_State is NULL then use the internal one from this class. --- 523,527 ---- wxString* errMsg_ = NULL, int* line_num = NULL); ! // checks the status with CheckRunError and tries to get Lua's error string // from the top of the stack and sends a wxEVT_LUA_ERROR. // If the lua_State is NULL then use the internal one from this class. *************** *** 525,529 **** static bool CheckRunError(int status, wxString *msg); ! // 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 --- 536,542 ---- static bool CheckRunError(int status, wxString *msg); ! // ----------------------------------------------------------------------- ! ! // 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 *************** *** 537,543 **** wxString GetDebugHookBreakMessage() const; ! // ----------------------------------------------------------------------- ! ! // Have lua run an internal hook function with this mask // hook = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT // Every count hook mask a wxEVT_LUA_DEBUG_HOOK event is sent if send_debug_evt --- 550,554 ---- wxString GetDebugHookBreakMessage() const; ! // Have Lua run an internal hook function with this mask // hook = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT // Every count hook mask a wxEVT_LUA_DEBUG_HOOK event is sent if send_debug_evt *************** *** 554,558 **** // Internally updated time that the debug hook was last called when running ! // lua code and SetLuaDebugHook is turned on unsigned long GetLastLuaDebugHookTime() const; // Set to an arbitrary time to control debug timing --- 565,569 ---- // Internally updated time that the debug hook was last called when running ! // Lua code and SetLuaDebugHook is turned on unsigned long GetLastLuaDebugHookTime() const; // Set to an arbitrary time to control debug timing *************** *** 573,577 **** 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; --- 584,588 ---- 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; *************** *** 593,597 **** // Get the binding list used to initialize this class ! // you may add or remove bindings before creation wxLuaBindingList* GetLuaBindingList() const; --- 604,609 ---- // Get the binding list used to initialize this class ! // you may add or remove bindings before creation, but not that ! // all wxLuaStates must have the same bindings in the same order! wxLuaBindingList* GetLuaBindingList() const; *************** *** 599,603 **** // When looking up a function to call, should the base class function ! // be called or the wxlua dervived method (internal use) void SetCallBaseClassFunction(bool call_base); bool GetCallBaseClassFunction(); --- 611,615 ---- // When looking up a function to call, should the base class function ! // be called or the wxLua dervived method (internal use) void SetCallBaseClassFunction(bool call_base); bool GetCallBaseClassFunction(); *************** *** 610,622 **** UNDELETE_OBJECT = 0, // stop tracking for deletion (someone else owns this) DELETE_OBJECT = 0x0001, // delete the object ! CLEAR_TRACKED_OBJECT = 0x0002, // clear tracking the object in lua reg table ! CLEAR_DERIVED_METHODS = 0x0004, // clear any derived methods in lua reg table DELETE_CLEAR_OBJECT = DELETE_OBJECT|CLEAR_TRACKED_OBJECT|CLEAR_DERIVED_METHODS }; ! // Track this object and delete it when lua calls the gc method for it void AddTrackedObject(wxObject *pObject); // Track this object, but hash it on the obj_ptr which may differ from the ! // pObject and delete it when lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. void AddTrackedObject(long obj_ptr, wxObject *pObject); --- 622,634 ---- UNDELETE_OBJECT = 0, // stop tracking for deletion (someone else owns this) DELETE_OBJECT = 0x0001, // delete the object ! CLEAR_TRACKED_OBJECT = 0x0002, // clear tracking the object in Lua reg table ! CLEAR_DERIVED_METHODS = 0x0004, // clear any derived methods in Lua reg table DELETE_CLEAR_OBJECT = DELETE_OBJECT|CLEAR_TRACKED_OBJECT|CLEAR_DERIVED_METHODS }; ! // Track this object and delete it when Lua calls the gc method for it void AddTrackedObject(wxObject *pObject); // Track this object, but hash it on the obj_ptr which may differ from the ! // pObject and delete it when Lua calls the gc method for it. // This is used for encapsulated classes that are wrapped in a wxObject. void AddTrackedObject(long obj_ptr, wxObject *pObject); *************** *** 626,629 **** --- 638,643 ---- // Is this object currently tracked? bool IsTrackedObject(void *pObject) const; + // The the hashtable of [long object pointer] = [long wxObject (container) pointer] + // The key = value for wxObject derived classes, but are different for non wxObject classes. wxLongToLongHashMap* GetTrackedObjects(); // Get an array of strings "wxObject_classname count#" *************** *** 663,667 **** // ----------------------------------------------------------------------- ! // wxLua lua Registry Table Functions // Create a reference to the object at stack index in the --- 677,681 ---- // ----------------------------------------------------------------------- ! // wxLua Lua Registry Table Functions // Create a reference to the object at stack index in the *************** *** 688,692 **** 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 --- 702,706 ---- 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 *************** *** 712,716 **** // and wxlua_getluatype() since it allows a small amount of coersion between types. int IswxLuaType(int luatype, int wxluaarg_tag) const; ! // Check if the item at the lua stack index is user data type tag bool IsUserDataType(int stack_idx, int tag) const; // Return a pointer to the object that corresponds to the specified stack --- 726,730 ---- // and wxlua_getluatype() since it allows a small amount of coersion between types. int IswxLuaType(int luatype, int wxluaarg_tag) const; ! // Check if the item at the Lua stack index is user data type tag bool IsUserDataType(int stack_idx, int tag) const; // Return a pointer to the object that corresponds to the specified stack *************** *** 730,734 **** const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be ! // either a lua string or a wxString userdata. wxString GetwxStringType(int stack_idx); // Validate that the object at the stack index specified is a boolean object --- 744,748 ---- const char* GetStringType(int stack_idx); // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be ! // either a Lua string or a wxString userdata. wxString GetwxStringType(int stack_idx); // Validate that the object at the stack index specified is a boolean object *************** *** 745,750 **** double GetNumberType(int stack_idx); ! // Checks for if the item at the stack index is one of the types or can ! // be converted into the type by lua, returns false if not (no errors) bool IsStringType(int stack_idx) const; bool IsBooleanType(int stack_idx) const; --- 759,764 ---- double GetNumberType(int stack_idx); ! // Checks if the item at the stack index is one of the types or can ! // be converted into the type by Lua, returns false if not (no errors) bool IsStringType(int stack_idx) const; bool IsBooleanType(int stack_idx) const; *************** *** 785,789 **** // ----------------------------------------------------------------------- ! // Returns the 'name' of a lua userdata object from its tag. // Also handles predefined wxLua arg tags, see wxlua_getwxluatypename // returns wxEmptyString on failure. --- 799,803 ---- // ----------------------------------------------------------------------- ! // Returns the 'name' of a Lua userdata object from its tag. // Also handles predefined wxLua arg tags, see wxlua_getwxluatypename // returns wxEmptyString on failure. *************** *** 792,802 **** // ----------------------------------------------------------------------- ! // Add this derived method, a lua function or value the user has set to a // wxLua userdata object that we will push onto the stack when they access // the index of the object with the "method_name". The pObject is the ! // userdata and the new wxLuaObject wraps the lua function or value // which will be deleted by this. // The derived methods are stored in the "wxLuaDerivedMethods" table in the ! // lua registry table. bool SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. --- 806,816 ---- // ----------------------------------------------------------------------- ! // Add this derived method, a Lua function or value the user has set to a // wxLua userdata object that we will push onto the stack when they access // the index of the object with the "method_name". The pObject is the ! // userdata and the new wxLuaObject wraps the Lua function or value // which will be deleted by this. // The derived methods are stored in the "wxLuaDerivedMethods" table in the ! // Lua registry table. bool SetDerivedMethod(void *pObject, const char *method_name, wxLuaObject* wxlObj); // Is there a derived method given an object and and a method name. *************** *** 820,824 **** // The function names have been capitalized to allow case sensitive searching // ----------------------------------------------------------------------- ! // Raw basic lua stack functions, lua.h int lua_GetTop() const; --- 834,838 ---- // The function names have been capitalized to allow case sensitive searching // ----------------------------------------------------------------------- ! // Raw basic Lua stack functions, lua.h int lua_GetTop() const; *************** *** 833,837 **** // ----------------------------------------------------------------------- ! // Raw lua accesses functions (stack -> C), lua.h bool lua_IsNumber(int index) const; --- 847,851 ---- // ----------------------------------------------------------------------- ! // Raw Lua accesses functions (stack -> C), lua.h bool lua_IsNumber(int index) const; *************** *** 859,863 **** // ----------------------------------------------------------------------- ! // Raw lua push functions (C -> stack), lua.h void lua_PushNil(); --- 873,877 ---- // ----------------------------------------------------------------------- ! // Raw Lua push functions (C -> stack), lua.h void lua_PushNil(); *************** *** 875,879 **** // ----------------------------------------------------------------------- ! // Raw lua get functions (Lua -> stack), lua.h void lua_GetTable(int idx); --- 889,893 ---- // ----------------------------------------------------------------------- ! // Raw Lua get functions (Lua -> stack), lua.h void lua_GetTable(int idx); *************** *** 889,893 **** // ----------------------------------------------------------------------- ! // Raw lua set functions (stack -> Lua), lua.h void lua_SetTable(int idx); --- 903,907 ---- // ----------------------------------------------------------------------- ! // Raw Lua set functions (stack -> Lua), lua.h void lua_SetTable(int idx); *************** *** 900,904 **** // ----------------------------------------------------------------------- ! // Raw lua `load' and `call' functions (load and run Lua code), lua.h void lua_Call(int nargs, int nresults); --- 914,918 ---- // ----------------------------------------------------------------------- ! // Raw Lua `load' and `call' functions (load and run Lua code), lua.h void lua_Call(int nargs, int nresults); *************** *** 911,915 **** // ----------------------------------------------------------------------- ! // Raw lua coroutine functions, lua.h int lua_Yield(int nresults); --- 925,929 ---- // ----------------------------------------------------------------------- ! // Raw Lua coroutine functions, lua.h int lua_Yield(int nresults); *************** *** 918,927 **** // ----------------------------------------------------------------------- ! // Raw lua garbage-collection functions, lua.h int lua_GetGCCount(); // ----------------------------------------------------------------------- ! // Raw lua miscellaneous functions, lua.h wxString lua_Version() const; --- 93... [truncated message content] |
From: John L. <jr...@us...> - 2007-08-07 20:23:28
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/bindings/wxwidgets Modified Files: wx_datatypes.lua wxcore_defsutils.i Log Message: Add wxShutdown() Rename lua -> Lua Index: wx_datatypes.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wx_datatypes.lua,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** wx_datatypes.lua 6 Aug 2007 01:46:32 -0000 1.84 --- wx_datatypes.lua 7 Aug 2007 20:23:25 -0000 1.85 *************** *** 3356,3359 **** --- 3356,3364 ---- Name = "wxShowEvent", }, + wxShutdownFlags = { + DefType = "enum", + IsNumber = true, + Name = "wxShutdownFlags", + }, wxSignal = { Condition = "wxLUA_USE_wxProcess", Index: wxcore_defsutils.i =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_defsutils.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxcore_defsutils.i 1 Aug 2007 03:21:23 -0000 1.2 --- wxcore_defsutils.i 7 Aug 2007 20:23:25 -0000 1.3 *************** *** 115,121 **** %function bool wxShell(const wxString& command = "") ! //%define wxSHUTDOWN_POWEROFF ! //%define wxSHUTDOWN_REBOOT ! //%function bool wxShutdown(wxShutdownFlags flags) // --------------------------------------------------------------------------- --- 115,125 ---- %function bool wxShell(const wxString& command = "") ! ! %enum wxShutdownFlags ! wxSHUTDOWN_POWEROFF ! wxSHUTDOWN_REBOOT ! %endenum ! ! %function bool wxShutdown(wxShutdownFlags flags) // --------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-08-07 20:23:28
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22233/wxLua/modules/wxbind/src Modified Files: wxcore_bind.cpp Log Message: Add wxShutdown() Rename lua -> Lua Index: wxcore_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxcore_bind.cpp 1 Aug 2007 03:21:24 -0000 1.3 --- wxcore_bind.cpp 7 Aug 2007 20:23:25 -0000 1.4 *************** *** 2052,2055 **** --- 2052,2057 ---- { "wxSHRINK", wxSHRINK }, + { "wxSHUTDOWN_POWEROFF", wxSHUTDOWN_POWEROFF }, + { "wxSHUTDOWN_REBOOT", wxSHUTDOWN_REBOOT }, #if wxLUA_USE_wxProcess *************** *** 4031,4034 **** --- 4033,4052 ---- static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxShell[1] = {{ wxLua_function_wxShell, WXLUAMETHOD_CFUNCTION, 0, 1, s_wxluatagArray_wxLua_function_wxShell }}; + static wxLuaArgTag s_wxluatagArray_wxLua_function_wxShutdown[] = { &s_wxluaarg_Integer, NULL }; + // %function bool wxShutdown(wxShutdownFlags flags) + static int LUACALL wxLua_function_wxShutdown(lua_State *L) + { + bool returns; + // wxShutdownFlags flags + wxShutdownFlags flags = (wxShutdownFlags)wxlua_getintegertype(L, 1); + // call wxShutdown + returns = (wxShutdown(flags)); + // push the result flag + lua_pushboolean(L, returns); + + return 1; + } + static wxLuaBindCFunc s_wxluafunc_wxLua_function_wxShutdown[1] = {{ wxLua_function_wxShutdown, WXLUAMETHOD_CFUNCTION, 1, 1, s_wxluatagArray_wxLua_function_wxShutdown }}; + // %function void wxWakeUpIdle() static int LUACALL wxLua_function_wxWakeUpIdle(lua_State *L) *************** *** 4210,4213 **** --- 4228,4232 ---- { "wxShell", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxShell, 1, NULL }, + { "wxShutdown", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxShutdown, 1, NULL }, { "wxWakeUpIdle", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxWakeUpIdle, 1, NULL }, { "wxYield", WXLUAMETHOD_CFUNCTION, s_wxluafunc_wxLua_function_wxYield, 1, NULL }, |
From: John L. <jr...@us...> - 2007-08-07 19:09:58
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24789/wxLua/docs Modified Files: FAQ.html Log Message: Fix typos Index: FAQ.html =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/FAQ.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FAQ.html 1 Jul 2007 02:23:53 -0000 1.4 --- FAQ.html 7 Aug 2007 19:09:55 -0000 1.5 *************** *** 1,5 **** <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <html> ! <head> --- 1,4 ---- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <html><head> *************** *** 11,18 **** ! <title>wxLua FAQ</title> ! <meta content="John Labenski" name="author"> ! </head> ! <body> --- 10,15 ---- ! ! <title>wxLua FAQ</title><meta content="John Labenski" name="author"></head> <body> *************** *** 259,263 **** ! <li>However, you can also use a wxString is you really want.</li> --- 256,260 ---- ! <li>However, you can also use a wxString if you really want.</li> *************** *** 362,368 **** <li>Bottom line - don't worry about delete()ing anything ! except graphics objects (for MSW really) or classes that specifically state (in wxluaref.html) that you should delete() them because the ! garbage collector may not do so soon enough.</li> --- 359,365 ---- <li>Bottom line - don't worry about delete()ing anything ! except:</li><ul><li>Graphics objects (for MSW really).</li><li>Classes that specifically state (in wxluaref.html) that you should delete() them because the ! garbage collector may not do so soon enough.</li><li>Objects that may be very large, like a wxImage(1000, 1000).</li></ul> *************** *** 431,438 **** ! <li>Unfortunately there is no way to tell whether the user has used the '.' or ':' calling convention and so the error message cannot be tailored for both static and nonstatic member ! functions. Just remember that the first parameter for nonstatic class member functions is the 'self'.</li> --- 428,437 ---- ! <li>Unfortunately ! there is no way to tell whether the user has used the '.' or ':' calling convention and so the error message cannot be tailored for both static and nonstatic member ! functions. Just remember that the first parameter for nonstatic class ! member functions called using the ':' notation is the 'self'.</li> *************** *** 472,475 **** ! </body> ! </html> --- 471,473 ---- ! </body></html> \ No newline at end of file |
From: John L. <jr...@us...> - 2007-08-07 03:06:18
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2700/wxLua/modules/wxlua/src Modified Files: wxlcallb.cpp Log Message: Make sure that we differentiate between wxScrollEvents and wxSpinEvents for wxEVT_SCROLLXXX Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wxlcallb.cpp 6 Aug 2007 22:00:34 -0000 1.39 --- wxlcallb.cpp 7 Aug 2007 03:06:12 -0000 1.40 *************** *** 82,91 **** return; ! wxlState.SetInEventType(event.GetEventType()); theCallback->CallFunction(&event); // we want the wxLuaWinDestroyCallback to get this too ! if (event.GetEventType() == wxEVT_DESTROY) event.Skip(); --- 82,93 ---- return; ! wxEventType evtType = event.GetEventType(); ! ! wxlState.SetInEventType(evtType); theCallback->CallFunction(&event); // we want the wxLuaWinDestroyCallback to get this too ! if (evtType == wxEVT_DESTROY) event.Skip(); *************** *** 108,112 **** --- 110,129 ---- // If !m_wxlBindEvent, we would have errored in the constructor, but... if (m_wxlBindEvent != NULL) + { event_tag = *m_wxlBindEvent->class_tag; + + // These wxEventTypes can be wxScrollEvents or wxSpinEvents + // wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN, wxEVT_SCROLL_THUMBTRACK + + if ((strcmp(m_wxlBindEvent->name, "wxScrollEvent") == 0) && + (event->GetClassInfo()->GetClassName() == wxString(wxT("wxSpinEvent")))) + { + const wxLuaBindClass *wxlClass = wxlState.GetLuaClass("wxSpinEvent"); + if (wxlClass != NULL) + event_tag = *wxlClass->class_tag; + else + event_tag = g_wxluatag_wxEvent; // get the s_wxluatag_wxEvent + } + } else event_tag = g_wxluatag_wxEvent; // get the s_wxluatag_wxEvent |
From: John L. <jr...@us...> - 2007-08-07 03:06:18
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2700/wxLua/modules/wxlua/include Modified Files: wxlbind.h Log Message: Make sure that we differentiate between wxScrollEvents and wxSpinEvents for wxEVT_SCROLLXXX Index: wxlbind.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlbind.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** wxlbind.h 3 Aug 2007 22:17:16 -0000 1.58 --- wxlbind.h 7 Aug 2007 03:06:12 -0000 1.59 *************** *** 103,108 **** WXLUAMETHOD_OVERLOAD_BASE = 0x8000, // Class method has been checked to see if it is // overloaded from the base class by the function ! // wxLuaBinding::GetClassMethod(wxLuaBindClass...) ! // Check WXLUAMETHOD::basemethod and if !NULL // this method is an overload from the base class }; --- 103,108 ---- WXLUAMETHOD_OVERLOAD_BASE = 0x8000, // Class method has been checked to see if it is // overloaded from the base class by the function ! // wxLuaState::RegisterBindings() ! // Check wxLuaBindMethod::basemethod and if !NULL // this method is an overload from the base class }; |
From: John L. <jr...@us...> - 2007-08-06 22:02:52
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17143/bindings Removed Files: genwxbind.sh Log Message: Remove, use Makefile --- genwxbind.sh DELETED --- |
From: John L. <jr...@us...> - 2007-08-06 22:00:37
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15149/wxLua/modules/wxlua/src Modified Files: wxlcallb.cpp wxlstate.cpp Log Message: Move wxWindow cleanup into wxLuaWinDestroyCallback from wxLuaCallback so we only have one connected wxEVT_DESTROY Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** wxlstate.cpp 3 Aug 2007 22:17:16 -0000 1.128 --- wxlstate.cpp 6 Aug 2007 22:00:34 -0000 1.129 *************** *** 97,100 **** --- 97,101 ---- } + #if 0 // copied from the Lua 5.0.1 debug library #define LEVELS1 12 /* size of the first part of the stack */ *************** *** 114,118 **** //static int db_errorfb (lua_State *L) in ldblib.c ! int LUACALL wxlua_tracebackFunction(lua_State *L) { int level; int firstpart = 1; /* still before eventual `...' */ --- 115,119 ---- //static int db_errorfb (lua_State *L) in ldblib.c ! static int LUACALL wxlua_tracebackFunction(lua_State *L) { int level; int firstpart = 1; /* still before eventual `...' */ *************** *** 165,168 **** --- 166,170 ---- return 1; } + #endif // 0 void LUACALL wxlua_debugHookFunction(lua_State *L, lua_Debug *LDebug) *************** *** 2368,2372 **** { M_WXLSTATEDATA->m_wxlStateData->m_windowList.Append(win); - new wxLuaCallback(*this, WXLUACALLBACK_NOROUTINE, win->GetId(), wxID_ANY, wxEVT_DESTROY, win->GetEventHandler()); return true; } --- 2370,2373 ---- *************** *** 4006,4011 **** else { ! // we have to count the methods that are displayed to find the one that failed ! // since we're failing anyway, we don't need this to be fast method = wxlMethod; int i_func = 0; --- 4007,4012 ---- else { ! // We have to count the methods that are displayed to find the one that failed. ! // Since we're failing anyway, we don't need this to be fast. method = wxlMethod; int i_func = 0; Index: wxlcallb.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlcallb.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxlcallb.cpp 3 Aug 2007 22:17:16 -0000 1.38 --- wxlcallb.cpp 6 Aug 2007 22:00:34 -0000 1.39 *************** *** 27,34 **** wxLuaCallback::wxLuaCallback(const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID winId, wxWindowID lastId, wxEventType eventType, wxEvtHandler *evtHandler) : wxObject(), m_routine(0), m_wxlState(wxlState), ! m_evtHandler(evtHandler), m_id(winId), m_lastId(lastId), m_wxlBindEvent(NULL) --- 27,34 ---- wxLuaCallback::wxLuaCallback(const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, wxEventType eventType, wxEvtHandler *evtHandler) : wxObject(), m_routine(0), m_wxlState(wxlState), ! m_evtHandler(evtHandler), m_id(win_id), m_last_id(last_id), m_wxlBindEvent(NULL) *************** *** 36,39 **** --- 36,41 ---- wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); + m_wxlState.AddTrackedCallback(this); + m_wxlBindEvent = wxlState.GetLuaEvent(eventType); *************** *** 43,47 **** // what wxEvent type class to use and someone probably made a mistake. wxString msg = wxString::Format(wxT("Invalid or unknown wxEventType : %d, winIds %d %d."), ! (int)eventType, winId, lastId); m_wxlState.terror(msg); return; --- 45,49 ---- // what wxEvent type class to use and someone probably made a mistake. wxString msg = wxString::Format(wxT("Invalid or unknown wxEventType : %d, winIds %d %d."), ! (int)eventType, win_id, last_id); m_wxlState.terror(msg); return; *************** *** 52,60 **** m_routine = m_wxlState.tinsert(lua_func_stack_idx); ! m_evtHandler->Connect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaCallback::EventHandler, this); - - m_wxlState.AddTrackedCallback(this); } --- 54,60 ---- m_routine = m_wxlState.tinsert(lua_func_stack_idx); ! m_evtHandler->Connect(win_id, last_id, eventType, (wxObjectEventFunction)&wxLuaCallback::EventHandler, this); } *************** *** 72,123 **** void wxLuaCallback::EventHandler(wxEvent& event) { ! // This is the wxLuaCallback to use, NOT "this" since "this" is a central event handler function ! wxLuaCallback *theCallback = (wxLuaCallback *) event.m_callbackUserData; wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaCallback in wxEvent user data")); - if (!theCallback || !theCallback->GetwxLuaState().Ok()) - return; wxLuaState wxlState(theCallback->GetwxLuaState()); ! wxlState.SetInEventType(event.GetEventType()); ! ! // If this is a wxWindow being destroyed, clear out all callbacks to it for safety ! if ((theCallback->m_routine == 0) && (event.GetEventType() == wxEVT_DESTROY)) ! { ! event.Skip(); ! // delete the reference to this handler since we're clearing it ! wxlState.RemoveTrackedCallback(theCallback); ! // remove tracking or derived methods for it ! wxlState.RemoveTrackedObject(event.GetEventObject(), wxLuaState::CLEAR_TRACKED_OBJECT|wxLuaState::CLEAR_DERIVED_METHODS); ! ! // Disconnect all callbacks associated with this window's evthandler ! theCallback->ClearwxLuaState(); ! ! wxEvtHandler *evtHandler = ((wxWindow*)event.GetEventObject())->GetEventHandler(); ! ! wxList::compatibility_iterator node = wxlState.GetTrackedCallbackList()->GetFirst(); ! while (node) ! { ! wxLuaCallback *wxlCallback = (wxLuaCallback *)node->GetData(); ! if ((wxlCallback != NULL) && (wxlCallback->GetEvtHandler() == evtHandler)) ! { ! // delete the reference to all other handlers that are cleared ! wxList::compatibility_iterator pc_node = node; // remember current node ! node = node->GetNext(); ! wxlState.GetTrackedCallbackList()->Erase(pc_node); ! // remove the ref to the routine since we're clearing the wxLuaState ! wxlState.tremove(wxlCallback->m_routine); ! wxlCallback->ClearwxLuaState(); ! } ! else ! node = node->GetNext(); ! } ! } ! else ! theCallback->CallFunction(&event); ! // we want to get this too or let it pass to someone else if (event.GetEventType() == wxEVT_DESTROY) event.Skip(); --- 72,90 ---- void wxLuaCallback::EventHandler(wxEvent& event) { ! // Get the wxLuaCallback to use, NOT "this" since "this" is a central event handler function ! wxLuaCallback *theCallback = (wxLuaCallback *)event.m_callbackUserData; wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaCallback in wxEvent user data")); + // Ok if !Ok() since the wxLuaState may been cleared during shutdown or after destroy event wxLuaState wxlState(theCallback->GetwxLuaState()); ! if (!wxlState.Ok()) ! return; ! wxlState.SetInEventType(event.GetEventType()); ! theCallback->CallFunction(&event); ! // we want the wxLuaWinDestroyCallback to get this too if (event.GetEventType() == wxEVT_DESTROY) event.Skip(); *************** *** 130,139 **** // Cannot call it if Lua is gone or the interpreter has been destroyed // This can happen when the program exists since windows may be destroyed ! // after lua has been deleted if (!m_wxlState.Ok()) return; // ref the state in case this generates a wxEVT_DESTROY which clears us - // this is why we don't get a pointer to the lua_Sstate but check it with GetLuaState() wxLuaState wxlState(m_wxlState); --- 97,105 ---- // Cannot call it if Lua is gone or the interpreter has been destroyed // This can happen when the program exists since windows may be destroyed ! // after Lua has been deleted if (!m_wxlState.Ok()) return; // ref the state in case this generates a wxEVT_DESTROY which clears us wxLuaState wxlState(m_wxlState); *************** *** 197,200 **** --- 163,167 ---- void wxLuaWinDestroyCallback::EventHandler(wxWindowDestroyEvent& event) { + // Central handler for events, forward to the specific instance wxLuaWinDestroyCallback *theCallback = (wxLuaWinDestroyCallback *)event.m_callbackUserData; if (theCallback && (((wxWindow*)event.GetEventObject()) == theCallback->m_window)) *************** *** 215,220 **** --- 182,219 ---- if (m_wxlState.Ok()) { + // clear the metatable for the copy of the we are tracking (clears it for all copies too) wxlua_tcleartrackedmetatable(m_wxlState.GetLuaState(), m_window); + // Now remove the object since it's gone + m_wxlState.RemoveTrackedObject(m_window, wxLuaState::CLEAR_TRACKED_OBJECT|wxLuaState::CLEAR_DERIVED_METHODS); + // Clear our own pointer to this window m_wxlState.RemoveTrackedWindow(m_window); + + wxEvtHandler* evtHandler = m_window->GetEventHandler(); + + // Finally, clear out the wxLuaCallbacks for the very odd cases where + // (activation) events can be sent during destruction. These can happen + // if you pop up a modal dialog (asking if they want to save perhaps) + // and when the dialog is closed the frame below sends an activation event, + // but we're right in the middle of being destroyed and we crash. + wxList::compatibility_iterator node = m_wxlState.GetTrackedCallbackList()->GetFirst(); + while (node) + { + wxLuaCallback *wxlCallback = (wxLuaCallback *)node->GetData(); + + if (wxlCallback->GetEvtHandler() == evtHandler) + { + // delete the reference to all other handlers that are cleared + wxList::compatibility_iterator pc_node = node; // remember current node + node = node->GetNext(); + m_wxlState.GetTrackedCallbackList()->Erase(pc_node); + + // remove the ref to the routine since we're clearing the wxLuaState + // See ~wxLuaCallback + m_wxlState.tremove(wxlCallback->GetLuaRoutine()); + wxlCallback->ClearwxLuaState(); + } + else + node = node->GetNext(); + } } } |
From: John L. <jr...@us...> - 2007-08-06 22:00:37
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15149/wxLua/modules/wxlua/include Modified Files: wxlcallb.h Log Message: Move wxWindow cleanup into wxLuaWinDestroyCallback from wxLuaCallback so we only have one connected wxEVT_DESTROY Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlcallb.h 3 Aug 2007 22:17:16 -0000 1.19 --- wxlcallb.h 6 Aug 2007 22:00:33 -0000 1.20 *************** *** 15,29 **** // ---------------------------------------------------------------------------- ! // wxLuaCallback - Forward events from C++ wxWidgets wxEvtHandlers to lua functions // ! // The wxLuaCallback is created with the wxLuaState, the stack index of the ! // lua function to call when an event is received, the window id ranges, and ! // the wxEventType to connect to the wxEvtHandler with this as the callback ! // user data for event. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function wxLuaCallback::EventHandler generically handles the events and ! // forwards them to the event's wxLuaCallback callback user data CallFunction(). // ---------------------------------------------------------------------------- --- 15,29 ---- // ---------------------------------------------------------------------------- ! // wxLuaCallback - Forward events from C++ wxWidgets wxEvtHandlers to Lua functions // ! // The wxLuaCallback is created with the wxLuaState, the stack index of a ! // Lua function to call when a wxEvent is received, the window id ranges, and ! // the wxEventType to connect using wxEvtHandler::Connect() with this as the ! // callback user data for event. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaCallback callback user data function CallFunction(). // ---------------------------------------------------------------------------- *************** *** 37,41 **** // if only one event Id is needed set lastId = wxID_ANY wxLuaCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID winId, wxWindowID lastId, wxEventType eventType, wxEvtHandler *evtHandler ); --- 37,41 ---- // if only one event Id is needed set lastId = wxID_ANY wxLuaCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, wxEventType eventType, wxEvtHandler *evtHandler ); *************** *** 44,52 **** void ClearwxLuaState() { m_wxlState.UnRef(); } ! wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindowID GetId() const { return m_id; } ! wxWindowID GetLastId() const { return m_lastId; } ! wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } ! wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } --- 44,53 ---- void ClearwxLuaState() { m_wxlState.UnRef(); } ! wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindowID GetId() const { return m_id; } ! wxWindowID GetLastId() const { return m_last_id; } ! wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } ! wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } ! int GetLuaRoutine() const { return m_routine; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } *************** *** 62,70 **** 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; ! wxWindowID m_id; ! wxWindowID m_lastId; const wxLuaBindEvent* m_wxlBindEvent; // data for this wxEventType --- 63,71 ---- 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; ! wxWindowID m_id; ! wxWindowID m_last_id; const wxLuaBindEvent* m_wxlBindEvent; // data for this wxEventType *************** *** 81,84 **** --- 82,88 ---- // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. + // + // The function EventHandler() generically handles the events and forwards them + // to the event's wxLuaWinDestroyCallback callback user data function OnDestroy(). // ---------------------------------------------------------------------------- *************** *** 93,100 **** wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindow* GetWindow() const { return m_window; } // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data void EventHandler(wxWindowDestroyEvent& event); --- 97,105 ---- wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindow* GetWindow() const { return m_window; } // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data. This function is treated like a ! // static function that all handlers of this class will call. void EventHandler(wxWindowDestroyEvent& event); *************** *** 103,108 **** protected: ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxWindow* m_window; private: --- 108,113 ---- protected: ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxWindow* m_window; private: |
From: John L. <jr...@us...> - 2007-08-06 01:46:36
|
Update of /cvsroot/wxlua/wxLua/docs In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28184/wxLua/docs Modified Files: binding.html Log Message: Add wx_datatypes.lua file for use with external bindings Index: binding.html =================================================================== RCS file: /cvsroot/wxlua/wxLua/docs/binding.html,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** binding.html 1 Aug 2007 22:16:16 -0000 1.25 --- binding.html 6 Aug 2007 01:46:32 -0000 1.26 *************** *** 2,6 **** <html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>wxLua Binding HowTo</title> <meta content="John Labenski" name="author"></head> - <body><h2><u>wxLuaBinding - writing and generating the binding --- 2,5 ---- *************** *** 95,99 **** typically alphabetical.</li> <ul> <li style="text-align: justify;">Class constructors first, class member functions, %operators, %members.</li> </ul> ! </ul><h3>wxluasetup.h </h3> <ul> <li>Contains #defines of all of the wxLUA_USE_wxXXX for C++ --- 94,105 ---- typically alphabetical.</li> <ul> <li style="text-align: justify;">Class constructors first, class member functions, %operators, %members.</li> </ul> ! </ul><h3>*_datatypes.lua files</h3><ul><li>These are generated files ! that contain Lua tables of typedefs, datatypes, and preprocessor ! conditions defined in a binding that may be used by another binding by ! adding them to the <span style="font-style: italic;">datatype_cache_input_fileTable</span> variable of the rules file.</li><li>The ! checking of known datatypes enforces that the generated bindings will ! work correctly. If a datatype is missing it will be unusable in Lua. </li><li>The items are added to the <span style="font-style: italic;">typedefTable, dataTypeTable,</span> and <span style="font-style: italic;">preprocConditionTable</span> variables of the <span style="font-style: italic;">genwxbind.lua</span> program.</li><li>All of the wxWidgets types are added to the <span style="font-weight: bold;">bindings/wxwidgets/wx_datatypes.lua</span> file which may be used by external bindings that use datatypes declared in the wxLua wxWidgets bindings. Note: Each <span style="font-style: italic;">bindings/wxwidgets/wxXXX_rules.lua</span> ! file will generate a wxXXX_datatypes.lua datatype file, but these are ! all gathered together into the wx_datatype.lua file. </li></ul><h3>wxluasetup.h </h3> <ul> <li>Contains #defines of all of the wxLUA_USE_wxXXX for C++ |
From: John L. <jr...@us...> - 2007-08-06 01:46:36
|
Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28184/wxLua/bindings/wxwidgets Added Files: wx_datatypes.lua wxdatatypes_rules.lua Log Message: Add wx_datatypes.lua file for use with external bindings --- NEW FILE: wx_datatypes.lua --- -- --------------------------------------------------------------------------- -- This file was generated by genwxbind.lua -- -- Any changes made to this file may be lost when file is regenerated -- --------------------------------------------------------------------------- -- --------------------------------------------------------------------------- -- typedefTable -- --------------------------------------------------------------------------- wx_typedefTable = { WXHANDLE = "void *", ["wxDateTime::wxDateTime_t"] = "unsigned short", wxDouble = "double", wxInt32 = "int", wxLogLevel = "unsigned long", wxNotebookPage = "wxWindow", wxPreviewWindow = "wxScrolledWindow", [...4655 lines suppressed...] wxUSE_XPM_IN_MSW = "wxUSE_XPM_IN_MSW", wxUSE_XRC = "wxUSE_XRC", wxUSE_X_RESOURCES = "wxUSE_X_RESOURCES", wxUSE_ZIPSTREAM = "wxUSE_ZIPSTREAM", wxUSE_ZLIB = "wxUSE_ZLIB", } -- --------------------------------------------------------------------------- -- Cache the dataTypes -- --------------------------------------------------------------------------- for k, v in pairs(wx_typedefTable) do typedefTable[k] = v end for k, v in pairs(wx_dataTypeTable) do dataTypeTable[k] = v end for k, v in pairs(wx_preprocConditionTable) do preprocConditionTable[k] = v end --- NEW FILE: wxdatatypes_rules.lua --- ------------------------------------------------------------------------------- -- Rules to build the wxWidgets datatypes for wxLua -- load using : $lua -e"rulesFilename=\"rules.lua\"" genwxbind.lua ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Set the root directory of the wxLua distribution, used only in this file wxlua_dir = "../" --============================================================================= -- Set the lua namespace (lua table) that the bindings will be placed into. -- eg. wx.wxWindow(...) hook_lua_namespace = "" -- Set the C++ "namespace" that the bindings will be placed. -- i.e. cpp function names contain this to prevent duplicate function names hook_cpp_namespace = "wx" --============================================================================= -- Set the directory to output the bindings to, both C++ header and source files output_cpp_header_filepath = "" output_cpp_filepath = "" --============================================================================= -- Set the DLLIMPEXP macros for compiling these bindings into a DLL -- Use "WXLUA_NO_DLLIMPEXP" and "WXLUA_NO_DLLIMPEXP_DATA" for no IMPEXP macros output_cpp_impexpsymbol = "" output_cpp_impexpdatasymbol = "" ------------------------------------------------------------------------------- -- Set the name of the header file that will have the #includes from the -- bindings in it. This will be used as #include "hook_cpp_header_filename" in -- the C++ wrapper files, so it must include the proper #include path. hook_cpp_header_filename = "" ------------------------------------------------------------------------------- -- Set the name of the main binding file that will have the glue code for the -- bindings in it. This file along with the output from the *.i files will be -- placed in the "output_cpp_filepath". hook_cpp_binding_filename = "" ------------------------------------------------------------------------------- -- Set the name of the subclassed wxLuaBinding class hook_cpp_binding_classname = "wxLuaBinding_"..hook_cpp_namespace ------------------------------------------------------------------------------- -- Set the function names that wrap the output structs of defined values, -- objects, events, functions, and classes. hook_cpp_define_funcname = "wxLuaGetDefineList_"..hook_cpp_namespace hook_cpp_string_funcname = "wxLuaGetStringList_"..hook_cpp_namespace hook_cpp_object_funcname = "wxLuaGetObjectList_"..hook_cpp_namespace hook_cpp_event_funcname = "wxLuaGetEventList_"..hook_cpp_namespace hook_cpp_function_funcname = "wxLuaGetFunctionList_"..hook_cpp_namespace hook_cpp_class_funcname = "wxLuaGetClassList_"..hook_cpp_namespace ------------------------------------------------------------------------------- -- Set any #includes or other C++ code to be placed verbatim at the top of -- every generated cpp file or "" for none hook_cpp_binding_includes = "" ------------------------------------------------------------------------------- -- Set any #includes or other C++ code to be placed verbatim below the -- #includes of every generated cpp file or "" for none -- X.h defines Above and Below as numbers, undef them for wx/layout.h hook_cpp_binding_post_includes = "" ------------------------------------------------------------------------------- -- Add additional include information or C++ code for the binding header file, -- hook_cpp_header_filename. -- This code will be place directly after any #includes at the top of the file hook_cpp_binding_header_includes = "" ------------------------------------------------------------------------------- -- Set any #includes or other C++ code to be placed verbatim at the top of -- the single hook_cpp_binding_filename generated cpp file or "" for none hook_cpp_binding_source_includes = "" --============================================================================= -- Set the bindings directory that contains the *.i interface files interface_filepath = wxlua_dir.."bindings/wxwidgets" ------------------------------------------------------------------------------- -- A list of interface files to use to make the bindings. These files will be -- converted into *.cpp and placed in the output_cpp_filepath directory. -- The files are loaded from the interface_filepath. interface_fileTable = {} ------------------------------------------------------------------------------- -- A list of files that contain bindings that need to be overridden or empty -- table {} for none. -- The files are loaded from the interface_filepath. -- override_fileTable = --============================================================================= -- A table containing filenames of XXX_datatype.lua from other wrappers to -- to define classes and data types used in this wrapper -- NOTE: for the base wxWidgets wrappers we don't load the cache since they -- don't depend on other wrappers and can cause problems when interface -- files are updated. Make sure you delete or have updated any cache file -- that changes any data types used by this binding. datatype_cache_input_fileTable = { wxlua_dir.."bindings/wxwidgets/wxadv_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxaui_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxbase_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxcore_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxgl_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxhtml_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxmedia_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxnet_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxrichtext_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxstc_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxxml_datatypes.lua", wxlua_dir.."bindings/wxwidgets/wxxrc_datatypes.lua" } ------------------------------------------------------------------------------- -- The file to output the data type cache for later use with a binding that -- makes use of data types (classes, enums, etc) that are declared in this -- binding. The file will be generated in the interface_filepath. datatypes_cache_output_filename = "wx_datatypes.lua" --============================================================================= -- virtual void wxLuaBinding::PreRegister function body for the -- hook_cpp_binding_classname. You can initialize data here. -- Typically this is not necessary and you can rem this out. wxLuaBinding_PreRegister = "" --============================================================================= -- virtual void wxLuaBinding::PostRegister function body for the -- hook_cpp_binding_classname. You can load any other custom bindings here. -- Typically this is not necessary and you can rem this out. -- wxLuaBinding_PostRegister = nothing to do here --============================================================================= -- Add additional conditions here -- example: conditions["DOXYGEN_INCLUDE"] = "defined(DOXYGEN_INCLUDE)" ------------------------------------------------------------------------------- -- Add additional data types here --AllocDataType("wxLuaObject", "class", false) --============================================================================= -- Generate comments into binding C++ code comment_cpp_binding_code = true |
From: John L. <jr...@us...> - 2007-08-06 01:46:36
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28184/wxLua/apps/wxluacan/src Modified Files: wxluacan_rules.lua Log Message: Add wx_datatypes.lua file for use with external bindings Index: wxluacan_rules.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/wxluacan_rules.lua,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxluacan_rules.lua 16 Jul 2007 19:34:12 -0000 1.14 --- wxluacan_rules.lua 6 Aug 2007 01:46:32 -0000 1.15 *************** *** 98,102 **** -- that changes any data types used by this binding. ! datatype_cache_input_fileTable = { "../../../bindings/wxwidgets/wxcore_datatypes.lua" } ------------------------------------------------------------------------------- --- 98,102 ---- -- that changes any data types used by this binding. ! datatype_cache_input_fileTable = { "../../../bindings/wxwidgets/wx_datatypes.lua" } ------------------------------------------------------------------------------- |
From: John L. <jr...@us...> - 2007-08-06 01:46:36
|
Update of /cvsroot/wxlua/wxLua/bindings In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28184/wxLua/bindings Modified Files: Makefile genwxbind.lua Log Message: Add wx_datatypes.lua file for use with external bindings Index: Makefile =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 16 Jul 2007 19:34:13 -0000 1.6 --- Makefile 6 Aug 2007 01:46:32 -0000 1.7 *************** *** 18,22 **** # These have to be in order of their dependencies ! all: wxbase wxcore wxadv wxaui wxgl wxhtml wxnet wxmedia wxstc wxxml wxxrc wxrichtext wxlua wxluasocket wxluacan --- 18,22 ---- # These have to be in order of their dependencies ! all: wxbase wxcore wxadv wxaui wxgl wxhtml wxnet wxmedia wxstc wxxml wxxrc wxrichtext wxlua wxluasocket wxluacan wxdatatypes *************** *** 78,81 **** --- 78,87 ---- @($(LUA) -e"rulesFilename=\"wxluasocket/wxluasocket_rules.lua\"" genwxbind.lua) + + wxdatatypes: + @echo Building wx DataTypes + @($(LUA) -e"rulesFilename=\"wxwidgets/wxdatatypes_rules.lua\"" genwxbind.lua) + + wxluacan: @echo "Building wxLuaCan (ps. did you forget to run make -B)" Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** genwxbind.lua 1 Aug 2007 19:15:30 -0000 1.146 --- genwxbind.lua 6 Aug 2007 01:46:32 -0000 1.147 *************** *** 4896,4901 **** end ! local interfaceList = GenerateInterfaceData() ! WriteWrapperFiles(interfaceList) -- Write out the data types for these interface files --- 4896,4903 ---- end ! if #interface_fileTable > 0 then ! local interfaceList = GenerateInterfaceData() ! WriteWrapperFiles(interfaceList) ! end -- Write out the data types for these interface files |