Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
22ff397f
Commit
22ff397f
authored
Aug 20, 2015
by
Paul Sokolovsky
Browse files
py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports.
Saves 320 bytes on x86.
parent
7f70b60f
Changes
6
Hide whitespace changes
Inline
Side-by-side
minimal/mpconfigport.h
View file @
22ff397f
...
...
@@ -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)
...
...
py/modbuiltins.c
View file @
22ff397f
...
...
@@ -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
...
...
py/mpconfig.h
View file @
22ff397f
...
...
@@ -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)
...
...
py/objfilter.c
View file @
22ff397f
...
...
@@ -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
py/qstrdefs.h
View file @
22ff397f
...
...
@@ -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
...
...
unix/mpconfigport_minimal.h
View file @
22ff397f
...
...
@@ -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)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment