Merge jv
authorMerge Script
Fri, 21 Aug 2015 06:46:46 +0200
branchjv
changeset 18705 843770030c5f
parent 18698 17c1b3a8e36f (current diff)
parent 18704 e1dc90e637b9 (diff)
child 18708 bb9a9708f010
Merge
ImmutableArray.st
ImmutableByteArray.st
ImmutableString.st
SmallInteger.st
String.st
Symbol.st
--- a/ImmutableArray.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/ImmutableArray.st	Fri Aug 21 06:46:46 2015 +0200
@@ -201,6 +201,14 @@
 
     self noModificationError.
     ^ super becomeNil
+!
+
+becomeSameAs:anotherObject
+    "trigger an error if I should become something else
+     (this would be an even more tricky manipulation)"
+
+    self noModificationError.
+    ^ super becomeSameAs:anotherObject
 ! !
 
 !ImmutableArray class methodsFor:'documentation'!
--- a/ImmutableByteArray.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/ImmutableByteArray.st	Fri Aug 21 06:46:46 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2009 by eXept Software AG
 	      All Rights Reserved
@@ -224,6 +226,14 @@
 
     self noModificationError.
     ^ super becomeNil
+!
+
+becomeSameAs:anotherObject
+    "trigger an error if I should become something else
+     (this would be an even more tricky manipulation)"
+
+    self noModificationError.
+    ^ super becomeSameAs:anotherObject
 ! !
 
 !ImmutableByteArray class methodsFor:'documentation'!
--- a/ImmutableString.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/ImmutableString.st	Fri Aug 21 06:46:46 2015 +0200
@@ -208,6 +208,14 @@
     ^ super becomeNil
 
     "Created: / 3.8.1998 / 14:48:37 / cg"
+!
+
+becomeSameAs:anotherObject
+    "trigger an error if I should become something else
+     (this would be an even more tricky manipulation)"
+
+    self noModificationError.
+    ^ super becomeSameAs:anotherObject
 ! !
 
 !ImmutableString class methodsFor:'documentation'!
--- a/SmallInteger.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/SmallInteger.st	Fri Aug 21 06:46:46 2015 +0200
@@ -2646,7 +2646,9 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( self.eqvP( aNumber ));
+    if (aNumber.isNumber()) {
+	return context._RETURN( self.eqvP( aNumber ));
+    }
 #else
 
     if (aNumber == self) {
@@ -2823,8 +2825,10 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( (self.eqvP( aNumber ) == STObject.True) ? STObject.False : STObject.True);
-    /* NOTREACHED */
+    if (aNumber.isNumber()) {
+	return context._RETURN( (self.eqvP( aNumber ) == STObject.True) ? STObject.False : STObject.True);
+	/* NOTREACHED */
+    }
 #else
 
     if (aNumber == self) {
@@ -3928,26 +3932,26 @@
     int negative = 0;
 
     if (self == __MKSMALLINT(0)) {
-        RETURN (@global(ZeroString));
+	RETURN (@global(ZeroString));
 //        RETURN (__MKSTRING_L("0", 1));
     }
     myValue = __intVal(self);
     if (myValue < 0) {
-        negative = 1;
-        myValue = -myValue;
+	negative = 1;
+	myValue = -myValue;
     }
     cp = buffer + sizeof(buffer) - 1;
     *cp-- = '\0';
     for ( ; myValue != 0; cp--) {
-        *cp = '0' + (myValue % 10);
-        myValue /= 10;
+	*cp = '0' + (myValue % 10);
+	myValue /= 10;
     }
     if (negative) {
-        *cp-- = '-';
+	*cp-- = '-';
     }
     newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
     if (newString != nil) {
-        RETURN (newString);
+	RETURN (newString);
     }
 #endif /* not __SCHTEAM__ */
 %}.
@@ -3981,52 +3985,52 @@
     java.lang.String __s;
 
     switch (__base) {
-        case 2:
-            __s = java.lang.Long.toBinaryString(myValue);
-            break;
-
-        case 8:
-            __s = java.lang.Long.toOctalString(myValue);
-            break;
-
-        case 10:
-            __s = java.lang.Long.toString(myValue);
-            break;
-
-        case 16:
-            __s = java.lang.Long.toHexString(myValue);
-            break;
-
-        default:
-        {
-            boolean negative = false;
-            __s = "";
-
-            if ((__base > 36) || (__base < 2)) {
-                throw new SmalltalkError("invalid base: ", base);
-            }
-            if (myValue < 0) {
-                negative = true;
-                myValue = -myValue;
-            }
-            while (myValue != 0) {
-                int digit;
-                char ch;
-
-                digit = (int)(myValue % __base);
-                if (digit <= 9) {
-                    ch = (char)('0' + digit);
-                } else {
-                    ch = (char)('A' + digit - 10);
-                }
-                __s = ch + __s;
-                myValue = myValue / __base;
-            }
-            if (negative) {
-                __s = "-" + __s;
-            }
-            break;
-        }
+	case 2:
+	    __s = java.lang.Long.toBinaryString(myValue);
+	    break;
+
+	case 8:
+	    __s = java.lang.Long.toOctalString(myValue);
+	    break;
+
+	case 10:
+	    __s = java.lang.Long.toString(myValue);
+	    break;
+
+	case 16:
+	    __s = java.lang.Long.toHexString(myValue);
+	    break;
+
+	default:
+	{
+	    boolean negative = false;
+	    __s = "";
+
+	    if ((__base > 36) || (__base < 2)) {
+		throw new SmalltalkError("invalid base: ", base);
+	    }
+	    if (myValue < 0) {
+		negative = true;
+		myValue = -myValue;
+	    }
+	    while (myValue != 0) {
+		int digit;
+		char ch;
+
+		digit = (int)(myValue % __base);
+		if (digit <= 9) {
+		    ch = (char)('0' + digit);
+		} else {
+		    ch = (char)('A' + digit - 10);
+		}
+		__s = ch + __s;
+		myValue = myValue / __base;
+	    }
+	    if (negative) {
+		__s = "-" + __s;
+	    }
+	    break;
+	}
     }
     return context._RETURN( new STString( __s ));
 #else
@@ -4034,37 +4038,37 @@
     INT __base;
 
     if (__isSmallInteger(base)) {
-        if (self == __MKSMALLINT(0)) {
-            RETURN (@global(ZeroString));
+	if (self == __MKSMALLINT(0)) {
+	    RETURN (@global(ZeroString));
     //        RETURN (__MKSTRING_L("0", 1));
-        }
-        __base = __intVal(base);
-
-        if ((__base < sizeof(digits)) && (__base > 1)) {
-            char buffer[64+3];  /* for 64bit machines, base 2, plus sign, plus 0-byte */
-            char *cp;
-            OBJ newString;
-            int negative = 0;
-            INT myValue = __intVal(self);
-
-            if (myValue < 0) {
-                negative = 1;
-                myValue = -myValue;
-            }
-            cp = buffer + sizeof(buffer) - 1;
-            *cp-- = '\0';
-            for (; myValue != 0; cp--) {
-                *cp = digits[myValue % __base];
-                myValue /= __base;
-            }
-            if (negative) {
-                *cp-- = '-';
-            }
-            newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
-            if (newString != nil) {
-                RETURN (newString);
-            }
-        }
+	}
+	__base = __intVal(base);
+
+	if ((__base < sizeof(digits)) && (__base > 1)) {
+	    char buffer[64+3];  /* for 64bit machines, base 2, plus sign, plus 0-byte */
+	    char *cp;
+	    OBJ newString;
+	    int negative = 0;
+	    INT myValue = __intVal(self);
+
+	    if (myValue < 0) {
+		negative = 1;
+		myValue = -myValue;
+	    }
+	    cp = buffer + sizeof(buffer) - 1;
+	    *cp-- = '\0';
+	    for (; myValue != 0; cp--) {
+		*cp = digits[myValue % __base];
+		myValue /= __base;
+	    }
+	    if (negative) {
+		*cp-- = '-';
+	    }
+	    newString = __MKSTRING_L(cp+1, (buffer + sizeof(buffer) - 2 - cp));
+	    if (newString != nil) {
+		RETURN (newString);
+	    }
+	}
     }
 #endif /* not __SCHTEAM__ */
 %}.
--- a/String.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/String.st	Fri Aug 21 06:46:46 2015 +0200
@@ -1522,10 +1522,11 @@
 	return __c__._RETURN_true();
     }
     if (aString.isStringLike()) {
-	return __c__._RETURN( self.stringEqual(aString) ? STObject.True : STObject.False );
+	return __c__._RETURN( self.isStringEqual(aString) ? STObject.True : STObject.False );
     }
-    return __c__._RETURN_false();
-    /* NOTREACHED */
+    if (aString == STObject.Nil) {
+	return __c__._RETURN_false();
+    }
 #else
     int l1, l2;
     unsigned char *cp1, *cp2;
@@ -2087,8 +2088,15 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( self.stringEqual( aString ) ? STObject.False : STObject.True);
-    /* NOTREACHED */
+    if (aString == self) {
+	return __c__._RETURN_false();
+    }
+    if (aString.isStringLike()) {
+	return __c__._RETURN( self.isStringEqual(aString) ? STObject.False : STObject.True );
+    }
+    if (aString == STObject.Nil) {
+	return __c__._RETURN_true();
+    }
 #else
     int l1, l2;
     unsigned char *cp1, *cp2;
--- a/Symbol.st	Wed Aug 19 06:41:26 2015 +0200
+++ b/Symbol.st	Fri Aug 21 06:46:46 2015 +0200
@@ -313,7 +313,7 @@
     |parts ns|
 
     self isNameSpaceSelector ifFalse:[
-        ^ Array with:nil with:self
+	^ Array with:nil with:self
     ].
     parts := self nameSpaceAndSelectorParts.
     ns := Smalltalk at:parts first asSymbol.
@@ -330,7 +330,7 @@
 
 nameSpaceAndSelectorParts
     "return a two element tuple consisting of the namespace name and the raw selector.
-     If I do not have the format of a namespace-selector, 
+     If I do not have the format of a namespace-selector,
      the first element of the returned tuple will be nil.
      Namespace selectors have a special, fix defined format, which is also known in the VM.
      They must be of the form :<ns>::<sel>,
@@ -341,7 +341,7 @@
      |nsPart selPart idx|
 
     self isNameSpaceSelector ifFalse:[
-        ^ Array with:nil with:self
+	^ Array with:nil with:self
     ].
     idx := self indexOf:$: startingAt:3.
     nsPart := self copyFrom:2 to:idx - 1.
@@ -429,6 +429,17 @@
      the inherited value compare."
 
 %{   /* NOCONTEXT */
+#ifdef __SCHTEAM__
+    if (something.isSymbol()) {
+	return context._RETURN ( self == something ? STObject.True : STObject.False );
+    }
+    if (something.isSTString()) {
+	return context._RETURN ( something.isStringEqual(self) ? STObject.True : STObject.False );
+    }
+    if (something == STObject.Nil) {
+	return context._RETURN_false ( );
+    }
+#else
     OBJ cls;
 
     if (something == self) RETURN(true);
@@ -439,6 +450,7 @@
     if (cls == String || cls == ImmutableString) {
 	RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? true : false);
     }
+#endif
 %}.
     "fall back; could be a TwoByteString, or a collection of Characters"
 
@@ -537,6 +549,17 @@
      the inherited value compare."
 
 %{   /* NOCONTEXT */
+#ifdef __SCHTEAM__
+    if (something.isSymbol()) {
+	return context._RETURN ( self == something ? STObject.False : STObject.True );
+    }
+    if (something.isSTString()) {
+	return context._RETURN ( something.isStringEqual(self) ? STObject.False : STObject.True );
+    }
+    if (something == STObject.Nil) {
+	return context._RETURN_true ( );
+    }
+#else
     OBJ cls;
 
     if (! __isNonNilObject(something)) RETURN(true);    /* cannot be equal */
@@ -546,6 +569,7 @@
     if (cls == String || cls == ImmutableString) {
 	RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? false : true);
     }
+#endif
 %}.
     "fall back; could be a TwoByteString, or a collection of Characters"
 
@@ -893,4 +917,3 @@
 version_SVN
     ^ '$ Id: Symbol.st 10648 2011-06-23 15:55:10Z vranyj1  $'
 ! !
-