From: John L. <jr...@us...> - 2007-05-21 01:08:33
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14147/wxLua/modules/wxluasocket/include Modified Files: dservice.h wxldserv.h wxlsock.h wxluasocketdefs.h 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: wxldserv.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldserv.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** wxldserv.h 19 May 2007 17:14:13 -0000 1.31 --- wxldserv.h 21 May 2007 01:08:00 -0000 1.32 *************** *** 19,23 **** class WXDLLIMPEXP_WXLUASOCKET wxLuaDebuggerBase; class WXDLLIMPEXP_WXLUASOCKET wxLuaDebuggerEvent; - class WXDLLIMPEXP_WXLUADEBUG wxLuaStackDialog; // ---------------------------------------------------------------------------- --- 19,22 ---- Index: wxlsock.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxlsock.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxlsock.h 19 May 2007 02:05:47 -0000 1.21 --- wxlsock.h 21 May 2007 01:08:00 -0000 1.22 *************** *** 59,62 **** --- 59,67 ---- virtual ~wxLuaSocketBase() {} + // Get the port used for the socket, -1 if not initialized + int GetPortNumber() const { return m_port_number; } + // Get the address of the socket, empty string if not initialized + wxString GetAddress() const { return m_address; } + // Is the socket currently connected virtual bool IsConnected() = 0; *************** *** 96,101 **** // implementation ! wxString m_name; // human readable name for the socket, for debugging ! wxString m_errorMsg; // human readable error message int m_port_number; // The port that's used, else -1 --- 101,107 ---- // implementation ! wxString m_name; // human readable name of socket, for debugging ! wxString m_errorMsg; // human readable error message ! wxString m_address; // The address for the socket to use int m_port_number; // The port that's used, else -1 Index: wxluasocketdefs.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxluasocketdefs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wxluasocketdefs.h 5 Sep 2006 21:48:11 -0000 1.4 --- wxluasocketdefs.h 21 May 2007 01:08:00 -0000 1.5 *************** *** 33,35 **** --- 33,44 ---- #endif + // ---------------------------------------------------------------------------- + // Defines for various things + // ---------------------------------------------------------------------------- + + #define ID_WXLUA_SERVER 1200 + #define ID_WXLUA_SOCKET 1201 + + #define WXLUA_SOCKET_PORT 1561 + #endif // __WX_WXLUASOCKETDEFS_H__ Index: dservice.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/dservice.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dservice.h 19 May 2007 02:05:47 -0000 1.22 --- dservice.h 21 May 2007 01:08:00 -0000 1.23 *************** *** 28,266 **** // This service waits for client - debugger to connect. - #ifndef WX_LUA_DEBUGGERSERVICE_H - #define WX_LUA_DEBUGGERSERVICE_H - - #include "wxluasocket/include/wxluasocketdefs.h" - - #include "wx/dynarray.h" - #include "wx/filename.h" - - #include "wxlua/include/wxlua.h" - #include "wxluasocket/include/wxlsock.h" - - #define ID_WXLUA_SERVER 1200 - #define ID_WXLUA_SOCKET 1201 - #define ID_WXLUA_SOCKET_DEBUGGER 1202 - - #define WXLUA_SOCKET_PORT 1561 - - class WXDLLIMPEXP_WXLUASOCKET wxLuaDebugService; - class WXDLLIMPEXP_WXLUASOCKET wxLuaDebuggee; - - #include "wxluasocket/include/wxldserv.h" - - WX_DECLARE_USER_EXPORTED_LIST(wxLuawxSocket, wxLuawxSocketList, WXDLLIMPEXP_WXLUASOCKET); - - // ---------------------------------------------------------------------------- - // wxLuaBreakPoint - Project BreakPoint - a filename/line pair - // ---------------------------------------------------------------------------- - - class WXDLLIMPEXP_WXLUASOCKET wxLuaBreakPoint : public wxObject - { - public: - wxLuaBreakPoint(); - wxLuaBreakPoint(const wxLuaBreakPoint& breakPoint) { Copy(breakPoint); } - wxLuaBreakPoint(const wxFileName& fileName, int line, bool enabled = true); - ~wxLuaBreakPoint() {} - - // Filename - wxFileName& GetFileName() { return m_fileName; } - void SetFileName(wxFileName& fileName) { m_fileName = fileName; } - - // Line - int GetLine() const { return m_line; } - void SetLine(int line) { m_line = line; } - - // Breakpoint Enabled - int GetEnabled() const { return m_enabled; } - void SetEnabled(bool enable) { m_enabled = enable; } - - static wxString GetBreakPointKey(const wxFileName& fileName, int line) - { - return wxString::Format(wxT("%u:%s"), line, fileName.GetFullPath().c_str()); - } - - // operators - void operator= (const wxLuaBreakPoint& data) { Copy(data); } - - private: - void Copy(const wxLuaBreakPoint& breakPoint); - - wxFileName m_fileName; - bool m_enabled; - int m_line; - }; - - WX_DECLARE_USER_EXPORTED_LIST(wxLuaBreakPoint, wxLuaBreakPointList, WXDLLIMPEXP_WXLUASOCKET); - - // ---------------------------------------------------------------------------- - // wxLuaDebuggee - Accepts Commands from Debugger, Redirects Lua Events to Debugger - // ---------------------------------------------------------------------------- - - class WXDLLIMPEXP_WXLUASOCKET wxLuaDebuggee : public wxObject - { - friend class wxLuaDebugService; - - public: - wxLuaDebuggee(wxLuaDebugService * debugService, lua_State *L); - virtual ~wxLuaDebuggee(); - - void AddBreakPoint(const wxFileName &fileName, int lineNumber); - void RemoveBreakPoint(const wxFileName &fileName, int lineNumber); - void DisableBreakPoint(const wxFileName &fileName, int lineNumber); - void EnableBreakPoint(const wxFileName &fileName, int lineNumber); - - void InteruptWait(); - - void NotifyBreakPoints(wxLuawxSocket* debugSocket = NULL); - protected: - - enum debugOperations - { - DEBUG_STEP, - DEBUG_STEPOVER, - DEBUG_STEPOUT, - DEBUG_GO - }; - - wxLuaDebugService* m_debugService; - wxLuaState m_wxlState; - - wxLuaBreakPointList m_breakPointList; - - debugOperations m_nextOperation; - bool m_forceBreak; - bool m_resetRequested; - bool m_fErrorsSeen; - int m_nFramesUntilBreak; - wxArrayInt m_references; - bool m_InDebugHook; - bool m_Wait; - wxCriticalSection m_luaCriticalSection; - - // Enter/Leave critical section for the threaded sockets - void EnterLuaCriticalSection() { m_luaCriticalSection.Enter(); } - void LeaveLuaCriticalSection() { m_luaCriticalSection.Leave(); } - - mutable wxCriticalSection m_breakPointListCriticalSection; - - // Do Debug Commands - void ClearAllBreakPoints(); - void Step(); - void StepOver(); - void StepOut(); - void Continue(); - void Break(); - void Reset(); - bool EnumerateStack(); - bool EnumerateStackEntry(int stackRef); - bool EnumerateTable(int tableRef, int nIndex, long itemNode); - bool EvaluateExpr(int exprRef, const wxString &strExpr); - void ClearReferences(); - - // Some Outputs - void DisplayError(const wxString &strError); - void NotifyPrint(const wxString &strMsg); - - // Debug Events from LuaDebugHook - bool DebugHook(int event); - - private: - bool AtBreakPoint(const wxFileName &fileName, int lineNumber) const; - - wxFileName GetDebugInfo(int &lineNumber) const; - - // Debug Events from Lua Interpreter - static void LUACALL LuaDebugHook(lua_State *L, lua_Debug *debug); - static int LUACALL LuaPrint (lua_State *L); - }; - - - WX_DECLARE_USER_EXPORTED_LIST(wxLuaDebuggee, wxLuaDebuggeeList, WXDLLIMPEXP_WXLUASOCKET); - - // ---------------------------------------------------------------------------- - // wxLuaDebugService - App Debugging Service - // ---------------------------------------------------------------------------- - - class WXDLLIMPEXP_WXLUASOCKET wxLuaDebugService : public wxEvtHandler - { - public: - wxLuaDebugService(int portNumber = WXLUA_SOCKET_PORT); - virtual ~wxLuaDebugService(); - - // Start Service - bool StartService(); - - // Debug Lua Interpreter - void DebugLua(lua_State* L); - - bool IsDebugger(); - - // Send Data to Debugger - bool NotifyBreak(const wxFileName &fileName, int lineNumber); - bool NotifyPrint(const wxString &errorMsg); - bool NotifyError(const wxString &errorMsg); - bool NotifyExit(); - bool NotifyStackEnumeration(const wxLuaDebugData& debugData); - bool NotifyStackEntryEnumeration(int stackRef, const wxLuaDebugData& debugData); - bool NotifyTableEnumeration(long itemNode, const wxLuaDebugData& debugData); - bool NotifyEvaluateExpr(int exprRef, const wxString &strResult); - bool NotifyBreakpointAdded(wxLuaBreakPoint& breakPoint, wxLuawxSocket* debugSocket = NULL); - bool NotifyBreakpointRemoved(wxLuaBreakPoint& breakPoint, wxLuawxSocket* debugSocket = NULL); - - wxLuaDebuggee* GetActiveDebuggee(); - - bool WaitForRead(); - - protected: - void OnServerEvent(wxSocketEvent& event); - void OnSocketEvent(wxSocketEvent& event); - - wxLuawxSocket* GetDebugSocket(wxSocketBase* sock); - - private: - wxSocketServer* m_serverSocket; - int m_portNumber; - - // Debuggers connected to Service - mutable wxCriticalSection m_debuggerSocketListCriticalSection; - wxLuawxSocketList m_debuggerSocketList; - - // Lua Interpreters Hooked by Service - mutable wxCriticalSection m_debuggeeListCriticalSection; - wxLuaDebuggeeList m_debuggeeList; - - mutable wxCriticalSection m_notifyBreakCriticalSection; - - DECLARE_EVENT_TABLE() - }; - - // ---------------------------------------------------------------------------- - // wxLuaDebugger - Lua Debugger Client (Client Side of Lua Debug Service) - // ---------------------------------------------------------------------------- - - class WXDLLIMPEXP_WXLUASOCKET wxLuaDebugger : public wxLuaDebuggerBase - { - public: - wxLuaDebugger(int port_number = WXLUA_SOCKET_PORT); - virtual ~wxLuaDebugger(); - - bool Connect(const wxString& hostname = wxT("localhost"), int portNumber = WXLUA_SOCKET_PORT); - - virtual wxLuaSocketBase* GetSocketBase() { return m_debuggerSocket; } - - protected: - void OnSocketEvent(wxSocketEvent& event); - - // Not Required for Debug Service - virtual bool Run(const wxString &WXUNUSED(fileName), - const wxString &WXUNUSED(buffer)) { return false; } - - private: - mutable wxCriticalSection m_debuggerSocketCriticalSection; - wxLuawxSocket* m_debuggerSocket; - - DECLARE_EVENT_TABLE() - }; - - #endif // WX_LUA_DEBUGGERSERVICE_H --- 28,29 ---- |