GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/lib/prim_values.c Lines: 30 30 100.0 %
Date: 2020-09-14 09:03:05 Branches: 0 0 - %

Line Branch Exec Source
1
#include "gwion_util.h"
2
#include "gwion_ast.h"
3
#include "gwion_env.h"
4
#include "vm.h"
5
#include "gwion.h"
6
#include "instr.h"
7
#include "object.h"
8
#include "emit.h"
9
#include "operator.h"
10
#include "import.h"
11
#include "gwi.h"
12
#include "driver.h"
13
#include "traverse.h"
14
#include "parse.h"
15
#include "specialid.h"
16
#include "array.h"
17
#include "gack.h"
18
19
711
GWION_IMPORT(values) {
20
711
  VM* vm = gwi_vm(gwi);
21
711
  ALLOC_PTR(gwi->gwion->mp, d_zero, m_float, 0.0);
22
711
  ALLOC_PTR(gwi->gwion->mp, sr,     m_float, (m_float)vm->bbq->si->sr);
23
711
  ALLOC_PTR(gwi->gwion->mp, samp,   m_float, 1.0);
24
711
  ALLOC_PTR(gwi->gwion->mp, ms,     m_float, (m_float)(*sr     / 1000.));
25
711
  ALLOC_PTR(gwi->gwion->mp, second, m_float, (m_float)*sr);
26
711
  ALLOC_PTR(gwi->gwion->mp, minute, m_float, (m_float)(*sr     * 60.0));
27
711
  ALLOC_PTR(gwi->gwion->mp, hour,   m_float, (m_float)(*minute * 60.0));
28
711
  ALLOC_PTR(gwi->gwion->mp, t_zero, m_float, 0.0);
29
711
  ALLOC_PTR(gwi->gwion->mp, pi, m_float, (m_float)M_PI);
30
711
  gwi_item_ini(gwi, "float", "samplerate");
31
711
  gwi_item_end(gwi, ae_flag_const, sr);
32
711
  gwi_item_ini(gwi, "float", "pi");
33
711
  gwi_item_end(gwi, ae_flag_const, pi);
34
711
  gwi_item_ini(gwi, "dur", "d_zero");
35
711
  gwi_item_end(gwi, ae_flag_const, d_zero);
36
711
  gwi_item_ini(gwi, "dur", "samp");
37
711
  gwi_item_end(gwi, ae_flag_const, samp);
38
711
  gwi_item_ini(gwi, "dur", "ms");
39
711
  gwi_item_end(gwi, ae_flag_const, ms);
40
711
  gwi_item_ini(gwi, "dur", "second");
41
711
  gwi_item_end(gwi, ae_flag_const, second);
42
711
  gwi_item_ini(gwi, "dur", "minute");
43
711
  gwi_item_end(gwi, ae_flag_const, minute);
44
711
  gwi_item_ini(gwi, "dur", "hour");
45
711
  gwi_item_end(gwi, ae_flag_const, hour);
46
711
  gwi_item_ini(gwi, "time", "t_zero");
47
711
  gwi_item_end(gwi, ae_flag_const, t_zero);
48
711
  return GW_OK;
49
}