1 module javascriptcore.c.types;
2 
3 public import glib.c.types;
4 public import gobject.c.types;
5 
6 alias JSGlobalContextRef = void*;
7 alias JSValueRef         = void*;
8 /**
9  * Enum values to specify a mode to check for syntax errors in jsc_context_check_syntax().
10  */
11 public enum JSCCheckSyntaxMode
12 {
13 	/**
14 	 * mode to check syntax of a script
15 	 */
16 	SCRIPT = 0,
17 	/**
18 	 * mode to check syntax of a module
19 	 */
20 	MODULE = 1,
21 }
22 alias JSCCheckSyntaxMode CheckSyntaxMode;
23 
24 /**
25  * Enum values to specify the result of jsc_context_check_syntax().
26  */
27 public enum JSCCheckSyntaxResult
28 {
29 	/**
30 	 * no errors
31 	 */
32 	SUCCESS = 0,
33 	/**
34 	 * recoverable syntax error
35 	 */
36 	RECOVERABLE_ERROR = 1,
37 	/**
38 	 * irrecoverable syntax error
39 	 */
40 	IRRECOVERABLE_ERROR = 2,
41 	/**
42 	 * unterminated literal error
43 	 */
44 	UNTERMINATED_LITERAL_ERROR = 3,
45 	/**
46 	 * out of memory error
47 	 */
48 	OUT_OF_MEMORY_ERROR = 4,
49 	/**
50 	 * stack overflow error
51 	 */
52 	STACK_OVERFLOW_ERROR = 5,
53 }
54 alias JSCCheckSyntaxResult CheckSyntaxResult;
55 
56 /**
57  * Enum values for options types.
58  *
59  * Since: 2.24
60  */
61 public enum JSCOptionType
62 {
63 	/**
64 	 * A #gboolean option type.
65 	 */
66 	BOOLEAN = 0,
67 	/**
68 	 * A #gint option type.
69 	 */
70 	INT = 1,
71 	/**
72 	 * A #guint option type.
73 	 */
74 	UINT = 2,
75 	/**
76 	 * A #gsize options type.
77 	 */
78 	SIZE = 3,
79 	/**
80 	 * A #gdouble options type.
81 	 */
82 	DOUBLE = 4,
83 	/**
84 	 * A string option type.
85 	 */
86 	STRING = 5,
87 	/**
88 	 * A range string option type.
89 	 */
90 	RANGE_STRING = 6,
91 }
92 alias JSCOptionType OptionType;
93 
94 /**
95  * Flags used when defining properties with jsc_value_object_define_property_data() and
96  * jsc_value_object_define_property_accessor().
97  */
98 public enum JSCValuePropertyFlags
99 {
100 	/**
101 	 * the type of the property descriptor may be changed and the
102 	 * property may be deleted from the corresponding object.
103 	 */
104 	CONFIGURABLE = 1,
105 	/**
106 	 * the property shows up during enumeration of the properties on
107 	 * the corresponding object.
108 	 */
109 	ENUMERABLE = 2,
110 	/**
111 	 * the value associated with the property may be changed with an
112 	 * assignment operator. This doesn't have any effect when passed to jsc_value_object_define_property_accessor().
113 	 */
114 	WRITABLE = 4,
115 }
116 alias JSCValuePropertyFlags ValuePropertyFlags;
117 
118 struct JSCClass;
119 
120 struct JSCClassClass;
121 
122 /**
123  * Virtual table for a JSCClass. This can be optionally used when registering a #JSCClass in a #JSCContext
124  * to provide a custom implementation for the class. All virtual functions are optional and can be set to
125  * %NULL to fallback to the default implementation.
126  */
127 struct JSCClassVTable
128 {
129 	/**
130 	 * a #JSCClassGetPropertyFunction for getting a property.
131 	 */
132 	JSCClassGetPropertyFunction getProperty;
133 	/**
134 	 * a #JSCClassSetPropertyFunction for setting a property.
135 	 */
136 	JSCClassSetPropertyFunction setProperty;
137 	/**
138 	 * a #JSCClassHasPropertyFunction for querying a property.
139 	 */
140 	JSCClassHasPropertyFunction hasProperty;
141 	/**
142 	 * a #JSCClassDeletePropertyFunction for deleting a property.
143 	 */
144 	JSCClassDeletePropertyFunction deleteProperty;
145 	/**
146 	 * a #JSCClassEnumeratePropertiesFunction for enumerating properties.
147 	 */
148 	JSCClassEnumeratePropertiesFunction enumerateProperties;
149 	/** */
150 	extern(C) void function() JscReserved0;
151 	/** */
152 	extern(C) void function() JscReserved1;
153 	/** */
154 	extern(C) void function() JscReserved2;
155 	/** */
156 	extern(C) void function() JscReserved3;
157 }
158 
159 struct JSCContext
160 {
161 	GObject parent;
162 	JSCContextPrivate* priv;
163 }
164 
165 struct JSCContextClass
166 {
167 	GObjectClass parentClass;
168 	/** */
169 	extern(C) void function() JscReserved0;
170 	/** */
171 	extern(C) void function() JscReserved1;
172 	/** */
173 	extern(C) void function() JscReserved2;
174 	/** */
175 	extern(C) void function() JscReserved3;
176 }
177 
178 struct JSCContextPrivate;
179 
180 struct JSCException
181 {
182 	GObject parent;
183 	JSCExceptionPrivate* priv;
184 }
185 
186 struct JSCExceptionClass
187 {
188 	GObjectClass parentClass;
189 	/** */
190 	extern(C) void function() JscReserved0;
191 	/** */
192 	extern(C) void function() JscReserved1;
193 	/** */
194 	extern(C) void function() JscReserved2;
195 	/** */
196 	extern(C) void function() JscReserved3;
197 }
198 
199 struct JSCExceptionPrivate;
200 
201 struct JSCValue
202 {
203 	GObject parent;
204 	JSCValuePrivate* priv;
205 }
206 
207 struct JSCValueClass
208 {
209 	GObjectClass parentClass;
210 	/** */
211 	extern(C) void function() JscReserved0;
212 	/** */
213 	extern(C) void function() JscReserved1;
214 	/** */
215 	extern(C) void function() JscReserved2;
216 	/** */
217 	extern(C) void function() JscReserved3;
218 }
219 
220 struct JSCValuePrivate;
221 
222 struct JSCVirtualMachine
223 {
224 	GObject parent;
225 	JSCVirtualMachinePrivate* priv;
226 }
227 
228 struct JSCVirtualMachineClass
229 {
230 	GObjectClass parentClass;
231 	/** */
232 	extern(C) void function() JscReserved0;
233 	/** */
234 	extern(C) void function() JscReserved1;
235 	/** */
236 	extern(C) void function() JscReserved2;
237 	/** */
238 	extern(C) void function() JscReserved3;
239 }
240 
241 struct JSCVirtualMachinePrivate;
242 
243 struct JSCWeakValue
244 {
245 	GObject parent;
246 	JSCWeakValuePrivate* priv;
247 }
248 
249 struct JSCWeakValueClass
250 {
251 	GObjectClass parentClass;
252 	/** */
253 	extern(C) void function() JscReserved0;
254 	/** */
255 	extern(C) void function() JscReserved1;
256 	/** */
257 	extern(C) void function() JscReserved2;
258 	/** */
259 	extern(C) void function() JscReserved3;
260 }
261 
262 struct JSCWeakValuePrivate;
263 
264 /**
265  * The type of delete_property in #JSCClassVTable. This is only required when you need to handle
266  * external properties not added to the prototype.
267  *
268  * Params:
269  *     jscClass = a #JSCClass
270  *     context = a #JSCContext
271  *     instance_ = the @jsc_class instance
272  *     name = the property name
273  *
274  * Returns: %TRUE if handled or %FALSE to to forward the request to the parent class or prototype chain.
275  */
276 public alias extern(C) int function(JSCClass* jscClass, JSCContext* context, void* instance_, const(char)* name) JSCClassDeletePropertyFunction;
277 
278 /**
279  * The type of enumerate_properties in #JSCClassVTable. This is only required when you need to handle
280  * external properties not added to the prototype.
281  *
282  * Params:
283  *     jscClass = a #JSCClass
284  *     context = a #JSCContext
285  *     instance_ = the @jsc_class instance
286  *
287  * Returns: a %NULL-terminated array of strings
288  *     containing the property names, or %NULL if @instance doesn't have enumerable properties.
289  */
290 public alias extern(C) char** function(JSCClass* jscClass, JSCContext* context, void* instance_) JSCClassEnumeratePropertiesFunction;
291 
292 /**
293  * The type of get_property in #JSCClassVTable. This is only required when you need to handle
294  * external properties not added to the prototype.
295  *
296  * Params:
297  *     jscClass = a #JSCClass
298  *     context = a #JSCContext
299  *     instance_ = the @jsc_class instance
300  *     name = the property name
301  *
302  * Returns: a #JSCValue or %NULL to forward the request to
303  *     the parent class or prototype chain
304  */
305 public alias extern(C) JSCValue* function(JSCClass* jscClass, JSCContext* context, void* instance_, const(char)* name) JSCClassGetPropertyFunction;
306 
307 /**
308  * The type of has_property in #JSCClassVTable. This is only required when you need to handle
309  * external properties not added to the prototype.
310  *
311  * Params:
312  *     jscClass = a #JSCClass
313  *     context = a #JSCContext
314  *     instance_ = the @jsc_class instance
315  *     name = the property name
316  *
317  * Returns: %TRUE if @instance has a property with @name or %FALSE to forward the request
318  *     to the parent class or prototype chain.
319  */
320 public alias extern(C) int function(JSCClass* jscClass, JSCContext* context, void* instance_, const(char)* name) JSCClassHasPropertyFunction;
321 
322 /**
323  * The type of set_property in #JSCClassVTable. This is only required when you need to handle
324  * external properties not added to the prototype.
325  *
326  * Params:
327  *     jscClass = a #JSCClass
328  *     context = a #JSCContext
329  *     instance_ = the @jsc_class instance
330  *     name = the property name
331  *     value = the #JSCValue to set
332  *
333  * Returns: %TRUE if handled or %FALSE to forward the request to the parent class or prototype chain.
334  */
335 public alias extern(C) int function(JSCClass* jscClass, JSCContext* context, void* instance_, const(char)* name, JSCValue* value) JSCClassSetPropertyFunction;
336 
337 /**
338  * Function used to handle JavaScript exceptions in a #JSCContext.
339  *
340  * Params:
341  *     context = a #JSCContext
342  *     exception = a #JSCException
343  *     userData = user data
344  */
345 public alias extern(C) void function(JSCContext* context, JSCException* exception, void* userData) JSCExceptionHandler;
346 
347 /**
348  * Function used to iterate options.
349  *
350  * Not that @description string is not localized.
351  *
352  * Params:
353  *     option = the option name
354  *     type = the option #JSCOptionType
355  *     description = the option description, or %NULL
356  *     userData = user data
357  *
358  * Returns: %TRUE to stop the iteration, or %FALSE otherwise
359  *
360  * Since: 2.24
361  */
362 public alias extern(C) int function(const(char)* option, JSCOptionType type, const(char)* description, void* userData) JSCOptionsFunc;
363 
364 /**
365  * Like jsc_get_major_version(), but from the headers used at
366  * application compile time, rather than from the library linked
367  * against at application run time.
368  */
369 enum MAJOR_VERSION = 2;
370 alias JSC_MAJOR_VERSION = MAJOR_VERSION;
371 
372 /**
373  * Like jsc_get_micro_version(), but from the headers used at
374  * application compile time, rather than from the library linked
375  * against at application run time.
376  */
377 enum MICRO_VERSION = 1;
378 alias JSC_MICRO_VERSION = MICRO_VERSION;
379 
380 /**
381  * Like jsc_get_minor_version(), but from the headers used at
382  * application compile time, rather than from the library linked
383  * against at application run time.
384  */
385 enum MINOR_VERSION = 30;
386 alias JSC_MINOR_VERSION = MINOR_VERSION;
387 
388 /**
389  * Allows the DFG JIT to be used if %TRUE.
390  * Option type: %JSC_OPTION_BOOLEAN
391  * Default value: %TRUE.
392  */
393 enum OPTIONS_USE_DFG = "useDFGJIT";
394 alias JSC_OPTIONS_USE_DFG = OPTIONS_USE_DFG;
395 
396 /**
397  * Allows the FTL JIT to be used if %TRUE.
398  * Option type: %JSC_OPTION_BOOLEAN
399  * Default value: %TRUE.
400  */
401 enum OPTIONS_USE_FTL = "useFTLJIT";
402 alias JSC_OPTIONS_USE_FTL = OPTIONS_USE_FTL;
403 
404 /**
405  * Allows the executable pages to be allocated for JIT and thunks if %TRUE.
406  * Option type: %JSC_OPTION_BOOLEAN
407  * Default value: %TRUE.
408  */
409 enum OPTIONS_USE_JIT = "useJIT";
410 alias JSC_OPTIONS_USE_JIT = OPTIONS_USE_JIT;
411 
412 /**
413  * Allows the LLINT to be used if %TRUE.
414  * Option type: %JSC_OPTION_BOOLEAN
415  * Default value: %TRUE.
416  */
417 enum OPTIONS_USE_LLINT = "useLLInt";
418 alias JSC_OPTIONS_USE_LLINT = OPTIONS_USE_LLINT;