:noname ( proc -- result )
make-continuation
+ ( Note that we get to this point either when
+ make-continuation is originally called or when
+ restore-continuation is called. Since we don't
+ want to call proc again following a restore,
+ we use the boolean values placed on the parameter
+ stack by make-continuation and restore-continuation
+ to detect which call got us here and act accordingly. )
+
drop if
nil cons
2swap apply
2drop
;
+( This word restores the return stack to that contained in the
+continuation object, and thus NEVER RETURNS. )
: restore-return-stack ( continuation -- )
continuation->rstack-list
2drop
;
+( This word restores the parameter and return stacks
+to those in the continuation object. The restoration of the
+return stack means that execution continues at the point
+described in the continuation object, so this word NEVER RETURNS.
+
+Note that both obj and a false-obj are added to the parameter
+stack before the return stack is restored, so that make-continuation
+knows that this execution path is the result of a continuation
+restoration rather than the original call to make-continuation. )
: restore-continuation-with-arg ( continuation obj -- )
>R >R \ Store obj on return stack