.
authorclaus
Thu, 18 May 1995 17:10:35 +0200
changeset 348 5ac1b6b43600
parent 347 0d4c08ca9da3
child 349 33d5e92c4ce7
.
Block.st
Coll.st
Collection.st
Object.st
OrdColl.st
OrderedCollection.st
Process.st
SeqColl.st
SequenceableCollection.st
Smalltalk.st
SortColl.st
SortedCollection.st
Unix.st
--- a/Block.st	Wed May 17 14:17:43 1995 +0200
+++ b/Block.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Block.st,v 1.34 1995-05-01 21:28:12 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Block.st,v 1.35 1995-05-18 15:08:46 claus Exp $
 '!
 
 !Block class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Block.st,v 1.34 1995-05-01 21:28:12 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Block.st,v 1.35 1995-05-18 15:08:46 claus Exp $
 "
 !
 
@@ -650,7 +650,9 @@
 
 valueUninterruptably
     "evaluate the receiver with interrupts blocked.
-     This does not prevent preemption by higher priority processes."
+     This does not prevent preemption by a higher priority processes
+     if any becomes runnable due to the evaluation of the receiver
+     (i.e. if a semaphore is signalled)."
 
     Processor activeProcess uninterruptablyDo:self
 !
--- a/Coll.st	Wed May 17 14:17:43 1995 +0200
+++ b/Coll.st	Thu May 18 17:10:35 1995 +0200
@@ -13,7 +13,7 @@
 Object subclass:#Collection
        instanceVariableNames:''
        classVariableNames:'InvalidKeySignal EmptyCollectionSignal
-			   ValueNotFoundSignal'
+			   ValueNotFoundSignal NotEnoughElementsSignal'
        poolDictionaries:''
        category:'Collections-Abstract'
 !
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.33 1995-05-16 17:06:27 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.34 1995-05-18 15:09:00 claus Exp $
 '!
 
 !Collection class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.33 1995-05-16 17:06:27 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Coll.st,v 1.34 1995-05-18 15:09:00 claus Exp $
 "
 !
 
@@ -73,7 +73,11 @@
 	ValueNotFoundSignal nameClass:self message:#valueNotFoundSignal.
 	ValueNotFoundSignal notifierString:'value not found:'.
 
-	EmptyCollectionSignal := ErrorSignal newSignalMayProceed:true.
+	NotEnoughElementsSignal := ErrorSignal newSignalMayProceed:true.
+	NotEnoughElementsSignal nameClass:self message:#notEnoughElementsSignal.
+	NotEnoughElementsSignal notifierString:'not enough elements in collection'.
+
+	EmptyCollectionSignal := NotEnoughElementsSignal newSignalMayProceed:true.
 	EmptyCollectionSignal nameClass:self message:#emptyCollectionSignal.
 	EmptyCollectionSignal notifierString:'operation not allowed for empty collections'.
     ]
@@ -97,6 +101,13 @@
     "return the signal used to report non-allowed operation on empty collections"
 
     ^ EmptyCollectionSignal
+! 
+
+notEnoughElementsSignal
+    "return the signal used to report attempts for an operation, for which
+     there are not enough elements in the collection"
+
+    ^ NotEnoughElementsSignal
 ! !
 
 !Collection class methodsFor:'queries'!
@@ -220,6 +231,13 @@
     ^ EmptyCollectionSignal raise
 !
 
+notEnoughElementsError
+    "report an error that the operation is not allowed,  
+     since not enough elements are in the collection"
+
+    ^ NotEnoughElementsSignal raise
+!
+
 emptyCheck 
     "check if the receiver is empty; report an error if so"
 
@@ -389,14 +407,17 @@
 !
 
 remove:anObject ifAbsent:exceptionBlock
-    "remove the argument, anObject from the receiver - if it was not
-     in the collection returns the the value of the exceptionBlock"
+    "remove the (first occurrence of) argument, anObject from the receiver,
+     and return it.
+     If it was not in the collection, return the the value of the exceptionBlock"
 
     ^ self subclassResponsibility
 !
 
 remove:anObject
-    "remove the argument, anObject from the receiver"
+    "remove the (first occurrence of) argument, anObject from the receiver,
+     and return it.
+     If it was not in the collection, raise an error."
 
     self remove:anObject ifAbsent:[self errorValueNotFound:anObject]
 !
@@ -416,6 +437,52 @@
 
     aCollection do:[:element | self remove:element].
     ^ aCollection
+!
+
+removeFirst
+    "remove the first element from the receiver.
+     Return the removed element."
+
+    ^ self subclassResponsibility
+!
+
+removeLast
+    "remove the last element from the receiver.
+     Return the removed element."
+
+    ^ self subclassResponsibility
+!
+
+removeFirst:n
+    "remove the first n elements from the receiver.
+     Return an array filled with the removed elements."
+
+    |ret|
+
+    self size < n ifTrue:[
+	^ self notEnoughElementsError
+    ].
+    ret := Array new:n.
+    1 to:n do:[:i |
+	ret at:i put:(self removeFirst).
+    ].
+    ^ ret
+!
+
+removeLast:n
+    "remove the last n elements from the receiver.
+     Return an array filled with the removed elements."
+
+    |ret|
+
+    self size < n ifTrue:[
+	^ self notEnoughElementsError
+    ].
+    ret := Array new:n.
+    n to:1 by:-1 do:[:i |
+	ret at:i put:(self removeLast).
+    ].
+    ^ ret
 ! !
 
 !Collection methodsFor:'growing'!
--- a/Collection.st	Wed May 17 14:17:43 1995 +0200
+++ b/Collection.st	Thu May 18 17:10:35 1995 +0200
@@ -13,7 +13,7 @@
 Object subclass:#Collection
        instanceVariableNames:''
        classVariableNames:'InvalidKeySignal EmptyCollectionSignal
-			   ValueNotFoundSignal'
+			   ValueNotFoundSignal NotEnoughElementsSignal'
        poolDictionaries:''
        category:'Collections-Abstract'
 !
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.33 1995-05-16 17:06:27 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.34 1995-05-18 15:09:00 claus Exp $
 '!
 
 !Collection class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.33 1995-05-16 17:06:27 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.34 1995-05-18 15:09:00 claus Exp $
 "
 !
 
@@ -73,7 +73,11 @@
 	ValueNotFoundSignal nameClass:self message:#valueNotFoundSignal.
 	ValueNotFoundSignal notifierString:'value not found:'.
 
-	EmptyCollectionSignal := ErrorSignal newSignalMayProceed:true.
+	NotEnoughElementsSignal := ErrorSignal newSignalMayProceed:true.
+	NotEnoughElementsSignal nameClass:self message:#notEnoughElementsSignal.
+	NotEnoughElementsSignal notifierString:'not enough elements in collection'.
+
+	EmptyCollectionSignal := NotEnoughElementsSignal newSignalMayProceed:true.
 	EmptyCollectionSignal nameClass:self message:#emptyCollectionSignal.
 	EmptyCollectionSignal notifierString:'operation not allowed for empty collections'.
     ]
@@ -97,6 +101,13 @@
     "return the signal used to report non-allowed operation on empty collections"
 
     ^ EmptyCollectionSignal
+! 
+
+notEnoughElementsSignal
+    "return the signal used to report attempts for an operation, for which
+     there are not enough elements in the collection"
+
+    ^ NotEnoughElementsSignal
 ! !
 
 !Collection class methodsFor:'queries'!
@@ -220,6 +231,13 @@
     ^ EmptyCollectionSignal raise
 !
 
+notEnoughElementsError
+    "report an error that the operation is not allowed,  
+     since not enough elements are in the collection"
+
+    ^ NotEnoughElementsSignal raise
+!
+
 emptyCheck 
     "check if the receiver is empty; report an error if so"
 
@@ -389,14 +407,17 @@
 !
 
 remove:anObject ifAbsent:exceptionBlock
-    "remove the argument, anObject from the receiver - if it was not
-     in the collection returns the the value of the exceptionBlock"
+    "remove the (first occurrence of) argument, anObject from the receiver,
+     and return it.
+     If it was not in the collection, return the the value of the exceptionBlock"
 
     ^ self subclassResponsibility
 !
 
 remove:anObject
-    "remove the argument, anObject from the receiver"
+    "remove the (first occurrence of) argument, anObject from the receiver,
+     and return it.
+     If it was not in the collection, raise an error."
 
     self remove:anObject ifAbsent:[self errorValueNotFound:anObject]
 !
@@ -416,6 +437,52 @@
 
     aCollection do:[:element | self remove:element].
     ^ aCollection
+!
+
+removeFirst
+    "remove the first element from the receiver.
+     Return the removed element."
+
+    ^ self subclassResponsibility
+!
+
+removeLast
+    "remove the last element from the receiver.
+     Return the removed element."
+
+    ^ self subclassResponsibility
+!
+
+removeFirst:n
+    "remove the first n elements from the receiver.
+     Return an array filled with the removed elements."
+
+    |ret|
+
+    self size < n ifTrue:[
+	^ self notEnoughElementsError
+    ].
+    ret := Array new:n.
+    1 to:n do:[:i |
+	ret at:i put:(self removeFirst).
+    ].
+    ^ ret
+!
+
+removeLast:n
+    "remove the last n elements from the receiver.
+     Return an array filled with the removed elements."
+
+    |ret|
+
+    self size < n ifTrue:[
+	^ self notEnoughElementsError
+    ].
+    ret := Array new:n.
+    n to:1 by:-1 do:[:i |
+	ret at:i put:(self removeLast).
+    ].
+    ^ ret
 ! !
 
 !Collection methodsFor:'growing'!
--- a/Object.st	Wed May 17 14:17:43 1995 +0200
+++ b/Object.st	Thu May 18 17:10:35 1995 +0200
@@ -29,7 +29,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.48 1995-05-16 17:08:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.49 1995-05-18 15:09:41 claus Exp $
 '!
 
 !Object class methodsFor:'documentation'!
@@ -50,7 +50,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.48 1995-05-16 17:08:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.49 1995-05-18 15:09:41 claus Exp $
 "
 !
 
@@ -1361,13 +1361,14 @@
      used from other c subsystems too, to upcast errors.
      IDs (currently) used:
 	#DisplayError ..... x-error interrupt
+	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
     "
 
     |handler|
 
     handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
     handler notNil ifTrue:[
-	handler errorInterrupt.
+	handler errorInterrupt:errorID.
 	^ self
     ].
 
--- a/OrdColl.st	Wed May 17 14:17:43 1995 +0200
+++ b/OrdColl.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.24 1995-05-16 17:08:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.25 1995-05-18 15:09:50 claus Exp $
 '!
 
 !OrderedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.24 1995-05-16 17:08:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.25 1995-05-18 15:09:50 claus Exp $
 "
 !
 
@@ -200,9 +200,11 @@
     ].
     ^ anObject
 
-    "(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst; yourself"
-    "(SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself"
-    "(SortedCollection new) removeFirst"
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst; yourself
+     OrderedCollection new removeFirst
+     (SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself
+    "
 !
 
 removeLast
@@ -225,17 +227,98 @@
     ].
     ^ anObject
 
-    "(OrderedCollection withAll:#(1 2 3 4 5)) removeLast; yourself"
-    "(SortedCollection withAll:#(5 4 3 2 1)) removeLast; yourself"
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast; yourself
+     OrderedCollection new removeLast
+     (SortedCollection withAll:#(5 4 3 2 1)) removeLast; yourself
+    "
+!
+
+removeFirst:n
+    "remove the first n elements from the collection; 
+     return the elements in an Array"
+
+    |mySize ret|
+
+    mySize := self size.
+    mySize < n ifTrue:[
+	"error if collection has not enough elements"
+	^ self notEnoughElementsError.
+    ].
+
+    ret := Array new:n.
+    ret replaceFrom:1 to:n with:contentsArray startingAt:firstIndex.
+    "/
+    "/ nil-out contents array, to not keep elements from being GC'd
+    "/
+    contentsArray from:firstIndex to:firstIndex + n - 1 put:nil.
+    firstIndex := firstIndex + n.
+
+    firstIndex > lastIndex ifTrue:[
+	"reset to avoid ever growing"
+	firstIndex := 1.
+	lastIndex := 0 
+    ].
+    ^ ret
+
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:2; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:0; yourself 
+     OrderedCollection new removeFirst:2 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:6 
+     (SortedCollection withAll:#(5 4 3 2 1)) removeFirst:2; yourself  
+    "
+!
+
+removeLast:n
+    "remove the last n elements from the collection; 
+     return the elements in an Array"
+
+    |mySize ret|
+
+    mySize := self size.
+    mySize < n ifTrue:[
+	"error if collection has not enough elements"
+	^ self notEnoughElementsError.
+    ].
+
+    ret := Array new:n.
+    ret replaceFrom:1 to:n with:contentsArray startingAt:lastIndex - n + 1.
+    "/
+    "/ nil-out contents array, to not keep elements from being GC'd
+    "/
+    contentsArray from:lastIndex - n + 1 to:lastIndex put:nil.
+    lastIndex := lastIndex - n.
+
+    firstIndex > lastIndex ifTrue:[
+	"reset to avoid ever growing"
+	firstIndex := 1.
+	lastIndex := 0 
+    ].
+    ^ ret
+
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:2; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:0; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:6; yourself 
+     (SortedCollection withAll:#(5 4 3 2 1)) removeLast:2; yourself  
+    "
 !
 
 removeFromIndex:startIndex toIndex:stopIndex
     "remove the elements stored under startIndex up to and including
      the elements under stopIndex.
-     return the receiver."
+     Return the receiver.
+     Returning the receiver here is a historic leftover - it may change.
+     Please use yourself in a cascade, if you need the receivers value
+     when using this method."
 
     |nDeleted|
 
+    (startIndex < firstIndex
+    or:[stopIndex > lastIndex]) ifTrue:[
+	^ self notEnoughElementsError
+    ].
     nDeleted := stopIndex - startIndex + 1.
     contentsArray 
 	replaceFrom:(firstIndex + startIndex - 1)
@@ -257,6 +340,7 @@
 
     "
      #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeFromIndex:3 toIndex:6
+     #(1 2 3 4 5) asOrderedCollection removeFromIndex:3 toIndex:6
     "
 !
 
@@ -287,6 +371,11 @@
 	index := index + 1
     ].
     ^ exceptionBlock value
+
+    "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection remove:3 ifAbsent:'oops' 
+     #(1 2 3 4 5) asOrderedCollection remove:9 ifAbsent:'oops' 
+    "
 !
 
 removeAll
@@ -295,6 +384,39 @@
     self initContents:10
 !
 
+removeAllSuchThat:aBlock
+    "remove all elements that meet a test criteria as specified in aBlock.
+     The argument, aBlock is evaluated for successive elements and all those,
+     for which it returns true, are removed."
+
+    "/ this is a q&d implementation (slow).
+    "/ it should be rewritten to 
+
+    |runIndex removed element|
+
+    removed := self species new.
+
+    runIndex := 1.
+    [runIndex <= self size] whileTrue:[
+	element := self at:runIndex.
+	(aBlock value:element) ifTrue:[
+	    removed add:element.
+	    self removeAtIndex:runIndex
+	] ifFalse:[
+	    runIndex := runIndex + 1
+	]
+    ].
+    ^ removed
+
+    "
+     |coll|
+
+     coll := OrderedCollection withAll:(1 to:10).
+     Transcript showCr:(coll removeAllSuchThat:[:el | el even]).
+     Transcript showCr:coll
+    "
+!
+
 add:anObject
     "add the argument, anObject to the end of the collection
      Return the argument, anObject."
@@ -393,7 +515,7 @@
     idx ~~ 0 ifTrue:[
 	^ self add:newObject beforeIndex:(idx + 1).
     ].
-    self errorNotFound:oldObject
+    self errorValueNotFound:oldObject
 
     "
      |c|
@@ -424,7 +546,7 @@
     idx ~~ 0 ifTrue:[
 	^ self add:newObject beforeIndex:idx.
     ].
-    self errorNotFound:oldObject
+    self errorValueNotFound:oldObject
 
     "
      |c|
@@ -572,7 +694,7 @@
     "return the element, after anObject.
      If anObject is not in the receiver, report an error."
 
-    ^ self after:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self after:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(4 3 2 1) asOrderedCollection after:3. 
@@ -605,7 +727,7 @@
     "return the element before the argument, anObject.
      If anObject is not in the receiver, report an error."
 
-    ^ self before:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self before:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(4 3 2 1) asOrderedCollection before:3. 
--- a/OrderedCollection.st	Wed May 17 14:17:43 1995 +0200
+++ b/OrderedCollection.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.24 1995-05-16 17:08:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.25 1995-05-18 15:09:50 claus Exp $
 '!
 
 !OrderedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.24 1995-05-16 17:08:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.25 1995-05-18 15:09:50 claus Exp $
 "
 !
 
@@ -200,9 +200,11 @@
     ].
     ^ anObject
 
-    "(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst; yourself"
-    "(SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself"
-    "(SortedCollection new) removeFirst"
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst; yourself
+     OrderedCollection new removeFirst
+     (SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself
+    "
 !
 
 removeLast
@@ -225,17 +227,98 @@
     ].
     ^ anObject
 
-    "(OrderedCollection withAll:#(1 2 3 4 5)) removeLast; yourself"
-    "(SortedCollection withAll:#(5 4 3 2 1)) removeLast; yourself"
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast; yourself
+     OrderedCollection new removeLast
+     (SortedCollection withAll:#(5 4 3 2 1)) removeLast; yourself
+    "
+!
+
+removeFirst:n
+    "remove the first n elements from the collection; 
+     return the elements in an Array"
+
+    |mySize ret|
+
+    mySize := self size.
+    mySize < n ifTrue:[
+	"error if collection has not enough elements"
+	^ self notEnoughElementsError.
+    ].
+
+    ret := Array new:n.
+    ret replaceFrom:1 to:n with:contentsArray startingAt:firstIndex.
+    "/
+    "/ nil-out contents array, to not keep elements from being GC'd
+    "/
+    contentsArray from:firstIndex to:firstIndex + n - 1 put:nil.
+    firstIndex := firstIndex + n.
+
+    firstIndex > lastIndex ifTrue:[
+	"reset to avoid ever growing"
+	firstIndex := 1.
+	lastIndex := 0 
+    ].
+    ^ ret
+
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:2; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:0; yourself 
+     OrderedCollection new removeFirst:2 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:6 
+     (SortedCollection withAll:#(5 4 3 2 1)) removeFirst:2; yourself  
+    "
+!
+
+removeLast:n
+    "remove the last n elements from the collection; 
+     return the elements in an Array"
+
+    |mySize ret|
+
+    mySize := self size.
+    mySize < n ifTrue:[
+	"error if collection has not enough elements"
+	^ self notEnoughElementsError.
+    ].
+
+    ret := Array new:n.
+    ret replaceFrom:1 to:n with:contentsArray startingAt:lastIndex - n + 1.
+    "/
+    "/ nil-out contents array, to not keep elements from being GC'd
+    "/
+    contentsArray from:lastIndex - n + 1 to:lastIndex put:nil.
+    lastIndex := lastIndex - n.
+
+    firstIndex > lastIndex ifTrue:[
+	"reset to avoid ever growing"
+	firstIndex := 1.
+	lastIndex := 0 
+    ].
+    ^ ret
+
+    "
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:2; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:0; yourself 
+     (OrderedCollection withAll:#(1 2 3 4 5)) removeLast:6; yourself 
+     (SortedCollection withAll:#(5 4 3 2 1)) removeLast:2; yourself  
+    "
 !
 
 removeFromIndex:startIndex toIndex:stopIndex
     "remove the elements stored under startIndex up to and including
      the elements under stopIndex.
-     return the receiver."
+     Return the receiver.
+     Returning the receiver here is a historic leftover - it may change.
+     Please use yourself in a cascade, if you need the receivers value
+     when using this method."
 
     |nDeleted|
 
+    (startIndex < firstIndex
+    or:[stopIndex > lastIndex]) ifTrue:[
+	^ self notEnoughElementsError
+    ].
     nDeleted := stopIndex - startIndex + 1.
     contentsArray 
 	replaceFrom:(firstIndex + startIndex - 1)
@@ -257,6 +340,7 @@
 
     "
      #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeFromIndex:3 toIndex:6
+     #(1 2 3 4 5) asOrderedCollection removeFromIndex:3 toIndex:6
     "
 !
 
@@ -287,6 +371,11 @@
 	index := index + 1
     ].
     ^ exceptionBlock value
+
+    "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection remove:3 ifAbsent:'oops' 
+     #(1 2 3 4 5) asOrderedCollection remove:9 ifAbsent:'oops' 
+    "
 !
 
 removeAll
@@ -295,6 +384,39 @@
     self initContents:10
 !
 
+removeAllSuchThat:aBlock
+    "remove all elements that meet a test criteria as specified in aBlock.
+     The argument, aBlock is evaluated for successive elements and all those,
+     for which it returns true, are removed."
+
+    "/ this is a q&d implementation (slow).
+    "/ it should be rewritten to 
+
+    |runIndex removed element|
+
+    removed := self species new.
+
+    runIndex := 1.
+    [runIndex <= self size] whileTrue:[
+	element := self at:runIndex.
+	(aBlock value:element) ifTrue:[
+	    removed add:element.
+	    self removeAtIndex:runIndex
+	] ifFalse:[
+	    runIndex := runIndex + 1
+	]
+    ].
+    ^ removed
+
+    "
+     |coll|
+
+     coll := OrderedCollection withAll:(1 to:10).
+     Transcript showCr:(coll removeAllSuchThat:[:el | el even]).
+     Transcript showCr:coll
+    "
+!
+
 add:anObject
     "add the argument, anObject to the end of the collection
      Return the argument, anObject."
@@ -393,7 +515,7 @@
     idx ~~ 0 ifTrue:[
 	^ self add:newObject beforeIndex:(idx + 1).
     ].
-    self errorNotFound:oldObject
+    self errorValueNotFound:oldObject
 
     "
      |c|
@@ -424,7 +546,7 @@
     idx ~~ 0 ifTrue:[
 	^ self add:newObject beforeIndex:idx.
     ].
-    self errorNotFound:oldObject
+    self errorValueNotFound:oldObject
 
     "
      |c|
@@ -572,7 +694,7 @@
     "return the element, after anObject.
      If anObject is not in the receiver, report an error."
 
-    ^ self after:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self after:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(4 3 2 1) asOrderedCollection after:3. 
@@ -605,7 +727,7 @@
     "return the element before the argument, anObject.
      If anObject is not in the receiver, report an error."
 
-    ^ self before:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self before:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(4 3 2 1) asOrderedCollection before:3. 
--- a/Process.st	Wed May 17 14:17:43 1995 +0200
+++ b/Process.st	Thu May 18 17:10:35 1995 +0200
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Process.st,v 1.27 1995-05-16 17:08:29 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Process.st,v 1.28 1995-05-18 15:09:58 claus Exp $
 '!
 
 !Process class methodsFor:'documentation'!
@@ -45,7 +45,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Process.st,v 1.27 1995-05-16 17:08:29 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Process.st,v 1.28 1995-05-18 15:09:58 claus Exp $
 "
 !
 
@@ -692,8 +692,10 @@
 !
 
 uninterruptablyDo:aBlock
-    "execute aBlock with interrupts blocked. This does not prevent
-     preemption by higher priority processes."
+    "execute aBlock with interrupts blocked. 
+     This does not prevent preemption by a higher priority processes
+     if any becomes runnable due to the evaluation of aBlock
+     (i.e. if a semaphore is signalled there)."
 
     |wasBlocked|
 
@@ -707,7 +709,8 @@
 !
 
 waitUntilTerminated
-    "wait until the receiver is terminated"
+    "wait until the receiver is terminated.
+     This method allows another process to wait till the receiver finishes."
 
     |wasBlocked|
 
@@ -718,7 +721,7 @@
 !
 
 waitUntilSuspended
-    "wait until the receiver is suspended"
+    "wait until the receiver is suspended."
 
     |wasBlocked|
 
--- a/SeqColl.st	Wed May 17 14:17:43 1995 +0200
+++ b/SeqColl.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 '!
 
 !SequenceableCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SeqColl.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 "
 !
 
@@ -1073,6 +1073,9 @@
 
 removeFromIndex:startIndex toIndex:endIndex
     "remove the elements stored at indexes between startIndex and endIndex.
+     Return the receiver.
+     Returning the receiver is a historic leftover - it may at one
+     time return a collection of the removed elements.
 
      Notice, that this is modifies the receiver - NOT a copy; 
      therefore any other users of the receiver will also see this change.
@@ -1108,8 +1111,8 @@
     "
 !
 
-removeAtIndex:index
-    "remove the argument stored at index and return it.
+removeAtIndex:anIndex
+    "remove the element stored at anIndex. Return the removed object.
 
      Notice, that this is modifies the receiver NOT a copy.
      Also note, that it may be a slow operation for some collections,
@@ -1118,11 +1121,13 @@
 
     |element|
 
-    element := self at:index.
-    self removeIndex:index.
+    element := self at:anIndex.
+    self removeFromIndex:anIndex toIndex:anIndex.
     ^ element
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeAtIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeAtIndex:6
      #($a $b $c $d $e $f $g) removeAtIndex:3
     "
 !
@@ -1138,6 +1143,8 @@
     self removeFromIndex:index toIndex:index
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeIndex:6
      #($a $b $c $d $e $f $g) removeIndex:3
     "
 !
@@ -1153,10 +1160,10 @@
     ^ self removeAtIndex:1
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeFirst.
-     a
+     a 
     "
 !
 
@@ -1171,7 +1178,7 @@
     ^ self removeAtIndex:(self size) 
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeLast.
      a   
--- a/SequenceableCollection.st	Wed May 17 14:17:43 1995 +0200
+++ b/SequenceableCollection.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 '!
 
 !SequenceableCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 "
 !
 
@@ -1073,6 +1073,9 @@
 
 removeFromIndex:startIndex toIndex:endIndex
     "remove the elements stored at indexes between startIndex and endIndex.
+     Return the receiver.
+     Returning the receiver is a historic leftover - it may at one
+     time return a collection of the removed elements.
 
      Notice, that this is modifies the receiver - NOT a copy; 
      therefore any other users of the receiver will also see this change.
@@ -1108,8 +1111,8 @@
     "
 !
 
-removeAtIndex:index
-    "remove the argument stored at index and return it.
+removeAtIndex:anIndex
+    "remove the element stored at anIndex. Return the removed object.
 
      Notice, that this is modifies the receiver NOT a copy.
      Also note, that it may be a slow operation for some collections,
@@ -1118,11 +1121,13 @@
 
     |element|
 
-    element := self at:index.
-    self removeIndex:index.
+    element := self at:anIndex.
+    self removeFromIndex:anIndex toIndex:anIndex.
     ^ element
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeAtIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeAtIndex:6
      #($a $b $c $d $e $f $g) removeAtIndex:3
     "
 !
@@ -1138,6 +1143,8 @@
     self removeFromIndex:index toIndex:index
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeIndex:6
      #($a $b $c $d $e $f $g) removeIndex:3
     "
 !
@@ -1153,10 +1160,10 @@
     ^ self removeAtIndex:1
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeFirst.
-     a
+     a 
     "
 !
 
@@ -1171,7 +1178,7 @@
     ^ self removeAtIndex:(self size) 
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeLast.
      a   
--- a/Smalltalk.st	Wed May 17 14:17:43 1995 +0200
+++ b/Smalltalk.st	Thu May 18 17:10:35 1995 +0200
@@ -27,7 +27,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.46 1995-05-16 17:08:57 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.47 1995-05-18 15:10:18 claus Exp $
 '!
 
 "
@@ -56,7 +56,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.46 1995-05-16 17:08:57 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.47 1995-05-18 15:10:18 claus Exp $
 "
 !
 
@@ -255,6 +255,9 @@
      Notice: this is not called when an image is restarted; in this
      case the show starts in Smalltalk>>restart."
 
+    SilentLoading := false.
+    Initializing := true.
+
     "
      define low-level debugging tools - graphical classes are not prepared yet
      to handle things. 
--- a/SortColl.st	Wed May 17 14:17:43 1995 +0200
+++ b/SortColl.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.16 1995-05-16 17:09:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.17 1995-05-18 15:10:23 claus Exp $
 '!
 
 !SortedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.16 1995-05-16 17:09:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.17 1995-05-18 15:10:23 claus Exp $
 "
 !
 
@@ -304,7 +304,7 @@
     "return the element before the argument, anObject; or nil if there is none.
      If the receiver does not contain anObject, report an error"
 
-    ^ self before:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self before:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(7 3 9 10 99) asSortedCollection before:50
@@ -346,7 +346,7 @@
     "return the element after the argument, anObject; or nil if there is none.
      If the receiver does not contain anObject, report an error"
 
-    ^ self after:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self after:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(7 3 9 10 99) asSortedCollection after:50
--- a/SortedCollection.st	Wed May 17 14:17:43 1995 +0200
+++ b/SortedCollection.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.16 1995-05-16 17:09:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.17 1995-05-18 15:10:23 claus Exp $
 '!
 
 !SortedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.16 1995-05-16 17:09:05 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.17 1995-05-18 15:10:23 claus Exp $
 "
 !
 
@@ -304,7 +304,7 @@
     "return the element before the argument, anObject; or nil if there is none.
      If the receiver does not contain anObject, report an error"
 
-    ^ self before:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self before:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(7 3 9 10 99) asSortedCollection before:50
@@ -346,7 +346,7 @@
     "return the element after the argument, anObject; or nil if there is none.
      If the receiver does not contain anObject, report an error"
 
-    ^ self after:anObject ifAbsent:[self errorNotFound:anObject]
+    ^ self after:anObject ifAbsent:[self errorValueNotFound:anObject]
 
     "
      #(7 3 9 10 99) asSortedCollection after:50
--- a/Unix.st	Wed May 17 14:17:43 1995 +0200
+++ b/Unix.st	Thu May 18 17:10:35 1995 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.34 1995-05-16 17:09:31 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.35 1995-05-18 15:10:35 claus Exp $
 '!
 
 !OperatingSystem primitiveDefinitions!
@@ -156,7 +156,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.34 1995-05-16 17:09:31 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.35 1995-05-18 15:10:35 claus Exp $
 "
 !
 
@@ -2001,11 +2001,6 @@
 #if defined(ITIMER_VIRTUAL)
     struct itimerval dt;
 
-    dt.it_interval.tv_sec = 0;
-    dt.it_interval.tv_usec = 0;
-    dt.it_value.tv_sec = 0;
-    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
-    setitimer(ITIMER_VIRTUAL, &dt, 0);
 # ifndef xxxSYSV4
 #  if defined(BSD) || defined(HAS_SIGSETMASK)
     sigsetmask(0);
@@ -2018,6 +2013,12 @@
     signal(SIGALRM, __spyInterrupt);
 # endif
 
+    dt.it_interval.tv_sec = 0;
+    dt.it_interval.tv_usec = 0;
+    dt.it_value.tv_sec = 0;
+    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
+    setitimer(ITIMER_VIRTUAL, &dt, 0);
+
     RETURN (true);
 #endif
 %}
@@ -2055,17 +2056,18 @@
 #if defined(ITIMER_REAL)
     struct itimerval dt;
 
-    dt.it_interval.tv_sec = 0;
-    dt.it_interval.tv_usec = 0;
-    dt.it_value.tv_sec = _intVal(millis) / 1000;
-    dt.it_value.tv_usec = (_intVal(millis) % 1000) * 1000;  
-    setitimer(ITIMER_REAL, &dt, 0);
 # ifndef xxxSYSV4
 #  if defined(BSD) || defined(HAS_SIGSETMASK)
     sigsetmask(0);
 #  endif
 # endif
     signal(SIGALRM, __signalTimerInterrupt);
+
+    dt.it_interval.tv_sec = 0;
+    dt.it_interval.tv_usec = 0;
+    dt.it_value.tv_sec = _intVal(millis) / 1000;
+    dt.it_value.tv_usec = (_intVal(millis) % 1000) * 1000;  
+    setitimer(ITIMER_REAL, &dt, 0);
     RETURN (true);
 #endif
 %}