-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcairo_runner.h
43 lines (33 loc) · 1 KB
/
cairo_runner.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef RUNNER_H
#define RUNNER_H
#include "collectc/cc_array.h"
#include "program.h"
#include "relocatable.h"
#include "vm.h"
typedef union relocated_memory_value {
felt_t value;
int none;
} relocated_memory_value;
typedef struct relocated_memory_cell {
relocated_memory_value memory_value;
bool is_some;
} relocated_memory_cell;
typedef struct cairo_runner {
struct program program;
virtual_machine vm;
CC_Array *relocated_memory;
CC_Array *relocation_table;
relocatable program_base;
relocatable execution_base;
relocatable initial_pc;
relocatable initial_fp;
relocatable final_pc;
} cairo_runner;
// Creates a new, empty cairo_runner
cairo_runner runner_new(struct program program);
// Frees resources used by the cairo_runner struct
void runner_free(cairo_runner *runner);
// Performs the intialization step, leaving the runner ready to run a loaded cairo program from a main entrypoint
relocatable runner_initialize(cairo_runner *runner);
void runner_relocate_memory(cairo_runner *runner);
#endif