# HG changeset patch # User Jan Vrany # Date 1548423231 0 # Node ID df7f89efd39d6374e35e67ceb4836f6cfb953d34 # Parent dae35d5b3d7244042eaa3e2410a924959b1c6c3b A complete rewrite of simple console ..that is not using `TerminalView`. The original (previous) implementation had various problems that were hard to fix, namely loosing some stream output in some cases. New (current) implementation uses custom console view (1VDBSimpleDebuggerConsoleView`) based on `TextCollector` rather than `TerminalView`. The resulting code is much much simpler, it does not use internal pipes nor REPL / pipe reader processes. Whole REPL runs completely in UI process. diff -r dae35d5b3d72 -r df7f89efd39d Make.proto --- a/Make.proto Wed Jan 23 11:02:06 2019 +0000 +++ b/Make.proto Fri Jan 25 13:33:51 2019 +0000 @@ -142,7 +142,7 @@ $(OUTDIR)VDBIconLibrary.$(O) VDBIconLibrary.$(C) VDBIconLibrary.$(H): VDBIconLibrary.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)VDBInstructionBasicBlock.$(O) VDBInstructionBasicBlock.$(C) VDBInstructionBasicBlock.$(H): VDBInstructionBasicBlock.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)VDBSettingsApplication.$(O) VDBSettingsApplication.$(C) VDBSettingsApplication.$(H): VDBSettingsApplication.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libtool/AbstractSettingsApplication.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR) -$(OUTDIR)VDBSimpleDebuggerConsoleView.$(O) VDBSimpleDebuggerConsoleView.$(C) VDBSimpleDebuggerConsoleView.$(H): VDBSimpleDebuggerConsoleView.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)VDBSimpleConsoleView.$(O) VDBSimpleConsoleView.$(C) VDBSimpleConsoleView.$(H): VDBSimpleConsoleView.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)VDBStartup.$(O) VDBStartup.$(C) VDBStartup.$(H): VDBStartup.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/StandaloneStartup.$(H) $(STCHDR) $(OUTDIR)VDBVirtualMemoryMap.$(O) VDBVirtualMemoryMap.$(C) VDBVirtualMemoryMap.$(H): VDBVirtualMemoryMap.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)VDBVirtualMemoryRegion.$(O) VDBVirtualMemoryRegion.$(C) VDBVirtualMemoryRegion.$(H): VDBVirtualMemoryRegion.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) diff -r dae35d5b3d72 -r df7f89efd39d Make.spec --- a/Make.spec Wed Jan 23 11:02:06 2019 +0000 +++ b/Make.spec Fri Jan 25 13:33:51 2019 +0000 @@ -59,7 +59,7 @@ VDBIconLibrary \ VDBInstructionBasicBlock \ VDBSettingsApplication \ - VDBSimpleDebuggerConsoleView \ + VDBSimpleConsoleView \ VDBStartup \ VDBVirtualMemoryMap \ VDBVirtualMemoryRegion \ @@ -109,7 +109,7 @@ $(OUTDIR)VDBIconLibrary.$(O) \ $(OUTDIR)VDBInstructionBasicBlock.$(O) \ $(OUTDIR)VDBSettingsApplication.$(O) \ - $(OUTDIR)VDBSimpleDebuggerConsoleView.$(O) \ + $(OUTDIR)VDBSimpleConsoleView.$(O) \ $(OUTDIR)VDBStartup.$(O) \ $(OUTDIR)VDBVirtualMemoryMap.$(O) \ $(OUTDIR)VDBVirtualMemoryRegion.$(O) \ diff -r dae35d5b3d72 -r df7f89efd39d VDBAbstractConsoleApplication.st --- a/VDBAbstractConsoleApplication.st Wed Jan 23 11:02:06 2019 +0000 +++ b/VDBAbstractConsoleApplication.st Fri Jan 25 13:33:51 2019 +0000 @@ -105,20 +105,6 @@ ^ self == VDBAbstractConsoleApplication. ! ! -!VDBAbstractConsoleApplication methodsFor:'accessing'! - -consoleInput - self subclassResponsibility - - "Created: / 01-06-2017 / 09:43:57 / Jan Vrany " -! - -consoleOutput - self subclassResponsibility - - "Created: / 01-06-2017 / 09:44:02 / Jan Vrany " -! ! - !VDBAbstractConsoleApplication methodsFor:'aspects'! consoleView @@ -153,13 +139,10 @@ ! initializeConsoleView: aTerminalView forDebugger: aGDBDebugger - aGDBDebugger notNil ifTrue:[ - aTerminalView inStream: self consoleInput. - aTerminalView outStream: self consoleOutput. - aTerminalView startReaderProcessWhenVisible. - ]. + "/ Nothing to do by default "Created: / 21-01-2019 / 15:30:41 / Jan Vrany " + "Modified: / 25-01-2019 / 12:05:20 / Jan Vrany " ! subscribe diff -r dae35d5b3d72 -r df7f89efd39d VDBAbstractUnixConsoleApplication.st --- a/VDBAbstractUnixConsoleApplication.st Wed Jan 23 11:02:06 2019 +0000 +++ b/VDBAbstractUnixConsoleApplication.st Fri Jan 25 13:33:51 2019 +0000 @@ -69,6 +69,18 @@ "Created: / 21-01-2019 / 14:23:21 / Jan Vrany " ! ! +!VDBAbstractUnixConsoleApplication methodsFor:'initialization & release'! + +initializeConsoleView: aTerminalView forDebugger: aGDBDebugger + aGDBDebugger notNil ifTrue:[ + aTerminalView inStream: self consoleInput. + aTerminalView outStream: self consoleOutput. + aTerminalView startReaderProcessWhenVisible. + ]. + + "Created: / 25-01-2019 / 12:04:58 / Jan Vrany " +! ! + !VDBAbstractUnixConsoleApplication class methodsFor:'documentation'! version_HG diff -r dae35d5b3d72 -r df7f89efd39d VDBSimpleConsoleView.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VDBSimpleConsoleView.st Fri Jan 25 13:33:51 2019 +0000 @@ -0,0 +1,415 @@ +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +"{ Package: 'jv:vdb' }" + +"{ NameSpace: Smalltalk }" + +TextCollector subclass:#VDBSimpleConsoleView + instanceVariableNames:'buffer bufferPosition history historyPosition completeAction + lastTabTime lastCompletions' + classVariableNames:'TabTabInterval' + poolDictionaries:'' + category:'VDB-UI-Console' +! + +!VDBSimpleConsoleView class methodsFor:'documentation'! + +copyright +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +! ! + +!VDBSimpleConsoleView class methodsFor:'initialization'! + +initialize + "Invoked at system start or when the class is dynamically loaded." + + "/ please change as required (and remove this comment) + + TabTabInterval := 500"ms" + + "Modified: / 25-01-2019 / 21:38:58 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'accessing'! + +completeAction + ^ completeAction +! + +completeAction:aBlock + completeAction := aBlock. +! ! + +!VDBSimpleConsoleView methodsFor:'actions'! + +buffer: aString + "Set the line buffer, position the cursor at the end of + line" + + | line | + + line := list at: cursorLine. + line := (line copyTo: cursorCol - bufferPosition) , aString. + + list at: cursorLine put: line. + buffer := aString. + bufferPosition := aString size + 1. + self cursorCol: line size + 1. + self invalidateLine: cursorLine. + + "Created: / 26-01-2019 / 22:16:51 / Jan Vrany " +! + +completions: anArray"of Strings" + "Should be called by application when completions are computed." + + | completion | + + lastCompletions := anArray. + lastCompletions isEmptyOrNil ifTrue:[ + lastCompletions := nil. + self flash: (resources string:'Nothing to complete'). + ^self. + ]. + completion := lastCompletions longestCommonPrefix copyFrom: bufferPosition. + + completion isEmpty ifTrue:[ + self flash: (resources string:'Ambiguous') + ] ifFalse:[ + buffer := (buffer copyTo: bufferPosition - 1) , completion , (buffer copyFrom: bufferPosition). + self insertStringAtCursor: completion. + bufferPosition := bufferPosition + completion size. + ] + + "Created: / 25-01-2019 / 21:50:41 / Jan Vrany " +! + +completionsShow + "Shows completion candidates" + + | currentColNr currentLineNr currentLine | + + lastCompletions isEmptyOrNil ifTrue:[ ^ self ]. + currentColNr := cursorCol. + currentLineNr := cursorLine. + currentLine := self list at: currentLineNr. + + self cr. + lastCompletions do:[:each | + self showCR: each. + ]. + self nextPutAll: currentLine. + self cursorCol: currentColNr. + + "Created: / 25-01-2019 / 21:56:26 / Jan Vrany " +! + +historyDown + ((historyPosition + 1) between: 1 and: history size) ifTrue:[ + historyPosition := historyPosition + 1. + self buffer: (history at: historyPosition) + ] ifFalse:[ + historyPosition := history size + 1. + self buffer: ''. + ]. + + "Created: / 26-01-2019 / 22:21:23 / Jan Vrany " +! + +historyUp + ((historyPosition - 1) between: 1 and: history size) ifTrue:[ + historyPosition := historyPosition - 1. + self buffer: (history at: historyPosition) + ] ifFalse:[ + self beep. + ]. + + "Created: / 26-01-2019 / 22:21:08 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'cursor handling'! + +cursorMovementAllowed + ^ false + + "Created: / 25-01-2019 / 09:40:14 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'event handling'! + +extendSelectionToX:x y:y setPrimarySelection:aBoolean + | savCursorLine savCursorCol | + + savCursorLine := cursorLine. + savCursorCol := cursorCol. + super extendSelectionToX:x y:y setPrimarySelection:aBoolean. + self cursorLine:savCursorLine col:savCursorCol. + + "Created: / 26-01-2019 / 23:00:55 / Jan Vrany " +! + +keyPress: key x: x y: y + + key == #Tab ifTrue:[ + self keyPressTab. + ^ self + ] ifFalse:[ + lastTabTime := lastCompletions := nil. + ]. + + key isCharacter ifTrue:[ + buffer := (buffer copyTo:bufferPosition-1) + , key + , (buffer copyFrom:bufferPosition). + self insertCharAtCursor:key. + bufferPosition := bufferPosition + 1. + ^ self + ]. + key == #Return ifTrue:[ + self keyPressReturn. + ^ self. + ]. + key == #BackSpace ifTrue:[ + self keyPressBackSpace. + ^ self. + ]. + key == #Delete ifTrue:[ + self keyPressDelete. + ^ self. + ]. + key == #CursorLeft ifTrue:[ + self keyPressCursorLeft. + ^ self. + ]. + key == #CursorRight ifTrue:[ + self keyPressCursorRight. + ^ self. + ]. + key == #CursorUp ifTrue:[ + self keyPressCursorUp. + ^ self. + ]. + key == #CursorDown ifTrue:[ + self keyPressCursorDown. + ^ self. + ]. + ((key == #BeginOfLine) or:[key == #Ctrla]) ifTrue:[ + self keyPressBeginOfLine. + ^ self + ]. + ((key == #EndOfLine) or:[key == #Ctrle]) ifTrue:[ + self keyPressEndOfLine. + ^ self + ]. + + (#(Shift_L Shift_R + Control_L Control_R + Alt_L Alt_R + Caps_Lock + PreviousPage NextPage + Copy Paste Insert + ) includes: key) ifTrue:[ + ^ super keyPress: key x:x y:y + ]. + + "/ Unhandled key + self beep; flash + + "Created: / 24-01-2019 / 22:02:09 / Jan Vrany " + "Modified: / 26-01-2019 / 22:36:57 / Jan Vrany " +! + +keyPressBackSpace + bufferPosition == 1 ifTrue:[ + self beep. + ^ self. + ]. + buffer := (buffer copyTo: bufferPosition - 2) , (buffer copyFrom: bufferPosition). + self deleteCharBeforeCursor. + bufferPosition := bufferPosition - 1. + + "Created: / 24-01-2019 / 22:09:20 / Jan Vrany " +! + +keyPressBeginOfLine + self cursorCol: self cursorCol - bufferPosition + 1. + bufferPosition := 1. + + "Created: / 25-01-2019 / 10:43:49 / Jan Vrany " +! + +keyPressCursorDown + self historyDown. + + "Created: / 24-01-2019 / 22:18:53 / Jan Vrany " + "Modified: / 26-01-2019 / 22:19:21 / Jan Vrany " +! + +keyPressCursorLeft + (bufferPosition < 2) ifTrue:[ + self beep. + ^ self. + ]. + bufferPosition := bufferPosition - 1. + self cursorLeft. + + "Created: / 24-01-2019 / 22:18:57 / Jan Vrany " + "Modified: / 25-01-2019 / 10:29:26 / Jan Vrany " +! + +keyPressCursorRight + (bufferPosition > buffer size) ifTrue:[ + self beep. + ^ self. + ]. + bufferPosition := bufferPosition + 1. + self cursorRight. + + "Created: / 24-01-2019 / 22:19:02 / Jan Vrany " + "Modified: / 25-01-2019 / 10:30:01 / Jan Vrany " +! + +keyPressCursorUp + self historyUp. + + "Created: / 24-01-2019 / 22:19:08 / Jan Vrany " + "Modified: / 26-01-2019 / 22:19:12 / Jan Vrany " +! + +keyPressDelete + bufferPosition == (buffer size + 1) ifTrue:[ + self beep. + ^ self. + ]. + buffer := (buffer copyTo: bufferPosition - 1) , (buffer copyFrom: bufferPosition + 1). + self deleteCharAtCursor. + + "Created: / 25-01-2019 / 10:33:00 / Jan Vrany " +! + +keyPressEndOfLine + self cursorCol: self cursorCol - bufferPosition + buffer size + 1. + bufferPosition := buffer size + 1. + + "Created: / 25-01-2019 / 11:40:33 / Jan Vrany " +! + +keyPressReturn + acceptAction value: buffer. + history add: buffer. + historyPosition := history size + 1. + self cr. + buffer := ''. + bufferPosition := 1. + + "Created: / 24-01-2019 / 22:09:15 / Jan Vrany " + "Modified: / 26-01-2019 / 22:22:53 / Jan Vrany " +! + +keyPressTab + | now | + + "/ No completion installed, do nothing + completeAction isNil ifTrue:[ + self flash: (resources string: 'Command completion not supported'). + ^ self + ]. + now := OperatingSystem getMillisecondTime. + (lastTabTime notNil and:[(now - lastTabTime) < TabTabInterval]) ifTrue:[ + "/ Tab Tab has been pressed, show completion history. + lastTabTime := nil. + self completionsShow. + ] ifFalse:[ + "/ A single Tab has been pressed, trigger completion. + lastTabTime := now. + completeAction value: (buffer copyTo: bufferPosition - 1) + + ]. + + "Created: / 25-01-2019 / 21:35:23 / Jan Vrany " + "Modified: / 25-01-2019 / 22:38:58 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'initialization & release'! + +initialize + super initialize. + buffer := ''. + bufferPosition := 1. + history := OrderedCollection new. + historyPosition := 1. + + "Created: / 24-01-2019 / 22:12:17 / Jan Vrany " + "Modified: / 26-01-2019 / 22:22:29 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'menu & menu actions'! + +copySelection + | savCursorLine savCursorCol | + + savCursorLine := cursorLine. + savCursorCol := cursorCol. + super copySelection. + self cursorLine:savCursorLine col:savCursorCol. + + "Created: / 26-01-2019 / 22:59:09 / Jan Vrany " +! + +paste:someText withCR:withCR + "/ (For now) disallow pasting text with newlines... + (someText includes: Character cr) ifTrue:[ + self beep. + ^ self. + ]. + buffer := (buffer copyTo: bufferPosition - 1) , someText , (buffer copyFrom: bufferPosition). + self insertStringAtCursor: someText. + bufferPosition := bufferPosition + someText size. + + "Created: / 26-01-2019 / 22:40:44 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'selections'! + +selectWordAtLine:line col:col + | savCursorLine savCursorCol | + + savCursorLine := cursorLine. + savCursorCol := cursorCol. + super selectWordAtLine:line col:col. + self cursorLine:savCursorLine col:savCursorCol. + + "Created: / 26-01-2019 / 22:55:41 / Jan Vrany " +! ! + +!VDBSimpleConsoleView methodsFor:'stream messages'! + +show:anObject + super show: anObject. + self endEntry. + + "Created: / 25-01-2019 / 09:55:16 / Jan Vrany " +! ! + +!VDBSimpleConsoleView class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' +! ! + + +VDBSimpleConsoleView initialize! diff -r dae35d5b3d72 -r df7f89efd39d VDBSimpleDebuggerConsoleApplication.st --- a/VDBSimpleDebuggerConsoleApplication.st Wed Jan 23 11:02:06 2019 +0000 +++ b/VDBSimpleDebuggerConsoleApplication.st Fri Jan 25 13:33:51 2019 +0000 @@ -11,10 +11,7 @@ "{ NameSpace: Smalltalk }" VDBAbstractConsoleApplication subclass:#VDBSimpleDebuggerConsoleApplication - instanceVariableNames:'consoleInput consoleOutput consoleOutputLock consoleProcess - consolePrompt consolePromptPrinted outstandingCommand - outstandingCommandToken outstandingCommandBlocker - ignoreNextLogStreamEvent running' + instanceVariableNames:'prompt promptPrinted running' classVariableNames:'' poolDictionaries:'GDBCommandStatus' category:'VDB-UI-Console' @@ -60,20 +57,6 @@ ^ self shouldImplement ! ! -!VDBSimpleDebuggerConsoleApplication methodsFor:'accessing'! - -consoleInput - ^ consoleInput - - "Created: / 21-01-2019 / 14:18:18 / Jan Vrany " -! - -consoleOutput - ^ consoleOutput - - "Created: / 21-01-2019 / 14:18:37 / Jan Vrany " -! ! - !VDBSimpleDebuggerConsoleApplication methodsFor:'actions'! doComplete: line @@ -84,29 +67,47 @@ command := GDBMI_complete arguments: (Array with: line). debugger send: command andWithResultDo: [ :result | - consoleView sensor pushUserEvent: #doComplete:with: for: self withArguments: (Array with: line with: result) + result isDone ifTrue:[ + consoleView completions: (result propertyAt: #completions) + ]. ]. "Created: / 30-12-2018 / 22:01:42 / Jan Vrany " - "Modified (comment): / 31-12-2018 / 11:35:55 / Jan Vrany " + "Modified: / 25-01-2019 / 22:03:06 / Jan Vrany " ! -doComplete: line with: result - "Called asynchronously from #doComplete: when possible completions - are computed. +doFire: aString + "Executes entered command" + + | cmd | + + promptPrinted := false. + + aString isEmptyOrNil ifTrue:[ + self showPrompt. + ^ self. + ]. - Private, this is for private use by #doComplete: - " - self consoleView completeCommandWith: (result propertyAt: #completions). + cmd := GDBCommand parse: aString. + cmd isCLICommand ifTrue:[ + cmd runOnBackground: true. + ]. + consoleView readOnly:true. + debugger send:cmd andWithResultDo:[:result| + result isError ifTrue:[ + consoleView showCR: (result propertyAt: #msg) + ]. + consoleView readOnly:false. + self showPrompt. + ]. - "Created: / 30-12-2018 / 22:04:05 / Jan Vrany " - "Modified: / 16-01-2019 / 14:24:46 / Jan Vrany " + "Created: / 25-01-2019 / 12:12:39 / Jan Vrany " ! ! !VDBSimpleDebuggerConsoleApplication methodsFor:'aspects'! consoleViewClass - ^ VDBSimpleDebuggerConsoleView + ^ VDBSimpleConsoleView "Modified: / 21-01-2019 / 14:22:03 / Jan Vrany " ! ! @@ -115,64 +116,12 @@ onCmdParamChanged: event event name = 'prompt' ifTrue:[ - consolePrompt := event value + prompt := event value ]. "Created: / 19-01-2019 / 22:13:49 / Jan Vrany " ! -onCommandEvent: event - event command == outstandingCommand ifTrue:[ - outstandingCommandToken := event token. - ignoreNextLogStreamEvent := true. - ]. - - "Created: / 06-06-2014 / 22:43:45 / Jan Vrany " - "Modified: / 11-06-2014 / 12:35:24 / Jan Vrany " -! - -onCommandResultEvent: event - outstandingCommandToken notNil ifTrue:[ - event token == outstandingCommandToken ifTrue:[ - "/ Check if command ended up with an error. If so, - "/ print the error message. - event result status == CommandStatusError ifTrue:[ - self showCR: ('Error: %1 ' bindWith: (event result propertyAt: #msg)). - ] ifFalse:[ - "/ Check if the command issues is actually a MI command, - "/ if so, print "Done" to the console since MI command don't - "/ provide user feedback. - outstandingCommand isMICommand ifTrue:[ - self showCR: ('Done ( %1 , see even log for result value)' bindWith: outstandingCommand value) - ]. - ]. - outstandingCommand := outstandingCommandToken := nil. - outstandingCommandBlocker signalForAll. - ]. - ]. - - "Created: / 06-06-2014 / 22:44:03 / Jan Vrany " - "Modified: / 27-02-2015 / 13:01:49 / Jan Vrany " -! - -onEventSetProcessingFinished: event - self showPrompt. - - "Created: / 18-09-2014 / 23:11:41 / Jan Vrany " -! - -onLogOutputEvent: event - ignoreNextLogStreamEvent ifTrue:[ - ignoreNextLogStreamEvent := false. - ] ifFalse:[ - self onStreamOutputEvent: event - ] - - "Created: / 11-06-2014 / 12:37:02 / Jan Vrany " - "Modified: / 04-04-2018 / 22:50:14 / jv" - "Modified: / 30-12-2018 / 22:03:04 / Jan Vrany " -! - onRunningEvent: event running := true. consoleView readOnly: true. @@ -189,34 +138,16 @@ ! onStreamOutputEvent: event - consolePromptPrinted ifTrue:[ self showCR:'' ]. - consolePromptPrinted := false. - event value asStringCollection do:[:line | - line notEmptyOrNil ifTrue:[ - self showCR: line. - ]. - ]. + promptPrinted ifTrue:[ consoleView cr ]. + promptPrinted := false. + consoleView show: event value "Created: / 11-06-2014 / 12:00:42 / Jan Vrany " - "Modified: / 30-12-2018 / 22:02:26 / Jan Vrany " + "Modified: / 25-01-2019 / 13:36:01 / Jan Vrany " ! ! !VDBSimpleDebuggerConsoleApplication methodsFor:'hooks'! -commonPostOpen - consoleProcess isNil ifTrue:[ - consoleProcess := - [ - [ self consoleProcess1Command ] loop. - ] newProcess. - consoleProcess name: 'VDB Debugger Console REPL loop'. - consoleProcess resume. - ]. - - "Created: / 10-06-2014 / 01:25:34 / Jan Vrany " - "Modified: / 19-01-2019 / 23:48:56 / Jan Vrany " -! - postBuildConsoleView: aTextCollector consoleView := aTextCollector scrolledView. consoleView readOnly: true; @@ -233,50 +164,39 @@ initialize super initialize. - - consoleInput := GDBInternalPipeStream new. - consoleOutput := GDBInternalPipeStream new. - consoleOutputLock := RecursionLock new. - consolePrompt := '(gdb) '. - consolePromptPrinted := false. + prompt := '(gdb) '. + promptPrinted := false. running := false. - outstandingCommandBlocker := Semaphore new. - ignoreNextLogStreamEvent := false. "Created: / 10-06-2014 / 01:23:43 / Jan Vrany " "Modified: / 07-04-2018 / 23:13:27 / jv" - "Modified: / 21-01-2019 / 15:37:11 / Jan Vrany " + "Modified: / 25-01-2019 / 22:01:31 / Jan Vrany " ! -initializeConsoleView: aTerminalView - super initializeConsoleView: aTerminalView. - aTerminalView localEcho:true. - aTerminalView inputTranslateCRToNL:true. - aTerminalView lineEditMode:true. +initializeConsoleView: view + super initializeConsoleView: view. + consoleView acceptAction: [ :command | self doFire: command ]. - "Created: / 21-01-2019 / 14:13:15 / Jan Vrany " - "Modified: / 21-01-2019 / 15:33:59 / Jan Vrany " + "Created: / 25-01-2019 / 12:13:44 / Jan Vrany " + "Modified: / 25-01-2019 / 22:34:02 / Jan Vrany " ! initializeConsoleView: aTerminalView forDebugger: aGDBDebugger super initializeConsoleView: aTerminalView forDebugger: aGDBDebugger. - (aGDBDebugger notNil and:[aGDBDebugger hasCommand:'-complete']) ifTrue:[ - consoleView completionBlock: [ :prefix | self doComplete: prefix ]. - consolePrompt := debugger getParameter: 'prompt'. + consoleView clear. + consoleView completeAction: nil. + (aGDBDebugger notNil) ifTrue:[ + prompt := debugger getParameter: 'prompt'. + self showPrompt. + (aGDBDebugger hasCommand:'-complete') ifTrue:[ + consoleView completeAction: [ :command | self doComplete: command ] + ]. ] ifFalse:[ - consoleView completionBlock: nil. - consolePrompt := '(gdb) ' + prompt := '(gdb) ' ]. "Created: / 21-01-2019 / 15:33:23 / Jan Vrany " - "Modified: / 21-01-2019 / 17:49:33 / Jan Vrany " -! - -release - super release. - consoleProcess terminate. - - "Created: / 10-06-2014 / 01:34:23 / Jan Vrany " + "Modified: / 25-01-2019 / 22:35:06 / Jan Vrany " ! subscribe @@ -284,88 +204,34 @@ super subscribe. debugger announcer - when: GDBCommandEvent send: #onCommandEvent: to: self; - when: GDBCommandResultEvent send: #onCommandResultEvent: to: self; +"/ when: GDBCommandEvent send: #onCommandEvent: to: self; +"/ when: GDBCommandResultEvent send: #onCommandResultEvent: to: self; when: GDBRunningEvent send: #onRunningEvent: to: self; when: GDBStoppedEvent send: #onStoppedEvent: to: self; - when: GDBConsoleOutputEvent send: #onStreamOutputEvent: to: self; - when: GDBTargetOutputEvent send: #onStreamOutputEvent: to: self; - when: GDBLogOutputEvent send: #onLogOutputEvent: to: self; + when: GDBConsoleOutputEvent send: #onStreamOutputEvent: to: self; + when: GDBTargetOutputEvent send: #onStreamOutputEvent: to: self; - when: GDBEventSetProcessingFinished send: #onEventSetProcessingFinished: to: self; + when: GDBCmdParamChangedEvent send: #onCmdParamChanged: to: self. - when: GDBCmdParamChangedEvent send: #onCmdParamChanged: to: self. - - running := debugger inferiors anySatisfy:[ :tg | tg isRunning ]. + running := debugger inferiors anySatisfy:[ :tg | tg isRunning and:[ tg isStopped not ] ]. "Created: / 06-06-2014 / 21:26:48 / Jan Vrany " - "Modified: / 21-01-2019 / 15:37:27 / Jan Vrany " + "Modified: / 25-01-2019 / 12:33:05 / Jan Vrany " ! ! -!VDBSimpleDebuggerConsoleApplication methodsFor:'private - console process'! - -consoleProcess1Command - | cmdLine cmd | - - self showPrompt. - cmdLine := consoleInput nextLine asString. - self showCR. - consolePromptPrinted := false. - cmdLine notEmptyOrNil ifTrue:[ - cmd := GDBCommand parse: cmdLine. - cmd isCLICommand ifTrue:[ - cmd runOnBackground: true. - ]. - outstandingCommand := cmd. - consoleView readOnly:true. - debugger send:cmd andWait:false. - outstandingCommandBlocker wait. - consoleView readOnly:false. - ]. - - "Created: / 19-01-2019 / 23:49:46 / Jan Vrany " - "Modified: / 21-01-2019 / 12:25:33 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleApplication methodsFor:'private - writing'! - -show: aString - consoleOutputLock critical:[ - consoleOutput nextPutAll: aString. - ]. - - "Created: / 11-06-2014 / 08:02:20 / Jan Vrany " - "Modified: / 11-06-2014 / 11:53:06 / Jan Vrany " -! - -showCR - consoleOutputLock critical:[ - consoleOutput crlf. - ]. - - "Created: / 21-01-2019 / 12:25:14 / Jan Vrany " -! - -showCR: aString - consoleOutputLock critical:[ - consoleOutput nextPutAll: aString; crlf. - ]. - - "Created: / 11-06-2014 / 08:02:49 / Jan Vrany " - "Modified: / 16-01-2019 / 10:52:51 / Jan Vrany " -! +!VDBSimpleDebuggerConsoleApplication methodsFor:'private'! showPrompt - (running not and: [consolePromptPrinted not]) ifTrue:[ - self show: consolePrompt. - consolePromptPrinted := true. + (running not and: [promptPrinted not]) ifTrue:[ + consoleView show: prompt. + promptPrinted := true. ]. "Created: / 18-09-2014 / 23:18:49 / Jan Vrany " "Modified: / 04-04-2018 / 23:01:24 / jv" - "Modified: / 19-01-2019 / 23:58:45 / Jan Vrany " + "Modified: / 25-01-2019 / 12:02:08 / Jan Vrany " ! ! !VDBSimpleDebuggerConsoleApplication class methodsFor:'documentation'! diff -r dae35d5b3d72 -r df7f89efd39d VDBSimpleDebuggerConsoleView.st --- a/VDBSimpleDebuggerConsoleView.st Wed Jan 23 11:02:06 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -" -jv:vdb - Visual / VM Debugger -Copyright (C) 2015-now Jan Vrany - -This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' - -You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ -" -"{ Package: 'jv:vdb' }" - -"{ NameSpace: Smalltalk }" - -TerminalView subclass:#VDBSimpleDebuggerConsoleView - instanceVariableNames:'lastTabPressTime completionBlock completions' - classVariableNames:'' - poolDictionaries:'' - category:'VDB-UI-Console' -! - -!VDBSimpleDebuggerConsoleView class methodsFor:'documentation'! - -copyright -" -jv:vdb - Visual / VM Debugger -Copyright (C) 2015-now Jan Vrany - -This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' - -You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ -" -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'accessing'! - -completionBlock - ^ completionBlock -! - -completionBlock:aBlock - completionBlock := aBlock. - - "Modified: / 16-01-2019 / 11:35:56 / Jan Vrany " - "Modified: / 16-01-2019 / 14:43:18 / jv" -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'completion'! - -completeCommand - completionBlock notNil ifTrue:[ - completions := nil. - completionBlock value: (lineBuffer copyTo: lineBufferCursorPosition - 1) - ]. - - "Created: / 16-01-2019 / 11:34:10 / Jan Vrany " - "Modified: / 16-01-2019 / 11:45:21 / jv" -! - -completeCommandWith: anArray"of Strings" - | completion | - - completions := anArray. - completions isEmptyOrNil ifTrue:[ - completions := nil. - self flash: (resources string:'Nothing to complete'). - ^self. - ]. - completion := completions longestCommonPrefix copyFrom: lineBufferCursorPosition. - - completion isEmpty ifTrue:[ - self flash: (resources string:'Ambiguous command, press Tab again') - ] ifFalse:[ - self doInsertString: completion. - ] - - "Created: / 16-01-2019 / 11:35:14 / Jan Vrany " - "Modified: / 16-01-2019 / 14:28:41 / jv" - "Modified: / 21-01-2019 / 11:49:56 / Jan Vrany " -! - -completionShow - "Shows completion candidates" - - | currentLineNr currentLine | - - completions isEmptyOrNil ifTrue:[ ^ self ]. - currentLineNr := cursorLine. - currentLine := self list at: currentLineNr. - self nextPutCRLF. - completions do:[:each | - self nextPutAll: each. - self nextPutCRLF. - ]. - self nextPutAll: currentLine. - - "Created: / 16-01-2019 / 11:58:44 / Jan Vrany " - "Modified: / 16-01-2019 / 12:39:48 / jv" -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'event handling'! - -keyPress:aKey x:x y:y - - - readOnly ifTrue:[ - self flashReadOnly. - ^ self. - ]. - inStream isNil ifTrue:[^ self]. - - aKey == #Tab ifTrue:[ - DebugKeyboard ifTrue:[ - Transcript showCR:'----'; show:'keyPress:' ; showCR:aKey printString. - ]. - (lastTabPressTime notNil and: [(OperatingSystem getMillisecondTime - lastTabPressTime) < 1000]) ifTrue:[ - lastTabPressTime := nil. - ^ self doTabTab. - ] ifFalse:[ - lastTabPressTime := OperatingSystem getMillisecondTime . - ^ self doTab - ]. - ]. - lastTabPressTime := nil. - ^ super keyPress:aKey x:x y:y - - - - - " - DebugKeyboard := true - " - - "Created: / 15-09-2016 / 23:55:56 / Jan Vrany " - "Modified: / 04-04-2018 / 22:57:53 / jv" - "Modified: / 21-01-2019 / 11:46:00 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'functions'! - -doInsertString: stringToComplete - "Insert (add) `stringToComplete` at current linebuffer insert point. - This is meant to implement command completion." - - lineBuffer := (lineBuffer copyTo:lineBufferCursorPosition-1) - , stringToComplete - , (lineBuffer copyFrom:lineBufferCursorPosition). - self insertStringAtCursor:stringToComplete. - lineBufferCursorPosition := lineBufferCursorPosition + stringToComplete size. - - "Created: / 31-12-2018 / 09:26:08 / Jan Vrany " -! - -doTab - self completeCommand - - "Created: / 15-09-2016 / 23:56:12 / Jan Vrany " - "Modified: / 04-04-2018 / 22:58:55 / jv" - "Modified: / 16-01-2019 / 11:31:57 / Jan Vrany " -! - -doTabTab - completionBlock notNil ifTrue:[ - self completionShow - ]. - - "Created: / 16-09-2016 / 00:56:02 / Jan Vrany " - "Modified: / 04-04-2018 / 22:59:02 / jv" - "Modified: / 16-01-2019 / 12:00:23 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'initialization'! - -initialize - "Invoked when a new instance is created." - - "/ please change as required (and remove this comment) - super initialize. - lastTabPressTime := nil. - completions := nil. - - "Modified: / 16-01-2019 / 11:59:02 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleView methodsFor:'processing-input'! - -nextPutCRLF - self pushEvent:#processInput:n: with: Character return , Character linefeed with:2 - - "Created: / 16-01-2019 / 12:45:16 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleView class methodsFor:'documentation'! - -version_HG - - ^ '$Changeset: $' -! ! - diff -r dae35d5b3d72 -r df7f89efd39d abbrev.stc --- a/abbrev.stc Wed Jan 23 11:02:06 2019 +0000 +++ b/abbrev.stc Fri Jan 25 13:33:51 2019 +0000 @@ -9,7 +9,7 @@ VDBIconLibrary VDBIconLibrary jv:vdb 'VDB-UI-Support' 0 VDBInstructionBasicBlock VDBInstructionBasicBlock jv:vdb 'VDB-UI-Support' 0 VDBSettingsApplication VDBSettingsApplication jv:vdb 'VDB-UI-Others' 2 -VDBSimpleDebuggerConsoleView VDBSimpleDebuggerConsoleView jv:vdb 'VDB-UI-Console' 2 +VDBSimpleConsoleView VDBSimpleConsoleView jv:vdb 'VDB-UI-Console' 2 VDBStartup VDBStartup jv:vdb 'VDB-UI' 1 VDBVirtualMemoryMap VDBVirtualMemoryMap jv:vdb 'VDB-Tools' 0 VDBVirtualMemoryRegion VDBVirtualMemoryRegion jv:vdb 'VDB-Tools' 0 diff -r dae35d5b3d72 -r df7f89efd39d bc.mak --- a/bc.mak Wed Jan 23 11:02:06 2019 +0000 +++ b/bc.mak Fri Jan 25 13:33:51 2019 +0000 @@ -89,7 +89,7 @@ $(OUTDIR)VDBIconLibrary.$(O) VDBIconLibrary.$(C) VDBIconLibrary.$(H): VDBIconLibrary.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)VDBInstructionBasicBlock.$(O) VDBInstructionBasicBlock.$(C) VDBInstructionBasicBlock.$(H): VDBInstructionBasicBlock.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)VDBSettingsApplication.$(O) VDBSettingsApplication.$(C) VDBSettingsApplication.$(H): VDBSettingsApplication.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libtool\AbstractSettingsApplication.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR) -$(OUTDIR)VDBSimpleDebuggerConsoleView.$(O) VDBSimpleDebuggerConsoleView.$(C) VDBSimpleDebuggerConsoleView.$(H): VDBSimpleDebuggerConsoleView.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)VDBSimpleConsoleView.$(O) VDBSimpleConsoleView.$(C) VDBSimpleConsoleView.$(H): VDBSimpleConsoleView.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)VDBStartup.$(O) VDBStartup.$(C) VDBStartup.$(H): VDBStartup.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\StandaloneStartup.$(H) $(STCHDR) $(OUTDIR)VDBVirtualMemoryMap.$(O) VDBVirtualMemoryMap.$(C) VDBVirtualMemoryMap.$(H): VDBVirtualMemoryMap.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)VDBVirtualMemoryRegion.$(O) VDBVirtualMemoryRegion.$(C) VDBVirtualMemoryRegion.$(H): VDBVirtualMemoryRegion.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) diff -r dae35d5b3d72 -r df7f89efd39d jv_vdb.st --- a/jv_vdb.st Wed Jan 23 11:02:06 2019 +0000 +++ b/jv_vdb.st Fri Jan 25 13:33:51 2019 +0000 @@ -55,9 +55,9 @@ #'stx:goodies/announcements' "Announcement - superclass of RREvent" #'stx:libbasic' "Collection - extended" #'stx:libtool' "AbstractSettingsApplication - superclass of VDBSettingsApplication" - #'stx:libview' "DisplaySurface - superclass of VDBSimpleDebuggerConsoleView" + #'stx:libview' "DisplaySurface - superclass of VDBSimpleConsoleView" #'stx:libview2' "ApplicationModel - superclass of VDBAbstractApplication" - #'stx:libwidg' "EditTextView - superclass of VDBSimpleDebuggerConsoleView" + #'stx:libwidg' "EditTextView - superclass of VDBSimpleConsoleView" #'stx:libwidg2' "AbstractHierarchicalItem - superclass of VDBAbstractPresenter" ) ! @@ -108,7 +108,7 @@ VDBIconLibrary VDBInstructionBasicBlock VDBSettingsApplication - VDBSimpleDebuggerConsoleView + VDBSimpleConsoleView VDBStartup VDBVirtualMemoryMap VDBVirtualMemoryRegion diff -r dae35d5b3d72 -r df7f89efd39d libInit.cc --- a/libInit.cc Wed Jan 23 11:02:06 2019 +0000 +++ b/libInit.cc Fri Jan 25 13:33:51 2019 +0000 @@ -24,7 +24,7 @@ extern void _VDBIconLibrary_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBInstructionBasicBlock_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBSettingsApplication_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); -extern void _VDBSimpleDebuggerConsoleView_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); +extern void _VDBSimpleConsoleView_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBStartup_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBVirtualMemoryMap_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBVirtualMemoryRegion_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); @@ -83,7 +83,7 @@ _VDBIconLibrary_Init(pass,__pRT__,snd); _VDBInstructionBasicBlock_Init(pass,__pRT__,snd); _VDBSettingsApplication_Init(pass,__pRT__,snd); - _VDBSimpleDebuggerConsoleView_Init(pass,__pRT__,snd); + _VDBSimpleConsoleView_Init(pass,__pRT__,snd); _VDBStartup_Init(pass,__pRT__,snd); _VDBVirtualMemoryMap_Init(pass,__pRT__,snd); _VDBVirtualMemoryRegion_Init(pass,__pRT__,snd); diff -r dae35d5b3d72 -r df7f89efd39d tests/Make.proto --- a/tests/Make.proto Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/Make.proto Fri Jan 25 13:33:51 2019 +0000 @@ -126,7 +126,7 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it $(OUTDIR)VDBAbstractApplicationTests.$(O) VDBAbstractApplicationTests.$(C) VDBAbstractApplicationTests.$(H): VDBAbstractApplicationTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) -$(OUTDIR)VDBSimpleDebuggerConsoleViewTest.$(O) VDBSimpleDebuggerConsoleViewTest.$(C) VDBSimpleDebuggerConsoleViewTest.$(H): VDBSimpleDebuggerConsoleViewTest.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)VDBSimpleConsoleViewTest.$(O) VDBSimpleConsoleViewTest.$(C) VDBSimpleConsoleViewTest.$(H): VDBSimpleConsoleViewTest.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)jv_vdb_tests.$(O) jv_vdb_tests.$(C) jv_vdb_tests.$(H): jv_vdb_tests.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR) $(OUTDIR)VDBInstructionListApplicationTests.$(O) VDBInstructionListApplicationTests.$(C) VDBInstructionListApplicationTests.$(H): VDBInstructionListApplicationTests.st $(INCLUDE_TOP)/jv/vdb/tests/VDBAbstractApplicationTests.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)VDBSimpleDebuggerConsoleApplicationTest.$(O) VDBSimpleDebuggerConsoleApplicationTest.$(C) VDBSimpleDebuggerConsoleApplicationTest.$(H): VDBSimpleDebuggerConsoleApplicationTest.st $(INCLUDE_TOP)/jv/vdb/tests/VDBAbstractApplicationTests.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) diff -r dae35d5b3d72 -r df7f89efd39d tests/Make.spec --- a/tests/Make.spec Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/Make.spec Fri Jan 25 13:33:51 2019 +0000 @@ -52,7 +52,7 @@ COMMON_CLASSES= \ VDBAbstractApplicationTests \ - VDBSimpleDebuggerConsoleViewTest \ + VDBSimpleConsoleViewTest \ jv_vdb_tests \ VDBInstructionListApplicationTests \ VDBSimpleDebuggerConsoleApplicationTest \ @@ -62,7 +62,7 @@ COMMON_OBJS= \ $(OUTDIR)VDBAbstractApplicationTests.$(O) \ - $(OUTDIR)VDBSimpleDebuggerConsoleViewTest.$(O) \ + $(OUTDIR)VDBSimpleConsoleViewTest.$(O) \ $(OUTDIR)jv_vdb_tests.$(O) \ $(OUTDIR)VDBInstructionListApplicationTests.$(O) \ $(OUTDIR)VDBSimpleDebuggerConsoleApplicationTest.$(O) \ diff -r dae35d5b3d72 -r df7f89efd39d tests/VDBSimpleConsoleViewTest.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/VDBSimpleConsoleViewTest.st Fri Jan 25 13:33:51 2019 +0000 @@ -0,0 +1,181 @@ +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +"{ Package: 'jv:vdb/tests' }" + +"{ NameSpace: Smalltalk }" + +TestCase subclass:#VDBSimpleConsoleViewTest + instanceVariableNames:'preferences console consoleI' + classVariableNames:'' + poolDictionaries:'' + category:'VDB-UI-Console-Tests' +! + +!VDBSimpleConsoleViewTest class methodsFor:'documentation'! + +copyright +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +! ! + +!VDBSimpleConsoleViewTest methodsFor:'running'! + +setUp + | window | + + super setUp. + Screen current isNil ifTrue:[ + Smalltalk openDisplay + ]. + self skipIf:Screen current isNil description:'No display connection'. + Smalltalk loadPackage:'stx:goodies/sunit/ext/ui'. + window := StandardSystemView new. + window extent:320 @ 200. + window label:self printString. + console := VDBSimpleConsoleView + origin:0.0 @ 0.0 + extent:1.0 @ 1.0 + in:window. + window open. + window waitUntilVisible. + consoleI := console interactor + + "Modified: / 16-01-2019 / 10:24:12 / jv" + "Modified: / 25-01-2019 / 09:34:43 / Jan Vrany " +! + +tearDown + super tearDown. + console topView destroy. + + "Created: / 28-09-2018 / 08:29:43 / Jan Vrany " + "Modified: / 16-01-2019 / 16:23:35 / Jan Vrany " +! ! + +!VDBSimpleConsoleViewTest methodsFor:'tests - basic'! + +test_basic_01 + + console show: '(gdb) '. + self assert: console list first = '(gdb) '. + self assert: console cursorCol = 7. + + consoleI type: 'b main'. + self assert: console list first = '(gdb) b main'. + self assert: console cursorCol = 13. + + consoleI type: #BackSpace. + self assert: console list first = '(gdb) b mai'. + self assert: console cursorCol = 12. + + consoleI type: #CursorLeft. + self assert: console list first = '(gdb) b mai'. + self assert: console cursorCol = 11. + + consoleI type: 'x'. + self assert: console list first = '(gdb) b maxi'. + self assert: console cursorCol = 12. + + consoleI type: #Delete. + self assert: console list first = '(gdb) b max'. + self assert: console cursorCol = 12. + + consoleI type: #CursorRight. + self assert: console list first = '(gdb) b max'. + self assert: console cursorCol = 12. + + consoleI type: #BeginOfLine. + self assert: console list first = '(gdb) b max'. + self assert: console cursorCol = 7. + + consoleI type: #CursorRight. + self assert: console list first = '(gdb) b max'. + self assert: console cursorCol = 8. + + consoleI type: 'r'. + self assert: console list first = '(gdb) br max'. + self assert: console cursorCol = 9. + + consoleI type: #EndOfLine. + self assert: console list first = '(gdb) br max'. + self assert: console cursorCol = 13. + + consoleI type: '('. + self assert: console list first = '(gdb) br max('. + self assert: console cursorCol = 14. + + "Created: / 25-01-2019 / 09:37:07 / Jan Vrany " + "Modified: / 25-01-2019 / 11:42:57 / Jan Vrany " +! ! + +!VDBSimpleConsoleViewTest methodsFor:'tests - obsolete'! + +test_completion_01 + console completeAction:[ :partial | + console completions: #('finish') + ]. + consoleI type: 'fi'. + consoleI type: #Tab. + self assert: console list first asString = 'finish'. + + "Created: / 25-01-2019 / 22:47:34 / Jan Vrany " +! + +test_completion_02 + + console completeAction:[ :partial | + console completions: + (#('file' 'finish') select: [ :each | each startsWith: partial ]). + ]. + consoleI type: 'f'. + consoleI type: #Tab. + self assert: console list first asString = 'fi'. + + consoleI type: 'l'. + consoleI type: #Tab. + self assert: console list first asString = 'file'. + + "Created: / 25-01-2019 / 22:48:21 / Jan Vrany " +! + +test_completion_03 + console show: '-> '. + + console completeAction:[ :partial | + console completions: + (#('file' 'finish') select: [ :each | each startsWith: partial ]). + ]. + consoleI type: 'f'. + consoleI type: #Tab. + consoleI type: #Tab. + self assert: (console list at: 1) asString = '-> fi'. + self assert: (console list at: 2) asString = 'file'. + self assert: (console list at: 3) asString = 'finish'. + self assert: (console list at: 4) asString = '-> fi'. + + consoleI type: 'n'. + consoleI type: #Tab. + self assert: (console list at: 4) asString = '-> finish'. + + "Created: / 25-01-2019 / 22:48:37 / Jan Vrany " +! ! + +!VDBSimpleConsoleViewTest class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' +! ! + diff -r dae35d5b3d72 -r df7f89efd39d tests/VDBSimpleDebuggerConsoleApplicationTest.st --- a/tests/VDBSimpleDebuggerConsoleApplicationTest.st Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/VDBSimpleDebuggerConsoleApplicationTest.st Fri Jan 25 13:33:51 2019 +0000 @@ -55,7 +55,6 @@ console := application consoleView. consoleI := console interactor. - [ console outStream hasData ] whileTrue:[ Delay waitForMilliseconds: 100 ]. consoleI type: 'fi'. consoleI type: #Tab. @@ -69,7 +68,7 @@ "Created: / 16-01-2019 / 13:53:06 / Jan Vrany " "Modified: / 21-01-2019 / 09:29:26 / Jan Vrany " - "Modified: / 21-01-2019 / 09:29:40 / jv" + "Modified: / 25-01-2019 / 22:53:40 / jv" ! ! !VDBSimpleDebuggerConsoleApplicationTest class methodsFor:'documentation'! diff -r dae35d5b3d72 -r df7f89efd39d tests/VDBSimpleDebuggerConsoleViewTest.st --- a/tests/VDBSimpleDebuggerConsoleViewTest.st Wed Jan 23 11:02:06 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -" -jv:vdb - Visual / VM Debugger -Copyright (C) 2015-now Jan Vrany - -This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' - -You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ -" -"{ Package: 'jv:vdb/tests' }" - -"{ NameSpace: Smalltalk }" - -TestCase subclass:#VDBSimpleDebuggerConsoleViewTest - instanceVariableNames:'preferences consoleOutput consoleInput console consoleI' - classVariableNames:'' - poolDictionaries:'' - category:'VDB-UI-Console-Tests' -! - -!VDBSimpleDebuggerConsoleViewTest class methodsFor:'documentation'! - -copyright -" -jv:vdb - Visual / VM Debugger -Copyright (C) 2015-now Jan Vrany - -This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' - -You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ -" -! ! - -!VDBSimpleDebuggerConsoleViewTest methodsFor:'running'! - -setUp - | window | - - super setUp. - - Screen current isNil ifTrue:[ Smalltalk openDisplay ]. - self skipIf: Screen current isNil description: 'No display connection'. - Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'. - - consoleOutput := GDBInternalPipeStream new. - consoleInput := GDBInternalPipeStream new. - - window := StandardSystemView new. - window extent: 320 @ 200. - window label: self printString. - console := VDBSimpleDebuggerConsoleView origin: 0.0@0.0 extent: 1.0@1.0 in: window. - - "/ Following should be kept in sync with - "/ VDBSimpleDebuggerConsoleApplication >> consoleView - console localEcho:true. - console inputTranslateCRToNL:true. - console lineEditMode:true. - console inStream:consoleInput. - console outStream:consoleOutput. - console startReaderProcessWhenVisible. - - window open. - window waitUntilVisible. - - consoleI := console interactor - - "Modified: / 16-01-2019 / 10:24:12 / jv" - "Modified: / 16-01-2019 / 16:23:28 / Jan Vrany " -! - -tearDown - super tearDown. - console topView destroy. - - "Created: / 28-09-2018 / 08:29:43 / Jan Vrany " - "Modified: / 16-01-2019 / 16:23:35 / Jan Vrany " -! ! - -!VDBSimpleDebuggerConsoleViewTest methodsFor:'tests'! - -test_completion_01 - - console completionBlock:[ :partial | - console completeCommandWith: #('finish') - ]. - consoleI type: 'fi'. - consoleI type: #Tab. - self assert: console list first asString = 'finish'. - - "Created: / 16-01-2019 / 11:44:32 / Jan Vrany " -! - -test_completion_02 - - console completionBlock:[ :partial | - console completeCommandWith: - (#('file' 'finish') select: [ :each | each startsWith: partial ]). - ]. - consoleI type: 'f'. - consoleI type: #Tab. - self assert: console list first asString = 'fi'. - - consoleI type: 'l'. - consoleI type: #Tab. - self assert: console list first asString = 'file'. - - "Created: / 16-01-2019 / 11:46:43 / Jan Vrany " -! - -test_completion_03 - consoleOutput nextPutAll: '-> '. - [ consoleOutput hasData ] whileTrue:[ Delay waitForMilliseconds: 100 ]. - - console completionBlock:[ :partial | - console completeCommandWith: - (#('file' 'finish') select: [ :each | each startsWith: partial ]). - ]. - consoleI type: 'f'. - consoleI type: #Tab. - consoleI type: #Tab. - self assert: (console list at: 1) asString = '-> fi'. - self assert: (console list at: 2) asString = 'file'. - self assert: (console list at: 3) asString = 'finish'. - self assert: (console list at: 4) asString = '-> fi'. - - consoleI type: 'n'. - consoleI type: #Tab. - self assert: (console list at: 4) asString = '-> finish'. - - "Created: / 16-01-2019 / 11:56:11 / Jan Vrany " - "Modified: / 16-01-2019 / 12:51:36 / jv" -! - -test_io_01 - - consoleOutput nextPutAll: 'Hello World'; crlf; nextPutAll: '> '. - [ consoleOutput hasData ] whileTrue:[ Delay waitForMilliseconds: 100 ]. - - self assert: console list first = 'Hello World'. - self assert: console list second = '> '. - - consoleI type: 'command'. - self assert: console list second = '> command'. - - consoleI type: #Return. - self assert: consoleInput nextLine asString = 'command'. - - "Created: / 16-01-2019 / 10:23:56 / Jan Vrany " - "Modified: / 16-01-2019 / 10:36:49 / jv" -! ! - -!VDBSimpleDebuggerConsoleViewTest class methodsFor:'documentation'! - -version_HG - - ^ '$Changeset: $' -! ! - diff -r dae35d5b3d72 -r df7f89efd39d tests/abbrev.stc --- a/tests/abbrev.stc Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/abbrev.stc Fri Jan 25 13:33:51 2019 +0000 @@ -2,7 +2,7 @@ # this file is needed for stc to be able to compile modules independently. # it provides information about a classes filename, category and especially namespace. VDBAbstractApplicationTests VDBAbstractApplicationTests jv:vdb/tests 'VDB-UI-Abstract-Tests' 1 -VDBSimpleDebuggerConsoleViewTest VDBSimpleDebuggerConsoleViewTest jv:vdb/tests 'VDB-UI-Console-Tests' 1 +VDBSimpleConsoleViewTest VDBSimpleConsoleViewTest jv:vdb/tests 'VDB-UI-Console-Tests' 1 jv_vdb_tests jv_vdb_tests jv:vdb/tests '* Projects & Packages *' 3 VDBInstructionListApplicationTests VDBInstructionListApplicationTests jv:vdb/tests 'VDB-UI-Others-Tests' 1 VDBSimpleDebuggerConsoleApplicationTest VDBSimpleDebuggerConsoleApplicationTest jv:vdb/tests 'VDB-UI-Console-Tests' 1 diff -r dae35d5b3d72 -r df7f89efd39d tests/bc.mak --- a/tests/bc.mak Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/bc.mak Fri Jan 25 13:33:51 2019 +0000 @@ -73,7 +73,7 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it $(OUTDIR)VDBAbstractApplicationTests.$(O) VDBAbstractApplicationTests.$(C) VDBAbstractApplicationTests.$(H): VDBAbstractApplicationTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) -$(OUTDIR)VDBSimpleDebuggerConsoleViewTest.$(O) VDBSimpleDebuggerConsoleViewTest.$(C) VDBSimpleDebuggerConsoleViewTest.$(H): VDBSimpleDebuggerConsoleViewTest.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)VDBSimpleConsoleViewTest.$(O) VDBSimpleConsoleViewTest.$(C) VDBSimpleConsoleViewTest.$(H): VDBSimpleConsoleViewTest.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)jv_vdb_tests.$(O) jv_vdb_tests.$(C) jv_vdb_tests.$(H): jv_vdb_tests.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR) $(OUTDIR)VDBInstructionListApplicationTests.$(O) VDBInstructionListApplicationTests.$(C) VDBInstructionListApplicationTests.$(H): VDBInstructionListApplicationTests.st $(INCLUDE_TOP)\jv\vdb\tests\VDBAbstractApplicationTests.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)VDBSimpleDebuggerConsoleApplicationTest.$(O) VDBSimpleDebuggerConsoleApplicationTest.$(C) VDBSimpleDebuggerConsoleApplicationTest.$(H): VDBSimpleDebuggerConsoleApplicationTest.st $(INCLUDE_TOP)\jv\vdb\tests\VDBAbstractApplicationTests.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) diff -r dae35d5b3d72 -r df7f89efd39d tests/jv_vdb_tests.st --- a/tests/jv_vdb_tests.st Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/jv_vdb_tests.st Fri Jan 25 13:33:51 2019 +0000 @@ -72,7 +72,7 @@ #'jv:libgdbs/tests' "GDBDebuggeesResource - referenced by VDBAbstractApplicationTests class>>resources" #'jv:vdb' "VDBInstructionListApplication - referenced by VDBInstructionListApplicationTests>>test_01a" #'stx:libbasic3' "MessageTracer - referenced by VDBAbstractApplicationTests>>setUp" - #'stx:libview' "StandardSystemView - referenced by VDBSimpleDebuggerConsoleViewTest>>setUp" + #'stx:libview' "StandardSystemView - referenced by VDBSimpleConsoleViewTest>>setUp" #'stx:libview2' "ValueHolder - referenced by VDBInstructionListApplicationTests>>test_01a" ) ! @@ -98,7 +98,7 @@ ^ #( " or ( attributes...) in load order" VDBAbstractApplicationTests - VDBSimpleDebuggerConsoleViewTest + VDBSimpleConsoleViewTest #'jv_vdb_tests' VDBInstructionListApplicationTests VDBSimpleDebuggerConsoleApplicationTest diff -r dae35d5b3d72 -r df7f89efd39d tests/libInit.cc --- a/tests/libInit.cc Wed Jan 23 11:02:06 2019 +0000 +++ b/tests/libInit.cc Fri Jan 25 13:33:51 2019 +0000 @@ -17,7 +17,7 @@ #endif extern void _VDBAbstractApplicationTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); -extern void _VDBSimpleDebuggerConsoleViewTest_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); +extern void _VDBSimpleConsoleViewTest_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _jv_137vdb_137tests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBInstructionListApplicationTests_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); extern void _VDBSimpleDebuggerConsoleApplicationTest_Init(int pass, struct __vmData__ *__pRT__, OBJ snd); @@ -36,7 +36,7 @@ { __BEGIN_PACKAGE2__("libjv_vdb_tests", _libjv_vdb_tests_Init, "jv:vdb/tests"); _VDBAbstractApplicationTests_Init(pass,__pRT__,snd); - _VDBSimpleDebuggerConsoleViewTest_Init(pass,__pRT__,snd); + _VDBSimpleConsoleViewTest_Init(pass,__pRT__,snd); _jv_137vdb_137tests_Init(pass,__pRT__,snd); _VDBInstructionListApplicationTests_Init(pass,__pRT__,snd); _VDBSimpleDebuggerConsoleApplicationTest_Init(pass,__pRT__,snd);