summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-21 23:22:44 +1100
committerDamien George <damien.p.george@gmail.com>2017-01-22 11:56:16 +1100
commit4ccd899e65e0aabf445f9cff6b857414eafbbb59 (patch)
tree1e8e0e6f39ecb1043b2351267d1300bdf4923a5a
parent8678e3edfd8f56b90d0847ba0a9a6ba615463152 (diff)
downloadmicropython-4ccd899e65e0aabf445f9cff6b857414eafbbb59.tar.gz
micropython-4ccd899e65e0aabf445f9cff6b857414eafbbb59.zip
esp8266: Convert to use builtin help function.
-rw-r--r--esp8266/Makefile1
-rw-r--r--esp8266/help.c20
-rw-r--r--esp8266/mpconfigport.h3
3 files changed, 4 insertions, 20 deletions
diff --git a/esp8266/Makefile b/esp8266/Makefile
index 1d50a0fb31..d63d5c255a 100644
--- a/esp8266/Makefile
+++ b/esp8266/Makefile
@@ -128,7 +128,6 @@ LIB_SRC_C = $(addprefix lib/,\
netutils/netutils.c \
timeutils/timeutils.c \
utils/pyexec.c \
- utils/pyhelp.c \
utils/interrupt_char.c \
)
diff --git a/esp8266/help.c b/esp8266/help.c
index 5370ee71ea..2035cdd6cb 100644
--- a/esp8266/help.c
+++ b/esp8266/help.c
@@ -24,11 +24,9 @@
* THE SOFTWARE.
*/
-#include <stdio.h>
+#include "py/builtin.h"
-#include "lib/utils/pyhelp.h"
-
-STATIC const char *help_text =
+const char *esp_help_text =
"Welcome to MicroPython!\n"
"\n"
"For online docs please visit http://docs.micropython.org/en/latest/esp8266/ .\n"
@@ -54,17 +52,3 @@ STATIC const char *help_text =
"\n"
"For further help on a specific object, type help(obj)\n"
;
-
-STATIC mp_obj_t builtin_help(uint n_args, const mp_obj_t *args) {
- if (n_args == 0) {
- // print a general help message
- printf("%s", help_text);
-
- } else {
- // try to print something sensible about the given object
- pyhelp_print_obj(args[0]);
- }
-
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, builtin_help);
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index 5ba153ce5f..0c4bda6bd2 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -38,6 +38,8 @@
#define MICROPY_PY_BUILTINS_SLICE (1)
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_BUILTINS_PROPERTY (1)
+#define MICROPY_PY_BUILTINS_HELP (1)
+#define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text
#define MICROPY_PY___FILE__ (0)
#define MICROPY_PY_GC (1)
#define MICROPY_PY_ARRAY (1)
@@ -140,7 +142,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_help), (mp_obj_t)&mp_builtin_help_obj }, \
{ 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 },