WeakIdentityDictionary.st
changeset 2910 1a3e44b10f9b
parent 2741 7af858fd7296
child 2988 c6550b3e9b3c
--- a/WeakIdentityDictionary.st	Tue Sep 09 19:26:58 1997 +0200
+++ b/WeakIdentityDictionary.st	Tue Sep 09 19:31:56 1997 +0200
@@ -57,10 +57,10 @@
 
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [See also:]
-        WeakArray WeakValueDictionary WeakIdentitySet
+	WeakArray WeakValueDictionary WeakIdentitySet
 "
 ! !
 
@@ -73,14 +73,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super at:key.
+	"/ already blocked
+	^ super at:key.
     ].
 
     [
-        val := super at:key.
+	val := super at:key.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -95,14 +95,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super at:key ifAbsent:exceptionBlock.
+	"/ already blocked
+	^ super at:key ifAbsent:exceptionBlock.
     ].
 
     [
-        val := super at:key ifAbsent:exceptionBlock.
+	val := super at:key ifAbsent:exceptionBlock.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -119,14 +119,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super at:key put:anObject.
+	"/ already blocked
+	^ super at:key put:anObject.
     ].
 
     [
-        val := super at:key put:anObject.
+	val := super at:key put:anObject.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -136,7 +136,7 @@
 
 removeKey:aKey ifAbsent:aBlock
     "remove the association under aKey from the collection,
-     return the value previously stored there..
+     return the value previously stored there.
      If it was not in the collection return the result 
      from evaluating aBlock.
 
@@ -147,14 +147,14 @@
     |ret|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super removeKey:aKey ifAbsent:aBlock.
+	"/ already blocked
+	^ super removeKey:aKey ifAbsent:aBlock.
     ].
 
     [
-        ret := super removeKey:aKey ifAbsent:aBlock
+	ret := super removeKey:aKey ifAbsent:aBlock
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts
+	OperatingSystem unblockInterrupts
     ].
     ^ ret
 
@@ -169,14 +169,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super saveRemoveKey:key.
+	"/ already blocked
+	^ super saveRemoveKey:key.
     ].
 
     [
-        val := super saveRemoveKey:key.
+	val := super saveRemoveKey:key.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -194,21 +194,21 @@
     |wasBlocked|
 
     something == #ElementExpired ifTrue:[
-        "
-         have to block here - dispose may be done at a low priority
-         from the background finalizer. If new items are added by a 
-         higher prio process, the dictionary might get corrupted otherwise
-        "
-        wasBlocked := OperatingSystem blockInterrupts.
+	"
+	 have to block here - dispose may be done at a low priority
+	 from the background finalizer. If new items are added by a 
+	 higher prio process, the dictionary might get corrupted otherwise
+	"
+	wasBlocked := OperatingSystem blockInterrupts.
 
-        keyArray 
-            forAllDeadIndicesDo:[:idx | 
-                                    valueArray basicAt:idx put:nil.
-                                    tally := tally - 1.
-                                ]
-            replacingCorpsesWith:DeletedEntry.
+	keyArray 
+	    forAllDeadIndicesDo:[:idx | 
+				    valueArray basicAt:idx put:nil.
+				    tally := tally - 1.
+				]
+	    replacingCorpsesWith:DeletedEntry.
 
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ]
 
     "Created: 7.1.1997 / 16:59:30 / stefan"
@@ -223,7 +223,7 @@
      Grow the receiver, if key was not found, and no unused slots were present.
 
      Warning: an empty slot MUST be filled by the sender - it is only to be sent
-              by at:put: / add: - like methods."
+	      by at:put: / add: - like methods."
 
     |index  "{ Class:SmallInteger }"
      length "{ Class:SmallInteger }"
@@ -231,12 +231,12 @@
      delIndex "{ Class:SmallInteger }"|
 
     (OperatingSystem blockInterrupts) ifFalse:[
-        "/
-        "/ may never be entered with interrupts enabled
-        "/
-        OperatingSystem unblockInterrupts.
-        self error:'oops - unblocked call of findKeyOrNil'.
-        ^ nil "/ leads to another error, if proceeded
+	"/
+	"/ may never be entered with interrupts enabled
+	"/
+	OperatingSystem unblockInterrupts.
+	self error:'oops - unblocked call of findKeyOrNil'.
+	^ nil "/ leads to another error, if proceeded
     ].
 
     delIndex := 0.
@@ -244,45 +244,45 @@
     length := keyArray basicSize.
     index := key identityHash.
     index < 16r1FFFFFFF ifTrue:[
-        index := index * 2
+	index := index * 2
     ].
     index := index \\ length + 1.
     startIndex := index.
 
     [true] whileTrue:[
-        probe := keyArray basicAt:index.
-        key == probe ifTrue:[^ index].
-        probe isNil ifTrue:[
-            delIndex == 0 ifTrue:[^ index].
-            keyArray basicAt:delIndex put:nil.
-            ^ delIndex
-        ].
+	probe := keyArray basicAt:index.
+	key == probe ifTrue:[^ index].
+	probe isNil ifTrue:[
+	    delIndex == 0 ifTrue:[^ index].
+	    keyArray basicAt:delIndex put:nil.
+	    ^ delIndex
+	].
 
-        probe == 0 ifTrue:[
-            probe := DeletedEntry.
-            keyArray basicAt:index put:probe.
-            valueArray basicAt:index put:nil.
-            tally := tally - 1.
-        ].
+	probe == 0 ifTrue:[
+	    probe := DeletedEntry.
+	    keyArray basicAt:index put:probe.
+	    valueArray basicAt:index put:nil.
+	    tally := tally - 1.
+	].
 
-        delIndex == 0 ifTrue:[
-            probe == DeletedEntry ifTrue:[
-                delIndex := index
-            ]
-        ].
+	delIndex == 0 ifTrue:[
+	    probe == DeletedEntry ifTrue:[
+		delIndex := index
+	    ]
+	].
 
-        index == length ifTrue:[
-            index := 1
-        ] ifFalse:[
-            index := index + 1
-        ].
-        index == startIndex ifTrue:[
-            delIndex ~~ 0 ifTrue:[
-                keyArray basicAt:delIndex put:nil.
-                ^ delIndex
-            ].
-            ^ self grow findKeyOrNil:key
-        ].
+	index == length ifTrue:[
+	    index := 1
+	] ifFalse:[
+	    index := index + 1
+	].
+	index == startIndex ifTrue:[
+	    delIndex ~~ 0 ifTrue:[
+		keyArray basicAt:delIndex put:nil.
+		^ delIndex
+	    ].
+	    ^ self grow findKeyOrNil:key
+	].
     ]
 
     "Modified: 30.1.1997 / 15:04:34 / cg"
@@ -296,14 +296,14 @@
 "/ 'grow:' printCR.
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super grow:newSize.
+	"/ already blocked
+	^ super grow:newSize.
     ].
 
     [
-        super grow:newSize
+	super grow:newSize
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts
+	OperatingSystem unblockInterrupts
     ].
 
     "Created: 28.1.1997 / 23:41:39 / cg"
@@ -332,14 +332,14 @@
 "/ 'rehash' printCR.
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super rehash.
+	"/ already blocked
+	^ super rehash.
     ].
 
     [
-        super rehash
+	super rehash
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts
+	OperatingSystem unblockInterrupts
     ].
 
     "Created: 29.1.1997 / 11:39:42 / cg"
@@ -354,14 +354,14 @@
 "/ 'setTally:' printCR.
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super setTally:count.
+	"/ already blocked
+	^ super setTally:count.
     ].
 
     [
-        super setTally:count
+	super setTally:count
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts
+	OperatingSystem unblockInterrupts
     ].
 
     "Created: 29.1.1997 / 11:40:12 / cg"
@@ -377,14 +377,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super includes:anObject.
+	"/ already blocked
+	^ super includes:anObject.
     ].
 
     [
-        val := super includes:anObject.
+	val := super includes:anObject.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -400,14 +400,14 @@
     |val|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super includesKey:key.
+	"/ already blocked
+	^ super includesKey:key.
     ].
 
     [
-        val := super includesKey:key.
+	val := super includesKey:key.
     ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts.
+	OperatingSystem unblockInterrupts.
     ].
     ^ val
 
@@ -419,5 +419,5 @@
 !WeakIdentityDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentityDictionary.st,v 1.31 1997-07-01 17:21:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentityDictionary.st,v 1.32 1997-09-09 17:31:56 cg Exp $'
 ! !