--- a/Context.st Tue Apr 21 21:40:04 2015 +0200
+++ b/Context.st Tue Apr 21 21:40:22 2015 +0200
@@ -671,7 +671,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ return context._RETURN(STInteger._new(self.numStArgs()));
#else
RETURN ( __mkSmallInteger( (__intVal(__INST(flags)) >> __NARG_SHIFT) & __NARG_MASK) );
#endif
@@ -693,7 +693,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ return context._RETURN(STInteger._new(self.numLocals(context)));
#else
RETURN ( __mkSmallInteger( (__intVal(__INST(flags)) >> __NVAR_SHIFT) & __NVAR_MASK) );
#endif
@@ -721,7 +721,11 @@
receiver
"return the receiver of the context"
-
+%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ return context._RETURN( self.stReceiver(context) );
+#endif
+%}.
^ receiver
!
@@ -756,6 +760,12 @@
selector
"return the selector of the method for which the context was created"
+%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ return context._RETURN(self.selector());
+ /* NOTREACHED */
+#endif
+%}.
^ selector
!
@@ -764,7 +774,8 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ return context._RETURN(self.sender());
+ /* NOTREACHED */
#else
OBJ theContext;
@@ -2006,7 +2017,7 @@
!
safeReceiverClassName
- "return the receivers class-name string or nil, if the receiver is invalid.
+ "return the receiver's class-name string or nil, if the receiver is invalid.
This cares for invalid (free) objects which may appear with bad primitive code,
and prevents a crash in such a case."
@@ -2014,7 +2025,13 @@
%{
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ {
+ STObject rcvr = self.stReceiver(context);
+ STClass cls = rcvr.clazz();
+
+ return context._RETURN( cls.className() );
+ }
+ /* NOT REACHED */
#else
/*
* special handling for (invalid) free objects.
@@ -2040,9 +2057,9 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ context._RETURN (self.isMarkedForUnwind() ? STObject.True : STObject.False);
#else
- RETURN ( ((INT)__INST(flags) & __MASKSMALLINT(__UNWIND_MARK)) ? true : false );
+ RETURN ( ((INT)__INST(flags) & __MASKSMALLINT(__UNWIND_MARK)) ? true : false );
#endif
%}
"
@@ -2057,7 +2074,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.markForHandle();
#else
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__HANDLE_MARK));
#endif
@@ -2073,7 +2090,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.markForInterrupt();
#else
__markInterrupted(__ContextInstPtr(self));
#endif
@@ -2088,7 +2105,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.markForInterruptOnUnwind();
#else
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__IRQ_ON_UNWIND));
#endif
@@ -2102,7 +2119,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.markForRaise();
#else
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__RAISE_MARK));
#endif
@@ -2118,7 +2135,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.markForUnwind();
#else
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__UNWIND_MARK));
#endif
@@ -2154,7 +2171,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ self.unmarkForUnwind();
#else
__INST(flags) = (OBJ)((INT)__INST(flags) & ~__MASKSMALLINT(__UNWIND_MARK));
#endif
@@ -2187,7 +2204,18 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ {
+ STObject caller = self.sender();
+
+ while (caller != Nil) {
+ if (caller.isExceptionalSmalltalkContext()) {
+ return context._RETURN(caller);
+ }
+ caller = caller.sender();
+ }
+ return context._RETURN( STObject.Nil );
+ }
+ /* NOTREACHED */
#else
OBJ theContext;
@@ -2214,7 +2242,7 @@
}
theContext = __ContextInstPtr(theContext)->c_sender;
}
-#endif
+#endif /* not SCHTEAM */
%}.
^ nil
!
@@ -2243,7 +2271,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
{
- STObject caller = self.asSTContinuation("sender").caller();
+ STObject caller = self.sender();
STObject sel1 = context.stArg(0);
STObject sel2 = context.stArg(1);
STObject sel3 = context.stArg(2);
@@ -2258,7 +2286,7 @@
break;
}
}
- caller = caller.asSTContinuation("sender").caller();
+ caller = caller.sender();
}
return context._RETURN(caller);
}
@@ -2575,7 +2603,7 @@
"
%{
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ return context._RETURN( STObject.True );
#else
OBJ sndr;
@@ -2612,7 +2640,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- ERROR("unimplemented");
+ return context._RETURN( STObject.True );
#else
RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(__CANNOT_RETURN)) ? false : true );
#endif
@@ -2832,11 +2860,11 @@
!Context class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.214 2015-04-20 10:48:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.215 2015-04-21 19:40:22 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.214 2015-04-20 10:48:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.215 2015-04-21 19:40:22 cg Exp $'
!
version_HG