From adcbd5570c289c7a7e4ea0ec4d752b6f9b251c59 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 12 Mar 2019 20:29:21 +0100 Subject: [PATCH] :art: Renaming --- include/driver.h | 10 +++++----- include/gwion.h | 1 - include/vm.h | 2 +- src/gwion.c | 11 +++++------ src/vm/driver.c | 13 ++++++------- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/driver.h b/include/driver.h index f9912d33..d3c88f93 100644 --- a/include/driver.h +++ b/include/driver.h @@ -1,17 +1,17 @@ #ifndef __DRIVER #define __DRIVER -typedef struct BBQ_ DriverInfo; + typedef m_bool (*f_drvini)(VM*, struct BBQ_*); typedef void (*f_drvrun)(VM*, struct BBQ_*); typedef void (*f_drvdel)(VM*, struct BBQ_*); -typedef struct Driver_ { +typedef struct DriverData_ { f_drvini ini; f_drvrun run; f_drvdel del; void* data; -} Driver; +} DriverData; -ANN void dummy_driver(Driver*); -ANN void bbq_alloc(DriverInfo*); +ANN void dummy_driver(DriverData*); +ANN void bbq_alloc(struct BBQ_*); #endif diff --git a/include/gwion.h b/include/gwion.h index ba3788ab..da153986 100644 --- a/include/gwion.h +++ b/include/gwion.h @@ -7,7 +7,6 @@ typedef struct Gwion_* Gwion; #include "driver.h" struct Gwion_ { PlugInfo* plug; -// DriverInfo* di; struct Arg_* arg; // sym // mem diff --git a/include/vm.h b/include/vm.h index 2410880a..a7a3a30f 100644 --- a/include/vm.h +++ b/include/vm.h @@ -26,7 +26,7 @@ struct BBQ_ { struct SoundInfo_ *si; f_bbqset func; f_bbqrun run; - struct Driver_* driver; + struct DriverData_* driver; }; typedef struct Shreduler_* Shreduler; diff --git a/src/gwion.c b/src/gwion.c index dfa4d5ce..07cd3162 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -26,11 +26,11 @@ #define VMBENCH_END #endif -ANN static DriverInfo* new_driverinfo(void) { - DriverInfo *di = (DriverInfo*)xcalloc(1, sizeof(DriverInfo)); +ANN static struct BBQ_ * new_driverinfo(void) { + struct BBQ_ * di = (struct BBQ*)xcalloc(1, sizeof(struct BBQ_)); di->func = dummy_driver; di->run = vm_run; - di->driver = (Driver*)xcalloc(1, sizeof(Driver)); + di->driver = (DriverData*)xcalloc(1, sizeof(DriverData)); return di; } @@ -43,7 +43,7 @@ ANN static Arg* new_arg(int argc, char** argv) { } ANN m_bool gwion_audio(const Gwion gwion) { - DriverInfo *di = gwion->vm->bbq; + struct BBQ_ *di = gwion->vm->bbq; // get driver from string. if(di->si->arg) { for(m_uint i = 0; i < map_size(&gwion->plug->drv); ++i) { @@ -103,7 +103,7 @@ ANN void gwion_run(const Gwion gwion) { VMBENCH_END } -ANN /* static */ void free_driverinfo(DriverInfo* di, VM* vm) { +ANN /* static */ void free_driverinfo(struct BBQ_* di, VM* vm) { mp_free(SoundInfo, di->si); if(di->driver->del) di->driver->del(vm, di); @@ -117,7 +117,6 @@ ANN void gwion_end(const Gwion gwion) { free_env(gwion->env); free_emitter(gwion->emit); free_vm(gwion->vm); -// free_driverinfo(gwion->vm->bbq, gwion->vm); xfree(gwion->plug); free_symbols(); } diff --git a/src/vm/driver.c b/src/vm/driver.c index c4800e8e..3a3f6117 100644 --- a/src/vm/driver.c +++ b/src/vm/driver.c @@ -10,24 +10,23 @@ #include "driver.h" #include "sound.h" -ANN void bbq_alloc(DriverInfo* di) { - struct BBQ_* bbq = (struct BBQ_*)di; - bbq->out = (m_float*)xcalloc(di->si->out, SZ_FLOAT); - bbq->in = (m_float*)xcalloc(di->si->in, SZ_FLOAT); +ANN void bbq_alloc(struct BBQ_ *bbq) { + bbq->out = (m_float*)xcalloc(bbq->si->out, SZ_FLOAT); + bbq->in = (m_float*)xcalloc(bbq->si->in, SZ_FLOAT); } -static void dummy_run(VM* vm, DriverInfo* di) { +static void dummy_run(VM* vm, struct BBQ_* di) { while(di->is_running) { di->run(vm); ++di->pos; } } -static m_bool dummy_ini(VM* vm __attribute__((unused)), DriverInfo* di __attribute__((unused))) { +static m_bool dummy_ini(VM* vm __attribute__((unused)), struct BBQ_* di __attribute__((unused))) { return GW_OK; } -void dummy_driver(Driver* d) { +void dummy_driver(DriverData* d) { d->ini = dummy_ini; d->run = dummy_run; } -- 2.43.0