--- a/Smalltalk.st Fri Nov 24 14:03:55 1995 +0100
+++ b/Smalltalk.st Fri Nov 24 19:04:30 1995 +0100
@@ -13,9 +13,9 @@
Object subclass:#Smalltalk
instanceVariableNames:''
classVariableNames:'ExitBlocks CachedClasses SystemPath StartupClass StartupSelector
- StartupArguments CachedAbbreviations SilentLoading Initializing
- StandAlone LogDoits LoadBinaries RealSystemPath ResourcePath
- SourcePath BitmapPath BinaryPath FileInPath'
+ StartupArguments CachedAbbreviations SilentLoading Initializing
+ StandAlone LogDoits LoadBinaries RealSystemPath ResourcePath
+ SourcePath BitmapPath BinaryPath FileInPath'
poolDictionaries:''
category:'System-Support'
!
@@ -109,11 +109,11 @@
envString isEmpty ifFalse:[
i := envString indexOf:$_.
(i == 0) ifTrue:[
- langString := envString.
- terrString := envString
+ langString := envString.
+ terrString := envString
] ifFalse:[
- langString := envString copyTo:(i - 1).
- terrString := envString copyFrom:(i + 1)
+ langString := envString copyTo:(i - 1).
+ terrString := envString copyFrom:(i + 1)
].
Language := langString asLowercase asSymbol.
LanguageTerritory := terrString asLowercase asSymbol
@@ -1005,23 +1005,20 @@
"return the class with name aString, or nil if absent.
To get to the metaClass, append 'class' to the string."
- |cls str sym|
+ |cls sym meta|
"be careful, to not invent new symbols ..."
sym := aString asSymbolIfInterned.
sym notNil ifTrue:[
cls := self at:sym ifAbsent:[].
- cls isNil ifTrue:[^ nil].
cls isBehavior ifTrue:[^ cls]
].
(aString endsWith:'class') ifTrue:[
- str := aString copyTo:(aString size - 5).
- sym := str asSymbolIfInterned.
- sym notNil ifTrue:[
- cls := self at:sym ifAbsent:[].
- cls isNil ifTrue:[^ nil].
- cls isBehavior ifTrue:[^ cls]
- ]
+
+ meta := self classNamed:(aString copyWithoutLast:5).
+ meta notNil ifTrue:[
+ ^ meta class
+ ].
].
^ nil
@@ -1031,7 +1028,12 @@
Smalltalk classNamed:'true'
Smalltalk classNamed:'Objectclass'
Smalltalk classNamed:'Metaclass'
+ Smalltalk classNamed:'Array'
+ Smalltalk classNamed:'Arrayclass'
"
+
+ "Created: 24.11.1995 / 17:30:22 / cg"
+ "Modified: 24.11.1995 / 17:31:29 / cg"
!
classNames
@@ -1039,37 +1041,61 @@
^ self allClasses collect:[:aClass | aClass name]
- "Smalltalk classNames"
+ "
+ Smalltalk classNames
+ "
!
classnameCompletion:aPartialClassName
"given a partial classname, return an array consisting of
2 entries: 1st: collection consisting of matching names
- 2nd: the longest match"
-
- |matches best|
-
+ 2nd: the best (longest) match"
+
+ |searchName matches best isMatchString|
+
+ searchName := aPartialClassName.
+ (searchName at:1) isLowercase ifTrue:[
+ searchName := searchName copy asUppercaseFirst
+ ].
+
+ isMatchString := searchName includesMatchCharacters.
matches := SortedCollection new.
self allClassesDo:[:aClass |
+ |className addIt|
+
+ className := aClass name.
aClass isMeta ifFalse:[
- (aClass name startsWith:aPartialClassName) ifTrue:[
+ isMatchString ifTrue:[
+ addIt := searchName match:className
+ ] ifFalse:[
+ addIt := className startsWith:searchName
+ ].
+ addIt ifTrue:[
matches add:aClass name
]
]
].
matches isEmpty ifTrue:[
- ^ Array with:aPartialClassName with:(Array with:aPartialClassName)
+ ^ Array with:searchName with:(Array with:searchName)
].
matches size == 1 ifTrue:[
^ Array with:matches first with:(matches asArray)
].
- best := matches longestCommonPrefix.
+ isMatchString ifTrue:[
+ best := searchName.
+ ] ifFalse:[
+ best := matches longestCommonPrefix.
+ ].
^ Array with:best with:matches asArray
"
Smalltalk classnameCompletion:'Arr'
Smalltalk classnameCompletion:'Arra'
+ Smalltalk classnameCompletion:'arra'
+ Smalltalk classnameCompletion:'*rray'
"
+
+ "Created: 24.11.1995 / 17:24:45 / cg"
!
includes:something
@@ -2601,5 +2627,5 @@
!Smalltalk class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.89 1995-11-23 17:13:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.90 1995-11-24 18:04:30 cg Exp $'
! !