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")] ref 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 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);
159 public unowned string get_name ();
160 public unowned JSC.Class get_parent ();
162 public JSC.Context context { owned get; construct; }
163 public string name { get; construct; }
164 public JSC.Class parent { get; construct; }
166 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_context_get_type ()")]
167 public class Context : GLib.Object {
168 [CCode (has_construct_function = false)]
170 public void clear_exception ();
171 public JSC.Value evaluate (string code, ssize_t length);
172 public JSC.Value evaluate_with_source_uri (string code, ssize_t length, string uri);
173 public static unowned JSC.Context? get_current ();
174 public unowned JSC.Exception? get_exception ();
175 public JSC.Value get_value (string name);
176 public unowned JSC.VirtualMachine get_virtual_machine ();
177 public void pop_exception_handler ();
178 public void push_exception_handler (owned JSC.ExceptionHandler handler);
179 public unowned JSC.Class register_class (string name, JSC.Class? parent_class, JSC.ClassVTable? vtable, GLib.DestroyNotify? destroy_notify);
180 public void set_value (string name, JSC.Value value);
181 public void @throw (string error_message);
182 public void throw_exception (JSC.Exception exception);
183 [CCode (has_construct_function = false)]
184 public Context.with_virtual_machine (JSC.VirtualMachine vm);
185 public JSC.VirtualMachine virtual_machine { get; construct; }
187 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_exception_get_type ()")]
188 public class Exception : GLib.Object {
189 [CCode (has_construct_function = false)]
190 public Exception (JSC.Context context, string message);
191 public uint get_line_number ();
192 public unowned string get_message ();
193 public unowned string? get_source_uri ();
195 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_value_get_type ()")]
196 public class Value : GLib.Object {
197 [CCode (has_construct_function = false)]
199 [CCode (has_construct_function = false)]
200 public Value.array_from_garray (JSC.Context context, GLib.GenericArray<JSC.Value>? array);
201 [CCode (has_construct_function = false)]
202 public Value.boolean (JSC.Context context, bool value);
203 public unowned JSC.Context get_context ();
204 public bool is_array ();
205 public bool is_boolean ();
206 public bool is_constructor ();
207 public bool is_function ();
208 public bool is_null ();
209 public bool is_number ();
210 public bool is_object ();
211 public bool is_string ();
212 public bool is_undefined ();
213 [CCode (has_construct_function = false)]
214 public Value.@null (JSC.Context context);
215 [CCode (has_construct_function = false)]
216 public Value.number (JSC.Context context, double number);
217 [CCode (has_construct_function = false)]
218 public Value.object (JSC.Context context, void* instance, JSC.Class? jsc_class);
219 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);
220 public void object_define_property_data (global::string property_name, JSC.ValuePropertyFlags flags, JSC.Value? property_value);
221 public bool object_delete_property (global::string name);
222 [CCode (array_length = false, array_null_terminated = true)]
223 public global::string[]? object_enumerate_properties ();
224 public JSC.Value object_get_property (global::string name);
225 public JSC.Value object_get_property_at_index (uint index);
226 public bool object_has_property (global::string name);
227 public bool object_is_instance_of (global::string name);
228 public void object_set_property (global::string name, JSC.Value property);
229 public void object_set_property_at_index (uint index, JSC.Value property);
230 [CCode (has_construct_function = false)]
231 public Value.string (JSC.Context context, global::string? string);
232 [CCode (has_construct_function = false)]
233 public Value.string_from_bytes (JSC.Context context, GLib.Bytes? bytes);
234 public bool to_boolean ();
235 public double to_double ();
236 public int32 to_int32 ();
237 public global::string to_string ();
238 public GLib.Bytes to_string_as_bytes ();
239 [CCode (has_construct_function = false)]
240 public Value.undefined (JSC.Context context);
241 public JSC.Context context { get; construct; }
243 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_virtual_machine_get_type ()")]
244 public class VirtualMachine : GLib.Object {
245 [CCode (has_construct_function = false)]
246 public VirtualMachine ();
248 [CCode (cheader_filename = "jsc/jsc.h", type_id = "jsc_weak_value_get_type ()")]
249 public class WeakValue : GLib.Object {
250 [CCode (has_construct_function = false)]
251 public WeakValue (JSC.Value value);
252 public JSC.Value get_value ();
254 public JSC.Value value { construct; }
255 public signal void cleared ();
257 [CCode (cheader_filename = "jsc/jsc.h", has_type_id = false)]
258 public struct ClassVTable {
259 public weak JSC.ClassGetPropertyFunction get_property;
260 public weak JSC.ClassSetPropertyFunction set_property;
261 public weak JSC.ClassHasPropertyFunction has_property;
262 public weak JSC.ClassDeletePropertyFunction delete_property;
263 public weak JSC.ClassEnumeratePropertiesFunction enumerate_properties;
265 [CCode (cheader_filename = "jsc/jsc.h", cprefix = "JSC_VALUE_PROPERTY_", has_type_id = false)]
267 public enum ValuePropertyFlags {
272 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
273 public delegate bool ClassDeletePropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
274 [CCode (array_length = false, array_null_terminated = true, cheader_filename = "jsc/jsc.h", has_target = false)]
275 public delegate string[]? ClassEnumeratePropertiesFunction (JSC.Class jsc_class, JSC.Context context, void* instance);
276 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
277 public delegate JSC.Value? ClassGetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
278 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
279 public delegate bool ClassHasPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name);
280 [CCode (cheader_filename = "jsc/jsc.h", has_target = false)]
281 public delegate bool ClassSetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name, JSC.Value value);
282 [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 2.9)]
283 public delegate void ExceptionHandler (JSC.Context context, JSC.Exception exception);
284 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MAJOR_VERSION")]
285 public const int MAJOR_VERSION;
286 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MICRO_VERSION")]
287 public const int MICRO_VERSION;
288 [CCode (cheader_filename = "jsc/jsc.h", cname = "JSC_MINOR_VERSION")]
289 public const int MINOR_VERSION;
290 [CCode (cheader_filename = "jsc/jsc.h")]
291 public static uint get_major_version ();
292 [CCode (cheader_filename = "jsc/jsc.h")]
293 public static uint get_micro_version ();
294 [CCode (cheader_filename = "jsc/jsc.h")]
295 public static uint get_minor_version ();