1 /* javascriptcoregtk-4.0.vapi generated by vapigen, do not modify. */
3 [CCode (cprefix = "JS", gir_namespace = "JavaScript", gir_version = "4.0", lower_case_cprefix = "JS_")]
4 [Version (deprecated = true, deprecated_since = "2.22")]
6 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "void", free_function = "JSClassRelease", has_type_id = false)]
9 [CCode (cname = "JSClassRelease")]
11 public void release ();
12 [CCode (cname = "JSClassRetain")]
13 public JS.Class retain ();
15 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSContext", free_function = "", has_type_id = false)]
17 public class Context {
18 [CCode (cname = "JSCheckScriptSyntax")]
19 public bool check_script_syntax (JS.String script, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null);
20 [CCode (cname = "JSGarbageCollect")]
21 public void collect_garbage ();
22 [CCode (cname = "JSEvaluateScript")]
23 public unowned JS.Value? evaluate_script (JS.String script, JS.Object? this_object = null, JS.String? source_url = null, int starting_line_number = 1, out JS.Value? exception = null);
25 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSContext", free_function = "JSGlobalContextRelease", has_type_id = false)]
27 public class GlobalContext : JS.Context {
28 [CCode (cname = "JSGlobalContextCreate")]
29 public GlobalContext (JS.Class? global_object_class = null);
30 [CCode (cname = "JSGlobalContextRelease")]
32 public void release ();
33 [CCode (cname = "JSGlobalContextRetain")]
34 public JS.GlobalContext retain ();
36 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSValue", free_function = "", has_type_id = false)]
39 [CCode (cname = "JSObjectCallAsFunction", instance_pos = 1.1)]
40 public JS.Value call_as_function (JS.Context ctx, JS.Object? this_object, [CCode (array_length_pos = 2.5)] JS.Value[]? arguments, out JS.Value? exception);
41 [CCode (cname = "JSObjectGetProperty", instance_pos = 1.1)]
42 public JS.Value get_property (JS.Context ctx, JS.String property_name, out JS.Value? exception);
43 [CCode (cname = "JSObjectHasProperty", instance_pos = 1.1)]
44 public bool has_property (JS.Context ctx, JS.String property_name);
45 [CCode (cname = "JSObjectMakeFunction")]
46 public Object.make_function (JS.String? name, [CCode (array_length_pos = 1.5)] JS.String[]? parameter_names, JS.String body, JS.String? source_url, int starting_line_number, out JS.Value? exception);
48 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "struct OpaqueJSString", free_function = "JSStringRelease", has_type_id = false)]
51 [CCode (cname = "JSStringCreateWithUTF8CString")]
52 public String.create_with_utf8_cstring (string str);
53 [CCode (cname = "JSStringGetLength")]
54 public size_t get_length ();
55 [CCode (cname = "JSStringGetMaximumUTF8CStringSize")]
56 public size_t get_maximum_utf8_cstring_size ();
57 [CCode (cname = "JSStringGetUTF8CString")]
58 public size_t get_utf8_cstring ([CCode (array_length_type = "gsize")] uint8[] buffer);
59 [CCode (cname = "JSStringIsEqual")]
60 public bool is_equal (JS.String b);
61 [CCode (cname = "JSStringIsEqualToUTF8CString")]
62 public bool is_equal_to_utf8_cstring (string b);
63 [CCode (cname = "JSStringRelease")]
65 public void release ();
66 [CCode (cname = "JSStringRetain")]
67 public JS.String retain ();
69 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "const struct OpaqueJSValue", free_function = "", has_type_id = false)]
72 [CCode (cname = "JSValueGetType", instance_pos = 1.1)]
73 public JS.Type get_type (JS.Context ctx);
74 [CCode (cname = "JSValueGetTypedArrayType", instance_pos = 1.1)]
75 public JS.TypedArrayType get_typed_array_type (JS.Context ctx);
76 [CCode (cname = "JSValueIsArray", instance_pos = 1.1)]
77 public bool is_array (JS.Context ctx);
78 [CCode (cname = "JSValueIsBoolean", instance_pos = 1.1)]
79 public bool is_boolean (JS.Context ctx);
80 [CCode (cname = "JSValueIsDate", instance_pos = 1.1)]
81 public bool is_date (JS.Context ctx);
82 [CCode (cname = "JSValueIsEqual", instance_pos = 1.1)]
83 public bool is_equal (JS.Context ctx, JS.Value b, out JS.Value? exception = null);
84 [CCode (cname = "JSValueIsNull", instance_pos = 1.1)]
85 public bool is_null (JS.Context ctx);
86 [CCode (cname = "JSValueIsNumber", instance_pos = 1.1)]
87 public bool is_number (JS.Context ctx);
88 [CCode (cname = "JSValueIsObject", instance_pos = 1.1)]
89 public bool is_object (JS.Context ctx);
90 [CCode (cname = "JSValueIsObjectOfClass", instance_pos = 1.1)]
91 public bool is_object_of_class (JS.Context ctx, JS.Class js_class);
92 [CCode (cname = "JSValueIsStrictEqual", instance_pos = 1.1)]
93 public bool is_strict_equal (JS.Context ctx, JS.Value b);
94 [CCode (cname = "JSValueIsString", instance_pos = 1.1)]
95 public bool is_string (JS.Context ctx);
96 [CCode (cname = "JSValueIsUndefined", instance_pos = 1.1)]
97 public bool is_undefined (JS.Context ctx);
98 [CCode (cname = "JSValueProtect", instance_pos = 1.1)]
99 public void protect (JS.Context ctx);
100 [CCode (cname = "JSValueToBoolean", instance_pos = 1.1)]
101 public bool to_boolean (JS.Context ctx);
102 [CCode (cname = "JSValueToNumber", instance_pos = 1.1)]
103 public double to_number (JS.Context ctx, out JS.Value? exception = null);
104 [CCode (cname = "JSValueToObject", instance_pos = 1.1)]
105 public JS.Object to_object (JS.Context ctx, out JS.Value? exception = null);
106 [CCode (cname = "JSValueToStringCopy", instance_pos = 1.1)]
107 public JS.String to_string_copy (JS.Context ctx, out JS.Value? exception = null);
108 [CCode (cname = "JSValueUnprotect", instance_pos = 1.1)]
109 public void unprotect (JS.Context ctx);
111 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSType", has_type_id = false)]
113 [CCode (cname = "kJSTypeUndefined")]
115 [CCode (cname = "kJSTypeNull")]
117 [CCode (cname = "kJSTypeBoolean")]
119 [CCode (cname = "kJSTypeNumber")]
121 [CCode (cname = "kJSTypeString")]
123 [CCode (cname = "kJSTypeObject")]
126 [CCode (cheader_filename = "JavaScriptCore/JavaScript.h", cname = "JSTypedArrayType", has_type_id = false)]
127 public enum TypedArrayType {
128 [CCode (cname = "kJSTypedArrayTypeInt8Array")]
130 [CCode (cname = "kJSTypedArrayTypeInt16Array")]
132 [CCode (cname = "kJSTypedArrayTypeInt32Array")]
134 [CCode (cname = "kJSTypedArrayTypeUint8Array")]
136 [CCode (cname = "kJSTypedArrayTypeUint8ClampedArray")]
138 [CCode (cname = "kJSTypedArrayTypeUint16Array")]
140 [CCode (cname = "kJSTypedArrayTypeUint32Array")]
142 [CCode (cname = "kJSTypedArrayTypeFloat32Array")]
144 [CCode (cname = "kJSTypedArrayTypeFloat64Array")]
146 [CCode (cname = "kJSTypedArrayTypeArrayBuffer")]
148 [CCode (cname = "kJSTypedArrayTypeNone")]
152 [CCode (cprefix = "JSC", gir_namespace = "JavaScriptCore", gir_version = "4.0", lower_case_cprefix = "jsc_")]
154 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_class_get_type ()")]
155 public class Class : GLib.Object {
156 [CCode (has_construct_function = false)]
158 public JSC.Value add_constructor_variadic (string? name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667)] owned GLib.Callback callback, GLib.Type return_type);
159 public JSC.Value add_constructorv (string? name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667)] owned GLib.Callback callback, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", array_length_pos = 3.5, array_length_type = "guint")] GLib.Type[]? parameter_types);
160 public void add_method_variadic (string name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667)] owned GLib.Callback callback, GLib.Type return_type);
161 public void add_methodv (string name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667)] owned GLib.Callback callback, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", array_length_pos = 3.5, array_length_type = "guint")] GLib.Type[]? parameter_types);
162 public void add_property (string name, GLib.Type property_type, [CCode (scope = "async")] GLib.Callback? getter, [CCode (scope = "async")] GLib.Callback? setter, void* user_data, GLib.DestroyNotify? destroy_notify);
163 public unowned string get_name ();
164 public unowned JSC.Class get_parent ();
166 public JSC.Context context { owned get; construct; }
167 public string name { get; construct; }
168 public JSC.Class parent { get; construct; }
170 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_context_get_type ()")]
171 public class Context : GLib.Object {
172 [CCode (has_construct_function = false)]
174 public JSC.CheckSyntaxResult check_syntax (string code, ssize_t length, JSC.CheckSyntaxMode mode, string uri, uint line_number, out JSC.Exception exception);
175 public void clear_exception ();
176 public JSC.Value evaluate (string code, ssize_t length);
177 public JSC.Value evaluate_in_object (string code, ssize_t length, void* object_instance, JSC.Class? object_class, string uri, uint line_number, out JSC.Value object);
178 public JSC.Value evaluate_with_source_uri (string code, ssize_t length, string uri, uint line_number);
179 public static unowned JSC.Context? get_current ();
180 public unowned JSC.Exception? get_exception ();
181 public JSC.Value get_global_object ();
182 public JSC.Value get_value (string name);
183 public unowned JSC.VirtualMachine get_virtual_machine ();
184 public void pop_exception_handler ();
185 public void push_exception_handler (owned JSC.ExceptionHandler handler);
186 public unowned JSC.Class register_class (string name, JSC.Class? parent_class, JSC.ClassVTable? vtable, GLib.DestroyNotify? destroy_notify);
187 public void set_value (string name, JSC.Value value);
188 public void @throw (string error_message);
189 public void throw_exception (JSC.Exception exception);
190 [CCode (has_construct_function = false)]
191 public Context.with_virtual_machine (JSC.VirtualMachine vm);
192 public JSC.VirtualMachine virtual_machine { get; construct; }
194 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_exception_get_type ()")]
195 public class Exception : GLib.Object {
196 [CCode (has_construct_function = false)]
197 public Exception (JSC.Context context, string message);
198 public uint get_line_number ();
199 public unowned string get_message ();
200 public unowned string? get_source_uri ();
202 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_value_get_type ()")]
203 public class Value : GLib.Object {
204 [CCode (has_construct_function = false)]
206 [CCode (has_construct_function = false)]
207 public Value.array_from_garray (JSC.Context context, GLib.GenericArray<JSC.Value>? array);
208 [CCode (has_construct_function = false)]
209 public Value.array_from_strv (JSC.Context context, [CCode (array_length = false, array_null_terminated = true)] global::string[] strv);
210 [CCode (has_construct_function = false)]
211 public Value.boolean (JSC.Context context, bool value);
212 public JSC.Value constructor_callv ([CCode (array_length_cname = "n_parameters", array_length_pos = 0.5, array_length_type = "guint")] JSC.Value[]? parameters);
213 public JSC.Value function_callv ([CCode (array_length_cname = "n_parameters", array_length_pos = 0.5, array_length_type = "guint")] JSC.Value[]? parameters);
214 [CCode (has_construct_function = false)]
215 public Value.function_variadic (JSC.Context context, global::string? name, [CCode (delegate_target_pos = 3.33333, destroy_notify_pos = 3.66667)] owned GLib.Callback callback, GLib.Type return_type);
216 [CCode (has_construct_function = false)]
217 public Value.functionv (JSC.Context context, global::string? name, [CCode (delegate_target_pos = 3.33333, destroy_notify_pos = 3.66667)] owned GLib.Callback callback, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", array_length_pos = 4.5, array_length_type = "guint")] GLib.Type[]? parameter_types);
218 public unowned JSC.Context get_context ();
219 public bool is_array ();
220 public bool is_boolean ();
221 public bool is_constructor ();
222 public bool is_function ();
223 public bool is_null ();
224 public bool is_number ();
225 public bool is_object ();
226 public bool is_string ();
227 public bool is_undefined ();
228 [CCode (has_construct_function = false)]
229 public Value.@null (JSC.Context context);
230 [CCode (has_construct_function = false)]
231 public Value.number (JSC.Context context, double number);
232 [CCode (has_construct_function = false)]
233 public Value.object (JSC.Context context, void* instance, JSC.Class? jsc_class);
234 public void object_define_property_accessor (global::string property_name, JSC.ValuePropertyFlags flags, GLib.Type property_type, [CCode (scope = "async")] GLib.Callback? getter, [CCode (scope = "async")] GLib.Callback? setter, void* user_data, GLib.DestroyNotify? destroy_notify);
235 public void object_define_property_data (global::string property_name, JSC.ValuePropertyFlags flags, JSC.Value? property_value);
236 public bool object_delete_property (global::string name);
237 [CCode (array_length = false, array_null_terminated = true)]
238 public global::string[]? object_enumerate_properties ();
239 public JSC.Value object_get_property (global::string name);
240 public JSC.Value object_get_property_at_index (uint index);
241 public bool object_has_property (global::string name);
242 public JSC.Value object_invoke_methodv (global::string name, [CCode (array_length_cname = "n_parameters", array_length_pos = 1.5, array_length_type = "guint")] JSC.Value[]? parameters);
243 public bool object_is_instance_of (global::string name);
244 public void object_set_property (global::string name, JSC.Value property);
245 public void object_set_property_at_index (uint index, JSC.Value property);
246 [CCode (has_construct_function = false)]
247 public Value.string (JSC.Context context, global::string? string);
248 [CCode (has_construct_function = false)]
249 public Value.string_from_bytes (JSC.Context context, GLib.Bytes? bytes);
250 public bool to_boolean ();
251 public double to_double ();
252 public int32 to_int32 ();
253 public global::string to_string ();
254 public GLib.Bytes to_string_as_bytes ();
255 [CCode (has_construct_function = false)]
256 public Value.undefined (JSC.Context context);
257 public JSC.Context context { get; construct; }
259 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_virtual_machine_get_type ()")]
260 public class VirtualMachine : GLib.Object {
261 [CCode (has_construct_function = false)]
262 public VirtualMachine ();
264 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_weak_value_get_type ()")]
265 public class WeakValue : GLib.Object {
266 [CCode (has_construct_function = false)]
267 public WeakValue (JSC.Value value);
268 public JSC.Value get_value ();
270 public JSC.Value value { construct; }
271 public signal void cleared ();
273 [CCode (cheader_filename = "jsc/jsc.h", has_type_id = false)]
274 public struct ClassVTable {
275 public weak JSC.ClassGetPropertyFunction get_property;
276 public weak JSC.ClassSetPropertyFunction set_property;
277 public weak JSC.ClassHasPropertyFunction has_property;
278 public weak JSC.ClassDeletePropertyFunction delete_property;
279 public weak JSC.ClassEnumeratePropertiesFunction enumerate_properties;
281 [CCode (cheader_filename = "jsc/jsc.h", cprefix = "JSC_CHECK_SYNTAX_MODE_", has_type_id = false)]
282 public enum CheckSyntaxMode {
286 [CCode (cheader_filename = "jsc/jsc.h", cprefix = "JSC_CHECK_SYNTAX_RESULT_", has_type_id = false)]
287 public enum CheckSyntaxResult {
291 UNTERMINATED_LITERAL_ERROR,
295 [CCode (cheader_filename = "jsc/jsc.h", cprefix = "JSC_VALUE_PROPERTY_", has_type_id = false)]
297 public enum ValuePropertyFlags {
302 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
303 public delegate bool ClassDeletePropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
304 [CCode (array_length = false, array_null_terminated = true, cheader_filename = "jsc/jsc.h", has_target = false)]
305 public delegate string[]? ClassEnumeratePropertiesFunction (JSC.Class jsc_class, JSC.Context context, void* instance);
306 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
307 public delegate JSC.Value? ClassGetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
308 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
309 public delegate bool ClassHasPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
310 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
311 public delegate bool ClassSetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name, JSC.Value value);
312 [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 2.9)]
313 public delegate void ExceptionHandler (JSC.Context context, JSC.Exception exception);
314 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MAJOR_VERSION")]
315 public const int MAJOR_VERSION;
316 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MICRO_VERSION")]
317 public const int MICRO_VERSION;
318 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MINOR_VERSION")]
319 public const int MINOR_VERSION;
320 [CCode (cheader_filename = "jsc/jsc.h")]
321 public static uint get_major_version ();
322 [CCode (cheader_filename = "jsc/jsc.h")]
323 public static uint get_micro_version ();
324 [CCode (cheader_filename = "jsc/jsc.h")]
325 public static uint get_minor_version ();