Merge jv
authorMerge Script
Fri, 12 Aug 2016 06:44:59 +0200
branchjv
changeset 20244 20922299fd44
parent 20229 b5cdb27022c8 (current diff)
parent 20243 44d5a7ba8756 (diff)
child 20248 34ed3b6c7307
Merge
Array.st
Dictionary.st
ExternalStream.st
IdentityDictionary.st
IdentitySet.st
LinkedList.st
Process.st
Registry.st
Set.st
Stream.st
UserPreferences.st
WeakIdentityDictionary.st
WeakIdentitySet.st
--- a/Array.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Array.st	Fri Aug 12 06:44:59 2016 +0200
@@ -303,7 +303,6 @@
     "Modified: 23.4.1996 / 15:55:06 / cg"
 ! !
 
-
 !Array methodsFor:'accessing'!
 
 at:index
@@ -1611,7 +1610,7 @@
 
 replaceFrom:start to:stop with:aCollection startingAt:repStart
     "replace elements in the receiver between index start and stop,
-     with elements  taken from replacementCollection starting at repStart.
+     with elements taken from replacementCollection starting at repStart.
      Return the receiver.
      Reimplemented for speed if both receiver and aCollection are Arrays"
 
@@ -1731,7 +1730,7 @@
                                 *dst++ = *src++;
                             }
 #endif
-                        } else {    
+                        } else {
                             // not copying into the same object
                             REGISTER int spc = __qSpace(self);
 #ifdef __UNROLL_LOOPS__
@@ -1774,7 +1773,7 @@
     "redefinable helper for displayString"
 
     |cls|
-    
+
     ((cls := self class) == Array or:[cls == ImmutableArray]) ifTrue:[
         ^ '#'
     ].
--- a/Dictionary.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Dictionary.st	Fri Aug 12 06:44:59 2016 +0200
@@ -296,6 +296,7 @@
 ! !
 
 
+
 !Dictionary methodsFor:'accessing'!
 
 associationAt:aKey
@@ -379,24 +380,37 @@
      This is an optimized accessor, which only computes the hash value once."
 
     |k index "{ Class: SmallInteger }"
-     newValue|
+     newValue oldKeyArray oldKey|
 
     (k := aKey) isNil ifTrue:[
         k := NilEntry
     ].
 
-    index := self findKeyOrNil:k.
-    (keyArray basicAt:index) notNil ifTrue:[
-        "/ key present
-        valueArray basicAt:index put:(newValue := aBlock value:(valueArray basicAt:index)).
-        ^ newValue
+    oldKeyArray := keyArray.
+    index := self findKeyOrNilOrDeletedEntry:k.
+    oldKey := keyArray basicAt:index.
+    (oldKey notNil and:[oldKey ~~ DeletedEntry]) ifTrue:[
+        "/ key is present
+        newValue := aBlock value:(valueArray basicAt:index).
+    ] ifFalse:[
+        "/ a new key
+        newValue := aBlock value:default.
     ].
-    "/ a new key
-    keyArray basicAt:index put:k.
-    valueArray basicAt:index put:(newValue := aBlock value:default).
-    tally := tally + 1.
-
-    self possiblyGrow.
+    (keyArray ~~ oldKeyArray or:[(keyArray basicAt:index) ~~ oldKey]) ifTrue:[
+        "I have been changed while performing aBlock.
+         have to find the key again."
+        index := self findKeyOrNil:k.
+    ].
+
+    valueArray basicAt:index put:newValue.
+    oldKey := keyArray basicAt:index.
+    (oldKey isNil or:[oldKey == DeletedEntry]) ifTrue:[
+        "key is not or no longer present"
+        keyArray basicAt:index put:k.
+        tally := tally + 1.
+        self possiblyGrow.
+    ].
+
     ^ newValue
 
     "
@@ -406,8 +420,27 @@
      d at:'one'  ifAbsent:0 update:[:val | val + 1].
      d at:'two'  ifAbsent:0 update:[:val | val + 1].
      d at:'three' ifAbsent:0  update:[:val | val + 1].
-     d at:'one' ifAbsent:0  update:[:val | val + 1].
      d at:'two' ifAbsent:0  update:[:val | val + 1].
+     d at:'three' ifAbsent:0  update:[:val | val + 1].
+     d at:'three' ifAbsent:0  update:[:val | val + 1].
+     d
+    "
+
+    "
+     |d|
+
+     d := Dictionary new.
+     d at:'two'  ifAbsent:0 update:[:val | val + 1].
+     d at:'two'  ifAbsent:0 update:[:val | 1 to:30 do:[:idx| d at:idx printString put:idx]. val + 1].
+     d
+    "
+
+    "
+     |d|
+
+     d := Dictionary new.
+     d at:'two'  ifAbsent:0 update:[:val | val + 1].
+     d at:'two'  ifAbsent:0 update:[:val | d removeKey:'two'. val + 1].
      d
     "
 !
@@ -420,29 +453,31 @@
               Iterate over a copy to do this."
 
     |index "{ Class: SmallInteger }"
-     k newValue oldKeyArray|
+     k newValue oldKeyArray probeKey|
 
     (k := aKey) isNil ifTrue:[
         k := NilEntry
     ].
 
-    index := self findKeyOrNil:k.
-    (keyArray basicAt:index) notNil ifTrue:[
+    index := self findKeyOrNilOrDeletedEntry:k.
+    probeKey := keyArray basicAt:index.
+    (probeKey notNil and:[probeKey ~~ DeletedEntry]) ifTrue:[
         "/ key is already present
         ^ valueArray at:index.
     ].
+
     "/ a new key
     oldKeyArray := keyArray.
-
     newValue := valueBlock value.
-
-    (keyArray ~~ oldKeyArray or:[(keyArray basicAt:index) notNil]) ifTrue:[
+    (keyArray ~~ oldKeyArray or:[(keyArray basicAt:index) ~~ probeKey]) ifTrue:[
         "I have been changed while performing the valueBlock.
          have to find the key again."
         index := self findKeyOrNil:k.
         (keyArray basicAt:index) notNil ifTrue:[
-            "/ key is now present
-            ^ valueArray at:index.
+            "/ key was not, but is now present.
+            "/ since we executed the valueBlock, overwrite the value in the Dictionary
+            valueArray at:index put:newValue.
+            ^ newValue
         ].
     ].
     "/ a new key...
@@ -463,6 +498,23 @@
      Transcript showCR:(d at:'foo2' ifAbsentPut:'bar2X').
     "
 
+    "
+     |d|
+
+     d := Dictionary new.
+     d at:'one' ifAbsentPut:[d at:'one' put:1. 33333].
+     d
+    "
+
+    "
+     |d|
+
+     d := Dictionary new.
+     d at:'two'  ifAbsentPut:[1 to:30 do:[:idx| d at:idx printString put:idx]. 2].
+     d
+    "
+
+
     "Created: / 23.1.1998 / 18:28:26 / cg"
     "Modified: / 26.2.1998 / 19:10:09 / stefan"
 !
@@ -500,17 +552,13 @@
     ].
 
     index := self findKeyOrNil:k.
-    (keyArray basicAt:index) notNil ifTrue:[
-        "/ key already present
-        valueArray basicAt:index put:anObject.
-        ^ anObject
+    valueArray basicAt:index put:anObject.
+    (keyArray basicAt:index) isNil ifTrue:[
+        "/ a new key
+        keyArray basicAt:index put:k.
+        tally := tally + 1.
+        self possiblyGrow.
     ].
-    "/ a new key
-    keyArray basicAt:index put:k.
-    valueArray basicAt:index put:anObject.
-    tally := tally + 1.
-
-    self possiblyGrow.
     ^ anObject
 
     "Modified: 30.1.1997 / 14:59:10 / cg"
@@ -560,20 +608,34 @@
      This is an optimized accessor, which only computes the hash value once."
 
     |k index "{ Class: SmallInteger }"
-     newValue|
+     newValue oldKey oldKeyArray|
 
     (k := aKey) isNil ifTrue:[
         k := NilEntry
     ].
 
-    index := self findKeyOrNil:k.
-    (keyArray basicAt:index) notNil ifTrue:[
-        "/ key present
-        valueArray basicAt:index put:(newValue := aBlock value:(valueArray basicAt:index)).
-        ^ newValue
+    index := self find:k ifAbsent:0.
+    index == 0 ifTrue:[
+        "/ a new key
+        ^ self errorKeyNotFound:k.
     ].
-    "/ a new key
-    ^ self errorKeyNotFound:k.
+
+    "/ key present
+    oldKey := keyArray basicAt:index.
+    oldKeyArray := keyArray.
+    newValue := aBlock value:(valueArray basicAt:index).
+    (keyArray ~~ oldKeyArray or:[(keyArray basicAt:index) ~~ oldKey]) ifTrue:[
+        "I have been changed while performing aBlock.
+         have to find the key again."
+        index := self find:k ifAbsent:0.
+        index == 0 ifTrue:[
+            "/ the key is gone while performing the block.
+            ^ self errorKeyNotFound:k.
+        ].
+    ].
+
+    valueArray basicAt:index put:newValue.
+    ^ newValue
 
     "
      |d|
@@ -584,6 +646,14 @@
 
     "
      |d|
+
+     d := Dictionary new.
+     d at:'one' put:0.
+     d at:'one'  update:[:val | d removeKey:'one'. val + 1].
+    "
+
+    "
+     |d|
      d := Dictionary new.
      d at:'one' put:0.
      d at:'two' put:0.
@@ -592,8 +662,9 @@
      d at:'one'    update:[:val | val + 1].
      d at:'two'    update:[:val | val + 1].
      d at:'three'  update:[:val | val + 1].
-     d at:'one'    update:[:val | val + 1].
      d at:'two'    update:[:val | val + 1].
+     d at:'three'  update:[:val | val + 1].
+     d at:'three'  update:[:val | val + 1].
      d
     "
 !
--- a/ExternalStream.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/ExternalStream.st	Fri Aug 12 06:44:59 2016 +0200
@@ -5528,7 +5528,7 @@
      '/dev/null' asFilename readStream upToEnd
      '/proc/self/stat' asFilename readStream upToEnd
 
-     self assert:('smalltalk.rc' asFilename readStream upToEnd size) 
+     self assert:('smalltalk.rc' asFilename readStream upToEnd size)
                   =  ('smalltalk.rc' asFilename readStream size)
     "
 ! !
@@ -5739,8 +5739,8 @@
 !
 
 numAvailableForRead
-    "answer the nuber of bytes available for reading"
-    
+    "answer the number of bytes available for reading"
+
     |available|
 
     handle isNil ifTrue:[
--- a/IdentityDictionary.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/IdentityDictionary.st	Fri Aug 12 06:44:59 2016 +0200
@@ -110,6 +110,12 @@
     ] loop.
 !
 
+findIdentical:key ifAbsent:aBlock
+    "IdentityDictionary does identity compare anyway..."
+
+    ^ self find:key ifAbsent:aBlock
+!
+
 findKeyOrNil:key
     "Look for the key in the receiver.  
      If it is found, return the index of the first unused slot. 
@@ -160,6 +166,51 @@
     "Modified: 26.3.1996 / 20:00:44 / cg"
 !
 
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.  
+     If it is found, return the index of the first unused slot. 
+     Grow the receiver, if key was not found, and no unused slots were present."
+
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe 
+     delIndex "{ Class:SmallInteger }"|
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey:key.
+
+    [
+        probe := keyArray basicAt:index.
+        key == probe ifTrue:[^ index].              "<--- == is different from inherited"   
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+
+        (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
+            delIndex := index
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: 26.3.1996 / 20:00:44 / cg"
+!
+
 hashFor:aKey
     "return an initial index given a key."
 
@@ -198,5 +249,9 @@
 
 version
     ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
 ! !
 
--- a/IdentitySet.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/IdentitySet.st	Fri Aug 12 06:44:59 2016 +0200
@@ -217,7 +217,56 @@
                 keyArray basicAt:delIndex put:nil.
                 ^ delIndex
             ].
-            ^ self grow findKeyOrNil:key
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: 26.3.1996 / 20:00:42 / cg"
+!
+
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.  
+     If it is found, return return the index of the first unused slot. 
+     Grow the receiver, if key was not found, and no unused slots were present"
+
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe 
+     delIndex "{ Class:SmallInteger }"|
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey:key.
+
+    [
+        probe := keyArray basicAt:index.
+        key == probe ifTrue:[^ index].
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+
+        probe == DeletedEntry ifTrue:[
+            delIndex == 0 ifTrue:[
+                delIndex := index
+            ]
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
         ].
     ] loop.
 
--- a/LinkedList.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/LinkedList.st	Fri Aug 12 06:44:59 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -182,6 +180,17 @@
 
     theLink := self linkAt:index ifAbsent:[^ exceptionValue value].
     ^ theLink value
+
+    "
+     |l|
+
+     l := LinkedList new.
+     l add:'one'.
+     l add:'two'.
+     l add:'hello'.
+     l at:3 ifAbsent:'missing'.
+     l at:4 ifAbsent:'missing'.
+    "
 !
 
 first
@@ -230,7 +239,7 @@
      since it is slow to walk through the list - think about using
      another collection if you need indexed access.
      Notice:
-        that many methods in SeqColl are based on at:-access,
+        that many methods in the superclass, SequenceableCollection are based on at:-access,
         so other inherited methods may be very slow (showing O^2 runtime).
         It is a very bad idea to access LinkedList elements by index.
         many algorithms degenerate to poor performance if you do.
@@ -238,14 +247,17 @@
         but please consider using another type of collection if you use it"
 
     |theLink
-     runIndex "{Class: SmallInteger}"|
+     count "{Class: SmallInteger}"|
+
+    count := index.
+    (count < 1 or:[count > numberOfNodes]) ifTrue:[
+        ^ exceptionBlock value.
+    ].
 
     theLink := firstLink.
-    runIndex := 1.
-    [runIndex == index] whileFalse:[
+    count-1 timesRepeat:[
         theLink isNil ifTrue:[^ exceptionBlock value].
         theLink := theLink nextLink.
-        runIndex := runIndex + 1.
     ].
     ^ theLink
 ! !
@@ -438,6 +450,7 @@
 
     |thisNode|
 
+    "aBlock may add elements, so do not use 'numberOfNodes-1 timesRepeat:[]'"
     thisNode := firstLink.
     [thisNode notNil] whileTrue:[
         aBlock value:thisNode value.
@@ -450,6 +463,7 @@
 
     |thisNode|
 
+    "aBlock may add elements, so do not use 'numberOfNodes-1 timesRepeat:[]'"
     thisNode := firstLink.
     [thisNode notNil] whileTrue:[
         aBlock value:thisNode.
@@ -492,21 +506,26 @@
         but please consider using another type of collection if you use it.
      "
 
-    |theNode idx "{ Class: SmallInteger }"
+    |theNode count "{ Class: SmallInteger }"
      linkOrValue|
 
+    count := start.
+    (count < 1 or:[count > numberOfNodes]) ifTrue:[
+        ^ 0.
+    ].
+
+    theNode := firstLink.
+    count-1 timesRepeat:[
+        theNode isNil ifTrue:[^ 0].     "reached the end"
+        theNode := theNode nextLink.
+    ].
+
     linkOrValue := aLinkOrValue value.
-    theNode := firstLink.
-    idx := 1.
-    [idx < start] whileTrue:[
-        theNode isNil ifTrue:[^ 0].     "reached the end"
+
+    [theNode notNil] whileTrue:[
+        (linkOrValue = theNode value) ifTrue:[^ count].
         theNode := theNode nextLink.
-        idx := idx + 1.
-    ].
-    [theNode notNil] whileTrue:[
-        (linkOrValue = theNode value) ifTrue:[^ idx].
-        theNode := theNode nextLink.
-        idx := idx + 1.
+        count := count + 1.
     ].                                  "reached the end"
     ^ 0
 
@@ -514,7 +533,7 @@
      |l|
 
      l := LinkedList new.
-     l indexOf:'hello'
+     l indexOf:'hello' startingAt:1
     "
 
     "
@@ -524,7 +543,7 @@
      l add:(ValueLink new value:'one').
      l add:(ValueLink new value:'two').
      l add:(v := ValueLink new value:'hello').
-     l indexOf:v
+     l indexOf:v startingAt:2.
     "
 ! !
 
@@ -542,21 +561,26 @@
         but please consider using another type of collection if you use it.
      "
 
-    |theNode idx "{ Class: SmallInteger }"
+    |theNode count "{ Class: SmallInteger }"
      linkOrValue|
 
+    count := start.
+    (count < 1 or:[count > numberOfNodes]) ifTrue:[
+        ^ 0.
+    ].
+
+    theNode := firstLink.
+    count-1 timesRepeat:[
+        theNode isNil ifTrue:[^ 0].     "reached the end"
+        theNode := theNode nextLink.
+    ].
+
     linkOrValue := aLinkOrValue value.
-    theNode := firstLink.
-    idx := 1.
-    [idx < start] whileTrue:[
-        theNode isNil ifTrue:[^ 0].     "reached the end"
+
+    [theNode notNil] whileTrue:[
+        (linkOrValue == theNode value) ifTrue:[^ count].
         theNode := theNode nextLink.
-        idx := idx + 1.
-    ].
-    [theNode notNil] whileTrue:[
-        (linkOrValue == theNode value) ifTrue:[^ idx].
-        theNode := theNode nextLink.
-        idx := idx + 1.
+        count := count + 1.
     ].                                  "reached the end"
     ^ 0
 
@@ -564,7 +588,7 @@
      |l|
 
      l := LinkedList new.
-     l indexOf:'hello'
+     l identityIndexOf:'hello' startingAt:1
     "
 
     "
@@ -574,7 +598,7 @@
      l add:(ValueLink new value:'one').
      l add:(ValueLink new value:'two').
      l add:(v := ValueLink new value:'hello').
-     l indexOf:v
+     l identityIndexOf:v startingAt:2.
     "
 ! !
 
--- a/Process.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Process.st	Fri Aug 12 06:44:59 2016 +0200
@@ -58,7 +58,7 @@
     threads - it may, but the actual implementation depends on the underlying
     OS'S features. However, even if implemented as native thread, the ST/X
     kernel makes certain, that only one thread executes at a time (with certain,
-    well-defined exceptions). The reason is that the reqiored locking in the
+    well-defined exceptions). The reason is that the required locking in the
     runtime system would make things slower in most cases.
 
     Processes are typically created by sending #fork or #forkAt: to a block;
--- a/Registry.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Registry.st	Fri Aug 12 06:44:59 2016 +0200
@@ -225,6 +225,63 @@
 
     "Modified: 30.1.1997 / 15:04:34 / cg"
     "Modified: 1.10.1997 / 11:25:32 / stefan"
+!
+
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.
+     If it is found, return the index,
+     otherwise the index of the first unused slot.
+     Grow the receiver, if key was not found, and no unused slots were present. 
+
+     Redefined to not nil values of expired keys here."
+
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe
+     delIndex "{ Class:SmallInteger }"|
+
+    (OperatingSystem blockInterrupts) ifFalse:[
+        "/
+        "/ may never be entered with interrupts enabled
+        "/
+        OperatingSystem unblockInterrupts.
+        self error:'unblocked call of findKeyOrNil'.
+    ].
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey:key.
+
+    [
+        probe := keyArray basicAt:index.
+        key == probe ifTrue:[^ index].
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+
+        (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
+            delIndex := index
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: 30.1.1997 / 15:04:34 / cg"
+    "Modified: 1.10.1997 / 11:25:32 / stefan"
 ! !
 
 !Registry methodsFor:'registering objects'!
--- a/Set.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Set.st	Fri Aug 12 06:44:59 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
@@ -202,7 +200,6 @@
     "Created: / 24.10.1997 / 23:13:44 / cg"
 ! !
 
-
 !Set methodsFor:'Compatibility-ST80'!
 
 initialIndexFor:hashKey boundedBy:length
@@ -816,6 +813,7 @@
 ! !
 
 
+
 !Set methodsFor:'obsolete set operations'!
 
 + aCollection
@@ -935,6 +933,59 @@
     "Modified: / 27-02-2011 / 15:30:42 / cg"
 !
 
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.  
+     If it is found, return the index of the first unused slot. 
+     Grow the receiver, if key was not found, and no unused slots were present.
+     The answer is the index into the keyArray where the (keyArray at:index)
+     may contain:
+        nil             -   an empty slot
+        DeletedEntry    -   an empty slot, but preceeded and followed by non-empty
+                            slots with keys hashing to the same value (hash collisions)
+        key             -   key is laready present in the slot."
+
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe 
+     delIndex "{ Class:SmallInteger }"|
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey:key.
+
+    [
+        probe := keyArray basicAt:index.
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+        probe == DeletedEntry ifTrue:[
+            delIndex == 0 ifTrue:[
+                delIndex := index
+            ]
+        ] ifFalse:[
+            key = probe ifTrue:[^ index]
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: / 27-02-2011 / 15:30:42 / cg"
+!
+
 findNil:key
     "Look for the next slot usable for key.  
      WARNING:
--- a/Stream.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/Stream.st	Fri Aug 12 06:44:59 2016 +0200
@@ -237,8 +237,8 @@
 !
 
 signalAtEnd
-    "return the signalAtEnd flag setting. 
-     If true, reading past the end will always raise an EndOfStream exception. 
+    "return the signalAtEnd flag setting.
+     If true, reading past the end will always raise an EndOfStream exception.
      If false, no exception is raised and nil is returned from all reading messages.
      If nil (default), the exception is raised if there is a handler; otherwise, nil is returned.
      The default is nil (for ST80 compatibility) i.e. to only raise a signal if there is a handler."
@@ -317,7 +317,7 @@
 
 asLineNumberReadStream
     "returns a new stream, which keeps track of the line number.
-     It can be asked for the current linenumber, 
+     It can be asked for the current linenumber,
      which is useful eg. for error message generation"
 
     ^ LineNumberReadStream on:self
@@ -367,7 +367,7 @@
     "Created: 14.5.1996 / 17:38:07 / cg"
 !
 
-italic 
+italic
     "set emphasis to #italic.
      this allows Streams to be used interchangeable with printStreams"
 
@@ -459,7 +459,7 @@
     "
 
     "
-     Filename readingFile:'/etc/hosts' 
+     Filename readingFile:'/etc/hosts'
      do:[:s |
          s linesDo:[:line | Transcript showCR:line].
      ].
@@ -506,9 +506,9 @@
 
 pastEndRead
     "someone tried to read after the end of the stream.
-     If signalAtEnd == true, raise a signal. 
+     If signalAtEnd == true, raise a signal.
      If it is false, return nil.
-     Otherwise raise a notification, which is ignored if not handled; 
+     Otherwise raise a notification, which is ignored if not handled;
      otherwise return nil."
 
     |shouldSignalAtEnd|
@@ -592,7 +592,7 @@
     "switch to binary mode. In binary mode, reading of text streams
      returns byte-valued integers instead of characters; writing expects
      byte-valued integers respectively.
-     Ignored here, but added to make internalStreams protocol compatible 
+     Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 
     "Modified: 15.5.1996 / 17:38:36 / cg"
@@ -606,29 +606,29 @@
 !
 
 eolMode
-    "Dummy here, but added to make internalStreams protocol compatible 
+    "Dummy here, but added to make internalStreams protocol compatible
      with externalStreams."
 
      ^ nil  "/ transparent
 !
 
 eolMode:aSymbol
-    "Ignored here, but added to make internalStreams protocol compatible 
+    "Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 !
 
 lineEndCRLF
-    "Ignored here, but added to make internalStreams protocol compatible 
+    "Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 !
 
 lineEndLF
-    "Ignored here, but added to make internalStreams protocol compatible 
+    "Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 !
 
 lineEndTransparent
-    "Ignored here, but added to make internalStreams protocol compatible 
+    "Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 !
 
@@ -639,8 +639,8 @@
 !
 
 text
-    "switch to text mode. 
-     Ignored here, but added to make internalStreams protocol compatible 
+    "switch to text mode.
+     Ignored here, but added to make internalStreams protocol compatible
      with externalStreams."
 
     "Modified: 15.5.1996 / 17:38:36 / cg"
@@ -691,9 +691,9 @@
             [
                 |count|
 
-                count := aWriteStream 
+                count := aWriteStream
                             nextPutAll:readCount-writeCount
-                            from:buffer 
+                            from:buffer
                             startingAt:writeCount+1.
                 writeCount := writeCount + count.
                 writeCount < readCount ifTrue:[
@@ -704,7 +704,7 @@
                 ].
             ] whileTrue.
             countWritten := countWritten + writeCount.
-        ]. 
+        ].
         "Note: atEnd will block if reading from an empty pipe or socket.
          avoid atEnd if possible, because it reads a single byte."
         bytesLeft ~~ 0 or:[self atEnd not]
@@ -742,8 +742,8 @@
 "/    retVal := self copyToEndInto:outStream bufferSize:(64*1024).
 "/].
 "/
-"/Transcript showCR:('%1 KB copied in %2s (%3 KB/s)' 
-"/        bindWith:((retVal/1024)asFixedPoint:2) 
+"/Transcript showCR:('%1 KB copied in %2s (%3 KB/s)'
+"/        bindWith:((retVal/1024)asFixedPoint:2)
 "/        with:((t/1000)asFixedPoint:2)
 "/        with:((retVal/1024/(t/1000))asFixedPoint:2)).
 "/^ retVal.
@@ -780,9 +780,9 @@
             [
                 |count|
 
-                count := outStream 
+                count := outStream
                             nextPutAll:readCount-writeCount
-                            from:buffer 
+                            from:buffer
                             startingAt:writeCount+1.
                 writeCount := writeCount + count.
                 writeCount < readCount ifTrue:[
@@ -793,7 +793,7 @@
                 ].
             ] whileTrue.
             countWritten := countWritten + writeCount.
-        ]. 
+        ].
         "Note: atEnd will block if reading from an empty pipe or socket.
          avoid atEnd if possible, because it reads a single byte."
         readCount ~~ 0 or:[self atEnd not]
@@ -855,13 +855,13 @@
      If the receiver is some socket/pipe-like stream, an exception
      is raised if the connection is broken.
 
-     The object must have non-pointer indexed instvars (i.e. it must be 
+     The object must have non-pointer indexed instvars (i.e. it must be
      a ByteArray, String, Float- or DoubleArray).
      If anObject is a string or byteArray and reused, this provides the
      fastest possible physical I/O (since no new objects are allocated).
 
      Use with care - non object oriented i/o.
-     Warning: in general, you cannot use this method to pass data from other 
+     Warning: in general, you cannot use this method to pass data from other
      architectures since it does not care for byte order or float representation."
 
     ^ self nextBytes:count into:anObject startingAt:1
@@ -948,19 +948,19 @@
      If the receiver is some socket/pipe-like stream, an exception
      is raised if the connection is broken.
 
-     The object to read into must have non-pointer indexed instvars 
-     (i.e. it must be a ByteArray, String, Float- or DoubleArray).     
+     The object to read into must have non-pointer indexed instvars
+     (i.e. it must be a ByteArray, String, Float- or DoubleArray).
      If anObject is a string or byteArray and reused, this provides the
      fastest possible physical I/O (since no new objects are allocated).
 
      Use with care - non object oriented i/o.
-     Warning: in general, you cannot use this method to pass data from other 
+     Warning: in general, you cannot use this method to pass data from other
      architectures since it does not care for byte order or float representation."
 
     ^ self nextBytes:(anObject byteSize) into:anObject startingAt:1
 
     " to read 100 bytes from a stream:
-    
+
      |b aStream|
 
      aStream := 'smalltalk.rc' asFilename readStream.
@@ -1035,7 +1035,7 @@
     ].
     "change from unsigned 0..FFFF to signed -8000..7FFF"
     uval >= 16r8000 ifTrue:[
-        ^ uval - 16r10000 
+        ^ uval - 16r10000
     ].
     ^ uval
 
@@ -1059,7 +1059,7 @@
     uval := self nextUnsignedInt24MSB:msbFlag.
     "change from unsigned 0..FFFFFF to signed -800000..7FFFFF"
     uval >= 16r800000 ifTrue:[
-        ^ uval - 16r1000000 
+        ^ uval - 16r1000000
     ].
     ^ uval
 
@@ -1105,7 +1105,7 @@
     "change from unsigned 0..FFFFFFFF to signed -80000000..7FFFFFFF"
 
     val >= 16r80000000 ifTrue:[
-      ^ val - 16r100000000 
+      ^ val - 16r100000000
     ].
     ^ val
 
@@ -1152,7 +1152,7 @@
     "change from unsigned 0..FF..FF to signed -80..00..7FF..FF"
 
     uval >= 16r8000000000000000 ifTrue:[
-      ^ uval - 16r10000000000000000 
+      ^ uval - 16r10000000000000000
     ].
     ^ uval
 
@@ -1196,7 +1196,7 @@
     uval := self nextByte.
     "change from unsigned 0..FF to signed -80..7F"
     uval >= 16r80 ifTrue:[
-        ^ uval - 16r100 
+        ^ uval - 16r100
     ].
     ^ uval
 
@@ -1207,7 +1207,7 @@
 
 nextString:count
     "read the next count bytes and return it as a string.
-     If EOF is encountered while reading, a truncated string is returned. 
+     If EOF is encountered while reading, a truncated string is returned.
      If EOF is already reached before the first byte can be read,
      an error is raised."
 
@@ -1259,7 +1259,7 @@
     "/ bytes
     bytes := self nextBytes:numBytes.
     ^ (LargeInteger digitBytes:bytes MSB:msbFlag) compressed
-    
+
 "/    val := 0.
 "/    msbFlag ifTrue:[
 "/        numBytes timesRepeat:[
@@ -1278,14 +1278,14 @@
      |s|
 
      s := #[ 16r01 16r02 16r03 16r04 16r05 ] readStream.
-     (s nextUnsigned:3 MSB:true) hexPrintString.           
+     (s nextUnsigned:3 MSB:true) hexPrintString.
      s := #[ 16r01 16r02 16r03 16r04 16r05 16r06 16r07 16r08 16r09 ] readStream.
-     (s nextUnsigned:9 MSB:true) hexPrintString.           
+     (s nextUnsigned:9 MSB:true) hexPrintString.
 
      s := #[ 16r01 16r02 16r03 16r04 16r05 ] readStream.
-     (s nextUnsigned:3 MSB:false) hexPrintString.      
+     (s nextUnsigned:3 MSB:false) hexPrintString.
      s := #[ 16r01 16r02 16r03 16r04 16r05 16r06 16r07 16r08 16r09 ] readStream.
-     (s nextUnsigned:9 MSB:false) hexPrintString.      
+     (s nextUnsigned:9 MSB:false) hexPrintString.
     "
 !
 
@@ -1352,7 +1352,7 @@
         bH := b3.
         bM := b2.
         bL := b1.
-    ].    
+    ].
     ^ (((bH bitShift:8) bitOr:bM) bitShift:8) bitOr:bL
 
     "
@@ -1530,8 +1530,8 @@
     ^ self nextInt64MSB:true
 !
 
-nextNumber:numBytes 
-    "Return the next n bytes as a positive Integer; 
+nextNumber:numBytes
+    "Return the next n bytes as a positive Integer;
      bytes are taken msb-first."
 
     ^ self nextUnsigned:numBytes MSB:true
@@ -1868,9 +1868,9 @@
     "
 !
 
-nextNumber:n put:v 
+nextNumber:n put:v
     "Append to the receiver the argument, v, which is a positive Integer,
-     as the next n bytes. Bytes are written msb first. 
+     as the next n bytes. Bytes are written msb first.
      Possibly pad with leading zeros.
      The receiver must support writing of binary bytes."
 
@@ -1879,8 +1879,8 @@
 
 nextNumber:n put:v MSB:msb
     "Append to the receiver the argument, v, which is a positive Integer,
-     as the next n bytes. 
-     Bytes are written in the specified byte order. 
+     as the next n bytes.
+     Bytes are written in the specified byte order.
      Possibly pad with leading zeros (trailing zeros, if lsb).
      The receiver must support writing of binary bytes."
 
@@ -1904,9 +1904,9 @@
                 bh := (v bitShift:-8) bitAnd:16rFF.
                 msb ifTrue:[
                     self nextPutByte:bh; nextPutByte:bl.
-                ] ifFalse:[    
+                ] ifFalse:[
                     self nextPutByte:bl; nextPutByte:bh.
-                ].    
+                ].
                 ^ self
             ].
         ].
@@ -1923,7 +1923,7 @@
                     self nextPutByte:bl.
                     self nextPutByte:bm.
                     self nextPutByte:bh.
-                ].    
+                ].
                 ^ self
             ].
         ].
@@ -1963,7 +1963,7 @@
         "pad with leading zeros"
         i := n.
         [i > vlen] whileTrue:[
-            self nextPutByte:0. 
+            self nextPutByte:0.
             i := i - 1
         ].
 
@@ -1972,18 +1972,18 @@
         ].
 
         [i > 0] whileTrue:[
-            self nextPutByte:(v digitAt:i). 
+            self nextPutByte:(v digitAt:i).
             i := i - 1
         ]
     ] ifFalse:[
         1 to:vlen do:[:i |
             self nextPutByte:(v digitAt:i).
-        ].    
+        ].
         "pad with trailing zeros"
         vlen+1 to:n do:[:i |
-            self nextPutByte:0. 
+            self nextPutByte:0.
         ].
-    ].    
+    ].
 
     "Modified: / 22-06-2006 / 11:31:13 / fm"
 !
@@ -2034,7 +2034,7 @@
 !
 
 nextPutByte:aByteValue
-    "write a byte. 
+    "write a byte.
      Same as nextPut: here; for protocol compatibility with externalStream."
 
     self nextPut:aByteValue
@@ -2047,10 +2047,10 @@
     "write bytes from an object; the number of bytes is defined by
      the object's size.
      Return the number of bytes written or nil on error.
-     The object must have non-pointer indexed instvars 
-     (i.e. be a ByteArray, String, Float- or DoubleArray).     
+     The object must have non-pointer indexed instvars
+     (i.e. be a ByteArray, String, Float- or DoubleArray).
      Use with care - non object oriented i/o.
-     Warning: in general, you cannot use this method to pass non-byte data to other 
+     Warning: in general, you cannot use this method to pass non-byte data to other
      architectures since it does not care for byte order or float representation."
 
     ^ self nextPutBytes:(anObject size) from:anObject startingAt:1
@@ -2061,10 +2061,10 @@
 nextPutBytes:count from:anObject
     "write count bytes from an object.
      Return the number of bytes written or nil on error.
-     The object must have non-pointer indexed instvars 
-     (i.e. be a ByteArray, String, Float- or DoubleArray).     
+     The object must have non-pointer indexed instvars
+     (i.e. be a ByteArray, String, Float- or DoubleArray).
      Use with care - non object oriented i/o.
-     Warning: in general, you cannot use this method to pass non-byte data to other 
+     Warning: in general, you cannot use this method to pass non-byte data to other
      architectures since it does not care for byte order or float representation."
 
     ^ self nextPutBytes:count from:anObject startingAt:1
@@ -2139,9 +2139,9 @@
 !
 
 nextPutInt16:anIntegerOrCharacter MSB:msbFlag
-    "Write the argument, anIntegerOrCharacter as a short (two bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, anIntegerOrCharacter as a short (two bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2173,7 +2173,7 @@
 
      s := #[] writeStream.
      s nextPutInt16:16r1234 MSB:false.
-     s contents.  
+     s contents.
     "
     "
      |s|
@@ -2214,9 +2214,9 @@
 !
 
 nextPutInt32:aNumber MSB:msbFlag
-    "Write the argument, aNumber as a long (four bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, aNumber as a long (four bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2257,7 +2257,7 @@
      s nextPutInt32:16r12345678 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextInt32MSB:false) hexPrintString.   
+     (s nextInt32MSB:false) hexPrintString.
     "
     "
      |s bytes|
@@ -2266,7 +2266,7 @@
      s nextPutInt32:16r12345678 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextInt32MSB:true) hexPrintString.   
+     (s nextInt32MSB:true) hexPrintString.
 .
     "
     "
@@ -2276,7 +2276,7 @@
      s nextPutInt32:16r-80000000 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextInt32MSB:true) hexPrintString.   
+     (s nextInt32MSB:true) hexPrintString.
     "
     "
      |s bytes|
@@ -2285,7 +2285,7 @@
      s nextPutInt32:16r-80000000 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextInt32MSB:false) hexPrintString.   
+     (s nextInt32MSB:false) hexPrintString.
     "
 
     "Modified: / 01-11-1997 / 18:30:52 / cg"
@@ -2318,9 +2318,9 @@
 !
 
 nextPutInt64:aNumber MSB:msbFlag
-    "Write the argument, aNumber as a longlong (8 bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, aNumber as a longlong (8 bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2347,7 +2347,7 @@
      s nextPutInt64:16r123456789abcdef0 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextUInt64MSB:false) hexPrintString.   
+     (s nextUInt64MSB:false) hexPrintString.
     "
     "
      |s bytes|
@@ -2356,7 +2356,7 @@
      s nextPutInt64:16r123456789abcdef0 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextUInt64MSB:true) hexPrintString.   
+     (s nextUInt64MSB:true) hexPrintString.
     "
     "
      |s bytes|
@@ -2365,7 +2365,7 @@
      s nextPutInt64:16r-8000000000000000 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextUInt64MSB:true) hexPrintString.    
+     (s nextUInt64MSB:true) hexPrintString.
     "
     "
      |s bytes|
@@ -2374,7 +2374,7 @@
      s nextPutInt64:16r-8000000000000000 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextUInt64MSB:false) hexPrintString.   
+     (s nextUInt64MSB:false) hexPrintString.
     "
 
     "Modified: / 01-11-1997 / 18:30:52 / cg"
@@ -2440,16 +2440,16 @@
     "
 !
 
-nextPutUtf16Bytes:aCharacter MSB:msb 
+nextPutUtf16Bytes:aCharacter MSB:msb
     "append my UTF-16 representation to the argument, aStream.
      UTF-16 can encode only characters with code points between 0 to 16r10FFFF.
      The underlying stream must support writing of bytes."
-    
+
     |codePoint|
 
     codePoint := aCharacter codePoint.
-    (codePoint <= 16rD7FF 
-        or:[ codePoint >= 16rE000 and:[ codePoint <= 16rFFFF ] ]) 
+    (codePoint <= 16rD7FF
+        or:[ codePoint >= 16rE000 and:[ codePoint <= 16rFFFF ] ])
             ifTrue:[ self nextPutInt16:codePoint MSB:msb. ]
             ifFalse:[
                 codePoint <= 16r10FFFF ifTrue:[
@@ -2538,7 +2538,7 @@
     EncodingError raiseWith:aCharacter errorString:'codePoint > 31bit in #nextPutUtf8:'.
 
     "
-      (String streamContents:[:s| 
+      (String streamContents:[:s|
             s nextPutUtf8:$a.
             s nextPutUtf8:$ü.
             s nextPutUtf8: (Character value:16r1fff).
@@ -2547,7 +2547,7 @@
             s nextPutUtf8: (Character value:16r800).
       ])
             asByteArray
-            
+
     "
 ! !
 
@@ -2555,9 +2555,9 @@
 
 nextPutHyper:aNumber MSB:msbFlag
     <resource: #obsolete>
-    "Write the argument, aNumber as a hyper (8 bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, aNumber as a hyper (8 bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2576,7 +2576,7 @@
      s nextPutHyper:16r123456789abcdef0 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextHyperMSB:false) hexPrintString.   
+     (s nextHyperMSB:false) hexPrintString.
     "
     "
      |s bytes|
@@ -2585,7 +2585,7 @@
      s nextPutHyper:16r123456789abcdef0 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextHyperMSB:true) hexPrintString.   
+     (s nextHyperMSB:true) hexPrintString.
 .
     "
     "
@@ -2595,7 +2595,7 @@
      s nextPutHyper:16r-8000000000000000 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextHyperMSB:true) hexPrintString.    
+     (s nextHyperMSB:true) hexPrintString.
     "
     "
      |s bytes|
@@ -2604,7 +2604,7 @@
      s nextPutHyper:16r-8000000000000000 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextHyperMSB:false) hexPrintString.   
+     (s nextHyperMSB:false) hexPrintString.
     "
 
     "Modified: / 01-11-1997 / 18:30:52 / cg"
@@ -2613,9 +2613,9 @@
 
 nextPutLong:aNumber MSB:msbFlag
     <resource: #obsolete>
-    "Write the argument, aNumber as a long (four bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, aNumber as a long (four bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2634,7 +2634,7 @@
      s nextPutLong:16r12345678 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextLongMSB:false) hexPrintString.   
+     (s nextLongMSB:false) hexPrintString.
     "
     "
      |s bytes|
@@ -2643,7 +2643,7 @@
      s nextPutLong:16r12345678 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextLongMSB:true) hexPrintString.   
+     (s nextLongMSB:true) hexPrintString.
 .
     "
     "
@@ -2653,7 +2653,7 @@
      s nextPutLong:16r-80000000 MSB:true.
      bytes := s contents.
      s := bytes readStream.
-     (s nextLongMSB:true) hexPrintString.   
+     (s nextLongMSB:true) hexPrintString.
     "
     "
      |s bytes|
@@ -2662,7 +2662,7 @@
      s nextPutLong:16r-80000000 MSB:false.
      bytes := s contents.
      s := bytes readStream.
-     (s nextLongMSB:false) hexPrintString.   
+     (s nextLongMSB:false) hexPrintString.
     "
 
     "Modified: / 01-11-1997 / 18:30:52 / cg"
@@ -2683,9 +2683,9 @@
 
 nextPutShort:anIntegerOrCharacter MSB:msbFlag
     <resource: #obsolete>
-    "Write the argument, anIntegerOrCharacter as a short (two bytes). 
-     If msbFlag is true, data is written most-significant byte first; 
-     otherwise least first. 
+    "Write the argument, anIntegerOrCharacter as a short (two bytes).
+     If msbFlag is true, data is written most-significant byte first;
+     otherwise least first.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
 
@@ -2702,7 +2702,7 @@
 
      s := #[] writeStream.
      s nextPutShort:16r1234 MSB:false.
-     s contents.  
+     s contents.
     "
     "
      |s|
@@ -2741,8 +2741,8 @@
 contentsSpecies
     "this should return the class of which an instance is
      returned by the #contents method. Here, Array is returned,
-     since the abstract Stream-class has no idea of the underlying 
-     collection class. 
+     since the abstract Stream-class has no idea of the underlying
+     collection class.
      It is redefined in some subclasses - for example, to return String."
 
     ^ Array
@@ -2846,8 +2846,8 @@
 !
 
 numAvailableForRead
-    "answer the nuber of bytes available for reading"
-    
+    "answer the number of bytes available for reading"
+
     ^ self size
 !
 
@@ -2903,7 +2903,7 @@
     "return the next count elements of the stream as aCollection,
      which depends on the streams type - (see #contentsSpecies)."
 
-    |answerStream 
+    |answerStream
      cnt  "{ Class: SmallInteger }" |
 
     cnt := count.
@@ -3008,10 +3008,10 @@
     ^ answerStream contents
 
     "
-     (ReadStream on:#(1 2 3 4 5)) nextAvailable:3 
-     (ReadStream on:#(1 2 3 4 5)) nextAvailable:10 
+     (ReadStream on:#(1 2 3 4 5)) nextAvailable:3
+     (ReadStream on:#(1 2 3 4 5)) nextAvailable:10
      (ReadStream on:'hello') nextAvailable:3
-     (ReadStream on:'hello') nextAvailable:10 
+     (ReadStream on:'hello') nextAvailable:10
     "
 
     "Modified: / 16.6.1998 / 15:52:41 / cg"
@@ -3061,7 +3061,7 @@
     ^ self next
 !
 
-skip:numberToSkip 
+skip:numberToSkip
     "skip numberToSkip objects, return the receiver"
 
     "don't know how to unread ..."
@@ -3082,7 +3082,7 @@
 !
 
 skipFor:anObject
-    "skip all objects up-to and including anObject; 
+    "skip all objects up-to and including anObject;
      read and return the element after anObject."
 
     (self skipThrough:anObject) notNil ifTrue:[
@@ -3093,8 +3093,8 @@
     "
      |s next rest|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     next := s skipFor:4.      
-     rest := s upToEnd.   
+     next := s skipFor:4.
+     rest := s upToEnd.
     "
     "
      |s next rest|
@@ -3115,8 +3115,8 @@
 !
 
 skipThrough:anObject
-    "skip all objects up-to and including anObject. 
-     Return the receiver if skip was successful, 
+    "skip all objects up-to and including anObject.
+     Return the receiver if skip was successful,
      otherwise (i.e. if not found) return nil and leave the stream positioned at the end.
      The next read operation will return the element after anObject."
 
@@ -3141,33 +3141,33 @@
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
      s skipThrough:4.
      s skipThrough:4.
-     s next     
+     s next
     "
     "
      |s|
      s := ReadStream on:'12345678'.
      s skipThrough:$4.
-     s next     
+     s next
     "
     "
      |s|
      s := ReadStream on:'12345678'.
      s skipThrough:$4.
      s skipThrough:$4.
-     s next     
+     s next
     "
     "
      |s|
      s := ReadStream on:'12345678'.
      s skipThrough:$4.
      s skipThrough:$4.
-     s atEnd     
+     s atEnd
     "
 !
 
 skipThroughAll:aCollection
     "skip for and through the sequence given by the argument, aCollection;
-     return nil if not found, the receiver otherwise. 
+     return nil if not found, the receiver otherwise.
      On a successful match, the next read will return elements after aCollection;
      if no match was found, the receiver will be positioned at the end."
 
@@ -3176,18 +3176,18 @@
     l := aCollection size.
     first := aCollection at:1.
     [self atEnd] whileFalse:[
-	buffer isNil ifTrue:[
-	    buffer := self nextAvailable:l.
-	].
-	buffer = aCollection ifTrue:[
-	    ^ self
-	].
-	idx := buffer indexOf:first startingAt:2.
-	idx == 0 ifTrue:[
-	    buffer := nil
-	] ifFalse:[
-	    buffer := (buffer copyFrom:idx) , (self nextAvailable:(idx - 1))
-	]
+        buffer isNil ifTrue:[
+            buffer := self nextAvailable:l.
+        ].
+        buffer = aCollection ifTrue:[
+            ^ self
+        ].
+        idx := buffer indexOf:first startingAt:2.
+        idx == 0 ifTrue:[
+            buffer := nil
+        ] ifFalse:[
+            buffer := (buffer copyFrom:idx) , (self nextAvailable:(idx - 1))
+        ]
     ].
     ^ nil
 
@@ -3195,19 +3195,19 @@
      |s|
      s := ReadStream on:'12345678901234567890'.
      s skipThroughAll:'901'.
-     s upToEnd                    
+     s upToEnd
     "
     "
      |s|
      s := ReadStream on:'12345678901234567890'.
      s skipThroughAll:'1234'.
-     s upToEnd                    
+     s upToEnd
     "
     "
      |s|
      s := ReadStream on:'12345678901234567890'.
      s skipThroughAll:'999'.
-     s atEnd                    
+     s atEnd
     "
 
     "Created: 11.1.1997 / 18:55:13 / cg"
@@ -3215,7 +3215,7 @@
 !
 
 skipUntil:aBlock
-    "skip all elements for which aBlock returns false. 
+    "skip all elements for which aBlock returns false.
      Return true if more elements can be read, false if eof has been reached."
 
     [self atEnd] whileFalse:[
@@ -3252,7 +3252,7 @@
 
 through:anObject
     "read a collection of all objects up-to anObject and return these
-     elements, including anObject. 
+     elements, including anObject.
      The next read operation will return the element after anObject.
      If anObject is not encountered, all elements up to the end are read
      and returned.
@@ -3264,23 +3264,23 @@
 
     answerStream := WriteStream on:(self contentsSpecies new).
     [self atEnd] whileFalse:[
-	element := self next.
-	answerStream nextPut:element.
-	(element = anObject) ifTrue: [
-	    ^ answerStream contents
-	]
+        element := self next.
+        answerStream nextPut:element.
+        (element = anObject) ifTrue: [
+            ^ answerStream contents
+        ]
     ].
     ^ answerStream contents
 
     "
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s through:4).  
+     Transcript showCR:(s through:4).
      Transcript showCR:s next
 
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s through:9).  
+     Transcript showCR:(s through:9).
      Transcript showCR:s next
 
      |s|
@@ -3293,7 +3293,7 @@
 !
 
 throughAll:aCollection
-    "read & return a collection of all objects up-to and including 
+    "read & return a collection of all objects up-to and including
      a subcollection given by aCollection.
      (i.e. read until a ``substring'' is encountered.)
      The next read operation will return the element after aCollection.
@@ -3305,31 +3305,31 @@
     last := aCollection last.
     answerStream := WriteStream on:(self contentsSpecies new).
     [self atEnd] whileFalse:[
-	element := self next.
-	answerStream nextPut:element.
-	element == last ifTrue:[
-	    ((rslt := answerStream contents) endsWith:aCollection) ifTrue:[
-		^ rslt
-	    ]
-	].
+        element := self next.
+        answerStream nextPut:element.
+        element == last ifTrue:[
+            ((rslt := answerStream contents) endsWith:aCollection) ifTrue:[
+                ^ rslt
+            ]
+        ].
     ].
     ^ answerStream contents
 
     "
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s throughAll:#(4 4 4)).  
+     Transcript showCR:(s throughAll:#(4 4 4)).
      Transcript showCR:s next
 
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s throughAll:#(4 5 6)).  
+     Transcript showCR:(s throughAll:#(4 5 6)).
      Transcript showCR:s next
 
      |s|
      s := ReadStream on:'hello world, this is some text'.
-     Transcript showCR:(s throughAll:'world').  
-     Transcript showCR:(s throughAll:'some').  
+     Transcript showCR:(s throughAll:'world').
+     Transcript showCR:(s throughAll:'some').
      Transcript showCR:s upToEnd.
     "
 
@@ -3337,7 +3337,7 @@
 !
 
 throughAny:aCollection
-    "read & return a collection of all objects up-to and including 
+    "read & return a collection of all objects up-to and including
      an element contained in aCollection.
      (i.e. read until any from aCollection is encountered.)
      If no such character is encountered, all elements up to the end are read
@@ -3358,13 +3358,13 @@
     "
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s throughAny:#(3 4 5)).  
+     Transcript showCR:(s throughAny:#(3 4 5)).
      Transcript showCR:s next
 
      |s|
      s := ReadStream on:'hello world, this is some text'.
-     Transcript showCR:(s throughAny:'wt').  
-     Transcript showCR:(s throughAny:'wt').  
+     Transcript showCR:(s throughAny:'wt').
+     Transcript showCR:(s throughAny:'wt').
      Transcript showCR:s upToEnd.
     "
 
@@ -3397,7 +3397,7 @@
 
 upTo:anObject
     "read a collection of all objects up-to anObject and return these
-     elements, but excluding anObject. 
+     elements, but excluding anObject.
      The next read operation will return the element after anObject.
      (i.e. anObject is considered a separator, which is skipped)
      Similar to #through:, but the matching object is not included in the
@@ -3417,18 +3417,18 @@
     "
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s upTo:4).  
+     Transcript showCR:(s upTo:4).
      Transcript showCR:s next
 
      compare the above to:
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s through:4).  
+     Transcript showCR:(s through:4).
      Transcript showCR:s next
 
      |s|
      s := ReadStream on:#(1 2 3 4 5 6 7 8).
-     Transcript showCR:(s upTo:9).  
+     Transcript showCR:(s upTo:9).
      Transcript showCR:s next
 
      |s|
@@ -3436,18 +3436,18 @@
      Transcript showCR:(s upTo:Character space).
      Transcript showCR:(s upToEnd)
 
-     (ReadStream on:'12345678905') upTo:$5; next 
-
-     (ReadStream on:'12345678905') upTo:$5; upTo:$5 
-
-     (ReadStream on:'123456') upTo:$7     
-
-     (ReadStream on:#(1 2 3 4 5 6)) upTo:4  
+     (ReadStream on:'12345678905') upTo:$5; next
+
+     (ReadStream on:'12345678905') upTo:$5; upTo:$5
+
+     (ReadStream on:'123456') upTo:$7
+
+     (ReadStream on:#(1 2 3 4 5 6)) upTo:4
 
      (ReadStream on:'line 1
-                     line 2') upTo:Character cr  
-
-     'Makefile' asFilename readStream upTo:Character cr;upTo:Character cr  
+                     line 2') upTo:Character cr
+
+     'Makefile' asFilename readStream upTo:Character cr;upTo:Character cr
     "
 
     "Modified: / 12.1.1998 / 21:58:38 / cg"
@@ -3517,7 +3517,7 @@
 
 upToAny:aCollectionOfObjects
     "read a collection of all objects up-to a element which is contained in
-     aCollectionOfObjects and return these elements, but excluding the matching one. 
+     aCollectionOfObjects and return these elements, but excluding the matching one.
      The next read operation will return the element AFTER anObject.
      If no such element is encountered, all elements up to the end are read
      and returned.
@@ -3539,7 +3539,7 @@
      Transcript showCR:(s upToAny:(Array with:Character space)).
      Transcript showCR:(s upToEnd)
 
-     'Makefile' asFilename readStream upToAny:($A to:$Z)  
+     'Makefile' asFilename readStream upToAny:($A to:$Z)
     "
 
     "Created: / 30.8.1997 / 03:02:05 / cg"
@@ -3548,7 +3548,7 @@
 
 upToBeforeAny:aCollectionOfObjects
     "read a collection of all objects up-to a element which is contained in
-     aCollectionOfObjects and return these elements, but excluding the matching one. 
+     aCollectionOfObjects and return these elements, but excluding the matching one.
      The next read operation will return the matching element.
      If no such element is encountered, all elements up to the end are read
      and returned.
@@ -3574,9 +3574,9 @@
      |s|
      s := ReadStream on:'hello world'.
      Transcript showCR:(s upToBeforeAny:(Array with:Character space)).
-     Transcript showCR:(s upToEnd)    
-
-     'Make.proto' asFilename readStream upToBeforeAny:($A to:$Z)  
+     Transcript showCR:(s upToEnd)
+
+     'Make.proto' asFilename readStream upToBeforeAny:($A to:$Z)
     "
 
     "Created: / 30.8.1997 / 03:02:05 / cg"
@@ -3616,15 +3616,15 @@
 
     answerStream := WriteStream on:(self contentsSpecies new).
     [self atEnd] whileFalse:[
-	answerStream nextPut:(self next)
+        answerStream nextPut:(self next)
     ].
     ^ answerStream contents
 
     "
      (ReadStream on:'1234567890') upToEnd
      ('123456' readStream) next; next; upToEnd
-     ('1 23456' readStream) upTo:Character space; upToEnd 
-     ('12' readStream) next; next; upToEnd  
+     ('1 23456' readStream) upTo:Character space; upToEnd
+     ('12' readStream) next; next; upToEnd
     "
 
     "Modified: 15.5.1996 / 18:00:39 / cg"
@@ -3649,10 +3649,10 @@
 "/    ^ answerStream contents
 
     "
-     'hello world' readStream upToMatching:[:c | c isSeparator].  
+     'hello world' readStream upToMatching:[:c | c isSeparator].
     "
     "
-     'helloworld' readStream upToMatching:[:c | c isSeparator].   
+     'helloworld' readStream upToMatching:[:c | c isSeparator].
     "
     "
      |s|
@@ -3669,21 +3669,21 @@
     "Return the next elements up to but not including the next separator.
      The next read will return the separator.
      If no separator is encountered, the contents up to the end is returned.
-     The elements are supposed to understand #isSeparator 
+     The elements are supposed to understand #isSeparator
      (i.e. the receiver is supposed to be a character-stream)."
 
     ^ self upToElementForWhich:[:ch | ch isSeparator]
 
     "
-     'hello world' readStream upToSeparator  
-     'helloworld' readStream upToSeparator   
-     'helloworld' readStream upToSeparator   
-     '' readStream upToSeparator   
+     'hello world' readStream upToSeparator
+     'helloworld' readStream upToSeparator
+     'helloworld' readStream upToSeparator
+     '' readStream upToSeparator
 
      |s|
      s := 'hello world' readStream.
      s upToSeparator.
-     s upToEnd  
+     s upToEnd
     "
 
     "Modified: 4.1.1997 / 23:38:05 / cg"
@@ -3791,7 +3791,7 @@
         answerStream backStep.
     ].
     ^ answerStream contents
-        
+
 
     "Modified: / 19.5.1998 / 17:26:25 / cg"
 ! !
@@ -4086,8 +4086,8 @@
 
     "
      1 to: 10 do:[:i |
-        Transcript 
-            format:'[%1] Hello %2 World - this is %3%<cr>' 
+        Transcript
+            format:'[%1] Hello %2 World - this is %3%<cr>'
             with:{i . 'my' . 'nice'}
      ].
     "
@@ -4148,7 +4148,7 @@
 
     (aCollection notNil and:[aCollection isSequenceable]) ifFalse:[
         "/ fallback
-        aCollection do:[:eachElement|    
+        aCollection do:[:eachElement|
             self nextPut:eachElement.
         ].
          ^ self.
@@ -4169,7 +4169,7 @@
 
      s := WriteStream on:(String new).
      s nextPutAll:($a to:$f).
-     s nextPutAll:'one '; 
+     s nextPutAll:'one ';
        nextPutAll:'two ';
        nextPutAll:'three'.
      s contents
@@ -4183,7 +4183,7 @@
      of the argument, aCollection onto the receiver.
      This is only allowed, if the receiver supports writing.
      Answer the number of elements that were appended.
-     This is for compatibility with ExternalStream, where less then 
+     This is for compatibility with ExternalStream, where less then
      count elements may be written. Dolphin defines this as well."
 
     self nextPutAll:aCollection startingAt:initialIndex to:initialIndex+count-1.
@@ -4212,7 +4212,7 @@
 
      s := WriteStream on:#().
      s nextPutAll:#('one' 'two' 'three' 'four' 'five') startingAt:2.
-     s contents  
+     s contents
     "
 
     "Modified: 11.7.1996 / 10:00:28 / cg"
@@ -4241,7 +4241,7 @@
 
 nextPutAllLines:aCollectionOfStrings
     "put all elements of the argument, aCollection as individual lines
-     onto the receiver, append a cr (carriage return) after each. 
+     onto the receiver, append a cr (carriage return) after each.
      This is only useful with character streams in textMode,
      and only allowed, if the receiver supports writing."
 
@@ -4325,7 +4325,7 @@
 
 printf:format
     "C-style printing into a stream"
-    
+
     format printf:#() on:self.
 
     "
@@ -4335,7 +4335,7 @@
 
 printf:format with:argument
     "C-style printing into a stream"
-    
+
     format printf:{argument} on:self.
 
     "
@@ -4345,7 +4345,7 @@
 
 printf:format with:argument1 with:argument2
     "C-style printing into a stream"
-    
+
     format printf:{argument1 . argument2} on:self.
 
     "
@@ -4355,7 +4355,7 @@
 
 printf:format with:argument1 with:argument2 with:argument3
     "C-style printing into a stream"
-    
+
     format printf:{argument1 . argument2 . argument3} on:self.
 
     "
@@ -4366,7 +4366,7 @@
 
 printf:format with:argument1 with:argument2 with:argument3 with:argument4
     "C-style printing into a stream"
-    
+
     format printf:{argument1 . argument2 . argument3 . argument4} on:self.
 
     "
@@ -4378,7 +4378,7 @@
 
 printf:format with:argument1 with:argument2 with:argument3 with:argument4 with:argument5
     "C-style printing into a stream"
-    
+
     format printf:{argument1 . argument2 . argument3 . argument4 . argument5} on:self.
 
     "
@@ -4390,7 +4390,7 @@
 
 printf:format withAll:arguments
     "C-style printing into a stream"
-    
+
     format printf:arguments on:self.
 
     "
@@ -4416,7 +4416,7 @@
 show:something
     "append a printed representation of the argument to the stream.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4427,7 +4427,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolder %1 with the printString of arg.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4440,7 +4440,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1 and %2 with the printStrings of arg1 and arg2.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4453,7 +4453,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4466,7 +4466,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4479,7 +4479,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4492,7 +4492,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of argi.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4503,8 +4503,8 @@
     "append a printed representation of the argument to the stream
      and append a newline character.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
-	Smalltalk at:#Transcript put:Stdout
+     allows you to say:
+        Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
     self show:aString.
@@ -4518,7 +4518,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolder %1 with the printString of arg.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4531,7 +4531,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1 and %2 with the printStrings of arg1 and arg2.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4544,7 +4544,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4557,7 +4557,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4570,7 +4570,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4583,7 +4583,7 @@
     "append a printed representation of the argument to the stream, expanding
      the placeHolders %1,%2 and %3 with the printStrings of argi.
      This makes streams somewhat compatible to TextCollectors and
-     allows you to say: 
+     allows you to say:
         Smalltalk at:#Transcript put:Stdout
      or to use #show:/#showCR: with internal or external streams."
 
@@ -4663,7 +4663,7 @@
 
 nextChunkPut:aString
     "put aString as a chunk onto the receiver;
-     double all exclamation marks except within primitives and append a 
+     double all exclamation marks except within primitives and append a
      single delimiting exclamation mark at the end.
      This modification of the chunk format (not doubling exclas in primitive code)
      was done to have primitive code more readable and easier be edited in the fileBrowser
@@ -4704,7 +4704,7 @@
 
     [index <= endIndex] whileTrue:[
         "
-         find position of next interesting character; 
+         find position of next interesting character;
          output stuff up to that one in one piece
         "
         next := aString indexOfAny:stopChars startingAt:index ifAbsent:stop.
--- a/UserPreferences.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/UserPreferences.st	Fri Aug 12 06:44:59 2016 +0200
@@ -765,11 +765,11 @@
         AbstractSourceCodeManager availableManagers do:[:eachManager |
             eachManager savePreferencesOn:s
         ].
-        
+
         userPrefs useSystemLanguage ifFalse:[
             s nextPutAll:('Smalltalk language:',UserPreferences current language storeString).
             s nextPutLine:(' territory:',UserPreferences current languageTerritory storeString,'.').
-        ].    
+        ].
         s syncData.
         userPrefs beUnmodified.
     ].
@@ -1967,68 +1967,68 @@
     "tells view classes about changed font preferences"
 
     |dict fn getFont|
-    
+
     dict := self at:#fontPreferences.
     dict isNil ifTrue:[^ self].
-    
-    getFont := 
+
+    getFont :=
         [:key|
             |s fn|
-            
+
             s := dict at:key ifAbsent:nil.
             s notNil ifTrue:[
                 fn := Object readFrom:s.
                 self useXftFontsOnly ifTrue:[
                     fn := XftFontDescription for:fn
-		    "/ cg: don't allocate on the display, because it takes
-		    "/ dam long sometimes when Xft fonts are used.
-		    "/ startup feels better, if we do it lazy.
-                ] ifFalse:[    
+                    "/ cg: don't allocate on the display, because it takes
+                    "/ dam long sometimes when Xft fonts are used.
+                    "/ startup feels better, if we do it lazy.
+                ] ifFalse:[
                     Display notNil ifTrue:[fn := fn onDevice:Display].
-		]
+                ]
             ].
             fn
         ].
-    
+
     fn := getFont value:#Other.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         SimpleView withAllSubclasses do:[:cls | cls defaultFont:fn].
     ].
-    
+
     fn := getFont value:#Label.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         Label defaultFont:fn.
         CheckBox defaultFont:fn.
     ].
-    
+
     fn := getFont value:#Button.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         Button defaultFont:fn.
         Toggle defaultFont:fn.
     ].
-    
+
     fn := getFont value:#Text.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         TextView withAllSubclasses do:[:cls | cls defaultFont:fn].
     ].
-    
+
     fn := getFont value:#InputField.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         EditField withAllSubclasses do:[:cls | cls defaultFont:fn].
     ].
-    
+
     fn := getFont value:#List.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         SelectionInListView withAllSubclasses do:[:cls | cls defaultFont:fn].
     ].
-    
+
     fn := getFont value:#Tooltip.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         ActiveHelpView withAllSubclasses do:[:cls | cls defaultFont:fn].
     ].
-    
+
     fn := getFont value:#Menu.
-    fn notNil ifTrue:[    
+    fn notNil ifTrue:[
         ListView defaultFont:fn.
         MenuView defaultFont:fn.
         MenuPanel defaultFont:fn.
@@ -4153,7 +4153,7 @@
 generateCommentsForGetters
     "return true if comments for simple getters are to be generated (by the codeGenerator tool).
      The default is now false, as these look stupid in the browser and were only generated
-     for the HTMLDocumentGenerator, which is not able  to generate these comments on the fly."
+     for the HTMLDocumentGenerator, which is not able to generate these comments on the fly."
 
     ^ self generateComments and:[self at:#generateCommentsForGetters ifAbsent:false].
 
@@ -4165,7 +4165,7 @@
 generateCommentsForGetters:aBoolean
     "true if comments for simple getters are to be generated (by the codeGenerator tool).
      The default is now false, as these look stupid in the browser and were only generated
-     for the HTMLDocumentGenerator, which is not able  to generate these comments on the fly."
+     for the HTMLDocumentGenerator, which is not able to generate these comments on the fly."
 
     self at:#generateCommentsForGetters put:aBoolean.
 
@@ -4177,7 +4177,7 @@
 generateCommentsForSetters
     "return true if comments for simple setters are to be generated (by the codeGenerator tool).
      The default is now false, as these look stupid in the browser and were only generated
-     for the HTMLDocumentGenerator, which is not able  to generate these comments on the fly."
+     for the HTMLDocumentGenerator, which is not able to generate these comments on the fly."
 
     ^ self generateComments and:[self at:#generateCommentsForSetters ifAbsent:false].
 
@@ -4189,7 +4189,7 @@
 generateCommentsForSetters:aBoolean
     "true if comments for simple setters are to be generated (by the codeGenerator tool).
      The default is now false, as these look stupid in the browser and were only generated
-     for the HTMLDocumentGenerator, which is not able  to generate these comments on the fly."
+     for the HTMLDocumentGenerator, which is not able to generate these comments on the fly."
 
     self at:#generateCommentsForSetters put:aBoolean.
 
@@ -5132,7 +5132,7 @@
 debuggerLogFile:aFilename
     "if non nil, any entered debugger writes a backrace to that logfile.
      This is useful to record all session-problems"
-     
+
     ^ self at:#debuggerLogFile put:aFilename
 
     "
@@ -5389,7 +5389,7 @@
 useJavaCompletionEngineSimple
     "/ switch to false, when the JavaCompletionEngine is
     "/ finished.
-    
+
     ^ true
 !
 
--- a/WeakIdentityDictionary.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/WeakIdentityDictionary.st	Fri Aug 12 06:44:59 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -318,6 +316,68 @@
     "Modified: 1.10.1997 / 11:25:32 / stefan"
 !
 
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.
+     If it is found, return the index,
+     otherwise the index of the first unused slot.
+     Grow the receiver, if key was not found, and no unused slots were present."
+
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe
+     delIndex "{ Class:SmallInteger }"|
+
+    (OperatingSystem blockInterrupts) ifFalse:[
+        "/
+        "/ may never be entered with interrupts enabled
+        "/
+        OperatingSystem unblockInterrupts.
+        self error:'unblocked call of findKeyOrNil'.
+    ].
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey:key.
+
+    [
+        probe := keyArray basicAt:index.
+        key == probe ifTrue:[^ index].
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+
+        probe class == SmallInteger ifTrue:[
+            probe := DeletedEntry.
+            keyArray basicAt:index put:probe.
+            valueArray basicAt:index put:nil.
+            tally := tally - 1.
+        ].
+
+        (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
+            delIndex := index
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: 30.1.1997 / 15:04:34 / cg"
+    "Modified: 1.10.1997 / 11:25:32 / stefan"
+!
+
 grow:newSize
     "grow the receiver.
      Redefined to block interrupts, to avoid trouble when dependencies
--- a/WeakIdentitySet.st	Thu Aug 11 06:44:08 2016 +0200
+++ b/WeakIdentitySet.st	Fri Aug 12 06:44:59 2016 +0200
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libbasic' }"
 
+"{ NameSpace: Smalltalk }"
+
 IdentitySet subclass:#WeakIdentitySet
 	instanceVariableNames:''
 	classVariableNames:''
@@ -225,7 +227,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 }"
@@ -233,11 +235,11 @@
      delIndex "{ Class:SmallInteger }"|
 
     (OperatingSystem blockInterrupts) ifFalse:[
-	"/
-	"/ may never be entered with interrupts enabled
-	"/
-	OperatingSystem unblockInterrupts.
-	self error:'unblocked call of findKeyOrNil'.
+        "/
+        "/ may never be entered with interrupts enabled
+        "/
+        OperatingSystem unblockInterrupts.
+        self error:'unblocked call of findKeyOrNil'.
     ].
 
     delIndex := 0.
@@ -246,37 +248,100 @@
     startIndex := index := self initialIndexForKey:key.
 
     [
-	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 class == SmallInteger ifTrue:[
+            probe := DeletedEntry.
+            keyArray basicAt:index put:probe.
+            tally := tally - 1.
+        ].
+        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.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
+    ] loop.
+
+    "Modified: 30.1.1997 / 15:04:38 / cg"
+!
+
+findKeyOrNilOrDeletedEntry:key
+    "Look for the key in the receiver.
+     If it is found, return return the index, otherwise
+     the index of the first unused slot.
+     Grow the receiver, if key was not found, and no unused slots were present"
 
-	probe class == SmallInteger ifTrue:[
-	    probe := DeletedEntry.
-	    keyArray basicAt:index put:probe.
-	    tally := tally - 1.
-	].
-	delIndex == 0 ifTrue:[
-	    probe == DeletedEntry ifTrue:[
-		delIndex := index
-	    ]
-	].
+    |index  "{ Class:SmallInteger }"
+     length "{ Class:SmallInteger }"
+     startIndex probe
+     delIndex "{ Class:SmallInteger }"|
+
+    (OperatingSystem blockInterrupts) ifFalse:[
+        "/
+        "/ may never be entered with interrupts enabled
+        "/
+        OperatingSystem unblockInterrupts.
+        self error:'unblocked call of findKeyOrNil'.
+    ].
+
+    delIndex := 0.
+
+    length := keyArray basicSize.
+    startIndex := index := self initialIndexForKey: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
-	].
+    [
+        probe := keyArray basicAt:index.
+        key == probe ifTrue:[^ index].
+        probe isNil ifTrue:[
+            delIndex == 0 ifTrue:[^ index].
+            ^ delIndex
+        ].
+
+        probe class == SmallInteger ifTrue:[
+            probe := DeletedEntry.
+            keyArray basicAt:index put:probe.
+            tally := tally - 1.
+        ].
+        delIndex == 0 ifTrue:[
+            probe == DeletedEntry ifTrue:[
+                delIndex := index
+            ]
+        ].
+
+        index == length ifTrue:[
+            index := 1
+        ] ifFalse:[
+            index := index + 1
+        ].
+        index == startIndex ifTrue:[
+            delIndex ~~ 0 ifTrue:[
+                ^ delIndex
+            ].
+            self grow.
+            length := keyArray basicSize.
+            startIndex := index := self initialIndexForKey:key.
+        ].
     ] loop.
 
     "Modified: 30.1.1997 / 15:04:38 / cg"