From ef4616f943c15d40cc2ff189b70e0ef6251af561 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 28 Aug 2001 16:38:06 +0000 Subject: guile integration --- mixutils/mixvm_loop.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'mixutils/mixvm_loop.c') diff --git a/mixutils/mixvm_loop.c b/mixutils/mixvm_loop.c index 023d82d..f88acfb 100644 --- a/mixutils/mixvm_loop.c +++ b/mixutils/mixvm_loop.c @@ -27,6 +27,11 @@ #include #include #include + +#ifdef MAKE_GUILE +#include +#endif + #include "mixvm_command.h" #ifdef HAVE_LIBHISTORY @@ -80,7 +85,7 @@ rl_gets () /* The main command loop of the virtual machine */ static mix_config_t *config_ = NULL; -static void +static mix_vm_cmd_dispatcher_t * init_mixvm_ (const gchar *file, gboolean use_emacs) { static const gchar *HISTORY_FILE = "mixvm.history"; @@ -93,18 +98,30 @@ init_mixvm_ (const gchar *file, gboolean use_emacs) if (mix_config_get_history_size (config_) == 0) mix_config_set_history_size (config_, HISTORY_SIZE); - mixvm_cmd_init (config_, (char *)file, use_emacs); + return mixvm_cmd_init (config_, (char *)file, use_emacs); } -void -mix_vmloop (const gchar *file, gboolean use_emacs) + +static void +loop_ (int argc, char *argv[]) { - init_mixvm_ (file, use_emacs); while ( mixvm_cmd_exec (rl_gets ()) ) ; mix_config_delete (config_); } +void +mix_vmloop (int argc, char *argv[], const gchar *file, gboolean use_emacs) +{ +#ifdef MAKE_GUILE + mix_vm_cmd_dispatcher_t *dis = init_mixvm_ (file, use_emacs); + mixguile_init (argc, argv, loop_, dis); +#else + (void) init_mixvm_ (file, use_emacs); + loop_ (argc, argv); +#endif +} + /* run a program and exit */ void mix_vmrun (const gchar *code_file, gboolean dump) -- cgit v1.2.3