1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
/* automatically generated by rust-bindgen */

pub const WREN_VERSION_MAJOR: u32 = 0;
pub const WREN_VERSION_MINOR: u32 = 4;
pub const WREN_VERSION_PATCH: u32 = 0;
pub const WREN_VERSION_STRING: &'static [u8; 6usize] = b"0.4.0\0";
pub const WREN_VERSION_NUMBER: u32 = 4000;
pub const WREN_NAN_TAGGING: u32 = 1;
pub const WREN_COMPUTED_GOTO: u32 = 1;
pub const WREN_OPT_META: u32 = 1;
pub const WREN_OPT_RANDOM: u32 = 1;
pub const WREN_DEBUG_GC_STRESS: u32 = 0;
pub const WREN_DEBUG_TRACE_MEMORY: u32 = 0;
pub const WREN_DEBUG_TRACE_GC: u32 = 0;
pub const WREN_DEBUG_DUMP_COMPILED_CODE: u32 = 0;
pub const WREN_DEBUG_TRACE_INSTRUCTIONS: u32 = 0;
pub type size_t = ::std::os::raw::c_ulong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WrenVM {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WrenHandle {
    _unused: [u8; 0],
}
pub type WrenReallocateFn = ::std::option::Option<
    unsafe extern "C" fn(
        memory: *mut ::std::os::raw::c_void,
        newSize: size_t,
        userData: *mut ::std::os::raw::c_void,
    ) -> *mut ::std::os::raw::c_void,
>;
pub type WrenForeignMethodFn = ::std::option::Option<unsafe extern "C" fn(vm: *mut WrenVM)>;
pub type WrenFinalizerFn =
    ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void)>;
pub type WrenResolveModuleFn = ::std::option::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,
>;
pub type WrenLoadModuleCompleteFn = ::std::option::Option<
    unsafe extern "C" fn(
        vm: *mut WrenVM,
        name: *const ::std::os::raw::c_char,
        result: WrenLoadModuleResult,
    ),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WrenLoadModuleResult {
    pub source: *const ::std::os::raw::c_char,
    pub onComplete: WrenLoadModuleCompleteFn,
    pub userData: *mut ::std::os::raw::c_void,
}
#[test]
fn bindgen_test_layout_WrenLoadModuleResult() {
    assert_eq!(
        ::std::mem::size_of::<WrenLoadModuleResult>(),
        24usize,
        concat!("Size of: ", stringify!(WrenLoadModuleResult))
    );
    assert_eq!(
        ::std::mem::align_of::<WrenLoadModuleResult>(),
        8usize,
        concat!("Alignment of ", stringify!(WrenLoadModuleResult))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenLoadModuleResult>())).source as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenLoadModuleResult),
            "::",
            stringify!(source)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenLoadModuleResult>())).onComplete as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenLoadModuleResult),
            "::",
            stringify!(onComplete)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenLoadModuleResult>())).userData as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenLoadModuleResult),
            "::",
            stringify!(userData)
        )
    );
}
pub type WrenLoadModuleFn = ::std::option::Option<
    unsafe extern "C" fn(
        vm: *mut WrenVM,
        name: *const ::std::os::raw::c_char,
    ) -> WrenLoadModuleResult,
>;
pub type WrenBindForeignMethodFn = ::std::option::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,
>;
pub type WrenWriteFn = ::std::option::Option<
    unsafe extern "C" fn(vm: *mut WrenVM, text: *const ::std::os::raw::c_char),
>;
pub const WrenErrorType_WREN_ERROR_COMPILE: WrenErrorType = 0;
pub const WrenErrorType_WREN_ERROR_RUNTIME: WrenErrorType = 1;
pub const WrenErrorType_WREN_ERROR_STACK_TRACE: WrenErrorType = 2;
pub type WrenErrorType = u32;
pub type WrenErrorFn = ::std::option::Option<
    unsafe extern "C" fn(
        vm: *mut WrenVM,
        type_: WrenErrorType,
        module: *const ::std::os::raw::c_char,
        line: ::std::os::raw::c_int,
        message: *const ::std::os::raw::c_char,
    ),
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct WrenForeignClassMethods {
    pub allocate: WrenForeignMethodFn,
    pub finalize: WrenFinalizerFn,
}
#[test]
fn bindgen_test_layout_WrenForeignClassMethods() {
    assert_eq!(
        ::std::mem::size_of::<WrenForeignClassMethods>(),
        16usize,
        concat!("Size of: ", stringify!(WrenForeignClassMethods))
    );
    assert_eq!(
        ::std::mem::align_of::<WrenForeignClassMethods>(),
        8usize,
        concat!("Alignment of ", stringify!(WrenForeignClassMethods))
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenForeignClassMethods>())).allocate as *const _ as usize
        },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenForeignClassMethods),
            "::",
            stringify!(allocate)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenForeignClassMethods>())).finalize as *const _ as usize
        },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenForeignClassMethods),
            "::",
            stringify!(finalize)
        )
    );
}
pub type WrenBindForeignClassFn = ::std::option::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)]
#[derive(Debug, Copy, Clone)]
pub struct WrenConfiguration {
    pub reallocateFn: WrenReallocateFn,
    pub resolveModuleFn: WrenResolveModuleFn,
    pub loadModuleFn: WrenLoadModuleFn,
    pub bindForeignMethodFn: WrenBindForeignMethodFn,
    pub bindForeignClassFn: WrenBindForeignClassFn,
    pub writeFn: WrenWriteFn,
    pub errorFn: WrenErrorFn,
    pub initialHeapSize: size_t,
    pub minHeapSize: size_t,
    pub heapGrowthPercent: ::std::os::raw::c_int,
    pub userData: *mut ::std::os::raw::c_void,
}
#[test]
fn bindgen_test_layout_WrenConfiguration() {
    assert_eq!(
        ::std::mem::size_of::<WrenConfiguration>(),
        88usize,
        concat!("Size of: ", stringify!(WrenConfiguration))
    );
    assert_eq!(
        ::std::mem::align_of::<WrenConfiguration>(),
        8usize,
        concat!("Alignment of ", stringify!(WrenConfiguration))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).reallocateFn as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(reallocateFn)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenConfiguration>())).resolveModuleFn as *const _ as usize
        },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(resolveModuleFn)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).loadModuleFn as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(loadModuleFn)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenConfiguration>())).bindForeignMethodFn as *const _ as usize
        },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(bindForeignMethodFn)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenConfiguration>())).bindForeignClassFn as *const _ as usize
        },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(bindForeignClassFn)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).writeFn as *const _ as usize },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(writeFn)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).errorFn as *const _ as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(errorFn)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenConfiguration>())).initialHeapSize as *const _ as usize
        },
        56usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(initialHeapSize)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).minHeapSize as *const _ as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(minHeapSize)
        )
    );
    assert_eq!(
        unsafe {
            &(*(::std::ptr::null::<WrenConfiguration>())).heapGrowthPercent as *const _ as usize
        },
        72usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(heapGrowthPercent)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<WrenConfiguration>())).userData as *const _ as usize },
        80usize,
        concat!(
            "Offset of field: ",
            stringify!(WrenConfiguration),
            "::",
            stringify!(userData)
        )
    );
}
pub const WrenInterpretResult_WREN_RESULT_SUCCESS: WrenInterpretResult = 0;
pub const WrenInterpretResult_WREN_RESULT_COMPILE_ERROR: WrenInterpretResult = 1;
pub const WrenInterpretResult_WREN_RESULT_RUNTIME_ERROR: WrenInterpretResult = 2;
pub type WrenInterpretResult = u32;
pub const WrenType_WREN_TYPE_BOOL: WrenType = 0;
pub const WrenType_WREN_TYPE_NUM: WrenType = 1;
pub const WrenType_WREN_TYPE_FOREIGN: WrenType = 2;
pub const WrenType_WREN_TYPE_LIST: WrenType = 3;
pub const WrenType_WREN_TYPE_MAP: WrenType = 4;
pub const WrenType_WREN_TYPE_NULL: WrenType = 5;
pub const WrenType_WREN_TYPE_STRING: WrenType = 6;
pub const WrenType_WREN_TYPE_UNKNOWN: WrenType = 7;
pub type WrenType = u32;
extern "C" {
    pub fn wrenGetVersionNumber() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn wrenInitConfiguration(configuration: *mut WrenConfiguration);
}
extern "C" {
    pub fn wrenNewVM(configuration: *mut WrenConfiguration) -> *mut WrenVM;
}
extern "C" {
    pub fn wrenFreeVM(vm: *mut WrenVM);
}
extern "C" {
    pub fn wrenCollectGarbage(vm: *mut WrenVM);
}
extern "C" {
    pub fn wrenInterpret(
        vm: *mut WrenVM,
        module: *const ::std::os::raw::c_char,
        source: *const ::std::os::raw::c_char,
    ) -> WrenInterpretResult;
}
extern "C" {
    pub fn wrenMakeCallHandle(
        vm: *mut WrenVM,
        signature: *const ::std::os::raw::c_char,
    ) -> *mut WrenHandle;
}
extern "C" {
    pub fn wrenCall(vm: *mut WrenVM, method: *mut WrenHandle) -> WrenInterpretResult;
}
extern "C" {
    pub fn wrenReleaseHandle(vm: *mut WrenVM, handle: *mut WrenHandle);
}
extern "C" {
    pub fn wrenGetSlotCount(vm: *mut WrenVM) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn wrenEnsureSlots(vm: *mut WrenVM, numSlots: ::std::os::raw::c_int);
}
extern "C" {
    pub fn wrenGetSlotType(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> WrenType;
}
extern "C" {
    pub fn wrenGetSlotBool(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> bool;
}
extern "C" {
    pub fn wrenGetSlotBytes(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
        length: *mut ::std::os::raw::c_int,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn wrenGetSlotDouble(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> f64;
}
extern "C" {
    pub fn wrenGetSlotForeign(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
    ) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    pub fn wrenGetSlotString(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn wrenGetSlotHandle(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> *mut WrenHandle;
}
extern "C" {
    pub fn wrenSetSlotBool(vm: *mut WrenVM, slot: ::std::os::raw::c_int, value: bool);
}
extern "C" {
    pub fn wrenSetSlotBytes(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
        bytes: *const ::std::os::raw::c_char,
        length: size_t,
    );
}
extern "C" {
    pub fn wrenSetSlotDouble(vm: *mut WrenVM, slot: ::std::os::raw::c_int, value: f64);
}
extern "C" {
    pub fn wrenSetSlotNewForeign(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
        classSlot: ::std::os::raw::c_int,
        size: size_t,
    ) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    pub fn wrenSetSlotNewList(vm: *mut WrenVM, slot: ::std::os::raw::c_int);
}
extern "C" {
    pub fn wrenSetSlotNewMap(vm: *mut WrenVM, slot: ::std::os::raw::c_int);
}
extern "C" {
    pub fn wrenSetSlotNull(vm: *mut WrenVM, slot: ::std::os::raw::c_int);
}
extern "C" {
    pub fn wrenSetSlotString(
        vm: *mut WrenVM,
        slot: ::std::os::raw::c_int,
        text: *const ::std::os::raw::c_char,
    );
}
extern "C" {
    pub fn wrenSetSlotHandle(vm: *mut WrenVM, slot: ::std::os::raw::c_int, handle: *mut WrenHandle);
}
extern "C" {
    pub fn wrenGetListCount(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn wrenGetListElement(
        vm: *mut WrenVM,
        listSlot: ::std::os::raw::c_int,
        index: ::std::os::raw::c_int,
        elementSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn wrenSetListElement(
        vm: *mut WrenVM,
        listSlot: ::std::os::raw::c_int,
        index: ::std::os::raw::c_int,
        elementSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn wrenInsertInList(
        vm: *mut WrenVM,
        listSlot: ::std::os::raw::c_int,
        index: ::std::os::raw::c_int,
        elementSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn wrenGetMapCount(vm: *mut WrenVM, slot: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn wrenGetMapContainsKey(
        vm: *mut WrenVM,
        mapSlot: ::std::os::raw::c_int,
        keySlot: ::std::os::raw::c_int,
    ) -> bool;
}
extern "C" {
    pub fn wrenGetMapValue(
        vm: *mut WrenVM,
        mapSlot: ::std::os::raw::c_int,
        keySlot: ::std::os::raw::c_int,
        valueSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn wrenSetMapValue(
        vm: *mut WrenVM,
        mapSlot: ::std::os::raw::c_int,
        keySlot: ::std::os::raw::c_int,
        valueSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn wrenRemoveMapValue(
        vm: *mut WrenVM,
        mapSlot: ::std::os::raw::c_int,
        keySlot: ::std::os::raw::c_int,
        removedValueSlot: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub 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,
    );
}
extern "C" {
    pub fn wrenHasVariable(
        vm: *mut WrenVM,
        module: *const ::std::os::raw::c_char,
        name: *const ::std::os::raw::c_char,
    ) -> bool;
}
extern "C" {
    pub fn wrenHasModule(vm: *mut WrenVM, module: *const ::std::os::raw::c_char) -> bool;
}
extern "C" {
    pub fn wrenAbortFiber(vm: *mut WrenVM, slot: ::std::os::raw::c_int);
}
extern "C" {
    pub fn wrenGetUserData(vm: *mut WrenVM) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    pub fn wrenSetUserData(vm: *mut WrenVM, userData: *mut ::std::os::raw::c_void);
}
extern "C" {
    pub fn wrenMetaSource() -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn wrenMetaBindForeignMethod(
        vm: *mut WrenVM,
        className: *const ::std::os::raw::c_char,
        isStatic: bool,
        signature: *const ::std::os::raw::c_char,
    ) -> WrenForeignMethodFn;
}
extern "C" {
    pub fn wrenRandomSource() -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn wrenRandomBindForeignClass(
        vm: *mut WrenVM,
        module: *const ::std::os::raw::c_char,
        className: *const ::std::os::raw::c_char,
    ) -> WrenForeignClassMethods;
}
extern "C" {
    pub fn wrenRandomBindForeignMethod(
        vm: *mut WrenVM,
        className: *const ::std::os::raw::c_char,
        isStatic: bool,
        signature: *const ::std::os::raw::c_char,
    ) -> WrenForeignMethodFn;
}