2swap apply
; make-primitive apply
-:noname ( args -- result )
- make-continuation nil cons
- 2swap apply
+:noname ( proc -- result )
+ make-continuation
+
+ drop if
+ nil cons
+ 2swap apply
+ else
+ 2swap 2drop
+ then
+
+ trace
; 1 make-fa-primitive call-with-current-continuation
depth 2- 2/ fixnum-type 2swap cons
;
-: make-continuation
+: make-continuation ( -- continuation true-obj )
+ \ true-obj allows calling code to detect whether
+ \ it is being called immediately following make-continuation
+ \ or by a restore-continuation.
cons-param-stack
cons-return-stack
cons drop continuation-type
+
+ true boolean-type
;
: continuation->pstack-list
2swap
+ false boolean-type \ Add flag signifying continuation restore
+
+ 2swap
+
restore-return-stack
;