*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 23 Jun 2000 21:08:42 +0200
changeset 5412 323c7d7ae289
parent 5411 c396c6640868
child 5413 4e67713bf25a
*** empty log message ***
SmallInteger.st
--- a/SmallInteger.st	Fri Jun 23 21:03:30 2000 +0200
+++ b/SmallInteger.st	Fri Jun 23 21:08:42 2000 +0200
@@ -782,7 +782,8 @@
 
     /* invert anything except tag bits */
     RETURN ( ((OBJ) ((INT)self ^ ~TAG_MASK)) );
-%}
+%}.
+    ^ self primitiveFailed
 !
 
 bitOr:anInteger
@@ -1594,7 +1595,8 @@
 
     __qMKFLOAT(newFloat, dVal);
     RETURN ( newFloat );
-%}
+%}.
+    ^ self primitiveFailed
 !
 
 asLargeInteger
@@ -1614,7 +1616,8 @@
 
     __qMKSFLOAT(newFloat, fVal);
     RETURN ( newFloat );
-%}
+%}.
+    ^ self primitiveFailed
 !
 
 coerce:aNumber
@@ -1637,13 +1640,14 @@
     INT i = __intVal(self);
 
     if (i & 0x80) {
-	i = i | ~0xFFL;
+        i = i | ~0xFFL;
     } else {
-	i = i & 0x7F;
+        i = i & 0x7F;
     }
 
     RETURN (__MKSMALLINT(i));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      16rFF signExtendedByteValue
@@ -1659,13 +1663,14 @@
     INT i = __intVal(self);
 
     if (i & 0x8000) {
-	i = i | ~0xFFFFL;
+        i = i | ~0xFFFFL;
     } else {
-	i = i & 0x7FFF;
+        i = i & 0x7FFF;
     }
 
     RETURN (__MKSMALLINT(i));
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      16rFFFF signExtendedShortValue 
@@ -1921,20 +1926,20 @@
 
     tmp = __intVal(self);
     if (tmp > 0) {
-	if (__isBlockLike(aBlock)
-	 && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(0))) {
-	    {
-		REGISTER OBJFUNC codeVal;
-
-		/*
-		 * specially tuned version for compiled blocks, 
-		 * (the most common case)
-		 */
-		if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+        if (__isBlockLike(aBlock)
+         && (__BlockInstPtr(aBlock)->b_nargs == __MKSMALLINT(0))) {
+            {
+                REGISTER OBJFUNC codeVal;
+
+                /*
+                 * specially tuned version for compiled blocks, 
+                 * (the most common case)
+                 */
+                if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
 #ifdef PARANOIA
-		 && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
+                 && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))
 #endif
-		) {
+                ) {
 
 #ifdef NEW_BLOCK_CALL
 
@@ -1943,84 +1948,84 @@
 #else
 
 #                   define BLOCK_ARG  rHome
-		    REGISTER OBJ rHome;
-
-		    /*
-		     * home on stack - no need to refetch
-		     */
-		    rHome = __BlockInstPtr(aBlock)->b_home;
-		    if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) 
+                    REGISTER OBJ rHome;
+
+                    /*
+                     * home on stack - no need to refetch
+                     */
+                    rHome = __BlockInstPtr(aBlock)->b_home;
+                    if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE)) 
 #endif
-		    {
+                    {
 #ifdef WIN32
 # undef UNROLL_LOOPS
 #endif
 
 #ifdef UNROLL_LOOPS
 
-			/*
-			 * you are not supposed to program like this - I know what I do
-			 */
-			while (tmp > 8) {
-			    if (InterruptPending != nil) goto interrupted0;
-	continue0:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted1;
-	continue1:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted2;
-	continue2:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted3;
-	continue3:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted4;
-	continue4:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted5;
-	continue5:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted6;
-	continue6:
-			    (*codeVal)(BLOCK_ARG);
-			    if (InterruptPending != nil) goto interrupted7;
-	continue7:
-			    (*codeVal)(BLOCK_ARG);
-			    tmp -= 8;
-			}
+                        /*
+                         * you are not supposed to program like this - I know what I do
+                         */
+                        while (tmp > 8) {
+                            if (InterruptPending != nil) goto interrupted0;
+        continue0:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted1;
+        continue1:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted2;
+        continue2:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted3;
+        continue3:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted4;
+        continue4:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted5;
+        continue5:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted6;
+        continue6:
+                            (*codeVal)(BLOCK_ARG);
+                            if (InterruptPending != nil) goto interrupted7;
+        continue7:
+                            (*codeVal)(BLOCK_ARG);
+                            tmp -= 8;
+                        }
 #endif /* UNROLL_LOOPS */
-			do {
-			    if (InterruptPending != nil) goto interruptedX;
-	continueX:
-			    (*codeVal)(BLOCK_ARG);
-			} while(--tmp);
-
-			RETURN (self);
-			if (0) {
+                        do {
+                            if (InterruptPending != nil) goto interruptedX;
+        continueX:
+                            (*codeVal)(BLOCK_ARG);
+                        } while(--tmp);
+
+                        RETURN (self);
+                        if (0) {
 #ifdef UNROLL_LOOPS
-			    interrupted0:
-						__interruptL(@line); goto continue0;
-			    interrupted1:
-						__interruptL(@line); goto continue1;
-			    interrupted2:
-						__interruptL(@line); goto continue2;
-			    interrupted3:
-						__interruptL(@line); goto continue3;
-			    interrupted4:
-						__interruptL(@line); goto continue4;
-			    interrupted5:
-						__interruptL(@line); goto continue5;
-			    interrupted6:
-						__interruptL(@line); goto continue6;
-			    interrupted7:
-						__interruptL(@line); goto continue7;
+                            interrupted0:
+                                                __interruptL(@line); goto continue0;
+                            interrupted1:
+                                                __interruptL(@line); goto continue1;
+                            interrupted2:
+                                                __interruptL(@line); goto continue2;
+                            interrupted3:
+                                                __interruptL(@line); goto continue3;
+                            interrupted4:
+                                                __interruptL(@line); goto continue4;
+                            interrupted5:
+                                                __interruptL(@line); goto continue5;
+                            interrupted6:
+                                                __interruptL(@line); goto continue6;
+                            interrupted7:
+                                                __interruptL(@line); goto continue7;
 #endif /* UNROLL_LOOPS */
-			    interruptedX:
-						__interruptL(@line); goto continueX;
-			}
-		    }
-		}
-	    }
+                            interruptedX:
+                                                __interruptL(@line); goto continueX;
+                        }
+                    }
+                }
+            }
 
 #           undef BLOCK_ARG
 
@@ -2032,60 +2037,61 @@
 #           define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
 #endif
 
-	    /*
-	     * sorry - must check for the blocks code within the loops;
-	     * it could be recompiled or flushed (in the interrupt)
-	     */
-	    do {
-		REGISTER OBJFUNC codeVal;
-
-		if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
-		    /*
-		     * arg is a compiled block with code -
-		     * directly call it without going through Block>>value
-		     * however, if there is an interrupt, refetch the code pointer.
-		     */
-		    /* stay here, while no interrupts are pending ... */
-		    do {
-			(*codeVal)(BLOCK_ARG);
-			if (InterruptPending != nil) goto outerLoop;
-		    } while (--tmp);
-		    RETURN (self);
-		} else {
-		    if (InterruptPending != nil) __interruptL(@line);
-
-		    if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
-			/*
-			 * arg is a compiled block with bytecode -
-			 * directly call interpreter without going through Block>>value
-			 */
-			__interpret(aBlock, 0, nil, IBLOCK_ARG, nil, nil);
-		    } else {
-			/*
-			 * arg is something else - call it with #value
-			 */
-			(*blockVal.ilc_func)(aBlock, @symbol(value), nil, &blockVal);
-		    }
-		}
+            /*
+             * sorry - must check for the blocks code within the loops;
+             * it could be recompiled or flushed (in the interrupt)
+             */
+            do {
+                REGISTER OBJFUNC codeVal;
+
+                if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+                    /*
+                     * arg is a compiled block with code -
+                     * directly call it without going through Block>>value
+                     * however, if there is an interrupt, refetch the code pointer.
+                     */
+                    /* stay here, while no interrupts are pending ... */
+                    do {
+                        (*codeVal)(BLOCK_ARG);
+                        if (InterruptPending != nil) goto outerLoop;
+                    } while (--tmp);
+                    RETURN (self);
+                } else {
+                    if (InterruptPending != nil) __interruptL(@line);
+
+                    if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
+                        /*
+                         * arg is a compiled block with bytecode -
+                         * directly call interpreter without going through Block>>value
+                         */
+                        __interpret(aBlock, 0, nil, IBLOCK_ARG, nil, nil);
+                    } else {
+                        /*
+                         * arg is something else - call it with #value
+                         */
+                        (*blockVal.ilc_func)(aBlock, @symbol(value), nil, &blockVal);
+                    }
+                }
     outerLoop: ;
-	    } while (--tmp);
+            } while (--tmp);
 
 #           undef BLOCK_ARG
 #           undef IBLOCK_ARG
 
-	    RETURN (self);
-	}
-
-	/*
-	 * not a block-like thingy - call it with #value
-	 */
-	do {
-	    if (InterruptPending != nil) __interruptL(@line);
-	    (*blockVal.ilc_func)(aBlock, @symbol(value), nil, &blockVal);
-	} while(--tmp);
-	RETURN (self);
+            RETURN (self);
+        }
+
+        /*
+         * not a block-like thingy - call it with #value
+         */
+        do {
+            if (InterruptPending != nil) __interruptL(@line);
+            (*blockVal.ilc_func)(aBlock, @symbol(value), nil, &blockVal);
+        } while(--tmp);
+        RETURN (self);
     }
-%}
+%}.
+    ^ super timesRepeat:aBlock
 
 "/    |count "{ Class: SmallInteger }" |
 "/
@@ -3082,7 +3088,8 @@
 %{  /* NOCONTEXT */
 
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? false : true );
-%}
+%}.
+    ^ super even
 !
 
 negative
@@ -3097,7 +3104,8 @@
 #else
     RETURN ( (__intVal(self) < 0) ? true : false );
 #endif
-%}
+%}.
+    ^ self < 0
 !
 
 odd
@@ -3106,7 +3114,9 @@
 %{  /* NOCONTEXT */
 
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? true : false );
-%}
+%}.
+    ^ super odd
+
 !
 
 positive
@@ -3121,7 +3131,9 @@
 #else
     RETURN ( (__intVal(self) >= 0) ? true : false );
 #endif
-%}
+%}.
+    ^ super positive
+
 !
 
 sign
@@ -3133,13 +3145,14 @@
     INT val = __intVal(self);
 
     if (val < 0) {
-	RETURN ( __MKSMALLINT(-1) ); 
+        RETURN ( __MKSMALLINT(-1) ); 
     }
     if (val > 0) {
-	RETURN ( __MKSMALLINT(1) );
+        RETURN ( __MKSMALLINT(1) );
     }
     RETURN ( __MKSMALLINT(0) );
-%}
+%}.
+    ^ super sign
 !
 
 strictlyPositive
@@ -3154,11 +3167,12 @@
 #else
     RETURN ( (__intVal(self) > 0) ? true : false );
 #endif
-%}
+%}.
+    ^ super strictlyPositive
 ! !
 
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.128 2000-06-23 18:57:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.129 2000-06-23 19:08:42 cg Exp $'
 ! !