VDBDebuggerConsoleApplication refactored to use custom TerminalView.
--- a/Make.proto Tue Jun 10 01:13:32 2014 +0100
+++ b/Make.proto Tue Jun 10 01:38:50 2014 +0100
@@ -34,7 +34,7 @@
# add the path(es) here:,
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
# if you need any additional defines for embedded C code,
@@ -126,7 +126,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)VDBAbstractApplication.$(O) VDBAbstractApplication.$(H): VDBAbstractApplication.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
-$(OUTDIR)VDBDebuggerConsoleView.$(O) VDBDebuggerConsoleView.$(H): VDBDebuggerConsoleView.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libwidg/EditTextView.$(H) $(INCLUDE_TOP)/stx/libwidg/ListView.$(H) $(INCLUDE_TOP)/stx/libwidg/TextCollector.$(H) $(INCLUDE_TOP)/stx/libwidg/TextView.$(H) $(STCHDR)
+$(OUTDIR)VDBDebuggerConsoleView.$(O) VDBDebuggerConsoleView.$(H): VDBDebuggerConsoleView.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libwidg/EditTextView.$(H) $(INCLUDE_TOP)/stx/libwidg/ListView.$(H) $(INCLUDE_TOP)/stx/libwidg/TextCollector.$(H) $(INCLUDE_TOP)/stx/libwidg/TextView.$(H) $(INCLUDE_TOP)/stx/libwidg2/TerminalView.$(H) $(STCHDR)
$(OUTDIR)VDBInternalPipeStream.$(O) VDBInternalPipeStream.$(H): VDBInternalPipeStream.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(STCHDR)
$(OUTDIR)jv_vdb.$(O) jv_vdb.$(H): jv_vdb.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
$(OUTDIR)VDBAbstractContainer.$(O) VDBAbstractContainer.$(H): VDBAbstractContainer.st $(INCLUDE_TOP)/jv/vdb/VDBAbstractApplication.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
--- a/VDBDebuggerConsoleApplication.st Tue Jun 10 01:13:32 2014 +0100
+++ b/VDBDebuggerConsoleApplication.st Tue Jun 10 01:38:50 2014 +0100
@@ -1,7 +1,7 @@
"{ Package: 'jv:vdb' }"
VDBAbstractApplication subclass:#VDBDebuggerConsoleApplication
- instanceVariableNames:'consoleView'
+ instanceVariableNames:'consoleView consoleInput consoleOutput consoleProcess'
classVariableNames:''
poolDictionaries:''
category:'VDB-UI-Console'
@@ -56,19 +56,100 @@
consoleView
consoleView isNil ifTrue:[
- consoleView := VDBDebuggerConsoleView new.
- consoleView debuggerHolder: self debuggerHolder.
+ consoleView :=VDBDebuggerConsoleView new.
+ consoleView localEcho:true.
+ consoleView inputTranslateCRToNL:true.
+ consoleView lineEditMode: true.
+ debugger notNil ifTrue:[
+ consoleView inStream: consoleInput.
+ consoleView outStream: consoleOutput.
+ consoleView startReaderProcessWhenVisible.
+ ].
].
^ consoleView
"Created: / 09-06-2014 / 10:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-06-2014 / 01:37:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBDebuggerConsoleApplication methodsFor:'event handling'!
+
+onCommandEvent: event
+
+ "Created: / 06-06-2014 / 22:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onCommandResultEvent: event
+
+ "Created: / 06-06-2014 / 22:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-06-2014 / 01:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onConsoleOutputEvent: event
+ consoleOutput nextPutAll: event value.
+ consoleOutput nextPut: Character return.
+
+ "Created: / 06-06-2014 / 21:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-06-2014 / 01:33:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-debuggerHolder:aValueModel
- super debuggerHolder:aValueModel.
- self consoleView debuggerHolder:aValueModel
+onTargetOutputEvent: event
+ consoleOutput nextPutAll: event value.
+ consoleOutput nextPut: Character return.
+
+ "Created: / 06-06-2014 / 21:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-06-2014 / 01:33:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBDebuggerConsoleApplication methodsFor:'hooks'!
+
+commonPostOpen
+ consoleProcess :=
+ [
+ [
+ | cmd |
+ consoleOutput nextPutAll:'(gdb) '.
+ cmd := consoleInput nextLine asString.
+ consoleOutput nextPutLine: cmd.
+ consoleOutput nextPut: Character return.
+ debugger send: (GDBCLICommand new value: cmd) wait: true.
+ ] loop.
+ ] newProcess.
+ consoleProcess name: 'VDB Debugger Console REPL loop'.
+ consoleProcess resume.
+
+ "Created: / 10-06-2014 / 01:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
- "Created: / 06-06-2014 / 22:04:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!VDBDebuggerConsoleApplication methodsFor:'initialization & release'!
+
+initialize
+ super initialize.
+
+ consoleInput := VDBInternalPipeStream new.
+ consoleOutput := VDBInternalPipeStream new.
+
+ "Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+release
+ super release.
+ consoleProcess terminate.
+
+ "Created: / 10-06-2014 / 01:34:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+subscribe
+ "Register for debugger events. To be overrided by subclasses"
+
+ debugger announcer
+ when: GDBCommandEvent send: #onCommandEvent: to: self;
+ when: GDBCommandResultEvent send: #onCommandResultEvent: to: self;
+
+ when: GDBConsoleOutputEvent send: #onConsoleOutputEvent: to: self;
+ when: GDBTargetOutputEvent send: #onTargetOutputEvent: to: self.
+
+ "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBDebuggerConsoleApplication class methodsFor:'documentation'!
--- a/VDBDebuggerConsoleView.st Tue Jun 10 01:13:32 2014 +0100
+++ b/VDBDebuggerConsoleView.st Tue Jun 10 01:38:50 2014 +0100
@@ -1,223 +1,17 @@
"{ Package: 'jv:vdb' }"
-TextCollector subclass:#VDBDebuggerConsoleView
- instanceVariableNames:'debuggerHolder debugger'
- classVariableNames:'Prompt'
+TerminalView subclass:#VDBDebuggerConsoleView
+ instanceVariableNames:''
+ classVariableNames:''
poolDictionaries:''
category:'VDB-UI-Console'
!
-!VDBDebuggerConsoleView class methodsFor:'initialization'!
-initialize
- "Invoked at system start or when the class is dynamically loaded."
-
- "/ please change as required (and remove this comment)
-
- Prompt := '(gdb) '.
-
- "Modified: / 06-06-2014 / 22:45:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!VDBDebuggerConsoleView methodsFor:'aspects'!
-
-debuggerHolder
- "return/create the 'debuggerHolder' value holder (automatically generated)"
-
- debuggerHolder isNil ifTrue:[
- debuggerHolder := ValueHolder new.
- debuggerHolder addDependent:self.
- ].
- ^ debuggerHolder
-!
-
-debuggerHolder:aValueModel
- "set the 'debuggerHolder' value holder (automatically generated)"
-
- |oldValue newValue|
+!VDBDebuggerConsoleView class methodsFor:'documentation'!
- debuggerHolder notNil ifTrue:[
- oldValue := debuggerHolder value.
- debuggerHolder removeDependent:self.
- ].
- debuggerHolder := aValueModel.
- debuggerHolder notNil ifTrue:[
- debuggerHolder addDependent:self.
- ].
- newValue := debuggerHolder value.
- oldValue ~~ newValue ifTrue:[
- self update:#value with:newValue from:debuggerHolder.
- ].
-! !
-
-!VDBDebuggerConsoleView methodsFor:'change & update'!
-
-update:something with:aParameter from:changedObject
- "Invoked when an object that I depend upon sends a change notification."
+version_HG
- changedObject == debuggerHolder ifTrue:[
- debuggerHolder value == debugger ifFalse:[
- debugger notNil ifTrue:[
- self unsubscribe.
- ].
- debugger := debuggerHolder value.
- debugger notNil ifTrue:[
- self subscribe.
- ].
- ].
- ^ self.
- ].
- super update:something with:aParameter from:changedObject
-
- "Modified: / 06-06-2014 / 22:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!VDBDebuggerConsoleView methodsFor:'cursor handling'!
-
-cursorMovementAllowed
- "return true, if the user may move the cursor around
- (via button-click, or cursor-key with selection).
- Here false is returned - the cursor is only moved by
- cursor positioning escape sequences arriving from the
- stream."
-
- ^ false
-
- "Created: / 07-06-2014 / 01:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ ^ '$Changeset: <not expanded> $'
! !
-!VDBDebuggerConsoleView methodsFor:'event handling'!
-
-keyPress: key x: x y: y
-
- self cursorLine < self list size ifTrue:[
- ^ self.
- ].
-
- key == #CursorLeft ifTrue:[
- (self cursorCol) > (Prompt size + 2) ifTrue:[
- ^ super keyPress: key x: x y: y
- ].
- ^ self
- ].
-
-
- key == #CursorUp ifTrue:[
- self keyPressCursorUp.
- ^ self
- ].
- key == #CursorDown ifTrue:[
- self keyPressCursorDown.
- ^ self.
- ].
- key == #Return ifTrue:[
- self keyPressReturn.
- ^ super keyPress: key x: x y: y
- ].
-
- ^ super keyPress: key x: x y: y
-
- "Created: / 06-06-2014 / 22:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 07-06-2014 / 01:22:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-keyPressCursorDown
-
- "Created: / 06-06-2014 / 22:36:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-keyPressCursorUp
-
- "Created: / 06-06-2014 / 22:36:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-keyPressReturn
- | command |
-
- command := self list at: self cursorLine.
- command isEmptyOrNil ifTrue:[ ^ self ].
- command := command copyFrom: Prompt size + 1.
- command isEmptyOrNil ifTrue:[
- self showPrompt.
- ] ifFalse:[
- debugger send: (GDBCLICommand new value: command) wait: false.
- ].
-
- "Created: / 06-06-2014 / 22:36:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-onCommandEvent: event
-
- "Created: / 06-06-2014 / 22:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-onCommandResultEvent: event
- self showPrompt.
-
- "Created: / 06-06-2014 / 22:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-onConsoleOutputEvent: event
- self show: event value
-
- "Created: / 06-06-2014 / 21:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-onTargetOutputEvent: event
- self show: event value
-
- "Created: / 06-06-2014 / 21:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!VDBDebuggerConsoleView methodsFor:'initialization & release'!
-
-initialize
- super initialize.
- self showPrompt.
-
- "Created: / 06-06-2014 / 22:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-subscribe
- "Register for debugger events. To be overrided by subclasses"
-
- debugger announcer
- when: GDBCommandEvent send: #onCommandEvent: to: self;
- when: GDBCommandResultEvent send: #onCommandResultEvent: to: self;
-
- when: GDBConsoleOutputEvent send: #onConsoleOutputEvent: to: self;
- when: GDBTargetOutputEvent send: #onTargetOutputEvent: to: self.
-
- "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsubscribe
- "Unsubscribe myself fo debugger events"
-
- debugger announcer unsubscribe: self.
- debugger := nil.
-
- "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!VDBDebuggerConsoleView methodsFor:'selection handling'!
-
-autoMoveCursorToEndOfSelection
- "Redefined to return false since the cursor should
- not be affected by selecting"
-
- ^ false
-
- "Created: / 07-06-2014 / 01:20:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!VDBDebuggerConsoleView methodsFor:'stream messages'!
-
-showPrompt
- self nextPutAll: Prompt
-
- "Created: / 06-06-2014 / 22:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-
-VDBDebuggerConsoleView initialize!
--- a/bc.mak Tue Jun 10 01:13:32 2014 +0100
+++ b/bc.mak Tue Jun 10 01:38:50 2014 +0100
@@ -34,7 +34,7 @@
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
LOCALDEFINES=
STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
@@ -72,7 +72,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)VDBAbstractApplication.$(O) VDBAbstractApplication.$(H): VDBAbstractApplication.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
-$(OUTDIR)VDBDebuggerConsoleView.$(O) VDBDebuggerConsoleView.$(H): VDBDebuggerConsoleView.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libwidg\EditTextView.$(H) $(INCLUDE_TOP)\stx\libwidg\ListView.$(H) $(INCLUDE_TOP)\stx\libwidg\TextCollector.$(H) $(INCLUDE_TOP)\stx\libwidg\TextView.$(H) $(STCHDR)
+$(OUTDIR)VDBDebuggerConsoleView.$(O) VDBDebuggerConsoleView.$(H): VDBDebuggerConsoleView.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libwidg\EditTextView.$(H) $(INCLUDE_TOP)\stx\libwidg\ListView.$(H) $(INCLUDE_TOP)\stx\libwidg\TextCollector.$(H) $(INCLUDE_TOP)\stx\libwidg\TextView.$(H) $(INCLUDE_TOP)\stx\libwidg2\TerminalView.$(H) $(STCHDR)
$(OUTDIR)VDBInternalPipeStream.$(O) VDBInternalPipeStream.$(H): VDBInternalPipeStream.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(STCHDR)
$(OUTDIR)jv_vdb.$(O) jv_vdb.$(H): jv_vdb.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
$(OUTDIR)VDBAbstractContainer.$(O) VDBAbstractContainer.$(H): VDBAbstractContainer.st $(INCLUDE_TOP)\jv\vdb\VDBAbstractApplication.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
--- a/tests/tests.rc Tue Jun 10 01:13:32 2014 +0100
+++ b/tests/tests.rc Tue Jun 10 01:38:50 2014 +0100
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
VALUE "ProductName", "LibraryName\0"
VALUE "ProductVersion", "6.2.4.0\0"
- VALUE "ProductDate", "Tue, 10 Jun 2014 00:11:41 GMT\0"
+ VALUE "ProductDate", "Tue, 10 Jun 2014 00:38:22 GMT\0"
END
END
--- a/vdb.rc Tue Jun 10 01:13:32 2014 +0100
+++ b/vdb.rc Tue Jun 10 01:38:50 2014 +0100
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
VALUE "ProductName", "LibraryName\0"
VALUE "ProductVersion", "6.2.4.0\0"
- VALUE "ProductDate", "Tue, 10 Jun 2014 00:11:39 GMT\0"
+ VALUE "ProductDate", "Tue, 10 Jun 2014 00:38:20 GMT\0"
END
END