Context.st
branchjv
changeset 18292 8d4fe353a2d2
parent 18285 7aab8c3dab19
parent 18291 610fcf903bed
child 18301 d0a478542bbf
--- a/Context.st	Sat Apr 25 06:43:41 2015 +0200
+++ b/Context.st	Mon Apr 27 06:43:29 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -346,7 +348,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( STInteger._new( ((STContinuation)self).numStArgs() ) );
+    return context._RETURN( STInteger._new( self.asSTContinuation().numStArgs() ) );
 #else
     RETURN ( __mkSmallInteger( (__intVal(__INST(flags)) >> __NARG_SHIFT) & __NARG_MASK) );
 #endif
@@ -397,7 +399,7 @@
 	int idx = context.stArg(0).intValue("[instVarAt:]");
 
 	if (idx == I_sender) {
-	    return context._RETURN( ((STContinuation)self).caller() );
+	    return context._RETURN( self.asSTContinuation().caller() );
 	}
 	if (idx == I_retvalTemp) {
 	    return context._RETURN( Nil );
@@ -671,7 +673,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN(STInteger._new(self.numStArgs()));
+    return context._RETURN(STInteger._new(self.asSTContinuation().numStArgs()));
 #else
     RETURN ( __mkSmallInteger( (__intVal(__INST(flags)) >> __NARG_SHIFT) & __NARG_MASK) );
 #endif
@@ -693,7 +695,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN(STInteger._new(self.numLocals(context)));
+    return context._RETURN(STInteger._new(self.asSTContinuation().numLocals(context)));
 #else
     RETURN ( __mkSmallInteger( (__intVal(__INST(flags)) >> __NVAR_SHIFT) & __NVAR_MASK) );
 #endif
@@ -723,7 +725,7 @@
     "return the receiver of the context"
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( self.stSelf(context) );
+    return context._RETURN( self.asSTContinuation().stSelf(context) );
 #endif
 %}.
     ^ receiver
@@ -760,12 +762,6 @@
 selector
     "return the selector of the method for which the context was created"
 
-%{  /* NOCONTEXT */
-#ifdef __SCHTEAM__
-    return context._RETURN(self.selector());
-    /* NOTREACHED */
-#endif
-%}.
     ^ selector
 !
 
@@ -774,7 +770,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN(self.sender());
+    return context._RETURN(self.asSTContinuation().sender());
     /* NOTREACHED */
 #else
     OBJ theContext;
@@ -817,15 +813,12 @@
      invalid until needed."
 
 %{  /* NOCONTEXT */
-#ifdef __SCHTEAM__
-    ERROR("unimplemented");
-#else
     if ( __INST(sender_) == nil ) {
 	RETURN (true);
     }
     RETURN (false);
-#endif
 %}.
+    ^ self sender isNil
 !
 
 setLineNumber:aNumber
@@ -1022,8 +1015,8 @@
      - used only for MiniDebuggers walkback print"
 
     self receiverPrintString errorPrint. ' ' errorPrint. selector errorPrint.
-    self size ~~ 0 ifTrue: [
-	' ' errorPrint. self argsDisplayString errorPrint
+    self numArgs ~~ 0 ifTrue: [
+        ' ' errorPrint. self argsDisplayString errorPrint
     ].
     ' [' errorPrint. self lineNumber errorPrint. ']' errorPrintCR
 
@@ -2026,7 +2019,7 @@
 %{
 #ifdef __SCHTEAM__
     {
-	STObject rcvr = self.stSelf(context);
+	STObject rcvr = self.asSTContinuation().stSelf(context);
 	STClass cls = rcvr.clazz();
 
 	return context._RETURN( cls.className() );
@@ -2057,7 +2050,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    context._RETURN (self.isMarkedForUnwind() ? STObject.True : STObject.False);
+    return context._RETURN (self.asSTContinuation().isMarkedForUnwind() ? STObject.True : STObject.False);
 #else
     RETURN ( ((INT)__INST(flags) & __MASKSMALLINT(__UNWIND_MARK)) ? true : false );
 #endif
@@ -2074,7 +2067,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.markForHandle();
+    self.asSTContinuation().markForHandle();
 #else
      __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__HANDLE_MARK));
 #endif
@@ -2090,7 +2083,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.markForInterrupt();
+    self.asSTContinuation().markForInterrupt();
 #else
      __markInterrupted(__ContextInstPtr(self));
 #endif
@@ -2105,7 +2098,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.markForInterruptOnUnwind();
+    self.asSTContinuation().markForInterruptOnUnwind();
 #else
      __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__IRQ_ON_UNWIND));
 #endif
@@ -2119,7 +2112,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.markForRaise();
+    self.asSTContinuation().markForRaise();
 #else
      __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__RAISE_MARK));
 #endif
@@ -2135,7 +2128,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.markForUnwind();
+    self.asSTContinuation().markForUnwind();
 #else
      __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__UNWIND_MARK));
 #endif
@@ -2171,7 +2164,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    self.unmarkForUnwind();
+    self.asSTContinuation().unmarkForUnwind();
 #else
     __INST(flags) = (OBJ)((INT)__INST(flags) & ~__MASKSMALLINT(__UNWIND_MARK));
 #endif
@@ -2205,7 +2198,7 @@
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
     {
-	STObject caller = self.sender();
+	STObject caller = self.asSTContinuation().sender();
 
 	while (caller != Nil) {
 	    if (caller.isExceptionalSmalltalkContext()) {
@@ -2603,7 +2596,7 @@
     "
 %{
 #ifdef __SCHTEAM__
-    return context._RETURN( STObject.True );
+    return context._RETURN_true();
 #else
     OBJ sndr;
 
@@ -2640,7 +2633,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( STObject.True );
+    return context._RETURN_true();
 #else
     RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(__CANNOT_RETURN)) ? false : true );
 #endif
@@ -2860,11 +2853,11 @@
 !Context class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.217 2015-04-24 08:19:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.219 2015-04-26 14:57:54 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.217 2015-04-24 08:19:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.219 2015-04-26 14:57:54 cg Exp $'
 !
 
 version_HG