From 6e846668d230a6e535fe8193c0e479c02366d71a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 15 Dec 2019 14:30:21 +0100 Subject: [PATCH] :art: Use gwion for type_engine_init --- include/engine.h | 2 +- src/gwion.c | 4 ++-- src/lib/engine.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/engine.h b/include/engine.h index 630fae7d..728d16e6 100644 --- a/include/engine.h +++ b/include/engine.h @@ -1,4 +1,4 @@ #ifndef __ENGINE #define __ENGINE -ANN m_bool type_engine_init(VM*, const Vector); +ANN m_bool type_engine_init(const Gwion gwion, const Vector); #endif diff --git a/src/gwion.c b/src/gwion.c index cb88c413..1b816c77 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -4,9 +4,9 @@ #include "vm.h" #include "instr.h" #include "emit.h" -#include "engine.h" #include "driver.h" #include "gwion.h" +#include "engine.h" #include "arg.h" #include "compile.h" #include "object.h" // fork_clean @@ -35,7 +35,7 @@ ANN m_bool gwion_audio(const Gwion gwion) { } ANN static inline m_bool gwion_engine(const Gwion gwion) { - return type_engine_init(gwion->vm, &gwion->data->plug->vec[GWPLUG_IMPORT]) > 0; + return type_engine_init(gwion, &gwion->data->plug->vec[GWPLUG_IMPORT]) > 0; } ANN static inline void gwion_compile(const Gwion gwion, const Vector v) { diff --git a/src/lib/engine.c b/src/lib/engine.c index 6d6dcf85..23dc1969 100644 --- a/src/lib/engine.c +++ b/src/lib/engine.c @@ -146,19 +146,19 @@ ANN static m_bool import_core_libs(const Gwi gwi) { return GW_OK; } -ANN m_bool type_engine_init(VM* vm, const Vector plug_dirs) { - vm->gwion->env->name = "[builtin]"; +ANN m_bool type_engine_init(const Gwion gwion, const Vector plug_dirs) { + gwion->env->name = "[builtin]"; struct loc_t loc = {}; OperCK oper = {}; - struct Gwi_ gwi = { .gwion=vm->gwion, .loc=&loc, .oper=&oper }; + struct Gwi_ gwi = { .gwion=gwion, .loc=&loc, .oper=&oper }; CHECK_BB(import_core_libs(&gwi)) - push_global(vm->gwion, "[plugins]"); - vm->gwion->env->name = "[imported]"; + push_global(gwion, "[plugins]"); + gwion->env->name = "[imported]"; for(m_uint i = 0; i < vector_size(plug_dirs); ++i) { m_bool (*import)(Gwi) = (m_bool(*)(Gwi))vector_at(plug_dirs, i); if(import && import(&gwi) < 0) gwi_reset(&gwi); } - push_global(vm->gwion, "[user]"); + push_global(gwion, "[user]"); return GW_OK; } -- 2.43.0