Skip to content

Commit d7337f2

Browse files
committed
minimal: Support even-driven REPL.
1 parent 87bc8e2 commit d7337f2

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

minimal/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@ int main(int argc, char **argv) {
6060
gc_init(heap, heap + sizeof(heap));
6161
#endif
6262
mp_init();
63+
#if MICROPY_REPL_EVENT_DRIVEN
64+
pyexec_friendly_repl_init();
65+
for (;;) {
66+
int c = stdin_rx_chr();
67+
if (pyexec_friendly_repl_process_char(c)) {
68+
break;
69+
}
70+
}
71+
#else
6372
pyexec_friendly_repl();
73+
#endif
6474
//do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')");
6575
mp_deinit();
6676
return 0;

minimal/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define MICROPY_MEM_STATS (0)
1212
#define MICROPY_DEBUG_PRINTERS (0)
1313
#define MICROPY_ENABLE_GC (1)
14+
#define MICROPY_REPL_EVENT_DRIVEN (0)
1415
#define MICROPY_HELPER_REPL (1)
1516
#define MICROPY_HELPER_LEXER_UNIX (0)
1617
#define MICROPY_ENABLE_SOURCE_LINE (0)

0 commit comments

Comments
 (0)