Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 23 Jan 2016 07:23:05 +0000
branchjv
changeset 19103 71257a47eba2
parent 19065 1fc3abdcb8f9 (current diff)
parent 19092 4a5b5b1e6f36 (diff)
child 19104 e7c5169d9ab7
Merge
Bag.st
ExternalStream.st
Filename.st
Float.st
Integer.st
LongFloat.st
NonPositionableExternalStream.st
Number.st
ProcessorScheduler.st
ProgrammingLanguage.st
SequenceableCollection.st
Set.st
SmallInteger.st
SortedCollection.st
Stream.st
UserPreferences.st
WeakValueDictionary.st
WeakValueIdentityDictionary.st
--- a/.hgtags	Thu Jan 21 17:58:19 2016 +0000
+++ b/.hgtags	Sat Jan 23 07:23:05 2016 +0000
@@ -1,6 +1,5 @@
 15dc2dbf6e8fe7c62c2e3ce222caaf1d29b7b199 expecco_2_6_0rc1
 1d9d6c39b0502beb341e3890a46d6f310fbd8475 ecpecco_1_6_0
-23b3c4c6c9e7362188dceda99eed26eee944615f expecco_ALM_1_9_7
 23b97fa0be768ce65ad2fc755e02f7f625a235e8 expecco_2_0_0_0
 246ccdafca3ce8d2ca3f22ab44981b5ecb2c1e5f expecco_2_6_2
 2a14d6e5479c98cd9e1d82719908e486297376d9 expecco_1_7_0rc8
@@ -8,6 +7,7 @@
 2c07a05644f14ed0851f9b676504d8246800dfa8 expeccoNET_1_6_8_0
 2c1c439ddab3d63d3ce82d0a0b8b29aee2a7df3e expecco_1_3_4
 2e7fc0e4df9bba4892506790d0041601b9d0aa9b expecco_2_8_0
+2e7fc0e4df9bba4892506790d0041601b9d0aa9b expecco_2_8_0a
 32b2b8791d17cdddb1a2db5660362643c60baa79 expecco_2_7_1
 373af30a15cafccd184b57b8492979e1969af65f rel3_4_1_1
 3816e831f5f3ed00876f38adbfaf1a25ad010ed7 rel2_10_8_6_last_before_vmData_change
@@ -16,6 +16,7 @@
 41f8a86105f0bc8209fae8b44e7979c8a084fc3c expecco_2_7_5a
 4306fb61b9f8004278974861ad3d1fb0cc9a9529 expecco_1_6_0rc5
 43bb5d8495e0048a1ba8f299b56d6411394dc6d1 expecco_1_7_0rc1
+508e9e5d9254027c7f4aed4fe7734dab793e5230 expecco_ALM_1_9_7
 59d0cc49b9442979ff138bc2424f588e8a533c2f expecco_1_7_0rc3
 602e61cb64a3aaa674fbaf01705064701f2f5c14 expecco_2_2_5
 615c4fe0f449a6be077b11450d39fb6560b1695a rel4_1_3_1
--- a/Bag.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Bag.st	Sat Jan 23 07:23:05 2016 +0000
@@ -237,21 +237,21 @@
 !
 
 remove:oldObject ifAbsent:anExceptionBlock
-    "Remove oldObject from the collection.
+    "Remove one occurrence of oldObject from the collection.
      If it was not present, return the value of the exceptionBlock;
      otherwise return the removed object.
 
      WARNING: do not add/remove elements while iterating over the receiver.
-	      Iterate over a copy to do this."
+              Iterate over a copy to do this."
 
     |count|
 
     count := contents at:oldObject ifAbsent:0.
     (count == 0) ifTrue:[^ anExceptionBlock value].
     (count == 1) ifTrue:[
-	contents removeKey:oldObject
+        contents removeKey:oldObject
     ] ifFalse:[
-	contents at:oldObject put:(count - 1)
+        contents at:oldObject put:(count - 1)
     ].
     ^ oldObject
 
@@ -554,10 +554,10 @@
 !Bag class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.54 2015-06-08 19:23:24 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.54 2015-06-08 19:23:24 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/ExternalStream.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/ExternalStream.st	Sat Jan 23 07:23:05 2016 +0000
@@ -2221,10 +2221,7 @@
     "close the stream - added for protocol compatibility with PipeStream.
      see comment there"
 
-    self isOpen ifTrue:[
-        self unregisterForFinalization.
-        self closeFile
-    ]
+    self close.
 
     "Modified: 30.8.1996 / 00:39:21 / cg"
 ! !
--- a/Filename.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Filename.st	Sat Jan 23 07:23:05 2016 +0000
@@ -6096,7 +6096,7 @@
 
 appendingFileDo:aBlock
     "create a append-stream on the receiver file, evaluate aBlock, passing that stream as arg,
-     and return the blocks value.
+     and return the block's value.
      If the file cannot be opened, an exception is raised.
      Ensures that the stream is closed."
 
@@ -6104,16 +6104,16 @@
 
     stream := self appendStream.
     [
-	result := aBlock value:stream
+        result := aBlock value:stream
     ] ensure:[
-	stream close
+        stream close
     ].
     ^ result
 
     "
      'ttt' asFilename appendingFileDo:[:s |
-	s nextPutLine:'hello'.
-	s nextPutLine:'world'.
+        s nextPutLine:'hello'.
+        s nextPutLine:'world'.
      ]
     "
 
@@ -6150,7 +6150,7 @@
 
 writingFileDo:aBlock
     "create a write-stream on the receiver file, evaluate aBlock, passing that stream as arg,
-     and return the blocks value.
+     and return the block's value.
      If the file cannot be opened, an exception is raised.
      Ensures that the stream is closed."
 
@@ -6158,16 +6158,16 @@
 
     stream := self writeStream.
     [
-	result := aBlock value:stream
+        result := aBlock value:stream
     ] ensure:[
-	stream close
+        stream close
     ].
     ^ result
 
     "
      'ttt' asFilename writingFileDo:[:s |
-	s nextPutLine:'hello'.
-	s nextPutLine:'world'.
+        s nextPutLine:'hello'.
+        s nextPutLine:'world'.
      ]
     "
 
--- a/Float.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Float.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -1790,26 +1788,34 @@
     OBJ newFloat;
 
     if (__isFloatLike(n)) {
-	__threadErrno = 0;
-	rslt = pow(__floatVal(self), __floatVal(n));
-	if (! isnan(rslt))  /* Currently all our systems support isnan() */
-	{
-	    if (__threadErrno == 0) {
-		__qMKFLOAT(newFloat, rslt);
-		RETURN ( newFloat );
-	    }
-	}
+        __threadErrno = 0;
+        rslt = pow(__floatVal(self), __floatVal(n));
+        if (! isnan(rslt))  /* Currently all our systems support isnan() */
+        {
+            if (__threadErrno == 0) {
+                __qMKFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
     }
 %}.
+    "/ the c-library pow functin, has a bug:
+    "/ it does not deal correctly with negative numbers. 
+    "/ I.e. it raises an error on -8^(1/3) instead of returning a negative -2
+    "/ work around with a kludge:
+    self < 0 ifTrue:[
+        ^ (self negated raisedTo:n) negated
+    ].
+
     "
      an invalid argument (not convertable to float ?)
     "
     ^ self class
-	raise:#domainErrorSignal
-	receiver:self
-	selector:#raisedTo:
-	arguments:(Array with:aNumber)
-	errorString:'bad receiver/arg in raisedTo:'
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#raisedTo:
+        arguments:(Array with:aNumber)
+        errorString:'bad receiver/arg in raisedTo:'
 
     "Modified: / 16.11.2001 / 14:16:51 / cg"
 !
--- a/Integer.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Integer.st	Sat Jan 23 07:23:05 2016 +0000
@@ -70,7 +70,7 @@
 byte1:b1 byte2:b2 byte3:b3 byte4:b4
     "Squeak compatibility:
      Return an Integer given four value bytes.
-     The returned integer is either a Small- or a LargeInteger 
+     The returned integer is either a Small- or a LargeInteger
      (on 32bit systems - on 64bit systems, it will be always a SmallInteger)"
 
     |t|
@@ -223,7 +223,7 @@
      negative specifies if the result should be a negative number.
      The digits can be stored byte-wise into the result, using digitAt:put:"
 
-    ^ LargeInteger basicNew 
+    ^ LargeInteger basicNew
             numberOfDigits:numberOfBytes
             sign:(negative ifTrue:[-1] ifFalse:[1])
 !
@@ -926,7 +926,7 @@
 
 primeCacheSize
     "see comment in initializePrimeCacheUpTo:limit"
-    
+
     ^ PrimeCache size * 2
 
     "
@@ -1057,7 +1057,7 @@
 primesUpTo: max do: aBlock
     "Compute aBlock with all prime integers up to and including the given integer.
      See comment in initializePrimeCacheUpTo:limit"
-     
+
     | limit flags prime k |
 
     max <= 2000 ifTrue:[
@@ -1126,7 +1126,7 @@
 !Integer methodsFor:'*Roe'!
 
 acceptRoeVisitor: aVisitor
-	^ aVisitor visitInteger: self
+        ^ aVisitor visitInteger: self
 ! !
 
 !Integer methodsFor:'Compatibility-Dolphin'!
@@ -1134,7 +1134,7 @@
 & aNumber
     "return the bitwise-and of the receiver and the argument, anInteger.
      Same as bitAnd: - added for compatibility with Dolphin Smalltalk.
-     Notice: 
+     Notice:
         please do not use ^ for integers in new code; it makes the code harder
         to understand, as it may be not obvious, whether a boolean or a bitWise or is intended.
         For integers, use bitAnd: to make the intention explicit."
@@ -1228,7 +1228,7 @@
 | aNumber
     "return the bitwise-or of the receiver and the argument, anInteger.
      Same as bitOr: - added for compatibility with Dolphin Smalltalk.
-     Notice: 
+     Notice:
         please do not use | for integers in new code; it makes the code harder
         to understand, as it may be not obvious, whether a boolean or a bitWise or is intended.
         For integers, use bitOr: to make the intention explicit."
@@ -1256,7 +1256,7 @@
     "return my hexBytes in MSB, optionally padded at the left with zeros"
 
     "(((
-        | repeats number | 
+        | repeats number |
         repeats := 1000000.
         number := 123456789123456789123456789123456789123456789123456789.
          [repeats timesRepeat: (number asByteArrayOfSize: 1024) ] timeToRun.
@@ -1279,7 +1279,7 @@
 
      255 asByteArrayOfSize:1 #[255]
 
-     256 asByteArrayOfSize:1 
+     256 asByteArrayOfSize:1
      256 asByteArrayOfSize:2
      256 asByteArrayOfSize:4
     "
@@ -1314,9 +1314,9 @@
     ^ (self printStringRadix:base) leftPaddedTo:size with:padChar
 
     "
-     1234 printPaddedWith:$0 to:4 base:16     
-     1234 printLeftPaddedWith:$0 to:4 base:16 
-     128 printLeftPaddedWith:$0 to:2 base:16  
+     1234 printPaddedWith:$0 to:4 base:16
+     1234 printLeftPaddedWith:$0 to:4 base:16
+     128 printLeftPaddedWith:$0 to:2 base:16
     "
 !
 
@@ -1526,8 +1526,9 @@
 !
 
 bitClear:aMaskInteger
-    "return the bitwise-and of the receiver and the complement of argument, anInteger,
+    "return the bitwise-and of the receiver and the complement of the argument, anInteger,
      returning the receiver with bits of the argument cleared.
+     (i.e. the same as self bitAnd:aMaskInteger bitInvert).
      This is a general and slow implementation, walking over the bytes of
      the receiver and the argument."
 
@@ -1598,11 +1599,24 @@
     ].
     ^ result
 
-     "
-      16rff bitInvert bitAnd:16rff
-      16rffffffff bitInvert
-      16rff00ff00 bitInvert hexPrintString
-     "
+    "
+     16rff bitInvert bitAnd:16rff
+     16rffffffff bitInvert
+     16rff00ff00 bitInvert hexPrintString
+    "
+!
+
+bitInvertByte
+    "return a new integer, where the low 8 bits are masked and complemented.
+     This returns an unsigned version of what bitInvert would return.
+     (i.e. same as self bitInvert bitAnd:16rFF)"
+
+    ^ (self digitAt:1) bitInvert bitAnd:16rFF
+    
+    "
+     16rff bitInvert
+     16rff bitInvertByte
+    "
 !
 
 bitOr:aMaskInteger
@@ -1877,7 +1891,7 @@
     ^ self bitOr:mask
 
     "
-     (16r3fffffff changeMask:16r80 to:0) hexPrintString 
+     (16r3fffffff changeMask:16r80 to:0) hexPrintString
      (16r3fff0000 changeMask:16r80 to:1) hexPrintString
     "
 !
@@ -2353,7 +2367,7 @@
         "ByteArray<<#swapBytes needs even number of bytes.
          Add 0 to the most significant position (the end)"
         digitBytes := digitBytes copyWith:0.
-        
+
     ].
     ^ (LargeInteger digitBytes:digitBytes swapBytes) compressed
 
@@ -2483,7 +2497,7 @@
      16r7FFFFF signExtended24BitValue
      16rFFFFFF signExtended24BitValue
     "
-    
+
     "Modified: / 07-05-1996 / 09:31:57 / cg"
     "Created: / 05-03-2012 / 14:37:55 / cg"
 !
@@ -2512,11 +2526,11 @@
      This may be useful for communication interfaces"
 
     |masked|
-    
+
     masked := self bitAnd:((1 bitShift:bitNr)-1).
     (self isBitSet:bitNr) ifTrue:[
         ^ masked - (1 bitShift:bitNr)
-    ].    
+    ].
     ^ masked
 
     "
@@ -2536,7 +2550,7 @@
 
     (self bitTest:16r8000000000000000) ifTrue:[
         ^ (self bitAnd:16rFFFFFFFFFFFFFFFF) - 16r10000000000000000
-    ].    
+    ].
     ^ (self bitAnd:16r7FFFFFFFFFFFFFFF)
 
     "
@@ -2554,7 +2568,7 @@
 
     (self bitTest:16r80000000) ifTrue:[
         ^ (self bitAnd:16rFFFFFFFF) - 16r100000000
-    ].    
+    ].
     ^ (self bitAnd:16r7FFFFFFF)
 
     "
@@ -2747,7 +2761,7 @@
 
     "
      1 to:10 collect:[:i | i squared]
-     10 to:20 collect:[:i | i squared]  
+     10 to:20 collect:[:i | i squared]
      (10 to:20) collect:[:i | i squared]
     "
 ! !
@@ -2838,14 +2852,14 @@
 !
 
 divMod:aNumber
-    "return an array filled with 
+    "return an array filled with
         (self // aNumber) and (self \\ aNumber).
      The returned remainder has the same sign as aNumber.
      The following is always true:
         (receiver // something) * something + (receiver \\ something) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     Especially surprising:     
+     Especially surprising:
         -1 \\ 10 -> 9  (because -(1/10) is truncated towards next smaller integer, which is -1,
                         and -1 multiplied by 10 gives -10, so we have to add 9 to get the original -1).
         -10 \\ 3 -> 2 (because -(10/3) is truncated towards next smaller integer, which is -4,
@@ -2861,7 +2875,7 @@
     "
      10 divMod:3       -> #(3 1)   because 3*3 + 1 = 10
      10 divMod:-3      -> #(-4 -2) because -4*-3 + (-2) = 10
-     -10 divMod:3      -> #(-4 2) because -4*-3 + 2 = -10   
+     -10 divMod:3      -> #(-4 2) because -4*-3 + 2 = -10
      -10 divMod:-3     -> #(3 -1)  because -3*3 + (-1) = -10
 
      1000000000000000000000 divMod:3   -> #(333333333333333333333 1)
@@ -3169,26 +3183,26 @@
     ^ self highBit - 1.
 
     "
-      2  log:2  
-      2  integerLog2  
-
-      3  log:2       
-      3  integerLog2  
-
-      4  log:2          
-      4  integerLog2    
-
-      64  integerLog2  
+      2  log:2
+      2  integerLog2
+
+      3  log:2
+      3  integerLog2
+
+      4  log:2
+      4  integerLog2
+
+      64  integerLog2
       100 integerLog2
       100 log:2
       999 integerLog2
       999 log:2
-      120000 integerLog2 
-      120000 log:2       
+      120000 integerLog2
+      120000 log:2
       -1 integerLog2
-      50 factorial integerLog2   
+      50 factorial integerLog2
       50 factorial log:2
-      1000 factorial integerLog2   
+      1000 factorial integerLog2
       1000 factorial log:2       -- float error!!
     "
 !
@@ -3229,7 +3243,7 @@
 
 integerSqrt
     "return the largest integer which is less or equal to the
-     receiver's square root. 
+     receiver's square root.
      This might be needed for some number theoretic problems with large numbers
      (and also in cryptography). Uses Newton's method"
 
@@ -3243,10 +3257,11 @@
             arguments:#()
             errorString:'bad (negative) receiver in sqrt'
     ].
+    self == 0 ifTrue:[^ 0].
     
     guess := (1 bitShift:(self highBit // 2)).
 
-    [ 
+    [
         prevGuess ~= guess
         and:[ ((guessSquared := guess squared) - self) abs >= guess ]
     ] whileTrue:[
@@ -3262,14 +3277,14 @@
     ^ guess.
 
     "
-     333 integerSqrt          
-     325 integerSqrt          
-     324 integerSqrt          
-     323 integerSqrt          
+     333 integerSqrt
+     325 integerSqrt
+     324 integerSqrt
+     323 integerSqrt
      10239552311579 integerSqrt
      5397346292805549782720214077673687806275517530364350655459511599582614290 integerSqrt
      1000 factorial integerSqrt
-     
+
      1000 factorial - 1000 factorial integerSqrt squared
      1000 factorial - (1000 factorial integerSqrt + 1) squared
    "
@@ -3673,12 +3688,12 @@
 
     "
      (100 factorial) asBCD
-     999999999 asBCD 
-     100000000 asBCD   
-     123456789 asBCD   
-     99999999 asBCD  
+     999999999 asBCD
+     100000000 asBCD
+     123456789 asBCD
+     99999999 asBCD
      12345678 asBCD
-     12345678 asBCD 
+     12345678 asBCD
      12345678 asBCD hexPrintString
      12345678901234567890 asBCD
     "
@@ -3713,7 +3728,7 @@
     ^ s contents reverse
 
     "
-     12345678 asBCDBytes 
+     12345678 asBCDBytes
      12345678 asBCDBytes hexPrintString
      12345678901234567890 asBCDBytes
     "
@@ -3823,7 +3838,7 @@
 "/        r := r*r.    "/ radix^10 / radix^12 (chunks of 10/12 digits)
 "/        nD := nD * 2.
 "/    ].
-   
+
     "get a Stream with space for the digits we are going to print.
      We need ((num log:base) ceiling) digits, which is equivalent
      to ((num log:2)/(base log:2) ceiling)
@@ -3847,7 +3862,7 @@
         ].
     ].
 
-    [num ~= 0] whileTrue:[
+    [num ~~ 0] whileTrue:[
         divMod := num divMod:base.
         num := divMod at:1.
         mod := divMod at:2.
@@ -3873,7 +3888,7 @@
     "Modified (comment): / 28-12-2015 / 08:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-printOn:aStream base:baseInteger size:sz 
+printOn:aStream base:baseInteger size:sz
     "print a string representation of the receiver in the specified
      base. The string is padded on the left with fillCharacter to make
      its size as specified in sz."
@@ -4035,7 +4050,7 @@
     ^ self printStringRadix:base showRadix:false
 
     "
-     10 printStringRadix:16   
+     10 printStringRadix:16
     "
 
     "Created: / 19-01-1998 / 17:20:58 / stefan"
@@ -4141,17 +4156,17 @@
 
     "
      self assert:( 1.0 exponent = 1 exponent ).
-     self assert:( 2.0 exponent = 2 exponent ).  
-     self assert:( 3.0 exponent = 3 exponent ).  
-     self assert:( 4.0 exponent = 4 exponent ).  
-     self assert:( 12345.0 exponent = 12345 exponent ).  
-     self assert:( 0.0 exponent = 0 exponent ).   
+     self assert:( 2.0 exponent = 2 exponent ).
+     self assert:( 3.0 exponent = 3 exponent ).
+     self assert:( 4.0 exponent = 4 exponent ).
+     self assert:( 12345.0 exponent = 12345 exponent ).
+     self assert:( 0.0 exponent = 0 exponent ).
 
      self assert:( -1.0 exponent = -1 exponent ).
-     self assert:( -2.0 exponent = -2 exponent ).  
-     self assert:( -3.0 exponent = -3 exponent ).  
-     self assert:( -4.0 exponent = -4 exponent ).  
-     self assert:( -12345.0 exponent = -12345 exponent ).  
+     self assert:( -2.0 exponent = -2 exponent ).
+     self assert:( -3.0 exponent = -3 exponent ).
+     self assert:( -4.0 exponent = -4 exponent ).
+     self assert:( -12345.0 exponent = -12345 exponent ).
     "
 !
 
@@ -4171,9 +4186,9 @@
 isPerfectSquare
     "return true if I am a perfect square.
      That is a number for which the square root is an integer."
-     
+
     |intSqrt realSqrt|
-    
+
     self strictlyPositive ifFalse:[
         self == 0 ifTrue:[^ true].
         "/ should we raise a domain error for negative receivers?
@@ -4181,18 +4196,18 @@
     ].
 
     "/ q&d check for common small squares
-    self < 400 ifTrue:[    
+    self < 400 ifTrue:[
         ^ #(1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 ) includes:self.
-    ].        
-    self < 1024 ifTrue:[    
+    ].
+    self < 1024 ifTrue:[
         ^ #(400 441 484 529 576 625 676 729 784 841 900 961) includes:self.
     ].
-    
+
     "/ try powers of 2
     self isPowerOfTwo ifTrue:[
         ^ self lowBit odd
     ].
-    
+
     "/ guess
     realSqrt := self sqrt.
     realSqrt isFinite ifTrue:[
@@ -4200,9 +4215,9 @@
             "/ still have to check due to rounding errors.
             intSqrt := realSqrt truncated asInteger.
             ^ intSqrt squared = self
-        ].    
+        ].
     ].
-    
+
     "/ slow code
     intSqrt := self integerSqrt.
     ^ intSqrt squared = self
@@ -4236,7 +4251,7 @@
     "
      0 isPowerOf:2
      1 isPowerOf:2
-     
+
      16r0000000000000000 isPowerOf:2
      16r0000004000000000 isPowerOf:2
      16r0000004000000001 isPowerOf:2
@@ -4287,12 +4302,12 @@
     ^ true
 
     "
-     10000 factorial isPowerOfTwo  
-     |n| n := 10000 factorial. Time millisecondsToRun:[1000 timesRepeat:[ n isPowerOfTwo]] 
-    "
-    "
-     (2 raisedTo:10000) isPowerOfTwo  
-     |n| n := (2 raisedTo:10000). Time millisecondsToRun:[1000 timesRepeat:[ n isPowerOfTwo]] 
+     10000 factorial isPowerOfTwo
+     |n| n := 10000 factorial. Time millisecondsToRun:[1000 timesRepeat:[ n isPowerOfTwo]]
+    "
+    "
+     (2 raisedTo:10000) isPowerOfTwo
+     |n| n := (2 raisedTo:10000). Time millisecondsToRun:[1000 timesRepeat:[ n isPowerOfTwo]]
     "
 
     "Modified: / 20-06-2011 / 12:43:05 / cg"
@@ -4353,13 +4368,13 @@
     ^ self + (n - rest)
 
     "
-     1 nextMultipleOf: 4  
-     2 nextMultipleOf: 4  
-     3 nextMultipleOf: 4  
-     4 nextMultipleOf: 4  
-     5 nextMultipleOf: 4  
-
-     22 nextMultipleOf: 4 
+     1 nextMultipleOf: 4
+     2 nextMultipleOf: 4
+     3 nextMultipleOf: 4
+     4 nextMultipleOf: 4
+     5 nextMultipleOf: 4
+
+     22 nextMultipleOf: 4
     "
 !
 
@@ -4367,7 +4382,7 @@
     "return the power of 2 at or above the receiver.
      Useful for padding.
      Notice, that for a powerOf2, the receiver is returned.
-     Also notice, that (because it is used for padding), 
+     Also notice, that (because it is used for padding),
      0 is returned for zero."
 
     |x t sh|
@@ -4382,33 +4397,33 @@
         sh := -32.
         [
             x := x bitOr: (t := x bitShift: sh).
-            sh := sh + sh. 
+            sh := sh + sh.
         ] doWhile: [t ~~ 0]
     ].
-    ^ x + 1 
-
-    "
-     0 nextPowerOf2    
-     1 nextPowerOf2    
-     2 nextPowerOf2    
-     3 nextPowerOf2    
-     4 nextPowerOf2    
-     5 nextPowerOf2    
-     6 nextPowerOf2    
-     7 nextPowerOf2    
-     8 nextPowerOf2    
+    ^ x + 1
+
+    "
+     0 nextPowerOf2
+     1 nextPowerOf2
+     2 nextPowerOf2
+     3 nextPowerOf2
+     4 nextPowerOf2
+     5 nextPowerOf2
+     6 nextPowerOf2
+     7 nextPowerOf2
+     8 nextPowerOf2
 
      22 nextPowerOf2
-     12 factorial nextPowerOf2  isPowerOf:2  
-     100 factorial nextPowerOf2  isPowerOf:2  
+     12 factorial nextPowerOf2  isPowerOf:2
+     100 factorial nextPowerOf2  isPowerOf:2
      1000 factorial nextPowerOf2  isPowerOf:2
      Time millisecondsToRun:[
          |v|
          v := 1000 factorial.
          1000 timesRepeat:[
-            v nextPowerOf2    
-         ]    
-     ]    
+            v nextPowerOf2
+         ]
+     ]
     "
 !
 
@@ -4447,14 +4462,14 @@
     ^ self bitCount odd
 
     "
-     0 parityOdd    
-     1 parityOdd    
-     2 parityOdd    
-     4 parityOdd    
-     5 parityOdd    
-     7 parityOdd    
-     33 parityOdd   
-     6 parityOdd    
+     0 parityOdd
+     1 parityOdd
+     2 parityOdd
+     4 parityOdd
+     5 parityOdd
+     7 parityOdd
+     33 parityOdd
+     6 parityOdd
 
      1 to:1000000 do:[:n |
         self assert:(n parityOdd = ((n printStringRadix:2) occurrencesOf:$1) odd).
@@ -4463,9 +4478,9 @@
      0 to:255 do:[:n |
         |p|
 
-        p := 
-            (((((((((n rightShift: 7) 
-            bitXor: (n rightShift: 6)) 
+        p :=
+            (((((((((n rightShift: 7)
+            bitXor: (n rightShift: 6))
                 bitXor: (n rightShift: 5))
                     bitXor: (n rightShift: 4))
                         bitXor: (n rightShift: 3))
@@ -4482,7 +4497,7 @@
 !Integer methodsFor:'special modulo arithmetic'!
 
 add_32:anInteger
-    "return a C-semantic 32bit sum of the receiver and the argument. 
+    "return a C-semantic 32bit sum of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns a signed 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
@@ -4512,7 +4527,7 @@
 !
 
 add_32u:anInteger
-    "return a C-semantic 32bit unsigned sum of the receiver and the argument. 
+    "return a C-semantic 32bit unsigned sum of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns an unsigned 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
@@ -4542,7 +4557,7 @@
 !
 
 mul_32:anInteger
-    "return a C-semantic 32bit product of the receiver and the argument. 
+    "return a C-semantic 32bit product of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns a signed 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
@@ -4572,7 +4587,7 @@
 !
 
 mul_32u:anInteger
-    "return a C-semantic 32bit unsigned product of the receiver and the argument. 
+    "return a C-semantic 32bit unsigned product of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns an unsigned 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
@@ -4602,7 +4617,7 @@
 !
 
 sub_32:anInteger
-    "return a C-semantic 32bit difference of the receiver and the argument. 
+    "return a C-semantic 32bit difference of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns a signed 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
@@ -4632,7 +4647,7 @@
 !
 
 sub_32u:anInteger
-    "return a C-semantic 32bit unsigned difference of the receiver and the argument. 
+    "return a C-semantic 32bit unsigned difference of the receiver and the argument.
      Both must be either Small- or LargeIntegers.
      Returns an unsigned 32bit number.
      This (nonstandard) specialized method is provided to allow simulation of
--- a/LongFloat.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/LongFloat.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1999 by eXept Software AG
 	      All Rights Reserved
@@ -1403,35 +1401,43 @@
     OBJ newFloat;
 
     if (__isFloatLike(n)) {
-	__threadErrno = 0;
-	rslt = LONG_pow(__longFloatVal(self), __floatVal(n));
+        __threadErrno = 0;
+        rslt = LONG_pow(__longFloatVal(self), __floatVal(n));
 # ifdef LONG_isnan
-	if (! LONG_isnan(rslt))
+        if (! LONG_isnan(rslt))
 # endif
-	{
-	    if (__threadErrno == 0) {
-		__qMKLFLOAT(newFloat, rslt);
-		RETURN ( newFloat );
-	    }
-	}
+        {
+            if (__threadErrno == 0) {
+                __qMKLFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
     }
 #else
     useFallBack = true;
 #endif
 %}.
     useFallBack notNil ifTrue:[
-	^ super raisedTo:aNumber
+        ^ super raisedTo:aNumber
+    ].
+
+    "/ the c-library pow functin, has a bug:
+    "/ it does not deal correctly with negative numbers. 
+    "/ I.e. it raises an error on -8^(1/3) instead of returning a negative -2
+    "/ work around with a kludge:
+    self < 0 ifTrue:[
+        ^ (self negated raisedTo:n) negated
     ].
 
     "
      an invalid argument (not convertable to float ?)
     "
     ^ self class
-	raise:#domainErrorSignal
-	receiver:self
-	selector:#raisedTo:
-	arguments:(Array with:aNumber)
-	errorString:'bad receiver/arg in raisedTo:'
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#raisedTo:
+        arguments:(Array with:aNumber)
+        errorString:'bad receiver/arg in raisedTo:'
 
     "Modified: / 16.11.2001 / 14:16:51 / cg"
 !
--- a/NonPositionableExternalStream.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/NonPositionableExternalStream.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -220,6 +218,18 @@
     "
      Stderr positionError
     "
+!
+
+writeError:errorNumber
+    "report an error, that some write error occured.
+     Redefined to care for writeErrors on stdout and stderr,
+     which happens under linux, if the console is closed while I am running.
+     In this case, we ignore the error."
+
+    ((self == Stderr) or:[self == Stdout]) ifTrue:[
+        ^ self
+    ].
+    super writeError:errorNumber
 ! !
 
 !NonPositionableExternalStream methodsFor:'initialization'!
--- a/Number.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Number.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1394,7 +1394,12 @@
     ^ self asFloat raisedTo:aNumber
 
     "
-     2 raisedTo: 4    
+     2 raisedTo: 4
+     -2 raisedTo: 4
+     4 raisedTo: 1/2
+     -4 raisedTo: 1/2
+     8 raisedTo: 1/3
+     -8 raisedTo: 1/3
      10 raisedTo: 4    
      10 raisedTo: -4    
     "
--- a/ProcessorScheduler.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/ProcessorScheduler.st	Sat Jan 23 07:23:05 2016 +0000
@@ -637,7 +637,7 @@
 dispatch
      "It handles timeouts and switches to the highest prio runnable process"
 
-    |any millis pri p nActions "{ Class: SmallInteger }"
+    |millis pri p nActions "{ Class: SmallInteger }"
      checkBlock sema wasBlocked|
 
     wasBlocked := OperatingSystem blockInterrupts.
@@ -646,7 +646,7 @@
      handle all timeout actions
     "
     anyTimeouts ifTrue:[
-	self evaluateTimeouts
+        self evaluateTimeouts
     ].
 
     "first do a quick check for semaphores using checkActions - this is needed for
@@ -656,45 +656,42 @@
      Also, this is needed for poor MSDOS, where WaitForObject does not work with
      sockets and pipes (sigh)
     "
-    any := false.
     nActions := readCheckArray size.
     1 to:nActions do:[:index |
-	checkBlock := readCheckArray at:index.
-	(checkBlock notNil and:[checkBlock value]) ifTrue:[
-	    sema := readSemaphoreArray at:index.
-	    sema notNil ifTrue:[
-		sema signalOnce.
-	    ].
-	    any := true.
-	]
+        checkBlock := readCheckArray at:index.
+        (checkBlock notNil and:[checkBlock value]) ifTrue:[
+            sema := readSemaphoreArray at:index.
+            sema notNil ifTrue:[
+                sema signalOnce.
+            ].
+        ]
     ].
     nActions := writeCheckArray size.
     1 to:nActions do:[:index |
-	checkBlock := writeCheckArray at:index.
-	(checkBlock notNil and:[checkBlock value]) ifTrue:[
-	    sema := writeSemaphoreArray at:index.
-	    sema notNil ifTrue:[
-		sema signalOnce.
-	    ].
-	    any := true.
-	]
+        checkBlock := writeCheckArray at:index.
+        (checkBlock notNil and:[checkBlock value]) ifTrue:[
+            sema := writeSemaphoreArray at:index.
+            sema notNil ifTrue:[
+                sema signalOnce.
+            ].
+        ]
     ].
 
     "now, someone might be runnable ..."
 
     p := self highestPriorityRunnableProcess.
     p isNil ifTrue:[
-	"/ no one runnable, hard wait for event or timeout
-	"/ Trace ifTrue:['w' printCR.].
-	self waitForEventOrTimeout.
-
-	"/ check for OS process termination
-	gotChildSignalInterrupt ifTrue:[
-	    gotChildSignalInterrupt := false.
-	    self handleChildSignalInterrupt
-	].
-	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-	^ self
+        "/ no one runnable, hard wait for event or timeout
+        "/ Trace ifTrue:['w' printCR.].
+        self waitForEventOrTimeout.
+
+        "/ check for OS process termination
+        gotChildSignalInterrupt ifTrue:[
+            gotChildSignalInterrupt := false.
+            self handleChildSignalInterrupt
+        ].
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+        ^ self
     ].
 
     pri := p priority.
@@ -725,13 +722,13 @@
 
 "
     pri < TimingPriority ifTrue:[
-	anyTimeouts ifTrue:[
-	    millis := self timeToNextTimeout.
-	    millis == 0 ifTrue:[
-		wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-		^ self
-	    ]
-	]
+        anyTimeouts ifTrue:[
+            millis := self timeToNextTimeout.
+            millis == 0 ifTrue:[
+                wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+                ^ self
+            ]
+        ]
     ].
 "
 
@@ -744,38 +741,38 @@
     pri < UserInterruptPriority ifTrue:[
 
 "comment out this if above is uncommented"
-	anyTimeouts ifTrue:[
-	    millis := self timeToNextTimeout.
-	    millis == 0 ifTrue:[
-		wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-		^ self
-	    ].
-	].
+        anyTimeouts ifTrue:[
+            millis := self timeToNextTimeout.
+            millis == 0 ifTrue:[
+                wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+                ^ self
+            ].
+        ].
 "---"
 
-	useIOInterrupts ifTrue:[
+        useIOInterrupts ifTrue:[
 "/            readFdArray do:[:fd |
 "/                (fd notNil and:[fd >= 0]) ifTrue:[
 "/                    OperatingSystem enableIOInterruptsOn:fd
 "/                ].
 "/            ].
-	] ifFalse:[
-	    millis notNil ifTrue:[
-		millis := millis min:EventPollingInterval
-	    ] ifFalse:[
-		millis := EventPollingInterval
-	    ]
-	]
+        ] ifFalse:[
+            millis notNil ifTrue:[
+                millis := millis min:EventPollingInterval
+            ] ifFalse:[
+                millis := EventPollingInterval
+            ]
+        ]
     ].
 
     millis notNil ifTrue:[
-	"/ Trace ifTrue:['C' print. millis printCR.].
-	"schedule a clock interrupt after millis milliseconds"
-	OperatingSystem enableTimer:millis rounded.
+        "/ Trace ifTrue:['C' print. millis printCR.].
+        "schedule a clock interrupt after millis milliseconds"
+        OperatingSystem enableTimer:millis rounded.
     ].
 
     scheduledProcesses notNil ifTrue:[
-	scheduledProcesses add:p
+        scheduledProcesses add:p
     ].
 
     "
@@ -787,17 +784,17 @@
     "/ Trace ifTrue:['<-' printCR.].
 
     "... when we arrive here, we are back on stage.
-	 Either by an ALARM or IO signal, or by a suspend of another process
+         Either by an ALARM or IO signal, or by a suspend of another process
     "
 
     millis notNil ifTrue:[
-	OperatingSystem disableTimer.
+        OperatingSystem disableTimer.
     ].
 
     "/ check for OS process termination
     gotChildSignalInterrupt ifTrue:[
-	gotChildSignalInterrupt := false.
-	self handleChildSignalInterrupt
+        gotChildSignalInterrupt := false.
+        self handleChildSignalInterrupt
     ].
 
     "/ check for new input
@@ -805,8 +802,8 @@
     OperatingSystem unblockInterrupts.
 
     (gotIOInterrupt or:[useIOInterrupts not]) ifTrue:[
-	gotIOInterrupt := false.
-	self checkForIOWithTimeout:0.
+        gotIOInterrupt := false.
+        self checkForIOWithTimeout:0.
     ].
 
     wasBlocked ifTrue:[OperatingSystem blockInterrupts].
@@ -3368,9 +3365,8 @@
                         self disableSemaphore:sema.
                     ].
                 ].
-                action notNil ifTrue:[
-                    action value.
-                    newProcessMaybeReady := true
+                (action notNil and:[action value]) ifTrue:[
+                    newProcessMaybeReady := true.
                 ].
             ].
             nReady := nReady - 1.
@@ -3395,10 +3391,9 @@
                         self disableSemaphore:sema.
                     ].
                 ].
-                action notNil ifTrue:[
-                    action value.
-                    newProcessMaybeReady := true
-                ]
+                (action notNil and:[action value]) ifTrue:[
+                    newProcessMaybeReady := true.
+                ].
             ].
             nReady := nReady - 1.
             readyIndex := readyIndex + 1.
--- a/ProgrammingLanguage.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/ProgrammingLanguage.st	Sat Jan 23 07:23:05 2016 +0000
@@ -171,16 +171,21 @@
 allDo: aBlock
     ^ self allSubclassesDo: [:each | aBlock value: each instance]
 
+    "
+     ProgrammingLanguage allDo:[:l | Transcript showCR:l ]
+    "
+    
     "Created: / 16-08-2009 / 14:07:40 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
 !ProgrammingLanguage class methodsFor:'private'!
 
 instancesDetect: detectBlock ifNone: failBlock
-
-
-    self allSubclasses 
-        do:[:cls|(detectBlock value: cls instance) ifTrue:[^cls instance]].
+    self allSubclasses do:[:cls|
+        |inst|
+        inst := cls instance.
+        (detectBlock value:inst) ifTrue:[^inst]
+    ].
     ^failBlock value
 
     "Created: / 16-08-2009 / 10:57:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
--- a/SequenceableCollection.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/SequenceableCollection.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1190,8 +1190,10 @@
 !
 
 remove:anElement ifAbsent:aBlock
-    "search for an object which is equal to anElement;
-     if found remove and return it; if not, return the value from evaluating aBlock.
+    "search for the first occurrrence of object 
+     (i.e. which is equal to anElement)
+     If found remove and return it; 
+     if not, return the value from evaluating aBlock.
      Use equality compare (=) to search for an occurrence.
 
      Notice, that this is modifies the receiver NOT a copy.
@@ -1199,26 +1201,28 @@
      due to the grow:-message, which is inefficient for fixed size
      collections (i.e. for Strings and Arrays it is not recommened)."
 
-    |any
+    |any foundElement
      dstIndex "{ Class: SmallInteger }"
      sz       "{ Class: SmallInteger }"|
 
-    dstIndex := 1.
     any := false.
     sz := self size.
     1 to:sz do:[:srcIndex |
-	(anElement = (self at:srcIndex)) ifTrue:[
-	    any := true
-	] ifFalse:[
-	    (dstIndex ~~ srcIndex) ifTrue:[
-		self at:dstIndex put:(self at:srcIndex)
-	    ].
-	    dstIndex := dstIndex + 1
-	]
+        any ifFalse:[
+            "/ still searching
+            (anElement = (foundElement := self at:srcIndex)) ifTrue:[
+                any := true.
+                dstIndex := srcIndex.
+            ]    
+        ] ifTrue:[
+            "/ already copying
+            self at:dstIndex put:(self at:srcIndex).
+            dstIndex := dstIndex + 1
+        ]
     ].
     any ifTrue:[
-	self grow:dstIndex - 1.
-	^ anElement
+        self grow:dstIndex - 1.
+        ^ foundElement
     ].
     ^ aBlock value
 
@@ -1227,6 +1231,16 @@
      #(1 2 3 4 5 6 7 8 9 0) remove:99 ifAbsent:[#oops]
      #(1.0 2.0 3.0 4.0 5.0) remove:5 ifAbsent:[#oops]
      #(1.0 2.0 3.0 4.0 5.0) removeIdentical:5 ifAbsent:[#oops]
+
+     |a|
+     a := #(1 2 3 1 2 3 1 2 3).
+     a remove:3.
+     a
+
+     |a|
+     a := #(1 2 3 1 2 3 1 2 3) asOrderedCollection.
+     a remove:3.
+     a
     "
 
     "Modified: 1.2.1997 / 11:49:01 / cg"
@@ -1378,27 +1392,28 @@
      due to the grow:-message, which is inefficient for fixed size
      collections (i.e. for Strings and Arrays it is not recommened)."
 
-    |any el
+    |any
      dstIndex "{ Class: SmallInteger }"
      sz       "{ Class: SmallInteger }"|
 
-    dstIndex := 1.
     any := false.
     sz := self size.
     1 to:sz do:[:srcIndex |
-	el := self at:srcIndex.
-	(anElement == el) ifTrue:[
-	    any := true
-	] ifFalse:[
-	    (dstIndex ~~ srcIndex) ifTrue:[
-		self at:dstIndex put:el
-	    ].
-	    dstIndex := dstIndex + 1
-	]
+        any ifFalse:[
+            "/ still searching
+            (anElement == (self at:srcIndex)) ifTrue:[
+                any := true.
+                dstIndex := srcIndex.
+            ]    
+        ] ifTrue:[
+            "/ already copying
+            self at:dstIndex put:(self at:srcIndex).
+            dstIndex := dstIndex + 1
+        ]
     ].
     any ifTrue:[
-	self grow:dstIndex - 1.
-	^ anElement
+        self grow:dstIndex - 1.
+        ^ anElement
     ].
     ^ aBlock value
 
--- a/Set.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Set.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
@@ -382,7 +380,7 @@
 !
 
 remove:oldObjectArg ifAbsent:exceptionBlock
-    "remove oldObject from the collection and return it.
+    "remove the first occurrence of oldObject from the collection and return it.
      If it was not in the collection return the value of exceptionBlock.
      Notice, that the returned object could be non-identical to the argument
      (although it will always be equal).
@@ -1342,11 +1340,11 @@
 !Set class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.134 2015-06-08 19:22:24 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.134 2015-06-08 19:22:24 cg Exp $'
+    ^ '$Header$'
 ! !
 
 
--- a/SmallInteger.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/SmallInteger.st	Sat Jan 23 07:23:05 2016 +0000
@@ -961,6 +961,7 @@
 ! !
 
 
+
 !SmallInteger methodsFor:'bit operators'!
 
 bitAnd:anInteger
@@ -987,6 +988,7 @@
 bitClear:anInteger
     "return the bitwise-and of the receiver and the complement of the argument, anInteger,
      returning the receiver with bits of the argument cleared.
+     (i.e. the same as self bitAnd:aMaskInteger bitInvert).
      The method's name may be misleading: the receiver is not changed,
      but a new number is returned. Should be named #withBitCleared:"
 
@@ -996,7 +998,7 @@
 #else
     /* anding the tags doesn't change it */
     if (__isSmallInteger(anInteger)) {
-	RETURN ( ((OBJ) (((INT)self & ~(INT)anInteger) | TAG_INT)) );
+        RETURN ( ((OBJ) (((INT)self & ~(INT)anInteger) | TAG_INT)) );
     }
 #endif /* not __SCHTEAM__ */
 %}.
@@ -1005,6 +1007,8 @@
     "
      (2r001010100 bitClear:2r00001111) radixPrintStringRadix:2
      (2r111111111 bitClear:2r00001000) radixPrintStringRadix:2
+
+     (2r001010100 bitAnd:2r00001111 bitInvert) radixPrintStringRadix:2
     "
 !
 
@@ -1194,6 +1198,34 @@
     ^ super bitInvert
 !
 
+bitInvertByte
+    "return a new integer, where the low 8 bits are masked and complemented.
+     This returns an unsigned version of what bitInvert would return.
+     (i.e. same as self bitInvert bitAnd:16rFF)"
+
+%{  /* NOCONTEXT */
+#ifdef __SCHTEAM__
+    long _self = self.longValue();
+    return __c__._RETURN( STInteger._new( ~_self & 0xFF) );
+#else
+    /* invert anything except tag bits */
+    RETURN ( (OBJ) (((INT)self ^ ~TAG_MASK) & (INT)(__mkSmallInteger(0xFF))) );
+#endif /* not __SCHTEAM__ */
+%}.
+    ^ super bitInvertByte
+    
+    "
+     16r7f bitInvert
+     16r7f bitInvertByte
+
+     16r80 bitInvert
+     16r80 bitInvertByte
+
+     16rff bitInvert
+     16rff bitInvertByte
+    "
+!
+
 bitOr:anInteger
     "return the bitwise-or of the receiver and the argument, anInteger"
 
--- a/SortedCollection.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/SortedCollection.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -956,7 +954,9 @@
 !
 
 max
-    "Return the largest element."
+    "return the maximum value in the receiver collection,
+     redefined, since this can be easily computed.
+     Raises an error, if the receiver is empty."
 
     sortBlock == DefaultSortBlock ifTrue:[
         ^ self last
@@ -965,11 +965,15 @@
 
     "
      #(10 35 20 45 30 5) asSortedCollection max 
+     #(10 35 20 45 30 5) max 
+     #() asSortedCollection max 
     "
 !
 
 min
-    "Return the smallest element."
+    "return the minimum value in the receiver collection,
+     redefined, since this can be easily computed.
+     Raises an error, if the receiver is empty."
 
     sortBlock == DefaultSortBlock ifTrue:[
         ^ self first
@@ -978,6 +982,27 @@
 
     "
      #(10 35 20 45 30 5) asSortedCollection min
+     #(10 35 20 45 30 5) min
+    "
+!
+
+minMax
+    "return the minimum and maximum values in the receiver collection
+     as a two element array, using #< to compare elements.
+     Raises an error, if the receiver is empty."
+
+    "return the minimum value in the receiver collection,
+     redefined, since this can be easily computed.
+     Raises an error, if the receiver is empty."
+
+    sortBlock == DefaultSortBlock ifTrue:[
+        ^ { self first . self last }
+    ].
+    ^ super minMax
+
+    "
+     #(10 35 20 45 30 5) asSortedCollection minMax
+     #(10 35 20 45 30 5) minMax
     "
 !
 
--- a/Stream.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/Stream.st	Sat Jan 23 07:23:05 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -216,6 +214,7 @@
     ^ ChunkSeparator
 ! !
 
+
 !Stream methodsFor:'Compatibility-Dolphin'!
 
 display:someObject
@@ -1832,7 +1831,7 @@
     "
         ((WriteStream on:Unicode16String new)
             nextPutUtf16:$B;
-            nextPutUtf16:$Ä; 
+            nextPutUtf16:$Ä; 
             nextPutUtf16:(Character codePoint:16r10CCCC)
             yourself) contents
     "
@@ -1895,7 +1894,7 @@
     "
       (String streamContents:[:s| 
             s nextPutUtf8:$a.
-            s nextPutUtf8:$ü.
+            s nextPutUtf8:$ü.
             s nextPutUtf8: (Character value:16r1fff).
             s nextPutUtf8: (Character value:16rffff).
             s nextPutUtf8: (Character value:16r1ffffff).
@@ -3353,6 +3352,14 @@
     "put all elements of the argument, aCollection onto the receiver.
      This is only allowed, if the receiver supports writing."
 
+    (aCollection notNil and:[aCollection isSequenceable]) ifFalse:[
+        "/ fallback
+        aCollection do:[:eachElement|    
+            self nextPut:eachElement.
+        ].
+         ^ self.
+    ].
+
     self nextPutAll:aCollection startingAt:1 to:aCollection size
 
     "
--- a/UserPreferences.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/UserPreferences.st	Sat Jan 23 07:23:05 2016 +0000
@@ -4954,6 +4954,32 @@
     "
 !
 
+debuggerLogFile
+    "if non nil, any entered debugger writes a backrace to that logfile.
+     This is useful to record all session-problems"
+     
+    ^ self at:#debuggerLogFile ifAbsent:nil
+
+    "
+     UserPreferences current debuggerLogFile
+     UserPreferences current debuggerLogFile:'debug.log'
+     UserPreferences current debuggerLogFile:nil
+    "
+!
+
+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
+
+    "
+     UserPreferences current debuggerLogFile
+     UserPreferences current debuggerLogFile:'debug.log'
+     UserPreferences current debuggerLogFile:nil
+    "
+!
+
 editToolbarVisibleInWorkspace
     "return the flag which defaults the edit-toolbar-visibility in a workspace application"
 
--- a/WeakValueDictionary.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/WeakValueDictionary.st	Sat Jan 23 07:23:05 2016 +0000
@@ -62,19 +62,18 @@
 !WeakValueDictionary methodsFor:'adding & removing'!
 
 at:key ifAbsent:somethingRespondingToValue
-    "
-     Redefined to block interrupts, to avoid trouble when dependencies
-     are added within interrupting high prio processes.
-    "
+    "Redefined to block interrupts, to avoid trouble when dependencies
+     are added within interrupting high prio processes."
 
     |ret|
 
     [
-	ret := super at:key ifAbsent:[^ somethingRespondingToValue value].
-	ret class == SmallInteger ifTrue:[
-	    ret := somethingRespondingToValue value
-	].
+        ret := super at:key ifAbsent:somethingRespondingToValue.
     ] valueUninterruptably.
+
+    ret class == SmallInteger ifTrue:[
+        ret := somethingRespondingToValue value
+    ].
     ^ ret
 !
 
--- a/WeakValueIdentityDictionary.st	Thu Jan 21 17:58:19 2016 +0000
+++ b/WeakValueIdentityDictionary.st	Sat Jan 23 07:23:05 2016 +0000
@@ -9,8 +9,9 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+"{ Package: 'stx:libbasic' }"
 
-"{ Package: 'stx:libbasic' }"
+"{ NameSpace: Smalltalk }"
 
 IdentityDictionary subclass:#WeakValueIdentityDictionary
 	instanceVariableNames:''
@@ -70,14 +71,14 @@
     |ret|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super at:key put:anObject
+        "/ already blocked
+        ^ super at:key put:anObject
     ].
 
     [
-	ret := super at:key put:anObject.
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
+        ret := super at:key put:anObject.
+    ] ensure:[
+        OperatingSystem unblockInterrupts
     ].
     ^ ret
 
@@ -99,14 +100,14 @@
     |ret|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super removeKey:aKey ifAbsent:aBlock
+        "/ already blocked
+        ^ super removeKey:aKey ifAbsent:aBlock
     ].
 
     [
-	ret := super removeKey:aKey ifAbsent:aBlock
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
+        ret := super removeKey:aKey ifAbsent:aBlock
+    ] ensure:[
+        OperatingSystem unblockInterrupts
     ].
     ^ ret
 
@@ -127,14 +128,14 @@
     |ret|
 
     (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super removeValue:aKey ifAbsent:aBlock
+        "/ already blocked
+        ^ super removeValue:aKey ifAbsent:aBlock
     ].
 
     [
-	ret := super removeValue:aKey ifAbsent:aBlock
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
+        ret := super removeValue:aKey ifAbsent:aBlock
+    ] ensure:[
+        OperatingSystem unblockInterrupts
     ].
     ^ ret.
 
@@ -251,7 +252,7 @@
 !WeakValueIdentityDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakValueIdentityDictionary.st,v 1.4 2006/03/06 10:04:38 cg Exp $'
+    ^ '$Header$'
 ! !