Skip to content

Commit

Permalink
Merge pull request #173 from ChayimFriedman2/add-get-variable-slot-ha…
Browse files Browse the repository at this point in the history
…ndle

Provide access to `wrenGetVariable()` and `wrenGetSlotHandle()`
  • Loading branch information
avivbeeri committed Feb 22, 2021
2 parents 0c696c2 + 7155db3 commit 99effb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/plugins/index.md
Expand Up @@ -274,6 +274,11 @@ const char* getSlotBytes(WrenVM* vm, int slot, int* length);
void getMapValue(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void setMapValue(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void removeMapValue(WrenVM* vm, int mapSlot, int keySlot, int removedValueSlot);
void getVariable(WrenVM* vm, const char* module, const char* name, int slot);
WrenHandle* getSlotHandle(WrenVM* vm, int slot);
void setSlotHandle(WrenVM* vm, int slot, WrenHandle* handle);
void releaseHandle(WrenVM* vm, WrenHandle* handle);
```

## Audio
Expand Down
6 changes: 6 additions & 0 deletions include/dome.h
Expand Up @@ -59,6 +59,7 @@ typedef enum {
#ifndef wren_h
// If the wren header is not in use, we forward declare some types we need.
typedef struct WrenVM WrenVM;
typedef struct WrenHandle WrenHandle;
typedef void (*WrenForeignMethodFn)(WrenVM* vm);
typedef void (*WrenFinalizerFn)(void* data);

Expand Down Expand Up @@ -127,6 +128,11 @@ typedef struct {
void (*getMapValue)(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void (*setMapValue)(WrenVM* vm, int mapSlot, int keySlot, int valueSlot);
void (*removeMapValue)(WrenVM* vm, int mapSlot, int keySlot, int removedValueSlot);

void (*getVariable)(WrenVM* vm, const char* module, const char* name, int slot);
WrenHandle* (*getSlotHandle)(WrenVM* vm, int slot);
void (*setSlotHandle)(WrenVM* vm, int slot, WrenHandle* handle);
void (*releaseHandle)(WrenVM* vm, WrenHandle* handle);
} WREN_API_v0;

typedef struct {
Expand Down
7 changes: 6 additions & 1 deletion src/plugin.c
Expand Up @@ -318,7 +318,12 @@ WREN_API_v0 wren_v0 = {
.getMapContainsKey = wrenGetMapContainsKey,
.getMapValue = wrenGetMapValue,
.setMapValue = wrenSetMapValue,
.removeMapValue = wrenRemoveMapValue
.removeMapValue = wrenRemoveMapValue,

.getVariable = wrenGetVariable,
.getSlotHandle = wrenGetSlotHandle,
.setSlotHandle = wrenSetSlotHandle,
.releaseHandle = wrenReleaseHandle
};

DOME_API_v0 dome_v0 = {
Expand Down

0 comments on commit 99effb4

Please sign in to comment.