Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 03 Dec 2016 10:09:23 +0000
branchjv
changeset 21089 d50f93ca9622
parent 21088 6f4535127ce6 (current diff)
parent 21085 0da90045c648 (diff)
child 21092 6dc23c67620f
child 23072 0402b3e0d43b
Merge
CharacterArray.st
Collection.st
DoubleArray.st
FloatArray.st
Object.st
ProtoObject.st
--- a/CharacterArray.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/CharacterArray.st	Sat Dec 03 10:09:23 2016 +0000
@@ -2475,7 +2475,7 @@
     (s := self string) ~~ self ifTrue:[
         ^ s endsWith:aStringOrCharacter
     ].
-    (self size > 0 and:[aStringOrCharacter isCharacter]) ifTrue:[
+    (self size ~~ 0 and:[aStringOrCharacter isCharacter]) ifTrue:[
         ^ self last = aStringOrCharacter
     ].
     ^ super endsWith:aStringOrCharacter
@@ -3009,7 +3009,7 @@
     |s|
 
     aStringOrCharacter isCharacter ifTrue:[
-        ^ (self size > 0) and:[ (self at:1) == aStringOrCharacter ]
+        ^ (self size ~~ 0) and:[ (self at:1) == aStringOrCharacter ]
     ].
     (s := self string) ~~ self ifTrue:[
         ^ s startsWith:aStringOrCharacter
--- a/Collection.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/Collection.st	Sat Dec 03 10:09:23 2016 +0000
@@ -1616,16 +1616,16 @@
 asArrayOfType:arrayClass
     "return a new instance of arrayClass with the collection's elements"
 
-    |anIntegerArray 
+    |anArrayInstance 
      index "{ Class: SmallInteger }" |
 
-    anIntegerArray := arrayClass new:(self size).
+    anArrayInstance := arrayClass new:(self size).
     index := 1.
     self do:[:each |
-        anIntegerArray at:index put:each.
+        anArrayInstance at:index put:each.
         index := index + 1
     ].
-    ^ anIntegerArray
+    ^ anArrayInstance
 !
 
 asBag
--- a/DoubleArray.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/DoubleArray.st	Sat Dec 03 10:09:23 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -255,6 +253,7 @@
                     if (_v1 > _max) _max = _v1;
                 }
             }
+
             min = __MKFLOAT(_min);
             __PROTECT__(min);
             max = __MKFLOAT(_max);
--- a/FloatArray.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/FloatArray.st	Sat Dec 03 10:09:23 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
@@ -16,10 +14,10 @@
 "{ NameSpace: Smalltalk }"
 
 AbstractNumberVector variableFloatSubclass:#FloatArray
-        instanceVariableNames:''
-        classVariableNames:''
-        poolDictionaries:''
-        category:'Collections-Arrayed'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Collections-Arrayed'
 !
 
 !FloatArray class methodsFor:'documentation'!
@@ -688,28 +686,6 @@
             OBJ retVal;
             
             _min = _max = _p[0];
-#ifdef PRE_4_OCT_2011
-            if (_sz > 1) {
-                float _this = _p[1];
-                float _prev;
-
-                /* how about inline-mmx-asm for this ... */
-                for (_i=2; _i<_sz; _i++) {
-                    _prev = _this;
-                    _this = _p[_i];
-                    if (_prev < _min) {
-                        _min = _prev;
-                    } else if (_prev > _max) {
-                        _max = _prev;
-                    }
-                }
-                if (_this < _min) {
-                    _min = _this;
-                } else if (_this > _max) {
-                    _max = _this;
-                }
-            }
-#else
             for (_i=_sz-1; _i>0; _i-=2) {
                 float _v1 = _p[_i];
                 float _v2 = _p[_i-1];
@@ -721,7 +697,7 @@
                     if (_v1 > _max) _max = _v1;
                 }
             }
-#endif
+
             min = __MKFLOAT(_min);
             __PROTECT__(min);
             max = __MKFLOAT(_max);
@@ -734,7 +710,7 @@
     empty == true ifTrue:[
         ^ self emptyCollectionError.
     ].
-    ^ Array with:(super min) with:(super max)
+    ^ Array with:(self min) with:(self max)
 
     "
      |f1|
--- a/Object.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/Object.st	Sat Dec 03 10:09:23 2016 +0000
@@ -521,6 +521,7 @@
 
 
 
+
 !Object methodsFor:'Compatibility-Dolphin'!
 
 stbFixup: anSTBInFiler at: newObjectIndex
@@ -693,7 +694,6 @@
 ! !
 
 
-
 !Object methodsFor:'accessing'!
 
 _at:index
@@ -9941,6 +9941,10 @@
     "Created: / 10-08-2006 / 16:24:53 / cg"
 !
 
+isProtoObject
+    ^ false
+!
+
 isProxy
     "return true if the receiver is a proxy for another (lazy loaded) object.
      False is returned here."
--- a/ProtoObject.st	Wed Nov 30 10:25:34 2016 +0000
+++ b/ProtoObject.st	Sat Dec 03 10:09:23 2016 +0000
@@ -50,6 +50,78 @@
 "
 ! !
 
+!ProtoObject class methodsFor:'helpers'!
+
+shallowCopyOf:anObject
+    "return a copy of anObject with shared subobjects (a shallow copy)
+     i.e. the copy shares referenced instvars with its original."
+
+%{  /* NOCONTEXT */
+    int ninsts, spc, sz;
+    OBJ theCopy;
+    OBJ cls = __qClass(anObject);
+    int flags = __intVal(__ClassInstPtr(cls)->c_flags);
+
+    /*
+     * bail out for special objects ..
+     */
+    if (((flags & ~ARRAYMASK) == 0)
+     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
+        sz = __qSize(anObject);
+        __PROTECT__(anObject);
+        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
+        __UNPROTECT__(anObject);
+        if (theCopy) {
+            cls = __qClass(anObject);
+            spc = __qSpace(theCopy);
+
+            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
+
+            sz = sz - OHDR_SIZE;
+            if (sz) {
+                char *src, *dst;
+
+                src = (char *)(__InstPtr(anObject)->i_instvars);
+                dst = (char *)(__InstPtr(theCopy)->i_instvars);
+#ifdef bcopy4
+                {
+                    /* care for odd-number of longs */
+                    int nW = sz >> 2;
+
+                    if (sz & 3) {
+                        nW++;
+                    }
+
+                    bcopy4(src, dst, nW);
+                }
+#else
+                bcopy(src, dst, sz);
+#endif
+
+                flags &= ARRAYMASK;
+                if (flags == POINTERARRAY) {
+                    ninsts = __BYTES2OBJS__(sz);
+                } else {
+                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
+                }
+                if (ninsts) {
+                    do {
+                        OBJ el;
+
+                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
+                        __STORE_SPC(theCopy, el, spc);
+                    } while (--ninsts);
+                }
+            }
+            RETURN (theCopy);
+        }
+    }
+%}.
+    "/ fallBack for special objects & memoryAllocation failure case
+
+    ^ self error:'ProtoObject>>#shallowCopyOf: failed'
+! !
+
 !ProtoObject methodsFor:'error handling'!
 
 doesNotUnderstand:aMessage
@@ -69,6 +141,26 @@
     ^ MessageNotUnderstood raiseRequestWith:aMessage
 ! !
 
+!ProtoObject methodsFor:'inspecting'!
+
+inspect
+    "this method is required to allow inspection of the object"
+
+    ^ (Object compiledMethodAt:#inspect)
+        valueWithReceiver:self
+        arguments:nil
+        selector:#inspect
+!
+
+instVarAt:index
+    "this method is required to allow inspection of the object"
+
+    ^ (Object compiledMethodAt:#instVarAt:)
+        valueWithReceiver:self
+        arguments:{index}
+        selector:#instVarAt:
+! !
+
 !ProtoObject methodsFor:'queries'!
 
 class
@@ -163,6 +255,10 @@
     ^ false
 !
 
+isBridgeProxy
+    ^ false
+!
+
 isException
     ^ false
 !
@@ -185,6 +281,14 @@
     ^ false
 
     "Created: / 04-06-2007 / 17:19:10 / cg"
+!
+
+isNil
+    ^ false.
+!
+
+isProtoObject
+    ^ true
 ! !
 
 !ProtoObject class methodsFor:'documentation'!