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