diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-15 00:58:08 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-15 00:58:08 +0300 |
commit | 95fe7a40b3962440b67ad0f187e3e9400bf0c642 (patch) | |
tree | 0aff9f1d48970920a7271fd8909c39fdda38f2b6 /zephyr/main.c | |
parent | 403c93053e6a9897ad397ef325e451c4cc671ce1 (diff) | |
download | micropython-95fe7a40b3962440b67ad0f187e3e9400bf0c642.tar.gz micropython-95fe7a40b3962440b67ad0f187e3e9400bf0c642.zip |
zephyr: Support raw REPL.
Diffstat (limited to 'zephyr/main.c')
-rw-r--r-- | zephyr/main.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/zephyr/main.c b/zephyr/main.c index 9146cfadb6..f8e48e61e8 100644 --- a/zephyr/main.c +++ b/zephyr/main.c @@ -72,22 +72,23 @@ int real_main(void) { #endif mp_init(); MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt); + #if MICROPY_MODULE_FROZEN pyexec_frozen_module("main.py"); #endif - #if MICROPY_REPL_EVENT_DRIVEN - pyexec_event_repl_init(); + for (;;) { - int c = mp_hal_stdin_rx_chr(); - if (pyexec_event_repl_process_char(c)) { - break; + if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { + if (pyexec_raw_repl() != 0) { + break; + } + } else { + if (pyexec_friendly_repl() != 0) { + break; + } } } - #else - pyexec_friendly_repl(); - #endif - //do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT); - //do_str("for i in range(10):\r\n print(i)", MP_PARSE_FILE_INPUT); + mp_deinit(); return 0; } |