From 510296f25ae53e5732fe98cdd4b68bfeea15204a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 8 Aug 2014 22:51:40 +0300 Subject: modzlibd: Decompress part of "zlib" module, based on miniz tinfl.c . --- py/builtin.h | 1 + py/builtintables.c | 3 +++ py/mpconfig.h | 5 +++++ py/py.mk | 3 ++- py/qstrdefs.h | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) (limited to 'py') diff --git a/py/builtin.h b/py/builtin.h index 25edf3289..af428d0c0 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -89,3 +89,4 @@ extern struct _dummy_t mp_sys_stderr_obj; // extmod modules extern const mp_obj_module_t mp_module_uctypes; +extern const mp_obj_module_t mp_module_zlibd; diff --git a/py/builtintables.c b/py/builtintables.c index 0f0cfcbc7..e55e93b33 100644 --- a/py/builtintables.c +++ b/py/builtintables.c @@ -196,6 +196,9 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = { #if MICROPY_PY_UCTYPES { MP_OBJ_NEW_QSTR(MP_QSTR_uctypes), (mp_obj_t)&mp_module_uctypes }, #endif +#if MICROPY_PY_ZLIBD + { MP_OBJ_NEW_QSTR(MP_QSTR_zlibd), (mp_obj_t)&mp_module_zlibd }, +#endif // extra builtin modules as defined by a port MICROPY_PORT_BUILTIN_MODULES diff --git a/py/mpconfig.h b/py/mpconfig.h index 351910b6d..76e02be51 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -368,10 +368,15 @@ typedef double mp_float_t; // Extended modules + #ifndef MICROPY_PY_UCTYPES #define MICROPY_PY_UCTYPES (0) #endif +#ifndef MICROPY_PY_ZLIBD +#define MICROPY_PY_ZLIBD (0) +#endif + /*****************************************************************************/ /* Hooks for a port to add builtins */ diff --git a/py/py.mk b/py/py.mk index 5d6245881..08eeddc29 100644 --- a/py/py.mk +++ b/py/py.mk @@ -104,7 +104,8 @@ PY_O_BASENAME = \ smallint.o \ pfenv.o \ pfenv_printf.o \ - ../extmod/moductypes.o + ../extmod/moductypes.o \ + ../extmod/modzlibd.o \ # prepend the build destination prefix to the py object files PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME)) diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 062f741de..e154faf55 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -450,3 +450,8 @@ Q(getter) Q(setter) Q(deleter) #endif + +#if MICROPY_PY_ZLIBD +Q(zlibd) +Q(decompress) +#endif -- cgit v1.2.3