py: Add MICROPY_PY_BUILTINS_REVERSED, disable for minimal ports.
This commit is contained in:
parent
e2d44e30c7
commit
282ca09f8e
@ -23,6 +23,7 @@
|
||||
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
|
||||
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
||||
#define MICROPY_PY_BUILTINS_SET (0)
|
||||
#define MICROPY_PY_BUILTINS_SLICE (0)
|
||||
#define MICROPY_PY_BUILTINS_PROPERTY (0)
|
||||
|
@ -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 },
|
||||
#endif
|
||||
{ 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 },
|
||||
#endif
|
||||
#if MICROPY_PY_BUILTINS_SET
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_set), (mp_obj_t)&mp_type_set },
|
||||
#endif
|
||||
|
@ -469,6 +469,11 @@ typedef double mp_float_t;
|
||||
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
||||
#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
|
||||
#ifndef MICROPY_PY___FILE__
|
||||
#define MICROPY_PY___FILE__ (1)
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_REVERSED
|
||||
|
||||
typedef struct _mp_obj_reversed_t {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t seq; // sequence object that we are reversing
|
||||
@ -75,3 +77,5 @@ const mp_obj_type_t mp_type_reversed = {
|
||||
.getiter = mp_identity,
|
||||
.iternext = reversed_iternext,
|
||||
};
|
||||
|
||||
#endif // MICROPY_PY_BUILTINS_REVERSED
|
||||
|
@ -50,6 +50,7 @@
|
||||
#define MICROPY_PY_BUILTINS_COMPILE (0)
|
||||
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
||||
#define MICROPY_PY_BUILTINS_SET (0)
|
||||
#define MICROPY_PY_BUILTINS_SLICE (0)
|
||||
#define MICROPY_PY_BUILTINS_STR_UNICODE (0)
|
||||
|
Loading…
Reference in New Issue
Block a user