GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/import/import_special.c Lines: 29 29 100.0 %
Date: 2020-09-22 13:02:15 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
2848
ANN void gwi_register_freearg(const Gwi gwi, const f_instr _exec, const f_freearg _free) {
22
2848
  map_set(&gwi->gwion->data->freearg, (vtype)_exec, (vtype)_free);
23
2848
}
24
25
1
ANN void gwi_register_pass(const Gwi gwi, const m_str name, const compilation_pass pass[2]) {
26
1
  pass_register(gwi->gwion, name, pass);
27
1
}
28
29
4273
ANN void gwi_reserve(const Gwi gwi, const m_str str) {
30
4273
  vector_add(&gwi->gwion->data->reserved, (vtype)insert_symbol(gwi->gwion->st, str));
31
4273
}
32
33
4273
ANN void gwi_specialid(const Gwi gwi, const m_str id, const SpecialId spid) {
34
4273
  struct SpecialId_ *a = mp_calloc(gwi->gwion->mp, SpecialId);
35
4273
  memcpy(a, spid, sizeof(struct SpecialId_));
36
4273
  map_set(&gwi->gwion->data->id, (vtype)insert_symbol(gwi->gwion->st, id), (vtype)a);
37
4273
  gwi_reserve(gwi, id);
38
4273
}
39
40
379749
ANN void gwi_set_loc(const Gwi gwi, const m_str file, const uint line) {
41
379749
  gwi->loc->first.line = gwi->loc->last.line = line;
42
379749
  gwi->gwion->env->name = file;
43
379749
}
44
45
9968
ANN static m_bool mk_gack(MemPool p, const Type type, const f_gack d) {
46
9968
  const VM_Code code = new_vm_code(p, NULL, SZ_INT, ae_flag_member | ae_flag_builtin, "@gack");
47
9968
  code->native_func = (m_uint)d;
48
9968
  SET_FLAG(code, builtin);
49
9968
  type->e->gack = code;
50
9968
  return GW_OK;
51
}
52
53
9968
ANN m_bool gwi_gack(const Gwi gwi, const Type type, const f_gack d) {
54
9968
  return mk_gack(gwi->gwion->mp, type, d);
55
}
56
57
3560
ANN VM* gwi_vm(const Gwi gwi) {
58
3560
  return gwi->gwion->vm;
59
}