Wrap more c functions.

This commit is contained in:
King_DuckZ 2020-04-30 19:58:26 +02:00
parent df52fe0fba
commit 751667769c
2 changed files with 11 additions and 0 deletions

View file

@ -188,6 +188,11 @@ namespace wren {
return {data, length}; return {data, length};
} }
void* VM::slot_foreign (int slot_num) {
assert(SlotType::Foreign == slot_type(slot_num));
return wrenGetSlotForeign(m_local->wvm, slot_num);
}
void VM::set_slot_string (int slot_num, const char* value) { void VM::set_slot_string (int slot_num, const char* value) {
wrenSetSlotString(m_local->wvm, slot_num, value); wrenSetSlotString(m_local->wvm, slot_num, value);
} }
@ -208,6 +213,10 @@ namespace wren {
wrenSetSlotBytes(m_local->wvm, slot_num, bytes, length); wrenSetSlotBytes(m_local->wvm, slot_num, bytes, length);
} }
void* VM::set_slot_new_foreign (int slot_num, int class_slot, std::size_t size) {
return wrenSetSlotNewForeign(m_local->wvm, slot_num, class_slot, size);
}
void VM::ensure_slots (int num_slots) { void VM::ensure_slots (int num_slots) {
wrenEnsureSlots(m_local->wvm, num_slots); wrenEnsureSlots(m_local->wvm, num_slots);
} }

View file

@ -68,12 +68,14 @@ namespace wren {
void set_slot_bool (int slot_num, bool value); void set_slot_bool (int slot_num, bool value);
void set_slot_null (int slot_num); void set_slot_null (int slot_num);
void set_slot_bytes (int slot_num, const char* bytes, std::size_t length); void set_slot_bytes (int slot_num, const char* bytes, std::size_t length);
void* set_slot_new_foreign (int slot_num, int class_slot, std::size_t size);
//slot getters //slot getters
const char* slot_string (int slot_num); const char* slot_string (int slot_num);
double slot_double (int slot_num); double slot_double (int slot_num);
bool slot_bool (int slot_num); bool slot_bool (int slot_num);
std::pair<const char*, int> slot_bytes (int slot_num); std::pair<const char*, int> slot_bytes (int slot_num);
void* slot_foreign (int slot_num);
private: private:
struct LocalData; struct LocalData;