[project @ 2005-07-04 01:48:38 by unknown_lamer]
[clinton/bobotpp.git] / source / Interp.C
index 1107f57..161b89f 100644 (file)
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; 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.
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -40,7 +41,7 @@ pthread_mutex_t Interp::mutex = PTHREAD_MUTEX_INITIALIZER;
 typedef SCM (*SCMFunc)();
 
 SCM
-scm_apply_wrapper(void *data)
+Interp::ScmApplyWrapper (void *data)
 {
 #ifdef MULTITHREAD
   //  pthread_mutex_lock (&Interp::mutex);
@@ -56,8 +57,8 @@ scm_apply_wrapper(void *data)
   return SCM_BOOL_T;
 }
 
-static SCM
-lazy_handler(void *data, SCM tag, SCM throw_args)
+SCM
+Interp::LazyHandler (void *data, SCM tag, SCM throw_args)
 {
   SCM log_port = Interp::bot->botInterp->ScriptLog();
   SCM eport = scm_set_current_error_port(log_port);
@@ -70,18 +71,20 @@ lazy_handler(void *data, SCM tag, SCM throw_args)
 }
 
 SCM
-empty_handler(void *data, SCM tag, SCM args)
+Interp::EmptyHandler(void *data, SCM tag, SCM args)
 {
   return SCM_UNSPECIFIED;
 }
 
 
 SCM
-lazy_apply_wrapper(void *data)
+Interp::LazyApplyWrapper(void *data)
 {
   return scm_internal_lazy_catch(SCM_BOOL_T,
-                                (scm_t_catch_body) scm_apply_wrapper, data,
-                                (scm_t_catch_handler) lazy_handler, 0);
+                                (scm_t_catch_body) Interp::ScmApplyWrapper, 
+                                data,
+                                (scm_t_catch_handler) Interp::LazyHandler, 
+                                0);
 }
 
 
@@ -89,8 +92,9 @@ static SCM
 lazy_eval_file(char *filename)
 {
   return scm_internal_lazy_catch(SCM_BOOL_T,
-                                (scm_t_catch_body) scm_c_primitive_load, filename,
-                                (scm_t_catch_handler) lazy_handler, 0);
+                                (scm_t_catch_body) scm_c_primitive_load, 
+                                filename,
+                                (scm_t_catch_handler) Interp::LazyHandler, 0);
 }
 
 static SCM
@@ -98,7 +102,7 @@ lazy_eval_string(char *str)
 {
   return scm_internal_lazy_catch(SCM_BOOL_T,
                                 (scm_t_catch_body) scm_c_eval_string, str,
-                                (scm_t_catch_handler) lazy_handler, 0);
+                                (scm_t_catch_handler) Interp::LazyHandler, 0);
 }
 
 
@@ -147,11 +151,10 @@ interp_init_helper (void* unused)
   scm_c_define ("hooks/invite", scm_long2num(Hook::INVITE));
   scm_c_define ("hooks/join", scm_long2num(Hook::JOIN));
   scm_c_define ("hooks/kick", scm_long2num(Hook::KICK));
-  scm_c_define ("hooks/leave", scm_long2num(Hook::LEAVE));
-  scm_c_define ("hooks/part", scm_long2num(Hook::LEAVE));
   scm_c_define ("hooks/mode", scm_long2num(Hook::MODE));
   scm_c_define ("hooks/message", scm_long2num(Hook::MESSAGE));
   scm_c_define ("hooks/notice", scm_long2num(Hook::NOTICE));
+  scm_c_define ("hooks/part", scm_long2num(Hook::PART));
   scm_c_define ("hooks/public", scm_long2num(Hook::PUBLIC));
   scm_c_define ("hooks/public-notice", scm_long2num(Hook::PUBLIC_NOTICE));
   scm_c_define ("hooks/raw", scm_long2num(Hook::RAW));
@@ -300,7 +303,7 @@ Interp::Execute(Bot *b, String command)
   bot = b;
   scm_internal_catch(SCM_BOOL_T,
                     (scm_t_catch_body) lazy_eval_string, (void *) static_cast<const char *> (command),
-                    (scm_t_catch_handler) empty_handler, 0);
+                    (scm_t_catch_handler) Interp::EmptyHandler, 0);
   
 #ifdef MULTITHREAD
   // We release the lock
@@ -318,8 +321,9 @@ Interp::LoadScript(Bot *b, String filename)
 #endif
   bot = b;
   scm_internal_catch(SCM_BOOL_T,
-                    (scm_t_catch_body) lazy_eval_file, (void *)static_cast<const char * >(filename),
-                    (scm_t_catch_handler) empty_handler, 0);
+                    (scm_t_catch_body) lazy_eval_file, 
+                    (void *)static_cast<const char * >(filename),
+                    (scm_t_catch_handler) Interp::EmptyHandler, 0);
 #ifdef MULTITHREAD
   // We release the lock
   pthread_mutex_unlock(&mutex);