rmquickjs-sys 1.0.0

Low-level MicroQuickJS bindings for Rust
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
573
574
575
576
577
/* automatically generated by rust-bindgen 0.72.1 */

pub const JSW: u32 = 8;
pub const JS_TAG_SPECIAL_BITS: u32 = 5;
pub const JS_EX_NORMAL: u32 = 0;
pub const JS_EX_CALL: u32 = 1;
pub const JS_EVAL_RETVAL: u32 = 1;
pub const JS_EVAL_REPL: u32 = 2;
pub const JS_EVAL_STRIP_COL: u32 = 4;
pub const JS_EVAL_JSON: u32 = 8;
pub const JS_EVAL_REGEXP: u32 = 16;
pub const JS_EVAL_REGEXP_FLAGS_SHIFT: u32 = 8;
pub const JS_BYTECODE_MAGIC: u32 = 44283;
pub const JS_DUMP_LONG: u32 = 1;
pub const JS_DUMP_NOQUOTE: u32 = 2;
pub const JS_DUMP_RAW: u32 = 4;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSContext {
    _unused: [u8; 0],
}
pub type JSWord = u64;
pub type JSValue = u64;
pub const JS_TAG_INT: _bindgen_ty_1 = 0;
pub const JS_TAG_PTR: _bindgen_ty_1 = 1;
pub const JS_TAG_SPECIAL: _bindgen_ty_1 = 3;
pub const JS_TAG_BOOL: _bindgen_ty_1 = 3;
pub const JS_TAG_NULL: _bindgen_ty_1 = 7;
pub const JS_TAG_UNDEFINED: _bindgen_ty_1 = 11;
pub const JS_TAG_EXCEPTION: _bindgen_ty_1 = 15;
pub const JS_TAG_SHORT_FUNC: _bindgen_ty_1 = 19;
pub const JS_TAG_UNINITIALIZED: _bindgen_ty_1 = 23;
pub const JS_TAG_STRING_CHAR: _bindgen_ty_1 = 27;
pub const JS_TAG_CATCH_OFFSET: _bindgen_ty_1 = 31;
pub const JS_TAG_SHORT_FLOAT: _bindgen_ty_1 = 5;
pub type _bindgen_ty_1 = ::core::ffi::c_uint;
pub const JSObjectClassEnum_JS_CLASS_OBJECT: JSObjectClassEnum = 0;
pub const JSObjectClassEnum_JS_CLASS_ARRAY: JSObjectClassEnum = 1;
pub const JSObjectClassEnum_JS_CLASS_C_FUNCTION: JSObjectClassEnum = 2;
pub const JSObjectClassEnum_JS_CLASS_CLOSURE: JSObjectClassEnum = 3;
pub const JSObjectClassEnum_JS_CLASS_NUMBER: JSObjectClassEnum = 4;
pub const JSObjectClassEnum_JS_CLASS_BOOLEAN: JSObjectClassEnum = 5;
pub const JSObjectClassEnum_JS_CLASS_STRING: JSObjectClassEnum = 6;
pub const JSObjectClassEnum_JS_CLASS_DATE: JSObjectClassEnum = 7;
pub const JSObjectClassEnum_JS_CLASS_REGEXP: JSObjectClassEnum = 8;
pub const JSObjectClassEnum_JS_CLASS_ERROR: JSObjectClassEnum = 9;
pub const JSObjectClassEnum_JS_CLASS_EVAL_ERROR: JSObjectClassEnum = 10;
pub const JSObjectClassEnum_JS_CLASS_RANGE_ERROR: JSObjectClassEnum = 11;
pub const JSObjectClassEnum_JS_CLASS_REFERENCE_ERROR: JSObjectClassEnum = 12;
pub const JSObjectClassEnum_JS_CLASS_SYNTAX_ERROR: JSObjectClassEnum = 13;
pub const JSObjectClassEnum_JS_CLASS_TYPE_ERROR: JSObjectClassEnum = 14;
pub const JSObjectClassEnum_JS_CLASS_URI_ERROR: JSObjectClassEnum = 15;
pub const JSObjectClassEnum_JS_CLASS_INTERNAL_ERROR: JSObjectClassEnum = 16;
pub const JSObjectClassEnum_JS_CLASS_ARRAY_BUFFER: JSObjectClassEnum = 17;
pub const JSObjectClassEnum_JS_CLASS_TYPED_ARRAY: JSObjectClassEnum = 18;
pub const JSObjectClassEnum_JS_CLASS_UINT8C_ARRAY: JSObjectClassEnum = 19;
pub const JSObjectClassEnum_JS_CLASS_INT8_ARRAY: JSObjectClassEnum = 20;
pub const JSObjectClassEnum_JS_CLASS_UINT8_ARRAY: JSObjectClassEnum = 21;
pub const JSObjectClassEnum_JS_CLASS_INT16_ARRAY: JSObjectClassEnum = 22;
pub const JSObjectClassEnum_JS_CLASS_UINT16_ARRAY: JSObjectClassEnum = 23;
pub const JSObjectClassEnum_JS_CLASS_INT32_ARRAY: JSObjectClassEnum = 24;
pub const JSObjectClassEnum_JS_CLASS_UINT32_ARRAY: JSObjectClassEnum = 25;
pub const JSObjectClassEnum_JS_CLASS_FLOAT32_ARRAY: JSObjectClassEnum = 26;
pub const JSObjectClassEnum_JS_CLASS_FLOAT64_ARRAY: JSObjectClassEnum = 27;
pub const JSObjectClassEnum_JS_CLASS_USER: JSObjectClassEnum = 28;
pub type JSObjectClassEnum = ::core::ffi::c_uint;
pub const JSCFunctionEnum_JS_CFUNCTION_bound: JSCFunctionEnum = 0;
pub const JSCFunctionEnum_JS_CFUNCTION_USER: JSCFunctionEnum = 1;
pub type JSCFunctionEnum = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSCStringBuf {
    pub buf: [u8; 5usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSCStringBuf"][::core::mem::size_of::<JSCStringBuf>() - 5usize];
    ["Alignment of JSCStringBuf"][::core::mem::align_of::<JSCStringBuf>() - 1usize];
    ["Offset of field: JSCStringBuf::buf"][::core::mem::offset_of!(JSCStringBuf, buf) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSGCRef {
    pub val: JSValue,
    pub prev: *mut JSGCRef,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSGCRef"][::core::mem::size_of::<JSGCRef>() - 16usize];
    ["Alignment of JSGCRef"][::core::mem::align_of::<JSGCRef>() - 8usize];
    ["Offset of field: JSGCRef::val"][::core::mem::offset_of!(JSGCRef, val) - 0usize];
    ["Offset of field: JSGCRef::prev"][::core::mem::offset_of!(JSGCRef, prev) - 8usize];
};
unsafe extern "C" {
    pub fn JS_PushGCRef(ctx: *mut JSContext, ref_: *mut JSGCRef) -> *mut JSValue;
}
unsafe extern "C" {
    pub fn JS_PopGCRef(ctx: *mut JSContext, ref_: *mut JSGCRef) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_AddGCRef(ctx: *mut JSContext, ref_: *mut JSGCRef) -> *mut JSValue;
}
unsafe extern "C" {
    pub fn JS_DeleteGCRef(ctx: *mut JSContext, ref_: *mut JSGCRef);
}
unsafe extern "C" {
    pub fn JS_NewFloat64(ctx: *mut JSContext, d: f64) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewInt32(ctx: *mut JSContext, val: i32) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewUint32(ctx: *mut JSContext, val: u32) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewInt64(ctx: *mut JSContext, val: i64) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_IsNumber(ctx: *mut JSContext, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_IsString(ctx: *mut JSContext, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_IsError(ctx: *mut JSContext, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_IsFunction(ctx: *mut JSContext, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_GetClassID(ctx: *mut JSContext, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_SetOpaque(ctx: *mut JSContext, val: JSValue, opaque: *mut ::core::ffi::c_void);
}
unsafe extern "C" {
    pub fn JS_GetOpaque(ctx: *mut JSContext, val: JSValue) -> *mut ::core::ffi::c_void;
}
pub type JSCFunction = ::core::option::Option<
    unsafe extern "C" fn(
        ctx: *mut JSContext,
        this_val: *mut JSValue,
        argc: ::core::ffi::c_int,
        argv: *mut JSValue,
    ) -> JSValue,
>;
pub type JSCFinalizer = ::core::option::Option<
    unsafe extern "C" fn(ctx: *mut JSContext, opaque: *mut ::core::ffi::c_void),
>;
pub const JSCFunctionDefEnum_JS_CFUNC_generic: JSCFunctionDefEnum = 0;
pub const JSCFunctionDefEnum_JS_CFUNC_generic_magic: JSCFunctionDefEnum = 1;
pub const JSCFunctionDefEnum_JS_CFUNC_constructor: JSCFunctionDefEnum = 2;
pub const JSCFunctionDefEnum_JS_CFUNC_constructor_magic: JSCFunctionDefEnum = 3;
pub const JSCFunctionDefEnum_JS_CFUNC_generic_params: JSCFunctionDefEnum = 4;
pub const JSCFunctionDefEnum_JS_CFUNC_f_f: JSCFunctionDefEnum = 5;
pub type JSCFunctionDefEnum = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Copy, Clone)]
pub union JSCFunctionType {
    pub generic: JSCFunction,
    pub generic_magic: ::core::option::Option<
        unsafe extern "C" fn(
            ctx: *mut JSContext,
            this_val: *mut JSValue,
            argc: ::core::ffi::c_int,
            argv: *mut JSValue,
            magic: ::core::ffi::c_int,
        ) -> JSValue,
    >,
    pub constructor: JSCFunction,
    pub constructor_magic: ::core::option::Option<
        unsafe extern "C" fn(
            ctx: *mut JSContext,
            this_val: *mut JSValue,
            argc: ::core::ffi::c_int,
            argv: *mut JSValue,
            magic: ::core::ffi::c_int,
        ) -> JSValue,
    >,
    pub generic_params: ::core::option::Option<
        unsafe extern "C" fn(
            ctx: *mut JSContext,
            this_val: *mut JSValue,
            argc: ::core::ffi::c_int,
            argv: *mut JSValue,
            params: JSValue,
        ) -> JSValue,
    >,
    pub f_f: ::core::option::Option<unsafe extern "C" fn(f: f64) -> f64>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSCFunctionType"][::core::mem::size_of::<JSCFunctionType>() - 8usize];
    ["Alignment of JSCFunctionType"][::core::mem::align_of::<JSCFunctionType>() - 8usize];
    ["Offset of field: JSCFunctionType::generic"]
        [::core::mem::offset_of!(JSCFunctionType, generic) - 0usize];
    ["Offset of field: JSCFunctionType::generic_magic"]
        [::core::mem::offset_of!(JSCFunctionType, generic_magic) - 0usize];
    ["Offset of field: JSCFunctionType::constructor"]
        [::core::mem::offset_of!(JSCFunctionType, constructor) - 0usize];
    ["Offset of field: JSCFunctionType::constructor_magic"]
        [::core::mem::offset_of!(JSCFunctionType, constructor_magic) - 0usize];
    ["Offset of field: JSCFunctionType::generic_params"]
        [::core::mem::offset_of!(JSCFunctionType, generic_params) - 0usize];
    ["Offset of field: JSCFunctionType::f_f"]
        [::core::mem::offset_of!(JSCFunctionType, f_f) - 0usize];
};
#[repr(C)]
#[derive(Copy, Clone)]
pub struct JSCFunctionDef {
    pub func: JSCFunctionType,
    pub name: JSValue,
    pub def_type: u8,
    pub arg_count: u8,
    pub magic: i16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSCFunctionDef"][::core::mem::size_of::<JSCFunctionDef>() - 24usize];
    ["Alignment of JSCFunctionDef"][::core::mem::align_of::<JSCFunctionDef>() - 8usize];
    ["Offset of field: JSCFunctionDef::func"]
        [::core::mem::offset_of!(JSCFunctionDef, func) - 0usize];
    ["Offset of field: JSCFunctionDef::name"]
        [::core::mem::offset_of!(JSCFunctionDef, name) - 8usize];
    ["Offset of field: JSCFunctionDef::def_type"]
        [::core::mem::offset_of!(JSCFunctionDef, def_type) - 16usize];
    ["Offset of field: JSCFunctionDef::arg_count"]
        [::core::mem::offset_of!(JSCFunctionDef, arg_count) - 17usize];
    ["Offset of field: JSCFunctionDef::magic"]
        [::core::mem::offset_of!(JSCFunctionDef, magic) - 18usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSSTDLibraryDef {
    pub stdlib_table: *const JSWord,
    pub c_function_table: *const JSCFunctionDef,
    pub c_finalizer_table: *const JSCFinalizer,
    pub stdlib_table_len: u32,
    pub stdlib_table_align: u32,
    pub sorted_atoms_offset: u32,
    pub global_object_offset: u32,
    pub class_count: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSSTDLibraryDef"][::core::mem::size_of::<JSSTDLibraryDef>() - 48usize];
    ["Alignment of JSSTDLibraryDef"][::core::mem::align_of::<JSSTDLibraryDef>() - 8usize];
    ["Offset of field: JSSTDLibraryDef::stdlib_table"]
        [::core::mem::offset_of!(JSSTDLibraryDef, stdlib_table) - 0usize];
    ["Offset of field: JSSTDLibraryDef::c_function_table"]
        [::core::mem::offset_of!(JSSTDLibraryDef, c_function_table) - 8usize];
    ["Offset of field: JSSTDLibraryDef::c_finalizer_table"]
        [::core::mem::offset_of!(JSSTDLibraryDef, c_finalizer_table) - 16usize];
    ["Offset of field: JSSTDLibraryDef::stdlib_table_len"]
        [::core::mem::offset_of!(JSSTDLibraryDef, stdlib_table_len) - 24usize];
    ["Offset of field: JSSTDLibraryDef::stdlib_table_align"]
        [::core::mem::offset_of!(JSSTDLibraryDef, stdlib_table_align) - 28usize];
    ["Offset of field: JSSTDLibraryDef::sorted_atoms_offset"]
        [::core::mem::offset_of!(JSSTDLibraryDef, sorted_atoms_offset) - 32usize];
    ["Offset of field: JSSTDLibraryDef::global_object_offset"]
        [::core::mem::offset_of!(JSSTDLibraryDef, global_object_offset) - 36usize];
    ["Offset of field: JSSTDLibraryDef::class_count"]
        [::core::mem::offset_of!(JSSTDLibraryDef, class_count) - 40usize];
};
pub type JSWriteFunc = ::core::option::Option<
    unsafe extern "C" fn(
        opaque: *mut ::core::ffi::c_void,
        buf: *const ::core::ffi::c_void,
        buf_len: usize,
    ),
>;
pub type JSInterruptHandler = ::core::option::Option<
    unsafe extern "C" fn(
        ctx: *mut JSContext,
        opaque: *mut ::core::ffi::c_void,
    ) -> ::core::ffi::c_int,
>;
unsafe extern "C" {
    pub fn JS_NewContext(
        mem_start: *mut ::core::ffi::c_void,
        mem_size: usize,
        stdlib_def: *const JSSTDLibraryDef,
    ) -> *mut JSContext;
}
unsafe extern "C" {
    pub fn JS_NewContext2(
        mem_start: *mut ::core::ffi::c_void,
        mem_size: usize,
        stdlib_def: *const JSSTDLibraryDef,
        prepare_compilation: ::core::ffi::c_int,
    ) -> *mut JSContext;
}
unsafe extern "C" {
    pub fn JS_FreeContext(ctx: *mut JSContext);
}
unsafe extern "C" {
    pub fn JS_SetContextOpaque(ctx: *mut JSContext, opaque: *mut ::core::ffi::c_void);
}
unsafe extern "C" {
    pub fn JS_SetInterruptHandler(ctx: *mut JSContext, interrupt_handler: JSInterruptHandler);
}
unsafe extern "C" {
    pub fn JS_SetRandomSeed(ctx: *mut JSContext, seed: u64);
}
unsafe extern "C" {
    pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_Throw(ctx: *mut JSContext, obj: JSValue) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_ThrowError(
        ctx: *mut JSContext,
        error_num: JSObjectClassEnum,
        fmt: *const ::core::ffi::c_char,
        ...
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_ThrowOutOfMemory(ctx: *mut JSContext) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_GetPropertyStr(
        ctx: *mut JSContext,
        this_obj: JSValue,
        str_: *const ::core::ffi::c_char,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_GetPropertyUint32(ctx: *mut JSContext, obj: JSValue, idx: u32) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_SetPropertyStr(
        ctx: *mut JSContext,
        this_obj: JSValue,
        str_: *const ::core::ffi::c_char,
        val: JSValue,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_SetPropertyUint32(
        ctx: *mut JSContext,
        this_obj: JSValue,
        idx: u32,
        val: JSValue,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewObjectClassUser(ctx: *mut JSContext, class_id: ::core::ffi::c_int) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewObject(ctx: *mut JSContext) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewArray(ctx: *mut JSContext, initial_len: ::core::ffi::c_int) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewCFunctionParams(
        ctx: *mut JSContext,
        func_idx: ::core::ffi::c_int,
        params: JSValue,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_Parse(
        ctx: *mut JSContext,
        input: *const ::core::ffi::c_char,
        input_len: usize,
        filename: *const ::core::ffi::c_char,
        eval_flags: ::core::ffi::c_int,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_Run(ctx: *mut JSContext, val: JSValue) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_Eval(
        ctx: *mut JSContext,
        input: *const ::core::ffi::c_char,
        input_len: usize,
        filename: *const ::core::ffi::c_char,
        eval_flags: ::core::ffi::c_int,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_GC(ctx: *mut JSContext);
}
unsafe extern "C" {
    pub fn JS_NewStringLen(
        ctx: *mut JSContext,
        buf: *const ::core::ffi::c_char,
        buf_len: usize,
    ) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_NewString(ctx: *mut JSContext, buf: *const ::core::ffi::c_char) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_ToCStringLen(
        ctx: *mut JSContext,
        plen: *mut usize,
        val: JSValue,
        buf: *mut JSCStringBuf,
    ) -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn JS_ToCString(
        ctx: *mut JSContext,
        val: JSValue,
        buf: *mut JSCStringBuf,
    ) -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn JS_ToString(ctx: *mut JSContext, val: JSValue) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_ToInt32(
        ctx: *mut JSContext,
        pres: *mut ::core::ffi::c_int,
        val: JSValue,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_ToUint32(ctx: *mut JSContext, pres: *mut u32, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_ToInt32Sat(
        ctx: *mut JSContext,
        pres: *mut ::core::ffi::c_int,
        val: JSValue,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_ToNumber(ctx: *mut JSContext, pres: *mut f64, val: JSValue) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_GetException(ctx: *mut JSContext) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_StackCheck(ctx: *mut JSContext, len: u32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_PushArg(ctx: *mut JSContext, val: JSValue);
}
unsafe extern "C" {
    pub fn JS_Call(ctx: *mut JSContext, call_flags: ::core::ffi::c_int) -> JSValue;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSBytecodeHeader {
    pub magic: u16,
    pub version: u16,
    pub base_addr: usize,
    pub unique_strings: JSValue,
    pub main_func: JSValue,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSBytecodeHeader"][::core::mem::size_of::<JSBytecodeHeader>() - 32usize];
    ["Alignment of JSBytecodeHeader"][::core::mem::align_of::<JSBytecodeHeader>() - 8usize];
    ["Offset of field: JSBytecodeHeader::magic"]
        [::core::mem::offset_of!(JSBytecodeHeader, magic) - 0usize];
    ["Offset of field: JSBytecodeHeader::version"]
        [::core::mem::offset_of!(JSBytecodeHeader, version) - 2usize];
    ["Offset of field: JSBytecodeHeader::base_addr"]
        [::core::mem::offset_of!(JSBytecodeHeader, base_addr) - 8usize];
    ["Offset of field: JSBytecodeHeader::unique_strings"]
        [::core::mem::offset_of!(JSBytecodeHeader, unique_strings) - 16usize];
    ["Offset of field: JSBytecodeHeader::main_func"]
        [::core::mem::offset_of!(JSBytecodeHeader, main_func) - 24usize];
};
unsafe extern "C" {
    pub fn JS_PrepareBytecode(
        ctx: *mut JSContext,
        hdr: *mut JSBytecodeHeader,
        pdata_buf: *mut *const u8,
        pdata_len: *mut u32,
        eval_code: JSValue,
    );
}
unsafe extern "C" {
    pub fn JS_RelocateBytecode2(
        ctx: *mut JSContext,
        hdr: *mut JSBytecodeHeader,
        buf: *mut u8,
        buf_len: u32,
        new_base_addr: usize,
        update_atoms: ::core::ffi::c_int,
    ) -> ::core::ffi::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct JSBytecodeHeader32 {
    pub magic: u16,
    pub version: u16,
    pub base_addr: u32,
    pub unique_strings: u32,
    pub main_func: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of JSBytecodeHeader32"][::core::mem::size_of::<JSBytecodeHeader32>() - 16usize];
    ["Alignment of JSBytecodeHeader32"][::core::mem::align_of::<JSBytecodeHeader32>() - 4usize];
    ["Offset of field: JSBytecodeHeader32::magic"]
        [::core::mem::offset_of!(JSBytecodeHeader32, magic) - 0usize];
    ["Offset of field: JSBytecodeHeader32::version"]
        [::core::mem::offset_of!(JSBytecodeHeader32, version) - 2usize];
    ["Offset of field: JSBytecodeHeader32::base_addr"]
        [::core::mem::offset_of!(JSBytecodeHeader32, base_addr) - 4usize];
    ["Offset of field: JSBytecodeHeader32::unique_strings"]
        [::core::mem::offset_of!(JSBytecodeHeader32, unique_strings) - 8usize];
    ["Offset of field: JSBytecodeHeader32::main_func"]
        [::core::mem::offset_of!(JSBytecodeHeader32, main_func) - 12usize];
};
unsafe extern "C" {
    pub fn JS_PrepareBytecode64to32(
        ctx: *mut JSContext,
        hdr: *mut JSBytecodeHeader32,
        pdata_buf: *mut *const u8,
        pdata_len: *mut u32,
        eval_code: JSValue,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_IsBytecode(buf: *const u8, buf_len: usize) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_RelocateBytecode(
        ctx: *mut JSContext,
        buf: *mut u8,
        buf_len: u32,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn JS_LoadBytecode(ctx: *mut JSContext, buf: *const u8) -> JSValue;
}
unsafe extern "C" {
    pub fn JS_SetLogFunc(ctx: *mut JSContext, write_func: JSWriteFunc);
}
unsafe extern "C" {
    pub fn JS_PrintValue(ctx: *mut JSContext, val: JSValue);
}
unsafe extern "C" {
    pub fn JS_PrintValueF(ctx: *mut JSContext, val: JSValue, flags: ::core::ffi::c_int);
}
unsafe extern "C" {
    pub fn JS_DumpValueF(
        ctx: *mut JSContext,
        str_: *const ::core::ffi::c_char,
        val: JSValue,
        flags: ::core::ffi::c_int,
    );
}
unsafe extern "C" {
    pub fn JS_DumpValue(ctx: *mut JSContext, str_: *const ::core::ffi::c_char, val: JSValue);
}
unsafe extern "C" {
    pub fn JS_DumpMemory(ctx: *mut JSContext, is_long: ::core::ffi::c_int);
}
unsafe extern "C" {
    pub static js_stdlib: JSSTDLibraryDef;
}
pub type JSHostCallback = ::core::option::Option<
    unsafe extern "C" fn(
        ctx: *mut JSContext,
        this_val: *mut JSValue,
        argc: ::core::ffi::c_int,
        argv: *mut JSValue,
        params: JSValue,
    ) -> JSValue,
>;
unsafe extern "C" {
    pub fn JS_SetHostCallback(callback: JSHostCallback);
}
unsafe extern "C" {
    pub fn JS_GetContextOpaque(ctx: *mut JSContext) -> *mut ::core::ffi::c_void;
}