Convert remaining old style `catch' to `with-throw-handler'
[clinton/bobotpp.git] / source / BotInterp.C
index de65e93..32801f1 100644 (file)
 
 #include <algorithm>
 
-#include "Utils.H"
-#include "Bot.H"
 #include "BotInterp.H"
 
+#include "Bot.H"
+#include "Interp.H"
+#include "Utils.H"
+
 #ifdef USESCRIPTS
 
 #include <libguile.h>
@@ -173,18 +175,18 @@ BotInterp::RunHooks(int hooktype, std::string match, SCM args)
        it != hooks[hooktype].rend();
        ++it) 
     {
-      std::cerr << "Matching...\n";
       if (scm_regexp_exec((*it)->regex, Utils::str2scm (match),
                          SCM_UNDEFINED, SCM_UNDEFINED) != SCM_BOOL_F)
        {
-         std::cerr << " Match " << (*it)->regex_str << std::endl;
          bool fallthru_p = (*it)->fallthru;
          wd.func = (*it)->function;
-         result = scm_internal_catch(SCM_BOOL_T, 
-                                     (scm_t_catch_body) 
-                                     Interp::LazyApplyWrapper,
-                                     static_cast<void *> (&wd), 
-                                     (scm_t_catch_handler) Interp::EmptyHandler, 0);
+         result = scm_c_with_throw_handler (SCM_BOOL_T,
+                                            (scm_t_catch_body)
+                                            Interp::LazyApplyWrapper,
+                                            static_cast<void *> (&wd),
+                                            (scm_t_catch_handler) Interp::EmptyHandler,
+                                            0,
+                                            0);
          if (!fallthru_p)
            break;
        }
@@ -251,11 +253,12 @@ BotInterp::RunTimers(int now)
        {
          wd.func = current_timer.function;
 
-         scm_internal_catch (SCM_BOOL_T,
-                             (scm_t_catch_body) Interp::LazyApplyWrapper,
-                             (void *)&wd,
-                             (scm_t_catch_handler) Interp::EmptyHandler, 
-                             0);
+         scm_c_with_throw_handler (SCM_BOOL_T,
+                                   (scm_t_catch_body) Interp::LazyApplyWrapper,
+                                   (void *)&wd,
+                                   (scm_t_catch_handler) Interp::EmptyHandler,
+                                   0,
+                                   0);
 
          // The timer list may have been modified by the timer
          // callback; if it has in such a way that the first queue