diff options
author | Dave Hylands <dhylands@gmail.com> | 2015-10-31 21:24:47 -0700 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-04 14:21:10 +0000 |
commit | 074d713bfb845a87e557e608f5215f53694e7d01 (patch) | |
tree | 3688db7f8d476613bc0888b4be6a01a5238b63af /lib/memzip/lexermemzip.c | |
parent | a9f3030371094e3308b4d2150853db2ee3aa4a6b (diff) | |
download | micropython-074d713bfb845a87e557e608f5215f53694e7d01.tar.gz micropython-074d713bfb845a87e557e608f5215f53694e7d01.zip |
lib/memzip: Factor out memzip from teensy/ into lib/memzip.
Diffstat (limited to 'lib/memzip/lexermemzip.c')
-rw-r--r-- | lib/memzip/lexermemzip.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/memzip/lexermemzip.c b/lib/memzip/lexermemzip.c new file mode 100644 index 0000000000..72fe6b1c6b --- /dev/null +++ b/lib/memzip/lexermemzip.c @@ -0,0 +1,17 @@ +#include <stdlib.h> + +#include "py/lexer.h" +#include "memzip.h" + +mp_lexer_t *mp_lexer_new_from_file(const char *filename) +{ + void *data; + size_t len; + + if (memzip_locate(filename, &data, &len) != MZ_OK) { + return NULL; + } + + return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0); +} + |