From 6333a37011368ce65b5804b0c698257559a6e41a Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 24 Feb 2023 19:25:04 -0500 Subject: bindings: Make variables not static global --- diff --git a/src/scripting/bindings.c b/src/scripting/bindings.c index 7e45146..4efe584 100644 --- a/src/scripting/bindings.c +++ b/src/scripting/bindings.c @@ -16,17 +16,15 @@ * . */ -#define _SCRIPTING_BINDINGS_C_ - #include #include "ffi.h" #include "bindings.h" -struct ffi_namespace *top_ns; - void bindings_init(void) { + struct ffi_namespace *top_ns; + top_ns = ffi_add_namespace(NULL, "bouken"); - bindings_viewport_init(); + bindings_viewport_init(top_ns); } diff --git a/src/scripting/bindings.h b/src/scripting/bindings.h index 4ad7386..725580b 100644 --- a/src/scripting/bindings.h +++ b/src/scripting/bindings.h @@ -19,11 +19,9 @@ #ifndef _SCRIPTING_BINDINGS_H_ #define _SCRIPTING_BINDINGS_H_ -#ifndef _SCRIPTING_BINDINGS_C_ -extern struct ffi_namespace *top_ns; -#endif +#include "ffi.h" void bindings_init(void); -void bindings_viewport_init(void); +void bindings_viewport_init(struct ffi_namespace *top_ns); #endif diff --git a/src/scripting/bindings/viewport.c b/src/scripting/bindings/viewport.c index 8fcc041..7e23d7d 100644 --- a/src/scripting/bindings/viewport.c +++ b/src/scripting/bindings/viewport.c @@ -21,8 +21,6 @@ #include "../ffi.h" #include "../bindings.h" -static struct ffi_namespace *ns; - static void binding_set_size(struct ffi_function *fn) { @@ -36,8 +34,10 @@ binding_set_size(struct ffi_function *fn) } void -bindings_viewport_init(void) +bindings_viewport_init(struct ffi_namespace *top_ns) { + struct ffi_namespace *ns; + ns = ffi_add_namespace(top_ns, "viewport"); ffi_add_function(ns, "set_size", binding_set_size); } -- cgit v0.9.1