temporarily disable elisp exception tests
[bpt/guile.git] / libguile / root.c
index 688ec87..c83da1c 100644 (file)
@@ -1,22 +1,26 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000, 2001, 2002, 2006, 2008, 2009, 2012 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 as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
  */
 
 
 \f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include <string.h>
 #include <stdio.h>
 #include "libguile/root.h"
 \f
 
-SCM scm_sys_protects[SCM_NUM_PROTECTS];
-
-\f
-
 /* {call-with-dynamic-root}
  *
  * Suspending the current thread to evaluate a thunk on the
@@ -109,25 +109,28 @@ scm_internal_cwdr (scm_t_catch_body body, void *body_data,
                   SCM_STACKITEM *stack_start)
 {
   struct cwdr_handler_data my_handler_data;
-  SCM answer, old_winds;
+  scm_t_dynstack *dynstack = &SCM_I_CURRENT_THREAD->dynstack;
+  SCM answer;
+  scm_t_dynstack *old_dynstack;
 
   /* Exit caller's dynamic state.
    */
-  old_winds = scm_i_dynwinds ();
-  scm_dowinds (SCM_EOL, scm_ilength (old_winds));
+  old_dynstack = scm_dynstack_capture_all (dynstack);
+  scm_dynstack_unwind (dynstack, SCM_DYNSTACK_FIRST (dynstack));
 
   scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
   scm_dynwind_current_dynamic_state (scm_make_dynamic_state (SCM_UNDEFINED));
 
   my_handler_data.run_handler = 0;
   answer = scm_i_with_continuation_barrier (body, body_data,
-                                           cwdr_handler, &my_handler_data);
+                                           cwdr_handler, &my_handler_data,
+                                           NULL, NULL);
 
   scm_dynwind_end ();
 
   /* Enter caller's dynamic state.
    */
-  scm_dowinds (old_winds, - scm_ilength (old_winds));
+  scm_dynstack_wind (dynstack, SCM_DYNSTACK_FIRST (old_dynstack));
 
   /* Now run the real handler iff the body did a throw. */
   if (my_handler_data.run_handler)
@@ -154,9 +157,9 @@ cwdr (SCM proc, SCM a1, SCM args, SCM handler, SCM_STACKITEM *stack_start)
 
 SCM_DEFINE (scm_call_with_dynamic_root, "call-with-dynamic-root", 2, 0, 0,
            (SCM thunk, SCM handler),
-           "Call @var{thunk} with a new dynamic state and within"
-           "a continuation barrier.  The @var{handler} catches all"
-           "otherwise uncaught throws and executes within the same"
+           "Call @var{thunk} with a new dynamic state and within\n"
+           "a continuation barrier.  The @var{handler} catches all\n"
+           "otherwise uncaught throws and executes within the same\n"
            "dynamic context as @var{thunk}.")
 #define FUNC_NAME s_scm_call_with_dynamic_root
 {