Merge jv
authorMerge Script
Mon, 20 Apr 2015 06:40:26 +0200
branchjv
changeset 18237 8457ae63fa44
parent 18225 420aa3ffe9a8 (current diff)
parent 18236 f5b870afebf4 (diff)
child 18247 3c81bb9bbaea
Merge
AbstractOperatingSystem.st
ExternalLibraryFunction.st
Integer.st
LargeInteger.st
Object.st
SmallInteger.st
String.st
UnixOperatingSystem.st
--- a/AbstractOperatingSystem.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/AbstractOperatingSystem.st	Mon Apr 20 06:40:26 2015 +0200
@@ -5998,6 +5998,13 @@
 %{  /* NOCONTEXT */
     unsigned INT low, high;
 
+#ifdef __x86_64__
+# if defined(__GCC__)
+    asm volatile("rdtsc" : "=a"(low), "=d"(high));
+    RETURN ( __MKUINT(low + (high << 32)) );
+# endif
+#endif
+
 #ifdef i386
     // use RDTSC instruction (retrieves 64bit cycle count; hi in EDX, lo in EAX)
 
@@ -6007,21 +6014,16 @@
     _asm { mov low,eax };
     _asm { mov high,edx };
     _asm { pop edx };
-# elif defined(__MINGW_H) || defined(__GNUC__)
+# else
+#  if defined(__MINGW_H) || defined(__GNUC__)
     asm volatile("rdtsc" : "=a"(low), "=d"(high));
-# else
+#  else
     goto unsupported;
+#  endif
 # endif
     RETURN ( __MKLARGEINT64(1, low, high) );
 #endif /* i386 */
 
-#ifdef __x86_64__
-# if defined(__GCC__)
-    asm volatile("rdtsc" : "=a"(low), "=d"(high));
-    RETURN ( __MKUINT(low + (high << 32)) );
-# endif
-#endif
-
 unsupported: ;
 %}.
     self primitiveFailed:'no CPU cycle register on this architecture'
@@ -7724,11 +7726,11 @@
 !AbstractOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.296 2015-04-07 10:21:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.297 2015-04-19 09:46:54 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.296 2015-04-07 10:21:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.297 2015-04-19 09:46:54 cg Exp $'
 ! !
 
 
--- a/ExternalLibraryFunction.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/ExternalLibraryFunction.st	Mon Apr 20 06:40:26 2015 +0200
@@ -230,20 +230,24 @@
 
     DLLPATH isNil ifTrue:[
 	DLLPATH := #('.').
-	FLAG_VIRTUAL := %{ __MKSMALLINT(__EXTL_FLAG_VIRTUAL) %}.                "/ a virtual c++ call
-	FLAG_NONVIRTUAL := %{ __MKSMALLINT(__EXTL_FLAG_NONVIRTUAL) %}.          "/ a non-virtual c++ call
-	FLAG_OBJECTIVEC := %{ __MKSMALLINT(__EXTL_FLAG_OBJECTIVEC) %}.          "/ an objectiveC message send
-	FLAG_UNLIMITEDSTACK := %{ __MKSMALLINT(__EXTL_FLAG_UNLIMITEDSTACK) %}.  "/ unlimitedstack under unix
-	FLAG_ASYNC := %{ __MKSMALLINT(__EXTL_FLAG_ASYNC) %}.                    "/ async under win32
-	FLAG_RETVAL_IS_CONST := %{ __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST) %}."/ return value is not to be registered for finalization
+%{
+#ifndef __JAVA__
+	@global(FLAG_VIRTUAL) = __MKSMALLINT(__EXTL_FLAG_VIRTUAL);                  // a virtual c++ call
+	@global(FLAG_NONVIRTUAL) = __MKSMALLINT(__EXTL_FLAG_NONVIRTUAL);            // a non-virtual c++ call
+	@global(FLAG_OBJECTIVEC) = __MKSMALLINT(__EXTL_FLAG_OBJECTIVEC);            // an objectiveC message send
+	@global(FLAG_UNLIMITEDSTACK) = __MKSMALLINT(__EXTL_FLAG_UNLIMITEDSTACK);    // unlimitedstack under unix
+	@global(FLAG_ASYNC) = __MKSMALLINT(__EXTL_FLAG_ASYNC);                      // async under win32
+	@global(FLAG_RETVAL_IS_CONST) = __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST);  // return value is not to be registered for finalization
 
-	CALLTYPE_API := %{ __MKSMALLINT(__EXTL_CALLTYPE_API) %}.                "/ WINAPI-call (win32 only)
-	CALLTYPE_C := %{ __MKSMALLINT(__EXTL_CALLTYPE_C) %}.                    "/ regular C-call (the default)
-	CALLTYPE_V8 := %{ __MKSMALLINT(__EXTL_CALLTYPE_V8) %}.                  "/ v8 call (sparc only)
-	CALLTYPE_V9 := %{ __MKSMALLINT(__EXTL_CALLTYPE_V9) %}.                  "/ v9 call (sparc only)
-	CALLTYPE_UNIX64 := %{ __MKSMALLINT(__EXTL_CALLTYPE_UNIX64) %}.          "/ unix64 call (alpha only)
+	@global(CALLTYPE_API) = __MKSMALLINT(__EXTL_CALLTYPE_API);                  // WINAPI-call (win32 only)
+	@global(CALLTYPE_C) = __MKSMALLINT(__EXTL_CALLTYPE_C);                      // regular C-call (the default)
+	@global(CALLTYPE_V8) = __MKSMALLINT(__EXTL_CALLTYPE_V8);                    // v8 call (sparc only)
+	@global(CALLTYPE_V9) = __MKSMALLINT(__EXTL_CALLTYPE_V9);                    // v9 call (sparc only)
+	@global(CALLTYPE_UNIX64) = __MKSMALLINT(__EXTL_CALLTYPE_UNIX64);            // unix64 call (alpha only)
 
-	CALLTYPE_MASK := %{ __MKSMALLINT(__EXTL_CALLTYPE_MASK) %}.
+	@global(CALLTYPE_MASK) = __MKSMALLINT(__EXTL_CALLTYPE_MASK);
+#endif
+%}
     ].
 
     "
@@ -1689,7 +1693,7 @@
 !ExternalLibraryFunction class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.95 2013-03-29 15:05:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.96 2015-04-19 09:45:21 cg Exp $'
 !
 
 version_SVN
--- a/Integer.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/Integer.st	Mon Apr 20 06:40:26 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
               All Rights Reserved
@@ -430,7 +432,7 @@
      stopOnSeparator finish|
 
     romanValues := Dictionary
-                    withKeys:#($M $D $C $L $X $V $I)
+                    withKeys:'MDCLXVI' "/ #($M $D $C $L $X $V $I)
                     andValues:#(1000 500 100 50 10 5 1).
 
     (stopOnSeparator := aStringOrStream isStream) ifFalse:[
@@ -820,6 +822,7 @@
     "
 ! !
 
+
 !Integer class methodsFor:'prime numbers'!
 
 flushPrimeCache
@@ -3032,7 +3035,7 @@
     ^ fibUsingDict value:self
 
     "the running time is mostly dictated by the LargeInteger multiplication performance...
-     (therefore, we get O² execution times, even for a linear number of multiplications)
+     (therefore, we get O² execution times, even for a linear number of multiplications)
 
      Time millisecondsToRun:[50000 fib_iterative]  312    (DUO 1.7Ghz CPU)
      Time millisecondsToRun:[50000 fib_helper]     109
@@ -4390,6 +4393,7 @@
     "Created: / 09-01-2012 / 17:18:06 / cg"
 ! !
 
+
 !Integer methodsFor:'special modulo arithmetic'!
 
 add_32:anInteger
@@ -5118,11 +5122,11 @@
 !Integer class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.308 2015-02-18 14:40:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.309 2015-04-19 10:17:10 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.308 2015-02-18 14:40:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.309 2015-04-19 10:17:10 cg Exp $'
 ! !
 
 
--- a/LargeInteger.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/LargeInteger.st	Mon Apr 20 06:40:26 2015 +0200
@@ -40,7 +40,7 @@
 
 documentation
 "
-    This class provides arbitrary precision integers. 
+    This class provides arbitrary precision integers.
     These are represented as:
       sign (-1/0/+1) and, if sign ~~ 0
       the absolute value in a ByteArray of digits with 8 bits per element;
@@ -55,9 +55,9 @@
     Also, results of LargeInteger operations are converted to back to
     SmallIntegers, when possible (see #compressed).
 
-    In contrast to ST-80, there is only one class for LargeIntegers, 
-    which keeps the sign as an instance variable 
-    (ST-80 has LargePositiveInteger and LargeNegativeInteger). 
+    In contrast to ST-80, there is only one class for LargeIntegers,
+    which keeps the sign as an instance variable
+    (ST-80 has LargePositiveInteger and LargeNegativeInteger).
     Another possible change is to use 2's complement instead of sign-magnitude
     representation, and to use the underlying CPU's native byte order (instead of LSB).
     This would allow us to use modern CPU vector/longword operations, at least for 64 and
@@ -66,12 +66,12 @@
     change in the future.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Number
-        Float Fraction FixedPoint
-        SmallInteger
+	Number
+	Float Fraction FixedPoint
+	SmallInteger
 "
 !
 
@@ -259,9 +259,9 @@
     |digits|
 
     msb == false ifTrue:[
-        digits := aByteArrayOfDigits
+	digits := aByteArrayOfDigits
     ] ifFalse:[
-        digits := aByteArrayOfDigits reversed
+	digits := aByteArrayOfDigits reversed
     ].
     ^ self basicNew setDigits:digits
 
@@ -479,16 +479,16 @@
 
 // aNumber
     "return the integer part of the quotient of the receivers value
-     and the arguments value. 
+     and the arguments value.
      The result is truncated toward negative infinity
      and will be negative, if the operands signs differ.
      The following is always true:
-        (receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
+	(receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     Especially surprising:     
-        -1 // 10 -> -1 (because -(1/10) is truncated towards next smaller integer, which is -1.
-        -10 // 3 -> -4 (because -(10/3) is truncated towards next smaller integer, which is -4.
+     Especially surprising:
+	-1 // 10 -> -1 (because -(1/10) is truncated towards next smaller integer, which is -1.
+	-10 // 3 -> -4 (because -(10/3) is truncated towards next smaller integer, which is -4.
 
      See #quo: which returns -2 in the above case and #rem: which is the corresponding remainder."
 
@@ -502,38 +502,38 @@
      Use a special method for this case ...
     "
     (cls == SmallInteger) ifTrue:[
-        abs := aNumber.
-        abs := abs abs.
-        (abs between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
-            divMod := self absFastDivMod:abs.
-        ] ifFalse:[
-            n := abs asLargeInteger.
-        ].
+	abs := aNumber.
+	abs := abs abs.
+	(abs between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
+	    divMod := self absFastDivMod:abs.
+	] ifFalse:[
+	    n := abs asLargeInteger.
+	].
     ] ifFalse:[
-        "
-         if the argument is not a largeInteger, coerce
-        "
-        (cls == self class) ifFalse:[
-            ^ self retry:#// coercing:aNumber
-        ].
-        n := aNumber
+	"
+	 if the argument is not a largeInteger, coerce
+	"
+	(cls == self class) ifFalse:[
+	    ^ self retry:#// coercing:aNumber
+	].
+	n := aNumber
     ].
 
     divMod isNil ifTrue:[
-        divMod := self absDivMod:n.
+	divMod := self absDivMod:n.
     ].
     quo := divMod at:1.
     (sign == aNumber sign) ifFalse:[
-        "/ adjust for truncation if negative and there is a remainder ...
-        "/ be careful: there is one special case to care for here:
-        "/ if quo is maxInt+1, the negation can be represented as a smallInt.
-        quo := quo sign:-1.
-        (divMod at:2) == 0 ifFalse:[
-            ^ quo - 1
-        ].
-        quo digitLength == SmallInteger maxBytes ifTrue:[
-            ^ quo compressed
-        ].
+	"/ adjust for truncation if negative and there is a remainder ...
+	"/ be careful: there is one special case to care for here:
+	"/ if quo is maxInt+1, the negation can be represented as a smallInt.
+	quo := quo sign:-1.
+	(divMod at:2) == 0 ifFalse:[
+	    ^ quo - 1
+	].
+	quo digitLength == SmallInteger maxBytes ifTrue:[
+	    ^ quo compressed
+	].
     ].
     ^ quo
 
@@ -566,19 +566,19 @@
 
 \\ aNumber
     "Answer the integer remainder m defined by division with truncation toward
-     negative infinity. 
+     negative infinity.
      m < |aNumber| AND there is an integer k with (k * aNumber + m) = self
 
      The returned remainder has the same sign as aNumber.
      The following is always true:
-        (receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
+	(receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     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,
-                        and -4 * 4 gives -12, so we need to add 2 to get the original -10.
+     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,
+			and -4 * 4 gives -12, so we need to add 2 to get the original -10.
 
      See #rem: which is the corresponding remainder for division via #quo:.
 
@@ -587,11 +587,11 @@
     |abs rem negativeDivisor|
 
     aNumber negative ifTrue:[
-        negativeDivisor := true.
-        abs := aNumber negated.
+	negativeDivisor := true.
+	abs := aNumber negated.
     ] ifFalse:[
-        negativeDivisor := false.
-        abs := aNumber.
+	negativeDivisor := false.
+	abs := aNumber.
     ].
 
     "
@@ -599,33 +599,33 @@
      Use a special method for this case ...
     "
     (aNumber class == SmallInteger) ifTrue:[
-        (abs between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
-            rem := (self absFastDivMod:abs) at:2.
-        ] ifFalse:[
-            rem := self absMod:abs asLargeInteger
-        ].
+	(abs between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
+	    rem := (self absFastDivMod:abs) at:2.
+	] ifFalse:[
+	    rem := self absMod:abs asLargeInteger
+	].
     ] ifFalse:[
-        "
-         if the argument is not a largeInteger, coerce
-        "
-        (aNumber class == self class) ifFalse:[
-            ^ self retry:#\\ coercing:aNumber
-        ].
-
-        rem := self absMod:abs.
+	"
+	 if the argument is not a largeInteger, coerce
+	"
+	(aNumber class == self class) ifFalse:[
+	    ^ self retry:#\\ coercing:aNumber
+	].
+
+	rem := self absMod:abs.
     ].
 
     rem = 0 ifFalse:[
-        negativeDivisor ifTrue:[
-            rem := rem sign:-1
-        ].
-        (self negative ~~ negativeDivisor) ifTrue:[
-            "different sign, so remainder would have been negative.
-             rem has been rounded toward zero, this code will simulate
-             rounding to negative infinity."
-
-            rem := aNumber - rem.
-        ].
+	negativeDivisor ifTrue:[
+	    rem := rem sign:-1
+	].
+	(self negative ~~ negativeDivisor) ifTrue:[
+	    "different sign, so remainder would have been negative.
+	     rem has been rounded toward zero, this code will simulate
+	     rounding to negative infinity."
+
+	    rem := aNumber - rem.
+	].
     ].
     ^ rem
 
@@ -669,44 +669,44 @@
 !
 
 divMod:aNumber
-    "return an array filled with 
-        (self // aNumber) and (self \\ aNumber).
+    "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
+	(receiver // something) * something + (receiver \\ something) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     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,
-                        and -4 * 4 gives -12, so we need to add 2 to get the original -10.
-
-     This is redefined here for more performance 
+     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,
+			and -4 * 4 gives -12, so we need to add 2 to get the original -10.
+
+     This is redefined here for more performance
      (as the remainder is generated as a side effect of division)"
 
     |cls n|
 
     ((self < 0) or:[aNumber <= 0]) ifTrue:[
-        ^ super divMod:aNumber
+	^ super divMod:aNumber
     ].
 
     "/ only handle the common case here
     cls := aNumber class.
     (cls == SmallInteger) ifTrue:[
-        "
-         this is the common case, dividing by a SmallInteger.
-         Use a special method for this case ...
-        "
-        (aNumber between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
-            ^ self absFastDivMod:aNumber abs.
-        ].
-        n := aNumber asLargeInteger.
+	"
+	 this is the common case, dividing by a SmallInteger.
+	 Use a special method for this case ...
+	"
+	(aNumber between:1 and:(SmallInteger maxBytes == 8 ifTrue:16r00ffffffffff ifFalse:16r00ffffff)) ifTrue:[
+	    ^ self absFastDivMod:aNumber abs.
+	].
+	n := aNumber asLargeInteger.
     ] ifFalse:[
-        (cls == self class) ifFalse:[
-            ^ super divMod:aNumber
-        ].
-        n := aNumber.
+	(cls == self class) ifFalse:[
+	    ^ super divMod:aNumber
+	].
+	n := aNumber.
     ].
 
     ^ self absDivMod:n abs.
@@ -1552,6 +1552,11 @@
 digitAt:index
     "return 8 bits of value, starting at byte index"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).digitAt( index.intValue() ) );
+#endif
+%}.
     index > digitByteArray size ifTrue:[^ 0].
     ^ digitByteArray at:index
 !
@@ -1559,6 +1564,11 @@
 digitAt:index put:aByte
     "set the 8 bits, index is a byte index"
 
+%{
+#ifdef __JAVA__
+    ERROR("cannot modify the digits of a LargeInteger");
+#endif
+%}.
     digitByteArray at:index put:aByte
 !
 
@@ -1568,6 +1578,12 @@
      for negative ones, the actual bit representation is returned."
 
     |t digits|
+
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).digitByteAt( index.intValue() ) );
+#endif
+%}.
     sign >= 0 ifTrue:[
 	index > digitByteArray size ifTrue:[
 	    ^ 0
@@ -1598,6 +1614,11 @@
      (8 bits of the absolute value per element).
      Least significant byte is first!!"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).digitBytes() );
+#endif
+%}.
     ^ digitByteArray
 
     "Modified: / 5.5.1999 / 14:57:03 / stefan"
@@ -1637,6 +1658,11 @@
     "
     |l "{ Class: SmallInteger }" |
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).digitLength() );
+#endif
+%}.
     l := digitByteArray size.
     [l ~~ 0 and:[(digitByteArray at:l) == 0]] whileTrue:[
 	l := l - 1.
@@ -5363,6 +5389,11 @@
 negative
     "return true, if the receiver is < 0"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).largeValue.signum() < 0 ? STObject.True : STObject.False);
+#endif
+%}.
     ^ (sign < 0)
 !
 
@@ -5377,28 +5408,42 @@
 positive
     "return true, if the receiver is >= 0"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).largeValue.signum() >= 0 ? STObject.True : STObject.False);
+#endif
+%}.
     ^ (sign >= 0)
 !
 
 sign
     "return the sign of the receiver (-1, 0 or 1)"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( STInteger._new( ((STLargeInteger)self).largeValue.signum() ));
+#endif
+%}.
     ^ sign
 !
 
 strictlyPositive
     "return true, if the receiver is > 0"
 
+%{
+#ifdef __JAVA__
+    return context._RETURN( ((STLargeInteger)self).largeValue.signum() > 0 ? STObject.True : STObject.False);
+#endif
+%}.
     ^ (sign > 0)
 ! !
 
 !LargeInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.223 2015-03-25 14:12:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.224 2015-04-19 22:31:45 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.223 2015-03-25 14:12:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.224 2015-04-19 22:31:45 cg Exp $'
 ! !
-
--- a/Object.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/Object.st	Mon Apr 20 06:40:26 2015 +0200
@@ -2054,8 +2054,11 @@
 	- redefining it may not work as expected."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( (self == context.stArg(0)) ? STObject.True : STObject.False );
+#else
     RETURN ( (self == anObject) ? true : false );
+#endif
 %}
 !
 
@@ -2278,7 +2281,11 @@
 	- redefining it may not work as expected."
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( (self == context.stArg(0)) ? STObject.False : STObject.True );
+#else
     RETURN ( (self == anObject) ? false : true );
+#endif
 %}
 ! !
 
@@ -5471,44 +5478,46 @@
     <resource: #skipInDebuggersWalkBack>
 
 %{
+#ifdef __JAVA__
+#else
     REGISTER OBJ sel = aSelector;
     int hash0;
 
     if (InterruptPending == nil) {
 	struct inlineCache *pIlc;
 
-#define nways 2
-#define nilcs 131
-
-#define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF0(l) , __ILCPERF0(l) } , 0 }
-#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
-#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
-#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
-#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
-#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
-#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
-
-#define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
+# define nways 2
+# define nilcs 131
+
+# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF0(l) , __ILCPERF0(l) } , 0 }
+# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
+# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
+# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
+# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
+# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
+# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
+
+# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
 
 	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
 
-#undef SEL_AND_ILC_INIT_1
-#undef SEL_AND_ILC_INIT_2
-#undef SEL_AND_ILC_INIT_4
-#undef SEL_AND_ILC_INIT_8
-#undef SEL_AND_ILC_INIT_16
-#undef SEL_AND_ILC_INIT_32
-#undef SEL_AND_ILC_INIT_64
-#undef SEL_AND_ILC_INIT_128
-#undef SEL_AND_ILC_INIT_256
-
-#undef SEL_AND_ILC_INIT_131
-#undef SEL_AND_ILC_INIT_257
-
-#define TRY(n)                                  \
+# undef SEL_AND_ILC_INIT_1
+# undef SEL_AND_ILC_INIT_2
+# undef SEL_AND_ILC_INIT_4
+# undef SEL_AND_ILC_INIT_8
+# undef SEL_AND_ILC_INIT_16
+# undef SEL_AND_ILC_INIT_32
+# undef SEL_AND_ILC_INIT_64
+# undef SEL_AND_ILC_INIT_128
+# undef SEL_AND_ILC_INIT_256
+
+# undef SEL_AND_ILC_INIT_131
+# undef SEL_AND_ILC_INIT_257
+
+# define TRY(n)                                  \
 	if (sel == sel_and_ilc[hash0].sel[n]) { \
 	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
 	    goto perform0_send_and_return;      \
@@ -5524,7 +5533,7 @@
 	TRY(0);
 	TRY(1);
 
-#undef TRY
+# undef TRY
 	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
 
 	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
@@ -5541,6 +5550,7 @@
 	static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
 	RETURN (_SEND0(self, aSelector, nil, &ilc0));
     }
+#endif /* not JAVA */
 %}.
     ^ self perform:aSelector withArguments:#()
 !
@@ -5570,6 +5580,8 @@
 	^ nil
     ].
 %{
+#ifdef __JAVA__
+#else
     REGISTER OBJ *argP;
     int nargs, i;
 
@@ -5715,7 +5727,7 @@
 				 argP[11], argP[12], argP[13], argP[14]));
 	    }
 
-#ifdef _SEND16
+# ifdef _SEND16
 	case 16:
 	    {
 		static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
@@ -5724,8 +5736,8 @@
 				 argP[6], argP[7], argP[8], argP[9], argP[10],
 				 argP[11], argP[12], argP[13], argP[14], argP[15]));
 	    }
-#endif
-#ifdef _SEND17
+# endif
+# ifdef _SEND17
 	case 17:
 	    {
 		static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
@@ -5734,11 +5746,12 @@
 				 argP[6], argP[7], argP[8], argP[9], argP[10],
 				 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
 	    }
-#endif
+# endif
 
 
     }
 bad:;
+#endif /* not JAVA */
 %}.
     "/ arrive here, if bad number of arguments (too many)
     "/ ST/X (currently) only allows up to 15 method arguments
@@ -5750,45 +5763,47 @@
     "send the one-arg-message aSelector to the receiver"
 
 %{
+#ifdef __JAVA__
+#else
     REGISTER OBJ sel = aSelector;
     int hash0;
 
     if (InterruptPending == nil) {
 	struct inlineCache *pIlc;
-#undef nways
-#define nways 2
-#undef nilcs
-#define nilcs 131
-
-#define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF1(l) , __ILCPERF1(l)  } , 0 }
-#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
-#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
-#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
-#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
-#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
-#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
-
-#define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
+# undef nways
+# define nways 2
+# undef nilcs
+# define nilcs 131
+
+# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF1(l) , __ILCPERF1(l)  } , 0 }
+# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
+# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
+# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
+# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
+# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
+# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
+
+# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
 
 	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
 
-#undef SEL_AND_ILC_INIT_1
-#undef SEL_AND_ILC_INIT_2
-#undef SEL_AND_ILC_INIT_4
-#undef SEL_AND_ILC_INIT_8
-#undef SEL_AND_ILC_INIT_16
-#undef SEL_AND_ILC_INIT_32
-#undef SEL_AND_ILC_INIT_64
-#undef SEL_AND_ILC_INIT_128
-#undef SEL_AND_ILC_INIT_256
-
-#undef SEL_AND_ILC_INIT_131
-#undef SEL_AND_ILC_INIT_257
-
-#define TRY(n)                                  \
+# undef SEL_AND_ILC_INIT_1
+# undef SEL_AND_ILC_INIT_2
+# undef SEL_AND_ILC_INIT_4
+# undef SEL_AND_ILC_INIT_8
+# undef SEL_AND_ILC_INIT_16
+# undef SEL_AND_ILC_INIT_32
+# undef SEL_AND_ILC_INIT_64
+# undef SEL_AND_ILC_INIT_128
+# undef SEL_AND_ILC_INIT_256
+
+# undef SEL_AND_ILC_INIT_131
+# undef SEL_AND_ILC_INIT_257
+
+# define TRY(n)                                  \
 	if (sel == sel_and_ilc[hash0].sel[n]) { \
 	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
 	    goto perform1_send_and_return;      \
@@ -5804,7 +5819,7 @@
 	TRY(0);
 	TRY(1);
 
-#undef TRY
+# undef TRY
 	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
 
 	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
@@ -5822,6 +5837,7 @@
 	static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
 	RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
     }
+#endif /* not JAVA */
 %}.
     ^ self perform:aSelector withArguments:(Array with:arg)
 !
@@ -5830,45 +5846,47 @@
     "send the two-arg-message aSelector to the receiver"
 
 %{
+#ifndef __JAVA__
+#else
     REGISTER OBJ sel = aSelector;
     struct inlineCache *pIlc;
     int hash0;
 
     if (InterruptPending == nil) {
-#undef nways
-#define nways 2
-#undef nilcs
-#define nilcs 131
-
-#define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF2(l) , __ILCPERF2(l) } , 0 }
-#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
-#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
-#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
-#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
-#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
-#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
-#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
-
-#define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
+# undef nways
+# define nways 2
+# undef nilcs
+# define nilcs 131
+
+# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF2(l) , __ILCPERF2(l) } , 0 }
+# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
+# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
+# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
+# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
+# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
+# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
+# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
+
+# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
 
 	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
 
-#undef SEL_AND_ILC_INIT_1
-#undef SEL_AND_ILC_INIT_2
-#undef SEL_AND_ILC_INIT_4
-#undef SEL_AND_ILC_INIT_8
-#undef SEL_AND_ILC_INIT_16
-#undef SEL_AND_ILC_INIT_32
-#undef SEL_AND_ILC_INIT_64
-#undef SEL_AND_ILC_INIT_128
-#undef SEL_AND_ILC_INIT_256
-
-#undef SEL_AND_ILC_INIT_131
-#undef SEL_AND_ILC_INIT_257
-
-#define TRY(n)                                  \
+# undef SEL_AND_ILC_INIT_1
+# undef SEL_AND_ILC_INIT_2
+# undef SEL_AND_ILC_INIT_4
+# undef SEL_AND_ILC_INIT_8
+# undef SEL_AND_ILC_INIT_16
+# undef SEL_AND_ILC_INIT_32
+# undef SEL_AND_ILC_INIT_64
+# undef SEL_AND_ILC_INIT_128
+# undef SEL_AND_ILC_INIT_256
+
+# undef SEL_AND_ILC_INIT_131
+# undef SEL_AND_ILC_INIT_257
+
+# define TRY(n)                                  \
 	if (sel == sel_and_ilc[hash0].sel[n]) { \
 	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
 	    goto perform2_send_and_return;      \
@@ -5884,7 +5902,7 @@
 	TRY(0);
 	TRY(1);
 
-#undef TRY
+# undef TRY
 	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
 
 	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
@@ -5902,6 +5920,7 @@
 	static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
 	RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
     }
+#endif /* not JAVA */
 %}.
     ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
 !
@@ -5910,6 +5929,8 @@
     "send the three-arg-message aSelector to the receiver"
 
 %{
+#ifndef __JAVA__
+#else
     struct inlineCache *pIlc;
     static struct inlineCache ilc_0 = __ILCPERF3(@line);
     static struct inlineCache ilc_1 = __ILCPERF3(@line);
@@ -5945,6 +5966,7 @@
 	static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
 	RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
     }
+#endif
 %}.
     ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
 
@@ -6741,7 +6763,8 @@
 !
 
 performX:aSelector
-    "send the message aSelector to the receiver"
+    "send the message aSelector to the receiver
+     This is the original implementation of #perform, for reference (before Jan's changes for Ruby tuning)."
 
     <resource: #skipInDebuggersWalkBack>
 
@@ -7753,7 +7776,7 @@
 	    nbytes -= nInstBytes;
 	    RETURN ( __mkSmallInteger(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */
     }
-#endif
+#endif /* not JAVA */
 %}.
     ^ 0
 !
@@ -8161,17 +8184,17 @@
 		}
 	    }
 
-#if defined(memsrch4)
+# if defined(memsrch4)
 	    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
 		RETURN (true);
 	    }
-#else
+# else
 	    for (inst=0; inst<nInsts; inst++) {
 		if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
 		    RETURN (true);
 		}
 	    }
-#endif
+# endif
 	    RETURN (false);
 	}
 
@@ -8228,11 +8251,11 @@
 	}
 
 	if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
-#if defined(memsrch4)
+# if defined(memsrch4)
 	    if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
 		RETURN (true);
 	    }
-#else
+# else
 	    int i;
 
 	    for (i=0; i<nObjs; i++) {
@@ -8240,7 +8263,7 @@
 		    RETURN (true);
 		}
 	    }
-#endif /* memsrch4 */
+# endif /* memsrch4 */
 	}
 
 	for (inst=0; inst<nInsts; inst++) {
@@ -8248,17 +8271,17 @@
 	    int i;
 
 	    if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
-#if defined(memsrch4)
+# if defined(memsrch4)
 		if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
 		    RETURN (true);
 		}
-#else
+# else
 		for (i=0; i<nObjs; i++) {
 		    if (instVar == __arrayVal(aCollection)[i]) {
 			RETURN (true);
 		    }
 		}
-#endif /* memsrch4 */
+# endif /* memsrch4 */
 	    }
 	}
 	RETURN (false);
@@ -8424,17 +8447,17 @@
 	}
     }
 
-#if defined(memsrch4)
+# if defined(memsrch4)
     if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
 	RETURN (true);
     }
-#else
+# else
     for (i=0; i<nInsts; i++) {
 	if (__InstPtr(self)->i_instvars[i] == anObject) {
 	    RETURN (true);
 	}
     }
-#endif /* memsrch4 */
+# endif /* memsrch4 */
 
 %}.
 
@@ -8702,7 +8725,7 @@
 	}
     }
 %}.
-    ok ifTrue:[
+    ok == true ifTrue:[
 	ok := false.
 	myClass := self class.
 	myClass == otherClass ifTrue:[
@@ -8750,8 +8773,8 @@
 	    ]
 	]
     ].
-    ok ifTrue:[
-	"now, change the receivers class ..."
+    ok == true ifTrue:[
+	"now, change the receiver's class ..."
 %{
 	{
 	    OBJ me = self;
@@ -8845,6 +8868,7 @@
     }
     RETURN (anyChange);
 %}.
+    self primitiveFailed
 
     "
      |v|
@@ -10223,11 +10247,11 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.796 2015-04-15 00:30:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.797 2015-04-19 13:55:32 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.796 2015-04-15 00:30:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.797 2015-04-19 13:55:32 cg Exp $'
 !
 
 version_SVN
--- a/SmallInteger.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/SmallInteger.st	Mon Apr 20 06:40:26 2015 +0200
@@ -114,10 +114,16 @@
      For very special uses only - not constant across implementations"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    // longs are always 64bits
+    return context._RETURN ( STInteger._new(64) );
+#else
     RETURN ( __mkSmallInteger(N_INT_BITS) );
+#endif
 %}
-
-    "SmallInteger maxBits"
+    "
+     SmallInteger maxBits
+    "
 !
 
 maxBytes
@@ -125,9 +131,13 @@
      For very special uses only - not constant across implementations"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    // longs are always 8 bytes
+    return context._RETURN ( STInteger._new(8) );
+#else
     RETURN ( __mkSmallInteger(N_INT_BITS / 8 + 1) );
+#endif
 %}
-
     "
      SmallInteger maxBytes
     "
@@ -138,10 +148,15 @@
      For very special uses only - not constant across implementations"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN ( STInteger._MAX_INTVAL );
+#else
     RETURN ( __mkSmallInteger(_MAX_INT) );
+#endif
 %}
-
-    "SmallInteger maxVal"
+    "
+     SmallInteger maxVal
+    "
 !
 
 minVal
@@ -149,10 +164,15 @@
      For very special uses only - not constant across implementations"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN ( STInteger._MIN_INTVAL );
+#else
     RETURN ( __mkSmallInteger(_MIN_INT) );
+#endif
 %}
-
-    "SmallInteger minVal"
+    "
+     SmallInteger minVal
+    "
 ! !
 
 !SmallInteger class methodsFor:'queries'!
@@ -193,7 +213,9 @@
     "return the product of the receiver and the argument"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.times( aNumber ));
+#else
     /*
      * notice:
      * the following inline code handles some common cases,
@@ -220,25 +242,25 @@
      * (took me a while to find this out :-(
      * (try 10000 * 10000)
      */
-#if defined(__sparc__) && defined(__GNUC__) && (__GNUC__ >= 2)
-# define USE_LONGLONG_FOR_MUL
-#endif
-
-#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 2)
-# define USE_LONGLONG_FOR_MUL
-#endif
+# if defined(__sparc__) && defined(__GNUC__) && (__GNUC__ >= 2)
+#  define USE_LONGLONG_FOR_MUL
+# endif
+
+# if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 2)
+#  define USE_LONGLONG_FOR_MUL
+# endif
 
     if (__isSmallInteger(aNumber)) {
 	myValue = __intVal(self);
 	otherValue = __intVal(aNumber);
 
-#if defined(USE_LONGLONG_FOR_MUL)
+# if defined(USE_LONGLONG_FOR_MUL)
 	{
-# if defined(__alpha__) && !defined(__alpha64__)
-#  define LONGLONG      INT64
-# else
-#  define LONGLONG      long long
-# endif
+#  if defined(__alpha__) && !defined(__alpha64__)
+#   define LONGLONG      INT64
+#  else
+#   define LONGLONG      long long
+#  endif
 	    LONGLONG product;
 
 	    product = (LONGLONG)myValue * (LONGLONG)otherValue;
@@ -255,7 +277,7 @@
 	    productHi = product >> 32;
 	    productLow = product & 0xFFFFFFFFL;
 	}
-#else /* no long-long */
+# else /* no long-long */
 	negative = 1;
 	if (myValue < 0) {
 	    negative = -1;
@@ -266,21 +288,21 @@
 	    otherValue = -otherValue;
 	}
 
-# if defined(__GNUC__) && defined(__mc68k__)
+#  if defined(__GNUC__) && defined(__mc68k__)
 	asm ("mulu%.l %3,%1:%0"
 		: "=d"  ((unsigned long)(productLow)),
 		  "=d"  ((unsigned long)(productHi))
 		: "%0"  ((unsigned long)(myValue)),
 		  "dmi" ((unsigned long)(otherValue)));
-# else
-#  if defined (__GNUC__) && defined(__i386__)
+#  else
+#   if defined (__GNUC__) && defined(__i386__)
 	asm ("mull %3"
 		: "=a"  ((unsigned long)(productLow)),
 		  "=d"  ((unsigned long)(productHi))
 		: "%0"  ((unsigned long)(myValue)),
 		  "rm"  ((unsigned long)(otherValue)));
-#  else
-#   if defined(WIN32) && defined(__BORLANDC__)
+#   else
+#    if defined(WIN32) && defined(__BORLANDC__)
 	asm {
 	    mov   eax, myValue
 	    mov   edx, otherValue
@@ -288,7 +310,7 @@
 	    mov   productLow, eax
 	    mov   productHi, edx
 	}
-#   else /* generic */
+#    else /* generic */
 	{
 	    unsigned INT pHH, pHL, pLH, pLL;
 	    unsigned INT low1, low2, hi1, hi2;
@@ -301,19 +323,19 @@
 	     * (or at least 32*32 with Overflow check)
 	     * - need more assembler (inline) functions here
 	     */
-#    if __POINTER_SIZE__ == 8
+#     if __POINTER_SIZE__ == 8
 	    low1 = low32Bits((unsigned INT)myValue);
 	    hi1 = hi32Bits((unsigned INT)myValue);
 	    low2 = low32Bits((unsigned INT)otherValue);
 	    hi2 = hi32Bits((unsigned INT)otherValue);
-#     define LLMASK 0xC000000000000000L
-#    else
+#      define LLMASK 0xC000000000000000L
+#     else
 	    low1 = low16Bits((unsigned INT)myValue);
 	    hi1 = hi16Bits((unsigned INT)myValue);
 	    low2 = low16Bits((unsigned INT)otherValue);
 	    hi2 = hi16Bits((unsigned INT)otherValue);
-#     define LLMASK 0xC0000000
-#    endif
+#      define LLMASK 0xC0000000
+#     endif
 
 	    pLH = low1 * hi2;
 	    pHL = hi1 * low2;
@@ -340,19 +362,19 @@
 	     *   pLL                   |--------|--------|
 	     */
 
-#    if __POINTER_SIZE__ == 8
+#     if __POINTER_SIZE__ == 8
 	    t = low32Bits(pLH) + low32Bits(pHL) + hi32Bits(pLL);
 	    productLow = (t << 32) + low32Bits(pLL);
 	    productHi = pHH + hi32Bits(t) + hi32Bits(pHL) + hi32Bits(pLH);
-#    else
+#     else
 	    t = low16Bits(pLH) + low16Bits(pHL) + hi16Bits(pLL);
 	    productLow = (t << 16) + low16Bits(pLL);
 	    productHi = pHH + hi16Bits(t) + hi16Bits(pHL) + hi16Bits(pLH);
-#    endif
+#     endif
 	}
-#   endif /* ! WIN32 */
-#  endif /* ! (__GNUC__ && __i386__) */
-# endif /* ! (__GNUC__ && __mc68k__) */
+#    endif /* ! WIN32 */
+#   endif /* ! (__GNUC__ && __i386__) */
+#  endif /* ! (__GNUC__ && __mc68k__) */
 
 	if (productHi == 0) {
 	    if (negative < 0) {
@@ -365,13 +387,13 @@
 		}
 	    }
 	}
-#endif /* ! USE_LONGLONG */
-
-#if __POINTER_SIZE__ == 8
+# endif /* ! USE_LONGLONG */
+
+# if __POINTER_SIZE__ == 8
 	RETURN (__MKLARGEINT128(negative, productLow, productHi));
-#else
+# else
 	RETURN (__MKLARGEINT64(negative, productLow, productHi));
-#endif
+# endif
     } else if (__isFloatLike(aNumber)) {
 	OBJ newFloat;
 	double val = (double)__intVal(self) * __floatVal(aNumber);
@@ -385,6 +407,7 @@
 	__qMKSFLOAT(newFloat, val);
 	RETURN ( newFloat );
     }
+#endif /* not JAVA */
 %}.
     ^ aNumber productFromInteger:self
 !
@@ -393,7 +416,9 @@
     "return the sum of the receivers value and the arguments value"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.plus( aNumber ));
+#else
     /*
      * notice:
      * the following inline code handles some common cases,
@@ -405,9 +430,9 @@
      */
 
     if (__isSmallInteger(aNumber)) {
-#ifdef _ADD_IO_IO
+# ifdef _ADD_IO_IO
 	RETURN ( _ADD_IO_IO(self, aNumber) );
-#else
+# else
 	REGISTER INT sum;
 
 	sum =  __intVal(self) + __intVal(aNumber);
@@ -415,7 +440,7 @@
 	    RETURN ( __mkSmallInteger(sum) );
 	}
 	RETURN ( __MKLARGEINT(sum) );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	OBJ newFloat;
@@ -431,6 +456,7 @@
 	__qMKSFLOAT(newFloat, val);
 	RETURN ( newFloat );
     }
+#endif /* not JAVA */
 %}.
     ^ aNumber sumFromInteger:self
 !
@@ -439,7 +465,9 @@
     "return the difference of the receivers value and the arguments value"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.minus( aNumber ));
+#else
     /*
      * notice:
      * the following inline code handles some common cases,
@@ -451,9 +479,9 @@
      */
 
     if (__isSmallInteger(aNumber)) {
-#ifdef _SUB_IO_IO
+# ifdef _SUB_IO_IO
 	RETURN ( _SUB_IO_IO(self, aNumber) );
-#else
+# else
 	REGISTER INT diff;
 
 	diff =  __intVal(self) - __intVal(aNumber);
@@ -461,7 +489,7 @@
 	    RETURN ( __mkSmallInteger(diff) );
 	}
 	RETURN ( __MKLARGEINT(diff) );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	OBJ newFloat;
@@ -477,6 +505,7 @@
 	__qMKSFLOAT(newFloat, val);
 	RETURN ( newFloat );
     }
+#endif /* not JAVA */
 %}.
     ^ aNumber differenceFromInteger:self
 !
@@ -485,6 +514,9 @@
     "return the quotient of the receivers value and the arguments value"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.quotient( aNumber ));
+#else
 
     /*
      * notice:
@@ -504,9 +536,9 @@
 	if (val != 0) {
 	    me = __intVal(self);
 	    t = me / val;
-#ifdef GOOD_OPTIMIZER
+# ifdef GOOD_OPTIMIZER
 	    if (me % val == 0) {
-#else
+# else
 	    /* this is stupid - all I want is to look for a remainder ...
 	       but most compilers are too stupid and generate an extra modulus
 	       instruction for "if (me % val)".
@@ -516,7 +548,7 @@
 	       on most machines. Hint to GNU people :-)
 	    */
 	    if ((t * val) == me) {
-#endif
+# endif
 		RETURN ( __mkSmallInteger(t) );
 	    }
 	}
@@ -532,6 +564,7 @@
 	    }
 	}
     }
+#endif /* not JAVA */
 %}.
     aNumber isInteger ifTrue:[
 	aNumber == 0 ifTrue:[
@@ -556,21 +589,23 @@
 
 // aNumber
     "return the integer part of the quotient of the receivers value
-     and the arguments value. 
+     and the arguments value.
      The result is truncated toward negative infinity
      and will be negative, if the operands signs differ.
      The following is always true:
-        (receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
+	(receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     Especially surprising:     
-        -1 // 10 -> -1 (because -(1/10) is truncated towards next smaller integer, which is -1.
-        -10 // 3 -> -4 (because -(10/3) is truncated towards next smaller integer, which is -4.
+     Especially surprising:
+	-1 // 10 -> -1 (because -(1/10) is truncated towards next smaller integer, which is -1.
+	-10 // 3 -> -4 (because -(10/3) is truncated towards next smaller integer, which is -4.
 
      See #quo: which returns -2 in the above case and #rem: which is the corresponding remainder."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.quotientTruncated( aNumber ));
+#else
     /*
      * notice:
      * the following inline code handles some common cases,
@@ -584,59 +619,60 @@
     INT dividend, divisor, rslt;
 
     if (__isSmallInteger(aNumber)) {
-        divisor = __intVal(aNumber);
-        if (divisor != 0) {
-            dividend = __intVal(self);
-            rslt = dividend / divisor;
-            /*
-             * Optimized to speed up positive result
-             */
-            if (rslt <= 0) {
-                if (rslt == 0) {
-                    if ((dividend ^ divisor) < 0) {
-                        /*
-                         * result (negative) has been truncated toward 0.
-                         * Return -1, because we truncate toward negative inf.
-                         */
-                         rslt = -1;
-                    }
-                } else {
-                    /*
-                     * If result (negative) has been truncated toward 0,
-                     * subtract 1, because we truncate toward negative inf.
-                     */
-                    if (divisor > 0) {
-                        if (rslt * divisor > dividend) {
-                            rslt--;
-                        }
-                    } else {
-                        if (rslt * divisor < dividend) {
-                            rslt--;
-                        }
-                    }
-                }
-            }
-            RETURN ( __mkSmallInteger(rslt) );
-        }
+	divisor = __intVal(aNumber);
+	if (divisor != 0) {
+	    dividend = __intVal(self);
+	    rslt = dividend / divisor;
+	    /*
+	     * Optimized to speed up positive result
+	     */
+	    if (rslt <= 0) {
+		if (rslt == 0) {
+		    if ((dividend ^ divisor) < 0) {
+			/*
+			 * result (negative) has been truncated toward 0.
+			 * Return -1, because we truncate toward negative inf.
+			 */
+			 rslt = -1;
+		    }
+		} else {
+		    /*
+		     * If result (negative) has been truncated toward 0,
+		     * subtract 1, because we truncate toward negative inf.
+		     */
+		    if (divisor > 0) {
+			if (rslt * divisor > dividend) {
+			    rslt--;
+			}
+		    } else {
+			if (rslt * divisor < dividend) {
+			    rslt--;
+			}
+		    }
+		}
+	    }
+	    RETURN ( __mkSmallInteger(rslt) );
+	}
     } else {
-        if (__isFraction(aNumber)) {
-            OBJ t;
-            INT num, den;
-
-            t = __FractionInstPtr(aNumber)->f_numerator;
-            if (__isSmallInteger(t)) {
-                num = __intVal(t);
-                t = __FractionInstPtr(aNumber)->f_denominator;
-                if (__isSmallInteger(t)) {
-                    den = __intVal(t);
-                    RETURN ( __mkSmallInteger(__intVal(self) * den / num ));
-                }
-            }
-        }
+	if (__isFraction(aNumber)) {
+	    OBJ t;
+	    INT num, den;
+
+	    t = __FractionInstPtr(aNumber)->f_numerator;
+	    if (__isSmallInteger(t)) {
+		num = __intVal(t);
+		t = __FractionInstPtr(aNumber)->f_denominator;
+		if (__isSmallInteger(t)) {
+		    den = __intVal(t);
+		    RETURN ( __mkSmallInteger(__intVal(self) * den / num ));
+		}
+	    }
+	}
     }
+#endif /* not JAVA */
 %}.
     (aNumber = 0) ifTrue:[
-        ^ ZeroDivide raiseRequestWith:thisContext.
+	^ ZeroDivide raiseRequestWith:thisContext.
     ].
     ^ aNumber integerQuotientFromInteger:self
 
@@ -662,26 +698,28 @@
 
 \\ aNumber
     "Answer the integer remainder m defined by division with truncation toward
-     negative infinity. 
+     negative infinity.
      m < |aNumber| AND there is an integer k with (k * aNumber + m) = self
 
      The returned remainder has the same sign as aNumber.
      The following is always true:
-        (receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
+	(receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     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,
-                        and -4 * 4 gives -12, so we need to add 2 to get the original -10.
+     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,
+			and -4 * 4 gives -12, so we need to add 2 to get the original -10.
 
      See #rem: which is the corresponding remainder for division via #quo:.
 
      Redefined here for speed."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.remainder( aNumber ));
+#else
     /*
      * notice:
      * the following inline code handles some common cases,
@@ -695,32 +733,33 @@
     INT dividend, divisor, rem;
 
     if (__isSmallInteger(aNumber)
-        && (divisor = __intVal(aNumber)) != 0) {
-        /*
-         * Note that the sign of something modulo a negative number is undefined
-         * in C!
-         */
-        dividend = __intVal(self);
-        rem = dividend % divisor;
-        if (rem) {
-            if ((rem ^ divisor) < 0) {
-                /* sign of remainder is different from sign of divisor */
-                rem = -rem;
-            }
-            if ((dividend ^ divisor) < 0) {
-                /* different signs, so division would have returned a
-                 * negative number.
-                 * C rounds toward zero, this code will simulate
-                 * rounding towards negative infinity.
-                 */
-                rem = divisor - rem;
-            }
-        }
-        RETURN ( __mkSmallInteger(rem) );
+	&& (divisor = __intVal(aNumber)) != 0) {
+	/*
+	 * Note that the sign of something modulo a negative number is undefined
+	 * in C!
+	 */
+	dividend = __intVal(self);
+	rem = dividend % divisor;
+	if (rem) {
+	    if ((rem ^ divisor) < 0) {
+		/* sign of remainder is different from sign of divisor */
+		rem = -rem;
+	    }
+	    if ((dividend ^ divisor) < 0) {
+		/* different signs, so division would have returned a
+		 * negative number.
+		 * C rounds toward zero, this code will simulate
+		 * rounding towards negative infinity.
+		 */
+		rem = divisor - rem;
+	    }
+	}
+	RETURN ( __mkSmallInteger(rem) );
     }
+#endif /* not JAVA */
 %}.
     (aNumber = 0) ifTrue:[
-        ^ ZeroDivide raiseRequestWith:thisContext.
+	^ ZeroDivide raiseRequestWith:thisContext.
     ].
     ^ aNumber moduloFromInteger:self
 
@@ -742,7 +781,9 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.abs());
+#else
     INT val = __intVal(self);
 
     if (val >= 0) {
@@ -753,6 +794,7 @@
     }
     /* only reached for minVal */
     RETURN( __MKLARGEINT(-_MIN_INT));
+#endif
 %}.
     ^ super abs
 !
@@ -762,7 +804,9 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.negated());
+#else
     INT val = __intVal(self);
 
     if (val != _MIN_INT) {
@@ -770,6 +814,7 @@
     }
     /* only reached for minVal */
     RETURN (__MKLARGEINT( -_MIN_INT));
+#endif
 %}.
     ^ 0 - self
 "/    "only reached for minVal"
@@ -788,6 +833,9 @@
      in contrast: '9 quo: 4 = 2' and '-9 quo: 4 = -2'"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.quotient(aNumber));
+#else
     INT val;
 
     if (__isSmallInteger(aNumber)) {
@@ -811,6 +859,7 @@
 	    }
 	}
     }
+#endif /* not JAVA */
 %}.
     (aNumber = 0) ifTrue:[
 	^ ZeroDivide raiseRequestWith:thisContext.
@@ -832,11 +881,14 @@
     "return the bitwise-and of the receiver and the argument, anInteger"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitAnd(anInteger));
+#else
     /* anding the tags doesn't change it */
     if (__isSmallInteger(anInteger)) {
 	RETURN ( ((OBJ) ((INT)self & (INT)anInteger)) );
     }
+#endif /* not JAVA */
 %}.
     anInteger class == LargeInteger ifTrue:[
 	^ anInteger bitAnd:self
@@ -849,25 +901,28 @@
 bitAt:anIntegerIndex
     "return the value of the index's bit (index starts at 1) as 0 or 1.
      Notice: the result of bitAt: on negative receivers is not
-             defined in the language standard (since the implementation
-             is free to choose any internal representation for integers)"
+	     defined in the language standard (since the implementation
+	     is free to choose any internal representation for integers)"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitAt(anIntegerIndex));
+#else
     if (__isSmallInteger(anIntegerIndex)) {
-        INT idx = __smallIntegerVal(anIntegerIndex);
-        if (idx > 0) {
-            if (idx > N_INT_BITS) {
-                RETURN(__mkSmallInteger(0));
-            }
-            RETURN((__smallIntegerVal(self) & (1 << (idx-1))) ? __mkSmallInteger(1) : __mkSmallInteger(0));
-        }
+	INT idx = __smallIntegerVal(anIntegerIndex);
+	if (idx > 0) {
+	    if (idx > N_INT_BITS) {
+		RETURN(__mkSmallInteger(0));
+	    }
+	    RETURN((__smallIntegerVal(self) & (1 << (idx-1))) ? __mkSmallInteger(1) : __mkSmallInteger(0));
+	}
     }
+#endif /* not JAVA */
 %}.
 
     ^ SubscriptOutOfBoundsError
-            raiseRequestWith:anIntegerIndex
-            errorString:'index out of bounds'
+	    raiseRequestWith:anIntegerIndex
+	    errorString:'index out of bounds'
 
     "
      16r00000001 bitAt:0
@@ -887,9 +942,9 @@
     |mask|
 
     anIntegerIndex <= 0 ifTrue:[
-        ^ SubscriptOutOfBoundsSignal
-                raiseRequestWith:anIntegerIndex
-                errorString:'index out of bounds'
+	^ SubscriptOutOfBoundsSignal
+		raiseRequestWith:anIntegerIndex
+		errorString:'index out of bounds'
     ].
     (anIntegerIndex > SmallInteger maxBits) ifTrue:[^ 0].
     mask := 1 bitShift:(anIntegerIndex - 1).
@@ -903,11 +958,14 @@
      returning the receiver with bits of the argument cleared."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitClear(anInteger));
+#else
     /* anding the tags doesn't change it */
     if (__isSmallInteger(anInteger)) {
 	RETURN ( ((OBJ) (((INT)self & ~(INT)anInteger) | TAG_INT)) );
     }
+#endif /* not JAVA */
 %}.
     ^ self retry:#bitClear: coercing:anInteger
 
@@ -921,6 +979,7 @@
     "return the number of 1-bits in the receiver"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     unsigned int _cnt;
     unsigned INT _self = __intVal(self);
 
@@ -931,8 +990,8 @@
 
     _cnt = 0;
     while (_self) {
-        _cnt++;
-        _self = _self & (_self - 1);
+	_cnt++;
+	_self = _self & (_self - 1);
     }
 # else
 #  ifdef ALGORITHM_2
@@ -942,8 +1001,8 @@
 
     _cnt = 0;
     while (_self) {
-        _cnt += table[ _self & 0x0F ];
-        _self >>= 4;
+	_cnt += table[ _self & 0x0F ];
+	_self >>= 4;
     }
 #  else
 #   ifdef ALGORIHTM_3
@@ -975,30 +1034,32 @@
 # endif
 
     RETURN ( __MKSMALLINT(_cnt));
-%}
+#endif /* not JAVA */
+%}.
+    ^ super bitCount.
 
     "
 
      1 to:1000000 do:[:n |
-        self assert:(n bitCount = ((n printStringRadix:2) occurrencesOf:$1))
+	self assert:(n bitCount = ((n printStringRadix:2) occurrencesOf:$1))
      ].
 
      #(
-        16r00010000 16r00100000 16r01000000 16r10000000
-        16r00020000 16r00200000 16r02000000 16r20000000
-        16r00040000 16r00400000 16r04000000 16r40000000
-        16r00080000 16r00800000 16r08000000 16r80000000
-
-        16rFFFFFFFF 16r7FFFFFFF 16r3FFFFFFF 16r1FFFFFFF
-        16rEEEEEEEE 16r7EEEEEEE 16r3EEEEEEE 16r1EEEEEEE
-        16rDDDDDDDD 16r7DDDDDDD 16r3DDDDDDD 16r1DDDDDDD
-        16rCCCCCCCC 16r7CCCCCCC 16r3CCCCCCC 16r1CCCCCCC
+	16r00010000 16r00100000 16r01000000 16r10000000
+	16r00020000 16r00200000 16r02000000 16r20000000
+	16r00040000 16r00400000 16r04000000 16r40000000
+	16r00080000 16r00800000 16r08000000 16r80000000
+
+	16rFFFFFFFF 16r7FFFFFFF 16r3FFFFFFF 16r1FFFFFFF
+	16rEEEEEEEE 16r7EEEEEEE 16r3EEEEEEE 16r1EEEEEEE
+	16rDDDDDDDD 16r7DDDDDDD 16r3DDDDDDD 16r1DDDDDDD
+	16rCCCCCCCC 16r7CCCCCCC 16r3CCCCCCC 16r1CCCCCCC
      ) do:[:n |
-        self assert:(n bitCount = ((n printStringRadix:2) occurrencesOf:$1))
+	self assert:(n bitCount = ((n printStringRadix:2) occurrencesOf:$1))
      ]
 
      1 to:10000000 do:[:n |
-        (n bitCount)
+	(n bitCount)
      ]
     "
 
@@ -1009,22 +1070,27 @@
     "return the value of the receiver with all bits inverted"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+#else
     /* invert anything except tag bits */
     RETURN ( ((OBJ) ((INT)self ^ ~TAG_MASK)) );
+#endif
 %}.
-    ^ self primitiveFailed
+    ^ super bitInvert
 !
 
 bitOr:anInteger
     "return the bitwise-or of the receiver and the argument, anInteger"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitOr( anInteger ));
+#else
     /* oring the tags doesn't change it */
     if (__isSmallInteger(anInteger)) {
 	RETURN ( ((OBJ) ((INT)self | (INT)anInteger)) );
     }
+#endif
 %}.
     ^ self retry:#bitOr: coercing:anInteger
 
@@ -1040,76 +1106,79 @@
     "return the value of the receiver shifted by shiftCount bits;
      leftShift if shiftCount > 0; rightShift otherwise.
      Notice: the result of bitShift: on negative receivers is not
-             defined in the language standard (since the implementation
-             is free to choose any internal representation for integers).
-             However, ST/X preserves the sign."
+	     defined in the language standard (since the implementation
+	     is free to choose any internal representation for integers).
+	     However, ST/X preserves the sign."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitShift( shiftCount ));
+#else
     INT bits, count;
 
     if (__isSmallInteger(shiftCount)) {
-        bits = __intVal(self);
-        if (bits == 0) {
-            RETURN (self);
-        }
-
-        count = __intVal(shiftCount);
-
-        if (count > 0) {
-            /*
-             * a left shift
-             */
-#if defined(USE_LONGLONG_FOR_SHIFT)
-            if (count <= N_INT_BITS) {
-                unsigned LONGLONG result;
-
-                result = (unsigned LONGLONG)bits;
-                result <<= count;
-                if (result <= _MAX_INT) {
-                    RETURN ( __mkSmallInteger(result) );
-                }
-                {
-                    RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
-                }
-            }
-#else
-            /*
-             * check for overflow
-             */
-            if (count < (N_INT_BITS-1)) {
-                if (! (bits >> (N_INT_BITS - 1 - count))) {
-                    RETURN ( __mkSmallInteger(bits << count) );
-                }
-                /*
-                 * so, there is an overflow ...
-                 * handle it as largeInteger
-                 */
-                /* FALL THROUGH */
-            }
-#endif
-        } else {
-            if (count == 0) {
-                RETURN (self);
-            }
-
-            /*
-             * right shifts cannot overflow
-             *
-             * some machines ignore shifts bigger than
-             * the number of bits in an int ...
-             */
-            count = -count;
-            if (count > (N_INT_BITS-1)) {
-                RETURN (__mkSmallInteger(0));
-            }
-
-            RETURN ( __mkSmallInteger(bits >> count) );
-        }
+	bits = __intVal(self);
+	if (bits == 0) {
+	    RETURN (self);
+	}
+
+	count = __intVal(shiftCount);
+
+	if (count > 0) {
+	    /*
+	     * a left shift
+	     */
+# if defined(USE_LONGLONG_FOR_SHIFT)
+	    if (count <= N_INT_BITS) {
+		unsigned LONGLONG result;
+
+		result = (unsigned LONGLONG)bits;
+		result <<= count;
+		if (result <= _MAX_INT) {
+		    RETURN ( __mkSmallInteger(result) );
+		}
+		{
+		    RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
+		}
+	    }
+# else
+	    /*
+	     * check for overflow
+	     */
+	    if (count < (N_INT_BITS-1)) {
+		if (! (bits >> (N_INT_BITS - 1 - count))) {
+		    RETURN ( __mkSmallInteger(bits << count) );
+		}
+		/*
+		 * so, there is an overflow ...
+		 * handle it as largeInteger
+		 */
+		/* FALL THROUGH */
+	    }
+# endif
+	} else {
+	    if (count == 0) {
+		RETURN (self);
+	    }
+
+	    /*
+	     * right shifts cannot overflow
+	     *
+	     * some machines ignore shifts bigger than
+	     * the number of bits in an int ...
+	     */
+	    count = -count;
+	    if (count > (N_INT_BITS-1)) {
+		RETURN (__mkSmallInteger(0));
+	    }
+
+	    RETURN ( __mkSmallInteger(bits >> count) );
+	}
     }
+#endif /* not JAVA */
 %}.
     (shiftCount isMemberOf:SmallInteger) ifTrue:[
-        ^ (LargeInteger value:self) bitShift:shiftCount
+	^ (LargeInteger value:self) bitShift:shiftCount
     ].
     ^ self bitShift:shiftCount asInteger   "/ is this a good idea ?
 !
@@ -1120,11 +1189,17 @@
      is non-0, false otherwise."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN(
+	    ( self.bitAnd( aMask ) == STInteger._0 )
+	    ? STObject.False : STObject.True );
+    /* NOTREACHED */
+#else
     /* and all bits except tag */
     if (__isSmallInteger(aMask)) {
 	RETURN ( ((INT)self & ((INT)aMask & ~TAG_MASK)) ? true : false );
     }
+#endif /* not JAVA */
 %}.
     aMask class == LargeInteger ifTrue:[
 	^ (aMask bitAnd:self) ~~ 0
@@ -1146,11 +1221,14 @@
     "return the bitwise-exclusive-or of the receiver and the argument, anInteger"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.bitXor( anInteger ));
+#else
     /* xoring the tags turns it off - or it in again */
     if (__isSmallInteger(anInteger)) {
 	RETURN ( (OBJ)( ((INT)self ^ (INT)anInteger) | TAG_INT) );
     }
+#endif /* not JAVA */
 %}.
     ^ self retry:#bitXor: coercing:anInteger
 !
@@ -1162,24 +1240,26 @@
      but a new number is returned. Should be named #withBitCleared:"
 
 %{  /* NOCONTEXT */
-
-    if (__isSmallInteger(anInteger)) {
-        int index = __intVal(anInteger);
-
-        if (index > 0) {
-#if __POINTER_SIZE__ == 8
-            if (index <= 62)
+#ifdef __JAVA__
 #else
-            if (index <= 30)
-#endif
-            {
-                INT mask = __MASKSMALLINT(1 << (index-1));
-
-                RETURN ( ((OBJ) ((INT)self & ~(INT)mask)) );
-            }
-            RETURN (self);  /* nothing to do ... */
-        }
+    if (__isSmallInteger(anInteger)) {
+	int index = __intVal(anInteger);
+
+	if (index > 0) {
+# if __POINTER_SIZE__ == 8
+	    if (index <= 62)
+# else
+	    if (index <= 30)
+# endif
+	    {
+		INT mask = __MASKSMALLINT(1 << (index-1));
+
+		RETURN ( ((OBJ) ((INT)self & ~(INT)mask)) );
+	    }
+	    RETURN (self);  /* nothing to do ... */
+	}
     }
+#endif /* not JAVA */
 %}.
     ^ super clearBit:anInteger
 
@@ -1207,7 +1287,36 @@
      Returns 0 if no bit is set."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    {
+	long bits = self.longValue();
+	int bitNr = 0;
+
+	if (bits != 0) {
+	    if ((bits & 0xFFFFFFFF00000000L) != 0) {
+		bitNr += 32; bits >>= 32;
+	    }
+	    if ((bits & 0xFFFF0000L) != 0) {
+		bitNr += 16; bits >>= 16;
+	    }
+	    if ((bits & 0xFF00) != 0) {
+		bitNr += 8; bits >>= 8;
+	    }
+	    if ((bits & 0xF0) != 0) {
+		bitNr += 4; bits >>= 4;
+	    }
+	    if ((bits & 0xC) != 0) {
+		bitNr += 2; bits >>= 2;
+	    }
+	    if ((bits & 0x2) != 0) {
+		bitNr += 1; bits >>= 1;
+	    }
+	    bitNr += 1;
+	}
+	return context._RETURN( STInteger._new(bitNr) );
+    }
+    /* NOTREACHED */
+#else
     unsigned INT bits;
     int index;
 
@@ -1216,41 +1325,44 @@
 	RETURN ( __mkSmallInteger(0) );
     }
 
-#ifdef __BSR
+# ifdef __BSR
     /*
      * so much for CISC CPUS:
      * the following code is not faster on a PIII-400
      * (but saves a few code-bytes, though)
      */
     index = __BSR(bits);
-#else
+# else
 
     index = 0;
 
-# if __POINTER_SIZE__ == 8
+#  if __POINTER_SIZE__ == 8
     if (bits & 0xFFFFFFFF00000000L) {
-	index += 32; bits = bits >> 32;
+	index += 32; bits >>= 32;
     }
-# endif
+#  endif
     if (bits & 0xFFFF0000L) {
-	index += 16; bits = bits >> 16;
+	index += 16; bits >>= 16;
     }
     if (bits & 0xFF00) {
-	index += 8; bits = bits >> 8;
+	index += 8; bits >>= 8;
     }
     if (bits & 0xF0) {
-	index += 4; bits = bits >> 4;
+	index += 4; bits >>= 4;
     }
     if (bits & 0xC) {
-	index += 2; bits = bits >> 2;
+	index += 2; bits >>= 2;
     }
     if (bits & 0x2) {
-	index += 1; bits = bits >> 1;
+	index += 1; bits >>= 1;
     }
-#endif /* no BSR instruction */
+# endif /* no BSR instruction */
 
     RETURN ( __mkSmallInteger(index+1) );
-%}
+#endif /* not JAVA */
+%}.
+    ^ super highBit
+
     "
      2r0 highBit
      2r1 highBit
@@ -1311,23 +1423,25 @@
      but a new number is returned. Should be named #withBitInverted:"
 
 %{  /* NOCONTEXT */
-
-    if (__isSmallInteger(anInteger)) {
-        int index = __intVal(anInteger);
-
-        if (index > 0) {
-#if __POINTER_SIZE__ == 8
-            if (index <= 62)
+#ifdef __JAVA__
 #else
-            if (index <= 30)
-#endif
-            {
-                INT mask = __MASKSMALLINT(1 << (index-1));
-
-                RETURN ( ((OBJ) ((INT)self ^ (INT)mask)) );
-            }
-        }
+    if (__isSmallInteger(anInteger)) {
+	int index = __intVal(anInteger);
+
+	if (index > 0) {
+# if __POINTER_SIZE__ == 8
+	    if (index <= 62)
+# else
+	    if (index <= 30)
+# endif
+	    {
+		INT mask = __MASKSMALLINT(1 << (index-1));
+
+		RETURN ( ((OBJ) ((INT)self ^ (INT)mask)) );
+	    }
+	}
     }
+#endif /* not JAVA */
 %}.
     ^ super invertBit:anInteger
 
@@ -1351,7 +1465,8 @@
      Returns 0 if no bit is set."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+#else
     unsigned INT bits;
     int index;
 
@@ -1360,7 +1475,7 @@
 	RETURN ( __mkSmallInteger(0) );
     }
 
-#ifdef __BSF
+# ifdef __BSF
     /*
      * so much for CISC CPUS:
      * the following code is only marginally faster on a PIII-400
@@ -1369,15 +1484,15 @@
      */
     index = __BSF(bits);
     RETURN ( __mkSmallInteger(index + 1) );
-#else
+# else
 
     index = 1;
 
-# if __POINTER_SIZE__ == 8
+#  if __POINTER_SIZE__ == 8
     if ((bits<<32) == 0) {
 	index += 32; bits >>= 32;
     }
-# endif
+#  endif
 
     if ((bits & 0xFFFF)==0) {
 	index += 16; bits >>= 16;
@@ -1394,10 +1509,12 @@
     if ((bits & 0x1)==0) {
 	index += 1;
     }
-#endif
+# endif
 
     RETURN ( __mkSmallInteger(index) );
-%}
+#endif /* not JAVA */
+%}.
+    ^ super lowBit
 
     "
      0 lowBit
@@ -1443,83 +1560,85 @@
     "return the value of the receiver shifted by shiftCount bits;
      right shift if shiftCount > 0; left shift  otherwise.
      Notice: the result of bitShift: on negative receivers is not
-             defined in the language standard (since the implementation
-             is free to choose any internal representation for integers).
-             However, ST/X preserves the sign."
+	     defined in the language standard (since the implementation
+	     is free to choose any internal representation for integers).
+	     However, ST/X preserves the sign."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+#else
     INT bits, count;
 
     if (__isSmallInteger(shiftCount)) {
-        bits = __intVal(self);
-        if (bits == 0) {
-            RETURN (self);
-        }
-
-        count = __intVal(shiftCount);
-
-        if (count < 0) {
-            /*
-             * a left shift
-             */
-            count = -count;
-#if defined(USE_LONGLONG_FOR_SHIFT)
-            if (count <= N_INT_BITS) {
-                unsigned LONGLONG result;
-
-                result = (unsigned LONGLONG)bits;
-                result <<= count;
-                if (result <= _MAX_INT) {
-                    RETURN ( __mkSmallInteger(result) );
-                }
-                {
-                    RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
-                }
-            }
-#else
-            /*
-             * check for overflow
-             */
-            if (count < (N_INT_BITS-1)) {
-                if (! (bits >> (N_INT_BITS - 1 - count))) {
-                    RETURN ( __mkSmallInteger(bits << count) );
-                }
-                /*
-                 * so, there is an overflow ...
-                 * handle it as largeInteger
-                 */
-                /* FALL THROUGH */
-            }
-#endif
-        } else {
-            if (count == 0) {
-                RETURN (self);
-            }
-
-            /*
-             * right shifts cannot overflow
-             *
-             * some machines ignore shifts bigger than
-             * the number of bits in an int ...
-             */
-            if (count > (N_INT_BITS-1)) {
-                RETURN (__mkSmallInteger(0));
-            }
-
-            RETURN ( __mkSmallInteger(bits >> count) );
-        }
+	bits = __intVal(self);
+	if (bits == 0) {
+	    RETURN (self);
+	}
+
+	count = __intVal(shiftCount);
+
+	if (count < 0) {
+	    /*
+	     * a left shift
+	     */
+	    count = -count;
+# if defined(USE_LONGLONG_FOR_SHIFT)
+	    if (count <= N_INT_BITS) {
+		unsigned LONGLONG result;
+
+		result = (unsigned LONGLONG)bits;
+		result <<= count;
+		if (result <= _MAX_INT) {
+		    RETURN ( __mkSmallInteger(result) );
+		}
+		{
+		    RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
+		}
+	    }
+# else
+	    /*
+	     * check for overflow
+	     */
+	    if (count < (N_INT_BITS-1)) {
+		if (! (bits >> (N_INT_BITS - 1 - count))) {
+		    RETURN ( __mkSmallInteger(bits << count) );
+		}
+		/*
+		 * so, there is an overflow ...
+		 * handle it as largeInteger
+		 */
+		/* FALL THROUGH */
+	    }
+# endif
+	} else {
+	    if (count == 0) {
+		RETURN (self);
+	    }
+
+	    /*
+	     * right shifts cannot overflow
+	     *
+	     * some machines ignore shifts bigger than
+	     * the number of bits in an int ...
+	     */
+	    if (count > (N_INT_BITS-1)) {
+		RETURN (__mkSmallInteger(0));
+	    }
+
+	    RETURN ( __mkSmallInteger(bits >> count) );
+	}
     }
+#endif /* not JAVA */
 %}.
     (shiftCount isMemberOf:SmallInteger) ifTrue:[
-        ^ (LargeInteger value:self) rightShift:shiftCount
+	^ (LargeInteger value:self) rightShift:shiftCount
     ].
     ^ self rightShift:shiftCount asInteger   "/ is this a good idea ?
 
 
     "
-        16 rightShift:2
-         4 rightShift:-2
+	16 rightShift:2
+	 4 rightShift:-2
     "
 !
 
@@ -1530,23 +1649,25 @@
      but a new number is returned. Should be named #withBitSet:"
 
 %{  /* NOCONTEXT */
-
-    if (__isSmallInteger(anInteger)) {
-        int index = __intVal(anInteger);
-
-        if (index > 0) {
-#if __POINTER_SIZE__ == 8
-            if (index <= 62)
+#ifdef __JAVA__
 #else
-            if (index <= 30)
-#endif
-            {
-                INT mask = __MASKSMALLINT(1 << (index-1));
-
-                RETURN ( ((OBJ) ((INT)self | (INT)mask)) );
-            }
-        }
+    if (__isSmallInteger(anInteger)) {
+	int index = __intVal(anInteger);
+
+	if (index > 0) {
+# if __POINTER_SIZE__ == 8
+	    if (index <= 62)
+# else
+	    if (index <= 30)
+# endif
+	    {
+		INT mask = __MASKSMALLINT(1 << (index-1));
+
+		RETURN ( ((OBJ) ((INT)self | (INT)mask)) );
+	    }
+	}
     }
+#endif /* not JAVA */
 %}.
     ^ super setBit:anInteger
 
@@ -1565,19 +1686,19 @@
 
 !SmallInteger methodsFor:'byte access'!
 
-byteSwapped 
+byteSwapped
     "lsb -> msb;
      i.e. a.b.c.d -> d.c.b.a"
 
     SmallInteger maxBytes == 8 ifTrue:[
-        ^ self byteSwapped64
+	^ self byteSwapped64
     ] ifFalse:[
-        ^ self byteSwapped32
+	^ self byteSwapped32
     ].
 
     "
-     16r11223344 byteSwapped hexPrintString  
-     16r44332211 byteSwapped hexPrintString   
+     16r11223344 byteSwapped hexPrintString
+     16r44332211 byteSwapped hexPrintString
     "
 
     "Created: / 09-01-2012 / 23:01:33 / cg"
@@ -1589,17 +1710,20 @@
      i.e. a.b -> b.a"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     unsigned INT v = __intVal(self);
     unsigned INT swapped;
 
     swapped = ((v>>8)&0xFF) | ((v & 0xFF)<<8);
     RETURN (__mkSmallInteger(swapped));
+#endif
 %}.
+    ^ super byteSwapped16
 
     "
-     16r1122 byteSwapped16 hexPrintString   
-     16r2211 byteSwapped16 hexPrintString   
-     16r332211 byteSwapped16 hexPrintString   
+     16r1122 byteSwapped16 hexPrintString
+     16r2211 byteSwapped16 hexPrintString
+     16r332211 byteSwapped16 hexPrintString
     "
 !
 
@@ -1609,68 +1733,71 @@
      i.e. a.b.c.d -> d.c.b.a"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     unsigned INT v = __intVal(self);
     unsigned INT swapped;
 
-#undef HAVE_BSWAP
-#if __POINTER_SIZE__ == 4
-
-# if defined(USE_BSWAP) && defined(__BORLANDC__)
+# undef HAVE_BSWAP
+# if __POINTER_SIZE__ == 4
+
+#  if defined(USE_BSWAP) && defined(__BORLANDC__)
 #   define HAVE_BSWAP
 
     _asm {
-        mov eax, v
-        bswap eax
-        mov swapped, eax
+	mov eax, v
+	bswap eax
+	mov swapped, eax
     };
-# endif
-# if defined(USE_BSWAP) && defined(__VISUALC__)
+#  endif
+#  if defined(USE_BSWAP) && defined(__VISUALC__)
 #   define HAVE_BSWAP
 
     _asm {
-        mov eax, v
-        xchg al, ah
-        rol eax, 16
-        xchg al, ah
-        mov swapped, eax
+	mov eax, v
+	xchg al, ah
+	rol eax, 16
+	xchg al, ah
+	mov swapped, eax
     };
-# endif
-# if defined(USE_BSWAP) && defined(__GNUC__)
+#  endif
+#  if defined(USE_BSWAP) && defined(__GNUC__)
 #   define HAVE_BSWAP
 
     asm("movl %1, %%eax \n\
-         bswap %%eax    \n\
-         movl %%eax, %0 \n\
-        "
-        : "=rm"  (swapped)
-        : "rm"   (v));
-# endif
-#endif /* __POINTER_SIZE__ == 4 */
-
-#if __POINTER_SIZE__ == 8
+	 bswap %%eax    \n\
+	 movl %%eax, %0 \n\
+	"
+	: "=rm"  (swapped)
+	: "rm"   (v));
+#  endif
+# endif /* __POINTER_SIZE__ == 4 */
+
+# if __POINTER_SIZE__ == 8
     v &= 0xFFFFFFFF;
 
-# if defined(__x86_64__) && defined(__GNUC__)
+#  if defined(__x86_64__) && defined(__GNUC__)
 #   define HAVE_BSWAP
     asm("movq %1, %%rax \n\
-         bswap %%eax    \n\
-         movq %%rax, %0 \n\
-        "
-        : "=rm"  (swapped)
-        : "rm"   (v));
+	 bswap %%eax    \n\
+	 movq %%rax, %0 \n\
+	"
+	: "=rm"  (swapped)
+	: "rm"   (v));
+#  endif
 # endif
-#endif
-
-#ifndef HAVE_BSWAP
+
+# ifndef HAVE_BSWAP
     swapped = ((v>>24) | ((v>>8)&0xFF00) | ((v & 0xFF00)<<8) | ((v & 0xFF)<<24));
-#endif
+# endif
 
     RETURN (__MKUINT(swapped));
+#endif /* not JAVA */
 %}.
+    ^ super byteSwapped32
 
     "
-     16r11223344 byteSwapped32 hexPrintString  
-     16r44332211 byteSwapped32 hexPrintString   
+     16r11223344 byteSwapped32 hexPrintString
+     16r44332211 byteSwapped32 hexPrintString
     "
 
     "Created: / 09-01-2012 / 23:01:33 / cg"
@@ -1682,31 +1809,34 @@
      i.e. a.b.c.d.e.f.g.h -> h.g.f.e.d.c.b.a"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     unsigned INT v = __intVal(self);
     unsigned INT swapped;
 
-#if __POINTER_SIZE__ == 4
-    //   xxxxxxxx 00000000 00000000 00000000 -> 00000000 00000000 00000000 xxxxxxxx  
+# if __POINTER_SIZE__ == 4
+    //   xxxxxxxx 00000000 00000000 00000000 -> 00000000 00000000 00000000 xxxxxxxx
     //            xxxxxxxx                                        xxxxxxxx
     //                     xxxxxxxx                      xxxxxxxx
     //                              xxxxxxxx    xxxxxxxx
     swapped = (v>>24) | ((v>>8)&0xFF00) | ((v & 0xFF00)<<8) | ((v & 0xFF)<<24);
     RETURN(__MKLARGEINT64(1, 0, swapped));
-#else
-    //   xxxxxxxx 00000000 00000000 00000000 -> 00000000 00000000 00000000 xxxxxxxx  
+# else
+    //   xxxxxxxx 00000000 00000000 00000000 -> 00000000 00000000 00000000 xxxxxxxx
     //            xxxxxxxx                                        xxxxxxxx
     //                     xxxxxxxx                      xxxxxxxx
     //                              xxxxxxxx    xxxxxxxx
     swapped =  (v>>56) | ((v>>40)&0xFF00) | ((v>>24) & 0xFF0000) | ((v>>8) & 0xFF000000)
-                | ((v & 0xFF000000)<<8) | ((v & 0x00FF0000)<<24) | ((v & 0x0000FF00)<<40)
-                | ((v & 0xFF)<<56);
+		| ((v & 0xFF000000)<<8) | ((v & 0x00FF0000)<<24) | ((v & 0x0000FF00)<<40)
+		| ((v & 0xFF)<<56);
+# endif
+    RETURN(__MKUINT( swapped ));
 #endif
-    RETURN(__MKUINT( swapped ));
 %}.
+    ^ super byteSwapped64
 
     "
-     16r11223344 byteSwapped64 hexPrintString  
-     16r44332211 byteSwapped64 hexPrintString   
+     16r11223344 byteSwapped64 hexPrintString
+     16r44332211 byteSwapped64 hexPrintString
     "
 
     "Created: / 09-01-2012 / 23:01:33 / cg"
@@ -1716,7 +1846,15 @@
     "return 8 bits of value, starting at byte index"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    int idx = index.intValue() - 1;
+
+    if (idx <= 7) {
+	int byteVal = (int)((self.longValue() >> (idx * 8)) & 0xFF);
+
+	return context._RETURN( STInteger._new(byteVal) );
+    }
+#else
     REGISTER INT val;
     INT idx;
 
@@ -1736,7 +1874,7 @@
 	    case 4:
 		val = (val >> 24);
 		break;
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
 	    case 5:
 		val = (val >> 32);
 		break;
@@ -1749,7 +1887,7 @@
 	    case 8:
 		val = (val >> 56);
 		break;
-#endif
+# endif
 	    default:
 		if (idx < 1)
 		    goto bad;   /* sorry */
@@ -1758,6 +1896,7 @@
 	RETURN ( __mkSmallInteger( val & 0xFF) );
     }
   bad: ;
+#endif /* not JAVA */
 %}.
     index > 0 ifFalse:[
 	"
@@ -1782,7 +1921,7 @@
      for negative ones, the actual bit representation is returned."
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     REGISTER INT val;
     INT idx;
 
@@ -1800,7 +1939,7 @@
 	    case 4:
 		val = (val >> 24);
 		break;
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
 	    case 5:
 		val = (val >> 32);
 		break;
@@ -1813,7 +1952,7 @@
 	    case 8:
 		val = (val >> 56);
 		break;
-#endif
+# endif
 	    default:
 		if (idx < 1)
 		    goto bad;   /* sorry */
@@ -1825,6 +1964,7 @@
 	RETURN ( __mkSmallInteger( val & 0xFF) );
     }
   bad: ;
+#endif /* not JAVA */
 %}.
     index > 0 ifFalse:[
 	"
@@ -1862,83 +2002,83 @@
      overhead of producing any intermediate byte-arrays (and the scanning)
     "
     self == 0 ifTrue: [
-        ^ ByteArray with:0.
+	^ ByteArray with:0.
     ].
 
     self < 0 ifTrue: [
-        absValue := self negated
+	absValue := self negated
     ] ifFalse: [
-        absValue := self.
+	absValue := self.
     ].
 
     b1 := absValue bitAnd:16rFF.
     absValue := absValue bitShift:-8.
     absValue == 0 ifTrue:[
-        digitByteArray := ByteArray with:b1
+	digitByteArray := ByteArray with:b1
     ] ifFalse:[
-        b2 := absValue bitAnd:16rFF.
-        absValue := absValue bitShift:-8.
-        absValue == 0 ifTrue:[
-            digitByteArray := ByteArray with:b1 with:b2
-        ] ifFalse:[
-            b3 := absValue bitAnd:16rFF.
-            absValue := absValue bitShift:-8.
-            absValue == 0 ifTrue:[
-                digitByteArray := ByteArray with:b1 with:b2 with:b3
-            ] ifFalse:[
-                b4 := absValue bitAnd:16rFF.
-                absValue := absValue bitShift:-8.
-                absValue == 0 ifTrue:[
-                    digitByteArray := ByteArray with:b1 with:b2 with:b3 with:b4
-                ] ifFalse:[
-                    b5 := absValue bitAnd:16rFF.
-                    absValue := absValue bitShift:-8.
-                    absValue == 0 ifTrue:[
-                        digitByteArray := ByteArray new:5.
-                        digitByteArray at:1 put:b1.
-                        digitByteArray at:2 put:b2.
-                        digitByteArray at:3 put:b3.
-                        digitByteArray at:4 put:b4.
-                        digitByteArray at:5 put:b5.
-                    ] ifFalse:[
-                        b6 := absValue bitAnd:16rFF.
-                        absValue := absValue bitShift:-8.
-                        absValue == 0 ifTrue:[
-                            digitByteArray := ByteArray new:6.
-                            digitByteArray at:1 put:b1.
-                            digitByteArray at:2 put:b2.
-                            digitByteArray at:3 put:b3.
-                            digitByteArray at:4 put:b4.
-                            digitByteArray at:5 put:b5.
-                            digitByteArray at:6 put:b6.
-                        ] ifFalse:[
-                            b7 := absValue bitAnd:16rFF.
-                            absValue := absValue bitShift:-8.
-                            absValue == 0 ifTrue:[
-                                digitByteArray := ByteArray new:7.
-                                digitByteArray at:1 put:b1.
-                                digitByteArray at:2 put:b2.
-                                digitByteArray at:3 put:b3.
-                                digitByteArray at:4 put:b4.
-                                digitByteArray at:5 put:b5.
-                                digitByteArray at:6 put:b6.
-                                digitByteArray at:7 put:b7.
-                            ] ifFalse:[
-                                digitByteArray := ByteArray new:8.
-                                digitByteArray at:1 put:b1.
-                                digitByteArray at:2 put:b2.
-                                digitByteArray at:3 put:b3.
-                                digitByteArray at:4 put:b4.
-                                digitByteArray at:5 put:b5.
-                                digitByteArray at:6 put:b6.
-                                digitByteArray at:7 put:b7.
-                                digitByteArray at:8 put:absValue.
-                            ]
-                        ]
-                    ]
-                ]
-            ]
-        ]
+	b2 := absValue bitAnd:16rFF.
+	absValue := absValue bitShift:-8.
+	absValue == 0 ifTrue:[
+	    digitByteArray := ByteArray with:b1 with:b2
+	] ifFalse:[
+	    b3 := absValue bitAnd:16rFF.
+	    absValue := absValue bitShift:-8.
+	    absValue == 0 ifTrue:[
+		digitByteArray := ByteArray with:b1 with:b2 with:b3
+	    ] ifFalse:[
+		b4 := absValue bitAnd:16rFF.
+		absValue := absValue bitShift:-8.
+		absValue == 0 ifTrue:[
+		    digitByteArray := ByteArray with:b1 with:b2 with:b3 with:b4
+		] ifFalse:[
+		    b5 := absValue bitAnd:16rFF.
+		    absValue := absValue bitShift:-8.
+		    absValue == 0 ifTrue:[
+			digitByteArray := ByteArray new:5.
+			digitByteArray at:1 put:b1.
+			digitByteArray at:2 put:b2.
+			digitByteArray at:3 put:b3.
+			digitByteArray at:4 put:b4.
+			digitByteArray at:5 put:b5.
+		    ] ifFalse:[
+			b6 := absValue bitAnd:16rFF.
+			absValue := absValue bitShift:-8.
+			absValue == 0 ifTrue:[
+			    digitByteArray := ByteArray new:6.
+			    digitByteArray at:1 put:b1.
+			    digitByteArray at:2 put:b2.
+			    digitByteArray at:3 put:b3.
+			    digitByteArray at:4 put:b4.
+			    digitByteArray at:5 put:b5.
+			    digitByteArray at:6 put:b6.
+			] ifFalse:[
+			    b7 := absValue bitAnd:16rFF.
+			    absValue := absValue bitShift:-8.
+			    absValue == 0 ifTrue:[
+				digitByteArray := ByteArray new:7.
+				digitByteArray at:1 put:b1.
+				digitByteArray at:2 put:b2.
+				digitByteArray at:3 put:b3.
+				digitByteArray at:4 put:b4.
+				digitByteArray at:5 put:b5.
+				digitByteArray at:6 put:b6.
+				digitByteArray at:7 put:b7.
+			    ] ifFalse:[
+				digitByteArray := ByteArray new:8.
+				digitByteArray at:1 put:b1.
+				digitByteArray at:2 put:b2.
+				digitByteArray at:3 put:b3.
+				digitByteArray at:4 put:b4.
+				digitByteArray at:5 put:b5.
+				digitByteArray at:6 put:b6.
+				digitByteArray at:7 put:b7.
+				digitByteArray at:8 put:absValue.
+			    ]
+			]
+		    ]
+		]
+	    ]
+	]
     ].
 
     ^ digitByteArray
@@ -1970,83 +2110,83 @@
      overhead of producing any intermediate byte-arrays (and the scanning)
     "
     self == 0 ifTrue: [
-        ^ ByteArray with:0.
+	^ ByteArray with:0.
     ].
 
     self < 0 ifTrue: [
-        absValue := self negated
+	absValue := self negated
     ] ifFalse: [
-        absValue := self.
+	absValue := self.
     ].
 
     b1 := absValue bitAnd:16rFF.
     absValue := absValue bitShift:-8.
     absValue == 0 ifTrue:[
-        digitByteArray := ByteArray with:b1
+	digitByteArray := ByteArray with:b1
     ] ifFalse:[
-        b2 := absValue bitAnd:16rFF.
-        absValue := absValue bitShift:-8.
-        absValue == 0 ifTrue:[
-            digitByteArray := ByteArray with:b2 with:b1
-        ] ifFalse:[
-            b3 := absValue bitAnd:16rFF.
-            absValue := absValue bitShift:-8.
-            absValue == 0 ifTrue:[
-                digitByteArray := ByteArray with:b3 with:b2 with:b1
-            ] ifFalse:[
-                b4 := absValue bitAnd:16rFF.
-                absValue := absValue bitShift:-8.
-                absValue == 0 ifTrue:[
-                    digitByteArray := ByteArray with:b4 with:b3 with:b2 with:b1
-                ] ifFalse:[
-                    b5 := absValue bitAnd:16rFF.
-                    absValue := absValue bitShift:-8.
-                    absValue == 0 ifTrue:[
-                        digitByteArray := ByteArray new:5.
-                        digitByteArray at:1 put:b5.
-                        digitByteArray at:2 put:b4.
-                        digitByteArray at:3 put:b3.
-                        digitByteArray at:4 put:b2.
-                        digitByteArray at:5 put:b1.
-                    ] ifFalse:[
-                        b6 := absValue bitAnd:16rFF.
-                        absValue := absValue bitShift:-8.
-                        absValue == 0 ifTrue:[
-                            digitByteArray := ByteArray new:6.
-                            digitByteArray at:1 put:b6.
-                            digitByteArray at:2 put:b5.
-                            digitByteArray at:3 put:b4.
-                            digitByteArray at:4 put:b3.
-                            digitByteArray at:5 put:b2.
-                            digitByteArray at:6 put:b1.
-                        ] ifFalse:[
-                            b7 := absValue bitAnd:16rFF.
-                            absValue := absValue bitShift:-8.
-                            absValue == 0 ifTrue:[
-                                digitByteArray := ByteArray new:7.
-                                digitByteArray at:1 put:b7.
-                                digitByteArray at:2 put:b6.
-                                digitByteArray at:3 put:b5.
-                                digitByteArray at:4 put:b4.
-                                digitByteArray at:5 put:b3.
-                                digitByteArray at:6 put:b2.
-                                digitByteArray at:7 put:b1.
-                            ] ifFalse:[
-                                digitByteArray := ByteArray new:8.
-                                digitByteArray at:1 put:absValue.
-                                digitByteArray at:2 put:b7.
-                                digitByteArray at:3 put:b6.
-                                digitByteArray at:4 put:b5.
-                                digitByteArray at:5 put:b4.
-                                digitByteArray at:6 put:b3.
-                                digitByteArray at:7 put:b2.
-                                digitByteArray at:8 put:b1.
-                            ]
-                        ]
-                    ]
-                ]
-            ]
-        ]
+	b2 := absValue bitAnd:16rFF.
+	absValue := absValue bitShift:-8.
+	absValue == 0 ifTrue:[
+	    digitByteArray := ByteArray with:b2 with:b1
+	] ifFalse:[
+	    b3 := absValue bitAnd:16rFF.
+	    absValue := absValue bitShift:-8.
+	    absValue == 0 ifTrue:[
+		digitByteArray := ByteArray with:b3 with:b2 with:b1
+	    ] ifFalse:[
+		b4 := absValue bitAnd:16rFF.
+		absValue := absValue bitShift:-8.
+		absValue == 0 ifTrue:[
+		    digitByteArray := ByteArray with:b4 with:b3 with:b2 with:b1
+		] ifFalse:[
+		    b5 := absValue bitAnd:16rFF.
+		    absValue := absValue bitShift:-8.
+		    absValue == 0 ifTrue:[
+			digitByteArray := ByteArray new:5.
+			digitByteArray at:1 put:b5.
+			digitByteArray at:2 put:b4.
+			digitByteArray at:3 put:b3.
+			digitByteArray at:4 put:b2.
+			digitByteArray at:5 put:b1.
+		    ] ifFalse:[
+			b6 := absValue bitAnd:16rFF.
+			absValue := absValue bitShift:-8.
+			absValue == 0 ifTrue:[
+			    digitByteArray := ByteArray new:6.
+			    digitByteArray at:1 put:b6.
+			    digitByteArray at:2 put:b5.
+			    digitByteArray at:3 put:b4.
+			    digitByteArray at:4 put:b3.
+			    digitByteArray at:5 put:b2.
+			    digitByteArray at:6 put:b1.
+			] ifFalse:[
+			    b7 := absValue bitAnd:16rFF.
+			    absValue := absValue bitShift:-8.
+			    absValue == 0 ifTrue:[
+				digitByteArray := ByteArray new:7.
+				digitByteArray at:1 put:b7.
+				digitByteArray at:2 put:b6.
+				digitByteArray at:3 put:b5.
+				digitByteArray at:4 put:b4.
+				digitByteArray at:5 put:b3.
+				digitByteArray at:6 put:b2.
+				digitByteArray at:7 put:b1.
+			    ] ifFalse:[
+				digitByteArray := ByteArray new:8.
+				digitByteArray at:1 put:absValue.
+				digitByteArray at:2 put:b7.
+				digitByteArray at:3 put:b6.
+				digitByteArray at:4 put:b5.
+				digitByteArray at:5 put:b4.
+				digitByteArray at:6 put:b3.
+				digitByteArray at:7 put:b2.
+				digitByteArray at:8 put:b1.
+			    ]
+			]
+		    ]
+		]
+	    ]
+	]
     ].
 
     ^ digitByteArray
@@ -2064,13 +2204,13 @@
      is returned."
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     INT val = __intVal(self);
 
     if (val < 0) {
 	val = -val;
     }
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
     if (val & 0xFFFFFFFF00000000L) {
 	if (val & 0xFFFF000000000000L) {
 	    if (val & 0xFF00000000000000L) {
@@ -2086,7 +2226,7 @@
 	    }
 	}
     }
-#endif
+# endif
 
     if (val & 0xFFFF0000) {
 	if (val & 0xFF000000) {
@@ -2101,7 +2241,7 @@
 	    RETURN ( __mkSmallInteger(1));
 	}
     }
-
+#endif
 %}.
     ^ self abs highBit - 1 // 8 + 1
 
@@ -2129,35 +2269,36 @@
      This case is handled in the superclass."
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     unsigned INT v = __intVal(self);
 
     if ((INT)v >= 0) {
-        unsigned INT swapped;
-
-#if __POINTER_SIZE__ == 8
-        swapped = ((v >> 8) & 0x00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF) << 8);
-#else
-        swapped = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
-#endif /* __POINTER_SIZE__ */
-
-        //if (__ISVALIDINTEGER(swapped)) {   // sorry, but this does not work here if (INT)swapped would be negative
-        if (swapped <= _MAX_INT) {
-            RETURN ( __mkSmallInteger(swapped) );
-        }
-        RETURN (__MKUINT(swapped));
+	unsigned INT swapped;
+
+# if __POINTER_SIZE__ == 8
+	swapped = ((v >> 8) & 0x00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF) << 8);
+# else
+	swapped = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
+# endif /* __POINTER_SIZE__ */
+
+	//if (__ISVALIDINTEGER(swapped)) {   // sorry, but this does not work here if (INT)swapped would be negative
+	if (swapped <= _MAX_INT) {
+	    RETURN ( __mkSmallInteger(swapped) );
+	}
+	RETURN (__MKUINT(swapped));
     }
+#endif
 %}.
     ^ super swapBytes
 
     "
-     -1 swapBytes hexPrintString   
-     16r11223344 swapBytes hexPrintString   
-     16r44332211 swapBytes hexPrintString 
+     -1 swapBytes hexPrintString
+     16r11223344 swapBytes hexPrintString
+     16r44332211 swapBytes hexPrintString
      self maxVal swapBytes hexPrintString
      self maxVal swapBytes swapBytes hexPrintString
-     16r1122334455667788 swapBytes hexPrintString   
-     16r11223344556677889900 swapBytes hexPrintString   
+     16r1122334455667788 swapBytes hexPrintString
+     16r11223344556677889900 swapBytes hexPrintString
     "
 
     "Created: / 09-01-2012 / 23:01:33 / cg"
@@ -2205,12 +2346,15 @@
      Redefined for performance (machine can do it faster)"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( STDouble._new((double)(self.longValue())) );
+#else
     OBJ newFloat;
     double dVal = (double)__intVal(self);
 
     __qMKFLOAT(newFloat, dVal);
     RETURN ( newFloat );
+#endif
 %}.
     ^ self primitiveFailed
 !
@@ -2226,13 +2370,16 @@
      Redefined for performance (machine can do it faster)"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( STFloat._new((float)(self.longValue())) );
+#else
     OBJ dummy = @global(ShortFloat);
     OBJ newFloat;
     float fVal = (float)__intVal(self);
 
     __qMKSFLOAT(newFloat, fVal);
     RETURN ( newFloat );
+#endif
 %}.
     ^ self primitiveFailed
 !
@@ -2261,6 +2408,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT i = __intVal(self);
 
     if (i & 0x800000) {
@@ -2270,6 +2418,7 @@
     }
 
     RETURN (__mkSmallInteger(i));
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -2285,6 +2434,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT i = __intVal(self);
 
     if (i & 0x80) {
@@ -2294,6 +2444,7 @@
     }
 
     RETURN (__mkSmallInteger(i));
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -2309,15 +2460,17 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT i = __intVal(self);
 
     if (i & 0x80000000) {
-        i = i | ~0xFFFFFFFFL;
+	i = i | ~0xFFFFFFFFL;
     } else {
-        i = i & 0x7FFFFFFF;
+	i = i & 0x7FFFFFFF;
     }
 
     RETURN (__mkSmallInteger(i));
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -2333,6 +2486,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT i = __intVal(self);
 
     if (i & 0x8000) {
@@ -2342,6 +2496,7 @@
     }
 
     RETURN (__mkSmallInteger(i));
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -2358,18 +2513,21 @@
     "return true, if the argument is greater than the receiver"
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.ltP( aNumber ));
+#else
     if (__isSmallInteger(aNumber)) {
-#ifdef POSITIVE_ADDRESSES
+# ifdef POSITIVE_ADDRESSES
 	RETURN ( (__intVal(self) < __intVal(aNumber)) ? true : false );
-#else
+# else
 	/* tag bit does not change ordering */
 	RETURN ( ((INT)self < (INT)aNumber) ? true : false );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	RETURN ( ((double)__intVal(self) < __floatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ aNumber lessFromInteger:self
     "^ self retry:#< coercing:aNumber"
@@ -2379,18 +2537,22 @@
     "return true, if the argument is greater or equal"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.leP( aNumber ));
+#else
 
     if (__isSmallInteger(aNumber)) {
-#ifdef POSITIVE_ADDRESSES
+# ifdef POSITIVE_ADDRESSES
 	RETURN ( (__intVal(self) <= __intVal(aNumber)) ? true : false );
-#else
+# else
 	/* tag bit does not change ordering */
 	RETURN ( ((INT)self <= (INT)aNumber) ? true : false );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	RETURN ( ((double)__intVal(self) <= __floatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ (self > aNumber) not
 
@@ -2402,6 +2564,9 @@
      as the receiver, false otherwise"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.eqP( aNumber ));
+#else
 
     if (aNumber == self) {
 	RETURN ( true );
@@ -2417,6 +2582,7 @@
     if (__qIsShortFloat(aNumber)) {
 	RETURN ( ((double)__intVal(self) == __shortFloatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ aNumber equalFromInteger:self
 !
@@ -2425,18 +2591,22 @@
     "return true, if the argument is less than the receiver"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.gtP( aNumber ));
+#else
 
     if (__isSmallInteger(aNumber)) {
-#ifdef POSITIVE_ADDRESSES
+# ifdef POSITIVE_ADDRESSES
 	RETURN ( (__intVal(self) > __intVal(aNumber)) ? true : false );
-#else
+# else
 	/* tag bit does not change ordering */
 	RETURN ( ((INT)self > (INT)aNumber) ? true : false );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	RETURN ( ((double)__intVal(self) > __floatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ (aNumber < self)
 
@@ -2447,18 +2617,22 @@
     "return true, if the argument is less or equal"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.geP( aNumber ));
+#else
 
     if (__isSmallInteger(aNumber)) {
-#ifdef POSITIVE_ADDRESSES
+# ifdef POSITIVE_ADDRESSES
 	RETURN ( (__intVal(self) >= __intVal(aNumber)) ? true : false );
-#else
+# else
 	/* tag bit does not change ordering */
 	RETURN ( ((INT)self >= (INT)aNumber) ? true : false );
-#endif
+# endif
     }
     if (__isFloatLike(aNumber)) {
 	RETURN ( ((double)__intVal(self) >= __floatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ (self < aNumber) not
 
@@ -2478,15 +2652,15 @@
     |low|
 
     low := self bitAnd: 16r3FFF.
-    ^ (9741 * low 
+    ^ (9741 * low
       + ((9741 * (self bitShift: -14) + (101 * low) bitAnd: 16383) * 16384))
-        bitAnd: 16r0FFFFFFF
+	bitAnd: 16r0FFFFFFF
 
     "
-     1 hashMultiply    
-     2 hashMultiply    
-     3 hashMultiply    
-     100 hashMultiply  
+     1 hashMultiply
+     2 hashMultiply
+     3 hashMultiply
+     100 hashMultiply
     "
 !
 
@@ -2503,14 +2677,15 @@
     "return the receiver or the argument, whichever is greater"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     if (__isSmallInteger(aNumber)) {
-#if TAG_INT == 1
+# if TAG_INT == 1
 	/* tag bit does not change ordering */
 	if ((INT)(self) > (INT)(aNumber))
-#else
+# else
 	if (__intVal(self) > __intVal(aNumber))
-#endif
+# endif
 	{
 	    RETURN ( self );
 	}
@@ -2522,6 +2697,7 @@
 	}
 	RETURN ( aNumber );
     }
+#endif
 %}.
     "/ fallback for non-smallInteger argument
 
@@ -2533,14 +2709,15 @@
     "return the receiver or the argument, whichever is smaller"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     if (__isSmallInteger(aNumber)) {
-#if TAG_INT == 1
+# if TAG_INT == 1
 	/* tag bit does not change ordering */
 	if ((INT)(self) < (INT)(aNumber))
-#else
+# else
 	if (__intVal(self) < __intVal(aNumber))
-#endif
+# endif
 	{
 	    RETURN ( self );
 	}
@@ -2552,6 +2729,7 @@
 	}
 	RETURN ( aNumber );
     }
+#endif
 %}.
     "/ fallback for non-smallInteger argument
 
@@ -2563,6 +2741,10 @@
     "return true, if the arguments value is not equal to mine"
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( (self.eqP( aNumber ) == STObject.True) ? STObject.False : STObject.True);
+    /* NOTREACHED */
+#else
 
     if (aNumber == self) {
 	RETURN ( false );
@@ -2578,6 +2760,7 @@
     if (__qIsShortFloat(aNumber)) {
 	RETURN ( ((double)__intVal(self) != __shortFloatVal(aNumber)) ? true : false );
     }
+#endif
 %}.
     ^ (self = aNumber) not
 ! !
@@ -2620,6 +2803,7 @@
      Reimplemented as primitive for speed"
 
 %{
+#ifndef __JAVA__
     REGISTER INT tmp;
     static struct inlineCache blockVal = __ILC0(0);
 
@@ -2635,16 +2819,16 @@
 		 * (the most common case)
 		 */
 		if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
-#ifdef PARANOIA
+# ifdef PARANOIA
 		 && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
-#endif
+# endif
 		) {
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 
 #                   define BLOCK_ARG  aBlock
 
-#else
+# else
 
 #                   define BLOCK_ARG  rHome
 		    REGISTER OBJ rHome;
@@ -2654,9 +2838,9 @@
 		     */
 		    rHome = __BlockInstPtr(aBlock)->b_home;
 		    if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
-#endif
+# endif
 		    {
-#ifdef __UNROLL_LOOPS__
+# ifdef __UNROLL_LOOPS__
 
 			/*
 			 * you are not supposed to program like this - I know what I do
@@ -2688,7 +2872,7 @@
 			    (*codeVal)(BLOCK_ARG);
 			    tmp -= 8;
 			}
-#endif /* __UNROLL_LOOPS__ */
+# endif /* __UNROLL_LOOPS__ */
 			do {
 			    if (InterruptPending != nil) goto interruptedX;
 	continueX:
@@ -2697,7 +2881,7 @@
 
 			RETURN (self);
 			if (0) {
-#ifdef __UNROLL_LOOPS__
+# ifdef __UNROLL_LOOPS__
 			    interrupted0:
 						__interruptL(@line); goto continue0;
 			    interrupted1:
@@ -2714,7 +2898,7 @@
 						__interruptL(@line); goto continue6;
 			    interrupted7:
 						__interruptL(@line); goto continue7;
-#endif /* __UNROLL_LOOPS__ */
+# endif /* __UNROLL_LOOPS__ */
 			    interruptedX:
 						__interruptL(@line); goto continueX;
 			}
@@ -2724,13 +2908,13 @@
 
 #           undef BLOCK_ARG
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 #           define BLOCK_ARG  aBlock
 #           define IBLOCK_ARG nil
-#else
+# else
 #           define BLOCK_ARG  (__BlockInstPtr(aBlock)->b_home)
 #           define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
-#endif
+# endif
 
 	    /*
 	     * sorry - must check for the blocks code within the loops;
@@ -2785,6 +2969,7 @@
 	} while(--tmp);
 	RETURN (self);
     }
+#endif
 %}.
     ^ super timesRepeat:aBlock
 
@@ -2801,6 +2986,7 @@
     "reimplemented as primitive for speed"
 
 %{
+#ifndef __JAVA__
     REGISTER INT tmp, step;
     REGISTER INT final;
     static struct inlineCache blockVal = __ILC1(0);
@@ -2820,23 +3006,23 @@
 		 * home on the stack (the most common case)
 		 */
 		if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
-#ifdef PARANOIA
+# ifdef PARANOIA
 		 && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
-#endif
+# endif
 		) {
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 
 #                   define BLOCK_ARG  aBlock
 
-#else
+# else
 
 #                   define BLOCK_ARG  rHome
 		    REGISTER OBJ rHome;
 		    rHome = __BlockInstPtr(aBlock)->b_home;
 		    if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
 
-#endif
+# endif
 		    {
 			if (step < 0) {
 			    if (step == -1) {
@@ -2879,13 +3065,13 @@
 
 #           undef BLOCK_ARG
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 #           define BLOCK_ARG  aBlock
 #           define IBLOCK_ARG nil
-#else
+# else
 #           define BLOCK_ARG  (__BlockInstPtr(aBlock)->b_home)
 #           define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
-#endif
+# endif
 
 	    if (step < 0) {
 		while (tmp >= final) {
@@ -2905,16 +3091,16 @@
 			     * arg is a compiled block with bytecode -
 			     * directly call interpreter without going through Block>>value
 			     */
-#ifdef PASS_ARG_POINTER
+# ifdef PASS_ARG_POINTER
 			    {
 				OBJ idx;
 
 				idx = __mkSmallInteger(tmp);
 				__interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &idx);
 			    }
-#else
+# else
 			    __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, __mkSmallInteger(tmp));
-#endif
+# endif
 
 			} else {
 			    /*
@@ -2943,16 +3129,16 @@
 			     * arg is a compiled block with bytecode -
 			     * directly call interpreter without going through Block>>value
 			     */
-#ifdef PASS_ARG_POINTER
+# ifdef PASS_ARG_POINTER
 			    {
 				OBJ idx;
 
 				idx = __mkSmallInteger(tmp);
 				__interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &idx);
 			    }
-#else
+# else
 			    __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, __mkSmallInteger(tmp));
-#endif
+# endif
 
 			} else {
 			    /*
@@ -2996,6 +3182,7 @@
 	}
 	RETURN ( self );
     }
+#endif
 %}.
     "/
     "/ arrive here if stop is not a smallInteger
@@ -3014,6 +3201,7 @@
      Reimplemented as primitive for speed"
 
 %{
+#ifndef __JAVA__
     REGISTER INT tmp;
     INT final;
     static struct inlineCache blockVal = __ILC1(0);
@@ -3033,27 +3221,27 @@
 
 		if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 
 #                   define BLOCK_ARG  aBlock
 
-#else
+# else
 
 #                   define BLOCK_ARG  rHome
 		    REGISTER OBJ rHome;
 		    rHome = __BlockInstPtr(aBlock)->b_home;
 		    if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
-#endif
+# endif
 		    {
 
-#ifdef PARANOIA
+# ifdef PARANOIA
 			if (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
-#endif
+# endif
 			{
 			    /*
 			     * static compiled blocks ...
 			     */
-#ifdef __UNROLL_LOOPS__
+# ifdef __UNROLL_LOOPS__
 			    /*
 			     * The following code is designed to run as fast as possible;
 			     *  - taken branches only if interrupts are pending
@@ -3062,95 +3250,95 @@
 			     *
 			     * you are not supposed to program like this - I know what I do
 			     */
-# if TAG_INT==1
+#  if TAG_INT==1
 			    INT t8 = (INT)(__mkSmallInteger(tmp+8));
 			    tmp = (INT)(__mkSmallInteger(tmp));
 			    final = (INT)(__mkSmallInteger(final));
-# else
+#  else
 			    INT t8 = tmp+8;
-# endif
+#  endif
 
 			    for (;;) {
 
 				while (t8 <= final) {
-# if TAG_INT==1
+#  if TAG_INT==1
 				    t8 += (INT)(__MASKSMALLINT(8));
-# else
+#  else
 				    t8 += 8;
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted0;
 	continue0:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp);
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted1;
 	continue1:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(1)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+1));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted2;
 	continue2:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(2)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+2));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted3;
 	continue3:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(3)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+3));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted4;
 	continue4:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(4)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+4));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted5;
 	continue5:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(5)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+5));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted6;
 	continue6:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(6)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+6));
-# endif
+#  endif
 				    if (InterruptPending != nil) goto interrupted7;
 	continue7:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp+(INT)(__MASKSMALLINT(7)) );
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp+7));
-# endif
-
-# if TAG_INT==1
+#  endif
+
+#  if TAG_INT==1
 				    tmp += (INT)(__MASKSMALLINT(8));
-# else
+#  else
 				    tmp += 8;
-# endif
+#  endif
 				}
 				while (tmp <= final) {
 				    if (InterruptPending != nil) goto interruptedX;
 	continueX:
-# if TAG_INT==1
+#  if TAG_INT==1
 				    (*codeVal)(BLOCK_ARG, tmp);
 				    tmp += (INT)(__MASKSMALLINT(1));
-# else
+#  else
 				    (*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp));
 				    tmp++;
-# endif
+#  endif
 				}
 				RETURN (self);
 
@@ -3180,14 +3368,14 @@
 						    __interruptL(@line); goto continueX;
 				}
 			    }
-#else
+# else
 			    while (tmp <= final) {
 				if (InterruptPending != nil) __interruptL(@line);
 				(*codeVal)(BLOCK_ARG, __mkSmallInteger(tmp));
 				tmp ++;
 			    }
 			    RETURN (self);
-#endif /* __UNROLL_LOOPS__ */
+# endif /* __UNROLL_LOOPS__ */
 			}
 
 			/*
@@ -3210,13 +3398,13 @@
 
 #           undef BLOCK_ARG
 
-#ifdef NEW_BLOCK_CALL
+# ifdef NEW_BLOCK_CALL
 #           define BLOCK_ARG  aBlock
 #           define IBLOCK_ARG nil
-#else
+# else
 #           define BLOCK_ARG  (__BlockInstPtr(aBlock)->b_home)
 #           define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
-#endif
+# endif
 
 	    /*
 	     * sorry - must check for the blocks code within the loops;
@@ -3246,16 +3434,16 @@
 			 * arg is a compiled block with bytecode -
 			 * directly call interpreter without going through Block>>value
 			 */
-#ifdef PASS_ARG_POINTER
+# ifdef PASS_ARG_POINTER
 			{
 			    OBJ idx;
 
 			    idx = __mkSmallInteger(tmp);
 			    __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &idx);
 			}
-#else
+# else
 			__interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, __mkSmallInteger(tmp));
-#endif
+# endif
 
 		    } else {
 			/*
@@ -3287,6 +3475,7 @@
 	}
 	RETURN ( self );
     }
+#endif /* not JAVA */
 %}.
 
     "/
@@ -3360,32 +3549,34 @@
 !
 
 divMod:aNumber
-    "return an array filled with 
-        (self // aNumber) and (self \\ aNumber).
+    "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
+	(receiver // something) * something + (receiver \\ something) = receiver
 
      Be careful with negative results: 9 // 4 -> 2, while -9 // 4 -> -3.
-     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,
-                        and -4 * 4 gives -12, so we need to add 2 to get the original -10.
+     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,
+			and -4 * 4 gives -12, so we need to add 2 to get the original -10.
 
      This is redefined here for more performance"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT val, div, mod, mySelf;
 
     if (__isSmallInteger(aNumber)
      && ((val = __intVal(aNumber)) > 0)
      && ((mySelf = __intVal(self)) >= 0)) {
-        div = mySelf / val;
-        mod = mySelf % val;
-
-        RETURN (__ARRAY_WITH2( __mkSmallInteger(div), __mkSmallInteger(mod)));
+	div = mySelf / val;
+	mod = mySelf % val;
+
+	RETURN (__ARRAY_WITH2( __mkSmallInteger(div), __mkSmallInteger(mod)));
     }
+#endif
 %}.
     ^ super divMod:aNumber
 
@@ -3407,14 +3598,14 @@
 
      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)
      1000000000000000000000 divMod:-3  -> #(-333333333333333333334 -2)
      -1000000000000000000000 divMod:3  -> #(-333333333333333333334 2)
      -1000000000000000000000 divMod:-3 -> #(333333333333333333333 -1)
-     100 factorial divMod:103    
+     100 factorial divMod:103
     "
 !
 
@@ -3425,7 +3616,7 @@
      some code. (thanx to MessageTally)"
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     if (__isSmallInteger(anInteger)) {
 	INT orgArg, ttt, selfInt, orgSelfInt, temp;
 
@@ -3452,8 +3643,8 @@
 	    RETURN ( __mkSmallInteger(selfInt) );
 	}
     }
-%}
-.
+#endif
+%}.
     ^ super gcd:anInteger
 !
 
@@ -3474,49 +3665,49 @@
      (i.e. without log)."
 
     self > 0 ifTrue:[
-        self < 10000 ifTrue:[
-            self < 10 ifTrue:[^ 0].
-            self < 100 ifTrue:[^ 1].
-            self < 1000 ifTrue:[^ 2].
-            ^ 3
-        ].
-        self < 100000000 ifTrue:[
-            self < 100000 ifTrue:[^ 4].
-            self < 1000000 ifTrue:[^ 5].
-            self < 10000000 ifTrue:[^ 6].
-            ^ 7
-        ].
-        self < 1000000000 ifTrue:[^ 8].
-        SmallInteger maxBytes == 4 ifTrue:[
-            "/ on a 32 bit machine, SmallInt cannot be larger
-            ^ 9
-        ].
-
-        "/ 64 bit machine
-        self < 100000000000000 ifTrue:[
-            self < 10000000000 ifTrue:[^ 9].
-            self < 100000000000 ifTrue:[^ 10].
-            self < 1000000000000 ifTrue:[^ 11].
-            self < 10000000000000 ifTrue:[^ 12].
-            ^ 13
-        ].   
-        self < 1000000000000000 ifTrue:[^ 14].
-        self < 10000000000000000 ifTrue:[^ 15].
-        self < 100000000000000000 ifTrue:[^ 16].
-        self < 1000000000000000000 ifTrue:[^ 17].
-        ^ 18.
+	self < 10000 ifTrue:[
+	    self < 10 ifTrue:[^ 0].
+	    self < 100 ifTrue:[^ 1].
+	    self < 1000 ifTrue:[^ 2].
+	    ^ 3
+	].
+	self < 100000000 ifTrue:[
+	    self < 100000 ifTrue:[^ 4].
+	    self < 1000000 ifTrue:[^ 5].
+	    self < 10000000 ifTrue:[^ 6].
+	    ^ 7
+	].
+	self < 1000000000 ifTrue:[^ 8].
+	SmallInteger maxBytes == 4 ifTrue:[
+	    "/ on a 32 bit machine, SmallInt cannot be larger
+	    ^ 9
+	].
+
+	"/ 64 bit machine
+	self < 100000000000000 ifTrue:[
+	    self < 10000000000 ifTrue:[^ 9].
+	    self < 100000000000 ifTrue:[^ 10].
+	    self < 1000000000000 ifTrue:[^ 11].
+	    self < 10000000000000 ifTrue:[^ 12].
+	    ^ 13
+	].
+	self < 1000000000000000 ifTrue:[^ 14].
+	self < 10000000000000000 ifTrue:[^ 15].
+	self < 100000000000000000 ifTrue:[^ 16].
+	self < 1000000000000000000 ifTrue:[^ 17].
+	^ 18.
     ].
 
     ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#intlog10
-        arguments:#()
-        errorString:'logarithm of negative integer'
+	raise:#domainErrorSignal
+	receiver:self
+	selector:#intlog10
+	arguments:#()
+	errorString:'logarithm of negative integer'
 
     "
-      99 intlog10 
-      100 intlog10  
+      99 intlog10
+      100 intlog10
       101 intlog10
       (101 log:10) floor
       120 intlog10
@@ -3534,74 +3725,76 @@
      or control systems, which represent numbers this way..."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     int i;
-    INT _10000000s = 0, _1000000s = 0; 
+    INT _10000000s = 0, _1000000s = 0;
     INT _100000s = 0, _10000s = 0, _1000s = 0;
     INT _100s = 0, _10s = 0, _1s = 0;
     INT b = __intVal(self);
     unsigned INT rslt;
 
     if (b <= 99999999) {
-        if (b <= 255) {
-            // the most common case: convert bytes
-            for (i=7; i>=0; i--) {
-                if (_100s >= 5)       _100s += 3; 
-                if (_10s >= 5)        _10s += 3;
-                if (_1s >= 5)         _1s += 3;
-
-                _100s    =    (_100s<<1)       | (_10s >> 3 & 1);       _100s &= 0xF;  
-                _10s     =    (_10s<<1)        | (_1s >> 3 & 1);        _10s &= 0xF; 
-                _1s      =    (_1s<<1)         | (b >> 7 & 1);          _1s &= 0xF; 
-                b <<= 1;      
-            }
-            rslt = (_100s<<8) | (_10s<<4) | _1s;
-            RETURN (__MKSMALLINT( rslt) );
-        }
-
-        for (i=26; i>=0; i--) {
-            if (_10000000s >= 5)  _10000000s += 3; 
-            if (_1000000s >= 5)   _1000000s += 3; 
-            if (_100000s >= 5)    _100000s += 3; 
-            if (_10000s >= 5)     _10000s += 3; 
-            if (_1000s >= 5)      _1000s += 3; 
-            if (_100s >= 5)       _100s += 3; 
-            if (_10s >= 5)        _10s += 3;
-            if (_1s >= 5)         _1s += 3;
-
-            _10000000s =  (_10000000s<<1)  | (_1000000s >> 3 & 1);  _10000000s &= 0xF;  
-            _1000000s =   (_1000000s<<1)   | (_100000s >> 3 & 1);   _1000000s &= 0xF;  
-            _100000s =    (_100000s<<1)    | (_10000s >> 3 & 1);    _100000s &= 0xF;  
-            _10000s  =    (_10000s<<1)     | (_1000s >> 3 & 1);     _10000s &= 0xF;  
-            _1000s   =    (_1000s<<1)      | (_100s >> 3 & 1);      _1000s &= 0xF;  
-            _100s    =    (_100s<<1)       | (_10s >> 3 & 1);       _100s &= 0xF;  
-            _10s     =    (_10s<<1)        | (_1s >> 3 & 1);        _10s &= 0xF; 
-            _1s      =    (_1s<<1)         | (b >> 26 & 1);         _1s &= 0xF; 
-            b <<= 1;      
-        }
-
-        rslt = (_10000000s<<28)
-               | (_1000000s<<24) | (_100000s<<20) | (_10000s<<16) 
-               | (_1000s<<12) | (_100s<<8) | (_10s<<4) | _1s;
-        RETURN (__MKUINT( rslt) );
+	if (b <= 255) {
+	    // the most common case: convert bytes
+	    for (i=7; i>=0; i--) {
+		if (_100s >= 5)       _100s += 3;
+		if (_10s >= 5)        _10s += 3;
+		if (_1s >= 5)         _1s += 3;
+
+		_100s    =    (_100s<<1)       | (_10s >> 3 & 1);       _100s &= 0xF;
+		_10s     =    (_10s<<1)        | (_1s >> 3 & 1);        _10s &= 0xF;
+		_1s      =    (_1s<<1)         | (b >> 7 & 1);          _1s &= 0xF;
+		b <<= 1;
+	    }
+	    rslt = (_100s<<8) | (_10s<<4) | _1s;
+	    RETURN (__MKSMALLINT( rslt) );
+	}
+
+	for (i=26; i>=0; i--) {
+	    if (_10000000s >= 5)  _10000000s += 3;
+	    if (_1000000s >= 5)   _1000000s += 3;
+	    if (_100000s >= 5)    _100000s += 3;
+	    if (_10000s >= 5)     _10000s += 3;
+	    if (_1000s >= 5)      _1000s += 3;
+	    if (_100s >= 5)       _100s += 3;
+	    if (_10s >= 5)        _10s += 3;
+	    if (_1s >= 5)         _1s += 3;
+
+	    _10000000s =  (_10000000s<<1)  | (_1000000s >> 3 & 1);  _10000000s &= 0xF;
+	    _1000000s =   (_1000000s<<1)   | (_100000s >> 3 & 1);   _1000000s &= 0xF;
+	    _100000s =    (_100000s<<1)    | (_10000s >> 3 & 1);    _100000s &= 0xF;
+	    _10000s  =    (_10000s<<1)     | (_1000s >> 3 & 1);     _10000s &= 0xF;
+	    _1000s   =    (_1000s<<1)      | (_100s >> 3 & 1);      _1000s &= 0xF;
+	    _100s    =    (_100s<<1)       | (_10s >> 3 & 1);       _100s &= 0xF;
+	    _10s     =    (_10s<<1)        | (_1s >> 3 & 1);        _10s &= 0xF;
+	    _1s      =    (_1s<<1)         | (b >> 26 & 1);         _1s &= 0xF;
+	    b <<= 1;
+	}
+
+	rslt = (_10000000s<<28)
+	       | (_1000000s<<24) | (_100000s<<20) | (_10000s<<16)
+	       | (_1000s<<12) | (_100s<<8) | (_10s<<4) | _1s;
+	RETURN (__MKUINT( rslt) );
     }
+#endif
 %}.
     ^ super asBCD.
 
     "
-      99999999 asBCD hexPrintString     
-      12812345 asBCD hexPrintString     
-      128123 asBCD hexPrintString   
-      128901 asBCD hexPrintString   
-      12890 asBCD hexPrintString    
-      1289 asBCD hexPrintString    
-      999 asBCD hexPrintString 
-      256 asBCD hexPrintString  
-      255 asBCD hexPrintString  
-      128 asBCD hexPrintString 
-      162 asBCD hexPrintString 
-
-      999999999 asBCD hexPrintString     
-      128123456 asBCD hexPrintString     
+      99999999 asBCD hexPrintString
+      12812345 asBCD hexPrintString
+      128123 asBCD hexPrintString
+      128901 asBCD hexPrintString
+      12890 asBCD hexPrintString
+      1289 asBCD hexPrintString
+      999 asBCD hexPrintString
+      256 asBCD hexPrintString
+      255 asBCD hexPrintString
+      128 asBCD hexPrintString
+      162 asBCD hexPrintString
+
+      999999999 asBCD hexPrintString
+      128123456 asBCD hexPrintString
 
     "
 !
@@ -3640,6 +3833,9 @@
      upon the printOn: method."
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( new STString( java.lang.Long.toString(self.longValue()) ));
+#else
     char buffer[30];    /* enough for 64 bit machines */
     char *cp;
     OBJ newString = nil;
@@ -3648,18 +3844,18 @@
     int len;
 
     if (self == __MKSMALLINT(0)) {
-        RETURN (@global(ZeroString));
+	RETURN (@global(ZeroString));
 //        RETURN (__MKSTRING_L("0", 1));
     }
     myValue = __intVal(self);
-#ifdef SLOW_CODE
+# ifdef SLOW_CODE
     /*
      * this takes twice as long as the code below ...
      * (printf is soooo slow)
      */
 
     /*
-     * PROTECT_REGISTERS: 
+     * PROTECT_REGISTERS:
      * actually only needed on sparc: since thisContext is
      * in a global register, which gets destroyed by printf,
      * manually save it here - very stupid ...
@@ -3669,28 +3865,29 @@
     __END_PROTECT_REGISTERS__
 
     if (len >= 0 && len <= sizeof(buffer)) {
-        newString = __MKSTRING_L(buffer, len);
+	newString = __MKSTRING_L(buffer, len);
     }
-#else
+# else
     if (myValue < 0) {
-        negative = 1;
-        myValue = -myValue;
+	negative = 1;
+	myValue = -myValue;
     }
     cp = buffer + sizeof(buffer) - 1;
     *cp-- = '\0';
     while (myValue != 0) {
-        *cp = '0' + (myValue % 10);
-        myValue = myValue / 10;
-        cp--;
+	*cp = '0' + (myValue % 10);
+	myValue = myValue / 10;
+	cp--;
     }
     if (negative) {
-        *cp-- = '-';
+	*cp-- = '-';
     }
     newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
-#endif
+# endif
     if (newString != nil) {
-        RETURN (newString);
+	RETURN (newString);
     }
+#endif /* not JAVA */
 %}.
     "/ only arrive here,
     "/  when having memory problems (i.e. no space for string) ...
@@ -3706,7 +3903,7 @@
     Time millisecondsToRun:[ 1000000 timesRepeat:[ 1234 printString ]]         130 140 130 130 130
     Time millisecondsToRun:[ 1000000 timesRepeat:[ 12 printString ]]           130 120 120 120 110
     Time millisecondsToRun:[ 1000000 timesRepeat:[ 5 printString ]]            110 110 100 110 90
-    Time millisecondsToRun:[ 1000000 timesRepeat:[ 0 printString ]]             60 
+    Time millisecondsToRun:[ 1000000 timesRepeat:[ 0 printString ]]             60
     "
 !
 
@@ -3716,6 +3913,7 @@
     |s|
 
 %{
+#ifndef __JAVA__
     char buffer[64+3];  /* for 64bit machines, base 2, plus sign, plus 0-byte */
     char *cp;
     OBJ newString;
@@ -3724,76 +3922,77 @@
     INT __base;
 
     if (__isSmallInteger(base)) {
-        if (self == __MKSMALLINT(0)) {
-            RETURN (__MKSTRING_L("0", 1));
-        }
-        myValue = __intVal(self);
-        __base = __intVal(base);
-
-#ifdef SLOW_CODE
-        /* disabled, because printf is slower than the code below */
-
-        switch (__base) {
-            case 10:
-                format = "%"_ld_"";
-                break;
-            case 16:
-                format = "%"_lx_"";
-                break;
-            case 8:
-                format = "%"_lo_"";
-                break;
-        }
-
-        if (format) {
-            /*
-             * actually only needed on sparc: since thisContext is
-             * in a global register, which gets destroyed by printf,
-             * manually save it here - very stupid ...
-             */
-            __BEGIN_PROTECT_REGISTERS__
-
-            len = snprintf(buffer, sizeof(buffer), format, (long)myValue);
-
-            __END_PROTECT_REGISTERS__
-
-            if (len > 0 && len <= sizeof(buffer)) {
-                newString = __MKSTRING_L(buffer, len);
-                if (newString != nil) {
-                    RETURN (newString);
-                }
-            }
-        }
-#else
-        if ((__base <= 36) && (__base > 1)) {
-            if (myValue < 0) {
-                negative = 1;
-                myValue = -myValue;
-            }
-            cp = buffer + sizeof(buffer) - 1;
-            *cp-- = '\0';
-            while (myValue != 0) {
-                int digit;
-
-                digit = myValue % __base;
-                if (digit <= 9) {
-                    *cp = '0' + digit;
-                } else {
-                    *cp = 'A' + digit - 10;
-                }
-                myValue = myValue / __base;
-                cp--;
-            }
-            if (negative) {
-                *cp-- = '-';
-            }
-            newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
-            if (newString != nil) {
-                RETURN (newString);
-            }
-        }
-#endif
+	if (self == __MKSMALLINT(0)) {
+	    RETURN (__MKSTRING_L("0", 1));
+	}
+	myValue = __intVal(self);
+	__base = __intVal(base);
+
+# ifdef SLOW_CODE
+	/* disabled, because printf is slower than the code below */
+
+	switch (__base) {
+	    case 10:
+		format = "%"_ld_"";
+		break;
+	    case 16:
+		format = "%"_lx_"";
+		break;
+	    case 8:
+		format = "%"_lo_"";
+		break;
+	}
+
+	if (format) {
+	    /*
+	     * actually only needed on sparc: since thisContext is
+	     * in a global register, which gets destroyed by printf,
+	     * manually save it here - very stupid ...
+	     */
+	    __BEGIN_PROTECT_REGISTERS__
+
+	    len = snprintf(buffer, sizeof(buffer), format, (long)myValue);
+
+	    __END_PROTECT_REGISTERS__
+
+	    if (len > 0 && len <= sizeof(buffer)) {
+		newString = __MKSTRING_L(buffer, len);
+		if (newString != nil) {
+		    RETURN (newString);
+		}
+	    }
+	}
+# else
+	if ((__base <= 36) && (__base > 1)) {
+	    if (myValue < 0) {
+		negative = 1;
+		myValue = -myValue;
+	    }
+	    cp = buffer + sizeof(buffer) - 1;
+	    *cp-- = '\0';
+	    while (myValue != 0) {
+		int digit;
+
+		digit = myValue % __base;
+		if (digit <= 9) {
+		    *cp = '0' + digit;
+		} else {
+		    *cp = 'A' + digit - 10;
+		}
+		myValue = myValue / __base;
+		cp--;
+	    }
+	    if (negative) {
+		*cp-- = '-';
+	    }
+	    newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
+	    if (newString != nil) {
+		RETURN (newString);
+	    }
+	}
+# endif
     }
+#endif /* not JAVA */
 %}.
     "/ arrive here, for bad base,
     "/ or when having memory problems (i.e. no space for string) ...
@@ -3844,39 +4043,41 @@
      Please use the printf: method, which is safe as it is completely implemented in Smalltalk."
 
 %{  /* STACK: 400 */
+#ifndef __JAVA__
     char buffer[256];
     OBJ s;
     int len;
 
     if (__isStringLike(formatString)) {
-        /*
-         * actually only needed on sparc: since thisContext is
-         * in a global register, which gets destroyed by printf,
-         * manually save it here - very stupid ...
-         */
-        __BEGIN_PROTECT_REGISTERS__
-
-        len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
-
-        __END_PROTECT_REGISTERS__
-
-        if (len < 0) goto fail;
-
-        s = __MKSTRING_L(buffer, len);
-        if (s != nil) {
-            RETURN (s);
-        }
+	/*
+	 * actually only needed on sparc: since thisContext is
+	 * in a global register, which gets destroyed by printf,
+	 * manually save it here - very stupid ...
+	 */
+	__BEGIN_PROTECT_REGISTERS__
+
+	len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
+
+	__END_PROTECT_REGISTERS__
+
+	if (len < 0) goto fail;
+
+	s = __MKSTRING_L(buffer, len);
+	if (s != nil) {
+	    RETURN (s);
+	}
     }
 fail: ;
+#endif /* not JAVA */
 %}.
     self primitiveFailed
 
     "
-        123 printfPrintString:'%%d -> %d'
-        123 printfPrintString:'%%6d -> %6d'   
-        123 printfPrintString:'%%x -> %x'     
-        123 printfPrintString:'%%4x -> %4x'   
-        123 printfPrintString:'%%04x -> %04x' 
+	123 printfPrintString:'%%d -> %d'
+	123 printfPrintString:'%%6d -> %6d'
+	123 printfPrintString:'%%x -> %x'
+	123 printfPrintString:'%%4x -> %4x'
+	123 printfPrintString:'%%04x -> %04x'
     "
 ! !
 
@@ -3913,13 +4114,15 @@
      This is of course not always correct, but allows for C/Java behavior to be emulated."
 
 %{  /* NOCONTEXT */
+#ifndef _JAVA__
     INT sum;
 
     sum =  __unsignedLongIntVal(self) + __unsignedLongIntVal(aNumber);
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
     sum &= 0xFFFFFFFFL;
-#endif
+# endif
     RETURN ( __MKUINT(sum));
+#endif /* not JAVA */
 %}.
     self primitiveFailed
 
@@ -3938,6 +4141,7 @@
      and can therefore speed things up by not going through LargeIntegers."
 
 %{  /* NOCONTEXT */
+#ifndef _JAVA__
 
     if (__isSmallInteger(aNumber)) {
 	INT sum;
@@ -3949,6 +4153,7 @@
 	}
 	RETURN ( __mkSmallInteger(sum));
     }
+#endif
 %}.
     self primitiveFailed
 
@@ -3970,6 +4175,7 @@
      and can therefore speed things up by not going through LargeIntegers."
 
 %{  /* NOCONTEXT */
+#ifndef _JAVA__
 
     if (__isSmallInteger(aNumber)) {
 	INT diff;
@@ -3981,6 +4187,7 @@
 	}
 	RETURN ( __mkSmallInteger(diff));
     }
+#endif
 %}.
     self primitiveFailed
 
@@ -4002,6 +4209,7 @@
      and can therefore speed things up by not going through LargeIntegers."
 
 %{  /* NOCONTEXT */
+#ifndef _JAVA__
 
     INT myValue, otherValue;
     unsigned INT productLow, productHi;
@@ -4019,25 +4227,25 @@
      * (took me a while to find this out :-(
      * (try 10000 * 10000)
      */
-#if defined(__sparc__) && defined(__GNUC__) && (__GNUC__ >= 2)
-# define USE_LONGLONG_FOR_MUL
-#endif
-
-#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 2)
-# define USE_LONGLONG_FOR_MUL
-#endif
+# if defined(__sparc__) && defined(__GNUC__) && (__GNUC__ >= 2)
+#  define USE_LONGLONG_FOR_MUL
+# endif
+
+# if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 2)
+#  define USE_LONGLONG_FOR_MUL
+# endif
 
     if (__isSmallInteger(aNumber)) {
 	myValue = __intVal(self);
 	otherValue = __intVal(aNumber);
 
-#if defined(USE_LONGLONG_FOR_MUL)
+# if defined(USE_LONGLONG_FOR_MUL)
 	{
-# if defined(__alpha__) && !defined(__alpha64__)
-#  define LONGLONG      INT64
-# else
-#  define LONGLONG      long long
-# endif
+#  if defined(__alpha__) && !defined(__alpha64__)
+#   define LONGLONG      INT64
+#  else
+#   define LONGLONG      long long
+#  endif
 	    LONGLONG product;
 
 	    product = (LONGLONG)myValue * (LONGLONG)otherValue;
@@ -4046,7 +4254,7 @@
 	    }
 	    RETURN ( __mkSmallInteger((INT)(product & _MAX_INT)));
 	}
-#else /* no long-long */
+# else /* no long-long */
 	negative = 1;
 	if (myValue < 0) {
 	    negative = -1;
@@ -4057,21 +4265,21 @@
 	    otherValue = -otherValue;
 	}
 
-# if defined(__GNUC__) && defined(__mc68k__)
+#  if defined(__GNUC__) && defined(__mc68k__)
 	asm ("mulu%.l %3,%1:%0"
 		: "=d"  ((unsigned long)(productLow)),
 		  "=d"  ((unsigned long)(productHi))
 		: "%0"  ((unsigned long)(myValue)),
 		  "dmi" ((unsigned long)(otherValue)));
-# else
-#  if defined (__GNUC__) && defined(__i386__)
+#  else
+#   if defined (__GNUC__) && defined(__i386__)
 	asm ("mull %3"
 		: "=a"  ((unsigned long)(productLow)),
 		  "=d"  ((unsigned long)(productHi))
 		: "%0"  ((unsigned long)(myValue)),
 		  "rm"  ((unsigned long)(otherValue)));
-#  else
-#   if defined(WIN32) && defined(__BORLANDC__)
+#   else
+#    if defined(WIN32) && defined(__BORLANDC__)
 	asm {
 	    mov   eax, myValue
 	    mov   edx, otherValue
@@ -4079,7 +4287,7 @@
 	    mov   productLow, eax
 	    mov   productHi, edx
 	}
-#   else /* generic */
+#    else /* generic */
 	{
 	    unsigned INT pHH, pHL, pLH, pLL;
 	    unsigned INT low1, low2, hi1, hi2;
@@ -4092,19 +4300,19 @@
 	     * (or at least 32*32 with Overflow check)
 	     * - need more assembler (inline) functions here
 	     */
-#    if __POINTER_SIZE__ == 8
+#     if __POINTER_SIZE__ == 8
 	    low1 = low32Bits((unsigned INT)myValue);
 	    hi1 = hi32Bits((unsigned INT)myValue);
 	    low2 = low32Bits((unsigned INT)otherValue);
 	    hi2 = hi32Bits((unsigned INT)otherValue);
-#     define LLMASK 0xC000000000000000L
-#    else
+#      define LLMASK 0xC000000000000000L
+#     else
 	    low1 = low16Bits((unsigned INT)myValue);
 	    hi1 = hi16Bits((unsigned INT)myValue);
 	    low2 = low16Bits((unsigned INT)otherValue);
 	    hi2 = hi16Bits((unsigned INT)otherValue);
-#     define LLMASK 0xC0000000
-#    endif
+#      define LLMASK 0xC0000000
+#     endif
 
 	    pLH = low1 * hi2;
 	    pHL = hi1 * low2;
@@ -4131,26 +4339,27 @@
 	     *   pLL                   |--------|--------|
 	     */
 
-#    if __POINTER_SIZE__ == 8
+#     if __POINTER_SIZE__ == 8
 	    t = low32Bits(pLH) + low32Bits(pHL) + hi32Bits(pLL);
 	    productLow = (t << 32) + low32Bits(pLL);
 	    productHi = pHH + hi32Bits(t) + hi32Bits(pHL) + hi32Bits(pLH);
-#    else
+#     else
 	    t = low16Bits(pLH) + low16Bits(pHL) + hi16Bits(pLL);
 	    productLow = (t << 16) + low16Bits(pLL);
 	    productHi = pHH + hi16Bits(t) + hi16Bits(pHL) + hi16Bits(pLH);
-#    endif
+#     endif
 	}
-#   endif /* ! WIN32 */
-#  endif /* ! (__GNUC__ && __i386__) */
-# endif /* ! (__GNUC__ && __mc68k__) */
+#    endif /* ! WIN32 */
+#   endif /* ! (__GNUC__ && __i386__) */
+#  endif /* ! (__GNUC__ && __mc68k__) */
 
 	if (negative < 0) {
 	    RETURN ( __mkSmallInteger(-(INT)(productLow & _MAX_INT)));
 	}
 	RETURN ( __mkSmallInteger((INT)(productLow & _MAX_INT)));
-#endif /* ! USE_LONGLONG */
+# endif /* ! USE_LONGLONG */
     }
+#endif /* not JAVA */
 %}.
 
     self primitiveFailed
@@ -4171,14 +4380,16 @@
      (changes the sign)"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     unsigned INT v;
 
     v = __intVal(self);
     v = ~v;
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
     v &= 0xFFFFFFFFL;
+# endif
+    RETURN ( __MKUINT(v) );
 #endif
-    RETURN ( __MKUINT(v) );
 %}.
     ^ self primitiveFailed
 
@@ -4196,6 +4407,7 @@
      Useful for crypt algorithms, or to emulate C/Java semantics."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     unsigned INT bits;
     int count;
@@ -4210,11 +4422,12 @@
 	} else {
 	    bits = (bits >> (-count)) | (bits << (32-(-count)));
 	}
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
 	bits &= 0xFFFFFFFFL;
-#endif
+# endif
 	RETURN (__MKUINT(bits));
     }
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -4241,6 +4454,7 @@
      or to emulate C/Java semantics."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     INT bits, count;
 
@@ -4256,11 +4470,12 @@
 	} else {
 	    bits = bits >> (-count);
 	}
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
 	bits &= 0xFFFFFFFFL;
-#endif
+# endif
 	RETURN (__MKINT(bits));
     }
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -4280,13 +4495,15 @@
      This is of course not always correct, but allows for C/Java behavior to be emulated."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT rslt;
 
     rslt =  __unsignedLongIntVal(self) ^ __unsignedLongIntVal(aNumber);
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
     rslt &= 0xFFFFFFFFL;
+# endif
+    RETURN ( __MKUINT(rslt));
 #endif
-    RETURN ( __MKUINT(rslt));
 %}.
     self primitiveFailed
 
@@ -4304,6 +4521,7 @@
      or to emulate C/Java semantics."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     unsigned INT bits;
     INT count;
@@ -4320,11 +4538,12 @@
 	} else {
 	    bits = bits >> (-count);
 	}
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
 	bits &= 0xFFFFFFFFL;
-#endif
+# endif
 	RETURN (__MKUINT(bits));
     }
+#endif
 %}.
     ^ self primitiveFailed
 
@@ -4348,30 +4567,32 @@
      - reimplemented here for speed"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     if (__bothSmallInteger(min, max)) {
-#if TAG_INT == 1
-        // tag bit does not change the magnitude order
-        if ((INT)self < (INT)(min)) {
-             RETURN ( false );
-        }
-        if ((INT)self > (INT)(max)) {
-             RETURN ( false );
-        }
-        RETURN ( true );
-#else
-        REGISTER INT selfVal;
-
-        selfVal = __intVal(self);
-        if (selfVal < __intVal(min)) {
-             RETURN ( false );
-        }
-        if (selfVal > __intVal(max)) {
-             RETURN ( false );
-        }
-        RETURN ( true );
+# if TAG_INT == 1
+	// tag bit does not change the magnitude order
+	if ((INT)self < (INT)(min)) {
+	     RETURN ( false );
+	}
+	if ((INT)self > (INT)(max)) {
+	     RETURN ( false );
+	}
+	RETURN ( true );
+# else
+	REGISTER INT selfVal;
+
+	selfVal = __intVal(self);
+	if (selfVal < __intVal(min)) {
+	     RETURN ( false );
+	}
+	if (selfVal > __intVal(max)) {
+	     RETURN ( false );
+	}
+	RETURN ( true );
+# endif
+    }
 #endif
-    }
 %}.
     (self < min) ifTrue:[^ false].
     (self > max) ifTrue:[^ false].
@@ -4382,8 +4603,9 @@
     "return true, if the receiver is even"
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? false : true );
+#endif
 %}.
     ^ super even
 !
@@ -4417,12 +4639,16 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-
-#if TAG_INT == 1
+#ifdef __JAVA__
+    return context._RETURN( self.ltP(0) );
+    /* NOTREACHED */
+#else
+# if TAG_INT == 1
     /* tag bit does not change sign */
     RETURN ( ((INT)(self) < 0) ? true : false );
-#else
+# else
     RETURN ( (__intVal(self) < 0) ? true : false );
+# endif
 #endif
 %}.
     ^ self < 0
@@ -4433,6 +4659,7 @@
      Useful for padding."
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
     INT x;
 
     x = __intVal(self) - 1;
@@ -4441,11 +4668,14 @@
     x |= (x >> 4);
     x |= (x >> 8);
     x |= (x >> 16);
-#if __POINTER_SIZE__ == 8
+# if __POINTER_SIZE__ == 8
     x |= (x >> 32);
+# endif
+    RETURN (__MKINT(x + 1));
 #endif
-    RETURN (__MKINT(x + 1));
-%}
+%}.
+    ^ super nextPowerOf2
+
     "
      1 nextPowerOf2
      2 nextPowerOf2
@@ -4457,9 +4687,9 @@
      8 nextPowerOf2
 
      22 nextPowerOf2
-     10 factorial nextPowerOf2 
-     20 factorial nextPowerOf2 
-     100 factorial nextPowerOf2 
+     10 factorial nextPowerOf2
+     20 factorial nextPowerOf2
+     100 factorial nextPowerOf2
     "
 !
 
@@ -4467,8 +4697,9 @@
     "return true, if the receiver is odd"
 
 %{  /* NOCONTEXT */
-
+#ifndef __JAVA__
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? true : false );
+#endif
 %}.
     ^ super odd
 
@@ -4480,9 +4711,10 @@
      Undefined for negative values (smalltalk does not require the machine to use 2's complement)"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     // tricky, but very fast (google for it, to understand)
-#if __POINTER_SIZE__ == 4
+# if __POINTER_SIZE__ == 4
     unsigned int v = __intVal(self);
 
     v ^= v >> 16;
@@ -4490,6 +4722,7 @@
     v ^= v >> 4;
     v &= 0xf;
     RETURN ( ( (0x6996 >> v) & 1 ) ? true : false );
+# endif
 #endif
 %}.
     ^ super parityOdd
@@ -4516,12 +4749,16 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-
-#if TAG_INT == 1
+#ifdef __JAVA__
+    return context._RETURN( (self.ltP(0) == STObject.True) ? STObject.False : STObject.True);
+#else
+
+# if TAG_INT == 1
     /* tag bit does not change sign */
     RETURN ( ((INT)(self) >= 0) ? true : false );
-#else
+# else
     RETURN ( (__intVal(self) >= 0) ? true : false );
+# endif
 #endif
 %}.
     ^ super positive
@@ -4533,6 +4770,7 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
+#ifndef __JAVA__
 
     INT val = __intVal(self);
 
@@ -4543,6 +4781,7 @@
 	RETURN ( __mkSmallInteger(1) );
     }
     RETURN ( __mkSmallInteger(0) );
+#endif
 %}.
     ^ super sign
 !
@@ -4552,31 +4791,33 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-
-#if TAG_INT == 1
+#ifndef __JAVA__
+
+# if TAG_INT == 1
     /* tag bit does not change sign */
     RETURN ( ((INT)(self) > (INT)(__mkSmallInteger(0))) ? true : false );
-#else
+# else
     RETURN ( (__intVal(self) > 0) ? true : false );
+# endif
 #endif
 %}.
     ^ super strictlyPositive
 
     "
-     0 strictlyPositive  
-     1 strictlyPositive   
-     -1 strictlyPositive  
+     0 strictlyPositive
+     1 strictlyPositive
+     -1 strictlyPositive
     "
 ! !
 
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.227 2015-03-26 16:23:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.231 2015-04-19 22:55:08 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.227 2015-03-26 16:23:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.231 2015-04-19 22:55:08 cg Exp $'
 ! !
 
 
--- a/String.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/String.st	Mon Apr 20 06:40:26 2015 +0200
@@ -160,7 +160,9 @@
      can be directly used as separator or for formatting."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.basicNew( anInteger.intValue() ));
+#else
     OBJ newString;
     REGISTER int len;
     REGISTER unsigned char *cp;
@@ -182,7 +184,7 @@
 
 		    cp = __stringVal(newString);
 
-#if defined(memset4) && !defined(NON_ASCII)
+# if defined(memset4) && !defined(NON_ASCII)
 		    {
 			/*
 			 * no sizeof(int) here please -
@@ -194,31 +196,31 @@
 			memset4(cp, 0x20202020, l4);
 			cp[len] = '\0';
 		    }
-#else
-# ifdef FAST_MEMSET
+# else
+#  ifdef FAST_MEMSET
 		    memset(cp, ' ', len);
 		    cp[len] = '\0';
-# else
+#  else
 		    while (len >= 8) {
-#  ifndef NON_ASCII       /* i.e. EBCDIC  */
-#   ifdef INT64
+#   ifndef NON_ASCII       /* i.e. EBCDIC  */
+#    ifdef INT64
 			((INT64 *)cp)[0] = 0x2020202020202020L;
-#   else
+#    else
 			((int *)cp)[0] = 0x20202020;
 			((int *)cp)[1] = 0x20202020;
-#   endif
-#  else
+#    endif
+#   else
 			cp[0] = cp[1] = cp[2] = cp[3] = ' ';
 			cp[4] = cp[5] = cp[6] = cp[7] = ' ';
-#  endif
+#   endif
 			cp += 8;
 			len -= 8;
 		    }
 		    while (len--)
 			*cp++ = ' ';
 		    *cp = '\0';
-# endif /* not FAST_MEMSET */
-#endif /* not memset4 */
+#  endif /* not FAST_MEMSET */
+# endif /* not memset4 */
 
 		    RETURN (newString);
 		}
@@ -244,53 +246,54 @@
 		/*
 		 * nil-out instvars
 		 */
-#if defined(memset4)
+# if defined(memset4)
 		memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
-#else
-# if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
+# else
+#  if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
 		/*
 		 * knowing that nil is 0
 		 */
 		memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
-# else
+#  else
 		op = __InstPtr(newString)->i_instvars;
 		do {
 		    *op++ = nil;
 		} while (--nInstVars);
+#  endif
 # endif
-#endif
 	    }
 
 	    /*
 	     * fill with spaces
 	     */
-#ifdef FAST_MEMSET
+# ifdef FAST_MEMSET
 	    memset(cp, ' ', len);
 	    *(cp + len) = '\0';
-#else
+# else
 	    while (len >= 8) {
-# ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
-#  ifdef INT64
+#  ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
+#   ifdef INT64
 		((INT64 *)cp)[0] = 0x2020202020202020L;
-#  else
+#   else
 		((int *)cp)[0] = 0x20202020;
 		((int *)cp)[1] = 0x20202020;
-#  endif
-# else
+#   endif
+#  else
 		cp[0] = cp[1] = cp[2] = cp[3] = ' ';
 		cp[4] = cp[5] = cp[6] = cp[7] = ' ';
-# endif
+#  endif
 		cp += 8;
 		len -= 8;
 	    }
 	    while (len--)
 		*cp++ = ' ';
 	    *cp = '\0';
-#endif
+# endif
 	    RETURN (newString);
 	}
     }
 fail: ;;
+#endif /* not JAVA */
 %}.
     "
      invalid argument, or out-of-memory:
@@ -349,7 +352,9 @@
      used as a stream buffer."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.basicNew( anInteger.intValue() ));
+#else
     OBJ newString;
     REGISTER int len;
     REGISTER unsigned char *cp;
@@ -392,21 +397,21 @@
 		/*
 		 * nil-out instvars
 		 */
-#if defined(memset4)
+# if defined(memset4)
 		memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
-#else
-# if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
+# else
+#  if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
 		/*
 		 * knowing that nil is 0
 		 */
 		memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
-# else
+#  else
 		op = __InstPtr(newString)->i_instvars;
 		do {
 		    *op++ = nil;
 		} while (--nInstVars);
+#  endif
 # endif
-#endif
 		cp = __stringVal(newString) + __OBJS2BYTES__(nInstVars);
 	    } else {
 		cp = __stringVal(newString);
@@ -417,6 +422,7 @@
 	}
     }
 fail: ;;
+#endif /* not JAVA */
 %}.
     "
      invalid argument, or out-of-memory:
@@ -554,7 +560,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __JAVA__
-    if (context.stArg(0).isSmallInteger()) {
+    if (index.isSmallInteger()) {
 	int idx1Based = context.stArg(0).intValue();   // st index is 1 based
 	return context.RETURN( self.basicAt( idx1Based ));
     }
@@ -589,12 +595,11 @@
 
 %{  /* NOCONTEXT */
 #ifdef __JAVA__
-    if (context.stArg(0).isSmallInteger()) {
-	int idx1Based = context.stArg(0).intValue();   // st index is 1 based
-	STObject val = context.stArg(1);
-
-	self.basicAt_put_(idx1Based, val );
-	return context.RETURN( val );
+    if (index.isSmallInteger()) {
+	int idx1Based = index.intValue();   // st index is 1 based
+
+	self.basicAt_put_(idx1Based, aCharacter );
+	return context.RETURN( aCharacter );
     }
 #else
     REGISTER int value, indx;
@@ -626,8 +631,8 @@
 
 %{  /* NOCONTEXT */
 #ifdef __JAVA__
-    if (context.stArg(0).isSmallInteger()) {
-	int idx1Based = context.stArg(0).intValue();   // st index is 1 based
+    if (index.isSmallInteger()) {
+	int idx1Based = index.intValue();   // st index is 1 based
 	return context.RETURN( self.basicAt( idx1Based ));
     }
 #else
@@ -647,7 +652,7 @@
 	}
     }
 badIndex: ;
-#endif
+#endif /* not JAVA */
 %}.
     index isInteger ifFalse:[
 	^ self indexNotInteger:index
@@ -665,12 +670,11 @@
 
 %{  /* NOCONTEXT */
 #ifdef __JAVA__
-    if (context.stArg(0).isSmallInteger()) {
-	int idx1Based = context.stArg(0).intValue();   // st index is 1 based
-	STObject val = context.stArg(1);
-
-	self.basicAt_put_(idx1Based, val );
-	return context.RETURN( val );
+    if (index.isSmallInteger()) {
+	int idx1Based = index.intValue();   // st index is 1 based
+
+	self.basicAt_put_(idx1Based, aCharacter );
+	return context.RETURN( aCharacter );
     }
 #else
     REGISTER int value, indx;
@@ -696,7 +700,7 @@
 	}
     }
 badIndex: ;
-#endif
+#endif /* not JAVA */
 %}.
     (aCharacter isMemberOf:Character) ifFalse:[
 	"
@@ -1153,19 +1157,19 @@
 		    /* only a single character match */
 		    unsigned char m = matchP[0];
 
-    #ifdef FAST_MEMCHR
+# ifdef FAST_MEMCHR
 		    ccp = (unsigned char *) memchr(cp, m, len+1-index);
 		    if (ccp) {
 			RETURN ( __mkSmallInteger((ccp - cp) + index + 1) );
 		    }
-    #else
+# else
 		    while (c = *cp++) {
 			if (c == m) {
 			    RETURN ( __mkSmallInteger(index) );
 			}
 			index++;
 		    }
-    #endif
+# endif
 		    RETURN ( __mkSmallInteger(0) );
 		}
 
@@ -1306,6 +1310,7 @@
     }
     RETURN ( __mkSmallInteger(0) );
 %}.
+    ^ super indexOfNonSeparatorStartingAt:start
 
     "
      'hello world' indexOfNonWhiteSpaceStartingAt:3
@@ -1349,6 +1354,7 @@
     }
     RETURN ( __mkSmallInteger(0) );
 %}.
+    ^ super indexOfSeparatorStartingAt:start
 
     "
      'hello world' indexOfSeparatorStartingAt:3
@@ -1432,7 +1438,10 @@
      This may change."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.stringLtP(aString) );
+    /* NOTREACHED */
+#else
     int len1, len2, cmp;
     unsigned char *cp1, *cp2;
     int argIsString;
@@ -1478,6 +1487,7 @@
 	    RETURN ( false );
 	}
     }
+#endif
 %}.
     ^ super < aString
 !
@@ -1489,7 +1499,10 @@
      Use sameAs: to compare with case ignored."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.stringEqualP(aString) );
+    /* NOTREACHED */
+#else
     int l1, l2;
     unsigned char *cp1, *cp2;
     INT addrDelta;
@@ -1531,11 +1544,11 @@
 	if (l1 != l2) {
 	    RETURN ( false );
 	}
-#ifdef FAST_MEMCMP
+# ifdef FAST_MEMCMP
 	RETURN ( (memcmp(cp1, cp2, l1) == 0) ? true : false );
-#else
+# else
 	addrDelta = cp2 - cp1;
-# ifdef __UNROLL_LOOPS__
+#  ifdef __UNROLL_LOOPS__
 	while (l1 >= (sizeof(unsigned INT)*4)) {
 	    if (((unsigned INT *)cp1)[0] != ((unsigned INT *)(cp1+addrDelta))[0]) {
 		RETURN (false);
@@ -1552,7 +1565,7 @@
 	    l1 -= (sizeof(unsigned INT) * 4);
 	    cp1 += (sizeof(unsigned INT) * 4);
 	}
-# endif /* __UNROLL_LOOPS__ */
+#  endif /* __UNROLL_LOOPS__ */
 	while (l1 >= sizeof(unsigned INT)) {
 	    if (*((unsigned INT *)cp1) != *((unsigned INT *)(cp1+addrDelta))) {
 		RETURN (false);
@@ -1576,8 +1589,9 @@
 	}
 
 	RETURN (true);
-#endif
+# endif
     }
+#endif /* not JAVA */
 %}.
     ^ super = aString
 
@@ -1608,7 +1622,10 @@
      This may change."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( aString.stringLtP( self ) );
+    /* NOTREACHED */
+#else
     int len1, len2, cmp;
     unsigned char *cp1, *cp2;
     int argIsString;
@@ -1654,6 +1671,7 @@
 	    RETURN ( false );
 	}
     }
+#endif /* not JAVA */
 %}.
     ^ super > aString
 !
@@ -1793,7 +1811,8 @@
     // make sure, it fits into a smallInt
     h = (h ^ (h >> 30)) & 0x3FFFFFFF;
     RETURN(__mkSmallInteger(h));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      'a' hash
@@ -1859,7 +1878,8 @@
      */
     val *= 31415821;
     RETURN ( __mkSmallInteger(val & _MAX_INT));
-%}
+%}.
+    ^ self primitiveFailed
 !
 
 hash_fnv1a
@@ -1897,7 +1917,8 @@
     // make it a smallInteger
     h = (h ^ (h >> 30)) & 0x3FFFFFFF;
     RETURN ( __mkSmallInteger(h));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      'a' hash_fnv1a
@@ -1940,7 +1961,8 @@
 	val = ((val * 31) & 0xFFFFFFFF) + *cp++;
     }
     RETURN ( __MKUINT(val));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      'a' hash_java
@@ -1982,7 +2004,8 @@
 	val = ((val * 65599) & _MAX_INT) + *cp++;
     }
     RETURN ( __mkSmallInteger(val & _MAX_INT));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      'a' hash
@@ -2002,7 +2025,10 @@
      extra message send."
 
 %{  /* NOCONTEXT */
-
+#ifdef __JAVA__
+    return context._RETURN( self.stringEqualP( aString.not()) );
+    /* NOTREACHED */
+#else
     int l1, l2;
     unsigned char *cp1, *cp2;
     OBJ cls, myCls;
@@ -2088,6 +2114,7 @@
 	}
 	RETURN (false);
     }
+#endif /* not JAVA */
 %}.
     ^ super ~= aString
 ! !
@@ -2248,6 +2275,9 @@
     "Return a unique symbol with the name taken from the receivers characters."
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( self.asSTSymbol() );
+#else
     OBJ newSymbol;
     OBJ cls;
     char *cp = __stringVal(self);
@@ -2261,6 +2291,7 @@
     if (newSymbol) {
 	RETURN ( newSymbol);
     }
+#endif /* not JAVA */
 %}.
     ^ ObjectMemory allocationFailureSignal raise.
 
@@ -2277,6 +2308,9 @@
      performed once."
 
 %{  /* NOCONTEXT */
+#ifdef __JAVA__
+    return context._RETURN( STSymbol.asSymbolIfInterned( self.asString() ));
+#else
     OBJ cls;
     int indx;
 
@@ -2287,8 +2321,9 @@
 	indx = 0;
     }
     RETURN ( __SYMBOL_OR_NIL(__stringVal(self) + indx));
+#endif /* not JAVA */
 %}.
-    self primitiveFailed
+    ^ self primitiveFailed
     "
      'hello' asSymbolIfInterned
      'fooBarBaz' asSymbolIfInterned
@@ -2455,7 +2490,7 @@
 		cp1 = (char *) __stringVal(self);
 		cp2 = (char *) __stringVal(aString);
 
-#ifdef bcopy4
+# ifdef bcopy4
 		/* knowing that allocation is 4-byte aligned and
 		 * size rounded up to next 4-byte, the first copy
 		 * can be done word-wise.
@@ -2469,21 +2504,21 @@
 		    bcopy4(cp1, dstp, nw);
 		    dstp += l1;
 		}
-#else
-# ifdef FAST_MEMCPY
+# else
+#  ifdef FAST_MEMCPY
 		memcpy(dstp, cp1, l1);
 		dstp += l1;
-# else
+#  else
 		while (l1 >= 4) {
 		    *(int *)dstp = *(int *)cp1;
 		    dstp += 4; cp1 += 4;
 		    l1 -= 4;
 		}
 		while (l1--) *dstp++ = *cp1++;
+#  endif
 # endif
-#endif
-
-#ifdef bcopy4
+
+# ifdef bcopy4
 		if (((INT)dstp & 3) == 0) {
 		    int nw = l2 >> 2;
 
@@ -2492,15 +2527,15 @@
 		    *(dstp + l2) = '\0';
 		    RETURN ( newString );
 		}
-#endif
-
-#ifdef FAST_MEMCPY
+# endif
+
+# ifdef FAST_MEMCPY
 		memcpy(dstp, cp2, l2+1);
 		dstp[l2] = '\0';
-#else
+# else
 		while (l2--) *dstp++ = *cp2++;
 		*dstp = '\0';
-#endif
+# endif
 		RETURN ( newString );
 	    }
 	}
@@ -2805,7 +2840,7 @@
 		__qSTORE(newString, String);
 		dstp = __stringVal(newString);
 
-#ifdef bcopy4
+# ifdef bcopy4
 		{
 		    int nw = count >> 2;
 		    char *srcp = (char *)__stringVal(self);
@@ -2816,11 +2851,11 @@
 		    bcopy4(srcp, dstp, nw);
 		    dstp += count;
 		}
-#else
-# ifdef FAST_MEMCPY
+# else
+#  ifdef FAST_MEMCPY
 		memcpy(dstp, __stringVal(self), count);
 		dstp += count;
-# else
+#  else
 		{
 		    REGISTER unsigned char *srcp;
 
@@ -2828,7 +2863,7 @@
 		    while ((*dstp = *srcp++) != '\0')
 			dstp++;
 		}
-# endif
+#  endif
 # endif
 		*dstp++ = cVal;
 		*dstp = '\0';
@@ -3609,6 +3644,7 @@
     }
     RETURN (false);
 %}.
+    ^ super contains8BitCharacters
 
     "
      'hello world' contains8BitCharacters
@@ -3914,17 +3950,17 @@
     if ((cls = __qClass(self)) != String)
 	src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
 
-#ifndef NON_ASCII
-# ifdef UINT64
+#  ifndef NON_ASCII
+#   ifdef UINT64
     while (*((UINT64 *)src) == 0x2020202020202020L) {
 	src += 8;
     }
-# endif /* UINT64 */
+#   endif /* UINT64 */
 
     while (*((unsigned *)src) == 0x20202020) {
 	src += 4;
     }
-#endif /* ascii */
+#  endif /* ascii */
 
     while (c = *src++) {
 	if (c != ' ') {
@@ -3932,7 +3968,7 @@
 	}
     }
     RETURN ( true );
-#endif /* ! __JAVA__ */
+# endif /* ! __JAVA__ */
 %}.
     ^ super isBlank
 !
@@ -4120,7 +4156,7 @@
 	    RETURN ( false );
 	}
 
-#ifdef UINT64
+# ifdef UINT64
 	while (len2 > (OHDR_SIZE+sizeof(UINT64))) {
 	    if ( ((UINT64 *)src1)[0] != ((UINT64 *)src2)[0] ) {
 		RETURN (false);
@@ -4129,8 +4165,8 @@
 	    src1 += sizeof(UINT64);
 	    src2 += sizeof(UINT64);
 	}
-#else
-# ifdef __UNROLL_LOOPS__
+# else
+#  ifdef __UNROLL_LOOPS__
 	while (len2 > (OHDR_SIZE+sizeof(INT)*4)) {
 	    if ( ((unsigned INT *)src1)[0] != ((unsigned INT *)src2)[0]) {
 		RETURN (false);
@@ -4148,8 +4184,8 @@
 	    src1 += sizeof(INT)*4;
 	    src2 += sizeof(INT)*4;
 	}
-# endif /* __UNROLL_LOOPS__ */
-#endif /* UINT64 */
+#  endif /* __UNROLL_LOOPS__ */
+# endif /* UINT64 */
 
 	while (len2 > (OHDR_SIZE+sizeof(INT))) {
 	    if ( ((unsigned INT *)src1)[0] != ((unsigned INT *)src2)[0]) {
@@ -4217,10 +4253,9 @@
 !String class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.332 2015-04-15 00:30:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.334 2015-04-19 22:55:08 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.332 2015-04-15 00:30:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.334 2015-04-19 22:55:08 cg Exp $'
 ! !
-
--- a/UnixOperatingSystem.st	Sat Apr 18 06:57:35 2015 +0200
+++ b/UnixOperatingSystem.st	Mon Apr 20 06:40:26 2015 +0200
@@ -2036,530 +2036,530 @@
      */
 
     if (__isSmallInteger(errNr)) {
-        switch ( __intVal(errNr)) {
-            /*
-             * POSIX errnos - these should be defined
-             */
+	switch ( __intVal(errNr)) {
+	    /*
+	     * POSIX errnos - these should be defined
+	     */
 #ifdef EPERM
-            case EPERM:
-                sym = @symbol(EPERM);
-                typ = @symbol(noPermissionsSignal);
-                break;
+	    case EPERM:
+		sym = @symbol(EPERM);
+		typ = @symbol(noPermissionsSignal);
+		break;
 #endif
 #ifdef ENOENT
-            case ENOENT:
-                sym = @symbol(ENOENT);
-                typ = @symbol(nonexistentSignal);
-                break;
+	    case ENOENT:
+		sym = @symbol(ENOENT);
+		typ = @symbol(nonexistentSignal);
+		break;
 #endif
 #ifdef ESRCH
-            case ESRCH:
-                sym = @symbol(ESRCH);
-                typ = @symbol(unavailableReferentSignal);
-                break;
+	    case ESRCH:
+		sym = @symbol(ESRCH);
+		typ = @symbol(unavailableReferentSignal);
+		break;
 #endif
 #ifdef EINTR
-            case EINTR:
-                sym = @symbol(EINTR);
-                typ = @symbol(transientErrorSignal);
-                break;
+	    case EINTR:
+		sym = @symbol(EINTR);
+		typ = @symbol(transientErrorSignal);
+		break;
 #endif
 #ifdef EIO
-            case EIO:
-                sym = @symbol(EIO);
-                typ = @symbol(transferFaultSignal);
-                break;
+	    case EIO:
+		sym = @symbol(EIO);
+		typ = @symbol(transferFaultSignal);
+		break;
 #endif
 #ifdef ENXIO
-            case ENXIO:
-                sym = @symbol(ENXIO);
-                typ = @symbol(unavailableReferentSignal);
-                break;
+	    case ENXIO:
+		sym = @symbol(ENXIO);
+		typ = @symbol(unavailableReferentSignal);
+		break;
 #endif
 #ifdef E2BIG
-            case E2BIG:
-                sym = @symbol(E2BIG);
-                typ = @symbol(invalidArgumentsSignal);
-                break;
+	    case E2BIG:
+		sym = @symbol(E2BIG);
+		typ = @symbol(invalidArgumentsSignal);
+		break;
 #endif
 #ifdef ENOEXEC
-            case ENOEXEC:
-                sym = @symbol(ENOEXEC);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOEXEC:
+		sym = @symbol(ENOEXEC);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EBADF
-            case EBADF:
-                sym = @symbol(EBADF);
-                typ = @symbol(badAccessorSignal);
-                break;
+	    case EBADF:
+		sym = @symbol(EBADF);
+		typ = @symbol(badAccessorSignal);
+		break;
 #endif
 #ifdef ECHILD
-            case ECHILD:
-                sym = @symbol(ECHILD);
-                typ = @symbol(informationSignal);
-                break;
+	    case ECHILD:
+		sym = @symbol(ECHILD);
+		typ = @symbol(informationSignal);
+		break;
 #endif
 #if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
-            case EAGAIN:
-                sym = @symbol(EAGAIN);
-                typ = @symbol(notReadySignal);
-                break;
+	    case EAGAIN:
+		sym = @symbol(EAGAIN);
+		typ = @symbol(notReadySignal);
+		break;
 #endif
 #ifdef EOVERFLOW
-            case EOVERFLOW:
-                sym = @symbol(EOVERFLOW);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case EOVERFLOW:
+		sym = @symbol(EOVERFLOW);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef ENOMEM
-            case ENOMEM:
-                sym = @symbol(ENOMEM);
-                typ = @symbol(noMemorySignal);
-                break;
+	    case ENOMEM:
+		sym = @symbol(ENOMEM);
+		typ = @symbol(noMemorySignal);
+		break;
 #endif
 #ifdef EACCES
-            case EACCES:
-                sym = @symbol(EACCES);
-                typ = @symbol(noPermissionsSignal);
-                break;
+	    case EACCES:
+		sym = @symbol(EACCES);
+		typ = @symbol(noPermissionsSignal);
+		break;
 #endif
 #ifdef EFAULT
-            case EFAULT:
-                sym = @symbol(EFAULT);
-                typ = @symbol(invalidArgumentsSignal);
-                break;
+	    case EFAULT:
+		sym = @symbol(EFAULT);
+		typ = @symbol(invalidArgumentsSignal);
+		break;
 #endif
 #ifdef EBUSY
-            case EBUSY:
-                sym = @symbol(EBUSY);
-                typ = @symbol(unavailableReferentSignal);
-                break;
+	    case EBUSY:
+		sym = @symbol(EBUSY);
+		typ = @symbol(unavailableReferentSignal);
+		break;
 #endif
 #ifdef EEXIST
-            case EEXIST:
-                sym = @symbol(EEXIST);
-                typ = @symbol(existingReferentSignal);
-                break;
+	    case EEXIST:
+		sym = @symbol(EEXIST);
+		typ = @symbol(existingReferentSignal);
+		break;
 #endif
 #ifdef EXDEV
-            case EXDEV:
-                sym = @symbol(EXDEV);
-                typ = @symbol(inappropriateReferentSignal);
-                break;
+	    case EXDEV:
+		sym = @symbol(EXDEV);
+		typ = @symbol(inappropriateReferentSignal);
+		break;
 #endif
 #ifdef ENODEV
-            case ENODEV:
-                sym = @symbol(ENODEV);
-                typ = @symbol(inaccessibleSignal);
-                break;
+	    case ENODEV:
+		sym = @symbol(ENODEV);
+		typ = @symbol(inaccessibleSignal);
+		break;
 #endif
 #ifdef ENOTDIR
-            case ENOTDIR:
-                sym = @symbol(ENOTDIR);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOTDIR:
+		sym = @symbol(ENOTDIR);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EISDIR
-            case EISDIR:
-                sym = @symbol(EISDIR);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case EISDIR:
+		sym = @symbol(EISDIR);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EINVAL
-            case EINVAL:
-                sym = @symbol(EINVAL);
-                typ = @symbol(invalidArgumentsSignal);
-                break;
+	    case EINVAL:
+		sym = @symbol(EINVAL);
+		typ = @symbol(invalidArgumentsSignal);
+		break;
 #endif
 #ifdef ENFILE
-            case ENFILE:
-                sym = @symbol(ENFILE);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case ENFILE:
+		sym = @symbol(ENFILE);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef EMFILE
-            case EMFILE:
-                sym = @symbol(EMFILE);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case EMFILE:
+		sym = @symbol(EMFILE);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef ENOTTY
-            case ENOTTY:
-                sym = @symbol(ENOTTY);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOTTY:
+		sym = @symbol(ENOTTY);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EFBIG
-            case EFBIG:
-                sym = @symbol(EFBIG);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case EFBIG:
+		sym = @symbol(EFBIG);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef ENOSPC
-            case ENOSPC:
-                sym = @symbol(ENOSPC);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case ENOSPC:
+		sym = @symbol(ENOSPC);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef ENOTSUP
 # if !defined(EOPNOTSUPP) || (ENOTSUP != EOPNOTSUPP)
-            case ENOTSUP:
-                sym = @symbol(ENOTSUP);        
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOTSUP:
+		sym = @symbol(ENOTSUP);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 # endif
 #endif
 #ifdef ESPIPE
-            case ESPIPE:
-                sym = @symbol(ESPIPE);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ESPIPE:
+		sym = @symbol(ESPIPE);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EROFS
-            case EROFS:
-                sym = @symbol(EROFS);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case EROFS:
+		sym = @symbol(EROFS);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EMLINK
-            case EMLINK:
-                sym = @symbol(EMLINK);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case EMLINK:
+		sym = @symbol(EMLINK);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef EPIPE
-            case EPIPE:
-                sym = @symbol(EPIPE);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case EPIPE:
+		sym = @symbol(EPIPE);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef EDOM
-            case EDOM:
-                sym = @symbol(EDOM);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case EDOM:
+		sym = @symbol(EDOM);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef ERANGE
-            case ERANGE:
-                sym = @symbol(ERANGE);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case ERANGE:
+		sym = @symbol(ERANGE);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef EDEADLK
 # if EDEADLK != EWOULDBLOCK
-            case EDEADLK:
-                sym = @symbol(EDEADLK);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case EDEADLK:
+		sym = @symbol(EDEADLK);
+		typ = @symbol(noResourcesSignal);
+		break;
 # endif
 #endif
 #ifdef ENAMETOOLONG
-            case ENAMETOOLONG:
-                sym = @symbol(ENAMETOOLONG);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case ENAMETOOLONG:
+		sym = @symbol(ENAMETOOLONG);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef ENOLCK
-            case ENOLCK:
-                sym = @symbol(ENOLCK);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOLCK:
+		sym = @symbol(ENOLCK);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef ENOSYS
-            case ENOSYS:
-                sym = @symbol(ENOSYS);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOSYS:
+		sym = @symbol(ENOSYS);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
-            case ENOTEMPTY:
-                sym = @symbol(ENOTEMPTY);
-                typ = @symbol(inappropriateReferentSignal);
-                break;
+	    case ENOTEMPTY:
+		sym = @symbol(ENOTEMPTY);
+		typ = @symbol(inappropriateReferentSignal);
+		break;
 #endif
 #ifdef EILSEQ
-            case EILSEQ:
-                sym = @symbol(EILSEQ);
-                typ = @symbol(transferFaultSignal);
-                break;
-#endif
-            /*
-             * XPG3 errnos - defined on most systems
-             */
+	    case EILSEQ:
+		sym = @symbol(EILSEQ);
+		typ = @symbol(transferFaultSignal);
+		break;
+#endif
+	    /*
+	     * XPG3 errnos - defined on most systems
+	     */
 #ifdef ENOTBLK
-            case ENOTBLK:
-                sym = @symbol(ENOTBLK);
-                typ = @symbol(inappropriateReferentSignal);
-                break;
+	    case ENOTBLK:
+		sym = @symbol(ENOTBLK);
+		typ = @symbol(inappropriateReferentSignal);
+		break;
 #endif
 #ifdef ETXTBSY
-            case ETXTBSY:
-                sym = @symbol(ETXTBSY);
-                typ = @symbol(inaccessibleSignal);
-                break;
-#endif
-            /*
-             * some others
-             */
+	    case ETXTBSY:
+		sym = @symbol(ETXTBSY);
+		typ = @symbol(inaccessibleSignal);
+		break;
+#endif
+	    /*
+	     * some others
+	     */
 #ifdef EWOULDBLOCK
-            case EWOULDBLOCK:
-                sym = @symbol(EWOULDBLOCK);
-                typ = @symbol(notReadySignal);
-                break;
+	    case EWOULDBLOCK:
+		sym = @symbol(EWOULDBLOCK);
+		typ = @symbol(notReadySignal);
+		break;
 #endif
 #ifdef ENOMSG
-            case ENOMSG:
-                sym = @symbol(ENOMSG);
-                typ = @symbol(noDataSignal);
-                break;
+	    case ENOMSG:
+		sym = @symbol(ENOMSG);
+		typ = @symbol(noDataSignal);
+		break;
 #endif
 #ifdef ELOOP
-            case ELOOP:
-                sym = @symbol(ELOOP);
-                typ = @symbol(rangeErrorSignal);
-                break;
-#endif
-
-            /*
-             * some stream errors
-             */
+	    case ELOOP:
+		sym = @symbol(ELOOP);
+		typ = @symbol(rangeErrorSignal);
+		break;
+#endif
+
+	    /*
+	     * some stream errors
+	     */
 #ifdef ETIME
-            case ETIME:
-                sym = @symbol(ETIME);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ETIME:
+		sym = @symbol(ETIME);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ENOSR
-            case ENOSR:
-                sym = @symbol(ENOSR);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case ENOSR:
+		sym = @symbol(ENOSR);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef ENOSTR
-            case ENOSTR:
-                sym = @symbol(ENOSTR);
-                typ = @symbol(inappropriateReferentSignal);
-                break;
+	    case ENOSTR:
+		sym = @symbol(ENOSTR);
+		typ = @symbol(inappropriateReferentSignal);
+		break;
 #endif
 #ifdef ECOMM
-            case ECOMM:
-                sym = @symbol(ECOMM);
-                typ = @symbol(transferFaultSignal);
-                break;
+	    case ECOMM:
+		sym = @symbol(ECOMM);
+		typ = @symbol(transferFaultSignal);
+		break;
 #endif
 #ifdef EPROTO
-            case EPROTO:
-                sym = @symbol(EPROTO);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
-#endif
-            /*
-             * nfs errors
-             */
+	    case EPROTO:
+		sym = @symbol(EPROTO);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
+#endif
+	    /*
+	     * nfs errors
+	     */
 #ifdef ESTALE
-            case ESTALE:
-                sym = @symbol(ESTALE);
-                typ = @symbol(unavailableReferentSignal);
-                break;
+	    case ESTALE:
+		sym = @symbol(ESTALE);
+		typ = @symbol(unavailableReferentSignal);
+		break;
 #endif
 #ifdef EREMOTE
-            case EREMOTE:
-                sym = @symbol(EREMOTE);
-                typ = @symbol(rangeErrorSignal);
-                break;
-#endif
-            /*
-             * some networking errors
-             */
+	    case EREMOTE:
+		sym = @symbol(EREMOTE);
+		typ = @symbol(rangeErrorSignal);
+		break;
+#endif
+	    /*
+	     * some networking errors
+	     */
 #ifdef EINPROGRESS
-            case EINPROGRESS:
-                sym = @symbol(EINPROGRESS);
-                typ = @symbol(operationStartedSignal);
-                break;
+	    case EINPROGRESS:
+		sym = @symbol(EINPROGRESS);
+		typ = @symbol(operationStartedSignal);
+		break;
 #endif
 #ifdef EALREADY
-            case EALREADY:
-                sym = @symbol(EALREADY);
-                typ = @symbol(operationStartedSignal);
-                break;
+	    case EALREADY:
+		sym = @symbol(EALREADY);
+		typ = @symbol(operationStartedSignal);
+		break;
 #endif
 #ifdef ENOTSOCK
-            case ENOTSOCK:
-                sym = @symbol(ENOTSOCK);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case ENOTSOCK:
+		sym = @symbol(ENOTSOCK);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EDESTADDRREQ
-            case EDESTADDRREQ:
-                sym = @symbol(EDESTADDRREQ);
-                typ = @symbol(underspecifiedSignal);
-                break;
+	    case EDESTADDRREQ:
+		sym = @symbol(EDESTADDRREQ);
+		typ = @symbol(underspecifiedSignal);
+		break;
 #endif
 #ifdef EMSGSIZE
-            case EMSGSIZE:
-                sym = @symbol(EMSGSIZE);
-                typ = @symbol(rangeErrorSignal);
-                break;
+	    case EMSGSIZE:
+		sym = @symbol(EMSGSIZE);
+		typ = @symbol(rangeErrorSignal);
+		break;
 #endif
 #ifdef EPROTOTYPE
-            case EPROTOTYPE:
-                sym = @symbol(EPROTOTYPE);
-                typ = @symbol(wrongSubtypeForOperationSignal);
-                break;
+	    case EPROTOTYPE:
+		sym = @symbol(EPROTOTYPE);
+		typ = @symbol(wrongSubtypeForOperationSignal);
+		break;
 #endif
 #ifdef ENOPROTOOPT
-            case ENOPROTOOPT:
-                sym = @symbol(ENOPROTOOPT);
-                typ = @symbol(unsupportedOperationSignal);
-                break;
+	    case ENOPROTOOPT:
+		sym = @symbol(ENOPROTOOPT);
+		typ = @symbol(unsupportedOperationSignal);
+		break;
 #endif
 #ifdef EPROTONOSUPPORT
-            case EPROTONOSUPPORT:
-                sym = @symbol(EPROTONOSUPPORT);
-                typ = @symbol(unsupportedOperationSignal);
-                break;
+	    case EPROTONOSUPPORT:
+		sym = @symbol(EPROTONOSUPPORT);
+		typ = @symbol(unsupportedOperationSignal);
+		break;
 #endif
 #ifdef ESOCKTNOSUPPORT
-            case ESOCKTNOSUPPORT:
-                sym = @symbol(ESOCKTNOSUPPORT);
-                typ = @symbol(unsupportedOperationSignal);
-                break;
+	    case ESOCKTNOSUPPORT:
+		sym = @symbol(ESOCKTNOSUPPORT);
+		typ = @symbol(unsupportedOperationSignal);
+		break;
 #endif
 #ifdef EOPNOTSUPP
-            case EOPNOTSUPP:
-                sym = @symbol(EOPNOTSUPP);
-                typ = @symbol(inappropriateOperationSignal);
-                break;
+	    case EOPNOTSUPP:
+		sym = @symbol(EOPNOTSUPP);
+		typ = @symbol(inappropriateOperationSignal);
+		break;
 #endif
 #ifdef EPFNOSUPPORT
-            case EPFNOSUPPORT:
-                sym = @symbol(EPFNOSUPPORT);
-                typ = @symbol(unsupportedOperationSignal);
-                break;
+	    case EPFNOSUPPORT:
+		sym = @symbol(EPFNOSUPPORT);
+		typ = @symbol(unsupportedOperationSignal);
+		break;
 #endif
 #ifdef EAFNOSUPPORT
-            case EAFNOSUPPORT:
-                sym = @symbol(EAFNOSUPPORT);
-                typ = @symbol(unsupportedOperationSignal);
-                break;
+	    case EAFNOSUPPORT:
+		sym = @symbol(EAFNOSUPPORT);
+		typ = @symbol(unsupportedOperationSignal);
+		break;
 #endif
 #ifdef EADDRINUSE
-            case EADDRINUSE:
-                sym = @symbol(EADDRINUSE);
-                typ = @symbol(existingReferentSignal);
-                break;
+	    case EADDRINUSE:
+		sym = @symbol(EADDRINUSE);
+		typ = @symbol(existingReferentSignal);
+		break;
 #endif
 #ifdef EADDRNOTAVAIL
-            case EADDRNOTAVAIL:
-                sym = @symbol(EADDRNOTAVAIL);
-                typ = @symbol(noPermissionsSignal);
-                break;
+	    case EADDRNOTAVAIL:
+		sym = @symbol(EADDRNOTAVAIL);
+		typ = @symbol(noPermissionsSignal);
+		break;
 #endif
 #ifdef ETIMEDOUT
-            case ETIMEDOUT:
-                sym = @symbol(ETIMEDOUT);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ETIMEDOUT:
+		sym = @symbol(ETIMEDOUT);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ECONNREFUSED
-            case ECONNREFUSED:
-                sym = @symbol(ECONNREFUSED);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ECONNREFUSED:
+		sym = @symbol(ECONNREFUSED);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ENETDOWN
-            case ENETDOWN:
-                sym = @symbol(ENETDOWN);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ENETDOWN:
+		sym = @symbol(ENETDOWN);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ENETUNREACH
-            case ENETUNREACH:
-                sym = @symbol(ENETUNREACH);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ENETUNREACH:
+		sym = @symbol(ENETUNREACH);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ENETRESET
-            case ENETRESET:
-                sym = @symbol(ENETRESET);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ENETRESET:
+		sym = @symbol(ENETRESET);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ECONNABORTED
-            case ECONNABORTED:
-                sym = @symbol(ECONNABORTED);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ECONNABORTED:
+		sym = @symbol(ECONNABORTED);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef ECONNRESET
-            case ECONNRESET:
-                sym = @symbol(ECONNRESET);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case ECONNRESET:
+		sym = @symbol(ECONNRESET);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef EISCONN
-            case EISCONN:
-                sym = @symbol(EISCONN);
-                typ = @symbol(unpreparedOperationSignal);
-                break;
+	    case EISCONN:
+		sym = @symbol(EISCONN);
+		typ = @symbol(unpreparedOperationSignal);
+		break;
 #endif
 #ifdef ENOTCONN
-            case ENOTCONN:
-                sym = @symbol(ENOTCONN);
-                typ = @symbol(unpreparedOperationSignal);
-                break;
+	    case ENOTCONN:
+		sym = @symbol(ENOTCONN);
+		typ = @symbol(unpreparedOperationSignal);
+		break;
 #endif
 #ifdef ESHUTDOWN
-            case ESHUTDOWN:
-                sym = @symbol(ESHUTDOWN);
-                typ = @symbol(unpreparedOperationSignal);
-                break;
+	    case ESHUTDOWN:
+		sym = @symbol(ESHUTDOWN);
+		typ = @symbol(unpreparedOperationSignal);
+		break;
 #endif
 #ifdef EHOSTDOWN
-            case EHOSTDOWN:
-                sym = @symbol(EHOSTDOWN);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case EHOSTDOWN:
+		sym = @symbol(EHOSTDOWN);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef EHOSTUNREACH
-            case EHOSTUNREACH:
-                sym = @symbol(EHOSTUNREACH);
-                typ = @symbol(peerFaultSignal);
-                break;
+	    case EHOSTUNREACH:
+		sym = @symbol(EHOSTUNREACH);
+		typ = @symbol(peerFaultSignal);
+		break;
 #endif
 #ifdef EDQUOT
-            case EDQUOT:
-                sym = @symbol(EDQUOT);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case EDQUOT:
+		sym = @symbol(EDQUOT);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 
 #ifdef ENOMEDIUM
-            case ENOMEDIUM:
-                sym = @symbol(ENOMEDIUM);
-                typ = @symbol(noResourcesSignal);
-                break;
+	    case ENOMEDIUM:
+		sym = @symbol(ENOMEDIUM);
+		typ = @symbol(noResourcesSignal);
+		break;
 #endif
 #ifdef EMEDIUMTYPE
-            case EMEDIUMTYPE:
-                sym = @symbol(EMEDIUMTYPE);
-                typ = @symbol(noResourcesSignal);
-                break;
-#endif
-
-            default:
-                break;
-        }
+	    case EMEDIUMTYPE:
+		sym = @symbol(EMEDIUMTYPE);
+		typ = @symbol(noResourcesSignal);
+		break;
+#endif
+
+	    default:
+		break;
+	}
     }
 %}.
     holder := OSErrorHolder new.
     sym isNil ifTrue:[
-        sym := #ERROR_OTHER.
-        errNr notNil ifTrue:[
-            "keep symbols as symbols"
-            holder parameter:(errNr isString ifTrue:[errNr] ifFalse:[errNr asString]).
-        ].
+	sym := #ERROR_OTHER.
+	errNr notNil ifTrue:[
+	    "keep symbols as symbols"
+	    holder parameter:(errNr isString ifTrue:[errNr] ifFalse:[errNr asString]).
+	].
     ].
     holder errorSymbol:sym errorCategory:(typ ? #defaultOsErrorSignal).
     ^ holder
@@ -2567,7 +2567,7 @@
 
     "
      OperatingSystem errorHolderForNumber:4
-     OperatingSystem errorHolderForNumber:45 
+     OperatingSystem errorHolderForNumber:45
      OperatingSystem errorHolderForNumber:#badArgument
      self errorHolderForNumber:(self errorNumberFor:#EPERM)
      self errorHolderForNumber:(self errorNumberFor:#EIO)
@@ -2589,238 +2589,238 @@
      */
 #ifdef EPERM
     if (sym == @symbol(EPERM)) {
-        RETURN ( __mkSmallInteger(EPERM) );
+	RETURN ( __mkSmallInteger(EPERM) );
     }
 #endif
 
 #ifdef ENOENT
     /* ERROR_FILE_NOT_FOUND is originally windows, but referd to in ExternalStream>>#openError: */
     if (sym == @symbol(ENOENT) || sym == @symbol(ERROR_FILE_NOT_FOUND)) {
-        RETURN ( __mkSmallInteger(ENOENT) );
+	RETURN ( __mkSmallInteger(ENOENT) );
     }
 #endif
 
 #ifdef ESRCH
     if (sym == @symbol(ESRCH)) {
-        RETURN ( __mkSmallInteger(ESRCH) );
+	RETURN ( __mkSmallInteger(ESRCH) );
     }
 #endif
 
 #ifdef EINTR
     if (sym == @symbol(EINTR)) {
-        RETURN ( __mkSmallInteger(EINTR) );
+	RETURN ( __mkSmallInteger(EINTR) );
     }
 #endif
 
 #ifdef EIO
     if (sym == @symbol(EIO)) {
-        RETURN ( __mkSmallInteger(EIO) );
+	RETURN ( __mkSmallInteger(EIO) );
     }
 #endif
 
 #ifdef ENXIO
     if (sym == @symbol(ENXIO)) {
-        RETURN ( __mkSmallInteger(ENXIO) );
+	RETURN ( __mkSmallInteger(ENXIO) );
     }
 #endif
 
 #ifdef E2BIG
     if (sym == @symbol(E2BIG)) {
-        RETURN ( __mkSmallInteger(E2BIG) );
+	RETURN ( __mkSmallInteger(E2BIG) );
     }
 #endif
 
 #ifdef ENOEXEC
     if (sym == @symbol(ENOEXEC)) {
-        RETURN ( __mkSmallInteger(ENOEXEC) );
+	RETURN ( __mkSmallInteger(ENOEXEC) );
     }
 #endif
 
 #ifdef ENOTSUP
 # if !defined(EOPNOTSUPP) || (ENOTSUP != EOPNOTSUPP)
     if (sym == @symbol(ENOTSUP)) {
-        RETURN ( __mkSmallInteger(ENOTSUP) );
+	RETURN ( __mkSmallInteger(ENOTSUP) );
     }
 # endif
 #endif
 
 #ifdef EBADF
     if (sym == @symbol(EBADF)) {
-        RETURN ( __mkSmallInteger(EBADF) );
+	RETURN ( __mkSmallInteger(EBADF) );
     }
 #endif
 
 #ifdef ECHILD
     if (sym == @symbol(ECHILD)) {
-        RETURN ( __mkSmallInteger(ECHILD) );
+	RETURN ( __mkSmallInteger(ECHILD) );
     }
 #endif
 
 #if defined(EAGAIN)
     if (sym == @symbol(EAGAIN)) {
-        RETURN ( __mkSmallInteger(EAGAIN) );
+	RETURN ( __mkSmallInteger(EAGAIN) );
     }
 #endif
 
 #ifdef ENOMEM
     if (sym == @symbol(ENOMEM)) {
-        RETURN ( __mkSmallInteger(ENOMEM) );
+	RETURN ( __mkSmallInteger(ENOMEM) );
     }
 #endif
 
 #ifdef EACCES
     if (sym == @symbol(EACCES)) {
-        RETURN ( __mkSmallInteger(EACCES) );
+	RETURN ( __mkSmallInteger(EACCES) );
     }
 #endif
 
 #ifdef EFAULT
     if (sym == @symbol(EFAULT)) {
-        RETURN ( __mkSmallInteger(EFAULT) );
+	RETURN ( __mkSmallInteger(EFAULT) );
     }
 #endif
 
 #ifdef EBUSY
     if (sym == @symbol(EBUSY)) {
-        RETURN ( __mkSmallInteger(EBUSY) );
+	RETURN ( __mkSmallInteger(EBUSY) );
     }
 #endif
 
 #ifdef EXDEV
     if (sym == @symbol(EXDEV)) {
-        RETURN ( __mkSmallInteger(EXDEV) );
+	RETURN ( __mkSmallInteger(EXDEV) );
     }
 #endif
 
 #ifdef ENODEV
     if (sym == @symbol(ENODEV)) {
-        RETURN ( __mkSmallInteger(ENODEV) );
+	RETURN ( __mkSmallInteger(ENODEV) );
     }
 #endif
 
 #ifdef ENOTDIR
     if (sym == @symbol(ENOTDIR)) {
-        RETURN ( __mkSmallInteger(ENOTDIR) );
+	RETURN ( __mkSmallInteger(ENOTDIR) );
     }
 #endif
 
 #ifdef EISDIR
     if (sym == @symbol(EISDIR)) {
-        RETURN ( __mkSmallInteger(EISDIR) );
+	RETURN ( __mkSmallInteger(EISDIR) );
     }
 #endif
 
 #ifdef EINVAL
     if (sym == @symbol(EINVAL)) {
-        RETURN ( __mkSmallInteger(EINVAL) );
+	RETURN ( __mkSmallInteger(EINVAL) );
     }
 #endif
 
 #ifdef ENFILE
     if (sym == @symbol(ENFILE)) {
-        RETURN ( __mkSmallInteger(ENFILE) );
+	RETURN ( __mkSmallInteger(ENFILE) );
     }
 #endif
 
 #ifdef EMFILE
     if (sym == @symbol(EMFILE)) {
-        RETURN ( __mkSmallInteger(EMFILE) );
+	RETURN ( __mkSmallInteger(EMFILE) );
     }
 #endif
 
 #ifdef ENOTTY
     if (sym == @symbol(ENOTTY)) {
-        RETURN ( __mkSmallInteger(ENOTTY) );
+	RETURN ( __mkSmallInteger(ENOTTY) );
     }
 #endif
 
 #ifdef EFBIG
     if (sym == @symbol(EFBIG)) {
-        RETURN ( __mkSmallInteger(EFBIG) );
+	RETURN ( __mkSmallInteger(EFBIG) );
     }
 #endif
 
 #ifdef ENOSPC
     if (sym == @symbol(ENOSPC)) {
-        RETURN ( __mkSmallInteger(ENOSPC) );
+	RETURN ( __mkSmallInteger(ENOSPC) );
     }
 #endif
 
 #ifdef ESPIPE
     if (sym == @symbol(ESPIPE)) {
-        RETURN ( __mkSmallInteger(ESPIPE) );
+	RETURN ( __mkSmallInteger(ESPIPE) );
     }
 #endif
 
 #ifdef EROFS
     if (sym == @symbol(EROFS)) {
-        RETURN ( __mkSmallInteger(EROFS) );
+	RETURN ( __mkSmallInteger(EROFS) );
     }
 #endif
 
 #ifdef EMLINK
     if (sym == @symbol(EMLINK)) {
-        RETURN ( __mkSmallInteger(EMLINK) );
+	RETURN ( __mkSmallInteger(EMLINK) );
     }
 #endif
 
 #ifdef EPIPE
     if (sym == @symbol(EPIPE)) {
-        RETURN ( __mkSmallInteger(EPIPE) );
+	RETURN ( __mkSmallInteger(EPIPE) );
     }
 #endif
 
 #ifdef EDOM
     if (sym == @symbol(EDOM)) {
-        RETURN ( __mkSmallInteger(EDOM) );
+	RETURN ( __mkSmallInteger(EDOM) );
     }
 #endif
 
 #ifdef ERANGE
     if (sym == @symbol(ERANGE)) {
-        RETURN ( __mkSmallInteger(ERANGE) );
+	RETURN ( __mkSmallInteger(ERANGE) );
     }
 #endif
 
 #ifdef EDEADLK
     if (sym == @symbol(EDEADLK)) {
-        RETURN ( __mkSmallInteger(EDEADLK) );
+	RETURN ( __mkSmallInteger(EDEADLK) );
     }
 #endif
 
 #ifdef ENAMETOOLONG
     if (sym == @symbol(ENAMETOOLONG)) {
-        RETURN ( __mkSmallInteger(ENAMETOOLONG) );
+	RETURN ( __mkSmallInteger(ENAMETOOLONG) );
     }
 #endif
 
 #ifdef ENOLCK
     if (sym == @symbol(ENOLCK)) {
-        RETURN ( __mkSmallInteger(ENOLCK) );
+	RETURN ( __mkSmallInteger(ENOLCK) );
     }
 #endif
 
 #ifdef ENOSYS
     if (sym == @symbol(ENOSYS)) {
-        RETURN ( __mkSmallInteger(ENOSYS) );
+	RETURN ( __mkSmallInteger(ENOSYS) );
     }
 #endif
 
 #ifdef ENOTEMPTY
     if (sym == @symbol(ENOTEMPTY)) {
-        RETURN ( __mkSmallInteger(ENOTEMPTY) );
+	RETURN ( __mkSmallInteger(ENOTEMPTY) );
     }
 #endif
 
 #ifdef EEXIST
     if (sym == @symbol(EEXIST)) {
-        RETURN ( __mkSmallInteger(EEXIST) );
+	RETURN ( __mkSmallInteger(EEXIST) );
     }
 #endif
 
 #ifdef EILSEQ
     if (sym == @symbol(EILSEQ)) {
-        RETURN ( __mkSmallInteger(EILSEQ) );
+	RETURN ( __mkSmallInteger(EILSEQ) );
     }
 #endif
 
@@ -2829,13 +2829,13 @@
      */
 #ifdef ENOTBLK
     if (sym == @symbol(ENOTBLK)) {
-        RETURN ( __mkSmallInteger(ENOTBLK) );
+	RETURN ( __mkSmallInteger(ENOTBLK) );
     }
 #endif
 
 #ifdef ETXTBSY
     if (sym == @symbol(ETXTBSY)) {
-        RETURN ( __mkSmallInteger(ETXTBSY) );
+	RETURN ( __mkSmallInteger(ETXTBSY) );
     }
 #endif
 
@@ -2844,25 +2844,25 @@
      */
 #ifdef EWOULDBLOCK
     if (sym == @symbol(EWOULDBLOCK)) {
-        RETURN ( __mkSmallInteger(EWOULDBLOCK) );
+	RETURN ( __mkSmallInteger(EWOULDBLOCK) );
     }
 #endif
 
 #ifdef EOVERFLOW
     if (sym == @symbol(EOVERFLOW)) {
-        RETURN ( __mkSmallInteger(EOVERFLOW) );
+	RETURN ( __mkSmallInteger(EOVERFLOW) );
     }
 #endif
 
 #ifdef ENOMSG
     if (sym == @symbol(ENOMSG)) {
-        RETURN ( __mkSmallInteger(ENOMSG) );
+	RETURN ( __mkSmallInteger(ENOMSG) );
     }
 #endif
 
 #ifdef ELOOP
     if (sym == @symbol(ELOOP)) {
-        RETURN ( __mkSmallInteger(ELOOP) );
+	RETURN ( __mkSmallInteger(ELOOP) );
     }
 #endif
 
@@ -2871,31 +2871,31 @@
      */
 #ifdef ETIME
     if (sym == @symbol(ETIME)) {
-        RETURN ( __mkSmallInteger(ETIME) );
+	RETURN ( __mkSmallInteger(ETIME) );
     }
 #endif
 
 #ifdef ENOSR
     if (sym == @symbol(ENOSR)) {
-        RETURN ( __mkSmallInteger(ENOSR) );
+	RETURN ( __mkSmallInteger(ENOSR) );
     }
 #endif
 
 #ifdef ENOSTR
     if (sym == @symbol(ENOSTR)) {
-        RETURN ( __mkSmallInteger(ENOSTR) );
+	RETURN ( __mkSmallInteger(ENOSTR) );
     }
 #endif
 
 #ifdef ECOMM
     if (sym == @symbol(ECOMM)) {
-        RETURN ( __mkSmallInteger(ECOMM) );
+	RETURN ( __mkSmallInteger(ECOMM) );
     }
 #endif
 
 #ifdef EPROTO
     if (sym == @symbol(EPROTO)) {
-        RETURN ( __mkSmallInteger(EPROTO) );
+	RETURN ( __mkSmallInteger(EPROTO) );
     }
 #endif
 
@@ -2904,13 +2904,13 @@
      */
 #ifdef ESTALE
     if (sym == @symbol(ESTALE)) {
-        RETURN ( __mkSmallInteger(ESTALE) );
+	RETURN ( __mkSmallInteger(ESTALE) );
     }
 #endif
 
 #ifdef EREMOTE
     if (sym == @symbol(EREMOTE)) {
-        RETURN ( __mkSmallInteger(EREMOTE) );
+	RETURN ( __mkSmallInteger(EREMOTE) );
     }
 #endif
 
@@ -2919,178 +2919,178 @@
      */
 #ifdef EINPROGRESS
     if (sym == @symbol(EINPROGRESS)) {
-        RETURN ( __mkSmallInteger(EINPROGRESS) );
+	RETURN ( __mkSmallInteger(EINPROGRESS) );
     }
 #endif
 
 #ifdef EALREADY
     if (sym == @symbol(EALREADY)) {
-        RETURN ( __mkSmallInteger(EALREADY) );
+	RETURN ( __mkSmallInteger(EALREADY) );
     }
 #endif
 
 #ifdef ENOTSOCK
     if (sym == @symbol(ENOTSOCK)) {
-        RETURN ( __mkSmallInteger(ENOTSOCK) );
+	RETURN ( __mkSmallInteger(ENOTSOCK) );
     }
 #endif
 
 #ifdef EDESTADDRREQ
     if (sym == @symbol(EDESTADDRREQ)) {
-        RETURN ( __mkSmallInteger(EDESTADDRREQ) );
+	RETURN ( __mkSmallInteger(EDESTADDRREQ) );
     }
 #endif
 
 #ifdef EMSGSIZE
     if (sym == @symbol(EMSGSIZE)) {
-        RETURN ( __mkSmallInteger(EMSGSIZE) );
+	RETURN ( __mkSmallInteger(EMSGSIZE) );
     }
 #endif
 
 #ifdef EPROTOTYPE
     if (sym == @symbol(EPROTOTYPE)) {
-        RETURN ( __mkSmallInteger(EPROTOTYPE) );
+	RETURN ( __mkSmallInteger(EPROTOTYPE) );
     }
 #endif
 
 #ifdef ENOPROTOOPT
     if (sym == @symbol(ENOPROTOOPT)) {
-        RETURN ( __mkSmallInteger(ENOPROTOOPT) );
+	RETURN ( __mkSmallInteger(ENOPROTOOPT) );
     }
 #endif
 
 #ifdef EPROTONOSUPPORT
     if (sym == @symbol(EPROTONOSUPPORT)) {
-        RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
+	RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
     }
 #endif
 
 #ifdef ESOCKTNOSUPPORT
     if (sym == @symbol(ESOCKTNOSUPPORT)) {
-        RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
+	RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
     }
 #endif
 
 #ifdef EOPNOTSUPP
     if (sym == @symbol(EOPNOTSUPP)) {
-        RETURN ( __mkSmallInteger(EOPNOTSUPP) );
+	RETURN ( __mkSmallInteger(EOPNOTSUPP) );
     }
 #endif
 
 #ifdef EPFNOSUPPORT
     if (sym == @symbol(EPFNOSUPPORT)) {
-        RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
+	RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
     }
 #endif
 
 #ifdef EAFNOSUPPORT
     if (sym == @symbol(EAFNOSUPPORT)) {
-        RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
+	RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
     }
 #endif
 
 #ifdef EADDRINUSE
     if (sym == @symbol(EADDRINUSE)) {
-        RETURN ( __mkSmallInteger(EADDRINUSE) );
+	RETURN ( __mkSmallInteger(EADDRINUSE) );
     }
 #endif
 
 #ifdef EADDRNOTAVAIL
     if (sym == @symbol(EADDRNOTAVAIL)) {
-        RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
+	RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
     }
 #endif
 
 #ifdef ETIMEDOUT
     if (sym == @symbol(ETIMEDOUT)) {
-        RETURN ( __mkSmallInteger(ETIMEDOUT) );
+	RETURN ( __mkSmallInteger(ETIMEDOUT) );
     }
 #endif
 
 #ifdef ECONNREFUSED
     if (sym == @symbol(ECONNREFUSED)) {
-        RETURN ( __mkSmallInteger(ECONNREFUSED) );
+	RETURN ( __mkSmallInteger(ECONNREFUSED) );
     }
 #endif
 
 #ifdef ENETDOWN
     if (sym == @symbol(ENETDOWN)) {
-        RETURN ( __mkSmallInteger(ENETDOWN) );
+	RETURN ( __mkSmallInteger(ENETDOWN) );
     }
 #endif
 
 #ifdef ENETUNREACH
     if (sym == @symbol(ENETUNREACH)) {
-        RETURN ( __mkSmallInteger(ENETUNREACH) );
+	RETURN ( __mkSmallInteger(ENETUNREACH) );
     }
 #endif
 
 #ifdef ENETRESET
     if (sym == @symbol(ENETRESET)) {
-        RETURN ( __mkSmallInteger(ENETRESET) );
+	RETURN ( __mkSmallInteger(ENETRESET) );
     }
 #endif
 
 #ifdef ECONNABORTED
     if (sym == @symbol(ECONNABORTED)) {
-        RETURN ( __mkSmallInteger(ECONNABORTED) );
+	RETURN ( __mkSmallInteger(ECONNABORTED) );
     }
 #endif
 
 #ifdef ECONNRESET
     if (sym == @symbol(ECONNRESET)) {
-        RETURN ( __mkSmallInteger(ECONNRESET) );
+	RETURN ( __mkSmallInteger(ECONNRESET) );
     }
 #endif
 
 #ifdef EISCONN
     if (sym == @symbol(EISCONN)) {
-        RETURN ( __mkSmallInteger(EISCONN) );
+	RETURN ( __mkSmallInteger(EISCONN) );
     }
 #endif
 
 #ifdef ENOTCONN
     if (sym == @symbol(ENOTCONN)) {
-        RETURN ( __mkSmallInteger(ENOTCONN) );
+	RETURN ( __mkSmallInteger(ENOTCONN) );
     }
 #endif
 
 #ifdef ESHUTDOWN
     if (sym == @symbol(ESHUTDOWN)) {
-        RETURN ( __mkSmallInteger(ESHUTDOWN) );
+	RETURN ( __mkSmallInteger(ESHUTDOWN) );
     }
 #endif
 
 #ifdef EHOSTDOWN
     if (sym == @symbol(EHOSTDOWN)) {
-        RETURN ( __mkSmallInteger(EHOSTDOWN) );
+	RETURN ( __mkSmallInteger(EHOSTDOWN) );
     }
 #endif
 
 #ifdef EHOSTUNREACH
     if (sym == @symbol(EHOSTUNREACH)) {
-        RETURN ( __mkSmallInteger(EHOSTUNREACH) );
+	RETURN ( __mkSmallInteger(EHOSTUNREACH) );
     }
 #endif
 
 #ifdef EREMOTEIO
     if (sym == @symbol(EREMOTEIO)) {
-        RETURN ( __mkSmallInteger(EREMOTEIO) );
+	RETURN ( __mkSmallInteger(EREMOTEIO) );
     }
 #endif
 #ifdef EDQUOT
     if (sym == @symbol(EDQUOT)) {
-        RETURN ( __mkSmallInteger(EDQUOT) );
+	RETURN ( __mkSmallInteger(EDQUOT) );
     }
 #endif
 #ifdef ENOMEDIUM
     if (sym == @symbol(ENOMEDIUM)) {
-        RETURN ( __mkSmallInteger(ENOMEDIUM) );
+	RETURN ( __mkSmallInteger(ENOMEDIUM) );
     }
 #endif
 #ifdef EMEDIUMTYPE
     if (sym == @symbol(EMEDIUMTYPE)) {
-        RETURN ( __mkSmallInteger(EMEDIUMTYPE) );
+	RETURN ( __mkSmallInteger(EMEDIUMTYPE) );
     }
 #endif
 
@@ -3609,35 +3609,35 @@
 
     commandFilename := aCommand asFilename.
     commandFilename isAbsolute ifTrue:[
-        ^ commandFilename pathName
+	^ commandFilename pathName
     ].
     commandFilename isExplicitRelative ifTrue:[
-         ^ commandFilename pathName
+	 ^ commandFilename pathName
     ].
     (aCommand includes:$/) ifTrue:[
-        "/ something like "smalltalk/stx", if executed from a parent directory
-        ^ ('./',aCommand) asFilename pathName
+	"/ something like "smalltalk/stx", if executed from a parent directory
+	^ ('./',aCommand) asFilename pathName
     ].
 
     path := self getEnvironment:'PATH'.
     path notEmptyOrNil ifTrue:[
-        (path asCollectionOfSubstringsSeparatedBy:self pathSeparator) do:[:eachPathComponent |
-            eachPathComponent isEmpty ifTrue:[
-                f := commandFilename
-            ] ifFalse:[
-                f := eachPathComponent asFilename construct:aCommand.
-            ].
-            self executableFileExtensions do:[:eachExtension |
-                eachExtension notEmpty ifTrue:[
-                    fExt := f addSuffix:eachExtension.
-                ] ifFalse:[
-                    fExt := f.
-                ].
-                fExt isExecutable ifTrue:[
-                    ^ fExt pathName
-                ].
-            ].
-        ].
+	(path asCollectionOfSubstringsSeparatedBy:self pathSeparator) do:[:eachPathComponent |
+	    eachPathComponent isEmpty ifTrue:[
+		f := commandFilename
+	    ] ifFalse:[
+		f := eachPathComponent asFilename construct:aCommand.
+	    ].
+	    self executableFileExtensions do:[:eachExtension |
+		eachExtension notEmpty ifTrue:[
+		    fExt := f addSuffix:eachExtension.
+		] ifFalse:[
+		    fExt := f.
+		].
+		fExt isExecutable ifTrue:[
+		    ^ fExt pathName
+		].
+	    ].
+	].
     ].
     ^ nil
 
@@ -4894,9 +4894,9 @@
 
      The info object returned is OS-specific, however it responds to at
      least
-        #isFor32BitArchitecture
-        #isFor64BitArchitecture ... returns true, if the given object is for
-                                     32bit, 64bit architecture respectively
+	#isFor32BitArchitecture
+	#isFor64BitArchitecture ... returns true, if the given object is for
+				     32bit, 64bit architecture respectively
     "
     ^ ELFFileHeader fromFile: aStringOrFilename
 
@@ -8556,7 +8556,7 @@
 	 * use the GSI_PLATFORM_NAME as a hint - it is only defined in
 	 * V4.0 and higher ... (sigh)
 	 */
-#  if defined GSI_PLATFORM_NAME
+#  if defined(GSI_PLATFORM_NAME)
 	{
 	    struct cpu_info cpuInfo;
 
@@ -9305,72 +9305,72 @@
 
     sysPath := super defaultSystemPath.
     places :=
-        #(
-            '/usr/local/lib/stx'
-            '/usr/local/lib/smalltalk'
-            '/usr/local/lib/smalltalk-x'
-            '/usr/lib/stx'
-            '/usr/lib/smalltalk'
-            '/usr/lib/smalltalk-x'
-            '/lib/stx'
-            '/lib/smalltalk'
-            '/lib/smalltalk-x'
-            '/opt/stx'
-            '/opt/smalltalk'
-            '/opt/smalltalk-x'
-        ).
+	#(
+	    '/usr/local/lib/stx'
+	    '/usr/local/lib/smalltalk'
+	    '/usr/local/lib/smalltalk-x'
+	    '/usr/lib/stx'
+	    '/usr/lib/smalltalk'
+	    '/usr/lib/smalltalk-x'
+	    '/lib/stx'
+	    '/lib/smalltalk'
+	    '/lib/smalltalk-x'
+	    '/opt/stx'
+	    '/opt/smalltalk'
+	    '/opt/smalltalk-x'
+	).
 
     self isOSXlike ifTrue:[
-        |pathOfSTX|
-
-         places :=
-                {
-                    '/Library/Smalltalk' .
-                    '/Library/Smalltalk-x' .
-                    '~/Library/Smalltalk' .
-                    '~/Library/Smalltalk-x' .
-                } , places.
-
-        pathOfSTX := OperatingSystem pathOfSTXExecutable.
-        pathOfSTX notNil ifTrue:[
-            places :=
-                {
-                    (pathOfSTX asFilename / '../Packages') name .
-                    (pathOfSTX asFilename / '../../Packages') name .
-                } , places.
-        ]
+	|pathOfSTX|
+
+	 places :=
+		{
+		    '/Library/Smalltalk' .
+		    '/Library/Smalltalk-x' .
+		    '~/Library/Smalltalk' .
+		    '~/Library/Smalltalk-x' .
+		} , places.
+
+	pathOfSTX := OperatingSystem pathOfSTXExecutable.
+	pathOfSTX notNil ifTrue:[
+	    places :=
+		{
+		    (pathOfSTX asFilename / '../Packages') name .
+		    (pathOfSTX asFilename / '../../Packages') name .
+		} , places.
+	]
     ].
     places do:[:dirName |
-        |dir vsnDir|
-
-        dir := dirName asFilename.
-        (dir isDirectory) ifTrue:[
-            "/ try to guess a gnu-smalltalk; skip it
-            (dir construct:'initialize.st') exists ifFalse:[
-                vsnDir := dir / vsnDirName.
-                vsnDir exists ifTrue:[
-                    "/ new style: look for a major.minor directory there
-                    sysPath add:vsnDir.
-                ] ifFalse:[
-                    "/ old style: look for a RELEASE file there and check if it matches
-                    releaseFile := dir construct:'RELEASE'.
-                    releaseFile exists ifTrue:[
-                        s := releaseFile readStreamOrNil.
-                        s notNil ifTrue:[
-                            v := Integer readFrom:s onError:-1.
-                            s close.
-                            v == majorVersionNr ifTrue:[
-                                sysPath add:dirName
-                            ] ifFalse:[
-                                ('UnixOperatingSystem [info]: ignore files in ' , dir pathName , ' (RELEASE mismatch)') infoPrintCR.
-                            ]
-                        ] ifFalse:[
-                            ('UnixOperatingSystem [info]: ignore files in ' , dir pathName , ' (RELEASE missing)') infoPrintCR.
-                        ]
-                    ]
-                ]
-            ]
-        ]
+	|dir vsnDir|
+
+	dir := dirName asFilename.
+	(dir isDirectory) ifTrue:[
+	    "/ try to guess a gnu-smalltalk; skip it
+	    (dir construct:'initialize.st') exists ifFalse:[
+		vsnDir := dir / vsnDirName.
+		vsnDir exists ifTrue:[
+		    "/ new style: look for a major.minor directory there
+		    sysPath add:vsnDir.
+		] ifFalse:[
+		    "/ old style: look for a RELEASE file there and check if it matches
+		    releaseFile := dir construct:'RELEASE'.
+		    releaseFile exists ifTrue:[
+			s := releaseFile readStreamOrNil.
+			s notNil ifTrue:[
+			    v := Integer readFrom:s onError:-1.
+			    s close.
+			    v == majorVersionNr ifTrue:[
+				sysPath add:dirName
+			    ] ifFalse:[
+				('UnixOperatingSystem [info]: ignore files in ' , dir pathName , ' (RELEASE mismatch)') infoPrintCR.
+			    ]
+			] ifFalse:[
+			    ('UnixOperatingSystem [info]: ignore files in ' , dir pathName , ' (RELEASE missing)') infoPrintCR.
+			]
+		    ]
+		]
+	    ]
+	]
     ].
     ^ sysPath
 
@@ -11026,7 +11026,7 @@
     DEFCONST(ELFDATANUM)
 
     DEFCONST(EI_VERSION)        /* File version byte index */
-                                /* Value must be EV_CURRENT */
+				/* Value must be EV_CURRENT */
 
     DEFCONST(EI_OSABI)          /* OS ABI identification */
     DEFCONST(ELFOSABI_NONE)     /* UNIX System V ABI */
@@ -11207,30 +11207,30 @@
 
 initializeOnFile: aStringOrFilename
     file := aStringOrFilename asFilename.
-    file exists ifFalse:[ 
-        self error:'Given file does not exist'.
-        ^ nil
-    ].
-    file isRegularFile ifFalse:[ 
-        self error:'Given file is not a regular file'.
-        ^ nil
+    file exists ifFalse:[
+	self error:'Given file does not exist'.
+	^ nil
+    ].
+    file isRegularFile ifFalse:[
+	self error:'Given file is not a regular file'.
+	^ nil
     ].
     file readingFileDo:[ :s |
-        s binary.
-        data := s next: 16r18.
-        (data at: 1 + EI_MAG0) ~~ ELFMAG0 ifTrue:[ 
-            self error:'Given file is not a valid ELF file (magic not found)'.
-        ].
-        (data at: 1 + EI_MAG1) ~~ ELFMAG1 ifTrue:[ 
-            self error:'Given file is not a valid ELF file (magic not found)'.
-        ].
-        (data at: 1 + EI_MAG2) ~~ ELFMAG2 ifTrue:[ 
-            self error:'Given file is not a valid ELF file (magic not found)'.
-        ].
-        (data at: 1 + EI_MAG3) ~~ ELFMAG3 ifTrue:[ 
-            self error:'Given file is not a valid ELF file (magic not found)'.
-        ].
-        msb := (data at: 1 + EI_DATA) == ELFDATA2MSB
+	s binary.
+	data := s next: 16r18.
+	(data at: 1 + EI_MAG0) ~~ ELFMAG0 ifTrue:[
+	    self error:'Given file is not a valid ELF file (magic not found)'.
+	].
+	(data at: 1 + EI_MAG1) ~~ ELFMAG1 ifTrue:[
+	    self error:'Given file is not a valid ELF file (magic not found)'.
+	].
+	(data at: 1 + EI_MAG2) ~~ ELFMAG2 ifTrue:[
+	    self error:'Given file is not a valid ELF file (magic not found)'.
+	].
+	(data at: 1 + EI_MAG3) ~~ ELFMAG3 ifTrue:[
+	    self error:'Given file is not a valid ELF file (magic not found)'.
+	].
+	msb := (data at: 1 + EI_DATA) == ELFDATA2MSB
     ].
 
     "Created: / 16-03-2015 / 16:13:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -14202,11 +14202,11 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.434 2015-04-10 11:34:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.435 2015-04-19 09:43:40 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.434 2015-04-10 11:34:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.435 2015-04-19 09:43:40 cg Exp $'
 ! !