diff --git a/cc3200/application.mk b/cc3200/application.mk index 5d25424e15..1f54b764b9 100644 --- a/cc3200/application.mk +++ b/cc3200/application.mk @@ -151,7 +151,6 @@ APP_LIB_SRC_C = $(addprefix lib/,\ APP_STM_SRC_C = $(addprefix stmhal/,\ bufhelper.c \ - input.c \ irq.c \ pybstdio.c \ ) diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h index 4d19900aee..4bd583a4b8 100644 --- a/cc3200/mpconfigport.h +++ b/cc3200/mpconfigport.h @@ -80,6 +80,7 @@ #define MICROPY_VFS_FAT (1) #define MICROPY_PY_ASYNC_AWAIT (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (1) +#define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT cc3200_help_text #ifndef DEBUG @@ -142,7 +143,6 @@ // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, \ // extra built in modules to add to the list of known ones diff --git a/esp8266/Makefile b/esp8266/Makefile index a3da9d3986..cf4b288ca2 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -94,7 +94,6 @@ SRC_C = \ STM_SRC_C = $(addprefix stmhal/,\ pybstdio.c \ - input.c \ ) EXTMOD_SRC_C = $(addprefix extmod/,\ diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h index c286bdcdd9..483f93d02b 100644 --- a/esp8266/mpconfigport.h +++ b/esp8266/mpconfigport.h @@ -39,6 +39,7 @@ #define MICROPY_PY_BUILTINS_SLICE (1) #define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) #define MICROPY_PY_BUILTINS_PROPERTY (1) +#define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text #define MICROPY_PY_BUILTINS_HELP_MODULES (1) @@ -147,7 +148,6 @@ void *esp_native_code_commit(void*, size_t); // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, // extra built in modules to add to the list of known ones diff --git a/stmhal/Makefile b/stmhal/Makefile index 09643be94a..2d9d44afd9 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -147,7 +147,6 @@ SRC_C = \ gccollect.c \ pybstdio.c \ help.c \ - input.c \ machine_i2c.c \ modmachine.c \ modpyb.c \ diff --git a/stmhal/input.c b/stmhal/input.c deleted file mode 100644 index c78525cc91..0000000000 --- a/stmhal/input.c +++ /dev/null @@ -1,44 +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. - */ - -#include "py/nlr.h" -#include "py/obj.h" -#include "lib/mp-readline/readline.h" - -STATIC mp_obj_t mp_builtin_input(uint n_args, const mp_obj_t *args) { - if (n_args == 1) { - mp_obj_print(args[0], PRINT_STR); - } - vstr_t line; - vstr_init(&line, 16); - int ret = readline(&line, ""); - if (line.len == 0 && ret == CHAR_CTRL_D) { - nlr_raise(mp_obj_new_exception(&mp_type_EOFError)); - } - return mp_obj_new_str_from_vstr(&mp_type_str, &line); -} - -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_input_obj, 0, 1, mp_builtin_input); diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 444ce93032..ac3c1f2470 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -87,6 +87,7 @@ #define MICROPY_PY_ALL_SPECIAL_METHODS (1) #define MICROPY_PY_BUILTINS_COMPILE (1) #define MICROPY_PY_BUILTINS_EXECFILE (1) +#define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_POW3 (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT stmhal_help_text @@ -159,7 +160,6 @@ // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, // extra built in modules to add to the list of known ones diff --git a/teensy/Makefile b/teensy/Makefile index 9f52cc3c76..923ea77ecd 100644 --- a/teensy/Makefile +++ b/teensy/Makefile @@ -93,7 +93,6 @@ SRC_C = \ STM_SRC_C = $(addprefix stmhal/,\ gccollect.c \ - input.c \ irq.c \ pin.c \ pin_named_pins.c \ diff --git a/teensy/mpconfigport.h b/teensy/mpconfigport.h index 8c40220465..de30924d9e 100644 --- a/teensy/mpconfigport.h +++ b/teensy/mpconfigport.h @@ -14,6 +14,7 @@ #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_OPT_COMPUTED_GOTO (1) +#define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT teensy_help_text @@ -31,7 +32,6 @@ // extra built in names to add to the global namespace #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ // extra built in modules to add to the list of known ones extern const struct _mp_obj_module_t os_module;