actually capture partial continuations
authorAndy Wingo <wingo@pobox.com>
Mon, 22 Feb 2010 22:00:19 +0000 (23:00 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 22 Feb 2010 22:00:19 +0000 (23:00 +0100)
commitcee1d22c3c10b1892c82a5758ef69cd6fc9aba31
tree03628430d2426ab2148587d19ee386f82a9f09aa
parent76e3816281cf6c406ef6f01907ce29401c8ff455
actually capture partial continuations

* libguile/control.c (cont_objcode): Along with a bunch of boilerplate
  that certainly needs to go in some central place, define this
  continuation-calling trampoline.
  (reify_partial_continuation): New function, returns a procedure that
  when called will reinstate a partial continuation.
  (scm_c_abort): Take an extra arg, the cookie. Actually reify a
  continuation.
  (scm_at_abort): Adapt to scm_c_abort change.

* libguile/control.h: Declare scm_c_abort change.

* libguile/vm-i-system.c (partial_cont_call): New instruction.
  (call/cc, tail-call/cc): Adapt to scm_i_vm_capture_stack change.
  (abort): Pass vm_cookie to abort.

* libguile/vm.h (SCM_F_VM_CONT_PARTIAL, SCM_F_VM_CONT_REWINDABLE): New
  flags.
  (struct scm_vm_cont): Add flags field.
  (SCM_VM_CONT_PARTIAL_P, SCM_VM_CONT_REWINDABLE_P): New predicates.

* libguile/vm.c (scm_i_vm_capture_stack): Rename from
  vm_capture_continuation, and make internal instead of static. Take a
  flags argument.
  (scm_i_vm_capture_continuation): Adapt to scm_i_vm_capture_stack
  change.
  (vm_abort): Plumb cookie to scm_c_abort.
  (vm_reinstate_partial_continuation): New stub.
libguile/control.c
libguile/control.h
libguile/vm-i-system.c
libguile/vm.c
libguile/vm.h