From 7bc9c9a84b1cf58a2a35be7f0bcd1c39214cf63f Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Sun, 19 Mar 2017 15:31:10 -0400 Subject: REPL: just use guile's normal REPL This gives _much_ more useful readline behavior, since (ice-9 readline) actually knows how to autocomplete based on the scheme environment, handle multi-line input, etc.; and properly displays return values and error-messages, and supports switching to different front-end programming languages like ecmascript. Note that we're keeping catch_handler so that we have a chance of diagnosing problems that could _conceivably_ occur when interacting with guile during bootstrap (e.g.: missing readline support, changed REPL API...). --- src/main.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 62a9210..fcc55f5 100644 --- a/src/main.c +++ b/src/main.c @@ -325,22 +325,25 @@ void main_prog(void *closure, gint argc, gchar *argv[]) } else { - gchar buf[BUFF_LEN]; - g_printf ("Robot program not specified. Entering interactive mode..\n"); - while (1) - { - memset(&buf, 0, BUFF_LEN); - - ui_cmdwin_get_string(UI_CMDWIN(ui->priv->cmdwin), "guile> ", - buf, BUFF_LEN); - - scm_internal_catch(SCM_BOOL_T, - (scm_t_catch_body) scm_c_eval_string, buf, - catch_handler, NULL); - } + scm_internal_catch(SCM_BOOL_T, + (scm_t_catch_body) scm_c_use_module, + "ice-9 readline", + catch_handler, NULL); + scm_internal_catch(SCM_BOOL_T, + (scm_t_catch_body) scm_c_eval_string, + "(activate-readline)", + catch_handler, NULL); + scm_internal_catch(SCM_BOOL_T, + (scm_t_catch_body) scm_c_use_module, + "system repl repl", + catch_handler, NULL); + scm_internal_catch(SCM_BOOL_T, + (scm_t_catch_body) scm_c_eval_string, + "(start-repl)", + catch_handler, NULL); } /* done */ -- cgit v1.1