GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/vm/driver.c Lines: 32 32 100.0 %
Date: 2020-10-03 09:50:08 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
724
ANN Driver* new_driver(MemPool p) {
10
724
  Driver* di = (Driver*)mp_calloc(p, BBQ);
11
724
  di->func = dummy_driver;
12
724
  di->driver = (DriverData*)mp_calloc(p, DriverData);
13
724
  di->is_running = 1;
14
724
  return di;
15
}
16
17
719
ANN void free_driver(Driver *d, VM *vm) {
18
719
  if(d->in)
19
712
    xfree(d->in);
20
719
  if(d->out)
21
712
    xfree(d->out);
22
719
  mp_free(vm->gwion->mp, SoundInfo, d->si);
23
719
  if(d->driver->del)
24
1
    d->driver->del(vm, d);
25
719
  mp_free(vm->gwion->mp, DriverData, d->driver);
26
719
  mp_free(vm->gwion->mp, BBQ, d);
27
719
}
28
29
713
ANN void driver_alloc(Driver *d) {
30
713
  d->out = (m_float*)xcalloc(d->si->out, SZ_FLOAT);
31
713
  d->in  = (m_float*)xcalloc(d->si->in, SZ_FLOAT);
32
713
}
33
34
712
static DRVRUN(dummy_run) {
35
2823128
  while(di->is_running) {
36
2821705
    di->run(vm);
37
2821704
    ++di->pos;
38
  }
39
711
}
40
41
712
static DRVINI(dummy_ini) {
42
712
  return GW_OK;
43
}
44
45
712
void dummy_driver(DriverData* dd) {
46
712
  dd->ini = dummy_ini;
47
712
  dd->run = dummy_run;
48
712
}