From: John L. <jr...@us...> - 2006-10-05 05:10:52
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28254/wxLua/modules/wxluasocket/include Modified Files: wxldserv.h wxlsock.h Log Message: change wxLuaDebugeeEvent wxEVT_WXLUA_DEBUGGER_CLIENT_CONNECTED to wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED add wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED and send it when a read/write fails make wxEvtHandler::Connect check for numbers only, NOT nil or bool enhance the wxLuaSocketException replace more nil bool values with true/false in editor.wx.lua Index: wxldserv.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxldserv.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wxldserv.h 4 Oct 2006 22:07:23 -0000 1.22 --- wxldserv.h 5 Oct 2006 05:10:47 -0000 1.23 *************** *** 95,100 **** // functions will act as a middle man to get the wxLuaDebugData through the // socket connection to the debuggee using the wxLuaDebuggerBase. ! // Note that the wxLuaState is not used in this case since it 'exists' in ! // the debuggee process. // ---------------------------------------------------------------------------- --- 95,100 ---- // functions will act as a middle man to get the wxLuaDebugData through the // socket connection to the debuggee using the wxLuaDebuggerBase. ! // Note: The wxLuaState of the wxLuaStackDialog is not used in this case ! // since it 'exists' in the debuggee process. // ---------------------------------------------------------------------------- *************** *** 120,123 **** --- 120,124 ---- protected: wxLuaDebuggerBase* m_luaDebugger; + private: DECLARE_ABSTRACT_CLASS(wxLuaDebuggerStackDialog) *************** *** 140,151 **** virtual ~wxLuaDebuggerBase(); - // Start the debugger server to listen for a debuggee. After creation - // you must call StartServer to actually start the server. - virtual bool StartServer() = 0; - // Stop the debugger server - virtual bool StopServer() = 0; - // Start a debuggee client to be debugged by this - virtual bool StartClient() = 0; - // These functions all send socket commands wxLUASOCKET_DEBUGGER_CMD_XXX // and the appropriate data to the debuggee. --- 141,144 ---- *************** *** 169,176 **** bool EvaluateExpr(int exprRef, const wxString &strExpression); - // compile the buffer in a temp lua_State returning true on success. - // Always sends a wxEVT_WXLUA_DEBUGGER_ERROR event with a message. - bool Compile(const wxString &fileName, const wxString &buffer); - // Handle the wxLuaSocketDebuggeeEvents_Type event sent by the debuggee. // returns the input event_type if ok or -1 on error --- 162,165 ---- *************** *** 181,184 **** --- 170,182 ---- // Get the debugger socket to read/write data to the debuggee virtual wxLuaSocketBase* GetSocketBase() = 0; + // Check if the socket is connected and if not send a + // wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED event with a socket error msg + virtual bool CheckSocketConnected(bool send_event = true); + // Check if the input is true (eg. return of a socket read) and if not send a + // wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED with a read error msg + virtual bool CheckSocketRead(bool read_ok); + // Check if the input is true (eg. return of a socket write) and if not send a + // wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED with a write error msg + virtual bool CheckSocketWrite(bool write_ok); // Send the event to this wxEvtHandler *************** *** 218,222 **** protected: int m_port_number; // the socket port to listen to ! wxLuaStackDialog *m_stackDialog; wxProcess *m_debuggeeProcess; // wxProcess of the debuggee long m_debuggeeProcessID; // id of the debuggee wxProcess --- 216,220 ---- protected: int m_port_number; // the socket port to listen to ! wxLuaStackDialog *m_stackDialog; // the stack dialog to wxProcess *m_debuggeeProcess; // wxProcess of the debuggee long m_debuggeeProcessID; // id of the debuggee wxProcess *************** *** 260,274 **** virtual ~wxLuaDebuggerServer(); bool StartServer(); bool StopServer(); bool StartClient(); bool StartServerThread(); bool WaitForConnect(int timeOut); void ThreadFunction(); - virtual wxLuaSocketBase* GetSocketBase() { return m_acceptedSocket; } - - protected: wxLuaSocket *m_serverSocket; wxLuaSocket *m_acceptedSocket; --- 258,276 ---- virtual ~wxLuaDebuggerServer(); + // Start the debugger server to listen for a debuggee. After creation + // you must call StartServer to actually start the server. returns success bool StartServer(); + // Stop the debugger server, returns success bool StopServer(); + // Start a debuggee client to be debugged by this, returns success bool StartClient(); + virtual wxLuaSocketBase* GetSocketBase() { return m_acceptedSocket; } + + protected: bool StartServerThread(); bool WaitForConnect(int timeOut); void ThreadFunction(); wxLuaSocket *m_serverSocket; wxLuaSocket *m_acceptedSocket; *************** *** 295,300 **** --- 297,306 ---- virtual ~wxLuaDebuggerwxSocketServer(); + // Start the debugger server to listen for a debuggee. After creation + // you must call StartServer to actually start the server. returns success bool StartServer(); + // Stop the debugger server, returns success bool StopServer(); + // Start a debuggee client to be debugged by this, returns success bool StartClient(); *************** *** 320,324 **** // ---------------------------------------------------------------------------- ! // wxLuaDebuggerEvent // ---------------------------------------------------------------------------- --- 326,331 ---- // ---------------------------------------------------------------------------- ! // wxLuaDebuggerEvent - wxEvent sent from the wxLuaDebuggerXXX to notify when ! // the debuggee has taken action or status of the debugger. // ---------------------------------------------------------------------------- *************** *** 338,345 **** int GetLineNumber() const { return m_lineNumber;} wxString GetFileName() const { return m_fileName; } ! wxString GetMessage() const { return m_strMessage; } ! long GetReference() const { return m_nReference; } ! bool GetEnabledFlag() const { return m_fEnabledFlag; } wxLuaDebugData GetDebugData() const { return m_debugData; } protected: --- 345,353 ---- int GetLineNumber() const { return m_lineNumber;} wxString GetFileName() const { return m_fileName; } ! wxString GetMessage() const { return m_strMessage; } // check HasMessage ! bool HasMessage() const { return m_fHasMessage; } ! long GetReference() const { return m_nReference; } // lua reference wxLuaDebugData GetDebugData() const { return m_debugData; } + bool GetEnabledFlag() const { return m_fEnabledFlag; } protected: *************** *** 351,356 **** bool m_fHasMessage; long m_nReference; - bool m_fEnabledFlag; wxLuaDebugData m_debugData; private: --- 359,364 ---- bool m_fHasMessage; long m_nReference; wxLuaDebugData m_debugData; + bool m_fEnabledFlag; private: *************** *** 361,377 **** BEGIN_DECLARE_EVENT_TYPES() ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_CLIENT_CONNECTED, 2510) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAK, 2511) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_PRINT, 2512) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_ERROR, 2513) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EXIT, 2514) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STACK_ENUM, 2515) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, 2516) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, 2517) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, 2518) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, 2519) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, 2520) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, 2521) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, 2522) END_DECLARE_EVENT_TYPES() --- 369,398 ---- BEGIN_DECLARE_EVENT_TYPES() ! // The debuggee has connected to the debugger through the socket connection ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED, 2510) ! // The debuggee has disconnected to the debugger through the socket connection ! // check Has/GetMessage for a description why ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, 2510) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_BREAK ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAK, 2511) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_PRINT ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_PRINT, 2512) ! // The debuggee has sent a wxEVT_WXLUA_DEBUGGER_ERROR ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_ERROR, 2513) ! // The debuggee has sent a wxEVT_WXLUA_DEBUGGER_EXIT ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EXIT, 2514) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENUM ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STACK_ENUM, 2515) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENTRY_ENUM ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, 2516) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, 2517) ! // The debuggee has sent a wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, 2518) ! ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, 2519) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, 2520) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, 2521) ! DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUASOCKET, wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, 2522) END_DECLARE_EVENT_TYPES() *************** *** 379,395 **** (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxLuaDebuggerEventFunction, &func) ! #define EVT_WXLUA_DEBUGGER_CLIENT_CONNECTED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_CLIENT_CONNECTED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAK(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAK, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_PRINT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_PRINT, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_ERROR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_ERROR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_EXIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EXIT, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STACK_ENUM(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STACK_ENUM, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_TABLE_ENUM(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_EVALUATE_EXPR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STARTDEBUGGER(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STOPDEBUGGER(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, -1, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #endif // WX_LUA_DEBUG_SERVER_H --- 400,416 ---- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxLuaDebuggerEventFunction, &func) ! #define EVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_DEBUGGEE_CONNECTED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAK(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAK, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_PRINT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_PRINT, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_ERROR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_ERROR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_EXIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EXIT, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STACK_ENUM(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STACK_ENUM, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_TABLE_ENUM(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_EVALUATE_EXPR(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STARTDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STARTDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_STOPDEBUGGER(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_STOPDEBUGGER, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_ADDED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), ! #define EVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_WXLUA_DEBUGGER_BREAKPOINT_REMOVED, id, -1, wxLuaDebuggerEventHandler(fn), (wxObject *) NULL), #endif // WX_LUA_DEBUG_SERVER_H Index: wxlsock.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/include/wxlsock.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wxlsock.h 3 Oct 2006 05:12:45 -0000 1.18 --- wxlsock.h 5 Oct 2006 05:10:47 -0000 1.19 *************** *** 216,222 **** // constructors ! wxLuaSocketException(SocketErrorCode code); wxLuaSocketException(const wxLuaSocketException &e) ! : m_code(e.m_code), m_errnum(e.m_errnum) {} SocketErrorCode GetCode() const { return m_code; } --- 216,222 ---- // constructors ! wxLuaSocketException(SocketErrorCode code, const wxString& msg); wxLuaSocketException(const wxLuaSocketException &e) ! : m_code(e.m_code), m_msg(e.m_msg), m_errnum(e.m_errnum) {} SocketErrorCode GetCode() const { return m_code; } *************** *** 228,231 **** --- 228,232 ---- SocketErrorCode m_code; + wxString m_msg; int m_errnum; wxString m_description; |