summaryrefslogtreecommitdiffstatshomepage
path: root/py/lexerstr.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
committerDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
commitdd5353a4054024a411aa343a22ffcd16195a16ad (patch)
treefaa3f91ab3a37f1b2f3469e01a9228e83853dc7b /py/lexerstr.c
parentab8012bd8098e155e38ef6dead62bca8a200e613 (diff)
downloadmicropython-dd5353a4054024a411aa343a22ffcd16195a16ad.tar.gz
micropython-dd5353a4054024a411aa343a22ffcd16195a16ad.zip
py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler, which is useful when only loading of pre-compiled bytecode is supported. It is enabled by default. MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin functions. By default they are only included if MICROPY_ENABLE_COMPILER is enabled. Disabling both options saves about 40k of code size on 32-bit x86.
Diffstat (limited to 'py/lexerstr.c')
-rw-r--r--py/lexerstr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/lexerstr.c b/py/lexerstr.c
index 5481b1032d..9fdf4c1eb5 100644
--- a/py/lexerstr.c
+++ b/py/lexerstr.c
@@ -26,6 +26,8 @@
#include "py/lexer.h"
+#if MICROPY_ENABLE_COMPILER
+
typedef struct _mp_lexer_str_buf_t {
mp_uint_t free_len; // if > 0, src_beg will be freed when done by: m_free(src_beg, free_len)
const char *src_beg; // beginning of source
@@ -59,3 +61,5 @@ mp_lexer_t *mp_lexer_new_from_str_len(qstr src_name, const char *str, mp_uint_t
sb->src_end = str + len;
return mp_lexer_new(src_name, sb, (mp_lexer_stream_next_byte_t)str_buf_next_byte, (mp_lexer_stream_close_t)str_buf_free);
}
+
+#endif // MICROPY_ENABLE_COMPILER