GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/vm/driver.c Lines: 32 32 100.0 %
Date: 2020-08-07 19:15:19 Branches: 8 8 100.0 %

Line Branch Exec Source
1
#include <time.h>
2
#include "gwion_util.h"
3
#include "gwion_ast.h"
4
#include "gwion_env.h"
5
#include "vm.h"
6
#include "gwion.h"
7
#include "driver.h"
8
9
740
ANN Driver* new_driver(MemPool p) {
10
740
  Driver* di = (Driver*)mp_calloc(p, BBQ);
11
740
  di->func = dummy_driver;
12
740
  di->driver = (DriverData*)mp_calloc(p, DriverData);
13
740
  di->is_running = 1;
14
740
  return di;
15
}
16
17
736
ANN void free_driver(Driver *d, VM *vm) {
18
736
  if(d->in)
19
729
    xfree(d->in);
20
736
  if(d->out)
21
729
    xfree(d->out);
22
736
  mp_free(vm->gwion->mp, SoundInfo, d->si);
23
736
  if(d->driver->del)
24
1
    d->driver->del(vm, d);
25
736
  mp_free(vm->gwion->mp, DriverData, d->driver);
26
736
  mp_free(vm->gwion->mp, BBQ, d);
27
736
}
28
29
730
ANN void driver_alloc(Driver *d) {
30
730
  d->out = (m_float*)xcalloc(d->si->out, SZ_FLOAT);
31
730
  d->in  = (m_float*)xcalloc(d->si->in, SZ_FLOAT);
32
730
}
33
34
729
static DRVRUN(dummy_run) {
35
3152035
  while(di->is_running) {
36
3150578
    di->run(vm);
37
3150577
    ++di->pos;
38
  }
39
728
}
40
41
729
static DRVINI(dummy_ini) {
42
729
  return GW_OK;
43
}
44
45
729
void dummy_driver(DriverData* dd) {
46
729
  dd->ini = dummy_ini;
47
729
  dd->run = dummy_run;
48
729
}