From: John L. <jr...@us...> - 2006-09-06 05:33:12
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25350/wxLua/modules/wxluasocket/src Modified Files: dservice.cpp wxldbgio.cpp wxldserv.cpp wxldtarg.cpp wxlhandl.cpp wxlsock.cpp Log Message: simplify socket code to use a wxLuaSocketBase for all IO operations remove wxLuaDebugIO class, in wxLuaSocketBase First step to using wxSockets and/or C sockets transparently Index: wxldbgio.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldbgio.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wxldbgio.cpp 1 Mar 2006 23:12:11 -0000 1.6 --- wxldbgio.cpp 6 Sep 2006 05:33:09 -0000 1.7 *************** *** 23,271 **** #include "wxluasocket/include/wxldbgio.h" - #include "wxlua/include/wxlstate.h" - #include "wxluasocket/include/wxlsock.h" - #include "wxluadebug/include/wxldebug.h" - - // ---------------------------------------------------------------------------- - // wxLuaDebugIO - // ---------------------------------------------------------------------------- - - unsigned char wxLuaDebugIO::ReadByte(wxLuaSocket *pSocket) - { - unsigned char value = 0; - pSocket->Read((char *) &value, sizeof(value)); - return value; - } - - short wxLuaDebugIO::ReadWord(wxLuaSocket *pSocket) - { - short value = 0; - pSocket->Read((char *)&value, sizeof(value)); - return value; - } - - unsigned short wxLuaDebugIO::ReadUWord(wxLuaSocket *pSocket) - { - unsigned short value = 0; - pSocket->Read((char *)&value, sizeof(value)); - return value; - } - - int wxLuaDebugIO::ReadInt(wxLuaSocket *pSocket) - { - int value = 0; - pSocket->Read((char *) &value, sizeof(value)); - return value; - } - - unsigned int wxLuaDebugIO::ReadUInt(wxLuaSocket *pSocket) - { - unsigned int value = 0; - pSocket->Read((char *) &value, sizeof(value)); - return value; - } - - long wxLuaDebugIO::ReadLong(wxLuaSocket *pSocket) - { - long value = 0; - pSocket->Read((char *) &value, sizeof(value)); - return value; - } - - unsigned long wxLuaDebugIO::ReadULong(wxLuaSocket *pSocket) - { - unsigned long value = 0; - pSocket->Read((char *) &value, sizeof(value)); - return value; - } - - wxString wxLuaDebugIO::ReadString(wxLuaSocket *pSocket) - { - wxString value; - unsigned int length = ReadInt(pSocket); - if (length > 0) - { - char *buffer = new char[length + 1]; - memset(buffer, 0, length+1); - pSocket->Read(buffer, length); - buffer[length] = 0; - value = lua2wx(buffer); - delete[] buffer; - } - return value; - } - - wxLuaDebugData *wxLuaDebugIO::ReadDebugData(wxLuaSocket *pSocket) - { - wxLuaDebugData *pSortedList = new wxLuaDebugData(); - - try - { - int idx, idxMax = 0; - pSocket->Read((char *) &idxMax, sizeof(int)); - - for (idx = 0; idx < idxMax; ++idx) - { - int bufferLength; - pSocket->Read((char *) &bufferLength, sizeof(bufferLength)); - if (bufferLength > 0) - { - char *pBuffer = new char[bufferLength]; - char *pMemory = pBuffer; - pSocket->Read(pMemory, bufferLength); - - int nReference = *(int *) pMemory; - pMemory += sizeof(int); - - int nIndex = *(int *) pMemory; - pMemory += sizeof(int); - - bool fExpanded = (0 != (*(int *) pMemory)); - pMemory += sizeof(int); - - const char *pNamePtr = pMemory; - pMemory += strlen(pNamePtr) + 1; - const char *pTypePtr = pMemory; - pMemory += strlen(pTypePtr) + 1; - const char *pValuePtr = pMemory; - - wxLuaDebugDataItem *pItem = new wxLuaDebugDataItem(lua2wx(pNamePtr), - lua2wx(pTypePtr), - lua2wx(pValuePtr), - wxEmptyString, // FIXME! source? - nReference, - nIndex, - fExpanded); - pSortedList->Add(pItem); - - delete[] pBuffer; - } - } - } - catch(wxLuaSocketException & /*e*/) - { - delete pSortedList; - pSortedList = NULL; - } - - return pSortedList; - } - - bool wxLuaDebugIO::WriteCharData(wxLuaSocket *pSocket, const char* value, int length) - { - try - { - pSocket->Write(value, length); - return true; - } - catch(wxLuaSocketException & /*e*/) - { - } - return false; - } - bool wxLuaDebugIO::WriteByte(wxLuaSocket *pSocket, unsigned char value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteWord(wxLuaSocket *pSocket, short value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteUWord(wxLuaSocket *pSocket, unsigned short value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteInt(wxLuaSocket *pSocket, int value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteUInt(wxLuaSocket *pSocket, unsigned int value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteLong(wxLuaSocket *pSocket, long value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - bool wxLuaDebugIO::WriteULong(wxLuaSocket *pSocket, unsigned long value) - { - return WriteCharData(pSocket, (const char *)&value, sizeof(value)); - } - - bool wxLuaDebugIO::WriteString(wxLuaSocket *pSocket, const wxString &value) - { - try - { - wxLuaCharBuffer buf(value); - int buflen = buf.Length(); - pSocket->Write((const char *)&buflen, sizeof(buflen)); - if (buflen > 0) - { - pSocket->Write(buf.GetData(), buflen); - } - return true; - } - catch(wxLuaSocketException & /*e*/) - { - } - return false; - } - - bool wxLuaDebugIO::WriteDebugData(wxLuaSocket *pSocket, const wxLuaDebugData *pSortedList) - { - bool result = false; - int idx, idxMax = pSortedList->Count(); - - pSocket->Write((const char *) &idxMax, sizeof(int)); - - for (idx = 0; idx < idxMax; ++idx) - { - try - { - const wxLuaDebugDataItem *item = pSortedList->Item(idx); - - int nameLength = item->GetName().Length() + 1; - int typeLength = item->GetType().Length() + 1; - int valueLength = item->GetValue().Length() + 1; - - int bufferLength = (3 * sizeof(int)) + - nameLength + - typeLength + - valueLength; - - unsigned char *pBuffer = new unsigned char[bufferLength]; - unsigned char *pMemory = pBuffer; - - pSocket->Write((const char *) &bufferLength, sizeof(bufferLength)); - - *(int *) pMemory = item->GetReference(); - pMemory += sizeof(int); - - *(int *) pMemory = item->GetIndex(); - pMemory += sizeof(int); - - *(int *) pMemory = item->IsExpanded() ? 1 : 0; - pMemory += sizeof(int); - - memcpy(pMemory, wx2lua(item->GetName()), nameLength); - pMemory += nameLength; - - memcpy(pMemory, wx2lua(item->GetType()), typeLength); - pMemory += typeLength; - - memcpy(pMemory, wx2lua(item->GetValue()), valueLength); - - pSocket->Write((const char *) pBuffer, bufferLength); - - delete[] pBuffer; - result = true; - } - catch(wxLuaSocketException & /*e*/) - { - } - - if (result == false) - break; - } - return result; - } --- 23,24 ---- Index: wxldserv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldserv.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxldserv.cpp 28 Aug 2006 05:26:21 -0000 1.14 --- wxldserv.cpp 6 Sep 2006 05:33:09 -0000 1.15 *************** *** 319,325 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_ADD_BREAKPOINT) && ! WriteString(m_acceptedSocket, fileName) && ! WriteInt(m_acceptedSocket, lineNumber)) { return true; --- 319,325 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_ADD_BREAKPOINT) && ! m_acceptedSocket->WriteString(fileName) && ! m_acceptedSocket->WriteInt(lineNumber)) { return true; *************** *** 339,345 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_REMOVE_BREAKPOINT) && ! WriteString(m_acceptedSocket, fileName) && ! WriteInt(m_acceptedSocket, lineNumber)) { return true; --- 339,345 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_REMOVE_BREAKPOINT) && ! m_acceptedSocket->WriteString(fileName) && ! m_acceptedSocket->WriteInt(lineNumber)) { return true; *************** *** 359,363 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_CLEAR_ALL_BREAKPOINTS)) return true; } --- 359,363 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_CLEAR_ALL_BREAKPOINTS)) return true; } *************** *** 437,443 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_RUN_BUFFER) && ! WriteString(m_acceptedSocket, fileName) && ! WriteString(m_acceptedSocket, buffer)) { return true; --- 437,443 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_RUN_BUFFER) && ! m_acceptedSocket->WriteString(fileName) && ! m_acceptedSocket->WriteString(buffer)) { return true; *************** *** 457,461 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_DEBUG_STEP); } catch(wxLuaSocketException & /*e*/) --- 457,461 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_DEBUG_STEP); } catch(wxLuaSocketException & /*e*/) *************** *** 472,476 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_DEBUG_STEPOVER); } catch(wxLuaSocketException & /*e*/) --- 472,476 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_DEBUG_STEPOVER); } catch(wxLuaSocketException & /*e*/) *************** *** 487,491 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_DEBUG_STEPOUT); } catch(wxLuaSocketException & /*e*/) --- 487,491 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_DEBUG_STEPOUT); } catch(wxLuaSocketException & /*e*/) *************** *** 502,506 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_DEBUG_CONTINUE); } catch(wxLuaSocketException & /*e*/) --- 502,506 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_DEBUG_CONTINUE); } catch(wxLuaSocketException & /*e*/) *************** *** 517,521 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_DEBUG_BREAK); } catch(wxLuaSocketException & /*e*/) --- 517,521 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_DEBUG_BREAK); } catch(wxLuaSocketException & /*e*/) *************** *** 532,536 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_ENUMERATE_STACK); } catch(wxLuaSocketException & /*e*/) --- 532,536 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_ENUMERATE_STACK); } catch(wxLuaSocketException & /*e*/) *************** *** 547,551 **** try { ! return WriteByte(m_acceptedSocket, wxLUA_CMD_RESET); } catch(wxLuaSocketException & /*e*/) --- 547,551 ---- try { ! return m_acceptedSocket->WriteByte(wxLUA_CMD_RESET); } catch(wxLuaSocketException & /*e*/) *************** *** 562,567 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_ENUMERATE_STACK_ENTRY) && ! WriteInt(m_acceptedSocket, stackEntry)) { return true; --- 562,567 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_ENUMERATE_STACK_ENTRY) && ! m_acceptedSocket->WriteInt(stackEntry)) { return true; *************** *** 581,588 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_ENUMERATE_TABLE_REF) && ! WriteInt(m_acceptedSocket, tableRef) && ! WriteInt(m_acceptedSocket, nIndex) && ! WriteLong(m_acceptedSocket, nItemNode)) { return true; --- 581,588 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_ENUMERATE_TABLE_REF) && ! m_acceptedSocket->WriteInt(tableRef) && ! m_acceptedSocket->WriteInt(nIndex) && ! m_acceptedSocket->WriteLong(nItemNode)) { return true; *************** *** 602,606 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_CLEAR_DEBUG_REFERENCES)) { return true; --- 602,606 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_CLEAR_DEBUG_REFERENCES)) { return true; *************** *** 642,652 **** while (!m_fShutdown) { ! int debugEvent = ReadByte(m_acceptedSocket); switch((wxLuaDebugEvents_Type) debugEvent) { case wxLUA_EVENT_DEBUG_BREAK: { ! wxString fileName = ReadString(m_acceptedSocket); ! int lineNumber = ReadInt(m_acceptedSocket); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_BREAK, lineNumber, fileName); --- 642,652 ---- while (!m_fShutdown) { ! int debugEvent = m_acceptedSocket->ReadByte(); switch((wxLuaDebugEvents_Type) debugEvent) { case wxLUA_EVENT_DEBUG_BREAK: { ! wxString fileName = m_acceptedSocket->ReadString(); ! int lineNumber = m_acceptedSocket->ReadInt(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_BREAK, lineNumber, fileName); *************** *** 657,661 **** case wxLUA_EVENT_DEBUG_PRINT: { ! wxString strMessage = ReadString(m_acceptedSocket); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_PRINT); --- 657,661 ---- case wxLUA_EVENT_DEBUG_PRINT: { ! wxString strMessage = m_acceptedSocket->ReadString(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_PRINT); *************** *** 667,671 **** case wxLUA_EVENT_DEBUG_ERROR: { ! wxString strMessage = ReadString(m_acceptedSocket); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_ERROR); --- 667,671 ---- case wxLUA_EVENT_DEBUG_ERROR: { ! wxString strMessage = m_acceptedSocket->ReadString(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_ERROR); *************** *** 685,689 **** { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENUM); ! wxLuaDebugData *pDebugData = ReadDebugData(m_acceptedSocket); if (pDebugData != NULL) debugEvent.SetDebugData(-1, pDebugData); --- 685,689 ---- { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENUM); ! wxLuaDebugData *pDebugData = m_acceptedSocket->ReadDebugData(); if (pDebugData != NULL) debugEvent.SetDebugData(-1, pDebugData); *************** *** 695,700 **** { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENTRY_ENUM); ! int stackRef = ReadInt(m_acceptedSocket); ! wxLuaDebugData *pDebugData = ReadDebugData(m_acceptedSocket); if (pDebugData != NULL) debugEvent.SetDebugData(stackRef, pDebugData); --- 695,700 ---- { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENTRY_ENUM); ! int stackRef = m_acceptedSocket->ReadInt(); ! wxLuaDebugData *pDebugData = m_acceptedSocket->ReadDebugData(); if (pDebugData != NULL) debugEvent.SetDebugData(stackRef, pDebugData); *************** *** 706,711 **** { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_TABLE_ENUM); ! long itemNode = ReadLong(m_acceptedSocket); ! wxLuaDebugData *pDebugData = ReadDebugData(m_acceptedSocket); if (pDebugData != NULL) debugEvent.SetDebugData(itemNode, pDebugData); --- 706,711 ---- { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_TABLE_ENUM); ! long itemNode = m_acceptedSocket->ReadLong(); ! wxLuaDebugData *pDebugData = m_acceptedSocket->ReadDebugData(); if (pDebugData != NULL) debugEvent.SetDebugData(itemNode, pDebugData); *************** *** 717,722 **** { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_EVALUATE_EXPR); ! int exprRef = ReadInt(m_acceptedSocket); ! wxString strResult = ReadString(m_acceptedSocket); debugEvent.SetMessage(strResult); --- 717,722 ---- { wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_EVALUATE_EXPR); ! int exprRef = m_acceptedSocket->ReadInt(); ! wxString strResult = m_acceptedSocket->ReadString(); debugEvent.SetMessage(strResult); *************** *** 782,788 **** try { ! if (WriteByte(m_acceptedSocket, wxLUA_CMD_EVALUATE_EXPR) && ! WriteInt(m_acceptedSocket, exprRef) && ! WriteString(m_acceptedSocket, strExpression)) { return true; --- 782,788 ---- try { ! if (m_acceptedSocket->WriteByte(wxLUA_CMD_EVALUATE_EXPR) && ! m_acceptedSocket->WriteInt(exprRef) && ! m_acceptedSocket->WriteString(strExpression)) { return true; Index: dservice.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dservice.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dservice.cpp 2 May 2006 05:25:06 -0000 1.17 --- dservice.cpp 6 Sep 2006 05:33:09 -0000 1.18 *************** *** 67,304 **** // wxLuaDebugSocket - Handles Debugger/Debuggee IO // ---------------------------------------------------------------------------- - unsigned char wxLuaDebugSocket::ReadByte() - { - unsigned char value; - m_socket->Read((char *) &value, sizeof(value)); - return value; - } - - short wxLuaDebugSocket::ReadWord() - { - short value; - m_socket->Read((char *)&value, sizeof(value)); - return value; - } - - unsigned short wxLuaDebugSocket::ReadUWord() - { - unsigned short value; - m_socket->Read((char *)&value, sizeof(value)); - return value; - } - - int wxLuaDebugSocket::ReadInt() - { - int value; - m_socket->Read((char *) &value, sizeof(value)); - return value; - } - - unsigned int wxLuaDebugSocket::ReadUInt() - { - unsigned int value; - m_socket->Read((char *) &value, sizeof(value)); - return value; - } - - long wxLuaDebugSocket::ReadLong() - { - long value; - m_socket->Read((char *) &value, sizeof(value)); - return value; - } - - unsigned long wxLuaDebugSocket::ReadULong() - { - unsigned long value; - m_socket->Read((char *) &value, sizeof(value)); - return value; - } - - wxString wxLuaDebugSocket::ReadString() - { - wxString value; - unsigned int length = ReadInt(); - if (length > 0) - { - char *buffer = new char[length + 1]; - if (buffer) - { - m_socket->Read(buffer, length); - buffer[length] = 0; - value = lua2wx(buffer); - delete[] buffer; - } - } - - return value; - } - - wxLuaDebugData *wxLuaDebugSocket::ReadDebugData() - { - wxLuaDebugData *pSortedList = new wxLuaDebugData(); - - size_t idx, idxMax = 0; - m_socket->Read((char *) &idxMax, sizeof(idxMax)); - - for (idx = 0; idx < idxMax; ++idx) - { - int bufferLength; - m_socket->Read((char *) &bufferLength, sizeof(bufferLength)); - if (bufferLength > 0) - { - char *pBuffer = new char[bufferLength]; - char *pMemory = pBuffer; - m_socket->Read(pMemory, bufferLength); - int nReference = *(int *) pMemory; - pMemory += sizeof(int); - int nIndex = *(int *) pMemory; - pMemory += sizeof(int); - bool fExpanded = (0 != *(int *) pMemory); - pMemory += sizeof(int); ! const char *pNamePtr = pMemory; ! pMemory += strlen(pNamePtr) + 1; ! const char *pTypePtr = pMemory; ! pMemory += strlen(pTypePtr) + 1; ! const char *pValuePtr = pMemory; ! pMemory += strlen(pValuePtr) + 1; ! const char *pSourcePtr = pMemory; ! ! wxLuaDebugDataItem *pItem = new wxLuaDebugDataItem(lua2wx(pNamePtr), ! lua2wx(pTypePtr), ! lua2wx(pValuePtr), ! lua2wx(pSourcePtr), ! nReference, ! nIndex, ! fExpanded); ! pSortedList->Add(pItem); ! ! delete[] pBuffer; ! } ! } ! ! return pSortedList; ! } ! ! bool wxLuaDebugSocket::WriteByte(unsigned char value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteWord(short value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteUWord(unsigned short value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteInt(int value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteUInt(unsigned int value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteLong(long value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteULong(unsigned long value) ! { ! m_socket->Write((const char *) &value, sizeof(value)); ! return !m_socket->Error(); ! } ! ! bool wxLuaDebugSocket::WriteString(const wxString &value) { ! wxLuaCharBuffer buf(value); ! int buflen = buf.Length(); ! m_socket->Write((const char *) &buflen, sizeof(buflen)); ! if (m_socket->Error()) ! return false; ! ! if (buflen > 0) ! { ! m_socket->Write(buf.GetData(), buflen); ! if (m_socket->Error()) ! return false; ! } ! ! return true; } ! bool wxLuaDebugSocket::WriteDebugData(const wxLuaDebugData *pSortedList) { ! size_t idx, idxMax = pSortedList->Count(); ! ! m_socket->Write((const char *) &idxMax, sizeof(idxMax)); ! if (m_socket->Error()) ! return false; ! ! for (idx = 0; idx < idxMax; ++idx) ! { ! const wxLuaDebugDataItem *item = pSortedList->Item(idx); ! ! int nameLength = item->GetName().Length() + 1; ! int typeLength = item->GetType().Length() + 1; ! int valueLength = item->GetValue().Length() + 1; ! int sourceLength = item->GetSource().Length() + 1; ! ! int bufferLength = (3 * sizeof(int)) + ! nameLength + ! typeLength + ! valueLength + ! sourceLength; ! ! m_socket->Write((const char *) &bufferLength, sizeof(bufferLength)); ! if (m_socket->Error()) ! return false; ! ! unsigned char *pBuffer = new unsigned char[bufferLength]; ! unsigned char *pMemory = pBuffer; ! ! *(int *) pMemory = item->GetReference(); ! pMemory += sizeof(int); ! ! *(int *) pMemory = item->GetIndex(); ! pMemory += sizeof(int); ! ! *(int *) pMemory = item->IsExpanded() ? 1 : 0; ! pMemory += sizeof(int); ! ! memcpy(pMemory, wx2lua(item->GetName()), nameLength); ! pMemory += nameLength; ! ! memcpy(pMemory, wx2lua(item->GetType()), typeLength); ! pMemory += typeLength; ! ! memcpy(pMemory, wx2lua(item->GetValue()), valueLength); ! pMemory += valueLength; ! ! memcpy(pMemory, wx2lua(item->GetSource()), sourceLength); ! ! m_socket->Write((const char *) pBuffer, bufferLength); ! ! delete[] pBuffer; ! ! if (m_socket->Error()) ! return false; ! } ! ! return true; } --- 67,83 ---- // wxLuaDebugSocket - Handles Debugger/Debuggee IO // ---------------------------------------------------------------------------- ! int wxLuaDebugSocket::Read(char *buffer, int length) { ! wxCHECK_MSG(m_socket, 0, wxT("Invalid wxSocketBase")); ! m_socket->Read(buffer, (wxUint32)length); ! return m_socket->LastCount(); } ! int wxLuaDebugSocket::Write(const char *buffer, int length) { ! wxCHECK_MSG(m_socket, 0, wxT("Invalid wxSocketBase")); ! m_socket->Write(buffer, (wxUint32)length); ! return m_socket->LastCount(); } *************** *** 667,681 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_BREAK); #if wxCHECK_VERSION(2,3,0) ! m_debuggerSocketList[i]->WriteString(fileName.GetFullPath()); #else ! m_debuggerSocketList[i]->WriteString(fileName); #endif ! m_debuggerSocketList[i]->WriteInt(lineNumber); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 446,462 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_BREAK); #if wxCHECK_VERSION(2,3,0) ! dSocket->WriteString(fileName.GetFullPath()); #else ! dSocket->WriteString(fileName); #endif ! dSocket->WriteInt(lineNumber); ! if (!dSocket->Error()) result = true; } *************** *** 691,700 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_ERROR); ! m_debuggerSocketList[i]->WriteString(errorMsg); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 472,483 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_ERROR); ! dSocket->WriteString(errorMsg); ! if (!dSocket->Error()) result = true; } *************** *** 710,719 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_ERROR); ! m_debuggerSocketList[i]->WriteString(errorMsg); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 493,504 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_ERROR); ! dSocket->WriteString(errorMsg); ! if (!dSocket->Error()) result = true; } *************** *** 729,737 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_EXIT); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 514,524 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_EXIT); ! if (!dSocket->Error()) result = true; } *************** *** 747,756 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! m_debuggerSocketList[i]->WriteDebugData(pDebugData); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 534,545 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! dSocket->WriteDebugData(pDebugData); ! if (!dSocket->Error()) result = true; } *************** *** 768,778 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); ! m_debuggerSocketList[i]->WriteInt(entryRef); ! m_debuggerSocketList[i]->WriteDebugData(pDebugData); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 557,569 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); ! dSocket->WriteInt(entryRef); ! dSocket->WriteDebugData(pDebugData); ! if (!dSocket->Error()) result = true; } *************** *** 790,800 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); ! m_debuggerSocketList[i]->WriteLong(itemNode); ! m_debuggerSocketList[i]->WriteDebugData(pDebugData); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 581,593 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); ! dSocket->WriteLong(itemNode); ! dSocket->WriteDebugData(pDebugData); ! if (!dSocket->Error()) result = true; } *************** *** 812,822 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_EVALUATE_EXPR); ! m_debuggerSocketList[i]->WriteInt(exprRef); ! m_debuggerSocketList[i]->WriteString(strResult); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 605,617 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_EVALUATE_EXPR); ! dSocket->WriteInt(exprRef); ! dSocket->WriteString(strResult); ! if (!dSocket->Error()) result = true; } *************** *** 832,849 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { if (!debugSocket || debugSocket == m_debuggerSocketList[i]) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_BREAKPOINT_ADDED); #if wxCHECK_VERSION(2,3,0) ! m_debuggerSocketList[i]->WriteString(breakPoint.GetFileName().GetFullPath()); #else ! m_debuggerSocketList[i]->WriteString(breakPoint.GetFileName()); #endif ! m_debuggerSocketList[i]->WriteInt(breakPoint.GetLine()); ! m_debuggerSocketList[i]->WriteInt((int)breakPoint.GetEnabled()); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 627,646 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { if (!debugSocket || debugSocket == m_debuggerSocketList[i]) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_BREAKPOINT_ADDED); #if wxCHECK_VERSION(2,3,0) ! dSocket->WriteString(breakPoint.GetFileName().GetFullPath()); #else ! dSocket->WriteString(breakPoint.GetFileName()); #endif ! dSocket->WriteInt(breakPoint.GetLine()); ! dSocket->WriteInt((int)breakPoint.GetEnabled()); ! if (!dSocket->Error()) result = true; } *************** *** 860,877 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { if (!debugSocket || debugSocket == m_debuggerSocketList[i]) { ! m_debuggerSocketList[i]->WriteByte(wxLUA_EVENT_DEBUG_BREAKPOINT_REMOVED); #if wxCHECK_VERSION(2,3,0) ! m_debuggerSocketList[i]->WriteString(breakPoint.GetFileName().GetFullPath()); #else ! m_debuggerSocketList[i]->WriteString(breakPoint.GetFileName()); #endif ! m_debuggerSocketList[i]->WriteInt(breakPoint.GetLine()); ! m_debuggerSocketList[i]->WriteInt((int)breakPoint.GetEnabled()); ! if (!m_debuggerSocketList[i]->Error()) result = true; } --- 657,676 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { if (!debugSocket || debugSocket == m_debuggerSocketList[i]) { ! wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; ! dSocket->WriteByte(wxLUA_EVENT_DEBUG_BREAKPOINT_REMOVED); #if wxCHECK_VERSION(2,3,0) ! dSocket->WriteString(breakPoint.GetFileName().GetFullPath()); #else ! dSocket->WriteString(breakPoint.GetFileName()); #endif ! dSocket->WriteInt(breakPoint.GetLine()); ! dSocket->WriteInt((int)breakPoint.GetEnabled()); ! if (!dSocket->Error()) result = true; } *************** *** 885,889 **** wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! for (size_t i = 0; i < m_debuggerSocketList.GetCount(); i++) { if (m_debuggerSocketList[i]->WaitForRead()) --- 684,689 ---- wxCriticalSectionLocker locker(m_debuggerSocketListCriticalSection); ! size_t i, count = m_debuggerSocketList.GetCount(); ! for (i = 0; i < count; i++) { if (m_debuggerSocketList[i]->WaitForRead()) Index: wxlsock.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlsock.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wxlsock.cpp 28 Aug 2006 05:26:21 -0000 1.7 --- wxlsock.cpp 6 Sep 2006 05:33:09 -0000 1.8 *************** *** 23,26 **** --- 23,28 ---- #include "wxluasocket/include/wxlsock.h" + #include "wxlua/include/wxlstate.h" + #include "wxluadebug/include/wxldebug.h" #ifdef _MSC_VER *************** *** 28,33 **** #endif ! extern const wxCharBuffer wx2lua(const wxString& AppString); ! extern wxString lua2wx(const char* c_str); // ---------------------------------------------------------------------------- --- 30,276 ---- #endif ! // ---------------------------------------------------------------------------- ! // wxLuaSocketBase ! // ---------------------------------------------------------------------------- ! ! unsigned char wxLuaSocketBase::ReadByte() ! { ! unsigned char value = 0; ! Read((char *) &value, sizeof(value)); ! return value; ! } ! ! short wxLuaSocketBase::ReadWord() ! { ! short value = 0; ! Read((char *)&value, sizeof(value)); ! return value; ! } ! ! unsigned short wxLuaSocketBase::ReadUWord() ! { ! unsigned short value = 0; ! Read((char *)&value, sizeof(value)); ! return value; ! } ! ! int wxLuaSocketBase::ReadInt() ! { ! int value = 0; ! Read((char *) &value, sizeof(value)); ! return value; ! } ! ! unsigned int wxLuaSocketBase::ReadUInt() ! { ! unsigned int value = 0; ! Read((char *) &value, sizeof(value)); ! return value; ! } ! ! long wxLuaSocketBase::ReadLong() ! { ! long value = 0; ! Read((char *) &value, sizeof(value)); ! return value; ! } ! ! unsigned long wxLuaSocketBase::ReadULong() ! { ! unsigned long value = 0; ! Read((char *) &value, sizeof(value)); ! return value; ! } ! ! wxString wxLuaSocketBase::ReadString() ! { ! wxString value; ! unsigned int length = ReadInt(); ! if (length > 0) ! { ! char *buffer = new char[length + 1]; ! memset(buffer, 0, length+1); ! Read(buffer, length); ! buffer[length] = 0; ! value = lua2wx(buffer); ! delete[] buffer; ! } ! return value; ! } ! ! wxLuaDebugData *wxLuaSocketBase::ReadDebugData() ! { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! ! try ! { ! int idx, idxMax = 0; ! Read((char *) &idxMax, sizeof(int)); ! ! for (idx = 0; idx < idxMax; ++idx) ! { ! int bufferLength; ! Read((char *) &bufferLength, sizeof(bufferLength)); ! if (bufferLength > 0) ! { ! char *pBuffer = new char[bufferLength]; ! char *pMemory = pBuffer; ! Read(pMemory, bufferLength); ! ! int nReference = *(int *) pMemory; ! pMemory += sizeof(int); ! ! int nIndex = *(int *) pMemory; ! pMemory += sizeof(int); ! ! bool fExpanded = (0 != (*(int *) pMemory)); ! pMemory += sizeof(int); ! ! const char *pNamePtr = pMemory; ! pMemory += strlen(pNamePtr) + 1; ! const char *pTypePtr = pMemory; ! pMemory += strlen(pTypePtr) + 1; ! const char *pValuePtr = pMemory; ! ! wxLuaDebugDataItem *pItem = new wxLuaDebugDataItem(lua2wx(pNamePtr), ! lua2wx(pTypePtr), ! lua2wx(pValuePtr), ! wxEmptyString, // FIXME! source? ! nReference, ! nIndex, ! fExpanded); ! pSortedList->Add(pItem); ! ! delete[] pBuffer; ! } ! } ! } ! catch(wxLuaSocketException & /*e*/) ! { ! delete pSortedList; ! pSortedList = NULL; ! } ! ! return pSortedList; ! } ! ! bool wxLuaSocketBase::WriteCharData(const char* value, int length) ! { ! try ! { ! Write(value, length); ! return true; ! } ! catch(wxLuaSocketException & /*e*/) ! { ! } ! return false; ! } ! bool wxLuaSocketBase::WriteByte(unsigned char value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteWord(short value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteUWord(unsigned short value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteInt(int value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteUInt(unsigned int value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteLong(long value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! bool wxLuaSocketBase::WriteULong(unsigned long value) ! { ! return WriteCharData((const char *)&value, sizeof(value)); ! } ! ! bool wxLuaSocketBase::WriteString(const wxString &value) ! { ! try ! { ! wxLuaCharBuffer buf(value); ! int buflen = buf.Length(); ! Write((const char *)&buflen, sizeof(buflen)); ! if (buflen > 0) ! { ! Write(buf.GetData(), buflen); ! } ! return true; ! } ! catch(wxLuaSocketException & /*e*/) ! { ! } ! return false; ! } ! ! bool wxLuaSocketBase::WriteDebugData(const wxLuaDebugData *pSortedList) ! { ! bool result = false; ! int idx, idxMax = pSortedList->Count(); ! ! Write((const char *) &idxMax, sizeof(int)); ! ! for (idx = 0; idx < idxMax; ++idx) ! { ! try ! { ! const wxLuaDebugDataItem *item = pSortedList->Item(idx); ! ! int nameLength = item->GetName().Length() + 1; ! int typeLength = item->GetType().Length() + 1; ! int valueLength = item->GetValue().Length() + 1; ! ! int bufferLength = (3 * sizeof(int)) + ! nameLength + ! typeLength + ! valueLength; ! ! unsigned char *pBuffer = new unsigned char[bufferLength]; ! unsigned char *pMemory = pBuffer; ! ! Write((const char *) &bufferLength, sizeof(bufferLength)); ! ! *(int *) pMemory = item->GetReference(); ! pMemory += sizeof(int); ! ! *(int *) pMemory = item->GetIndex(); ! pMemory += sizeof(int); ! ! *(int *) pMemory = item->IsExpanded() ? 1 : 0; ! pMemory += sizeof(int); ! ! memcpy(pMemory, wx2lua(item->GetName()), nameLength); ! pMemory += nameLength; ! ! memcpy(pMemory, wx2lua(item->GetType()), typeLength); ! pMemory += typeLength; ! ! memcpy(pMemory, wx2lua(item->GetValue()), valueLength); ! ! Write((const char *) pBuffer, bufferLength); ! ! delete[] pBuffer; ! result = true; ! } ! catch(wxLuaSocketException & /*e*/) ! { ! } ! ! if (result == false) ! break; ! } ! return result; ! } // ---------------------------------------------------------------------------- *************** *** 150,158 **** // Write data to an open socket, repeat until all data has been sent. ! void wxLuaSocket::Write(const char *buffer, int length) { if ((m_sockstate != SOCKET_CONNECTED) && (m_sockstate != SOCKET_ACCEPTED)) throw wxLuaSocketException(wxLuaSocketException::SOCKET_NOT_CONNECTED); while (length > 0) { --- 393,403 ---- // Write data to an open socket, repeat until all data has been sent. ! int wxLuaSocket::Write(const char *buffer, int length_) { if ((m_sockstate != SOCKET_CONNECTED) && (m_sockstate != SOCKET_ACCEPTED)) throw wxLuaSocketException(wxLuaSocketException::SOCKET_NOT_CONNECTED); + int length = length_; + while (length > 0) { *************** *** 164,167 **** --- 409,414 ---- buffer += numWritten; } + + return length_; } Index: wxlhandl.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlhandl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxlhandl.cpp 28 Aug 2006 05:26:21 -0000 1.3 --- wxlhandl.cpp 6 Sep 2006 05:33:09 -0000 1.4 *************** *** 30,43 **** // ---------------------------------------------------------------------------- ! wxLuaHandler* wxLuaHandler::sm_luahandler = NULL; wxLuaHandler::wxLuaHandler() { ! wxASSERT_MSG(!sm_luahandler, wxT("There can only be one wxLuaHandler")); ! sm_luahandler = this; } wxLuaHandler::~wxLuaHandler() { ! sm_luahandler = NULL; } --- 30,43 ---- // ---------------------------------------------------------------------------- ! wxLuaHandler* wxLuaHandler::sm_luaHandler = NULL; wxLuaHandler::wxLuaHandler() { ! wxASSERT_MSG(!sm_luaHandler, wxT("There can only be one wxLuaHandler")); ! sm_luaHandler = this; } wxLuaHandler::~wxLuaHandler() { ! sm_luaHandler = NULL; } Index: wxldtarg.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldtarg.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wxldtarg.cpp 2 May 2006 05:25:06 -0000 1.17 --- wxldtarg.cpp 6 Sep 2006 05:33:09 -0000 1.18 *************** *** 196,206 **** try { ! wxLuaDebugCommands_Type debugCommand = (wxLuaDebugCommands_Type) ReadByte(&m_clientSocket); switch(debugCommand) { case wxLUA_CMD_ADD_BREAKPOINT: { ! wxString fileName = ReadString(&m_clientSocket); ! int lineNumber = ReadInt(&m_clientSocket); AddBreakPoint(fileName, lineNumber); --- 196,206 ---- try { ! wxLuaDebugCommands_Type debugCommand = (wxLuaDebugCommands_Type)m_clientSocket.ReadByte(); switch(debugCommand) { case wxLUA_CMD_ADD_BREAKPOINT: { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); AddBreakPoint(fileName, lineNumber); *************** *** 210,215 **** case wxLUA_CMD_REMOVE_BREAKPOINT: { ! wxString fileName = ReadString(&m_clientSocket); ! int lineNumber = ReadInt(&m_clientSocket); RemoveBreakPoint(fileName, lineNumber); --- 210,215 ---- case wxLUA_CMD_REMOVE_BREAKPOINT: { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); RemoveBreakPoint(fileName, lineNumber); *************** *** 223,228 **** case wxLUA_CMD_RUN_BUFFER: { ! wxString fileName = ReadString(&m_clientSocket); ! wxString buffer = ReadString(&m_clientSocket); Run(fileName, buffer); --- 223,228 ---- case wxLUA_CMD_RUN_BUFFER: { ! wxString fileName = m_clientSocket.ReadString(); ! wxString buffer = m_clientSocket.ReadString(); Run(fileName, buffer); *************** *** 256,260 **** case wxLUA_CMD_ENUMERATE_STACK_ENTRY: { ! int stackRef = ReadInt(&m_clientSocket); EnumerateStackEntry(stackRef); } --- 256,260 ---- case wxLUA_CMD_ENUMERATE_STACK_ENTRY: { ! int stackRef = m_clientSocket.ReadInt(); EnumerateStackEntry(stackRef); } *************** *** 263,269 **** case wxLUA_CMD_ENUMERATE_TABLE_REF: { ! int tableRef = ReadInt(&m_clientSocket); ! int index = ReadInt(&m_clientSocket); ! long itemNode = ReadLong(&m_clientSocket); EnumerateTable(tableRef, index, itemNode); } --- 263,269 ---- case wxLUA_CMD_ENUMERATE_TABLE_REF: { ! int tableRef = m_clientSocket.ReadInt(); ! int index = m_clientSocket.ReadInt(); ! long itemNode = m_clientSocket.ReadLong(); EnumerateTable(tableRef, index, itemNode); } *************** *** 276,281 **** case wxLUA_CMD_EVALUATE_EXPR: { ! int exprRef = ReadInt(&m_clientSocket); ! wxString buffer = ReadString(&m_clientSocket); EvaluateExpr(exprRef, buffer); } --- 276,281 ---- case wxLUA_CMD_EVALUATE_EXPR: { ! int exprRef = m_clientSocket.ReadInt(); ! wxString buffer = m_clientSocket.ReadString(); EvaluateExpr(exprRef, buffer); } *************** *** 601,607 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_BREAK); ! WriteString(&m_clientSocket, fileName); ! WriteInt(&m_clientSocket, lineNumber); return true; } --- 601,607 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_BREAK); ! m_clientSocket.WriteString(fileName); ! m_clientSocket.WriteInt(lineNumber); return true; } *************** *** 613,618 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_PRINT); ! WriteString(&m_clientSocket, errorMsg); return true; } --- 613,618 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_PRINT); ! m_clientSocket.WriteString(errorMsg); return true; } *************** *** 624,629 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_ERROR); ! WriteString(&m_clientSocket, errorMsg); return true; } --- 624,629 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_ERROR); ! m_clientSocket.WriteString(errorMsg); return true; } *************** *** 639,643 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_EXIT); return true; } --- 639,643 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_EXIT); return true; } *************** *** 649,654 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_STACK_ENUM); ! WriteDebugData(&m_clientSocket, pDebugData); return true; } --- 649,654 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! m_clientSocket.WriteDebugData(pDebugData); return true; } *************** *** 662,668 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); ! WriteInt(&m_clientSocket, entryRef); ! WriteDebugData(&m_clientSocket, pDebugData); return true; } --- 662,668 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); ! m_clientSocket.WriteInt(entryRef); ! m_clientSocket.WriteDebugData(pDebugData); return true; } *************** *** 676,682 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_TABLE_ENUM); ! WriteLong(&m_clientSocket, itemNode); ! WriteDebugData(&m_clientSocket, pDebugData); return true; } --- 676,682 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); ! m_clientSocket.WriteLong(itemNode); ! m_clientSocket.WriteDebugData(pDebugData); return true; } *************** *** 690,696 **** if (WaitForConnect()) { ! WriteByte(&m_clientSocket, wxLUA_EVENT_DEBUG_EVALUATE_EXPR); ! WriteInt(&m_clientSocket, exprRef); ! WriteString(&m_clientSocket, strResult); return true; } --- 690,696 ---- if (WaitForConnect()) { ! m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_EVALUATE_EXPR); ! m_clientSocket.WriteInt(exprRef); ! m_clientSocket.WriteString(strResult); return true; } |