#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
use paste::paste;
type WrenReallocateFn = Option<unsafe extern "C" fn(memory: *mut libc::c_void, newSize: usize, userData: *mut libc::c_void) -> *mut libc::c_void>;
type WrenForeignMethodFn = Option<unsafe extern "C" fn(vm: *mut WrenVM)>;
type WrenFinalizerFn = Option<unsafe extern "C" fn(data: *mut libc::c_void)>;
type WrenResolveModuleFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, importer: *const std::os::raw::c_char, name: *const std::os::raw::c_char) -> *const std::os::raw::c_char>;
type WrenLoadModuleCompleteFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, name: *const std::os::raw::c_char, result: WrenLoadModuleResult)>;
#[repr(C)]
struct WrenLoadModuleResult {
source: *const std::os::raw::c_char,
onComplete: WrenLoadModuleCompleteFn,
userData: *mut libc::c_void
}
type WrenLoadModuleFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, name: *const std::os::raw::c_char) -> WrenLoadModuleResult>;
type WrenBindForeignMethodFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, module: *const std::os::raw::c_char, className: *const std::os::raw::c_char, isStatic: bool, signature: *const std::os::raw::c_char) -> WrenForeignMethodFn>;
type WrenWriteFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, text: *const std::os::raw::c_char)>;
#[repr(C)]
enum WrenErrorType {
WREN_ERROR_COMPILE,
WREN_ERROR_RUNTIME,
WREN_ERROR_STACK_TRACE
}
type WrenErrorFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, r#type: WrenErrorType, module: *const std::os::raw::c_char, line: std::os::raw::c_int, message: *const std::os::raw::c_char)>;
#[repr(C)]
struct WrenForeignClassMethods {
allocate: WrenForeignMethodFn,
finalize: WrenFinalizerFn
}
type WrenBindForeignClassFn = Option<unsafe extern "C" fn(vm: *mut WrenVM, module: *const std::os::raw::c_char, className: *const std::os::raw::c_char) -> WrenForeignClassMethods>;
#[repr(C)]
struct WrenConfiguration {
reallocateFn: WrenReallocateFn,
resolveModuleFn: WrenResolveModuleFn,
loadModuleFn: WrenLoadModuleFn,
bindForeignMethodFn: WrenBindForeignMethodFn,
bindForeignClassFn: WrenBindForeignClassFn,
writeFn: WrenWriteFn,
errorFn: WrenErrorFn,
initialHeapSize: usize,
minHeapSize: usize,
heapGrowthPercent: std::os::raw::c_int,
userData: *mut libc::c_void
}
#[repr(C)]
#[derive(Debug)]
enum WrenInterpretResult {
WREN_RESULT_SUCCESS,
WREN_RESULT_COMPILE_ERROR,
WREN_RESULT_RUNTIME_ERROR
}
#[repr(C)]
enum WrenType {
WREN_TYPE_BOOL,
WREN_TYPE_NUM,
WREN_TYPE_FOREIGN,
WREN_TYPE_LIST,
WREN_TYPE_MAP,
WREN_TYPE_NULL,
WREN_TYPE_STRING,
WREN_TYPE_UNKNOWN
}
#[link(name = "wren")]
extern "C" {
fn wrenInitConfiguration(configuration: *mut WrenConfiguration);
fn wrenNewVM(configuration: *mut WrenConfiguration) -> *mut WrenVM;
fn wrenFreeVM(vm: *mut WrenVM);
fn wrenCollectGarbage(vm: *mut WrenVM);
fn wrenInterpret(vm: *mut WrenVM, module: *const std::os::raw::c_char, source: *const std::os::raw::c_char) -> WrenInterpretResult;
fn wrenMakeCallHandle(vm: *mut WrenVM, signature: *const std::os::raw::c_char) -> *mut WrenHandle;
fn wrenCall(vm: *mut WrenVM, method: *mut WrenHandle) -> WrenInterpretResult;
fn wrenReleaseHandle(vm: *mut WrenVM, handle: *mut WrenHandle);
fn wrenGetSlotCount(vm: *mut WrenVM) -> std::os::raw::c_int;
fn wrenEnsureSlots(vm: *mut WrenVM, numSlots: std::os::raw::c_int);
fn wrenGetSlotType(vm: *mut WrenVM, slot: std::os::raw::c_int) -> WrenType;
fn wrenGetSlotBool(vm: *mut WrenVM, slot: std::os::raw::c_int) -> bool;
fn wrenGetSlotBytes(vm: *mut WrenVM, slot: std::os::raw::c_int, length: *mut std::os::raw::c_int) -> *const std::os::raw::c_char;
fn wrenGetSlotDouble(vm: *mut WrenVM, slot: std::os::raw::c_int) -> std::os::raw::c_double;
fn wrenGetSlotForeign(vm: *mut WrenVM, slot: std::os::raw::c_int) -> *mut libc::c_void;
fn wrenGetSlotString(vm: *mut WrenVM, slot: std::os::raw::c_int) -> *const std::os::raw::c_char;
fn wrenGetSlotHandle(vm: *mut WrenVM, slot: std::os::raw::c_int) -> *mut WrenHandle;
fn wrenSetSlotBool(vm: *mut WrenVM, slot: std::os::raw::c_int, value: bool);
fn wrenSetSlotBytes(vm: *mut WrenVM, slot: std::os::raw::c_int, bytes: *const std::os::raw::c_char, length: usize);
fn wrenSetSlotDouble(vm: *mut WrenVM, slot: std::os::raw::c_int, value: std::os::raw::c_double);
fn wrenSetSlotNewForeign(vm: *mut WrenVM, slot: std::os::raw::c_int, classSlot: std::os::raw::c_int, size: usize) -> *mut libc::c_void;
fn wrenSetSlotNewList(vm: *mut WrenVM, slot: std::os::raw::c_int);
fn wrenSetSlotNewMap(vm: *mut WrenVM, slot: std::os::raw::c_int);
fn wrenSetSlotNull(vm: *mut WrenVM, slot: std::os::raw::c_int);
fn wrenSetSlotString(vm: *mut WrenVM, slot: std::os::raw::c_int, text: *const std::os::raw::c_char);
fn wrenSetSlotHandle(vm: *mut WrenVM, slot: std::os::raw::c_int, handle: *mut WrenHandle);
fn wrenGetListCount(vm: *mut WrenVM, slot: std::os::raw::c_int) -> std::os::raw::c_int;
fn wrenGetListElement(vm: *mut WrenVM, listSlot: std::os::raw::c_int, index: std::os::raw::c_int, elementSlot: std::os::raw::c_int);
fn wrenSetListElement(vm: *mut WrenVM, listSlot: std::os::raw::c_int, index: std::os::raw::c_int, elementSlot: std::os::raw::c_int);
fn wrenInsertInList(vm: *mut WrenVM, listSlot: std::os::raw::c_int, index: std::os::raw::c_int, elementSlot: std::os::raw::c_int);
fn wrenGetMapCount(vm: *mut WrenVM, slot: std::os::raw::c_int) -> std::os::raw::c_int;
fn wrenGetMapContainsKey(vm: *mut WrenVM, mapSlot: std::os::raw::c_int, keySlot: std::os::raw::c_int) -> bool;
fn wrenGetMapValue(vm: *mut WrenVM, mapSlot: std::os::raw::c_int, keySlot: std::os::raw::c_int, valueSlot: std::os::raw::c_int);
fn wrenSetMapValue(vm: *mut WrenVM, mapSlot: std::os::raw::c_int, keySlot: std::os::raw::c_int, valueSlot: std::os::raw::c_int);
fn wrenRemoveMapValue(vm: *mut WrenVM, mapSlot: std::os::raw::c_int, keySlot: std::os::raw::c_int, removedValueSlot: std::os::raw::c_int);
fn wrenGetVariable(vm: *mut WrenVM, module: *const std::os::raw::c_char, name: *const std::os::raw::c_char, slot: std::os::raw::c_int);
fn wrenHasVariable(vm: *mut WrenVM, module: *const std::os::raw::c_char, name: *const std::os::raw::c_char) -> bool;
fn wrenHasModule(vm: *mut WrenVM, module: *const std::os::raw::c_char) -> bool;
fn wrenAbortFiber(vm: *mut WrenVM, slot: std::os::raw::c_int);
fn wrenGetUserData(vm: *mut WrenVM) -> *mut libc::c_void;
fn wrenSetUserData(vm: *mut WrenVM, userData: *mut libc::c_void);
}
macro_rules! declare_buffer {
($name:ident, $type:ty) => {
paste! {
#[repr(C)]
struct [<$name Buffer>] {
data: *mut $type,
count: std::os::raw::c_int,
capacity: std::os::raw::c_int
}
#[link(name = "wren")]
extern "C" {
fn [<wren $name BufferInit>](buffer: *mut [<$name Buffer>]);
fn [<wren $name BufferClear>](vm: *mut WrenVM, buffer: *mut [<$name Buffer>]);
fn [<wren $name BufferFill>](vm: *mut WrenVM, buffer: *mut [<$name Buffer>], data: $type, count: std::os::raw::c_int);
fn [<wren $name BufferWrite>](vm: *mut WrenVM, buffer: *mut [<$name Buffer>], data: $type);
}
}
};
}
declare_buffer!(Byte, u8);
declare_buffer!(Int, std::os::raw::c_int);
declare_buffer!(String, *mut ObjString);
type SymbolTable = StringBuffer;
#[link(name = "wren")]
extern "C" {
fn wrenSymbolTableInit(symbols: *mut SymbolTable);
fn wrenSymbolTableClear(vm: *mut WrenVM, symbols: *mut SymbolTable);
fn wrenSymbolTableAdd(vm: *mut WrenVM, symbols: *mut SymbolTable, name: *const std::os::raw::c_char, length: usize) -> std::os::raw::c_int;
fn wrenSymbolTableEnsure(vm: *mut WrenVM, symbols: *mut SymbolTable, name: *const std::os::raw::c_char, length: usize) -> std::os::raw::c_int;
fn wrenSymbolTableFind(symbols: *const SymbolTable, name: *const std::os::raw::c_char, length: usize) -> std::os::raw::c_int;
fn wrenBlackenSymbolTable(vm: *mut WrenVM, symbolTable: *mut SymbolTable);
fn wrenUtf8EncodeNumBytes(value: std::os::raw::c_int) -> std::os::raw::c_int;
fn wrenUtf8Encode(value: std::os::raw::c_int, bytes: *mut u8) -> std::os::raw::c_int;
fn wrenUtf8Decode(bytes: *const std::os::raw::c_char, length: u32) -> std::os::raw::c_int;
fn wrenUtf8DecodeNumBytes(byte: u8) -> std::os::raw::c_int;
fn wrenPowerOf2Ceil(n: std::os::raw::c_int) -> std::os::raw::c_int;
fn wrenValidateIndex(count: u32, value: i64) -> u32;
}
#[link(name = "wren")]
extern "C" {
fn wrenDoubleFromBits(bits: u64) -> std::os::raw::c_double;
fn wrenDoubleToBits(num: std::os::raw::c_double) -> u64;
}
#[repr(C)]
enum ObjType {
OBJ_CLASS,
OBJ_CLOSURE,
OBJ_FIBER,
OBJ_FN,
OBJ_FOREIGN,
OBJ_INSTANCE,
OBJ_LIST,
OBJ_MAP,
OBJ_MODULE,
OBJ_RANGE,
OBJ_STRING,
OBJ_UPVALUE
}
#[repr(C)]
struct Obj {
r#type: ObjType,
isDark: bool,
classObj: *mut ObjClass,
next: *mut Obj
}
type Value = u64;
declare_buffer!(Value, Value);
#[repr(C)]
struct ObjString {
obj: Obj,
length: u32,
hash: u32,
value: *mut std::os::raw::c_char
}
#[repr(C)]
struct ObjUpvalue {
obj: Obj,
value: *mut Value,
closed: Value,
next: *mut ObjUpvalue
}
type Primitive = extern "C" fn(vm: *mut WrenVM, args: *mut Value) -> bool;
#[repr(C)]
struct FnDebug {
name: *mut std::os::raw::c_char,
sourceLines: IntBuffer
}
#[repr(C)]
struct ObjModule {
obj: Obj,
variables: ValueBuffer,
variablesNames: SymbolTable,
name: *mut ObjString
}
#[repr(C)]
struct ObjFn {
obj: Obj,
code: ByteBuffer,
constants: ValueBuffer,
module: *mut ObjModule,
maxSlots: std::os::raw::c_int,
numUpvalues: std::os::raw::c_int,
arity: std::os::raw::c_int,
debug: *mut FnDebug
}
#[repr(C)]
struct ObjClosure {
obj: Obj,
r#fn: *mut ObjFn,
upvalues: *mut *mut ObjUpvalue
}
#[repr(C)]
struct CallFrame {
ip: u8,
closure: *mut ObjClosure,
stackStart: *mut Value
}
#[repr(C)]
enum FiberState {
FIBER_TRY,
FIBER_ROOT,
FIBER_OTHER
}
#[repr(C)]
struct ObjFiber {
obj: Obj,
stack: *mut Value,
stackTop: *mut Value,
stackCapacity: std::os::raw::c_int,
frames: *mut CallFrame,
numFrames: std::os::raw::c_int,
frameCapacity: std::os::raw::c_int,
openUpvalues: *mut ObjUpvalue,
caller: *mut ObjFiber,
error: Value,
state: FiberState
}
#[repr(C)]
enum MethodType {
METHOD_PRIMITIVE,
METHOD_FUNCTION_CALL,
METHOD_FOREIGN,
METHOD_BLOCK,
METHOD_NONE
}
#[repr(C)]
union MethodContents {
primitive: Primitive,
foreign: WrenForeignMethodFn,
closure: *mut ObjClosure
}
#[repr(C)]
struct Method {
r#type: MethodType,
r#as: MethodContents
}
declare_buffer!(Method, Method);
#[repr(C)]
struct ObjClass {
obj: Obj,
superclass: *mut ObjClass,
numFields: std::os::raw::c_int,
methods: MethodBuffer,
name: *mut ObjString
}
#[repr(C)]
struct ObjForeign {
obj: Obj,
data: *mut u8
}
#[repr(C)]
struct ObjInstance {
obj: Obj,
fields: *mut Value
}
#[repr(C)]
struct ObjList {
obj: Obj,
elements: ValueBuffer
}
#[repr(C)]
struct MapEntry {
key: Value,
value: Value
}
#[repr(C)]
struct ObjMap {
obj: Obj,
capacity: u32,
count: u32,
entries: *mut MapEntry
}
#[repr(C)]
struct ObjRange {
obj: Obj,
from: std::os::raw::c_double,
to: std::os::raw::c_double,
isInclusive: bool
}
#[link(name = "wren")]
extern "C" {
fn wrenNewSingleClass(vm: *mut WrenVM, numFields: std::os::raw::c_int, name: *mut ObjString) -> *mut ObjClass;
fn wrenBindSuperclass(vm: *mut WrenVM, subclass: *mut ObjClass, superclass: *mut ObjClass);
fn wrenNewClass(vm: *mut WrenVM, suuperclass: *mut ObjClass, numFields: std::os::raw::c_int, name: *mut ObjString) -> *mut ObjClass;
fn wrenBindMethod(vm: *mut WrenVM, classObject: *mut ObjClass, symbol: std::os::raw::c_int, method: Method);
fn wrenNewClosure(vm: *mut WrenVM, r#fn: *mut ObjFn) -> *mut ObjClosure;
fn wrenNewFiber(vm: *mut WrenVM, closure: *mut ObjClosure) -> *mut ObjFiber;
fn wrenAppendCallFrame(vm: *mut WrenVM, fiber: *mut ObjFiber, closure: *mut ObjClosure, stackStart: *mut Value);
fn wrenEnsureStack(vm: *mut WrenVM, fiber: *mut ObjFiber, needed: std::os::raw::c_int);
fn wrenHasError(fiber: *const ObjFiber) -> bool;
fn wrenNewForeign(vm: *mut WrenVM, classObj: *mut ObjClass, size: usize) -> *mut ObjForeign;
fn wrenNewFunction(vm: *mut WrenVM, module: *mut ObjModule, maxSlots: std::os::raw::c_int) -> *mut ObjFn;
fn wrenFunctionBindName(vm: *mut WrenVM, r#fn: *mut ObjFn, name: *const std::os::raw::c_char, length: std::os::raw::c_int);
fn wrenNewInstance(vm: *mut WrenVM, classObj: *mut ObjClass) -> Value;
fn wrenNewList(vm: *mut WrenVM, numElements: u32) -> *mut ObjList;
fn wrenListInsert(vm: *mut WrenVM, list: *mut ObjList, value: Value, index: u32);
fn wrenListRemoveAt(vm: *mut WrenVM, list: *mut ObjList, index: u32) -> Value;
fn wrenListIndexOf(vm: *mut WrenVM, list: *mut ObjList, value: Value) -> std::os::raw::c_int;
fn wrenNewMap(vm: *mut WrenVM) -> *mut ObjMap;
fn wrenMapGet(map: *mut ObjMap, key: Value) -> Value;
fn wrenMapSet(vm: *mut WrenVM, map: *mut ObjMap, key: Value, value: Value);
fn wrenMapClear(vm: *mut WrenVM, map: *mut ObjMap);
fn wrenMapRemoveKey(vm: *mut WrenVM, map: *mut ObjMap, key: Value) -> Value;
fn wrenNewModule(vm: *mut WrenVM, name: *mut ObjString) -> *mut ObjModule;
fn wrenNewRange(vm: *mut WrenVM, from: std::os::raw::c_double, to: std::os::raw::c_double, isInclusive: bool) -> Value;
fn wrenNeString(vm: *mut WrenVM, text: *const std::os::raw::c_char) -> Value;
fn wrenNewStringLength(vm: *mut WrenVM, text: *const std::os::raw::c_char, length: usize) -> Value;
fn wrenNewStringFromRange(vm: *mut WrenVM, source: *mut ObjString, start: std::os::raw::c_int, count: u32, step: std::os::raw::c_int) -> Value;
fn wrenNumToString(vm: *mut WrenVM, value: std::os::raw::c_double) -> Value;
fn wrenStringFormat(vm: *mut WrenVM, format: *const std::os::raw::c_char, ...) -> Value;
fn wrenStringFromCodePoint(vm: *mut WrenVM, value: std::os::raw::c_int) -> Value;
fn wrenStringFromByte(vm: *mut WrenVM, value: u8) -> Value;
fn wrenStringCodePointAt(vm: *mut WrenVM, string: *mut ObjString, index: u32) -> Value;
fn wrenStringFind(haystack: *mut ObjString, needle: *mut ObjString, startIndex: u32) -> u32;
fn wrenStringEqualsCString(a: *const ObjString, b: *const std::os::raw::c_char, length: usize) -> bool;
fn wrenNewUpvalue(vm: *mut WrenVM, value: *mut Value) -> *mut ObjUpvalue;
fn wrenGrayObj(vm: *mut WrenVM, obj: *mut Obj);
fn wrenGrayValue(vm: *mut WrenVM, value: Value);
fn wrenGrayBuffer(vm: *mut WrenVM, buffer: *mut ValueBuffer);
fn wrenBlackenObjects(vm: *mut WrenVM);
fn wrenFreeObj(vm: *mut WrenVM, obj: *mut Obj);
fn wrenGetClass(vm: *mut WrenVM, value: Value) -> *mut ObjClass;
fn wrenValuesSame(a: Value, b: Value);
fn wrenValuesEqual(a: Value, b: Value) -> bool;
fn wrenIsBool(value: Value) -> bool;
fn wrenIsObjType(value: Value, r#type: ObjType) -> bool;
fn wrenObjectToValue(obj: *mut Obj) -> Value;
fn wrenValueToNum(value: Value) -> std::os::raw::c_double;
fn wrenNumToValue(num: std::os::raw::c_double) -> Value;
}
#[repr(C)]
struct Compiler {
_private: [u8;0]
}
#[link(name = "wren")]
extern "C" {
fn wrenCompile(vm: *mut WrenVM, module: *mut ObjModule, source: *const std::os::raw::c_char, isExpression: bool, printErrors: bool) -> *mut ObjFn;
fn wrenBindMethodCode(classObj: *mut ObjClass, r#fn: *mut ObjFn);
fn wrenMarkCompiler(vm: *mut WrenVM, compiler: *mut Compiler);
}
#[repr(C)]
enum Code {
CODE_CONSTANT,
CODE_NULL,
CODE_FALSE,
CODE_TRUE,
CODE_LOAD_LOCAL_0,
CODE_LOAD_LOCAL_1,
CODE_LOAD_LOCAL_2,
CODE_LOAD_LOCAL_3,
CODE_LOAD_LOCAL_4,
CODE_LOAD_LOCAL_5,
CODE_LOAD_LOCAL_6,
CODE_LOAD_LOCAL_7,
CODE_LOAD_LOCAL_8,
CODE_LOAD_LOCAL,
CODE_STORE_LOCAL,
CODE_LOAD_UPVALUE,
CODE_STORE_UPVALUE,
CODE_LOAD_MODULE_VAR,
CODE_STORE_MODULE_VAR,
CODE_LOAD_FIELD_THIS,
CODE_STORE_FIELD_THIS,
CODE_LOAD_FIELD,
CODE_STORE_FIELD,
CODE_POP,
CODE_CALL_0,
CODE_CALL_1,
CODE_CALL_2,
CODE_CALL_3,
CODE_CALL_4,
CODE_CALL_5,
CODE_CALL_6,
CODE_CALL_7,
CODE_CALL_8,
CODE_CALL_9,
CODE_CALL_10,
CODE_CALL_11,
CODE_CALL_12,
CODE_CALL_13,
CODE_CALL_14,
CODE_CALL_15,
CODE_CALL_16,
CODE_SUPER_0,
CODE_SUPER_1,
CODE_SUPER_2,
CODE_SUPER_3,
CODE_SUPER_4,
CODE_SUPER_5,
CODE_SUPER_6,
CODE_SUPER_7,
CODE_SUPER_8,
CODE_SUPER_9,
CODE_SUPER_10,
CODE_SUPER_11,
CODE_SUPER_12,
CODE_SUPER_13,
CODE_SUPER_14,
CODE_SUPER_15,
CODE_SUPER_16,
CODE_JUMP,
CODE_LOOP,
CODE_JUMP_IF,
CODE_AND,
CODE_OR,
CODE_CLOSE_UPVALUE,
CODE_RETURN,
CODE_CLOSURE,
CODE_CONSTRUCT,
CODE_FOREIGN_CONSTRUCT,
CODE_CLASS,
CODE_FOREIGN_CLASS,
CODE_METHOD_INSTANCE,
CODE_METHOD_STATIC,
CODE_END_MODULE,
CODE_IMPORT_MODULE,
CODE_IMPORT_VARIABLE,
CODE_END
}
#[repr(C)]
struct WrenHandle {
value: Value,
prev: *mut WrenHandle,
next: *mut WrenHandle
}
#[repr(C)]
struct WrenVM {
boolClass: *mut ObjClass,
classClass: *mut ObjClass,
fiberClass: *mut ObjClass,
fnClass: *mut ObjClass,
listClass: *mut ObjClass,
mapClass: *mut ObjClass,
nullClass: *mut ObjClass,
numClass: *mut ObjClass,
objectClass: *mut ObjClass,
rangeClass: *mut ObjClass,
stringClass: *mut ObjClass,
fiber: *mut ObjFiber,
modules: *mut ObjMap,
lastModule: *mut ObjModule,
bytesAllocated: usize,
nextGC: usize,
first: *mut Obj,
gray: *mut *mut Obj,
grayCount: std::os::raw::c_int,
grayCapacity: std::os::raw::c_int,
tempRoots: [*mut Obj; 8],
numTempRoots: std::os::raw::c_int,
handles: *mut WrenHandle,
apiStack: *mut Value,
config: WrenConfiguration,
compiler: *mut Compiler,
methodNames: SymbolTable
}
#[link(name = "wren")]
extern "C" {
fn wrenReallocate(vm: *mut WrenVM, memory: *mut libc::c_void, oldSize: usize, newSize: usize) -> *mut libc::c_void;
fn wrenFinalizeForeign(vm: *mut WrenVM, foreign: *mut ObjForeign);
fn wrenMakeHandle(vm: *mut WrenVM, value: Value) -> *mut WrenHandle;
fn wrenCompileSource(vm: *mut WrenVM, module: *const std::os::raw::c_char, source: *const std::os::raw::c_char, isExpression: bool, printErrors: bool) -> *mut ObjClosure;
fn wrenGetModuleVariable(vm: *mut WrenVM, moduleName: Value, variableName: Value) -> Value;
fn wrenFindVariable(vm: *mut WrenVM, module: *mut ObjModule, name: *const std::os::raw::c_char) -> Value;
fn wrenDeclareVariable(vm: *mut WrenVM, module: *mut ObjModule, name: *const std::os::raw::c_char, length: usize, line: std::os::raw::c_int) -> std::os::raw::c_int;
fn wrenDefineVariable(vm: *mut WrenVM, module: *mut ObjModule, name: *const std::os::raw::c_char, length: usize, value: Value, line: *mut std::os::raw::c_int);
fn wrenCallFunction(vm: *mut WrenVM, fiber: *mut ObjFiber, closure: *mut ObjClosure, numArgs: std::os::raw::c_int);
fn wrenPushRoot(vm: *mut WrenVM, obj: *mut Obj);
fn wrenPopRoot(vm: *mut WrenVM);
fn wrenGetClassInLine(vm: *mut WrenVM, value: Value) -> *mut ObjClass;
fn wrenIsLocalName(name: *const std::os::raw::c_char) -> bool;
}
#[link(name = "wren")]
extern "C" {
fn validateFn(vm: *mut WrenVM, arg: Value, argName: *const std::os::raw::c_char) -> bool;
fn validateNum(vm: *mut WrenVM, arg: Value, argName: *const std::os::raw::c_char) -> bool;
fn validateIntValue(vm: *mut WrenVM, value: std::os::raw::c_double, argName: *const std::os::raw::c_char) -> bool;
fn validateInt(vm: *mut WrenVM, arg: Value, argName: *const std::os::raw::c_char) -> bool;
fn validateKey(vm: *mut WrenVM, argName: *const std::os::raw::c_char) -> bool;
fn validateIndex(vm: *mut WrenVM, arg: Value, count: u32, argName: *const std::os::raw::c_char) -> u32;
fn validateString(vm: *mut WrenVM, arg: Value, argName: *const std::os::raw::c_char) -> bool;
fn calculateRange(vm: *mut WrenVM, range: *mut ObjRange, length: *mut u32, step: *mut std::os::raw::c_int) -> u32;
}