#define SCM_SET_CONTINUATION_LENGTH(x, n)\ (SCM_CONTREGS (x)->num_stack_items = (n)) #define SCM_JMPBUF(x) ((SCM_CONTREGS (x))->jmpbuf) #define SCM_CONTINUATION_ROOT(x) ((SCM_CONTREGS (x))->root) #define SCM_DFRAME(x) ((SCM_CONTREGS (x))->dframe) /* scm_i_make_continuation will return a procedure whose code will reinstate the continuation. Here, as in gsubr.c, we define the form of that trampoline function. */ static const scm_t_uint32 continuation_stub_code[] = { SCM_PACK_OP_24 (continuation_call, 0) }; static SCM make_continuation_trampoline (SCM contregs) { SCM ret; scm_t_bits nfree = 1; scm_t_bits flags = SCM_F_PROGRAM_IS_CONTINUATION; ret = scm_words (scm_tc7_program | (nfree << 16) | flags, nfree + 2); SCM_SET_CELL_WORD_1 (ret, continuation_stub_code); SCM_PROGRAM_FREE_VARIABLE_SET (ret, 0, contregs); return ret; }
if (stack_depth < saved_stack_depth) abort (); n = stack_depth - saved_stack_depth; for (i = 0; i < n; i++) vals = scm_cons (vp->sp[i].as_scm, vals); vp->sp += n; return vals; } static const scm_t_uint32 compose_continuation_code[] = { SCM_PACK_OP_24 (compose_continuation, 0) }; static SCM make_partial_continuation (SCM vm_cont) { scm_t_bits nfree = 1; scm_t_bits flags = SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION; SCM ret; ret = scm_words (scm_tc7_program | (nfree << 16) | flags, nfree + 2); SCM_SET_CELL_WORD_1 (ret, compose_continuation_code); SCM_PROGRAM_FREE_VARIABLE_SET (ret, 0, vm_cont); return ret;