Commit 22ff397f authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports.

Saves 320 bytes on x86.
parent 7f70b60f
......@@ -24,6 +24,7 @@
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FILTER (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_REVERSED (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
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
#endif
#if MICROPY_PY_BUILTINS_FILTER
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
#endif
#if MICROPY_PY_BUILTINS_FLOAT
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
#endif
......
......@@ -500,6 +500,11 @@ typedef double mp_float_t;
#define MICROPY_PY_BUILTINS_EXECFILE (0)
#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)
#ifndef MICROPY_PY_BUILTINS_REVERSED
#define MICROPY_PY_BUILTINS_REVERSED (1)
......
......@@ -26,6 +26,8 @@
#include "py/runtime.h"
#if MICROPY_PY_BUILTINS_FILTER
typedef struct _mp_obj_filter_t {
mp_obj_base_t base;
mp_obj_t fun;
......@@ -66,3 +68,5 @@ const mp_obj_type_t mp_type_filter = {
.getiter = mp_identity,
.iternext = filter_iternext,
};
#endif // MICROPY_PY_BUILTINS_FILTER
......@@ -205,7 +205,9 @@ Q(exec)
#if MICROPY_PY_BUILTINS_EXECFILE
Q(execfile)
#endif
#if MICROPY_PY_BUILTINS_FILTER
Q(filter)
#endif
#if MICROPY_PY_BUILTINS_FLOAT
Q(float)
#endif
......
......@@ -50,6 +50,7 @@
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_COMPILE (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FILTER (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (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