# HG changeset patch # User Claus Gittinger # Date 1525624387 -7200 # Node ID 43cc0113e23a9bdc82a8d8fec545cd31d82c2d0d # Parent 4ca48fa9c122b3c2a7b23378d183fa51364d96f5 #UI_ENHANCEMENT by cg class: ReadEvalPrintLoop class definition added: #printFlag #printFlag: changed: #basicReadEvalPrintLoopWithInput:output:error:compiler:prompt:print: #cmd_help: #cmd_setOrClear:to: #readEvalPrintLoop (send #basicReadEvalPrintWithInput:output:error:compiler:prompt:print: instead of #readEvalPrintWithInput:output:error:compiler:prompt:print:) diff -r 4ca48fa9c122 -r 43cc0113e23a ReadEvalPrintLoop.st --- a/ReadEvalPrintLoop.st Sun May 06 18:21:44 2018 +0200 +++ b/ReadEvalPrintLoop.st Sun May 06 18:33:07 2018 +0200 @@ -19,7 +19,7 @@ instanceVariableNames:'inputStream outputStream errorStream compiler prompt doChunkFormat traceFlag timingFlag profilingFlag printFlag exitAction currentDirectory lastEditedClass lastEditedSelector - editorCommand confirmDebugger debuggerUsed' + editorCommand confirmDebugger debuggerUsed returnValuePrinting' classVariableNames:'' poolDictionaries:'' category:'System-Support' @@ -200,6 +200,18 @@ "Created: / 07-12-2006 / 19:12:27 / cg" ! +printFlag + "true if the return value of expressions should be printed" + + ^ printFlag ? true +! + +printFlag:aBoolean + "true if the return value of expressions should be printed" + + printFlag := aBoolean +! + prompt:aString "set the prompt" @@ -536,6 +548,8 @@ profiling .......... show execution profile chunkFormat ........ traditional bang chunk format input mode editor ............. command used with #edit directive + confirmDebugger .... ask for debug on error + print .............. print return values #debug ................. enter a MiniDebugger #edit ........ open an external editor class .............. on a class @@ -692,10 +706,14 @@ confirmDebugger := aBoolean. ^ self. ]. + (what startsWith:'pri') ifTrue:[ + printFlag := aBoolean. + ^ self. + ]. ]. self errorStream showCR:'? usage: set/clear '; - showCR:'? ( must be one of: trace, times, profile, chunk, editor, confirmDebug)'. + showCR:'? ( must be one of: trace, times, profile, chunk, editor, confirmDebug, print)'. "Modified: / 08-11-2016 / 22:49:17 / cg" ! @@ -1035,7 +1053,7 @@ (self confirmDebugger not or:[ ex creator isControlInterrupt or:[ self askYesNo:('Error encountered: %1\Debug? ' - bindWith:ex description)]] + withCRs bindWith:ex description)]] ) ifTrue:[ MiniDebugger enterWithMessage:(ex errorString) mayProceed:true. "/ if we arrive here, user typed 'c' - continue @@ -1054,7 +1072,7 @@ evaluate:chunk compile:true. ]. - doPrint ifTrue:[ + (doPrint and:[printFlag]) ifTrue:[ '-> (Return value): ' print. value displayString printOn:output. output cr. output flush. @@ -1064,7 +1082,7 @@ value := (compilerClass new requestor:self) evaluate:chunk compile:true. ]. - doPrint ifTrue:[ + (doPrint and:[printFlag]) ifTrue:[ value isVoid ifFalse:[ '-> (Return value): ' print. value displayString printOn:output. output cr. @@ -1146,10 +1164,12 @@ ]. ] do:[ input signalAtEnd:true. + self basicReadEvalPrintLoopWithInput:input output:output error:error - compiler:compilerClass prompt:prompt print:(printFlag ? true). - ] + compiler:compilerClass prompt:prompt print:true. + + ]. ]. "/ self errorStream showCR:('done.').