shared/runtime/pyexec: Cleanup EXEC_FLAG flag constants.
- Cleanup pyexec flags definitions so it's clear they are different. - Use mp_uint_t for exec_flags because it should be unsigned.
This commit is contained in:
parent
58b56b91c4
commit
644f4dcc94
|
@ -50,20 +50,20 @@ int pyexec_system_exit = 0;
|
||||||
STATIC bool repl_display_debugging_info = 0;
|
STATIC bool repl_display_debugging_info = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXEC_FLAG_PRINT_EOF (1)
|
#define EXEC_FLAG_PRINT_EOF (1 << 0)
|
||||||
#define EXEC_FLAG_ALLOW_DEBUGGING (2)
|
#define EXEC_FLAG_ALLOW_DEBUGGING (1 << 1)
|
||||||
#define EXEC_FLAG_IS_REPL (4)
|
#define EXEC_FLAG_IS_REPL (1 << 2)
|
||||||
#define EXEC_FLAG_SOURCE_IS_RAW_CODE (8)
|
#define EXEC_FLAG_SOURCE_IS_RAW_CODE (1 << 3)
|
||||||
#define EXEC_FLAG_SOURCE_IS_VSTR (16)
|
#define EXEC_FLAG_SOURCE_IS_VSTR (1 << 4)
|
||||||
#define EXEC_FLAG_SOURCE_IS_FILENAME (32)
|
#define EXEC_FLAG_SOURCE_IS_FILENAME (1 << 5)
|
||||||
#define EXEC_FLAG_SOURCE_IS_READER (64)
|
#define EXEC_FLAG_SOURCE_IS_READER (1 << 6)
|
||||||
|
|
||||||
// parses, compiles and executes the code in the lexer
|
// parses, compiles and executes the code in the lexer
|
||||||
// frees the lexer before returning
|
// frees the lexer before returning
|
||||||
// EXEC_FLAG_PRINT_EOF prints 2 EOF chars: 1 after normal output, 1 after exception output
|
// EXEC_FLAG_PRINT_EOF prints 2 EOF chars: 1 after normal output, 1 after exception output
|
||||||
// EXEC_FLAG_ALLOW_DEBUGGING allows debugging info to be printed after executing the code
|
// EXEC_FLAG_ALLOW_DEBUGGING allows debugging info to be printed after executing the code
|
||||||
// EXEC_FLAG_IS_REPL is used for REPL inputs (flag passed on to mp_compile)
|
// EXEC_FLAG_IS_REPL is used for REPL inputs (flag passed on to mp_compile)
|
||||||
STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input_kind, int exec_flags) {
|
STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input_kind, mp_uint_t exec_flags) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#if MICROPY_REPL_INFO
|
#if MICROPY_REPL_INFO
|
||||||
uint32_t start = 0;
|
uint32_t start = 0;
|
||||||
|
@ -135,6 +135,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
|
||||||
if (exec_flags & EXEC_FLAG_PRINT_EOF) {
|
if (exec_flags & EXEC_FLAG_PRINT_EOF) {
|
||||||
mp_hal_stdout_tx_strn("\x04", 1);
|
mp_hal_stdout_tx_strn("\x04", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for SystemExit
|
// check for SystemExit
|
||||||
if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t *)nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
|
if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t *)nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
|
||||||
// at the moment, the value of SystemExit is unused
|
// at the moment, the value of SystemExit is unused
|
||||||
|
|
Loading…
Reference in New Issue