From: John L. <jr...@us...> - 2007-05-21 01:08:33
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14147/wxLua/modules/wxluasocket/src Modified Files: dservice.cpp wxldserv.cpp wxlsock.cpp Log Message: Remove all code in dservice as it wasn't used Removed m_pDerivedList and put derived lua functions into the lua registry index A little more cleanup in the socket and editor.wx.lua code. Index: dservice.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dservice.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dservice.cpp 19 May 2007 02:05:47 -0000 1.32 --- dservice.cpp 21 May 2007 01:08:00 -0000 1.33 *************** *** 15,1367 **** // wxWidgets Socket Sample - #include "wx/wxprec.h" - - #ifdef __BORLANDC__ - #pragma hdrstop - #endif - - #ifndef WX_PRECOMP - #include "wx/wx.h" [...1324 lines suppressed...] - } - - void wxLuaDebuggee::NotifyBreakPoints(wxLuawxSocket* debugSocket) - { - wxCriticalSectionLocker locker(m_breakPointListCriticalSection); - - // Notify Debugger of Each BreakPoint - wxLuaBreakPointList::compatibility_iterator nodeBreakPoint; - wxLuaBreakPointList::compatibility_iterator nextBreakPoint; - - for (nodeBreakPoint = m_breakPointList.GetFirst(); nodeBreakPoint; nodeBreakPoint = nextBreakPoint) - { - nextBreakPoint = nodeBreakPoint->GetNext(); - - wxLuaBreakPoint* breakPoint = nodeBreakPoint->GetData(); - - m_debugService->NotifyBreakpointAdded(*breakPoint, debugSocket); - } - } --- 15,16 ---- Index: wxldserv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldserv.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wxldserv.cpp 19 May 2007 17:14:13 -0000 1.38 --- wxldserv.cpp 21 May 2007 01:08:00 -0000 1.39 *************** *** 196,204 **** { // we don't delete the the process, we kill it and it's OnTerminate deletes it ! if ((m_debuggeeProcess != NULL) && (m_debuggeeProcessID > 0)) { m_debuggeeProcess->m_debugger = NULL; m_debuggeeProcess = NULL; ! wxProcess::Kill(m_debuggeeProcessID, wxSIGTERM, wxKILL_CHILDREN); //wxPrintf(wxT("Deleting the m_debuggeeProcess %d\n"), m_debuggeeProcessID); --- 196,205 ---- { // we don't delete the the process, we kill it and it's OnTerminate deletes it ! if ((m_debuggeeProcess != NULL) && (m_debuggeeProcessID > 0) && ! wxProcess::Exists(m_debuggeeProcessID)) { m_debuggeeProcess->m_debugger = NULL; m_debuggeeProcess = NULL; ! wxProcess::Kill(m_debuggeeProcessID, wxSIGKILL, wxKILL_CHILDREN); //wxPrintf(wxT("Deleting the m_debuggeeProcess %d\n"), m_debuggeeProcessID); *************** *** 216,220 **** m_port_number); ! m_debuggeeProcessID = wxExecute(command, wxEXEC_ASYNC, m_debuggeeProcess); if (m_debuggeeProcessID < 1) --- 217,221 ---- m_port_number); ! m_debuggeeProcessID = wxExecute(command, wxEXEC_ASYNC|wxEXEC_MAKE_GROUP_LEADER, m_debuggeeProcess); if (m_debuggeeProcessID < 1) *************** *** 362,365 **** --- 363,368 ---- //extern wxString wxLuaSocketCmdEventMsg(int val); + // This function shouldn't modify any internal variables without using a + // critical section since the wxLuaDebuggerCServer calls it from the thread. int wxLuaDebuggerBase::HandleDebuggeeEvent(int event_type) { *************** *** 852,856 **** debug_event = wxLUASOCKET_DEBUGGEE_EVENT_EXIT; - { // lock the critical section while we access it --- 855,858 ---- *************** *** 859,862 **** --- 861,865 ---- { m_fShutdown = true; + break; } } *************** *** 869,877 **** { m_fShutdown = true; } } } - wxCriticalSectionLocker locker(m_acceptSockCritSect); // delete the accepted socket --- 872,880 ---- { m_fShutdown = true; + break; } } } wxCriticalSectionLocker locker(m_acceptSockCritSect); // delete the accepted socket *************** *** 906,913 **** #else // !WXLUASOCKET_USE_C_SOCKET - #include "wxluasocket/include/dservice.h" - // --------------------------------------------------------------------------- ! // --------------------------------------------------------------------------- IMPLEMENT_ABSTRACT_CLASS(wxLuaDebuggerwxSocketServer, wxLuaDebuggerBase) --- 909,914 ---- #else // !WXLUASOCKET_USE_C_SOCKET // --------------------------------------------------------------------------- ! // wxLuaDebuggerwxSocketServer // --------------------------------------------------------------------------- IMPLEMENT_ABSTRACT_CLASS(wxLuaDebuggerwxSocketServer, wxLuaDebuggerBase) *************** *** 978,982 **** { wxString s; ! return s; --- 979,984 ---- { wxString s; ! if (m_acceptedSocket) ! s += m_acceptedSocket->GetErrorMsg(true); return s; *************** *** 998,1001 **** --- 1000,1004 ---- sock->SetFlags(wxSOCKET_NOWAIT); m_acceptedSocket = new wxLuawxSocket(sock); + m_acceptedSocket->m_port_number = m_port_number; // can't get it from wxSocketBase m_acceptedSocket->m_name = wxString::Format(wxT("wxLuaDebuggerwxSocketServer::m_acceptedSocket (%ld)"), (long)wxGetProcessId()); Index: wxlsock.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlsock.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** wxlsock.cpp 19 May 2007 17:14:13 -0000 1.25 --- wxlsock.cpp 21 May 2007 01:08:00 -0000 1.26 *************** *** 308,312 **** wxString wxLuaSocketBase::GetErrorMsg(bool clear_msg) { ! wxString s = m_errorMsg; if (clear_msg) m_errorMsg.Clear(); --- 308,312 ---- wxString wxLuaSocketBase::GetErrorMsg(bool clear_msg) { ! wxString s(m_errorMsg); if (clear_msg) m_errorMsg.Clear(); *************** *** 319,323 **** wxString s(msg); // wxT(__TIME__) ! if (m_port_number > -1) s += wxString::Format(wxT(" Port %d."), m_port_number); --- 319,325 ---- wxString s(msg); // wxT(__TIME__) ! if (m_address.Length() != 0) ! s += wxString::Format(wxT(" Address '%s'."), m_address.c_str()); ! if (m_port_number > 0) s += wxString::Format(wxT(" Port %d."), m_port_number); *************** *** 345,348 **** --- 347,352 ---- :m_sock(socket), m_sockaddress(address), m_sockstate(SOCKET_ACCEPTED) { + m_address = lua2wx(inet_ntoa(m_sockaddress.sin_addr)); + m_port_number = ntohs(m_sockaddress.sin_port); } *************** *** 466,469 **** --- 470,476 ---- m_sockaddress.sin_port = htons(port_number); + m_address = lua2wx(inet_ntoa(m_sockaddress.sin_addr)); + m_port_number = ntohs(m_sockaddress.sin_port); + if (::connect(m_sock, (sockaddr *) &m_sockaddress, sizeof(m_sockaddress)) == SOCKET_ERROR) { *************** *** 476,501 **** } - wxString wxLuaCSocket::GetAddress() - { - if ((m_sockstate != SOCKET_CONNECTED) && (m_sockstate != SOCKET_ACCEPTED)) - { - AddErrorMessage(wxT("Unable to get the address of an unconnected or unaccepted socket.")); - return wxEmptyString; - } - - return lua2wx(inet_ntoa(m_sockaddress.sin_addr)); - } - - int wxLuaCSocket::GetPort() - { - if ((m_sockstate != SOCKET_CONNECTED) && (m_sockstate != SOCKET_ACCEPTED)) - { - AddErrorMessage(wxT("Unable to get the port of an unconnected or unaccepted socket.")); - return -1; - } - - return ntohs(m_sockaddress.sin_port); - } - // Write data to an open socket, repeat until all data has been sent. int wxLuaCSocket::Write(const char *buffer_, wxUint32 length_) --- 483,486 ---- *************** *** 729,733 **** { case wxSOCKET_NOERROR : s = wxT("No error happened."); break; ! case wxSOCKET_INVOP : s = wxT(" Invalid operation."); break; case wxSOCKET_IOERR : s = wxT("Input/Output error."); break; case wxSOCKET_INVADDR : s = wxT("Invalid address passed to wxSocket."); break; --- 714,718 ---- { case wxSOCKET_NOERROR : s = wxT("No error happened."); break; ! case wxSOCKET_INVOP : s = wxT("Invalid operation."); break; case wxSOCKET_IOERR : s = wxT("Input/Output error."); break; case wxSOCKET_INVADDR : s = wxT("Invalid address passed to wxSocket."); break; |