From 89755ae67f5c4a7cf7c963a53b12489461f0d839 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 11 May 2014 17:35:43 +0100 Subject: [PATCH] py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT. For consistency with MICROPY_MOD_SYS_STDFILES, etc. --- py/modsys.c | 11 +++++------ py/mpconfig.h | 11 ++++++----- stmhal/mpconfigport.h | 2 +- unix/mpconfigport.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/py/modsys.c b/py/modsys.c index d133d6b278..954711a5a9 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -36,11 +36,10 @@ #if MICROPY_ENABLE_MOD_SYS -MP_DECLARE_CONST_FUN_OBJ(mp_sys_exit_obj); - // These should be implemented by ports, specific types don't matter, // only addresses. struct _dummy_t; +extern struct _dummy_t mp_sys_exit_obj; extern struct _dummy_t mp_sys_stdin_obj; extern struct _dummy_t mp_sys_stdout_obj; extern struct _dummy_t mp_sys_stderr_obj; @@ -55,10 +54,6 @@ STATIC const MP_DEFINE_STR_OBJ(version_obj, "3.4.0"); STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_sys) }, -#if MICROPY_SYS_EXIT - // Should be implemented by port - { MP_OBJ_NEW_QSTR(MP_QSTR_exit), (mp_obj_t)&mp_sys_exit_obj }, -#endif { MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj }, @@ -70,6 +65,10 @@ STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_byteorder), MP_OBJ_NEW_QSTR(MP_QSTR_big) }, #endif +#if MICROPY_MOD_SYS_EXIT + { MP_OBJ_NEW_QSTR(MP_QSTR_exit), (mp_obj_t)&mp_sys_exit_obj }, +#endif + #if MICROPY_MOD_SYS_STDFILES { MP_OBJ_NEW_QSTR(MP_QSTR_stdin), (mp_obj_t)&mp_sys_stdin_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdout), (mp_obj_t)&mp_sys_stdout_obj }, diff --git a/py/mpconfig.h b/py/mpconfig.h index a7e1c4a40d..76cd1091cb 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -235,13 +235,14 @@ typedef double mp_float_t; #define MICROPY_ENABLE_MOD_SYS (1) #endif -#ifndef MICROPY_MOD_SYS_STDFILES -#define MICROPY_MOD_SYS_STDFILES (0) +// sys.exit() availability +#ifndef MICROPY_MOD_SYS_EXIT +#define MICROPY_MOD_SYS_EXIT (0) #endif -// sys.exit() availability -#ifndef MICROPY_SYS_EXIT -#define MICROPY_SYS_EXIT (0) +// sys.{stdin,stdout,stderr} availability +#ifndef MICROPY_MOD_SYS_STDFILES +#define MICROPY_MOD_SYS_STDFILES (0) #endif // Whether to support slice object and correspondingly diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index fd725c67ea..59934b948b 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -45,8 +45,8 @@ */ #define MICROPY_ENABLE_LFN (1) #define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ +#define MICROPY_MOD_SYS_EXIT (1) #define MICROPY_MOD_SYS_STDFILES (1) -#define MICROPY_SYS_EXIT (1) #define MICROPY_ENABLE_MOD_CMATH (1) // extra built in names to add to the global namespace diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 38bb979c92..4f347f4e02 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -42,9 +42,9 @@ #define MICROPY_PATH_MAX (PATH_MAX) #define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_USE_COMPUTED_GOTO (1) +#define MICROPY_MOD_SYS_EXIT (1) #define MICROPY_MOD_SYS_STDFILES (1) #define MICROPY_ENABLE_MOD_CMATH (1) -#define MICROPY_SYS_EXIT (1) // Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc. // names in exception messages (may require more RAM). #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)