--- a/Symbol.st Fri Aug 14 23:22:53 2009 +0200
+++ b/Symbol.st Sat Aug 15 08:54:44 2009 +0200
@@ -185,13 +185,6 @@
! !
-!Symbol methodsFor:'*magritte-model-converting'!
-
-asAccessor
- ^ Magritte::MASelectorAccessor selector: self
-! !
-
-
!Symbol methodsFor:'Compatibility-Squeak'!
isUnary
@@ -208,9 +201,9 @@
^ UserMessage key:self catalogID:catalogID
"
- (#theFooMessage << #myMessages)
- (#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
- (#theFooMessage >> 'cannot read subclass of metaclass')
+ (#theFooMessage << #myMessages)
+ (#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
+ (#theFooMessage >> 'cannot read subclass of metaclass')
"
!
@@ -219,12 +212,12 @@
and the argument as defaultString.
VW compatibility."
- ^ UserMessage key:self defaultString:aString
+ ^ UserMessage key:self defaultString:aString
"
- (#theFooMessage << #myMessages)
- (#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
- (#theFooMessage >> 'cannot read subclass of metaclass')
+ (#theFooMessage << #myMessages)
+ (#theFooMessage << #myMessages >> 'cannot read subclass of metaclass')
+ (#theFooMessage >> 'cannot read subclass of metaclass')
"
! !
@@ -251,7 +244,7 @@
= something
"return true, if the receiver and argument consist of the same characters.
- Redefined here, for more efficient #= comparison of symbols
+ Redefined here, for more efficient #= comparison of symbols
(which ought to be compared using #==).
If the argument is a symbol, we use a quick pointer compare, instead of
the inherited value compare."
@@ -264,7 +257,7 @@
RETURN (self == something ? true : false);
}
if (cls == String) {
- RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? true : false);
+ RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? true : false);
}
%}.
"fall back; could be a TwoByteString, or a collection of Characters"
@@ -292,12 +285,12 @@
if (val == 0) {
cp = __stringVal(self);
l = __stringSize(self);
-
+
/*
- * this is the dragon-book algorithm
+ * this is the dragon-book algorithm
* We have tested 5-bit shifts as well:
*
- * ST/X Symbols: 17807
+ * ST/X Symbols: 17807
* Hashkey collisions (4bit): 14 0.07%
* Hashkey collisions (5bit): 300 1.68%
*/
@@ -350,16 +343,16 @@
].
hashSet := hashColl asSet.
- Transcript showCR:'Symbols: ', hashColl size printString,
+ Transcript showCR:'Symbols: ', hashColl size printString,
' unique hash keys: ', hashSet size printString,
' collisions:', (hashColl size - hashSet size) printString.
"
-
+
!
~= something
"return true, if the receiver and argument do not consist of the same characters.
- Redefined here, for more efficient #~= comparison of symbols
+ Redefined here, for more efficient #~= comparison of symbols
(which ought to be compared using #~~).
If the argument is a symbol, we use a quick pointer compare, instead of
the inherited value compare."
@@ -390,11 +383,11 @@
s = __MKSTRING_ST(self);
if (s != nil) {
- RETURN (s);
+ RETURN (s);
}
%}.
^ (String new:(self size))
- replaceFrom:1 with:self startingAt:1
+ replaceFrom:1 with:self startingAt:1
!
asSymbol
@@ -405,7 +398,7 @@
!
asSymbolIfInterned
- "If a symbol with the receivers characters is already known, return it. Otherwise, return nil.
+ "If a symbol with the receivers characters is already known, return it. Otherwise, return nil.
Since I am a symbol - just return myself"
^ self
@@ -515,9 +508,9 @@
storeString := self storeString.
(self == #true or:[self == #false or:[self == #nil or:[(storeString at:2) == $']]]) ifTrue:[
- aStream nextPutAll:storeString.
+ aStream nextPutAll:storeString.
] ifFalse:[
- aStream nextPutAll:self.
+ aStream nextPutAll:self.
].
!
@@ -530,45 +523,45 @@
storeString
"return a String for storing the receiver"
- |sz "{Class: SmallInteger }"
+ |sz "{Class: SmallInteger }"
c anyColon|
sz := self size.
(sz ~~ 0 and:[(self at:1) isLetter]) ifTrue:[
- anyColon := false.
- 2 to:sz do:[:index |
- c := self at:index.
- c == $: ifTrue:[
- (index == sz or:[(self at:(index+1)) isLetterOrDigit]) ifFalse:[
- ^ '#' , super storeString.
- ].
- anyColon := true.
- ] ifFalse:[
- c isLetterOrDigit ifFalse:[
- ^ '#' , super storeString
- ].
- ].
- ].
- "no colon in symbol or symbol ends with a colon"
- (anyColon and:[c ~~ $:]) ifFalse:[
- ^ '#' , self
- ].
+ anyColon := false.
+ 2 to:sz do:[:index |
+ c := self at:index.
+ c == $: ifTrue:[
+ (index == sz or:[(self at:(index+1)) isLetterOrDigit]) ifFalse:[
+ ^ '#' , super storeString.
+ ].
+ anyColon := true.
+ ] ifFalse:[
+ c isLetterOrDigit ifFalse:[
+ ^ '#' , super storeString
+ ].
+ ].
+ ].
+ "no colon in symbol or symbol ends with a colon"
+ (anyColon and:[c ~~ $:]) ifFalse:[
+ ^ '#' , self
+ ].
].
^ '#' , super storeString
"
- #'abc' storeString
- #'abc:' storeString
- #'abc:def:' storeString
- #'abc:def' storeString
- #'abc::def' storeString
- #'abc &^*' storeString
- #'abcdef::' storeString
- #'hello''world' storeString
- #'' storeString
- #'''' storeString
- #'_hello' storeString
- #'123' storeString
+ #'abc' storeString
+ #'abc:' storeString
+ #'abc:def:' storeString
+ #'abc:def' storeString
+ #'abc::def' storeString
+ #'abc &^*' storeString
+ #'abcdef::' storeString
+ #'hello''world' storeString
+ #'' storeString
+ #'''' storeString
+ #'_hello' storeString
+ #'123' storeString
"
! !
@@ -580,10 +573,10 @@
^ self first isLetterOrDigit not
"
- #at:put: isInfix
- #at: isInfix
- #+ isInfix
- #size isInfix
+ #at:put: isInfix
+ #at: isInfix
+ #+ isInfix
+ #size isInfix
"
"Created: / 1.11.1997 / 12:34:55 / cg"
@@ -596,17 +589,17 @@
^ self includes:$:
"
- #at:put: isKeyword
- #at: isKeyword
- #+ isKeyword
- #size isKeyword
+ #at:put: isKeyword
+ #at: isKeyword
+ #+ isKeyword
+ #size isKeyword
"
"Created: / 1.11.1997 / 12:34:55 / cg"
"Modified: / 1.11.1997 / 12:36:37 / cg"
!
-isSymbol
+isSymbol
"return true, if the receiver is some kind of symbol.
Since I am a symbol, return always true"
@@ -630,10 +623,10 @@
^ coll asArray
"
- #at:put: keywords
- #at: keywords
- #+ keywords
- #size keywords
+ #at:put: keywords
+ #at: keywords
+ #+ keywords
+ #size keywords
"
!
@@ -672,12 +665,12 @@
This can be a very dangerous operation - be warned.
Notice: because of the danger here, this method may report an error
- in future versions"
+ in future versions"
(Smalltalk includesKey:self) ifTrue:[
- self primitiveFailed
+ self primitiveFailed
] ifFalse:[
- super becomeNil
+ super becomeNil
]
! !
@@ -701,5 +694,5 @@
!Symbol class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.87 2009-07-30 08:03:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.88 2009-08-15 06:54:44 sr Exp $'
! !