MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1#ifndef RUNTIME_H
2#define RUNTIME_H
3
4#include "types.h"
5struct arg_file;
6
7#define ANT_RUNTIME_CRYPTO_INIT (1u << 0)
8#define CODE_ARENA_BLOCK_SIZE (64 * 1024)
9
10struct ant_runtime {
11 ant_t *js;
12 char **argv;
13 ant_value_t ant_obj;
14 int argc;
15 int pid;
16 unsigned int flags;
17 const char *ls_fp;
18};
19
20typedef struct {
21 void *block;
22 size_t used;
23} code_arena_mark_t;
24
25extern struct ant_runtime *const rt;
26struct ant_runtime *ant_runtime_init(ant_t *js, int argc, char **argv, struct arg_file *ls_p);
27
28size_t code_arena_get_memory(void);
29const char *code_arena_alloc(const char *code, size_t len);
30
31code_arena_mark_t code_arena_mark(void);
32void code_arena_rewind(code_arena_mark_t mark);
33
34void code_arena_reset(void);
35void destroy_runtime(ant_t *js);
36void *code_arena_bump(size_t size);
37
38#endif