2014-01-08 09:00:22 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-01-01 21:13:30 +00:00
|
|
|
#include "py/lexer.h"
|
2017-03-14 00:36:24 +00:00
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "py/mperrno.h"
|
2014-01-08 09:00:22 +00:00
|
|
|
#include "memzip.h"
|
|
|
|
|
2023-09-27 04:43:50 +01:00
|
|
|
mp_lexer_t *mp_lexer_new_from_file(qstr filename)
|
2014-01-08 09:00:22 +00:00
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
size_t len;
|
|
|
|
|
2023-09-27 04:43:50 +01:00
|
|
|
if (memzip_locate(qstr_str(filename), &data, &len) != MZ_OK) {
|
2017-03-14 00:36:24 +00:00
|
|
|
mp_raise_OSError(MP_ENOENT);
|
2014-01-08 09:00:22 +00:00
|
|
|
}
|
2014-01-15 06:23:56 +00:00
|
|
|
|
2023-09-27 04:43:50 +01:00
|
|
|
return mp_lexer_new_from_str_len(filename, (const char *)data, (mp_uint_t)len, 0);
|
2014-01-08 09:00:22 +00:00
|
|
|
}
|
|
|
|
|