GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/import/special.c Lines: 29 29 100.0 %
Date: 2020-09-12 17:36:58 Branches: 0 0 - %

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 "object.h"
11
#include "emit.h"
12
#include "gwion.h"
13
#include "operator.h"
14
#include "import.h"
15
#include "gwi.h"
16
#include "gwi.h"
17
#include "parser.h"
18
#include "specialid.h"
19
#include "pass.h"
20
21
2844
ANN void gwi_register_freearg(const Gwi gwi, const f_instr _exec, const f_freearg _free) {
22
2844
  map_set(&gwi->gwion->data->freearg, (vtype)_exec, (vtype)_free);
23
2844
}
24
25
1
ANN void gwi_register_pass(const Gwi gwi, const m_str name, const compilation_pass pass) {
26
1
  pass_register(gwi->gwion, name, pass);
27
1
}
28
29
4267
ANN void gwi_reserve(const Gwi gwi, const m_str str) {
30
4267
  vector_add(&gwi->gwion->data->reserved, (vtype)insert_symbol(gwi->gwion->st, str));
31
4267
}
32
33
4267
ANN void gwi_specialid(const Gwi gwi, const m_str id, const SpecialId spid) {
34
4267
  struct SpecialId_ *a = mp_calloc(gwi->gwion->mp, SpecialId);
35
4267
  memcpy(a, spid, sizeof(struct SpecialId_));
36
4267
  map_set(&gwi->gwion->data->id, (vtype)insert_symbol(gwi->gwion->st, id), (vtype)a);
37
4267
  gwi_reserve(gwi, id);
38
4267
}
39
40
376387
ANN void gwi_set_loc(const Gwi gwi, const m_str file, const uint line) {
41
376387
  gwi->loc->first.line = gwi->loc->last.line = line;
42
376387
  gwi->gwion->env->name = file;
43
376387
}
44
45
9954
ANN static m_bool mk_gack(MemPool p, const Type type, const f_gack d) {
46
9954
  const VM_Code code = new_vm_code(p, NULL, SZ_INT, ae_flag_member | ae_flag_builtin, "@gack");
47
9954
  code->native_func = (m_uint)d;
48
9954
  SET_FLAG(code, builtin);
49
9954
  type->e->gack = code;
50
9954
  return GW_OK;
51
}
52
53
9954
ANN m_bool gwi_gack(const Gwi gwi, const Type type, const f_gack d) {
54
9954
  return mk_gack(gwi->gwion->mp, type, d);
55
}
56
57
3555
ANN VM* gwi_vm(const Gwi gwi) {
58
3555
  return gwi->gwion->vm;
59
}