libguile/Makefile.am (snarfcppopts): Remove CFLAGS
[bpt/guile.git] / libguile / continuations.c
index 31e3644..8dca62e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -116,7 +116,7 @@ continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
    placed on the VM stack). */
 #define FUNC_NAME "scm_i_make_continuation"
 SCM 
-scm_i_make_continuation (int *first, SCM vm, SCM vm_cont)
+scm_i_make_continuation (int *first, struct scm_vm *vp, SCM vm_cont)
 {
   scm_i_thread *thread = SCM_I_CURRENT_THREAD;
   SCM cont;
@@ -137,7 +137,7 @@ scm_i_make_continuation (int *first, SCM vm, SCM vm_cont)
 #endif
   continuation->offset = continuation->stack - src;
   memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size);
-  continuation->vm = vm;
+  continuation->vp = vp;
   continuation->vm_cont = vm_cont;
 
   SCM_NEWSMOB (cont, tc16_continuation, continuation);
@@ -161,12 +161,15 @@ scm_i_make_continuation (int *first, SCM vm, SCM vm_cont)
       return make_continuation_trampoline (cont);
     }
   else
-    return SCM_UNDEFINED;
+    {
+      scm_gc_after_nonlocal_exit ();
+      return SCM_UNDEFINED;
+    }
 }
 #undef FUNC_NAME
 
-SCM
-scm_i_continuation_to_frame (SCM continuation)
+int
+scm_i_continuation_to_frame (SCM continuation, struct scm_frame *frame)
 {
   SCM contregs;
   scm_t_contregs *cont;
@@ -177,19 +180,22 @@ scm_i_continuation_to_frame (SCM continuation)
   if (scm_is_true (cont->vm_cont))
     {
       struct scm_vm_cont *data = SCM_VM_CONT_DATA (cont->vm_cont);
-      return scm_c_make_frame (SCM_VM_FRAME_KIND_CONT, cont->vm_cont,
-                               (data->fp + data->reloc) - data->stack_base,
-                               (data->sp + data->reloc) - data->stack_base,
-                               data->ra);
+
+      frame->stack_holder = data;
+      frame->fp_offset = (data->fp + data->reloc) - data->stack_base;
+      frame->sp_offset = (data->sp + data->reloc) - data->stack_base;
+      frame->ip = data->ra;
+
+      return 1;
     }
   else
-    return SCM_BOOL_F;
+    return 0;
 }
 
-SCM
-scm_i_contregs_vm (SCM contregs)
+struct scm_vm *
+scm_i_contregs_vp (SCM contregs)
 {
-  return SCM_CONTREGS (contregs)->vm;
+  return SCM_CONTREGS (contregs)->vp;
 }
 
 SCM