From: John L. <jr...@us...> - 2005-11-25 18:52:30
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15042/wxLua/modules/wxluasocket/src Modified Files: debugio.cpp dserver.cpp dservice.cpp dtarget.cpp Log Message: initialize vars in debugio.cpp add static function in wxLuaHandler to get the global handler, deprecate global function code cleaning Index: dtarget.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dtarget.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dtarget.cpp 25 Nov 2005 02:43:02 -0000 1.4 --- dtarget.cpp 25 Nov 2005 18:52:22 -0000 1.5 *************** *** 65,69 **** lua_setglobal(m_luaState, "print"); ! wxGetLuaHandler().EnterLuaCriticalSection(); } --- 65,69 ---- lua_setglobal(m_luaState, "print"); ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); } *************** *** 73,77 **** delete m_pThread; ! wxGetLuaHandler().LeaveLuaCriticalSection(); } --- 73,77 ---- delete m_pThread; ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } *************** *** 414,418 **** lua_Debug luaDebug; ! wxGetLuaHandler().EnterLuaCriticalSection(); while (lua_getstack(m_luaState, nIndex, &luaDebug) != 0) --- 414,418 ---- lua_Debug luaDebug; ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); while (lua_getstack(m_luaState, nIndex, &luaDebug) != 0) *************** *** 444,448 **** ++nIndex; } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } return NotifyStackEnumeration(pSortedList); --- 444,448 ---- ++nIndex; } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } return NotifyStackEnumeration(pSortedList); *************** *** 454,458 **** if (pSortedList != NULL) { ! wxGetLuaHandler().EnterLuaCriticalSection(); { lua_Debug luaDebug; --- 454,458 ---- if (pSortedList != NULL) { ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { lua_Debug luaDebug; *************** *** 541,545 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } return NotifyStackEntryEnumeration(stackRef, pSortedList); --- 541,545 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } return NotifyStackEntryEnumeration(stackRef, pSortedList); *************** *** 551,555 **** if (pSortedList != NULL) { ! wxGetLuaHandler().EnterLuaCriticalSection(); { if (tableRef == -1) --- 551,555 ---- if (pSortedList != NULL) { ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { if (tableRef == -1) *************** *** 700,704 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } return NotifyTableEnumeration(nItemNode, pSortedList); --- 700,704 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } return NotifyTableEnumeration(nItemNode, pSortedList); *************** *** 710,714 **** int nReference = LUA_NOREF; ! wxGetLuaHandler().EnterLuaCriticalSection(); { if (wxStrpbrk(strExpr.c_str(), wxT(" ~=<>+-*/%(){}[]:;,.\"'")) != NULL) --- 710,714 ---- int nReference = LUA_NOREF; ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { if (wxStrpbrk(strExpr.c_str(), wxT(" ~=<>+-*/%(){}[]:;,.\"'")) != NULL) *************** *** 838,842 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); return NotifyEvaluateExpr(exprRef, strResult); --- 838,842 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); return NotifyEvaluateExpr(exprRef, strResult); *************** *** 1078,1086 **** // release the critical section so // the other thread can access LUA ! wxGetLuaHandler().LeaveLuaCriticalSection(); // Wait for a command m_debugCondition.Wait(); // acquire the critical section again ! wxGetLuaHandler().EnterLuaCriticalSection(); } m_fStopped = false; --- 1078,1086 ---- // release the critical section so // the other thread can access LUA ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); // Wait for a command m_debugCondition.Wait(); // acquire the critical section again ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); } m_fStopped = false; Index: dserver.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dserver.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dserver.cpp 25 Nov 2005 02:43:02 -0000 1.4 --- dserver.cpp 25 Nov 2005 18:52:22 -0000 1.5 *************** *** 252,256 **** debugEvent.SetMessage(msg); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } --- 252,256 ---- debugEvent.SetMessage(msg); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } *************** *** 527,531 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_CLIENT_CONNECTED); ! wxGetLuaHandler().AddPendingEvent(debugEvent); // Enter the debug loop --- 527,531 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_CLIENT_CONNECTED); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); // Enter the debug loop *************** *** 542,546 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAK, lineNumber, fileName); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 542,546 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAK, lineNumber, fileName); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 553,557 **** debugEvent.SetMessage(strMessage); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 553,557 ---- debugEvent.SetMessage(strMessage); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 564,568 **** debugEvent.SetMessage(strMessage); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 564,568 ---- debugEvent.SetMessage(strMessage); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 571,575 **** { wxLuaDebugEvent debugEvent(wxEVT_DEBUG_EXIT); ! wxGetLuaHandler().AddPendingEvent(debugEvent); m_fShutdown = true; } --- 571,575 ---- { wxLuaDebugEvent debugEvent(wxEVT_DEBUG_EXIT); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); m_fShutdown = true; } *************** *** 583,587 **** debugEvent.SetDebugData(-1, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 583,587 ---- debugEvent.SetDebugData(-1, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 595,599 **** debugEvent.SetDebugData(stackRef, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 595,599 ---- debugEvent.SetDebugData(stackRef, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 607,611 **** debugEvent.SetDebugData(itemNode, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 607,611 ---- debugEvent.SetDebugData(itemNode, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 620,624 **** debugEvent.SetDebugData(exprRef); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 620,624 ---- debugEvent.SetDebugData(exprRef); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; Index: dservice.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dservice.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dservice.cpp 20 Nov 2005 20:10:41 -0000 1.1 --- dservice.cpp 25 Nov 2005 18:52:22 -0000 1.2 *************** *** 596,600 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_STOPDEBUGGER); ! wxGetLuaHandler().ProcessEvent(debugEvent); } --- 596,600 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_STOPDEBUGGER); ! wxLuaHandler::GetHandler().ProcessEvent(debugEvent); } *************** *** 660,664 **** // started debug process ! if (!wxGetLuaHandler().ProcessEvent(debugEvent)) return false; --- 660,664 ---- // started debug process ! if (!wxLuaHandler::GetHandler().ProcessEvent(debugEvent)) return false; *************** *** 987,991 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAK, lineNumber, fileName); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 987,991 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAK, lineNumber, fileName); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 998,1002 **** debugEvent.SetMessage(strMessage); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 998,1002 ---- debugEvent.SetMessage(strMessage); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1009,1013 **** debugEvent.SetMessage(strMessage); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1009,1013 ---- debugEvent.SetMessage(strMessage); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1016,1020 **** { wxLuaDebugEvent debugEvent(wxEVT_DEBUG_EXIT); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1016,1020 ---- { wxLuaDebugEvent debugEvent(wxEVT_DEBUG_EXIT); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1027,1031 **** debugEvent.SetDebugData(-1, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1027,1031 ---- debugEvent.SetDebugData(-1, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1039,1043 **** debugEvent.SetDebugData(stackRef, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1039,1043 ---- debugEvent.SetDebugData(stackRef, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1051,1055 **** debugEvent.SetDebugData(itemNode, pDebugData); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1051,1055 ---- debugEvent.SetDebugData(itemNode, pDebugData); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1064,1068 **** debugEvent.SetDebugData(exprRef); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1064,1068 ---- debugEvent.SetDebugData(exprRef); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1075,1079 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_ADDED, line, fileName, enabled); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1075,1079 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_ADDED, line, fileName, enabled); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1085,1089 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_REMOVED, line, fileName); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } break; --- 1085,1089 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_REMOVED, line, fileName); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } break; *************** *** 1250,1254 **** debugEvent.SetMessage(msg); ! wxGetLuaHandler().AddPendingEvent(debugEvent); } --- 1250,1254 ---- debugEvent.SetMessage(msg); ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } *************** *** 1277,1281 **** lua_setglobal(m_luaState, "print"); ! wxGetLuaHandler().EnterLuaCriticalSection(); } --- 1277,1281 ---- lua_setglobal(m_luaState, "print"); ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); } *************** *** 1295,1299 **** } ! wxGetLuaHandler().LeaveLuaCriticalSection(); // Unhook --- 1295,1299 ---- } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); // Unhook *************** *** 1400,1404 **** // release the critical section so // the other thread can access LUA ! wxGetLuaHandler().LeaveLuaCriticalSection(); // Wait for Debugger To Send Command --- 1400,1404 ---- // release the critical section so // the other thread can access LUA ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); // Wait for Debugger To Send Command *************** *** 1417,1421 **** // acquire the critical section again ! wxGetLuaHandler().EnterLuaCriticalSection(); } --- 1417,1421 ---- // acquire the critical section again ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); } *************** *** 1473,1477 **** #endif ! wxGetLuaHandler().AddPendingEvent(debugEvent); } } --- 1473,1477 ---- #endif ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); } } *************** *** 1499,1503 **** wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_REMOVED, lineNumber, fileName); #endif ! wxGetLuaHandler().AddPendingEvent(debugEvent); delete breakPoint; --- 1499,1503 ---- wxLuaDebugEvent debugEvent(wxEVT_DEBUG_BREAKPOINT_REMOVED, lineNumber, fileName); #endif ! wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); delete breakPoint; *************** *** 1590,1594 **** lua_Debug luaDebug; ! wxGetLuaHandler().EnterLuaCriticalSection(); while (lua_getstack(m_luaState, nIndex, &luaDebug) != 0) --- 1590,1594 ---- lua_Debug luaDebug; ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); while (lua_getstack(m_luaState, nIndex, &luaDebug) != 0) *************** *** 1623,1627 **** ++nIndex; } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } --- 1623,1627 ---- ++nIndex; } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } *************** *** 1634,1638 **** if (pSortedList != NULL) { ! wxGetLuaHandler().EnterLuaCriticalSection(); { lua_Debug luaDebug; --- 1634,1638 ---- if (pSortedList != NULL) { ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { lua_Debug luaDebug; *************** *** 1722,1726 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } --- 1722,1726 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } *************** *** 1733,1737 **** if (pSortedList != NULL) { ! wxGetLuaHandler().EnterLuaCriticalSection(); { if (tableRef == -1) --- 1733,1737 ---- if (pSortedList != NULL) { ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { if (tableRef == -1) *************** *** 1883,1887 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); } --- 1883,1887 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); } *************** *** 1894,1898 **** int nReference = LUA_NOREF; ! wxGetLuaHandler().EnterLuaCriticalSection(); { if (wxStrpbrk(strExpr.c_str(), wxT(" ~=<>+-*/%(){}[]:;,.\"'")) != NULL) --- 1894,1898 ---- int nReference = LUA_NOREF; ! wxLuaHandler::GetHandler().EnterLuaCriticalSection(); { if (wxStrpbrk(strExpr.c_str(), wxT(" ~=<>+-*/%(){}[]:;,.\"'")) != NULL) *************** *** 2042,2046 **** } } ! wxGetLuaHandler().LeaveLuaCriticalSection(); return m_debugService->NotifyEvaluateExpr(exprRef, strResult); --- 2042,2046 ---- } } ! wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); return m_debugService->NotifyEvaluateExpr(exprRef, strResult); Index: debugio.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/debugio.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** debugio.cpp 7 Jun 2005 04:17:41 -0000 1.2 --- debugio.cpp 25 Nov 2005 18:52:22 -0000 1.3 *************** *** 33,37 **** unsigned char wxLuaDebugIO::ReadByte(wxLuaSocket *pSocket) { ! unsigned char value; pSocket->Read((char *) &value, sizeof(value)); return value; --- 33,37 ---- unsigned char wxLuaDebugIO::ReadByte(wxLuaSocket *pSocket) { ! unsigned char value = 0; pSocket->Read((char *) &value, sizeof(value)); return value; *************** *** 40,44 **** short wxLuaDebugIO::ReadWord(wxLuaSocket *pSocket) { ! short value; pSocket->Read((char *)&value, sizeof(value)); return value; --- 40,44 ---- short wxLuaDebugIO::ReadWord(wxLuaSocket *pSocket) { ! short value = 0; pSocket->Read((char *)&value, sizeof(value)); return value; *************** *** 47,51 **** unsigned short wxLuaDebugIO::ReadUWord(wxLuaSocket *pSocket) { ! unsigned short value; pSocket->Read((char *)&value, sizeof(value)); return value; --- 47,51 ---- unsigned short wxLuaDebugIO::ReadUWord(wxLuaSocket *pSocket) { ! unsigned short value = 0; pSocket->Read((char *)&value, sizeof(value)); return value; *************** *** 54,58 **** int wxLuaDebugIO::ReadInt(wxLuaSocket *pSocket) { ! int value; pSocket->Read((char *) &value, sizeof(value)); return value; --- 54,58 ---- int wxLuaDebugIO::ReadInt(wxLuaSocket *pSocket) { ! int value = 0; pSocket->Read((char *) &value, sizeof(value)); return value; *************** *** 61,65 **** unsigned int wxLuaDebugIO::ReadUInt(wxLuaSocket *pSocket) { ! unsigned int value; pSocket->Read((char *) &value, sizeof(value)); return value; --- 61,65 ---- unsigned int wxLuaDebugIO::ReadUInt(wxLuaSocket *pSocket) { ! unsigned int value = 0; pSocket->Read((char *) &value, sizeof(value)); return value; *************** *** 68,72 **** long wxLuaDebugIO::ReadLong(wxLuaSocket *pSocket) { ! long value; pSocket->Read((char *) &value, sizeof(value)); return value; --- 68,72 ---- long wxLuaDebugIO::ReadLong(wxLuaSocket *pSocket) { ! long value = 0; pSocket->Read((char *) &value, sizeof(value)); return value; *************** *** 75,79 **** unsigned long wxLuaDebugIO::ReadULong(wxLuaSocket *pSocket) { ! unsigned long value; pSocket->Read((char *) &value, sizeof(value)); return value; --- 75,79 ---- unsigned long wxLuaDebugIO::ReadULong(wxLuaSocket *pSocket) { ! unsigned long value = 0; pSocket->Read((char *) &value, sizeof(value)); return value; *************** *** 87,90 **** --- 87,91 ---- { char *buffer = new char[length + 1]; + memset(buffer, 0, length+1); pSocket->Read(buffer, length); buffer[length] = 0; |