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