py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports.
Saves 320 bytes on x86.
This commit is contained in:
parent
7f70b60f4d
commit
22ff397fb1
@ -24,6 +24,7 @@
|
|||||||
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
|
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
|
||||||
#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_FILTER (0)
|
||||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||||
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
||||||
#define MICROPY_PY_BUILTINS_SET (0)
|
#define MICROPY_PY_BUILTINS_SET (0)
|
||||||
|
@ -563,7 +563,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = {
|
|||||||
#if MICROPY_PY_BUILTINS_ENUMERATE
|
#if MICROPY_PY_BUILTINS_ENUMERATE
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
|
||||||
#endif
|
#endif
|
||||||
|
#if MICROPY_PY_BUILTINS_FILTER
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
|
||||||
|
#endif
|
||||||
#if MICROPY_PY_BUILTINS_FLOAT
|
#if MICROPY_PY_BUILTINS_FLOAT
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,6 +500,11 @@ typedef double mp_float_t;
|
|||||||
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
#define MICROPY_PY_BUILTINS_EXECFILE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Whether to support filter function(type)
|
||||||
|
#ifndef MICROPY_PY_BUILTINS_FILTER
|
||||||
|
#define MICROPY_PY_BUILTINS_FILTER (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Whether to support reversed function(type)
|
// Whether to support reversed function(type)
|
||||||
#ifndef MICROPY_PY_BUILTINS_REVERSED
|
#ifndef MICROPY_PY_BUILTINS_REVERSED
|
||||||
#define MICROPY_PY_BUILTINS_REVERSED (1)
|
#define MICROPY_PY_BUILTINS_REVERSED (1)
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_BUILTINS_FILTER
|
||||||
|
|
||||||
typedef struct _mp_obj_filter_t {
|
typedef struct _mp_obj_filter_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
mp_obj_t fun;
|
mp_obj_t fun;
|
||||||
@ -66,3 +68,5 @@ const mp_obj_type_t mp_type_filter = {
|
|||||||
.getiter = mp_identity,
|
.getiter = mp_identity,
|
||||||
.iternext = filter_iternext,
|
.iternext = filter_iternext,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MICROPY_PY_BUILTINS_FILTER
|
||||||
|
@ -205,7 +205,9 @@ Q(exec)
|
|||||||
#if MICROPY_PY_BUILTINS_EXECFILE
|
#if MICROPY_PY_BUILTINS_EXECFILE
|
||||||
Q(execfile)
|
Q(execfile)
|
||||||
#endif
|
#endif
|
||||||
|
#if MICROPY_PY_BUILTINS_FILTER
|
||||||
Q(filter)
|
Q(filter)
|
||||||
|
#endif
|
||||||
#if MICROPY_PY_BUILTINS_FLOAT
|
#if MICROPY_PY_BUILTINS_FLOAT
|
||||||
Q(float)
|
Q(float)
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
|
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
|
||||||
#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_FILTER (0)
|
||||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||||
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
||||||
#define MICROPY_PY_BUILTINS_SET (0)
|
#define MICROPY_PY_BUILTINS_SET (0)
|
||||||
|
Loading…
Reference in New Issue
Block a user