summaryrefslogtreecommitdiff
path: root/lib/utils/pyexec.c
diff options
context:
space:
mode:
authorMark <56205165+gamblor21@users.noreply.github.com>2021-03-15 20:00:13 -0500
committerGitHub <noreply@github.com>2021-03-15 20:00:13 -0500
commite326d7ca800ce7101ddce001320c5349ee5ddeb6 (patch)
tree000a06790af7a8d27e9ba9fc27e10015815e1509 /lib/utils/pyexec.c
parent307d2a99febbf6cdff824131dddc2ef938f5ea13 (diff)
parentf7a988b9b307141611b07f6dc9da5b26e982c154 (diff)
Merge branch 'main' into rp_dp_parallel
Diffstat (limited to 'lib/utils/pyexec.c')
-rw-r--r--[-rwxr-xr-x]lib/utils/pyexec.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index 68a3710ce..450b5ae32 100755..100644
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -85,7 +85,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) {
lex = mp_lexer_new_from_file(source);
} else {
- lex = (mp_lexer_t*)source;
+ lex = (mp_lexer_t *)source;
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
@@ -95,7 +95,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
- *((uint32_t volatile*) &parse_tree.chunk) = 0;
+ *((uint32_t volatile *)&parse_tree.chunk) = 0;
#else
mp_raise_msg(&mp_type_RuntimeError, translate("script compilation not supported"));
#endif
@@ -132,12 +132,12 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
-#if CIRCUITPY_ALARM
+ #if CIRCUITPY_ALARM
} else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) {
ret = PYEXEC_DEEP_SLEEP;
-#endif
+ #endif
} else {
- if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
+ if ((mp_obj_t)nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
ret = PYEXEC_EXCEPTION;
@@ -169,8 +169,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n "
- "n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n",
- (unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes);
+ "n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n",
+ (unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes);
}
#if MICROPY_ENABLE_GC
@@ -195,7 +195,7 @@ typedef struct _repl_t {
// but it was moved to MP_STATE_VM(repl_line) as containing
// root pointer. Still keep structure in case more state
// will be added later.
- //vstr_t line;
+ // vstr_t line;
bool cont_line;
} repl_t;
@@ -307,10 +307,10 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
} else {
if (ret == CHAR_CTRL_C) {
- // cancel everything
- mp_hal_stdout_tx_str("\r\n");
- repl.cont_line = false;
- goto input_restart;
+ // cancel everything
+ mp_hal_stdout_tx_str("\r\n");
+ repl.cont_line = false;
+ goto input_restart;
} else if (ret == CHAR_CTRL_D) {
// stop entering compound statement
goto exec;
@@ -326,13 +326,13 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
return 0;
}
-exec: ;
+ exec:;
int ret = parse_compile_execute(MP_STATE_VM(repl_line), MP_PARSE_SINGLE_INPUT, EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL | EXEC_FLAG_SOURCE_IS_VSTR, NULL);
if (ret & PYEXEC_FORCED_EXIT) {
return ret;
}
-input_restart:
+ input_restart:
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false;
readline_init(MP_STATE_VM(repl_line), ">>> ");
@@ -409,11 +409,11 @@ int pyexec_friendly_repl(void) {
vstr_t line;
vstr_init(&line, 32);
-#if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
+ #if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD
// in host mode, we enable the LCD for the repl
mp_obj_t lcd_o = mp_call_function_0(mp_load_name(qstr_from_str("LCD")));
mp_call_function_1(mp_load_attr(lcd_o, qstr_from_str("light")), mp_const_true);
-#endif
+ #endif
friendly_repl_reset:
mp_hal_stdout_tx_str("\r\n");