#FEATURE by cg
class: ReadEvalPrintLoop
added:
#showModules
#showVariables
changed:
#cmd_edit:
#cmd_show:
#showPackages
--- a/ReadEvalPrintLoop.st Tue Nov 08 17:17:20 2016 +0100
+++ b/ReadEvalPrintLoop.st Tue Nov 08 17:24:52 2016 +0100
@@ -276,7 +276,7 @@
tmpFile := Filename newTemporary.
tmpFile contents:code.
modifiedTime := tmpFile modificationTime.
- OperatingSystem executeCommand:('%1 %2' bindWith:editor with:tmpFile pathName).
+ OperatingSystem executeCommand:('%1 "%2"' bindWith:editor with:tmpFile pathName).
tmpFile modificationTime ~= modifiedTime ifTrue:[
isNewClass ifTrue:[
Compiler evaluate:tmpFile contentsOfEntireFile.
@@ -419,7 +419,7 @@
!
cmd_show:lineStream
- |errStream what showAll printModule ok|
+ |errStream what showAll ok|
errStream := self errorStream.
@@ -432,13 +432,7 @@
(showAll or:[ what startsWith:'var' ]) ifTrue:[
showAll ifTrue:[ errStream nextPutLine:'Variables:'; nextPutLine:'----------' ].
- Workspace notNil ifTrue:[
- Workspace workspaceVariables keys asOrderedCollection sort do:[:nm |
- |holder|
- holder := Workspace workspaceVariables at:nm.
- errStream nextPutAll:nm; nextPutAll:' -> '; nextPutLine:holder value printString.
- ].
- ].
+ self showVariables.
ok := true.
].
@@ -456,23 +450,7 @@
(showAll or:[ what startsWith:'mod' ]) ifTrue:[
showAll ifTrue:[ errStream cr; nextPutLine:'Modules:'; nextPutLine:'--------' ].
- printModule :=
- [:mod |
- errStream
- nextPutAll:' ';
- nextPutAll:(mod package "libraryName");
- nextPutLine:' (',(mod type),')'.
- ].
-
- errStream nextPutLine:'builtIn:'.
- ((ObjectMemory binaryModuleInfo
- reject:[:m | m dynamic])
- asSortedCollection:[:a :b | a name < b name]) do:printModule.
-
- errStream nextPutLine:'dynamic:'.
- ((ObjectMemory binaryModuleInfo
- select:[:m | m dynamic])
- asSortedCollection:[:a :b | a name < b name]) do:printModule.
+ self showModules.
ok := true.
].
@@ -568,6 +546,34 @@
"Created: / 07-12-2006 / 18:49:17 / cg"
!
+showModules
+ |errStream printModule|
+
+ errStream := self errorStream.
+
+ printModule :=
+ [:mod |
+ errStream
+ nextPutAll:' ';
+ nextPutAll:(mod package "libraryName");
+ nextPutLine:' (',(mod type),')'.
+ ].
+
+ errStream nextPutLine:'builtIn:'.
+ ((ObjectMemory binaryModuleInfo
+ reject:[:m | m dynamic])
+ asSortedCollection:[:a :b | a name < b name]) do:printModule.
+
+ errStream nextPutLine:'dynamic:'.
+ ((ObjectMemory binaryModuleInfo
+ select:[:m | m dynamic])
+ asSortedCollection:[:a :b | a name < b name]) do:printModule.
+
+ "
+ ReadEvalPrintLoop basicNew showModules
+ "
+!
+
showPackages
|all|
@@ -577,11 +583,33 @@
].
all := all asOrderedCollection sort.
all do:[:eachPackage |
- self errorStream nextPutLine:eachPackage.
+ self errorStream nextPutAll:eachPackage.
+ (Smalltalk isPackageLoaded:eachPackage) ifTrue:[
+ self errorStream nextPutAll:' (loaded)'.
+ ].
+ self errorStream cr.
].
"
ReadEvalPrintLoop basicNew showPackages
+ ReadEvalPrintLoop basicNew showModules
+ "
+!
+
+showVariables
+ Workspace notNil ifTrue:[
+ Workspace workspaceVariables keys asOrderedCollection sort do:[:nm |
+ |holder|
+ holder := Workspace workspaceVariables at:nm.
+ self errorStream
+ nextPutAll:nm;
+ nextPutAll:' -> ';
+ nextPutLine:holder value printString.
+ ].
+ ].
+
+ "
+ ReadEvalPrintLoop basicNew showVariables
"
! !