GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/lib/prim_values.c Lines: 30 30 100.0 %
Date: 2020-09-14 20:46:08 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
712
GWION_IMPORT(values) {
20
712
  VM* vm = gwi_vm(gwi);
21
712
  ALLOC_PTR(gwi->gwion->mp, d_zero, m_float, 0.0);
22
712
  ALLOC_PTR(gwi->gwion->mp, sr,     m_float, (m_float)vm->bbq->si->sr);
23
712
  ALLOC_PTR(gwi->gwion->mp, samp,   m_float, 1.0);
24
712
  ALLOC_PTR(gwi->gwion->mp, ms,     m_float, (m_float)(*sr     / 1000.));
25
712
  ALLOC_PTR(gwi->gwion->mp, second, m_float, (m_float)*sr);
26
712
  ALLOC_PTR(gwi->gwion->mp, minute, m_float, (m_float)(*sr     * 60.0));
27
712
  ALLOC_PTR(gwi->gwion->mp, hour,   m_float, (m_float)(*minute * 60.0));
28
712
  ALLOC_PTR(gwi->gwion->mp, t_zero, m_float, 0.0);
29
712
  ALLOC_PTR(gwi->gwion->mp, pi, m_float, (m_float)M_PI);
30
712
  gwi_item_ini(gwi, "float", "samplerate");
31
712
  gwi_item_end(gwi, ae_flag_const, sr);
32
712
  gwi_item_ini(gwi, "float", "pi");
33
712
  gwi_item_end(gwi, ae_flag_const, pi);
34
712
  gwi_item_ini(gwi, "dur", "d_zero");
35
712
  gwi_item_end(gwi, ae_flag_const, d_zero);
36
712
  gwi_item_ini(gwi, "dur", "samp");
37
712
  gwi_item_end(gwi, ae_flag_const, samp);
38
712
  gwi_item_ini(gwi, "dur", "ms");
39
712
  gwi_item_end(gwi, ae_flag_const, ms);
40
712
  gwi_item_ini(gwi, "dur", "second");
41
712
  gwi_item_end(gwi, ae_flag_const, second);
42
712
  gwi_item_ini(gwi, "dur", "minute");
43
712
  gwi_item_end(gwi, ae_flag_const, minute);
44
712
  gwi_item_ini(gwi, "dur", "hour");
45
712
  gwi_item_end(gwi, ae_flag_const, hour);
46
712
  gwi_item_ini(gwi, "time", "t_zero");
47
712
  gwi_item_end(gwi, ae_flag_const, t_zero);
48
712
  return GW_OK;
49
}