Преглед на файлове

【增加】quit() 和 exit() 方式退出 repl 。

Signed-off-by: armink <armink.ztl@gmail.com>
armink преди 8 години
родител
ревизия
b9a4fbfabf
променени са 2 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 1 0
      port/genhdr/qstrdefs.generated.h
  2. 3 0
      port/mpconfigport.h

+ 1 - 0
port/genhdr/qstrdefs.generated.h

@@ -600,5 +600,6 @@ QDEF(MP_QSTR_encoding, (const byte*)"\x06\x08" "encoding")
 QDEF(MP_QSTR___dict__, (const byte*)"\x7f\x08" "__dict__")
 QDEF(MP_QSTR_release, (const byte*)"\xec\x07" "release")
 QDEF(MP_QSTR_iterable, (const byte*)"\x25\x08" "iterable")
+QDEF(MP_QSTR_quit, (const byte*)"\x5c\x04" "quit")
 
 // This file was automatically generated by makeqstrdata.py

+ 3 - 0
port/mpconfigport.h

@@ -288,6 +288,7 @@ extern const struct _mp_obj_module_t mp_module_uos;
 extern const struct _mp_obj_module_t mp_module_uselect;
 extern const struct _mp_obj_module_t mp_module_usocket;
 extern const struct _mp_obj_module_t mp_module_io;
+extern const struct _mp_obj_fun_builtin_fixed_t machine_soft_reset_obj;
 
 #if MICROPY_PY_RTTHREAD
 #define RTTHREAD_PORT_BUILTIN_MODULES { MP_ROM_QSTR(MP_QSTR_rtthread), MP_ROM_PTR(&mp_module_rtthread) },
@@ -316,6 +317,8 @@ extern const struct _mp_obj_module_t mp_module_io;
 
 // extra built in names to add to the global namespace
 #define MICROPY_PORT_BUILTINS \
+    { MP_ROM_QSTR(MP_QSTR_exit), MP_ROM_PTR(&machine_soft_reset_obj) }, \
+    { MP_ROM_QSTR(MP_QSTR_quit), MP_ROM_PTR(&machine_soft_reset_obj) }, \
     MODUOS_PORT_BUILTINS \
 
 #define MICROPY_PORT_BUILTIN_MODULES \