javascriptcore5_rs_sys/
lib.rs

1// Generated by gir (https://github.com/gtk-rs/gir @ 425f84d5af7f)
2// from gir-files (https://github.com/gtk-rs/gir-files.git @ 4eaad6a722bf)
3// from webkit2gtk-gir-files
4// DO NOT EDIT
5
6#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
7#![allow(
8    clippy::approx_constant,
9    clippy::type_complexity,
10    clippy::unreadable_literal,
11    clippy::upper_case_acronyms
12)]
13#![cfg_attr(feature = "dox", feature(doc_cfg))]
14
15#[allow(unused_imports)]
16use libc::{
17    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
18    intptr_t, size_t, ssize_t, uintptr_t, FILE,
19};
20
21#[allow(unused_imports)]
22use glib::{gboolean, gconstpointer, gpointer, GType};
23
24// Enums
25pub type JSCCheckSyntaxMode = c_int;
26pub const JSC_CHECK_SYNTAX_MODE_SCRIPT: JSCCheckSyntaxMode = 0;
27pub const JSC_CHECK_SYNTAX_MODE_MODULE: JSCCheckSyntaxMode = 1;
28
29pub type JSCCheckSyntaxResult = c_int;
30pub const JSC_CHECK_SYNTAX_RESULT_SUCCESS: JSCCheckSyntaxResult = 0;
31pub const JSC_CHECK_SYNTAX_RESULT_RECOVERABLE_ERROR: JSCCheckSyntaxResult = 1;
32pub const JSC_CHECK_SYNTAX_RESULT_IRRECOVERABLE_ERROR: JSCCheckSyntaxResult = 2;
33pub const JSC_CHECK_SYNTAX_RESULT_UNTERMINATED_LITERAL_ERROR: JSCCheckSyntaxResult = 3;
34pub const JSC_CHECK_SYNTAX_RESULT_OUT_OF_MEMORY_ERROR: JSCCheckSyntaxResult = 4;
35pub const JSC_CHECK_SYNTAX_RESULT_STACK_OVERFLOW_ERROR: JSCCheckSyntaxResult = 5;
36
37pub type JSCOptionType = c_int;
38pub const JSC_OPTION_BOOLEAN: JSCOptionType = 0;
39pub const JSC_OPTION_INT: JSCOptionType = 1;
40pub const JSC_OPTION_UINT: JSCOptionType = 2;
41pub const JSC_OPTION_SIZE: JSCOptionType = 3;
42pub const JSC_OPTION_DOUBLE: JSCOptionType = 4;
43pub const JSC_OPTION_STRING: JSCOptionType = 5;
44pub const JSC_OPTION_RANGE_STRING: JSCOptionType = 6;
45
46pub type JSCTypedArrayType = c_int;
47pub const JSC_TYPED_ARRAY_NONE: JSCTypedArrayType = 0;
48pub const JSC_TYPED_ARRAY_INT8: JSCTypedArrayType = 1;
49pub const JSC_TYPED_ARRAY_INT16: JSCTypedArrayType = 2;
50pub const JSC_TYPED_ARRAY_INT32: JSCTypedArrayType = 3;
51pub const JSC_TYPED_ARRAY_INT64: JSCTypedArrayType = 4;
52pub const JSC_TYPED_ARRAY_UINT8: JSCTypedArrayType = 5;
53pub const JSC_TYPED_ARRAY_UINT8_CLAMPED: JSCTypedArrayType = 6;
54pub const JSC_TYPED_ARRAY_UINT16: JSCTypedArrayType = 7;
55pub const JSC_TYPED_ARRAY_UINT32: JSCTypedArrayType = 8;
56pub const JSC_TYPED_ARRAY_UINT64: JSCTypedArrayType = 9;
57pub const JSC_TYPED_ARRAY_FLOAT32: JSCTypedArrayType = 10;
58pub const JSC_TYPED_ARRAY_FLOAT64: JSCTypedArrayType = 11;
59
60// Constants
61pub const JSC_MAJOR_VERSION: c_int = 2;
62pub const JSC_MICRO_VERSION: c_int = 0;
63pub const JSC_MINOR_VERSION: c_int = 38;
64pub const JSC_OPTIONS_USE_DFG: &[u8] = b"useDFGJIT\0";
65pub const JSC_OPTIONS_USE_FTL: &[u8] = b"useFTLJIT\0";
66pub const JSC_OPTIONS_USE_JIT: &[u8] = b"useJIT\0";
67pub const JSC_OPTIONS_USE_LLINT: &[u8] = b"useLLInt\0";
68
69// Flags
70pub type JSCValuePropertyFlags = c_uint;
71pub const JSC_VALUE_PROPERTY_CONFIGURABLE: JSCValuePropertyFlags = 1;
72pub const JSC_VALUE_PROPERTY_ENUMERABLE: JSCValuePropertyFlags = 2;
73pub const JSC_VALUE_PROPERTY_WRITABLE: JSCValuePropertyFlags = 4;
74
75// Callbacks
76pub type JSCClassDeletePropertyFunction = Option<
77    unsafe extern "C" fn(*mut JSCClass, *mut JSCContext, gpointer, *const c_char) -> gboolean,
78>;
79pub type JSCClassEnumeratePropertiesFunction =
80    Option<unsafe extern "C" fn(*mut JSCClass, *mut JSCContext, gpointer) -> *mut *mut c_char>;
81pub type JSCClassGetPropertyFunction = Option<
82    unsafe extern "C" fn(*mut JSCClass, *mut JSCContext, gpointer, *const c_char) -> *mut JSCValue,
83>;
84pub type JSCClassHasPropertyFunction = Option<
85    unsafe extern "C" fn(*mut JSCClass, *mut JSCContext, gpointer, *const c_char) -> gboolean,
86>;
87pub type JSCClassSetPropertyFunction = Option<
88    unsafe extern "C" fn(
89        *mut JSCClass,
90        *mut JSCContext,
91        gpointer,
92        *const c_char,
93        *mut JSCValue,
94    ) -> gboolean,
95>;
96pub type JSCClassVariadicFunction =
97    Option<unsafe extern "C" fn(gpointer, *mut glib::GPtrArray, gpointer) -> *mut JSCValue>;
98pub type JSCConstructor = Option<unsafe extern "C" fn(*mut glib::GPtrArray, gpointer) -> gpointer>;
99pub type JSCExceptionHandler =
100    Option<unsafe extern "C" fn(*mut JSCContext, *mut JSCException, gpointer)>;
101pub type JSCGetter = Option<unsafe extern "C" fn(gpointer) -> *mut JSCValue>;
102pub type JSCOptionsFunc =
103    Option<unsafe extern "C" fn(*const c_char, JSCOptionType, *const c_char, gpointer) -> gboolean>;
104pub type JSCPropertyGetter = Option<unsafe extern "C" fn(gpointer, gpointer) -> *mut JSCValue>;
105pub type JSCPropertySetter = Option<unsafe extern "C" fn(gpointer, *mut JSCValue, gpointer)>;
106pub type JSCSetter = Option<unsafe extern "C" fn(*mut JSCValue, gpointer)>;
107pub type JSCVariadicFunction =
108    Option<unsafe extern "C" fn(*mut glib::GPtrArray, gpointer) -> *mut JSCValue>;
109
110// Records
111#[repr(C)]
112pub struct _JSCClassClass {
113    _data: [u8; 0],
114    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
115}
116
117pub type JSCClassClass = *mut _JSCClassClass;
118
119#[derive(Copy, Clone)]
120#[repr(C)]
121pub struct JSCClassVTable {
122    pub get_property: JSCClassGetPropertyFunction,
123    pub set_property: JSCClassSetPropertyFunction,
124    pub has_property: JSCClassHasPropertyFunction,
125    pub delete_property: JSCClassDeletePropertyFunction,
126    pub enumerate_properties: JSCClassEnumeratePropertiesFunction,
127    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
128    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
129    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
130    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
131}
132
133impl ::std::fmt::Debug for JSCClassVTable {
134    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
135        f.debug_struct(&format!("JSCClassVTable @ {self:p}"))
136            .field("get_property", &self.get_property)
137            .field("set_property", &self.set_property)
138            .field("has_property", &self.has_property)
139            .field("delete_property", &self.delete_property)
140            .field("enumerate_properties", &self.enumerate_properties)
141            .field("_jsc_reserved0", &self._jsc_reserved0)
142            .field("_jsc_reserved1", &self._jsc_reserved1)
143            .field("_jsc_reserved2", &self._jsc_reserved2)
144            .field("_jsc_reserved3", &self._jsc_reserved3)
145            .finish()
146    }
147}
148
149#[derive(Copy, Clone)]
150#[repr(C)]
151pub struct JSCContextClass {
152    pub parent_class: gobject::GObjectClass,
153    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
154    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
155    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
156    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
157}
158
159impl ::std::fmt::Debug for JSCContextClass {
160    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
161        f.debug_struct(&format!("JSCContextClass @ {self:p}"))
162            .field("parent_class", &self.parent_class)
163            .field("_jsc_reserved0", &self._jsc_reserved0)
164            .field("_jsc_reserved1", &self._jsc_reserved1)
165            .field("_jsc_reserved2", &self._jsc_reserved2)
166            .field("_jsc_reserved3", &self._jsc_reserved3)
167            .finish()
168    }
169}
170
171#[repr(C)]
172pub struct _JSCContextPrivate {
173    _data: [u8; 0],
174    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
175}
176
177pub type JSCContextPrivate = *mut _JSCContextPrivate;
178
179#[derive(Copy, Clone)]
180#[repr(C)]
181pub struct JSCExceptionClass {
182    pub parent_class: gobject::GObjectClass,
183    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
184    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
185    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
186    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
187}
188
189impl ::std::fmt::Debug for JSCExceptionClass {
190    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
191        f.debug_struct(&format!("JSCExceptionClass @ {self:p}"))
192            .field("parent_class", &self.parent_class)
193            .field("_jsc_reserved0", &self._jsc_reserved0)
194            .field("_jsc_reserved1", &self._jsc_reserved1)
195            .field("_jsc_reserved2", &self._jsc_reserved2)
196            .field("_jsc_reserved3", &self._jsc_reserved3)
197            .finish()
198    }
199}
200
201#[repr(C)]
202pub struct _JSCExceptionPrivate {
203    _data: [u8; 0],
204    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
205}
206
207pub type JSCExceptionPrivate = *mut _JSCExceptionPrivate;
208
209#[derive(Copy, Clone)]
210#[repr(C)]
211pub struct JSCValueClass {
212    pub parent_class: gobject::GObjectClass,
213    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
214    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
215    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
216    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
217}
218
219impl ::std::fmt::Debug for JSCValueClass {
220    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
221        f.debug_struct(&format!("JSCValueClass @ {self:p}"))
222            .field("parent_class", &self.parent_class)
223            .field("_jsc_reserved0", &self._jsc_reserved0)
224            .field("_jsc_reserved1", &self._jsc_reserved1)
225            .field("_jsc_reserved2", &self._jsc_reserved2)
226            .field("_jsc_reserved3", &self._jsc_reserved3)
227            .finish()
228    }
229}
230
231#[repr(C)]
232pub struct _JSCValuePrivate {
233    _data: [u8; 0],
234    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
235}
236
237pub type JSCValuePrivate = *mut _JSCValuePrivate;
238
239#[derive(Copy, Clone)]
240#[repr(C)]
241pub struct JSCVirtualMachineClass {
242    pub parent_class: gobject::GObjectClass,
243    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
244    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
245    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
246    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
247}
248
249impl ::std::fmt::Debug for JSCVirtualMachineClass {
250    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
251        f.debug_struct(&format!("JSCVirtualMachineClass @ {self:p}"))
252            .field("parent_class", &self.parent_class)
253            .field("_jsc_reserved0", &self._jsc_reserved0)
254            .field("_jsc_reserved1", &self._jsc_reserved1)
255            .field("_jsc_reserved2", &self._jsc_reserved2)
256            .field("_jsc_reserved3", &self._jsc_reserved3)
257            .finish()
258    }
259}
260
261#[repr(C)]
262pub struct _JSCVirtualMachinePrivate {
263    _data: [u8; 0],
264    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
265}
266
267pub type JSCVirtualMachinePrivate = *mut _JSCVirtualMachinePrivate;
268
269#[derive(Copy, Clone)]
270#[repr(C)]
271pub struct JSCWeakValueClass {
272    pub parent_class: gobject::GObjectClass,
273    pub _jsc_reserved0: Option<unsafe extern "C" fn()>,
274    pub _jsc_reserved1: Option<unsafe extern "C" fn()>,
275    pub _jsc_reserved2: Option<unsafe extern "C" fn()>,
276    pub _jsc_reserved3: Option<unsafe extern "C" fn()>,
277}
278
279impl ::std::fmt::Debug for JSCWeakValueClass {
280    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
281        f.debug_struct(&format!("JSCWeakValueClass @ {self:p}"))
282            .field("parent_class", &self.parent_class)
283            .field("_jsc_reserved0", &self._jsc_reserved0)
284            .field("_jsc_reserved1", &self._jsc_reserved1)
285            .field("_jsc_reserved2", &self._jsc_reserved2)
286            .field("_jsc_reserved3", &self._jsc_reserved3)
287            .finish()
288    }
289}
290
291#[repr(C)]
292pub struct _JSCWeakValuePrivate {
293    _data: [u8; 0],
294    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
295}
296
297pub type JSCWeakValuePrivate = *mut _JSCWeakValuePrivate;
298
299#[repr(C)]
300pub struct _JSGlobalContextRef {
301    _data: [u8; 0],
302    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
303}
304
305pub type JSGlobalContextRef = *mut _JSGlobalContextRef;
306
307#[repr(C)]
308pub struct _JSStringRef {
309    _data: [u8; 0],
310    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
311}
312
313pub type JSStringRef = *mut _JSStringRef;
314
315#[repr(C)]
316pub struct _JSValueRef {
317    _data: [u8; 0],
318    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
319}
320
321pub type JSValueRef = *mut _JSValueRef;
322
323// Classes
324#[repr(C)]
325pub struct JSCClass {
326    _data: [u8; 0],
327    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
328}
329
330impl ::std::fmt::Debug for JSCClass {
331    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
332        f.debug_struct(&format!("JSCClass @ {self:p}")).finish()
333    }
334}
335
336#[derive(Copy, Clone)]
337#[repr(C)]
338pub struct JSCContext {
339    pub parent: gobject::GObject,
340    pub priv_: *mut JSCContextPrivate,
341}
342
343impl ::std::fmt::Debug for JSCContext {
344    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
345        f.debug_struct(&format!("JSCContext @ {self:p}"))
346            .field("parent", &self.parent)
347            .finish()
348    }
349}
350
351#[derive(Copy, Clone)]
352#[repr(C)]
353pub struct JSCException {
354    pub parent: gobject::GObject,
355    pub priv_: *mut JSCExceptionPrivate,
356}
357
358impl ::std::fmt::Debug for JSCException {
359    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
360        f.debug_struct(&format!("JSCException @ {self:p}"))
361            .field("parent", &self.parent)
362            .finish()
363    }
364}
365
366#[derive(Copy, Clone)]
367#[repr(C)]
368pub struct JSCValue {
369    pub parent: gobject::GObject,
370    pub priv_: *mut JSCValuePrivate,
371}
372
373impl ::std::fmt::Debug for JSCValue {
374    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
375        f.debug_struct(&format!("JSCValue @ {self:p}"))
376            .field("parent", &self.parent)
377            .finish()
378    }
379}
380
381#[derive(Copy, Clone)]
382#[repr(C)]
383pub struct JSCVirtualMachine {
384    pub parent: gobject::GObject,
385    pub priv_: *mut JSCVirtualMachinePrivate,
386}
387
388impl ::std::fmt::Debug for JSCVirtualMachine {
389    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
390        f.debug_struct(&format!("JSCVirtualMachine @ {self:p}"))
391            .field("parent", &self.parent)
392            .finish()
393    }
394}
395
396#[derive(Copy, Clone)]
397#[repr(C)]
398pub struct JSCWeakValue {
399    pub parent: gobject::GObject,
400    pub priv_: *mut JSCWeakValuePrivate,
401}
402
403impl ::std::fmt::Debug for JSCWeakValue {
404    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
405        f.debug_struct(&format!("JSCWeakValue @ {self:p}"))
406            .field("parent", &self.parent)
407            .finish()
408    }
409}
410
411#[link(name = "javascriptcoregtk-5.0")]
412extern "C" {
413
414    //=========================================================================
415    // JSGlobalContextRef
416    //=========================================================================
417    pub fn JSGlobalContextRetain(context: JSGlobalContextRef);
418    pub fn JSGlobalContextRelease(context: JSGlobalContextRef);
419
420    //=========================================================================
421    // JSStringRef
422    //=========================================================================
423    pub fn JSStringRetain(string: JSStringRef);
424    pub fn JSStringRelease(string: JSStringRef);
425    pub fn JSStringGetMaximumUTF8CStringSize(string: JSStringRef) -> size_t;
426    pub fn JSStringGetUTF8CString(
427        string: JSStringRef,
428        buffer: *mut *mut c_char,
429        buffer_size: size_t,
430    ) -> size_t;
431
432    //=========================================================================
433    // JSValueRef
434    //=========================================================================
435    pub fn JSValueIsArray(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
436    pub fn JSValueProtect(context: JSGlobalContextRef, value: JSValueRef);
437    pub fn JSValueUnprotect(context: JSGlobalContextRef, value: JSValueRef);
438    pub fn JSValueIsBoolean(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
439    pub fn JSValueIsDate(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
440    pub fn JSValueIsObject(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
441    pub fn JSValueIsNull(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
442    pub fn JSValueIsNumber(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
443    pub fn JSValueIsString(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
444    pub fn JSValueIsUndefined(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
445    pub fn JSValueToBoolean(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean;
446    pub fn JSValueToNumber(
447        ctx: JSGlobalContextRef,
448        value: JSValueRef,
449        exception: *mut *mut JSCException,
450    ) -> c_double;
451    pub fn JSValueToStringCopy(
452        ctx: JSGlobalContextRef,
453        value: JSValueRef,
454        exception: *mut JSValueRef,
455    ) -> JSStringRef;
456
457    //=========================================================================
458    // JSCClass
459    //=========================================================================
460    pub fn jsc_class_get_type() -> GType;
461    pub fn jsc_class_add_constructor(
462        jsc_class: *mut JSCClass,
463        name: *const c_char,
464        callback: gobject::GCallback,
465        user_data: gpointer,
466        destroy_notify: glib::GDestroyNotify,
467        return_type: GType,
468        n_params: c_uint,
469        ...
470    ) -> *mut JSCValue;
471    pub fn jsc_class_add_constructor_variadic(
472        jsc_class: *mut JSCClass,
473        name: *const c_char,
474        callback: JSCConstructor,
475        user_data: gpointer,
476        destroy_notify: glib::GDestroyNotify,
477        return_type: GType,
478    ) -> *mut JSCValue;
479    pub fn jsc_class_add_constructorv(
480        jsc_class: *mut JSCClass,
481        name: *const c_char,
482        callback: gobject::GCallback,
483        user_data: gpointer,
484        destroy_notify: glib::GDestroyNotify,
485        return_type: GType,
486        n_parameters: c_uint,
487        parameter_types: *mut GType,
488    ) -> *mut JSCValue;
489    pub fn jsc_class_add_method(
490        jsc_class: *mut JSCClass,
491        name: *const c_char,
492        callback: gobject::GCallback,
493        user_data: gpointer,
494        destroy_notify: glib::GDestroyNotify,
495        return_type: GType,
496        n_params: c_uint,
497        ...
498    );
499    pub fn jsc_class_add_method_variadic(
500        jsc_class: *mut JSCClass,
501        name: *const c_char,
502        callback: JSCClassVariadicFunction,
503        user_data: gpointer,
504        destroy_notify: glib::GDestroyNotify,
505        return_type: GType,
506    );
507    pub fn jsc_class_add_methodv(
508        jsc_class: *mut JSCClass,
509        name: *const c_char,
510        callback: gobject::GCallback,
511        user_data: gpointer,
512        destroy_notify: glib::GDestroyNotify,
513        return_type: GType,
514        n_parameters: c_uint,
515        parameter_types: *mut GType,
516    );
517    pub fn jsc_class_add_property(
518        jsc_class: *mut JSCClass,
519        name: *const c_char,
520        property_type: GType,
521        getter: JSCPropertyGetter,
522        setter: JSCPropertySetter,
523        user_data: gpointer,
524        destroy_notify: glib::GDestroyNotify,
525    );
526    pub fn jsc_class_get_name(jsc_class: *mut JSCClass) -> *const c_char;
527    pub fn jsc_class_get_parent(jsc_class: *mut JSCClass) -> *mut JSCClass;
528
529    //=========================================================================
530    // JSCContext
531    //=========================================================================
532    pub fn jsc_context_get_type() -> GType;
533    pub fn jsc_context_new() -> *mut JSCContext;
534    pub fn jsc_context_new_with_virtual_machine(vm: *mut JSCVirtualMachine) -> *mut JSCContext;
535    pub fn jsc_context_get_current() -> *mut JSCContext;
536    pub fn jsc_context_check_syntax(
537        context: *mut JSCContext,
538        code: *const c_char,
539        length: ssize_t,
540        mode: JSCCheckSyntaxMode,
541        uri: *const c_char,
542        line_number: c_uint,
543        exception: *mut *mut JSCException,
544    ) -> JSCCheckSyntaxResult;
545    pub fn jsc_context_clear_exception(context: *mut JSCContext);
546    pub fn jsc_context_evaluate(
547        context: *mut JSCContext,
548        code: *const c_char,
549        length: ssize_t,
550    ) -> *mut JSCValue;
551    pub fn jsc_context_evaluate_in_object(
552        context: *mut JSCContext,
553        code: *const c_char,
554        length: ssize_t,
555        object_instance: gpointer,
556        object_class: *mut JSCClass,
557        uri: *const c_char,
558        line_number: c_uint,
559        object: *mut *mut JSCValue,
560    ) -> *mut JSCValue;
561    pub fn jsc_context_evaluate_with_source_uri(
562        context: *mut JSCContext,
563        code: *const c_char,
564        length: ssize_t,
565        uri: *const c_char,
566        line_number: c_uint,
567    ) -> *mut JSCValue;
568    pub fn jsc_context_get_exception(context: *mut JSCContext) -> *mut JSCException;
569    pub fn jsc_context_get_global_object(context: *mut JSCContext) -> *mut JSCValue;
570    pub fn jsc_context_get_value(context: *mut JSCContext, name: *const c_char) -> *mut JSCValue;
571    pub fn jsc_context_get_virtual_machine(context: *mut JSCContext) -> *mut JSCVirtualMachine;
572    pub fn jsc_context_pop_exception_handler(context: *mut JSCContext);
573    pub fn jsc_context_push_exception_handler(
574        context: *mut JSCContext,
575        handler: JSCExceptionHandler,
576        user_data: gpointer,
577        destroy_notify: glib::GDestroyNotify,
578    );
579    pub fn jsc_context_register_class(
580        context: *mut JSCContext,
581        name: *const c_char,
582        parent_class: *mut JSCClass,
583        vtable: *mut JSCClassVTable,
584        destroy_notify: glib::GDestroyNotify,
585    ) -> *mut JSCClass;
586    pub fn jsc_context_set_value(
587        context: *mut JSCContext,
588        name: *const c_char,
589        value: *mut JSCValue,
590    );
591    pub fn jsc_context_throw(context: *mut JSCContext, error_message: *const c_char);
592    pub fn jsc_context_throw_exception(context: *mut JSCContext, exception: *mut JSCException);
593    pub fn jsc_context_throw_printf(context: *mut JSCContext, format: *const c_char, ...);
594    pub fn jsc_context_throw_with_name(
595        context: *mut JSCContext,
596        error_name: *const c_char,
597        error_message: *const c_char,
598    );
599    pub fn jsc_context_throw_with_name_printf(
600        context: *mut JSCContext,
601        error_name: *const c_char,
602        format: *const c_char,
603        ...
604    );
605
606    //=========================================================================
607    // JSCException
608    //=========================================================================
609    pub fn jsc_exception_get_type() -> GType;
610    pub fn jsc_exception_new(context: *mut JSCContext, message: *const c_char)
611        -> *mut JSCException;
612    pub fn jsc_exception_new_printf(
613        context: *mut JSCContext,
614        format: *const c_char,
615        ...
616    ) -> *mut JSCException;
617    //pub fn jsc_exception_new_vprintf(context: *mut JSCContext, format: *const c_char, args: /*Unimplemented*/va_list) -> *mut JSCException;
618    pub fn jsc_exception_new_with_name(
619        context: *mut JSCContext,
620        name: *const c_char,
621        message: *const c_char,
622    ) -> *mut JSCException;
623    pub fn jsc_exception_new_with_name_printf(
624        context: *mut JSCContext,
625        name: *const c_char,
626        format: *const c_char,
627        ...
628    ) -> *mut JSCException;
629    //pub fn jsc_exception_new_with_name_vprintf(context: *mut JSCContext, name: *const c_char, format: *const c_char, args: /*Unimplemented*/va_list) -> *mut JSCException;
630    pub fn jsc_exception_get_backtrace_string(exception: *mut JSCException) -> *const c_char;
631    pub fn jsc_exception_get_column_number(exception: *mut JSCException) -> c_uint;
632    pub fn jsc_exception_get_line_number(exception: *mut JSCException) -> c_uint;
633    pub fn jsc_exception_get_message(exception: *mut JSCException) -> *const c_char;
634    pub fn jsc_exception_get_name(exception: *mut JSCException) -> *const c_char;
635    pub fn jsc_exception_get_source_uri(exception: *mut JSCException) -> *const c_char;
636    pub fn jsc_exception_report(exception: *mut JSCException) -> *mut c_char;
637    pub fn jsc_exception_to_string(exception: *mut JSCException) -> *mut c_char;
638
639    //=========================================================================
640    // JSCValue
641    //=========================================================================
642    pub fn jsc_value_get_type() -> GType;
643    pub fn jsc_value_new_array(
644        context: *mut JSCContext,
645        first_item_type: GType,
646        ...
647    ) -> *mut JSCValue;
648    #[cfg(any(feature = "v2_38", feature = "dox"))]
649    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
650    pub fn jsc_value_new_array_buffer(
651        context: *mut JSCContext,
652        data: gpointer,
653        size: size_t,
654        destroy_notify: glib::GDestroyNotify,
655        user_data: gpointer,
656    ) -> *mut JSCValue;
657    pub fn jsc_value_new_array_from_garray(
658        context: *mut JSCContext,
659        array: *mut glib::GPtrArray,
660    ) -> *mut JSCValue;
661    pub fn jsc_value_new_array_from_strv(
662        context: *mut JSCContext,
663        strv: *const *const c_char,
664    ) -> *mut JSCValue;
665    pub fn jsc_value_new_boolean(context: *mut JSCContext, value: gboolean) -> *mut JSCValue;
666    #[cfg(any(feature = "v2_28", feature = "dox"))]
667    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
668    pub fn jsc_value_new_from_json(context: *mut JSCContext, json: *const c_char) -> *mut JSCValue;
669    pub fn jsc_value_new_function(
670        context: *mut JSCContext,
671        name: *const c_char,
672        callback: gobject::GCallback,
673        user_data: gpointer,
674        destroy_notify: glib::GDestroyNotify,
675        return_type: GType,
676        n_params: c_uint,
677        ...
678    ) -> *mut JSCValue;
679    pub fn jsc_value_new_function_variadic(
680        context: *mut JSCContext,
681        name: *const c_char,
682        callback: JSCVariadicFunction,
683        user_data: gpointer,
684        destroy_notify: glib::GDestroyNotify,
685        return_type: GType,
686    ) -> *mut JSCValue;
687    pub fn jsc_value_new_functionv(
688        context: *mut JSCContext,
689        name: *const c_char,
690        callback: gobject::GCallback,
691        user_data: gpointer,
692        destroy_notify: glib::GDestroyNotify,
693        return_type: GType,
694        n_parameters: c_uint,
695        parameter_types: *mut GType,
696    ) -> *mut JSCValue;
697    pub fn jsc_value_new_null(context: *mut JSCContext) -> *mut JSCValue;
698    pub fn jsc_value_new_number(context: *mut JSCContext, number: c_double) -> *mut JSCValue;
699    pub fn jsc_value_new_object(
700        context: *mut JSCContext,
701        instance: gpointer,
702        jsc_class: *mut JSCClass,
703    ) -> *mut JSCValue;
704    pub fn jsc_value_new_string(context: *mut JSCContext, string: *const c_char) -> *mut JSCValue;
705    pub fn jsc_value_new_string_from_bytes(
706        context: *mut JSCContext,
707        bytes: *mut glib::GBytes,
708    ) -> *mut JSCValue;
709    #[cfg(any(feature = "v2_38", feature = "dox"))]
710    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
711    pub fn jsc_value_new_typed_array(
712        context: *mut JSCContext,
713        type_: JSCTypedArrayType,
714        length: size_t,
715    ) -> *mut JSCValue;
716    pub fn jsc_value_new_undefined(context: *mut JSCContext) -> *mut JSCValue;
717    #[cfg(any(feature = "v2_38", feature = "dox"))]
718    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
719    pub fn jsc_value_array_buffer_get_data(value: *mut JSCValue, size: *mut size_t) -> gpointer;
720    #[cfg(any(feature = "v2_38", feature = "dox"))]
721    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
722    pub fn jsc_value_array_buffer_get_size(value: *mut JSCValue) -> size_t;
723    pub fn jsc_value_constructor_call(
724        value: *mut JSCValue,
725        first_parameter_type: GType,
726        ...
727    ) -> *mut JSCValue;
728    pub fn jsc_value_constructor_callv(
729        value: *mut JSCValue,
730        n_parameters: c_uint,
731        parameters: *mut *mut JSCValue,
732    ) -> *mut JSCValue;
733    pub fn jsc_value_function_call(
734        value: *mut JSCValue,
735        first_parameter_type: GType,
736        ...
737    ) -> *mut JSCValue;
738    pub fn jsc_value_function_callv(
739        value: *mut JSCValue,
740        n_parameters: c_uint,
741        parameters: *mut *mut JSCValue,
742    ) -> *mut JSCValue;
743    pub fn jsc_value_get_context(value: *mut JSCValue) -> *mut JSCContext;
744    pub fn jsc_value_is_array(value: *mut JSCValue) -> gboolean;
745    #[cfg(any(feature = "v2_38", feature = "dox"))]
746    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
747    pub fn jsc_value_is_array_buffer(value: *mut JSCValue) -> gboolean;
748    pub fn jsc_value_is_boolean(value: *mut JSCValue) -> gboolean;
749    pub fn jsc_value_is_constructor(value: *mut JSCValue) -> gboolean;
750    pub fn jsc_value_is_function(value: *mut JSCValue) -> gboolean;
751    pub fn jsc_value_is_null(value: *mut JSCValue) -> gboolean;
752    pub fn jsc_value_is_number(value: *mut JSCValue) -> gboolean;
753    pub fn jsc_value_is_object(value: *mut JSCValue) -> gboolean;
754    pub fn jsc_value_is_string(value: *mut JSCValue) -> gboolean;
755    #[cfg(any(feature = "v2_38", feature = "dox"))]
756    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
757    pub fn jsc_value_is_typed_array(value: *mut JSCValue) -> gboolean;
758    pub fn jsc_value_is_undefined(value: *mut JSCValue) -> gboolean;
759    #[cfg(any(feature = "v2_38", feature = "dox"))]
760    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
761    pub fn jsc_value_new_typed_array_with_buffer(
762        array_buffer: *mut JSCValue,
763        type_: JSCTypedArrayType,
764        offset: size_t,
765        length: ssize_t,
766    ) -> *mut JSCValue;
767    pub fn jsc_value_object_define_property_accessor(
768        value: *mut JSCValue,
769        property_name: *const c_char,
770        flags: JSCValuePropertyFlags,
771        property_type: GType,
772        getter: JSCGetter,
773        setter: JSCSetter,
774        user_data: gpointer,
775        destroy_notify: glib::GDestroyNotify,
776    );
777    pub fn jsc_value_object_define_property_data(
778        value: *mut JSCValue,
779        property_name: *const c_char,
780        flags: JSCValuePropertyFlags,
781        property_value: *mut JSCValue,
782    );
783    pub fn jsc_value_object_delete_property(value: *mut JSCValue, name: *const c_char) -> gboolean;
784    pub fn jsc_value_object_enumerate_properties(value: *mut JSCValue) -> *mut *mut c_char;
785    pub fn jsc_value_object_get_property(
786        value: *mut JSCValue,
787        name: *const c_char,
788    ) -> *mut JSCValue;
789    pub fn jsc_value_object_get_property_at_index(
790        value: *mut JSCValue,
791        index: c_uint,
792    ) -> *mut JSCValue;
793    pub fn jsc_value_object_has_property(value: *mut JSCValue, name: *const c_char) -> gboolean;
794    pub fn jsc_value_object_invoke_method(
795        value: *mut JSCValue,
796        name: *const c_char,
797        first_parameter_type: GType,
798        ...
799    ) -> *mut JSCValue;
800    pub fn jsc_value_object_invoke_methodv(
801        value: *mut JSCValue,
802        name: *const c_char,
803        n_parameters: c_uint,
804        parameters: *mut *mut JSCValue,
805    ) -> *mut JSCValue;
806    pub fn jsc_value_object_is_instance_of(value: *mut JSCValue, name: *const c_char) -> gboolean;
807    pub fn jsc_value_object_set_property(
808        value: *mut JSCValue,
809        name: *const c_char,
810        property: *mut JSCValue,
811    );
812    pub fn jsc_value_object_set_property_at_index(
813        value: *mut JSCValue,
814        index: c_uint,
815        property: *mut JSCValue,
816    );
817    pub fn jsc_value_to_boolean(value: *mut JSCValue) -> gboolean;
818    pub fn jsc_value_to_double(value: *mut JSCValue) -> c_double;
819    pub fn jsc_value_to_int32(value: *mut JSCValue) -> i32;
820    #[cfg(any(feature = "v2_28", feature = "dox"))]
821    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_28")))]
822    pub fn jsc_value_to_json(value: *mut JSCValue, indent: c_uint) -> *mut c_char;
823    pub fn jsc_value_to_string(value: *mut JSCValue) -> *mut c_char;
824    pub fn jsc_value_to_string_as_bytes(value: *mut JSCValue) -> *mut glib::GBytes;
825    #[cfg(any(feature = "v2_38", feature = "dox"))]
826    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
827    pub fn jsc_value_typed_array_get_buffer(value: *mut JSCValue) -> *mut JSCValue;
828    #[cfg(any(feature = "v2_38", feature = "dox"))]
829    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
830    pub fn jsc_value_typed_array_get_data(value: *mut JSCValue, length: *mut size_t) -> gpointer;
831    #[cfg(any(feature = "v2_38", feature = "dox"))]
832    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
833    pub fn jsc_value_typed_array_get_length(value: *mut JSCValue) -> size_t;
834    #[cfg(any(feature = "v2_38", feature = "dox"))]
835    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
836    pub fn jsc_value_typed_array_get_offset(value: *mut JSCValue) -> size_t;
837    #[cfg(any(feature = "v2_38", feature = "dox"))]
838    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
839    pub fn jsc_value_typed_array_get_size(value: *mut JSCValue) -> size_t;
840    #[cfg(any(feature = "v2_38", feature = "dox"))]
841    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_38")))]
842    pub fn jsc_value_typed_array_get_type(value: *mut JSCValue) -> JSCTypedArrayType;
843
844    //=========================================================================
845    // JSCVirtualMachine
846    //=========================================================================
847    pub fn jsc_virtual_machine_get_type() -> GType;
848    pub fn jsc_virtual_machine_new() -> *mut JSCVirtualMachine;
849
850    //=========================================================================
851    // JSCWeakValue
852    //=========================================================================
853    pub fn jsc_weak_value_get_type() -> GType;
854    pub fn jsc_weak_value_new(value: *mut JSCValue) -> *mut JSCWeakValue;
855    pub fn jsc_weak_value_get_value(weak_value: *mut JSCWeakValue) -> *mut JSCValue;
856
857    //=========================================================================
858    // Other functions
859    //=========================================================================
860    pub fn jsc_get_major_version() -> c_uint;
861    pub fn jsc_get_micro_version() -> c_uint;
862    pub fn jsc_get_minor_version() -> c_uint;
863    pub fn jsc_options_foreach(function: JSCOptionsFunc, user_data: gpointer);
864    pub fn jsc_options_get_boolean(option: *const c_char, value: *mut gboolean) -> gboolean;
865    pub fn jsc_options_get_double(option: *const c_char, value: *mut c_double) -> gboolean;
866    pub fn jsc_options_get_int(option: *const c_char, value: *mut c_int) -> gboolean;
867    pub fn jsc_options_get_option_group() -> *mut glib::GOptionGroup;
868    pub fn jsc_options_get_range_string(option: *const c_char, value: *mut *mut c_char)
869        -> gboolean;
870    pub fn jsc_options_get_size(option: *const c_char, value: *mut size_t) -> gboolean;
871    pub fn jsc_options_get_string(option: *const c_char, value: *mut *mut c_char) -> gboolean;
872    pub fn jsc_options_get_uint(option: *const c_char, value: *mut c_uint) -> gboolean;
873    pub fn jsc_options_set_boolean(option: *const c_char, value: gboolean) -> gboolean;
874    pub fn jsc_options_set_double(option: *const c_char, value: c_double) -> gboolean;
875    pub fn jsc_options_set_int(option: *const c_char, value: c_int) -> gboolean;
876    pub fn jsc_options_set_range_string(option: *const c_char, value: *const c_char) -> gboolean;
877    pub fn jsc_options_set_size(option: *const c_char, value: size_t) -> gboolean;
878    pub fn jsc_options_set_string(option: *const c_char, value: *const c_char) -> gboolean;
879    pub fn jsc_options_set_uint(option: *const c_char, value: c_uint) -> gboolean;
880
881}