ReadEvalPrintLoop.st
changeset 20923 ce3f5d5e8b54
parent 20922 26a835f3689a
child 20924 148f95eee302
--- a/ReadEvalPrintLoop.st	Tue Nov 08 19:10:04 2016 +0100
+++ b/ReadEvalPrintLoop.st	Tue Nov 08 19:15:27 2016 +0100
@@ -228,7 +228,7 @@
     "/ 
     (classOrMethodName isUppercaseFirst) ifTrue:[ 
         (cls := Smalltalk classNamed:classOrMethodName) isNil ifTrue:[
-            errStream nextPutAll:'edit: no such class: ',classOrMethodName,' ; create (y/n)? '.
+            errStream show:'edit: no such class: ',classOrMethodName,' ; create (y/n)? '.
             (self inputStream nextLine withoutSeparators startsWith:'y') ifFalse:[^ self].
             isNewClass := true.
             code := 
@@ -252,10 +252,10 @@
     isNewClass ifFalse:[
         cls := cls ? lastEditedClass.
         cls isNil ifTrue:[
-            errStream nextPutLine:'edit usage:'.
-            errStream nextPutLine:'   #edit className selector'.
-            errStream nextPutLine:'   #edit className '.
-            errStream nextPutLine:'   #edit selector (class as in previous edit)'.
+            errStream showCR:'edit usage:'.
+            errStream showCR:'   #edit className selector'.
+            errStream showCR:'   #edit className '.
+            errStream showCR:'   #edit selector (class as in previous edit)'.
             ^ self.
         ].
         lastEditedClass := cls.
@@ -265,7 +265,7 @@
         ] ifFalse:[    
             ((selector := methodName asSymbolIfInterned) isNil 
             or:[ (cls implements:selector) not]) ifTrue:[
-                errStream nextPutAll:('"',methodName,'" is a new method; create (y/n)? ').
+                errStream show:('"',methodName,'" is a new method; create (y/n)? ').
                 (self inputStream nextLine withoutSeparators startsWith:'y') ifFalse:[^ self].
                 code := '
 %1
@@ -361,12 +361,12 @@
     lineStream skipSeparators.
     filename := lineStream upToEnd withoutSeparators.
     filename isNil ifTrue:[
-        '? which file?' errorPrintCR.
+        self errorStream showCR:'? which file?'.
         ^ self.
     ].
     filename := filename withoutSeparators.
     filename isEmpty ifTrue:[
-        '? which file?' errorPrintCR.
+        self errorStream showCR:'? which file?'.
         ^ self.
     ].
 
@@ -381,7 +381,7 @@
         newInput := filename readStream.
     ].
     newInput isNil ifTrue:[
-        ('Could not find file: "',filename pathName,'"') errorPrintCR.
+        self errorStream showCR:('Could not find file: "',filename pathName,'"').
         ^ self.
     ].
 
@@ -402,7 +402,6 @@
             compiler:(compiler ? Compiler ? Parser)
             prompt:false
             print:false.
-        'after read1' errorPrintCR.
     ] ensure:[
         newInput close.
         doChunkFormat := savedDoChunkFormat.
@@ -410,10 +409,7 @@
         inputStream := savedInput.
         printFlag := savedPrint.
         prompt := savedPrompt.
-        
-        'ensure done' errorPrintCR.
     ].
-    'after read2' errorPrintCR.
 !
 
 cmd_set:lineStream
@@ -445,7 +441,7 @@
             ^ self.
         ].
     ].
-    self errorStream nextPutLine:'? which flag ?'.
+    self errorStream showCR:'? which flag ?'.
 
     "Modified: / 07-12-2006 / 19:13:34 / cg"
 !
@@ -463,25 +459,25 @@
         showAll := (what startsWith:'all').
         
         (showAll or:[ what startsWith:'var' ]) ifTrue:[                      
-            showAll ifTrue:[ errStream nextPutLine:'Variables:'; nextPutLine:'----------' ].
+            showAll ifTrue:[ errStream showCR:'Variables:'; showCR:'----------' ].
             self showVariables.
             ok := true.
         ].
         
         (showAll or:[ what startsWith:'proc' ]) ifTrue:[                    
-            showAll ifTrue:[ errStream cr; nextPutLine:'Threads:'; nextPutLine:'--------' ].
+            showAll ifTrue:[ errStream cr; showCR:'Threads:'; showCR:'--------' ].
             MiniDebugger basicNew showProcesses.
             ok := true.
         ].
         
         ("showAll or:[" what startsWith:'pack' "]") ifTrue:[                    
-            showAll ifTrue:[ errStream cr; nextPutLine:'Available Packages:'; nextPutLine:'--------' ].
+            showAll ifTrue:[ errStream cr; showCR:'Available Packages:'; showCR:'--------' ].
             self showPackages.
             ok := true.
         ].
 
         (showAll or:[ what startsWith:'mod' ]) ifTrue:[
-            showAll ifTrue:[ errStream cr; nextPutLine:'Modules:'; nextPutLine:'--------' ].
+            showAll ifTrue:[ errStream cr; showCR:'Modules:'; showCR:'--------' ].
             self showModules.
 
             ok := true.
@@ -490,31 +486,31 @@
         (showAll or:[ what startsWith:'mem' ]) ifTrue:[
             |allMem|
             
-            showAll ifTrue:[ errStream cr; nextPutLine:'Memory:'; nextPutLine:'-------' ].
+            showAll ifTrue:[ errStream cr; showCR:'Memory:'; showCR:'-------' ].
             "/ allMem := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed
             "/                                     + ObjectMemory newSpaceUsed.
             errStream
-                "/ nextPutLine:('overall: ',(allMem // 1024) printString,' Kb');
-                nextPutLine:('used   : ',(ObjectMemory bytesUsed // 1024) printString,' Kb');
-                nextPutLine:('free   : ',(ObjectMemory freeSpace // 1024) printString,' Kb');
-                nextPutAll:('minorGC: ',(ObjectMemory scavengeCount) printString);
-                nextPutLine:(' majorGC: ',(ObjectMemory garbageCollectCount) printString).
+                "/ showCR:('overall: ',(allMem // 1024) printString,' Kb');
+                showCR:('used   : ',(ObjectMemory bytesUsed // 1024) printString,' Kb');
+                showCR:('free   : ',(ObjectMemory freeSpace // 1024) printString,' Kb');
+                show:('minorGC: ',(ObjectMemory scavengeCount) printString);
+                showCR:(' majorGC: ',(ObjectMemory garbageCollectCount) printString).
             ok := true.
         ].
         
         (showAll or:[ what startsWith:'flag' ]) ifTrue:[
-            showAll ifTrue:[ errStream cr; nextPutLine:'Flags:'; nextPutLine:'------' ].
+            showAll ifTrue:[ errStream cr; showCR:'Flags:'; showCR:'------' ].
             errStream
-                nextPutLine:('trace :      ',(traceFlag ? false) printString);
-                nextPutLine:('timing:      ',(timingFlag ? false) printString);
-                nextPutLine:('profiling:   ',(profilingFlag ? false) printString);
-                nextPutLine:('chunkFormat: ',(doChunkFormat ? false) printString).
+                showCR:('trace :      ',(traceFlag ? false) printString);
+                showCR:('timing:      ',(timingFlag ? false) printString);
+                showCR:('profiling:   ',(profilingFlag ? false) printString);
+                showCR:('chunkFormat: ',(doChunkFormat ? false) printString).
             ok := true.
         ].
     ].
 
     ok ifFalse:[
-        errStream nextPutLine:'? show what ?'.
+        errStream showCR:'? show what ?'.
     ].
     
     "
@@ -530,26 +526,26 @@
     lineStream skipSeparators.
     pkg := lineStream upToEnd.
     pkg isNil ifTrue:[
-	'? which package?' errorPrintCR.
-	^ self.
+        self errorStream showCR:'? which package?'.
+        ^ self.
     ].
     pkg := pkg withoutSeparators.
     pkg isEmpty ifTrue:[
-	'? which package?' errorPrintCR.
-	^ self.
+        self errorStream showCR:'? which package?'.
+        ^ self.
     ].
 
     [
-	Smalltalk loadPackage:pkg.
+        Smalltalk loadPackage:pkg.
     ] on:PackageLoadError do:[:ex|
-	"/ allow for some shortcuts...
-	(pkg includes:$:) ifTrue:[
-	    self errorStream nextPutLine:('Failed to load package: "',pkg,'"').
-	] ifFalse:[
-	    "/ try stx standard package
-	    pkg := 'stx:', pkg.
-	    ex restart.
-	].
+        "/ allow for some shortcuts...
+        (pkg includes:$:) ifTrue:[
+            self errorStream showCR:('Failed to load package: "',pkg,'"').
+        ] ifFalse:[
+            "/ try stx standard package
+            pkg := 'stx:', pkg.
+            ex restart.
+        ].
     ].
 
     "Created: / 07-12-2006 / 19:07:56 / cg"
@@ -569,19 +565,17 @@
     cmd := s nextAlphaNumericWord.
     cmd notNil ifTrue:[
         AbortAllOperationRequest handle:[:ex |
-            self errorStream nextPutLine:('Directive aborted: ', ex description)
+            self errorStream showCR:('Directive aborted: ', ex description)
         ] do:[
             Error handle:[:ex |
-                self errorStream nextPutLine:('Ignored in directive: ', ex description).
+                self errorStream showCR:('Ignored in directive: ', ex description).
             ] do:[    
                 self
                     perform:('cmd_',cmd) asMutator with:s
                     ifNotUnderstood:[
                         self errorStream
-                            nextPutAll:'?? invalid command: ';
-                            nextPutAll:cmd;
-                            nextPutAll:'. Type "#help" for help.';
-                            cr.
+                            show:'?? invalid command: '; show:cmd;
+                            showCR:'. Type "#help" for help.'
                     ].
             ].
         ].
@@ -598,9 +592,9 @@
     printModule :=
         [:mod |
             errStream
-                nextPutAll:'  ';
-                nextPutAll:(mod package "libraryName");
-                nextPutLine:' (',(mod type),')'.
+                show:'  ';
+                show:(mod package "libraryName");
+                showCR:' (',(mod type),')'.
         ].
 
     errStream nextPutLine:'builtIn:'.
@@ -627,9 +621,9 @@
     ].
     all := all asOrderedCollection sort.
     all do:[:eachPackage |
-        self errorStream nextPutAll:eachPackage.
+        self errorStream show:eachPackage.
         (Smalltalk isPackageLoaded:eachPackage) ifTrue:[
-            self errorStream nextPutAll:' (loaded)'.
+            self errorStream show:' (loaded)'.
         ].    
         self errorStream cr.
     ].    
@@ -646,9 +640,9 @@
             |holder|
             holder := Workspace workspaceVariables at:nm.
             self errorStream 
-                nextPutAll:nm;  
-                nextPutAll:' -> '; 
-                nextPutLine:holder value printString.
+                show:nm;  
+                show:' -> '; 
+                showCR:holder value printString.
         ].
     ].