2014-01-08 04:00:22 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-01-15 01:23:56 -05:00
|
|
|
#include "mpconfig.h"
|
2014-07-15 01:19:27 -04:00
|
|
|
#include "misc.h"
|
2014-01-15 01:23:56 -05:00
|
|
|
#include "qstr.h"
|
2014-01-08 04:00:22 -05:00
|
|
|
#include "lexer.h"
|
|
|
|
#include "memzip.h"
|
|
|
|
|
2014-06-16 01:33:14 -04:00
|
|
|
mp_lexer_t *mp_lexer_new_from_file(const char *filename)
|
2014-01-08 04:00:22 -05:00
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
if (memzip_locate(filename, &data, &len) != MZ_OK) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-01-15 01:23:56 -05:00
|
|
|
|
2014-07-03 08:47:47 -04:00
|
|
|
return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
|
2014-01-08 04:00:22 -05:00
|
|
|
}
|
|
|
|
|