From 40274fec9c0f8e1ce06f999927f550106b9aa5e8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 9 Nov 2015 13:13:09 +0000 Subject: lib/pyexec: Move header pyexec.h from stmhal directory. --- cc3200/mods/modmachine.c | 1 - cc3200/mptask.c | 2 +- esp8266/main.c | 2 +- esp8266/modpyb.c | 1 - esp8266/uart.c | 2 +- lib/utils/pyexec.c | 2 +- lib/utils/pyexec.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ minimal/main.c | 2 +- pic16bit/main.c | 2 +- stmhal/main.c | 2 +- stmhal/modpyb.c | 2 +- stmhal/pyexec.h | 43 ------------------------------------------- teensy/main.c | 2 +- teensy/modpyb.c | 3 ++- 14 files changed, 58 insertions(+), 55 deletions(-) create mode 100644 lib/utils/pyexec.h delete mode 100644 stmhal/pyexec.h diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c index 896aa9917..ed24951a6 100644 --- a/cc3200/mods/modmachine.c +++ b/cc3200/mods/modmachine.c @@ -39,7 +39,6 @@ #include "inc/hw_uart.h" #include "rom_map.h" #include "prcm.h" -#include "pyexec.h" #include "pybuart.h" #include "pybpin.h" #include "pybrtc.h" diff --git a/cc3200/mptask.c b/cc3200/mptask.c index 7346ddaf2..96a4001ad 100644 --- a/cc3200/mptask.c +++ b/cc3200/mptask.c @@ -43,7 +43,7 @@ #include "pybuart.h" #include "pybpin.h" #include "pybrtc.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" #include "gccollect.h" #include "gchelper.h" #include "readline.h" diff --git a/esp8266/main.c b/esp8266/main.c index 0d8b3723c..178ad8b7c 100644 --- a/esp8266/main.c +++ b/esp8266/main.c @@ -35,7 +35,7 @@ #include "py/frozenmod.h" #include "py/mphal.h" #include "py/gc.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" #include "gccollect.h" #include "user_interface.h" diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c index 36a9d6bf2..a9daef9c7 100644 --- a/esp8266/modpyb.c +++ b/esp8266/modpyb.c @@ -31,7 +31,6 @@ #include "py/gc.h" #include "py/mphal.h" #include "gccollect.h" -#include "pyexec.h" #include "user_interface.h" #include "modpyb.h" diff --git a/esp8266/uart.c b/esp8266/uart.c index 55841fe39..49fc9bb87 100644 --- a/esp8266/uart.c +++ b/esp8266/uart.c @@ -207,7 +207,7 @@ void ICACHE_FLASH_ATTR uart_reattach() { // Task-based UART interface #include "py/obj.h" -#include "stmhal/pyexec.h" +#include "lib/utils/pyexec.h" void soft_reset(void); diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index abf74d6db..295d05943 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -39,7 +39,7 @@ #include "usb.h" #endif #include "readline.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" #include "genhdr/mpversion.h" pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h new file mode 100644 index 000000000..96bb481a5 --- /dev/null +++ b/lib/utils/pyexec.h @@ -0,0 +1,47 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013, 2014 Damien P. George + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__ +#define __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__ + +typedef enum { + PYEXEC_MODE_RAW_REPL, + PYEXEC_MODE_FRIENDLY_REPL, +} pyexec_mode_kind_t; + +extern pyexec_mode_kind_t pyexec_mode_kind; + +#define PYEXEC_FORCED_EXIT (0x100) +#define PYEXEC_SWITCH_MODE (0x200) + +int pyexec_raw_repl(void); +int pyexec_friendly_repl(void); +int pyexec_file(const char *filename); +void pyexec_event_repl_init(void); +int pyexec_event_repl_process_char(int c); + +MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj); + +#endif // __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__ diff --git a/minimal/main.c b/minimal/main.c index dc34d89bc..cb3b62508 100644 --- a/minimal/main.c +++ b/minimal/main.c @@ -7,7 +7,7 @@ #include "py/runtime.h" #include "py/repl.h" #include "py/gc.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" void do_str(const char *src, mp_parse_input_kind_t input_kind) { mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); diff --git a/pic16bit/main.c b/pic16bit/main.c index ad6f9e364..b8e9b46ea 100644 --- a/pic16bit/main.c +++ b/pic16bit/main.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" #include "readline.h" #include "board.h" #include "modpyb.h" diff --git a/stmhal/main.c b/stmhal/main.c index de52cac8f..f6d6ada70 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -36,13 +36,13 @@ #include "py/gc.h" #include "py/mphal.h" +#include "lib/utils/pyexec.h" #include "lib/fatfs/ff.h" #include "systick.h" #include "pendsv.h" #include "gccollect.h" #include "readline.h" -#include "pyexec.h" #include "i2c.h" #include "spi.h" #include "uart.h" diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index b7df53f67..e8dcd57a0 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -33,12 +33,12 @@ #include "py/nlr.h" #include "py/obj.h" #include "py/gc.h" +#include "lib/utils/pyexec.h" #include "lib/fatfs/ff.h" #include "lib/fatfs/diskio.h" #include "gccollect.h" #include "irq.h" #include "systick.h" -#include "pyexec.h" #include "led.h" #include "pin.h" #include "timer.h" diff --git a/stmhal/pyexec.h b/stmhal/pyexec.h deleted file mode 100644 index 0728b9133..000000000 --- a/stmhal/pyexec.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2013, 2014 Damien P. George - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -typedef enum { - PYEXEC_MODE_RAW_REPL, - PYEXEC_MODE_FRIENDLY_REPL, -} pyexec_mode_kind_t; - -extern pyexec_mode_kind_t pyexec_mode_kind; - -#define PYEXEC_FORCED_EXIT (0x100) -#define PYEXEC_SWITCH_MODE (0x200) - -int pyexec_raw_repl(void); -int pyexec_friendly_repl(void); -int pyexec_file(const char *filename); -void pyexec_event_repl_init(void); -int pyexec_event_repl_process_char(int c); - -MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj); diff --git a/teensy/main.c b/teensy/main.c index 417bde78b..ac7325909 100644 --- a/teensy/main.c +++ b/teensy/main.c @@ -11,7 +11,7 @@ #include "py/gc.h" #include "py/mphal.h" #include "gccollect.h" -#include "pyexec.h" +#include "lib/utils/pyexec.h" #include "readline.h" #include "lexermemzip.h" diff --git a/teensy/modpyb.c b/teensy/modpyb.c index 8429191af..aa62f7870 100644 --- a/teensy/modpyb.c +++ b/teensy/modpyb.c @@ -33,10 +33,11 @@ #include "py/gc.h" #include "py/mphal.h" +#include "lib/utils/pyexec.h" + #include "gccollect.h" #include "irq.h" #include "systick.h" -#include "pyexec.h" #include "led.h" #include "pin.h" #include "timer.h" -- cgit v1.2.3