{ "callstack" "kernel" (( -- cs )) }
{ "set-datastack" "kernel" (( ds -- )) }
{ "set-retainstack" "kernel" (( rs -- )) }
- { "set-callstack" "kernel" (( cs -- )) }
+ { "set-callstack" "kernel" (( cs -- * )) }
{ "(exit)" "system" (( n -- )) }
{ "data-room" "memory" (( -- data-room )) }
{ "code-room" "memory" (( -- code-room )) }
{ "innermost-frame-executing" "kernel.private" (( callstack -- obj )) }
{ "innermost-frame-scan" "kernel.private" (( callstack -- n )) }
{ "set-innermost-frame-quot" "kernel.private" (( n callstack -- )) }
- { "call-clear" "kernel.private" (( quot -- )) }
+ { "call-clear" "kernel.private" (( quot -- * )) }
{ "resize-byte-array" "byte-arrays" (( n byte-array -- newbyte-array )) }
{ "dll-valid?" "alien.libraries" (( dll -- ? )) }
{ "unimplemented" "kernel.private" (( -- * )) }
{ $values { "cs" callstack } }
{ $description "Outputs a copy of the call stack contents, with the top of the stack at the end of the vector. The stack frame of the caller word is " { $emphasis "not" } " included." } ;
-HELP: set-callstack ( cs -- )
+HELP: set-callstack ( cs -- * )
{ $values { "cs" callstack } }
{ $description "Replaces the call stack contents. The end of the vector becomes the top of the stack. Control flow is transferred immediately to the new call stack." } ;
{ call POSTPONE: call( } related-words
-HELP: call-clear ( quot -- )
+HELP: call-clear ( quot -- * )
{ $values { "quot" callable } }
{ $description "Calls a quotation with an empty call stack. If the quotation returns, Factor will exit.." }
{ $notes "Used to implement " { $link "threads" } "." } ;
last-frame
] unit-test
+: throw-frame-test ( c -- * ) [ gc gc continue ] call-clear ;
+: throw-frame-test' ( -- ) [ throw-frame-test ] callcc0 ;
+
+[ ] [ throw-frame-test' ] unit-test
+
[ 10 2 3 4 5 ] [ 1 2 3 4 5 [ 10 * ] 4dip ] unit-test
[ 3 -1 5/6 ] [ 1 2 3 4 5 6 [ + ] [ - ] [ / ] 2tri* ] unit-test