diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-05 08:19:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-05 08:19:43 -0700 |
commit | 7007754f037dd1d6ef4f9cfd636ef91016809737 (patch) | |
tree | 7ce814df93acd143ccbd4ad66f87ce33d244f0ca /txr.c | |
parent | edbb612c40e3541a170aeaaf41ad8703c8b70cf9 (diff) | |
download | txr-7007754f037dd1d6ef4f9cfd636ef91016809737.tar.gz txr-7007754f037dd1d6ef4f9cfd636ef91016809737.tar.bz2 txr-7007754f037dd1d6ef4f9cfd636ef91016809737.zip |
Basic REPL based on linenoise.
* Makefile (OBJS): Only include linenoise.o if
have_termios is y.
* configure: Adding test for termios.
(have_termios): New configure and config.make variable.
(gen_config_make): Generate have_termios variable.
* parser.c (repl): New function.
* parser.h (repl): Declared.
* txr.c (help): Summarize new -i option.
(txr_main): Implement -i repl.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -113,6 +113,8 @@ static void help(void) "-B Force list of bindings to be dumped, or false\n" " if termination is unsuccessful.\n" "-l If dumping bindings, use TXR Lisp format.\n" +"-i Interactive TXR Lisp listener mode.\n" +" (Requires compiled-in support.)\n" "-d Debugger mode.\n" "-n Noninteractive input mode for standard input stream,\n" " even if its connected to a terminal device.\n" @@ -624,6 +626,16 @@ int txr_main(int argc, char **argv) opt_lisp_bindings = 1; opt_print_bindings = 1; break; + case 'i': +#if HAVE_TERMIOS + repl(bindings, std_input, std_output); + return 0; +#else + format(std_error, + lit("~a: option ~a requires a platform with termios\n"), + prog_string, arg, nao); + return EXIT_FAILURE; +#endif case 'd': #if CONFIG_DEBUG_SUPPORT opt_debugger = 1; |