summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-01-16 01:38:10 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-01-16 01:38:24 +0200
commitd7337f288e9411d8473c6c77aa35a00b50346ca7 (patch)
tree166d5861a75ce76f4b98151845b9067d6c6380fd
parent87bc8e2b3d66d3e87c2d01a7b3107a8ecce2a07f (diff)
downloadmicropython-d7337f288e9411d8473c6c77aa35a00b50346ca7.tar.gz
micropython-d7337f288e9411d8473c6c77aa35a00b50346ca7.zip
minimal: Support even-driven REPL.
-rw-r--r--minimal/main.c10
-rw-r--r--minimal/mpconfigport.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/minimal/main.c b/minimal/main.c
index 29956c91a6..d23d4d414f 100644
--- a/minimal/main.c
+++ b/minimal/main.c
@@ -60,7 +60,17 @@ int main(int argc, char **argv) {
gc_init(heap, heap + sizeof(heap));
#endif
mp_init();
+ #if MICROPY_REPL_EVENT_DRIVEN
+ pyexec_friendly_repl_init();
+ for (;;) {
+ int c = stdin_rx_chr();
+ if (pyexec_friendly_repl_process_char(c)) {
+ break;
+ }
+ }
+ #else
pyexec_friendly_repl();
+ #endif
//do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')");
mp_deinit();
return 0;
diff --git a/minimal/mpconfigport.h b/minimal/mpconfigport.h
index cc6055df3d..236cebcf60 100644
--- a/minimal/mpconfigport.h
+++ b/minimal/mpconfigport.h
@@ -11,6 +11,7 @@
#define MICROPY_MEM_STATS (0)
#define MICROPY_DEBUG_PRINTERS (0)
#define MICROPY_ENABLE_GC (1)
+#define MICROPY_REPL_EVENT_DRIVEN (0)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (0)