MiniInspector.st
changeset 16250 c376e523d007
parent 15926 2a89ee50988c
child 16558 4c38a24c247c
--- a/MiniInspector.st	Tue Mar 11 10:27:52 2014 +0100
+++ b/MiniInspector.st	Tue Mar 11 10:32:24 2014 +0100
@@ -63,8 +63,8 @@
 commandLoop
     |cmd valid|
 
-    'MiniInspector on ' print.  inspectedObject displayString printCR.
-    '' printCR.
+    'MiniInspector on ' errorPrint.  inspectedObject displayString errorPrintCR.
+    '' errorPrintCR.
 
     [true] whileTrue:[
         valid := false.
@@ -82,16 +82,16 @@
         ].
         (cmd == $p) ifTrue:[
             valid := true.
-            inspectedObject displayString printCR
+            inspectedObject displayString errorPrintCR
         ].
         (cmd == $c) ifTrue:[
             valid := true.
-            inspectedObject class displayString printCR
+            inspectedObject class displayString errorPrintCR
         ].
         (cmd == $C) ifTrue:[
             valid := true.
             MiniInspector openOn:inspectedObject class.
-            'back in previous inspector; inspecting ' print.  inspectedObject displayString printCR.
+            'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
         ].
         (cmd == $d) ifTrue:[
             valid := true.
@@ -103,7 +103,7 @@
         ].
         (cmd == $e) ifTrue:[
             valid := true.
-            (Parser evaluate:commandArg receiver:inspectedObject) printCR.
+            (Parser evaluate:commandArg receiver:inspectedObject) errorPrintCR.
         ].
         (cmd == $e) ifTrue:[
             valid := true.
@@ -153,8 +153,8 @@
         Error handle:[:ex |
             |yesNo|
 
-            'Error while executing command: ' print.
-            ex description printCR.
+            'Error while executing command: ' errorPrint.
+            ex description errorPrintCR.
             yesNo := self getCommand:'- (i)gnore / (p)roceed / (d)ebug ? '.
             yesNo == $d ifTrue:[
                 ex reject
@@ -173,16 +173,18 @@
 getCommand:prompt
     |cmd c num arg|
 
-    prompt print.
+    prompt errorPrint.
 
-    cmd := Character fromUser.
-    c := cmd.
-    (c notNil and:[c isDigit]) ifTrue:[
+    c := cmd := Character fromUser.
+    c isNil ifTrue:[
+        ^ nil.
+    ].
+    c isDigit ifTrue:[
         num := 0.
-        [c notNil and:[c isDigit]] whileTrue:[
+        [
             num := (num * 10) + c digitValue.
             c := Character fromUser.
-        ].
+        ] doWhile:[c notNil and:[c isDigit]].
         ^ num "/ numeric
     ].
 
@@ -210,22 +212,22 @@
     numInsts := anObject class instSize.
 
     which > numInsts ifTrue:[
-	idx := which - numInsts.
+        idx := which - numInsts.
         idx > anObject basicSize ifTrue:[
-            'invalid indexed instvar index: ' print. idx printCR
+            'invalid indexed instvar index: ' errorPrint. idx errorPrintCR
         ] ifFalse:[
-	    'Inspecting indexed instVar ' print. idx print. '...' printCR.
-	    MiniInspector openOn:(anObject basicAt:idx).
-	    'back in previous inspector; inspecting ' print.  inspectedObject displayString printCR.
+            'Inspecting indexed instVar ' errorPrint. idx errorPrint. '...' errorPrintCR.
+            MiniInspector openOn:(anObject basicAt:idx).
+            'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
         ]
     ] ifFalse: [
-	which < 0 ifTrue:[
-	    'invalid instVar # (must be >= 1)' printCR
-	] ifFalse:[
-	    'Inspecting instVar ' print. which print. '...' printCR.
-	    MiniInspector openOn:(anObject instVarAt:which).
-	    'back in previous inspector; inspecting ' print.  inspectedObject displayString printCR.
-	].
+        which < 0 ifTrue:[
+            'invalid instVar # (must be >= 1)' errorPrintCR
+        ] ifFalse:[
+            'Inspecting instVar ' errorPrint. which errorPrint. '...' errorPrintCR.
+            MiniInspector openOn:(anObject instVarAt:which).
+            'back in previous inspector; inspecting ' errorPrint.  inspectedObject displayString errorPrintCR.
+        ].
     ]
 
     "Modified: 20.5.1996 / 10:27:40 / cg"
@@ -234,12 +236,12 @@
 interpreterLoopWith:anObject
     |line done rslt|
  
-    'read-eval-print loop; exit with empty line' printCR.
-    '' printCR.
+    'read-eval-print loop; exit with empty line' errorPrintCR.
+    '' errorPrintCR.
  
     done := false.
     [done] whileFalse:[
-        '> ' print.
+        '> ' errorPrint.
  
         line := Stdin nextLine.
         (line size == 0) ifTrue:[
@@ -251,7 +253,7 @@
                 receiver:anObject
                 notifying:nil
                 ifFail:[].
-            rslt printCR.
+            rslt errorPrintCR.
         ]
     ]
 !
@@ -262,22 +264,22 @@
     n := anObject class instSize.
     names := anObject class allInstVarNames.
 
-    'number of instvars: ' print. n printCR.
+    'number of instvars: ' errorPrint. n errorPrintCR.
     1 to:n do:[:i |
-        (i printStringLeftPaddedTo:2) print. 
-	' {' print. (names at:i) print. '}' print.
-	': ' print.
-        ((anObject instVarAt:i) displayString contractAtEndTo:80) printCR
+        (i printStringLeftPaddedTo:2) errorPrint. 
+        ' {' errorPrint. (names at:i) errorPrint. '}' errorPrint.
+        ': ' errorPrint.
+        ((anObject instVarAt:i) displayString contractAtEndTo:80) errorPrintCR
     ].
 
     n := anObject basicSize.
     n > 0 ifTrue:[
-        'number of indexed instvars: ' print. n printCR.
+        'number of indexed instvars: ' errorPrint. n errorPrintCR.
         n > 10 ifTrue:[n := 10].
         1 to:n do:[:i |
-            ' [' print. i print. ']: ' print.
-            ((anObject basicAt:i) displayString contractAtEndTo:80) printCR
-	]
+            ' [' errorPrint. i errorPrint. ']: ' errorPrint.
+            ((anObject basicAt:i) displayString contractAtEndTo:80) errorPrintCR
+        ]
     ].
 
     "Modified: 20.5.1996 / 10:27:45 / cg"
@@ -286,6 +288,6 @@
 !MiniInspector class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/MiniInspector.st,v 1.29 2014-02-03 09:20:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/MiniInspector.st,v 1.30 2014-03-11 09:32:24 stefan Exp $'
 ! !