Number.st
changeset 13 62303f84ff5f
parent 5 67342904af11
child 39 bcf183a31bbb
--- a/Number.st	Sat Dec 11 01:46:55 1993 +0100
+++ b/Number.st	Sat Dec 11 01:59:35 1993 +0100
@@ -24,7 +24,7 @@
 
 abstract superclass for all kinds of numbers
 
-$Header: /cvs/stx/stx/libbasic/Number.st,v 1.4 1993-10-13 02:12:54 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Number.st,v 1.5 1993-12-11 00:51:25 claus Exp $
 '!
 
 ! Number methodsFor:'converting' !
@@ -37,18 +37,18 @@
 
     extern char *newNextPtr, *newEndPtr;
 
+    /*
+     * I cant tell if this special code is worth anything
+     */
     if (_CanDoQuickNew(sizeof(struct point))) {
         OBJ newPoint;
 
-        _qCheckedAlignedNew(newPoint, sizeof(struct point), __context);
+        _qCheckedAlignedNew(newPoint, sizeof(struct point));
         _InstPtr(newPoint)->o_class = Point;
         _PointInstPtr(newPoint)->p_x = self;
         _PointInstPtr(newPoint)->p_y = aNumber;
-        /*
-         * no store check needed for self: self is a number, new object is definitely in newSpace
-         * however, argument may be a context/block
-         */
         __STORE(newPoint, aNumber);
+        __STORE(newPoint, self);
         RETURN ( newPoint );
     }
 %}
@@ -68,14 +68,11 @@
     if (_CanDoQuickNew(sizeof(struct point))) {
         OBJ newPoint;
 
-        _qCheckedAlignedNew(newPoint, sizeof(struct point), __context);
+        _qCheckedAlignedNew(newPoint, sizeof(struct point));
         _InstPtr(newPoint)->o_class = Point;
         _PointInstPtr(newPoint)->p_x = self;
         _PointInstPtr(newPoint)->p_y = self;
-        /* 
-         * no store check needed - its definitely in newSpace
-         * and self is a number
-         */
+        __STORE(newPoint, self);
         RETURN ( newPoint );
     }
 %}
@@ -133,9 +130,25 @@
     self error:'retry:coercing: oops - same generality'
 ! !
 
+!Number methodsFor:'testing'!
+
+isLiteral
+    "return true, if the receiver can be used as a literal"
+
+    ^ true
+!
+
+isNumber
+    "return true, if the receiver is a kind of number"
+
+    ^ true
+! !
+
 !Number methodsFor:'printing & storing'!
 
 storeString
+    "return a string for storing"
+
     ^ self printString
 ! !