Commit 282ca09f authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py: Add MICROPY_PY_BUILTINS_REVERSED, disable for minimal ports.

parent e2d44e30
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0) #define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0) #define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0) #define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0) #define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_SLICE (0) #define MICROPY_PY_BUILTINS_SLICE (0)
#define MICROPY_PY_BUILTINS_PROPERTY (0) #define MICROPY_PY_BUILTINS_PROPERTY (0)
......
...@@ -615,7 +615,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = { ...@@ -615,7 +615,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_property), (mp_obj_t)&mp_type_property }, { MP_OBJ_NEW_QSTR(MP_QSTR_property), (mp_obj_t)&mp_type_property },
#endif #endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_range), (mp_obj_t)&mp_type_range }, { MP_OBJ_NEW_QSTR(MP_QSTR_range), (mp_obj_t)&mp_type_range },
#if MICROPY_PY_BUILTINS_REVERSED
{ MP_OBJ_NEW_QSTR(MP_QSTR_reversed), (mp_obj_t)&mp_type_reversed }, { MP_OBJ_NEW_QSTR(MP_QSTR_reversed), (mp_obj_t)&mp_type_reversed },
#endif
#if MICROPY_PY_BUILTINS_SET #if MICROPY_PY_BUILTINS_SET
{ MP_OBJ_NEW_QSTR(MP_QSTR_set), (mp_obj_t)&mp_type_set }, { MP_OBJ_NEW_QSTR(MP_QSTR_set), (mp_obj_t)&mp_type_set },
#endif #endif
......
...@@ -469,6 +469,11 @@ typedef double mp_float_t; ...@@ -469,6 +469,11 @@ typedef double mp_float_t;
#define MICROPY_PY_BUILTINS_EXECFILE (0) #define MICROPY_PY_BUILTINS_EXECFILE (0)
#endif #endif
// Whether to support reversed function(type)
#ifndef MICROPY_PY_BUILTINS_REVERSED
#define MICROPY_PY_BUILTINS_REVERSED (1)
#endif
// Whether to set __file__ for imported modules // Whether to set __file__ for imported modules
#ifndef MICROPY_PY___FILE__ #ifndef MICROPY_PY___FILE__
#define MICROPY_PY___FILE__ (1) #define MICROPY_PY___FILE__ (1)
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "py/nlr.h" #include "py/nlr.h"
#include "py/runtime.h" #include "py/runtime.h"
#if MICROPY_PY_BUILTINS_REVERSED
typedef struct _mp_obj_reversed_t { typedef struct _mp_obj_reversed_t {
mp_obj_base_t base; mp_obj_base_t base;
mp_obj_t seq; // sequence object that we are reversing mp_obj_t seq; // sequence object that we are reversing
...@@ -75,3 +77,5 @@ const mp_obj_type_t mp_type_reversed = { ...@@ -75,3 +77,5 @@ const mp_obj_type_t mp_type_reversed = {
.getiter = mp_identity, .getiter = mp_identity,
.iternext = reversed_iternext, .iternext = reversed_iternext,
}; };
#endif // MICROPY_PY_BUILTINS_REVERSED
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#define MICROPY_PY_BUILTINS_COMPILE (0) #define MICROPY_PY_BUILTINS_COMPILE (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0) #define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0) #define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0) #define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_SLICE (0) #define MICROPY_PY_BUILTINS_SLICE (0)
#define MICROPY_PY_BUILTINS_STR_UNICODE (0) #define MICROPY_PY_BUILTINS_STR_UNICODE (0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment