From a2913dda9786a73155cf408ca03facd8ceac66dc Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 3 Aug 2007 15:02:30 -0700 Subject: [PATCH] Adding support for the "run" command and acutally using the session name * Source/DebuggerConnection.m|h: ([DebuggerConnection run]): New method that tells the script to continue running ([DebuggerConnection refreshStatus]): New method that sends the status command and then updates the display ([DebuggerConnection handshake:]): Renamed to _handshake ([DebuggerConnection updateStatus:]): Renamed to _updateStatus ([DebuggerConnection _createCommand:]): New method. Creates a new packet to send to the server with the session information tacked on * Source/DebuggerWindowController.m|h: ([DebuggerWindowController run:]): New method to forward UI command to the DebuggerConnection --- English.lproj/Debugger.nib/keyedobjects.nib | Bin 11773 -> 11768 bytes Source/DebuggerConnection.h | 7 ++++ Source/DebuggerConnection.m | 36 +++++++++++++++++--- Source/DebuggerWindowController.h | 2 ++ Source/DebuggerWindowController.m | 8 +++++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index 2a7196cdedf9917a120b511f831710bd90875e43..de8c825563c7cd9c3556ceda4e26a751ca0f97d9 100644 GIT binary patch delta 1252 zcmZvZ3ry8j9LN9n&)HA`{kKT1sB?b5^HU_^aRE&W%}1dW0trFN!;5$)kIU;mcuDu3 zoITf?b(!m7Sr8=XbvQ?)$k^ zFjCMNZWgoIwq6!((>t4^YYe;1{Kyz)vFvsh$KqK6OJsJIq-T=ZJhp)48kwwy)v`L~ zW*+8cK32~fSR-pPPMR;-vRE_Q$XeLL%+CT$u}8Wq%)?PEXO*uyIPF&6UBU-#**3o| zVAR`E%#}uy$&Eat#%M6xj9R17@EBfWu~BEZ4WF5zQdOF2Q%TCD`jkUOsA+1q@++Zw zRH15Cp=yqbS8u4Y;0q8Hu%*~iw3K^X(4$52^zx3^u`cnS&g5DyNlV3#3l?gT2)&xe z>sV)A=^U#6b7PS)J>-1I@!eMBHI^p~Ctk6f@c*7C9Glm8E=5OKab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u(eLW_^!xe){h>an59!1Di2g($)t~8O`t!6tu21MM z^hte6pVnveIsKhJuP^8y^;I6ogLnw%bASuEh==nCet<{wSRT(4_#rOlM|l#La2Y?& zPx4d_@(iBIAr5mD&*k~NfEV&2j&h7^IKfF?%niJRmvS>3Ud2!Iv%H#L=FV$)J#XNR Oyp4BcP7IaSfxiI18;)K8 diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index 6685677..f81f3d0 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -35,4 +35,11 @@ - (int)port; - (NSString *)session; +// communication +- (void)run; +- (void)refreshStatus; + +// ================= internal private +- (NSString *)_createCommand: (NSString *)cmd; + @end diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index d643e5a..69ab596 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -110,7 +110,7 @@ */ - (void)socketDidAccept { - [_socket receive: @selector(handshake:)]; + [_socket receive: @selector(_handshake:)]; } /** @@ -125,21 +125,47 @@ * The initial packet handshake. This allows us to set things like the title of the window * and glean information about hte server we are debugging */ -- (void)handshake: (NSString *)packet +- (void)_handshake: (NSString *)packet { - [_socket send: @"status -i foo"]; - [_socket receive: @selector(updateStatus:)]; + [self refreshStatus]; } /** * Handler used by dataReceived:deliverTo: for anytime the status command is issued. It sets * the window controller's status text */ -- (void)updateStatus: (NSString *)packet +- (void)_updateStatus: (NSString *)packet { NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString: packet options: NSXMLDocumentTidyXML error: nil]; [_windowController setStatus: [[[[doc rootElement] attributeForName: @"status"] stringValue] capitalizedString]]; [doc release]; } +/** + * Tells the debugger to continue running the script + */ +- (void)run +{ + [_socket send: [self _createCommand: @"run"]]; + [self refreshStatus]; +} + +/** + * Method that runs tells the debugger to give us its status. This will call _updateStatus + * and will update the status text on the window + */ +- (void)refreshStatus +{ + [_socket send: [self _createCommand: @"status"]]; + [_socket receive: @selector(_updateStatus:)]; +} + +/** + * Helper method to create a string command with the -i automatically tacked on + */ +- (NSString *)_createCommand: (NSString *)cmd +{ + return [NSString stringWithFormat: @"%@ -i %@", cmd, _session]; +} + @end diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index b1ba3b6..6bf0e58 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -31,4 +31,6 @@ - (void)setStatus: (NSString *)status; - (void)setError: (NSString *)error; +- (IBAction)run: (id)sender; + @end diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 3433caf..f165c5c 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -62,4 +62,12 @@ [_error setHidden: NO]; } +/** + * Forwards the message to run script execution to the connection + */ +- (IBAction)run: (id)sender +{ + [_connection run]; +} + @end -- 2.22.5