*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 07 Dec 2006 19:13:43 +0100
changeset 10256 63993a2b4d15
parent 10255 a50472b6354a
child 10257 2bc06451585b
*** empty log message ***
ReadEvalPrintLoop.st
--- a/ReadEvalPrintLoop.st	Thu Dec 07 19:07:27 2006 +0100
+++ b/ReadEvalPrintLoop.st	Thu Dec 07 19:13:43 2006 +0100
@@ -53,18 +53,36 @@
     "Created: / 07-12-2006 / 17:33:39 / cg"
 !
 
+errorStream
+    ^ errorStream ? Transcript ? Stderr
+
+    "Created: / 07-12-2006 / 19:11:56 / cg"
+!
+
 input:something
     inputStream := something.
 
     "Modified: / 07-12-2006 / 17:33:31 / cg"
 !
 
+inputStream
+    ^ inputStream ? Stdin
+
+    "Created: / 07-12-2006 / 19:12:13 / cg"
+!
+
 output:something
     outputStream := something.
 
     "Created: / 07-12-2006 / 17:27:48 / cg"
 !
 
+outputStream
+    ^ outputStream ? Stdout
+
+    "Created: / 07-12-2006 / 19:12:27 / cg"
+!
+
 prompt:something
     prompt := something.
 ! !
@@ -84,7 +102,7 @@
 !
 
 cmd_help:lineStream
-    errorStream
+    self errorStream
         nextPutAll:
 'Everything entered up to an empty line is called a "chunk" and evaluated as a block.
 Lines starting with "#" are commands to the read-eval-print interpreter.
@@ -128,9 +146,9 @@
         ^ self.
     ].
 
-    errorStream nextPutLine:'?? which flag ?'.
+    self errorStream nextPutLine:'?? which flag ?'.
 
-    "Modified: / 07-12-2006 / 19:06:00 / cg"
+    "Modified: / 07-12-2006 / 19:13:34 / cg"
 !
 
 cmd_show:lineStream
@@ -146,21 +164,23 @@
         ^ self.
     ].
     (what startsWith:'mem') ifTrue:[
-        errorStream nextPutAll:('overall: ',(ObjectMemory bytesUsed / 1024) printString,' kb').
-        errorStream nextPutAll:('free   : ',(ObjectMemory freeSpace / 1024) printString,' kb').
-        errorStream nextPutAll:('minorGC: ',(ObjectMemory scavengeCount) printString).
-        errorStream nextPutAll:('majorGC: ',(ObjectMemory garbageCollectCount) printString).
+        self errorStream 
+            nextPutAll:('overall: ',(ObjectMemory bytesUsed / 1024) printString,' kb');
+            nextPutAll:('free   : ',(ObjectMemory freeSpace / 1024) printString,' kb');
+            nextPutAll:('minorGC: ',(ObjectMemory scavengeCount) printString);
+            nextPutAll:('majorGC: ',(ObjectMemory garbageCollectCount) printString).
         ^ self.
     ].
     (what startsWith:'flag') ifTrue:[
-        errorStream nextPutAll:('trace : ',traceFlag printString).
-        errorStream nextPutAll:('timing: ',timingFlag printString).
+        self errorStream 
+            nextPutAll:('trace : ',traceFlag printString);
+            nextPutAll:('timing: ',timingFlag printString).
         ^ self.
     ].
 
-    errorStream nextPutLine:'?? show what ?'.
+    self errorStream nextPutLine:'?? show what ?'.
 
-    "Modified: / 07-12-2006 / 19:06:31 / cg"
+    "Modified: / 07-12-2006 / 19:14:08 / cg"
 !
 
 cmd_use:lineStream
@@ -184,7 +204,7 @@
     self 
         perform:('cmd_',cmd,':') asSymbol with:s 
         ifNotUnderstood:[   
-            (errorStream ? Stderr) 
+            self errorStream  
                 nextPutAll:'?? invalid command: ';
                 nextPutAll:cmd;
                 nextPutAll:'. Type "#help" for help.';
@@ -206,9 +226,10 @@
     [
         |input output error lines chunk compilerClass|
 
-        input := inputStream ? Stdin.
-        output := outputStream ? Stdout.
-        error := errorStream ? Stderr.
+        "/ re-evaluate these in the loop, so they can be changed dynamically
+        input := self inputStream.
+        output := self outputStream.
+        error := self errorStream.
         compilerClass := compiler ? Compiler.
 
         prompt notNil ifTrue:[
@@ -258,11 +279,11 @@
     "
 
     "Created: / 07-12-2006 / 17:27:21 / cg"
-    "Modified: / 07-12-2006 / 18:45:44 / cg"
+    "Modified: / 07-12-2006 / 19:13:11 / cg"
 ! !
 
 !ReadEvalPrintLoop class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadEvalPrintLoop.st,v 1.6 2006-12-07 18:07:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadEvalPrintLoop.st,v 1.7 2006-12-07 18:13:43 cg Exp $'
 ! !