Line | Branch | Exec | Source |
---|---|---|---|
1 | #include <stdlib.h> | ||
2 | #include <string.h> | ||
3 | #include <ctype.h> | ||
4 | #include "gwion_util.h" | ||
5 | #include "gwion_ast.h" | ||
6 | #include "gwion_env.h" | ||
7 | #include "vm.h" | ||
8 | #include "traverse.h" | ||
9 | #include "instr.h" | ||
10 | #include "emit.h" | ||
11 | #include "gwion.h" | ||
12 | #include "object.h" | ||
13 | #include "operator.h" | ||
14 | #include "import.h" | ||
15 | #include "gwi.h" | ||
16 | #include "gwi.h" | ||
17 | #include "specialid.h" | ||
18 | #include "pass.h" | ||
19 | |||
20 | 3828 | ANN void gwi_register_freearg(const Gwi gwi, const f_instr _exec, | |
21 | const f_freearg _free) { | ||
22 | 3828 | map_set(&gwi->gwion->data->freearg, (vtype)_exec, (vtype)_free); | |
23 | 3828 | } | |
24 | |||
25 | ✗ | ANN void gwi_register_pass(const Gwi gwi, const m_str name, | |
26 | const compilation_pass pass) { | ||
27 | ✗ | pass_register(gwi->gwion, name, pass); | |
28 | } | ||
29 | |||
30 | 6380 | ANN void gwi_specialid(const Gwi gwi, const m_str id, const SpecialId spid) { | |
31 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6380 times.
|
6380 | if (gwi->gwion->data->cdoc) |
32 | ✗ | gwfmt_util(gwi->gwfmt, "{+C}specialid{0} %s{/}%s{0};\n", | |
33 | ✗ | spid->is_const ? "{+G}const{0} " : "", id); | |
34 | 6380 | struct SpecialId_ *a = mp_calloc(gwi->gwion->mp, SpecialId); | |
35 | 6380 | memcpy(a, spid, sizeof(struct SpecialId_)); | |
36 | 6380 | map_set(&gwi->gwion->data->id, (vtype)insert_symbol(gwi->gwion->st, id), | |
37 | (vtype)a); | ||
38 | 6380 | } | |
39 | |||
40 | 507294 | ANN void gwi_set_loc(const Gwi gwi, const m_str file, const uint line) { | |
41 | 507294 | gwi->loc.first.line = gwi->loc.last.line = line; | |
42 | 507294 | gwi->loc.first.column = 1; | |
43 | 507294 | gwi->loc.last.column = 2; | |
44 | 507294 | gwi->gwion->env->name = file; | |
45 | 507294 | } | |
46 | |||
47 | 11484 | ANN m_bool mk_gack(MemPool p, const Type type, const f_gack d) { | |
48 | 11484 | const VM_Code code = new_vmcode(p, NULL, NULL, "@gack", SZ_INT, true, false); | |
49 | 11484 | code->native_func = (m_uint)d; | |
50 | 11484 | type->info->gack = code; | |
51 | 11484 | return GW_OK; | |
52 | } | ||
53 | |||
54 | 8932 | ANN m_bool gwi_gack(const Gwi gwi, const Type type, const f_gack d) { | |
55 | 8932 | return mk_gack(gwi->gwion->mp, type, d); | |
56 | } | ||
57 | |||
58 | 2552 | ANN VM *gwi_vm(const Gwi gwi) { return gwi->gwion->vm; } | |
59 | |||
60 | ✗ | ANN void gwi_effects(const Gwi gwi, const m_str name) { | |
61 | ✗ | if (!gwi->effects.ptr) vector_init(&gwi->effects); | |
62 | ✗ | const Symbol sym = insert_symbol(gwi->gwion->st, name); | |
63 | ✗ | vector_add(&gwi->effects, (m_uint)sym); | |
64 | } | ||
65 |