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