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