mirror of https://github.com/mgba-emu/mgba.git
Scripting: Rename mScriptCallbackAdapter to mScriptCallbackManager
This commit is contained in:
parent
f739c28b5f
commit
98c371b769
|
@ -9,11 +9,11 @@
|
|||
#include <mgba/core/serialize.h>
|
||||
#include <mgba/script/macros.h>
|
||||
|
||||
struct mScriptCallbackAdapter {
|
||||
struct mScriptCallbackManager {
|
||||
struct mScriptContext* context;
|
||||
};
|
||||
|
||||
static void _mScriptCallbackAdd(struct mScriptCallbackAdapter* adapter, struct mScriptString* name, struct mScriptValue* fn) {
|
||||
static void _mScriptCallbackAdd(struct mScriptCallbackManager* adapter, struct mScriptString* name, struct mScriptValue* fn) {
|
||||
if (fn->type->base == mSCRIPT_TYPE_WRAPPER) {
|
||||
fn = mScriptValueUnwrap(fn);
|
||||
}
|
||||
|
@ -21,20 +21,20 @@ static void _mScriptCallbackAdd(struct mScriptCallbackAdapter* adapter, struct m
|
|||
mScriptValueDeref(fn);
|
||||
}
|
||||
|
||||
mSCRIPT_DECLARE_STRUCT(mScriptCallbackAdapter);
|
||||
mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCallbackAdapter, add, _mScriptCallbackAdd, 2, STR, callback, WRAPPER, function);
|
||||
mSCRIPT_DECLARE_STRUCT(mScriptCallbackManager);
|
||||
mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCallbackManager, add, _mScriptCallbackAdd, 2, STR, callback, WRAPPER, function);
|
||||
|
||||
mSCRIPT_DEFINE_STRUCT(mScriptCallbackAdapter)
|
||||
mSCRIPT_DEFINE_STRUCT(mScriptCallbackManager)
|
||||
mSCRIPT_DEFINE_DOCSTRING("Add a callback of the named type")
|
||||
mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCallbackAdapter, add)
|
||||
mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCallbackManager, add)
|
||||
mSCRIPT_DEFINE_END;
|
||||
|
||||
void mScriptContextAttachStdlib(struct mScriptContext* context) {
|
||||
struct mScriptValue* lib;
|
||||
|
||||
lib = mScriptValueAlloc(mSCRIPT_TYPE_MS_S(mScriptCallbackAdapter));
|
||||
lib->value.opaque = calloc(1, sizeof(struct mScriptCallbackAdapter));
|
||||
*(struct mScriptCallbackAdapter*) lib->value.opaque = (struct mScriptCallbackAdapter) {
|
||||
lib = mScriptValueAlloc(mSCRIPT_TYPE_MS_S(mScriptCallbackManager));
|
||||
lib->value.opaque = calloc(1, sizeof(struct mScriptCallbackManager));
|
||||
*(struct mScriptCallbackManager*) lib->value.opaque = (struct mScriptCallbackManager) {
|
||||
.context = context
|
||||
};
|
||||
lib->flags = mSCRIPT_VALUE_FLAG_FREE_BUFFER;
|
||||
|
|
Loading…
Reference in New Issue