1 module javascriptcore.c.functions;
2 
3 import std.stdio;
4 import javascriptcore.c.types;
5 version (Windows)
6 	static immutable LIBRARY_JAVASCRIPTCORE = ["libjavascriptcoregtk-4.0-18.dll;javascriptcoregtk-4.0-18.dll;javascriptcoregtk-4.dll"];
7 else version (OSX)
8 	static immutable LIBRARY_JAVASCRIPTCORE = ["libjavascriptcoregtk-4.0.18.dylib"];
9 else
10 	static immutable LIBRARY_JAVASCRIPTCORE = ["libjavascriptcoregtk-4.0.so.18"];
11 
12 __gshared extern(C)
13 {
14 
15 	// javascriptcore.Class
16 
17 	GType jsc_class_get_type();
18 	JSCValue* jsc_class_add_constructor(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParams, ... );
19 	JSCValue* jsc_class_add_constructor_variadic(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType);
20 	JSCValue* jsc_class_add_constructorv(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParameters, GType* parameterTypes);
21 	void jsc_class_add_method(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParams, ... );
22 	void jsc_class_add_method_variadic(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType);
23 	void jsc_class_add_methodv(JSCClass* jscClass, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParameters, GType* parameterTypes);
24 	void jsc_class_add_property(JSCClass* jscClass, const(char)* name, GType propertyType, GCallback getter, GCallback setter, void* userData, GDestroyNotify destroyNotify);
25 	const(char)* jsc_class_get_name(JSCClass* jscClass);
26 	JSCClass* jsc_class_get_parent(JSCClass* jscClass);
27 
28 	// javascriptcore.Context
29 
30 	GType jsc_context_get_type();
31 	JSCContext* jsc_context_new();
32 	JSCContext* jsc_context_new_with_virtual_machine(JSCVirtualMachine* vm);
33 	JSCContext* jsc_context_get_current();
34 	JSCCheckSyntaxResult jsc_context_check_syntax(JSCContext* context, const(char)* code, ptrdiff_t length, JSCCheckSyntaxMode mode, const(char)* uri, uint lineNumber, JSCException** exception);
35 	void jsc_context_clear_exception(JSCContext* context);
36 	JSCValue* jsc_context_evaluate(JSCContext* context, const(char)* code, ptrdiff_t length);
37 	JSCValue* jsc_context_evaluate_in_object(JSCContext* context, const(char)* code, ptrdiff_t length, void* objectInstance, JSCClass* objectClass, const(char)* uri, uint lineNumber, JSCValue** object);
38 	JSCValue* jsc_context_evaluate_with_source_uri(JSCContext* context, const(char)* code, ptrdiff_t length, const(char)* uri, uint lineNumber);
39 	JSCException* jsc_context_get_exception(JSCContext* context);
40 	JSCValue* jsc_context_get_global_object(JSCContext* context);
41 	JSCValue* jsc_context_get_value(JSCContext* context, const(char)* name);
42 	JSCVirtualMachine* jsc_context_get_virtual_machine(JSCContext* context);
43 	void jsc_context_pop_exception_handler(JSCContext* context);
44 	void jsc_context_push_exception_handler(JSCContext* context, JSCExceptionHandler handler, void* userData, GDestroyNotify destroyNotify);
45 	JSCClass* jsc_context_register_class(JSCContext* context, const(char)* name, JSCClass* parentClass, JSCClassVTable* vtable, GDestroyNotify destroyNotify);
46 	void jsc_context_set_value(JSCContext* context, const(char)* name, JSCValue* value);
47 	void jsc_context_throw(JSCContext* context, const(char)* errorMessage);
48 	void jsc_context_throw_exception(JSCContext* context, JSCException* exception);
49 	void jsc_context_throw_printf(JSCContext* context, const(char)* format, ... );
50 	void jsc_context_throw_with_name(JSCContext* context, const(char)* errorName, const(char)* errorMessage);
51 	void jsc_context_throw_with_name_printf(JSCContext* context, const(char)* errorName, const(char)* format, ... );
52 
53 	// javascriptcore.Exception
54 
55 	GType jsc_exception_get_type();
56 	JSCException* jsc_exception_new(JSCContext* context, const(char)* message);
57 	JSCException* jsc_exception_new_printf(JSCContext* context, const(char)* format, ... );
58 	JSCException* jsc_exception_new_vprintf(JSCContext* context, const(char)* format, void* args);
59 	JSCException* jsc_exception_new_with_name(JSCContext* context, const(char)* name, const(char)* message);
60 	JSCException* jsc_exception_new_with_name_printf(JSCContext* context, const(char)* name, const(char)* format, ... );
61 	JSCException* jsc_exception_new_with_name_vprintf(JSCContext* context, const(char)* name, const(char)* format, void* args);
62 	const(char)* jsc_exception_get_backtrace_string(JSCException* exception);
63 	uint jsc_exception_get_column_number(JSCException* exception);
64 	uint jsc_exception_get_line_number(JSCException* exception);
65 	const(char)* jsc_exception_get_message(JSCException* exception);
66 	const(char)* jsc_exception_get_name(JSCException* exception);
67 	const(char)* jsc_exception_get_source_uri(JSCException* exception);
68 	char* jsc_exception_report(JSCException* exception);
69 	char* jsc_exception_to_string(JSCException* exception);
70 
71 	// javascriptcore.Value
72 
73 	GType jsc_value_get_type();
74 	JSCValue* jsc_value_new_array(JSCContext* context, GType firstItemType, ... );
75 	JSCValue* jsc_value_new_array_from_garray(JSCContext* context, GPtrArray* array);
76 	JSCValue* jsc_value_new_array_from_strv(JSCContext* context, char** strv);
77 	JSCValue* jsc_value_new_boolean(JSCContext* context, int value);
78 	JSCValue* jsc_value_new_from_json(JSCContext* context, const(char)* json);
79 	JSCValue* jsc_value_new_function(JSCContext* context, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParams, ... );
80 	JSCValue* jsc_value_new_function_variadic(JSCContext* context, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType);
81 	JSCValue* jsc_value_new_functionv(JSCContext* context, const(char)* name, GCallback callback, void* userData, GDestroyNotify destroyNotify, GType returnType, uint nParameters, GType* parameterTypes);
82 	JSCValue* jsc_value_new_null(JSCContext* context);
83 	JSCValue* jsc_value_new_number(JSCContext* context, double number);
84 	JSCValue* jsc_value_new_object(JSCContext* context, void* instance_, JSCClass* jscClass);
85 	JSCValue* jsc_value_new_string(JSCContext* context, const(char)* string_);
86 	JSCValue* jsc_value_new_string_from_bytes(JSCContext* context, GBytes* bytes);
87 	JSCValue* jsc_value_new_undefined(JSCContext* context);
88 	JSCValue* jsc_value_constructor_call(JSCValue* value, GType firstParameterType, ... );
89 	JSCValue* jsc_value_constructor_callv(JSCValue* value, uint nParameters, JSCValue** parameters);
90 	JSCValue* jsc_value_function_call(JSCValue* value, GType firstParameterType, ... );
91 	JSCValue* jsc_value_function_callv(JSCValue* value, uint nParameters, JSCValue** parameters);
92 	JSCContext* jsc_value_get_context(JSCValue* value);
93 	int jsc_value_is_array(JSCValue* value);
94 	int jsc_value_is_boolean(JSCValue* value);
95 	int jsc_value_is_constructor(JSCValue* value);
96 	int jsc_value_is_function(JSCValue* value);
97 	int jsc_value_is_null(JSCValue* value);
98 	int jsc_value_is_number(JSCValue* value);
99 	int jsc_value_is_object(JSCValue* value);
100 	int jsc_value_is_string(JSCValue* value);
101 	int jsc_value_is_undefined(JSCValue* value);
102 	void jsc_value_object_define_property_accessor(JSCValue* value, const(char)* propertyName, JSCValuePropertyFlags flags, GType propertyType, GCallback getter, GCallback setter, void* userData, GDestroyNotify destroyNotify);
103 	void jsc_value_object_define_property_data(JSCValue* value, const(char)* propertyName, JSCValuePropertyFlags flags, JSCValue* propertyValue);
104 	int jsc_value_object_delete_property(JSCValue* value, const(char)* name);
105 	char** jsc_value_object_enumerate_properties(JSCValue* value);
106 	JSCValue* jsc_value_object_get_property(JSCValue* value, const(char)* name);
107 	JSCValue* jsc_value_object_get_property_at_index(JSCValue* value, uint index);
108 	int jsc_value_object_has_property(JSCValue* value, const(char)* name);
109 	JSCValue* jsc_value_object_invoke_method(JSCValue* value, const(char)* name, GType firstParameterType, ... );
110 	JSCValue* jsc_value_object_invoke_methodv(JSCValue* value, const(char)* name, uint nParameters, JSCValue** parameters);
111 	int jsc_value_object_is_instance_of(JSCValue* value, const(char)* name);
112 	void jsc_value_object_set_property(JSCValue* value, const(char)* name, JSCValue* property);
113 	void jsc_value_object_set_property_at_index(JSCValue* value, uint index, JSCValue* property);
114 	int jsc_value_to_boolean(JSCValue* value);
115 	double jsc_value_to_double(JSCValue* value);
116 	int jsc_value_to_int32(JSCValue* value);
117 	char* jsc_value_to_json(JSCValue* value, uint indent);
118 	char* jsc_value_to_string(JSCValue* value);
119 	GBytes* jsc_value_to_string_as_bytes(JSCValue* value);
120 
121 	// javascriptcore.VirtualMachine
122 
123 	GType jsc_virtual_machine_get_type();
124 	JSCVirtualMachine* jsc_virtual_machine_new();
125 
126 	// javascriptcore.WeakValue
127 
128 	GType jsc_weak_value_get_type();
129 	JSCWeakValue* jsc_weak_value_new(JSCValue* value);
130 	JSCValue* jsc_weak_value_get_value(JSCWeakValue* weakValue);
131 }